disable check for updated version since it was causing an access

violation on close and since there is nothing to check it against
anyway. will reimplement check for updated version in the future.
This commit is contained in:
walker0643 2018-01-29 22:49:50 -05:00
parent 31a64731c1
commit ecf4ebf50e
2 changed files with 24 additions and 21 deletions

View File

@ -25,37 +25,41 @@
#include <QLocale> #include <QLocale>
#define VERSION_REGEX "(\\d+\\.\\d+\\.\\d+)" #define VERSION_REGEX "(\\d+\\.\\d+\\.\\d+)"
#define VERSION_URL "http://symless.com/version/" //#define VERSION_URL "http://www.TODO.com/"
VersionChecker::VersionChecker() VersionChecker::VersionChecker(QObject* parent)
: QObject(parent)
{ {
m_manager = new QNetworkAccessManager(this);
connect(m_manager, SIGNAL(finished(QNetworkReply*)),
this, SLOT(replyFinished(QNetworkReply*)));
}
VersionChecker::~VersionChecker()
{
delete m_manager;
} }
void VersionChecker::checkLatest() void VersionChecker::checkLatest()
{ {
m_manager->get(QNetworkRequest(QUrl(VERSION_URL))); // calling m_manager->get(..) is causing an access violation on app close
// atm there is nothing to check the version against, so removing until we need a version checker again
//m_manager = new QNetworkAccessManager(this);
//connect(m_manager, SIGNAL(finished(QNetworkReply*)),
// this, SLOT(replyFinished(QNetworkReply*)));
//m_manager->get(QNetworkRequest(QUrl(VERSION_URL)));
} }
void VersionChecker::replyFinished(QNetworkReply* reply) void VersionChecker::replyFinished(QNetworkReply* reply)
{ {
QString newestVersion = QString(reply->readAll()); if (reply->error()) {
if (!newestVersion.isEmpty()) // TODO: handle me
{ } else {
QString currentVersion = getVersion(); QString newestVersion = QString(reply->readAll());
if (currentVersion != "Unknown") { if (!newestVersion.isEmpty()) {
if (compareVersions(currentVersion, newestVersion) > 0) QString currentVersion = getVersion();
emit updateFound(newestVersion); if (currentVersion != "Unknown") {
if (compareVersions(currentVersion, newestVersion) > 0)
emit updateFound(newestVersion);
}
} }
} }
reply->deleteLater();
} }
int VersionChecker::compareVersions(const QString& left, const QString& right) int VersionChecker::compareVersions(const QString& left, const QString& right)

View File

@ -28,8 +28,7 @@ class VersionChecker : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
VersionChecker(); explicit VersionChecker(QObject* parent = 0);
virtual ~VersionChecker();
void checkLatest(); void checkLatest();
QString getVersion(); QString getVersion();
void setApp(const QString& app) { m_app = app; } void setApp(const QString& app) { m_app = app; }