summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-07-22 04:30:45 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-07-22 04:30:45 +0200
commit7eddc26d24defb3444e21adfbd43f8e568be576d (patch)
tree3304b432ba49ef52df8f9de993a7ea4694dc0fff
parent26e02b898d3f4e63c942d2742cb920aec9e6489c (diff)
downloadkube-7eddc26d24defb3444e21adfbd43f8e568be576d.tar.gz
kube-7eddc26d24defb3444e21adfbd43f8e568be576d.zip
ModelIndexRetriever to abuse Repeater less publicly
Simliar to Retriever, but we'd have to alias all properties/roles automatically somehow.
-rw-r--r--components/kube/contents/ui/LogView.qml19
-rw-r--r--framework/qml/ModelIndexRetriever.qml32
-rw-r--r--framework/qmldir1
3 files changed, 39 insertions, 13 deletions
diff --git a/components/kube/contents/ui/LogView.qml b/components/kube/contents/ui/LogView.qml
index 0d01ed6f..918597df 100644
--- a/components/kube/contents/ui/LogView.qml
+++ b/components/kube/contents/ui/LogView.qml
@@ -122,24 +122,17 @@ Controls.SplitView {
122 property date timestamp 122 property date timestamp
123 property string message 123 property string message
124 property string resourceId: "" 124 property string resourceId: ""
125 property string accountId: "" 125 property string accountId: retriever.currentData.accountId
126 property string accountName: "" 126 property string accountName: retriever.currentData.name
127 color: Kube.Colors.backgroundColor 127 color: Kube.Colors.backgroundColor
128 Repeater { 128
129 Kube.ModelIndexRetriever {
130 id: retriever
129 model: Kube.AccountsModel { 131 model: Kube.AccountsModel {
130 id: accountsModel
131 resourceId: details.resourceId 132 resourceId: details.resourceId
132 } 133 }
133 Item {
134 property string account: model.accountId
135 property string accountName: model.name
136 onAccountChanged: {
137 details.accountId = account
138 details.accountName = name
139 }
140 visible: false
141 }
142 } 134 }
135
143 Rectangle { 136 Rectangle {
144 anchors { 137 anchors {
145 fill: parent 138 fill: parent
diff --git a/framework/qml/ModelIndexRetriever.qml b/framework/qml/ModelIndexRetriever.qml
new file mode 100644
index 00000000..fa3fb64b
--- /dev/null
+++ b/framework/qml/ModelIndexRetriever.qml
@@ -0,0 +1,32 @@
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
19import QtQuick 2.4
20
21Repeater {
22 id: root
23 property var currentData
24 Item {
25 id: delegate
26 property var currentData: model
27 onCurrentDataChanged: {
28 root.currentData = model
29 }
30 visible: false
31 }
32}
diff --git a/framework/qmldir b/framework/qmldir
index b7e455b3..0a71b6c8 100644
--- a/framework/qmldir
+++ b/framework/qmldir
@@ -33,6 +33,7 @@ ListView 1.0 ListView.qml
33TreeView 1.0 TreeView.qml 33TreeView 1.0 TreeView.qml
34GridView 1.0 GridView.qml 34GridView 1.0 GridView.qml
35ScrollHelper 1.0 ScrollHelper.qml 35ScrollHelper 1.0 ScrollHelper.qml
36ModelIndexRetriever 1.0 ModelIndexRetriever.qml
36singleton Messages 1.0 Messages.qml 37singleton Messages 1.0 Messages.qml
37singleton Colors 1.0 Colors.qml 38singleton Colors 1.0 Colors.qml
38singleton Icons 1.0 Icons.qml 39singleton Icons 1.0 Icons.qml