on xenial help sign in
cimi review comments
58c8ed2Nick Dedekind
qml/Components/ScrollCalculator.qml+10−17
@@ -14,33 +14,26 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
15 */
16
16
17−import QtQuick 2.0
17+import QtQuick 2.2
18+import Ubuntu.Components 1.1
18
19
19Item {
20Item {
20 id: scrollArea
21 id: scrollArea
21
22
23+ readonly property bool areaActive: lateralPosition >= 0
22 property real stopScrollThreshold: units.gu(2)
24 property real stopScrollThreshold: units.gu(2)
23 property int direction: Qt.LeftToRight
25 property int direction: Qt.LeftToRight
24− property real baseScrollAmount: units.dp(2)
26+ property real baseScrollAmount: units.dp(2)
25 property real maximumScrollAmount: units.dp(6)
27 property real maximumScrollAmount: units.dp(6)
26−
27 property real lateralPosition: -1
28 property real lateralPosition: -1
28− readonly property bool areaActive: lateralPosition >= 0
29− onAreaActiveChanged: {
30− if (areaActive) {
31− handleEnter();
32− } else {
33− handleExit();
34− }
35− }
36−
37− // from 0 to 1
38 property real forceScrollingPercentage: 0.4
29 property real forceScrollingPercentage: 0.4
30+
39 signal scroll(real scrollAmount)
31 signal scroll(real scrollAmount)
40
32
33+ onAreaActiveChanged: areaActive ? handleEnter() : handleExit()
34+
41− width: 200
35+ width: units.gu(5)
42− height: 200
43− rotation: direction == Qt.LeftToRight ? 0 : 180
36+ rotation: direction === Qt.LeftToRight ? 0 : 180
44
37
45 function handleEnter() {
38 function handleEnter() {
46 d.threasholdAreaX = -scrollArea.stopScrollThreshold;
39 d.threasholdAreaX = -scrollArea.stopScrollThreshold;
@@ -70,7 +63,7 @@ Item {
70
63
71 Timer {
64 Timer {
72 id: scrollTimer
65 id: scrollTimer
73− interval: 5
66+ interval: 16
74 repeat: true
67 repeat: true
75
68
76 property int iter: 0
69 property int iter: 0
qml/Panel/Handle.qml+3−2
@@ -14,7 +14,8 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
15 */
16
16
17−import QtQuick 2.0
17+import QtQuick 2.2
18+import Ubuntu.Components 1.1
18
19
19Rectangle {
20Rectangle {
20 id: handle
21 id: handle
@@ -25,7 +26,7 @@ Rectangle {
25 Row {
26 Row {
26 id: dots
27 id: dots
27 width: childrenRect.width
28 width: childrenRect.width
28− height: children.height
29+ height: childrenRect.height
29 anchors.centerIn: parent
30 anchors.centerIn: parent
30 spacing: units.gu(0.5)
31 spacing: units.gu(0.5)
31 Repeater {
32 Repeater {
qml/Panel/IndicatorItem.qml+1−1
@@ -14,7 +14,7 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
15 */
16
16
17−import QtQuick 2.1
17+import QtQuick 2.2
18import Ubuntu.Components 1.1
18import Ubuntu.Components 1.1
19import Ubuntu.Settings.Components 0.1
19import Ubuntu.Settings.Components 0.1
20import "Indicators"
20import "Indicators"
qml/Panel/IndicatorItemRow.qml+31−28
@@ -14,8 +14,8 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
15 */
16
16
17−import QtQuick 2.1
17+import QtQuick 2.2
18−import Ubuntu.Components 0.1
18+import Ubuntu.Components 1.1
19
19
20Item {
20Item {
21 id: root
21 id: root
@@ -35,9 +35,8 @@ Item {
35
35
36 property real lateralPosition: -1
36 property real lateralPosition: -1
37 onLateralPositionChanged: {
37 onLateralPositionChanged: {
38− if (currentItem && !enableLateralChanges) return;
38+ if (currentItem || !enableLateralChanges) return;
39 updateItemFromLateralPosition(lateralPosition);
39 updateItemFromLateralPosition(lateralPosition);
40− highlight.updateHighlightOffset();
41 }
40 }
42
41
43 function updateItemFromLateralPosition(lateralPosition) {
42 function updateItemFromLateralPosition(lateralPosition) {
@@ -54,9 +53,10 @@ Item {
54 var bufferExceeded = false;
53 var bufferExceeded = false;
55
54
56 if (proposedItem !== currentItem) {
55 if (proposedItem !== currentItem) {
56+ // Proposed item is not directly adjacent to current?
57 if (Math.abs(currentItem.ownIndex - currentItem.ownIndex) > 1) {
57 if (Math.abs(currentItem.ownIndex - currentItem.ownIndex) > 1) {
58 bufferExceeded = true;
58 bufferExceeded = true;
59− } else {
59+ } else { // no
60 var currentItemLateralPosition = root.mapToItem(proposedItem, lateralPosition, 0).x;
60 var currentItemLateralPosition = root.mapToItem(proposedItem, lateralPosition, 0).x;
61
61
62 // Is the distance into proposed item greater than max buffer?
62 // Is the distance into proposed item greater than max buffer?
@@ -103,7 +103,7 @@ Item {
103 currentItem = item;
103 currentItem = item;
104 } else {
104 } else {
105 // Select default item.
105 // Select default item.
106− var searchIndex = lateralPosition > width ? repeater.count-1 : 0;
106+ var searchIndex = lateralPosition > width ? repeater.count - 1 : 0;
107
107
108 for (var i = 0; i < row.children.length; i++) {
108 for (var i = 0; i < row.children.length; i++) {
109 if (row.children[i].hasOwnProperty("ownIndex") && row.children[i].ownIndex === searchIndex) {
109 if (row.children[i].hasOwnProperty("ownIndex") && row.children[i].ownIndex === searchIndex) {
@@ -170,7 +170,7 @@ Item {
170 anchors.bottom: row.bottom
170 anchors.bottom: row.bottom
171 height: units.dp(2)
171 height: units.dp(2)
172 color: root.hightlightColor
172 color: root.hightlightColor
173− visible: root.currentItem !== null
173+ visible: currentItem !== null
174 opacity: 0.0
174 opacity: 0.0
175
175
176 width: currentItem ? currentItem.width : 0
176 width: currentItem ? currentItem.width : 0
@@ -181,31 +181,34 @@ Item {
181
181
182 // micromovements of the highlight line when user moves the finger across the items while pulling
182 // micromovements of the highlight line when user moves the finger across the items while pulling
183 // the handle downwards.
183 // the handle downwards.
184− function updateHighlightOffset() {
184+ Connections {
185+ target: root
186+ onLateralPositionChanged: {
185− if (!currentItem || lateralPosition == -1) {
187+ if (!currentItem || lateralPosition == -1) {
186− highlightCenterOffset = 0;
188+ highlight.highlightCenterOffset = 0;
187− return;
189+ return;
188− }
190+ }
191+ if (!enableLateralChanges) return;
189
192
190− var itemMapped = root.mapToItem(currentItem, lateralPosition, 0);
193+ var itemMapped = root.mapToItem(currentItem, lateralPosition, 0);
191
194
192− var distanceFromCenter = itemMapped.x - currentItem.width / 2;
195+ var distanceFromCenter = itemMapped.x - currentItem.width / 2;
193− if (distanceFromCenter > 0) {
196+ if (distanceFromCenter > 0) {
194− distanceFromCenter = Math.max(0, distanceFromCenter-currentItem.width / 8);
197+ distanceFromCenter = Math.max(0, distanceFromCenter - currentItem.width / 8);
195− } else {
198+ } else {
196− distanceFromCenter = Math.min(0, distanceFromCenter+currentItem.width / 8);
199+ distanceFromCenter = Math.min(0, distanceFromCenter + currentItem.width / 8);
197− }
200+ }
198
201
199− if (currentItem && currentItem.ownIndex === 0 && distanceFromCenter < 0) {
202+ if (currentItem && currentItem.ownIndex === 0 && distanceFromCenter < 0) {
200− highlightCenterOffset = 0;
203+ highlight.highlightCenterOffset = 0;
201− } else if (currentItem && currentItem.ownIndex === repeater.count-1 & distanceFromCenter > 0) {
204+ } else if (currentItem && currentItem.ownIndex === repeater.count-1 & distanceFromCenter > 0) {
202− highlightCenterOffset = 0;
205+ highlight.highlightCenterOffset = 0;
203− } else {
206+ } else {
204− var shiftPercentageOffset = (distanceFromCenter / (currentItem.width / 4));
207+ highlight.highlightCenterOffset = (distanceFromCenter / (currentItem.width / 4)) * units.gu(1);
205− highlightCenterOffset = shiftPercentageOffset * units.gu(1);
208+ }
206 }
209 }
207−
208 }
210 }
211+
209 property real highlightCenterOffset: 0
212 property real highlightCenterOffset: 0
210 Behavior on highlightCenterOffset {
213 Behavior on highlightCenterOffset {
211 NumberAnimation { duration: UbuntuAnimation.FastDuration; easing: UbuntuAnimation.StandardEasing }
214 NumberAnimation { duration: UbuntuAnimation.FastDuration; easing: UbuntuAnimation.StandardEasing }
@@ -236,7 +239,7 @@ Item {
236 Transition {
239 Transition {
237 PropertyAnimation {
240 PropertyAnimation {
238 properties: "opacity";
241 properties: "opacity";
239− duration: UbuntuAnimation.SnapDuration;
242+ duration: UbuntuAnimation.SnapDuration
240 easing: UbuntuAnimation.StandardEasing
243 easing: UbuntuAnimation.StandardEasing
241 }
244 }
242 }
245 }
qml/Panel/IndicatorsBar.qml+5−3
@@ -14,8 +14,8 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
15 */
16
16
17−import QtQuick 2.0
17+import QtQuick 2.2
18−import Ubuntu.Components 0.1
18+import Ubuntu.Components 1.1
19import "../Components"
19import "../Components"
20
20
21Item {
21Item {
@@ -23,10 +23,10 @@ Item {
23 property alias expanded: row.expanded
23 property alias expanded: row.expanded
24 property alias indicatorsModel: row.indicatorsModel
24 property alias indicatorsModel: row.indicatorsModel
25 property alias unitProgress: row.unitProgress
25 property alias unitProgress: row.unitProgress
26− property real lateralPosition: -1
27 property alias enableLateralChanges: row.enableLateralChanges
26 property alias enableLateralChanges: row.enableLateralChanges
28 property alias overFlowWidth: row.overFlowWidth
27 property alias overFlowWidth: row.overFlowWidth
29 readonly property alias currentItemIndex: row.currentItemIndex
28 readonly property alias currentItemIndex: row.currentItemIndex
29+ property real lateralPosition: -1
30
30
31 function selectItemAt(lateralPosition) {
31 function selectItemAt(lateralPosition) {
32 if (!expanded) {
32 if (!expanded) {
@@ -37,6 +37,8 @@ Item {
37 }
37 }
38
38
39 function updateItemFromLateralPosition(position) {
39 function updateItemFromLateralPosition(position) {
40+ if (position === -1) return;
41+
40 var mapped = root.mapToItem(row, position, 0);
42 var mapped = root.mapToItem(row, position, 0);
41 row.updateItemFromLateralPosition(mapped.x);
43 row.updateItemFromLateralPosition(mapped.x);
42 }
44 }
qml/Panel/IndicatorsMenu.qml+12−11
@@ -14,32 +14,32 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
15 */
16
16
17−import QtQuick 2.0
17+import QtQuick 2.2
18−import Ubuntu.Components 0.1
18+import Ubuntu.Components 1.1
19import Ubuntu.Gestures 0.1
19import Ubuntu.Gestures 0.1
20import "../Components"
20import "../Components"
21
21
22Showable {
22Showable {
23 id: root
23 id: root
24+ property alias indicatorsModel: bar.indicatorsModel
25+ property alias showDragHandle: __showDragHandle
26+ property alias hideDragHandle: __hideDragHandle
27+ property alias overFlowWidth: bar.overFlowWidth
28+
24 property int minimizedPanelHeight: units.gu(3)
29 property int minimizedPanelHeight: units.gu(3)
25 property int expandedPanelHeight: units.gu(7)
30 property int expandedPanelHeight: units.gu(7)
26 property real openedHeight: units.gu(71)
31 property real openedHeight: units.gu(71)
27− readonly property int lockThreshold: openedHeight * (2 / 3)
32+ readonly property real unitProgress: Math.max(0, (height - minimizedPanelHeight) / (openedHeight - minimizedPanelHeight))
28− property alias indicatorsModel: bar.indicatorsModel
29− property alias overFlowWidth: bar.overFlowWidth
30− property bool enableHint: true
31− property real showHintBottomMargin: 0
32− property bool contentEnabled: true
33 readonly property bool fullyOpened: unitProgress >= 1
33 readonly property bool fullyOpened: unitProgress >= 1
34 readonly property bool partiallyOpened: unitProgress > 0 && unitProgress < 1.0
34 readonly property bool partiallyOpened: unitProgress > 0 && unitProgress < 1.0
35 readonly property bool fullyClosed: unitProgress == 0
35 readonly property bool fullyClosed: unitProgress == 0
36− readonly property real unitProgress: Math.max(0, (height - minimizedPanelHeight) / (openedHeight - minimizedPanelHeight))
36+
37+ property bool enableHint: true
38+ property bool contentEnabled: true
37 property color panelColor: "black"
39 property color panelColor: "black"
38
40
39 signal showTapped(point position)
41 signal showTapped(point position)
40
42
41− property alias showDragHandle: __showDragHandle
42− property alias hideDragHandle: __hideDragHandle
43
43
44 // TODO: Perhaps we need a animation standard for showing/hiding? Each showable seems to
44 // TODO: Perhaps we need a animation standard for showing/hiding? Each showable seems to
45 // use its own values. Need to ask design about this.
45 // use its own values. Need to ask design about this.
@@ -131,6 +131,7 @@ Showable {
131 right: parent.right
131 right: parent.right
132 }
132 }
133 expanded: false
133 expanded: false
134+ enableLateralChanges: false
134 lateralPosition: -1
135 lateralPosition: -1
135 unitProgress: root.unitProgress
136 unitProgress: root.unitProgress
136
137
qml/Panel/MenuContent.qml+1−1
@@ -14,7 +14,7 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
15 */
16
16
17−import QtQuick 2.0
17+import QtQuick 2.2
18import QtQuick.Layouts 1.1
18import QtQuick.Layouts 1.1
19import Ubuntu.Components 1.1
19import Ubuntu.Components 1.1
20import Unity.Indicators 0.1 as Indicators
20import Unity.Indicators 0.1 as Indicators
qml/Panel/Panel.qml+2−2
@@ -14,8 +14,8 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
15 */
16
16
17−import QtQuick 2.0
17+import QtQuick 2.2
18−import Ubuntu.Components 0.1
18+import Ubuntu.Components 1.1
19import Unity.Application 0.1
19import Unity.Application 0.1
20import "../Components"
20import "../Components"
21import "../Components/ListItems"
21import "../Components/ListItems"
qml/Panel/PanelVelocityCalculator.qml+1−1
@@ -14,7 +14,7 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
15 */
16
16
17−import QtQuick 2.0
17+import QtQuick 2.2
18import Ubuntu.Gestures 0.1
18import Ubuntu.Gestures 0.1
19
19
20Item {
20Item {