Merge lp:~unity-team/unity8/switching-previews into lp:unity8

Proposed by Michał Sawicz
Status: Merged
Approved by: Albert Astals Cid
Approved revision: 484
Merged at revision: 493
Proposed branch: lp:~unity-team/unity8/switching-previews
Merge into: lp:unity8
Prerequisite: lp:~unity-team/unity8/fix-genericpreview
Diff against target: 1364 lines (+516/-243)
24 files modified
Components/Carousel.qml (+27/-9)
Components/FilterGrid.qml (+3/-0)
Components/LazyImage.qml (+2/-2)
Components/PageHeader.qml (+4/-0)
Components/ResponsiveGridView.qml (+10/-0)
Components/Tile.qml (+9/-0)
Dash/Apps/AppPreview.qml (+9/-0)
Dash/Apps/ApplicationsFilterGrid.qml (+14/-5)
Dash/Apps/DashPluginFilterGrid.qml (+2/-4)
Dash/DashPreview.qml (+1/-3)
Dash/DashPreviewPlaceholder.qml (+25/-0)
Dash/Generic/GenericFilterGrid.qml (+4/-6)
Dash/Generic/WeatherFilterGrid.qml (+2/-4)
Dash/GenericScopeView.qml (+227/-66)
Dash/Music/AlbumTile.qml (+0/-116)
Dash/Music/MusicFilterGrid.qml (+2/-4)
Dash/SearchableResultModel.qml (+4/-0)
Dash/Video/VideoFilterGrid.qml (+2/-4)
tests/mocks/Unity/fake_preview.cpp (+9/-1)
tests/mocks/Unity/fake_preview.h (+2/-0)
tests/mocks/Unity/fake_scope.cpp (+25/-4)
tests/mocks/Unity/fake_scope.h (+7/-2)
tests/mocks/Unity/fake_unity_plugin.cpp (+3/-0)
tests/qmltests/Dash/tst_GenericScopeView.qml (+123/-13)
To merge this branch: bzr merge lp:~unity-team/unity8/switching-previews
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Albert Astals Cid (community) Approve
Michał Sawicz Needs Fixing
Michal Hruby (community) Approve
Oren Horev design Pending
Review via email: mp+189556@code.launchpad.net

This proposal supersedes a proposal from 2013-10-04.

Commit message

Implement switching between previews by swiping.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:369
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~mzanetti/unity8/switching-previews/+merge/189391/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/unity8-ci/1264/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-saucy/4549
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-touch/2334
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-saucy/2099
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-amd64-ci/287
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1264
        deb: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1264/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-i386-ci/1263
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-saucy/833
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/424
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/424/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/2336
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/2336/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-maguro/2009
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/2022

Click here to trigger a rebuild:
http://s-jenkins:8080/job/unity8-ci/1264/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
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
Michał Sawicz (saviq) wrote :

It works beautifully for apps, but for videos and music it gets confused when sliding the view behind the preview. I think it might be the recent "move the gap" change?

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

There's also something funky with the pointer in Carousel - it moves a bit, then, when the carousel completes its movement, it moves more.

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

 83 + readonly property real center: x - listView.contentX + xTransform - drawBuffer + (width/2)

Would rather use mapToItem/mapFromItem here.

=====

182 + // FIXME: Because of ListViews inside ListViews inside Flickables inside ListViews (and some more)
183 + // we finally reached the point where this ListView doesn't correctly get swipe input any more but
184 + // instead the parent ListView is the one that is swiped. This MouseArea sort of creates a blocking
185 + // layer to make sure this ListView can be swiped, regardless of what's behind it.

Can you reproduce with a simple testcase? QTBUG?

=====

We should Probably have a ScopeFilterGrid or something, to have a base for all the clicked and pressAndHold signals / handlers. But that's for later.

=====

483 + live: true

Can it not be live when opening? We had to make it non-live, 'cause manta didn't cope with all those pixels being moved and refreshed at the same time.

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Michal Hruby (mhr3) wrote :

634 + Rectangle {

This affects all the foreground items, z: -1 seems to fix that.

review: Needs Fixing
Revision history for this message
Michael Zanetti (mzanetti) wrote :

> It works beautifully for apps, but for videos and music it gets confused when
> sliding the view behind the preview. I think it might be the recent "move the
> gap" change?

fixed

Revision history for this message
Michael Zanetti (mzanetti) wrote :

> There's also something funky with the pointer in Carousel - it moves a bit,
> then, when the carousel completes its movement, it moves more.

This is because there is a Behavior on the position of the arrow which is tied to the center of the item, but also the center of the item moves in the carouse. So we have two animations colliding, which is a limitation of QML. I've spent now quite a bit trying to work around this without real success:

* I can't really know when the carousel movement is finished as Flickable::moving etc only reflect user interaction.

* I tried to make the current center animation always complete and when done, update it with the new center positon. While it removes the jumping it causes too much moving and looks similarly crap.

Any other ideas are welcome.

Revision history for this message
Michael Zanetti (mzanetti) wrote :

> 83 + readonly property real center: x - listView.contentX +
> xTransform - drawBuffer + (width/2)
>
> Would rather use mapToItem/mapFromItem here.

Tried with that first. Behaves really weird in the carousel. I guess it would be possible to correct the weirdness somehow, but it seems to make the line even more complicated.

> =====
>
> 483 + live: true
>
> Can it not be live when opening? We had to make it non-live, 'cause manta
> didn't cope with all those pixels being moved and refreshed at the same time.

fixed

Revision history for this message
Michael Zanetti (mzanetti) wrote :

> 182 + // FIXME: Because of ListViews inside ListViews inside
> Flickables inside ListViews (and some more)
> 183 + // we finally reached the point where this ListView doesn't
> correctly get swipe input any more but
> 184 + // instead the parent ListView is the one that is swiped.
> This MouseArea sort of creates a blocking
> 185 + // layer to make sure this ListView can be swiped, regardless
> of what's behind it.
>
> Can you reproduce with a simple testcase? QTBUG?

Have tried for a while before adding this workaround, couldn't get anywhere in a reasonable amount of time.

>
> =====
>
> We should Probably have a ScopeFilterGrid or something, to have a base for all
> the clicked and pressAndHold signals / handlers. But that's for later.

Ack. Probably with the "cleaning up the Dash folder" task

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

Text conflict in Components/ResponsiveGridView.qml
Text conflict in Components/Tile.qml
Text conflict in Dash/GenericScopeView.qml
Text conflict in Dash/Music/MusicFilterGrid.qml

:/

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Michael Zanetti (mzanetti) wrote :

> 634 + Rectangle {
>
> This affects all the foreground items, z: -1 seems to fix that.

Fixed. Thanks for noticing this one. I totally got used to everything being darker and didn't notice this at all :)

Revision history for this message
Michael Zanetti (mzanetti) wrote :

> Text conflict in Components/ResponsiveGridView.qml
> Text conflict in Components/Tile.qml
> Text conflict in Dash/GenericScopeView.qml
> Text conflict in Dash/Music/MusicFilterGrid.qml
>
> :/

fixed

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:377
http://jenkins.qa.ubuntu.com/job/unity8-ci/1391/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-saucy/4989
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-touch/2901
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-saucy/2258
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-amd64-ci/414
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1391
        deb: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1391/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-i386-ci/1390
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-saucy/1162
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/864
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/864/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/2903
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/2903/artifact/work/output/*zip*/output.zip
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-maguro/2414
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/2457

Click here to trigger a rebuild:
http://10.97.0.26:8080/job/unity8-ci/1391/rebuild

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

FAILED: Continuous integration, rev:378
http://jenkins.qa.ubuntu.com/job/unity8-ci/1397/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-saucy/4995
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-touch/2910
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-saucy/2264
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-amd64-ci/420
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1397
        deb: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1397/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-i386-ci/1396
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-saucy/1166
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/870
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/870/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/2912
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/2912/artifact/work/output/*zip*/output.zip
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-maguro/2421
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/2464

Click here to trigger a rebuild:
http://10.97.0.26:8080/job/unity8-ci/1397/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Michal Hruby (mhr3) wrote :

Noticed one more strangeness, tapping a video result works fine, but once I'm in the preview mode (where swiping left/right just requests next/prev preview), swiping requests smaller size image, and once it loads it looks blurry.

Just to be clear, let's consider video preview's image uri to be "image://thumbnailer/foo". When I tap on a result, image with correct x*y dimensions is requested, but if I was on a different preview and swipe to request this one the dimensions for the request w*z are different (where w < x and z < y), so while swiping the preview images are lower res.

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

mhr3: fixed the bluriness.

Unfortunately found how to confuse it again: just switch back'n'forth between previews at row boundary without letting it finish the scroll behind the preview - because it didn't finish the animation, it will start at a wrong contentY and not travel the whole range required to settle at the next row.

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

I'm also getting a lot of:

file:///home/michal/dev/canonical/unity8/repo/Dash/DashContent.qml:119: TypeError: Cannot read property 'previewSh
own' of null
file:///home/michal/dev/canonical/unity8/repo/Dash/DashContent.qml:120: TypeError: Cannot read property 'moving' o
f null

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:380
http://jenkins.qa.ubuntu.com/job/unity8-ci/1407/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-saucy/5008
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-touch/2929
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-saucy/2274
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-amd64-ci/430
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1407
        deb: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1407/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-i386-ci/1406
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-saucy/1178
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/883
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/883/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/2931
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/2931/artifact/work/output/*zip*/output.zip
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-maguro/2439
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/2482

Click here to trigger a rebuild:
http://10.97.0.26:8080/job/unity8-ci/1407/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Michael Zanetti (mzanetti) wrote :

> There's also something funky with the pointer in Carousel - it moves a bit,
> then, when the carousel completes its movement, it moves more.

SmoothedAnimation handles this one better now.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:385
http://jenkins.qa.ubuntu.com/job/unity8-ci/1411/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-saucy/5015
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-touch/2939
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-saucy/2278
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-amd64-ci/434
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1411
        deb: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1411/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-i386-ci/1410
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-saucy/1184
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/890
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/890/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/2941
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/2941/artifact/work/output/*zip*/output.zip
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-maguro/2448
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/2491

Click here to trigger a rebuild:
http://10.97.0.26:8080/job/unity8-ci/1411/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Michal Hruby (mhr3) wrote :

There's still the issue Saviq described - the previews move when swiping between them, plus some extra debug that should be removed (495, 652), but otherwise it looks fine from my pov.

review: Approve
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 :

FAILED: Continuous integration, rev:387
http://jenkins.qa.ubuntu.com/job/unity8-ci/1459/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-saucy/5114
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-touch/3103/console
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-saucy/2331
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-amd64-ci/482
    FAILURE: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1459/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-i386-ci/1458
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-saucy/1278
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/989
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/989/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/3105
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/3105/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-maguro/2592/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/2643/console
    SUCCESS: http://10.97.0.26:8080/job/touch-flash-device/215
    SUCCESS: http://10.97.0.26:8080/job/touch-flash-device/214

Click here to trigger a rebuild:
http://10.97.0.26:8080/job/unity8-ci/1459/rebuild

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

Warnings:

Dash/GenericScopeView.qml:62: ReferenceError: previewLoader is not defined

Think we could have some tests for this?

review: Needs Fixing
Revision history for this message
Michael Zanetti (mzanetti) wrote :

> Warnings:
>
> Dash/GenericScopeView.qml:62: ReferenceError: previewLoader is not defined

fixed

> Think we could have some tests for this?

I agree this needs testing, but I didn't add them because it requires mocking of all the preview stuff. As it is yet another bigger task I'd prefer to do that in a separate branch. You ok with that?

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:388
http://jenkins.qa.ubuntu.com/job/unity8-ci/1515/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/153
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/147/console
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/42
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/39
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/39
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/39/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/39
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/144
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/153
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/153/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/147
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/147/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-maguro/2773/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/2824/console
    SUCCESS: http://10.97.0.26:8080/job/touch-flash-device/588
    SUCCESS: http://10.97.0.26:8080/job/touch-flash-device/585

Click here to trigger a rebuild:
http://10.97.0.26:8080/job/unity8-ci/1515/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

Works nicely and can't find anything horribly wrong in the code

review: Approve
Revision history for this message
Albert Astals Cid (aacid) wrote :

Tests will be provided at a later stage just to make sure this code stops conflicting like crazy asap

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:389
http://jenkins.qa.ubuntu.com/job/unity8-ci/1522/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/190
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/184/console
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/49
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/46
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/46
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/46/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/46
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/179
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/190
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/190/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/184
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/184/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-maguro/2807/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/2858/console
    SUCCESS: http://10.97.0.26:8080/job/touch-flash-device/654
    SUCCESS: http://10.97.0.26:8080/job/touch-flash-device/653

Click here to trigger a rebuild:
http://10.97.0.26:8080/job/unity8-ci/1522/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

Good -)

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Components/Carousel.qml'
2--- Components/Carousel.qml 2013-10-16 16:37:00 +0000
3+++ Components/Carousel.qml 2013-10-31 15:22:38 +0000
4@@ -45,18 +45,24 @@
5 property int drawBuffer: width / pathItemCount // an "ok" value - but values used from the listView cause loops
6 /// The selected item can be shown in a different size controlled by selectedItemScaleFactor
7 property real selectedItemScaleFactor: 1.1
8+ /// The index of the item that should be highlighted
9+ property alias highlightIndex: listView.highlightIndex
10+ /// exposes the delegate of the currentItem
11+ readonly property alias currentItem: listView.currentItem
12+ /// exposes the distance to the next row (only one row in carousel, so it's the topMargins)
13+ readonly property alias verticalSpacing: listView.verticalMargin
14
15 /// Emitted when the user clicked on an item
16 /// @param index is the index of the clicked item
17- /// @param delegateItem is the clicked component/delegate itself
18+ /// @param model is the model of all the items in the carousel
19 /// @param itemY is y of the clicked delegate
20- signal clicked(int index, var delegateItem, real itemY)
21+ signal clicked(int index, var model, real itemY)
22
23 /// Emitted when the user pressed and held on an item
24 /// @param index is the index of the held item
25- /// @param delegateItem is the held component/delegate itself
26+ /// @param model is the model of all the items in the carousel
27 /// @param itemY is y of the held delegate
28- signal pressAndHold(int index, var delegateItem, real itemY)
29+ signal pressAndHold(int index, var model, real itemY)
30
31 implicitHeight: listView.tileHeight * selectedItemScaleFactor
32
33@@ -75,6 +81,7 @@
34 property real newContentX: disabledNewContentX
35 property real pathItemCount: referenceWidth / referenceTileWidth
36 property real tileAspectRatio: 1
37+ property int highlightIndex: -1
38
39 /* The positioning and scaling of the items in the carousel is based on the variable
40 'continuousIndex', a continuous real variable between [0, 'carousel.model.count'],
41@@ -143,6 +150,7 @@
42 orientation: ListView.Horizontal
43
44 function itemClicked(index, delegateItem) {
45+ listView.currentIndex = index
46 var x = CarouselJS.getXFromContinuousIndex(index,
47 realWidth,
48 realContentWidth,
49@@ -151,11 +159,11 @@
50 gapToEndPhase,
51 carousel.drawBuffer)
52
53- if (Math.abs(x - contentX) < 1) {
54+ if (Math.abs(x - contentX) < 1 && delegateItem !== undefined) {
55 /* We're clicking the selected item and
56 we're in the neighbourhood of radius 1 pixel from it.
57 Let's emit the clicked signal. */
58- carousel.clicked(index, delegateItem, delegateItem.y)
59+ carousel.clicked(index, listView.model, delegateItem.y)
60 return
61 }
62
63@@ -175,11 +183,11 @@
64 gapToEndPhase,
65 carousel.drawBuffer);
66
67- if (Math.abs(x - contentX) < 1) {
68+ if (Math.abs(x - contentX) < 1 && delegateItem !== undefined) {
69 /* We're pressAndHold the selected item and
70 we're in the neighbourhood of radius 1 pixel from it.
71 Let's emit the pressAndHold signal. */
72- carousel.pressAndHold(index, delegateItem, delegateItem.y);
73+ carousel.pressAndHold(index, listView.model, delegateItem.y);
74 return;
75 }
76
77@@ -190,6 +198,12 @@
78 newContentXAnimation.start();
79 }
80
81+ onHighlightIndexChanged: {
82+ if (highlightIndex != -1) {
83+ itemClicked(highlightIndex)
84+ }
85+ }
86+
87 onMovementStarted: {
88 stepAnimation.stop()
89 newContentXAnimation.stop()
90@@ -273,14 +287,18 @@
91 itemTranslationScale,
92 listView.maximumItemTranslation)
93
94+ readonly property real xTransform: listView.viewTranslation + translationX * listView.scaleFactor
95+ readonly property real center: x - listView.contentX + xTransform - drawBuffer + (width/2)
96+
97 width: listView.tileWidth
98 height: listView.tileHeight
99 scale: itemScale * explicitScaleFactor
100 sourceComponent: itemComponent
101 z: cachedTiles - Math.abs(index - listView.selectedIndex)
102+ opacity: highlightIndex == -1 ? 1 : (highlightIndex == index ? 0.6 : 0.2)
103
104 transform: Translate {
105- x: listView.viewTranslation + translationX * listView.scaleFactor
106+ x: xTransform
107 }
108
109 Behavior on explicitScaleFactor {
110
111=== modified file 'Components/FilterGrid.qml'
112--- Components/FilterGrid.qml 2013-10-15 10:09:56 +0000
113+++ Components/FilterGrid.qml 2013-10-31 15:22:38 +0000
114@@ -54,6 +54,7 @@
115 property alias delegateWidth: iconTileGrid.delegateWidth
116 property alias delegateHeight: iconTileGrid.delegateHeight
117 property alias verticalSpacing: iconTileGrid.verticalSpacing
118+ readonly property alias margins: iconTileGrid.margins
119 property alias delegate: iconTileGrid.delegate
120 property alias cellWidth: iconTileGrid.cellWidth
121 property alias cellHeight: iconTileGrid.cellHeight
122@@ -62,6 +63,8 @@
123 readonly property alias flicking: iconTileGrid.flicking
124 readonly property alias moving: iconTileGrid.moving
125 readonly property alias pressDelay: iconTileGrid.pressDelay
126+ property alias highlightIndex: iconTileGrid.highlightIndex
127+ readonly property alias currentItem: iconTileGrid.currentItem
128
129 height: !filterAnimation.running ? childrenRect.height : height
130 clip: filterAnimation.running
131
132=== modified file 'Components/LazyImage.qml'
133--- Components/LazyImage.qml 2013-10-14 11:47:16 +0000
134+++ Components/LazyImage.qml 2013-10-31 15:22:38 +0000
135@@ -100,10 +100,10 @@
136 verticalAlignment: Image.AlignVCenter
137 sourceSize.width: root.scaleTo == "width" ? root.width
138 : root.scaleTo == "fit" && root.width < root.height ? root.width
139- : undefined
140+ : 0
141 sourceSize.height: root.scaleTo == "height" ? root.height
142 : root.scale == "fit" && root.height < root.width ? root.height
143- : undefined
144+ : 0
145 }
146 }
147
148
149=== modified file 'Components/PageHeader.qml'
150--- Components/PageHeader.qml 2013-10-07 08:36:52 +0000
151+++ Components/PageHeader.qml 2013-10-31 15:22:38 +0000
152@@ -48,6 +48,10 @@
153 searchField.focus = false;
154 }
155
156+ function unfocus() {
157+ searchField.focus = false;
158+ }
159+
160 Connections {
161 target: greeter
162 onShownChanged: if (shown) resetSearch()
163
164=== modified file 'Components/ResponsiveGridView.qml'
165--- Components/ResponsiveGridView.qml 2013-10-09 07:58:13 +0000
166+++ Components/ResponsiveGridView.qml 2013-10-31 15:22:38 +0000
167@@ -26,6 +26,7 @@
168 property int maximumNumberOfColumns: 6
169 readonly property int columns: gridView.columns
170 property alias verticalSpacing: gridView.verticalSpacing
171+ readonly property alias margins: gridView.margin
172 property int delegateWidth
173 property int delegateHeight
174 property alias model: gridView.model
175@@ -41,6 +42,8 @@
176 readonly property alias pressDelay: gridView.pressDelay
177 property alias delegateCreationBegin: gridView.delegateCreationBegin
178 property alias delegateCreationEnd: gridView.delegateCreationEnd
179+ property alias highlightIndex: gridView.highlightIndex
180+ readonly property alias currentItem: gridView.currentItem
181
182 function contentHeightForRows(rows) {
183 return rows * cellHeight + verticalSpacing
184@@ -77,8 +80,15 @@
185 property real horizontalSpacing: spacingForColumns(columns)
186 property real verticalSpacing: horizontalSpacing
187 property int margin: allocatableHorizontalSpace - columns * horizontalSpacing
188+ property int highlightIndex: -1
189
190 cellWidth: delegateWidth + horizontalSpacing
191 cellHeight: delegateHeight + verticalSpacing
192+
193+ onHighlightIndexChanged: {
194+ if (highlightIndex != -1) {
195+ currentIndex = highlightIndex
196+ }
197+ }
198 }
199 }
200
201=== modified file 'Components/Tile.qml'
202--- Components/Tile.qml 2013-10-09 15:28:21 +0000
203+++ Components/Tile.qml 2013-10-31 15:22:38 +0000
204@@ -26,5 +26,14 @@
205 property int imageHeight
206 property int maximumLineCount: 1
207
208+ readonly property int center: (index % GridView.view.columns * width) + (width / 2)
209+
210+ opacity: GridView.view.highlightIndex === -1 ? 1 :
211+ GridView.view.highlightIndex === index ? 0.6 : 0.2
212+
213+ Behavior on opacity {
214+ UbuntuNumberAnimation {}
215+ }
216+
217 style: TileStyle {}
218 }
219
220=== modified file 'Dash/Apps/AppPreview.qml'
221--- Dash/Apps/AppPreview.qml 2013-10-02 14:56:24 +0000
222+++ Dash/Apps/AppPreview.qml 2013-10-31 15:22:38 +0000
223@@ -44,6 +44,15 @@
224 model: previewData.infoMap["more-screenshots"] != null ? previewData.infoMap["more-screenshots"].value : [previewData.image]
225 cacheBuffer: width * 3
226
227+ // FIXME: Because of ListViews inside ListViews inside Flickables inside ListViews (and some more)
228+ // we finally reached the point where this ListView doesn't correctly get swipe input any more but
229+ // instead the parent ListView is the one that is swiped. This MouseArea sort of creates a blocking
230+ // layer to make sure this ListView can be swiped, regardless of what's behind it.
231+ MouseArea {
232+ anchors.fill: parent
233+ enabled: parent.contentWidth > parent.width
234+ }
235+
236 LazyImage {
237 objectName: "placeholderScreenshot"
238 anchors {
239
240=== modified file 'Dash/Apps/ApplicationsFilterGrid.qml'
241--- Dash/Apps/ApplicationsFilterGrid.qml 2013-09-05 10:02:00 +0000
242+++ Dash/Apps/ApplicationsFilterGrid.qml 2013-10-31 15:22:38 +0000
243@@ -19,7 +19,7 @@
244 import "../../Applications"
245
246 FilterGrid {
247- id: filterGrid
248+ id: filtergrid
249
250 filter: false
251 minimumHorizontalSpacing: units.gu(0.5)
252@@ -28,9 +28,11 @@
253 delegateHeight: units.gu(9.5)
254 verticalSpacing: units.gu(2)
255
256- signal clicked(int index, variant data)
257+ signal clicked(int index, var model, real itemY)
258+ signal pressAndHold(int index, var model, real itemY)
259
260 delegate: Tile {
261+ id: tile
262 objectName: "delegate" + index
263 Application {
264 id: application
265@@ -44,12 +46,19 @@
266
267 property string icon: model.icon ? model.icon : "../../graphics/applicationIcons/" + application.icon + ".png" // FIXME: this is temporary
268
269- width: filterGrid.cellWidth
270- height: filterGrid.cellHeight
271+ width: filtergrid.cellWidth
272+ height: filtergrid.cellHeight
273 text: model.title ? model.title : application.name // FIXME: this is temporary
274 imageWidth: units.gu(8)
275 imageHeight: units.gu(7.5)
276 source: icon
277- onClicked: filterGrid.clicked(index, application.desktopFile);
278+
279+ onClicked: {
280+ filtergrid.clicked(index, filtergrid.model, tile.y)
281+ }
282+
283+ onPressAndHold: {
284+ filtergrid.pressAndHold(index, filtergrid.model, tile.y)
285+ }
286 }
287 }
288
289=== modified file 'Dash/Apps/DashPluginFilterGrid.qml'
290--- Dash/Apps/DashPluginFilterGrid.qml 2013-10-08 13:12:21 +0000
291+++ Dash/Apps/DashPluginFilterGrid.qml 2013-10-31 15:22:38 +0000
292@@ -37,13 +37,11 @@
293 }
294
295 onClicked: {
296- var data = { model: model }
297- filtergrid.clicked(index, data, tile.y)
298+ filtergrid.clicked(index, filtergrid.model, tile.y)
299 }
300
301 onPressAndHold: {
302- var data = { model: model }
303- filtergrid.pressAndHold(index, data, tile.y)
304+ filtergrid.pressAndHold(index, filtergrid.model, tile.y)
305 }
306 }
307 }
308
309=== modified file 'Dash/DashPreview.qml'
310--- Dash/DashPreview.qml 2013-10-16 15:49:27 +0000
311+++ Dash/DashPreview.qml 2013-10-31 15:22:38 +0000
312@@ -17,7 +17,7 @@
313 import QtQuick 2.0
314 import Ubuntu.Components 0.1
315
316-Rectangle {
317+Item {
318 id: root
319
320 property int keyboardSize: Qt.inputMethod.visible ? Qt.inputMethod.keyboardRectangle.height : 0
321@@ -36,7 +36,6 @@
322 readonly property int columnWidth: narrowMode ? contentRow.width : (contentRow.width / 3) - contentRow.spacing
323 readonly property int contentSpacing: units.gu(3)
324
325- color: Qt.rgba(0, 0, 0, .3)
326 clip: true
327
328 function ensureVisible(item) {
329@@ -61,7 +60,6 @@
330 anchors.fill: parent
331 }
332
333-
334 Row {
335 id: contentRow
336 anchors {
337
338=== added file 'Dash/DashPreviewPlaceholder.qml'
339--- Dash/DashPreviewPlaceholder.qml 1970-01-01 00:00:00 +0000
340+++ Dash/DashPreviewPlaceholder.qml 2013-10-31 15:22:38 +0000
341@@ -0,0 +1,25 @@
342+/*
343+ * Copyright (C) 2013 Canonical, Ltd.
344+ *
345+ * This program is free software; you can redistribute it and/or modify
346+ * it under the terms of the GNU General Public License as published by
347+ * the Free Software Foundation; version 3.
348+ *
349+ * This program is distributed in the hope that it will be useful,
350+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
351+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
352+ * GNU General Public License for more details.
353+ *
354+ * You should have received a copy of the GNU General Public License
355+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
356+ */
357+
358+import QtQuick 2.0
359+import Ubuntu.Components 0.1
360+
361+DashPreview {
362+ ActivityIndicator {
363+ anchors.centerIn: parent
364+ running: true
365+ }
366+}
367
368=== modified file 'Dash/Generic/GenericFilterGrid.qml'
369--- Dash/Generic/GenericFilterGrid.qml 2013-10-08 13:12:21 +0000
370+++ Dash/Generic/GenericFilterGrid.qml 2013-10-31 15:22:38 +0000
371@@ -28,8 +28,8 @@
372 property int iconWidth: units.gu(8)
373 property int iconHeight: units.gu(7.5)
374
375- signal clicked(int index, var delegateItem, real itemY)
376- signal pressAndHold(int index, var delegateItem, real itemY)
377+ signal clicked(int index, var model, real itemY)
378+ signal pressAndHold(int index, var model, real itemY)
379
380 delegate: Tile {
381 id: tile
382@@ -42,13 +42,11 @@
383 source: model.icon
384
385 onClicked: {
386- var data = { model: model }
387- filtergrid.clicked(index, data, tile.y)
388+ filtergrid.clicked(index, filtergrid.model, tile.y)
389 }
390
391 onPressAndHold: {
392- var data = { model: model }
393- filtergrid.pressAndHold(index, data, tile.y)
394+ filtergrid.pressAndHold(index, filtergrid.model, tile.y)
395 }
396 }
397 }
398
399=== modified file 'Dash/Generic/WeatherFilterGrid.qml'
400--- Dash/Generic/WeatherFilterGrid.qml 2013-10-08 13:12:21 +0000
401+++ Dash/Generic/WeatherFilterGrid.qml 2013-10-31 15:22:38 +0000
402@@ -37,13 +37,11 @@
403 style: FlatTileStyle {}
404
405 onClicked: {
406- var data = { model: model }
407- filtergrid.clicked(index, data, tile.y)
408+ filtergrid.clicked(index, filtergrid.model, tile.y)
409 }
410
411 onPressAndHold: {
412- var data = { model: model }
413- filtergrid.pressAndHold(index, data, tile.y)
414+ filtergrid.pressAndHold(index, filtergrid.model, tile.y)
415 }
416 }
417 }
418
419=== modified file 'Dash/GenericScopeView.qml'
420--- Dash/GenericScopeView.qml 2013-10-11 13:54:24 +0000
421+++ Dash/GenericScopeView.qml 2013-10-31 15:22:38 +0000
422@@ -21,14 +21,14 @@
423
424 ScopeView {
425 id: scopeView
426- readonly property alias previewShown: previewLoader.onScreen
427+ readonly property alias previewShown: previewListView.onScreen
428 property bool enableHeightBehaviorOnNextCreation: false
429
430 moving: categoryView.moving
431
432 onIsCurrentChanged: {
433 pageHeader.resetSearch();
434- previewLoader.open = false;
435+ previewListView.open = false;
436 }
437
438 onMovementStarted: categoryView.showHeader()
439@@ -57,9 +57,8 @@
440
441 Connections {
442 target: scopeView.scope
443- onShowDash: previewLoader.open = false;
444- onHideDash: previewLoader.open = false;
445- onActivated: previewLoader.closePreviewSpinner();
446+ onShowDash: previewListView.open = false;
447+ onHideDash: previewListView.open = false;
448 }
449
450 ScopeListView {
451@@ -67,12 +66,18 @@
452 objectName: "categoryListView"
453 anchors.fill: parent
454 model: scopeView.categories
455- forceNoClip: previewLoader.onScreen
456+ forceNoClip: previewListView.onScreen
457
458 onAtYEndChanged: if (atYEnd) endReached()
459 onMovingChanged: if (moving && atYEnd) endReached()
460
461 property string expandedCategoryId: ""
462+ signal correctExpandedCategory();
463+
464+ Behavior on contentY {
465+ enabled: previewListView.open
466+ UbuntuNumberAnimation {}
467+ }
468
469 delegate: ListItems.Base {
470 id: baseItem
471@@ -124,33 +129,50 @@
472 Connections {
473 target: rendererLoader.item
474 onClicked: {
475+ // Prepare the preview in case activate() triggers a preview only
476 effect.positionPx = mapToItem(categoryView, 0, itemY).y
477- scopeView.scope.activate(delegateItem.model.uri,
478- delegateItem.model.icon,
479- delegateItem.model.category,
480- 0,
481- delegateItem.model.mimetype,
482- delegateItem.model.title,
483- delegateItem.model.comment,
484- delegateItem.model.dndUri,
485- delegateItem.model.metadata)
486+ previewListView.categoryId = categoryId
487+ previewListView.categoryDelegate = rendererLoader.item
488+ previewListView.model = model;
489+ previewListView.init = true;
490+ previewListView.currentIndex = index;
491+
492+ var item = model.get(index);
493+
494+ if ((scopeView.scope.id == "applications.scope" && categoryId == "installed")
495+ || (scopeView.scope.id == "home.scope" && categoryId == "applications.scope")) {
496+ scopeView.scope.activate(item.uri, item.icon, item.category, 0, item.mimetype, item.title,
497+ item.comment, item.dndUri, item.metadata)
498+ } else {
499+ previewListView.open = true
500+
501+ scopeView.scope.preview( item.uri, item.icon, item.category, 0, item.mimetype, item.title,
502+ item.comment, item.dndUri, item.metadata)
503+ }
504 }
505 onPressAndHold: {
506 effect.positionPx = mapToItem(categoryView, 0, itemY).y
507- scopeView.scope.preview( delegateItem.model.uri,
508- delegateItem.model.icon,
509- delegateItem.model.category,
510- 0,
511- delegateItem.model.mimetype,
512- delegateItem.model.title,
513- delegateItem.model.comment,
514- delegateItem.model.dndUri,
515- delegateItem.model.metadata)
516+ previewListView.categoryId = categoryId
517+ previewListView.categoryDelegate = rendererLoader.item
518+ previewListView.model = model;
519+ previewListView.init = true;
520+ previewListView.currentIndex = index;
521+ previewListView.open = true
522+
523+ var item = model.get(index)
524+ scopeView.scope.preview( item.uri, item.icon, item.category, 0, item.mimetype, item.title,
525+ item.comment, item.dndUri, item.metadata)
526 }
527 }
528 Connections {
529 target: categoryView
530 onExpandedCategoryIdChanged: {
531+ collapseAllButExpandedCategory();
532+ }
533+ onCorrectExpandedCategory: {
534+ collapseAllButExpandedCategory();
535+ }
536+ function collapseAllButExpandedCategory() {
537 var item = rendererLoader.item;
538 if (item.expandable) {
539 var shouldFilter = categoryId != categoryView.expandedCategoryId;
540@@ -158,13 +180,15 @@
541 // If the filter animation will be seen start it, otherwise, just flip the switch
542 var shrinkingVisible = shouldFilter && y + item.collapsedHeight < categoryView.height;
543 var growingVisible = !shouldFilter && y + height < categoryView.height;
544- if (shrinkingVisible || growingVisible) {
545- item.startFilterAnimation(shouldFilter)
546- } else {
547- item.filter = shouldFilter;
548- }
549- if (!shouldFilter) {
550- categoryView.maximizeVisibleArea(index, item.uncollapsedHeight);
551+ if (!previewListView.open || !shouldFilter) {
552+ if (shrinkingVisible || growingVisible) {
553+ item.startFilterAnimation(shouldFilter)
554+ } else {
555+ item.filter = shouldFilter;
556+ }
557+ if (!shouldFilter && !previewListView.open) {
558+ categoryView.maximizeVisibleArea(index, item.uncollapsedHeight);
559+ }
560 }
561 }
562 }
563@@ -270,6 +294,7 @@
564
565 OpenEffect {
566 id: effect
567+ objectName: "openEffect"
568 anchors {
569 fill: parent
570 bottomMargin: -bottomOverflow
571@@ -282,29 +307,44 @@
572 topOpacity: (1 - gap * 1.2)
573 bottomGapPx: positionPx + gap * (targetBottomGapPx - positionPx)
574 bottomOverflow: units.gu(20)
575- bottomOpacity: 1 - (gap * 0.8)
576+ live: !expansionAnimation.running
577
578 property int targetBottomGapPx: height - units.gu(8) - bottomOverflow
579- property real gap: previewLoader.open ? 1.0 : 0.0
580+ property real gap: previewListView.open ? 1.0 : 0.0
581
582 Behavior on gap {
583 NumberAnimation {
584+ id: expansionAnimation
585 duration: 200
586 easing.type: Easing.InOutQuad
587 onRunningChanged: {
588- if (!previewLoader.open && !running) {
589- previewLoader.onScreen = false
590+ if (!previewListView.open && !running) {
591+ previewListView.onScreen = false
592 }
593 }
594 }
595 }
596+ Behavior on positionPx {
597+ enabled: previewListView.open
598+ UbuntuNumberAnimation {}
599+ }
600 }
601
602 Connections {
603 target: scopeView.scope
604 onPreviewReady: {
605- previewLoader.previewData = preview
606- previewLoader.open = true
607+ if (previewListView.init) {
608+ // Preview was triggered because of a click on the item. Need to expand now.
609+ if (!previewListView.open) {
610+ previewListView.open = true
611+ }
612+
613+ var index = previewListView.currentIndex
614+ previewListView.currentIndex = -1
615+ previewListView.currentIndex = index
616+ previewListView.init = false
617+ }
618+ previewListView.currentItem.previewData = preview
619 }
620 }
621
622@@ -312,18 +352,9 @@
623 id: previewDelegateMapper
624 }
625
626- Connections {
627- ignoreUnknownSignals: true
628- target: previewLoader.valid ? previewLoader.item : null
629- onClose: {
630- previewLoader.open = false
631- }
632- }
633-
634- Loader {
635- objectName: "previewLoader"
636- id: previewLoader
637- property var previewData
638+ ListView {
639+ id: previewListView
640+ objectName: "previewListView"
641 height: effect.bottomGapPx - effect.topGapPx
642 anchors {
643 top: parent.top
644@@ -331,38 +362,168 @@
645 left: parent.left
646 right: parent.right
647 }
648- source: onScreen ? previewDelegateMapper.map(previewLoader.previewData.rendererName) : ""
649+ orientation: ListView.Horizontal
650+ highlightRangeMode: ListView.StrictlyEnforceRange
651+ snapMode: ListView.SnapOneItem
652+ boundsBehavior: Flickable.DragAndOvershootBounds
653+ highlightMoveDuration: 250
654+ flickDeceleration: units.gu(625)
655+ maximumFlickVelocity: width * 5
656+ cacheBuffer: 0
657+
658+ // To be set before opening the preview
659+ property string categoryId: ""
660+ property var categoryDelegate
661+
662+ // because the ListView is built asynchronous, setting the
663+ // currentIndex directly won't work. We need to refresh it
664+ // when the first preview is ready to be displayed.
665+ property bool init: true
666+
667+ onCurrentIndexChanged: {
668+ var row = Math.floor(currentIndex / categoryDelegate.columns);
669+ if (categoryDelegate.collapsedRowCount <= row) {
670+ categoryView.expandedCategoryId = categoryId
671+ }
672+
673+ if (open) {
674+ categoryDelegate.highlightIndex = currentIndex
675+ }
676+
677+ if (!init && model !== undefined) {
678+ var item = model.get(currentIndex)
679+ scopeView.scope.preview( item.uri, item.icon, item.category, 0, item.mimetype, item.title, item.comment, item.dndUri, item.metadata)
680+ }
681+
682+ var itemY = categoryView.contentItem.mapFromItem(categoryDelegate.currentItem).y;
683+ var newContentY = itemY - effect.positionPx - categoryDelegate.verticalSpacing;
684+ var effectAdjust = effect.positionPx;
685+ if (newContentY < 0) {
686+ effectAdjust += newContentY;
687+ newContentY = 0;
688+ }
689+ if (newContentY > Math.max(0, categoryView.contentHeight - categoryView.height)) {
690+ effectAdjust += -(categoryView.contentHeight - categoryView.height) + newContentY
691+ newContentY = categoryView.contentHeight - categoryView.height;
692+ }
693+
694+ effect.positionPx = effectAdjust;
695+ categoryView.contentY = newContentY - categoryView.originY;
696+ }
697
698 property bool open: false
699 property bool onScreen: false
700- property bool valid: item !== null
701
702 onOpenChanged: {
703 if (open) {
704- onScreen = true
705- }
706- }
707-
708- onLoaded: {
709- item.previewData = Qt.binding(function() { return previewLoader.previewData })
710- }
711-
712- function closePreviewSpinner() {
713- if(item) {
714- item.showProcessingAction = false;
715- }
716- }
717+ onScreen = true;
718+ categoryDelegate.highlightIndex = currentIndex;
719+ pageHeader.unfocus();
720+ } else {
721+ // Cancel any pending preview requests or actions
722+ if (previewListView.currentItem.previewData !== undefined) {
723+ previewListView.currentItem.previewData.cancelAction();
724+ }
725+ scopeView.scope.cancelActivation();
726+ model = undefined;
727+ categoryView.correctExpandedCategory();
728+ categoryDelegate.highlightIndex = -1;
729+ }
730+ }
731+
732+ Rectangle {
733+ anchors.fill: parent
734+ color: Qt.rgba(0, 0, 0, .3)
735+ z: -1
736+ }
737+
738+ delegate: Loader {
739+ id: previewLoader
740+ objectName: "previewLoader" + index
741+ height: previewListView.height
742+ width: previewListView.width
743+ asynchronous: true
744+ source: previewListView.onScreen ?
745+ (previewData !== undefined ? previewDelegateMapper.map(previewData.rendererName) : "DashPreviewPlaceholder.qml") : ""
746+
747+ onPreviewDataChanged: {
748+ if (previewData !== undefined && source.toString().indexOf("DashPreviewPlaceholder.qml") != -1) {
749+ previewLoader.opacity = 0;
750+ }
751+ }
752+
753+ onSourceChanged: {
754+ if (previewData !== undefined) {
755+ fadeIn.start()
756+ }
757+ }
758+
759+ PropertyAnimation {
760+ id: fadeIn
761+ target: previewLoader
762+ property: "opacity"
763+ from: 0.0
764+ to: 1.0
765+ duration: UbuntuAnimation.BriskDuration
766+ }
767+
768+ property var previewData
769+ property bool valid: item !== null
770+
771+ onLoaded: {
772+ if (previewListView.onScreen && previewData !== undefined) {
773+ item.previewData = Qt.binding(function() { return previewData })
774+ }
775+ }
776+
777+ Connections {
778+ ignoreUnknownSignals: true
779+ target: item
780+ onClose: {
781+ previewListView.open = false
782+ }
783+ }
784+
785+ function closePreviewSpinner() {
786+ if(item) {
787+ item.showProcessingAction = false;
788+ }
789+ }
790+ }
791+ }
792+
793+ Image {
794+ objectName: "pointerArrow"
795+ anchors {
796+ top: previewListView.bottom
797+ left: parent.left
798+ leftMargin: previewListView.categoryDelegate !== undefined && previewListView.categoryDelegate.currentItem ?
799+ previewListView.categoryDelegate.currentItem.center + (-width + margins) / 2 : 0
800+
801+ Behavior on leftMargin {
802+ SmoothedAnimation {
803+ duration: UbuntuAnimation.FastDuration
804+ }
805+ }
806+ }
807+ height: units.gu(1)
808+ width: units.gu(2)
809+ property int margins: previewListView.categoryDelegate ? previewListView.categoryDelegate.margins : 0
810+ opacity: previewListView.open ? .5 : 0
811+
812+ source: "graphics/tooltip_arrow.png"
813 }
814
815 // TODO: Move as InverseMouseArea to DashPreview
816 MouseArea {
817- enabled: previewLoader.onScreen
818+ objectName: "closePreviewMouseArea"
819+ enabled: previewListView.onScreen
820 anchors {
821 fill: parent
822 topMargin: effect.bottomGapPx
823 }
824 onClicked: {
825- previewLoader.open = false;
826+ previewListView.open = false;
827 }
828 }
829 }
830
831=== removed file 'Dash/Music/AlbumTile.qml'
832--- Dash/Music/AlbumTile.qml 2013-07-12 16:07:42 +0000
833+++ Dash/Music/AlbumTile.qml 1970-01-01 00:00:00 +0000
834@@ -1,116 +0,0 @@
835-/*
836- * Copyright (C) 2013 Canonical, Ltd.
837- *
838- * This program is free software; you can redistribute it and/or modify
839- * it under the terms of the GNU General Public License as published by
840- * the Free Software Foundation; version 3.
841- *
842- * This program is distributed in the hope that it will be useful,
843- * but WITHOUT ANY WARRANTY; without even the implied warranty of
844- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
845- * GNU General Public License for more details.
846- *
847- * You should have received a copy of the GNU General Public License
848- * along with this program. If not, see <http://www.gnu.org/licenses/>.
849- */
850-
851-import QtQuick 2.0
852-import Ubuntu.Components 0.1
853-
854-AbstractButton {
855- id: root
856- property url source
857- property alias album: albumLabel.text
858- property alias artist: artistLabel.text
859- property alias iconWidth: icon.width
860- property alias iconHeight: icon.height
861-
862- UbuntuShape {
863- id: icon
864- anchors {
865- top: parent.top
866- horizontalCenter: parent.horizontalCenter
867- }
868- radius: "medium"
869- image: Image {
870- source: root.source
871- sourceSize { width: icon.width; height: icon.height }
872- asynchronous: true
873- cache: false
874- }
875- }
876-
877- UbuntuShape {
878- id: borderPressed
879-
880- anchors.fill: icon
881- radius: "medium"
882- borderSource: "radius_pressed.sci"
883- opacity: root.pressed ? 1.0 : 0.0
884- Behavior on opacity { NumberAnimation { duration: 200; easing.type: Easing.OutQuint } }
885- }
886-
887- Item {
888- id: artistContainer
889- anchors {
890- left: parent.left
891- right: parent.right
892- top: icon.bottom
893- }
894- height: units.gu(2)
895-
896- Label {
897- id: artistLabel
898- anchors {
899- baseline: parent.bottom
900- left: parent.left
901- right: parent.right
902- leftMargin: units.gu(1)
903- rightMargin: units.gu(1)
904- }
905-
906- color: Theme.palette.selected.backgroundText
907- opacity: 0.9
908- style: Text.Raised
909- styleColor: "black"
910- fontSize: "small"
911- elide: Text.ElideMiddle
912- horizontalAlignment: Text.AlignHCenter
913- }
914- }
915-
916- Item {
917- anchors {
918- left: parent.left
919- right: parent.right
920- top: artistContainer.bottom
921- }
922- height: units.gu(1.5)
923-
924- Label {
925- id: albumLabel
926- anchors {
927- baseline: parent.bottom
928- left: parent.left
929- right: parent.right
930- leftMargin: units.gu(1)
931- rightMargin: units.gu(1)
932- }
933-
934- color: Theme.palette.selected.backgroundText
935- opacity: 0.9
936- style: Text.Raised
937- styleColor: "black"
938- fontSize: "small"
939- font.weight: Font.Light
940- elide: Text.ElideMiddle
941- horizontalAlignment: Text.AlignHCenter
942- }
943- }
944-
945- GridView.onRemove: SequentialAnimation {
946- PropertyAction { target: root; property: "GridView.delayRemove"; value: true }
947- NumberAnimation { target: root; property: "opacity"; from: 1; to: 0; duration: 200; easing.type: Easing.InOutQuad }
948- PropertyAction { target: root; property: "GridView.delayRemove"; value: false }
949- }
950-}
951
952=== modified file 'Dash/Music/MusicFilterGrid.qml'
953--- Dash/Music/MusicFilterGrid.qml 2013-10-09 15:28:21 +0000
954+++ Dash/Music/MusicFilterGrid.qml 2013-10-31 15:22:38 +0000
955@@ -44,13 +44,11 @@
956 }
957
958 onClicked: {
959- var data = { model: model }
960- filtergrid.clicked(index, data, tile.y)
961+ filtergrid.clicked(index, filtergrid.model, tile.y)
962 }
963
964 onPressAndHold: {
965- var data = { model: model }
966- filtergrid.pressAndHold(index, data, tile.y)
967+ filtergrid.pressAndHold(index, filtergrid.model, tile.y)
968 }
969 }
970 }
971
972=== modified file 'Dash/SearchableResultModel.qml'
973--- Dash/SearchableResultModel.qml 2013-08-14 12:19:25 +0000
974+++ Dash/SearchableResultModel.qml 2013-10-31 15:22:38 +0000
975@@ -25,6 +25,10 @@
976
977 filterRole: CategoryResults.RoleTitle
978
979+ function get(index) {
980+ return model.get(mapToSource(index))
981+ }
982+
983 onSearchQueryChanged: {
984 if (searchQuery.length == 0) {
985 filterRegExp = RegExp("");
986
987=== modified file 'Dash/Video/VideoFilterGrid.qml'
988--- Dash/Video/VideoFilterGrid.qml 2013-10-09 17:22:03 +0000
989+++ Dash/Video/VideoFilterGrid.qml 2013-10-31 15:22:38 +0000
990@@ -42,13 +42,11 @@
991 style: VideoTileStyle {}
992
993 onClicked: {
994- var data = { model: model }
995- filtergrid.clicked(index, data, tile.y)
996+ filtergrid.clicked(index, filtergrid.model, tile.y)
997 }
998
999 onPressAndHold: {
1000- var data = { model: model }
1001- filtergrid.pressAndHold(index, data, tile.y)
1002+ filtergrid.pressAndHold(index, filtergrid.model, tile.y)
1003 }
1004 }
1005 }
1006
1007=== added file 'Dash/graphics/tooltip_arrow@27.png'
1008Binary files Dash/graphics/tooltip_arrow@27.png 1970-01-01 00:00:00 +0000 and Dash/graphics/tooltip_arrow@27.png 2013-10-31 15:22:38 +0000 differ
1009=== modified file 'tests/mocks/Unity/fake_preview.cpp'
1010--- tests/mocks/Unity/fake_preview.cpp 2013-10-01 15:46:09 +0000
1011+++ tests/mocks/Unity/fake_preview.cpp 2013-10-31 15:22:38 +0000
1012@@ -16,9 +16,13 @@
1013
1014 #include "fake_preview.h"
1015
1016+Preview::Preview(QObject *parent): QObject(parent)
1017+{
1018+}
1019+
1020 QString Preview::rendererName() const
1021 {
1022- return "foo";
1023+ return "generic-preview";
1024 }
1025
1026 QString Preview::title() const
1027@@ -61,3 +65,7 @@
1028 Q_UNUSED(actionId);
1029 Q_UNUSED(hints);
1030 }
1031+
1032+void Preview::cancelAction()
1033+{
1034+}
1035
1036=== modified file 'tests/mocks/Unity/fake_preview.h'
1037--- tests/mocks/Unity/fake_preview.h 2013-10-01 15:46:09 +0000
1038+++ tests/mocks/Unity/fake_preview.h 2013-10-31 15:22:38 +0000
1039@@ -51,6 +51,8 @@
1040
1041 Q_INVOKABLE void execute(const QString& actionId, const QHash<QString, QVariant>& hints);
1042
1043+ Q_INVOKABLE void cancelAction();
1044+
1045 Q_SIGNALS:
1046 void previewChanged();
1047 };
1048
1049=== modified file 'tests/mocks/Unity/fake_scope.cpp'
1050--- tests/mocks/Unity/fake_scope.cpp 2013-10-07 10:09:21 +0000
1051+++ tests/mocks/Unity/fake_scope.cpp 2013-10-31 15:22:38 +0000
1052@@ -14,13 +14,11 @@
1053 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1054 */
1055
1056-// Self
1057 #include "fake_scope.h"
1058+#include "fake_preview.h"
1059+#include "paths.h"
1060
1061 #include <dee.h>
1062-#include "paths.h"
1063-
1064-#include "fake_preview.h"
1065
1066 static DeeModel* create_categories_model(unsigned category_count);
1067 static DeeModel* create_results_model(unsigned category_count, unsigned result_count);
1068@@ -39,6 +37,13 @@
1069 m_categories->setResultModel(results_model);
1070 m_categories->setModel(create_categories_model(4));
1071 m_results->setModel(results_model);
1072+
1073+ m_timer.setInterval(1000);
1074+ m_timer.setSingleShot(true);
1075+ connect(&m_timer, &QTimer::timeout, [this]() {
1076+ Preview *p = new Preview(this);
1077+ Q_EMIT previewReady(p);
1078+ });
1079 }
1080
1081 Scope::Scope(QString const& id, QString const& name, bool visible, QObject* parent)
1082@@ -55,6 +60,13 @@
1083 m_categories->setResultModel(results_model);
1084 m_categories->setModel(create_categories_model(4));
1085 m_results->setModel(results_model);
1086+
1087+ m_timer.setInterval(1000);
1088+ m_timer.setSingleShot(true);
1089+ connect(&m_timer, &QTimer::timeout, [this]() {
1090+ Preview *p = new Preview(this);
1091+ Q_EMIT previewReady(p);
1092+ });
1093 }
1094
1095 QString Scope::id() const {
1096@@ -168,6 +180,8 @@
1097 Q_UNUSED(comment);
1098 Q_UNUSED(dnd_uri);
1099 Q_UNUSED(metadata);
1100+
1101+ m_timer.start();
1102 }
1103
1104 void Scope::preview(const QVariant &uri, const QVariant &icon_hint, const QVariant &category,
1105@@ -183,6 +197,8 @@
1106 Q_UNUSED(comment);
1107 Q_UNUSED(dnd_uri);
1108 Q_UNUSED(metadata);
1109+
1110+ m_timer.start();
1111 }
1112
1113 static const gchar * categories_model_schema[] = {
1114@@ -248,3 +264,8 @@
1115 }
1116 return results_model;
1117 }
1118+
1119+void Scope::cancelActivation()
1120+{
1121+ m_timer.stop();
1122+}
1123
1124=== modified file 'tests/mocks/Unity/fake_scope.h'
1125--- tests/mocks/Unity/fake_scope.h 2013-10-07 10:09:21 +0000
1126+++ tests/mocks/Unity/fake_scope.h 2013-10-31 15:22:38 +0000
1127@@ -17,9 +17,10 @@
1128 #ifndef FAKE_SCOPE_H
1129 #define FAKE_SCOPE_H
1130
1131-// Qt
1132+#include "fake_categories.h"
1133+
1134 #include <QObject>
1135-#include "fake_categories.h"
1136+#include <QDebug>
1137
1138 class Preview;
1139
1140@@ -78,6 +79,8 @@
1141 const QVariant &result_type, const QVariant &mimetype, const QVariant &title,
1142 const QVariant &comment, const QVariant &dnd_uri, const QVariant &metadata);
1143
1144+ Q_INVOKABLE void cancelActivation();
1145+
1146 Q_SIGNALS:
1147 void idChanged(const QString&);
1148 void nameChanged(const QString&);
1149@@ -115,6 +118,8 @@
1150
1151 Categories* m_categories;
1152 DeeListModel* m_results;
1153+
1154+ QTimer m_timer;
1155 };
1156
1157 #endif // FAKE_SCOPE_H
1158
1159=== modified file 'tests/mocks/Unity/fake_unity_plugin.cpp'
1160--- tests/mocks/Unity/fake_unity_plugin.cpp 2013-08-23 11:56:44 +0000
1161+++ tests/mocks/Unity/fake_unity_plugin.cpp 2013-10-31 15:22:38 +0000
1162@@ -22,6 +22,7 @@
1163 // local
1164 #include "fake_scopes.h"
1165 #include "fake_categories.h"
1166+#include "fake_preview.h"
1167 #include "categoryresults.h"
1168
1169 // External
1170@@ -37,8 +38,10 @@
1171
1172 Q_ASSERT(uri == QLatin1String("Unity"));
1173
1174+ qmlRegisterUncreatableType<Preview>(uri, 0, 1, "Preview", "Can't create Preview object in QML.");
1175 qmlRegisterType<Scopes>(uri, 0, 1, "Scopes");
1176 qmlRegisterType<Scope>(uri, 0, 1, "Scope");
1177 qmlRegisterType<Categories>(uri, 0, 1, "Categories");
1178 qmlRegisterUncreatableType<CategoryResults>(uri, 0, 1, "CategoryResults", "Can't create");
1179+ qmlRegisterType<DeeListModel>(uri, 0, 1, "DeeListModel");
1180 }
1181
1182=== modified file 'tests/qmltests/Dash/tst_GenericScopeView.qml'
1183--- tests/qmltests/Dash/tst_GenericScopeView.qml 2013-10-16 15:49:27 +0000
1184+++ tests/qmltests/Dash/tst_GenericScopeView.qml 2013-10-31 15:22:38 +0000
1185@@ -23,11 +23,21 @@
1186 import Unity.Test 0.1 as UT
1187
1188 Item {
1189+ id: shell
1190 width: units.gu(120)
1191 height: units.gu(80)
1192
1193 Scopes {
1194 id: scopes
1195+
1196+ onLoadedChanged: {
1197+ genericScopeView.scope = scopes.get(0)
1198+ }
1199+ }
1200+
1201+ property Item applicationManager: Item {
1202+ signal sideStageFocusedApplicationChanged()
1203+ signal mainStageFocusedApplicationChanged()
1204 }
1205
1206 GenericScopeView {
1207@@ -38,44 +48,144 @@
1208 name: "GenericScopeView"
1209 when: scopes.loaded
1210
1211- function init() {
1212- genericScopeView.scope = scopes.get(0)
1213- }
1214-
1215 function test_isCurrent() {
1216 var pageHeader = findChild(genericScopeView, "pageHeader");
1217- var previewLoader = findChild(genericScopeView, "previewLoader");
1218+ var previewListView = findChild(genericScopeView, "previewListView");
1219 genericScopeView.isCurrent = true
1220 pageHeader.searchQuery = "test"
1221- previewLoader.open = true
1222+ previewListView.open = true
1223 genericScopeView.isCurrent = false
1224 tryCompare(pageHeader, "searchQuery", "")
1225 tryCompare(genericScopeView, "previewShown", false);
1226 }
1227
1228 function test_showDash() {
1229- var previewLoader = findChild(genericScopeView, "previewLoader");
1230- previewLoader.open = true;
1231+ var previewListView = findChild(genericScopeView, "previewListView");
1232+ previewListView.open = true;
1233 scopes.get(0).showDash();
1234 tryCompare(genericScopeView, "previewShown", false);
1235 }
1236
1237 function test_hideDash() {
1238- var previewLoader = findChild(genericScopeView, "previewLoader");
1239- previewLoader.open = true;
1240+ var previewListView = findChild(genericScopeView, "previewListView");
1241+ previewListView.open = true;
1242 scopes.get(0).hideDash();
1243 tryCompare(genericScopeView, "previewShown", false);
1244 }
1245
1246+ function openPreview() {
1247+ var tile = findChild(genericScopeView, "delegate0");
1248+ mouseClick(tile, tile.width / 2, tile.height / 2);
1249+ var openEffect = findChild(genericScopeView, "openEffect");
1250+ tryCompare(openEffect, "gap", 1);
1251+ }
1252+
1253+ function checkArrowPosition(index) {
1254+ var tile = findChild(genericScopeView, "delegate" + index);
1255+ var tileCenter = tile.x + tile.width/2;
1256+ var pointerArrow = findChild(genericScopeView, "pointerArrow");
1257+ var pointerArrowCenter = pointerArrow.x + pointerArrow.width/2;
1258+ compare(pointerArrowCenter, tileCenter, "Pointer did not move to tile");
1259+ }
1260+
1261+ function closePreview() {
1262+ var closePreviewMouseArea = findChild(genericScopeView, "closePreviewMouseArea");
1263+ mouseClick(closePreviewMouseArea, closePreviewMouseArea.width / 2, closePreviewMouseArea.height / 2);
1264+
1265+ var previewListView = findChild(genericScopeView, "previewListView");
1266+ tryCompare(previewListView, "open", false);
1267+ var openEffect = findChild(genericScopeView, "openEffect");
1268+ tryCompare(openEffect, "gap", 0);
1269+
1270+ var categoryListView = findChild(genericScopeView, "categoryListView");
1271+ categoryListView.flick(0, units.gu(200));
1272+ tryCompare(categoryListView, "flicking", false);
1273+ }
1274+
1275+ function test_previewOpenClose() {
1276+ var previewListView = findChild(genericScopeView, "previewListView");
1277+ tryCompare(previewListView, "open", false);
1278+
1279+ openPreview();
1280+
1281+ // check for it opening successfully
1282+ var currentPreviewItem = findChild(genericScopeView, "previewLoader0");
1283+ tryCompareFunction(function() {
1284+ var parts = currentPreviewItem.source.toString().split("/");
1285+ var name = parts[parts.length - 1];
1286+ return name == "DashPreviewPlaceholder.qml";
1287+ },
1288+ true);
1289+ tryCompareFunction(function() {
1290+ var parts = currentPreviewItem.source.toString().split("/");
1291+ var name = parts[parts.length - 1];
1292+ return name == "GenericPreview.qml";
1293+ },
1294+ true);
1295+ tryCompare(currentPreviewItem, "progress", 1);
1296+ tryCompare(previewListView, "open", true);
1297+
1298+ closePreview();
1299+ tryCompare(previewListView, "open", false);
1300+ }
1301+
1302+ function test_previewCycleOne() {
1303+ var previewListView = findChild(genericScopeView, "previewListView");
1304+ tryCompare(previewListView, "open", false);
1305+
1306+ openPreview();
1307+
1308+ // wait for it to be loaded
1309+ var currentPreviewItem = findChild(genericScopeView, "previewLoader0");
1310+ tryCompareFunction(function() {
1311+ var parts = currentPreviewItem.source.toString().split("/");
1312+ var name = parts[parts.length - 1];
1313+ return name == "GenericPreview.qml";
1314+ },
1315+ true);
1316+ tryCompare(currentPreviewItem, "progress", 1);
1317+ waitForRendering(currentPreviewItem);
1318+
1319+ checkArrowPosition(0);
1320+
1321+ // flick to the next previews
1322+
1323+ for (var i = 1; i < previewListView.count; ++i) {
1324+
1325+ mouseFlick(previewListView, previewListView.width - units.gu(1),
1326+ previewListView.height / 2,
1327+ units.gu(2),
1328+ previewListView.height / 2);
1329+
1330+ // wait for it to be loaded
1331+ var nextPreviewItem = findChild(genericScopeView, "previewLoader" + i);
1332+ tryCompareFunction(function() {
1333+ var parts = nextPreviewItem.source.toString().split("/");
1334+ var name = parts[parts.length - 1];
1335+ return name == "GenericPreview.qml";
1336+ },
1337+ true);
1338+ tryCompare(nextPreviewItem, "progress", 1);
1339+ waitForRendering(nextPreviewItem);
1340+
1341+ checkArrowPosition(i);
1342+ }
1343+
1344+ closePreview();
1345+ }
1346+
1347 function test_show_spinner() {
1348- var previewLoader = findChild(genericScopeView, "previewLoader");
1349- previewLoader.open = true;
1350- previewLoader.source = "../../../Dash/Generic/GenericPreview.qml";
1351+ openPreview();
1352+ var previewListView = findChild(genericScopeView, "previewListView");
1353+ var previewLoader = findChild(genericScopeView, "previewLoader0");
1354+
1355 previewLoader.item.showProcessingAction = true;
1356 var waitingForAction = findChild(genericScopeView, "waitingForActionMouseArea");
1357 tryCompare(waitingForAction, "enabled", true);
1358 previewLoader.closePreviewSpinner();
1359 tryCompare(waitingForAction, "enabled", false);
1360+
1361+ closePreview();
1362 }
1363 }
1364 }

Subscribers

People subscribed via source and target branches