diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 3cf3463f83..ee9188a7d7 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -19,7 +19,7 @@ set(UVCCAMERACONTROL_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/UVCCameraCont if (DEFINED ENV{JOB_ID}) set(BUILD_SEQ $ENV{JOB_ID}) else () - set(BUILD_SEQ "0") + set(BUILD_SEQ "0.1") endif () set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} $ENV{QT_CMAKE_PREFIX_PATH}) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 79a32addb2..4e9705b49c 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -89,6 +89,8 @@ const float MIRROR_FULLSCREEN_DISTANCE = 0.35f; const float MIRROR_REARVIEW_DISTANCE = 0.65f; const float MIRROR_REARVIEW_BODY_DISTANCE = 2.3f; +const QString CHECK_VERSION_URL = "http://www.google.com"; + void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString &message) { fprintf(stdout, "%s", message.toLocal8Bit().constData()); @@ -196,20 +198,21 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : setOrganizationDomain(applicationInfo.value("organizationDomain").toString()); #ifdef Q_WS_X11 - _operatingSystem = "ubuntu"; + _operatingSystem = new QString("ubuntu"); #endif #ifdef Q_WS_WIN - _operatingSystem = "win"; + _operatingSystem = new QString("win"); #endif #ifdef Q_WS_MACX - _operatingSystem = "mac"; + _operatingSystem = new QString("mac"); #endif checkVersion(); qDebug("[VERSION] Build sequence: %s\n", applicationVersion().toStdString().c_str()); + qDebug("[OS] %s", _operatingSystem->toStdString().c_str()); _settings = new QSettings(this); @@ -4555,40 +4558,33 @@ void Application::checkVersion() { void Application::parseVersionXml(QNetworkReply *reply) { QString _releaseDate; QString _releaseNotes; - QUrl *_downloadLink; QXmlStreamReader xml(reply); while (!xml.atEnd() && !xml.hasError()) { QXmlStreamReader::TokenType token = xml.readNext(); if (token == QXmlStreamReader::StartElement) { - if (xml.name() == "ReleaseDate") { xml.readNext(); _releaseDate = xml.text().toString(); } - if (xml.name() == "ReleaseNotes") { xml.readNext(); _releaseNotes = xml.text().toString(); } - if (xml.name() == "Version") { xml.readNext(); _latestVersion = new QString(xml.text().toString()); } } - } + + _downloadURL = new QUrl(CHECK_VERSION_URL); + if (!shouldSkipVersion() && applicationVersion() != _latestVersion) { - + UpdateDialog *_updateDialog = new UpdateDialog(_glWidget, _releaseNotes); + _updateDialog->exec(); } - - _downloadLink = new QUrl("http://www.google.com"); - - UpdateDialog *_updateDialog = new UpdateDialog(_glWidget, _releaseNotes, _downloadLink); - _updateDialog->exec(); - } QFile *Application::loadSkipFile() { diff --git a/interface/src/Application.h b/interface/src/Application.h index 88b38ddbbb..8d45b9257f 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -224,6 +224,7 @@ public: QString *_latestVersion; QString *_operatingSystem; + QUrl *_downloadURL; public slots: void sendAvatarFaceVideoMessage(int frameCount, const QByteArray& data); diff --git a/interface/src/ui/UpdateDialog.cpp b/interface/src/ui/UpdateDialog.cpp index d8bf6bd742..c218d9ddbd 100644 --- a/interface/src/ui/UpdateDialog.cpp +++ b/interface/src/ui/UpdateDialog.cpp @@ -24,10 +24,9 @@ const int dialogHeigth = 300; const QString dialogTitle = "Update Required"; -UpdateDialog::UpdateDialog(QWidget *parent, QString releaseNotes, QUrl *downloadURL) : QDialog(parent, Qt::Dialog) { +UpdateDialog::UpdateDialog(QWidget *parent, QString releaseNotes) : QDialog(parent, Qt::Dialog) { Application* application = Application::getInstance(); - _downloadURL = downloadURL; const QString updateRequired = QString("You are currently running build %1, the latest build released is %2.\n \ Please download and install the most recent release to access the latest \ @@ -73,7 +72,7 @@ UpdateDialog::UpdateDialog(QWidget *parent, QString releaseNotes, QUrl *download void UpdateDialog::handleDownload() { Application* application = Application::getInstance(); - QDesktopServices::openUrl((*_downloadURL)); + QDesktopServices::openUrl(*application->_downloadURL); application->quit(); } diff --git a/interface/src/ui/UpdateDialog.h b/interface/src/ui/UpdateDialog.h index 54ce812471..4f5969f3bd 100644 --- a/interface/src/ui/UpdateDialog.h +++ b/interface/src/ui/UpdateDialog.h @@ -20,7 +20,7 @@ class UpdateDialog : public QDialog { Q_OBJECT public: - UpdateDialog(QWidget*, QString releaseNotes, QUrl *downloadURL); + UpdateDialog(QWidget*, QString releaseNotes); private: QLabel *_updateRequired;