diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-05-13 10:02:23 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-05-13 10:02:23 +0200 |
commit | 6d034c853ea7cd6d426fccd79db90ec56e188327 (patch) | |
tree | d5f4e37fa99e0dead333d685b2485784f5df1e66 /framework | |
parent | eaca65f1639ebd35646188be264f406a0b58196b (diff) | |
download | kube-6d034c853ea7cd6d426fccd79db90ec56e188327.tar.gz kube-6d034c853ea7cd6d426fccd79db90ec56e188327.zip |
StatusBar as individual component
Diffstat (limited to 'framework')
-rw-r--r-- | framework/qml/StatusBar.qml | 79 | ||||
-rw-r--r-- | framework/qmldir | 1 |
2 files changed, 80 insertions, 0 deletions
diff --git a/framework/qml/StatusBar.qml b/framework/qml/StatusBar.qml new file mode 100644 index 00000000..fa85f872 --- /dev/null +++ b/framework/qml/StatusBar.qml | |||
@@ -0,0 +1,79 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2017 Christian Mollekopf, <mollekopf@kolabsys.com> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along | ||
15 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
17 | */ | ||
18 | |||
19 | import QtQuick 2.7 | ||
20 | import org.kube.framework 1.0 as Kube | ||
21 | |||
22 | Item { | ||
23 | id: root | ||
24 | property string accountId: "" | ||
25 | Repeater { | ||
26 | model: Kube.AccountsModel { | ||
27 | accountId: root.accountId | ||
28 | } | ||
29 | |||
30 | Column { | ||
31 | anchors.fill: root | ||
32 | spacing: Kube.Units.smallSpacing | ||
33 | Kube.Label { | ||
34 | id: statusText | ||
35 | anchors.horizontalCenter: parent.horizontalCenter | ||
36 | visible: false | ||
37 | color: Kube.Colors.highlightedTextColor | ||
38 | states: [ | ||
39 | State { | ||
40 | name: "disconnected"; when: model.status == Kube.AccountsModel.OfflineStatus | ||
41 | PropertyChanges { target: statusBar; visible: true } | ||
42 | PropertyChanges { target: statusText; text: "Disconnected"; visible: true } | ||
43 | }, | ||
44 | State { | ||
45 | name: "busy"; when: model.status == Kube.AccountsModel.BusyStatus | ||
46 | PropertyChanges { target: statusBar; visible: true } | ||
47 | PropertyChanges { target: statusText; text: "Synchronizing..."; visible: true } | ||
48 | PropertyChanges { target: progressBar; visible: true } | ||
49 | }, | ||
50 | State { | ||
51 | name: "error"; when: model.status == Kube.AccountsModel.ErrorStatus | ||
52 | PropertyChanges { target: statusBar; visible: true } | ||
53 | //TODO get to an error description | ||
54 | PropertyChanges { target: statusText; text: "Error"; visible: true } | ||
55 | } | ||
56 | ] | ||
57 | } | ||
58 | Kube.ProgressBar { | ||
59 | id: progressBar | ||
60 | anchors.horizontalCenter: parent.horizontalCenter | ||
61 | height: 2 | ||
62 | width: parent.width - Kube.Units.smallSpacing * 2 | ||
63 | |||
64 | indeterminate: true | ||
65 | visible: false | ||
66 | |||
67 | Kube.Listener { | ||
68 | filter: Kube.Messages.progressNotification | ||
69 | onMessageReceived: { | ||
70 | progressBar.indeterminate = false | ||
71 | progressBar.from = 0 | ||
72 | progressBar.to = message.total | ||
73 | progressBar.value = message.progress | ||
74 | } | ||
75 | } | ||
76 | } | ||
77 | } | ||
78 | } | ||
79 | } | ||
diff --git a/framework/qmldir b/framework/qmldir index 2060a920..a5184771 100644 --- a/framework/qmldir +++ b/framework/qmldir | |||
@@ -18,6 +18,7 @@ IconButton 1.0 IconButton.qml | |||
18 | Button 1.0 Button.qml | 18 | Button 1.0 Button.qml |
19 | Popup 1.0 Popup.qml | 19 | Popup 1.0 Popup.qml |
20 | ProgressBar 1.0 ProgressBar.qml | 20 | ProgressBar 1.0 ProgressBar.qml |
21 | StatusBar 1.0 StatusBar.qml | ||
21 | ComboBox 1.0 ComboBox.qml | 22 | ComboBox 1.0 ComboBox.qml |
22 | PositiveButton 1.0 PositiveButton.qml | 23 | PositiveButton 1.0 PositiveButton.qml |
23 | TextField 1.0 TextField.qml | 24 | TextField 1.0 TextField.qml |