Beautifying of codes
[situare] / src / ui / infotab.cpp
index da41c67..a3ab6a5 100644 (file)
 InfoTab::InfoTab(QWidget *parent)
     : QWidget(parent, Qt::FramelessWindowHint)
 {
-    m_layout = new QGridLayout(this);
-    m_userPicture = new QLabel;
-    m_userNameLabel = new QLabel;
-    m_messageLabel = new QLabel;
-    m_addressLabel = new QLabel;
-    m_timeLabel = new QLabel;
-    QLabel *m_clockLabel = new QLabel;
-    QLabel *m_envelopeLabel = new QLabel;
-    QLabel *m_compassLabel = new QLabel;
-    //QToolButton *updateFriendsButton = new QToolButton;
-    //QToolButton *updateStatusMessageButton = new QToolButton;
-    ButtonItem *updateFriendsButton = new ButtonItem();
-    ButtonItem *updateStatusMessageButton = new ButtonItem();
+    QWidget *widget = new QWidget(this);
+    QGridLayout *layout = new QGridLayout(widget);
+    m_userPicture = new QLabel(widget);
+    m_userNameLabel = new QLabel(widget);
+    m_messageLabel = new QLabel(widget);
+    m_addressLabel = new QLabel(widget);
+    m_timeLabel = new QLabel(widget);
+    QLabel *m_clockLabel = new QLabel(widget);
+    QLabel *m_envelopeLabel = new QLabel(widget);
+    QLabel *m_compassLabel = new QLabel(widget);
+    ButtonItem *updateFriendsButton = new ButtonItem(widget);
+    ButtonItem *updateStatusMessageButton = new ButtonItem(widget);
 
     updateFriendsButton->setIcon(QIcon(QPixmap(":/resources/reload_icon.png")));
     updateStatusMessageButton->setIcon(QIcon(QPixmap(":/resources/sendPosition_icon.png")));
@@ -45,43 +44,21 @@ InfoTab::InfoTab(QWidget *parent)
     m_clockLabel->setPixmap(QPixmap(":/resources/clock_small.png"));
     m_envelopeLabel->setPixmap(QPixmap(":/resources/list_small.png"));
     m_compassLabel->setPixmap(QPixmap(":/resources/compas_small.png"));
-    m_layout->addWidget(m_userPicture,0,0,4,1);
-    m_layout->addWidget(m_userNameLabel,0,2,1,2);
-    m_layout->addWidget(m_clockLabel,1,1,1,1);
-    m_layout->addWidget(m_envelopeLabel,2,1,1,1);
-    m_layout->addWidget(m_compassLabel,3,1,1,1);
-    m_layout->addWidget(m_timeLabel,1,2,1,1);
-    m_layout->addWidget(m_messageLabel,2,2,1,1);
-    m_layout->addWidget(m_addressLabel,3,2,1,1);
-    m_layout->addWidget(updateFriendsButton,0,3,2,1);
-    m_layout->addWidget(updateStatusMessageButton,1,3,2,1);
+    layout->addWidget(m_userPicture,0,0,4,1);
+    layout->addWidget(m_userNameLabel,0,2,1,2);
+    layout->addWidget(m_clockLabel,1,1,1,1);
+    layout->addWidget(m_envelopeLabel,2,1,1,1);
+    layout->addWidget(m_compassLabel,3,1,1,1);
+    layout->addWidget(m_timeLabel,1,2,1,1);
+    layout->addWidget(m_messageLabel,2,2,1,1);
+    layout->addWidget(m_addressLabel,3,2,1,1);
+    layout->addWidget(updateFriendsButton,0,3,1,1);
+    layout->addWidget(updateStatusMessageButton,2,3,1,1);
 
     connect(updateStatusMessageButton,SIGNAL(clicked()),this,SLOT(messageUpdate()));
     connect(updateFriendsButton,SIGNAL(clicked()),this,SLOT(updateFriendsStatus()));
 }
 
-InfoTab::~InfoTab()
-{
-    if (m_userPicture)
-        delete m_userPicture;
-    if (m_userNameLabel)
-        delete m_userNameLabel;
-    if (m_messageLabel)
-        delete m_messageLabel;
-    if (m_addressLabel)
-        delete m_addressLabel;
-    if (m_timeLabel)
-        delete m_timeLabel;
-    if (m_layout)
-        delete m_layout;
-    m_userPicture=NULL;
-    m_userNameLabel=NULL;
-    m_messageLabel=NULL;
-    m_addressLabel=NULL;
-    m_timeLabel=NULL;
-    m_layout=NULL;
-}
-
 void InfoTab::paintEvent(QPaintEvent *aPaintEvent)
 {
     //Look and feel settings