Merge lp:~cimi/unity8/card-social into lp:unity8

Proposed by Andrea Cimitan
Status: Superseded
Proposed branch: lp:~cimi/unity8/card-social
Merge into: lp:unity8
Diff against target: 3382 lines (+2184/-181)
45 files modified
debian/control (+2/-2)
plugins/Dash/CardCreator.js (+112/-34)
plugins/Dash/CardCreatorCache.qml (+3/-3)
plugins/Dash/CardSocialActions.qml (+86/-0)
plugins/Dash/qmldir (+1/-0)
qml/Dash/CardCarousel.qml (+0/-1)
qml/Dash/CardGrid.qml (+1/-1)
qml/Dash/CardHorizontalList.qml (+1/-1)
qml/Dash/CardTool.qml (+29/-28)
qml/Dash/CardVerticalJournal.qml (+1/-1)
qml/Dash/DashRenderer.qml (+6/-0)
qml/Dash/GenericScopeView.qml (+4/-0)
tests/mocks/Unity/CMakeLists.txt (+1/-1)
tests/mocks/Unity/fake_categories.cpp (+4/-1)
tests/mocks/Unity/fake_resultsmodel.cpp (+2/-0)
tests/plugins/Dash/cardcreator/1.res (+5/-7)
tests/plugins/Dash/cardcreator/1.res.cardcreator (+119/-0)
tests/plugins/Dash/cardcreator/10.res (+4/-6)
tests/plugins/Dash/cardcreator/10.res.cardcreator (+137/-0)
tests/plugins/Dash/cardcreator/11.res (+6/-8)
tests/plugins/Dash/cardcreator/11.res.cardcreator (+210/-0)
tests/plugins/Dash/cardcreator/12.res (+146/-0)
tests/plugins/Dash/cardcreator/12.res.cardcreator (+145/-0)
tests/plugins/Dash/cardcreator/12.tst (+3/-0)
tests/plugins/Dash/cardcreator/2.res (+4/-6)
tests/plugins/Dash/cardcreator/2.res.cardcreator (+136/-0)
tests/plugins/Dash/cardcreator/3.res (+4/-6)
tests/plugins/Dash/cardcreator/3.res.cardcreator (+137/-0)
tests/plugins/Dash/cardcreator/4.res (+4/-6)
tests/plugins/Dash/cardcreator/4.res.cardcreator (+109/-0)
tests/plugins/Dash/cardcreator/5.res (+6/-8)
tests/plugins/Dash/cardcreator/5.res.cardcreator (+156/-0)
tests/plugins/Dash/cardcreator/6.res (+3/-5)
tests/plugins/Dash/cardcreator/6.res.cardcreator (+126/-0)
tests/plugins/Dash/cardcreator/7.res (+4/-6)
tests/plugins/Dash/cardcreator/7.res.cardcreator (+149/-0)
tests/plugins/Dash/cardcreator/8.res (+4/-6)
tests/plugins/Dash/cardcreator/8.res.cardcreator (+107/-0)
tests/plugins/Dash/cardcreator/9.res (+3/-5)
tests/plugins/Dash/cardcreator/9.res.cardcreator (+118/-0)
tests/plugins/Dash/cardcreatortest.cpp (+35/-25)
tests/plugins/Dash/cardcreatortest.qml (+4/-4)
tests/qmltests/Dash/CardHelpers.js (+5/-3)
tests/qmltests/Dash/tst_Card.qml (+38/-3)
tests/qmltests/Dash/tst_CardTool.qml (+4/-4)
To merge this branch: bzr merge lp:~cimi/unity8/card-social
Reviewer Review Type Date Requested Status
Unity8 CI Bot continuous-integration Needs Fixing
Albert Astals Cid Pending
PS Jenkins bot continuous-integration Pending
Review via email: mp+288083@code.launchpad.net

This proposal supersedes a proposal from 2016-02-11.

This proposal has been superseded by a proposal from 2016-03-07.

Commit message

Add social actions to cards

Description of the change

 * Are there any related MPs required for this MP to build/function as expected? Please list.
yes
https://code.launchpad.net/~stolowski/unity-scopes-shell/social-attributes/+merge/287808
https://code.launchpad.net/~stolowski/unity-api/social-attributes-role/+merge/287802
 * Did you perform an exploratory manual test run of your code change and any related functionality?
will with silo, locally tested with mocks
 * Did you make sure that your branch does not contain spurious tags?
y
 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
ye
 * If you changed the UI, has there been a design review?
y

To post a comment you must log in.
Revision history for this message
Albert Astals Cid (aacid) wrote : Posted in a previous version of this proposal

columns: width > units.gu(12) ? 4 : 2

where does this units.gu(12) come from?

review: Needs Information
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:2115
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/~cimi/unity8/card-social/+merge/285769/+edit-commit-message

https://unity8-jenkins.ubuntu.com/job/lp-unity8-1-ci/332/
Executed test runs:
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build/454/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/477
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/495
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/495
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/491
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/491/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/491/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/491
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/491/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/491/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/491
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/491/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/491/console

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-1-ci/332/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Andrea Cimitan (cimi) wrote : Posted in a previous version of this proposal

14 gu is a small card in CardTool, minus the 1gu*2 per side.... we want
just small cards to have 4 columns
> Review: Needs Information
>
> columns: width > units.gu(12) ? 4 : 2
>
> where does this units.gu(12) come from?

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:2115
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/~cimi/unity8/card-social/+merge/285769/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/unity8-ci/7267/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-vivid-touch/6429
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-xenial-touch/682/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-vivid/1972
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-qmluitest-xenial-amd64/675
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-amd64-ci/1867
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-i386-ci/1867
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-amd64-ci/674
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-i386-ci/673
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-vivid-touch/4921
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/6440
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/6440/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/27505
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-xenial-touch/351/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/680
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/680/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/27506

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:2116
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/~cimi/unity8/card-social/+merge/285769/+edit-commit-message

https://unity8-jenkins.ubuntu.com/job/lp-unity8-1-ci/364/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/497
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay/149
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial/149
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/520
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/538
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/538
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/534
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/534/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/534
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/534/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/534
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/534/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/534
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/534/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/534
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/534/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/534
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/534/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-1-ci/364/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:2116
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/~cimi/unity8/card-social/+merge/285769/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/unity8-ci/7302/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-vivid-touch/6492
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-xenial-touch/717/console
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-vivid/2007
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity8-qmluitest-xenial-amd64/710
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-amd64-ci/1902
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-i386-ci/1902
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-amd64-ci/709
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-i386-ci/708
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-vivid-touch/4957
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/6503
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/6503/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/27619
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-xenial-touch/367/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/715
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/715/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/27618

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:2118
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/~cimi/unity8/card-social/+merge/285769/+edit-commit-message

https://unity8-jenkins.ubuntu.com/job/lp-unity8-1-ci/365/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/498
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay/150
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial/150
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/521
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/539
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/539
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/535
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/535/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/535
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/535/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/535
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/535/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/535
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/535/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/535
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/535/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/535
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/535/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-1-ci/365/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:2118
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/~cimi/unity8/card-social/+merge/285769/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/unity8-ci/7308/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-vivid-touch/6499
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-xenial-touch/723/console
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-vivid/2013
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity8-qmluitest-xenial-amd64/716
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-amd64-ci/1908
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-i386-ci/1908
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-amd64-ci/715
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-i386-ci/714
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-vivid-touch/4963
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/6510
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/6510/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/27631
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-xenial-touch/372/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/721
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/721/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/27630

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote : Posted in a previous version of this proposal

Need commit message and description

review: Needs Fixing
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:2119
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/~cimi/unity8/card-social/+merge/285769/+edit-commit-message

https://unity8-jenkins.ubuntu.com/job/lp-unity8-1-ci/562/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/753
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/771
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/771
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/767
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/767/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/767
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/767/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/767
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/767/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/767
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/767/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/767
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/767/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/767
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/767/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-1-ci/562/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:2120
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/~cimi/unity8/card-social/+merge/285769/+edit-commit-message

https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/589/
Executed test runs:
    None: https://unity8-jenkins.ubuntu.com/job/lp-generic-update-mp/686/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/782
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/798
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/798

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/589/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:2120
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/~cimi/unity8/card-social/+merge/285769/+edit-commit-message

https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/591/
Executed test runs:
    None: https://unity8-jenkins.ubuntu.com/job/lp-generic-update-mp/688/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/784
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/800/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/800/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/798/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/798/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/798/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/798/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/798/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/798/console

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/591/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
lp:~cimi/unity8/card-social updated
2123. By Andrea Cimitan

bumped unity-scopes-impl dep

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2123
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/602/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/338
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial,testname=qmluitests.sh/338
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=phone-armhf,release=vivid+overlay,testname=autopilot.sh/338
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/793
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/806
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/806
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/808
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/808/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/808
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/808/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/808
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/808/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/808
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/808/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/808
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/808/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/808
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/808/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/602/rebuild

review: Needs Fixing (continuous-integration)
lp:~cimi/unity8/card-social updated
2124. By Andrea Cimitan

Merge and fix cardCreator test

2125. By Andrea Cimitan

Forgot to add test file :)

2126. By Andrea Cimitan

merged trunk

2127. By Andrea Cimitan

Bumped deps requirements and fixed test

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
lp:~cimi/unity8/card-social updated
2128. By Andrea Cimitan

Reworked one if/else

2129. By Andrea Cimitan

As review

2130. By Andrea Cimitan

Change mocks to be more generic

2131. By Andrea Cimitan

merge

2132. By Andrea Cimitan

Merges

2133. By Andrea Cimitan

Fix for review

2134. By Andrea Cimitan

as review

2135. By Andrea Cimitan

merged trunk

2136. By Andrea Cimitan

fixed card creator test

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2016-02-19 12:42:44 +0000
3+++ debian/control 2016-03-07 13:12:28 +0000
4@@ -29,7 +29,7 @@
5 libqt5xmlpatterns5-dev,
6 libsystemsettings-dev,
7 libudev-dev,
8- libunity-api-dev (>= 7.107),
9+ libunity-api-dev (>= 7.108),
10 libusermetricsoutput1-dev,
11 # Need those X11 libs touch emulation from mouse events in manual QML tests on a X11 desktop
12 libx11-dev[!armhf],
13@@ -134,7 +134,7 @@
14 unity-application-impl-13,
15 unity-notifications-impl-3,
16 unity-plugin-scopes | unity-scopes-impl,
17- unity-scopes-impl-10,
18+ unity-scopes-impl-11,
19 unity8-fake-env | unity-application-impl,
20 ${misc:Depends},
21 Breaks: unity8 (<< 7.86),
22
23=== modified file 'plugins/Dash/CardCreator.js'
24--- plugins/Dash/CardCreator.js 2016-02-12 00:11:52 +0000
25+++ plugins/Dash/CardCreator.js 2016-03-07 13:12:28 +0000
26@@ -18,12 +18,13 @@
27
28 // %1 is the template["card-background"]["elements"][0]
29 // %2 is the template["card-background"]["elements"][1]
30-// %3 is the template["card-background"] string
31+// %3 is whether the loader should be asynchronous or not
32+// %4 is the template["card-background"] string
33 var kBackgroundLoaderCode = 'Loader {\n\
34 id: backgroundLoader; \n\
35 objectName: "backgroundLoader"; \n\
36 anchors.fill: parent; \n\
37- asynchronous: root.asynchronous; \n\
38+ asynchronous: %3; \n\
39 visible: status == Loader.Ready; \n\
40 sourceComponent: UbuntuShape { \n\
41 objectName: "background"; \n\
42@@ -46,7 +47,7 @@
43 objectName: "backgroundImage"; \n\
44 source: { \n\
45 if (cardData && typeof cardData["background"] === "string") return cardData["background"]; \n\
46- else return %3; \n\
47+ else return %4; \n\
48 } \n\
49 } \n\
50 function getColor(index) { \n\
51@@ -63,8 +64,9 @@
52 // %3 is used as image height
53 // %4 is used for artShapeSource.hideSource and inner Loader visible
54 // %5 is used as aspect ratio fallback
55-// %6 is injected as code to artImage
56-// %7 is used as image fallback
57+// %6 is whether the loader should be asynchronous or not
58+// %7 is injected as code to artImage
59+// %8 is used as image fallback
60 var kArtShapeHolderCode = 'Item { \n\
61 id: artShapeHolder; \n\
62 height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height; \n\
63@@ -73,9 +75,9 @@
64 Loader { \n\
65 id: artShapeLoader; \n\
66 objectName: "artShapeLoader"; \n\
67- readonly property string cardArt: cardData && cardData["art"] || %7; \n\
68+ readonly property string cardArt: cardData && cardData["art"] || %8; \n\
69 active: cardArt != ""; \n\
70- asynchronous: root.asynchronous; \n\
71+ asynchronous: %6; \n\
72 visible: status == Loader.Ready; \n\
73 sourceComponent: Item { \n\
74 id: artShape; \n\
75@@ -132,10 +134,10 @@
76 id: artImage; \n\
77 objectName: "artImage"; \n\
78 source: artShapeLoader.cardArt; \n\
79- asynchronous: root.asynchronous; \n\
80+ asynchronous: %6; \n\
81 width: %2; \n\
82 height: %3; \n\
83- %6 \n\
84+ %7 \n\
85 } \n\
86 } \n\
87 } \n\
88@@ -187,12 +189,14 @@
89 } \n\
90 }';
91
92+// %1 is whether the loader should be asynchronous or not
93+// %2 is the header height code
94 var kOverlayLoaderCode = 'Loader { \n\
95 id: overlayLoader; \n\
96- readonly property real overlayHeight: (fixedHeaderHeight > 0 ? fixedHeaderHeight : headerHeight) + units.gu(2); \n\
97+ readonly property real overlayHeight: %2 + units.gu(2); \n\
98 anchors.fill: artShapeHolder; \n\
99 active: artShapeLoader.active && artShapeLoader.item && artShapeLoader.item.image.status === Image.Ready || false; \n\
100- asynchronous: root.asynchronous; \n\
101+ asynchronous: %1; \n\
102 visible: showHeader && status == Loader.Ready; \n\
103 sourceComponent: UbuntuShapeOverlay { \n\
104 id: overlay; \n\
105@@ -211,17 +215,19 @@
106 objectName: "outerRow"; \n\
107 property real margins: units.gu(1); \n\
108 spacing: margins; \n\
109- height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight; \n\
110+ %2\
111 anchors { %1 } \n\
112 anchors.right: parent.right; \n\
113 anchors.margins: margins; \n\
114 anchors.rightMargin: 0; \n\
115 data: [ \n\
116- %2 \n\
117+ %3 \n\
118 ] \n\
119 }\n';
120 var args = Array.prototype.slice.call(arguments);
121- var code = kHeaderRowCodeTemplate.arg(args.shift()).arg(args.join(',\n'));
122+ var isCardTool = args.shift();
123+ var heightCode = isCardTool ? "" : "height: root.fixedHeaderHeight; \n";
124+ var code = kHeaderRowCodeTemplate.arg(args.shift()).arg(heightCode).arg(args.join(',\n'));
125 return code;
126 }
127
128@@ -242,10 +248,11 @@
129 }
130
131 // %1 is used as anchors of mascotShapeLoader
132+// %2 is whether the loader should be asynchronous or not
133 var kMascotShapeLoaderCode = 'Loader { \n\
134 id: mascotShapeLoader; \n\
135 objectName: "mascotShapeLoader"; \n\
136- asynchronous: root.asynchronous; \n\
137+ asynchronous: %2; \n\
138 active: mascotImage.status === Image.Ready; \n\
139 visible: showHeader && active && status == Loader.Ready; \n\
140 width: units.gu(6); \n\
141@@ -275,6 +282,7 @@
142 // %2 is used as color of titleLabel
143 // %3 is used as extra condition for visible of titleLabel
144 // %4 is used as title width
145+// %5 is used as horizontal alignment
146 var kTitleLabelCode = 'Label { \n\
147 id: titleLabel; \n\
148 objectName: "titleLabel"; \n\
149@@ -289,7 +297,7 @@
150 width: %4; \n\
151 text: root.title; \n\
152 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal; \n\
153- horizontalAlignment: root.titleAlignment; \n\
154+ horizontalAlignment: %5; \n\
155 }\n';
156
157 // %1 is used as extra anchors of emblemIcon
158@@ -348,6 +356,17 @@
159 model: cardData && cardData["attributes"]; \n\
160 }\n';
161
162+// %1 is used as anchors of socialActionsRow
163+// %2 is used as color of socialActionsRow
164+var kSocialActionsRowCode = 'CardSocialActions { \n\
165+ id: socialActionsRow; \n\
166+ objectName: "socialActionsRow"; \n\
167+ anchors { %1 } \n\
168+ color: %2; \n\
169+ model: cardData && cardData["socialActions"]; \n\
170+ onClicked: root.action(actionId); \n\
171+ }\n';
172+
173 // %1 is used as top anchor of summary
174 // %2 is used as topMargin anchor of summary
175 // %3 is used as color of summary
176@@ -398,7 +417,7 @@
177 return colorString;
178 }
179
180-function cardString(template, components) {
181+function cardString(template, components, isCardTool) {
182 var code;
183
184 var templateInteractive = (template == null ? true : (template["non-interactive"] !== undefined ? !template["non-interactive"] : true)) ? "true" : "false";
185@@ -410,16 +429,16 @@
186 property string backgroundShapeStyle: "inset"; \n\
187 property real fontScale: 1.0; \n\
188 property var scopeStyle: null; \n\
189- property int titleAlignment: Text.AlignLeft; \n\
190- property int fixedHeaderHeight: -1; \n\
191+ %2\
192 property size fixedArtShapeSize: Qt.size(-1, -1); \n\
193 readonly property string title: cardData && cardData["title"] || ""; \n\
194- property bool asynchronous: true; \n\
195 property bool showHeader: true; \n\
196 implicitWidth: childrenRect.width; \n\
197 enabled: %1; \n\
198 \n'.arg(templateInteractive);
199
200+ code = code.arg(isCardTool ? "" : "property int fixedHeaderHeight: -1; \n");
201+
202 var hasArt = components["art"] && components["art"]["field"] || false;
203 var hasSummary = components["summary"] || false;
204 var isConciergeMode = components["art"] && components["art"]["conciergeMode"] || false;
205@@ -434,8 +453,11 @@
206 var hasSubtitle = hasTitle && components["subtitle"] || false;
207 var hasHeaderRow = hasMascot && hasTitle;
208 var hasAttributes = hasTitle && components["attributes"] && components["attributes"]["field"] || false;
209+ var hasSocialActions = hasTitle && components["socialActions"] || false;
210 var isAudio = template["quick-preview-type"] === "audio";
211+ var asynchronous = isCardTool ? "false" : "true";
212
213+ code += 'signal action(var actionId);\n';
214 if (isAudio) {
215 // For now we only support audio cards with [optional] art, title, subtitle
216 // in horizontal mode
217@@ -468,7 +490,7 @@
218 backgroundElements1 = '"%1"'.arg(element1);
219 }
220 }
221- code += kBackgroundLoaderCode.arg(backgroundElements0).arg(backgroundElements1).arg(templateCardBackground);
222+ code += kBackgroundLoaderCode.arg(backgroundElements0).arg(backgroundElements1).arg(asynchronous).arg(templateCardBackground);
223 }
224
225 if (hasArt) {
226@@ -497,23 +519,31 @@
227 if (isNaN(aspectRatio)) {
228 aspectRatio = 1;
229 }
230- var fallback = components["art"] && components["art"]["fallback"] || "";
231+ var fallback = !isCardTool && components["art"] && components["art"]["fallback"] || "";
232 fallback = encodeURI(fallback);
233 var fallbackStatusCode = "";
234 var fallbackURICode = '""';
235 if (fallback !== "") {
236 // fallbackStatusCode has %6 in it because we want to substitute it for fallbackURICode
237- // which in kArtShapeHolderCode is %7
238- fallbackStatusCode += 'onStatusChanged: if (status === Image.Error) source = %7;';
239+ // which in kArtShapeHolderCode is %8
240+ fallbackStatusCode += 'onStatusChanged: if (status === Image.Error) source = %8;';
241 fallbackURICode = 'decodeURI("%1")'.arg(fallback);
242 }
243- code += kArtShapeHolderCode.arg(artAnchors).arg(widthCode).arg(heightCode).arg(isConciergeMode ? "false" : "true").arg(aspectRatio).arg(fallbackStatusCode).arg(fallbackURICode);
244+ code += kArtShapeHolderCode.arg(artAnchors)
245+ .arg(widthCode)
246+ .arg(heightCode)
247+ .arg(isConciergeMode ? "false" : "true")
248+ .arg(aspectRatio)
249+ .arg(asynchronous)
250+ .arg(fallbackStatusCode)
251+ .arg(fallbackURICode);
252 } else {
253 code += 'readonly property size artShapeSize: Qt.size(-1, -1);\n'
254 }
255
256 if (headerAsOverlay) {
257- code += kOverlayLoaderCode;
258+ var headerHeightCode = isCardTool ? "headerHeight" : "root.fixedHeaderHeight";
259+ code += kOverlayLoaderCode.arg(asynchronous).arg(headerHeightCode);
260 }
261
262 var headerVerticalAnchors;
263@@ -595,11 +625,11 @@
264 }
265
266 if (useMascotShape) {
267- mascotShapeCode = kMascotShapeLoaderCode.arg(mascotAnchors);
268+ mascotShapeCode = kMascotShapeLoaderCode.arg(mascotAnchors).arg(asynchronous);
269 }
270
271 var mascotImageVisible = useMascotShape ? 'false' : 'showHeader';
272- var fallback = components["mascot"] && components["mascot"]["fallback"] || "";
273+ var fallback = !isCardTool && components["mascot"] && components["mascot"]["fallback"] || "";
274 fallback = encodeURI(fallback);
275 var fallbackStatusCode = "";
276 var fallbackURICode = '""';
277@@ -715,9 +745,24 @@
278 }
279 }
280
281+ var titleAlignment = "Text.AlignHCenter";
282+ if (template["card-layout"] === "horizontal"
283+ || typeof components["title"] !== "object"
284+ || components["title"]["align"] === "left") titleAlignment = "Text.AlignLeft";
285+ var keys = ["mascot", "emblem", "subtitle", "attributes", "summary"];
286+ for (var key in keys) {
287+ key = keys[key];
288+ try {
289+ if (typeof components[key] === "string"
290+ || typeof components[key]["field"] === "string") titleAlignment = "Text.AlignLeft";
291+ } catch (e) {
292+ continue;
293+ }
294+ }
295+
296 // code for different elements
297 var titleLabelVisibleExtra = (headerAsOverlay ? '&& overlayLoader.active': '');
298- var titleCode = kTitleLabelCode.arg(titleAnchors).arg(titleColor).arg(titleLabelVisibleExtra).arg(titleWidth);
299+ var titleCode = kTitleLabelCode.arg(titleAnchors).arg(titleColor).arg(titleLabelVisibleExtra).arg(titleWidth).arg(titleAlignment);
300 var subtitleCode;
301 var attributesCode;
302
303@@ -759,7 +804,7 @@
304 if (mascotShapeCode != '') {
305 rowCode.unshift(mascotShapeCode);
306 }
307- code += kHeaderRowCodeGenerator(headerVerticalAnchors + headerLeftAnchor, rowCode)
308+ code += kHeaderRowCodeGenerator(isCardTool, headerVerticalAnchors + headerLeftAnchor, rowCode)
309 } else {
310 code += mascotShapeCode + mascotCode + titleSubtitleCode;
311 }
312@@ -783,7 +828,8 @@
313 } else {
314 audioButtonAnchorsFill = 'undefined';
315 audioButtonWidth = 'height';
316- audioButtonHeight = '(root.fixedHeaderHeight > 0 ? root.fixedHeaderHeight : headerHeight) + 2 * units.gu(1)';
317+ audioButtonHeight = isCardTool ? 'headerHeight + 2 * units.gu(1)'
318+ : 'root.fixedHeaderHeight + 2 * units.gu(1)';
319 }
320 code += kAudioButtonCode.arg(audioButtonAnchorsFill).arg(audioButtonWidth).arg(audioButtonHeight);
321 }
322@@ -813,6 +859,36 @@
323 code += kSummaryLabelCode.arg(summaryTopAnchor).arg(summaryTopMargin).arg(summaryColor);
324 }
325
326+ if (hasSocialActions) {
327+ var socialAnchors;
328+ var socialTopAnchor;
329+
330+ if (hasSummary) {
331+ socialTopAnchor = 'summary.bottom;';
332+ } else {
333+ if (isHorizontal && hasArt) socialTopAnchor = 'artShapeHolder.bottom;';
334+ else if (headerAsOverlay && hasArt) socialTopAnchor = 'artShapeHolder.bottom;';
335+ else if (hasHeaderRow) socialTopAnchor = 'row.bottom;';
336+ else if (hasTitleContainer) socialTopAnchor = 'headerTitleContainer.bottom;';
337+ else if (hasMascot) socialTopAnchor = 'mascotImage.bottom;';
338+ else if (hasAttributes) socialTopAnchor = 'attributesRow.bottom;';
339+ else if (hasSubtitle) socialTopAnchor = 'subtitleLabel.bottom;';
340+ else if (hasTitle) socialTopAnchor = 'titleLabel.bottom;';
341+ else if (hasArt) socialTopAnchor = 'artShapeHolder.bottom;';
342+ else socialTopAnchor = 'parent.top';
343+ }
344+ socialAnchors = 'top: ' + socialTopAnchor + ' left: parent.left; right: parent.right; topMargin: units.gu(1);'
345+
346+ var socialColor;
347+ if (hasBackground) {
348+ socialColor = summaryColorWithBackground;
349+ } else {
350+ socialColor = 'root.scopeStyle ? root.scopeStyle.foreground : theme.palette.normal.baseText';
351+ }
352+
353+ code += kSocialActionsRowCode.arg(socialAnchors).arg(socialColor);
354+ }
355+
356 var touchdownAnchors;
357 if (hasBackground) {
358 touchdownAnchors = 'fill: backgroundLoader';
359@@ -824,7 +900,9 @@
360 code += kTouchdownCode.arg(touchdownAnchors);
361
362 var implicitHeight = 'implicitHeight: ';
363- if (hasSummary) {
364+ if (hasSocialActions) {
365+ implicitHeight += 'socialActionsRow.y + socialActionsRow.height + units.gu(1);\n';
366+ } else if (hasSummary) {
367 implicitHeight += 'summary.y + summary.height + units.gu(1);\n';
368 } else if (isAudio) {
369 implicitHeight += 'audioButton.height;\n';
370@@ -854,13 +932,13 @@
371 return code;
372 }
373
374-function createCardComponent(parent, template, components, identifier) {
375+function createCardComponent(parent, template, components, isCardTool, identifier) {
376 var imports = 'import QtQuick 2.4; \n\
377 import Ubuntu.Components 1.3; \n\
378 import Ubuntu.Settings.Components 0.1; \n\
379 import Dash 0.1;\n\
380 import Utils 0.1;\n';
381- var card = cardString(template, components);
382+ var card = cardString(template, components, isCardTool);
383 var code = imports + 'Component {\n' + card + '}\n';
384
385 try {
386
387=== modified file 'plugins/Dash/CardCreatorCache.qml'
388--- plugins/Dash/CardCreatorCache.qml 2016-01-21 17:56:08 +0000
389+++ plugins/Dash/CardCreatorCache.qml 2016-03-07 13:12:28 +0000
390@@ -23,16 +23,16 @@
391
392 property var cache: new Object();
393
394- function getCardComponent(template, components) {
395+ function getCardComponent(template, components, isCardTool) {
396 if (template === undefined || components === undefined)
397 return undefined;
398
399 var tString = JSON.stringify(template);
400 var cString = JSON.stringify(components);
401- var allString = tString + cString;
402+ var allString = tString + cString + isCardTool;
403 var component = cache[allString];
404 if (component === undefined) {
405- component = CardCreator.createCardComponent(root, template, components, allString);
406+ component = CardCreator.createCardComponent(root, template, components, isCardTool, allString);
407 cache[allString] = component;
408 }
409 return component;
410
411=== added file 'plugins/Dash/CardSocialActions.qml'
412--- plugins/Dash/CardSocialActions.qml 1970-01-01 00:00:00 +0000
413+++ plugins/Dash/CardSocialActions.qml 2016-03-07 13:12:28 +0000
414@@ -0,0 +1,86 @@
415+/*
416+ * Copyright 2016 Canonical Ltd.
417+ *
418+ * This program is free software; you can redistribute it and/or modify
419+ * it under the terms of the GNU General Public License as published by
420+ * the Free Software Foundation; version 3.
421+ *
422+ * This program is distributed in the hope that it will be useful,
423+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
424+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
425+ * GNU General Public License for more details.
426+ *
427+ * You should have received a copy of the GNU General Public License
428+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
429+ */
430+
431+import QtQuick 2.4
432+import QtQuick.Layouts 1.1
433+import Ubuntu.Components 1.3
434+import "../../../qml/Components/ListItems" as ListItems
435+
436+Column {
437+ id: socialActions
438+ spacing: units.gu(0.5)
439+
440+ property alias model: repeater.model
441+ property color color: theme.palette.normal.baseText
442+
443+ signal clicked(var actionId)
444+
445+ ListItems.ThinDivider {
446+ id: divider
447+ visible: repeater.count > 0
448+ anchors { left: parent.left; right: parent.right; }
449+ }
450+
451+ Row {
452+ id: row
453+ anchors {
454+ left: parent.left
455+ right: parent.right
456+ leftMargin: units.gu(1)
457+ rightMargin: units.gu(1)
458+ }
459+ spacing: units.gu(2)
460+ readonly property int visibleItems: {
461+ if (width <= units.gu(12)) // small card
462+ return 2;
463+ else if (width <= units.gu(21)) // medium card
464+ return 3;
465+ else // large or horizontal card
466+ return 4;
467+ }
468+
469+ Repeater {
470+ id: repeater
471+ delegate: Loader {
472+ height: units.gu(2)
473+ active: index < row.visibleItems
474+ sourceComponent: AbstractButton {
475+ objectName: "delegate" + index
476+ height: units.gu(2)
477+ width: icon.width
478+ Icon {
479+ id: icon
480+ objectName: "icon"
481+
482+ readonly property url urlIcon: modelData && modelData["icon"] || ""
483+ readonly property url urlTemporaryIcon: "temporaryIcon" in modelData && modelData["temporaryIcon"] || ""
484+
485+ height: units.gu(2)
486+ // FIXME Workaround for bug https://bugs.launchpad.net/ubuntu/+source/ubuntu-ui-toolkit/+bug/1421293
487+ width: implicitWidth > 0 && implicitHeight > 0 ? (implicitWidth / implicitHeight * height) : implicitWidth
488+ source: urlIcon
489+ color: socialActions.color
490+
491+ onUrlIconChanged: if (urlIcon) source = urlIcon
492+ }
493+
494+ onClicked: socialActions.clicked(modelData["id"]);
495+ onPressedChanged: if (pressed && icon.urlTemporaryIcon != "") icon.source = icon.urlTemporaryIcon
496+ }
497+ }
498+ }
499+ }
500+}
501
502=== modified file 'plugins/Dash/qmldir'
503--- plugins/Dash/qmldir 2015-05-18 22:17:21 +0000
504+++ plugins/Dash/qmldir 2016-03-07 13:12:28 +0000
505@@ -5,6 +5,7 @@
506 singleton DashAudioPlayer 0.1 DashAudioPlayer.qml
507 ScopeStyle 0.1 ScopeStyle.qml
508 CardAttributes 0.1 CardAttributes.qml
509+CardSocialActions 0.1 CardSocialActions.qml
510 CroppedImageMinimumSourceSize 0.1 CroppedImageMinimumSourceSize.qml
511 AudioProgressBar 0.1 AudioProgressBar.qml
512 CardAudioProgress 0.1 CardAudioProgress.qml
513
514=== modified file 'qml/Dash/CardCarousel.qml'
515--- qml/Dash/CardCarousel.qml 2016-01-28 14:11:14 +0000
516+++ qml/Dash/CardCarousel.qml 2016-03-07 13:12:28 +0000
517@@ -66,7 +66,6 @@
518 item.cardData = Qt.binding(function() { return model; });
519 item.fontScale = Qt.binding(function() { return carousel.fontScale; });
520 item.showHeader = Qt.binding(function() { return loader.explicitlyScaled; });
521- item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; });
522 item.artShapeStyle = "shadow";
523 item.scopeStyle = cardCarousel.scopeStyle;
524 }
525
526=== modified file 'qml/Dash/CardGrid.qml'
527--- qml/Dash/CardGrid.qml 2016-02-02 08:47:07 +0000
528+++ qml/Dash/CardGrid.qml 2016-03-07 13:12:28 +0000
529@@ -70,7 +70,6 @@
530 item.fixedHeaderHeight = Qt.binding(function() { return cardTool.headerHeight; });
531 item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; });
532 item.cardData = Qt.binding(function() { return model; });
533- item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; });
534 item.scopeStyle = root.scopeStyle;
535 item.artShapeStyle = root.artShapeStyle;
536 item.backgroundShapeStyle = root.backgroundShapeStyle;
537@@ -79,6 +78,7 @@
538 target: loader.item
539 onClicked: root.clicked(index, result, loader.item, model)
540 onPressAndHold: root.pressAndHold(index, result, model)
541+ onAction: root.action(index, result, actionId)
542 }
543 }
544 }
545
546=== modified file 'qml/Dash/CardHorizontalList.qml'
547--- qml/Dash/CardHorizontalList.qml 2016-01-28 14:11:14 +0000
548+++ qml/Dash/CardHorizontalList.qml 2016-03-07 13:12:28 +0000
549@@ -53,13 +53,13 @@
550 item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; });
551 item.fixedHeaderHeight = Qt.binding(function() { return cardTool.headerHeight; });
552 item.cardData = Qt.binding(function() { return model; });
553- item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; });
554 item.scopeStyle = root.scopeStyle;
555 }
556 Connections {
557 target: loader.item
558 onClicked: root.clicked(index, result, loader.item, model)
559 onPressAndHold: root.pressAndHold(index, result, model)
560+ onAction: root.action(index, result, actionId)
561 }
562 }
563 }
564
565=== modified file 'qml/Dash/CardTool.qml'
566--- qml/Dash/CardTool.qml 2016-01-28 14:11:14 +0000
567+++ qml/Dash/CardTool.qml 2016-03-07 13:12:28 +0000
568@@ -66,7 +66,7 @@
569 return layout;
570 }
571
572- property var cardComponent: CardCreatorCache.getCardComponent(cardTool.template, cardTool.components);
573+ property var cardComponent: CardCreatorCache.getCardComponent(cardTool.template, cardTool.components, false);
574
575 // FIXME: Saviq
576 // Only way for the card below to actually be laid out completely.
577@@ -139,29 +139,6 @@
578 readonly property int headerHeight: cardLoader.item ? cardLoader.item.headerHeight : 0
579 property size artShapeSize: cardLoader.item ? cardLoader.item.artShapeSize : 0
580
581- /*!
582- \brief Desired alignment of title
583- */
584- readonly property int titleAlignment: {
585- if (template["card-layout"] === "horizontal"
586- || typeof components["title"] !== "object"
587- || components["title"]["align"] === "left") return Text.AlignLeft;
588-
589- var keys = ["mascot", "emblem", "subtitle", "attributes", "summary"];
590-
591- for (var key in keys) {
592- key = keys[key];
593- try {
594- if (typeof components[key] === "string"
595- || typeof components[key]["field"] === "string") return Text.AlignLeft;
596- } catch (e) {
597- continue;
598- }
599- }
600-
601- return Text.AlignHCenter;
602- }
603-
604 QtObject {
605 id: carouselTool
606
607@@ -205,21 +182,45 @@
608 }
609 }
610
611+ Item {
612+ id: socialActionsModel
613+ property int numOfActions: 0
614+ property var model: []
615+ property bool hasActions: {
616+ var actions = components["socialActions"];
617+ var hasActionsFlag = (actions != undefined);
618+
619+ if (hasActionsFlag) {
620+ if (actions["max-count"]) {
621+ numOfActions = actions["max-count"];
622+ }
623+ }
624+ return hasActionsFlag
625+ }
626+
627+ onNumOfActionsChanged: {
628+ model = []
629+ for (var i = 0; i < numOfActions; i++) {
630+ model.push( {"id":"text"+(i+1), "icon":"image://theme/ok" } );
631+ }
632+ }
633+ }
634+
635 Loader {
636 id: cardLoader
637- readonly property var fields: ["art", "mascot", "title", "subtitle", "summary", "attributes"]
638+ readonly property var fields: ["art", "mascot", "title", "subtitle", "summary", "attributes", "socialActions"]
639 readonly property var maxData: {
640 "art": Qt.resolvedUrl("graphics/pixel.png"),
641 "mascot": Qt.resolvedUrl("graphics/pixel.png"),
642 "title": "—\n—",
643 "subtitle": "—",
644 "summary": "—\n—\n—\n—\n—",
645- "attributes": attributesModel.model
646+ "attributes": attributesModel.model,
647+ "socialActions": socialActionsModel.model
648 }
649- sourceComponent: cardTool.cardComponent
650+ sourceComponent: CardCreatorCache.getCardComponent(cardTool.template, cardTool.components, true);
651 onLoaded: {
652 item.objectName = "cardToolCard";
653- item.asynchronous = false;
654 item.width = Qt.binding(function() { return cardTool.cardWidth !== -1 ? cardTool.cardWidth : item.implicitWidth; });
655 item.height = Qt.binding(function() { return cardTool.cardHeight !== -1 ? cardTool.cardHeight : item.implicitHeight; });
656 }
657
658=== modified file 'qml/Dash/CardVerticalJournal.qml'
659--- qml/Dash/CardVerticalJournal.qml 2016-01-28 14:11:14 +0000
660+++ qml/Dash/CardVerticalJournal.qml 2016-03-07 13:12:28 +0000
661@@ -72,13 +72,13 @@
662 item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; });
663 item.fixedHeaderHeight = Qt.binding(function() { return cardTool.headerHeight; });
664 item.cardData = Qt.binding(function() { return model; });
665- item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; });
666 item.scopeStyle = root.scopeStyle;
667 }
668 Connections {
669 target: loader.item
670 onClicked: root.clicked(index, result, loader.item, model)
671 onPressAndHold: root.pressAndHold(index, result, model)
672+ onAction: root.action(index, result, actionId)
673 }
674 }
675 }
676
677=== modified file 'qml/Dash/DashRenderer.qml'
678--- qml/Dash/DashRenderer.qml 2015-07-15 15:07:19 +0000
679+++ qml/Dash/DashRenderer.qml 2016-03-07 13:12:28 +0000
680@@ -57,4 +57,10 @@
681 /// @param result result model of the clicked item, used for activation
682 /// @param itemModel model of the item
683 signal pressAndHold(int index, var result, var itemModel)
684+
685+ /// Emitted when the user clicked on an item action
686+ /// @param index is the index of the clicked item
687+ /// @param result result model of the clicked item, used for activation
688+ /// @param actionId id of the clicked action
689+ signal action(int index, var result, var actionId)
690 }
691
692=== modified file 'qml/Dash/GenericScopeView.qml'
693--- qml/Dash/GenericScopeView.qml 2016-02-19 11:50:12 +0000
694+++ qml/Dash/GenericScopeView.qml 2016-03-07 13:12:28 +0000
695@@ -385,6 +385,10 @@
696 scopeView.itemPressedAndHeld(result, baseItem.category);
697 }
698
699+ onAction: { // (int index, var result, var actionId)
700+ scope.activateAction(result, baseitem.categoryId, actionId);
701+ }
702+
703 function categoryItemCount() {
704 var categoryItemCount = -1;
705 if (!rendererLoader.expanded && !seeAllLabel.visible && target.collapsedItemCount > 0) {
706
707=== modified file 'tests/mocks/Unity/CMakeLists.txt'
708--- tests/mocks/Unity/CMakeLists.txt 2016-02-19 12:42:44 +0000
709+++ tests/mocks/Unity/CMakeLists.txt 2016-03-07 13:12:28 +0000
710@@ -8,7 +8,7 @@
711 add_subdirectory(Screens)
712
713 pkg_search_module(GOBJECT gobject-2.0 REQUIRED)
714-pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=10)
715+pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=11)
716
717 include_directories(
718 ${CMAKE_CURRENT_BINARY_DIR}
719
720=== modified file 'tests/mocks/Unity/fake_categories.cpp'
721--- tests/mocks/Unity/fake_categories.cpp 2016-01-14 09:26:28 +0000
722+++ tests/mocks/Unity/fake_categories.cpp 2016-03-07 13:12:28 +0000
723@@ -88,7 +88,7 @@
724 }
725 case RoleComponents:
726 {
727- QVariantMap map, artMap, attributeMap;
728+ QVariantMap map, artMap, attributeMap, socialActionMap;
729 if (index.row() % 2 != 0) {
730 artMap["aspect-ratio"] = QString("1.%1").arg(index.row());
731 } else {
732@@ -99,6 +99,9 @@
733 map["title"] = "HOLA";
734 map["subtitle"] = "HOLA";
735 attributeMap["field"] = "attribute";
736+ socialActionMap["icon"] = "image://theme/cancel";
737+ socialActionMap["id"] = "dislike";
738+ map["socialActions"] = socialActionMap;
739 map["attributes"] = attributeMap;
740 return map;
741 }
742
743=== modified file 'tests/mocks/Unity/fake_resultsmodel.cpp'
744--- tests/mocks/Unity/fake_resultsmodel.cpp 2015-11-23 15:41:34 +0000
745+++ tests/mocks/Unity/fake_resultsmodel.cpp 2016-03-07 13:12:28 +0000
746@@ -72,6 +72,8 @@
747 case RoleUri:
748 case RoleCategoryId:
749 case RoleDndUri:
750+ case RoleAttributes:
751+ case RoleSocialActions:
752 return QString();
753 case RoleResult:
754 return QString("Result.%1.%2").arg(m_categoryId).arg(index.row());
755
756=== modified file 'tests/plugins/Dash/cardcreator/1.res'
757--- tests/plugins/Dash/cardcreator/1.res 2016-02-11 13:13:31 +0000
758+++ tests/plugins/Dash/cardcreator/1.res 2016-03-07 13:12:28 +0000
759@@ -5,15 +5,13 @@
760 property string backgroundShapeStyle: "inset";
761 property real fontScale: 1.0;
762 property var scopeStyle: null;
763- property int titleAlignment: Text.AlignLeft;
764 property int fixedHeaderHeight: -1;
765 property size fixedArtShapeSize: Qt.size(-1, -1);
766 readonly property string title: cardData && cardData["title"] || "";
767- property bool asynchronous: true;
768- property bool showHeader: true;
769+ property bool showHeader: true;
770 implicitWidth: childrenRect.width;
771 enabled: true;
772-
773+signal action(var actionId);
774 readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
775 Item {
776 id: artShapeHolder;
777@@ -25,7 +23,7 @@
778 objectName: "artShapeLoader";
779 readonly property string cardArt: cardData && cardData["art"] || "";
780 active: cardArt != "";
781- asynchronous: root.asynchronous;
782+ asynchronous: true;
783 visible: status == Loader.Ready;
784 sourceComponent: Item {
785 id: artShape;
786@@ -82,7 +80,7 @@
787 id: artImage;
788 objectName: "artImage";
789 source: artShapeLoader.cardArt;
790- asynchronous: root.asynchronous;
791+ asynchronous: true;
792 width: root.width;
793 height: width / artShape.aspect;
794 }
795@@ -108,7 +106,7 @@
796 width: undefined;
797 text: root.title;
798 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
799- horizontalAlignment: root.titleAlignment;
800+ horizontalAlignment: Text.AlignHCenter;
801 }
802 UbuntuShape {
803 id: touchdown;
804
805=== added file 'tests/plugins/Dash/cardcreator/1.res.cardcreator'
806--- tests/plugins/Dash/cardcreator/1.res.cardcreator 1970-01-01 00:00:00 +0000
807+++ tests/plugins/Dash/cardcreator/1.res.cardcreator 2016-03-07 13:12:28 +0000
808@@ -0,0 +1,119 @@
809+AbstractButton {
810+ id: root;
811+ property var cardData;
812+ property string artShapeStyle: "inset";
813+ property string backgroundShapeStyle: "inset";
814+ property real fontScale: 1.0;
815+ property var scopeStyle: null;
816+ property size fixedArtShapeSize: Qt.size(-1, -1);
817+ readonly property string title: cardData && cardData["title"] || "";
818+ property bool showHeader: true;
819+ implicitWidth: childrenRect.width;
820+ enabled: true;
821+signal action(var actionId);
822+readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
823+Item {
824+ id: artShapeHolder;
825+ height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height;
826+ width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width;
827+ anchors { horizontalCenter: parent.horizontalCenter; }
828+ Loader {
829+ id: artShapeLoader;
830+ objectName: "artShapeLoader";
831+ readonly property string cardArt: cardData && cardData["art"] || "";
832+ active: cardArt != "";
833+ asynchronous: false;
834+ visible: status == Loader.Ready;
835+ sourceComponent: Item {
836+ id: artShape;
837+ objectName: "artShape";
838+ visible: image.status == Image.Ready;
839+ readonly property alias image: artImage;
840+ ShaderEffectSource {
841+ id: artShapeSource;
842+ sourceItem: artImage;
843+ anchors.centerIn: parent;
844+ width: 1;
845+ height: 1;
846+ hideSource: true;
847+ }
848+ Loader {
849+ anchors.fill: parent;
850+ visible: true;
851+ sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
852+ Component {
853+ id: artShapeShapeComponent;
854+ UbuntuShape {
855+ source: artShapeSource;
856+ sourceFillMode: UbuntuShape.PreserveAspectCrop;
857+ radius: "medium";
858+ aspect: {
859+ switch (root.artShapeStyle) {
860+ case "inset": return UbuntuShape.Inset;
861+ case "shadow": return UbuntuShape.DropShadow;
862+ default:
863+ case "flat": return UbuntuShape.Flat;
864+ }
865+ }
866+ }
867+ }
868+ Component {
869+ id: artShapeIconComponent;
870+ ProportionalShape { source: artShapeSource; aspect: UbuntuShape.DropShadow; }
871+ }
872+ }
873+ readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
874+ readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1.6;
875+ Component.onCompleted: { updateWidthHeightBindings(); }
876+ Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
877+ function updateWidthHeightBindings() {
878+ if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
879+ width = root.fixedArtShapeSize.width;
880+ height = root.fixedArtShapeSize.height;
881+ } else {
882+ width = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.width });
883+ height = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.height });
884+ }
885+ }
886+ CroppedImageMinimumSourceSize {
887+ id: artImage;
888+ objectName: "artImage";
889+ source: artShapeLoader.cardArt;
890+ asynchronous: false;
891+ width: root.width;
892+ height: width / artShape.aspect;
893+ }
894+ }
895+ }
896+ }
897+readonly property int headerHeight: titleLabel.height;
898+Label {
899+ id: titleLabel;
900+ objectName: "titleLabel";
901+ anchors { right: parent.right;
902+ left: parent.left;
903+ top: artShapeHolder.bottom;
904+ topMargin: units.gu(1);
905+ }
906+ elide: Text.ElideRight;
907+ fontSize: "small";
908+ wrapMode: Text.Wrap;
909+ maximumLineCount: 2;
910+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
911+ color: root.scopeStyle ? root.scopeStyle.foreground : theme.palette.normal.baseText;
912+ visible: showHeader ;
913+ width: undefined;
914+ text: root.title;
915+ font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
916+ horizontalAlignment: Text.AlignHCenter;
917+ }
918+UbuntuShape {
919+ id: touchdown;
920+ objectName: "touchdown";
921+ anchors { fill: artShapeHolder }
922+ visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
923+ radius: "medium";
924+ borderSource: "radius_pressed.sci"
925+}
926+implicitHeight: titleLabel.y + titleLabel.height + units.gu(1);
927+}
928
929=== modified file 'tests/plugins/Dash/cardcreator/10.res'
930--- tests/plugins/Dash/cardcreator/10.res 2016-02-02 08:47:07 +0000
931+++ tests/plugins/Dash/cardcreator/10.res 2016-03-07 13:12:28 +0000
932@@ -5,20 +5,18 @@
933 property string backgroundShapeStyle: "inset";
934 property real fontScale: 1.0;
935 property var scopeStyle: null;
936- property int titleAlignment: Text.AlignLeft;
937 property int fixedHeaderHeight: -1;
938 property size fixedArtShapeSize: Qt.size(-1, -1);
939 readonly property string title: cardData && cardData["title"] || "";
940- property bool asynchronous: true;
941 property bool showHeader: true;
942 implicitWidth: childrenRect.width;
943 enabled: true;
944-
945+signal action(var actionId);
946 Loader {
947 id: backgroundLoader;
948 objectName: "backgroundLoader";
949 anchors.fill: parent;
950- asynchronous: root.asynchronous;
951+ asynchronous: true;
952 visible: status == Loader.Ready;
953 sourceComponent: UbuntuShape {
954 objectName: "background";
955@@ -59,7 +57,7 @@
956 objectName: "outerRow";
957 property real margins: units.gu(1);
958 spacing: margins;
959- height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
960+ height: root.fixedHeaderHeight;
961 anchors { top: parent.top;
962 topMargin: units.gu(1);
963 left: parent.left;
964@@ -103,7 +101,7 @@
965 width: undefined;
966 text: root.title;
967 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
968- horizontalAlignment: root.titleAlignment;
969+ horizontalAlignment: Text.AlignLeft;
970 }
971 ,Label {
972 id: subtitleLabel;
973
974=== added file 'tests/plugins/Dash/cardcreator/10.res.cardcreator'
975--- tests/plugins/Dash/cardcreator/10.res.cardcreator 1970-01-01 00:00:00 +0000
976+++ tests/plugins/Dash/cardcreator/10.res.cardcreator 2016-03-07 13:12:28 +0000
977@@ -0,0 +1,137 @@
978+AbstractButton {
979+ id: root;
980+ property var cardData;
981+ property string artShapeStyle: "inset";
982+ property string backgroundShapeStyle: "inset";
983+ property real fontScale: 1.0;
984+ property var scopeStyle: null;
985+ property size fixedArtShapeSize: Qt.size(-1, -1);
986+ readonly property string title: cardData && cardData["title"] || "";
987+ property bool showHeader: true;
988+ implicitWidth: childrenRect.width;
989+ enabled: true;
990+signal action(var actionId);
991+Loader {
992+ id: backgroundLoader;
993+ objectName: "backgroundLoader";
994+ anchors.fill: parent;
995+ asynchronous: false;
996+ visible: status == Loader.Ready;
997+ sourceComponent: UbuntuShape {
998+ objectName: "background";
999+ radius: "medium";
1000+ aspect: {
1001+ switch (root.backgroundShapeStyle) {
1002+ case "inset": return UbuntuShape.Inset;
1003+ case "shadow": return UbuntuShape.DropShadow;
1004+ default:
1005+ case "flat": return UbuntuShape.Flat;
1006+ }
1007+ }
1008+ backgroundColor: getColor(0) || "white";
1009+ secondaryBackgroundColor: getColor(1) || backgroundColor;
1010+ backgroundMode: UbuntuShape.VerticalGradient;
1011+ anchors.fill: parent;
1012+ source: backgroundImage.source ? backgroundImage : null;
1013+ property real luminance: Style.luminance(backgroundColor);
1014+ property Image backgroundImage: Image {
1015+ objectName: "backgroundImage";
1016+ source: {
1017+ if (cardData && typeof cardData["background"] === "string") return cardData["background"];
1018+ else return "";
1019+ }
1020+ }
1021+ function getColor(index) {
1022+ if (cardData && typeof cardData["background"] === "object"
1023+ && (cardData["background"]["type"] === "color" || cardData["background"]["type"] === "gradient")) {
1024+ return cardData["background"]["elements"][index];
1025+ } else return index === 0 ? "" : "";
1026+ }
1027+ }
1028+ }
1029+readonly property size artShapeSize: Qt.size(-1, -1);
1030+readonly property int headerHeight: row.height;
1031+Row {
1032+ id: row;
1033+ objectName: "outerRow";
1034+ property real margins: units.gu(1);
1035+ spacing: margins;
1036+ anchors { top: parent.top;
1037+ topMargin: units.gu(1);
1038+left: parent.left;
1039+ }
1040+ anchors.right: parent.right;
1041+ anchors.margins: margins;
1042+ anchors.rightMargin: 0;
1043+ data: [
1044+ CroppedImageMinimumSourceSize {
1045+ id: mascotImage;
1046+ objectName: "mascotImage";
1047+ anchors { verticalCenter: parent.verticalCenter; }
1048+ source: cardData && cardData["mascot"] || "";
1049+ width: units.gu(6);
1050+ height: units.gu(5.625);
1051+ horizontalAlignment: Image.AlignHCenter;
1052+ verticalAlignment: Image.AlignVCenter;
1053+ visible: showHeader;
1054+
1055+ }
1056+,Item {
1057+ id: headerTitleContainer;
1058+ anchors { verticalCenter: parent.verticalCenter; }
1059+ width: parent.width - x;
1060+ implicitHeight: titleLabel.height + subtitleLabel.height;
1061+ data: [
1062+ Label {
1063+ id: titleLabel;
1064+ objectName: "titleLabel";
1065+ anchors { right: parent.right;
1066+rightMargin: units.gu(1);
1067+left: parent.left;
1068+ top: parent.top; }
1069+ elide: Text.ElideRight;
1070+ fontSize: "small";
1071+ wrapMode: Text.Wrap;
1072+ maximumLineCount: 2;
1073+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
1074+ color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? theme.palette.normal.baseText : "white");
1075+ visible: showHeader ;
1076+ width: undefined;
1077+ text: root.title;
1078+ font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
1079+ horizontalAlignment: Text.AlignLeft;
1080+ }
1081+,Label {
1082+ id: subtitleLabel;
1083+ objectName: "subtitleLabel";
1084+ anchors { right: parent.right;
1085+ left: parent.left;
1086+rightMargin: units.gu(1);
1087+top: titleLabel.bottom;
1088+ }
1089+ anchors.topMargin: units.dp(2);
1090+ elide: Text.ElideRight;
1091+ maximumLineCount: 1;
1092+ fontSize: "x-small";
1093+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
1094+ color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? theme.palette.normal.baseText : "white");
1095+ visible: titleLabel.visible && titleLabel.text;
1096+ text: cardData && cardData["subtitle"] || "";
1097+ font.weight: Font.Light;
1098+ }
1099+
1100+ ]
1101+ }
1102+
1103+ ]
1104+ }
1105+UbuntuShape {
1106+ id: touchdown;
1107+ objectName: "touchdown";
1108+ anchors { fill: backgroundLoader }
1109+ visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
1110+ radius: "medium";
1111+ borderSource: "radius_pressed.sci"
1112+ }
1113+implicitHeight: row.y + row.height + units.gu(1);
1114+}
1115
1116=== modified file 'tests/plugins/Dash/cardcreator/11.res'
1117--- tests/plugins/Dash/cardcreator/11.res 2016-02-11 13:13:31 +0000
1118+++ tests/plugins/Dash/cardcreator/11.res 2016-03-07 13:12:28 +0000
1119@@ -5,20 +5,18 @@
1120 property string backgroundShapeStyle: "inset";
1121 property real fontScale: 1.0;
1122 property var scopeStyle: null;
1123- property int titleAlignment: Text.AlignLeft;
1124 property int fixedHeaderHeight: -1;
1125 property size fixedArtShapeSize: Qt.size(-1, -1);
1126 readonly property string title: cardData && cardData["title"] || "";
1127- property bool asynchronous: true;
1128 property bool showHeader: true;
1129 implicitWidth: childrenRect.width;
1130 enabled: true;
1131-
1132+signal action(var actionId);
1133 Loader {
1134 id: backgroundLoader;
1135 objectName: "backgroundLoader";
1136 anchors.fill: parent;
1137- asynchronous: root.asynchronous;
1138+ asynchronous: true;
1139 visible: status == Loader.Ready;
1140 sourceComponent: UbuntuShape {
1141 objectName: "background";
1142@@ -63,7 +61,7 @@
1143 objectName: "artShapeLoader";
1144 readonly property string cardArt: cardData && cardData["art"] || decodeURI("%5C");
1145 active: cardArt != "";
1146- asynchronous: root.asynchronous;
1147+ asynchronous: true;
1148 visible: status == Loader.Ready;
1149 sourceComponent: Item {
1150 id: artShape;
1151@@ -120,7 +118,7 @@
1152 id: artImage;
1153 objectName: "artImage";
1154 source: artShapeLoader.cardArt;
1155- asynchronous: root.asynchronous;
1156+ asynchronous: true;
1157 width: root.width;
1158 height: width / artShape.aspect;
1159 onStatusChanged: if (status === Image.Error) source = decodeURI("%5C");
1160@@ -134,7 +132,7 @@
1161 objectName: "outerRow";
1162 property real margins: units.gu(1);
1163 spacing: margins;
1164- height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
1165+ height: root.fixedHeaderHeight;
1166 anchors { top: artShapeHolder.bottom;
1167 topMargin: units.gu(1);
1168 left: parent.left;
1169@@ -178,7 +176,7 @@
1170 width: undefined;
1171 text: root.title;
1172 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
1173- horizontalAlignment: root.titleAlignment;
1174+ horizontalAlignment: Text.AlignLeft;
1175 }
1176 ,Label {
1177 id: subtitleLabel;
1178
1179=== added file 'tests/plugins/Dash/cardcreator/11.res.cardcreator'
1180--- tests/plugins/Dash/cardcreator/11.res.cardcreator 1970-01-01 00:00:00 +0000
1181+++ tests/plugins/Dash/cardcreator/11.res.cardcreator 2016-03-07 13:12:28 +0000
1182@@ -0,0 +1,210 @@
1183+AbstractButton {
1184+ id: root;
1185+ property var cardData;
1186+ property string artShapeStyle: "inset";
1187+ property string backgroundShapeStyle: "inset";
1188+ property real fontScale: 1.0;
1189+ property var scopeStyle: null;
1190+ property size fixedArtShapeSize: Qt.size(-1, -1);
1191+ readonly property string title: cardData && cardData["title"] || "";
1192+ property bool showHeader: true;
1193+ implicitWidth: childrenRect.width;
1194+ enabled: true;
1195+signal action(var actionId);
1196+Loader {
1197+ id: backgroundLoader;
1198+ objectName: "backgroundLoader";
1199+ anchors.fill: parent;
1200+ asynchronous: false;
1201+ visible: status == Loader.Ready;
1202+ sourceComponent: UbuntuShape {
1203+ objectName: "background";
1204+ radius: "medium";
1205+ aspect: {
1206+ switch (root.backgroundShapeStyle) {
1207+ case "inset": return UbuntuShape.Inset;
1208+ case "shadow": return UbuntuShape.DropShadow;
1209+ default:
1210+ case "flat": return UbuntuShape.Flat;
1211+ }
1212+ }
1213+ backgroundColor: getColor(0) || "white";
1214+ secondaryBackgroundColor: getColor(1) || backgroundColor;
1215+ backgroundMode: UbuntuShape.VerticalGradient;
1216+ anchors.fill: parent;
1217+ source: backgroundImage.source ? backgroundImage : null;
1218+ property real luminance: Style.luminance(backgroundColor);
1219+ property Image backgroundImage: Image {
1220+ objectName: "backgroundImage";
1221+ source: {
1222+ if (cardData && typeof cardData["background"] === "string") return cardData["background"];
1223+ else return "";
1224+ }
1225+ }
1226+ function getColor(index) {
1227+ if (cardData && typeof cardData["background"] === "object"
1228+ && (cardData["background"]["type"] === "color" || cardData["background"]["type"] === "gradient")) {
1229+ return cardData["background"]["elements"][index];
1230+ } else return index === 0 ? "#E9E9E9" : undefined;
1231+ }
1232+ }
1233+ }
1234+readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
1235+Item {
1236+ id: artShapeHolder;
1237+ height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height;
1238+ width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width;
1239+ anchors { horizontalCenter: parent.horizontalCenter; }
1240+ Loader {
1241+ id: artShapeLoader;
1242+ objectName: "artShapeLoader";
1243+ readonly property string cardArt: cardData && cardData["art"] || "";
1244+ active: cardArt != "";
1245+ asynchronous: false;
1246+ visible: status == Loader.Ready;
1247+ sourceComponent: Item {
1248+ id: artShape;
1249+ objectName: "artShape";
1250+ visible: image.status == Image.Ready;
1251+ readonly property alias image: artImage;
1252+ ShaderEffectSource {
1253+ id: artShapeSource;
1254+ sourceItem: artImage;
1255+ anchors.centerIn: parent;
1256+ width: 1;
1257+ height: 1;
1258+ hideSource: true;
1259+ }
1260+ Loader {
1261+ anchors.fill: parent;
1262+ visible: true;
1263+ sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
1264+ Component {
1265+ id: artShapeShapeComponent;
1266+ UbuntuShape {
1267+ source: artShapeSource;
1268+ sourceFillMode: UbuntuShape.PreserveAspectCrop;
1269+ radius: "medium";
1270+ aspect: {
1271+ switch (root.artShapeStyle) {
1272+ case "inset": return UbuntuShape.Inset;
1273+ case "shadow": return UbuntuShape.DropShadow;
1274+ default:
1275+ case "flat": return UbuntuShape.Flat;
1276+ }
1277+ }
1278+ }
1279+ }
1280+ Component {
1281+ id: artShapeIconComponent;
1282+ ProportionalShape { source: artShapeSource; aspect: UbuntuShape.DropShadow; }
1283+ }
1284+ }
1285+ readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
1286+ readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1;
1287+ Component.onCompleted: { updateWidthHeightBindings(); }
1288+ Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
1289+ function updateWidthHeightBindings() {
1290+ if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
1291+ width = root.fixedArtShapeSize.width;
1292+ height = root.fixedArtShapeSize.height;
1293+ } else {
1294+ width = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.width });
1295+ height = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.height });
1296+ }
1297+ }
1298+ CroppedImageMinimumSourceSize {
1299+ id: artImage;
1300+ objectName: "artImage";
1301+ source: artShapeLoader.cardArt;
1302+ asynchronous: false;
1303+ width: root.width;
1304+ height: width / artShape.aspect;
1305+ }
1306+ }
1307+ }
1308+ }
1309+readonly property int headerHeight: row.height;
1310+Row {
1311+ id: row;
1312+ objectName: "outerRow";
1313+ property real margins: units.gu(1);
1314+ spacing: margins;
1315+ anchors { top: artShapeHolder.bottom;
1316+ topMargin: units.gu(1);
1317+left: parent.left;
1318+ }
1319+ anchors.right: parent.right;
1320+ anchors.margins: margins;
1321+ anchors.rightMargin: 0;
1322+ data: [
1323+ CroppedImageMinimumSourceSize {
1324+ id: mascotImage;
1325+ objectName: "mascotImage";
1326+ anchors { verticalCenter: parent.verticalCenter; }
1327+ source: cardData && cardData["mascot"] || "";
1328+ width: units.gu(6);
1329+ height: units.gu(5.625);
1330+ horizontalAlignment: Image.AlignHCenter;
1331+ verticalAlignment: Image.AlignVCenter;
1332+ visible: showHeader;
1333+ }
1334+,Item {
1335+ id: headerTitleContainer;
1336+ anchors { verticalCenter: parent.verticalCenter; }
1337+ width: parent.width - x;
1338+ implicitHeight: titleLabel.height + subtitleLabel.height;
1339+ data: [
1340+ Label {
1341+ id: titleLabel;
1342+ objectName: "titleLabel";
1343+ anchors { right: parent.right;
1344+rightMargin: units.gu(1);
1345+left: parent.left;
1346+ top: parent.top; }
1347+ elide: Text.ElideRight;
1348+ fontSize: "small";
1349+ wrapMode: Text.Wrap;
1350+ maximumLineCount: 2;
1351+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
1352+ color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? theme.palette.normal.baseText : "white");
1353+ visible: showHeader ;
1354+ width: undefined;
1355+ text: root.title;
1356+ font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
1357+ horizontalAlignment: Text.AlignLeft;
1358+ }
1359+,Label {
1360+ id: subtitleLabel;
1361+ objectName: "subtitleLabel";
1362+ anchors { right: parent.right;
1363+ left: parent.left;
1364+rightMargin: units.gu(1);
1365+top: titleLabel.bottom;
1366+ }
1367+ anchors.topMargin: units.dp(2);
1368+ elide: Text.ElideRight;
1369+ maximumLineCount: 1;
1370+ fontSize: "x-small";
1371+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
1372+ color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? theme.palette.normal.baseText : "white");
1373+ visible: titleLabel.visible && titleLabel.text;
1374+ text: cardData && cardData["subtitle"] || "";
1375+ font.weight: Font.Light;
1376+ }
1377+
1378+ ]
1379+ }
1380+
1381+ ]
1382+ }
1383+UbuntuShape {
1384+ id: touchdown;
1385+ objectName: "touchdown";
1386+ anchors { fill: backgroundLoader }
1387+ visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
1388+ radius: "medium";
1389+ borderSource: "radius_pressed.sci"
1390+ }
1391+implicitHeight: row.y + row.height + units.gu(1);
1392+}
1393
1394=== added file 'tests/plugins/Dash/cardcreator/12.res'
1395--- tests/plugins/Dash/cardcreator/12.res 1970-01-01 00:00:00 +0000
1396+++ tests/plugins/Dash/cardcreator/12.res 2016-03-07 13:12:28 +0000
1397@@ -0,0 +1,146 @@
1398+AbstractButton {
1399+ id: root;
1400+ property var cardData;
1401+ property string artShapeStyle: "inset";
1402+ property string backgroundShapeStyle: "inset";
1403+ property real fontScale: 1.0;
1404+ property var scopeStyle: null;
1405+ property int fixedHeaderHeight: -1;
1406+ property size fixedArtShapeSize: Qt.size(-1, -1);
1407+ readonly property string title: cardData && cardData["title"] || "";
1408+ property bool showHeader: true;
1409+ implicitWidth: childrenRect.width;
1410+ enabled: true;
1411+signal action(var actionId);
1412+readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
1413+Item {
1414+ id: artShapeHolder;
1415+ height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height;
1416+ width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width;
1417+ anchors { horizontalCenter: parent.horizontalCenter; }
1418+ Loader {
1419+ id: artShapeLoader;
1420+ objectName: "artShapeLoader";
1421+ readonly property string cardArt: cardData && cardData["art"] || "";
1422+ active: cardArt != "";
1423+ asynchronous: true;
1424+ visible: status == Loader.Ready;
1425+ sourceComponent: Item {
1426+ id: artShape;
1427+ objectName: "artShape";
1428+ visible: image.status == Image.Ready;
1429+ readonly property alias image: artImage;
1430+ ShaderEffectSource {
1431+ id: artShapeSource;
1432+ sourceItem: artImage;
1433+ anchors.centerIn: parent;
1434+ width: 1;
1435+ height: 1;
1436+ hideSource: true;
1437+ }
1438+ Loader {
1439+ anchors.fill: parent;
1440+ visible: true;
1441+ sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
1442+ Component {
1443+ id: artShapeShapeComponent;
1444+ UbuntuShape {
1445+ source: artShapeSource;
1446+ sourceFillMode: UbuntuShape.PreserveAspectCrop;
1447+ radius: "medium";
1448+ aspect: {
1449+ switch (root.artShapeStyle) {
1450+ case "inset": return UbuntuShape.Inset;
1451+ case "shadow": return UbuntuShape.DropShadow;
1452+ default:
1453+ case "flat": return UbuntuShape.Flat;
1454+ }
1455+ }
1456+ }
1457+ }
1458+ Component {
1459+ id: artShapeIconComponent;
1460+ ProportionalShape { source: artShapeSource; aspect: UbuntuShape.DropShadow; }
1461+ }
1462+ }
1463+ readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
1464+ readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 0.75;
1465+ Component.onCompleted: { updateWidthHeightBindings(); }
1466+ Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
1467+ function updateWidthHeightBindings() {
1468+ if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
1469+ width = root.fixedArtShapeSize.width;
1470+ height = root.fixedArtShapeSize.height;
1471+ } else {
1472+ width = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.width });
1473+ height = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.height });
1474+ }
1475+ }
1476+ CroppedImageMinimumSourceSize {
1477+ id: artImage;
1478+ objectName: "artImage";
1479+ source: artShapeLoader.cardArt;
1480+ asynchronous: true;
1481+ width: root.width;
1482+ height: width / artShape.aspect;
1483+ }
1484+ }
1485+ }
1486+ }
1487+readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;
1488+Label {
1489+ id: titleLabel;
1490+ objectName: "titleLabel";
1491+ anchors { right: parent.right;
1492+ left: parent.left;
1493+ top: artShapeHolder.bottom;
1494+ topMargin: units.gu(1);
1495+ }
1496+ elide: Text.ElideRight;
1497+ fontSize: "small";
1498+ wrapMode: Text.Wrap;
1499+ maximumLineCount: 2;
1500+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
1501+ color: root.scopeStyle ? root.scopeStyle.foreground : theme.palette.normal.baseText;
1502+ visible: showHeader ;
1503+ width: undefined;
1504+ text: root.title;
1505+ font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
1506+ horizontalAlignment: Text.AlignLeft;
1507+ }
1508+Label {
1509+ id: subtitleLabel;
1510+ objectName: "subtitleLabel";
1511+ anchors { left: titleLabel.left;
1512+ leftMargin: titleLabel.leftMargin;
1513+ right: titleLabel.right;
1514+ top: titleLabel.bottom;
1515+ }
1516+ anchors.topMargin: units.dp(2);
1517+ elide: Text.ElideRight;
1518+ maximumLineCount: 1;
1519+ fontSize: "x-small";
1520+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
1521+ color: root.scopeStyle ? root.scopeStyle.foreground : theme.palette.normal.baseText;
1522+ visible: titleLabel.visible && titleLabel.text;
1523+ text: cardData && cardData["subtitle"] || "";
1524+ font.weight: Font.Light;
1525+ }
1526+CardSocialActions {
1527+ id: socialActionsRow;
1528+ objectName: "socialActionsRow";
1529+ anchors { top: subtitleLabel.bottom; left: parent.left; right: parent.right; topMargin: units.gu(1); }
1530+ color: root.scopeStyle ? root.scopeStyle.foreground : theme.palette.normal.baseText;
1531+ model: cardData && cardData["socialActions"];
1532+ onClicked: root.action(actionId);
1533+}
1534+UbuntuShape {
1535+ id: touchdown;
1536+ objectName: "touchdown";
1537+ anchors { fill: artShapeHolder }
1538+ visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
1539+ radius: "medium";
1540+ borderSource: "radius_pressed.sci"
1541+}
1542+implicitHeight: socialActionsRow.y + socialActionsRow.height + units.gu(1);
1543+}
1544
1545=== added file 'tests/plugins/Dash/cardcreator/12.res.cardcreator'
1546--- tests/plugins/Dash/cardcreator/12.res.cardcreator 1970-01-01 00:00:00 +0000
1547+++ tests/plugins/Dash/cardcreator/12.res.cardcreator 2016-03-07 13:12:28 +0000
1548@@ -0,0 +1,145 @@
1549+AbstractButton {
1550+ id: root;
1551+ property var cardData;
1552+ property string artShapeStyle: "inset";
1553+ property string backgroundShapeStyle: "inset";
1554+ property real fontScale: 1.0;
1555+ property var scopeStyle: null;
1556+ property size fixedArtShapeSize: Qt.size(-1, -1);
1557+ readonly property string title: cardData && cardData["title"] || "";
1558+ property bool showHeader: true;
1559+ implicitWidth: childrenRect.width;
1560+ enabled: true;
1561+signal action(var actionId);
1562+readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
1563+Item {
1564+ id: artShapeHolder;
1565+ height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height;
1566+ width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width;
1567+ anchors { horizontalCenter: parent.horizontalCenter; }
1568+ Loader {
1569+ id: artShapeLoader;
1570+ objectName: "artShapeLoader";
1571+ readonly property string cardArt: cardData && cardData["art"] || "";
1572+ active: cardArt != "";
1573+ asynchronous: false;
1574+ visible: status == Loader.Ready;
1575+ sourceComponent: Item {
1576+ id: artShape;
1577+ objectName: "artShape";
1578+ visible: image.status == Image.Ready;
1579+ readonly property alias image: artImage;
1580+ ShaderEffectSource {
1581+ id: artShapeSource;
1582+ sourceItem: artImage;
1583+ anchors.centerIn: parent;
1584+ width: 1;
1585+ height: 1;
1586+ hideSource: true;
1587+ }
1588+ Loader {
1589+ anchors.fill: parent;
1590+ visible: true;
1591+ sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
1592+ Component {
1593+ id: artShapeShapeComponent;
1594+ UbuntuShape {
1595+ source: artShapeSource;
1596+ sourceFillMode: UbuntuShape.PreserveAspectCrop;
1597+ radius: "medium";
1598+ aspect: {
1599+ switch (root.artShapeStyle) {
1600+ case "inset": return UbuntuShape.Inset;
1601+ case "shadow": return UbuntuShape.DropShadow;
1602+ default:
1603+ case "flat": return UbuntuShape.Flat;
1604+ }
1605+ }
1606+ }
1607+ }
1608+ Component {
1609+ id: artShapeIconComponent;
1610+ ProportionalShape { source: artShapeSource; aspect: UbuntuShape.DropShadow; }
1611+ }
1612+ }
1613+ readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
1614+ readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 0.75;
1615+ Component.onCompleted: { updateWidthHeightBindings(); }
1616+ Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
1617+ function updateWidthHeightBindings() {
1618+ if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
1619+ width = root.fixedArtShapeSize.width;
1620+ height = root.fixedArtShapeSize.height;
1621+ } else {
1622+ width = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.width });
1623+ height = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.height });
1624+ }
1625+ }
1626+ CroppedImageMinimumSourceSize {
1627+ id: artImage;
1628+ objectName: "artImage";
1629+ source: artShapeLoader.cardArt;
1630+ asynchronous: false;
1631+ width: root.width;
1632+ height: width / artShape.aspect;
1633+ }
1634+ }
1635+ }
1636+ }
1637+readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;
1638+Label {
1639+ id: titleLabel;
1640+ objectName: "titleLabel";
1641+ anchors { right: parent.right;
1642+ left: parent.left;
1643+ top: artShapeHolder.bottom;
1644+ topMargin: units.gu(1);
1645+ }
1646+ elide: Text.ElideRight;
1647+ fontSize: "small";
1648+ wrapMode: Text.Wrap;
1649+ maximumLineCount: 2;
1650+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
1651+ color: root.scopeStyle ? root.scopeStyle.foreground : theme.palette.normal.baseText;
1652+ visible: showHeader ;
1653+ width: undefined;
1654+ text: root.title;
1655+ font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
1656+ horizontalAlignment: Text.AlignLeft;
1657+ }
1658+Label {
1659+ id: subtitleLabel;
1660+ objectName: "subtitleLabel";
1661+ anchors { left: titleLabel.left;
1662+ leftMargin: titleLabel.leftMargin;
1663+ right: titleLabel.right;
1664+ top: titleLabel.bottom;
1665+ }
1666+ anchors.topMargin: units.dp(2);
1667+ elide: Text.ElideRight;
1668+ maximumLineCount: 1;
1669+ fontSize: "x-small";
1670+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
1671+ color: root.scopeStyle ? root.scopeStyle.foreground : theme.palette.normal.baseText;
1672+ visible: titleLabel.visible && titleLabel.text;
1673+ text: cardData && cardData["subtitle"] || "";
1674+ font.weight: Font.Light;
1675+ }
1676+CardSocialActions {
1677+ id: socialActionsRow;
1678+ objectName: "socialActionsRow";
1679+ anchors { top: subtitleLabel.bottom; left: parent.left; right: parent.right; topMargin: units.gu(1); }
1680+ color: root.scopeStyle ? root.scopeStyle.foreground : theme.palette.normal.baseText;
1681+ model: cardData && cardData["socialActions"];
1682+ onClicked: root.action(actionId);
1683+}
1684+UbuntuShape {
1685+ id: touchdown;
1686+ objectName: "touchdown";
1687+ anchors { fill: artShapeHolder }
1688+ visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
1689+ radius: "medium";
1690+ borderSource: "radius_pressed.sci"
1691+}
1692+implicitHeight: socialActionsRow.y + socialActionsRow.height + units.gu(1);
1693+}
1694
1695=== added file 'tests/plugins/Dash/cardcreator/12.tst'
1696--- tests/plugins/Dash/cardcreator/12.tst 1970-01-01 00:00:00 +0000
1697+++ tests/plugins/Dash/cardcreator/12.tst 2016-03-07 13:12:28 +0000
1698@@ -0,0 +1,3 @@
1699+template: {"card-layout":"vertical","card-size":"small","category-layout":"grid","collapsed-rows":2}
1700+components: {"art":{"aspect-ratio":0.75,"field":"art"},"subtitle":{"field":"price"},"title":{"field":"title"},"attributes":{},"socialActions":[{"id":"like","label":"text1","icon":"image://theme/ok","temporaryIcon":"image://theme/undo"},{"id":"share","label":"text2","icon":"image://theme/cancel"}]}
1701+result: 12.res
1702
1703=== modified file 'tests/plugins/Dash/cardcreator/2.res'
1704--- tests/plugins/Dash/cardcreator/2.res 2016-01-28 14:11:14 +0000
1705+++ tests/plugins/Dash/cardcreator/2.res 2016-03-07 13:12:28 +0000
1706@@ -5,20 +5,18 @@
1707 property string backgroundShapeStyle: "inset";
1708 property real fontScale: 1.0;
1709 property var scopeStyle: null;
1710- property int titleAlignment: Text.AlignLeft;
1711 property int fixedHeaderHeight: -1;
1712 property size fixedArtShapeSize: Qt.size(-1, -1);
1713 readonly property string title: cardData && cardData["title"] || "";
1714- property bool asynchronous: true;
1715 property bool showHeader: true;
1716 implicitWidth: childrenRect.width;
1717 enabled: true;
1718-
1719+signal action(var actionId);
1720 Loader {
1721 id: backgroundLoader;
1722 objectName: "backgroundLoader";
1723 anchors.fill: parent;
1724- asynchronous: root.asynchronous;
1725+ asynchronous: true;
1726 visible: status == Loader.Ready;
1727 sourceComponent: UbuntuShape {
1728 objectName: "background";
1729@@ -59,7 +57,7 @@
1730 objectName: "outerRow";
1731 property real margins: units.gu(1);
1732 spacing: margins;
1733- height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
1734+ height: root.fixedHeaderHeight;
1735 anchors { top: parent.top;
1736 topMargin: units.gu(1);
1737 left: parent.left;
1738@@ -102,7 +100,7 @@
1739 width: undefined;
1740 text: root.title;
1741 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
1742- horizontalAlignment: root.titleAlignment;
1743+ horizontalAlignment: Text.AlignLeft;
1744 }
1745 ,Label {
1746 id: subtitleLabel;
1747
1748=== added file 'tests/plugins/Dash/cardcreator/2.res.cardcreator'
1749--- tests/plugins/Dash/cardcreator/2.res.cardcreator 1970-01-01 00:00:00 +0000
1750+++ tests/plugins/Dash/cardcreator/2.res.cardcreator 2016-03-07 13:12:28 +0000
1751@@ -0,0 +1,136 @@
1752+AbstractButton {
1753+ id: root;
1754+ property var cardData;
1755+ property string artShapeStyle: "inset";
1756+ property string backgroundShapeStyle: "inset";
1757+ property real fontScale: 1.0;
1758+ property var scopeStyle: null;
1759+ property size fixedArtShapeSize: Qt.size(-1, -1);
1760+ readonly property string title: cardData && cardData["title"] || "";
1761+ property bool showHeader: true;
1762+ implicitWidth: childrenRect.width;
1763+ enabled: true;
1764+signal action(var actionId);
1765+Loader {
1766+ id: backgroundLoader;
1767+ objectName: "backgroundLoader";
1768+ anchors.fill: parent;
1769+ asynchronous: false;
1770+ visible: status == Loader.Ready;
1771+ sourceComponent: UbuntuShape {
1772+ objectName: "background";
1773+ radius: "medium";
1774+ aspect: {
1775+ switch (root.backgroundShapeStyle) {
1776+ case "inset": return UbuntuShape.Inset;
1777+ case "shadow": return UbuntuShape.DropShadow;
1778+ default:
1779+ case "flat": return UbuntuShape.Flat;
1780+ }
1781+ }
1782+ backgroundColor: getColor(0) || "white";
1783+ secondaryBackgroundColor: getColor(1) || backgroundColor;
1784+ backgroundMode: UbuntuShape.VerticalGradient;
1785+ anchors.fill: parent;
1786+ source: backgroundImage.source ? backgroundImage : null;
1787+ property real luminance: Style.luminance(backgroundColor);
1788+ property Image backgroundImage: Image {
1789+ objectName: "backgroundImage";
1790+ source: {
1791+ if (cardData && typeof cardData["background"] === "string") return cardData["background"];
1792+ else return "";
1793+ }
1794+ }
1795+ function getColor(index) {
1796+ if (cardData && typeof cardData["background"] === "object"
1797+ && (cardData["background"]["type"] === "color" || cardData["background"]["type"] === "gradient")) {
1798+ return cardData["background"]["elements"][index];
1799+ } else return index === 0 ? "#E9E9E9" : undefined;
1800+ }
1801+ }
1802+ }
1803+readonly property size artShapeSize: Qt.size(-1, -1);
1804+readonly property int headerHeight: row.height;
1805+Row {
1806+ id: row;
1807+ objectName: "outerRow";
1808+ property real margins: units.gu(1);
1809+ spacing: margins;
1810+ anchors { top: parent.top;
1811+ topMargin: units.gu(1);
1812+ left: parent.left;
1813+ }
1814+ anchors.right: parent.right;
1815+ anchors.margins: margins;
1816+ anchors.rightMargin: 0;
1817+ data: [
1818+CroppedImageMinimumSourceSize {
1819+ id: mascotImage;
1820+ objectName: "mascotImage";
1821+ anchors { verticalCenter: parent.verticalCenter; }
1822+ source: cardData && cardData["mascot"] || "";
1823+ width: units.gu(6);
1824+ height: units.gu(5.625);
1825+ horizontalAlignment: Image.AlignHCenter;
1826+ verticalAlignment: Image.AlignVCenter;
1827+ visible: showHeader;
1828+ }
1829+,Item {
1830+ id: headerTitleContainer;
1831+ anchors { verticalCenter: parent.verticalCenter; }
1832+ width: parent.width - x;
1833+ implicitHeight: titleLabel.height + subtitleLabel.height;
1834+ data: [
1835+ Label {
1836+ id: titleLabel;
1837+ objectName: "titleLabel";
1838+ anchors { right: parent.right;
1839+ rightMargin: units.gu(1);
1840+ left: parent.left;
1841+ top: parent.top; }
1842+ elide: Text.ElideRight;
1843+ fontSize: "small";
1844+ wrapMode: Text.Wrap;
1845+ maximumLineCount: 2;
1846+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
1847+ color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? theme.palette.normal.baseText : "white");
1848+ visible: showHeader ;
1849+ width: undefined;
1850+ text: root.title;
1851+ font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
1852+ horizontalAlignment: Text.AlignLeft;
1853+ }
1854+ ,Label {
1855+ id: subtitleLabel;
1856+ objectName: "subtitleLabel";
1857+ anchors { right: parent.right;
1858+ left: parent.left;
1859+ rightMargin: units.gu(1);
1860+ top: titleLabel.bottom;
1861+ }
1862+ anchors.topMargin: units.dp(2);
1863+ elide: Text.ElideRight;
1864+ maximumLineCount: 1;
1865+ fontSize: "x-small";
1866+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
1867+ color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? theme.palette.normal.baseText : "white");
1868+ visible: titleLabel.visible && titleLabel.text;
1869+ text: cardData && cardData["subtitle"] || "";
1870+ font.weight: Font.Light;
1871+ }
1872+
1873+ ]
1874+ }
1875+
1876+ ]
1877+ }
1878+UbuntuShape {
1879+ id: touchdown;
1880+ objectName: "touchdown";
1881+ anchors { fill: backgroundLoader }
1882+ visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
1883+ radius: "medium";
1884+ borderSource: "radius_pressed.sci"
1885+}
1886+implicitHeight: row.y + row.height + units.gu(1);
1887+}
1888
1889=== modified file 'tests/plugins/Dash/cardcreator/3.res'
1890--- tests/plugins/Dash/cardcreator/3.res 2016-02-11 13:13:31 +0000
1891+++ tests/plugins/Dash/cardcreator/3.res 2016-03-07 13:12:28 +0000
1892@@ -5,15 +5,13 @@
1893 property string backgroundShapeStyle: "inset";
1894 property real fontScale: 1.0;
1895 property var scopeStyle: null;
1896- property int titleAlignment: Text.AlignLeft;
1897 property int fixedHeaderHeight: -1;
1898 property size fixedArtShapeSize: Qt.size(-1, -1);
1899 readonly property string title: cardData && cardData["title"] || "";
1900- property bool asynchronous: true;
1901 property bool showHeader: true;
1902 implicitWidth: childrenRect.width;
1903 enabled: true;
1904-
1905+signal action(var actionId);
1906 readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
1907 Item {
1908 id: artShapeHolder;
1909@@ -25,7 +23,7 @@
1910 objectName: "artShapeLoader";
1911 readonly property string cardArt: cardData && cardData["art"] || decodeURI("IHAVE%5C%22ESCAPED%5C%22QUOTES%5C%22");
1912 active: cardArt != "";
1913- asynchronous: root.asynchronous;
1914+ asynchronous: true;
1915 visible: status == Loader.Ready;
1916 sourceComponent: Item {
1917 id: artShape;
1918@@ -82,7 +80,7 @@
1919 id: artImage;
1920 objectName: "artImage";
1921 source: artShapeLoader.cardArt;
1922- asynchronous: root.asynchronous;
1923+ asynchronous: true;
1924 width: root.width;
1925 height: width / artShape.aspect;
1926 onStatusChanged: if (status === Image.Error) source = decodeURI("IHAVE%5C%22ESCAPED%5C%22QUOTES%5C%22");
1927@@ -109,7 +107,7 @@
1928 width: undefined;
1929 text: root.title;
1930 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
1931- horizontalAlignment: root.titleAlignment;
1932+ horizontalAlignment: Text.AlignLeft;
1933 }
1934 Label {
1935 id: subtitleLabel;
1936
1937=== added file 'tests/plugins/Dash/cardcreator/3.res.cardcreator'
1938--- tests/plugins/Dash/cardcreator/3.res.cardcreator 1970-01-01 00:00:00 +0000
1939+++ tests/plugins/Dash/cardcreator/3.res.cardcreator 2016-03-07 13:12:28 +0000
1940@@ -0,0 +1,137 @@
1941+AbstractButton {
1942+ id: root;
1943+ property var cardData;
1944+ property string artShapeStyle: "inset";
1945+ property string backgroundShapeStyle: "inset";
1946+ property real fontScale: 1.0;
1947+ property var scopeStyle: null;
1948+ property size fixedArtShapeSize: Qt.size(-1, -1);
1949+ readonly property string title: cardData && cardData["title"] || "";
1950+ property bool showHeader: true;
1951+ implicitWidth: childrenRect.width;
1952+ enabled: true;
1953+signal action(var actionId);
1954+readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
1955+Item {
1956+ id: artShapeHolder;
1957+ height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height;
1958+ width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width;
1959+ anchors { horizontalCenter: parent.horizontalCenter; }
1960+ Loader {
1961+ id: artShapeLoader;
1962+ objectName: "artShapeLoader";
1963+ readonly property string cardArt: cardData && cardData["art"] || "";
1964+ active: cardArt != "";
1965+ asynchronous: false;
1966+ visible: status == Loader.Ready;
1967+ sourceComponent: Item {
1968+ id: artShape;
1969+ objectName: "artShape";
1970+ visible: image.status == Image.Ready;
1971+ readonly property alias image: artImage;
1972+ ShaderEffectSource {
1973+ id: artShapeSource;
1974+ sourceItem: artImage;
1975+ anchors.centerIn: parent;
1976+ width: 1;
1977+ height: 1;
1978+ hideSource: true;
1979+ }
1980+ Loader {
1981+ anchors.fill: parent;
1982+ visible: true;
1983+ sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
1984+ Component {
1985+ id: artShapeShapeComponent;
1986+ UbuntuShape {
1987+ source: artShapeSource;
1988+ sourceFillMode: UbuntuShape.PreserveAspectCrop;
1989+ radius: "medium";
1990+ aspect: {
1991+ switch (root.artShapeStyle) {
1992+ case "inset": return UbuntuShape.Inset;
1993+ case "shadow": return UbuntuShape.DropShadow;
1994+ default:
1995+ case "flat": return UbuntuShape.Flat;
1996+ }
1997+ }
1998+ }
1999+ }
2000+ Component {
2001+ id: artShapeIconComponent;
2002+ ProportionalShape { source: artShapeSource; aspect: UbuntuShape.DropShadow; }
2003+ }
2004+ }
2005+ readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
2006+ readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 0.75;
2007+ Component.onCompleted: { updateWidthHeightBindings(); }
2008+ Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
2009+ function updateWidthHeightBindings() {
2010+ if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
2011+ width = root.fixedArtShapeSize.width;
2012+ height = root.fixedArtShapeSize.height;
2013+ } else {
2014+ width = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.width });
2015+ height = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.height });
2016+ }
2017+ }
2018+ CroppedImageMinimumSourceSize {
2019+ id: artImage;
2020+ objectName: "artImage";
2021+ source: artShapeLoader.cardArt;
2022+ asynchronous: false;
2023+ width: root.width;
2024+ height: width / artShape.aspect;
2025+ }
2026+ }
2027+ }
2028+ }
2029+readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;
2030+Label {
2031+ id: titleLabel;
2032+ objectName: "titleLabel";
2033+ anchors { right: parent.right;
2034+ left: parent.left;
2035+ top: artShapeHolder.bottom;
2036+ topMargin: units.gu(1);
2037+ }
2038+ elide: Text.ElideRight;
2039+ fontSize: "small";
2040+ wrapMode: Text.Wrap;
2041+ maximumLineCount: 2;
2042+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
2043+ color: root.scopeStyle ? root.scopeStyle.foreground : theme.palette.normal.baseText;
2044+ visible: showHeader ;
2045+ width: undefined;
2046+ text: root.title;
2047+ font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
2048+ horizontalAlignment: Text.AlignLeft;
2049+ }
2050+Label {
2051+ id: subtitleLabel;
2052+ objectName: "subtitleLabel";
2053+ anchors { left: titleLabel.left;
2054+ leftMargin: titleLabel.leftMargin;
2055+ right: titleLabel.right;
2056+ top: titleLabel.bottom;
2057+ }
2058+ anchors.topMargin: units.dp(2);
2059+ elide: Text.ElideRight;
2060+ maximumLineCount: 1;
2061+ fontSize: "x-small";
2062+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
2063+ color: root.scopeStyle ? root.scopeStyle.foreground : theme.palette.normal.baseText;
2064+ visible: titleLabel.visible && titleLabel.text;
2065+ text: cardData && cardData["subtitle"] || "";
2066+ font.weight: Font.Light;
2067+ }
2068+UbuntuShape {
2069+ id: touchdown;
2070+ objectName: "touchdown";
2071+ anchors { fill: artShapeHolder }
2072+ visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
2073+ radius: "medium";
2074+ borderSource: "radius_pressed.sci"
2075+}
2076+implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1);
2077+}
2078
2079=== modified file 'tests/plugins/Dash/cardcreator/4.res'
2080--- tests/plugins/Dash/cardcreator/4.res 2016-01-28 14:11:14 +0000
2081+++ tests/plugins/Dash/cardcreator/4.res 2016-03-07 13:12:28 +0000
2082@@ -5,15 +5,13 @@
2083 property string backgroundShapeStyle: "inset";
2084 property real fontScale: 1.0;
2085 property var scopeStyle: null;
2086- property int titleAlignment: Text.AlignLeft;
2087 property int fixedHeaderHeight: -1;
2088 property size fixedArtShapeSize: Qt.size(-1, -1);
2089 readonly property string title: cardData && cardData["title"] || "";
2090- property bool asynchronous: true;
2091 property bool showHeader: true;
2092 implicitWidth: childrenRect.width;
2093 enabled: true;
2094-
2095+signal action(var actionId);
2096 readonly property size artShapeSize: Qt.size(-1, -1);
2097 readonly property int headerHeight: row.height;
2098 Row {
2099@@ -21,7 +19,7 @@
2100 objectName: "outerRow";
2101 property real margins: units.gu(1);
2102 spacing: margins;
2103- height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
2104+ height: root.fixedHeaderHeight;
2105 anchors { top: parent.top;
2106 topMargin: units.gu(1);
2107 left: parent.left;
2108@@ -33,7 +31,7 @@
2109 Loader {
2110 id: mascotShapeLoader;
2111 objectName: "mascotShapeLoader";
2112- asynchronous: root.asynchronous;
2113+ asynchronous: true;
2114 active: mascotImage.status === Image.Ready;
2115 visible: showHeader && active && status == Loader.Ready;
2116 width: units.gu(6);
2117@@ -77,7 +75,7 @@
2118 width: undefined;
2119 text: root.title;
2120 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
2121- horizontalAlignment: root.titleAlignment;
2122+ horizontalAlignment: Text.AlignLeft;
2123 }
2124 ,Label {
2125 id: subtitleLabel;
2126
2127=== added file 'tests/plugins/Dash/cardcreator/4.res.cardcreator'
2128--- tests/plugins/Dash/cardcreator/4.res.cardcreator 1970-01-01 00:00:00 +0000
2129+++ tests/plugins/Dash/cardcreator/4.res.cardcreator 2016-03-07 13:12:28 +0000
2130@@ -0,0 +1,109 @@
2131+AbstractButton {
2132+ id: root;
2133+ property var cardData;
2134+ property string artShapeStyle: "inset";
2135+ property string backgroundShapeStyle: "inset";
2136+ property real fontScale: 1.0;
2137+ property var scopeStyle: null;
2138+ property size fixedArtShapeSize: Qt.size(-1, -1);
2139+ readonly property string title: cardData && cardData["title"] || "";
2140+ property bool showHeader: true;
2141+ implicitWidth: childrenRect.width;
2142+ enabled: true;
2143+signal action(var actionId);
2144+readonly property size artShapeSize: Qt.size(-1, -1);
2145+readonly property int headerHeight: row.height;
2146+Row {
2147+ id: row;
2148+ objectName: "outerRow";
2149+ property real margins: units.gu(1);
2150+ spacing: margins;
2151+ anchors { top: parent.top;
2152+ topMargin: units.gu(1);
2153+ left: parent.left;
2154+}
2155+ anchors.right: parent.right;
2156+ anchors.margins: margins;
2157+ anchors.rightMargin: 0;
2158+data: [
2159+Loader {
2160+ id: mascotShapeLoader;
2161+ objectName: "mascotShapeLoader";
2162+ asynchronous: false;
2163+ active: mascotImage.status === Image.Ready;
2164+ visible: showHeader && active && status == Loader.Ready;
2165+ width: units.gu(6);
2166+ height: units.gu(5.625);
2167+ sourceComponent: UbuntuShape { image: mascotImage }
2168+ anchors { verticalCenter: parent.verticalCenter; }
2169+ }
2170+
2171+,CroppedImageMinimumSourceSize {
2172+ id: mascotImage;
2173+ objectName: "mascotImage";
2174+ anchors { verticalCenter: parent.verticalCenter; }
2175+ source: cardData && cardData["mascot"] || "";
2176+ width: units.gu(6);
2177+ height: units.gu(5.625);
2178+ horizontalAlignment: Image.AlignHCenter;
2179+ verticalAlignment: Image.AlignVCenter;
2180+ visible: false;
2181+ }
2182+
2183+,Item {
2184+ id: headerTitleContainer;
2185+ anchors { verticalCenter: parent.verticalCenter; }
2186+ width: parent.width - x;
2187+ implicitHeight: titleLabel.height + subtitleLabel.height;
2188+ data: [
2189+Label {
2190+ id: titleLabel;
2191+ objectName: "titleLabel";
2192+ anchors { right: parent.right;
2193+ rightMargin: units.gu(1);
2194+ left: parent.left;
2195+ top: parent.top; }
2196+ elide: Text.ElideRight;
2197+ fontSize: "small";
2198+ wrapMode: Text.Wrap;
2199+ maximumLineCount: 2;
2200+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
2201+ color: root.scopeStyle ? root.scopeStyle.foreground : theme.palette.normal.baseText;
2202+ visible: showHeader ;
2203+ width: undefined;
2204+ text: root.title;
2205+ font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
2206+ horizontalAlignment: Text.AlignLeft;
2207+ }
2208+,Label {
2209+ id: subtitleLabel;
2210+ objectName: "subtitleLabel";
2211+ anchors { right: parent.right;
2212+ left: parent.left;
2213+ rightMargin: units.gu(1);
2214+ top: titleLabel.bottom;
2215+ }
2216+ anchors.topMargin: units.dp(2);
2217+ elide: Text.ElideRight;
2218+ maximumLineCount: 1;
2219+ fontSize: "x-small";
2220+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
2221+ color: root.scopeStyle ? root.scopeStyle.foreground : theme.palette.normal.baseText;
2222+ visible: titleLabel.visible && titleLabel.text;
2223+ text: cardData && cardData["subtitle"] || "";
2224+ font.weight: Font.Light;
2225+ }
2226+]
2227+}
2228+]
2229+}
2230+UbuntuShape {
2231+ id: touchdown;
2232+ objectName: "touchdown";
2233+ anchors { fill: root }
2234+ visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
2235+ radius: "medium";
2236+ borderSource: "radius_pressed.sci"
2237+}
2238+implicitHeight: row.y + row.height + units.gu(1);
2239+}
2240
2241=== modified file 'tests/plugins/Dash/cardcreator/5.res'
2242--- tests/plugins/Dash/cardcreator/5.res 2016-02-11 13:13:31 +0000
2243+++ tests/plugins/Dash/cardcreator/5.res 2016-03-07 13:12:28 +0000
2244@@ -5,15 +5,13 @@
2245 property string backgroundShapeStyle: "inset";
2246 property real fontScale: 1.0;
2247 property var scopeStyle: null;
2248- property int titleAlignment: Text.AlignLeft;
2249 property int fixedHeaderHeight: -1;
2250 property size fixedArtShapeSize: Qt.size(-1, -1);
2251 readonly property string title: cardData && cardData["title"] || "";
2252- property bool asynchronous: true;
2253 property bool showHeader: true;
2254 implicitWidth: childrenRect.width;
2255 enabled: false;
2256-
2257+signal action(var actionId);
2258 readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
2259 Item {
2260 id: artShapeHolder;
2261@@ -25,7 +23,7 @@
2262 objectName: "artShapeLoader";
2263 readonly property string cardArt: cardData && cardData["art"] || "";
2264 active: cardArt != "";
2265- asynchronous: root.asynchronous;
2266+ asynchronous: true;
2267 visible: status == Loader.Ready;
2268 sourceComponent: Item {
2269 id: artShape;
2270@@ -82,7 +80,7 @@
2271 id: artImage;
2272 objectName: "artImage";
2273 source: artShapeLoader.cardArt;
2274- asynchronous: root.asynchronous;
2275+ asynchronous: true;
2276 width: root.width;
2277 height: width / artShape.aspect;
2278 }
2279@@ -91,10 +89,10 @@
2280 }
2281 Loader {
2282 id: overlayLoader;
2283- readonly property real overlayHeight: (fixedHeaderHeight > 0 ? fixedHeaderHeight : headerHeight) + units.gu(2);
2284+ readonly property real overlayHeight: root.fixedHeaderHeight + units.gu(2);
2285 anchors.fill: artShapeHolder;
2286 active: artShapeLoader.active && artShapeLoader.item && artShapeLoader.item.image.status === Image.Ready || false;
2287- asynchronous: root.asynchronous;
2288+ asynchronous: true;
2289 visible: showHeader && status == Loader.Ready;
2290 sourceComponent: UbuntuShapeOverlay {
2291 id: overlay;
2292@@ -126,7 +124,7 @@
2293 width: undefined;
2294 text: root.title;
2295 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
2296- horizontalAlignment: root.titleAlignment;
2297+ horizontalAlignment: Text.AlignLeft;
2298 }
2299 Label {
2300 id: subtitleLabel;
2301
2302=== added file 'tests/plugins/Dash/cardcreator/5.res.cardcreator'
2303--- tests/plugins/Dash/cardcreator/5.res.cardcreator 1970-01-01 00:00:00 +0000
2304+++ tests/plugins/Dash/cardcreator/5.res.cardcreator 2016-03-07 13:12:28 +0000
2305@@ -0,0 +1,156 @@
2306+AbstractButton {
2307+ id: root;
2308+ property var cardData;
2309+ property string artShapeStyle: "inset";
2310+ property string backgroundShapeStyle: "inset";
2311+ property real fontScale: 1.0;
2312+ property var scopeStyle: null;
2313+ property size fixedArtShapeSize: Qt.size(-1, -1);
2314+ readonly property string title: cardData && cardData["title"] || "";
2315+ property bool showHeader: true;
2316+ implicitWidth: childrenRect.width;
2317+ enabled: false;
2318+signal action(var actionId);
2319+readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
2320+Item {
2321+ id: artShapeHolder;
2322+ height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height;
2323+ width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width;
2324+ anchors { horizontalCenter: parent.horizontalCenter; }
2325+ Loader {
2326+ id: artShapeLoader;
2327+ objectName: "artShapeLoader";
2328+ readonly property string cardArt: cardData && cardData["art"] || "";
2329+ active: cardArt != "";
2330+ asynchronous: false;
2331+ visible: status == Loader.Ready;
2332+ sourceComponent: Item {
2333+ id: artShape;
2334+ objectName: "artShape";
2335+ visible: image.status == Image.Ready;
2336+ readonly property alias image: artImage;
2337+ ShaderEffectSource {
2338+ id: artShapeSource;
2339+ sourceItem: artImage;
2340+ anchors.centerIn: parent;
2341+ width: 1;
2342+ height: 1;
2343+ hideSource: false;
2344+ }
2345+ Loader {
2346+ anchors.fill: parent;
2347+ visible: false;
2348+ sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
2349+ Component {
2350+ id: artShapeShapeComponent;
2351+ UbuntuShape {
2352+ source: artShapeSource;
2353+ sourceFillMode: UbuntuShape.PreserveAspectCrop;
2354+ radius: "medium";
2355+ aspect: {
2356+ switch (root.artShapeStyle) {
2357+ case "inset": return UbuntuShape.Inset;
2358+ case "shadow": return UbuntuShape.DropShadow;
2359+ default:
2360+ case "flat": return UbuntuShape.Flat;
2361+ }
2362+ }
2363+ }
2364+ }
2365+ Component {
2366+ id: artShapeIconComponent;
2367+ ProportionalShape { source: artShapeSource; aspect: UbuntuShape.DropShadow; }
2368+ }
2369+ }
2370+ readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
2371+ readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1;
2372+ Component.onCompleted: { updateWidthHeightBindings(); }
2373+ Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
2374+ function updateWidthHeightBindings() {
2375+ if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
2376+ width = root.fixedArtShapeSize.width;
2377+ height = root.fixedArtShapeSize.height;
2378+ } else {
2379+ width = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.width });
2380+ height = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.height });
2381+ }
2382+ }
2383+ CroppedImageMinimumSourceSize {
2384+ id: artImage;
2385+ objectName: "artImage";
2386+ source: artShapeLoader.cardArt;
2387+ asynchronous: false;
2388+ width: root.width;
2389+ height: width / artShape.aspect;
2390+ }
2391+ }
2392+ }
2393+ }
2394+Loader {
2395+ id: overlayLoader;
2396+ readonly property real overlayHeight: headerHeight + units.gu(2);
2397+ anchors.fill: artShapeHolder;
2398+ active: artShapeLoader.active && artShapeLoader.item && artShapeLoader.item.image.status === Image.Ready || false;
2399+ asynchronous: false;
2400+ visible: showHeader && status == Loader.Ready;
2401+ sourceComponent: UbuntuShapeOverlay {
2402+ id: overlay;
2403+ property real luminance: Style.luminance(overlayColor);
2404+ aspect: UbuntuShape.Flat;
2405+ radius: "medium";
2406+ overlayColor: cardData && cardData["overlayColor"] || "#99000000";
2407+ overlayRect: Qt.rect(0, 1 - overlayLoader.overlayHeight / height, 1, 1);
2408+ }
2409+ }
2410+readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;
2411+Label {
2412+ id: titleLabel;
2413+ objectName: "titleLabel";
2414+ anchors { right: parent.right;
2415+ rightMargin: units.gu(1);
2416+ left: parent.left;
2417+ leftMargin: units.gu(1);
2418+ top: overlayLoader.top;
2419+ topMargin: units.gu(1) + overlayLoader.height - overlayLoader.overlayHeight;
2420+ }
2421+ elide: Text.ElideRight;
2422+ fontSize: "small";
2423+ wrapMode: Text.Wrap;
2424+ maximumLineCount: 2;
2425+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
2426+ color: root.scopeStyle && overlayLoader.item ? root.scopeStyle.getTextColor(overlayLoader.item.luminance) : (overlayLoader.item && overlayLoader.item.luminance > 0.7 ? theme.palette.normal.baseText : "white");
2427+ visible: showHeader && overlayLoader.active;
2428+ width: undefined;
2429+ text: root.title;
2430+ font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
2431+ horizontalAlignment: Text.AlignLeft;
2432+ }
2433+Label {
2434+ id: subtitleLabel;
2435+ objectName: "subtitleLabel";
2436+ anchors { left: titleLabel.left;
2437+ leftMargin: titleLabel.leftMargin;
2438+ rightMargin: units.gu(1);
2439+ right: titleLabel.right;
2440+ top: titleLabel.bottom;
2441+ }
2442+ anchors.topMargin: units.dp(2);
2443+ elide: Text.ElideRight;
2444+ maximumLineCount: 1;
2445+ fontSize: "x-small";
2446+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
2447+ color: root.scopeStyle && overlayLoader.item ? root.scopeStyle.getTextColor(overlayLoader.item.luminance) : (overlayLoader.item && overlayLoader.item.luminance > 0.7 ? theme.palette.normal.baseText : "white");
2448+ visible: titleLabel.visible && titleLabel.text;
2449+ text: cardData && cardData["subtitle"] || "";
2450+ font.weight: Font.Light;
2451+ }
2452+UbuntuShape {
2453+ id: touchdown;
2454+ objectName: "touchdown";
2455+ anchors { fill: artShapeHolder }
2456+ visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
2457+ radius: "medium";
2458+ borderSource: "radius_pressed.sci"
2459+}
2460+implicitHeight: artShapeHolder.height;
2461+}
2462
2463=== modified file 'tests/plugins/Dash/cardcreator/6.res'
2464--- tests/plugins/Dash/cardcreator/6.res 2016-02-02 08:47:07 +0000
2465+++ tests/plugins/Dash/cardcreator/6.res 2016-03-07 13:12:28 +0000
2466@@ -5,20 +5,18 @@
2467 property string backgroundShapeStyle: "inset";
2468 property real fontScale: 1.0;
2469 property var scopeStyle: null;
2470- property int titleAlignment: Text.AlignLeft;
2471 property int fixedHeaderHeight: -1;
2472 property size fixedArtShapeSize: Qt.size(-1, -1);
2473 readonly property string title: cardData && cardData["title"] || "";
2474- property bool asynchronous: true;
2475 property bool showHeader: true;
2476 implicitWidth: childrenRect.width;
2477 enabled: true;
2478-
2479+signal action(var actionId);
2480 Loader {
2481 id: backgroundLoader;
2482 objectName: "backgroundLoader";
2483 anchors.fill: parent;
2484- asynchronous: root.asynchronous;
2485+ asynchronous: true;
2486 visible: status == Loader.Ready;
2487 sourceComponent: UbuntuShape {
2488 objectName: "background";
2489@@ -81,7 +79,7 @@
2490 width: undefined;
2491 text: root.title;
2492 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
2493- horizontalAlignment: root.titleAlignment;
2494+ horizontalAlignment: Text.AlignLeft;
2495 }
2496 ,Label {
2497 id: subtitleLabel;
2498
2499=== added file 'tests/plugins/Dash/cardcreator/6.res.cardcreator'
2500--- tests/plugins/Dash/cardcreator/6.res.cardcreator 1970-01-01 00:00:00 +0000
2501+++ tests/plugins/Dash/cardcreator/6.res.cardcreator 2016-03-07 13:12:28 +0000
2502@@ -0,0 +1,126 @@
2503+AbstractButton {
2504+ id: root;
2505+ property var cardData;
2506+ property string artShapeStyle: "inset";
2507+ property string backgroundShapeStyle: "inset";
2508+ property real fontScale: 1.0;
2509+ property var scopeStyle: null;
2510+ property size fixedArtShapeSize: Qt.size(-1, -1);
2511+ readonly property string title: cardData && cardData["title"] || "";
2512+ property bool showHeader: true;
2513+ implicitWidth: childrenRect.width;
2514+ enabled: true;
2515+signal action(var actionId);
2516+Loader {
2517+ id: backgroundLoader;
2518+ objectName: "backgroundLoader";
2519+ anchors.fill: parent;
2520+ asynchronous: false;
2521+ visible: status == Loader.Ready;
2522+ sourceComponent: UbuntuShape {
2523+ objectName: "background";
2524+ radius: "medium";
2525+ aspect: {
2526+ switch (root.backgroundShapeStyle) {
2527+ case "inset": return UbuntuShape.Inset;
2528+ case "shadow": return UbuntuShape.DropShadow;
2529+ default:
2530+ case "flat": return UbuntuShape.Flat;
2531+ }
2532+ }
2533+ backgroundColor: getColor(0) || "white";
2534+ secondaryBackgroundColor: getColor(1) || backgroundColor;
2535+ backgroundMode: UbuntuShape.VerticalGradient;
2536+ anchors.fill: parent;
2537+ source: backgroundImage.source ? backgroundImage : null;
2538+ property real luminance: Style.luminance(backgroundColor);
2539+ property Image backgroundImage: Image {
2540+ objectName: "backgroundImage";
2541+ source: {
2542+ if (cardData && typeof cardData["background"] === "string") return cardData["background"];
2543+ else return decodeURI("http://assets.ubuntu.com/sites/ubuntu/latest/u/img/logos/logo-ubuntu-grey.png");
2544+ }
2545+ }
2546+ function getColor(index) {
2547+ if (cardData && typeof cardData["background"] === "object"
2548+ && (cardData["background"]["type"] === "color" || cardData["background"]["type"] === "gradient")) {
2549+ return cardData["background"]["elements"][index];
2550+ } else return index === 0 ? undefined : undefined;
2551+ }
2552+ }
2553+ }
2554+readonly property size artShapeSize: Qt.size(-1, -1);
2555+readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;
2556+Item {
2557+ id: headerTitleContainer;
2558+ anchors { right: parent.right; left: parent.left;
2559+ top: parent.top;
2560+ topMargin: units.gu(1);
2561+ leftMargin: units.gu(1);
2562+ }
2563+ width: parent.width - x;
2564+ implicitHeight: titleLabel.height + subtitleLabel.height;
2565+ data: [
2566+ Label {
2567+ id: titleLabel;
2568+ objectName: "titleLabel";
2569+ anchors { right: emblemIcon.left;
2570+ rightMargin: emblemIcon.width > 0 ? units.gu(0.5) : 0;
2571+ left: parent.left;
2572+ top: parent.top; }
2573+ elide: Text.ElideRight;
2574+ fontSize: "small";
2575+ wrapMode: Text.Wrap;
2576+ maximumLineCount: 2;
2577+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
2578+ color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? theme.palette.normal.baseText : "white");
2579+ visible: showHeader ;
2580+ width: undefined;
2581+ text: root.title;
2582+ font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
2583+ horizontalAlignment: Text.AlignLeft;
2584+ }
2585+,Label {
2586+ id: subtitleLabel;
2587+ objectName: "subtitleLabel";
2588+ anchors { right: parent.right;
2589+ left: parent.left;
2590+ rightMargin: units.gu(1);
2591+ top: titleLabel.bottom;
2592+ }
2593+ anchors.topMargin: units.dp(2);
2594+ elide: Text.ElideRight;
2595+ maximumLineCount: 1;
2596+ fontSize: "x-small";
2597+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
2598+ color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? theme.palette.normal.baseText : "white");
2599+ visible: titleLabel.visible && titleLabel.text;
2600+ text: cardData && cardData["subtitle"] || "";
2601+ font.weight: Font.Light;
2602+ }
2603+,Icon {
2604+ id: emblemIcon;
2605+ objectName: "emblemIcon";
2606+ anchors {
2607+ bottom: titleLabel.baseline;
2608+ right: parent.right;
2609+ rightMargin: units.gu(1);
2610+ }
2611+ source: cardData && cardData["emblem"] || "";
2612+ color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? theme.palette.normal.baseText : "white");
2613+ height: source != "" ? titleLabel.font.pixelSize : 0;
2614+ width: implicitWidth > 0 && implicitHeight > 0 ? (implicitWidth / implicitHeight * height) : implicitWidth;
2615+ }
2616+
2617+ ]
2618+ }
2619+UbuntuShape {
2620+ id: touchdown;
2621+ objectName: "touchdown";
2622+ anchors { fill: backgroundLoader }
2623+ visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
2624+ radius: "medium";
2625+ borderSource: "radius_pressed.sci"
2626+}
2627+implicitHeight: headerTitleContainer.y + headerTitleContainer.height + units.gu(1);
2628+}
2629
2630=== modified file 'tests/plugins/Dash/cardcreator/7.res'
2631--- tests/plugins/Dash/cardcreator/7.res 2016-01-28 14:11:14 +0000
2632+++ tests/plugins/Dash/cardcreator/7.res 2016-03-07 13:12:28 +0000
2633@@ -5,20 +5,18 @@
2634 property string backgroundShapeStyle: "inset";
2635 property real fontScale: 1.0;
2636 property var scopeStyle: null;
2637- property int titleAlignment: Text.AlignLeft;
2638 property int fixedHeaderHeight: -1;
2639 property size fixedArtShapeSize: Qt.size(-1, -1);
2640 readonly property string title: cardData && cardData["title"] || "";
2641- property bool asynchronous: true;
2642 property bool showHeader: true;
2643 implicitWidth: childrenRect.width;
2644 enabled: true;
2645-
2646+signal action(var actionId);
2647 Loader {
2648 id: backgroundLoader;
2649 objectName: "backgroundLoader";
2650 anchors.fill: parent;
2651- asynchronous: root.asynchronous;
2652+ asynchronous: true;
2653 visible: status == Loader.Ready;
2654 sourceComponent: UbuntuShape {
2655 objectName: "background";
2656@@ -59,7 +57,7 @@
2657 objectName: "outerRow";
2658 property real margins: units.gu(1);
2659 spacing: margins;
2660- height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
2661+ height: root.fixedHeaderHeight;
2662 anchors { top: parent.top;
2663 topMargin: units.gu(1);
2664 left: parent.left;
2665@@ -103,7 +101,7 @@
2666 width: undefined;
2667 text: root.title;
2668 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
2669- horizontalAlignment: root.titleAlignment;
2670+ horizontalAlignment: Text.AlignLeft;
2671 }
2672 ,Label {
2673 id: subtitleLabel;
2674
2675=== added file 'tests/plugins/Dash/cardcreator/7.res.cardcreator'
2676--- tests/plugins/Dash/cardcreator/7.res.cardcreator 1970-01-01 00:00:00 +0000
2677+++ tests/plugins/Dash/cardcreator/7.res.cardcreator 2016-03-07 13:12:28 +0000
2678@@ -0,0 +1,149 @@
2679+AbstractButton {
2680+ id: root;
2681+ property var cardData;
2682+ property string artShapeStyle: "inset";
2683+ property string backgroundShapeStyle: "inset";
2684+ property real fontScale: 1.0;
2685+ property var scopeStyle: null;
2686+ property size fixedArtShapeSize: Qt.size(-1, -1);
2687+ readonly property string title: cardData && cardData["title"] || "";
2688+ property bool showHeader: true;
2689+ implicitWidth: childrenRect.width;
2690+ enabled: true;
2691+signal action(var actionId);
2692+Loader {
2693+ id: backgroundLoader;
2694+ objectName: "backgroundLoader";
2695+ anchors.fill: parent;
2696+ asynchronous: false;
2697+ visible: status == Loader.Ready;
2698+ sourceComponent: UbuntuShape {
2699+ objectName: "background";
2700+ radius: "medium";
2701+ aspect: {
2702+ switch (root.backgroundShapeStyle) {
2703+ case "inset": return UbuntuShape.Inset;
2704+ case "shadow": return UbuntuShape.DropShadow;
2705+ default:
2706+ case "flat": return UbuntuShape.Flat;
2707+ }
2708+ }
2709+ backgroundColor: getColor(0) || "white";
2710+ secondaryBackgroundColor: getColor(1) || backgroundColor;
2711+ backgroundMode: UbuntuShape.VerticalGradient;
2712+ anchors.fill: parent;
2713+ source: backgroundImage.source ? backgroundImage : null;
2714+ property real luminance: Style.luminance(backgroundColor);
2715+ property Image backgroundImage: Image {
2716+ objectName: "backgroundImage";
2717+ source: {
2718+ if (cardData && typeof cardData["background"] === "string") return cardData["background"];
2719+ else return "";
2720+ }
2721+ }
2722+ function getColor(index) {
2723+ if (cardData && typeof cardData["background"] === "object"
2724+ && (cardData["background"]["type"] === "color" || cardData["background"]["type"] === "gradient")) {
2725+ return cardData["background"]["elements"][index];
2726+ } else return index === 0 ? "#E9E9E9" : "#E9AAE9";
2727+ }
2728+ }
2729+ }
2730+readonly property size artShapeSize: Qt.size(-1, -1);
2731+readonly property int headerHeight: row.height;
2732+Row {
2733+ id: row;
2734+ objectName: "outerRow";
2735+ property real margins: units.gu(1);
2736+ spacing: margins;
2737+ anchors { top: parent.top;
2738+ topMargin: units.gu(1);
2739+ left: parent.left;
2740+ }
2741+ anchors.right: parent.right;
2742+ anchors.margins: margins;
2743+ anchors.rightMargin: 0;
2744+ data: [
2745+CroppedImageMinimumSourceSize {
2746+ id: mascotImage;
2747+ objectName: "mascotImage";
2748+ anchors { verticalCenter: parent.verticalCenter; }
2749+ source: cardData && cardData["mascot"] || "";
2750+ width: units.gu(6);
2751+ height: units.gu(5.625);
2752+ horizontalAlignment: Image.AlignHCenter;
2753+ verticalAlignment: Image.AlignVCenter;
2754+ visible: showHeader;
2755+ }
2756+
2757+,Item {
2758+ id: headerTitleContainer;
2759+ anchors { verticalCenter: parent.verticalCenter; }
2760+ width: parent.width - x;
2761+ implicitHeight: titleLabel.height + subtitleLabel.height + attributesRow.height;
2762+ data: [
2763+ Label {
2764+ id: titleLabel;
2765+ objectName: "titleLabel";
2766+ anchors { right: parent.right;
2767+ rightMargin: units.gu(1);
2768+ left: parent.left;
2769+ top: parent.top; }
2770+ elide: Text.ElideRight;
2771+ fontSize: "small";
2772+ wrapMode: Text.Wrap;
2773+ maximumLineCount: 2;
2774+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
2775+ color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? theme.palette.normal.baseText : "white");
2776+ visible: showHeader ;
2777+ width: undefined;
2778+ text: root.title;
2779+ font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
2780+ horizontalAlignment: Text.AlignLeft;
2781+ }
2782+,Label {
2783+ id: subtitleLabel;
2784+ objectName: "subtitleLabel";
2785+ anchors { right: parent.right;
2786+ left: parent.left;
2787+ rightMargin: units.gu(1);
2788+ top: titleLabel.bottom;
2789+ }
2790+ anchors.topMargin: units.dp(2);
2791+ elide: Text.ElideRight;
2792+ maximumLineCount: 1;
2793+ fontSize: "x-small";
2794+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
2795+ color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? theme.palette.normal.baseText : "white");
2796+ visible: titleLabel.visible && titleLabel.text;
2797+ text: cardData && cardData["subtitle"] || "";
2798+ font.weight: Font.Light;
2799+ }
2800+,CardAttributes {
2801+ id: attributesRow;
2802+ objectName: "attributesRow";
2803+ anchors { right: parent.right;
2804+ left: parent.left;
2805+ rightMargin: units.gu(1);
2806+ top: subtitleLabel.bottom;
2807+ }
2808+ color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? theme.palette.normal.baseText : "white");
2809+ fontScale: root.fontScale;
2810+ model: cardData && cardData["attributes"];
2811+ }
2812+
2813+ ]
2814+ }
2815+
2816+ ]
2817+ }
2818+UbuntuShape {
2819+ id: touchdown;
2820+ objectName: "touchdown";
2821+ anchors { fill: backgroundLoader }
2822+ visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
2823+ radius: "medium";
2824+ borderSource: "radius_pressed.sci"
2825+}
2826+implicitHeight: row.y + row.height + units.gu(1);
2827+}
2828
2829=== modified file 'tests/plugins/Dash/cardcreator/8.res'
2830--- tests/plugins/Dash/cardcreator/8.res 2016-01-28 14:11:14 +0000
2831+++ tests/plugins/Dash/cardcreator/8.res 2016-03-07 13:12:28 +0000
2832@@ -5,20 +5,18 @@
2833 property string backgroundShapeStyle: "inset";
2834 property real fontScale: 1.0;
2835 property var scopeStyle: null;
2836- property int titleAlignment: Text.AlignLeft;
2837 property int fixedHeaderHeight: -1;
2838 property size fixedArtShapeSize: Qt.size(-1, -1);
2839 readonly property string title: cardData && cardData["title"] || "";
2840- property bool asynchronous: true;
2841 property bool showHeader: true;
2842 implicitWidth: childrenRect.width;
2843 enabled: true;
2844-
2845+signal action(var actionId);
2846 Loader {
2847 id: backgroundLoader;
2848 objectName: "backgroundLoader";
2849 anchors.fill: parent;
2850- asynchronous: root.asynchronous;
2851+ asynchronous: true;
2852 visible: status == Loader.Ready;
2853 sourceComponent: UbuntuShape {
2854 objectName: "background";
2855@@ -59,7 +57,7 @@
2856 objectName: "outerRow";
2857 property real margins: units.gu(1);
2858 spacing: margins;
2859- height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
2860+ height: root.fixedHeaderHeight;
2861 anchors { top: parent.top;
2862 topMargin: units.gu(1);
2863 left: parent.left;
2864@@ -94,7 +92,7 @@
2865 width: parent.width - x;
2866 text: root.title;
2867 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
2868- horizontalAlignment: root.titleAlignment;
2869+ horizontalAlignment: Text.AlignLeft;
2870 }
2871
2872 ]
2873
2874=== added file 'tests/plugins/Dash/cardcreator/8.res.cardcreator'
2875--- tests/plugins/Dash/cardcreator/8.res.cardcreator 1970-01-01 00:00:00 +0000
2876+++ tests/plugins/Dash/cardcreator/8.res.cardcreator 2016-03-07 13:12:28 +0000
2877@@ -0,0 +1,107 @@
2878+AbstractButton {
2879+ id: root;
2880+ property var cardData;
2881+ property string artShapeStyle: "inset";
2882+ property string backgroundShapeStyle: "inset";
2883+ property real fontScale: 1.0;
2884+ property var scopeStyle: null;
2885+ property size fixedArtShapeSize: Qt.size(-1, -1);
2886+ readonly property string title: cardData && cardData["title"] || "";
2887+ property bool showHeader: true;
2888+ implicitWidth: childrenRect.width;
2889+ enabled: true;
2890+signal action(var actionId);
2891+Loader {
2892+ id: backgroundLoader;
2893+ objectName: "backgroundLoader";
2894+ anchors.fill: parent;
2895+ asynchronous: false;
2896+ visible: status == Loader.Ready;
2897+ sourceComponent: UbuntuShape {
2898+ objectName: "background";
2899+ radius: "medium";
2900+ aspect: {
2901+ switch (root.backgroundShapeStyle) {
2902+ case "inset": return UbuntuShape.Inset;
2903+ case "shadow": return UbuntuShape.DropShadow;
2904+ default:
2905+ case "flat": return UbuntuShape.Flat;
2906+ }
2907+ }
2908+ backgroundColor: getColor(0) || "white";
2909+ secondaryBackgroundColor: getColor(1) || backgroundColor;
2910+ backgroundMode: UbuntuShape.VerticalGradient;
2911+ anchors.fill: parent;
2912+ source: backgroundImage.source ? backgroundImage : null;
2913+ property real luminance: Style.luminance(backgroundColor);
2914+ property Image backgroundImage: Image {
2915+ objectName: "backgroundImage";
2916+ source: {
2917+ if (cardData && typeof cardData["background"] === "string") return cardData["background"];
2918+ else return "";
2919+ }
2920+ }
2921+ function getColor(index) {
2922+ if (cardData && typeof cardData["background"] === "object"
2923+ && (cardData["background"]["type"] === "color" || cardData["background"]["type"] === "gradient")) {
2924+ return cardData["background"]["elements"][index];
2925+ } else return index === 0 ? "#E9E9E9" : "#E9AAE9";
2926+ }
2927+ }
2928+ }
2929+readonly property size artShapeSize: Qt.size(-1, -1);
2930+readonly property int headerHeight: row.height;
2931+Row {
2932+ id: row;
2933+ objectName: "outerRow";
2934+ property real margins: units.gu(1);
2935+ spacing: margins;
2936+ anchors { top: parent.top;
2937+ topMargin: units.gu(1);
2938+left: parent.left;
2939+ }
2940+ anchors.right: parent.right;
2941+ anchors.margins: margins;
2942+ anchors.rightMargin: 0;
2943+ data: [
2944+ CroppedImageMinimumSourceSize {
2945+ id: mascotImage;
2946+ objectName: "mascotImage";
2947+ anchors { verticalCenter: parent.verticalCenter; }
2948+ source: cardData && cardData["mascot"] || "";
2949+ width: units.gu(6);
2950+ height: units.gu(5.625);
2951+ horizontalAlignment: Image.AlignHCenter;
2952+ verticalAlignment: Image.AlignVCenter;
2953+ visible: showHeader;
2954+ }
2955+,Label {
2956+ id: titleLabel;
2957+ objectName: "titleLabel";
2958+ anchors { verticalCenter: parent.verticalCenter;
2959+ }
2960+ elide: Text.ElideRight;
2961+ fontSize: "small";
2962+ wrapMode: Text.Wrap;
2963+ maximumLineCount: 2;
2964+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
2965+ color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? theme.palette.normal.baseText : "white");
2966+ visible: showHeader ;
2967+ width: parent.width - x;
2968+ text: root.title;
2969+ font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
2970+ horizontalAlignment: Text.AlignLeft;
2971+ }
2972+
2973+ ]
2974+ }
2975+UbuntuShape {
2976+ id: touchdown;
2977+ objectName: "touchdown";
2978+ anchors { fill: backgroundLoader }
2979+ visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
2980+ radius: "medium";
2981+ borderSource: "radius_pressed.sci"
2982+}
2983+implicitHeight: row.y + row.height + units.gu(1);
2984+}
2985
2986=== modified file 'tests/plugins/Dash/cardcreator/9.res'
2987--- tests/plugins/Dash/cardcreator/9.res 2016-02-12 00:11:52 +0000
2988+++ tests/plugins/Dash/cardcreator/9.res 2016-03-07 13:12:28 +0000
2989@@ -5,15 +5,13 @@
2990 property string backgroundShapeStyle: "inset";
2991 property real fontScale: 1.0;
2992 property var scopeStyle: null;
2993- property int titleAlignment: Text.AlignLeft;
2994 property int fixedHeaderHeight: -1;
2995 property size fixedArtShapeSize: Qt.size(-1, -1);
2996 readonly property string title: cardData && cardData["title"] || "";
2997- property bool asynchronous: true;
2998 property bool showHeader: true;
2999 implicitWidth: childrenRect.width;
3000 enabled: true;
3001-
3002+signal action(var actionId);
3003 readonly property size artShapeSize: Qt.size(-1, -1);
3004 readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin + audioProgressBar.height + audioProgressBar.anchors.topMargin;
3005 Label {
3006@@ -36,7 +34,7 @@
3007 width: undefined;
3008 text: root.title;
3009 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
3010- horizontalAlignment: root.titleAlignment;
3011+ horizontalAlignment: Text.AlignLeft;
3012 }
3013 Label {
3014 id: subtitleLabel;
3015@@ -72,7 +70,7 @@
3016 id: audioButton;
3017 anchors.fill: undefined;
3018 width: height;
3019- height: (root.fixedHeaderHeight > 0 ? root.fixedHeaderHeight : headerHeight) + 2 * units.gu(1);
3020+ height: root.fixedHeaderHeight + 2 * units.gu(1);
3021 readonly property url source: (cardData["quickPreviewData"] && cardData["quickPreviewData"]["uri"]) || "";
3022 UbuntuShape {
3023 anchors.fill: parent;
3024
3025=== added file 'tests/plugins/Dash/cardcreator/9.res.cardcreator'
3026--- tests/plugins/Dash/cardcreator/9.res.cardcreator 1970-01-01 00:00:00 +0000
3027+++ tests/plugins/Dash/cardcreator/9.res.cardcreator 2016-03-07 13:12:28 +0000
3028@@ -0,0 +1,118 @@
3029+AbstractButton {
3030+ id: root;
3031+ property var cardData;
3032+ property string artShapeStyle: "inset";
3033+ property string backgroundShapeStyle: "inset";
3034+ property real fontScale: 1.0;
3035+ property var scopeStyle: null;
3036+ property size fixedArtShapeSize: Qt.size(-1, -1);
3037+ readonly property string title: cardData && cardData["title"] || "";
3038+ property bool showHeader: true;
3039+ implicitWidth: childrenRect.width;
3040+ enabled: true;
3041+signal action(var actionId);
3042+readonly property size artShapeSize: Qt.size(-1, -1);
3043+readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin + audioProgressBar.height + audioProgressBar.anchors.topMargin;
3044+Label {
3045+ id: titleLabel;
3046+ objectName: "titleLabel";
3047+ anchors { right: parent.right;
3048+rightMargin: units.gu(1);
3049+left: audioButton.right;
3050+ leftMargin: units.gu(1);
3051+top: parent.top;
3052+ topMargin: units.gu(1);
3053+ }
3054+ elide: Text.ElideRight;
3055+ fontSize: "small";
3056+ wrapMode: Text.Wrap;
3057+ maximumLineCount: 2;
3058+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
3059+ color: root.scopeStyle ? root.scopeStyle.foreground : theme.palette.normal.baseText;
3060+ visible: showHeader ;
3061+ width: undefined;
3062+ text: root.title;
3063+ font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
3064+ horizontalAlignment: Text.AlignLeft;
3065+ }
3066+Label {
3067+ id: subtitleLabel;
3068+ objectName: "subtitleLabel";
3069+ anchors { left: titleLabel.left;
3070+ leftMargin: titleLabel.leftMargin;
3071+rightMargin: units.gu(1);
3072+right: titleLabel.right;
3073+top: titleLabel.bottom;
3074+ }
3075+ anchors.topMargin: units.dp(2);
3076+ elide: Text.ElideRight;
3077+ maximumLineCount: 1;
3078+ fontSize: "x-small";
3079+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
3080+ color: root.scopeStyle ? root.scopeStyle.foreground : theme.palette.normal.baseText;
3081+ visible: titleLabel.visible && titleLabel.text;
3082+ text: cardData && cardData["subtitle"] || "";
3083+ font.weight: Font.Light;
3084+ }
3085+CardAudioProgress {
3086+ id: audioProgressBar;
3087+ duration: (cardData["quickPreviewData"] && cardData["quickPreviewData"]["duration"]) || 0;
3088+ source: (cardData["quickPreviewData"] && cardData["quickPreviewData"]["uri"]) || "";
3089+ anchors {
3090+ bottom: audioButton.bottom;
3091+ left: audioButton.right;
3092+ right: parent.right;
3093+ margins: units.gu(1);
3094+ }
3095+ color: root.scopeStyle ? root.scopeStyle.foreground : theme.palette.normal.baseText;
3096+ }AbstractButton {
3097+ id: audioButton;
3098+ anchors.fill: undefined;
3099+ width: height;
3100+ height: headerHeight + 2 * units.gu(1);
3101+ readonly property url source: (cardData["quickPreviewData"] && cardData["quickPreviewData"]["uri"]) || "";
3102+ UbuntuShape {
3103+ anchors.fill: parent;
3104+ visible: parent.pressed;
3105+ radius: "medium";
3106+ }
3107+ Rectangle {
3108+ color: Qt.rgba(0, 0, 0, 0.5);
3109+ anchors.centerIn: parent;
3110+ width: parent.width * 0.5;
3111+ height: width;
3112+ radius: width / 2;
3113+ }
3114+ Icon {
3115+ anchors.centerIn: parent;
3116+ width: parent.width * 0.3;
3117+ height: width;
3118+ opacity: 0.9;
3119+ name: DashAudioPlayer.playing && AudioUrlComparer.compare(parent.source, DashAudioPlayer.currentSource) ? "media-playback-pause" : "media-playback-start";
3120+ color: "white";
3121+ }
3122+ onClicked: {
3123+ if (AudioUrlComparer.compare(source, DashAudioPlayer.currentSource)) {
3124+ if (DashAudioPlayer.playing) {
3125+ DashAudioPlayer.pause();
3126+ } else {
3127+ DashAudioPlayer.play();
3128+ }
3129+ } else {
3130+ var playlist = (cardData["quickPreviewData"] && cardData["quickPreviewData"]["playlist"]) || null;
3131+ DashAudioPlayer.playSource(source, playlist);
3132+ }
3133+ }
3134+ onPressAndHold: {
3135+ root.pressAndHold();
3136+ }
3137+ }UbuntuShape {
3138+ id: touchdown;
3139+ objectName: "touchdown";
3140+ anchors { fill: root }
3141+ visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
3142+ radius: "medium";
3143+ borderSource: "radius_pressed.sci"
3144+ }
3145+implicitHeight: audioButton.height;
3146+}
3147
3148=== modified file 'tests/plugins/Dash/cardcreatortest.cpp'
3149--- tests/plugins/Dash/cardcreatortest.cpp 2016-01-25 16:49:26 +0000
3150+++ tests/plugins/Dash/cardcreatortest.cpp 2016-03-07 13:12:28 +0000
3151@@ -45,6 +45,30 @@
3152 delete view;
3153 }
3154
3155+ void compareFileContents(const QString &filePath, const QString cardStringResult)
3156+ {
3157+ QFile testResultFile(filePath);
3158+ QVERIFY(testResultFile.open(QIODevice::ReadOnly));
3159+ QTextStream ts2(&testResultFile);
3160+
3161+ // Record failed results to /tmp
3162+ const QString executedResult = cardStringResult;
3163+ QTemporaryFile tmpFile(QDir::tempPath() + QDir::separator() + "testCardCreatorFailedResultXXXXXX");
3164+ tmpFile.open();
3165+ tmpFile.setAutoRemove(false);
3166+ tmpFile.write(executedResult.toUtf8().constData());
3167+
3168+ // Line by line comparison
3169+ const QStringList expectedLines = ts2.readAll().trimmed().replace(QRegExp("\n\\s*\n"),"\n").split("\n");
3170+ const QStringList cardStringResultLines = cardStringResult.trimmed().replace(QRegExp("\n\\s*\n"),"\n").split("\n");
3171+ for (int i = 0; i < expectedLines.size(); ++i) {
3172+ QCOMPARE(cardStringResultLines[i].simplified(), expectedLines[i].simplified());
3173+ }
3174+
3175+ // Remove the result if it passed
3176+ tmpFile.setAutoRemove(true);
3177+ }
3178+
3179 void testKnownCases()
3180 {
3181 const QString templateString("template: ");
3182@@ -68,33 +92,19 @@
3183 const QString templateJSON = lines[0].mid(templateString.length());
3184 const QString componentsJSON = lines[1].mid(componentsString.length());
3185 const QString resultFileName = lines[2].mid(resultString.length());
3186-
3187 QVariant cardStringResult;
3188- QMetaObject::invokeMethod(view->rootObject(), "cardString", Q_RETURN_ARG(QVariant, cardStringResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON));
3189-
3190- QFile testResultFile(testDirPath + resultFileName);
3191- QVERIFY(testResultFile.open(QIODevice::ReadOnly));
3192- QTextStream ts2(&testResultFile);
3193-
3194- // Record failed results to /tmp
3195- const QString executedResult = cardStringResult.toString();
3196- QTemporaryFile tmpFile(QDir::tempPath() + QDir::separator() + "testCardCreatorFailedResultXXXXXX");
3197- tmpFile.open();
3198- tmpFile.setAutoRemove(false);
3199- tmpFile.write(executedResult.toUtf8().constData());
3200-
3201- // Line by line comparison
3202- const QStringList expectedLines = ts2.readAll().trimmed().replace(QRegExp("\n\\s*\n"),"\n").split("\n");
3203- const QStringList cardStringResultLines = cardStringResult.toString().trimmed().replace(QRegExp("\n\\s*\n"),"\n").split("\n");
3204- for (int i = 0; i < expectedLines.size(); ++i) {
3205- QCOMPARE(cardStringResultLines[i].simplified(), expectedLines[i].simplified());
3206- }
3207-
3208- // Remove the result if it passed
3209- tmpFile.setAutoRemove(true);
3210-
3211 QVariant createCardComponentResult;
3212- QMetaObject::invokeMethod(view->rootObject(), "createCardComponent", Q_RETURN_ARG(QVariant, createCardComponentResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON));
3213+
3214+ QMetaObject::invokeMethod(view->rootObject(), "cardString", Q_RETURN_ARG(QVariant, cardStringResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON), Q_ARG(QVariant, false));
3215+ compareFileContents(testDirPath + resultFileName, cardStringResult.toString());
3216+
3217+ QMetaObject::invokeMethod(view->rootObject(), "cardString", Q_RETURN_ARG(QVariant, cardStringResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON), Q_ARG(QVariant, true));
3218+ compareFileContents(testDirPath + resultFileName + ".cardcreator", cardStringResult.toString());
3219+
3220+ QMetaObject::invokeMethod(view->rootObject(), "createCardComponent", Q_RETURN_ARG(QVariant, createCardComponentResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON), Q_ARG(QVariant, false));
3221+ QVERIFY(createCardComponentResult.toBool());
3222+
3223+ QMetaObject::invokeMethod(view->rootObject(), "createCardComponent", Q_RETURN_ARG(QVariant, createCardComponentResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON), Q_ARG(QVariant, true));
3224 QVERIFY(createCardComponentResult.toBool());
3225 }
3226 }
3227
3228=== modified file 'tests/plugins/Dash/cardcreatortest.qml'
3229--- tests/plugins/Dash/cardcreatortest.qml 2015-07-15 15:07:19 +0000
3230+++ tests/plugins/Dash/cardcreatortest.qml 2016-03-07 13:12:28 +0000
3231@@ -19,11 +19,11 @@
3232
3233 Item {
3234 id: root
3235- function cardString(template, components) {
3236- return CardCreator.cardString(JSON.parse(template), JSON.parse(components));
3237+ function cardString(template, components, isCardCreator) {
3238+ return CardCreator.cardString(JSON.parse(template), JSON.parse(components), isCardCreator);
3239 }
3240
3241- function createCardComponent(template, components) {
3242- return CardCreator.createCardComponent(root, JSON.parse(template), JSON.parse(components)) !== null;
3243+ function createCardComponent(template, components, isCardCreator) {
3244+ return CardCreator.createCardComponent(root, JSON.parse(template), JSON.parse(components), isCardCreator) !== null;
3245 }
3246 }
3247
3248=== modified file 'tests/qmltests/Dash/CardHelpers.js'
3249--- tests/qmltests/Dash/CardHelpers.js 2015-05-15 12:57:48 +0000
3250+++ tests/qmltests/Dash/CardHelpers.js 2016-03-07 13:12:28 +0000
3251@@ -16,7 +16,7 @@
3252
3253 .pragma library
3254
3255-var components = ["title", "art", "subtitle", "mascot", "emblem", "summary", "attributes", "overlayColor", "quickPreviewData"]
3256+var components = ["title", "art", "subtitle", "mascot", "emblem", "summary", "attributes", "socialActions", "overlayColor", "quickPreviewData"]
3257
3258 var defaultLayout = ' \
3259 { \
3260@@ -38,7 +38,8 @@
3261 "mascot": null, \
3262 "emblem": null, \
3263 "summary": null, \
3264- "attributes": { "max-count": 2 } \
3265+ "attributes": { "max-count": 2 },
3266+ "socialActions": { "max-count": 4 } \
3267 }, \
3268 "resources": {} \
3269 }'
3270@@ -52,7 +53,8 @@
3271 "emblem": "emblem", \
3272 "overlayColor": "overlayColor", \
3273 "summary": "summary", \
3274- "attributes": "attributes" \
3275+ "attributes": "attributes", \
3276+ "socialActions": "socialActions" \
3277 }'
3278
3279
3280
3281=== modified file 'tests/qmltests/Dash/tst_Card.qml'
3282--- tests/qmltests/Dash/tst_Card.qml 2016-02-11 13:13:31 +0000
3283+++ tests/qmltests/Dash/tst_Card.qml 2016-03-07 13:12:28 +0000
3284@@ -36,6 +36,10 @@
3285 "subtitle": "bar",
3286 "summary": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
3287 "attributes": [{"value":"text1","icon":"image://theme/ok"},{"value":"text2","icon":"image://theme/cancel"}],
3288+ "socialActions": [{"id":"like","label":"text1","icon":"image://theme/ok","temporaryIcon":"image://theme/undo"},
3289+ {"id":"share","label":"text2","icon":"image://theme/cancel"},
3290+ {"id":"like","label":"text1","icon":"image://theme/ok","temporaryIcon":"image://theme/undo"},
3291+ {"id":"share","label":"text2","icon":"image://theme/cancel"}],
3292 "quickPreviewData": {"uri": "/some/file", "duration": "14"}
3293 }'
3294
3295@@ -211,6 +215,11 @@
3296 }
3297 }
3298
3299+ SignalSpy {
3300+ id: signalSpy
3301+ signalName: "action"
3302+ }
3303+
3304 UT.UnityTestCase {
3305 id: testCase
3306 name: "Card"
3307@@ -274,9 +283,11 @@
3308 { tag: "Wide", width: units.gu(18), index: 0 },
3309 { tag: "Horizontal", width: units.gu(38), index: 5 },
3310 // Make sure card ends with header when there's no summary
3311- { tag: "NoSummary", height: function() { var cardToolRow = findChild(cardTool, "outerRow");
3312- return cardToolRow.y + cardToolRow.height + units.gu(1) }, index: 6 },
3313- { tag: "HorizontalNoSummary", height: function() { return headerRow.height + units.gu(2) }, card_layout: "horizontal", index: 6 },
3314+ { tag: "NoSummary", height: function() { var socialActionsRow = findChild(cardTool, "socialActionsRow");
3315+ return socialActionsRow.y + socialActionsRow.height + units.gu(1) }, index: 6 },
3316+ { tag: "HorizontalNoSummary", height: function() { var socialActionsRow = findChild(cardTool, "socialActionsRow");
3317+ return socialActionsRow.y + socialActionsRow.height + units.gu(1) },
3318+ card_layout: "horizontal", index: 6 },
3319 ]
3320 }
3321
3322@@ -641,5 +652,29 @@
3323 verify((card.width - titleToCard.x - titleToCard.width) === units.gu(1));
3324 }
3325 }
3326+
3327+ function test_action() {
3328+ selector.selectedIndex = 0;
3329+ waitForRendering(card);
3330+
3331+ signalSpy.target = card;
3332+ var socialActionsRow = findChild(card, "socialActionsRow");
3333+ var delegate0 = findChild(socialActionsRow, "delegate0");
3334+ var icon0 = findChild(delegate0, "icon");
3335+ var delegate1 = findChild(socialActionsRow, "delegate1");
3336+ var icon1 = findChild(delegate1, "icon");
3337+
3338+ compare(icon0.source, "image://theme/ok");
3339+ mouseClick(delegate0, delegate0.height / 2, delegate0.height / 2);
3340+ tryCompare(signalSpy, "count", 1);
3341+ compare(signalSpy.signalArguments[0][0], "like");
3342+ compare(icon0.source, "image://theme/undo");
3343+
3344+ compare(icon1.source, "image://theme/cancel");
3345+ mouseClick(delegate1, delegate1.height / 2, delegate1.height / 2);
3346+ tryCompare(signalSpy, "count", 2);
3347+ compare(signalSpy.signalArguments[1][0], "share");
3348+ compare(icon1.source, "image://theme/cancel");
3349+ }
3350 }
3351 }
3352
3353=== modified file 'tests/qmltests/Dash/tst_CardTool.qml'
3354--- tests/qmltests/Dash/tst_CardTool.qml 2015-11-06 10:20:36 +0000
3355+++ tests/qmltests/Dash/tst_CardTool.qml 2016-03-07 13:12:28 +0000
3356@@ -339,22 +339,22 @@
3357 function test_card_title_alignment(data) {
3358 selector.selectedIndex = data.index;
3359
3360- tryCompare(cardTool, "titleAlignment", Text.AlignLeft);
3361+ tryCompareFunction(function() { return findChild(internalCard, "titleLabel").horizontalAlignment == Text.AlignLeft; }, true);
3362
3363 cardTool.components['title'] = { "field": "title", "align": "center" };
3364 cardTool.componentsChanged();
3365
3366- tryCompare(cardTool, "titleAlignment", data.value);
3367+ tryCompareFunction(function() { return findChild(internalCard, "titleLabel").horizontalAlignment == data.value; }, true);
3368
3369 cardTool.components['title'] = { "field": "title" };
3370 cardTool.componentsChanged();
3371
3372- tryCompare(cardTool, "titleAlignment", data.value);
3373+ tryCompareFunction(function() { return findChild(internalCard, "titleLabel").horizontalAlignment == data.value; }, true);
3374
3375 cardTool.components['title'] = { "field": "title", "align": "left" };
3376 cardTool.componentsChanged();
3377
3378- tryCompare(cardTool, "titleAlignment", Text.AlignLeft);
3379+ tryCompareFunction(function() { return findChild(internalCard, "titleLabel").horizontalAlignment == Text.AlignLeft; }, true);
3380 }
3381
3382 function test_categoryLayout_data() {

Subscribers

People subscribed via source and target branches