on xenial help sign in
merge lp:unity8
cd1f0fdAlbert Astals
Bottombar/Bottombar.qml+4−4
@@ -16,10 +16,10 @@
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18import "../Components"
18import "../Components"
19−import "../Components/Math.js" as MathLocal
19+import Utils 0.1
20−import Unity 0.1
21import Unity.Application 0.1
20import Unity.Application 0.1
22import Ubuntu.Gestures 0.1
21import Ubuntu.Gestures 0.1
22+import Ubuntu.Components 0.1
23
23
24Item {
24Item {
25 id: bottombar
25 id: bottombar
@@ -82,7 +82,7 @@ Item {
82
82
83 readonly property bool centeredHud: parent.width < units.gu(68) // Nexus 7 has 67 gu width
83 readonly property bool centeredHud: parent.width < units.gu(68) // Nexus 7 has 67 gu width
84
84
85− x: centeredHud ? parent.width / 2 - width / 2 : MathLocal.clamp(dragArea.touchStartX - (width / 2), 0, bottombar.width - width)
85+ x: centeredHud ? parent.width / 2 - width / 2 : MathUtils.clamp(dragArea.touchStartX - (width / 2), 0, bottombar.width - width)
86 y: bottombar.height - bottomEdgeButtonCenterDistance - (height / 2) - bottomMargin
86 y: bottombar.height - bottomEdgeButtonCenterDistance - (height / 2) - bottomMargin
87 z: 1
87 z: 1
88 visible: opacity != 0
88 visible: opacity != 0
@@ -136,7 +136,7 @@ Item {
136 readonly property real distanceFromThreshold: (-distance) - distanceThreshold // distance is negative
136 readonly property real distanceFromThreshold: (-distance) - distanceThreshold // distance is negative
137 readonly property real revealDistance: units.gu(2)
137 readonly property real revealDistance: units.gu(2)
138 readonly property real commitDistance: units.gu(6)
138 readonly property real commitDistance: units.gu(6)
139− readonly property real commitProgress: MathLocal.clamp(distanceFromThreshold / commitDistance, 0, 1)
139+ readonly property real commitProgress: MathUtils.clamp(distanceFromThreshold / commitDistance, 0, 1)
140
140
141 onStatusChanged: {
141 onStatusChanged: {
142 if (status === DirectionalDragArea.WaitingForTouch) {
142 if (status === DirectionalDragArea.WaitingForTouch) {
Components/Carousel.qml+4−6
@@ -54,15 +54,13 @@ Item {
54
54
55 /// Emitted when the user clicked on an item
55 /// Emitted when the user clicked on an item
56 /// @param index is the index of the clicked item
56 /// @param index is the index of the clicked item
57− /// @param model is the model of all the items in the carousel
58 /// @param itemY is y of the clicked delegate
57 /// @param itemY is y of the clicked delegate
59− signal clicked(int index, var model, real itemY)
58+ signal clicked(int index, real itemY)
60
59
61 /// Emitted when the user pressed and held on an item
60 /// Emitted when the user pressed and held on an item
62 /// @param index is the index of the held item
61 /// @param index is the index of the held item
63− /// @param model is the model of all the items in the carousel
64 /// @param itemY is y of the held delegate
62 /// @param itemY is y of the held delegate
65− signal pressAndHold(int index, var model, real itemY)
63+ signal pressAndHold(int index, real itemY)
66
64
67 implicitHeight: listView.tileHeight * selectedItemScaleFactor
65 implicitHeight: listView.tileHeight * selectedItemScaleFactor
68
66
@@ -163,7 +161,7 @@ Item {
163 /* We're clicking the selected item and
161 /* We're clicking the selected item and
164 we're in the neighbourhood of radius 1 pixel from it.
162 we're in the neighbourhood of radius 1 pixel from it.
165 Let's emit the clicked signal. */
163 Let's emit the clicked signal. */
166− carousel.clicked(index, listView.model, delegateItem.y)
164+ carousel.clicked(index, delegateItem.y)
167 return
165 return
168 }
166 }
169
167
@@ -187,7 +185,7 @@ Item {
187 /* We're pressAndHold the selected item and
185 /* We're pressAndHold the selected item and
188 we're in the neighbourhood of radius 1 pixel from it.
186 we're in the neighbourhood of radius 1 pixel from it.
189 Let's emit the pressAndHold signal. */
187 Let's emit the pressAndHold signal. */
190− carousel.pressAndHold(index, listView.model, delegateItem.y);
188+ carousel.pressAndHold(index, delegateItem.y);
191 return;
189 return;
192 }
190 }
193
191
Components/DragHandle.qml+1−2
@@ -17,7 +17,6 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import Ubuntu.Components 0.1
18import Ubuntu.Components 0.1
19import Ubuntu.Gestures 0.1
19import Ubuntu.Gestures 0.1
20−import "Math.js" as MathLocal
21
20
22/*
21/*
23 Put a DragHandle inside a Showable to enable the user to drag it from that handle.
22 Put a DragHandle inside a Showable to enable the user to drag it from that handle.
@@ -117,7 +116,7 @@ EdgeDragArea {
117 }
116 }
118
117
119 function limitMovement(inputStep) {
118 function limitMovement(inputStep) {
120− var targetValue = MathLocal.clamp(dragParent[targetProp] + inputStep, minValue, maxValue);
119+ var targetValue = MathUtils.clamp(dragParent[targetProp] + inputStep, minValue, maxValue);
121 var step = targetValue - dragParent[targetProp];
120 var step = targetValue - dragParent[targetProp];
122
121
123 if (hintDisplacement == 0) {
122 if (hintDisplacement == 0) {
Components/DraggingArea.qml+1−2
@@ -16,7 +16,6 @@
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18import Ubuntu.Components 0.1
18import Ubuntu.Components 0.1
19−import "Math.js" as MathLocal
20
19
21MouseArea {
20MouseArea {
22 id: draggingArea
21 id: draggingArea
@@ -26,7 +25,7 @@ MouseArea {
26 property real dragVelocity: 0
25 property real dragVelocity: 0
27 property real dragValue: (orientation == Qt.Vertical ? (mouseY - __pressedPosition.y)
26 property real dragValue: (orientation == Qt.Vertical ? (mouseY - __pressedPosition.y)
28 : (mouseX - __pressedPosition.x))
27 : (mouseX - __pressedPosition.x))
29− property real lateralPosition: orientation == Qt.Horizontal ? MathLocal.clamp(mouseY, 0, height) : MathLocal.clamp(mouseX, 0, width)
28+ property real lateralPosition: orientation == Qt.Horizontal ? MathUtils.clamp(mouseY, 0, height) : MathUtils.clamp(mouseX, 0, width)
30 property point __pressedPosition: Qt.point(0, 0)
29 property point __pressedPosition: Qt.point(0, 0)
31 property var __dragEvents: []
30 property var __dragEvents: []
32 property bool clickValidated: true
31 property bool clickValidated: true
Components/Math.jsdeleted−26
@@ -1,26 +0,0 @@
1−/*
2− * Copyright (C) 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 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−.pragma library
18−
19−function clamp(value, min, max) {
20− if (min <= max) {
21− return Math.max(min, Math.min(max, value))
22− } else {
23− // swap min/max if min > max
24− return clamp(value, max, min)
25− }
26−}
Components/Revealer.qml+1−2
@@ -16,7 +16,6 @@
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18import Ubuntu.Components 0.1
18import Ubuntu.Components 0.1
19−import "Math.js" as MathLocal
20
19
21Item {
20Item {
22 id: revealer
21 id: revealer
@@ -95,7 +94,7 @@ Item {
95 onClosedValueChanged: if (!__opened && !dragging) target[boundProperty] = closedValue
94 onClosedValueChanged: if (!__opened && !dragging) target[boundProperty] = closedValue
96
95
97 function __computeValue(dragPosition) {
96 function __computeValue(dragPosition) {
98− return MathLocal.clamp(dragToValue(dragPosition), __hintValue, openedValue)
97+ return MathUtils.clamp(dragToValue(dragPosition), __hintValue, openedValue)
99 }
98 }
100
99
101 function __open() {
100 function __open() {
Dash/Apps/DashPluginFilterGrid.qml+2−2
@@ -37,11 +37,11 @@ GenericFilterGrid {
37 }
37 }
38
38
39 onClicked: {
39 onClicked: {
40− filtergrid.clicked(index, filtergrid.model, tile.y)
40+ filtergrid.clicked(index, tile.y)
41 }
41 }
42
42
43 onPressAndHold: {
43 onPressAndHold: {
44− filtergrid.pressAndHold(index, filtergrid.model, tile.y)
44+ filtergrid.pressAndHold(index, tile.y)
45 }
45 }
46 }
46 }
47}
47}
Dash/Generic/GenericFilterGrid.qml+4−4
@@ -28,8 +28,8 @@ FilterGrid {
28 property int iconWidth: units.gu(8)
28 property int iconWidth: units.gu(8)
29 property int iconHeight: units.gu(7.5)
29 property int iconHeight: units.gu(7.5)
30
30
31− signal clicked(int index, var model, real itemY)
31+ signal clicked(int index, real itemY)
32− signal pressAndHold(int index, var model, real itemY)
32+ signal pressAndHold(int index, real itemY)
33
33
34 delegate: Tile {
34 delegate: Tile {
35 id: tile
35 id: tile
@@ -42,11 +42,11 @@ FilterGrid {
42 source: model.icon
42 source: model.icon
43
43
44 onClicked: {
44 onClicked: {
45− filtergrid.clicked(index, filtergrid.model, tile.y)
45+ filtergrid.clicked(index, tile.y)
46 }
46 }
47
47
48 onPressAndHold: {
48 onPressAndHold: {
49− filtergrid.pressAndHold(index, filtergrid.model, tile.y)
49+ filtergrid.pressAndHold(index, tile.y)
50 }
50 }
51 }
51 }
52}
52}
Dash/Generic/WeatherFilterGrid.qml+2−2
@@ -37,11 +37,11 @@ GenericFilterGrid {
37 style: FlatTileStyle {}
37 style: FlatTileStyle {}
38
38
39 onClicked: {
39 onClicked: {
40− filtergrid.clicked(index, filtergrid.model, tile.y)
40+ filtergrid.clicked(index, tile.y)
41 }
41 }
42
42
43 onPressAndHold: {
43 onPressAndHold: {
44− filtergrid.pressAndHold(index, filtergrid.model, tile.y)
44+ filtergrid.pressAndHold(index, tile.y)
45 }
45 }
46 }
46 }
47}
47}
Dash/GenericScopeView.qml+4−4
@@ -133,11 +133,11 @@ ScopeView {
133 effect.positionPx = mapToItem(categoryView, 0, itemY).y
133 effect.positionPx = mapToItem(categoryView, 0, itemY).y
134 previewListView.categoryId = categoryId
134 previewListView.categoryId = categoryId
135 previewListView.categoryDelegate = rendererLoader.item
135 previewListView.categoryDelegate = rendererLoader.item
136− previewListView.model = model;
136+ previewListView.model = target.model;
137 previewListView.init = true;
137 previewListView.init = true;
138 previewListView.currentIndex = index;
138 previewListView.currentIndex = index;
139
139
140− var item = model.get(index);
140+ var item = target.model.get(index);
141
141
142 if ((scopeView.scope.id == "applications.scope" && categoryId == "installed")
142 if ((scopeView.scope.id == "applications.scope" && categoryId == "installed")
143 || (scopeView.scope.id == "home.scope" && categoryId == "applications.scope")) {
143 || (scopeView.scope.id == "home.scope" && categoryId == "applications.scope")) {
@@ -154,12 +154,12 @@ ScopeView {
154 effect.positionPx = mapToItem(categoryView, 0, itemY).y
154 effect.positionPx = mapToItem(categoryView, 0, itemY).y
155 previewListView.categoryId = categoryId
155 previewListView.categoryId = categoryId
156 previewListView.categoryDelegate = rendererLoader.item
156 previewListView.categoryDelegate = rendererLoader.item
157− previewListView.model = model;
157+ previewListView.model = target.model;
158 previewListView.init = true;
158 previewListView.init = true;
159 previewListView.currentIndex = index;
159 previewListView.currentIndex = index;
160 previewListView.open = true
160 previewListView.open = true
161
161
162− var item = model.get(index)
162+ var item = target.model.get(index)
163 scopeView.scope.preview( item.uri, item.icon, item.category, 0, item.mimetype, item.title,
163 scopeView.scope.preview( item.uri, item.icon, item.category, 0, item.mimetype, item.title,
164 item.comment, item.dndUri, item.metadata)
164 item.comment, item.dndUri, item.metadata)
165 }
165 }
Dash/Music/MusicFilterGrid.qml+2−2
@@ -44,11 +44,11 @@ GenericFilterGrid {
44 }
44 }
45
45
46 onClicked: {
46 onClicked: {
47− filtergrid.clicked(index, filtergrid.model, tile.y)
47+ filtergrid.clicked(index, tile.y)
48 }
48 }
49
49
50 onPressAndHold: {
50 onPressAndHold: {
51− filtergrid.pressAndHold(index, filtergrid.model, tile.y)
51+ filtergrid.pressAndHold(index, tile.y)
52 }
52 }
53 }
53 }
54}
54}
Dash/Video/VideoFilterGrid.qml+2−2
@@ -42,11 +42,11 @@ GenericFilterGrid {
42 style: VideoTileStyle {}
42 style: VideoTileStyle {}
43
43
44 onClicked: {
44 onClicked: {
45− filtergrid.clicked(index, filtergrid.model, tile.y)
45+ filtergrid.clicked(index, tile.y)
46 }
46 }
47
47
48 onPressAndHold: {
48 onPressAndHold: {
49− filtergrid.pressAndHold(index, filtergrid.model, tile.y)
49+ filtergrid.pressAndHold(index, tile.y)
50 }
50 }
51 }
51 }
52}
52}
Greeter/Greeter.qml+1−2
@@ -19,7 +19,6 @@ import Ubuntu.Components 0.1
19import Ubuntu.Gestures 0.1
19import Ubuntu.Gestures 0.1
20import LightDM 0.1 as LightDM
20import LightDM 0.1 as LightDM
21import "../Components"
21import "../Components"
22−import "../Components/Math.js" as MathLocal
23
22
24Showable {
23Showable {
25 id: greeter
24 id: greeter
@@ -29,7 +28,7 @@ Showable {
29 property url defaultBackground
28 property url defaultBackground
30
29
31 // 1 when fully shown and 0 when fully hidden
30 // 1 when fully shown and 0 when fully hidden
32− property real showProgress: MathLocal.clamp((width + x) / width, 0, 1)
31+ property real showProgress: MathUtils.clamp((width + x) / width, 0, 1)
33
32
34 showAnimation: StandardAnimation { property: "x"; to: 0 }
33 showAnimation: StandardAnimation { property: "x"; to: 0 }
35 hideAnimation: StandardAnimation { property: "x"; to: -width }
34 hideAnimation: StandardAnimation { property: "x"; to: -width }
Greeter/GreeterContent.qml+11−11
@@ -74,17 +74,6 @@ MouseArea {
74 opacity: 0.4
74 opacity: 0.4
75 }
75 }
76
76
77− Clock {
78− id: clock
79− visible: narrowMode
80−
81− anchors {
82− top: parent.top
83− topMargin: units.gu(2)
84− horizontalCenter: parent.horizontalCenter
85− }
86− }
87−
88 MouseArea {
77 MouseArea {
89 id: teasingMouseArea
78 id: teasingMouseArea
90 anchors.fill: parent
79 anchors.fill: parent
@@ -163,4 +152,15 @@ MouseArea {
163 right: root.right
152 right: root.right
164 }
153 }
165 }
154 }
155+
156+ Clock {
157+ id: clock
158+ visible: narrowMode
159+
160+ anchors {
161+ top: parent.top
162+ topMargin: units.gu(2)
163+ horizontalCenter: parent.horizontalCenter
164+ }
165+ }
166}
166}
Panel/Indicators.qml+1−2
@@ -21,7 +21,6 @@ import Unity.Indicators 0.1 as Indicators
21
21
22import "../Components"
22import "../Components"
23import "../Components/ListItems"
23import "../Components/ListItems"
24−import "../Components/Math.js" as MathLocal
25
24
26Showable {
25Showable {
27 id: indicators
26 id: indicators
@@ -100,7 +99,7 @@ Showable {
100 Otherwise it contains the bar's location as a fraction of the distance between hintValue (is 0) and lockThreshold (is 1).
99 Otherwise it contains the bar's location as a fraction of the distance between hintValue (is 0) and lockThreshold (is 1).
101 */
100 */
102 var verticalProgress =
101 var verticalProgress =
103− MathLocal.clamp((indicators.height - handle.height - hintValue) /
102+ MathUtils.clamp((indicators.height - handle.height - hintValue) /
104 (lockThreshold - hintValue), 0, 1);
103 (lockThreshold - hintValue), 0, 1);
105
104
106 /*
105 /*
Panel/Indicators/DefaultIndicatorWidget.qml+32−10
@@ -24,7 +24,7 @@ import Unity.Indicators 0.1 as Indicators
24Indicators.IndicatorWidget {
24Indicators.IndicatorWidget {
25 id: indicatorWidget
25 id: indicatorWidget
26
26
27− width: itemRow.width + units.gu(0.5)
27+ width: itemRow.width
28
28
29 property alias leftLabel: itemLeftLabel.text
29 property alias leftLabel: itemLeftLabel.text
30 property alias rightLabel: itemRightLabel.text
30 property alias rightLabel: itemRightLabel.text
@@ -32,16 +32,17 @@ Indicators.IndicatorWidget {
32
32
33 Row {
33 Row {
34 id: itemRow
34 id: itemRow
35+ width: childrenRect.width
35 objectName: "itemRow"
36 objectName: "itemRow"
36 anchors {
37 anchors {
37 top: parent.top
38 top: parent.top
38 bottom: parent.bottom
39 bottom: parent.bottom
39 horizontalCenter: parent.horizontalCenter
40 horizontalCenter: parent.horizontalCenter
40 }
41 }
41− spacing: units.gu(0.5)
42
42
43 Label {
43 Label {
44 id: itemLeftLabel
44 id: itemLeftLabel
45+ width: guRoundUp(implicitWidth)
45 objectName: "leftLabel"
46 objectName: "leftLabel"
46 color: Theme.palette.selected.backgroundText
47 color: Theme.palette.selected.backgroundText
47 opacity: 0.8
48 opacity: 0.8
@@ -57,25 +58,35 @@ Indicators.IndicatorWidget {
57 top: parent.top
58 top: parent.top
58 bottom: parent.bottom
59 bottom: parent.bottom
59 }
60 }
60− spacing: units.gu(0.5)
61
61
62 Repeater {
62 Repeater {
63 model: indicatorWidget.icons
63 model: indicatorWidget.icons
64
64
65− Image {
65+ Item {
66− id: itemImage
66+ width: guRoundUp(itemImage.width)
67− objectName: "itemImage"
68− visible: source != ""
69− source: modelData
70 height: indicatorWidget.iconSize
67 height: indicatorWidget.iconSize
68+
69+ Image {
70+ id: itemImage
71+ objectName: "itemImage"
72+ visible: source != ""
73+ source: modelData
74+ height: parent.height
75+ anchors.horizontalCenter: parent.horizontalCenter
76+ fillMode: Image.PreserveAspectFit
77+
78+ sourceSize {
71− width: indicatorWidget.iconSize
79+ width: indicatorWidget.iconSize
72− anchors.verticalCenter: parent.verticalCenter
80+ height: indicatorWidget.iconSize
81+ }
82+ }
73 }
83 }
74 }
84 }
75 }
85 }
76
86
77 Label {
87 Label {
78 id: itemRightLabel
88 id: itemRightLabel
89+ width: guRoundUp(implicitWidth)
79 objectName: "rightLabel"
90 objectName: "rightLabel"
80 color: Theme.palette.selected.backgroundText
91 color: Theme.palette.selected.backgroundText
81 opacity: 0.8
92 opacity: 0.8
@@ -86,6 +97,17 @@ Indicators.IndicatorWidget {
86 }
97 }
87 }
98 }
88
99
100+ // TODO: Use toolkit function https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1242575
101+ function guRoundUp(width) {
102+ if (width == 0) {
103+ return 0;
104+ }
105+ var gu1 = units.gu(1.0);
106+ var mod = (width % gu1);
107+
108+ return mod == 0 ? width : width + (gu1 - mod);
109+ }
110+
89 onRootActionStateChanged: {
111 onRootActionStateChanged: {
90 if (rootActionState == undefined) {
112 if (rootActionState == undefined) {
91 leftLabel = "";
113 leftLabel = "";
Shell.qml+1−2
@@ -30,7 +30,6 @@ import "Launcher"
30import "Panel"
30import "Panel"
31import "Hud"
31import "Hud"
32import "Components"
32import "Components"
33−import "Components/Math.js" as MathLocal
34import "Bottombar"
33import "Bottombar"
35import "SideStage"
34import "SideStage"
36import "Notifications"
35import "Notifications"
@@ -237,7 +236,7 @@ FocusScope {
237 Behavior on x {SmoothedAnimation{velocity: 600}}
236 Behavior on x {SmoothedAnimation{velocity: 600}}
238
237
239 property real showProgress:
238 property real showProgress:
240− MathLocal.clamp(1 - (x + stages.x) / shell.width, 0, 1)
239+ MathUtils.clamp(1 - (x + stages.x) / shell.width, 0, 1)
241
240
242 Showable {
241 Showable {
243 id: stages
242 id: stages
data/unity8.conf+20
@@ -6,4 +6,24 @@ stop on desktop-end
6
6
7respawn
7respawn
8
8
9+pre-start script
10+ if [ -n "$MIR_SOCKET" ]; then
11+ if [ -z "$UNITY_MIR_SOCKET" ]; then
12+ # Save original value of MIR_SOCKET in case we are restarted,
13+ # as we modify the variable for future jobs, including ourself.
14+ UNITY_MIR_SOCKET=$MIR_SOCKET
15+ initctl set-env --global UNITY_MIR_SOCKET=$UNITY_MIR_SOCKET
16+ fi
17+
18+ # Point unity8 at unity-system-compositor
19+ MIR_SERVER_FILE=$XDG_RUNTIME_DIR/mir_socket
20+ initctl set-env MIR_SERVER_FILE=$MIR_SERVER_FILE
21+ initctl set-env MIR_SERVER_HOST_SOCKET=$UNITY_MIR_SOCKET
22+
23+ # Point all future jobs in this session to our Mir socket instead of
24+ # unity-system-compositor's socket.
25+ initctl set-env --global MIR_SOCKET=$MIR_SERVER_FILE
26+ fi
27+end script
28+
9exec ${BINARY:-unity8} $ARGS
29exec ${BINARY:-unity8} $ARGS
plugins/ListViewWithPageHeader/listviewwithpageheader.cpp+4−1
@@ -155,6 +155,7 @@ ListViewWithPageHeader::ListViewWithPageHeader()
155 , m_topSectionItem(nullptr)
155 , m_topSectionItem(nullptr)
156 , m_forceNoClip(false)
156 , m_forceNoClip(false)
157 , m_inLayout(false)
157 , m_inLayout(false)
158+ , m_inContentHeightKeepHeaderShown(false)
158{
159{
159 m_clipItem = new QQuickItem(contentItem());
160 m_clipItem = new QQuickItem(contentItem());
160// m_clipItem = new QQuickRectangle(contentItem());
161// m_clipItem = new QQuickRectangle(contentItem());
@@ -494,7 +495,7 @@ void ListViewWithPageHeader::viewportMoved(Qt::Orientations orient)
494 if (!scrolledUp && contentY() == -m_minYExtent) {
495 if (!scrolledUp && contentY() == -m_minYExtent) {
495 m_headerItemShownHeight = 0;
496 m_headerItemShownHeight = 0;
496 m_headerItem->setY(contentY());
497 m_headerItem->setY(contentY());
497− } else if ((scrolledUp && notRebounding && notShownByItsOwn && !maximizeVisibleAreaRunning) || (m_headerItemShownHeight > 0)) {
498+ } else if ((scrolledUp && notRebounding && notShownByItsOwn && !maximizeVisibleAreaRunning) || (m_headerItemShownHeight > 0) || m_inContentHeightKeepHeaderShown) {
498 if (maximizeVisibleAreaRunning && diff > 0) // If we are maximizing and the header was shown, make sure we hide it
499 if (maximizeVisibleAreaRunning && diff > 0) // If we are maximizing and the header was shown, make sure we hide it
499 m_headerItemShownHeight -= diff;
500 m_headerItemShownHeight -= diff;
500 else
501 else
@@ -1267,7 +1268,9 @@ void ListViewWithPageHeader::updatePolish()
1267
1268
1268 m_contentHeightDirty = false;
1269 m_contentHeightDirty = false;
1269 adjustMinYExtent();
1270 adjustMinYExtent();
1271+ m_inContentHeightKeepHeaderShown = m_headerItem && m_headerItem->y() == contentY();
1270 setContentHeight(contentHeight);
1272 setContentHeight(contentHeight);
1273+ m_inContentHeightKeepHeaderShown = false;
1271 }
1274 }
1272}
1275}
1273
1276
plugins/ListViewWithPageHeader/listviewwithpageheader.h+1
@@ -202,6 +202,7 @@ private:
202
202
203 bool m_forceNoClip;
203 bool m_forceNoClip;
204 bool m_inLayout;
204 bool m_inLayout;
205+ bool m_inContentHeightKeepHeaderShown;
205
206
206 // Qt 5.0 doesn't like releasing the items just after itemCreated
207 // Qt 5.0 doesn't like releasing the items just after itemCreated
207 // so we delay the releasing until the next updatePolish
208 // so we delay the releasing until the next updatePolish
plugins/Unity/CMakeLists.txt−1
@@ -34,7 +34,6 @@ set(QMLPLUGIN_SRC
34 radiooptionfilter.cpp
34 radiooptionfilter.cpp
35 ratingsfilter.cpp
35 ratingsfilter.cpp
36 ratingfilteroption.cpp
36 ratingfilteroption.cpp
37− bottombarvisibilitycommunicatorshell.cpp
38 applicationpreview.cpp
37 applicationpreview.cpp
39 genericpreview.cpp
38 genericpreview.cpp
40 moviepreview.cpp
39 moviepreview.cpp
plugins/Unity/Indicators/qml/IndicatorWidget.qml+1−1
@@ -24,5 +24,5 @@ IndicatorBase {
24 id: indicatorWidget
24 id: indicatorWidget
25
25
26 enabled: false
26 enabled: false
27− property int iconSize: height - units.gu(0.5)
27+ property int iconSize: height
28}
28}
plugins/Unity/plugin.cpp−12
@@ -17,8 +17,6 @@
17 */
17 */
18
18
19// Qt
19// Qt
20−#include <QDBusConnection>
21−#include <QQmlContext>
22#include <qqml.h>
20#include <qqml.h>
23
21
24// self
22// self
@@ -33,16 +31,12 @@
33#include "scopes.h"
31#include "scopes.h"
34#include "categories.h"
32#include "categories.h"
35#include "categoryresults.h"
33#include "categoryresults.h"
36−#include "bottombarvisibilitycommunicatorshell.h"
37#include "genericoptionsmodel.h"
34#include "genericoptionsmodel.h"
38#include "result.h"
35#include "result.h"
39
36
40// libqtdee
37// libqtdee
41#include "deelistmodel.h"
38#include "deelistmodel.h"
42
39
43−static const char* BOTTOM_BAR_VISIBILITY_COMMUNICATOR_DBUS_PATH = "/BottomBarVisibilityCommunicator";
44−static const char* DBUS_SERVICE = "com.canonical.Shell.BottomBarVisibilityCommunicator";
45−
46void UnityPlugin::registerTypes(const char *uri)
40void UnityPlugin::registerTypes(const char *uri)
47{
41{
48 Q_ASSERT(uri == QLatin1String("Unity"));
42 Q_ASSERT(uri == QLatin1String("Unity"));
@@ -57,7 +51,6 @@ void UnityPlugin::registerTypes(const char *uri)
57 qmlRegisterType<Categories>(uri, 0, 1, "Categories");
51 qmlRegisterType<Categories>(uri, 0, 1, "Categories");
58 qmlRegisterUncreatableType<CategoryResults>(uri, 0, 1, "CategoryResults", "Can't create new Category Results in QML. Get them from Categories instance.");
52 qmlRegisterUncreatableType<CategoryResults>(uri, 0, 1, "CategoryResults", "Can't create new Category Results in QML. Get them from Categories instance.");
59 qmlRegisterType<DeeListModel>(uri, 0, 1, "DeeListModel");
53 qmlRegisterType<DeeListModel>(uri, 0, 1, "DeeListModel");
60− qmlRegisterUncreatableType<BottomBarVisibilityCommunicatorShell>(uri, 0, 1, "BottomBarVisibilityCommunicatorShell", "Can't create BottomBarVisibilityCommunicatorShell");
61}
54}
62
55
63void UnityPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
56void UnityPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
@@ -66,9 +59,4 @@ void UnityPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
66#ifndef GLIB_VERSION_2_36
59#ifndef GLIB_VERSION_2_36
67 g_type_init();
60 g_type_init();
68#endif
61#endif
69−
70− QDBusConnection::sessionBus().registerService(DBUS_SERVICE);
71− BottomBarVisibilityCommunicatorShell *bottomBarVisibilityCommunicator = &BottomBarVisibilityCommunicatorShell::instance();
72− QDBusConnection::sessionBus().registerObject(BOTTOM_BAR_VISIBILITY_COMMUNICATOR_DBUS_PATH, bottomBarVisibilityCommunicator, QDBusConnection::ExportAllContents);
73− engine->rootContext()->setContextProperty("bottomBarVisibilityCommunicatorShell", bottomBarVisibilityCommunicator);
74}
62}
plugins/Utils/CMakeLists.txt+1
@@ -13,6 +13,7 @@ include_directories(
13set(QMLPLUGIN_SRC
13set(QMLPLUGIN_SRC
14 albumartprovider.cpp
14 albumartprovider.cpp
15 applicationpaths.h
15 applicationpaths.h
16+ bottombarvisibilitycommunicatorshell.cpp
16 mediaartcache.cpp
17 mediaartcache.cpp
17 qlimitproxymodelqml.cpp
18 qlimitproxymodelqml.cpp
18 qsortfilterproxymodelqml.cpp
19 qsortfilterproxymodelqml.cpp
plugins/Unity/bottombarvisibilitycommunicatorshell.cpp → plugins/Utils/bottombarvisibilitycommunicatorshell.cpprenamed

The content is the same.

plugins/Unity/bottombarvisibilitycommunicatorshell.h → plugins/Utils/bottombarvisibilitycommunicatorshell.hrenamed

The content is the same.

plugins/Utils/plugin.cpp+12
@@ -18,6 +18,8 @@
18
18
19// Qt
19// Qt
20#include <QtQml/qqml.h>
20#include <QtQml/qqml.h>
21+#include <QDBusConnection>
22+#include <QQmlContext>
21#include <QtQuick/QQuickWindow>
23#include <QtQuick/QQuickWindow>
22#include <QDebug>
24#include <QDebug>
23// self
25// self
@@ -26,11 +28,15 @@
26// local
28// local
27#include "albumartprovider.h"
29#include "albumartprovider.h"
28#include "applicationpaths.h"
30#include "applicationpaths.h"
31+#include "bottombarvisibilitycommunicatorshell.h"
29#include "qlimitproxymodelqml.h"
32#include "qlimitproxymodelqml.h"
30#include "qsortfilterproxymodelqml.h"
33#include "qsortfilterproxymodelqml.h"
31#include "ubuntuwindow.h"
34#include "ubuntuwindow.h"
32#include "unitymenumodelpaths.h"
35#include "unitymenumodelpaths.h"
33
36
37+static const char* BOTTOM_BAR_VISIBILITY_COMMUNICATOR_DBUS_PATH = "/BottomBarVisibilityCommunicator";
38+static const char* DBUS_SERVICE = "com.canonical.Shell.BottomBarVisibilityCommunicator";
39+
34static QObject* applicationsPathsSingleton(QQmlEngine* engine, QJSEngine* scriptEngine) {
40static QObject* applicationsPathsSingleton(QQmlEngine* engine, QJSEngine* scriptEngine) {
35 Q_UNUSED(engine);
41 Q_UNUSED(engine);
36 Q_UNUSED(scriptEngine);
42 Q_UNUSED(scriptEngine);
@@ -46,6 +52,7 @@ void UtilsPlugin::registerTypes(const char *uri)
46 qmlRegisterType<UnityMenuModelPaths>(uri, 0, 1, "UnityMenuModelPaths");
52 qmlRegisterType<UnityMenuModelPaths>(uri, 0, 1, "UnityMenuModelPaths");
47 qmlRegisterExtendedType<QQuickWindow, UbuntuWindow>(uri, 0, 1, "Window");
53 qmlRegisterExtendedType<QQuickWindow, UbuntuWindow>(uri, 0, 1, "Window");
48 qmlRegisterSingletonType<ApplicationPaths>(uri, 0, 1, "ApplicationPaths", applicationsPathsSingleton);
54 qmlRegisterSingletonType<ApplicationPaths>(uri, 0, 1, "ApplicationPaths", applicationsPathsSingleton);
55+ qmlRegisterUncreatableType<BottomBarVisibilityCommunicatorShell>(uri, 0, 1, "BottomBarVisibilityCommunicatorShell", "Can't create BottomBarVisibilityCommunicatorShell");
49}
56}
50
57
51void UtilsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
58void UtilsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
@@ -64,4 +71,9 @@ void UtilsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
64 {
71 {
65 qWarning() << "Failed to register image provider for albumart (unknown error)";
72 qWarning() << "Failed to register image provider for albumart (unknown error)";
66 }
73 }
74+
75+ QDBusConnection::sessionBus().registerService(DBUS_SERVICE);
76+ BottomBarVisibilityCommunicatorShell *bottomBarVisibilityCommunicator = &BottomBarVisibilityCommunicatorShell::instance();
77+ QDBusConnection::sessionBus().registerObject(BOTTOM_BAR_VISIBILITY_COMMUNICATOR_DBUS_PATH, bottomBarVisibilityCommunicator, QDBusConnection::ExportAllContents);
78+ engine->rootContext()->setContextProperty("bottomBarVisibilityCommunicatorShell", bottomBarVisibilityCommunicator);
67}
79}
po/ar.po+4−4
@@ -8,7 +8,7 @@ msgstr ""
8"Project-Id-Version: unity\n"
8"Project-Id-Version: unity\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
10"POT-Creation-Date: 2013-11-05 17:53+0100\n"
10"POT-Creation-Date: 2013-11-05 17:53+0100\n"
11−"PO-Revision-Date: 2013-10-20 19:41+0000\n"
11+"PO-Revision-Date: 2013-11-15 12:29+0000\n"
12"Last-Translator: Ibrahim Saed <ibraheem5000@gmail.com>\n"
12"Last-Translator: Ibrahim Saed <ibraheem5000@gmail.com>\n"
13"Language-Team: Arabic <ar@li.org>\n"
13"Language-Team: Arabic <ar@li.org>\n"
14"MIME-Version: 1.0\n"
14"MIME-Version: 1.0\n"
@@ -16,8 +16,8 @@ msgstr ""
16"Content-Transfer-Encoding: 8bit\n"
16"Content-Transfer-Encoding: 8bit\n"
17"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n % 100 >= "
17"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n % 100 >= "
18"3 && n % 100 <= 10 ? 3 : n % 100 >= 11 && n % 100 <= 99 ? 4 : 5;\n"
18"3 && n % 100 <= 10 ? 3 : n % 100 >= 11 && n % 100 <= 99 ? 4 : 5;\n"
19−"X-Launchpad-Export-Date: 2013-11-08 06:37+0000\n"
19+"X-Launchpad-Export-Date: 2013-11-16 06:27+0000\n"
20−"X-Generator: Launchpad (build 16820)\n"
20+"X-Generator: Launchpad (build 16831)\n"
21
21
22#: Applications/applications.js:23
22#: Applications/applications.js:23
23msgid "Phone"
23msgid "Phone"
@@ -215,7 +215,7 @@ msgstr "تتكلم الآن..."
215
215
216#: Notifications/NotificationMenuItemFactory.qml:89
216#: Notifications/NotificationMenuItemFactory.qml:89
217msgid "Show password"
217msgid "Show password"
218−msgstr ""
218+msgstr "عرض كلمة السر"
219
219
220#: Panel/SearchIndicator.qml:27
220#: Panel/SearchIndicator.qml:27
221msgid "Search"
221msgid "Search"
po/fi.po+3−3
@@ -8,14 +8,14 @@ msgstr ""
8"Project-Id-Version: unity\n"
8"Project-Id-Version: unity\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
10"POT-Creation-Date: 2013-11-05 17:53+0100\n"
10"POT-Creation-Date: 2013-11-05 17:53+0100\n"
11−"PO-Revision-Date: 2013-10-03 09:21+0000\n"
11+"PO-Revision-Date: 2013-11-11 14:07+0000\n"
12"Last-Translator: Jiri Grönroos <Unknown>\n"
12"Last-Translator: Jiri Grönroos <Unknown>\n"
13"Language-Team: Finnish <fi@li.org>\n"
13"Language-Team: Finnish <fi@li.org>\n"
14"MIME-Version: 1.0\n"
14"MIME-Version: 1.0\n"
15"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Type: text/plain; charset=UTF-8\n"
16"Content-Transfer-Encoding: 8bit\n"
16"Content-Transfer-Encoding: 8bit\n"
17"Plural-Forms: nplurals=2; plural=n != 1;\n"
17"Plural-Forms: nplurals=2; plural=n != 1;\n"
18−"X-Launchpad-Export-Date: 2013-11-08 06:37+0000\n"
18+"X-Launchpad-Export-Date: 2013-11-12 06:38+0000\n"
19"X-Generator: Launchpad (build 16820)\n"
19"X-Generator: Launchpad (build 16820)\n"
20
20
21#: Applications/applications.js:23
21#: Applications/applications.js:23
@@ -209,7 +209,7 @@ msgstr "Puhutaan..."
209
209
210#: Notifications/NotificationMenuItemFactory.qml:89
210#: Notifications/NotificationMenuItemFactory.qml:89
211msgid "Show password"
211msgid "Show password"
212−msgstr ""
212+msgstr "Näytä salasana"
213
213
214#: Panel/SearchIndicator.qml:27
214#: Panel/SearchIndicator.qml:27
215msgid "Search"
215msgid "Search"
po/km.po+5−5
@@ -8,15 +8,15 @@ msgstr ""
8"Project-Id-Version: unity8\n"
8"Project-Id-Version: unity8\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
10"POT-Creation-Date: 2013-11-05 17:53+0100\n"
10"POT-Creation-Date: 2013-11-05 17:53+0100\n"
11−"PO-Revision-Date: 2013-10-11 08:49+0000\n"
11+"PO-Revision-Date: 2013-11-14 03:02+0000\n"
12−"Last-Translator: Khoem Sokhem <khoemsokhem@khmeros.info>\n"
12+"Last-Translator: Seng Sutha <sutha@khmeros.info>\n"
13"Language-Team: Khmer <km@li.org>\n"
13"Language-Team: Khmer <km@li.org>\n"
14"MIME-Version: 1.0\n"
14"MIME-Version: 1.0\n"
15"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Type: text/plain; charset=UTF-8\n"
16"Content-Transfer-Encoding: 8bit\n"
16"Content-Transfer-Encoding: 8bit\n"
17"Plural-Forms: nplurals=1; plural=0;\n"
17"Plural-Forms: nplurals=1; plural=0;\n"
18−"X-Launchpad-Export-Date: 2013-11-08 06:37+0000\n"
18+"X-Launchpad-Export-Date: 2013-11-15 06:44+0000\n"
19−"X-Generator: Launchpad (build 16820)\n"
19+"X-Generator: Launchpad (build 16831)\n"
20
20
21#: Applications/applications.js:23
21#: Applications/applications.js:23
22msgid "Phone"
22msgid "Phone"
@@ -211,7 +211,7 @@ msgstr "កំពុង​និយាយ..."
211
211
212#: Notifications/NotificationMenuItemFactory.qml:89
212#: Notifications/NotificationMenuItemFactory.qml:89
213msgid "Show password"
213msgid "Show password"
214−msgstr ""
214+msgstr "បង្ហាញ​ពាក្យ​សម្ងាត់"
215
215
216#: Panel/SearchIndicator.qml:27
216#: Panel/SearchIndicator.qml:27
217msgid "Search"
217msgid "Search"
tests/mocks/Unity/Indicators/IndicatorBase.qmlnew file+37
@@ -0,0 +1,37 @@
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+ * Nick Dedekind <nick.dedekind@canonical.com>
18+ */
19+
20+import QtQuick 2.0
21+import QMenuModel 0.1
22+
23+Item {
24+ id: indicatorBase
25+
26+ //const
27+ property string busName
28+ property string actionsObjectPath
29+ property string rootMenuType: "com.canonical.indicator.root"
30+ property string deviceMenuObjectPath
31+
32+ property var menuModel: UnityMenuModel {}
33+
34+ property RootActionState rootActionState: RootActionState {
35+ onUpdated: indicatorBase.rootActionStateChanged()
36+ }
37+}
tests/mocks/Unity/Indicators/IndicatorWidget.qmlnew file+28
@@ -0,0 +1,28 @@
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+ * Nick Dedekind <nick.dedekind@canonical.com>
18+ */
19+
20+import QtQuick 2.0
21+import Unity.Indicators 0.1 as Indicators
22+
23+IndicatorBase {
24+ id: indicatorWidget
25+
26+ enabled: false
27+ property int iconSize: height
28+}
tests/mocks/Unity/Indicators/RootActionState.qml+17−9
@@ -20,14 +20,22 @@
20import QtQuick 2.0
20import QtQuick 2.0
21
21
22QtObject {
22QtObject {
23− property var menu
23+ property var menu
24− property bool valid: false
24+ property bool valid: false
25− property string title
25+ property string title
26− property string leftLabel
26+ property string leftLabel
27− property string rightLabel
27+ property string rightLabel
28− property var icons
28+ property var icons
29− property string accessibleName
29+ property string accessibleName
30− property bool visible: true
30+ property bool visible: true
31
31
32− signal updated
32+ signal updated
33+
34+ onValidChanged: updated()
35+ onTitleChanged: updated()
36+ onLeftLabelChanged: updated()
37+ onRightLabelChanged: updated()
38+ onIconsChanged: updated()
39+ onAccessibleNameChanged: updated()
40+ onVisibleChanged: updated()
33}
41}
tests/mocks/Unity/Indicators/qmldir+2
@@ -2,6 +2,8 @@ module Unity.Indicators
2plugin IndicatorsFakeQml
2plugin IndicatorsFakeQml
3
3
4CachedUnityMenuModel 0.1 CachedUnityMenuModel.qml
4CachedUnityMenuModel 0.1 CachedUnityMenuModel.qml
5+IndicatorBase 0.1 IndicatorBase.qml
6+IndicatorWidget 0.1 IndicatorWidget.qml
5IndicatorsModel 0.1 IndicatorsModel.qml
7IndicatorsModel 0.1 IndicatorsModel.qml
6FakeMenuPage 0.1 FakeMenuPage.qml
8FakeMenuPage 0.1 FakeMenuPage.qml
7RootActionState 0.1 RootActionState.qml
9RootActionState 0.1 RootActionState.qml
tests/mocks/Unity/fake_scope.cpp+3−20
@@ -25,25 +25,8 @@ static DeeModel* create_results_model(unsigned category_count, unsigned result_c
25
25
26// TODO: Implement remaining pieces
26// TODO: Implement remaining pieces
27
27
28−Scope::Scope(QObject* parent)
28+Scope::Scope(QObject* parent) : Scope(QString(), QString(), false, parent)
29− : QObject(parent)
30− , m_visible(false)
31− , m_searching(false)
32− , m_isActive(false)
33− , m_categories(new Categories(this))
34− , m_results(new DeeListModel(this))
35{
29{
36− DeeModel* results_model = create_results_model(4, 30);
37− m_categories->setResultModel(results_model);
38− m_categories->setModel(create_categories_model(4));
39− m_results->setModel(results_model);
40−
41− m_timer.setInterval(1000);
42− m_timer.setSingleShot(true);
43− connect(&m_timer, &QTimer::timeout, [this]() {
44− Preview *p = new Preview(this);
45− Q_EMIT previewReady(p);
46− });
47}
30}
48
31
49Scope::Scope(QString const& id, QString const& name, bool visible, QObject* parent)
32Scope::Scope(QString const& id, QString const& name, bool visible, QObject* parent)
@@ -56,9 +39,9 @@ Scope::Scope(QString const& id, QString const& name, bool visible, QObject* pare
56 , m_categories(new Categories(this))
39 , m_categories(new Categories(this))
57 , m_results(new DeeListModel(this))
40 , m_results(new DeeListModel(this))
58{
41{
59− DeeModel* results_model = create_results_model(4, 30);
42+ DeeModel* results_model = create_results_model(20, 300);
60 m_categories->setResultModel(results_model);
43 m_categories->setResultModel(results_model);
61− m_categories->setModel(create_categories_model(4));
44+ m_categories->setModel(create_categories_model(20));
62 m_results->setModel(results_model);
45 m_results->setModel(results_model);
63
46
64 m_timer.setInterval(1000);
47 m_timer.setInterval(1000);
tests/plugins/ListViewWithPageHeader/listviewwithpageheadertest.cpp+20
@@ -1724,6 +1724,9 @@ private Q_SLOTS:
1724
1724
1725 void testMaximizeVisibleAreaMoveUpAndShowHeader()
1725 void testMaximizeVisibleAreaMoveUpAndShowHeader()
1726 {
1726 {
1727+#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
1728+ QSKIP("This test is extremely unstable in 5.0.x");
1729+#endif
1727 model->setProperty(0, "size", 800);
1730 model->setProperty(0, "size", 800);
1728 verifyItem(0, 50., 800., false);
1731 verifyItem(0, 50., 800., false);
1729
1732
@@ -1824,6 +1827,23 @@ private Q_SLOTS:
1824 lvwph->positionAtBeginning();
1827 lvwph->positionAtBeginning();
1825 }
1828 }
1826
1829
1830+ void testHeaderPositionBug1240118()
1831+ {
1832+ scrollToBottom();
1833+ lvwph->showHeader();
1834+ QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1835+ QTest::qWait(100); // Make sure stuff is stable
1836+ QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 0), Q_ARG(QVariant, 100));
1837+ model->setProperty(3, "size", 10);
1838+ model->setProperty(4, "size", 10);
1839+ model->setProperty(5, "size", 10);
1840+ model->setProperty(6, "size", 10);
1841+#if (QT_VERSION > QT_VERSION_CHECK(5, 0, 3))
1842+ QTRY_COMPARE(lvwph->m_minYExtent, 210.);
1843+#endif
1844+ QTRY_COMPARE(lvwph->m_headerItem->y(), -lvwph->m_minYExtent);
1845+ }
1846+
1827private:
1847private:
1828 QQuickView *view;
1848 QQuickView *view;
1829 ListViewWithPageHeader *lvwph;
1849 ListViewWithPageHeader *lvwph;
tests/qmltests/CMakeLists.txt+2−1
@@ -13,7 +13,6 @@ set(qmltest_DEFAULT_NO_ADD_TEST FALSE)
13set(qmltest_DEFAULT_PROPERTIES ENVIRONMENT "QT_QPA_PLATFORM=minimal")
13set(qmltest_DEFAULT_PROPERTIES ENVIRONMENT "QT_QPA_PLATFORM=minimal")
14add_qml_test(Components AnimationControllerWithSignals)
14add_qml_test(Components AnimationControllerWithSignals)
15add_qml_test(Components Carousel)
15add_qml_test(Components Carousel)
16−add_qml_test(Components MathLocal)
17add_qml_test(Components OpenEffect)
16add_qml_test(Components OpenEffect)
18add_qml_test(Components RatingStars)
17add_qml_test(Components RatingStars)
19add_qml_test(Components TimeLocal)
18add_qml_test(Components TimeLocal)
@@ -71,6 +70,8 @@ add_qml_test(Panel Indicators IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest
71add_qml_test(Panel MenuContent IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
70add_qml_test(Panel MenuContent IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
72add_qml_test(Panel Panel IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
71add_qml_test(Panel Panel IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
73add_qml_test(Panel SearchIndicator)
72add_qml_test(Panel SearchIndicator)
73+add_qml_test(Panel/Indicators DefaultIndicatorWidget IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS}
74+ ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
74add_qml_test(SideStage SideStage IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS}
75add_qml_test(SideStage SideStage IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS}
75 ${CMAKE_BINARY_DIR}/tests/mocks
76 ${CMAKE_BINARY_DIR}/tests/mocks
76 ${CMAKE_BINARY_DIR}/plugins)
77 ${CMAKE_BINARY_DIR}/plugins)
tests/qmltests/Components/tst_MathLocal.qmldeleted−91
@@ -1,91 +0,0 @@
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 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.0
18−import QtTest 1.0
19−import "../../../Components/Math.js" as MathLocal
20−
21−TestCase {
22− name: "MathLocal"
23−
24− property int minValue
25− property int maxValue
26− property int clampValue
27− property int clamped
28−
29− function test_clamp_positive_lower() {
30− minValue = 9
31− maxValue = 42
32− clampValue = -7
33−
34− clamped = MathLocal.clamp(clampValue, minValue, maxValue)
35− compare(clamped, minValue, "clamped value not within range")
36− }
37−
38− function test_clamp_positive_greater() {
39− minValue = 9
40− maxValue = 42
41− clampValue = 111
42−
43− clamped = MathLocal.clamp(clampValue, minValue, maxValue)
44− compare(clamped, maxValue, "clamped value not within range")
45− }
46−
47− function test_clamp_positive_within() {
48− minValue = 9
49− maxValue = 53
50− clampValue = 42
51−
52− clamped = MathLocal.clamp(clampValue, minValue, maxValue)
53− compare(clamped, clampValue, "clamped value changed even though it shouldn't have")
54− }
55−
56− function test_clamp_positive_on_border() {
57− minValue = 9
58− maxValue = 42
59− clampValue = 9
60−
61− clamped = MathLocal.clamp(clampValue, minValue, maxValue)
62− compare(clamped, clampValue, "clamped value changed even though it shouldn't have")
63− }
64−
65− function test_clamp_negative_lower() {
66− minValue = -42
67− maxValue = -9
68− clampValue = -50
69−
70− clamped = MathLocal.clamp(clampValue, minValue, maxValue)
71− compare(clamped, minValue, "clamped value not within range")
72− }
73−
74− function test_clamp_negative_greater() {
75− minValue = -42
76− maxValue = -9
77− clampValue = 50
78−
79− clamped = MathLocal.clamp(clampValue, minValue, maxValue)
80− compare(clamped, maxValue, "clamped value not within range")
81− }
82−
83− function test_clamp_postive_and_negative_greater() {
84− minValue = -42
85− maxValue = 9
86− clampValue = 50
87−
88− clamped = MathLocal.clamp(clampValue, minValue, maxValue)
89− compare(clamped, maxValue, "clamped value not within range")
90− }
91−}
tests/qmltests/Dash/qml/FakeScopeView.qml+1
@@ -23,6 +23,7 @@ ScopeView {
23 id: fakeScopeView
23 id: fakeScopeView
24
24
25 property alias backColor : back.color
25 property alias backColor : back.color
26+ moving: listView.moving
26
27
27 onEndReached: {
28 onEndReached: {
28 if (shell != undefined && shell.scopeStatus != undefined) {
29 if (shell != undefined && shell.scopeStatus != undefined) {
tests/qmltests/Dash/tst_Dash.qml+2
@@ -103,6 +103,8 @@ Item {
103 return;
103 return;
104 }
104 }
105 dash.showScopeOnLoaded = data.tag
105 dash.showScopeOnLoaded = data.tag
106+ scopes.clear();
107+ scopes.load();
106
108
107 var dashContentList = findChild(dash, "dashContentList");
109 var dashContentList = findChild(dash, "dashContentList");
108 verify(dashContentList != undefined);
110 verify(dashContentList != undefined);
tests/qmltests/Dash/tst_DashContent.qml+14
@@ -229,5 +229,19 @@ Item {
229 tryCompare(scopesModel.get(1), "isActive", data.active1);
229 tryCompare(scopesModel.get(1), "isActive", data.active1);
230 tryCompare(scopesModel.get(2), "isActive", data.active2);
230 tryCompare(scopesModel.get(2), "isActive", data.active2);
231 }
231 }
232+
233+ function test_hswipe_disabled_vswipe() {
234+ var dashContentList = findChild(dashContent, "dashContentList");
235+
236+ tryCompare(dashContentList, "interactive", true);
237+
238+ var startX = dashContentList.width/2;
239+ var startY = dashContentList.height/2;
240+ touchFlick(dashContentList, startX, startY, startX, startY - units.gu(800));
241+
242+ tryCompare(dashContentList.currentItem, "moving", true);
243+
244+ compare(dashContentList.interactive, false);
245+ }
232 }
246 }
233}
247}
tests/qmltests/Dash/tst_GenericScopeView.qml+3
@@ -74,6 +74,9 @@ Item {
74 }
74 }
75
75
76 function openPreview() {
76 function openPreview() {
77+ var categoryListView = findChild(genericScopeView, "categoryListView");
78+ categoryListView.positionAtBeginning();
79+
77 var tile = findChild(genericScopeView, "delegate0");
80 var tile = findChild(genericScopeView, "delegate0");
78 mouseClick(tile, tile.width / 2, tile.height / 2);
81 mouseClick(tile, tile.width / 2, tile.height / 2);
79 var openEffect = findChild(genericScopeView, "openEffect");
82 var openEffect = findChild(genericScopeView, "openEffect");
tests/qmltests/Panel/Indicators/tst_DefaultIndicatorWidget.qmlnew file+97
@@ -0,0 +1,97 @@
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 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.0
18+import QtTest 1.0
19+import Unity.Test 0.1 as UT
20+import QMenuModel 0.1
21+import "../../../../Panel/Indicators"
22+
23+Item {
24+ id: testView
25+ width: units.gu(40)
26+ height: units.gu(70)
27+
28+ DefaultIndicatorWidget {
29+ id: widget
30+
31+ anchors {
32+ left: parent.left
33+ top: parent.top
34+ }
35+
36+ busName: "test"
37+ actionsObjectPath: "test"
38+ deviceMenuObjectPath: "test"
39+
40+ rootMenuType: ""
41+
42+ iconSize: units.gu(3.2)
43+ height: units.gu(3)
44+
45+ rootActionState {
46+ icons: [ "image://theme/audio-volume-high", "image://theme/audio-volume-low" ]
47+ leftLabel: "left"
48+ rightLabel: "right"
49+ }
50+ }
51+
52+ UT.UnityTestCase {
53+ name: "DefaultIndicatorWidget"
54+ when: windowShown
55+
56+ function init() {
57+ widget.rootActionState.icons = [];
58+ widget.rootActionState.leftLabel = "";
59+ widget.rootActionState.rightLabel = "";
60+ wait(50);
61+ }
62+
63+ function test_guRoundedWidth_data() {
64+ return [
65+ { tag: "empty", icons: [], leftLabel: "", rightLabel: "" },
66+ { tag: "1-icon-no-label", icons: [ "image://theme/audio-volume-high" ], leftLabel: "", rightLabel: "" },
67+ { tag: "2-icon-no-label", icons: [ "image://theme/audio-volume-high", "image://theme/audio-volume-low" ], leftLabel: "", rightLabel: "" },
68+ { tag: "no-icon-l-label", icons: [], leftLabel: "left", rightLabel: "" },
69+ { tag: "no-icon-lr-label", icons: [], leftLabel: "left", rightLabel: "right" },
70+ { tag: "1-icon-l-label", icons: [ "image://theme/audio-volume-high" ], leftLabel: "left", rightLabel: "" },
71+ { tag: "1-icon-lr-label", icons: [ "image://theme/audio-volume-high" ], leftLabel: "left", rightLabel: "right" },
72+ { tag: "2-icon-l-label", icons: [ "image://theme/audio-volume-high", "image://theme/audio-volume-low" ], leftLabel: "left", rightLabel: "" },
73+ { tag: "2-icon-lr-label", icons: [ "image://theme/audio-volume-high", "image://theme/audio-volume-low" ], leftLabel: "left", rightLabel: "right" }
74+ ];
75+ }
76+
77+ function test_guRoundedWidth(data) {
78+ widget.rootActionState.icons = data.icons
79+ widget.rootActionState.leftLabel = data.leftLabel;
80+ widget.rootActionState.rightLabel = data.rightLabel;
81+ wait(50);
82+
83+ compare(widget.width, guRoundUp(widget.width));
84+ }
85+ }
86+
87+ // TODO: Use toolkit function https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1242575
88+ function guRoundUp(width) {
89+ if (width == 0) {
90+ return 0;
91+ }
92+ var gu1 = units.gu(1.0);
93+ var mod = (width % gu1);
94+
95+ return mod == 0 ? width : width + (gu1 - mod);
96+ }
97+}