1/*
2 * \copyright Copyright (c) 2019-2021 Governikus GmbH & Co. KG, Germany
3 */
4
5import QtQuick 2.12
6import QtQuick.Layouts 1.12
7
8import Governikus.Global 1.0
9import Governikus.Type.ApplicationModel 1.0
10import Governikus.Type.SettingsModel 1.0
11
12RowLayout {
13	id: root
14
15	property alias progressText: bar.text
16	property alias progressValue: bar.value
17	property bool downloadInProgress: false
18
19	signal skipUpdate()
20	signal remindLater()
21	signal toggleUpdate()
22
23	spacing: Constants.component_spacing
24
25	GProgressBar {
26		id: bar
27
28		visible: downloadInProgress
29
30		Layout.fillWidth: true
31		Layout.preferredHeight: ApplicationModel.scaleFactor * 40
32
33		activeFocusOnTab: true
34	}
35
36	GButton {
37		visible: !downloadInProgress
38
39		//: LABEL DESKTOP_QML User choice to skip this update, the automatic update check will *not* inform about this update again.
40		text: qsTr("Skip update")
41
42		onClicked: root.skipUpdate()
43	}
44
45	GSpacer {
46		visible: !downloadInProgress
47
48		Layout.fillWidth: true
49	}
50
51	GButton {
52		visible: !downloadInProgress
53
54		//: LABEL DESKTOP_QML The available update is shown again after next automatic update check.
55		text: qsTr("Remind me later")
56
57		onClicked: root.remindLater()
58	}
59
60	GButton {
61		text: Qt.platform.os === "osx"
62			  //: LABEL DESKTOP_QML Open the Mac App Store on macOS
63			  ? qsTr("Open App Store")
64			  : downloadInProgress
65			  //: LABEL DESKTOP_QML Cancel the download of the update on Windows
66			  ? qsTr("Cancel update")
67			  //: LABEL DESKTOP_QML Start to download the update and execute it on Windows
68			  : qsTr("Start update")
69		enabledTooltipText: SettingsModel.appUpdateData.url
70
71		onClicked: root.toggleUpdate()
72	}
73}
74