Page MenuHomePhabricator (Chris)

No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
diff --git a/updater/updater.cpp b/updater/updater.cpp
index ee8a906..bb485fa 100644
--- a/updater/updater.cpp
+++ b/updater/updater.cpp
@@ -1,62 +1,64 @@
/*
* Copyright (C) 2016 Christian Kaiser
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <QApplication>
#include <QDate>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
-
+#include <QVersionNumber>
#include "updater.h"
#include "../dialogs/updaterdialog.cpp"
Updater::Updater(QObject *parent) :
QObject(parent)
{
connect(&mNetwork, SIGNAL(finished(QNetworkReply *)), this, SLOT(finished(QNetworkReply *)));
}
void Updater::check()
{
#ifdef Q_OS_WIN
QString platform = QString("Windows_%1").arg(QSysInfo::WindowsVersion);
#else
QString platform = QSysInfo::productType();
#endif
QNetworkRequest request(QUrl::fromUserInput("https://lightscreen.com.ar/version?from=" + qApp->applicationVersion() + "&platform=" + platform));
mNetwork.get(request);
}
void Updater::checkWithFeedback()
{
UpdaterDialog updaterDialog;
connect(this, &Updater::done, &updaterDialog, &UpdaterDialog::updateDone);
check();
updaterDialog.exec();
}
void Updater::finished(QNetworkReply *reply)
{
QByteArray data = reply->readAll();
- double version = QString(data).toDouble();
- emit done((version > qApp->applicationVersion().toDouble()));
+ auto currentVersion = QVersionNumber::fromString(qApp->applicationVersion()).normalized();
+ auto remoteVersion = QVersionNumber::fromString(QString(data)).normalized();
+
+ emit done(remoteVersion > currentVersion);
}
diff --git a/version.pri b/version.pri
index 46ee5d6..43f03b6 100644
--- a/version.pri
+++ b/version.pri
@@ -1,7 +1,7 @@
-VERSION = 2.3
+VERSION = 2.4
QMAKE_TARGET_COMPANY = Christian Kaiser
QMAKE_TARGET_PRODUCT = Lightscreen
QMAKE_TARGET_DESCRIPTION = Lightscreen Screenshot Tool
QMAKE_TARGET_COPYRIGHT = Copyright (C) 2008-2016 Christian Kaiser
DEFINES += APP_VERSION=\\\"$$VERSION\\\"

File Metadata

Mime Type
text/x-diff
Expires
Sat, May 16, 7:13 AM (10 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
64074
Default Alt Text
(2 KB)

Event Timeline