diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-06-28 11:21:51 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-06-28 11:21:51 +0200 |
commit | 1b46726b46197776c70adb9367fd604d50522755 (patch) | |
tree | 61fa69f275ed15117b0b2e24907f2b4c9ac09bf6 /components | |
parent | bd62b0c97bf7aa9f4c864367a159ea479c256bc1 (diff) | |
download | kube-1b46726b46197776c70adb9367fd604d50522755.tar.gz kube-1b46726b46197776c70adb9367fd604d50522755.zip |
Only show the logview if notificaitons are available
and rename to Notification view
Diffstat (limited to 'components')
-rw-r--r-- | components/kube/qml/Kube.qml | 8 | ||||
-rw-r--r-- | components/kube/qml/ViewManager.qml | 48 |
2 files changed, 35 insertions, 21 deletions
diff --git a/components/kube/qml/Kube.qml b/components/kube/qml/Kube.qml index 8d77ddb5..e33119aa 100644 --- a/components/kube/qml/Kube.qml +++ b/components/kube/qml/Kube.qml | |||
@@ -199,13 +199,18 @@ Controls2.ApplicationWindow { | |||
199 | onClicked: kubeViews.showView("log") | 199 | onClicked: kubeViews.showView("log") |
200 | activeFocusOnTab: true | 200 | activeFocusOnTab: true |
201 | checkable: true | 201 | checkable: true |
202 | visible: false | ||
202 | Kube.Listener { | 203 | Kube.Listener { |
203 | filter: Kube.Messages.errorPending | 204 | filter: Kube.Messages.errorPending |
204 | onMessageReceived: logButton.alert = message.errorPending | 205 | onMessageReceived: logButton.alert = message.errorPending |
205 | } | 206 | } |
207 | Kube.Listener { | ||
208 | filter: Kube.Messages.notificationPending | ||
209 | onMessageReceived: logButton.visible = true | ||
210 | } | ||
206 | checked: kubeViews.currentViewName == "log" | 211 | checked: kubeViews.currentViewName == "log" |
207 | Controls2.ButtonGroup.group: viewButtonGroup | 212 | Controls2.ButtonGroup.group: viewButtonGroup |
208 | tooltip: qsTr("logview") | 213 | tooltip: qsTr("Notification View") |
209 | } | 214 | } |
210 | 215 | ||
211 | Kube.IconButton { | 216 | Kube.IconButton { |
@@ -232,6 +237,7 @@ Controls2.ApplicationWindow { | |||
232 | 237 | ||
233 | Component.onCompleted: { | 238 | Component.onCompleted: { |
234 | dontFocus = true | 239 | dontFocus = true |
240 | prepareViewInBackground("log", {}) | ||
235 | showView("conversation") | 241 | showView("conversation") |
236 | if (startupCheck.noAccount) { | 242 | if (startupCheck.noAccount) { |
237 | showView("accounts") | 243 | showView("accounts") |
diff --git a/components/kube/qml/ViewManager.qml b/components/kube/qml/ViewManager.qml index 15ff2638..e29efaaf 100644 --- a/components/kube/qml/ViewManager.qml +++ b/components/kube/qml/ViewManager.qml | |||
@@ -44,6 +44,29 @@ StackView { | |||
44 | item.objectName = name | 44 | item.objectName = name |
45 | } | 45 | } |
46 | 46 | ||
47 | function createView(name, properties) { | ||
48 | //Creating a new view | ||
49 | var source = extensionModel.findSource(name, "View.qml"); | ||
50 | //On windows it will be async anyways, so just always create it async | ||
51 | var component = Qt.createComponent(source, Qt.Asynchronous) | ||
52 | |||
53 | function finishCreation() { | ||
54 | if (component.status == Component.Ready) { | ||
55 | var view = component.createObject(root); | ||
56 | viewDict[name] = view | ||
57 | pushView(view, properties, name) | ||
58 | } else { | ||
59 | console.error("Error while loading the component: ", source, "\nError: ", component.errorString()) | ||
60 | } | ||
61 | } | ||
62 | |||
63 | if (component.status == Component.Loading) { | ||
64 | component.statusChanged.connect(finishCreation); | ||
65 | } else { | ||
66 | finishCreation(); | ||
67 | } | ||
68 | } | ||
69 | |||
47 | function showOrReplaceView(name, properties, replace) { | 70 | function showOrReplaceView(name, properties, replace) { |
48 | if (currentItem && currentItem.objectName == name) { | 71 | if (currentItem && currentItem.objectName == name) { |
49 | return | 72 | return |
@@ -70,32 +93,17 @@ StackView { | |||
70 | } | 93 | } |
71 | } | 94 | } |
72 | 95 | ||
73 | //Creating a new view | 96 | createView(name) |
74 | var source = extensionModel.findSource(name, "View.qml"); | ||
75 | //On windows it will be async anyways, so just always create it async | ||
76 | var component = Qt.createComponent(source, Qt.Asynchronous) | ||
77 | |||
78 | function finishCreation() { | ||
79 | if (component.status == Component.Ready) { | ||
80 | var view = component.createObject(root); | ||
81 | viewDict[name] = view | ||
82 | pushView(view, properties, name) | ||
83 | } else { | ||
84 | console.error("Error while loading the component: ", source, "\nError: ", component.errorString()) | ||
85 | } | ||
86 | } | ||
87 | |||
88 | if (component.status == Component.Loading) { | ||
89 | component.statusChanged.connect(finishCreation); | ||
90 | } else { | ||
91 | finishCreation(); | ||
92 | } | ||
93 | } | 97 | } |
94 | 98 | ||
95 | function showView(name, properties) { | 99 | function showView(name, properties) { |
96 | showOrReplaceView(name, properties, false) | 100 | showOrReplaceView(name, properties, false) |
97 | } | 101 | } |
98 | 102 | ||
103 | function prepareViewInBackground(name, properties) { | ||
104 | createView(name, properties) | ||
105 | } | ||
106 | |||
99 | function replaceView(name, properties) { | 107 | function replaceView(name, properties) { |
100 | showOrReplaceView(name, properties, true) | 108 | showOrReplaceView(name, properties, true) |
101 | } | 109 | } |