diff --git a/interface/resources/qml/UpdateDialog.qml b/interface/resources/qml/UpdateDialog.qml index 10b0839cca..e5216ff619 100644 --- a/interface/resources/qml/UpdateDialog.qml +++ b/interface/resources/qml/UpdateDialog.qml @@ -110,7 +110,6 @@ DialogContainer { leftMargin: updateDialog.borderWidth } } - } Rectangle { @@ -125,38 +124,19 @@ DialogContainer { right: backgroundRectangle.right rightMargin: 15 } - Accessible.name: "Upgrade" - Accessible.description: "Download and update to latest version" - Accessible.role: Accessible.Button - Accessible.onPressAction: { - updateDialog.triggerBuildDownload() - } - - Text { text: "Upgrade" anchors { verticalCenter: parent.verticalCenter horizontalCenter: parent.horizontalCenter } - } - } - - DropShadow { - anchors.fill: downloadButton - horizontalOffset: 2 - verticalOffset: 2 - radius: updateDialog.buttonRadius - samples: 16 - color: "#80000000" - source: downloadButton - } - - MouseArea { - id: downloadButtonAction - anchors.fill: downloadButton - onClicked: updateDialog.triggerBuildDownload() + MouseArea { + id: downloadButtonAction + anchors.fill: parent + onClicked: updateDialog.triggerUpgrade() + cursorShape: "PointingHandCursor" + } } Rectangle { @@ -171,12 +151,6 @@ DialogContainer { right: downloadButton.left rightMargin: 15 } - Accessible.name: "Cancel" - Accessible.description: "Do not upgrade your current version" - Accessible.role: Accessible.Button - Accessible.onPressAction: { - updateDialog.closeUpdateDialog() - } Text { text: "Cancel" @@ -185,22 +159,12 @@ DialogContainer { horizontalCenter: parent.horizontalCenter } } - } - - DropShadow { - anchors.fill: cancelButton - horizontalOffset: 2 - verticalOffset: 2 - radius: updateDialog.buttonRadius - samples: 16 - color: "#80000000" - source: cancelButton - } - - MouseArea { - id: cancelButtonAction - anchors.fill: cancelButton - onClicked: updateDialog.closeUpdateDialog() + MouseArea { + id: cancelButtonAction + anchors.fill: parent + onClicked: updateDialog.closeDialog() + cursorShape: "PointingHandCursor" + } } } } diff --git a/interface/src/ui/UpdateDialog.cpp b/interface/src/ui/UpdateDialog.cpp index 5cf5a4fbed..9a6da9148e 100644 --- a/interface/src/ui/UpdateDialog.cpp +++ b/interface/src/ui/UpdateDialog.cpp @@ -13,7 +13,6 @@ HIFI_QML_DEF(UpdateDialog) UpdateDialog::UpdateDialog(QQuickItem* parent) : OffscreenQmlDialog(parent) { - qDebug() << "[LEOTEST] We are creating the dialog"; auto applicationUpdater = DependencyManager::get(); int currentVersion = QCoreApplication::applicationVersion().toInt(); int latestVersion = applicationUpdater.data()->getBuildData().lastKey(); @@ -23,10 +22,6 @@ UpdateDialog::UpdateDialog(QQuickItem* parent) : OffscreenQmlDialog(parent) { _releaseNotes = applicationUpdater.data()->getBuildData()[latestVersion]["releaseNotes"]; } -UpdateDialog::~UpdateDialog() { - -} - QString UpdateDialog::updateAvailableDetails() const { return _updateAvailableDetails; } @@ -35,8 +30,7 @@ QString UpdateDialog::releaseNotes() const { return _releaseNotes; } -void UpdateDialog::closeUpdateDialog() { - qDebug() << "[LEOTEST] Closing update dialog"; +void UpdateDialog::closeDialog() { hide(); } @@ -45,5 +39,6 @@ void UpdateDialog::hide() { } void UpdateDialog::triggerUpgrade() { - qDebug() << "[LEOTEST] Triggering download of build number"; + auto applicationUpdater = DependencyManager::get(); + applicationUpdater.data()->performAutoUpdate(applicationUpdater.data()->getBuildData().lastKey()); } \ No newline at end of file diff --git a/interface/src/ui/UpdateDialog.h b/interface/src/ui/UpdateDialog.h index eda7f8ceb2..25ea42e7bc 100644 --- a/interface/src/ui/UpdateDialog.h +++ b/interface/src/ui/UpdateDialog.h @@ -23,7 +23,6 @@ class UpdateDialog : public OffscreenQmlDialog { public: UpdateDialog(QQuickItem* parent = nullptr); - ~UpdateDialog(); QString updateAvailableDetails() const; QString releaseNotes() const; @@ -34,7 +33,7 @@ private: protected: void hide(); Q_INVOKABLE void triggerUpgrade(); - Q_INVOKABLE void closeUpdateDialog(); + Q_INVOKABLE void closeDialog(); }; diff --git a/libraries/auto-update/src/AutoUpdate.cpp b/libraries/auto-update/src/AutoUpdate.cpp index be52b283c5..3295016f81 100644 --- a/libraries/auto-update/src/AutoUpdate.cpp +++ b/libraries/auto-update/src/AutoUpdate.cpp @@ -29,10 +29,6 @@ AutoUpdate::AutoUpdate() { _builds = new QMap>; } -AutoUpdate::~AutoUpdate() { - qDebug() << "[LEOTEST] The object is now destroyed"; -} - void AutoUpdate::checkForUpdate() { this->getLatestVersionData(); @@ -113,18 +109,7 @@ void AutoUpdate::parseLatestVersionData() { emit latestVersionDataParsed(); } -void AutoUpdate::debugBuildData() { - qDebug() << "[LEOTEST] We finished parsing the xml build data"; - foreach (int key, _builds->keys()) { - qDebug() << "[LEOTEST] Build number: " << QString::number(key); - //foreach (QString detailsKey, _builds[key].keys()) { - // qDebug() << "[LEOTEST] Key: " << detailsKey << " Value: " << _builds[key][detailsKey]; - //} - } -} - void AutoUpdate::checkVersionAndNotify() { - qDebug() << "[LEOTEST] We are checking and notifying for updates"; int latestVersionAvailable = _builds->lastKey(); if (QCoreApplication::applicationVersion() != "dev" && QCoreApplication::applicationVersion().toInt() < latestVersionAvailable) { @@ -133,7 +118,12 @@ void AutoUpdate::checkVersionAndNotify() { } void AutoUpdate::performAutoUpdate(int version) { - + // NOTE: This is not yet auto updating - however this is a checkpoint towards that end + // Next PR will handle the automatic download, upgrading and application restart + QMap chosenVersion = _builds->value(version); + QUrl downloadUrl = chosenVersion.value("downloadUrl"); + QDesktopServices::openUrl(downloadUrl); + QCoreApplication::quit(); } void AutoUpdate::downloadUpdateVersion(int version) { diff --git a/libraries/auto-update/src/AutoUpdate.h b/libraries/auto-update/src/AutoUpdate.h index 4b32d68c48..b060aca2b6 100644 --- a/libraries/auto-update/src/AutoUpdate.h +++ b/libraries/auto-update/src/AutoUpdate.h @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -40,10 +41,10 @@ class AutoUpdate : public QObject, public Dependency { public: // Methods AutoUpdate(); - ~AutoUpdate(); void checkForUpdate(); QMap> &getBuildData() { return *_builds; } + void performAutoUpdate(int version); public slots: @@ -63,9 +64,7 @@ private: private slots: void parseLatestVersionData(); - void debugBuildData(); void checkVersionAndNotify(); - void performAutoUpdate(int version); signals: void latestVersionDataParsed();