Unity 8
IndicatorRepresentation.qml
1 /*
2  * Copyright 2013 Canonical Ltd.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation; version 3.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authors:
17  * Renato Araujo Oliveira Filho <renato@canonical.com>
18  * Nick Dedekind <nick.dedekind@canonical.com>
19  */
20 
21 import QtQuick 2.4
22 import Ubuntu.Components 1.3
23 import Ubuntu.Components.ListItems 1.3 as ListItem
24 import "../.."
25 
26 Page {
27  id: root
28 
29  title: indicatorProperties && indicatorProperties.title ? indicatorProperties.title :
30  indicatorProperties && indicatorProperties.accessibleName ? indicatorProperties.accessibleName
31  : ""
32  property variant indicatorProperties
33 
34  anchors.fill: parent
35 
36  ListItem.Standard {
37  id: visualCheckItem
38  text: "Enable Visual Representation"
39  control: Switch {
40  id: visualCheck
41  checked: true
42  }
43  }
44 
45  Loader {
46  id: pageLoader
47  objectName: "pageLoader"
48  clip:true
49  asynchronous: true
50 
51  Rectangle {
52  anchors.fill: pageLoader
53  color: "#221e1c" // FIXME not in palette yet
54  }
55 
56  anchors {
57  top: visualCheckItem.bottom
58  left: parent.left
59  right: parent.right
60  bottom: buttons.top
61  topMargin: units.gu(2)
62  bottomMargin: units.gu(2)
63  }
64  sourceComponent: visualCheck.checked ? page : tree
65 
66  Component {
67  id: page
68  IndicatorPage {
69  identifier: model.identifier
70  busName: indicatorProperties.busName
71  actionsObjectPath: indicatorProperties.actionsObjectPath
72  menuObjectPath: indicatorProperties.menuObjectPath
73  }
74  }
75  Component {
76  id: tree
77  IndicatorsTree {
78  identifier: model.identifier
79  busName: indicatorProperties.busName
80  actionsObjectPath: indicatorProperties.actionsObjectPath
81  menuObjectPath: indicatorProperties.menuObjectPath
82  }
83  }
84  }
85 
86  Item {
87  id: buttons
88  anchors {
89  left: parent.left
90  right: parent.right
91  bottom: parent.bottom
92  margins: units.gu(1)
93  }
94  height: childrenRect.height
95 
96  Button {
97  anchors {
98  left: parent.left
99  }
100  text: "Back"
101  onClicked: root.pageStack.reset()
102  }
103  }
104 }