From edce36f5a120f76a9453f4d805e9e74d2f44382f Mon Sep 17 00:00:00 2001 From: Leonardo Murillo Date: Mon, 8 Jun 2015 14:29:10 -0600 Subject: [PATCH] Checkpoint - buttons in place --- interface/resources/qml/UpdateDialog.qml | 101 ++++++++++++++++++++++- interface/src/ui/UpdateDialog.cpp | 13 +-- interface/src/ui/UpdateDialog.h | 7 +- 3 files changed, 110 insertions(+), 11 deletions(-) diff --git a/interface/resources/qml/UpdateDialog.qml b/interface/resources/qml/UpdateDialog.qml index a823bfff79..10b0839cca 100644 --- a/interface/resources/qml/UpdateDialog.qml +++ b/interface/resources/qml/UpdateDialog.qml @@ -1,6 +1,7 @@ import Hifi 1.0 import QtQuick 2.3 import QtQuick.Controls.Styles 1.3 +import QtGraphicalEffects 1.0 import "controls" import "styles" @@ -24,6 +25,12 @@ DialogContainer { readonly property int borderWidth: 30 readonly property int closeMargin: 16 readonly property int inputSpacing: 16 + readonly property int buttonWidth: 150 + readonly property int buttonHeight: 50 + readonly property int buttonRadius: 15 + + signal triggerBuildDownload + signal closeUpdateDialog Column { id: mainContent @@ -84,9 +91,9 @@ DialogContainer { top: dialogTitle.bottom } contentWidth: updateDialog.inputWidth - contentHeight: backgroundRectangle.height - (dialogTitle.height * 2) + contentHeight: backgroundRectangle.height - (dialogTitle.height * 2.5) width: updateDialog.inputWidth - height: backgroundRectangle.height - (dialogTitle.height * 2) + height: backgroundRectangle.height - (dialogTitle.height * 2.5) flickableDirection: Flickable.VerticalFlick clip: true @@ -105,6 +112,96 @@ DialogContainer { } } + + Rectangle { + id: downloadButton + width: updateDialog.buttonWidth + height: updateDialog.buttonHeight + radius: updateDialog.buttonRadius + color: "green" + anchors { + top: scrollArea.bottom + topMargin: 10 + 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() + } + + Rectangle { + id: cancelButton + width: updateDialog.buttonWidth + height: updateDialog.buttonHeight + radius: updateDialog.buttonRadius + color: "red" + anchors { + top: scrollArea.bottom + topMargin: 10 + 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" + anchors { + verticalCenter: parent.verticalCenter + 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() + } } } } diff --git a/interface/src/ui/UpdateDialog.cpp b/interface/src/ui/UpdateDialog.cpp index c5a6234f2c..5cf5a4fbed 100644 --- a/interface/src/ui/UpdateDialog.cpp +++ b/interface/src/ui/UpdateDialog.cpp @@ -18,11 +18,9 @@ UpdateDialog::UpdateDialog(QQuickItem* parent) : OffscreenQmlDialog(parent) { int currentVersion = QCoreApplication::applicationVersion().toInt(); int latestVersion = applicationUpdater.data()->getBuildData().lastKey(); int versionsBehind = latestVersion - currentVersion; - _updateAvailableDetails = "v." + QString::number(latestVersion) + " released on " + applicationUpdater.data()->getBuildData()[latestVersion]["releaseTime"]; + _updateAvailableDetails = "v" + QString::number(latestVersion) + " released on " + applicationUpdater.data()->getBuildData()[latestVersion]["releaseTime"]; _updateAvailableDetails += "\nYou are " + QString::number(versionsBehind) + " versions behind"; _releaseNotes = applicationUpdater.data()->getBuildData()[latestVersion]["releaseNotes"]; - qDebug() << "[LEOTEST] Release time " << applicationUpdater.data()->getBuildData()[latestVersion]["releaseTime"]; - qDebug() << "[LEOTEST] Release notes: " << applicationUpdater.data()->getBuildData()[latestVersion]["releaseNotes"]; } UpdateDialog::~UpdateDialog() { @@ -37,10 +35,15 @@ QString UpdateDialog::releaseNotes() const { return _releaseNotes; } +void UpdateDialog::closeUpdateDialog() { + qDebug() << "[LEOTEST] Closing update dialog"; + hide(); +} + void UpdateDialog::hide() { ((QQuickItem*)parent())->setEnabled(false); } -void UpdateDialog::triggerBuildDownload(const int &buildNumber) { - qDebug() << "[LEOTEST] Triggering download of build number: " << QString::number(buildNumber); +void UpdateDialog::triggerUpgrade() { + qDebug() << "[LEOTEST] Triggering download of build number"; } \ No newline at end of file diff --git a/interface/src/ui/UpdateDialog.h b/interface/src/ui/UpdateDialog.h index 6ba8f0c46b..eda7f8ceb2 100644 --- a/interface/src/ui/UpdateDialog.h +++ b/interface/src/ui/UpdateDialog.h @@ -27,15 +27,14 @@ public: QString updateAvailableDetails() const; QString releaseNotes() const; -protected: - void hide(); - private: QString _updateAvailableDetails; QString _releaseNotes; protected: - Q_INVOKABLE void triggerBuildDownload(const int& buildNumber); + void hide(); + Q_INVOKABLE void triggerUpgrade(); + Q_INVOKABLE void closeUpdateDialog(); };