on xenial help sign in
Add divider dots.
commit9f6a37d59f0a4ca8b20ab82c4be79bc77ee02940 authorYing-Chun Liu <paul.liu@canonical.com> dateTue 29 Jul 2014, 23:20 (12 years ago) parentd6e0fa4
6 files changed+49
qml/Components/PageHeader.qml+24 qml/Components/graphics/dot_off@30.png qml/Components/graphics/dot_on@30.png qml/Dash/DashContent.qml+2 qml/Dash/GenericScopeView.qml+2 tests/qmltests/Components/tst_PageHeader.qml+21
qml/Components/PageHeader.qml+24
@@ -35,6 +35,8 @@ Item {
3535 property bool searchInProgress: false
3636
3737 property alias bottomItem: bottomContainer.children
38+ property int dividerDotsCount: 0
39+ property int dividerDotsIndex: -1
3840
3941 // TODO We should use foreground for the icons
4042 // of the toolbar but unfortunately Action does not have
@@ -277,6 +279,28 @@ Item {
277279 }
278280 }
279281
282+ Row {
283+ id: dividerDotsRow
284+ objectName: "dividerDotsRow"
285+ spacing: units.gu(.5)
286+ Repeater {
287+ id: dividerDotsRepeater
288+ objectName: "dividerDotsRepeater"
289+ model: root.dividerDotsCount
290+ Image {
291+ objectName: "dividerDots_" + index
292+ height: units.gu(1)
293+ width: height
294+ source: (index == root.dividerDotsIndex) ? "graphics/dot_on.png" : "graphics/dot_off.png"
295+ }
296+ }
297+ anchors {
298+ top: headerContainer.bottom
299+ horizontalCenter: headerContainer.horizontalCenter
300+ topMargin: units.gu(.5)
301+ }
302+ }
303+
280304 Component {
281305 id: popoverComponent
282306 Popover {
qml/Components/graphics/dot_off@30.pngnew file

Binary file not shown.

qml/Components/graphics/dot_on@30.pngnew file

Binary file not shown.

qml/Dash/DashContent.qml+2
@@ -141,6 +141,8 @@ Item {
141141 item.scope = Qt.binding(function() { return scope })
142142 item.isCurrent = Qt.binding(function() { return visible && ListView.isCurrentItem })
143143 dashContent.scopeLoaded(item.scope.id)
144+ item.dividerDotsCount = Qt.binding(function() { return dashContentList.count } )
145+ item.dividerDotsIndex = Qt.binding(function() { return dashContentList.currentIndex } )
144146 }
145147 Connections {
146148 target: isCurrent ? scope : null
qml/Dash/GenericScopeView.qml+2
@@ -33,6 +33,8 @@ FocusScope {
3333 property bool hasBackAction: false
3434 property bool enableHeightBehaviorOnNextCreation: false
3535 property var categoryView: categoryView
36+ property alias dividerDotsCount: pageHeader.dividerDotsCount
37+ property alias dividerDotsIndex: pageHeader.dividerDotsIndex
3638
3739 property var scopeStyle: ScopeStyle {
3840 style: scope ? scope.customizations : {}
tests/qmltests/Components/tst_PageHeader.qml+21
@@ -175,6 +175,27 @@ Item {
175175 ];
176176 }
177177
178+ function test_divider_dots() {
179+ var dividerDotsRepeater = findChild(pageHeader, "dividerDotsRepeater");
180+ tryCompare(dividerDotsRepeater, "count", 0);
181+ pageHeader.dividerDotsCount = 5;
182+ tryCompare(dividerDotsRepeater, "count", 5);
183+ for (var i=0; i<pageHeader.dividerDotsCount; i++) {
184+ pageHeader.dividerDotsIndex = i;
185+ for (var j=0; j<dividerDotsRepeater.count; j++) {
186+ var dividerDot = findChild(pageHeader, "dividerDots_"+j);
187+ if (i==j) {
188+ compare(dividerDot.source.toString().indexOf("dot_on") > -1, true);
189+ } else {
190+ compare(dividerDot.source.toString().indexOf("dot_off") > -1, true);
191+ }
192+ }
193+ }
194+ pageHeader.dividerDotsIndex = -1;
195+ pageHeader.dividerDotsCount = 0;
196+ tryCompare(dividerDotsRepeater, "count", 0);
197+ }
198+
178199 function test_tap_outside_closes_popup(data) {
179200 searchEnabled = true;
180201 pageHeader.searchHistory.clear();