diff options
-rw-r--r-- | components/kube/qml/Kube.qml | 8 | ||||
-rw-r--r-- | components/kube/qml/ViewManager.qml | 48 | ||||
-rw-r--r-- | framework/qml/Messages.qml | 1 | ||||
-rw-r--r-- | views/log/qml/View.qml | 7 |
4 files changed, 43 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 | } |
diff --git a/framework/qml/Messages.qml b/framework/qml/Messages.qml index d9734a0a..1555507f 100644 --- a/framework/qml/Messages.qml +++ b/framework/qml/Messages.qml | |||
@@ -52,6 +52,7 @@ Item { | |||
52 | 52 | ||
53 | property string componentDone: "done" | 53 | property string componentDone: "done" |
54 | property string errorPending: "errorPending" | 54 | property string errorPending: "errorPending" |
55 | property string notificationPending: "notificationPending" | ||
55 | 56 | ||
56 | property string selectNextConversation: "selectNextConversation" | 57 | property string selectNextConversation: "selectNextConversation" |
57 | property string selectPreviousConversation: "selectPreviousConversation" | 58 | property string selectPreviousConversation: "selectPreviousConversation" |
diff --git a/views/log/qml/View.qml b/views/log/qml/View.qml index 3aa76025..4dc2bce8 100644 --- a/views/log/qml/View.qml +++ b/views/log/qml/View.qml | |||
@@ -27,12 +27,17 @@ Controls1.SplitView { | |||
27 | id: root | 27 | id: root |
28 | 28 | ||
29 | property bool pendingError: false; | 29 | property bool pendingError: false; |
30 | property bool pendingNotification: false; | ||
30 | onPendingErrorChanged: { | 31 | onPendingErrorChanged: { |
31 | Kube.Fabric.postMessage(Kube.Messages.errorPending, {errorPending: pendingError}) | 32 | Kube.Fabric.postMessage(Kube.Messages.errorPending, {errorPending: pendingError}) |
32 | } | 33 | } |
34 | onPendingNotificationChanged: { | ||
35 | Kube.Fabric.postMessage(Kube.Messages.notificationPending, {notificationPending: pendingNotification}) | ||
36 | } | ||
33 | 37 | ||
34 | Controls2.StackView.onActivated: { | 38 | Controls2.StackView.onActivated: { |
35 | root.pendingError = false; | 39 | root.pendingError = false; |
40 | root.pendingNotification = false; | ||
36 | //Always select the latest notification | 41 | //Always select the latest notification |
37 | listView.currentIndex = 0 | 42 | listView.currentIndex = 0 |
38 | } | 43 | } |
@@ -53,6 +58,8 @@ Controls1.SplitView { | |||
53 | root.pendingError = true | 58 | root.pendingError = true |
54 | } | 59 | } |
55 | 60 | ||
61 | root.pendingNotification = true | ||
62 | |||
56 | var error = { | 63 | var error = { |
57 | timestamp: new Date(), | 64 | timestamp: new Date(), |
58 | message: message.message, | 65 | message: message.message, |