Merge lp:~nick-dedekind/unity/phablet-greeter-indicators into lp:unity/phablet

Proposed by Nick Dedekind
Status: Merged
Approved by: Michał Sawicz
Approved revision: no longer in the source branch.
Merged at revision: 686
Proposed branch: lp:~nick-dedekind/unity/phablet-greeter-indicators
Merge into: lp:unity/phablet
Diff against target: 177 lines (+34/-33)
6 files modified
Panel/Indicators.qml (+11/-5)
Panel/Panel.qml (+15/-11)
Panel/SearchIndicator.qml (+0/-8)
Shell.qml (+1/-2)
tests/qmltests/Panel/tst_Panel.qml (+5/-5)
tests/qmltests/Panel/tst_SearchIndicator.qml (+2/-2)
To merge this branch: bzr merge lp:~nick-dedekind/unity/phablet-greeter-indicators
Reviewer Review Type Date Requested Status
Michał Sawicz Approve
PS Jenkins bot (community) continuous-integration Approve
Albert Astals Cid (community) Needs Fixing
Katie Taylor Pending
Review via email: mp+157330@code.launchpad.net

Commit message

Indicator panel now available in greeter

Description of the change

Indicator panel now available in greeter (sans Search bar)
==========================================================
Fixed some state change issues causing initial opening of dash not to have search bar (when removed from greeter).
Caused by state nor being initialized to "initial" by the dynamic assignment of the states.

To post a comment you must log in.
Revision history for this message
Michael Terry (mterry) wrote :

Is this WIP for a particular reason?

Revision history for this message
Nick Dedekind (nick-dedekind) wrote :

From Saviq:

Only thing I'm not sure of here is that it's possible to tap on the indicators to open them, looks to me like a potential "phone in pocket" issue.

Maybe we should only leave the drag gesture when over greeter?

Revision history for this message
Nick Dedekind (nick-dedekind) wrote :

> Is this WIP for a particular reason?

No, was just waiting on design review on your branch from Katie.
But since we've moved here then I've added the design review here as well.

Revision history for this message
Nick Dedekind (nick-dedekind) wrote :

> From Saviq:
>
> Only thing I'm not sure of here is that it's possible to tap on the indicators
> to open them, looks to me like a potential "phone in pocket" issue.
>
> Maybe we should only leave the drag gesture when over greeter?

Problem with disabling tap is that you won't be able to access the device overview page anymore.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

qmluitests don't pass

review: Needs Fixing
Revision history for this message
Michał Sawicz (saviq) wrote :

The below tests don't pass:
    qmltestrunner.Panel::test_search_click_when_disabled
    qmltestrunner.Panel::test_search_click_when_enabled
    qmltestrunner.SearchIndicator::test_hideUp
    qmltestrunner.SearchIndicator::test_show

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Katie Taylor (katie-t) wrote :

I don't think we should have tap to open on indicators in the greeter. It feels like a gesture that is too easy and would be prone to lots of accidental taps.

Tapping in the top part of the greeter screen should trigger a hint that the indicator menus open. (hint = reveal a small section of the indicator menu, and then fairly quickly hide it.)

This is similar to what we plan for the launcher, see Michael Zanetti's ~mzanetti/unity/phablet-tease-launcher

Revision history for this message
Michał Sawicz (saviq) wrote :

23 + // because of dynamic assignment of states, we need to assign state after completion.
24 + Component.onCompleted: state = "initial"

Is this really true? Why would « state: "initial" » not work?

=====

43 - property alias searchEnabled: search.enabled
44 + property bool searchVisible: true

Why this rename?

=====

94 - function show() {
95 - search.state = "visible"
96 + function show_state() {
97 + return "visible"
98 }
99
100 - function hideUp() {
101 - search.state = "hiddenUp"
102 + function hideUp_state() {
103 + return "hiddenUp"
104 }

169 - searchIndicator.hideUp()
170 + searchIndicator.state = searchIndicator.hideUp_state()

177 - searchIndicator.show()
178 + searchIndicator.state = searchIndicator.show_state()

This is weird, why the _state() methods at all? Either direct names or readonly props would suffice, no?

=====

116 + available: true

This is the default.

review: Needs Fixing
Revision history for this message
Nick Dedekind (nick-dedekind) wrote :

> 23 + // because of dynamic assignment of states, we need to assign state
> after completion.
> 24 + Component.onCompleted: state = "initial"
>
> Is this really true? Why would « state: "initial" » not work?
>

Yes, it's a bit of a quirk with QML. It seems the dynamic assignments are computed after the static ones.

ie.
  states: pinnedModeStates
is assigned after
  state: "initial"
no matter where in the code it's placed.

so, when states property is assigned after state, it clears the state "initial".

> =====
>
> 43 - property alias searchEnabled: search.enabled
> 44 + property bool searchVisible: true
>
> Why this rename?
>

Because it's visiblily vs enabling. Previously search was always visible, only it was disabled. Now it's not visible at all.

> =====
>
> 94 - function show() {
> 95 - search.state = "visible"
> 96 + function show_state() {
> 97 + return "visible"
> 98 }
> 99
> 100 - function hideUp() {
> 101 - search.state = "hiddenUp"
> 102 + function hideUp_state() {
> 103 + return "hiddenUp"
> 104 }
>
> 169 - searchIndicator.hideUp()
> 170 + searchIndicator.state = searchIndicator.hideUp_state()
>
> 177 - searchIndicator.show()
> 178 + searchIndicator.state = searchIndicator.show_state()
>
> This is weird, why the _state() methods at all? Either direct names or
> readonly props would suffice, no?
>

Done.
Guess I'm not a fan of setting state by string from external object. :(

> =====
>
> 116 + available: true
>
> This is the default.

Done

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

W dniu 20.05.2013 16:01, Nick Dedekind pisze:
>> 23 + // because of dynamic assignment of states, we need to assign state
>> after completion.
>> 24 + Component.onCompleted: state = "initial"
>>
>> Is this really true? Why would « state: "initial" » not work?
>>
>
> Yes, it's a bit of a quirk with QML. It seems the dynamic assignments are computed after the static ones.
>
> ie.
> states: pinnedModeStates
> is assigned after
> state: "initial"
> no matter where in the code it's placed.
>
> so, when states property is assigned after state, it clears the state "initial".

I could even imagine they're evaluated in alphabetical order ;). After
all you're not supposed to rely on that order.

>> 94 - function show() {
>> 95 - search.state = "visible"
>> 96 + function show_state() {
>> 97 + return "visible"
>> 98 }
>> 99
>> 100 - function hideUp() {
>> 101 - search.state = "hiddenUp"
>> 102 + function hideUp_state() {
>> 103 + return "hiddenUp"
>> 104 }
>>
>> 169 - searchIndicator.hideUp()
>> 170 + searchIndicator.state = searchIndicator.hideUp_state()
>>
>> 177 - searchIndicator.show()
>> 178 + searchIndicator.state = searchIndicator.show_state()
>>
>> This is weird, why the _state() methods at all? Either direct names or
>> readonly props would suffice, no?
>>
>
> Done.
> Guess I'm not a fan of setting state by string from external object. :(

Well, then the previous approach (with hideUp(), show()) was one that
didn't do it, no? .state = .show_state() is IMO the same as .state =
"visible" if show_state() just returns "visible". If you want to avoid
that, a show() function that sets the state to "visible" internally was
the right way, no? Why do we need to change the hideUp() and show()
methods at all?

--
Michał Sawicz <email address hidden>
Canonical Services Ltd.

Revision history for this message
Nick Dedekind (nick-dedekind) wrote :

> W dniu 20.05.2013 16:01, Nick Dedekind pisze:
> >> 23 + // because of dynamic assignment of states, we need to assign
> state
> >> after completion.
> >> 24 + Component.onCompleted: state = "initial"
> >>
> >> Is this really true? Why would « state: "initial" » not work?
> >>
> >
> > Yes, it's a bit of a quirk with QML. It seems the dynamic assignments are
> computed after the static ones.
> >
> > ie.
> > states: pinnedModeStates
> > is assigned after
> > state: "initial"
> > no matter where in the code it's placed.
> >
> > so, when states property is assigned after state, it clears the state
> "initial".
>
> I could even imagine they're evaluated in alphabetical order ;). After
> all you're not supposed to rely on that order.
>
>
> >> 94 - function show() {
> >> 95 - search.state = "visible"
> >> 96 + function show_state() {
> >> 97 + return "visible"
> >> 98 }
> >> 99
> >> 100 - function hideUp() {
> >> 101 - search.state = "hiddenUp"
> >> 102 + function hideUp_state() {
> >> 103 + return "hiddenUp"
> >> 104 }
> >>
> >> 169 - searchIndicator.hideUp()
> >> 170 + searchIndicator.state = searchIndicator.hideUp_state()
> >>
> >> 177 - searchIndicator.show()
> >> 178 + searchIndicator.state = searchIndicator.show_state()
> >>
> >> This is weird, why the _state() methods at all? Either direct names or
> >> readonly props would suffice, no?
> >>
> >
> > Done.
> > Guess I'm not a fan of setting state by string from external object. :(
>
> Well, then the previous approach (with hideUp(), show()) was one that
> didn't do it, no? .state = .show_state() is IMO the same as .state =
> "visible" if show_state() just returns "visible". If you want to avoid
> that, a show() function that sets the state to "visible" internally was
> the right way, no? Why do we need to change the hideUp() and show()
> methods at all?
>

Because the search bar state is dependant on the searchVisible flag and the width of the panel, search & indicatorbar, not the state of the Inidcators.
Thought it better to have the state determination in a single place than to have multiple entry points.
I could have had connections to the change of various items which determine the state of the search call into a function to re-interprets that state. But it's a bit messy.

> --
> Michał Sawicz <email address hidden>
> Canonical Services Ltd.

Revision history for this message
Nick Dedekind (nick-dedekind) wrote :

FYI, I believe the change for the search bar states will fix https://bugs.launchpad.net/touch-preview-images/+bug/1181249

Need to confirm though.

Revision history for this message
Michał Sawicz (saviq) wrote :

I'm not buying the s/enabled/visible/ change, but that's fine ;)

We need to later hide the search label when dash isn't focused (and even later - interface with the app to see if it supports search to determine whether to hide or not).

Also it feels like it's the search label that will hide when there's too many indicators, and it should be the other way 'round - it's the overflow indicators that should hide.

Aaand also the SEARCH label will need to get replaced (slide in from the bottom) with corresponding MUSIC, APPS, etc., or the actual search query (in double quotes).

Aaaand it should also be possible to edge-swipe the search entry down (should on the phone, not only tap on it...

Let me add those as WIs, so we don't lose them :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Panel/Indicators.qml'
--- Panel/Indicators.qml 2013-04-23 10:23:39 +0000
+++ Panel/Indicators.qml 2013-05-20 14:15:37 +0000
@@ -66,8 +66,6 @@
66 }66 }
67 }67 }
6868
69 state: "initial"
70
71 function handlePress() {69 function handlePress() {
72 menuContent.hideAll()70 menuContent.hideAll()
73 menuContent.activateContent()71 menuContent.activateContent()
@@ -267,9 +265,17 @@
267 }265 }
268 }266 }
269267
270 //FIXME: when 'states' is changed, "state" is reset to the empty string. Need to find268 // We start with pinned states. (default pinnedMode: true)
271 //a way to detect this and restore the correct state again.269 states: pinnedModeStates
272 states: (pinnedMode) ? pinnedModeStates : offScreenModeStates270 // because of dynamic assignment of states, we need to assign state after completion.
271 Component.onCompleted: state = "initial"
272
273 // changing states will reset state to "".
274 onPinnedModeChanged: {
275 var last_state = state;
276 states = (pinnedMode) ? pinnedModeStates : offScreenModeStates;
277 state = last_state;
278 }
273279
274 property list<State> offScreenModeStates: [280 property list<State> offScreenModeStates: [
275 State {281 State {
276282
=== modified file 'Panel/Panel.qml'
--- Panel/Panel.qml 2013-04-12 08:37:35 +0000
+++ Panel/Panel.qml 2013-05-20 14:15:37 +0000
@@ -25,7 +25,7 @@
25 property real indicatorsMenuWidth: (shell.width > units.gu(60)) ? units.gu(40) : shell.width25 property real indicatorsMenuWidth: (shell.width > units.gu(60)) ? units.gu(40) : shell.width
26 property alias indicators: indicatorsMenu26 property alias indicators: indicatorsMenu
27 property bool fullscreenMode: false27 property bool fullscreenMode: false
28 property alias searchEnabled: search.enabled28 property bool searchVisible: true
2929
30 readonly property real separatorLineHeight: leftSeparatorLine.height30 readonly property real separatorLineHeight: leftSeparatorLine.height
31 readonly property real __panelMinusSeparatorLineHeight: panelHeight - separatorLineHeight31 readonly property real __panelMinusSeparatorLineHeight: panelHeight - separatorLineHeight
@@ -115,16 +115,6 @@
115 pinnedMode: !fullscreenMode115 pinnedMode: !fullscreenMode
116116
117 property real unitProgress: (indicatorRevealer.closedValue - progress) / (indicatorRevealer.closedValue - indicatorRevealer.openedValue)117 property real unitProgress: (indicatorRevealer.closedValue - progress) / (indicatorRevealer.closedValue - indicatorRevealer.openedValue)
118
119 onStateChanged: {
120 if (parent.width < indicatorsMenu.width + search.width) {
121 if (state != "initial") {
122 search.hideUp()
123 return;
124 }
125 }
126 search.show()
127 }
128 }118 }
129119
130 PanelSeparatorLine {120 PanelSeparatorLine {
@@ -172,6 +162,20 @@
172 SearchIndicator {162 SearchIndicator {
173 id: search163 id: search
174 objectName: "search"164 objectName: "search"
165 enabled: root.searchVisible
166
167 state: {
168 if (parent.width < indicatorsMenu.width + width) {
169 if (indicatorsMenu.state != "initial") {
170 return "hiddenUp";
171 }
172 }
173 if (root.searchVisible) {
174 return "visible";
175 }
176
177 return "hiddenUp";
178 }
175179
176 width: units.gu(13)180 width: units.gu(13)
177 height: __panelMinusSeparatorLineHeight181 height: __panelMinusSeparatorLineHeight
178182
=== modified file 'Panel/SearchIndicator.qml'
--- Panel/SearchIndicator.qml 2013-04-08 15:36:12 +0000
+++ Panel/SearchIndicator.qml 2013-05-20 14:15:37 +0000
@@ -27,14 +27,6 @@
2727
28 signal clicked28 signal clicked
2929
30 function show() {
31 search.state = "visible"
32 }
33
34 function hideUp() {
35 search.state = "hiddenUp"
36 }
37
38 // eater30 // eater
39 MouseArea {31 MouseArea {
40 anchors.fill: parent32 anchors.fill: parent
4133
=== modified file 'Shell.qml'
--- Shell.qml 2013-05-17 11:00:27 +0000
+++ Shell.qml 2013-05-20 14:15:37 +0000
@@ -383,10 +383,9 @@
383 indicatorsMenuWidth: parent.width > units.gu(60) ? units.gu(40) : parent.width383 indicatorsMenuWidth: parent.width > units.gu(60) ? units.gu(40) : parent.width
384 indicators {384 indicators {
385 hides: [launcher]385 hides: [launcher]
386 available: !greeter.shown
387 }386 }
388 fullscreenMode: shell.fullscreenMode387 fullscreenMode: shell.fullscreenMode
389 searchEnabled: !greeter.shown388 searchVisible: !greeter.shown
390389
391 InputFilterArea {390 InputFilterArea {
392 anchors.fill: parent391 anchors.fill: parent
393392
=== modified file 'tests/qmltests/Panel/tst_Panel.qml'
--- tests/qmltests/Panel/tst_Panel.qml 2013-04-17 13:01:10 +0000
+++ tests/qmltests/Panel/tst_Panel.qml 2013-05-20 14:15:37 +0000
@@ -235,9 +235,9 @@
235 }235 }
236 }236 }
237237
238 function test_search_click_when_enabled() {238 function test_search_click_when_visible() {
239 panel.fullscreenMode = false;239 panel.fullscreenMode = false;
240 panel.searchEnabled = true;240 panel.searchVisible = true;
241241
242 var search_indicator = findChild(panel, "search");242 var search_indicator = findChild(panel, "search");
243 verify(search_indicator != undefined);243 verify(search_indicator != undefined);
@@ -249,9 +249,9 @@
249 compare(search_clicked, true, "Clicking search indicator while it was enabled did not emit searchClicked signal")249 compare(search_clicked, true, "Clicking search indicator while it was enabled did not emit searchClicked signal")
250 }250 }
251251
252 function test_search_click_when_disabled() {252 function test_search_click_when_not_visible() {
253 panel.fullscreenMode = false;253 panel.fullscreenMode = false;
254 panel.searchEnabled = false254 panel.searchVisible = false
255255
256 var search_indicator = findChild(panel, "search");256 var search_indicator = findChild(panel, "search");
257 verify(search_indicator != undefined);257 verify(search_indicator != undefined);
@@ -260,7 +260,7 @@
260 1, 1,260 1, 1,
261 Qt.LeftButton, Qt.NoModifier , 0);261 Qt.LeftButton, Qt.NoModifier , 0);
262262
263 compare(search_clicked, false, "Clicking search indicator while it was enabled emitted searchClicked signal")263 compare(search_clicked, false, "Clicking search indicator while it was not visible emitted searchClicked signal")
264 }264 }
265 }265 }
266}266}
267267
=== modified file 'tests/qmltests/Panel/tst_SearchIndicator.qml'
--- tests/qmltests/Panel/tst_SearchIndicator.qml 2013-04-17 13:01:10 +0000
+++ tests/qmltests/Panel/tst_SearchIndicator.qml 2013-05-20 14:15:37 +0000
@@ -49,14 +49,14 @@
4949
50 function test_hideUp() {50 function test_hideUp() {
51 var container = findChild(searchIndicator, "container")51 var container = findChild(searchIndicator, "container")
52 searchIndicator.hideUp()52 searchIndicator.state = "hiddenUp"
53 tryCompare(container, "opacity", 0)53 tryCompare(container, "opacity", 0)
54 tryCompare(container, "y", -container.height)54 tryCompare(container, "y", -container.height)
55 }55 }
5656
57 function test_show() {57 function test_show() {
58 var container = findChild(searchIndicator, "container")58 var container = findChild(searchIndicator, "container")
59 searchIndicator.show()59 searchIndicator.state = "visible"
60 tryCompare(container, "opacity", 1)60 tryCompare(container, "opacity", 1)
61 tryCompare(container, "y", 0)61 tryCompare(container, "y", 0)
62 }62 }

Subscribers

People subscribed via source and target branches