diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 7d71cd11fe..ab68326765 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -60,6 +60,7 @@ find_package(Qt5Svg REQUIRED) find_package(Qt5WebKit REQUIRED) find_package(Qt5WebKitWidgets REQUIRED) find_package(Qt5Xml REQUIRED) +find_package(Qt5UiTools REQUIRED) if (APPLE) set(MACOSX_BUNDLE_BUNDLE_NAME Interface) @@ -135,7 +136,7 @@ if (LIBOVR_FOUND AND NOT DISABLE_LIBOVR) target_link_libraries(${TARGET_NAME} ${LIBOVR_LIBRARIES}) endif (LIBOVR_FOUND AND NOT DISABLE_LIBOVR) -qt5_use_modules(${TARGET_NAME} Core Gui Multimedia Network OpenGL Script Svg WebKit WebKitWidgets Xml) +qt5_use_modules(${TARGET_NAME} Core Gui Multimedia Network OpenGL Script Svg WebKit WebKitWidgets Xml UiTools) # include headers for interface and InterfaceConfig. include_directories( diff --git a/interface/resources/ui/updateDialog.ui b/interface/resources/ui/updateDialog.ui new file mode 100644 index 0000000000..de3358ea80 --- /dev/null +++ b/interface/resources/ui/updateDialog.ui @@ -0,0 +1,182 @@ + + + Dialog + + + Qt::NonModal + + + + 0 + 0 + 750 + 300 + + + + PointingHandCursor + + + Update Required + + + background-color: rgb(255, 255, 255); + + + + + 0 + 0 + 751 + 71 + + + + Qt::LeftToRight + + + false + + + background-color: rgb(236, 236, 236); + + + QFrame::StyledPanel + + + QFrame::Plain + + + 0 + + + + + 240 + 10 + 271 + 41 + + + + + Arial + 36 + PreferAntialias + false + + + + color: rgb(51, 51, 51); + + + Update Required + + + + + + + 100 + 110 + 561 + 61 + + + + + Arial + 18 + 50 + false + + + + You are currently running build 312, the latest build available is 375. Please download and install the most recent release to access the latest features and bug fixes. + + + true + + + + + + 360 + 240 + 364 + 40 + + + + + + + PointingHandCursor + + + background-color: #333333; + border-width: 0; + border-radius: 9px; + border-radius: 9px; + font-family: Arial; + font-size: 18px; + font-weight: 100; + color: #b7b7b7; + width: 120px; + height: 40px; + + + Download + + + + + + + PointingHandCursor + + + background-color: #333333; + border-width: 0; + border-radius: 9px; + border-radius: 9px; + font-family: Arial; + font-size: 18px; + font-weight: 100; + color: #b7b7b7; + width: 120px; + height: 40px; + + + Skip Version + + + + + + + PointingHandCursor + + + background-color: #333333; + border-width: 0; + border-radius: 9px; + border-radius: 9px; + font-family: Arial; + font-size: 18px; + font-weight: 100; + color: #b7b7b7; + width: 120px; + height: 40px; + + + Close + + + + + + + + + diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index d50b8962a9..6cab83a44b 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -89,7 +89,7 @@ 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"; +const QString CHECK_VERSION_URL = "http://highfidelity.io/latestVersion.xml"; void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString &message) { fprintf(stdout, "%s", message.toLocal8Bit().constData()); @@ -4602,7 +4602,7 @@ void Application::updateLocalOctreeCache(bool firstTime) { } void Application::checkVersion() { - QUrl url("https://a-tower.below92.com/version.xml"); + QUrl url(CHECK_VERSION_URL); QNetworkAccessManager *downloadXML = new QNetworkAccessManager(this); QNetworkRequest request(url); connect(downloadXML, SIGNAL(finished(QNetworkReply*)), this, SLOT(parseVersionXml(QNetworkReply*))); @@ -4631,14 +4631,15 @@ void Application::parseVersionXml(QNetworkReply *reply) { xml.readNext(); _latestVersion = new QString(xml.text().toString()); } + if (xml.name() == _operatingSystem) { + xml.readNext(); + _downloadURL = new QUrl(xml.text().toString()); + } } } - _downloadURL = new QUrl(CHECK_VERSION_URL); - if (!shouldSkipVersion() && applicationVersion() != _latestVersion) { UpdateDialog *_updateDialog = new UpdateDialog(_glWidget, _releaseNotes); - _updateDialog->exec(); } } @@ -4655,7 +4656,7 @@ bool Application::shouldSkipVersion() { QByteArray skipFileContents = skipFile->readAll(); QString *skipVersion = new QString(skipFileContents); skipFile->close(); - if (*skipVersion == *_latestVersion ) { + if (*skipVersion == *_latestVersion /*|| applicationVersion() == "0.1"*/) { return true; } return false; diff --git a/interface/src/ui/UpdateDialog.cpp b/interface/src/ui/UpdateDialog.cpp index c218d9ddbd..5e924221ea 100644 --- a/interface/src/ui/UpdateDialog.cpp +++ b/interface/src/ui/UpdateDialog.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include "Application.h" #include "SharedUtil.h" @@ -26,44 +27,26 @@ const QString dialogTitle = "Update Required"; UpdateDialog::UpdateDialog(QWidget *parent, QString releaseNotes) : QDialog(parent, Qt::Dialog) { + QUiLoader updateDialogLoader; + + QFile updateDialogUi("resources/ui/updateDialog.ui"); + updateDialogUi.open(QFile::ReadOnly); + QWidget *updateDialog = updateDialogLoader.load(&updateDialogUi, this); + updateDialogUi.close(); + + updateDialog->show(); + Application* application = Application::getInstance(); - 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 \ - features and bug fixes.").arg(application->applicationVersion(), *application->_latestVersion); + const QString updateRequired = QString("You are currently running build %1, the latest build released is %2. Please download and install the most recent release to access the latest features and bug fixes.").arg(application->applicationVersion(), *application->_latestVersion); - int leftPosition = leftStartingPosition; - setWindowTitle(dialogTitle); - //setWindowFlags(Qt::WindowTitleHint); - setModal(true); - resize(dialogWidth, dialogHeigth); - QFile styleSheet("resources/styles/update_dialog.qss"); - if (styleSheet.open(QIODevice::ReadOnly)) { - setStyleSheet(styleSheet.readAll()); - } - _releaseNotes = new QLabel(this); - _releaseNotes->setText(releaseNotes); - _releaseNotes->setObjectName("releaseNotes"); - _updateRequired = new QLabel(this); - _updateRequired->setText(updateRequired); - _updateRequired->setObjectName("updateRequired"); + QPushButton *_downloadButton = updateDialog->findChild("downloadButton"); + QPushButton *_skipButton = updateDialog->findChild("skipButton"); + QPushButton *_closeButton = updateDialog->findChild("closeButton"); + QLabel *_updateContent = updateDialog->findChild("updateContent"); - _downloadButton = new QPushButton("Download", this); - _downloadButton->setObjectName("downloadButton"); - _downloadButton->setGeometry(leftPosition, buttonMargin, buttonWidth, buttonHeight); - leftPosition += buttonWidth; - - _skipButton = new QPushButton("Skip Version", this); - _skipButton->setObjectName("skipButton"); - _skipButton->setGeometry(leftPosition, buttonMargin, buttonWidth, buttonHeight); - leftPosition += buttonWidth; - - _closeButton = new QPushButton("Close", this); - _closeButton->setObjectName("closeButton"); - _closeButton->setGeometry(leftPosition, buttonMargin, buttonWidth, buttonHeight); - - _titleBackground = new QFrame(); + _updateContent->setText(updateRequired); connect(_downloadButton, SIGNAL(released()), this, SLOT(handleDownload())); connect(_skipButton, SIGNAL(released()), this, SLOT(handleSkip())); @@ -79,9 +62,10 @@ void UpdateDialog::handleDownload() { void UpdateDialog::handleSkip() { Application* application = Application::getInstance(); application->skipVersion(); - close(); + this->QDialog::close(); } void UpdateDialog::handleClose() { - close(); + qDebug("###### HANDLECLOSE\n"); + this->QDialog::close(); } \ No newline at end of file diff --git a/interface/src/ui/UpdateDialog.h b/interface/src/ui/UpdateDialog.h index 4f5969f3bd..425a4e5dc7 100644 --- a/interface/src/ui/UpdateDialog.h +++ b/interface/src/ui/UpdateDialog.h @@ -22,15 +22,6 @@ class UpdateDialog : public QDialog { public: UpdateDialog(QWidget*, QString releaseNotes); -private: - QLabel *_updateRequired; - QLabel *_releaseNotes; - QPushButton *_downloadButton; - QPushButton *_skipButton; - QPushButton *_closeButton; - QFrame *_titleBackground; - QUrl *_downloadURL; - private slots: void handleDownload(); void handleSkip();