Merge lp:~paulliu/unity8/attribute into lp:unity8
- attribute
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Albert Astals Cid |
Approved revision: | 1080 |
Merged at revision: | 1101 |
Proposed branch: | lp:~paulliu/unity8/attribute |
Merge into: | lp:unity8 |
Diff against target: |
1413 lines (+725/-357) 15 files modified
plugins/Dash/CardAttributes.qml (+65/-0) plugins/Dash/CardCreator.js (+76/-7) plugins/Dash/qmldir (+1/-0) qml/Dash/CardTool.qml (+27/-2) tests/plugins/Dash/CMakeLists.txt (+1/-0) tests/plugins/Dash/cardcreator/1.res (+63/-61) tests/plugins/Dash/cardcreator/2.res (+94/-91) tests/plugins/Dash/cardcreator/3.res (+77/-74) tests/plugins/Dash/cardcreator/5.res (+119/-117) tests/plugins/Dash/cardcreator/7.res (+128/-0) tests/plugins/Dash/cardcreator/7.tst (+3/-0) tests/plugins/Dash/cardcreatortest.cpp (+9/-1) tests/plugins/Dash/tst_CardAttributes.qml (+54/-0) tests/qmltests/Dash/CardHelpers.js (+5/-3) tests/qmltests/Dash/tst_Card.qml (+3/-1) |
To merge this branch: | bzr merge lp:~paulliu/unity8/attribute |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Albert Astals Cid (community) | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Michał Sawicz | Needs Fixing | ||
Michal Hruby (community) | Needs Fixing | ||
Review via email: mp+223242@code.launchpad.net |
Commit message
Implement Attribute UI.
Description of the change
* Are there any related MPs required for this MP to build/function as expected?
No
* Did you perform an exploratory manual test run of your code change and any related functionality?
Yes
* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A
* If you changed the UI, has there been a design review?
Not yet.
- 970. By Paweł Stołowski
-
Extend the hack for click scope categories with the upcoming 'store' category: single-tap on results from the 'store' category should activate them, instead of requesting a preview. Fixes: 1326292
- 971. By Albert Astals Cid
-
Drop the " Preview" suffix from Preview title
As requested in https:/
/bugs.launchpad .net/unity8/ +bug/1316671 Fixes: 1316671 - 972. By PS Jenkins bot
-
Releasing 7.89+14.
10.20140616. 1-0ubuntu1
PS Jenkins bot (ps-jenkins) wrote : | # |
- 973. By Launchpad Translations on behalf of unity-team
-
Launchpad automatic translations update.
- 974. By Albert Astals Cid
-
Departments support Fixes: 1320847
- 975. By PS Jenkins bot
-
Releasing 7.89+14.
10.20140619. 2-0ubuntu1 - 976. By PS Jenkins bot
-
No change rebuild against Qt 5.3
- 977. By PS Jenkins bot
-
Releasing 7.89+14.
10.20140619. 3-0ubuntu1 - 978. By Mirco Müller
-
Added the frontend-part of sound-hint support for notifications with updated QML-tests.
- 979. By Albert Astals Cid
-
Add VerticalJournal integration to Dash/scopes/QML Fixes: 1326467
- 980. By Michał Sawicz
-
Make so that fixedArtShapeSize actually fixes artShapeSize.
- 981. By PS Jenkins bot
-
Releasing 7.89+14.
10.20140623. 1-0ubuntu1 - 982. By Launchpad Translations on behalf of unity-team
-
Launchpad automatic translations update.
- 983. By Ying-Chun Liu
-
Add logout support.
Reviewed by: Daniel d'Andrada Fixes: 1302213
- 984. By PS Jenkins bot
-
Releasing 7.89+14.
10.20140624- 0ubuntu1
Michał Sawicz (saviq) wrote : | # |
You need to merge trunk.
- 985. By Alberto Aguirre
-
Update Powerd plugin and Shell.qml to accommodate changes in the display power state notification.
- 986. By PS Jenkins bot
-
Releasing 7.89+14.
10.20140624. 1-0ubuntu1 - 987. By PS Jenkins bot
-
Resync trunk
- 988. By Launchpad Translations on behalf of unity-team
-
Launchpad automatic translations update.
- 989. By Michał Sawicz
-
Adapt scope mock to new api and quiet unused variable warnings.
- 990. By Michael Terry
-
Fix path in launcher mock after moving our mock icons, to avoid a lot of "icon not found" warnings during qmluitests.
- 991. By Ying-Chun Liu
-
Fix LP:1330957
Fix some failed test cases. Fixes: 1330957 - 992. By Albert Astals Cid
-
Don't seem to need this waitForRendering
And makes test fail in 5.3
- 993. By Michael Terry
-
Fix the testMultiGreeter qmluitest. Incoming method variables are apparently read-only in Qt5.3. Fixes: 1332488
- 994. By Michał Sawicz
-
Fix dynamic overlay height. Fixes: 1334879
- 995. By Michał Sawicz
-
Don't center items in CardVerticalJou
rnal, kind of beats the purpose... Also don't bind unnecessarily. - 996. By PS Jenkins bot
-
Releasing 7.89+14.
10.20140627- 0ubuntu1
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:899
http://
Executed test runs:
FAILURE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Michal Hruby (mhr3) wrote : | # |
66 + text: modelData["text"]; \n\
Can you please use "value" instead of "text", that's what the shell plugin expects and server scopes provide already. Unless someone feels strongly about using "text", then we can change it.
- 997. By Didier Roche-Tolomelli
-
switch the default theme to suru Fixes: 1246688
- 998. By PS Jenkins bot
-
Releasing 7.90+14.
10.20140701. 2-0ubuntu1 - 999. By Sebastien Bacher
-
Resync distro.
- 1000. By Michal Hruby
-
Cache network requests to reduce data usage and increase dash icon loading speed.
- 1001. By Leo Arias
-
Fixed style and static python errors.
- 1002. By Nick Dedekind
-
Moved [Message]
MenuItemFacotor y from Unity.Indicators plugin to qml folder. - 1003. By Michael Zanetti
-
drop launcher item spacing Fixes: 1332022
- 1004. By Michał Sawicz
-
Initial code for a payment button widget, to handle purchasing apps from the click scope.
- 1005. By Michael Zanetti
-
change wording in launcher quicklist Fixes: 1332035
- 1006. By Albert Astals Cid
-
EasingCurve: Initialize members
- 1007. By Albert Astals Cid
-
Fix valgrind warning by not emitting reset on model destructor
That won't be supported until Qt 5.4
More info at https:/
/bugreports. qt-project. org/browse/ QTBUG-39780 Warning was
==16693== Invalid read of size 8
==16693== at 0x72B19A0: QQmlContext::isValid( ) const (qqmlcontext. cpp:231)
==16693== by 0x736C82B: QQmlDelegateModelPrivate: :emitChanges( ) (qqmldelegatemo del.cpp: 1412)
==16693== by 0x7372AE6: QQmlDelegateModel::_q_ modelReset( ) (qqmldelegatemo del.cpp: 1463)
==16693== by 0x7397224: QQmlDelegateModel::qt_ static_ metacall( QObject* , QMetaObject::Call, int, void**) (moc_qqmldelega temodel_ p.cpp:196)
==16693== by 0x739769E: QQmlDelegateModel::qt_ metacall( QMetaObject: :Call, int, void**) (moc_qqmldelega temodel_ p.cpp:292)
==16693== by 0x66379CC: QMetaObject::activate( QObject* , int, int, void**) (in /usr/lib/ x86_64- linux-gnu/ libQt5Core. so.5.3. 0)
==16693== by 0x65AEEFD: QAbstractItemModel::endResetMo del() (in /usr/lib/ x86_64- linux-gnu/ libQt5Core. so.5.3. 0)
==16693== by 0x23461EFD: FakeIndicatorsModel::unload( ) (fakeindicators model.cpp: 53)
==16693== by 0x23461E13: FakeIndicatorsModel::~ FakeIndicatorsM odel() (fakeindicators model.cpp: 34)
==16693== by 0x2345C073: QQmlPrivate::QQmlElement< FakeIndicatorsM odel>:: ~QQmlElement( ) (in /home/tsdgeos_ work/phablet/ unity8/ investigate_ test_shell_ crash/builddir/ tests/mocks/ Unity/Indicator s/libIndicators FakeQml. so)
==16693== by 0x2345C0A3: QQmlPrivate::QQmlElement< FakeIndicatorsM odel>:: ~QQmlElement( ) (qqmlprivate.h:106)
==16693== by 0x663636B: QObjectPrivate::deleteChildren () (in /usr/lib/ x86_64- linux-gnu/ libQt5Core. so.5.3. 0)
==16693== Address 0x1862d448 is 8 bytes inside a block of size 16 free'd
==16693== at 0x4C2C2BC: operator delete(void*) (vg_replace_malloc. c:503)
==16693== by 0x72B21B8: QQmlContextData::destroy( ) (qqmlcontext. cpp:647)
==16693== by 0x7293458: QQmlPrivate::qdeclarativeel ement_destructo r(QObject* ) (qqmlengine. cpp:612)
==16693== by 0x6C0CADD: QQmlPrivate::QQmlElement< QQuickItem> ::~QQmlElement( ) (qqmlprivate.h:105)
==16693== by 0x663636B: QObjectPrivate::deleteChildren () (in /usr/lib/ x86_64- linux-gnu/ libQt5Core. so.5.3. 0)
==16693== by 0x663F0EB: QObject::~QObject() (in /usr/lib/x86_64- linux-gnu/ libQt5Core. so.5.3. 0)
==16693== by 0x6BF64B5: QQuickItem::~QQuickItem( ) (qquickitem. cpp:2064)
==16693== by 0x6C0CAE5: QQmlPrivate::QQmlElement< QQuickItem> ::~QQmlElement( ) (qqmlprivate.h:106)
==16693== by 0x663636B: QObjectPrivate::deleteChildren () (in /usr/lib/ x86_64- linux-gnu/ libQt5Core. so.5.3. 0)
==16693== by 0x663F0EB: QObject::~QObject() (in /usr/lib/x86_64- linux-gnu/ libQt5Core. so.5.3. 0)
==16693== by 0x6BF64B5: QQuickItem::~QQuickItem( ) (qquickitem. cpp:2064)
==16693== by 0x6C0CAE5: QQmlPrivate::QQmlElement< QQuickItem> ::~QQmlElement( ) (qqmlprivate.h:106)
Fixes: 1332598 - 1008. By Renato Araujo Oliveira Filho
-
Create IndicatorsLight.qml component used to control indicator led.
A blue led will pulse if the message indicator is blue and screen is off.
- 1009. By PS Jenkins bot
-
Releasing 7.90+14.
10.20140703. 1-0ubuntu1 - 1010. By Launchpad Translations on behalf of unity-team
-
Launchpad automatic translations update.
- 1011. By Launchpad Translations on behalf of unity-team
-
Launchpad automatic translations update.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:899
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 1012. By Launchpad Translations on behalf of unity-team
-
Launchpad automatic translations update.
- 1013. By Nick Dedekind
-
Added support for TransferMenu
Approved by: Charles Kerr, Michał Sawicz - 1014. By PS Jenkins bot
-
Releasing 7.90+14.
10.20140707- 0ubuntu1 - 1015. By Launchpad Translations on behalf of unity-team
-
Launchpad automatic translations update.
Michał Sawicz (saviq) wrote : | # |
See inline.
BTW, when you merge / rebase, don't copy the whole commit log, it's available in the commit hierarchy anyway and just make it hard to read.
- 1016. By Michael Zanetti
-
make the launcher's drag'n'drop indicator more prominent Fixes: 1332042
Approved by: PS Jenkins bot, Andrea Cimitan - 1017. By Michael Zanetti
-
make launcher items live
having them non-live is not really required and reveals an issue in combination with UbuntuShape Fixes: 1302761
Approved by: PS Jenkins bot, Andrea Cimitan - 1018. By Michael Zanetti
-
Fade out launcher in place instead of moving it to the left on long left edge swipes. Fixes: 1332096
Approved by: Vesa Rautiainen, Michał Sawicz, PS Jenkins bot - 1019. By Michael Zanetti
-
update launcher icon glow as requested by design Fixes: 1336725
Approved by: Vesa Rautiainen, Michał Sawicz - 1020. By Michael Zanetti
-
update header in dash to use the new header from the SDK Fixes: 1335491
Approved by: Michał Sawicz - 1021. By Michał Sawicz
-
Refactor carousel item activation.
Approved by: Andrea Cimitan, Michael Zanetti - 1022. By Albert Astals Cid
-
We need to boostrap height also when we have 1 item ^_^
Fixes: 1337408
Approved by: Michał Sawicz - 1023. By Michał Sawicz
-
Refactor ScopeItem into GenericScopeView.
Approved by: Michael Zanetti, Michael Zanetti - 1024. By Michal Hruby
-
Fix FTBFS when using latest unity-api.
Approved by: Michał Sawicz - 1025. By Michał Sawicz
-
Add initial support for scope customizations.
Approved by: Michael Zanetti, Michael Zanetti - 1026. By Nick Dedekind
-
Added active call hint
A hint is displayed in the indicator panel when an call is active on the Telephony Serivce
Approved by: Olga Kemmet, Daniel d'Andrada, PS Jenkins bot, Michał Sawicz - 1027. By Michał Sawicz
-
Make rating stars in PreviewReviewDi
splay.qml non-interactive. Fixes: 1337508
Approved by: PS Jenkins bot, Andrea Cimitan, PS Jenkins bot - 1028. By Michael Zanetti
-
fix testPreview with larger GRID_UNIT_PX values
Approved by: PS Jenkins bot, Michał Sawicz - 1029. By Albert Astals Cid
-
CardCreator: Give a correct implicitHeight if we only have art
The hasSubtitle change is really unrelated and not needed here, just sneaking it in to not create yet another review. Fixes: 1330899
Approved by: Michał Sawicz - 1030. By Albert Astals Cid
-
Fake Scopes Plugin: Register PreviewModelInt
erface Approved by: Michał Sawicz
- 1031. By PS Jenkins bot
-
make launcher items live
having them non-live is not really required and reveals an issue in combination with UbuntuShape Fixes: 1302761
Approved by: PS Jenkins bot, Andrea Cimitan - 1032. By Michael Zanetti
-
clip the corner of pinned icons in the launcher as per new design
Approved by: PS Jenkins bot, Vesa Rautiainen, PS Jenkins bot, Michał Sawicz - 1033. By Michael Zanetti
-
update launcher background according to latest design Fixes: 1336314
Approved by: PS Jenkins bot, PS Jenkins bot, Michał Sawicz, PS Jenkins bot - 1034. By Michael Zanetti
-
Update Launcher's home button design according to new spec. Fixes: 1329331
Approved by: Michał Sawicz - 1035. By PS Jenkins bot
-
Releasing 7.90+14.
10.20140709. 2-0ubuntu1 - 1036. By Launchpad Translations on behalf of unity-team
-
Launchpad automatic translations update.
Albert Astals Cid (aacid) wrote : | # |
Conflict adding file tests/plugins/
Conflict adding file tests/plugins/
2 conflicts encountered.
- 1037. By Launchpad Translations on behalf of unity-team
-
Launchpad automatic translations update.
- 1038. By Launchpad Translations on behalf of unity-team
-
Launchpad automatic translations update.
- 1039. By Launchpad Translations on behalf of unity-team
-
Launchpad automatic translations update.
- 1040. By Launchpad Translations on behalf of unity-team
-
Launchpad automatic translations update.
- 1041. By Michał Sawicz
-
Activate all results in click scope by default. Fixes: 1341262
Approved by: Alejandro J. Cura, PS Jenkins bot, Albert Astals Cid - 1042. By Mirco Müller
-
Added support for utilization of the ComboButton SDK-element for snap-decision notifications with many actions.
Approved by: Michał Sawicz, PS Jenkins bot - 1043. By PS Jenkins bot
-
Releasing 7.90+14.
10.20140714- 0ubuntu1 - 1044. By Launchpad Translations on behalf of unity-team
-
Launchpad automatic translations update.
- 1045. By Launchpad Translations on behalf of unity-team
-
Launchpad automatic translations update.
- 1046. By Launchpad Translations on behalf of unity-team
-
Launchpad automatic translations update.
- 1047. By Michael Terry
-
Expose a new greeter DBus property, IsActive, which tells apps and indicators when the integrated-greeter screen is active. Useful for switching UI modes when the screen is locked.
Approved by: Michael Zanetti, PS Jenkins bot - 1048. By Michał Sawicz
-
Only generate .qmltypes files manually, no need to do it build-time.
It didn't work when cross-compiling either, and required builders to have otherwise unnecessary environment.
Approved by: Michael Zanetti - 1049. By Michael Terry
-
Allow the session to bring up the greeter/lockscreen over DBus. The emergency dialer will need this support in order to cancel bringing it up.
Approved by: Michael Zanetti, PS Jenkins bot - 1050. By Ying-Chun Liu
-
Add reboot/shutdown Fixes: 1234062
Approved by: Michael Zanetti - 1051. By Michał Sawicz
-
Fix CardCreator test. It got broken with a merge that got landed along side of it.
Approved by: Albert Astals Cid - 1052. By Mirco Müller
-
Fixes gap at top of sim-unlock/
fullscreen notification (point 1.), fixes blocking overlay if underlying UnityMenuModel vanishes from DBus (point 2.). The third bullet-point of the bug-report, lockup of shell-UI, could not be reproduced. Fixes: 1308011
Approved by: Michał Sawicz - 1053. By Albert Astals Cid
-
Make the departments test more stable
Approved by: Michael Zanetti, PS Jenkins bot
- 1054. By PS Jenkins bot
-
Releasing 7.90+14.
10.20140717. 1-0ubuntu1 - 1055. By Nick Dedekind
-
Added environment variable to upstart conf for mir trusted socket
Approved by: Michał Sawicz - 1056. By Nick Dedekind
-
Removed indicator menu dismissal on menu activation Fixes: 1337771
Approved by: Michał Sawicz - 1057. By PS Jenkins bot
-
Releasing 7.90+14.
10.20140717. 3-0ubuntu1 - 1058. By Launchpad Translations on behalf of unity-team
-
Launchpad automatic translations update.
- 1059. By Launchpad Translations on behalf of unity-team
-
Launchpad automatic translations update.
- 1060. By Launchpad Translations on behalf of unity-team
-
Launchpad automatic translations update.
- 1061. By Launchpad Translations on behalf of unity-team
-
Launchpad automatic translations update.
- 1062. By Ying-Chun Liu
-
Add attribute UI.
- 1063. By Ying-Chun Liu
-
Fix 7.tst
- 1064. By Ying-Chun Liu
-
Add test icons.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1062
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1064
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Michał Sawicz (saviq) wrote : | # |
plugins/
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1064
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 1065. By Ying-Chun Liu
-
Rename CardAttributesGrid to CardAttributes.
Add copyright header to CardAttributes.qml.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1065
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Albert Astals Cid (aacid) wrote : | # |
Merge issues have been fixed
Albert Astals Cid (aacid) wrote : | # |
* Did you perform an exploratory manual test run of the code change and any related functionality?
Yes, only using the tests since there seems there's no scope that returns this at the moment
* Did CI run pass? If not, please explain why.
No, known unstable/broken tests
Will wait to have a test-scope that uses this to top approve
- 1066. By Ying-Chun Liu
-
Add code for subtitle is not appeared
Albert Astals Cid (aacid) wrote : | # |
Without mascot -> It breaks
Text of attributes -> needs to be "Small"
if remove subtitle -> needs to go a bit up under the title
- 1067. By Ying-Chun Liu
-
Fix anchors/
non-subtitles. - 1068. By Ying-Chun Liu
-
Fix summary Top anchor for attributes.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1066
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 1069. By Ying-Chun Liu
-
Add color.
Fix rightMargin.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1068
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1069
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 1070. By Ying-Chun Liu
-
Fix implicitHeight.
Update *.res - 1071. By Ying-Chun Liu
-
Fix height again.
Albert Astals Cid (aacid) wrote : | # |
Paul knows, but just so that we don't forget, there's still height issues when the title is two lines height
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1070
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 1072. By Ying-Chun Liu
-
Fix GridLayout height sometimes 0.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1071
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 1073. By Ying-Chun Liu
-
Revert workarounds.
Add maxData for attributes to CardTool.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1072
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1073
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 1074. By Ying-Chun Liu
-
test 5 attributes.
- 1075. By Ying-Chun Liu
-
Fix CardTool to generate attributes dynamically.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1075
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Albert Astals Cid (aacid) wrote : | # |
Need to use the max-count from attributes in the CardTool.
- 1076. By Ying-Chun Liu
-
Add max-count for attributes
- 1077. By Ying-Chun Liu
-
test cardData.
- 1078. By Ying-Chun Liu
-
Merge trunk.
Albert Astals Cid (aacid) wrote : | # |
* Did you perform an exploratory manual test run of the code change and any related functionality?
Yes, it's been extensively tested this week in the London design sprint
* Did CI run pass? If not, please explain why.
It's passing locally here but I'll wait for r1078 CI run to finish before top approving.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1076
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1078
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Albert Astals Cid (aacid) wrote : | # |
Running make testCard gets me
QWARN : qmltestrunner:
QWARN : qmltestrunner:
QWARN : qmltestrunner:
QWARN : qmltestrunner:
QWARN : qmltestrunner:
QWARN : qmltestrunner:
QWARN : qmltestrunner:
QWARN : qmltestrunner:
a lot, can you have a look?
Albert Astals Cid (aacid) wrote : | # |
make tryCard, choose the "Art, summary" option, see how it displays broken.
- 1079. By Ying-Chun Liu
-
Fix Reference error on summary.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1078
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 1080. By Ying-Chun Liu
-
Remove the TODO line.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1079
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1080
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1080
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Albert Astals Cid (aacid) wrote : | # |
* Did you perform an exploratory manual test run of the code change and any related functionality?
Yes
* Did CI run pass? If not, please explain why.
It did
Preview Diff
1 | === added file 'plugins/Dash/CardAttributes.qml' | |||
2 | --- plugins/Dash/CardAttributes.qml 1970-01-01 00:00:00 +0000 | |||
3 | +++ plugins/Dash/CardAttributes.qml 2014-07-28 12:00:26 +0000 | |||
4 | @@ -0,0 +1,65 @@ | |||
5 | 1 | /* | ||
6 | 2 | * Copyright 2014 Canonical Ltd. | ||
7 | 3 | * | ||
8 | 4 | * This program is free software; you can redistribute it and/or modify | ||
9 | 5 | * it under the terms of the GNU General Public License as published by | ||
10 | 6 | * the Free Software Foundation; version 3. | ||
11 | 7 | * | ||
12 | 8 | * This program is distributed in the hope that it will be useful, | ||
13 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | 11 | * GNU General Public License for more details. | ||
16 | 12 | * | ||
17 | 13 | * You should have received a copy of the GNU General Public License | ||
18 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | 15 | */ | ||
20 | 16 | |||
21 | 17 | import QtQuick 2.2 | ||
22 | 18 | import QtQuick.Layouts 1.1 | ||
23 | 19 | import Ubuntu.Components 1.1 | ||
24 | 20 | import Ubuntu.Settings.Components 0.1 | ||
25 | 21 | |||
26 | 22 | GridLayout { | ||
27 | 23 | id: grid | ||
28 | 24 | anchors { | ||
29 | 25 | left: parent.left; | ||
30 | 26 | right: parent.right; | ||
31 | 27 | } | ||
32 | 28 | columns: 2 + repeater.count % 2 | ||
33 | 29 | property alias model: repeater.model | ||
34 | 30 | property var color | ||
35 | 31 | |||
36 | 32 | Repeater { | ||
37 | 33 | id: repeater | ||
38 | 34 | delegate: Row { | ||
39 | 35 | spacing: units.gu(0.5) | ||
40 | 36 | readonly property int column: index % grid.columns; | ||
41 | 37 | Layout.alignment: { | ||
42 | 38 | if (column == 0) return Qt.AlignLeft; | ||
43 | 39 | if (column == grid.columns - 1 || index == repeater.count - 1) return Qt.AlignRight; | ||
44 | 40 | if (column == 1) return Qt.AlignHCenter; | ||
45 | 41 | } | ||
46 | 42 | Layout.columnSpan: index == repeater.count - 1 && grid.columns == 3 && column == 1 ? 2 : 1 | ||
47 | 43 | Layout.maximumWidth: Math.max(icon.width, label.x + label.implicitWidth) | ||
48 | 44 | Layout.fillWidth: true | ||
49 | 45 | StatusIcon { | ||
50 | 46 | id: icon | ||
51 | 47 | height: units.gu(2) | ||
52 | 48 | sets: ["actions", "status", "apps"] | ||
53 | 49 | source: "icon" in modelData ? modelData["icon"] : "" | ||
54 | 50 | } | ||
55 | 51 | Label { | ||
56 | 52 | id: label | ||
57 | 53 | width: parent.width - x | ||
58 | 54 | anchors.verticalCenter: parent.verticalCenter | ||
59 | 55 | text: "value" in modelData ? modelData["value"] : ""; | ||
60 | 56 | elide: Text.ElideRight | ||
61 | 57 | maximumLineCount: 1 | ||
62 | 58 | font.weight: "style" in modelData && modelData["style"] == "highlighted" ? Font.DemiBold : Font.Light | ||
63 | 59 | fontSize: "small" | ||
64 | 60 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale) | ||
65 | 61 | color: grid.color | ||
66 | 62 | } | ||
67 | 63 | } | ||
68 | 64 | } | ||
69 | 65 | } | ||
70 | 0 | 66 | ||
71 | === modified file 'plugins/Dash/CardCreator.js' | |||
72 | --- plugins/Dash/CardCreator.js 2014-07-09 19:44:44 +0000 | |||
73 | +++ plugins/Dash/CardCreator.js 2014-07-28 12:00:26 +0000 | |||
74 | @@ -193,6 +193,21 @@ | |||
75 | 193 | ] \n\ | 193 | ] \n\ |
76 | 194 | }\n'; | 194 | }\n'; |
77 | 195 | 195 | ||
78 | 196 | // multiple column version of kHeaderColumnCode. | ||
79 | 197 | function kHeaderColumnCodeGenerator() { | ||
80 | 198 | var headerColumnCodeTemplate = 'Column { \n\ | ||
81 | 199 | anchors.verticalCenter: parent.verticalCenter; \n\ | ||
82 | 200 | spacing: units.dp(2); \n\ | ||
83 | 201 | width: parent.width - x;\n\ | ||
84 | 202 | data: [ \n\ | ||
85 | 203 | %1 \n\ | ||
86 | 204 | ]\n\ | ||
87 | 205 | }\n'; | ||
88 | 206 | var args = Array.prototype.slice.call(arguments); | ||
89 | 207 | var code = headerColumnCodeTemplate.arg(args.join(',\n')); | ||
90 | 208 | return code; | ||
91 | 209 | } | ||
92 | 210 | |||
93 | 196 | // %1 is used as anchors of mascotShapeLoader | 211 | // %1 is used as anchors of mascotShapeLoader |
94 | 197 | var kMascotShapeLoaderCode = 'Loader { \n\ | 212 | var kMascotShapeLoaderCode = 'Loader { \n\ |
95 | 198 | id: mascotShapeLoader; \n\ | 213 | id: mascotShapeLoader; \n\ |
96 | @@ -224,7 +239,7 @@ | |||
97 | 224 | }\n'; | 239 | }\n'; |
98 | 225 | 240 | ||
99 | 226 | // %1 is used as anchors of titleLabel | 241 | // %1 is used as anchors of titleLabel |
101 | 227 | // %1 is used as color of titleLabel | 242 | // %2 is used as color of titleLabel |
102 | 228 | // %3 is used as extra condition for visible of titleLabel | 243 | // %3 is used as extra condition for visible of titleLabel |
103 | 229 | var kTitleLabelCode = 'Label { \n\ | 244 | var kTitleLabelCode = 'Label { \n\ |
104 | 230 | id: titleLabel; \n\ | 245 | id: titleLabel; \n\ |
105 | @@ -258,6 +273,15 @@ | |||
106 | 258 | horizontalAlignment: root.headerAlignment; \n\ | 273 | horizontalAlignment: root.headerAlignment; \n\ |
107 | 259 | }\n'; | 274 | }\n'; |
108 | 260 | 275 | ||
109 | 276 | // %1 is used as anchors of attributesRow | ||
110 | 277 | var kAttributesRowCode = 'CardAttributes { \n\ | ||
111 | 278 | id: attributesRow; \n\ | ||
112 | 279 | objectName: "attributesRow"; \n\ | ||
113 | 280 | anchors { %1 } \n\ | ||
114 | 281 | color: %2; \n\ | ||
115 | 282 | model: cardData && cardData["attributes"] || undefined; \n\ | ||
116 | 283 | }\n'; | ||
117 | 284 | |||
118 | 261 | // %1 is used as top anchor of summary | 285 | // %1 is used as top anchor of summary |
119 | 262 | // %2 is used as topMargin anchor of summary | 286 | // %2 is used as topMargin anchor of summary |
120 | 263 | // %3 is used as color of summary | 287 | // %3 is used as color of summary |
121 | @@ -308,6 +332,7 @@ | |||
122 | 308 | var headerAsOverlay = hasArt && template && template["overlay"] === true && (hasTitle || hasMascot); | 332 | var headerAsOverlay = hasArt && template && template["overlay"] === true && (hasTitle || hasMascot); |
123 | 309 | var hasSubtitle = hasTitle && components["subtitle"] || false; | 333 | var hasSubtitle = hasTitle && components["subtitle"] || false; |
124 | 310 | var hasHeaderRow = hasMascot && hasTitle; | 334 | var hasHeaderRow = hasMascot && hasTitle; |
125 | 335 | var hasAttributes = hasTitle && components["attributes"] || false; | ||
126 | 311 | 336 | ||
127 | 312 | if (hasBackground) { | 337 | if (hasBackground) { |
128 | 313 | code += kBackgroundLoaderCode; | 338 | code += kBackgroundLoaderCode; |
129 | @@ -377,6 +402,14 @@ | |||
130 | 377 | code += 'readonly property int headerHeight: row.height;\n' | 402 | code += 'readonly property int headerHeight: row.height;\n' |
131 | 378 | } else if (hasMascot) { | 403 | } else if (hasMascot) { |
132 | 379 | code += 'readonly property int headerHeight: mascotImage.height;\n' | 404 | code += 'readonly property int headerHeight: mascotImage.height;\n' |
133 | 405 | } else if (hasAttributes) { | ||
134 | 406 | if (hasTitle && hasSubtitle) { | ||
135 | 407 | code += 'readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin + attributesRow.height + attributesRow.anchors.topMargin;\n' | ||
136 | 408 | } else if (hasTitle) { | ||
137 | 409 | code += 'readonly property int headerHeight: titleLabel.height + attributesRow.height + attributesRow.anchors.topMargin;\n' | ||
138 | 410 | } else { | ||
139 | 411 | code += 'readonly property int headerHeight: attributesRow.height;\n' | ||
140 | 412 | } | ||
141 | 380 | } else if (hasSubtitle) { | 413 | } else if (hasSubtitle) { |
142 | 381 | code += 'readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;\n' | 414 | code += 'readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;\n' |
143 | 382 | } else if (hasTitle) { | 415 | } else if (hasTitle) { |
144 | @@ -425,10 +458,12 @@ | |||
145 | 425 | 458 | ||
146 | 426 | var titleAnchors; | 459 | var titleAnchors; |
147 | 427 | var subtitleAnchors; | 460 | var subtitleAnchors; |
149 | 428 | if (hasMascot && hasSubtitle) { | 461 | var attributesAnchors; |
150 | 462 | if (hasMascot && (hasSubtitle || hasAttributes)) { | ||
151 | 429 | // Using row + column | 463 | // Using row + column |
152 | 430 | titleAnchors = 'left: parent.left; right: parent.right'; | 464 | titleAnchors = 'left: parent.left; right: parent.right'; |
153 | 431 | subtitleAnchors = titleAnchors; | 465 | subtitleAnchors = titleAnchors; |
154 | 466 | attributesAnchors = subtitleAnchors; | ||
155 | 432 | } else if (hasMascot) { | 467 | } else if (hasMascot) { |
156 | 433 | // Using row + label | 468 | // Using row + label |
157 | 434 | titleAnchors = 'verticalCenter: parent.verticalCenter;\n' | 469 | titleAnchors = 'verticalCenter: parent.verticalCenter;\n' |
158 | @@ -438,11 +473,13 @@ | |||
159 | 438 | titleAnchors = 'left: parent.left; \n\ | 473 | titleAnchors = 'left: parent.left; \n\ |
160 | 439 | leftMargin: units.gu(1); \n\ | 474 | leftMargin: units.gu(1); \n\ |
161 | 440 | right: parent.right; \n\ | 475 | right: parent.right; \n\ |
162 | 476 | rightMargin: units.gu(1); \n\ | ||
163 | 441 | top: overlayLoader.top; \n\ | 477 | top: overlayLoader.top; \n\ |
164 | 442 | topMargin: units.gu(1);\n'; | 478 | topMargin: units.gu(1);\n'; |
165 | 443 | } else { | 479 | } else { |
166 | 444 | // Using anchors to the mascot/parent | 480 | // Using anchors to the mascot/parent |
168 | 445 | titleAnchors = "right: parent.right;"; | 481 | titleAnchors = "right: parent.right;\n"; |
169 | 482 | titleAnchors += "rightMargin: units.gu(1);\n"; | ||
170 | 446 | titleAnchors += headerLeftAnchor; | 483 | titleAnchors += headerLeftAnchor; |
171 | 447 | titleAnchors += headerVerticalAnchors; | 484 | titleAnchors += headerVerticalAnchors; |
172 | 448 | if (!headerLeftAnchorHasMargin) { | 485 | if (!headerLeftAnchorHasMargin) { |
173 | @@ -452,8 +489,19 @@ | |||
174 | 452 | subtitleAnchors = 'left: titleLabel.left; \n\ | 489 | subtitleAnchors = 'left: titleLabel.left; \n\ |
175 | 453 | leftMargin: titleLabel.leftMargin; \n\ | 490 | leftMargin: titleLabel.leftMargin; \n\ |
176 | 454 | right: titleLabel.right; \n\ | 491 | right: titleLabel.right; \n\ |
177 | 492 | rightMargin: titleLabel.rightMargin; \n\ | ||
178 | 455 | top: titleLabel.bottom; \n\ | 493 | top: titleLabel.bottom; \n\ |
179 | 456 | topMargin: units.dp(2);\n'; | 494 | topMargin: units.dp(2);\n'; |
180 | 495 | if (hasSubtitle) { | ||
181 | 496 | attributesAnchors = 'left: subtitleLabel.left; \n\ | ||
182 | 497 | leftMargin: subtitleLabel.leftMargin; \n\ | ||
183 | 498 | right: subtitleLabel.right; \n\ | ||
184 | 499 | rightMargin: subtitleLabel.rightMargin; \n\ | ||
185 | 500 | top: subtitleLabel.bottom; \n\ | ||
186 | 501 | topMargin: units.dp(2);\n'; | ||
187 | 502 | } else { | ||
188 | 503 | attributesAnchors = subtitleAnchors; | ||
189 | 504 | } | ||
190 | 457 | } | 505 | } |
191 | 458 | 506 | ||
192 | 459 | var titleLabelVisibleExtra = (headerAsOverlay ? '&& overlayLoader.active': ''); | 507 | var titleLabelVisibleExtra = (headerAsOverlay ? '&& overlayLoader.active': ''); |
193 | @@ -463,11 +511,27 @@ | |||
194 | 463 | subtitleCode += kSubtitleLabelCode.arg(subtitleAnchors).arg(color); | 511 | subtitleCode += kSubtitleLabelCode.arg(subtitleAnchors).arg(color); |
195 | 464 | } | 512 | } |
196 | 465 | 513 | ||
198 | 466 | if (hasMascot && hasSubtitle) { | 514 | if (hasMascot && (hasSubtitle || hasAttributes)) { |
199 | 467 | // If using row + column wrap the code in the column | 515 | // If using row + column wrap the code in the column |
200 | 468 | titleSubtitleCode = kHeaderColumnCode.arg(titleCode).arg(subtitleCode); | 516 | titleSubtitleCode = kHeaderColumnCode.arg(titleCode).arg(subtitleCode); |
201 | 517 | if (hasSubtitle && hasAttributes) { | ||
202 | 518 | var attributesCode = kAttributesRowCode.arg(attributesAnchors).arg(color); | ||
203 | 519 | titleSubtitleCode = kHeaderColumnCodeGenerator(titleCode, subtitleCode, attributesCode); | ||
204 | 520 | } else if (hasSubtitle) { | ||
205 | 521 | titleSubtitleCode = kHeaderColumnCode.arg(titleCode).arg(subtitleCode); | ||
206 | 522 | } else if (hasAttributes) { | ||
207 | 523 | var attributesCode = kAttributesRowCode.arg(attributesAnchors).arg(color); | ||
208 | 524 | titleSubtitleCode = kHeaderColumnCode.arg(titleCode).arg(attributesCode); | ||
209 | 525 | } | ||
210 | 469 | } else { | 526 | } else { |
212 | 470 | titleSubtitleCode = titleCode + subtitleCode; | 527 | titleSubtitleCode = titleCode; |
213 | 528 | if (hasSubtitle) { | ||
214 | 529 | titleSubtitleCode = titleSubtitleCode + subtitleCode; | ||
215 | 530 | } | ||
216 | 531 | if (hasAttributes) { | ||
217 | 532 | var attributesCode = kAttributesRowCode.arg(attributesAnchors).arg(color); | ||
218 | 533 | titleSubtitleCode = titleSubtitleCode + attributesCode; | ||
219 | 534 | } | ||
220 | 471 | } | 535 | } |
221 | 472 | } | 536 | } |
222 | 473 | 537 | ||
223 | @@ -487,6 +551,7 @@ | |||
224 | 487 | else if (headerAsOverlay && hasArt) summaryTopAnchor = "artShapeHolder.bottom"; | 551 | else if (headerAsOverlay && hasArt) summaryTopAnchor = "artShapeHolder.bottom"; |
225 | 488 | else if (hasHeaderRow) summaryTopAnchor = "row.bottom"; | 552 | else if (hasHeaderRow) summaryTopAnchor = "row.bottom"; |
226 | 489 | else if (hasMascot) summaryTopAnchor = "mascotImage.bottom"; | 553 | else if (hasMascot) summaryTopAnchor = "mascotImage.bottom"; |
227 | 554 | else if (hasAttributes) summaryTopAnchor = "attributesRow.bottom"; | ||
228 | 490 | else if (hasSubtitle) summaryTopAnchor = "subtitleLabel.bottom"; | 555 | else if (hasSubtitle) summaryTopAnchor = "subtitleLabel.bottom"; |
229 | 491 | else if (hasTitle) summaryTopAnchor = "titleLabel.bottom"; | 556 | else if (hasTitle) summaryTopAnchor = "titleLabel.bottom"; |
230 | 492 | else if (hasArt) summaryTopAnchor = "artShapeHolder.bottom"; | 557 | else if (hasArt) summaryTopAnchor = "artShapeHolder.bottom"; |
231 | @@ -499,7 +564,7 @@ | |||
232 | 499 | color = 'root.scopeStyle ? root.scopeStyle.foreground : "grey"'; | 564 | color = 'root.scopeStyle ? root.scopeStyle.foreground : "grey"'; |
233 | 500 | } | 565 | } |
234 | 501 | 566 | ||
236 | 502 | var summaryTopMargin = (hasMascot || hasSubtitle ? 'anchors.margins' : '0'); | 567 | var summaryTopMargin = (hasMascot || hasSubtitle || hasAttributes ? 'anchors.margins' : '0'); |
237 | 503 | 568 | ||
238 | 504 | code += kSummaryLabelCode.arg(summaryTopAnchor).arg(summaryTopMargin).arg(color); | 569 | code += kSummaryLabelCode.arg(summaryTopAnchor).arg(summaryTopMargin).arg(color); |
239 | 505 | } | 570 | } |
240 | @@ -510,6 +575,8 @@ | |||
241 | 510 | code += 'implicitHeight: row.y + row.height + units.gu(1);\n'; | 575 | code += 'implicitHeight: row.y + row.height + units.gu(1);\n'; |
242 | 511 | } else if (hasMascot) { | 576 | } else if (hasMascot) { |
243 | 512 | code += 'implicitHeight: mascotImage.y + mascotImage.height;\n'; | 577 | code += 'implicitHeight: mascotImage.y + mascotImage.height;\n'; |
244 | 578 | } else if (hasAttributes) { | ||
245 | 579 | code += 'implicitHeight: attributesRow.y + attributesRow.height + units.gu(1);\n'; | ||
246 | 513 | } else if (hasSubtitle) { | 580 | } else if (hasSubtitle) { |
247 | 514 | code += 'implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1);\n'; | 581 | code += 'implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1);\n'; |
248 | 515 | } else if (hasTitle) { | 582 | } else if (hasTitle) { |
249 | @@ -526,8 +593,10 @@ | |||
250 | 526 | function createCardComponent(parent, template, components) { | 593 | function createCardComponent(parent, template, components) { |
251 | 527 | var imports = 'import QtQuick 2.2; \n\ | 594 | var imports = 'import QtQuick 2.2; \n\ |
252 | 528 | import Ubuntu.Components 0.1; \n\ | 595 | import Ubuntu.Components 0.1; \n\ |
254 | 529 | import Ubuntu.Thumbnailer 0.1;\n'; | 596 | import Ubuntu.Thumbnailer 0.1;\n\ |
255 | 597 | import Dash 0.1;\n'; | ||
256 | 530 | var card = cardString(template, components); | 598 | var card = cardString(template, components); |
257 | 531 | var code = imports + 'Component {\n' + card + '}\n'; | 599 | var code = imports + 'Component {\n' + card + '}\n'; |
258 | 600 | |||
259 | 532 | return Qt.createQmlObject(code, parent, "createCardComponent"); | 601 | return Qt.createQmlObject(code, parent, "createCardComponent"); |
260 | 533 | } | 602 | } |
261 | 534 | 603 | ||
262 | === modified file 'plugins/Dash/qmldir' | |||
263 | --- plugins/Dash/qmldir 2014-07-08 08:30:46 +0000 | |||
264 | +++ plugins/Dash/qmldir 2014-07-28 12:00:26 +0000 | |||
265 | @@ -3,3 +3,4 @@ | |||
266 | 3 | typeinfo Dash.qmltypes | 3 | typeinfo Dash.qmltypes |
267 | 4 | singleton CardCreatorCache 0.1 CardCreatorCache.qml | 4 | singleton CardCreatorCache 0.1 CardCreatorCache.qml |
268 | 5 | ScopeStyle 0.1 ScopeStyle.qml | 5 | ScopeStyle 0.1 ScopeStyle.qml |
269 | 6 | CardAttributes 0.1 CardAttributes.qml | ||
270 | 6 | \ No newline at end of file | 7 | \ No newline at end of file |
271 | 7 | 8 | ||
272 | === modified file 'qml/Dash/CardTool.qml' | |||
273 | --- qml/Dash/CardTool.qml 2014-05-02 14:51:22 +0000 | |||
274 | +++ qml/Dash/CardTool.qml 2014-07-28 12:00:26 +0000 | |||
275 | @@ -165,15 +165,40 @@ | |||
276 | 165 | } | 165 | } |
277 | 166 | } | 166 | } |
278 | 167 | 167 | ||
279 | 168 | Item { | ||
280 | 169 | id: attributesModel | ||
281 | 170 | property int numOfAttributes: 0 | ||
282 | 171 | property var model: [] | ||
283 | 172 | property bool hasAttributes: { | ||
284 | 173 | var attributes = components["attributes"]; | ||
285 | 174 | var hasAttributesFlag = (attributes != undefined) && attributes["field"]; | ||
286 | 175 | |||
287 | 176 | if (hasAttributesFlag) { | ||
288 | 177 | if (attributes["max-count"]) { | ||
289 | 178 | numOfAttributes = attributes["max-count"]; | ||
290 | 179 | } | ||
291 | 180 | } | ||
292 | 181 | return hasAttributesFlag | ||
293 | 182 | } | ||
294 | 183 | |||
295 | 184 | onNumOfAttributesChanged: { | ||
296 | 185 | model = [] | ||
297 | 186 | for (var i = 0; i < numOfAttributes; i++) { | ||
298 | 187 | model.push( {"value":"text"+(i+1), "icon":"image://theme/ok" } ); | ||
299 | 188 | } | ||
300 | 189 | } | ||
301 | 190 | } | ||
302 | 191 | |||
303 | 168 | Loader { | 192 | Loader { |
304 | 169 | id: cardLoader | 193 | id: cardLoader |
306 | 170 | property var fields: ["art", "mascot", "title", "subtitle", "summary"] | 194 | property var fields: ["art", "mascot", "title", "subtitle", "summary", "attributes"] |
307 | 171 | property var maxData: { | 195 | property var maxData: { |
308 | 172 | "art": Qt.resolvedUrl("graphics/checkers.png"), | 196 | "art": Qt.resolvedUrl("graphics/checkers.png"), |
309 | 173 | "mascot": Qt.resolvedUrl("graphics/checkers.png"), | 197 | "mascot": Qt.resolvedUrl("graphics/checkers.png"), |
310 | 174 | "title": "—\n—", | 198 | "title": "—\n—", |
311 | 175 | "subtitle": "—", | 199 | "subtitle": "—", |
313 | 176 | "summary": "—\n—\n—\n—\n—" | 200 | "summary": "—\n—\n—\n—\n—", |
314 | 201 | "attributes": attributesModel.model | ||
315 | 177 | } | 202 | } |
316 | 178 | sourceComponent: cardTool.cardComponent | 203 | sourceComponent: cardTool.cardComponent |
317 | 179 | onLoaded: { | 204 | onLoaded: { |
318 | 180 | 205 | ||
319 | === modified file 'tests/plugins/Dash/CMakeLists.txt' | |||
320 | --- tests/plugins/Dash/CMakeLists.txt 2014-07-08 08:35:20 +0000 | |||
321 | +++ tests/plugins/Dash/CMakeLists.txt 2014-07-28 12:00:26 +0000 | |||
322 | @@ -79,3 +79,4 @@ | |||
323 | 79 | set(qmltest_DEFAULT_PROPERTIES ENVIRONMENT "LC_ALL=C") | 79 | set(qmltest_DEFAULT_PROPERTIES ENVIRONMENT "LC_ALL=C") |
324 | 80 | add_qml_test(. ScopeStyle IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins) | 80 | add_qml_test(. ScopeStyle IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins) |
325 | 81 | add_qml_test(. ListViewWithPageHeaderQML IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins) | 81 | add_qml_test(. ListViewWithPageHeaderQML IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins) |
326 | 82 | add_qml_test(. CardAttributes IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins) | ||
327 | 82 | 83 | ||
328 | === modified file 'tests/plugins/Dash/cardcreator/1.res' | |||
329 | --- tests/plugins/Dash/cardcreator/1.res 2014-07-08 12:37:34 +0000 | |||
330 | +++ tests/plugins/Dash/cardcreator/1.res 2014-07-28 12:00:26 +0000 | |||
331 | @@ -5,8 +5,8 @@ | |||
332 | 5 | property var cardData; | 5 | property var cardData; |
333 | 6 | property var artShapeBorderSource: undefined; | 6 | property var artShapeBorderSource: undefined; |
334 | 7 | property real fontScale: 1.0; | 7 | property real fontScale: 1.0; |
337 | 8 | property var scopeStyle: null; | 8 | property var scopeStyle: null; |
338 | 9 | property int headerAlignment: Text.AlignLeft; | 9 | property int headerAlignment: Text.AlignLeft; |
339 | 10 | property int fixedHeaderHeight: -1; | 10 | property int fixedHeaderHeight: -1; |
340 | 11 | property size fixedArtShapeSize: Qt.size(-1, -1); | 11 | property size fixedArtShapeSize: Qt.size(-1, -1); |
341 | 12 | readonly property string title: cardData && cardData["title"] || ""; | 12 | readonly property string title: cardData && cardData["title"] || ""; |
342 | @@ -16,71 +16,73 @@ | |||
343 | 16 | onArtShapeBorderSourceChanged: { if (artShapeBorderSource !== undefined && artShapeLoader.item) artShapeLoader.item.borderSource = artShapeBorderSource; } | 16 | onArtShapeBorderSourceChanged: { if (artShapeBorderSource !== undefined && artShapeLoader.item) artShapeLoader.item.borderSource = artShapeBorderSource; } |
344 | 17 | readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1); | 17 | readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1); |
345 | 18 | Item { | 18 | Item { |
377 | 19 | id: artShapeHolder; | 19 | id: artShapeHolder; |
378 | 20 | height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height; | 20 | height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height; |
379 | 21 | width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width; | 21 | width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width; |
380 | 22 | anchors { horizontalCenter: parent.horizontalCenter; } | 22 | anchors { horizontalCenter: parent.horizontalCenter; } |
381 | 23 | Loader { | 23 | Loader { |
382 | 24 | id: artShapeLoader; | 24 | id: artShapeLoader; |
383 | 25 | objectName: "artShapeLoader"; | 25 | objectName: "artShapeLoader"; |
384 | 26 | active: cardData && cardData["art"] || false; | 26 | active: cardData && cardData["art"] || false; |
385 | 27 | asynchronous: root.asynchronous; | 27 | asynchronous: root.asynchronous; |
386 | 28 | visible: status == Loader.Ready; | 28 | visible: status == Loader.Ready; |
387 | 29 | sourceComponent: UbuntuShape { | 29 | sourceComponent: UbuntuShape { |
388 | 30 | id: artShape; | 30 | id: artShape; |
389 | 31 | objectName: "artShape"; | 31 | objectName: "artShape"; |
390 | 32 | radius: "medium"; | 32 | radius: "medium"; |
391 | 33 | visible: image.status == Image.Ready; | 33 | visible: image.status == Image.Ready; |
392 | 34 | readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; | 34 | readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; |
393 | 35 | readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1; | 35 | readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1; |
394 | 36 | readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect; | 36 | readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect; |
395 | 37 | Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; } | 37 | Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; } |
396 | 38 | onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings(); | 38 | onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings(); |
397 | 39 | Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); } | 39 | Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); } |
398 | 40 | function updateWidthHeightBindings() { | 40 | function updateWidthHeightBindings() { |
399 | 41 | if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) { | 41 | if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) { |
400 | 42 | width = root.fixedArtShapeSize.width; | 42 | width = root.fixedArtShapeSize.width; |
401 | 43 | height = root.fixedArtShapeSize.height; | 43 | height = root.fixedArtShapeSize.height; |
402 | 44 | } else if (aspectSmallerThanImageAspect) { | 44 | } else if (aspectSmallerThanImageAspect) { |
403 | 45 | width = Qt.binding(function() { return !visible ? 0 : image.width }); | 45 | width = Qt.binding(function() { return !visible ? 0 : image.width }); |
404 | 46 | height = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.height : width / image.aspect }); | 46 | height = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.height : width / image.aspect }); |
405 | 47 | } else { | 47 | } else { |
406 | 48 | width = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.width : height * image.aspect }); | 48 | width = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.width : height * image.aspect }); |
407 | 49 | height = Qt.binding(function() { return !visible ? 0 : image.height }); | 49 | height = Qt.binding(function() { return !visible ? 0 : image.height }); |
408 | 50 | } | ||
409 | 51 | } | ||
410 | 52 | image: Image { | ||
411 | 53 | objectName: "artImage"; | ||
412 | 54 | source: cardData && cardData["art"] || ""; | ||
413 | 55 | cache: true; | ||
414 | 56 | asynchronous: root.asynchronous; | ||
415 | 57 | fillMode: components && components["art"]["fill-mode"] === "fit" ? Image.PreserveAspectFit: Image.PreserveAspectCrop; | ||
416 | 58 | readonly property real aspect: implicitWidth / implicitHeight; | ||
417 | 59 | width: root.width; | ||
418 | 60 | height: width / artShape.aspect; | ||
419 | 61 | } | ||
420 | 50 | } | 62 | } |
421 | 51 | } | 63 | } |
435 | 52 | image: Image { | 64 | } |
423 | 53 | objectName: "artImage"; | ||
424 | 54 | source: cardData && cardData["art"] || ""; | ||
425 | 55 | cache: true; | ||
426 | 56 | asynchronous: root.asynchronous; | ||
427 | 57 | fillMode: components && components["art"]["fill-mode"] === "fit" ? Image.PreserveAspectFit: Image.PreserveAspectCrop; | ||
428 | 58 | readonly property real aspect: implicitWidth / implicitHeight; | ||
429 | 59 | width: root.width; | ||
430 | 60 | height: width / artShape.aspect; | ||
431 | 61 | } | ||
432 | 62 | } | ||
433 | 63 | } | ||
434 | 64 | } | ||
436 | 65 | readonly property int headerHeight: titleLabel.height; | 65 | readonly property int headerHeight: titleLabel.height; |
437 | 66 | Label { | 66 | Label { |
441 | 67 | id: titleLabel; | 67 | id: titleLabel; |
442 | 68 | objectName: "titleLabel"; | 68 | objectName: "titleLabel"; |
443 | 69 | anchors { right: parent.right;left: parent.left; | 69 | anchors { right: parent.right; |
444 | 70 | rightMargin: units.gu(1); | ||
445 | 71 | left: parent.left; | ||
446 | 70 | top: artShapeHolder.bottom; | 72 | top: artShapeHolder.bottom; |
447 | 71 | topMargin: units.gu(1); | 73 | topMargin: units.gu(1); |
448 | 72 | leftMargin: units.gu(1); | 74 | leftMargin: units.gu(1); |
461 | 73 | } | 75 | } |
462 | 74 | elide: Text.ElideRight; | 76 | elide: Text.ElideRight; |
463 | 75 | fontSize: "small"; | 77 | fontSize: "small"; |
464 | 76 | wrapMode: Text.Wrap; | 78 | wrapMode: Text.Wrap; |
465 | 77 | maximumLineCount: 2; | 79 | maximumLineCount: 2; |
466 | 78 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); | 80 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); |
467 | 79 | color: root.scopeStyle ? root.scopeStyle.foreground : "grey"; | 81 | color: root.scopeStyle ? root.scopeStyle.foreground : "grey"; |
468 | 80 | visible: showHeader ; | 82 | visible: showHeader ; |
469 | 81 | text: root.title; | 83 | text: root.title; |
470 | 82 | font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal; | 84 | font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal; |
471 | 83 | horizontalAlignment: root.headerAlignment; | 85 | horizontalAlignment: root.headerAlignment; |
472 | 84 | } | 86 | } |
473 | 85 | implicitHeight: titleLabel.y + titleLabel.height + units.gu(1); | 87 | implicitHeight: titleLabel.y + titleLabel.height + units.gu(1); |
474 | 86 | } | 88 | } |
475 | 87 | 89 | ||
476 | === modified file 'tests/plugins/Dash/cardcreator/2.res' | |||
477 | --- tests/plugins/Dash/cardcreator/2.res 2014-07-08 12:53:51 +0000 | |||
478 | +++ tests/plugins/Dash/cardcreator/2.res 2014-07-28 12:00:26 +0000 | |||
479 | @@ -5,8 +5,8 @@ | |||
480 | 5 | property var cardData; | 5 | property var cardData; |
481 | 6 | property var artShapeBorderSource: undefined; | 6 | property var artShapeBorderSource: undefined; |
482 | 7 | property real fontScale: 1.0; | 7 | property real fontScale: 1.0; |
485 | 8 | property var scopeStyle: null; | 8 | property var scopeStyle: null; |
486 | 9 | property int headerAlignment: Text.AlignLeft; | 9 | property int headerAlignment: Text.AlignLeft; |
487 | 10 | property int fixedHeaderHeight: -1; | 10 | property int fixedHeaderHeight: -1; |
488 | 11 | property size fixedArtShapeSize: Qt.size(-1, -1); | 11 | property size fixedArtShapeSize: Qt.size(-1, -1); |
489 | 12 | readonly property string title: cardData && cardData["title"] || ""; | 12 | readonly property string title: cardData && cardData["title"] || ""; |
490 | @@ -14,104 +14,107 @@ | |||
491 | 14 | property bool showHeader: true; | 14 | property bool showHeader: true; |
492 | 15 | implicitWidth: childrenRect.width; | 15 | implicitWidth: childrenRect.width; |
493 | 16 | Loader { | 16 | Loader { |
526 | 17 | id: backgroundLoader; | 17 | id: backgroundLoader; |
527 | 18 | objectName: "backgroundLoader"; | 18 | objectName: "backgroundLoader"; |
528 | 19 | anchors.fill: parent; | 19 | anchors.fill: parent; |
529 | 20 | asynchronous: root.asynchronous; | 20 | asynchronous: root.asynchronous; |
530 | 21 | visible: status == Loader.Ready; | 21 | visible: status == Loader.Ready; |
531 | 22 | sourceComponent: UbuntuShape { | 22 | sourceComponent: UbuntuShape { |
532 | 23 | objectName: "background"; | 23 | objectName: "background"; |
533 | 24 | radius: "medium"; | 24 | radius: "medium"; |
534 | 25 | color: getColor(0) || "white"; | 25 | color: getColor(0) || "white"; |
535 | 26 | gradientColor: getColor(1) || color; | 26 | gradientColor: getColor(1) || color; |
536 | 27 | anchors.fill: parent; | 27 | anchors.fill: parent; |
537 | 28 | image: backgroundImage.source ? backgroundImage : null; | 28 | image: backgroundImage.source ? backgroundImage : null; |
538 | 29 | property real luminance: 0.2126 * color.r + 0.7152 * color.g + 0.0722 * color.b; | 29 | property real luminance: 0.2126 * color.r + 0.7152 * color.g + 0.0722 * color.b; |
539 | 30 | property Image backgroundImage: Image { | 30 | property Image backgroundImage: Image { |
540 | 31 | objectName: "backgroundImage"; | 31 | objectName: "backgroundImage"; |
541 | 32 | source: { | 32 | source: { |
542 | 33 | if (cardData && typeof cardData["background"] === "string") return cardData["background"]; | 33 | if (cardData && typeof cardData["background"] === "string") return cardData["background"]; |
543 | 34 | else if (template && typeof template["card-background"] === "string") return template["card-background"]; | 34 | else if (template && typeof template["card-background"] === "string") return template["card-background"]; |
544 | 35 | else return ""; | 35 | else return ""; |
545 | 36 | } | 36 | } |
546 | 37 | } | 37 | } |
547 | 38 | function getColor(index) { | 38 | function getColor(index) { |
548 | 39 | if (cardData && typeof cardData["background"] === "object" | 39 | if (cardData && typeof cardData["background"] === "object" |
549 | 40 | && (cardData["background"]["type"] === "color" || cardData["background"]["type"] === "gradient")) { | 40 | && (cardData["background"]["type"] === "color" || cardData["background"]["type"] === "gradient")) { |
550 | 41 | return cardData["background"]["elements"][index]; | 41 | return cardData["background"]["elements"][index]; |
551 | 42 | } else if (template && typeof template["card-background"] === "object" | 42 | } else if (template && typeof template["card-background"] === "object" |
552 | 43 | && (template["card-background"]["type"] === "color" || template["card-background"]["type"] === "gradient")) { | 43 | && (template["card-background"]["type"] === "color" || template["card-background"]["type"] === "gradient")) { |
553 | 44 | return template["card-background"]["elements"][index]; | 44 | return template["card-background"]["elements"][index]; |
554 | 45 | } else return undefined; | 45 | } else return undefined; |
555 | 46 | } | 46 | } |
556 | 47 | } | 47 | } |
557 | 48 | } | 48 | } |
558 | 49 | readonly property size artShapeSize: Qt.size(-1, -1); | 49 | readonly property size artShapeSize: Qt.size(-1, -1); |
559 | 50 | readonly property int headerHeight: row.height; | 50 | readonly property int headerHeight: row.height; |
560 | 51 | Row { | 51 | Row { |
567 | 52 | id: row; | 52 | id: row; |
568 | 53 | objectName: "outerRow"; | 53 | objectName: "outerRow"; |
569 | 54 | property real margins: units.gu(1); | 54 | property real margins: units.gu(1); |
570 | 55 | spacing: margins; | 55 | spacing: margins; |
571 | 56 | height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight; | 56 | height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight; |
572 | 57 | anchors { top: parent.top; | 57 | anchors { top: parent.top; |
573 | 58 | topMargin: units.gu(1); | 58 | topMargin: units.gu(1); |
617 | 59 | left: parent.left; | 59 | left: parent.left; |
618 | 60 | } | 60 | } |
619 | 61 | anchors.right: parent.right; | 61 | anchors.right: parent.right; |
620 | 62 | anchors.margins: margins; | 62 | anchors.margins: margins; |
621 | 63 | data: [ Image { | 63 | data: [ Image { |
622 | 64 | id: mascotImage; | 64 | id: mascotImage; |
623 | 65 | objectName: "mascotImage"; | 65 | objectName: "mascotImage"; |
624 | 66 | anchors { verticalCenter: parent.verticalCenter; } | 66 | anchors { verticalCenter: parent.verticalCenter; } |
625 | 67 | readonly property int maxSize: Math.max(width, height) * 4; | 67 | readonly property int maxSize: Math.max(width, height) * 4; |
626 | 68 | source: cardData && cardData["mascot"]; | 68 | source: cardData && cardData["mascot"]; |
627 | 69 | width: units.gu(6); | 69 | width: units.gu(6); |
628 | 70 | height: units.gu(5.625); | 70 | height: units.gu(5.625); |
629 | 71 | sourceSize { width: maxSize; height: maxSize } | 71 | sourceSize { width: maxSize; height: maxSize } |
630 | 72 | fillMode: Image.PreserveAspectCrop; | 72 | fillMode: Image.PreserveAspectCrop; |
631 | 73 | horizontalAlignment: Image.AlignHCenter; | 73 | horizontalAlignment: Image.AlignHCenter; |
632 | 74 | verticalAlignment: Image.AlignVCenter; | 74 | verticalAlignment: Image.AlignVCenter; |
633 | 75 | visible: showHeader; | 75 | visible: showHeader; |
634 | 76 | } | 76 | } |
592 | 77 | , | ||
593 | 78 | Column { | ||
594 | 79 | anchors.verticalCenter: parent.verticalCenter; | ||
595 | 80 | spacing: units.dp(2); | ||
596 | 81 | width: parent.width - x; | ||
597 | 82 | data: [ Label { | ||
598 | 83 | id: titleLabel; | ||
599 | 84 | objectName: "titleLabel"; | ||
600 | 85 | anchors { left: parent.left; right: parent.right } | ||
601 | 86 | elide: Text.ElideRight; | ||
602 | 87 | fontSize: "small"; | ||
603 | 88 | wrapMode: Text.Wrap; | ||
604 | 89 | maximumLineCount: 2; | ||
605 | 90 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); | ||
606 | 91 | color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey"); | ||
607 | 92 | visible: showHeader ; | ||
608 | 93 | text: root.title; | ||
609 | 94 | font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal; | ||
610 | 95 | horizontalAlignment: root.headerAlignment; | ||
611 | 96 | } | ||
612 | 97 | , | ||
613 | 98 | Label { | ||
614 | 99 | id: subtitleLabel; | ||
615 | 100 | objectName: "subtitleLabel"; | ||
616 | 101 | anchors { left: parent.left; right: parent.right } | ||
635 | 102 | 77 | ||
636 | 78 | , | ||
637 | 79 | Column { | ||
638 | 80 | anchors.verticalCenter: parent.verticalCenter; | ||
639 | 81 | spacing: units.dp(2); | ||
640 | 82 | width: parent.width - x; | ||
641 | 83 | data: [ Label { | ||
642 | 84 | id: titleLabel; | ||
643 | 85 | objectName: "titleLabel"; | ||
644 | 86 | anchors { left: parent.left; right: parent.right } | ||
645 | 103 | elide: Text.ElideRight; | 87 | elide: Text.ElideRight; |
646 | 104 | fontSize: "small"; | 88 | fontSize: "small"; |
647 | 89 | wrapMode: Text.Wrap; | ||
648 | 90 | maximumLineCount: 2; | ||
649 | 105 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); | 91 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); |
654 | 106 | color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey"); | 92 | color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey"); |
655 | 107 | visible: titleLabel.visible && titleLabel.text; | 93 | visible: showHeader ; |
656 | 108 | text: cardData && cardData["subtitle"] || ""; | 94 | text: root.title; |
657 | 109 | font.weight: Font.Light; | 95 | font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal; |
658 | 110 | horizontalAlignment: root.headerAlignment; | 96 | horizontalAlignment: root.headerAlignment; |
659 | 111 | } | 97 | } |
664 | 112 | ] | 98 | |
665 | 113 | } | 99 | , |
666 | 114 | ] | 100 | Label { |
667 | 115 | } | 101 | id: subtitleLabel; |
668 | 102 | objectName: "subtitleLabel"; | ||
669 | 103 | anchors { left: parent.left; right: parent.right } | ||
670 | 104 | elide: Text.ElideRight; | ||
671 | 105 | fontSize: "small"; | ||
672 | 106 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); | ||
673 | 107 | color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey"); | ||
674 | 108 | visible: titleLabel.visible && titleLabel.text; | ||
675 | 109 | text: cardData && cardData["subtitle"] || ""; | ||
676 | 110 | font.weight: Font.Light; | ||
677 | 111 | horizontalAlignment: root.headerAlignment; | ||
678 | 112 | } | ||
679 | 113 | |||
680 | 114 | ] | ||
681 | 115 | } | ||
682 | 116 | |||
683 | 117 | ] | ||
684 | 118 | } | ||
685 | 116 | implicitHeight: row.y + row.height + units.gu(1); | 119 | implicitHeight: row.y + row.height + units.gu(1); |
686 | 117 | } | 120 | } |
687 | 118 | 121 | ||
688 | === modified file 'tests/plugins/Dash/cardcreator/3.res' | |||
689 | --- tests/plugins/Dash/cardcreator/3.res 2014-07-08 12:37:34 +0000 | |||
690 | +++ tests/plugins/Dash/cardcreator/3.res 2014-07-28 12:00:26 +0000 | |||
691 | @@ -5,8 +5,8 @@ | |||
692 | 5 | property var cardData; | 5 | property var cardData; |
693 | 6 | property var artShapeBorderSource: undefined; | 6 | property var artShapeBorderSource: undefined; |
694 | 7 | property real fontScale: 1.0; | 7 | property real fontScale: 1.0; |
697 | 8 | property var scopeStyle: null; | 8 | property var scopeStyle: null; |
698 | 9 | property int headerAlignment: Text.AlignLeft; | 9 | property int headerAlignment: Text.AlignLeft; |
699 | 10 | property int fixedHeaderHeight: -1; | 10 | property int fixedHeaderHeight: -1; |
700 | 11 | property size fixedArtShapeSize: Qt.size(-1, -1); | 11 | property size fixedArtShapeSize: Qt.size(-1, -1); |
701 | 12 | readonly property string title: cardData && cardData["title"] || ""; | 12 | readonly property string title: cardData && cardData["title"] || ""; |
702 | @@ -16,89 +16,92 @@ | |||
703 | 16 | onArtShapeBorderSourceChanged: { if (artShapeBorderSource !== undefined && artShapeLoader.item) artShapeLoader.item.borderSource = artShapeBorderSource; } | 16 | onArtShapeBorderSourceChanged: { if (artShapeBorderSource !== undefined && artShapeLoader.item) artShapeLoader.item.borderSource = artShapeBorderSource; } |
704 | 17 | readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1); | 17 | readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1); |
705 | 18 | Item { | 18 | Item { |
743 | 19 | id: artShapeHolder; | 19 | id: artShapeHolder; |
744 | 20 | height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height; | 20 | height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height; |
745 | 21 | width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width; | 21 | width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width; |
746 | 22 | anchors { horizontalCenter: parent.horizontalCenter; } | 22 | anchors { horizontalCenter: parent.horizontalCenter; } |
747 | 23 | Loader { | 23 | Loader { |
748 | 24 | id: artShapeLoader; | 24 | id: artShapeLoader; |
749 | 25 | objectName: "artShapeLoader"; | 25 | objectName: "artShapeLoader"; |
750 | 26 | active: cardData && cardData["art"] || false; | 26 | active: cardData && cardData["art"] || false; |
714 | 27 | asynchronous: root.asynchronous; | ||
715 | 28 | visible: status == Loader.Ready; | ||
716 | 29 | sourceComponent: UbuntuShape { | ||
717 | 30 | id: artShape; | ||
718 | 31 | objectName: "artShape"; | ||
719 | 32 | radius: "medium"; | ||
720 | 33 | visible: image.status == Image.Ready; | ||
721 | 34 | readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; | ||
722 | 35 | readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1; | ||
723 | 36 | readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect; | ||
724 | 37 | Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; } | ||
725 | 38 | onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings(); | ||
726 | 39 | Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); } | ||
727 | 40 | function updateWidthHeightBindings() { | ||
728 | 41 | if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) { | ||
729 | 42 | width = root.fixedArtShapeSize.width; | ||
730 | 43 | height = root.fixedArtShapeSize.height; | ||
731 | 44 | } else if (aspectSmallerThanImageAspect) { | ||
732 | 45 | width = Qt.binding(function() { return !visible ? 0 : image.width }); | ||
733 | 46 | height = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.height : width / image.aspect }); | ||
734 | 47 | } else { | ||
735 | 48 | width = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.width : height * image.aspect }); | ||
736 | 49 | height = Qt.binding(function() { return !visible ? 0 : image.height }); | ||
737 | 50 | } | ||
738 | 51 | } | ||
739 | 52 | image: Image { | ||
740 | 53 | objectName: "artImage"; | ||
741 | 54 | source: cardData && cardData["art"] || ""; | ||
742 | 55 | cache: true; | ||
751 | 56 | asynchronous: root.asynchronous; | 27 | asynchronous: root.asynchronous; |
756 | 57 | fillMode: components && components["art"]["fill-mode"] === "fit" ? Image.PreserveAspectFit: Image.PreserveAspectCrop; | 28 | visible: status == Loader.Ready; |
757 | 58 | readonly property real aspect: implicitWidth / implicitHeight; | 29 | sourceComponent: UbuntuShape { |
758 | 59 | width: root.width; | 30 | id: artShape; |
759 | 60 | height: width / artShape.aspect; | 31 | objectName: "artShape"; |
760 | 32 | radius: "medium"; | ||
761 | 33 | visible: image.status == Image.Ready; | ||
762 | 34 | readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; | ||
763 | 35 | readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1; | ||
764 | 36 | readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect; | ||
765 | 37 | Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; } | ||
766 | 38 | onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings(); | ||
767 | 39 | Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); } | ||
768 | 40 | function updateWidthHeightBindings() { | ||
769 | 41 | if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) { | ||
770 | 42 | width = root.fixedArtShapeSize.width; | ||
771 | 43 | height = root.fixedArtShapeSize.height; | ||
772 | 44 | } else if (aspectSmallerThanImageAspect) { | ||
773 | 45 | width = Qt.binding(function() { return !visible ? 0 : image.width }); | ||
774 | 46 | height = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.height : width / image.aspect }); | ||
775 | 47 | } else { | ||
776 | 48 | width = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.width : height * image.aspect }); | ||
777 | 49 | height = Qt.binding(function() { return !visible ? 0 : image.height }); | ||
778 | 50 | } | ||
779 | 51 | } | ||
780 | 52 | image: Image { | ||
781 | 53 | objectName: "artImage"; | ||
782 | 54 | source: cardData && cardData["art"] || ""; | ||
783 | 55 | cache: true; | ||
784 | 56 | asynchronous: root.asynchronous; | ||
785 | 57 | fillMode: components && components["art"]["fill-mode"] === "fit" ? Image.PreserveAspectFit: Image.PreserveAspectCrop; | ||
786 | 58 | readonly property real aspect: implicitWidth / implicitHeight; | ||
787 | 59 | width: root.width; | ||
788 | 60 | height: width / artShape.aspect; | ||
789 | 61 | } | ||
790 | 62 | } | ||
791 | 61 | } | 63 | } |
795 | 62 | } | 64 | } |
793 | 63 | } | ||
794 | 64 | } | ||
796 | 65 | readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin; | 65 | readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin; |
797 | 66 | Label { | 66 | Label { |
801 | 67 | id: titleLabel; | 67 | id: titleLabel; |
802 | 68 | objectName: "titleLabel"; | 68 | objectName: "titleLabel"; |
803 | 69 | anchors { right: parent.right;left: parent.left; | 69 | anchors { right: parent.right; |
804 | 70 | rightMargin: units.gu(1); | ||
805 | 71 | left: parent.left; | ||
806 | 70 | top: artShapeHolder.bottom; | 72 | top: artShapeHolder.bottom; |
807 | 71 | topMargin: units.gu(1); | 73 | topMargin: units.gu(1); |
808 | 72 | leftMargin: units.gu(1); | 74 | leftMargin: units.gu(1); |
830 | 73 | } | 75 | } |
810 | 74 | elide: Text.ElideRight; | ||
811 | 75 | fontSize: "small"; | ||
812 | 76 | wrapMode: Text.Wrap; | ||
813 | 77 | maximumLineCount: 2; | ||
814 | 78 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); | ||
815 | 79 | color: root.scopeStyle ? root.scopeStyle.foreground : "grey"; | ||
816 | 80 | visible: showHeader ; | ||
817 | 81 | text: root.title; | ||
818 | 82 | font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal; | ||
819 | 83 | horizontalAlignment: root.headerAlignment; | ||
820 | 84 | } | ||
821 | 85 | Label { | ||
822 | 86 | id: subtitleLabel; | ||
823 | 87 | objectName: "subtitleLabel"; | ||
824 | 88 | anchors { left: titleLabel.left; | ||
825 | 89 | leftMargin: titleLabel.leftMargin; | ||
826 | 90 | right: titleLabel.right; | ||
827 | 91 | top: titleLabel.bottom; | ||
828 | 92 | topMargin: units.dp(2); | ||
829 | 93 | } | ||
831 | 94 | elide: Text.ElideRight; | 76 | elide: Text.ElideRight; |
832 | 95 | fontSize: "small"; | 77 | fontSize: "small"; |
833 | 78 | wrapMode: Text.Wrap; | ||
834 | 79 | maximumLineCount: 2; | ||
835 | 96 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); | 80 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); |
840 | 97 | color: root.scopeStyle ? root.scopeStyle.foreground : "grey"; | 81 | color: root.scopeStyle ? root.scopeStyle.foreground : "grey"; |
841 | 98 | visible: titleLabel.visible && titleLabel.text; | 82 | visible: showHeader ; |
842 | 99 | text: cardData && cardData["subtitle"] || ""; | 83 | text: root.title; |
843 | 100 | font.weight: Font.Light; | 84 | font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal; |
844 | 101 | horizontalAlignment: root.headerAlignment; | 85 | horizontalAlignment: root.headerAlignment; |
845 | 102 | } | 86 | } |
846 | 87 | Label { | ||
847 | 88 | id: subtitleLabel; | ||
848 | 89 | objectName: "subtitleLabel"; | ||
849 | 90 | anchors { left: titleLabel.left; | ||
850 | 91 | leftMargin: titleLabel.leftMargin; | ||
851 | 92 | right: titleLabel.right; | ||
852 | 93 | rightMargin: titleLabel.rightMargin; | ||
853 | 94 | top: titleLabel.bottom; | ||
854 | 95 | topMargin: units.dp(2); | ||
855 | 96 | } | ||
856 | 97 | elide: Text.ElideRight; | ||
857 | 98 | fontSize: "small"; | ||
858 | 99 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); | ||
859 | 100 | color: root.scopeStyle ? root.scopeStyle.foreground : "grey"; | ||
860 | 101 | visible: titleLabel.visible && titleLabel.text; | ||
861 | 102 | text: cardData && cardData["subtitle"] || ""; | ||
862 | 103 | font.weight: Font.Light; | ||
863 | 104 | horizontalAlignment: root.headerAlignment; | ||
864 | 105 | } | ||
865 | 103 | implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1); | 106 | implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1); |
866 | 104 | } | 107 | } |
867 | 105 | 108 | ||
868 | === modified file 'tests/plugins/Dash/cardcreator/5.res' | |||
869 | --- tests/plugins/Dash/cardcreator/5.res 2014-07-08 12:37:34 +0000 | |||
870 | +++ tests/plugins/Dash/cardcreator/5.res 2014-07-28 12:00:26 +0000 | |||
871 | @@ -4,9 +4,9 @@ | |||
872 | 4 | property var components; | 4 | property var components; |
873 | 5 | property var cardData; | 5 | property var cardData; |
874 | 6 | property var artShapeBorderSource: undefined; | 6 | property var artShapeBorderSource: undefined; |
878 | 7 | property real fontScale: 1.0; | 7 | property real fontScale: 1.0; |
879 | 8 | property var scopeStyle: null; | 8 | property var scopeStyle: null; |
880 | 9 | property int headerAlignment: Text.AlignLeft; | 9 | property int headerAlignment: Text.AlignLeft; |
881 | 10 | property int fixedHeaderHeight: -1; | 10 | property int fixedHeaderHeight: -1; |
882 | 11 | property size fixedArtShapeSize: Qt.size(-1, -1); | 11 | property size fixedArtShapeSize: Qt.size(-1, -1); |
883 | 12 | readonly property string title: cardData && cardData["title"] || ""; | 12 | readonly property string title: cardData && cardData["title"] || ""; |
884 | @@ -16,130 +16,132 @@ | |||
885 | 16 | onArtShapeBorderSourceChanged: { if (artShapeBorderSource !== undefined && artShapeLoader.item) artShapeLoader.item.borderSource = artShapeBorderSource; } | 16 | onArtShapeBorderSourceChanged: { if (artShapeBorderSource !== undefined && artShapeLoader.item) artShapeLoader.item.borderSource = artShapeBorderSource; } |
886 | 17 | readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1); | 17 | readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1); |
887 | 18 | Item { | 18 | Item { |
925 | 19 | id: artShapeHolder; | 19 | id: artShapeHolder; |
926 | 20 | height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height; | 20 | height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height; |
927 | 21 | width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width; | 21 | width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width; |
928 | 22 | anchors { horizontalCenter: parent.horizontalCenter; } | 22 | anchors { horizontalCenter: parent.horizontalCenter; } |
929 | 23 | Loader { | 23 | Loader { |
930 | 24 | id: artShapeLoader; | 24 | id: artShapeLoader; |
931 | 25 | objectName: "artShapeLoader"; | 25 | objectName: "artShapeLoader"; |
932 | 26 | active: cardData && cardData["art"] || false; | 26 | active: cardData && cardData["art"] || false; |
896 | 27 | asynchronous: root.asynchronous; | ||
897 | 28 | visible: status == Loader.Ready; | ||
898 | 29 | sourceComponent: UbuntuShape { | ||
899 | 30 | id: artShape; | ||
900 | 31 | objectName: "artShape"; | ||
901 | 32 | radius: "medium"; | ||
902 | 33 | visible: image.status == Image.Ready; | ||
903 | 34 | readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; | ||
904 | 35 | readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1; | ||
905 | 36 | readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect; | ||
906 | 37 | Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; } | ||
907 | 38 | onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings(); | ||
908 | 39 | Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); } | ||
909 | 40 | function updateWidthHeightBindings() { | ||
910 | 41 | if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) { | ||
911 | 42 | width = root.fixedArtShapeSize.width; | ||
912 | 43 | height = root.fixedArtShapeSize.height; | ||
913 | 44 | } else if (aspectSmallerThanImageAspect) { | ||
914 | 45 | width = Qt.binding(function() { return !visible ? 0 : image.width }); | ||
915 | 46 | height = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.height : width / image.aspect }); | ||
916 | 47 | } else { | ||
917 | 48 | width = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.width : height * image.aspect }); | ||
918 | 49 | height = Qt.binding(function() { return !visible ? 0 : image.height }); | ||
919 | 50 | } | ||
920 | 51 | } | ||
921 | 52 | image: Image { | ||
922 | 53 | objectName: "artImage"; | ||
923 | 54 | source: cardData && cardData["art"] || ""; | ||
924 | 55 | cache: true; | ||
933 | 56 | asynchronous: root.asynchronous; | 27 | asynchronous: root.asynchronous; |
938 | 57 | fillMode: components && components["art"]["fill-mode"] === "fit" ? Image.PreserveAspectFit: Image.PreserveAspectCrop; | 28 | visible: status == Loader.Ready; |
939 | 58 | readonly property real aspect: implicitWidth / implicitHeight; | 29 | sourceComponent: UbuntuShape { |
940 | 59 | width: root.width; | 30 | id: artShape; |
941 | 60 | height: width / artShape.aspect; | 31 | objectName: "artShape"; |
942 | 32 | radius: "medium"; | ||
943 | 33 | visible: image.status == Image.Ready; | ||
944 | 34 | readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; | ||
945 | 35 | readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1; | ||
946 | 36 | readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect; | ||
947 | 37 | Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; } | ||
948 | 38 | onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings(); | ||
949 | 39 | Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); } | ||
950 | 40 | function updateWidthHeightBindings() { | ||
951 | 41 | if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) { | ||
952 | 42 | width = root.fixedArtShapeSize.width; | ||
953 | 43 | height = root.fixedArtShapeSize.height; | ||
954 | 44 | } else if (aspectSmallerThanImageAspect) { | ||
955 | 45 | width = Qt.binding(function() { return !visible ? 0 : image.width }); | ||
956 | 46 | height = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.height : width / image.aspect }); | ||
957 | 47 | } else { | ||
958 | 48 | width = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.width : height * image.aspect }); | ||
959 | 49 | height = Qt.binding(function() { return !visible ? 0 : image.height }); | ||
960 | 50 | } | ||
961 | 51 | } | ||
962 | 52 | image: Image { | ||
963 | 53 | objectName: "artImage"; | ||
964 | 54 | source: cardData && cardData["art"] || ""; | ||
965 | 55 | cache: true; | ||
966 | 56 | asynchronous: root.asynchronous; | ||
967 | 57 | fillMode: components && components["art"]["fill-mode"] === "fit" ? Image.PreserveAspectFit: Image.PreserveAspectCrop; | ||
968 | 58 | readonly property real aspect: implicitWidth / implicitHeight; | ||
969 | 59 | width: root.width; | ||
970 | 60 | height: width / artShape.aspect; | ||
971 | 61 | } | ||
972 | 62 | } | ||
973 | 61 | } | 63 | } |
977 | 62 | } | 64 | } |
975 | 63 | } | ||
976 | 64 | } | ||
978 | 65 | Loader { | 65 | Loader { |
1018 | 66 | id: overlayLoader; | 66 | id: overlayLoader; |
1019 | 67 | anchors { | 67 | anchors { |
1020 | 68 | left: artShapeHolder.left; | 68 | left: artShapeHolder.left; |
1021 | 69 | right: artShapeHolder.right; | 69 | right: artShapeHolder.right; |
1022 | 70 | bottom: artShapeHolder.bottom; | 70 | bottom: artShapeHolder.bottom; |
1023 | 71 | } | 71 | } |
1024 | 72 | active: artShapeLoader.active && artShapeLoader.item && artShapeLoader.item.image.status === Image.Ready || false; | 72 | active: artShapeLoader.active && artShapeLoader.item && artShapeLoader.item.image.status === Image.Ready || false; |
1025 | 73 | asynchronous: root.asynchronous; | 73 | asynchronous: root.asynchronous; |
1026 | 74 | visible: showHeader && status == Loader.Ready; | 74 | visible: showHeader && status == Loader.Ready; |
1027 | 75 | sourceComponent: ShaderEffect { | 75 | sourceComponent: ShaderEffect { |
1028 | 76 | id: overlay; | 76 | id: overlay; |
1029 | 77 | height: (fixedHeaderHeight > 0 ? fixedHeaderHeight : headerHeight) + units.gu(2); | 77 | height: (fixedHeaderHeight > 0 ? fixedHeaderHeight : headerHeight) + units.gu(2); |
1030 | 78 | opacity: 0.6; | 78 | opacity: 0.6; |
1031 | 79 | property var source: ShaderEffectSource { | 79 | property var source: ShaderEffectSource { |
1032 | 80 | id: shaderSource; | 80 | id: shaderSource; |
1033 | 81 | sourceItem: artShapeLoader.item; | 81 | sourceItem: artShapeLoader.item; |
1034 | 82 | onVisibleChanged: if (visible) scheduleUpdate(); | 82 | onVisibleChanged: if (visible) scheduleUpdate(); |
1035 | 83 | live: false; | 83 | live: false; |
1036 | 84 | sourceRect: Qt.rect(0, artShapeLoader.height - overlay.height, artShapeLoader.width, overlay.height); | 84 | sourceRect: Qt.rect(0, artShapeLoader.height - overlay.height, artShapeLoader.width, overlay.height); |
1037 | 85 | } | 85 | } |
1038 | 86 | vertexShader: " | 86 | vertexShader: " |
1039 | 87 | uniform highp mat4 qt_Matrix; | 87 | uniform highp mat4 qt_Matrix; |
1040 | 88 | attribute highp vec4 qt_Vertex; | 88 | attribute highp vec4 qt_Vertex; |
1041 | 89 | attribute highp vec2 qt_MultiTexCoord0; | 89 | attribute highp vec2 qt_MultiTexCoord0; |
1042 | 90 | varying highp vec2 coord; | 90 | varying highp vec2 coord; |
1043 | 91 | void main() { | 91 | void main() { |
1044 | 92 | coord = qt_MultiTexCoord0; | 92 | coord = qt_MultiTexCoord0; |
1045 | 93 | gl_Position = qt_Matrix * qt_Vertex; | 93 | gl_Position = qt_Matrix * qt_Vertex; |
1046 | 94 | }"; | 94 | }"; |
1047 | 95 | fragmentShader: " | 95 | fragmentShader: " |
1048 | 96 | varying highp vec2 coord; | 96 | varying highp vec2 coord; |
1049 | 97 | uniform sampler2D source; | 97 | uniform sampler2D source; |
1050 | 98 | uniform lowp float qt_Opacity; | 98 | uniform lowp float qt_Opacity; |
1051 | 99 | void main() { | 99 | void main() { |
1052 | 100 | lowp vec4 tex = texture2D(source, coord); | 100 | lowp vec4 tex = texture2D(source, coord); |
1053 | 101 | gl_FragColor = vec4(0, 0, 0, tex.a) * qt_Opacity; | 101 | gl_FragColor = vec4(0, 0, 0, tex.a) * qt_Opacity; |
1054 | 102 | }"; | 102 | }"; |
1055 | 103 | } | 103 | } |
1056 | 104 | } | 104 | } |
1057 | 105 | readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin; | 105 | readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin; |
1058 | 106 | Label { | 106 | Label { |
1087 | 107 | id: titleLabel; | 107 | id: titleLabel; |
1088 | 108 | objectName: "titleLabel"; | 108 | objectName: "titleLabel"; |
1089 | 109 | anchors { left: parent.left; | 109 | anchors { left: parent.left; |
1090 | 110 | leftMargin: units.gu(1); | 110 | leftMargin: units.gu(1); |
1091 | 111 | right: parent.right; | 111 | right: parent.right; |
1092 | 112 | top: overlayLoader.top; | 112 | rightMargin: units.gu(1); |
1093 | 113 | topMargin: units.gu(1); | 113 | top: overlayLoader.top; |
1094 | 114 | } | 114 | topMargin: units.gu(1); |
1095 | 115 | elide: Text.ElideRight; | 115 | } |
1068 | 116 | fontSize: "small"; | ||
1069 | 117 | wrapMode: Text.Wrap; | ||
1070 | 118 | maximumLineCount: 2; | ||
1071 | 119 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); | ||
1072 | 120 | color: "white"; | ||
1073 | 121 | visible: showHeader && overlayLoader.active; | ||
1074 | 122 | text: root.title; | ||
1075 | 123 | font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal; | ||
1076 | 124 | horizontalAlignment: root.headerAlignment; | ||
1077 | 125 | } | ||
1078 | 126 | Label { | ||
1079 | 127 | id: subtitleLabel; | ||
1080 | 128 | objectName: "subtitleLabel"; | ||
1081 | 129 | anchors { left: titleLabel.left; | ||
1082 | 130 | leftMargin: titleLabel.leftMargin; | ||
1083 | 131 | right: titleLabel.right; | ||
1084 | 132 | top: titleLabel.bottom; | ||
1085 | 133 | topMargin: units.dp(2); | ||
1086 | 134 | } | ||
1096 | 135 | elide: Text.ElideRight; | 116 | elide: Text.ElideRight; |
1097 | 136 | fontSize: "small"; | 117 | fontSize: "small"; |
1098 | 118 | wrapMode: Text.Wrap; | ||
1099 | 119 | maximumLineCount: 2; | ||
1100 | 137 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); | 120 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); |
1101 | 138 | color: "white"; | 121 | color: "white"; |
1105 | 139 | visible: titleLabel.visible && titleLabel.text; | 122 | visible: showHeader && overlayLoader.active; |
1106 | 140 | text: cardData && cardData["subtitle"] || ""; | 123 | text: root.title; |
1107 | 141 | font.weight: Font.Light; | 124 | font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal; |
1108 | 142 | horizontalAlignment: root.headerAlignment; | 125 | horizontalAlignment: root.headerAlignment; |
1109 | 143 | } | 126 | } |
1110 | 127 | Label { | ||
1111 | 128 | id: subtitleLabel; | ||
1112 | 129 | objectName: "subtitleLabel"; | ||
1113 | 130 | anchors { left: titleLabel.left; | ||
1114 | 131 | leftMargin: titleLabel.leftMargin; | ||
1115 | 132 | right: titleLabel.right; | ||
1116 | 133 | rightMargin: titleLabel.rightMargin; | ||
1117 | 134 | top: titleLabel.bottom; | ||
1118 | 135 | topMargin: units.dp(2); | ||
1119 | 136 | } | ||
1120 | 137 | elide: Text.ElideRight; | ||
1121 | 138 | fontSize: "small"; | ||
1122 | 139 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); | ||
1123 | 140 | color: "white"; | ||
1124 | 141 | visible: titleLabel.visible && titleLabel.text; | ||
1125 | 142 | text: cardData && cardData["subtitle"] || ""; | ||
1126 | 143 | font.weight: Font.Light; | ||
1127 | 144 | horizontalAlignment: root.headerAlignment; | ||
1128 | 145 | } | ||
1129 | 144 | implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1); | 146 | implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1); |
1130 | 145 | } | 147 | } |
1131 | 146 | 148 | ||
1132 | === added file 'tests/plugins/Dash/cardcreator/7.res' | |||
1133 | --- tests/plugins/Dash/cardcreator/7.res 1970-01-01 00:00:00 +0000 | |||
1134 | +++ tests/plugins/Dash/cardcreator/7.res 2014-07-28 12:00:26 +0000 | |||
1135 | @@ -0,0 +1,128 @@ | |||
1136 | 1 | AbstractButton { | ||
1137 | 2 | id: root; | ||
1138 | 3 | property var template; | ||
1139 | 4 | property var components; | ||
1140 | 5 | property var cardData; | ||
1141 | 6 | property var artShapeBorderSource: undefined; | ||
1142 | 7 | property real fontScale: 1.0; | ||
1143 | 8 | property var scopeStyle: null; | ||
1144 | 9 | property int headerAlignment: Text.AlignLeft; | ||
1145 | 10 | property int fixedHeaderHeight: -1; | ||
1146 | 11 | property size fixedArtShapeSize: Qt.size(-1, -1); | ||
1147 | 12 | readonly property string title: cardData && cardData["title"] || ""; | ||
1148 | 13 | property bool asynchronous: true; | ||
1149 | 14 | property bool showHeader: true; | ||
1150 | 15 | implicitWidth: childrenRect.width; | ||
1151 | 16 | Loader { | ||
1152 | 17 | id: backgroundLoader; | ||
1153 | 18 | objectName: "backgroundLoader"; | ||
1154 | 19 | anchors.fill: parent; | ||
1155 | 20 | asynchronous: root.asynchronous; | ||
1156 | 21 | visible: status == Loader.Ready; | ||
1157 | 22 | sourceComponent: UbuntuShape { | ||
1158 | 23 | objectName: "background"; | ||
1159 | 24 | radius: "medium"; | ||
1160 | 25 | color: getColor(0) || "white"; | ||
1161 | 26 | gradientColor: getColor(1) || color; | ||
1162 | 27 | anchors.fill: parent; | ||
1163 | 28 | image: backgroundImage.source ? backgroundImage : null; | ||
1164 | 29 | property real luminance: 0.2126 * color.r + 0.7152 * color.g + 0.0722 * color.b; | ||
1165 | 30 | property Image backgroundImage: Image { | ||
1166 | 31 | objectName: "backgroundImage"; | ||
1167 | 32 | source: { | ||
1168 | 33 | if (cardData && typeof cardData["background"] === "string") return cardData["background"]; | ||
1169 | 34 | else if (template && typeof template["card-background"] === "string") return template["card-background"]; | ||
1170 | 35 | else return ""; | ||
1171 | 36 | } | ||
1172 | 37 | } | ||
1173 | 38 | function getColor(index) { | ||
1174 | 39 | if (cardData && typeof cardData["background"] === "object" | ||
1175 | 40 | && (cardData["background"]["type"] === "color" || cardData["background"]["type"] === "gradient")) { | ||
1176 | 41 | return cardData["background"]["elements"][index]; | ||
1177 | 42 | } else if (template && typeof template["card-background"] === "object" | ||
1178 | 43 | && (template["card-background"]["type"] === "color" || template["card-background"]["type"] === "gradient")) { | ||
1179 | 44 | return template["card-background"]["elements"][index]; | ||
1180 | 45 | } else return undefined; | ||
1181 | 46 | } | ||
1182 | 47 | } | ||
1183 | 48 | } | ||
1184 | 49 | readonly property size artShapeSize: Qt.size(-1, -1); | ||
1185 | 50 | readonly property int headerHeight: row.height; | ||
1186 | 51 | Row { | ||
1187 | 52 | id: row; | ||
1188 | 53 | objectName: "outerRow"; | ||
1189 | 54 | property real margins: units.gu(1); | ||
1190 | 55 | spacing: margins; | ||
1191 | 56 | height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight; | ||
1192 | 57 | anchors { top: parent.top; | ||
1193 | 58 | topMargin: units.gu(1); | ||
1194 | 59 | left: parent.left; | ||
1195 | 60 | } | ||
1196 | 61 | anchors.right: parent.right; | ||
1197 | 62 | anchors.margins: margins; | ||
1198 | 63 | data: [ Image { | ||
1199 | 64 | id: mascotImage; | ||
1200 | 65 | objectName: "mascotImage"; | ||
1201 | 66 | anchors { verticalCenter: parent.verticalCenter; } | ||
1202 | 67 | readonly property int maxSize: Math.max(width, height) * 4; | ||
1203 | 68 | source: cardData && cardData["mascot"]; | ||
1204 | 69 | width: units.gu(6); | ||
1205 | 70 | height: units.gu(5.625); | ||
1206 | 71 | sourceSize { width: maxSize; height: maxSize } | ||
1207 | 72 | fillMode: Image.PreserveAspectCrop; | ||
1208 | 73 | horizontalAlignment: Image.AlignHCenter; | ||
1209 | 74 | verticalAlignment: Image.AlignVCenter; | ||
1210 | 75 | visible: showHeader; | ||
1211 | 76 | } | ||
1212 | 77 | |||
1213 | 78 | , | ||
1214 | 79 | Column { | ||
1215 | 80 | anchors.verticalCenter: parent.verticalCenter; | ||
1216 | 81 | spacing: units.dp(2); | ||
1217 | 82 | width: parent.width - x; | ||
1218 | 83 | data: [ | ||
1219 | 84 | Label { | ||
1220 | 85 | id: titleLabel; | ||
1221 | 86 | objectName: "titleLabel"; | ||
1222 | 87 | anchors { left: parent.left; right: parent.right } | ||
1223 | 88 | elide: Text.ElideRight; | ||
1224 | 89 | fontSize: "small"; | ||
1225 | 90 | wrapMode: Text.Wrap; | ||
1226 | 91 | maximumLineCount: 2; | ||
1227 | 92 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); | ||
1228 | 93 | color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey"); | ||
1229 | 94 | visible: showHeader ; | ||
1230 | 95 | text: root.title; | ||
1231 | 96 | font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal; | ||
1232 | 97 | horizontalAlignment: root.headerAlignment; | ||
1233 | 98 | } | ||
1234 | 99 | , | ||
1235 | 100 | Label { | ||
1236 | 101 | id: subtitleLabel; | ||
1237 | 102 | objectName: "subtitleLabel"; | ||
1238 | 103 | anchors { left: parent.left; right: parent.right } | ||
1239 | 104 | elide: Text.ElideRight; | ||
1240 | 105 | fontSize: "small"; | ||
1241 | 106 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); | ||
1242 | 107 | color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey"); | ||
1243 | 108 | visible: titleLabel.visible && titleLabel.text; | ||
1244 | 109 | text: cardData && cardData["subtitle"] || ""; | ||
1245 | 110 | font.weight: Font.Light; | ||
1246 | 111 | horizontalAlignment: root.headerAlignment; | ||
1247 | 112 | } | ||
1248 | 113 | , | ||
1249 | 114 | CardAttributes { | ||
1250 | 115 | id: attributesRow; | ||
1251 | 116 | objectName: "attributesRow"; | ||
1252 | 117 | anchors { left: parent.left; right: parent.right } | ||
1253 | 118 | color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey"); | ||
1254 | 119 | model: cardData["attributes"] | ||
1255 | 120 | } | ||
1256 | 121 | |||
1257 | 122 | ] | ||
1258 | 123 | } | ||
1259 | 124 | |||
1260 | 125 | ] | ||
1261 | 126 | } | ||
1262 | 127 | implicitHeight: row.y + row.height + units.gu(1); | ||
1263 | 128 | } | ||
1264 | 0 | 129 | ||
1265 | === added file 'tests/plugins/Dash/cardcreator/7.tst' | |||
1266 | --- tests/plugins/Dash/cardcreator/7.tst 1970-01-01 00:00:00 +0000 | |||
1267 | +++ tests/plugins/Dash/cardcreator/7.tst 2014-07-28 12:00:26 +0000 | |||
1268 | @@ -0,0 +1,3 @@ | |||
1269 | 1 | template: {"card-background":{"elements":["#E9E9E9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2} | ||
1270 | 2 | components: {"art":{"aspect-ratio":1,"fill-mode":"crop"},"background":{"field":"background"},"mascot":{"field":"icon"},"subtitle":{"field":"author"},"title":{"field":"title"},"attributes":{"field":"attributes","max-count":2}} | ||
1271 | 3 | result: 7.res | ||
1272 | 0 | 4 | ||
1273 | === modified file 'tests/plugins/Dash/cardcreatortest.cpp' | |||
1274 | --- tests/plugins/Dash/cardcreatortest.cpp 2014-05-06 13:09:08 +0000 | |||
1275 | +++ tests/plugins/Dash/cardcreatortest.cpp 2014-07-28 12:00:26 +0000 | |||
1276 | @@ -19,6 +19,7 @@ | |||
1277 | 19 | #include <QQuickItem> | 19 | #include <QQuickItem> |
1278 | 20 | #include <QQuickView> | 20 | #include <QQuickView> |
1279 | 21 | #include <QtTestGui> | 21 | #include <QtTestGui> |
1280 | 22 | #include <QTemporaryFile> | ||
1281 | 22 | 23 | ||
1282 | 23 | class CardCreatorTest : public QObject | 24 | class CardCreatorTest : public QObject |
1283 | 24 | { | 25 | { |
1284 | @@ -74,7 +75,14 @@ | |||
1285 | 74 | QVERIFY(testResultFile.open(QIODevice::ReadOnly)); | 75 | QVERIFY(testResultFile.open(QIODevice::ReadOnly)); |
1286 | 75 | QTextStream ts2(&testResultFile); | 76 | QTextStream ts2(&testResultFile); |
1287 | 76 | const QString expectedResult = ts2.readAll(); | 77 | const QString expectedResult = ts2.readAll(); |
1289 | 77 | QCOMPARE(cardStringResult.toString().simplified(), expectedResult.simplified()); | 78 | const QString executedResult = cardStringResult.toString(); |
1290 | 79 | // Record failed results to /tmp | ||
1291 | 80 | QTemporaryFile tmpFile(QDir::tempPath() + QDir::separator() + "testCardCreatorFailedResultXXXXXX"); | ||
1292 | 81 | tmpFile.open(); | ||
1293 | 82 | tmpFile.setAutoRemove(false); | ||
1294 | 83 | tmpFile.write(executedResult.toUtf8().constData()); | ||
1295 | 84 | QCOMPARE(executedResult.simplified(), expectedResult.simplified()); | ||
1296 | 85 | tmpFile.setAutoRemove(true); // Remove the result if it passed | ||
1297 | 78 | 86 | ||
1298 | 79 | QVariant createCardComponentResult; | 87 | QVariant createCardComponentResult; |
1299 | 80 | QMetaObject::invokeMethod(view->rootObject(), "createCardComponent", Q_RETURN_ARG(QVariant, createCardComponentResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON)); | 88 | QMetaObject::invokeMethod(view->rootObject(), "createCardComponent", Q_RETURN_ARG(QVariant, createCardComponentResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON)); |
1300 | 81 | 89 | ||
1301 | === added file 'tests/plugins/Dash/tst_CardAttributes.qml' | |||
1302 | --- tests/plugins/Dash/tst_CardAttributes.qml 1970-01-01 00:00:00 +0000 | |||
1303 | +++ tests/plugins/Dash/tst_CardAttributes.qml 2014-07-28 12:00:26 +0000 | |||
1304 | @@ -0,0 +1,54 @@ | |||
1305 | 1 | /* | ||
1306 | 2 | * Copyright 2013 Canonical Ltd. | ||
1307 | 3 | * | ||
1308 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1309 | 5 | * it under the terms of the GNU General Public License as published by | ||
1310 | 6 | * the Free Software Foundation; version 3. | ||
1311 | 7 | * | ||
1312 | 8 | * This program is distributed in the hope that it will be useful, | ||
1313 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1314 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1315 | 11 | * GNU General Public License for more details. | ||
1316 | 12 | * | ||
1317 | 13 | * You should have received a copy of the GNU General Public License | ||
1318 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1319 | 15 | */ | ||
1320 | 16 | |||
1321 | 17 | import QtQuick 2.0 | ||
1322 | 18 | import QtTest 1.0 | ||
1323 | 19 | import Dash 0.1 | ||
1324 | 20 | |||
1325 | 21 | Item { | ||
1326 | 22 | width: units.gu(40) | ||
1327 | 23 | height: units.gu(4.5) | ||
1328 | 24 | |||
1329 | 25 | property var testData: [ | ||
1330 | 26 | [{"value":"text1","icon":"image://theme/ok"},{"value":"text2","icon":"image://theme/cancel"}], | ||
1331 | 27 | [{"value":"text1","icon":"image://theme/ok"},{"value":"text2","icon":"image://theme/cancel"},{"value":"text3"}], | ||
1332 | 28 | [{"value":"text1","icon":"image://theme/ok"},{"value":"text2","icon":"image://theme/cancel"},{"value":"text3"},{"value":"text4"}], | ||
1333 | 29 | [{"value":"text1","icon":"image://theme/ok"},{"value":"text2","icon":"image://theme/cancel"},{"value":"text3","style":"highlighted"},{"value":"text4","icon":"image://theme/close","style":"highlighted"},{"value":"text5"}] | ||
1334 | 30 | ] | ||
1335 | 31 | |||
1336 | 32 | CardAttributes { | ||
1337 | 33 | id: cardAttributes | ||
1338 | 34 | model: testData[3] | ||
1339 | 35 | clip: true | ||
1340 | 36 | } | ||
1341 | 37 | |||
1342 | 38 | TestCase { | ||
1343 | 39 | name: "CardAttributesTest" | ||
1344 | 40 | when: windowShown | ||
1345 | 41 | |||
1346 | 42 | function init() { | ||
1347 | 43 | } | ||
1348 | 44 | |||
1349 | 45 | function test_columns_data() { | ||
1350 | 46 | return testData; | ||
1351 | 47 | } | ||
1352 | 48 | |||
1353 | 49 | function test_columns(data) { | ||
1354 | 50 | cardAttributes.model = data; | ||
1355 | 51 | compare(cardAttributes.columns, 2 + data.length % 2); | ||
1356 | 52 | } | ||
1357 | 53 | } | ||
1358 | 54 | } | ||
1359 | 0 | 55 | ||
1360 | === modified file 'tests/qmltests/Dash/CardHelpers.js' | |||
1361 | --- tests/qmltests/Dash/CardHelpers.js 2014-02-04 18:14:07 +0000 | |||
1362 | +++ tests/qmltests/Dash/CardHelpers.js 2014-07-28 12:00:26 +0000 | |||
1363 | @@ -16,7 +16,7 @@ | |||
1364 | 16 | 16 | ||
1365 | 17 | .pragma library | 17 | .pragma library |
1366 | 18 | 18 | ||
1368 | 19 | var components = ["title", "art", "subtitle", "mascot", "emblem", "old-price", "price", "alt-price", "rating", "alt-rating", "summary"] | 19 | var components = ["title", "art", "subtitle", "mascot", "emblem", "old-price", "price", "alt-price", "rating", "alt-rating", "summary", "attributes"] |
1369 | 20 | 20 | ||
1370 | 21 | var defaultLayout = ' \ | 21 | var defaultLayout = ' \ |
1371 | 22 | { \ | 22 | { \ |
1372 | @@ -48,7 +48,8 @@ | |||
1373 | 48 | "empty": "image://theme/rating-star-empty" \ | 48 | "empty": "image://theme/rating-star-empty" \ |
1374 | 49 | }, \ | 49 | }, \ |
1375 | 50 | "alt-rating": null, \ | 50 | "alt-rating": null, \ |
1377 | 51 | "summary": null \ | 51 | "summary": null, \ |
1378 | 52 | "attributes": { "max-count": 2 } \ | ||
1379 | 52 | }, \ | 53 | }, \ |
1380 | 53 | "resources": {} \ | 54 | "resources": {} \ |
1381 | 54 | }' | 55 | }' |
1382 | @@ -59,7 +60,8 @@ | |||
1383 | 59 | "art": "art", \ | 60 | "art": "art", \ |
1384 | 60 | "subtitle": "subtitle", \ | 61 | "subtitle": "subtitle", \ |
1385 | 61 | "mascot": "mascot", \ | 62 | "mascot": "mascot", \ |
1387 | 62 | "summary": "summary" \ | 63 | "summary": "summary", \ |
1388 | 64 | "attributes": "attributes" \ | ||
1389 | 63 | }' | 65 | }' |
1390 | 64 | 66 | ||
1391 | 65 | 67 | ||
1392 | 66 | 68 | ||
1393 | === modified file 'tests/qmltests/Dash/tst_Card.qml' | |||
1394 | --- tests/qmltests/Dash/tst_Card.qml 2014-06-27 08:47:04 +0000 | |||
1395 | +++ tests/qmltests/Dash/tst_Card.qml 2014-07-28 12:00:26 +0000 | |||
1396 | @@ -33,7 +33,8 @@ | |||
1397 | 33 | "mascot": "../../../tests/qmltests/Dash/artwork/avatar.png", | 33 | "mascot": "../../../tests/qmltests/Dash/artwork/avatar.png", |
1398 | 34 | "title": "foo", | 34 | "title": "foo", |
1399 | 35 | "subtitle": "bar", | 35 | "subtitle": "bar", |
1401 | 36 | "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." | 36 | "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.", |
1402 | 37 | "attributes": [{"value":"text1","icon":"image://theme/ok"},{"value":"text2","icon":"image://theme/cancel"}] | ||
1403 | 37 | }' | 38 | }' |
1404 | 38 | 39 | ||
1405 | 39 | property var cardsModel: [ | 40 | property var cardsModel: [ |
1406 | @@ -110,6 +111,7 @@ | |||
1407 | 110 | anchors { top: parent.top; left: parent.left; margins: units.gu(1) } | 111 | anchors { top: parent.top; left: parent.left; margins: units.gu(1) } |
1408 | 111 | 112 | ||
1409 | 112 | sourceComponent: cardTool.cardComponent | 113 | sourceComponent: cardTool.cardComponent |
1410 | 114 | clip: true | ||
1411 | 113 | onLoaded: { | 115 | onLoaded: { |
1412 | 114 | item.template = Qt.binding(function() { return cardTool.template; }); | 116 | item.template = Qt.binding(function() { return cardTool.template; }); |
1413 | 115 | item.components = Qt.binding(function() { return cardTool.components; }); | 117 | item.components = Qt.binding(function() { return cardTool.components; }); |
PASSED: Continuous integration, rev:897 jenkins. qa.ubuntu. com/job/ unity8- ci/3152/ jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- utopic- touch/903 jenkins. qa.ubuntu. com/job/ unity-phablet- qmluitests- utopic/ 156 jenkins. qa.ubuntu. com/job/ unity8- utopic- amd64-ci/ 246 jenkins. qa.ubuntu. com/job/ unity8- utopic- armhf-ci/ 246 jenkins. qa.ubuntu. com/job/ unity8- utopic- armhf-ci/ 246/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ unity8- utopic- i386-ci/ 246 jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- runner- mako/1307 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- armhf/1646 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- armhf/1646/ artifact/ work/output/ *zip*/output. zip s-jenkins. ubuntu- ci:8080/ job/touch- flash-device/ 8479
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/unity8- ci/3152/ rebuild
http://