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)
{ {
if (reply->error()) {
// TODO: handle me
} else {
QString newestVersion = QString(reply->readAll()); QString newestVersion = QString(reply->readAll());
if (!newestVersion.isEmpty()) if (!newestVersion.isEmpty()) {
{
QString currentVersion = getVersion(); QString currentVersion = getVersion();
if (currentVersion != "Unknown") { if (currentVersion != "Unknown") {
if (compareVersions(currentVersion, newestVersion) > 0) if (compareVersions(currentVersion, newestVersion) > 0)
emit updateFound(newestVersion); 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; }