Merge lp:~unity-team/unity8/new-scopes-cleanup into lp:unity8

Proposed by Michał Sawicz
Status: Merged
Merge reported by: Michał Sawicz
Merged at revision: not available
Proposed branch: lp:~unity-team/unity8/new-scopes-cleanup
Merge into: lp:unity8
Prerequisite: lp:~unity-team/unity8/new-scopes-clean-to-trunk
Diff against target: 7715 lines (+1067/-5236)
91 files modified
data/unity8.conf (+4/-0)
plugins/DashViews/listviewwithpageheader.cpp (+7/-7)
qml/Components/OpenEffect.qml (+0/-138)
qml/Components/PageHeader.qml (+1/-0)
qml/Components/RatingStars.qml (+0/-41)
qml/Components/Tile.qml (+0/-39)
qml/Components/TileStyle.qml (+0/-81)
qml/Dash/Apps/AppPreview.qml (+0/-167)
qml/Dash/Apps/DashPluginFilterGrid.qml (+0/-47)
qml/Dash/Apps/FrequentlyUsedAppsModel.qml (+0/-110)
qml/Dash/Card.qml (+1/-0)
qml/Dash/CardCarousel.qml (+1/-2)
qml/Dash/CardFilterGrid.qml (+52/-25)
qml/Dash/CardTool.qml (+1/-1)
qml/Dash/DashCarousel.qml (+0/-47)
qml/Dash/DashContent.qml (+26/-23)
qml/Dash/DashFilterGrid.qml (+0/-65)
qml/Dash/DashHome.qml (+0/-39)
qml/Dash/DashPreview.qml (+0/-208)
qml/Dash/DashPreviewPlaceholder.qml (+0/-25)
qml/Dash/DashRenderer.qml (+1/-4)
qml/Dash/Generic/FlatTileStyle.qml (+0/-79)
qml/Dash/Generic/GenericCarousel.qml (+0/-53)
qml/Dash/Generic/GenericFilterGrid.qml (+0/-46)
qml/Dash/Generic/GenericFilterGridPotrait.qml (+0/-28)
qml/Dash/Generic/GenericPreview.qml (+0/-197)
qml/Dash/Generic/WeatherFilterGrid.qml (+0/-47)
qml/Dash/GenericScopeView.qml (+3/-8)
qml/Dash/Movie/MoviePreview.qml (+0/-71)
qml/Dash/Music/CarouselDelegateMusic.qml (+0/-42)
qml/Dash/Music/MusicCarousel.qml (+0/-34)
qml/Dash/Music/MusicFilterGrid.qml (+0/-48)
qml/Dash/Music/MusicPreview.qml (+0/-203)
qml/Dash/Music/MusicTileStyle.qml (+0/-102)
qml/Dash/PreviewDelegateMapper.qml (+0/-38)
qml/Dash/PreviewListView.qml (+4/-2)
qml/Dash/Previews/Header.qml (+0/-109)
qml/Dash/Previews/Reviews.qml (+0/-194)
qml/Dash/ScopeDelegateMapper.qml (+1/-3)
qml/Dash/SearchableResultModel.qml (+0/-44)
qml/Dash/Video/CarouselDelegateVideo.qml (+0/-42)
qml/Dash/Video/VideoCarousel.qml (+0/-34)
qml/Dash/Video/VideoFilterGrid.qml (+0/-47)
qml/Dash/Video/VideoTileStyle.qml (+0/-87)
tests/autopilot/unity8/shell/emulators/dash.py (+23/-52)
tests/autopilot/unity8/shell/emulators/main_window.py (+0/-4)
tests/autopilot/unity8/shell/tests/__init__.py (+1/-1)
tests/autopilot/unity8/shell/tests/test_emulators.py (+26/-52)
tests/autopilot/unity8/shell/tests/test_greeter.py (+0/-38)
tests/mocks/Unity/CMakeLists.txt (+4/-4)
tests/mocks/Unity/categoryresults.cpp (+0/-121)
tests/mocks/Unity/categoryresults.h (+0/-68)
tests/mocks/Unity/fake_applications_scope.cpp (+0/-76)
tests/mocks/Unity/fake_applications_scope.h (+0/-33)
tests/mocks/Unity/fake_categories.cpp (+127/-212)
tests/mocks/Unity/fake_categories.h (+28/-32)
tests/mocks/Unity/fake_preview.cpp (+0/-73)
tests/mocks/Unity/fake_preview.h (+0/-65)
tests/mocks/Unity/fake_previewmodel.cpp (+43/-53)
tests/mocks/Unity/fake_previewmodel.h (+24/-25)
tests/mocks/Unity/fake_previewstack.cpp (+76/-0)
tests/mocks/Unity/fake_previewstack.h (+61/-0)
tests/mocks/Unity/fake_previewwidgetmodel.cpp (+86/-0)
tests/mocks/Unity/fake_previewwidgetmodel.h (+56/-0)
tests/mocks/Unity/fake_resultsmodel.cpp (+117/-0)
tests/mocks/Unity/fake_resultsmodel.h (+80/-0)
tests/mocks/Unity/fake_scope.cpp (+20/-120)
tests/mocks/Unity/fake_scope.h (+17/-18)
tests/mocks/Unity/fake_scopes.cpp (+1/-5)
tests/mocks/Unity/fake_unity_plugin.cpp (+8/-18)
tests/qmltests/CMakeLists.txt (+0/-10)
tests/qmltests/Components/tst_OpenEffect.qml (+0/-71)
tests/qmltests/Components/tst_PageHeaderLabel.qml (+1/-1)
tests/qmltests/Components/tst_RatingStars.qml (+0/-62)
tests/qmltests/Components/tst_Tile.qml (+0/-71)
tests/qmltests/Dash/Apps/tst_AppPreview.qml (+0/-276)
tests/qmltests/Dash/Movie/tst_MoviePreview.qml (+0/-86)
tests/qmltests/Dash/Music/tst_MusicPreview.qml (+0/-174)
tests/qmltests/Dash/Previews/tst_Preview.qml (+3/-17)
tests/qmltests/Dash/qml/FakeScopeView.qml (+1/-1)
tests/qmltests/Dash/qml/fake_scopeView1.qml (+1/-1)
tests/qmltests/Dash/qml/fake_scopeView2.qml (+1/-1)
tests/qmltests/Dash/qml/fake_scopeView3.qml (+1/-1)
tests/qmltests/Dash/tst_CardTool.qml (+1/-1)
tests/qmltests/Dash/tst_Dash.qml (+12/-6)
tests/qmltests/Dash/tst_DashContent.qml (+116/-34)
tests/qmltests/Dash/tst_DashPreview.qml (+0/-202)
tests/qmltests/Dash/tst_FilterGrids.qml (+0/-143)
tests/qmltests/Dash/tst_GenericPreview.qml (+0/-125)
tests/qmltests/Dash/tst_GenericScopeView.qml (+24/-231)
tests/qmltests/tst_Shell.qml (+6/-25)
To merge this branch: bzr merge lp:~unity-team/unity8/new-scopes-cleanup
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Unity Team Pending
Review via email: mp+209642@code.launchpad.net

Commit message

New scopes + removal of unused files + passing tests

Description of the change

* Are there any related MPs required for this MP to build/function as expected?
lp:~unity-team/unity8/new-scopes-clean-to-trunk
lp:~unity-team/unity8/fix-5.2-tests

* Did you perform an exploratory manual test run of your code change and any related functionality?
Yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A

 * If you changed the UI, has there been a design review?
Yes, the changes are wanted by design

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

FAILED: Continuous integration, rev:712
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/~unity-team/unity8/new-scopes-cleanup/+merge/209642/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/unity8-ci/2441/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/3711
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/3302/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/1311/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/962
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/966
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/966/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/962
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/3261
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/3716
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/3716/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3304
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3304/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/5673/console
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/4524

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

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

FAILED: Continuous integration, rev:724
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/~unity-team/unity8/new-scopes-cleanup/+merge/209642/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/unity8-ci/2463/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/3816
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/3401/console
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/1333
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/984
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/988
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/988/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/984
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/3349
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/3834
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/3834/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3403
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3403/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/5766/console
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/4662

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

review: Needs Fixing (continuous-integration)
725. By Michał Sawicz

Temporarily force scope-registry to start.

726. By Albert Astals Cid

Merge

727. By Albert Astals Cid

This should help with the DashContent::test_showPreviewCarousel failure in CI

728. By Albert Astals Cid

Merge

729. By Albert Astals Cid

Access the proper template variable

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

FAILED: Continuous integration, rev:725
http://jenkins.qa.ubuntu.com/job/unity8-ci/2465/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/3825
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/3410/console
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/1335
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/986
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/990
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/990/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/986
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/3356
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/3843
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/3843/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3412
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3412/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/5773/console
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/4673

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

review: Needs Fixing (continuous-integration)
730. By Albert Astals Cid

And need cardTool. here too

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

FAILED: Continuous integration, rev:729
http://jenkins.qa.ubuntu.com/job/unity8-ci/2466/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/3830
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/3415/console
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/1336
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/987
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/991
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/991/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/987
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/3361
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/3848
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/3848/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3417
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3417/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/5778/console
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/4680

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

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

FAILED: Continuous integration, rev:730
http://jenkins.qa.ubuntu.com/job/unity8-ci/2470/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/3837
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/3422/console
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/1340
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/991
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/995
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/995/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/991
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/3368
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/3855
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/3855/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3424
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3424/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/5785/console
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/4687

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

review: Needs Fixing (continuous-integration)
731. By Albert Astals Cid

The button needs to be non totally transparent before we can click on it

732. By Albert Astals Cid

Childrens have moved again

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

PASSED: Continuous integration, rev:732
http://jenkins.qa.ubuntu.com/job/unity8-ci/2471/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/3843
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/3428
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/1341
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/992
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/996
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/996/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/992
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/3372
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/3867
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/3867/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3430
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3430/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/5789
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/4704

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

review: Approve (continuous-integration)
733. By Michał Sawicz

Revert FIXME for starting scope registry.

734. By Albert Astals Cid

Click on the correct tile

There's more than one dashCategory1 so make sure we look for the correct one
otherwise we may be clicking on something that is not on screen

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

FAILED: Continuous integration, rev:733
http://jenkins.qa.ubuntu.com/job/unity8-ci/2481/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/3874
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/3459/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/1351
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/1002
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1006
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1006/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/1002
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/3395
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/3901
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/3901/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3461
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3461/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/5813/console
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/4744

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

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

FAILED: Continuous integration, rev:734
http://jenkins.qa.ubuntu.com/job/unity8-ci/2483/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/3877
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/3462/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/1353
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/1004
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1008
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1008/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/1004
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/3397
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/3904
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/3904/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3464
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3464/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/5815/console
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/4746

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

review: Needs Fixing (continuous-integration)
735. By Michał Sawicz

Merge 5.2 fixes

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

FAILED: Continuous integration, rev:735
http://jenkins.qa.ubuntu.com/job/unity8-ci/2498/
Executed test runs:
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/3924/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/3509/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/1368
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/1019
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1023
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1023/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/1019
    FAILURE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/3425/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/3957
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/3957/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3511
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3511/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/5848/console
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/4788

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

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

Looks good to me. Nice cleanup.

Waiting for all the prerequisites to get merged so the diff shrinks a bit before doing the final review/approval.

736. By Albert Astals Cid

Merge DashFilterGrid.qml to CardFilterGrid.qml

737. By Albert Astals Cid

DashFilterGrid -> CardFilterGrid in the tests

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

FAILED: Continuous integration, rev:737
http://jenkins.qa.ubuntu.com/job/unity8-ci/2505/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/3959
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/3544/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/1375/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/1026
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1030
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1030/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/1026
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/3456
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/3994
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/3994/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3546
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3546/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/5879/console
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/4833

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

review: Needs Fixing (continuous-integration)
738. By Michał Sawicz

Merge new-scopes-clean-to-trunk

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

Merge

740. By Albert Astals Cid

Turn this into a fuzzy compare too

I had another of those 80 != 80 cases that made the header animate when it should not

741. By Albert Astals Cid

And now make it compile ^_^

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

FAILED: Continuous integration, rev:739
http://jenkins.qa.ubuntu.com/job/unity8-ci/2528/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/4003
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/3588/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/1398/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/1049
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1053
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1053/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/1049
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/3494
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4044
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4044/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3590
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3590/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/5919/console
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/4892

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

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

FAILED: Continuous integration, rev:741
http://jenkins.qa.ubuntu.com/job/unity8-ci/2535/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/4013
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/3598/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/1405/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/1056
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1060
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1060/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/1056
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/3504
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4054
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4054/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3600
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3600/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/5929/console
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/4904

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

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'data/unity8.conf'
--- data/unity8.conf 2014-03-18 10:57:24 +0000
+++ data/unity8.conf 2014-03-18 10:57:24 +0000
@@ -1,6 +1,8 @@
1description "Unity Shell v8"1description "Unity Shell v8"
2author "Ricardo Mendoza <ricmm@ubuntu.com>"2author "Ricardo Mendoza <ricmm@ubuntu.com>"
33
4emits scope-ui-starting
5
4start on ((xsession SESSION=ubuntu-touch) or (xsession SESSION=ubuntu-touch-surfaceflinger)) and started dbus6start on ((xsession SESSION=ubuntu-touch) or (xsession SESSION=ubuntu-touch-surfaceflinger)) and started dbus
5stop on desktop-end7stop on desktop-end
68
@@ -38,6 +40,8 @@
38 if [ -S "$MIR_SERVER_FILE" ]; then40 if [ -S "$MIR_SERVER_FILE" ]; then
39 rm "$MIR_SERVER_FILE"41 rm "$MIR_SERVER_FILE"
40 fi42 fi
43
44 initctl emit scope-ui-starting
41end script45end script
4246
43exec ${BINARY:-unity8} $ARGS47exec ${BINARY:-unity8} $ARGS
4448
=== modified file 'plugins/DashViews/listviewwithpageheader.cpp'
--- plugins/DashViews/listviewwithpageheader.cpp 2014-03-18 10:57:24 +0000
+++ plugins/DashViews/listviewwithpageheader.cpp 2014-03-18 10:57:24 +0000
@@ -376,13 +376,18 @@
376 }376 }
377}377}
378378
379static inline bool uFuzzyCompare(qreal r1, qreal r2)
380{
381 return qFuzzyCompare(r1, r2) || (qFuzzyIsNull(r1) && qFuzzyIsNull(r2));
382}
383
379void ListViewWithPageHeader::showHeader()384void ListViewWithPageHeader::showHeader()
380{385{
381 if (!m_headerItem)386 if (!m_headerItem)
382 return;387 return;
383388
384 auto to = qMax(-minYExtent(), contentY() - m_headerItem->height() + m_headerItemShownHeight);389 const auto to = qMax(-minYExtent(), contentY() - m_headerItem->height() + m_headerItemShownHeight);
385 if (to != contentY()) {390 if (!uFuzzyCompare(to, contentY())) {
386 const bool headerShownByItsOwn = contentY() < m_headerItem->y() + m_headerItem->height();391 const bool headerShownByItsOwn = contentY() < m_headerItem->y() + m_headerItem->height();
387 if (headerShownByItsOwn && m_headerItemShownHeight == 0) {392 if (headerShownByItsOwn && m_headerItemShownHeight == 0) {
388 // We are not clipping since we are just at the top of the viewport393 // We are not clipping since we are just at the top of the viewport
@@ -485,11 +490,6 @@
485 polish();490 polish();
486}491}
487492
488static inline bool uFuzzyCompare(qreal r1, qreal r2)
489{
490 return qFuzzyCompare(r1, r2) || (qFuzzyIsNull(r1) && qFuzzyIsNull(r2));
491}
492
493void ListViewWithPageHeader::viewportMoved(Qt::Orientations orient)493void ListViewWithPageHeader::viewportMoved(Qt::Orientations orient)
494{494{
495 // Check we are not being taken down and don't paint anything495 // Check we are not being taken down and don't paint anything
496496
=== removed file 'qml/Components/OpenEffect.qml'
--- qml/Components/OpenEffect.qml 2013-07-09 15:24:41 +0000
+++ qml/Components/OpenEffect.qml 1970-01-01 00:00:00 +0000
@@ -1,138 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18
19Item {
20 id: effect
21 property bool enabled: topGapPx != positionPx || bottomGapPx != positionPx
22 property alias live: effectSource.live
23 property Item sourceItem
24 property ShaderEffectSource source: ShaderEffectSource {
25 id: effectSource
26 sourceItem: effect.enabled ? effect.sourceItem : null
27 hideSource: effect.enabled
28 live: false
29 sourceRect: {
30 if (effect.enabled) {
31 Qt.rect(0, -effect.topOverflow, sourceItem.width, sourceItem.height + effect.topOverflow + effect.bottomOverflow)
32 } else {
33 Qt.rect(0, 0, 0, 0)
34 }
35 }
36 }
37
38 onEnabledChanged: if (!live && enabled) scheduleUpdate()
39
40 /*!
41 \qmlproperty real positionPx
42 The y coordinate of where to perform the split.
43
44 \qmlproperty real topGapPx
45 Gap's top edge.
46
47 \qmlproperty real bottomGapPx
48 Gap's bottom edge.
49
50 \qmlproperty real topOverflow
51 How much of the sourceItem should be sourced above its bounds.
52
53 \qmlproperty real bottomOverflow
54 How much of the sourceItem should be sourced below its bounds.
55 */
56
57 property real positionPx: 0
58 property real topGapPx: 0
59 property real bottomGapPx: height
60 property real topOverflow: 0.0
61 property real bottomOverflow: 0.0
62 property real topOpacity: 1.0
63 property real bottomOpacity: 1.0
64
65 property real __roundedPositionPx: Math.round(positionPx)
66
67 function scheduleUpdate() {
68 source.scheduleUpdate();
69 }
70
71 ShaderEffect {
72 id: top
73 visible: effect.enabled
74 opacity: topOpacity
75 property ShaderEffectSource source: effect.source
76 property real positionPx: __roundedPositionPx
77 property real factor: effect.height / height
78
79 clip: true
80
81 anchors {
82 top: parent.top
83 left: parent.left
84 right: parent.right
85 topMargin: -topOverflow - positionPx + topGapPx
86 }
87 height: topOverflow + positionPx
88
89 vertexShader: "
90 uniform highp mat4 qt_Matrix;
91 attribute highp vec4 qt_Vertex;
92 attribute highp vec2 qt_MultiTexCoord0;
93 varying highp vec2 qt_TexCoord0;
94 uniform highp float factor;
95
96 void main() {
97 highp vec4 pos = qt_Vertex;
98 pos.y *= factor;
99 gl_Position = qt_Matrix * pos;
100 qt_TexCoord0 = qt_MultiTexCoord0;
101 }
102 "
103 }
104
105 ShaderEffect {
106 id: bottom
107 visible: effect.enabled
108 opacity: bottomOpacity
109 property ShaderEffectSource source: effect.source
110 property real offset: effect.topOverflow + __roundedPositionPx
111 property real factor: effect.height / height
112
113 clip: true
114
115 anchors {
116 left: parent.left
117 right: parent.right
118 }
119 y: topOverflow + bottomGapPx
120 height: sourceItem.height - positionPx + bottomOverflow
121
122 vertexShader: "
123 uniform highp mat4 qt_Matrix;
124 attribute highp vec4 qt_Vertex;
125 attribute highp vec2 qt_MultiTexCoord0;
126 varying highp vec2 qt_TexCoord0;
127 uniform highp float factor;
128 uniform highp float offset;
129
130 void main() {
131 highp vec4 pos = qt_Vertex;
132 pos.y = (pos.y * factor) - offset;
133 gl_Position = qt_Matrix * pos;
134 qt_TexCoord0 = qt_MultiTexCoord0;
135 }
136 "
137 }
138}
1390
=== modified file 'qml/Components/PageHeader.qml'
--- qml/Components/PageHeader.qml 2014-03-18 10:57:24 +0000
+++ qml/Components/PageHeader.qml 2014-03-18 10:57:24 +0000
@@ -74,6 +74,7 @@
7474
75 AbstractButton {75 AbstractButton {
76 id: backButton76 id: backButton
77 objectName: root.objectName + "_backButton"
77 visible: false78 visible: false
78 height: header.height79 height: header.height
79 y: header.contentY80 y: header.contentY
8081
=== removed file 'qml/Components/RatingStars.qml'
--- qml/Components/RatingStars.qml 2014-02-14 10:14:55 +0000
+++ qml/Components/RatingStars.qml 1970-01-01 00:00:00 +0000
@@ -1,41 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18
19Row {
20 id: root
21 property int rating
22 property int maximumRating: 5
23 property int starCount: 5
24 height: childrenRect.height
25 width: childrenRect.width
26
27 readonly property int effectiveRating: Math.max(0, Math.min(root.starCount * root.rating / root.maximumRating, root.maximumRating))
28
29 Repeater {
30 model: root.effectiveRating
31 Image {
32 source: "graphics/icon_star_on.png"
33 }
34 }
35 Repeater {
36 model: root.starCount - root.effectiveRating
37 Image {
38 source: "graphics/icon_star_off.png"
39 }
40 }
41}
420
=== removed file 'qml/Components/Tile.qml'
--- qml/Components/Tile.qml 2013-10-14 10:43:49 +0000
+++ qml/Components/Tile.qml 1970-01-01 00:00:00 +0000
@@ -1,39 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19
20AbstractButton {
21 property url source
22 property int fillMode: Image.PreserveAspectCrop
23 property int horizontalAlignment: Text.AlignHCenter
24 property string text
25 property int imageWidth
26 property int imageHeight
27 property int maximumLineCount: 1
28
29 readonly property int center: (index % GridView.view.columns * width) + (width / 2)
30
31 opacity: GridView.view.highlightIndex === -1 ? 1 :
32 GridView.view.highlightIndex === index ? 0.6 : 0.2
33
34 Behavior on opacity {
35 UbuntuNumberAnimation {}
36 }
37
38 style: TileStyle {}
39}
400
=== removed file 'qml/Components/TileStyle.qml'
--- qml/Components/TileStyle.qml 2013-10-10 10:20:36 +0000
+++ qml/Components/TileStyle.qml 1970-01-01 00:00:00 +0000
@@ -1,81 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19
20Item {
21 id: tile
22
23 anchors.fill: parent
24
25 UbuntuShape {
26 id: icon
27 anchors {
28 top: parent.top
29 horizontalCenter: parent.horizontalCenter
30 }
31 radius: "medium"
32 width: styledItem.imageWidth
33 height: styledItem.imageHeight
34 image: Image {
35 id: image
36 objectName: "image"
37 sourceSize { width: icon.width; height: icon.height }
38 asynchronous: true
39 cache: false
40 source: styledItem.source
41 fillMode: styledItem.fillMode
42 horizontalAlignment: Image.AlignHCenter
43 verticalAlignment: Image.AlignVCenter
44 }
45 }
46
47 UbuntuShape {
48 id: borderPressed
49 objectName: "borderPressed"
50
51 anchors.fill: icon
52 radius: "medium"
53 borderSource: "radius_pressed.sci"
54 opacity: styledItem.pressed ? 1.0 : 0.0
55 Behavior on opacity { NumberAnimation { duration: 200; easing.type: Easing.OutQuint } }
56 }
57
58 Label {
59 id: label
60 objectName: "label"
61 anchors {
62 baseline: icon.bottom
63 baselineOffset: units.gu(2)
64 left: parent.left
65 right: parent.right
66 leftMargin: units.gu(1)
67 rightMargin: units.gu(1)
68 }
69
70 color: Theme.palette.selected.backgroundText
71 opacity: 0.9
72 style: Text.Raised
73 styleColor: "black"
74 fontSize: "small"
75 elide: Text.ElideMiddle
76 horizontalAlignment: styledItem.horizontalAlignment
77 text: styledItem.text
78 wrapMode: Text.Wrap
79 maximumLineCount: styledItem.maximumLineCount
80 }
81}
820
=== removed file 'qml/Dash/Apps/AppPreview.qml'
--- qml/Dash/Apps/AppPreview.qml 2014-01-15 06:32:25 +0000
+++ qml/Dash/Apps/AppPreview.qml 1970-01-01 00:00:00 +0000
@@ -1,167 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19import Ubuntu.Components.ListItems 0.1 as ListItems
20import ".."
21import "../Generic"
22import "../Previews"
23import "../../Components"
24
25GenericPreview {
26 id: root
27
28 signal sendUserReview(string review)
29
30 previewImages: previewImagesComponent
31 description: descriptionComponent
32 header: headerComponent
33
34 // TODO: Ratings are not yet complete... enable this once they work
35 //ratings: ratingsComponent
36
37 Component {
38 id: previewImagesComponent
39 ListView {
40 id: previewImageListView
41 spacing: units.gu(1)
42 orientation: ListView.Horizontal
43 height: units.gu(22)
44 model: previewData.infoMap["more-screenshots"] != null ? previewData.infoMap["more-screenshots"].value : [previewData.image]
45 cacheBuffer: width * 3
46
47 // FIXME: Because of ListViews inside ListViews inside Flickables inside ListViews (and some more)
48 // we finally reached the point where this ListView doesn't correctly get swipe input any more but
49 // instead the parent ListView is the one that is swiped. This MouseArea sort of creates a blocking
50 // layer to make sure this ListView can be swiped, regardless of what's behind it.
51 MouseArea {
52 anchors.fill: parent
53 enabled: parent.contentWidth > parent.width
54 }
55
56 LazyImage {
57 objectName: "placeholderScreenshot"
58 anchors {
59 top: parent.top
60 bottom: parent.bottom
61 }
62 scaleTo: "height"
63 source: "broken_image"
64 initialWidth: units.gu(13)
65 visible: previewImageListView.count == 0
66 }
67
68 delegate: LazyImage {
69 id: shape
70 anchors {
71 top: parent.top
72 bottom: parent.bottom
73 }
74 source: modelData ? modelData : ""
75 scaleTo: "height"
76 initialWidth: units.gu(13)
77 }
78 }
79 }
80
81 Component {
82 id: headerComponent
83 Header {
84 objectName: "previewHeader"
85 title: previewData.title
86 icon: previewData.appIcon
87 subtitle: root.previewData.infoMap["publisher"] ? root.previewData.infoMap["publisher"].value : ""
88 rating: Math.round(root.previewData.rating * 10)
89 reviews: root.previewData.numRatings
90 rated: root.previewData.infoMap["rated"] ? root.previewData.infoMap["rated"].value : 0
91 }
92 }
93
94 Component {
95 id: descriptionComponent
96 Column {
97 spacing: units.gu(1)
98
99 Label {
100 objectName: "descriptionLabel"
101 anchors { left: parent.left; right: parent.right }
102 text: root.previewData.description
103 fontSize: "medium"
104 color: Theme.palette.selected.backgroundText
105 opacity: .6
106 wrapMode: Text.WordWrap
107 style: Text.Raised
108 styleColor: "black"
109 }
110 }
111 }
112
113 Component {
114 id: ratingsComponent
115 Column {
116 id: columnReviewRating
117 objectName: "columnReviewRating"
118 visible: root.previewData.rating >= 0
119
120 spacing: units.gu(1)
121 height: childrenRect.height
122
123 ListItems.ThinDivider { }
124
125 Item {
126 anchors { left: parent.left; right: parent.right }
127 height: rateLabel.height
128
129 Label {
130 id: rateLabel
131 fontSize: "medium"
132 color: "white"
133 style: Text.Raised
134 styleColor: "black"
135 opacity: .9
136 text: i18n.tr("Rate this")
137
138 anchors.left: parent.left
139 anchors.verticalCenter: parent.verticalCenter
140 }
141
142 // FIXME these need to be made interactive and connected to the scope
143 RatingStars {
144 anchors.right: parent.right
145 anchors.verticalCenter: parent.verticalCenter
146 }
147 }
148
149 ListItems.ThinDivider { }
150
151 Reviews {
152 id: appReviews
153 objectName: "appReviews"
154
155 anchors { left: parent.left; right: parent.right }
156
157 model: root.previewData.infoMap["comments"] ? root.previewData.infoMap["comments"].value : undefined
158
159 onSendReview: root.sendUserReview(review);
160
161 onEditing: {
162 root.ensureVisible(appReviews.textArea);
163 }
164 }
165 }
166 }
167}
1680
=== removed file 'qml/Dash/Apps/DashPluginFilterGrid.qml'
--- qml/Dash/Apps/DashPluginFilterGrid.qml 2013-11-11 11:44:39 +0000
+++ qml/Dash/Apps/DashPluginFilterGrid.qml 1970-01-01 00:00:00 +0000
@@ -1,47 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19import "../../Components"
20import "../Generic"
21
22GenericFilterGrid {
23 id: filtergrid
24
25 delegate: Tile {
26 id: tile
27 objectName: "delegate" + index
28 width: filtergrid.cellWidth
29 height: filtergrid.cellHeight
30 text: model.title
31 imageWidth: filtergrid.iconWidth
32 imageHeight: filtergrid.iconHeight
33 source: model.icon
34
35 style: FlatTileStyle {
36 disabled: model.rendererHints['scope_disabled'] === 1;
37 }
38
39 onClicked: {
40 filtergrid.clicked(index, tile.y)
41 }
42
43 onPressAndHold: {
44 filtergrid.pressAndHold(index, tile.y)
45 }
46 }
47}
480
=== removed file 'qml/Dash/Apps/FrequentlyUsedAppsModel.qml'
--- qml/Dash/Apps/FrequentlyUsedAppsModel.qml 2014-02-24 20:56:03 +0000
+++ qml/Dash/Apps/FrequentlyUsedAppsModel.qml 1970-01-01 00:00:00 +0000
@@ -1,110 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18
19ListModel {
20 ListElement {
21 uri: "application://dialer-app.desktop"
22 icon: "../../graphics/applicationIcons/phone-app.png"
23 category: 0
24 mimetype: "application/x-desktop"
25 title: "Dialer"
26 comment: ""
27 dndUri: "file:///usr/share/applications/dialer-app.desktop"
28 metadata: "subscope:applications.scope/applications-non-click.scope"
29 }
30 ListElement {
31 uri: "application://messaging-app.desktop"
32 icon: "../../graphics/applicationIcons/messages-app.png"
33 category: 0
34 mimetype: "application/x-desktop"
35 title: "Messaging"
36 comment: ""
37 dndUri: "file:///usr/share/applications/messaging-app.desktop"
38 metadata: "subscope:applications.scope/applications-non-click.scope"
39 }
40 ListElement {
41 uri: "application://address-book-app.desktop"
42 icon: "../../graphics/applicationIcons/contacts-app.png"
43 category: 0
44 mimetype: "application/x-desktop"
45 title: "Contacts"
46 comment: ""
47 dndUri: "file:///usr/share/applications/address-book-app.desktop"
48 metadata: "subscope:applications.scope/applications-non-click.scope"
49 }
50 ListElement {
51 uri: "appid://com.ubuntu.camera/camera/current-user-version"
52 icon: "../../graphics/applicationIcons/camera.png"
53 category: 0
54 mimetype: "application/x-desktop"
55 title: "Camera"
56 comment: ""
57 dndUri: "appid://com.ubuntu.camera/camera/current-user-version"
58 metadata: "subscope:applications.scope/applications-click.scope?app_id=com.ubuntu.camera"
59 }
60 ListElement {
61 uri: "appid://com.ubuntu.gallery/gallery/current-user-version"
62 icon: "../../graphics/applicationIcons/gallery.png"
63 category: 0
64 mimetype: "application/x-desktop"
65 title: "Gallery"
66 comment: ""
67 dndUri: "appid://com.ubuntu.gallery/gallery/current-user-version"
68 metadata: "subscope:applications.scope/applications-click.scope?app_id=com.ubuntu.gallery"
69 }
70 ListElement {
71 uri: "appid://com.ubuntu.developer.webapps.webapp-facebook/webapp-facebook/current-user-version"
72 icon: "../../graphics/applicationIcons/facebook.png"
73 category: 0
74 mimetype: "application/x-desktop"
75 title: "Facebook"
76 comment: ""
77 dndUri: "appid://com.ubuntu.developer.webapps.webapp-facebook/webapp-facebook/current-user-version"
78 metadata: "subscope:applications.scope/applications-click.scope?app_id=com.ubuntu.developer.webapps.webapp-facebook"
79 }
80 ListElement {
81 uri: "application://webbrowser-app.desktop"
82 icon: "../../graphics/applicationIcons/browser.png"
83 category: 0
84 mimetype: "application/x-desktop"
85 title: "Browser"
86 comment: ""
87 dndUri: "file:///usr/share/applications/webbrowser-app.desktop"
88 metadata: "subscope:applications.scope/applications-non-click.scope"
89 }
90 ListElement {
91 uri: "appid://com.ubuntu.developer.webapps.webapp-gmail/webapp-gmail/current-user-version"
92 icon: "../../graphics/applicationIcons/gmail.png"
93 category: 0
94 mimetype: "application/x-desktop"
95 title: "GMail"
96 comment: ""
97 dndUri: "appid://com.ubuntu.developer.webapps.webapp-gmail/webapp-gmail/current-user-version"
98 metadata: "subscope:applications.scope/applications-click.scope?app_id=com.ubuntu.developer.webapps.webapp-gmail"
99 }
100 ListElement {
101 uri: "application://ubuntu-system-settings.desktop"
102 icon: "../../graphics/applicationIcons/system-settings.png"
103 category: 0
104 mimetype: "application/x-desktop"
105 title: "System Settings"
106 comment: ""
107 dndUri: "file:///usr/share/applications/ubuntu-system-settings.desktop"
108 metadata: "subscope:applications.scope/applications-non-click.scope"
109 }
110}
1110
=== modified file 'qml/Dash/Card.qml'
--- qml/Dash/Card.qml 2014-03-18 10:57:24 +0000
+++ qml/Dash/Card.qml 2014-03-18 10:57:24 +0000
@@ -26,6 +26,7 @@
26 property alias fontScale: header.fontScale26 property alias fontScale: header.fontScale
27 property alias headerAlignment: header.headerAlignment27 property alias headerAlignment: header.headerAlignment
28 property alias headerHeight: header.height28 property alias headerHeight: header.height
29 readonly property alias title: header.title
2930
30 property bool showHeader: true31 property bool showHeader: true
3132
3233
=== modified file 'qml/Dash/CardCarousel.qml'
--- qml/Dash/CardCarousel.qml 2014-03-18 10:57:24 +0000
+++ qml/Dash/CardCarousel.qml 2014-03-18 10:57:24 +0000
@@ -42,7 +42,6 @@
42 selectedItemScaleFactor: cardTool.carouselSelectedItemScaleFactor42 selectedItemScaleFactor: cardTool.carouselSelectedItemScaleFactor
43 cacheBuffer: 1404 // 18px * 13gu * 643 cacheBuffer: 1404 // 18px * 13gu * 6
44 model: cardCarousel.model44 model: cardCarousel.model
45 highlightIndex: cardCarousel.highlightIndex
4645
47 onClicked: cardCarousel.clicked(index, itemY)46 onClicked: cardCarousel.clicked(index, itemY)
48 onPressAndHold: cardCarousel.pressAndHold(index, itemY)47 onPressAndHold: cardCarousel.pressAndHold(index, itemY)
@@ -52,7 +51,7 @@
5251
53 itemComponent: Card {52 itemComponent: Card {
54 id: card53 id: card
55 objectName: "delegate" + index54 objectName: "carouselDelegate" + index
56 headerHeight: carousel.headerHeight55 headerHeight: carousel.headerHeight
57 cardData: model56 cardData: model
58 template: cardTool.template57 template: cardTool.template
5958
=== modified file 'qml/Dash/CardFilterGrid.qml'
--- qml/Dash/CardFilterGrid.qml 2014-03-18 10:57:24 +0000
+++ qml/Dash/CardFilterGrid.qml 2014-03-18 10:57:24 +0000
@@ -15,35 +15,62 @@
15 */15 */
1616
17import QtQuick 2.017import QtQuick 2.0
18import Ubuntu.Components 0.118import "../Components"
1919
20DashFilterGrid {20DashRenderer {
21 id: genericFilterGrid21 id: genericFilterGrid
2222
23 minimumHorizontalSpacing: units.gu(1)23 expandable: filterGrid.expandable
24 delegateWidth: cardTool.cardWidth24 collapsedRowCount: Math.min(2, cardTool && cardTool.template && cardTool.template["collapsed-rows"] || 2)
25 delegateHeight: cardTool.cardHeight25 collapsedHeight: filterGrid.collapsedHeight
26 columns: filterGrid.columns
27 rows: filter ? collapsedRowCount : uncollapsedRowCount
28 margins: filterGrid.margins
29 uncollapsedHeight: filterGrid.uncollapsedHeight
26 verticalSpacing: units.gu(1)30 verticalSpacing: units.gu(1)
27 collapsedRowCount: Math.min(2, template && template["collapsed-rows"] || 2)31 currentItem: filterGrid.currentItem
2832 height: filterGrid.height
29 delegate: Item {33
30 width: genericFilterGrid.cellWidth34 function startFilterAnimation(filter) {
31 height: genericFilterGrid.cellHeight35 filterGrid.startFilterAnimation(filter)
32 Card {36 }
33 id: card37
34 width: cardTool.cardWidth38 FilterGrid {
35 height: cardTool.cardHeight39 id: filterGrid
36 headerHeight: cardTool.headerHeight40 width: genericFilterGrid.width
37 anchors.horizontalCenter: parent.horizontalCenter41 minimumHorizontalSpacing: units.gu(1)
38 objectName: "delegate" + index42 delegateWidth: cardTool.cardWidth
39 cardData: model43 delegateHeight: cardTool.cardHeight
40 template: cardTool.template44 verticalSpacing: genericFilterGrid.verticalSpacing
41 components: cardTool.components45 model: genericFilterGrid.model
4246 filter: genericFilterGrid.filter
43 headerAlignment: cardTool.headerAlignment47 collapsedRowCount: genericFilterGrid.collapsedRowCount
4448 delegateCreationBegin: genericFilterGrid.delegateCreationBegin
45 onClicked: genericFilterGrid.clicked(index, card.y)49 delegateCreationEnd: genericFilterGrid.delegateCreationEnd
46 onPressAndHold: genericFilterGrid.pressAndHold(index, card.y)50 delegate: Item {
51 width: filterGrid.cellWidth
52 height: filterGrid.cellHeight
53 Card {
54 id: card
55 width: cardTool.cardWidth
56 height: cardTool.cardHeight
57 headerHeight: cardTool.headerHeight
58 anchors.horizontalCenter: parent.horizontalCenter
59 objectName: "delegate" + index
60 cardData: model
61 template: cardTool.template
62 components: cardTool.components
63
64 headerAlignment: cardTool.headerAlignment
65
66 onClicked: genericFilterGrid.clicked(index, card.y)
67 onPressAndHold: genericFilterGrid.pressAndHold(index, card.y)
68 }
69 }
70
71 onFilterChanged: {
72 genericFilterGrid.filter = filter
73 filter = Qt.binding(function() { return genericFilterGrid.filter })
47 }74 }
48 }75 }
49}76}
5077
=== modified file 'qml/Dash/CardTool.qml'
--- qml/Dash/CardTool.qml 2014-03-06 15:46:54 +0000
+++ qml/Dash/CardTool.qml 2014-03-18 10:57:24 +0000
@@ -163,7 +163,7 @@
163163
164 Card {164 Card {
165 id: card165 id: card
166 objectName: "card"166 objectName: "cardToolCard"
167 template: cardTool.template167 template: cardTool.template
168 components: cardTool.components168 components: cardTool.components
169169
170170
=== removed file 'qml/Dash/DashCarousel.qml'
--- qml/Dash/DashCarousel.qml 2013-11-22 13:53:00 +0000
+++ qml/Dash/DashCarousel.qml 1970-01-01 00:00:00 +0000
@@ -1,47 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19import "../Components"
20
21DashRenderer {
22 id: dashCarousel
23
24 property alias cacheBuffer: carousel.cacheBuffer
25 property alias itemComponent: carousel.itemComponent
26 property alias minimumTileWidth: carousel.minimumTileWidth
27 property alias selectedItemScaleFactor: carousel.selectedItemScaleFactor
28 property alias tileAspectRatio: carousel.tileAspectRatio
29
30 currentItem: carousel.currentItem
31 height: carousel.implicitHeight + units.gu(6)
32 verticalSpacing: units.gu(3)
33
34 Carousel {
35 id: carousel
36 anchors.fill: parent
37 tileAspectRatio: 198 / 288
38 minimumTileWidth: units.gu(13)
39 selectedItemScaleFactor: 1.14
40 cacheBuffer: 1404 // 18px * 13gu * 6
41 model: dashCarousel.model
42 highlightIndex: dashCarousel.highlightIndex
43
44 onClicked: dashCarousel.clicked(index, itemY)
45 onPressAndHold: dashCarousel.pressAndHold(index, itemY)
46 }
47}
480
=== modified file 'qml/Dash/DashContent.qml'
--- qml/Dash/DashContent.qml 2014-03-18 10:57:24 +0000
+++ qml/Dash/DashContent.qml 2014-03-18 10:57:24 +0000
@@ -24,7 +24,7 @@
2424
25 property var model: null25 property var model: null
26 property var scopes: null26 property var scopes: null
27 property alias currentIndex: dashContentList.currentIndex27 readonly property alias currentIndex: dashContentList.currentIndex
28 property alias previewOpen: previewListView.open28 property alias previewOpen: previewListView.open
2929
30 property ScopeDelegateMapper scopeMapper : ScopeDelegateMapper {}30 property ScopeDelegateMapper scopeMapper : ScopeDelegateMapper {}
@@ -51,6 +51,12 @@
51 }51 }
5252
53 function setCurrentScopeAtIndex(index, animate, reset) {53 function setCurrentScopeAtIndex(index, animate, reset) {
54 // if the scopes haven't loaded yet, then wait until they are.
55 if (!scopes.loaded) {
56 set_current_index = [ index, animate, reset ]
57 return;
58 }
59
54 var storedMoveDuration = dashContentList.highlightMoveDuration60 var storedMoveDuration = dashContentList.highlightMoveDuration
55 var storedMoveSpeed = dashContentList.highlightMoveVelocity61 var storedMoveSpeed = dashContentList.highlightMoveVelocity
56 if (!animate) {62 if (!animate) {
@@ -58,11 +64,6 @@
58 dashContentList.highlightMoveDuration = 064 dashContentList.highlightMoveDuration = 0
59 }65 }
6066
61 // if the scopes haven't loaded yet, then wait until they are.
62 if (!scopes.loaded) {
63 set_current_index = [ index, animate, reset ]
64 return;
65 }
66 set_current_index = undefined;67 set_current_index = undefined;
6768
68 if (dashContentList.count > index)69 if (dashContentList.count > index)
@@ -100,7 +101,7 @@
100 id: dashContentList101 id: dashContentList
101 objectName: "dashContentList"102 objectName: "dashContentList"
102103
103 interactive: dashContent.scopes.loaded && !previewListView.open && !currentItem.moving104 interactive: dashContent.scopes.loaded && !previewListView.open && currentItem && !currentItem.moving
104105
105 anchors.fill: parent106 anchors.fill: parent
106 model: dashContent.model107 model: dashContent.model
@@ -124,7 +125,7 @@
124 dashContent.setCurrentScopeAtIndex(count-1, true, true)125 dashContent.setCurrentScopeAtIndex(count-1, true, true)
125 } else if (currentIndex < 0) {126 } else if (currentIndex < 0) {
126 // setting currentIndex directly, cause we don't want to loose set_current_index127 // setting currentIndex directly, cause we don't want to loose set_current_index
127 dashContent.currentIndex = 0128 dashContentList.currentIndex = 0
128 }129 }
129 }130 }
130 }131 }
@@ -147,11 +148,12 @@
147 readonly property bool isLoaded: status == Loader.Ready148 readonly property bool isLoaded: status == Loader.Ready
148149
149 onLoaded: {150 onLoaded: {
151 item.objectName = scope.id
152 item.pageHeader = dashPageHeader;
153 item.previewListView = previewListView;
150 item.scope = Qt.binding(function() { return scope })154 item.scope = Qt.binding(function() { return scope })
151 item.isCurrent = Qt.binding(function() { return visible && ListView.isCurrentItem })155 item.isCurrent = Qt.binding(function() { return visible && ListView.isCurrentItem })
152 item.tabBarHeight = dashPageHeader.implicitHeight;156 item.tabBarHeight = dashPageHeader.implicitHeight;
153 item.pageHeader = dashPageHeader;
154 item.previewListView = previewListView;
155 dashContentList.movementStarted.connect(item.movementStarted)157 dashContentList.movementStarted.connect(item.movementStarted)
156 dashContent.positionedAtBeginning.connect(item.positionedAtBeginning)158 dashContent.positionedAtBeginning.connect(item.positionedAtBeginning)
157 dashContent.scopeLoaded(item.scope.id)159 dashContent.scopeLoaded(item.scope.id)
@@ -177,23 +179,25 @@
177 width: parent.width179 width: parent.width
178 searchEntryEnabled: true180 searchEntryEnabled: true
179 searchHistory: dashContent.searchHistory181 searchHistory: dashContent.searchHistory
180 scope: dashContentList.currentItem.theScope182 scope: dashContentList.currentItem && dashContentList.currentItem.theScope
181183
182 childItem: TabBar {184 childItem: TabBar {
183 id: tabBar185 id: tabBar
184 objectName: "tabbar"186 objectName: "tabbar"
185 height: units.gu(6.5)187 height: units.gu(6.5)
186 width: parent.width188 width: parent.width
187 selectionMode: false
188 style: DashContentTabBarStyle {}189 style: DashContentTabBarStyle {}
189190
190 // TODO This together with the __styleInstance onModelChanged below191 model: dashContentList.model
191 // are a workaround for the first tab sometimes not showing the text.
192 // But Tabs are going away in the future so not sure if makes
193 // sense invetigating what's the problem at this stage
194 model: dashContentList.model.count > 0 ? dashContentList.model : null
195192
196 onSelectedIndexChanged: {193 onSelectedIndexChanged: {
194 if (dashContentList.currentIndex == -1 && tabBar.selectedIndex != -1) {
195 // TODO This together with the Timer below
196 // are a workaround for the first tab sometimes not showing the text.
197 // But Tabs are going away in the future so not sure if makes
198 // sense invetigating what's the problem at this stage
199 selectionModeTimer.restart();
200 }
197 dashContentList.currentIndex = selectedIndex;201 dashContentList.currentIndex = selectedIndex;
198 }202 }
199203
@@ -204,12 +208,10 @@
204 }208 }
205 }209 }
206210
207 Connections {211 Timer {
208 target: __styleInstance212 id: selectionModeTimer
209 onModelChanged: {213 interval: 1
210 tabBar.selectedIndex = -1;214 onTriggered: tabBar.selectionMode = false
211 tabBar.selectedIndex = 0;
212 }
213 }215 }
214 }216 }
215 }217 }
@@ -217,6 +219,7 @@
217219
218 PreviewListView {220 PreviewListView {
219 id: previewListView221 id: previewListView
222 objectName: "dashContentPreviewList"
220 visible: x != width223 visible: x != width
221 scope: dashContentList.currentItem ? dashContentList.currentItem.theScope : null224 scope: dashContentList.currentItem ? dashContentList.currentItem.theScope : null
222 pageHeader: dashPageHeader225 pageHeader: dashPageHeader
223226
=== removed file 'qml/Dash/DashFilterGrid.qml'
--- qml/Dash/DashFilterGrid.qml 2014-03-18 10:57:24 +0000
+++ qml/Dash/DashFilterGrid.qml 1970-01-01 00:00:00 +0000
@@ -1,65 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import "../Components"
19import ".."
20
21DashRenderer {
22 id: dashFilterGrid
23
24 property alias cellWidth: filterGrid.cellWidth
25 property alias cellHeight: filterGrid.cellHeight
26 property alias delegate: filterGrid.delegate
27 property alias delegateWidth: filterGrid.delegateWidth
28 property alias delegateHeight: filterGrid.delegateHeight
29 property alias verticalSpacing: filterGrid.verticalSpacing
30 property alias maximumNumberOfColumns: filterGrid.maximumNumberOfColumns
31 property alias minimumHorizontalSpacing: filterGrid.minimumHorizontalSpacing
32 property alias collapsedRowCount: filterGrid.collapsedRowCount
33
34 collapsedHeight: filterGrid.collapsedHeight
35 columns: filterGrid.columns
36 rows: filter ? filterGrid.collapsedRowCount : filterGrid.uncollapsedRowCount
37 currentItem: filterGrid.currentItem
38 expandable: filterGrid.expandable
39 height: filterGrid.height
40 margins: filterGrid.margins
41 uncollapsedHeight: filterGrid.uncollapsedHeight
42
43 function startFilterAnimation(filter) {
44 filterGrid.startFilterAnimation(filter)
45 }
46
47 FilterGrid {
48 id: filterGrid
49 width: dashFilterGrid.width
50 minimumHorizontalSpacing: units.gu(0.5)
51 delegateWidth: units.gu(11)
52 delegateHeight: units.gu(9.5)
53 verticalSpacing: units.gu(2)
54 model: dashFilterGrid.model
55 filter: dashFilterGrid.filter
56 highlightIndex: dashFilterGrid.highlightIndex
57 delegateCreationBegin: dashFilterGrid.delegateCreationBegin
58 delegateCreationEnd: dashFilterGrid.delegateCreationEnd
59
60 onFilterChanged: {
61 dashFilterGrid.filter = filter
62 filter = Qt.binding(function() { return dashFilterGrid.filter })
63 }
64 }
65}
660
=== removed file 'qml/Dash/DashHome.qml'
--- qml/Dash/DashHome.qml 2013-08-11 21:21:38 +0000
+++ qml/Dash/DashHome.qml 1970-01-01 00:00:00 +0000
@@ -1,39 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19import Utils 0.1
20import "../Components"
21import "../Components/ListItems"
22import "Apps"
23
24GenericScopeView {
25 id: root
26 objectName: "DashHome"
27
28 SearchableResultModel {
29 id: appsModel
30
31 model: FrequentlyUsedAppsModel {}
32 filterRole: 3
33 searchQuery: root.scope.searchQuery
34 }
35
36 onScopeChanged: {
37 root.scope.categories.overrideResults("applications.scope", appsModel);
38 }
39}
400
=== removed file 'qml/Dash/DashPreview.qml'
--- qml/Dash/DashPreview.qml 2014-02-03 19:18:05 +0000
+++ qml/Dash/DashPreview.qml 1970-01-01 00:00:00 +0000
@@ -1,208 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19
20Item {
21 id: root
22
23 property int keyboardSize: Qt.inputMethod.visible ? Qt.inputMethod.keyboardRectangle.height : 0
24 property var previewData
25 property alias showProcessingAction: waitingForActionMouseArea.enabled
26
27 property real previewWidthRatio: 0.5
28 property bool isCurrent: false
29
30 property Component previewImages
31 property Component header
32 property Component actions
33 property Component description
34 property Component ratings
35
36 readonly property bool narrowMode: width <= height * 1.5
37 readonly property int columnWidth: narrowMode ? contentRow.width : (contentRow.width / 3) - contentRow.spacing
38 readonly property int contentSpacing: units.gu(3)
39
40 clip: true
41
42 function ensureVisible(item) {
43 var o = leftFlickable.mapFromItem(item, 0, 0, item.width, item.height);
44 var keyboardY = shell.height - root.keyboardSize;
45 if ((o.y + o.height) > keyboardY) {
46 leftFlickable.contentY += o.y + o.height - keyboardY;
47 }
48 }
49
50 Connections {
51 target: shell.applicationManager
52 onMainStageFocusedApplicationChanged: {
53 root.close();
54 }
55 onSideStageFocusedApplicationChanged: {
56 root.close();
57 }
58 }
59
60 onPreviewDataChanged: showProcessingAction = false
61
62 MouseArea {
63 anchors.fill: parent
64 }
65
66 Row {
67 id: contentRow
68 anchors {
69 left: parent.left
70 top: parent.top
71 right: parent.right
72 bottom: parent.bottom
73 topMargin: root.contentSpacing
74 leftMargin: root.contentSpacing
75 rightMargin: root.contentSpacing
76 }
77 height: childrenRect.height
78
79 spacing: units.gu(2)
80
81
82 Flickable {
83 id: leftFlickable
84 objectName: "leftFlickable"
85 anchors {
86 top: parent.top
87 bottom: parent.bottom
88 }
89 width: root.columnWidth
90 contentHeight: leftColumn.height + root.contentSpacing
91 anchors.bottomMargin: root.keyboardSize
92 clip: true
93
94 Behavior on contentY { NumberAnimation { duration: 300 } }
95
96 Column {
97 id: leftColumn
98 objectName: "leftColumn"
99 height: childrenRect.height
100 spacing: root.contentSpacing
101 anchors {
102 left: parent.left
103 right: parent.right
104 }
105 }
106 }
107
108 Flickable {
109 id: centerFlickable
110 anchors {
111 top: parent.top
112 bottom: parent.bottom
113 }
114 width: root.columnWidth
115 contentHeight: centerColumn.height
116 clip: true
117
118 Column {
119 id: centerColumn
120 objectName: "centerColumn"
121 height: childrenRect.height
122 anchors {
123 left: parent.left
124 right: parent.right
125 }
126 spacing: root.contentSpacing
127 }
128 }
129
130 Flickable {
131 id: rightFlickable
132 anchors {
133 top: parent.top
134 bottom: parent.bottom
135 }
136 width: root.columnWidth
137 contentHeight: rightColumn.height
138 clip: true
139
140 Column {
141 id: rightColumn
142 objectName: "rightColumn"
143 height: childrenRect.height
144 anchors {
145 left: parent.left
146 right: parent.right
147 }
148 }
149 }
150 }
151
152 Loader {
153 id: previewImageLoader
154 parent: leftColumn
155 sourceComponent: root.previewImages
156 anchors {
157 left: parent.left
158 right: parent.right
159 }
160 }
161
162 Loader {
163 id: ratingsLoader
164 parent: root.narrowMode ? leftColumn : rightColumn
165 anchors {
166 left: parent.left
167 right: parent.right
168 }
169 sourceComponent: root.ratings
170 }
171
172 Loader {
173 id: descriptionLoader
174 parent: root.narrowMode ? leftColumn : centerColumn
175 anchors {
176 left: parent.left
177 right: parent.right
178 }
179 sourceComponent: root.description
180 }
181
182 Loader {
183 id: actionsLoader
184 parent: root.narrowMode ? leftColumn : centerColumn
185 anchors {
186 left: parent.left
187 right: parent.right
188 }
189 sourceComponent: root.actions
190 }
191
192 Loader {
193 id: headerLoader
194 parent: root.narrowMode ? leftColumn : centerColumn
195 anchors {
196 left: parent.left
197 right: parent.right
198 }
199 sourceComponent: root.header
200 }
201
202 MouseArea {
203 id: waitingForActionMouseArea
204 objectName: "waitingForActionMouseArea"
205 anchors.fill: parent
206 enabled: false
207 }
208}
2090
=== removed file 'qml/Dash/DashPreviewPlaceholder.qml'
--- qml/Dash/DashPreviewPlaceholder.qml 2014-03-18 10:57:24 +0000
+++ qml/Dash/DashPreviewPlaceholder.qml 1970-01-01 00:00:00 +0000
@@ -1,25 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19
20DashPreview {
21 ActivityIndicator {
22 anchors.centerIn: parent
23 running: visible
24 }
25}
260
=== modified file 'qml/Dash/DashRenderer.qml'
--- qml/Dash/DashRenderer.qml 2014-03-18 10:57:24 +0000
+++ qml/Dash/DashRenderer.qml 2014-03-18 10:57:24 +0000
@@ -31,9 +31,6 @@
3131
32 property int rows: 132 property int rows: 1
3333
34 // Index of the highlighted item
35 property int highlightIndex: -1
36
37 property int margins: 034 property int margins: 0
3835
39 property int uncollapsedHeight: height36 property int uncollapsedHeight: height
@@ -53,7 +50,7 @@
53 /*!50 /*!
54 \brief CardTool component.51 \brief CardTool component.
55 */52 */
56 property var cardTool53 property var cardTool: undefined
5754
58 /// Emitted when the user clicked on an item55 /// Emitted when the user clicked on an item
59 /// @param index is the index of the clicked item56 /// @param index is the index of the clicked item
6057
=== removed directory 'qml/Dash/Generic'
=== removed file 'qml/Dash/Generic/FlatTileStyle.qml'
--- qml/Dash/Generic/FlatTileStyle.qml 2013-10-10 10:20:36 +0000
+++ qml/Dash/Generic/FlatTileStyle.qml 1970-01-01 00:00:00 +0000
@@ -1,79 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19
20Item {
21 id: tile
22
23 property bool disabled: false
24
25 anchors.fill: parent
26
27 Image {
28 id: icon
29 objectName: "image"
30 width: styledItem.imageWidth
31 height: styledItem.imageHeight
32
33 anchors.horizontalCenter: parent.horizontalCenter
34
35 sourceSize { width: width; height: height }
36 asynchronous: true
37 cache: false
38 source: styledItem.source
39 fillMode: styledItem.fillMode
40 opacity: tile.disabled ? 0.3 : 1.0
41 horizontalAlignment: Image.AlignHCenter
42 verticalAlignment: Image.AlignVCenter
43 }
44
45 UbuntuShape {
46 id: borderPressed
47 objectName: "borderPressed"
48
49 anchors.fill: icon
50 radius: "medium"
51 borderSource: "radius_pressed.sci"
52 opacity: styledItem.pressed ? 1.0 : 0.0
53 Behavior on opacity { NumberAnimation { duration: 200; easing.type: Easing.OutQuint } }
54 }
55
56 Label {
57 id: label
58 objectName: "label"
59 anchors {
60 baseline: icon.bottom
61 baselineOffset: units.gu(2)
62 left: parent.left
63 right: parent.right
64 leftMargin: units.gu(1)
65 rightMargin: units.gu(1)
66 }
67
68 color: Theme.palette.selected.backgroundText
69 opacity: 0.9
70 style: Text.Raised
71 styleColor: "black"
72 fontSize: "small"
73 elide: Text.ElideMiddle
74 horizontalAlignment: styledItem.horizontalAlignment
75 text: styledItem.text
76 wrapMode: Text.Wrap
77 maximumLineCount: styledItem.maximumLineCount
78 }
79}
800
=== removed file 'qml/Dash/Generic/GenericCarousel.qml'
--- qml/Dash/Generic/GenericCarousel.qml 2013-12-05 18:01:29 +0000
+++ qml/Dash/Generic/GenericCarousel.qml 1970-01-01 00:00:00 +0000
@@ -1,53 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19import "../../Components"
20import ".."
21
22DashCarousel {
23 id: genericCarousel
24 itemComponent: carouselDelegateGeneric
25
26 Component {
27 id: carouselDelegateGeneric
28
29 BaseCarouselDelegate {
30 id: item
31 objectName: "carouselDelegate"
32
33 UbuntuShape {
34 anchors.fill: parent
35 radius: "medium"
36 borderSource: ""
37 image: Image {
38 asynchronous: true
39 sourceSize { width: item.width; height: item.height }
40 source: model ? model.icon : ""
41 }
42 }
43
44 BorderImage {
45 anchors.centerIn: parent
46 opacity: 0.6
47 source: "../../Components/graphics/non-selected.sci"
48 width: parent.width + units.gu(1.5)
49 height: parent.height + units.gu(1.5)
50 }
51 }
52 }
53}
540
=== removed file 'qml/Dash/Generic/GenericFilterGrid.qml'
--- qml/Dash/Generic/GenericFilterGrid.qml 2013-11-22 13:53:00 +0000
+++ qml/Dash/Generic/GenericFilterGrid.qml 1970-01-01 00:00:00 +0000
@@ -1,46 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19import "../../Components"
20import ".."
21
22DashFilterGrid {
23 id: genericFilterGrid
24
25 property int iconWidth: units.gu(8)
26 property int iconHeight: units.gu(7.5)
27
28 minimumHorizontalSpacing: units.gu(0.5)
29 delegateWidth: units.gu(11)
30 delegateHeight: units.gu(9.5)
31 verticalSpacing: units.gu(2)
32
33 delegate: Tile {
34 id: tile
35 objectName: "delegate" + index
36 width: genericFilterGrid.cellWidth
37 height: genericFilterGrid.cellHeight
38 text: model.title
39 imageWidth: genericFilterGrid.iconWidth
40 imageHeight: genericFilterGrid.iconHeight
41 source: model.icon
42
43 onClicked: genericFilterGrid.clicked(index, tile.y)
44 onPressAndHold: genericFilterGrid.pressAndHold(index, tile.y)
45 }
46}
470
=== removed file 'qml/Dash/Generic/GenericFilterGridPotrait.qml'
--- qml/Dash/Generic/GenericFilterGridPotrait.qml 2013-11-20 00:10:01 +0000
+++ qml/Dash/Generic/GenericFilterGridPotrait.qml 1970-01-01 00:00:00 +0000
@@ -1,28 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19import "../../Components"
20
21GenericFilterGrid {
22 minimumHorizontalSpacing: units.gu(0.5)
23 delegateWidth: units.gu(11)
24 delegateHeight: units.gu(18)
25 verticalSpacing: units.gu(2)
26 iconWidth: (width / columns) * 0.8
27 iconHeight: iconWidth * 16 / 11
28}
290
=== removed file 'qml/Dash/Generic/GenericPreview.qml'
--- qml/Dash/Generic/GenericPreview.qml 2014-01-23 06:57:49 +0000
+++ qml/Dash/Generic/GenericPreview.qml 1970-01-01 00:00:00 +0000
@@ -1,197 +0,0 @@
1/*
2 * Copyright (C) 2013, 2014 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19import Ubuntu.Components.ListItems 0.1 as ListItems
20import Ubuntu.DownloadDaemonListener 0.1
21import "../../Components"
22import ".."
23import "../Previews"
24
25DashPreview {
26 id: genericPreview
27
28 previewImages: previewImagesComponent
29 header: headerComponent
30 actions: (previewData.infoMap !== undefined && previewData.infoMap["show_progressbar"]) ? progressComponent : actionsComponent
31 description: descriptionComponent
32
33 Component {
34 id: previewImagesComponent
35
36 LazyImage {
37 objectName: "genericPreviewImage"
38 anchors {
39 left: parent.left
40 right: parent.right
41 }
42 scaleTo: "width"
43 source: genericPreview.previewData.image
44 initialHeight: width
45 }
46 }
47
48 Component {
49 id: headerComponent
50 Header {
51 title: previewData.title
52 subtitle: previewData.subtitle
53 }
54 }
55
56 Component {
57 id: actionsComponent
58
59 Column {
60 id: buttonList
61 spacing: units.gu(1)
62 Repeater {
63 objectName: "buttonList"
64 model: previewData.actions
65
66 delegate: Button {
67 objectName: "button" + index
68 width: parent.width
69 height: buttonList.buttonHeight
70 color: Theme.palette.selected.foreground
71 text: modelData.displayName
72 iconSource: modelData.iconHint
73 iconPosition: "right"
74 onClicked: {
75 previewData.execute(modelData.id, { })
76 genericPreview.showProcessingAction = true;
77 }
78 }
79 }
80 }
81 }
82
83 Component {
84 id: progressComponent
85
86 ProgressBar {
87 id: progressBar
88 objectName: "progressBar"
89 value: 0
90 maximumValue: 100
91 height: units.gu(5)
92
93 property var model: previewData.actions
94
95 DownloadTracker {
96 service: "com.canonical.applications.Downloader"
97 dbusPath: previewData.infoMap["progressbar_source"] ? previewData.infoMap["progressbar_source"].value : ""
98
99 onProgress: {
100 var percentage = parseInt(received * 100 / total);
101 progressBar.value = percentage;
102 }
103
104 onFinished: {
105 previewData.execute(progressBar.model[0].id, { })
106 }
107
108 onError: {
109 previewData.execute(progressBar.model[1].id, { "error": error });
110 }
111 }
112
113 }
114 }
115
116 Component {
117 id: descriptionComponent
118 Column {
119 spacing: units.gu(2)
120
121 Label {
122 id: descriptionLabel
123 objectName: "descriptionLabel"
124 anchors { left: parent.left; right: parent.right }
125 visible: text != ""
126 fontSize: "small"
127 opacity: 0.6
128 color: "white"
129 text: previewData.description.replace(/[\r\n]/g, "<br />")
130 style: Text.Raised
131 styleColor: "black"
132 wrapMode: Text.WordWrap
133 textFormat: Text.RichText
134 // FIXME: workaround for https://bugreports.qt-project.org/browse/QTBUG-33020
135 onWidthChanged: { wrapMode = Text.NoWrap; wrapMode = Text.WordWrap }
136 }
137
138 Column {
139 objectName: "infoHintColumn"
140 anchors {
141 left: parent.left
142 right: parent.right
143 }
144 Repeater {
145 objectName: "infoHintRepeater"
146 model: previewData.infoHints
147
148 delegate: Item {
149 objectName: "infoHintItem" + index
150 width: parent.width
151 height: units.gu(5)
152 Row {
153 width: parent.width
154 spacing: units.gu(1)
155 property int columnWidth: (width - spacing) / 2
156 anchors.verticalCenter: parent.verticalCenter
157
158 Label {
159 objectName: "displayNameLabel"
160 visible: valueLabel.visible
161 fontSize: "small"
162 opacity: 0.9
163 color: "white"
164 horizontalAlignment: Text.AlignLeft
165 width: parent.columnWidth
166 text: modelData.displayName
167 style: Text.Raised
168 styleColor: "black"
169 }
170 Label {
171 id: valueLabel
172 objectName: "valueLabel"
173 visible: modelData.value != ""
174 fontSize: "small"
175 opacity: 0.6
176 color: "white"
177 horizontalAlignment: Text.AlignRight
178 width: parent.columnWidth
179 text: modelData.value ? modelData.value : ""
180 style: Text.Raised
181 styleColor: "black"
182 wrapMode: Text.WordWrap
183 }
184 }
185 ListItems.ThinDivider {
186 anchors {
187 left: parent.left
188 bottom: parent.bottom
189 right: parent.right
190 }
191 }
192 }
193 }
194 }
195 }
196 }
197}
1980
=== removed file 'qml/Dash/Generic/WeatherFilterGrid.qml'
--- qml/Dash/Generic/WeatherFilterGrid.qml 2013-11-11 11:44:39 +0000
+++ qml/Dash/Generic/WeatherFilterGrid.qml 1970-01-01 00:00:00 +0000
@@ -1,47 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19import "../../Components"
20
21GenericFilterGrid {
22 id: filtergrid
23
24 delegateHeight: units.gu(11.5)
25
26 delegate: Tile {
27 id: tile
28 objectName: "delegate" + index
29 width: filtergrid.cellWidth
30 height: filtergrid.cellHeight
31 text: model.title
32 imageWidth: filtergrid.iconWidth
33 imageHeight: filtergrid.iconHeight
34 source: model.icon
35 maximumLineCount: 2
36
37 style: FlatTileStyle {}
38
39 onClicked: {
40 filtergrid.clicked(index, tile.y)
41 }
42
43 onPressAndHold: {
44 filtergrid.pressAndHold(index, tile.y)
45 }
46 }
47}
480
=== modified file 'qml/Dash/GenericScopeView.qml'
--- qml/Dash/GenericScopeView.qml 2014-03-18 10:57:24 +0000
+++ qml/Dash/GenericScopeView.qml 2014-03-18 10:57:24 +0000
@@ -24,9 +24,9 @@
24FocusScope {24FocusScope {
25 id: scopeView25 id: scopeView
2626
27 property Scope scope27 property Scope scope: null
28 property SortFilterProxyModel categories: categoryFilter28 property SortFilterProxyModel categories: categoryFilter
29 property bool isCurrent29 property bool isCurrent: false
30 property alias moving: categoryView.moving30 property alias moving: categoryView.moving
31 property int tabBarHeight: 031 property int tabBarHeight: 0
32 property PageHeader pageHeader: null32 property PageHeader pageHeader: null
@@ -91,7 +91,7 @@
91 Binding {91 Binding {
92 target: pageHeader92 target: pageHeader
93 property: "searchQuery"93 property: "searchQuery"
94 value: scopeView.scope.searchQuery94 value: scopeView.scope ? scopeView.scope.searchQuery : ""
95 when: isCurrent95 when: isCurrent
96 }96 }
9797
@@ -122,11 +122,6 @@
122 onOriginYChanged: pageHeader.positionRealHeader();122 onOriginYChanged: pageHeader.positionRealHeader();
123 onContentHeightChanged: pageHeader.positionRealHeader();123 onContentHeightChanged: pageHeader.positionRealHeader();
124124
125 Behavior on contentY {
126 enabled: previewListView.open
127 UbuntuNumberAnimation {}
128 }
129
130 delegate: ListItems.Base {125 delegate: ListItems.Base {
131 id: baseItem126 id: baseItem
132 objectName: "dashCategory" + category127 objectName: "dashCategory" + category
133128
=== removed directory 'qml/Dash/Movie'
=== removed file 'qml/Dash/Movie/MoviePreview.qml'
--- qml/Dash/Movie/MoviePreview.qml 2013-10-02 19:21:33 +0000
+++ qml/Dash/Movie/MoviePreview.qml 1970-01-01 00:00:00 +0000
@@ -1,71 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19import ".."
20import "../Generic"
21import "../../Components"
22import "../Previews"
23
24GenericPreview {
25 id: root
26
27 property bool ready: previewData ? true : false
28 property url url: ready ? previewData.image : ""
29
30 previewImages: previewImageComponent
31 header: headerComponent
32
33 Component {
34 id: previewImageComponent
35 LazyImage {
36 anchors.left: parent.left
37 anchors.right: parent.right
38 scaleTo: "width"
39 visible: height > 0
40 source: root.url
41 initialHeight: width * 10 / 16
42
43 Image {
44 objectName: "playButton"
45 anchors.centerIn: parent
46 readonly property bool bigButton: parent.width > units.gu(40)
47 width: bigButton ? units.gu(8) : units.gu(4.5)
48 height: width
49 source: "../graphics/play_button%1%2.png".arg(previewImageMouseArea.pressed ? "_active" : "").arg(bigButton ? "_big" : "")
50 }
51
52 MouseArea {
53 id: previewImageMouseArea
54 anchors.fill: parent
55 onClicked: {
56 Qt.openUrlExternally(previewData.result.uri);
57 }
58 }
59 }
60 }
61
62 Component {
63 id: headerComponent
64 Header {
65 title: previewData.title
66 rating: Math.round(previewData.rating * 10)
67 reviews: previewData.numRatings
68 rated: previewData.infoMap["rated"] ? previewData.infoMap["rated"].value : 0
69 }
70 }
71}
720
=== removed directory 'qml/Dash/Music'
=== removed file 'qml/Dash/Music/CarouselDelegateMusic.qml'
--- qml/Dash/Music/CarouselDelegateMusic.qml 2013-07-09 11:04:25 +0000
+++ qml/Dash/Music/CarouselDelegateMusic.qml 1970-01-01 00:00:00 +0000
@@ -1,42 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19import "../../Components"
20
21BaseCarouselDelegate {
22 id: item
23
24 UbuntuShape {
25 anchors.fill: parent
26 radius: "medium"
27 borderSource: ""
28 image: Image {
29 asynchronous: true
30 sourceSize { width: item.width; height: item.height }
31 source: model ? model.icon : ""
32 }
33 }
34
35 BorderImage {
36 anchors.centerIn: parent
37 opacity: 0.6
38 source: "../../Components/graphics/non-selected.sci"
39 width: parent.width + units.gu(1.5)
40 height: parent.height + units.gu(1.5)
41 }
42}
430
=== removed file 'qml/Dash/Music/MusicCarousel.qml'
--- qml/Dash/Music/MusicCarousel.qml 2013-11-20 00:10:01 +0000
+++ qml/Dash/Music/MusicCarousel.qml 1970-01-01 00:00:00 +0000
@@ -1,34 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import "../../Components"
19import ".."
20
21DashCarousel {
22 id: musicCarousel
23 tileAspectRatio: 1
24 minimumTileWidth: units.gu(13)
25 itemComponent: carouselDelegateMusic
26 selectedItemScaleFactor: 1.2
27 cacheBuffer: 1404 // 18px * 13gu * 6
28
29 Component {
30 id: carouselDelegateMusic
31 CarouselDelegateMusic {
32 }
33 }
34}
350
=== removed file 'qml/Dash/Music/MusicFilterGrid.qml'
--- qml/Dash/Music/MusicFilterGrid.qml 2013-11-22 13:53:00 +0000
+++ qml/Dash/Music/MusicFilterGrid.qml 1970-01-01 00:00:00 +0000
@@ -1,48 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import "../../Components"
19import "../Generic"
20
21GenericFilterGrid {
22 id: musicFilterGrid
23
24 delegateWidth: units.gu(11)
25 delegateHeight: units.gu(16)
26 iconWidth: units.gu(11)
27 iconHeight: units.gu(11)
28
29 delegate: Tile {
30 id: tile
31 objectName: "delegate" + index
32 width: musicFilterGrid.cellWidth
33 height: musicFilterGrid.cellHeight
34 text: model.comment
35 imageWidth: musicFilterGrid.iconWidth
36 imageHeight: musicFilterGrid.iconHeight
37 source: model.icon
38 maximumLineCount: 2
39 horizontalAlignment: Text.AlignLeft
40
41 style: MusicTileStyle {
42 artist: model.title
43 }
44
45 onClicked: musicFilterGrid.clicked(index, tile.y)
46 onPressAndHold: musicFilterGrid.pressAndHold(index, tile.y)
47 }
48}
490
=== removed file 'qml/Dash/Music/MusicPreview.qml'
--- qml/Dash/Music/MusicPreview.qml 2014-01-29 16:12:16 +0000
+++ qml/Dash/Music/MusicPreview.qml 1970-01-01 00:00:00 +0000
@@ -1,203 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import QtMultimedia 5.0
19import Ubuntu.Components 0.1
20import Ubuntu.Components.ListItems 0.1
21import ".."
22import "../Generic"
23import "../../Components"
24import "../Previews"
25
26GenericPreview {
27 id: root
28
29 previewImages: previewImageComponent
30 header: headerComponent
31 description: descriptionComponent
32
33 Component {
34 id: previewImageComponent
35 LazyImage {
36 height: units.gu(22)
37 scaleTo: "height"
38 source: previewData ? previewData.image : ""
39 initialHeight: height
40 initialWidth: height
41 }
42 }
43
44 Component {
45 id: headerComponent
46 Header {
47 title: previewData.title
48 subtitle: previewData.subtitle
49 }
50 }
51
52 Component {
53 id: descriptionComponent
54
55 Item {
56 height: childrenRect.height
57 Audio {
58 id: audioPlayer
59 objectName: "audioPlayer"
60 property real progress: audioPlayer.position / audioPlayer.duration
61
62 property Item playingItem
63
64 Component.onDestruction: {
65 audioPlayer.stop();
66 }
67
68 onErrorStringChanged: console.warn("Audio player error:", errorString)
69
70 }
71
72 Connections {
73 target: root
74 onIsCurrentChanged: {
75 if (!root.isCurrent) {
76 audioPlayer.stop();
77 }
78 }
79 }
80
81 Column {
82 anchors { left: parent.left; right: parent.right }
83 visible: trackRepeater.count > 0
84
85 ThinDivider {
86 objectName: "topDivider"
87 anchors { left: parent.left; right: parent.right }
88 }
89
90 Repeater {
91 id: trackRepeater
92 objectName: "trackRepeater"
93
94 model: previewData.tracks
95
96 delegate: Item {
97 id: trackItem
98 objectName: "trackItem" + index
99 anchors { left: parent.left; right: parent.right }
100 height: units.gu(5)
101 property bool isPlayingItem: audioPlayer.playingItem == trackItem
102
103 function play() {
104 audioPlayer.stop();
105 // Make sure we change the source, even if two items point to the same uri location
106 audioPlayer.source = "";
107 audioPlayer.source = model.uri;
108 audioPlayer.playingItem = trackItem;
109 audioPlayer.play();
110 }
111
112 Row {
113 id: trackRow
114 width: parent.width
115 spacing: units.gu(1)
116 property int column1Width: units.gu(3)
117 property int column2Width: width - (2 * spacing) - column1Width - column3Width
118 property int column3Width: units.gu(4)
119 anchors.verticalCenter: parent.verticalCenter
120
121 Button {
122 objectName: "playButton"
123 width: trackRow.column1Width
124 height: width
125 iconSource: audioPlayer.playbackState == Audio.PlayingState && trackItem.isPlayingItem ? "image://theme/media-playback-pause" : "image://theme/media-playback-start"
126
127 // Can't be "transparent" or "#00xxxxxx" as the button optimizes away the surrounding shape
128 // FIXME when this is resolved: https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1251685
129 color: "#01000000"
130
131 onClicked: {
132 if (trackItem.isPlayingItem) {
133 if (audioPlayer.playbackState == Audio.PlayingState) {
134 audioPlayer.pause();
135 } else if (audioPlayer.playbackState == Audio.PausedState){
136 audioPlayer.play();
137 }
138 } else {
139 trackItem.play();
140 }
141 }
142 }
143
144 Label {
145 objectName: "trackTitleLabel"
146 fontSize: "small"
147 opacity: 0.9
148 color: "white"
149 horizontalAlignment: Text.AlignLeft
150 anchors.verticalCenter: parent.verticalCenter
151 width: parent.column2Width
152 text: title
153 style: Text.Raised
154 styleColor: "black"
155 elide: Text.ElideRight
156
157 UbuntuShape {
158 id: progressBarFill
159 objectName: "progressBarFill"
160 color: UbuntuColors.orange
161 anchors.left: progressBarImage.left
162 anchors.right: progressBarImage.right
163 anchors.verticalCenter: progressBarImage.verticalCenter
164 height: units.dp(2)
165 anchors.margins: units.dp(2)
166 anchors.rightMargin: maxWidth - (maxWidth * audioPlayer.progress) + units.dp(2)
167 visible: progressBarImage.visible
168 property int maxWidth: progressBarImage.width - units.dp(4)
169 }
170
171 Image {
172 id: progressBarImage
173 anchors { left: parent.left; top: parent.bottom; right: parent.right }
174 height: units.dp(6)
175 visible: audioPlayer.playbackState != Audio.StoppedState && trackItem.isPlayingItem && model.length.length > 0
176 source: "graphics/music_progress_bg.png"
177 }
178 }
179
180 Label {
181 id: valueLabel
182 objectName: "timeLabel"
183 fontSize: "small"
184 opacity: 0.9
185 color: "white"
186 anchors.verticalCenter: parent.verticalCenter
187 horizontalAlignment: Text.AlignRight
188 width: parent.column3Width
189 text: length
190 style: Text.Raised
191 styleColor: "black"
192 }
193 }
194
195 ThinDivider {
196 anchors { left: parent.left; bottom: parent.bottom; right: parent.right }
197 }
198 }
199 }
200 }
201 }
202 }
203}
2040
=== removed file 'qml/Dash/Music/MusicTileStyle.qml'
--- qml/Dash/Music/MusicTileStyle.qml 2013-10-14 10:23:18 +0000
+++ qml/Dash/Music/MusicTileStyle.qml 1970-01-01 00:00:00 +0000
@@ -1,102 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19
20Item {
21 id: tile
22
23 property alias artist: artistLabel.text
24
25 anchors.fill: parent
26
27 UbuntuShape {
28 id: icon
29 anchors {
30 top: parent.top
31 horizontalCenter: parent.horizontalCenter
32 }
33 radius: "medium"
34 width: styledItem.imageWidth
35 height: styledItem.imageHeight
36 image: Image {
37 id: image
38 objectName: "image"
39 sourceSize { width: icon.width; height: icon.height }
40 asynchronous: true
41 cache: false
42 source: styledItem.source
43 fillMode: styledItem.fillMode
44 horizontalAlignment: Image.AlignHCenter
45 verticalAlignment: Image.AlignVCenter
46 }
47 }
48
49 UbuntuShape {
50 id: borderPressed
51 objectName: "borderPressed"
52
53 anchors.fill: icon
54 radius: "medium"
55 borderSource: "radius_pressed.sci"
56 opacity: styledItem.pressed ? 1.0 : 0.0
57 Behavior on opacity { NumberAnimation { duration: 200; easing.type: Easing.OutQuint } }
58 }
59
60 Label {
61 id: label
62 objectName: "label"
63 anchors {
64 baseline: icon.bottom
65 baselineOffset: units.gu(2)
66 left: icon.left
67 right: parent.right
68 rightMargin: units.gu(1)
69 leftMargin: units.dp(2)
70 }
71
72 color: Theme.palette.selected.backgroundText
73 opacity: 0.9
74 style: Text.Raised
75 styleColor: "black"
76 fontSize: "small"
77 font.weight: Font.Bold
78 elide: Text.ElideRight
79 horizontalAlignment: styledItem.horizontalAlignment
80 text: styledItem.text
81 wrapMode: Text.Wrap
82 maximumLineCount: styledItem.maximumLineCount
83 }
84
85 Label {
86 id: artistLabel
87 anchors {
88 top: label.bottom
89 left: label.left
90 right: label.right
91 rightMargin: units.gu(1)
92 }
93
94 color: Theme.palette.selected.backgroundText
95 opacity: 0.9
96 style: Text.Raised
97 styleColor: "black"
98 fontSize: "x-small"
99 elide: Text.ElideMiddle
100 horizontalAlignment: styledItem.horizontalAlignment
101 }
102}
1030
=== removed file 'qml/Dash/PreviewDelegateMapper.qml'
--- qml/Dash/PreviewDelegateMapper.qml 2013-11-04 15:40:30 +0000
+++ qml/Dash/PreviewDelegateMapper.qml 1970-01-01 00:00:00 +0000
@@ -1,38 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18
19QtObject {
20 property var d: QtObject {
21 readonly property string genericPreview: "Generic/GenericPreview.qml"
22 readonly property string appPreview: "Apps/AppPreview.qml"
23 property var previewDelegateMapping: {"preview-generic": genericPreview,
24 "preview-application": appPreview,
25 "preview-movie": "Movie/MoviePreview.qml",
26 "preview-music": "Music/MusicPreview.qml",
27 }
28 }
29
30 function map(rendererName) {
31 var customPreview = d.previewDelegateMapping[rendererName]
32 if (customPreview != undefined) {
33 return customPreview
34 }
35 console.debug("Renderer "+rendererName+" not found, using preview-generic")
36 return d.genericPreview
37 }
38}
390
=== modified file 'qml/Dash/PreviewListView.qml'
--- qml/Dash/PreviewListView.qml 2014-03-18 10:57:24 +0000
+++ qml/Dash/PreviewListView.qml 2014-03-18 10:57:24 +0000
@@ -34,6 +34,7 @@
3434
35 PageHeader {35 PageHeader {
36 id: header36 id: header
37 objectName: root.objectName + "_pageHeader"
37 width: parent.width38 width: parent.width
38 searchEntryEnabled: false39 searchEntryEnabled: false
39 scope: root.scope40 scope: root.scope
@@ -60,7 +61,7 @@
6061
61 ListView {62 ListView {
62 id: previewListView63 id: previewListView
63 objectName: "previewListView"64 objectName: root.objectName + "_listView"
64 anchors {65 anchors {
65 top: header.bottom66 top: header.bottom
66 bottom: parent.bottom67 bottom: parent.bottom
@@ -91,7 +92,7 @@
91 pageHeader.unfocus();92 pageHeader.unfocus();
92 } else {93 } else {
93 // Cancel any pending preview requests or actions94 // Cancel any pending preview requests or actions
94 if (previewListView.currentItem.previewData !== undefined) {95 if (previewListView.currentItem && previewListView.currentItem.previewData !== undefined) {
95 previewListView.currentItem.previewData.cancelAction();96 previewListView.currentItem.previewData.cancelAction();
96 }97 }
97 scope.cancelActivation();98 scope.cancelActivation();
@@ -100,6 +101,7 @@
100 }101 }
101102
102 delegate: Item {103 delegate: Item {
104 objectName: "previewItem" + index
103 height: previewListView.height105 height: previewListView.height
104 width: previewListView.width106 width: previewListView.width
105107
106108
=== removed file 'qml/Dash/Previews/Header.qml'
--- qml/Dash/Previews/Header.qml 2013-10-01 17:49:48 +0000
+++ qml/Dash/Previews/Header.qml 1970-01-01 00:00:00 +0000
@@ -1,109 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19import "../../Components"
20
21Row {
22 id: root
23 property alias icon: image.source
24 property alias title: titleLabel.text
25 property alias subtitle: subtitleLabel.text
26 property alias rating: ratingStars.rating
27 property int rated: 0
28 property int reviews: 0
29
30 spacing: units.gu(2)
31 height: imageShape.visible ? imageShape.height : contentColumn.height
32
33 UbuntuShape {
34 id: imageShape
35 width: height
36 height: Math.max(units.gu(6), contentColumn.height)
37 visible: image.source.toString().length > 0
38 image: Image {
39 id: image
40 sourceSize { width: imageShape.width; height: imageShape.height }
41 asynchronous: true
42 fillMode: Image.PreserveAspectFit
43 }
44 }
45
46 Column {
47 id: contentColumn
48 spacing: units.gu(1)
49 width: parent.width - x
50
51 Label {
52 id: titleLabel
53 objectName: "titleLabel"
54 fontSize: "large"
55 color: "white"
56 style: Text.Raised
57 styleColor: "black"
58 opacity: .9
59 width: parent.width
60 elide: Text.ElideRight
61 }
62
63 Label {
64 id: subtitleLabel
65 objectName: "subtitleLabel"
66 fontSize: "medium"
67 color: "white"
68 style: Text.Raised
69 styleColor: "black"
70 opacity: .6
71 visible: text.length > 0
72 }
73
74 Row {
75 visible: root.rating >= 0
76 spacing: units.gu(1)
77
78 RatingStars {
79 id: ratingStars
80 maximumRating: 10
81 rating: -1
82 }
83
84 Label {
85 id: ratedLabel
86 objectName: "ratedLabel"
87 fontSize: "medium"
88 color: "white"
89 style: Text.Raised
90 styleColor: "black"
91 opacity: .6
92 //TRANSLATORS: Number of persons who rated this app/video/whatever
93 text: i18n.tr("(%1)").arg(root.rated)
94 }
95
96 Label {
97 id: reviewsLabel
98 objectName: "reviewsLabel"
99 fontSize: "medium"
100 color: "white"
101 style: Text.Raised
102 styleColor: "black"
103 opacity: .6
104 //TRANSLATORS: Number of persons who wrote reviews for this app/video/whatever
105 text: i18n.tr("%1 review", "%1 reviews", root.reviews).arg(root.reviews)
106 }
107 }
108 }
109}
1100
=== removed file 'qml/Dash/Previews/Reviews.qml'
--- qml/Dash/Previews/Reviews.qml 2013-09-30 19:34:47 +0000
+++ qml/Dash/Previews/Reviews.qml 1970-01-01 00:00:00 +0000
@@ -1,194 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19import Ubuntu.Components.ListItems 0.1 as ListItem
20import "../../Components"
21
22Column {
23 id: root
24
25 property var model
26 property alias textArea: reviewField
27
28 signal sendReview(string review)
29 signal editing
30
31 spacing: units.gu(2)
32 state: ""
33
34 states: [
35 State {
36 name: ""
37 PropertyChanges { target: reviewField; width: root.width }
38 PropertyChanges { target: sendButton; opacity: 0 }
39 PropertyChanges { target: inverseArea; enabled: false }
40 },
41 State {
42 name: "editing"
43 PropertyChanges { target: reviewField; width: (root.width - row.spacing - sendButton.width) }
44 PropertyChanges { target: sendButton; opacity: 1 }
45 PropertyChanges { target: inverseArea; enabled: true }
46 }
47 ]
48
49 transitions: [
50 Transition {
51 from: ""
52 to: "editing"
53 SequentialAnimation {
54 UbuntuNumberAnimation { target: reviewField; properties: "width"; duration: UbuntuAnimation.SlowDuration }
55 UbuntuNumberAnimation { target: sendButton; properties: "opacity"; duration: UbuntuAnimation.SlowDuration }
56 }
57 },
58 Transition {
59 from: "editing"
60 to: ""
61 SequentialAnimation {
62 UbuntuNumberAnimation { target: sendButton; properties: "opacity"; duration: UbuntuAnimation.SlowDuration }
63 UbuntuNumberAnimation { target: reviewField; properties: "width"; duration: UbuntuAnimation.SlowDuration }
64 }
65 }
66 ]
67
68 Label {
69 fontSize: "medium"
70 color: "white"
71 style: Text.Raised
72 styleColor: "black"
73 opacity: .9
74 text: i18n.tr("Add a review")
75 }
76
77 Row {
78 id: row
79 spacing: units.gu(1)
80 width: root.width
81
82 // FIXME: needs to react to Qt.inputMethod geometry
83 TextArea {
84 id: reviewField
85 objectName: "reviewField"
86 placeholderText: i18n.tr("Review")
87 width: parent.width
88 verticalAlignment: Text.AlignVCenter
89 autoSize: true
90 maximumLineCount: 5
91
92 Behavior on height { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
93
94 onFocusChanged: {
95 if(reviewField.focus){
96 root.state = "editing";
97 reviewField.selectAll();
98 root.editing();
99 }
100 }
101
102 // FIXME: not active when in wide mode
103 InverseMouseArea {
104 id: inverseArea
105 anchors.fill: parent
106 enabled: false
107 onPressed: {
108 reviewField.focus = false;
109 root.state = "";
110 }
111 }
112 }
113
114 Button {
115 id: sendButton
116 objectName: "sendButton"
117 width: units.gu(10)
118 height: units.gu(4)
119 anchors.bottom: reviewField.bottom
120 color: Theme.palette.selected.foreground
121 text: i18n.tr("Send")
122 opacity: 0
123
124 onClicked: {
125 root.sendReview(reviewField.text);
126 reviewField.text = ""
127 }
128 }
129 }
130
131 ListItem.ThinDivider {}
132
133 Label {
134 fontSize: "medium"
135 color: "white"
136 style: Text.Raised
137 styleColor: "black"
138 opacity: .9
139 text: i18n.tr("Comments:")
140 }
141
142 Repeater {
143 objectName: "commentsArea"
144 model: root.model
145
146 Column {
147 anchors { left: parent.left; right: parent.right }
148
149 Column {
150 anchors { left: parent.left; right: parent.right }
151
152 Label {
153 anchors { left: parent.left; right: parent.right }
154 text: modelData[0]
155 fontSize: "medium"
156 color: "white"
157 opacity: .8
158 wrapMode: Text.WordWrap
159 style: Text.Raised
160 styleColor: "black"
161 }
162
163 Row {
164 spacing: units.gu(1)
165
166 RatingStars {
167 maximumRating: 10
168 rating: modelData[1]
169 }
170
171 Label {
172 text: modelData[2]
173 fontSize: "medium"
174 color: Theme.palette.selected.backgroundText
175 opacity: .6
176 style: Text.Raised
177 styleColor: "black"
178 }
179 }
180 }
181
182 Label {
183 anchors { left: parent.left; right: parent.right }
184 text: modelData[3]
185 fontSize: "medium"
186 color: Theme.palette.selected.backgroundText
187 opacity: .6
188 wrapMode: Text.WordWrap
189 style: Text.Raised
190 styleColor: "black"
191 }
192 }
193 }
194}
1950
=== modified file 'qml/Dash/ScopeDelegateMapper.qml'
--- qml/Dash/ScopeDelegateMapper.qml 2014-03-18 10:57:24 +0000
+++ qml/Dash/ScopeDelegateMapper.qml 2014-03-18 10:57:24 +0000
@@ -17,9 +17,7 @@
17import QtQuick 2.017import QtQuick 2.0
1818
19QtObject {19QtObject {
20 property var scopeDelegateMapping: {"clickscope": "DashApps.qml",20 property var scopeDelegateMapping: {"clickscope": "DashApps.qml"}
21 "home.scope": "DashHome.qml"
22 }
23 property string genericScope: "GenericScopeView.qml"21 property string genericScope: "GenericScopeView.qml"
2422
25 function map(scopeId) {23 function map(scopeId) {
2624
=== removed file 'qml/Dash/SearchableResultModel.qml'
--- qml/Dash/SearchableResultModel.qml 2014-03-18 10:57:24 +0000
+++ qml/Dash/SearchableResultModel.qml 1970-01-01 00:00:00 +0000
@@ -1,44 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import Utils 0.1
18import Unity 0.2
19
20SortFilterProxyModel {
21 id: root
22
23 property string searchQuery: ""
24 property bool hideOnSearch: false
25
26 filterRole: CategoryResults.RoleTitle
27
28 function get(index) {
29 return model.get(mapToSource(index))
30 }
31
32 onSearchQueryChanged: {
33 if (searchQuery.length == 0) {
34 filterRegExp = RegExp("");
35 filterCaseSensitivity = Qt.CaseInsensitive;
36 } else if (!hideOnSearch) {
37 setFilterWildcard(searchQuery);
38 filterCaseSensitivity = Qt.CaseInsensitive;
39 } else {
40 filterRegExp = /^$/;
41 filterCaseSensitivity = Qt.CaseInsensitive;
42 }
43 }
44}
450
=== removed directory 'qml/Dash/Video'
=== removed file 'qml/Dash/Video/CarouselDelegateVideo.qml'
--- qml/Dash/Video/CarouselDelegateVideo.qml 2013-07-09 09:06:29 +0000
+++ qml/Dash/Video/CarouselDelegateVideo.qml 1970-01-01 00:00:00 +0000
@@ -1,42 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19import "../../Components"
20
21BaseCarouselDelegate {
22 id: item
23
24 UbuntuShape {
25 anchors.fill: parent
26 radius: "medium"
27 borderSource: ""
28 image: Image {
29 asynchronous: true
30 sourceSize { width: item.width; height: item.height }
31 source: model ? model.icon : ""
32 }
33 }
34
35 BorderImage {
36 anchors.centerIn: parent
37 opacity: 0.6
38 source: "../../Components/graphics/non-selected.sci"
39 width: parent.width + units.gu(1.5)
40 height: parent.height + units.gu(1.5)
41 }
42}
430
=== removed file 'qml/Dash/Video/VideoCarousel.qml'
--- qml/Dash/Video/VideoCarousel.qml 2013-11-20 00:10:01 +0000
+++ qml/Dash/Video/VideoCarousel.qml 1970-01-01 00:00:00 +0000
@@ -1,34 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import "../../Components"
19import ".."
20
21DashCarousel {
22 id: videosCarousel
23 tileAspectRatio: 198 / 288
24 minimumTileWidth: units.gu(13)
25 itemComponent: carouselDelegateVideo
26 selectedItemScaleFactor: 1.14
27 cacheBuffer: 1404 // 18px * 13gu * 6
28
29 Component {
30 id: carouselDelegateVideo
31 CarouselDelegateVideo {
32 }
33 }
34}
350
=== removed file 'qml/Dash/Video/VideoFilterGrid.qml'
--- qml/Dash/Video/VideoFilterGrid.qml 2013-11-22 13:53:00 +0000
+++ qml/Dash/Video/VideoFilterGrid.qml 1970-01-01 00:00:00 +0000
@@ -1,47 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19import "../../Components"
20import "../Generic"
21
22GenericFilterGrid {
23 id: videoFilterGrid
24
25 delegateWidth: units.gu(11)
26 delegateHeight: units.gu(15)
27 iconWidth: units.gu(11)
28 iconHeight: units.gu(11)
29
30 delegate: Tile {
31 id: tile
32 objectName: "delegate" + index
33 width: videoFilterGrid.cellWidth
34 height: videoFilterGrid.cellHeight
35 text: model.title
36 imageWidth: videoFilterGrid.iconWidth
37 imageHeight: videoFilterGrid.iconHeight
38 source: model.icon
39 maximumLineCount: 2
40 horizontalAlignment: Text.AlignLeft
41
42 style: VideoTileStyle {}
43
44 onClicked: videoFilterGrid.clicked(index, tile.y)
45 onPressAndHold: videoFilterGrid.pressAndHold(index, tile.y)
46 }
47}
480
=== removed file 'qml/Dash/Video/VideoTileStyle.qml'
--- qml/Dash/Video/VideoTileStyle.qml 2013-10-14 10:23:18 +0000
+++ qml/Dash/Video/VideoTileStyle.qml 1970-01-01 00:00:00 +0000
@@ -1,87 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19
20Item {
21 id: tile
22
23 anchors.fill: parent
24
25 Image {
26 id: icon
27 anchors {
28 top: parent.top
29 horizontalCenter: parent.horizontalCenter
30 }
31 width: styledItem.imageWidth
32 height: styledItem.imageHeight
33 source: "graphics/movie_icon_holder.png"
34
35 Image {
36 id: image
37 objectName: "image"
38 anchors {
39 fill: parent;
40 topMargin: units.gu(2);
41 bottomMargin: units.gu(2)
42 }
43 sourceSize { width: icon.width; height: icon.height }
44 asynchronous: true
45 cache: false
46 source: styledItem.source
47 fillMode: styledItem.fillMode
48 horizontalAlignment: Image.AlignHCenter
49 verticalAlignment: Image.AlignVCenter
50 }
51 }
52
53 UbuntuShape {
54 id: borderPressed
55 objectName: "borderPressed"
56
57 anchors.fill: icon
58 radius: "medium"
59 borderSource: "radius_pressed.sci"
60 opacity: styledItem.pressed ? 1.0 : 0.0
61 Behavior on opacity { NumberAnimation { duration: 200; easing.type: Easing.OutQuint } }
62 }
63
64 Label {
65 id: label
66 objectName: "label"
67 anchors {
68 baseline: icon.bottom
69 baselineOffset: units.gu(2)
70 left: icon.left
71 right: parent.right
72 rightMargin: units.gu(1)
73 leftMargin: units.dp(2)
74 }
75
76 color: Theme.palette.selected.backgroundText
77 opacity: 0.9
78 style: Text.Raised
79 styleColor: "black"
80 fontSize: "small"
81 elide: Text.ElideRight
82 horizontalAlignment: styledItem.horizontalAlignment
83 text: styledItem.text
84 wrapMode: Text.Wrap
85 maximumLineCount: styledItem.maximumLineCount
86 }
87}
880
=== removed directory 'qml/Dash/Video/graphics'
=== removed file 'qml/Dash/Video/graphics/icon_button_amazon@20.png'
89Binary files qml/Dash/Video/graphics/icon_button_amazon@20.png 2013-06-05 22:03:08 +0000 and qml/Dash/Video/graphics/icon_button_amazon@20.png 1970-01-01 00:00:00 +0000 differ1Binary files qml/Dash/Video/graphics/icon_button_amazon@20.png 2013-06-05 22:03:08 +0000 and qml/Dash/Video/graphics/icon_button_amazon@20.png 1970-01-01 00:00:00 +0000 differ
=== removed file 'qml/Dash/Video/graphics/icon_button_u1@20.png'
90Binary files qml/Dash/Video/graphics/icon_button_u1@20.png 2013-06-05 22:03:08 +0000 and qml/Dash/Video/graphics/icon_button_u1@20.png 1970-01-01 00:00:00 +0000 differ2Binary files qml/Dash/Video/graphics/icon_button_u1@20.png 2013-06-05 22:03:08 +0000 and qml/Dash/Video/graphics/icon_button_u1@20.png 1970-01-01 00:00:00 +0000 differ
=== removed file 'qml/Dash/Video/graphics/movie_icon_holder@27.png'
91Binary files qml/Dash/Video/graphics/movie_icon_holder@27.png 2013-10-09 17:06:13 +0000 and qml/Dash/Video/graphics/movie_icon_holder@27.png 1970-01-01 00:00:00 +0000 differ3Binary files qml/Dash/Video/graphics/movie_icon_holder@27.png 2013-10-09 17:06:13 +0000 and qml/Dash/Video/graphics/movie_icon_holder@27.png 1970-01-01 00:00:00 +0000 differ
=== modified file 'tests/autopilot/unity8/shell/emulators/dash.py'
--- tests/autopilot/unity8/shell/emulators/dash.py 2014-02-07 17:03:14 +0000
+++ tests/autopilot/unity8/shell/emulators/dash.py 2014-03-18 10:57:24 +0000
@@ -36,11 +36,9 @@
36 self.dash_content_list = self.wait_select_single(36 self.dash_content_list = self.wait_select_single(
37 'QQuickListView', objectName='dashContentList')37 'QQuickListView', objectName='dashContentList')
3838
39 def get_home_applications_grid(self):39 def get_applications_grid(self):
40 get_grid = self.get_scope('home').wait_select_single(40 get_grid = self.get_scope('clickscope').wait_select_single(
41 "GenericFilterGrid",41 'CardFilterGrid', objectName='local')
42 objectName="applications.scope"
43 )
44 return get_grid42 return get_grid
4543
46 def get_application_icon(self, text):44 def get_application_icon(self, text):
@@ -50,24 +48,22 @@
50 :param text: String containing the text of the icon to search for.48 :param text: String containing the text of the icon to search for.
5149
52 """50 """
53 app_grid = self.get_home_applications_grid()51 app_grid = self.get_applications_grid()
54 resp_grid = app_grid.wait_select_single('ResponsiveGridView')52 resp_grid = app_grid.wait_select_single('ResponsiveGridView')
55 return resp_grid.select_single('Tile', text=text)53 return resp_grid.select_single('Tile', text=text)
5654
57 def get_scope(self, scope_name='home'):55 def get_scope(self, scope_name='clickscope'):
58 scope_id = "%s.scope" % scope_name
59 return self.dash_content_list.select_single(56 return self.dash_content_list.select_single(
60 'QQuickLoader', scopeId=scope_id)57 'QQuickLoader', scopeId=scope_name)
6158
62 @autopilot_logging.log_action(logger.info)59 @autopilot_logging.log_action(logger.info)
63 def open_scope(self, scope_name):60 def open_scope(self, scope_id):
64 """Open a dash scope.61 """Open a dash scope.
6562
66 :parameter scope_name: The name of the scope.63 :parameter scope_id: The id of the scope.
67 :return: The scope.64 :return: The scope.
6865
69 """66 """
70 scope_id = "%s.scope" % scope_name
71 scope_loader = self._get_scope_loader(scope_id)67 scope_loader = self._get_scope_loader(scope_id)
72 if scope_loader.isCurrent:68 if scope_loader.isCurrent:
73 logger.info('The scope is already open.')69 logger.info('The scope is already open.')
@@ -84,7 +80,7 @@
84 'No scope found with id {0}'.format(scope_id))80 'No scope found with id {0}'.format(scope_id))
8581
86 def _get_scope_from_loader(self, loader):82 def _get_scope_from_loader(self, loader):
87 if loader.scopeId == 'applications.scope':83 if loader.scopeId == 'clickscope':
88 return loader.select_single(DashApps)84 return loader.select_single(DashApps)
89 else:85 else:
90 return loader.select_single(GenericScopeView)86 return loader.select_single(GenericScopeView)
@@ -115,7 +111,7 @@
115 original_index = self.dash_content_list.currentIndex111 original_index = self.dash_content_list.currentIndex
116 # Scroll on the border of the page header, because some scopes have112 # Scroll on the border of the page header, because some scopes have
117 # contents that can be scrolled horizontally.113 # contents that can be scrolled horizontally.
118 page_header = self.select_single('PageHeader')114 page_header = self._get_page_header()
119 border = page_header.select_single('QQuickBorderImage')115 border = page_header.select_single('QQuickBorderImage')
120 start_x = border.width / 3116 start_x = border.width / 3
121 stop_x = border.width / 3 * 2117 stop_x = border.width / 3 * 2
@@ -123,12 +119,15 @@
123 self.pointing_device.drag(start_x, start_y, stop_x, stop_y)119 self.pointing_device.drag(start_x, start_y, stop_x, stop_y)
124 self.dash_content_list.currentIndex.wait_for(original_index - 1)120 self.dash_content_list.currentIndex.wait_for(original_index - 1)
125121
122 def _get_page_header(self):
123 return self.select_single('PageHeader', objectName='pageHeader')
124
126 @autopilot_logging.log_action(logger.info)125 @autopilot_logging.log_action(logger.info)
127 def _scroll_to_right_scope(self):126 def _scroll_to_right_scope(self):
128 original_index = self.dash_content_list.currentIndex127 original_index = self.dash_content_list.currentIndex
129 # Scroll on the border of the page header, because some scopes have128 # Scroll on the border of the page header, because some scopes have
130 # contents that can be scrolled horizontally.129 # contents that can be scrolled horizontally.
131 page_header = self.select_single('PageHeader')130 page_header = self._get_page_header()
132 border = page_header.select_single('QQuickBorderImage')131 border = page_header.select_single('QQuickBorderImage')
133 start_x = border.width / 3 * 2132 start_x = border.width / 3 * 2
134 stop_x = border.width / 3133 stop_x = border.width / 3
@@ -137,24 +136,9 @@
137 self.dash_content_list.currentIndex.wait_for(original_index + 1)136 self.dash_content_list.currentIndex.wait_for(original_index + 1)
138137
139138
140class DashPreview(emulators.UnityEmulatorBase):
141 """Autopilot emulator for the generic preview."""
142
143 def get_details(self):
144 """Return the details of the open preview."""
145 title = self.select_single('Label', objectName='titleLabel').text
146 subtitle = self.select_single(
147 'Label', objectName='subtitleLabel').text
148 description = self.select_single(
149 'Label', objectName='descriptionLabel').text
150 return dict(title=title, subtitle=subtitle, description=description)
151
152
153class GenericScopeView(emulators.UnityEmulatorBase):139class GenericScopeView(emulators.UnityEmulatorBase):
154 """Autopilot emulator for generic scopes."""140 """Autopilot emulator for generic scopes."""
155141
156 preview_class = DashPreview
157
158 @autopilot_logging.log_action(logger.info)142 @autopilot_logging.log_action(logger.info)
159 def open_preview(self, category, app_name):143 def open_preview(self, category, app_name):
160 """Open the preview of an application.144 """Open the preview of an application.
@@ -164,15 +148,13 @@
164148
165 """149 """
166 category_element = self._get_category_element(category)150 category_element = self._get_category_element(category)
167 icon = category_element.select_single('Tile', text=app_name)151 icon = category_element.select_single('Card', title=app_name)
168 # FIXME some categories need a long press in order to see the preview.152 # FIXME some categories need a long press in order to see the preview.
169 # Some categories do not show previews, like recent apps.153 # Some categories do not show previews, like recent apps.
170 # --elopio - 2014-1-14154 # --elopio - 2014-1-14
171 self.pointing_device.click_object(icon)155 self.pointing_device.click_object(icon)
172 preview = self.get_root_instance().wait_select_single(156 return self.get_root_instance().wait_select_single(
173 self.preview_class, isCurrent=True)157 'PreviewListView', objectName='dashContentPreviewList')
174 preview.showProcessingAction.wait_for(False)
175 return preview
176158
177 def _get_category_element(self, category):159 def _get_category_element(self, category):
178 try:160 try:
@@ -183,24 +165,9 @@
183 'No category found with name {}'.format(category))165 'No category found with name {}'.format(category))
184166
185167
186class AppPreview(DashPreview):
187 """Autopilot emulator for the application preview."""
188
189 def get_details(self):
190 """Return the details of the application showed in its preview."""
191 details = super(AppPreview, self).get_details()
192 # TODO return screenshots, icon, rating and reviews.
193 # --elopio - 2014-1-15
194 return dict(
195 title=details.get('title'), publisher=details.get('subtitle'),
196 description=details.get('description'))
197
198
199class DashApps(GenericScopeView):168class DashApps(GenericScopeView):
200 """Autopilot emulator for the applications scope."""169 """Autopilot emulator for the applications scope."""
201170
202 preview_class = AppPreview
203
204 def get_applications(self, category):171 def get_applications(self, category):
205 """Return the list of applications on a category.172 """Return the list of applications on a category.
206173
@@ -208,7 +175,11 @@
208175
209 """176 """
210 category_element = self._get_category_element(category)177 category_element = self._get_category_element(category)
211 application_tiles = category_element.select_many('Tile')178 application_tiles = category_element.select_many('Card')
212 # TODO return them on the same order they are displayed.179 # TODO return them on the same order they are displayed.
213 # --elopio - 2014-1-15180 # --elopio - 2014-1-15
214 return [tile.text for tile in application_tiles]181 result = []
182 for card in application_tiles:
183 if card.objectName != 'cardToolCard':
184 result.append(card)
185 return result
215186
=== modified file 'tests/autopilot/unity8/shell/emulators/main_window.py'
--- tests/autopilot/unity8/shell/emulators/main_window.py 2014-02-12 06:11:16 +0000
+++ tests/autopilot/unity8/shell/emulators/main_window.py 2014-03-18 10:57:24 +0000
@@ -42,10 +42,6 @@
42 objectName="greeterContentLoader"42 objectName="greeterContentLoader"
43 )43 )
4444
45 def get_greeter_background(self):
46 return self.select_single(
47 "CrossFadeImage", objectName="greeterBackground")
48
49 def get_login_loader(self):45 def get_login_loader(self):
50 return self.select_single("QQuickLoader", objectName="loginLoader")46 return self.select_single("QQuickLoader", objectName="loginLoader")
5147
5248
=== modified file 'tests/autopilot/unity8/shell/tests/__init__.py'
--- tests/autopilot/unity8/shell/tests/__init__.py 2014-02-22 00:12:49 +0000
+++ tests/autopilot/unity8/shell/tests/__init__.py 2014-03-18 10:57:24 +0000
@@ -376,7 +376,7 @@
376376
377 def assertUnityReady(self):377 def assertUnityReady(self):
378 dash = self.get_dash()378 dash = self.get_dash()
379 home_scope = dash.get_scope('home')379 home_scope = dash.get_scope('clickscope')
380380
381 # FIXME! There is a huge timeout here for when we're doing CI on381 # FIXME! There is a huge timeout here for when we're doing CI on
382 # VMs. See lp:1203715382 # VMs. See lp:1203715
383383
=== modified file 'tests/autopilot/unity8/shell/tests/test_emulators.py'
--- tests/autopilot/unity8/shell/tests/test_emulators.py 2014-02-22 00:12:49 +0000
+++ tests/autopilot/unity8/shell/tests/test_emulators.py 2014-03-18 10:57:24 +0000
@@ -60,14 +60,13 @@
60 self.dash.open_scope, scope_name)60 self.dash.open_scope, scope_name)
6161
62 self.assertEqual(62 self.assertEqual(
63 'No scope found with id unexisting.scope', str(exception))63 'No scope found with id unexisting', str(exception))
64 self.assertFalse(mock_pointer.called)64 self.assertFalse(mock_pointer.called)
6565
66 def test_open_already_opened_scope(self):66 def test_open_already_opened_scope(self):
67 scope_id = self._get_current_scope_id()67 scope_id = self._get_current_scope_id()
68 with mock.patch.object(self.dash, 'pointing_device') as mock_pointer:68 with mock.patch.object(self.dash, 'pointing_device') as mock_pointer:
69 scope = self.dash.open_scope(self._get_scope_name_from_id(69 scope = self.dash.open_scope(scope_id)
70 scope_id))
7170
72 self.assertFalse(mock_pointer.called)71 self.assertFalse(mock_pointer.called)
73 self._assert_scope_is_opened(scope, scope_id)72 self._assert_scope_is_opened(scope, scope_id)
@@ -83,12 +82,11 @@
83 return scope.scopeId82 return scope.scopeId
8483
85 def test_open_scope_to_the_right(self):84 def test_open_scope_to_the_right(self):
86 leftmost_scope = self._get_scope_name_from_id(85 leftmost_scope = self._get_leftmost_scope_id()
87 self._get_leftmost_scope_id())
88 self.dash.open_scope(leftmost_scope)86 self.dash.open_scope(leftmost_scope)
8987
90 scope_id = self._get_rightmost_scope_id()88 scope_id = self._get_rightmost_scope_id()
91 scope = self.dash.open_scope(self._get_scope_name_from_id(scope_id))89 scope = self.dash.open_scope(scope_id)
92 self._assert_scope_is_opened(scope, scope_id)90 self._assert_scope_is_opened(scope, scope_id)
9391
94 def _get_leftmost_scope_id(self):92 def _get_leftmost_scope_id(self):
@@ -104,10 +102,6 @@
104 'QQuickItem')[0]102 'QQuickItem')[0]
105 return item.get_children_by_type('QQuickLoader')103 return item.get_children_by_type('QQuickLoader')
106104
107 def _get_scope_name_from_id(self, scope_id):
108 if scope_id.endswith('.scope'):
109 return scope_id[:-6]
110
111 def _get_rightmost_scope_id(self):105 def _get_rightmost_scope_id(self):
112 scope_loaders = self._get_scope_loaders()106 scope_loaders = self._get_scope_loaders()
113 rightmost_scope_loader = scope_loaders[0]107 rightmost_scope_loader = scope_loaders[0]
@@ -117,23 +111,22 @@
117 return rightmost_scope_loader.scopeId111 return rightmost_scope_loader.scopeId
118112
119 def test_open_scope_to_the_left(self):113 def test_open_scope_to_the_left(self):
120 rightmost_scope = self._get_scope_name_from_id(114 rightmost_scope = self._get_rightmost_scope_id()
121 self._get_rightmost_scope_id())
122 self.dash.open_scope(rightmost_scope)115 self.dash.open_scope(rightmost_scope)
123116
124 scope_id = self._get_leftmost_scope_id()117 scope_id = self._get_leftmost_scope_id()
125 scope = self.dash.open_scope(self._get_scope_name_from_id(scope_id))118 scope = self.dash.open_scope(scope_id)
126 self._assert_scope_is_opened(scope, scope_id)119 self._assert_scope_is_opened(scope, scope_id)
127120
128 def test_open_generic_scope(self):121 def test_open_generic_scope(self):
129 scope_id = 'home.scope'122 scope_id = 'scopes'
130 scope = self.dash.open_scope(self._get_scope_name_from_id(scope_id))123 scope = self.dash.open_scope(scope_id)
131 self._assert_scope_is_opened(scope, scope_id)124 self._assert_scope_is_opened(scope, scope_id)
132 self.assertIsInstance(scope, dash_emulators.GenericScopeView)125 self.assertIsInstance(scope, dash_emulators.GenericScopeView)
133126
134 def test_open_applications_scope(self):127 def test_open_applications_scope(self):
135 scope_id = 'applications.scope'128 scope_id = 'clickscope'
136 scope = self.dash.open_scope(self._get_scope_name_from_id(scope_id))129 scope = self.dash.open_scope(scope_id)
137 self._assert_scope_is_opened(scope, scope_id)130 self._assert_scope_is_opened(scope, scope_id)
138 self.assertIsInstance(scope, dash_emulators.DashApps)131 self.assertIsInstance(scope, dash_emulators.DashApps)
139132
@@ -144,36 +137,24 @@
144 # Set up the fake scopes before launching unity.137 # Set up the fake scopes before launching unity.
145 self.useFixture(fixture_setup.FakeScopes())138 self.useFixture(fixture_setup.FakeScopes())
146 super(GenericScopeViewEmulatorTestCase, self).setUp()139 super(GenericScopeViewEmulatorTestCase, self).setUp()
147 self.home_scope = self.dash.open_scope('home')140 self.generic_scope = self.dash.open_scope('MockScope1')
148141
149 def test_open_preview(self):142 def test_open_preview(self):
150 preview = self.home_scope.open_preview('0', 'Title.0')143 preview = self.generic_scope.open_preview('0', 'Title.0.0')
151 self.assertIsInstance(preview, dash_emulators.DashPreview)144 preview.x.wait_for(0)
152 self.assertTrue(preview.isCurrent)
153 self.assertFalse(preview.showProcessingAction)
154
155 def test_get_details(self):
156 expected_details = dict(
157 title='Title', subtitle='Subtitle', description='Description')
158
159 preview = self.home_scope.open_preview('0', 'Title.0')
160 details = preview.get_details()
161
162 self.assertEqual(expected_details, details)
163
164145
165class DashAppsEmulatorTestCase(DashBaseTestCase):146class DashAppsEmulatorTestCase(DashBaseTestCase):
166147
167 available_applications = [148 available_applications = [
168 'Title.1', 'Title.21', 'Title.41', 'Title.61', 'Title.81',149 'Title.2.0', 'Title.2.1', 'Title.2.2', 'Title.2.3', 'Title.2.4',
169 'Title.101', 'Title.121', 'Title.141', 'Title.161', 'Title.181',150 'Title.2.5', 'Title.2.6', 'Title.2.7', 'Title.2.8', 'Title.2.9',
170 'Title.201', 'Title.221', 'Title.241', 'Title.261', 'Title.281']151 'Title.2.9', 'Title.2.10', 'Title.2.11']
171152
172 def setUp(self):153 def setUp(self):
173 # Set up the fake scopes before launching unity.154 # Set up the fake scopes before launching unity.
174 self.useFixture(fixture_setup.FakeScopes())155 self.useFixture(fixture_setup.FakeScopes())
175 super(DashAppsEmulatorTestCase, self).setUp()156 super(DashAppsEmulatorTestCase, self).setUp()
176 self.applications_scope = self.dash.open_scope('applications')157 self.applications_scope = self.dash.open_scope('clickscope')
177158
178 def test_get_applications_with_unexisting_category(self):159 def test_get_applications_with_unexisting_category(self):
179 exception = self.assertRaises(160 exception = self.assertRaises(
@@ -185,34 +166,27 @@
185 'No category found with name unexisting category', str(exception))166 'No category found with name unexisting category', str(exception))
186167
187 def test_get_applications_should_return_list_with_names(self):168 def test_get_applications_should_return_list_with_names(self):
188 category = 'installed'169 category = '2'
189 expected_apps_count = self._get_number_of_application_slots(category)170 expected_apps_count = self._get_number_of_application_slots(category)
190 expected_applications = self.available_applications[171 expected_applications = self.available_applications[
191 :expected_apps_count]172 :expected_apps_count]
192173
193 applications = self.applications_scope.get_applications(category)174 applications = self.applications_scope.get_applications(category)
175 applications_titles = []
176 for application in applications:
177 cardHeader = application.select_single('CardHeader')
178 applications_titles.append(cardHeader.title)
194179
195 self.assertThat(applications, HasLength(expected_apps_count))180 self.assertThat(applications, HasLength(expected_apps_count))
196 for expected in expected_applications:181 for expected in expected_applications:
197 self.assertThat(applications, Contains(expected))182 self.assertThat(applications_titles, Contains(expected))
198183
199 def _get_number_of_application_slots(self, category):184 def _get_number_of_application_slots(self, category):
200 category_element = self.applications_scope._get_category_element(185 category_element = self.applications_scope._get_category_element(
201 category)186 category)
202 grid = category_element.select_single('GenericFilterGrid')187 grid = category_element.select_single('CardFilterGrid')
203 return grid.columns * grid.rows188 return grid.columns * grid.rows
204189
205 def test_open_preview(self):190 def test_open_preview(self):
206 preview = self.applications_scope.open_preview('installed', 'Title.1')191 preview = self.applications_scope.open_preview('2', 'Title.2.1')
207 self.assertIsInstance(preview, dash_emulators.AppPreview)192 preview.x.wait_for(0)
208 self.assertTrue(preview.isCurrent)
209 self.assertFalse(preview.showProcessingAction)
210
211 def test_get_details(self):
212 expected_details = dict(
213 title='Title', publisher='', description='Description')
214
215 preview = self.applications_scope.open_preview('installed', 'Title.1')
216 details = preview.get_details()
217
218 self.assertEqual(expected_details, details)
219193
=== removed file 'tests/autopilot/unity8/shell/tests/test_greeter.py'
--- tests/autopilot/unity8/shell/tests/test_greeter.py 2013-10-22 15:59:23 +0000
+++ tests/autopilot/unity8/shell/tests/test_greeter.py 1970-01-01 00:00:00 +0000
@@ -1,38 +0,0 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2#
3# Unity Autopilot Test Suite
4# Copyright (C) 2012-2013 Canonical
5#
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation, either version 3 of the License, or
9# (at your option) any later version.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program. If not, see <http://www.gnu.org/licenses/>.
18#
19
20from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
21
22from testtools.matchers import Equals
23
24class TestGreeter(UnityTestCase):
25
26 """Tests the Shell Greeter."""
27
28 scenarios = _get_device_emulation_scenarios()
29
30 def test_greeter_background(self):
31 """Test that the background of the greeter and the background of the shell are placed correctly
32
33 """
34 self.launch_unity()
35 self.main_window.get_greeter()
36 greeter_background = self.main_window.get_greeter_background()
37 shell_background = self.main_window.get_shell_background()
38 self.assertThat(greeter_background.globalRect, Equals(shell_background.globalRect))
390
=== modified file 'tests/mocks/Unity/CMakeLists.txt'
--- tests/mocks/Unity/CMakeLists.txt 2014-02-07 09:55:56 +0000
+++ tests/mocks/Unity/CMakeLists.txt 2014-03-18 10:57:24 +0000
@@ -18,14 +18,14 @@
18add_definitions(-DQT_NO_KEYWORDS)18add_definitions(-DQT_NO_KEYWORDS)
1919
20set(UnityQML_SOURCES20set(UnityQML_SOURCES
21 categoryresults.cpp
22 iconutils.cpp21 iconutils.cpp
23 fake_applications_scope.cpp
24 fake_preview.cpp
25 fake_scope.cpp22 fake_scope.cpp
26 fake_scopes.cpp23 fake_scopes.cpp
27 fake_categories.cpp24 fake_categories.cpp
28 scopes-ng/fake_preview_model.cpp25 fake_resultsmodel.cpp
26 fake_previewmodel.cpp
27 fake_previewstack.cpp
28 fake_previewwidgetmodel.cpp
29 fake_unity_plugin.cpp29 fake_unity_plugin.cpp
30)30)
3131
3232
=== removed file 'tests/mocks/Unity/categoryresults.cpp'
--- tests/mocks/Unity/categoryresults.cpp 2013-11-12 18:21:40 +0000
+++ tests/mocks/Unity/categoryresults.cpp 1970-01-01 00:00:00 +0000
@@ -1,121 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * Authors:
5 * Michal Hruby <michal.hruby@canonical.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 3.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20// self
21#include "categoryresults.h"
22#include "iconutils.h"
23
24// TODO: use something from libunity once it's public
25enum ResultsColumn {
26 URI,
27 ICON_HINT,
28 CATEGORY,
29 RESULT_TYPE,
30 MIMETYPE,
31 TITLE,
32 COMMENT,
33 DND_URI,
34 METADATA
35};
36
37CategoryResults::CategoryResults(QObject* parent)
38 : DeeListModel(parent)
39 , m_categoryIndex(-1)
40{
41 m_roles[CategoryResults::RoleUri] = "uri";
42 m_roles[CategoryResults::RoleIconHint] = "icon";
43 m_roles[CategoryResults::RoleCategory] = "category";
44 m_roles[CategoryResults::RoleMimetype] = "mimetype";
45 m_roles[CategoryResults::RoleTitle] = "title";
46 m_roles[CategoryResults::RoleComment] = "comment";
47 m_roles[CategoryResults::RoleDndUri] = "dndUri";
48 m_roles[CategoryResults::RoleMetadata] = "metadata";
49 m_roles[CategoryResults::RoleRendererHints] = "rendererHints";
50}
51
52int CategoryResults::categoryIndex() const
53{
54 return m_categoryIndex;
55}
56
57void CategoryResults::setCategoryIndex(int index)
58{
59 if (m_categoryIndex != index) {
60 m_categoryIndex = index;
61 Q_EMIT categoryIndexChanged(m_categoryIndex);
62 }
63}
64
65QHash<int, QByteArray>
66CategoryResults::roleNames() const
67{
68 return m_roles;
69}
70
71QVariant
72CategoryResults::data(const QModelIndex& index, int role) const
73{
74 if (!index.isValid()) {
75 return QVariant();
76 }
77
78 switch (role) {
79 case RoleUri:
80 return DeeListModel::data(index, ResultsColumn::URI);
81 case RoleIconHint: {
82 QString giconString(DeeListModel::data(index, ResultsColumn::ICON_HINT).toString());
83 if (giconString.isEmpty()) {
84 QString mimetype(DeeListModel::data(index, ResultsColumn::MIMETYPE).toString());
85 QString uri(DeeListModel::data(index, ResultsColumn::URI).toString());
86 QString thumbnailerUri(uriToThumbnailerProviderString(uri, mimetype, DeeListModel::data(index, ResultsColumn::METADATA).toHash()));
87 if (!thumbnailerUri.isNull()) {
88 return QVariant::fromValue(thumbnailerUri);
89 }
90 }
91 return QVariant::fromValue(gIconToDeclarativeImageProviderString(giconString));
92 }
93 case RoleCategory:
94 return DeeListModel::data(index, ResultsColumn::CATEGORY);
95 case RoleMimetype:
96 return DeeListModel::data(index, ResultsColumn::MIMETYPE);
97 case RoleTitle:
98 return DeeListModel::data(index, ResultsColumn::TITLE);
99 case RoleComment:
100 return DeeListModel::data(index, ResultsColumn::COMMENT);
101 case RoleDndUri:
102 return DeeListModel::data(index, ResultsColumn::DND_URI);
103 case RoleMetadata:
104 return DeeListModel::data(index, ResultsColumn::METADATA);
105 case RoleRendererHints:
106 {
107 QVariantHash hash(DeeListModel::data(index, ResultsColumn::METADATA).toHash());
108 if (hash.contains("content")) {
109 QVariantMap hints;
110 QVariantHash innerHash(hash["content"].toHash());
111 if (innerHash.contains("scope_disabled")) {
112 hints["scope_disabled"] = innerHash["scope_disabled"];
113 }
114 return hints.empty() ? QVariant() : QVariant::fromValue(hints);
115 }
116 return QVariant();
117 }
118 default:
119 return QVariant();
120 }
121}
1220
=== removed file 'tests/mocks/Unity/categoryresults.h'
--- tests/mocks/Unity/categoryresults.h 2013-11-12 18:21:40 +0000
+++ tests/mocks/Unity/categoryresults.h 1970-01-01 00:00:00 +0000
@@ -1,68 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * Authors:
5 * Michal Hruby <michal.hruby@canonical.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 3.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20
21#ifndef CATEGORY_RESULTS_H
22#define CATEGORY_RESULTS_H
23
24// dee-qt
25#include "deelistmodel.h"
26
27class Q_DECL_EXPORT CategoryResults : public DeeListModel
28{
29 Q_OBJECT
30
31 Q_ENUMS(Roles)
32
33 Q_PROPERTY(int categoryIndex READ categoryIndex WRITE setCategoryIndex NOTIFY categoryIndexChanged)
34
35public:
36 explicit CategoryResults(QObject* parent = 0);
37
38 enum Roles {
39 RoleUri,
40 RoleIconHint,
41 RoleCategory,
42 RoleMimetype,
43 RoleTitle,
44 RoleComment,
45 RoleDndUri,
46 RoleMetadata,
47 RoleRendererHints
48 };
49
50 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
51
52 QHash<int, QByteArray> roleNames() const;
53
54 /* getters */
55 int categoryIndex() const;
56
57 /* setters */
58 void setCategoryIndex(int index);
59
60Q_SIGNALS:
61 void categoryIndexChanged(int index);
62
63private:
64 QHash<int, QByteArray> m_roles;
65 int m_categoryIndex;
66};
67
68#endif // CATEGORY_RESULTS_H
690
=== removed file 'tests/mocks/Unity/fake_applications_scope.cpp'
--- tests/mocks/Unity/fake_applications_scope.cpp 2014-01-16 17:39:35 +0000
+++ tests/mocks/Unity/fake_applications_scope.cpp 1970-01-01 00:00:00 +0000
@@ -1,76 +0,0 @@
1/*
2 * Copyright (C) 2013, 2014 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include "fake_applications_scope.h"
18
19static const gchar * categories_model_schema[] = {
20 "s", //ID
21 "s", // DISPLAY_NAME
22 "s", // ICON_HINT
23 "s", // RENDERER_NAME
24 "a{sv}" // HINTS
25};
26
27ApplicationsScope::ApplicationsScope(bool visible, QObject* parent)
28 : Scope(parent)
29{
30 m_id = "applications.scope";
31 m_name = "Applications";
32 m_visible = visible;
33 m_previewRendererName = "preview-application";
34 m_categories->setModel(createCategoriesModel());
35}
36
37DeeModel* ApplicationsScope::createCategoriesModel()
38{
39 DeeModel* category_model = dee_sequence_model_new();
40 dee_model_set_schema_full(category_model, categories_model_schema, G_N_ELEMENTS(categories_model_schema));
41 GVariant* hints = g_variant_new_array(g_variant_type_element(G_VARIANT_TYPE_VARDICT), NULL, 0);
42
43 GVariant* children[1];
44 children[0] = g_variant_new_dict_entry(g_variant_new_string("content-type"),
45 g_variant_new_variant(g_variant_new_string("apps")));
46 GVariant* recentHints = g_variant_new_array(g_variant_type_element(G_VARIANT_TYPE_VARDICT), children, 1);
47 dee_model_append(category_model,
48 "recent",
49 "Recent",
50 "gtk-apply",
51 "special",
52 recentHints);
53
54 dee_model_append(category_model,
55 "installed",
56 "Installed",
57 "gtk-apply",
58 "grid",
59 hints);
60
61 dee_model_append(category_model,
62 "suggested",
63 "Suggested",
64 "gtk-apply",
65 "grid",
66 hints);
67
68 dee_model_append(category_model,
69 "outdated",
70 "Outdaded",
71 "gtk-apply",
72 "grid",
73 hints);
74
75 return category_model;
76}
770
=== removed file 'tests/mocks/Unity/fake_applications_scope.h'
--- tests/mocks/Unity/fake_applications_scope.h 2013-09-02 20:34:05 +0000
+++ tests/mocks/Unity/fake_applications_scope.h 1970-01-01 00:00:00 +0000
@@ -1,33 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef FAKE_APPLICATIONS_SCOPE_H
18#define FAKE_APPLICATIONS_SCOPE_H
19
20#include "fake_scope.h"
21
22class ApplicationsScope : public Scope
23{
24 Q_OBJECT
25
26public:
27 ApplicationsScope(bool visible, QObject* parent = 0);
28
29private:
30 DeeModel* createCategoriesModel();
31};
32
33#endif // FAKE_APPLICATIONS_SCOPE_H
340
=== modified file 'tests/mocks/Unity/fake_categories.cpp'
--- tests/mocks/Unity/fake_categories.cpp 2013-10-02 13:02:16 +0000
+++ tests/mocks/Unity/fake_categories.cpp 2014-03-18 10:57:24 +0000
@@ -19,100 +19,21 @@
19// self19// self
20#include "fake_categories.h"20#include "fake_categories.h"
2121
22// local22#include "fake_resultsmodel.h"
23#include "categoryresults.h"23
2424Categories::Categories(int category_count, QObject* parent)
25#define CATEGORY_COLUMN 225 : QAbstractListModel(parent)
2626 , m_category_count(category_count)
27// TODO: use something from libunity once it's public
28enum CategoryColumn {
29 ID,
30 DISPLAY_NAME,
31 ICON_HINT,
32 RENDERER_NAME,
33 HINTS
34};
35
36Categories::Categories(QObject* parent)
37 : DeeListModel(parent)
38{27{
39 // FIXME: need to clean up unused filters on countChanged
40 m_roles[Categories::RoleCategoryId] = "categoryId";28 m_roles[Categories::RoleCategoryId] = "categoryId";
41 m_roles[Categories::RoleName] = "name";29 m_roles[Categories::RoleName] = "name";
42 m_roles[Categories::RoleIcon] = "icon";30 m_roles[Categories::RoleIcon] = "icon";
31 m_roles[Categories::RoleRawRendererTemplate] = "rawRendererTemplate";
43 m_roles[Categories::RoleRenderer] = "renderer";32 m_roles[Categories::RoleRenderer] = "renderer";
44 m_roles[Categories::RoleContentType] = "contentType";33 m_roles[Categories::RoleComponents] = "components";
45 m_roles[Categories::RoleRendererHint] = "rendererHint";34 m_roles[Categories::RoleProgressSource] = "progressSource";
46 m_roles[Categories::RoleHints] = "hints";
47 m_roles[Categories::RoleResults] = "results";35 m_roles[Categories::RoleResults] = "results";
48 m_roles[Categories::RoleCount] = "count";36 m_roles[Categories::RoleCount] = "count";
49
50 // TODO This should not be needed but accumulatting the count changes
51 // makes the visualization more stable and also makes crashes on fast
52 // change of the search term harder to reproduce
53 m_timer.setSingleShot(true);
54 m_timer.setInterval(50);
55 connect(&m_timer, SIGNAL(timeout()), this, SLOT(onEmitCountChanged()));
56}
57
58DeeListModel*
59Categories::getFilter(int index) const
60{
61 if (!m_filters.contains(index)) {
62 auto results = new CategoryResults ();
63 results->setCategoryIndex(index);
64 connect(results, SIGNAL(countChanged()), this, SLOT(onCountChanged()));
65
66 unsigned cat_index = static_cast<unsigned>(index);
67 auto model = getResultsForCategory(cat_index);
68 results->setModel(model);
69
70 m_filters.insert(index, results);
71 }
72
73 return m_filters[index];
74}
75
76void
77Categories::onCountChanged()
78{
79 DeeListModel* filter = qobject_cast<DeeListModel*>(sender());
80 if (filter) {
81 m_timerFilters << filter;
82 m_timer.start();
83 }
84}
85
86void Categories::onRowCountChanged()
87{
88 QAbstractItemModel* model = qobject_cast<QAbstractItemModel*>(sender());
89 // find the corresponding category index
90 for (auto iter = m_overriddenCategories.begin(); iter != m_overriddenCategories.end(); ++iter) {
91 if (iter.value() == model) {
92 for (int i = 0; i < rowCount(); i++) {
93 auto id = data(index(i), RoleCategoryId).toString();
94 if (id != iter.key()) continue;
95 QVector<int> roles;
96 roles.append(RoleCount);
97 QModelIndex changedIndex = index(i);
98 Q_EMIT dataChanged(changedIndex, changedIndex, roles);
99 break;
100 }
101 }
102 }
103}
104
105void
106Categories::onEmitCountChanged()
107{
108 QVector<int> roles;
109 roles.append(Categories::RoleCount);
110 Q_FOREACH(DeeListModel* results, m_timerFilters) {
111 auto cat_results = qobject_cast<CategoryResults*>(results);
112 QModelIndex changedIndex = index(cat_results->categoryIndex());
113 Q_EMIT dataChanged(changedIndex, changedIndex, roles);
114 }
115 m_timerFilters.clear();
116}37}
11738
118QHash<int, QByteArray>39QHash<int, QByteArray>
@@ -121,92 +42,44 @@
121 return m_roles;42 return m_roles;
122}43}
12344
124void Categories::onOverrideModelDestroyed()45int Categories::rowCount(const QModelIndex& /*parent*/) const
125{46{
126 QObject* model = sender();47 return m_category_count + m_specialCategories.count();
127 auto iter = m_overriddenCategories.begin();48}
128 while (iter != m_overriddenCategories.end()) {49
129 if (iter.value() == model) {50void Categories::addSpecialCategory(QString const& categoryId, QString const& name, QString const& icon, QString const& rawTemplate, QObject* countObject)
130 iter = m_overriddenCategories.erase(iter);51{
131 continue;52 CategoryData catData;
132 }53 catData.categoryId = categoryId;
133 ++iter;54 catData.name = name;
134 }55 catData.icon = icon;
135}56 catData.rawTemplate = rawTemplate;
13657 catData.countObject = countObject;
137void Categories::overrideResults(const QString& categoryId, QAbstractItemModel* model)58
138{59 beginInsertRows(QModelIndex(), 0, 0);
139 m_overriddenCategories[categoryId] = model;60 m_specialCategories.prepend(catData);
140 // watch the model61 endInsertRows();
141 connect(model, &QObject::destroyed, this, &Categories::onOverrideModelDestroyed);62
142 connect(model, &QAbstractItemModel::rowsInserted, this, &Categories::onRowCountChanged);63 if (countObject) {
143 connect(model, &QAbstractItemModel::rowsRemoved, this, &Categories::onRowCountChanged);64 connect(countObject, SIGNAL(countChanged()), this, SLOT(countChanged()));
144 connect(model, &QAbstractItemModel::modelReset, this, &Categories::onRowCountChanged);65 }
14566}
146 // emit the dataChanged signal if the category is already in the model67
147 for (int i = 0; i < rowCount(); i++) {68void Categories::countChanged()
148 auto id = data(index(i), RoleCategoryId).toString();69{
149 if (id != categoryId) continue;70 QObject* countObject = sender();
150 QVector<int> roles;71
151 roles.append(RoleCount);72 for (int i = 0; i < m_specialCategories.count(); ++i) {
152 roles.append(RoleResults);73 const CategoryData &catData = m_specialCategories.at(i);
153 QModelIndex changedIndex = index(i);74 if (catData.countObject == countObject) {
154 Q_EMIT dataChanged(changedIndex, changedIndex, roles);75 QVector<int> roles;
155 break;76 roles.append(RoleCount);
156 }77
157}78 QModelIndex changedIndex(index(i));
15879 dataChanged(changedIndex, changedIndex, roles);
159void Categories::setResultModel(DeeModel* model)80 break;
160{81 }
161 // FIXME: should ref it82 }
162 m_dee_results = model;
163}
164
165
166static void category_filter_map_func (DeeModel* orig_model,
167 DeeFilterModel* filter_model,
168 gpointer user_data)
169{
170 DeeModelIter* iter;
171 DeeModelIter* end;
172 unsigned index = GPOINTER_TO_UINT(user_data);
173
174 iter = dee_model_get_first_iter(orig_model);
175 end = dee_model_get_last_iter(orig_model);
176 while (iter != end) {
177 unsigned category_index = dee_model_get_uint32(orig_model, iter, CATEGORY_COLUMN);
178 if (index == category_index) {
179 dee_filter_model_append_iter(filter_model, iter);
180 }
181 iter = dee_model_next(orig_model, iter);
182 }
183}
184
185static gboolean category_filter_notify_func (DeeModel* orig_model,
186 DeeModelIter* orig_iter,
187 DeeFilterModel* filter_model,
188 gpointer user_data)
189{
190 unsigned index = GPOINTER_TO_UINT(user_data);
191 unsigned category_index = dee_model_get_uint32(orig_model, orig_iter, CATEGORY_COLUMN);
192
193 if (index != category_index)
194 return FALSE;
195
196 dee_filter_model_insert_iter_with_original_order(filter_model, orig_iter);
197 return TRUE;
198}
199
200DeeModel* Categories::getResultsForCategory(unsigned cat_index) const
201{
202 DeeFilter filter;
203 filter.map_func = category_filter_map_func;
204 filter.map_notify = category_filter_notify_func;
205 filter.destroy = nullptr;
206 filter.userdata = GUINT_TO_POINTER(cat_index);
207
208 DeeModel* filtered_model = dee_filter_model_new(m_dee_results, &filter);
209 return filtered_model;
210}83}
21184
212QVariant85QVariant
@@ -216,44 +89,86 @@
216 return QVariant();89 return QVariant();
217 }90 }
21891
219 switch (role) {92 ResultsModel *resultsModel = m_resultsModels[index.row()];
220 case RoleCategoryId:93 if (!resultsModel) {
221 return DeeListModel::data(index, CategoryColumn::ID);94 resultsModel = new ResultsModel(15, index.row());
222 case RoleName:95 m_resultsModels[index.row()] = resultsModel;
223 return DeeListModel::data(index, CategoryColumn::DISPLAY_NAME);96 }
224 case RoleIcon:97 if (index.row() < m_specialCategories.count()) {
225 return DeeListModel::data(index, CategoryColumn::ICON_HINT);98 const CategoryData &catData = m_specialCategories.at(index.row());
226 case RoleRenderer:99 switch (role) {
227 return DeeListModel::data(index, CategoryColumn::RENDERER_NAME);100 case RoleCategoryId:
228 case RoleContentType:101 return catData.categoryId;
229 {102 case RoleName:
230 auto hints = DeeListModel::data(index, CategoryColumn::HINTS).toHash();103 return catData.name;
231 return hints.contains("content-type") ? hints["content-type"] : QVariant(QString("default"));104 case RoleIcon:
232 }105 return catData.icon;
233 case RoleRendererHint:106 case RoleRawRendererTemplate:
234 {107 return catData.rawTemplate;
235 auto hints = DeeListModel::data(index, CategoryColumn::HINTS).toHash();108 case RoleRenderer:
236 return hints.contains("renderer-hint") ? hints["renderer-hint"] : QVariant(QString());109 {
237 }110 QVariantMap map;
238 case RoleHints:111 map["category-layout"] = index.row() % 2 == 0 ? "grid" : "carousel";
239 return DeeListModel::data(index, CategoryColumn::HINTS);112 map["card-size"] = "small";
240 case RoleResults:113 return map;
241 if (m_overriddenCategories.size() > 0)114 }
242 {115 case RoleComponents:
243 auto id = DeeListModel::data(index, CategoryColumn::ID).toString();116 {
244 if (m_overriddenCategories.find(id) != m_overriddenCategories.end())117 QVariantMap map, artMap;
245 return QVariant::fromValue(m_overriddenCategories[id]);118 artMap["aspect-ratio"] = "1.0";
246 }119 artMap["field"] = "art";
247 return QVariant::fromValue(getFilter(index.row()));120 map["art"] = artMap;
248 case RoleCount:121 map["title"] = "HOLA";
249 if (m_overriddenCategories.size() > 0)122 return map;
250 {123 }
251 auto id = DeeListModel::data(index, CategoryColumn::ID).toString();124 case RoleProgressSource:
252 if (m_overriddenCategories.find(id) != m_overriddenCategories.end())125 qFatal("Using un-implemented RoleProgressSource Categories role");
253 return QVariant::fromValue(m_overriddenCategories[id]->rowCount());126 return QVariant();
254 }127 case RoleResults:
255 return QVariant::fromValue(getFilter(index.row())->rowCount());128 return QVariant();
256 default:129 case RoleCount:
257 return QVariant();130 return catData.countObject->property("count");
131 default:
132 qFatal("Using un-implemented Categories role");
133 return QVariant();
134 }
135 } else {
136 switch (role) {
137 case RoleCategoryId:
138 return QString("%1").arg(index.row());
139 case RoleName:
140 return QString("Category %1").arg(index.row());
141 case RoleIcon:
142 return "gtk-apply";
143 case RoleRawRendererTemplate:
144 qFatal("Using un-implemented RoleRawRendererTemplate Categories role");
145 return QVariant();
146 case RoleRenderer:
147 {
148 QVariantMap map;
149 map["category-layout"] = index.row() % 2 == 0 ? "grid" : "carousel";
150 map["card-size"] = "small";
151 return map;
152 }
153 case RoleComponents:
154 {
155 QVariantMap map, artMap;
156 artMap["aspect-ratio"] = "1.0";
157 artMap["field"] = "art";
158 map["art"] = artMap;
159 map["title"] = "HOLA";
160 return map;
161 }
162 case RoleProgressSource:
163 qFatal("Using un-implemented RoleProgressSource Categories role");
164 return QVariant();
165 case RoleResults:
166 return QVariant::fromValue(resultsModel);
167 case RoleCount:
168 return resultsModel->rowCount();
169 default:
170 qFatal("Using un-implemented Categories role");
171 return QVariant();
172 }
258 }173 }
259}174}
260175
=== modified file 'tests/mocks/Unity/fake_categories.h'
--- tests/mocks/Unity/fake_categories.h 2013-10-02 13:02:16 +0000
+++ tests/mocks/Unity/fake_categories.h 2014-03-18 10:57:24 +0000
@@ -18,58 +18,54 @@
18#define FAKE_CATEGORIES_H18#define FAKE_CATEGORIES_H
1919
20// Qt20// Qt
21#include <QObject>21#include <QAbstractListModel>
22#include <QSet>22#include <QList>
23#include <QTimer>23
2424class ResultsModel;
25#include <dee.h>25
26#include <deelistmodel.h>26class Categories : public QAbstractListModel
27
28class Categories : public DeeListModel
29{27{
30 Q_OBJECT28 Q_OBJECT
3129
32 Q_ENUMS(Roles)30 Q_ENUMS(Roles)
3331
34public:32public:
35 Categories(QObject* parent = 0);33 Categories(int category_count, QObject* parent = 0);
36 enum Roles {34 enum Roles {
37 RoleCategoryId,35 RoleCategoryId,
38 RoleName,36 RoleName,
39 RoleIcon,37 RoleIcon,
38 RoleRawRendererTemplate,
40 RoleRenderer,39 RoleRenderer,
41 RoleContentType,40 RoleComponents,
42 RoleRendererHint,41 RoleProgressSource, // maybe
43 RoleHints,
44 RoleResults,42 RoleResults,
45 RoleCount43 RoleCount
46 };44 };
4745
48 Q_INVOKABLE void overrideResults(const QString& categoryId, QAbstractItemModel* model);46 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
4947 QHash<int, QByteArray> roleNames() const override;
50 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;48 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
5149
52 QHash<int, QByteArray> roleNames() const;50 Q_INVOKABLE void addSpecialCategory(QString const& categoryId, QString const& name, QString const& icon, QString const& rawTemplate, QObject* countObject);
53
54 /* setters */
55 void setResultModel(DeeModel* model);
5651
57private Q_SLOTS:52private Q_SLOTS:
58 void onCountChanged();53 void countChanged();
59 void onRowCountChanged();
60 void onEmitCountChanged();
61 void onOverrideModelDestroyed();
6254
63private:55private:
64 DeeModel* getResultsForCategory(unsigned index) const;56 mutable QHash<int, ResultsModel*> m_resultsModels;
65 DeeListModel* getFilter(int index) const;
66
67 DeeModel* m_dee_results;
68 QTimer m_timer;
69 QSet<DeeListModel*> m_timerFilters;
70 QHash<int, QByteArray> m_roles;57 QHash<int, QByteArray> m_roles;
71 QMap<QString, QAbstractItemModel*> m_overriddenCategories;58 int m_category_count;
72 mutable QMap<int, DeeListModel*> m_filters;59
60 struct CategoryData {
61 QString categoryId;
62 QString name;
63 QString icon;
64 QString rawTemplate;
65 QObject* countObject;
66 };
67
68 QList<CategoryData> m_specialCategories;
73};69};
7470
75#endif // FAKE_CATEGORIES_H71#endif // FAKE_CATEGORIES_H
7672
=== removed file 'tests/mocks/Unity/fake_preview.cpp'
--- tests/mocks/Unity/fake_preview.cpp 2014-01-16 17:39:35 +0000
+++ tests/mocks/Unity/fake_preview.cpp 1970-01-01 00:00:00 +0000
@@ -1,73 +0,0 @@
1/*
2 * Copyright (C) 2013, 2014 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include "fake_preview.h"
18
19Preview::Preview(const QString &rendererName, QObject *parent):
20 QObject(parent),
21 m_rendererName(rendererName)
22{
23}
24
25QString Preview::rendererName() const
26{
27 return m_rendererName;
28}
29
30QString Preview::title() const
31{
32 return "Title";
33}
34
35QString Preview::subtitle() const
36{
37 return "Subtitle";
38}
39
40QString Preview::description() const
41{
42 return "Description";
43}
44
45QVariant Preview::actions()
46{
47 return QVariant();
48}
49
50QVariant Preview::infoHints()
51{
52 return QVariant();
53}
54
55QVariantMap Preview::infoHintsHash() const
56{
57 return QVariantMap();
58}
59
60QString Preview::image() const
61{
62 return "";
63}
64
65void Preview::execute(const QString& actionId, const QHash<QString, QVariant>& hints)
66{
67 Q_UNUSED(actionId);
68 Q_UNUSED(hints);
69}
70
71void Preview::cancelAction()
72{
73}
740
=== removed file 'tests/mocks/Unity/fake_preview.h'
--- tests/mocks/Unity/fake_preview.h 2014-01-16 17:39:35 +0000
+++ tests/mocks/Unity/fake_preview.h 1970-01-01 00:00:00 +0000
@@ -1,65 +0,0 @@
1/*
2 * Copyright (C) 2013, 2014 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef FAKE_PREVIEW_H
18#define FAKE_PREVIEW_H
19
20// Qt
21#include <QObject>
22#include <QString>
23#include <QMetaType>
24#include <QList>
25#include <QVariantMap>
26
27class Q_DECL_EXPORT Preview : public QObject
28{
29 Q_OBJECT
30
31 Q_PROPERTY(QString rendererName READ rendererName NOTIFY previewChanged)
32 Q_PROPERTY(QString title READ title NOTIFY previewChanged)
33 Q_PROPERTY(QString subtitle READ subtitle NOTIFY previewChanged)
34 Q_PROPERTY(QString description READ description NOTIFY previewChanged)
35 Q_PROPERTY(QVariant actions READ actions NOTIFY previewChanged)
36 Q_PROPERTY(QVariant infoHints READ infoHints NOTIFY previewChanged)
37 Q_PROPERTY(QVariantMap infoMap READ infoHintsHash NOTIFY previewChanged)
38 Q_PROPERTY(QString image READ image NOTIFY previewChanged)
39
40public:
41 explicit Preview(const QString &rendererName, QObject *parent = 0);
42
43 QString rendererName() const;
44 QString title() const;
45 QString subtitle() const;
46 QString description() const;
47 QVariant actions();
48 QVariant infoHints();
49 QVariantMap infoHintsHash() const;
50 QString image() const;
51
52 Q_INVOKABLE void execute(const QString& actionId, const QHash<QString, QVariant>& hints);
53
54 Q_INVOKABLE void cancelAction();
55
56Q_SIGNALS:
57 void previewChanged();
58
59private:
60 QString m_rendererName;
61};
62
63Q_DECLARE_METATYPE(Preview *)
64
65#endif // FAKE_PREVIEW_H
660
=== renamed file 'tests/mocks/Unity/scopes-ng/fake_preview_model.cpp' => 'tests/mocks/Unity/fake_previewmodel.cpp'
--- tests/mocks/Unity/scopes-ng/fake_preview_model.cpp 2014-02-07 09:57:30 +0000
+++ tests/mocks/Unity/fake_previewmodel.cpp 2014-03-18 10:57:24 +0000
@@ -19,78 +19,68 @@
19 */19 */
2020
21// self21// self
22#include "fake_preview_model.h"22#include "fake_previewmodel.h"
23
24// local
25#include "fake_previewwidgetmodel.h"
2326
24// Qt27// Qt
25#include <QVariantMap>28#include <QDebug>
26
27namespace scopes_ng
28{
29
30struct PreviewData
31{
32 QString id;
33 QString type;
34 QVariantMap data;
35
36 PreviewData(QString const& id_, QString const& type_, QVariantMap const& data_): id(id_), type(type_), data(data_)
37 {
38 }
39};
4029
41PreviewModel::PreviewModel(QObject* parent) : QAbstractListModel(parent)30PreviewModel::PreviewModel(QObject* parent) : QAbstractListModel(parent)
42{31{
43 m_roles[Roles::RoleWidgetId] = "widgetId";32 // we have one column by default
44 m_roles[Roles::RoleType] = "type";33 PreviewWidgetModel* columnModel = new PreviewWidgetModel(this);
45 m_roles[Roles::RoleProperties] = "properties";34 m_previewWidgetModels.append(columnModel);
46
47 populateWidgets();
48}
49
50void PreviewModel::populateWidgets()
51{
52 beginResetModel();
53 m_previewWidgets.clear();
54 for (int i = 0; i <= 20; i++) {
55 // FIXME: the API will expose nicer getters soon, use those!
56 QVariantMap attributes;
57 attributes["text"] = QVariant::fromValue(QString("Widget %1").arg(i));
58 attributes["title"] = QVariant::fromValue(QString("Title %1").arg(i));
59 PreviewData* preview_data = new PreviewData(QString("widget-%1").arg(i), QString("text"), attributes);
60 m_previewWidgets.append(QSharedPointer<PreviewData>(preview_data));
61 }
62 endResetModel();
63
64}
65
66void PreviewModel::triggered(QString widgetId, QString actionId, QVariantMap data)
67{
68 Q_EMIT actionTriggered(widgetId, actionId, data);
69}35}
7036
71QHash<int, QByteArray> PreviewModel::roleNames() const37QHash<int, QByteArray> PreviewModel::roleNames() const
72{38{
73 return m_roles;39 QHash<int, QByteArray> roles;
40
41 roles[Roles::RoleColumnModel] = "columnModel";
42
43 return roles;
44}
45
46void PreviewModel::setWidgetColumnCount(int count)
47{
48 if (count != 1) {
49 qWarning("PreviewModel::setWidgetColumnCount != 1 not implemented");
50 }
51}
52
53int PreviewModel::widgetColumnCount() const
54{
55 return 1;
56}
57
58bool PreviewModel::loaded() const
59{
60 return true;
61}
62
63bool PreviewModel::processingAction() const
64{
65 return false;
66}
67
68void PreviewModel::setProcessingAction(bool /*processing*/)
69{
70 qFatal("PreviewModel::setProcessingAction not implemented");
74}71}
7572
76int PreviewModel::rowCount(const QModelIndex&) const73int PreviewModel::rowCount(const QModelIndex&) const
77{74{
78 return m_previewWidgets.size();75 return m_previewWidgetModels.size();
79}76}
8077
81QVariant PreviewModel::data(const QModelIndex& index, int role) const78QVariant PreviewModel::data(const QModelIndex& index, int role) const
82{79{
83 auto widget_data = m_previewWidgets.at(index.row());
84 switch (role) {80 switch (role) {
85 case RoleWidgetId:81 case RoleColumnModel:
86 return widget_data->id;82 return QVariant::fromValue(m_previewWidgetModels.at(index.row()));
87 case RoleType:
88 return widget_data->type;
89 case RoleProperties:
90 return widget_data->data;
91 default:83 default:
92 return QVariant();84 return QVariant();
93 }85 }
94}86}
95
96} // namespace scopes_ng
9787
=== renamed file 'tests/mocks/Unity/scopes-ng/fake_preview_model.h' => 'tests/mocks/Unity/fake_previewmodel.h'
--- tests/mocks/Unity/scopes-ng/fake_preview_model.h 2014-02-07 09:55:56 +0000
+++ tests/mocks/Unity/fake_previewmodel.h 2014-03-18 10:57:24 +0000
@@ -15,54 +15,53 @@
15 */15 */
1616
1717
18#ifndef NG_FAKE_PREVIEW_H18#ifndef FAKE_PREVIEWMODEL_H
19#define NG_FAKE_PREVIEW_H19#define FAKE_PREVIEWMODEL_H
2020
21#include <QAbstractListModel>21#include <QAbstractListModel>
22#include <QSharedPointer>22#include <QSharedPointer>
23#include <QVariantMap>23#include <QVariantMap>
2424
25namespace scopes_ng25class PreviewWidgetModel;
26{26
2727class PreviewModel : public QAbstractListModel
28class PreviewData;
29
30class Q_DECL_EXPORT PreviewModel : public QAbstractListModel
31{28{
32 Q_OBJECT29 Q_OBJECT
3330
34 Q_ENUMS(Roles)31 Q_ENUMS(Roles)
3532
33 Q_PROPERTY(int widgetColumnCount READ widgetColumnCount WRITE setWidgetColumnCount NOTIFY widgetColumnCountChanged)
34 Q_PROPERTY(bool loaded READ loaded NOTIFY loadedChanged)
35 Q_PROPERTY(bool processingAction READ processingAction NOTIFY processingActionChanged)
36
36public:37public:
37 explicit PreviewModel(QObject* parent = 0);38 explicit PreviewModel(QObject* parent = 0);
3839
39 enum Roles {40 enum Roles {
40 RoleWidgetId,41 RoleColumnModel
41 RoleType,
42 RoleProperties
43 };42 };
4443
45 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;44 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
46 QHash<int, QByteArray> roleNames() const override;45 QHash<int, QByteArray> roleNames() const override;
47 int rowCount(const QModelIndex& parent = QModelIndex()) const override;46 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
4847
48 void setWidgetColumnCount(int count);
49 int widgetColumnCount() const;
50 bool loaded() const;
51 bool processingAction() const;
52 void setProcessingAction(bool processing);
53
49Q_SIGNALS:54Q_SIGNALS:
50 void actionTriggered(QString widgetId, QString actionId, QVariantMap data);55 void widgetColumnCountChanged();
5156 void loadedChanged();
52public Q_SLOTS:57 void processingActionChanged();
53 void triggered(QString widgetId, QString actionId, QVariantMap data);58 void triggered(QString const&, QString const&, QVariantMap const&);
5459
55private:60private:
56 QHash<int, QByteArray> m_roles;61 QHash<int, QByteArray> m_roles;
57 QList<QSharedPointer<PreviewData>> m_previewWidgets;62 QList<PreviewWidgetModel*> m_previewWidgetModels;
58
59 void populateWidgets();
60
61};63};
6264
63} // namespace scopes_ng65Q_DECLARE_METATYPE(PreviewModel*)
6466
6567#endif // FAKE_PREVIEWMODEL_H
66Q_DECLARE_METATYPE(scopes_ng::PreviewModel*)
67
68#endif // NG_FAKE_PREVIW_H
6968
=== added file 'tests/mocks/Unity/fake_previewstack.cpp'
--- tests/mocks/Unity/fake_previewstack.cpp 1970-01-01 00:00:00 +0000
+++ tests/mocks/Unity/fake_previewstack.cpp 2014-03-18 10:57:24 +0000
@@ -0,0 +1,76 @@
1/*
2 * Copyright (C) 2014 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17// self
18#include "fake_previewstack.h"
19
20// local
21#include "fake_previewmodel.h"
22#include "fake_scope.h"
23
24PreviewStack::PreviewStack(QObject* parent) : QAbstractListModel(parent)
25{
26 m_previews << new PreviewModel(this);
27}
28
29PreviewStack::~PreviewStack()
30{
31}
32
33QHash<int, QByteArray> PreviewStack::roleNames() const
34{
35 QHash<int, QByteArray> roles;
36
37 roles[Roles::RolePreviewModel] = "previewModel";
38
39 return roles;
40}
41
42void PreviewStack::setWidgetColumnCount(int columnCount)
43{
44 if (columnCount != 1) {
45 qFatal("PreviewStack::setWidgetColumnCount != 1 not implemented");
46 }
47}
48
49int PreviewStack::widgetColumnCount() const
50{
51 return 1;
52}
53
54int PreviewStack::rowCount(const QModelIndex&) const
55{
56 return m_previews.size();
57}
58
59PreviewModel* PreviewStack::get(int index) const
60{
61 if (index >= m_previews.size()) {
62 return nullptr;
63 }
64
65 return m_previews.at(index);
66}
67
68QVariant PreviewStack::data(const QModelIndex& index, int role) const
69{
70 switch (role) {
71 case RolePreviewModel:
72 return QVariant::fromValue(m_previews.at(index.row()));
73 default:
74 return QVariant();
75 }
76}
077
=== added file 'tests/mocks/Unity/fake_previewstack.h'
--- tests/mocks/Unity/fake_previewstack.h 1970-01-01 00:00:00 +0000
+++ tests/mocks/Unity/fake_previewstack.h 2014-03-18 10:57:24 +0000
@@ -0,0 +1,61 @@
1/*
2 * Copyright (C) 2014 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17
18#ifndef FAKE_PREVIEWSTACK_H
19#define FAKE_PREVIEWSTACK_H
20
21#include <QAbstractListModel>
22#include <QSharedPointer>
23#include <QVariantMap>
24
25class PreviewModel;
26
27class PreviewStack : public QAbstractListModel
28{
29 Q_OBJECT
30
31 Q_ENUMS(Roles)
32
33 Q_PROPERTY(int widgetColumnCount READ widgetColumnCount WRITE setWidgetColumnCount NOTIFY widgetColumnCountChanged)
34
35public:
36 explicit PreviewStack(QObject* parent = 0);
37 virtual ~PreviewStack();
38
39 enum Roles {
40 RolePreviewModel
41 };
42
43 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
44 QHash<int, QByteArray> roleNames() const override;
45 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
46
47 Q_INVOKABLE PreviewModel* get(int index) const;
48
49 void setWidgetColumnCount(int columnCount);
50 int widgetColumnCount() const;
51
52Q_SIGNALS:
53 void widgetColumnCountChanged();
54
55private:
56 QList<PreviewModel*> m_previews;
57};
58
59Q_DECLARE_METATYPE(PreviewStack*)
60
61#endif // FAKE_PREVIEWSTACK_H
062
=== added file 'tests/mocks/Unity/fake_previewwidgetmodel.cpp'
--- tests/mocks/Unity/fake_previewwidgetmodel.cpp 1970-01-01 00:00:00 +0000
+++ tests/mocks/Unity/fake_previewwidgetmodel.cpp 2014-03-18 10:57:24 +0000
@@ -0,0 +1,86 @@
1/*
2 * Copyright (C) 2014 Canonical, Ltd.
3 *
4 * Authors:
5 * Michał Sawicz <michal.sawicz@canonical.com>
6 * Michal Hruby <michal.hruby@canonical.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 3.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21// self
22#include "fake_previewwidgetmodel.h"
23
24// Qt
25#include <QVariantMap>
26
27struct PreviewData
28{
29 QString id;
30 QString type;
31 QVariantMap data;
32
33 PreviewData(QString const& id_, QString const& type_, QVariantMap const& data_): id(id_), type(type_), data(data_)
34 {
35 }
36};
37
38PreviewWidgetModel::PreviewWidgetModel(QObject* parent) : QAbstractListModel(parent)
39{
40 m_roles[Roles::RoleWidgetId] = "widgetId";
41 m_roles[Roles::RoleType] = "type";
42 m_roles[Roles::RoleProperties] = "properties";
43
44 populateWidgets();
45}
46
47void PreviewWidgetModel::populateWidgets()
48{
49 beginResetModel();
50 m_previewWidgets.clear();
51 for (int i = 0; i <= 20; i++) {
52 // FIXME: the API will expose nicer getters soon, use those!
53 QVariantMap attributes;
54 attributes["text"] = QVariant::fromValue(QString("Widget %1").arg(i));
55 attributes["title"] = QVariant::fromValue(QString("Title %1").arg(i));
56 PreviewData* preview_data = new PreviewData(QString("widget-%1").arg(i), QString("text"), attributes);
57 m_previewWidgets.append(QSharedPointer<PreviewData>(preview_data));
58 }
59 endResetModel();
60
61}
62
63QHash<int, QByteArray> PreviewWidgetModel::roleNames() const
64{
65 return m_roles;
66}
67
68int PreviewWidgetModel::rowCount(const QModelIndex&) const
69{
70 return m_previewWidgets.size();
71}
72
73QVariant PreviewWidgetModel::data(const QModelIndex& index, int role) const
74{
75 auto widget_data = m_previewWidgets.at(index.row());
76 switch (role) {
77 case RoleWidgetId:
78 return widget_data->id;
79 case RoleType:
80 return widget_data->type;
81 case RoleProperties:
82 return widget_data->data;
83 default:
84 return QVariant();
85 }
86}
087
=== added file 'tests/mocks/Unity/fake_previewwidgetmodel.h'
--- tests/mocks/Unity/fake_previewwidgetmodel.h 1970-01-01 00:00:00 +0000
+++ tests/mocks/Unity/fake_previewwidgetmodel.h 2014-03-18 10:57:24 +0000
@@ -0,0 +1,56 @@
1/*
2 * Copyright (C) 2014 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17
18#ifndef FAKE_PREVIEWWIDGETMODEL_H
19#define FAKE_PREVIEWWIDGETMODEL_H
20
21#include <QAbstractListModel>
22#include <QSharedPointer>
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches