on xenial help sign in
Merge
commit0c8b85ca8dc4b1bdfea1514223e5c1f693164272 authorAlbert Astals <albert.astals@canonical.com> dateFri 21 Feb 2014, 15:42 (13 years ago) parent77900247608335
18 files changed+209−113
po/es.po+1−1 qml/Components/ResponsiveGridView.qml−1 qml/Components/Showable.qml+8 qml/Dash/Card.qml+2 qml/Dash/CardHeader.qml+2 qml/Dash/Dash.qml+2 qml/Dash/DashContent.qml+4 qml/Dash/GenericScopeView.qml+1 qml/Dash/PreviewListView.qml+25−29 qml/Dash/Previews/Preview.qml−13 qml/Dash/Previews/PreviewZoomableImage.qml+2−5 qml/Greeter/Greeter.qml+4 qml/Greeter/GreeterContent.qml−1 qml/Shell.qml+105−62 tests/mocks/AccountsService/AccountsService.cpp+1−1 tests/qmltests/Dash/tst_Card.qml+14 tests/qmltests/Greeter/tst_Phone.qml+19 tests/qmltests/Greeter/tst_Tablet.qml+19
po/es.po+1−1
@@ -15,7 +15,7 @@ msgstr ""
1515"Content-Type: text/plain; charset=UTF-8\n"
1616"Content-Transfer-Encoding: 8bit\n"
1717"Plural-Forms: nplurals=2; plural=n != 1;\n"
18−"X-Launchpad-Export-Date: 2014-02-20 05:47+0000\n"
18+"X-Launchpad-Export-Date: 2014-02-21 06:42+0000\n"
1919"X-Generator: Launchpad (build 16916)\n"
2020
2121#: plugins/Unity/Launcher/launcheritem.cpp:43
qml/Components/ResponsiveGridView.qml−1
@@ -56,7 +56,6 @@ Item {
5656 fill: parent
5757 leftMargin: margin/2
5858 rightMargin: margin/2
59− topMargin: verticalSpacing
6059 }
6160 clip: parent.height != totalContentHeight
6261
qml/Components/Showable.qml+8
@@ -107,6 +107,9 @@ Item {
107107 if (!hideAnimation.running) {
108108 hideAnimation.restart()
109109 }
110+ if (__skipShowAnimation) {
111+ hideAnimation.complete();
112+ }
110113 } else {
111114 visible = false
112115 required = false
@@ -115,6 +118,11 @@ Item {
115118 shown = false
116119 }
117120
121+ function hideNow() {
122+ __skipShowAnimation = true;
123+ hide();
124+ }
125+
118126 Connections {
119127 target: hideAnimation ? hideAnimation: null
120128 onRunningChanged: {
qml/Dash/Card.qml+2
@@ -161,6 +161,8 @@ AbstractButton {
161161 title: cardData && cardData["title"] || ""
162162 subtitle: cardData && cardData["subtitle"] || ""
163163
164+ titleWeight: components && components["subtitle"] ? Font.DemiBold : Font.Normal
165+
164166 opacity: showHeader ? 1 : 0
165167 inOverlay: root.template && root.template["overlay"] === true
166168 fontColor: inOverlay ? "white" : summary.color
qml/Dash/CardHeader.qml+2
@@ -26,6 +26,8 @@ Item {
2626 property alias oldPrice: oldPriceLabel.text
2727 property alias altPrice: altPriceLabel.text
2828
29+ property alias titleWeight: titleLabel.font.weight
30+
2931 // FIXME: Saviq, used to scale fonts down in Carousel
3032 property real fontScale: 1.0
3133
qml/Dash/Dash.qml+2
@@ -41,6 +41,8 @@ Showable {
4141 return
4242 }
4343
44+ dashContent.closePreview();
45+
4446 if (scopeIndex == dashContent.currentIndex && !reset) {
4547 // the scope is already the current one
4648 return
qml/Dash/DashContent.qml+4
@@ -87,6 +87,10 @@ Item {
8787 dashContentList.currentItem.theScope.closeScope(scope)
8888 }
8989
90+ function closePreview() {
91+ previewListView.open = false;
92+ }
93+
9094 Item {
9195 id: dashContentListHolder
9296 anchors.fill: parent
qml/Dash/GenericScopeView.qml+1
@@ -136,6 +136,7 @@ FocusScope {
136136 id: baseItem
137137 objectName: "dashCategory" + category
138138 highlightWhenPressed: false
139+ showDivider: false
139140
140141 readonly property bool expandable: rendererLoader.item ? rendererLoader.item.expandable : false
141142 readonly property bool filtered: rendererLoader.item ? rendererLoader.item.filter : true
qml/Dash/PreviewListView.qml+25−29
@@ -109,43 +109,39 @@ Item {
109109 }
110110 }
111111
112− delegate: Previews.Preview {
113− id: preview
114− objectName: "preview" + index
112+ delegate: Item {
115113 height: previewListView.height
116114 width: previewListView.width
117115
118− isCurrent: ListView.isCurrentItem
119−
120− onPreviewModelChanged: preview.opacity = 0;
121− onReadyChanged: if (ready) fadeIn.start()
122− previewModel: {
123− // TODO
124− // We need the isCurrent because the scope fails to
125− // deliver the preview if we ask for one after other very quickly
126− // If we remove the isCurrent, we will have to think another way of
127− // doing the fadeIn or just don't do it at all or just decide
128− // this code is good enough and remove the TODO
129− if (isCurrent) {
116+ Previews.Preview {
117+ id: preview
118+ objectName: "preview" + index
119+ anchors.fill: parent
120+
121+ isCurrent: parent.ListView.isCurrentItem
122+
123+ previewModel: {
130124 var previewStack = root.scope.preview(result);
131125 return previewStack.get(0);
132− } else {
133− ready = false;
134− return null;
135126 }
127+
128+ // onClose: {
129+ // previewListView.open = false
130+ // }
131+
136132 }
137133
138−// onClose: {
139−// previewListView.open = false
140−// }
141−
142− PropertyAnimation {
143− id: fadeIn
144− target: preview
145− property: "opacity"
146− from: 0.0
147− to: 1.0
148− duration: UbuntuAnimation.BriskDuration
134+ MouseArea {
135+ id: processingMouseArea
136+ objectName: "processingMouseArea"
137+ anchors.fill: parent
138+ enabled: !preview.previewModel.loaded || preview.previewModel.processingAction
139+
140+ ActivityIndicator {
141+ anchors.centerIn: parent
142+ visible: root.onScreen && parent.enabled
143+ running: visible
144+ }
149145 }
150146 }
151147 }
qml/Dash/Previews/Preview.qml−13
@@ -36,9 +36,6 @@ Item {
3636 //! \brief Should be set to true if this preview is currently displayed.
3737 property bool isCurrent: false
3838
39− //! \brief Will be changed to true when the initial preview widgets are in.
40− property bool ready: false
41−
4239 clip: true
4340
4441 Connections {
@@ -52,8 +49,6 @@ Item {
5249 }
5350 }
5451
55− onPreviewModelChanged: processingMouseArea.enabled = false
56−
5752 Binding {
5853 target: previewModel
5954 property: "widgetColumnCount"
@@ -84,7 +79,6 @@ Item {
8479 bottomMargin: Qt.inputMethod.visible ? Qt.inputMethod.keyboardRectangle.height : 0
8580
8681 model: columnModel
87− onCountChanged: if (count > 0) root.ready = true
8882 cacheBuffer: height
8983
9084 Behavior on contentY { UbuntuNumberAnimation { } }
@@ -113,11 +107,4 @@ Item {
113107 }
114108 }
115109 }
116−
117− MouseArea {
118− id: processingMouseArea
119− objectName: "processingMouseArea"
120− anchors.fill: parent
121− enabled: false
122− }
123110}
qml/Dash/Previews/PreviewZoomableImage.qml+2−5
@@ -30,11 +30,8 @@ PreviewWidget {
3030
3131 LazyImage {
3232 objectName: "image"
33− anchors {
34− top: parent.top
35− bottom: parent.bottom
36− }
37− scaleTo: "height"
33+ anchors.fill: parent
34+ scaleTo: "fit"
3835 source: widgetData["source"]
3936 initialWidth: units.gu(13)
4037 }
qml/Greeter/Greeter.qml+4
@@ -67,6 +67,10 @@ Showable {
6767
6868 source: required ? "GreeterContent.qml" : ""
6969
70+ onLoaded: {
71+ selected(currentIndex);
72+ }
73+
7074 Connections {
7175 target: greeterContentLoader.item
7276
qml/Greeter/GreeterContent.qml−1
@@ -96,7 +96,6 @@ MouseArea {
9696
9797 onLoaded: {
9898 item.currentIndex = greeterContentLoader.currentIndex;
99− selected(item.currentIndex);
10099 item.resetAuthentication();
101100 }
102101
qml/Shell.qml+105−62
@@ -83,8 +83,6 @@ FocusScope {
8383 applicationManager.setSideStageAppRect(sideStageAppRect);
8484 }
8585
86− readonly property bool applicationFocused: !!applicationManager.mainStageFocusedApplication
87− || !!applicationManager.sideStageFocusedApplication
8886 // Used for autopilot testing.
8987 readonly property string currentFocusedAppId: ApplicationManager.focusedApplicationId
9088
@@ -149,66 +147,94 @@ FocusScope {
149147 // Whether the underlay is fully covered by opaque UI elements.
150148 property bool fullyCovered: panel.indicators.fullyOpened && shell.width <= panel.indicatorsMenuWidth
151149
152− readonly property bool applicationRunning: ((mainStage.applications && mainStage.applications.count > 0)
153− || (sideStage.applications && sideStage.applications.count > 0))
150+ readonly property bool mainStageApplicationRunning: mainStage.applications && mainStage.applications.count > 0
151+ readonly property bool sideStageApplicationRunning: sideStage.applications && sideStage.applications.count > 0
154152
155153 // Whether the user should see the topmost application surface (if there's one at all).
156− readonly property bool applicationSurfaceShouldBeSeen: applicationRunning && !stages.fullyHidden
154+ readonly property bool mainStageApplicationShown: mainStageApplicationRunning && !stages.fullyHidden
157155 && !mainStage.usingScreenshots // but want sideStage animating over app surface
158156
159157
160158
161159 // NB! Application surfaces are stacked behing the shell one. So they can only be seen by the user
162160 // through the translucent parts of the shell surface.
163− visible: !fullyCovered && !applicationSurfaceShouldBeSeen
164−
165− Rectangle {
166− anchors.fill: parent
167− color: "black"
168− opacity: dash.disappearingAnimationProgress
169− }
161+ visible: !fullyCovered && !mainStageApplicationShown
162+
163+ Item {
164+ id: underlayClipper
165+ clip: !parent.mainStageApplicationShown && parent.sideStageApplicationRunning && stagesOuterContainer.showProgress > 0
166+ width: {
167+ if (clip) {
168+ var w = parent.width - sideStage.width
169+ w += stagesOuterContainer.x + stages.x + (sideStage.x - sideStageRevealer.openedValue)
170+ return Math.min(w, parent.width);
171+ } else {
172+ return parent.width;
173+ }
174+ }
175+ height: parent.height
170176
171− Image {
172− anchors.fill: dash
173− source: shell.width > shell.height ? "Dash/graphics/paper_landscape.png" : "Dash/graphics/paper_portrait.png"
174− fillMode: Image.PreserveAspectCrop
175− horizontalAlignment: Image.AlignRight
176− verticalAlignment: Image.AlignTop
177− }
177+ Image {
178+ anchors.fill: dash
179+ source: shell.width > shell.height ? "Dash/graphics/paper_landscape.png" : "Dash/graphics/paper_portrait.png"
180+ fillMode: Image.PreserveAspectCrop
181+ horizontalAlignment: Image.AlignRight
182+ verticalAlignment: Image.AlignTop
183+ }
184+
185+ Dash {
186+ id: dash
187+ objectName: "dash"
188+
189+ available: !greeter.shown && !lockscreen.shown
190+ hides: [stages, launcher, panel.indicators]
191+ shown: disappearingAnimationProgress !== 1.0
192+ enabled: disappearingAnimationProgress === 0.0 && edgeDemo.dashEnabled
193+ // FIXME: unfocus all applications when going back to the dash
194+ onEnabledChanged: {
195+ if (enabled) {
196+ shell.applicationManager.unfocusCurrentApplication()
197+ }
198+ }
178199
179− Dash {
180− id: dash
181− objectName: "dash"
182−
183− available: !greeter.shown && !lockscreen.shown
184− hides: [stages, launcher, panel.indicators]
185− shown: disappearingAnimationProgress !== 1.0
186− enabled: disappearingAnimationProgress === 0.0 && edgeDemo.dashEnabled
187− // FIXME: unfocus all applications when going back to the dash
188− onEnabledChanged: {
189− if (enabled) {
190− shell.applicationManager.unfocusCurrentApplication()
200+ width: underlay.width
201+ height: underlay.height - y
202+ y: panel.panelHeight
203+
204+ contentScale: 1.0 - 0.2 * disappearingAnimationProgress
205+ opacity: 1.0 - disappearingAnimationProgress
206+ property real disappearingAnimationProgress: {
207+ if (greeter.shown) {
208+ return greeter.showProgress;
209+ } else {
210+ if (underlayClipper.clip)
211+ return 0;
212+ else
213+ return stagesOuterContainer.showProgress;
214+ }
191215 }
216+
217+ // FIXME: only necessary because stagesOuterContainer.showProgress and
218+ // greeterRevealer.animatedProgress are not animated
219+ Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
192220 }
193221
194− anchors {
195− fill: parent
196− topMargin: panel.panelHeight
222+ Rectangle {
223+ width: underlay.width
224+ height: underlay.height
225+ color: "black"
226+ opacity: 0.5 * ((sideStage.x - sideStageRevealer.closedValue) / (sideStageRevealer.openedValue - sideStageRevealer.closedValue))
227+ visible: sideStageHideButton.enabled
197228 }
198229
199− contentScale: 1.0 - 0.2 * disappearingAnimationProgress
200− opacity: 1.0 - disappearingAnimationProgress
201− property real disappearingAnimationProgress: {
202− if (greeter.shown) {
203− return greeter.showProgress;
204− } else {
205− return stagesOuterContainer.showProgress;
230+ AbstractButton {
231+ id: sideStageHideButton
232+ enabled: mainStage.applications.count == 0 && sideStage.shown
233+ anchors.fill: parent
234+ onClicked: {
235+ sideStage.hide();
206236 }
207237 }
208−
209− // FIXME: only necessary because stagesOuterContainer.showProgress and
210− // greeterRevealer.animatedProgress are not animated
211− Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
212238 }
213239 }
214240
@@ -217,7 +243,7 @@ FocusScope {
217243
218244 width: parent.width
219245 height: parent.height
220− x: launcher.progress
246+ x: mainStage.applications.count > 0 ? launcher.progress : 0
221247 Behavior on x {SmoothedAnimation{velocity: 600}}
222248
223249 property real showProgress:
@@ -229,6 +255,16 @@ FocusScope {
229255
230256 x: width
231257
258+ function doLauncherHide() {
259+ if (mainStage.applications.count > 0) {
260+ hide();
261+ } else {
262+ if (sideStage.shown) {
263+ sideStage.hide();
264+ }
265+ }
266+ }
267+
232268 property bool fullyShown: shown && x == 0 && parent.x == 0
233269 property bool fullyHidden: !shown && x == width
234270 available: !greeter.shown
@@ -313,11 +349,6 @@ FocusScope {
313349 rightEdgeDraggingAreaWidth: shell.edgeSize
314350 normalApplicationY: shell.panelHeight
315351
316− onShownChanged: {
317− if (!shown && mainStage.applications.count == 0) {
318− stages.hide();
319− }
320− }
321352 // FIXME: when hiding the side stage, refocus the main stage
322353 // application so that it goes in front of the side stage
323354 // application and hides it
@@ -346,8 +377,16 @@ FocusScope {
346377 Connections {
347378 target: sideStage.applications
348379 onCountChanged: {
349− if (sideStage.applications.count == 0 && sideStage.shown) { // if all SS app closed, hide side stage
350− sideStage.hide();
380+ if (sideStage.applications.count == 0) {
381+ if (sideStage.shown) { // if all SS app closed, hide side stage
382+ sideStage.hide();
383+ } else {
384+ // Sidestage is hidden and there is no main app, make sure the
385+ // stages is totally hidden too
386+ if (mainStage.applications.count == 0) {
387+ stages.hideNow();
388+ }
389+ }
351390 }
352391 }
353392 }
@@ -356,7 +395,7 @@ FocusScope {
356395 Revealer {
357396 id: sideStageRevealer
358397
359− enabled: mainStage.applications.count > 0 && sideStage.applications.count > 0
398+ enabled: sideStage.applications.count > 0
360399 && sideStage.available
361400 direction: Qt.RightToLeft
362401 openedValue: parent.width - sideStage.width
@@ -437,7 +476,6 @@ FocusScope {
437476 Component.onCompleted: {
438477 if (LightDM.Users.count == 1) {
439478 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
440− greeter.selected(0)
441479 }
442480 }
443481 }
@@ -478,7 +516,7 @@ FocusScope {
478516 hides: [launcher, panel.indicators, hud]
479517 shown: true
480518
481− defaultBackground: shell.background
519+ defaultBackground: shell.defaultBackground
482520
483521 y: panel.panelHeight
484522 width: parent.width
@@ -515,7 +553,6 @@ FocusScope {
515553 // If there are more users, the Greeter will handle that
516554 if (LightDM.Users.count == 1) {
517555 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
518− greeter.selected(0);
519556 }
520557 greeter.forceActiveFocus();
521558 removeApplicationFocus();
@@ -563,8 +600,14 @@ FocusScope {
563600 }
564601
565602 InputFilterArea {
566− anchors.fill: parent
567− blockInput: !applicationFocused || greeter.shown || lockscreen.shown || launcher.shown
603+ width: {
604+ if (applicationManager.sideStageFocusedApplication && sideStage.shown)
605+ return parent.width - sideStage.width;
606+ else
607+ return parent.width;
608+ }
609+ height: parent.height
610+ blockInput: !applicationManager.mainStageFocusedApplication || greeter.shown || lockscreen.shown || launcher.shown
568611 || panel.indicators.shown || hud.shown
569612 }
570613
@@ -666,7 +709,7 @@ FocusScope {
666709 theHud: hud
667710 anchors.fill: parent
668711 enabled: hud.available
669− applicationIsOnForeground: applicationFocused
712+ applicationIsOnForeground: (stages.shown && mainStage.applications.count > 0) || (stages.shown && sideStage.shown)
670713 }
671714
672715 InputFilterArea {
@@ -688,7 +731,7 @@ FocusScope {
688731 anchors.bottom: parent.bottom
689732 width: parent.width
690733 dragAreaWidth: shell.edgeSize
691− available: (!greeter.shown || greeter.narrowMode) && edgeDemo.launcherEnabled
734+ available: !greeter.locked && edgeDemo.launcherEnabled
692735
693736 onShowDashHome: {
694737 if (edgeDemo.running)
@@ -698,7 +741,7 @@ FocusScope {
698741 }
699742 onDash: {
700743 if (stages.shown) {
701− stages.hide();
744+ stages.doLauncherHide();
702745 launcher.hide();
703746 }
704747 }
tests/mocks/AccountsService/AccountsService.cpp+1−1
@@ -20,7 +20,7 @@
2020
2121AccountsService::AccountsService(QObject* parent)
2222 : QObject(parent),
23− m_backgroundFile(TOP_SRCDIR "/graphics/phone_background.jpg"),
23+ m_backgroundFile(TOP_SRCDIR "/qml/graphics/phone_background.jpg"),
2424 m_statsWelcomeScreen(true)
2525{
2626}
tests/qmltests/Dash/tst_Card.qml+14
@@ -182,6 +182,7 @@ Rectangle {
182182 when: windowShown
183183
184184 property Item header: findChild(card, "cardHeader")
185+ property Item title: findChild(header, "titleLabel")
185186 property Item art: findChild(card, "artShape")
186187 property Item artImage: findChild(card, "artImage")
187188 property Item summary: findChild(card, "summaryLabel")
@@ -413,5 +414,18 @@ Rectangle {
413414 tryCompare(backgroundImage, "source", data.image);
414415 }
415416 }
417+
418+ function test_font_weights_data() {
419+ return [
420+ { tag: "Title only", index: 8, weight: Font.Normal },
421+ { tag: "Title, subtitle", index: 0, weight: Font.DemiBold },
422+ ]
423+ }
424+
425+ function test_font_weights(data) {
426+ selector.selectedIndex = data.index;
427+
428+ tryCompare(testCase.title.font, "weight", data.weight);
429+ }
416430 }
417431}
tests/qmltests/Greeter/tst_Phone.qml+19
@@ -44,6 +44,17 @@ Item {
4444 }
4545 }
4646
47+ Component {
48+ id: greeterComponent
49+ Greeter {
50+ SignalSpy {
51+ objectName: "selectedSpy"
52+ target: parent
53+ signalName: "selected"
54+ }
55+ }
56+ }
57+
4758 SignalSpy {
4859 id: unlockSpy
4960 target: greeter
@@ -148,5 +159,13 @@ Item {
148159 tryCompareFunction(function() { return background.source.toString().indexOf(data.expected) !== -1; }, true)
149160 tryCompare(background, "status", Image.Ready)
150161 }
162+
163+ function test_initial_selected_signal() {
164+ var greeterObj = greeterComponent.createObject(this)
165+ var spy = findChild(greeterObj, "selectedSpy")
166+ spy.wait()
167+ tryCompare(spy, "count", 1)
168+ greeterObj.destroy()
169+ }
151170 }
152171}
tests/qmltests/Greeter/tst_Tablet.qml+19
@@ -31,6 +31,17 @@ Item {
3131 anchors.fill: parent
3232 }
3333
34+ Component {
35+ id: greeterComponent
36+ Greeter {
37+ SignalSpy {
38+ objectName: "selectedSpy"
39+ target: parent
40+ signalName: "selected"
41+ }
42+ }
43+ }
44+
3445 SignalSpy {
3546 id: unlockSpy
3647 target: greeter
@@ -335,5 +346,13 @@ Item {
335346 var userlist = findChild(greeter, "userList")
336347 compare(greeter.model.data(userlist.currentIndex, LightDM.UserRoles.NameRole), "has-password")
337348 }
349+
350+ function test_initial_selected_signal() {
351+ var greeterObj = greeterComponent.createObject(this)
352+ var spy = findChild(greeterObj, "selectedSpy")
353+ spy.wait()
354+ tryCompare(spy, "count", 1)
355+ greeterObj.destroy()
356+ }
338357 }
339358}