on xenial help sign in
adjust sizings as per design spec, add a label for the current highlighted window
commit9636bc0213fc53e89b3d2573d0964f87edadbc08 authorMichael Zanetti <michael.zanetti@canonical.com> dateFri 22 May 2015, 13:46 (11 years ago) parent912d04d
2 files changed+21−17
qml/Stages/DesktopStage.qml+20−9 qml/Stages/SpreadMaths.qml+1−8
qml/Stages/DesktopStage.qml+20−9
@@ -138,7 +138,7 @@ Rectangle {
138138 id: appRepeater
139139 model: ApplicationManager
140140
141− property int highlightedIndex: 1
141+ property int highlightedIndex: -1
142142
143143 delegate: Item {
144144 id: appDelegate
@@ -365,17 +365,18 @@ Rectangle {
365365 spacing: units.gu(1)
366366 Item { Layout.fillWidth: true }
367367 Repeater {
368− model: 2 // TODO: should be workspacemodel
368+ model: 1 // TODO: will be a workspacemodel in the future
369369 Item {
370370 Layout.fillHeight: true
371371 Layout.preferredWidth: ((height - units.gu(6)) * root.width / root.height)
372372 Image {
373373 source: root.background
374374 anchors {
375− fill: parent;
376− topMargin: units.gu(2);
377− bottomMargin: units.gu(2);
375+ left: parent.left
376+ right: parent.right
377+ verticalCenter: parent.verticalCenter
378378 }
379+ height: parent.height * 0.75
379380
380381 ShaderEffect {
381382 anchors.fill: parent
@@ -412,10 +413,11 @@ Rectangle {
412413 Layout.preferredWidth: ((height - units.gu(6)) * root.width / root.height)
413414 Rectangle {
414415 anchors {
415− fill: parent;
416− topMargin: units.gu(2);
417− bottomMargin: units.gu(2);
416+ left: parent.left
417+ right: parent.right
418+ verticalCenter: parent.verticalCenter
418419 }
420+ height: parent.height * 0.75
419421 color: "#22ffffff"
420422
421423 Label {
@@ -429,6 +431,13 @@ Rectangle {
429431 }
430432 }
431433
434+ Label {
435+ id: currentSelectedLabel
436+ anchors { bottom: parent.bottom; bottomMargin: root.height * 0.625; horizontalCenter: parent.horizontalCenter }
437+ text: ApplicationManager.get(appRepeater.highlightedIndex).name
438+ visible: false
439+ }
440+
432441 Label {
433442 anchors { left: parent.left; bottom: parent.bottom; margins: units.gu(1) }
434443 text: "Progress: " + (spreadFlickable.contentX / (spreadFlickable.contentWidth - spreadFlickable.width)).toFixed(3) +
@@ -449,6 +458,7 @@ Rectangle {
449458 name: "altTab"; when: root.altTabPressed
450459 PropertyChanges { target: workspaceSelector; visible: true }
451460 PropertyChanges { target: spreadFlickable; enabled: true }
461+ PropertyChanges { target: currentSelectedLabel; visible: true }
452462 }
453463 ]
454464 signal updateWorkspaces();
@@ -465,8 +475,8 @@ Rectangle {
465475 PropertyAction { target: spreadFlickable; property: "visible" }
466476 PropertyAction { target: spreadFlickable; property: "contentX";
467477 value: ((spreadFlickable.contentWidth) / (ApplicationManager.count + 1)) * Math.max(0, Math.min(ApplicationManager.count - 3, 1));
468−
469478 }
479+ PropertyAction { target: appRepeater; property: "highlightedIndex"; value: 1 }
470480 }
471481 },
472482 Transition {
@@ -474,6 +484,7 @@ Rectangle {
474484 to: "*"
475485 PropertyAnimation { property: "opacity" }
476486 PropertyAction { target: root; property: "workspacesUpdated"; value: false }
487+ PropertyAction { target: appRepeater; property: "highlightedIndex"; value: -1 }
477488 }
478489
479490 ]
qml/Stages/SpreadMaths.qml+1−8
@@ -17,7 +17,7 @@ Item {
1717
1818 // Spread properties
1919 property real spreadHeight: sceneHeight * 0.4
20− property int spreadBottomOffset: sceneHeight * 0.2
20+ property int spreadBottomOffset: sceneHeight * 0.18
2121 property int foldingAreaWidth: flickableWidth * 0.2
2222 property int maxVisibleItems: 7
2323 property int margins: flickableWidth * 0.05
@@ -50,13 +50,6 @@ Item {
5050
5151 readonly property real middleSectionProgress: (linearX - margins - foldingAreaWidth) / (flickableWidth - (margins + foldingAreaWidth) * 2)
5252
53− Label {
54− anchors { left: parent.left; top: parent.top; topMargin: - 100 }
55− text: middleSectionProgress.toFixed(2)
56− color: "green"
57− fontSize: "x-large"
58− }
59−
6053 // Output
6154 readonly property int animatedX: {
6255 if (leftFoldingAreaProgress > 4) { // Stop it at the edge