]> git.sur5r.net Git - minitube/blobdiff - src/updatechecker.cpp
Imported Upstream version 2.0
[minitube] / src / updatechecker.cpp
index f8d381d2ecca99d7ecdfcaa182281a1e20bd0a81..fc794d31d874ea848c8da801216e730d673442d9 100644 (file)
@@ -1,6 +1,9 @@
 #include "updatechecker.h"
 #include "networkaccess.h"
 #include "constants.h"
+#ifdef APP_ACTIVATION
+#include "activation.h"
+#endif
 
 namespace The {
     NetworkAccess* http();
@@ -12,7 +15,22 @@ UpdateChecker::UpdateChecker() {
 
 void UpdateChecker::checkForUpdate() {
     QUrl updateUrl(QString(Constants::WEBSITE) + "-ws/release.xml");
-    // QUrl updateUrl("http://flavio.tordini.org:8012/release.xml");
+    updateUrl.addQueryItem("v", Constants::VERSION);
+
+#ifdef APP_MAC
+    updateUrl.addQueryItem("os", "mac");
+#endif
+#ifdef APP_WIN
+    updateUrl.addQueryItem("os", "win");
+#endif
+#ifdef APP_ACTIVATION
+    QString t = "demo";
+    if (Activation::instance().isActivated()) t = "active";
+    updateUrl.addQueryItem("t", t);
+#endif
+#ifdef APP_MAC_STORE
+    updateUrl.addQueryItem("store", "mac");
+#endif
 
     QObject *reply = The::http()->get(updateUrl);
     connect(reply, SIGNAL(data(QByteArray)), SLOT(requestFinished(QByteArray)));
@@ -39,10 +57,10 @@ bool UpdateCheckerStreamReader::read(QByteArray data) {
     while (!atEnd()) {
         readNext();
         if (isStartElement()) {
-            if (name() == "release") {
+            if (name() == QLatin1String("release")) {
                 while (!atEnd()) {
                     readNext();
-                    if (isStartElement() && name() == "version") {
+                    if (isStartElement() && name() == QLatin1String("version")) {
                         QString remoteVersion = readElementText();
                         qDebug() << remoteVersion << QString(Constants::VERSION);
                         m_needUpdate = remoteVersion != QString(Constants::VERSION);