Lomiri
Loading...
Searching...
No Matches
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
21import QtQuick 2.12
22import Lomiri.Components 1.3
23import ".."
24import "../.."
25
26Page {
27 id: root
28 property variant indicatorProperties
29
30 header: PageHeader {
31 title: indicatorProperties && indicatorProperties.title ? indicatorProperties.title :
32 indicatorProperties && indicatorProperties.accessibleName ? indicatorProperties.accessibleName
33 : identifier
34 }
35
36 anchors.fill: parent
37
38 ListItem {
39 color: theme.palette.highlighted.background
40 id: visualCheckItem
41
42 anchors {
43 top: header.bottom
44 left: parent.left
45 right: parent.right
46 }
47
48 height: selectorLayout.height
49 onClicked: visualCheck.checked = !visualCheck.checked
50
51 ListItemLayout {
52 id: selectorLayout
53 title.text: "Enable Visual Representation"
54
55 Switch {
56 id: visualCheck
57 checked: true
58 SlotsLayout.position: SlotsLayout.Trailing
59 }
60 }
61 }
62
63 Loader {
64 id: pageLoader
65 objectName: "pageLoader"
66 clip:true
67 asynchronous: true
68
69 anchors {
70 top: visualCheckItem.bottom
71 left: parent.left
72 right: parent.right
73 bottom: buttons.top
74 topMargin: units.gu(2)
75 bottomMargin: units.gu(2)
76 }
77 sourceComponent: visualCheck.checked ? page : tree
78
79 Component {
80 id: page
81 PanelMenuPage {
82 objectName: model.identifier + "-page"
83 submenuIndex: 0
84
85 menuModel: delegate.menuModel
86
87 factory: IndicatorMenuItemFactory {
88 indicator: model.identifier
89 rootModel: delegate.menuModel
90 }
91
92 IndicatorDelegate {
93 id: delegate
94 busName: indicatorProperties.busName
95 actionsObjectPath: indicatorProperties.actionsObjectPath
96 menuObjectPath: indicatorProperties.menuObjectPath
97 }
98 }
99 }
100 Component {
101 id: tree
102 IndicatorsTree {
103 identifier: model.identifier
104 busName: indicatorProperties.busName
105 actionsObjectPath: indicatorProperties.actionsObjectPath
106 menuObjectPath: indicatorProperties.menuObjectPath
107 }
108 }
109 }
110
111 Item {
112 id: buttons
113 anchors {
114 left: parent.left
115 right: parent.right
116 bottom: parent.bottom
117 margins: units.gu(1)
118 }
119 height: childrenRect.height
120 }
121}