on xenial help sign in
More stuff addressed
commit3c508c31c7fa392babce5aafe5127ca79b318dc5 authorAndrea Cimitan <andrea.cimitan@gmail.com> dateMon 18 Aug 2014, 12:34 (12 years ago) parentaf0bee6
8 files changed+35−101
qml/Dash/DashContent.qml+1−1 qml/Dash/GenericScopeView.qml+4−4 qml/Dash/PageHeader.qml−1 qml/Dash/ScopeSettings/ScopeSettingBoolean.qml+2−1 qml/Dash/ScopeSettings/ScopeSettingNumber.qml+2−54 qml/Dash/ScopeSettings/ScopeSettingString.qml+16−4 qml/Dash/ScopeSettings/ScopeSettings.qml−34 qml/Dash/ScopeSettingsPage.qml+10−2
qml/Dash/DashContent.qml+1−1
@@ -138,9 +138,9 @@ Item {
138138
139139 readonly property bool moving: item ? item.moving : false
140140 readonly property bool navigationShown: item ? item.navigationShown : false
141+ readonly property bool settingsShown: item ? item.settingsShown : false
141142 readonly property var categoryView: item ? item.categoryView : null
142143 readonly property var theScope: scope
143− readonly property bool settingsShown: item ? item.settingsShown : false
144144
145145 // these are needed for autopilot tests
146146 readonly property string scopeId: scope.id
qml/Dash/GenericScopeView.qml+4−4
@@ -469,10 +469,10 @@ FocusScope {
469469 property int initialIndex: -1
470470 property var model: null
471471
472− readonly property bool processing: status === Loader.Ready && item.hasOwnProperty("processing") ? item.processing : false
473− readonly property int count: status === Loader.Ready && item.hasOwnProperty("count") ? item.count : 0
474− readonly property int currentIndex: status === Loader.Ready && item.hasOwnProperty("currentIndex") ? item.currentIndex : false
475− readonly property var currentItem: status === Loader.Ready && item.hasOwnProperty("currentItem") ? item.currentItem : false
472+ readonly property bool processing: item && item.processing || false
473+ readonly property int count: item && item.count || 0
474+ readonly property int currentIndex: item && item.currentIndex || -1
475+ readonly property var currentItem: item && item.currentItem || null
476476
477477 property string subPage: ""
478478 readonly property bool previewShown: open && subPage == "preview"
qml/Dash/PageHeader.qml−1
@@ -47,7 +47,6 @@ Item {
4747 property var scopeStyle: null
4848
4949 signal backClicked()
50−
5150 signal settingsClicked()
5251
5352 onScopeStyleChanged: refreshLogo()
qml/Dash/ScopeSettings/ScopeSettingBoolean.qml+2−1
@@ -40,7 +40,8 @@ ScopeSetting {
4040 }
4141 text: widgetData.displayName
4242 elide: Text.ElideMiddle
43− color: scopeStyle ? scopeStyle.foreground : "grey"
43+ maximumLineCount: 1
44+ color: scopeStyle ? scopeStyle.foreground : Theme.palette.normal.baseText
4445 }
4546
4647 CheckBox {
qml/Dash/ScopeSettings/ScopeSettingNumber.qml+2−54
@@ -15,59 +15,7 @@
1515 */
1616
1717import QtQuick 2.2
18−import Ubuntu.Components 1.1
19−import Ubuntu.Components.ListItems 1.0 as ListItem
2018
21−ScopeSetting {
22− id: root
23− height: listItem.height
24−
25− ListItem.Empty {
26− id: listItem
27− onClicked: {
28− control.forceActiveFocus();
29− control.selectAll();
30− }
31−
32− Label {
33− anchors {
34− left: parent.left
35− leftMargin: __margins
36− right: control.left
37− rightMargin: units.gu(1)
38− verticalCenter: parent.verticalCenter
39− }
40− text: widgetData.displayName
41− elide: Text.ElideMiddle
42− color: scopeStyle ? scopeStyle.foreground : "grey"
43− }
44−
45− TextField {
46− id: control
47− objectName: "control"
48− anchors {
49− right: parent.right
50− rightMargin: __margins
51− verticalCenter: parent.verticalCenter
52− }
53− text: widgetData.value
54− width: units.gu(8)
55− validator: DoubleValidator {}
56− hasClearButton: false
57−
58− function updateText() {
59− if (acceptableInput) {
60− text = displayText;
61− root.updated(text);
62− }
63− }
64−
65− onAccepted: updateText()
66− onActiveFocusChanged: {
67− if (!activeFocus) {
68− updateText();
69− }
70− }
71− }
72− }
19+ScopeSettingString {
20+ mode: "number"
7321}
qml/Dash/ScopeSettings/ScopeSettingString.qml+16−4
@@ -22,6 +22,8 @@ ScopeSetting {
2222 id: root
2323 height: listItem.height
2424
25+ property string mode: "string"
26+
2527 ListItem.Empty {
2628 id: listItem
2729 onClicked: {
@@ -40,7 +42,8 @@ ScopeSetting {
4042 }
4143 text: widgetData.displayName
4244 elide: Text.ElideMiddle
43− color: scopeStyle ? scopeStyle.foreground : "grey"
45+ maximumLineCount: 1
46+ color: scopeStyle ? scopeStyle.foreground : Theme.palette.normal.baseText
4447 }
4548
4649 TextField {
@@ -51,12 +54,21 @@ ScopeSetting {
5154 rightMargin: __margins
5255 verticalCenter: parent.verticalCenter
5356 }
54− width: units.gu(12)
57+ width: root.mode == "number" ? units.gu(8) : units.gu(12)
5558 text: widgetData.value
59+ color: scopeStyle ? scopeStyle.foreground : Theme.palette.normal.fieldText
60+ validator: root.mode == "number" ? doubleValidator : null
61+ hasClearButton: root.mode == "number" ? false : true
62+
63+ DoubleValidator {
64+ id: doubleValidator
65+ }
5666
5767 function updateText() {
58− text = displayText;
59− root.updated(text);
68+ if (acceptableInput) {
69+ text = displayText;
70+ root.updated(text);
71+ }
6072 }
6173
6274 onAccepted: updateText()
qml/Dash/ScopeSettings/ScopeSettings.qmldeleted−34
@@ -1,34 +0,0 @@
1−/*
2− * Copyright (C) 2014 Canonical, Ltd.
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; 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 General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.2
18−import Ubuntu.Components 1.1
19−
20−ListView {
21− //! The ScopeStyle component.
22− property var scopeStyle: null
23−
24− orientation: ListView.Vertical
25−
26− delegate: ScopeSettingsWidgetFactory {
27− objectName: "scopeSettingItem" + index
28− width: root.width
29− widgetData: model
30− scopeStyle: root.scopeStyle
31−
32− onUpdated: model.value = value;
33− }
34−}
qml/Dash/ScopeSettingsPage.qml+10−2
@@ -34,13 +34,12 @@ Item {
3434 width: parent.width
3535 title: scope ? scope.name : ""
3636 showBackButton: true
37− searchEntryEnabled: false
3837 scopeStyle: root.scopeStyle || undefined
3938
4039 onBackClicked: root.backClicked()
4140 }
4241
43− ScopeSettings {
42+ ListView {
4443 id: scopeSettings
4544 objectName: "scopeSettings"
4645 anchors {
@@ -50,5 +49,14 @@ Item {
5049 right: parent.right
5150 }
5251 model: root.scope ? root.scope.settings : null
52+
53+ delegate: ScopeSettingsWidgetFactory {
54+ objectName: "scopeSettingItem" + index
55+ width: root.width
56+ widgetData: model
57+ scopeStyle: root.scopeStyle
58+
59+ onUpdated: model.value = value;
60+ }
5361 }
5462}