fix
authorJari Jarvi <t7jaja00@students.oamk.fi>
Mon, 21 Jun 2010 08:32:23 +0000 (11:32 +0300)
committerJari Jarvi <t7jaja00@students.oamk.fi>
Mon, 21 Jun 2010 08:32:23 +0000 (11:32 +0300)
src/mainwidget.cpp
src/remote.cpp
src/settingsdlg.cpp

index 3c9207b..fe4eff2 100644 (file)
@@ -35,9 +35,6 @@ MainWidget::MainWidget (QWidget *parent)
         layout->addWidget(button, i%2, i/2);
     }
 
-    connect(buttons[0], SIGNAL(clicked()),
-            this, SLOT(sendCmdClicked(IRemote::VOLUMEUP)));
-   
     this->setContentsMargins(0, 0, 0, 0);
     layout->setContentsMargins(0, 0, 0, 0);
     this->setLayout(layout);
@@ -45,7 +42,6 @@ MainWidget::MainWidget (QWidget *parent)
     this->setAttribute(Qt::WA_OpaquePaintEvent);
     resize();
 
-
     showSettingsDialog();
 }
 
index 5c252e0..c9cf83b 100644 (file)
@@ -11,6 +11,9 @@
 
 Remote::Remote(const QString &name)
     : m_name(name)
+    , m_mfg("")
+    , m_rating(0)
+    , m_voteCount(0)
 {
     init();
     updateInfo();
@@ -25,7 +28,8 @@ Remote::Remote(const QString &name, const QString &mfg,
 }
 
 Remote::Remote(const Remote &r)
-    : m_name(r.m_name)
+    : QObject()
+    , m_name(r.m_name)
     , m_mfg(r.m_mfg)
     , m_rating(r.m_rating)
     , m_voteCount(r.m_voteCount)
index 39a21d5..19d78aa 100644 (file)
@@ -58,27 +58,15 @@ SettingsDlg::SettingsDlg(QWidget *parent)
     connect(rateDownBtn, SIGNAL(clicked()),
             this, SLOT(rateDownClicked()));
  
-    QString selectedRemote = settings.value("remoteName", "").toString();
-    if (selectedRemote == "")
-    {
-        remoteNameLabel->setText(tr("No remote selected"));
-        enableRateBtns(false);
-    }
-    else
-    {
-        changeRemote();
-    }
-
     layout->addLayout(remoteNameLayout);
     layout->addLayout(btnLayout);
     this->setLayout(layout);
+
+    changeRemote();
 }
 
 SettingsDlg::~SettingsDlg()
 {
-    delete layout;
-    delete btnLayout;
-    delete remoteNameLayout;
     delete advSettingsBtn;
     delete selectRemoteBtn;
     delete rateUpBtn;
@@ -86,8 +74,10 @@ SettingsDlg::~SettingsDlg()
     delete aboutBtn;
     delete remoteNameLabel;
     delete ratingLabel;
-    if (remote)
-    {
+    delete btnLayout;
+    delete remoteNameLayout;
+    delete layout;
+    if (remote) {
         delete remote;
     }
 }
@@ -113,15 +103,20 @@ void SettingsDlg::showAboutDlg()
 
 void SettingsDlg::changeRemote()
 {
-    if (remote)
-    {
-        delete remote;
+    QString selectedRemote = settings.value("remoteName", "").toString();
+    if (selectedRemote == "") {
+        remoteNameLabel->setText("No remote selected");
+        enableRateBtns(false);
+    } else {
+        if (remote) {
+            delete remote;
+        }
+        remote = new Remote(selectedRemote);
+        connect(remote, SIGNAL(infoUpdated()),
+                this, SLOT(updateRemoteInfo()));
+        remote->updateInfo();
+        enableRateBtns();
     }
-    remote = new Remote(settings.value("remoteName", "").toString());
-    connect(remote, SIGNAL(infoUpdated()),
-            this, SLOT(updateRemoteInfo()));
-    remote->updateInfo();
-    enableRateBtns();
 }
 
 void SettingsDlg::updateRemoteInfo()