on xenial help sign in
IndicatorsClient: use PageHeader and ListItemLayout's

Approved by: Albert Astals Cid

commit91236b769f93514bbe3161136b594c3d332e5993 authorMarco Trevisan (Treviño) <mail@3v1n0.net> dateFri 9 Sep 2016, 14:52 (10 years ago) parentf004aa87b5207e
4 files changed+50−56
qml/Panel/Indicators/client/IndicatorRepresentation.qml+27−23 qml/Panel/Indicators/client/IndicatorsClient.qml+1−1 qml/Panel/Indicators/client/IndicatorsList.qml+18−24 qml/Panel/Indicators/client/IndicatorsTree.qml+4−8
qml/Panel/Indicators/client/IndicatorRepresentation.qml+27−23
@@ -20,25 +20,42 @@
2020
2121import QtQuick 2.4
2222import Ubuntu.Components 1.3
23−import Ubuntu.Components.ListItems 1.3 as ListItem
2423import "../.."
2524
2625Page {
2726 id: root
28−
29− title: indicatorProperties && indicatorProperties.title ? indicatorProperties.title :
30− indicatorProperties && indicatorProperties.accessibleName ? indicatorProperties.accessibleName
31− : ""
3227 property variant indicatorProperties
3328
29+ header: PageHeader {
30+ title: indicatorProperties && indicatorProperties.title ? indicatorProperties.title :
31+ indicatorProperties && indicatorProperties.accessibleName ? indicatorProperties.accessibleName
32+ : identifier
33+ }
34+
3435 anchors.fill: parent
3536
36− ListItem.Standard {
37+ ListItem {
38+ color: theme.palette.highlighted.background
3739 id: visualCheckItem
38− text: "Enable Visual Representation"
39− control: Switch {
40− id: visualCheck
41− checked: true
40+
41+ anchors {
42+ top: header.bottom
43+ left: parent.left
44+ right: parent.right
45+ }
46+
47+ height: selectorLayout.height
48+ onClicked: visualCheck.checked = !visualCheck.checked
49+
50+ ListItemLayout {
51+ id: selectorLayout
52+ title.text: "Enable Visual Representation"
53+
54+ Switch {
55+ id: visualCheck
56+ checked: true
57+ SlotsLayout.position: SlotsLayout.Trailing
58+ }
4259 }
4360 }
4461
@@ -48,11 +65,6 @@ Page {
4865 clip:true
4966 asynchronous: true
5067
51− Rectangle {
52− anchors.fill: pageLoader
53− color: "#221e1c" // FIXME not in palette yet
54− }
55−
5668 anchors {
5769 top: visualCheckItem.bottom
5870 left: parent.left
@@ -92,13 +104,5 @@ Page {
92104 margins: units.gu(1)
93105 }
94106 height: childrenRect.height
95−
96− Button {
97− anchors {
98− left: parent.left
99− }
100− text: "Back"
101− onClicked: root.pageStack.reset()
102− }
103107 }
104108}
qml/Panel/Indicators/client/IndicatorsClient.qml+1−1
@@ -21,8 +21,8 @@ import QtQuick 2.4
2121import Ubuntu.Components 1.3
2222
2323Rectangle {
24− color: theme.palette.normal.background
2524 id: root
25+ color: theme.palette.normal.background
2626
2727 Component.onCompleted: {
2828 theme.name = "Ubuntu.Components.Themes.SuruDark"
qml/Panel/Indicators/client/IndicatorsList.qml+18−24
@@ -1,5 +1,5 @@
11/*
2− * Copyright 2013 Canonical Ltd.
2+ * Copyright 2013-2016 Canonical Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU Lesser General Public License as published by
@@ -15,11 +15,11 @@
1515 *
1616 * Authors:
1717 * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ * Marco Trevisan <marco.trevisan@canonical.com>
1819 */
1920
2021import QtQuick 2.4
2122import Ubuntu.Components 1.3
22−import Ubuntu.Components.ListItems 1.3 as ListItem
2323import Unity.Indicators 0.1 as Indicators
2424import "../.."
2525import "../../../Components"
@@ -28,7 +28,9 @@ Page {
2828 id: page
2929 anchors.fill: parent
3030 property string profile: ""
31− title: "Plugin list"
31+ header: PageHeader {
32+ title: "Indicators List"
33+ }
3234
3335 Indicators.IndicatorsModel {
3436 id: indicatorsModel
@@ -42,32 +44,24 @@ Page {
4244 anchors.fill: parent
4345 model: indicatorsModel
4446
45− delegate: Rectangle {
46− color: "#221e1c"
47−
48− anchors.left: parent.left
49− anchors.right: parent.right
50− height: menuItem.height
47+ delegate: ListItem {
48+ objectName: identifier
49+ height: menuItem.height + (divider.visible ? divider.height : 0)
5150
52− ListItem.Standard {
51+ ListItemLayout {
5352 id: menuItem
54− anchors.left: parent.left
55− anchors.right: parent.right
56− objectName: identifier
57−
58− text: identifier
59−
60− onClicked: {
61− var new_page = Qt.createComponent("IndicatorRepresentation.qml");
62− if (new_page.status !== Component.Ready) {
63− if (new_page.status === Component.Error)
64− console.error("Error: " + new_page.errorString());
53+ title.text: identifier
54+ }
6555
66− return;
67− }
56+ onClicked: {
57+ var new_page = Qt.createComponent("IndicatorRepresentation.qml");
58+ if (new_page.status !== Component.Ready) {
59+ if (new_page.status === Component.Error)
60+ console.error("Error: " + new_page.errorString());
6861
69− page.pageStack.push(new_page.createObject(pages), {"indicatorProperties" : model.indicatorProperties });
62+ return;
7063 }
64+ page.pageStack.push(new_page.createObject(pages), {"indicatorProperties" : model.indicatorProperties });
7165 }
7266 }
7367 }
qml/Panel/Indicators/client/IndicatorsTree.qml+4−8
@@ -31,14 +31,10 @@ IndicatorBase {
3131 model: root.menuModel
3232 }
3333
34− Flickable {
34+ TextArea {
3535 anchors.fill: parent
36− contentHeight: all_data.height
37− clip:true
38− Text {
39− id: all_data
40− color: "white"
41− text: printer.text
42− }
36+ anchors.margins: units.gu(0.5)
37+ id: all_data
38+ text: printer.text
4339 }
4440}