Website updated.
[irwi] / src / remote.cpp
index 1f41978..f87c6c0 100644 (file)
@@ -62,6 +62,14 @@ Remote &Remote::operator=(const Remote &other)
     return *this;
 }
 
+bool Remote::operator==(const Remote &other) const
+{
+    return (m_name == other.m_name &&
+            m_mfg == other.m_mfg &&
+            m_rating == other.m_rating &&
+            m_voteCount == other.m_voteCount);
+}
+
 void Remote::saveToFile()
 {
     if (!m_name.isEmpty()) {
@@ -77,6 +85,7 @@ void Remote::saveToFile()
             + m_name;
         m_remoteNAM->get(QNetworkRequest(QUrl(url)));
         settings.setValue("remoteName", m_name);
+        settings.setValue("remoteMfg", m_mfg);
     }
 }
 
@@ -102,6 +111,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(
@@ -137,7 +149,7 @@ void Remote::infoRequestFinished(QNetworkReply *reply)
     if (reply->error() == QNetworkReply::NoError) {
         m_rating    = QString(reply->readLine(20)).toInt();
         m_voteCount = QString(reply->readLine(20)).toInt();
-        m_mfg       = QString(reply->readLine(20));
+        m_mfg       = QString(reply->readLine(20)).trimmed();
     }
     reply->close();
     reply->deleteLater();