Skip to content

Commit

Permalink
Added initial update dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
Iktwo committed Sep 13, 2014
1 parent 610a55e commit ec9c532
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
57 changes: 57 additions & 0 deletions qml/UpdateDialog.qml
Original file line number Diff line number Diff line change
@@ -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()
}
}
]
}
7 changes: 7 additions & 0 deletions qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down

0 comments on commit ec9c532

Please sign in to comment.