Rating is now updated immediately after pressing rating buttons
authorJari Jarvi <t7jaja00@students.oamk.fi>
Tue, 6 Jul 2010 10:42:50 +0000 (13:42 +0300)
committerJari Jarvi <t7jaja00@students.oamk.fi>
Tue, 6 Jul 2010 10:42:50 +0000 (13:42 +0300)
src/remote.cpp
src/remote.h
src/settingsdlg.cpp

index f94dbf0..967a99c 100644 (file)
@@ -110,6 +110,9 @@ void Remote::sendRating(Rating::Rating r)
     if (!m_name.isEmpty()) {
         if (!m_ratingNAM) {
             m_ratingNAM = new QNetworkAccessManager(this);
+            connect(m_ratingNAM, SIGNAL(finished(QNetworkReply *)),
+                    this, SIGNAL(ratingSent()));
+            connect(this, SIGNAL(ratingSent()), this, SLOT(updateInfo()));
         }
         QSettings settings(this);
         m_ratingNAM->get(QNetworkRequest(QUrl(
index 3f21cee..b59a495 100644 (file)
@@ -41,6 +41,7 @@ private slots:
 signals:
     void infoUpdated();
     void saveFinished();
+    void ratingSent();
 
 private:
     QString m_name;
index 6100100..753edcf 100644 (file)
@@ -71,9 +71,9 @@ SettingsDlg::SettingsDlg(QWidget *parent)
     } else {
         // Create remote by name and update it's info if online
         m_remote = Remote(selectedRemote);
-        m_remoteNameLabel->setText(selectedRemote);
         connect(&m_remote, SIGNAL(infoUpdated()),
-            this, SLOT(updateRemoteInfo()));
+                this, SLOT(updateRemoteInfo()));
+        m_remoteNameLabel->setText(selectedRemote);
         m_netConfMan = new QTM_PREPEND_NAMESPACE(
                 QNetworkConfigurationManager)(this);
         connect(m_netConfMan, SIGNAL(updateCompleted()),
@@ -155,21 +155,20 @@ void SettingsDlg::updateRemoteInfo()
 
 void SettingsDlg::rateUpClicked()
 {
-    m_remote.sendRating(Rating::Up);
     processRatingSent();
+    m_remote.sendRating(Rating::Up);
 }
 
 void SettingsDlg::rateDownClicked()
 {
-    m_remote.sendRating(Rating::Down);
     processRatingSent();
+    m_remote.sendRating(Rating::Down);
 }
 
 void SettingsDlg::processRatingSent()
 {
     setBusy();
     enableRateBtns(false);
-    m_remote.updateInfo();
 }
 
 void SettingsDlg::enableRateBtns(bool enable)