From ec9c5320ad2d1a2416e5f1f5d66a12e398c9834e Mon Sep 17 00:00:00 2001 From: Iktwo Sh Date: Sat, 13 Sep 2014 09:49:22 -0700 Subject: [PATCH] Added initial update dialog --- qml/UpdateDialog.qml | 57 ++++++++++++++++++++++++++++++++++++++++++++ qml/main.qml | 7 ++++++ 2 files changed, 64 insertions(+) create mode 100644 qml/UpdateDialog.qml diff --git a/qml/UpdateDialog.qml b/qml/UpdateDialog.qml new file mode 100644 index 0000000..bff34d4 --- /dev/null +++ b/qml/UpdateDialog.qml @@ -0,0 +1,57 @@ +import QtQuick 2.3 +import QtQuick.Controls 1.2 +import QtQuick.Layouts 1.1 +import com.iktwo.components 1.0 + +Dialog { + id: root + + property UpdateChecker updateCheckerElement + + buttons: [ + Button { + anchors { + horizontalCenter: parent.horizontalCenter + } + + text: qsTr("Update") + height: 40 * ScreenValues.dpMultiplier + Layout.preferredHeight: 40 * ScreenValues.dpMultiplier + width: Math.min(root.width / 2.5, 220 * ScreenValues.dpMultiplier) + Layout.preferredWidth: Math.min(root.width / 2.5, 220 * ScreenValues.dpMultiplier) + style: FlatButtonStyle { } + onClicked: updateCheckerElement.openPackageOnGooglePlay() + }, + Button { + anchors { + horizontalCenter: parent.horizontalCenter + } + + text: qsTr("Skip") + height: 40 * ScreenValues.dpMultiplier + Layout.preferredHeight: 40 * ScreenValues.dpMultiplier + width: Math.min(root.width / 2.5, 220 * ScreenValues.dpMultiplier) + Layout.preferredWidth: Math.min(root.width / 2.5, 220 * ScreenValues.dpMultiplier) + style: FlatButtonStyle { backgroundColor: "#cccccc"; fontColor: "#757575" } + + onClicked: root.close() + }, + Button { + anchors { + horizontalCenter: parent.horizontalCenter + } + + text: qsTr("Skip until next") + height: 40 * ScreenValues.dpMultiplier + Layout.preferredHeight: 40 * ScreenValues.dpMultiplier + width: Math.min(root.width / 2.5, 220 * ScreenValues.dpMultiplier) + Layout.preferredWidth: Math.min(root.width / 2.5, 220 * ScreenValues.dpMultiplier) + style: FlatButtonStyle { backgroundColor: "#cccccc"; fontColor: "#757575" } + + onClicked: { + /// TODO: store skipped version, if new version is greater than skipped then show dialog + root.close() + } + } + ] +} diff --git a/qml/main.qml b/qml/main.qml index 1cbb0d2..86c5232 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -185,6 +185,13 @@ ApplicationWindow { onLatestVersionChanged: console.log("LATEST VERSION:", latestVersion) } + UpdateDialog { + id: updateDialog + + title: qsTr("Update") + updateCheckerElement: updateChecker + text: qsTr("There's a new update available, you are running version %1 and you can update to version %2.").arg(updateChecker.version).arg(updateChecker.latestVersion) + } Component.onCompleted: { Theme.titleBarColor = "#0066CC"