Merge lp:~paulliu/unity8/attribute into lp:unity8

Proposed by Ying-Chun Liu
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
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.

To post a comment you must log in.
lp:~paulliu/unity8/attribute updated
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

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
lp:~paulliu/unity8/attribute updated
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

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

You need to merge trunk.

review: Needs Fixing
lp:~paulliu/unity8/attribute updated
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 CardVerticalJournal, kind of beats the purpose... Also don't bind unnecessarily.

996. By PS Jenkins bot

Releasing 7.89+14.10.20140627-0ubuntu1

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

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.

review: Needs Fixing
lp:~paulliu/unity8/attribute updated
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]MenuItemFacotory 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() (qqmldelegatemodel.cpp:1412)
==16693== by 0x7372AE6: QQmlDelegateModel::_q_modelReset() (qqmldelegatemodel.cpp:1463)
==16693== by 0x7397224: QQmlDelegateModel::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (moc_qqmldelegatemodel_p.cpp:196)
==16693== by 0x739769E: QQmlDelegateModel::qt_metacall(QMetaObject::Call, int, void**) (moc_qqmldelegatemodel_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::endResetModel() (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.3.0)
==16693== by 0x23461EFD: FakeIndicatorsModel::unload() (fakeindicatorsmodel.cpp:53)
==16693== by 0x23461E13: FakeIndicatorsModel::~FakeIndicatorsModel() (fakeindicatorsmodel.cpp:34)
==16693== by 0x2345C073: QQmlPrivate::QQmlElement<FakeIndicatorsModel>::~QQmlElement() (in /home/tsdgeos_work/phablet/unity8/investigate_test_shell_crash/builddir/tests/mocks/Unity/Indicators/libIndicatorsFakeQml.so)
==16693== by 0x2345C0A3: QQmlPrivate::QQmlElement<FakeIndicatorsModel>::~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::qdeclarativeelement_destructor(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.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
lp:~paulliu/unity8/attribute updated
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.

Revision history for this message
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.

review: Needs Fixing
lp:~paulliu/unity8/attribute updated
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 PreviewReviewDisplay.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 PreviewModelInterface

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.

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

Conflict adding file tests/plugins/Dash/cardcreator/6.res. Moved existing file to tests/plugins/Dash/cardcreator/6.res.moved.
Conflict adding file tests/plugins/Dash/cardcreator/6.tst. Moved existing file to tests/plugins/Dash/cardcreator/6.tst.moved.
2 conflicts encountered.

review: Needs Fixing
lp:~paulliu/unity8/attribute updated
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.

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

plugins/Dash/CardAttributesGrid.qml UNKNOWN *No copyright*

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~paulliu/unity8/attribute updated
1065. By Ying-Chun Liu

Rename CardAttributesGrid to CardAttributes.
Add copyright header to CardAttributes.qml.

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

Merge issues have been fixed

review: Abstain
Revision history for this message
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

review: Approve
lp:~paulliu/unity8/attribute updated
1066. By Ying-Chun Liu

Add code for subtitle is not appeared

Revision history for this message
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

review: Needs Fixing
lp:~paulliu/unity8/attribute updated
1067. By Ying-Chun Liu

Fix anchors/non-subtitles.

1068. By Ying-Chun Liu

Fix summary Top anchor for attributes.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~paulliu/unity8/attribute updated
1069. By Ying-Chun Liu

Add color.
Fix rightMargin.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~paulliu/unity8/attribute updated
1070. By Ying-Chun Liu

Fix implicitHeight.
Update *.res

1071. By Ying-Chun Liu

Fix height again.

Revision history for this message
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

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~paulliu/unity8/attribute updated
1072. By Ying-Chun Liu

Fix GridLayout height sometimes 0.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~paulliu/unity8/attribute updated
1073. By Ying-Chun Liu

Revert workarounds.
Add maxData for attributes to CardTool.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~paulliu/unity8/attribute updated
1074. By Ying-Chun Liu

test 5 attributes.

1075. By Ying-Chun Liu

Fix CardTool to generate attributes dynamically.

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

Need to use the max-count from attributes in the CardTool.

review: Needs Fixing
lp:~paulliu/unity8/attribute updated
1076. By Ying-Chun Liu

Add max-count for attributes

1077. By Ying-Chun Liu

test cardData.

1078. By Ying-Chun Liu

Merge trunk.

Revision history for this message
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.

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

Running make testCard gets me

QWARN : qmltestrunner::Card::test_summary_layout(Without header) file:///home/tsdgeos_work/phablet/unity8/attribute/builddir/plugins/Dash/createCardComponent:103: ReferenceError: attributesRow is not defined
QWARN : qmltestrunner::Card::test_summary_layout(Without header) file:///home/tsdgeos_work/phablet/unity8/attribute/builddir/plugins/Dash/createCardComponent:108: ReferenceError: attributesRow is not defined
QWARN : qmltestrunner::Card::test_summary_layout(Without header) file:///home/tsdgeos_work/phablet/unity8/attribute/builddir/plugins/Dash/createCardComponent:103: ReferenceError: attributesRow is not defined
QWARN : qmltestrunner::Card::test_summary_layout(Without header) file:///home/tsdgeos_work/phablet/unity8/attribute/builddir/plugins/Dash/createCardComponent:108: ReferenceError: attributesRow is not defined
QWARN : qmltestrunner::Card::test_summary_layout(Without header) file:///home/tsdgeos_work/phablet/unity8/attribute/builddir/plugins/Dash/createCardComponent:23: ReferenceError: attributesRow is not defined
QWARN : qmltestrunner::Card::test_summary_layout(Without header) file:///home/tsdgeos_work/phablet/unity8/attribute/builddir/plugins/Dash/createCardComponent:22: ReferenceError: attributesRow is not defined
QWARN : qmltestrunner::Card::test_summary_layout(Without header) file:///home/tsdgeos_work/phablet/unity8/attribute/builddir/plugins/Dash/createCardComponent:23: ReferenceError: attributesRow is not defined
QWARN : qmltestrunner::Card::test_summary_layout(Without header) file:///home/tsdgeos_work/phablet/unity8/attribute/builddir/plugins/Dash/createCardComponent:22: ReferenceError: attributesRow is not defined

a lot, can you have a look?

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

make tryCard, choose the "Art, summary" option, see how it displays broken.

review: Needs Fixing
lp:~paulliu/unity8/attribute updated
1079. By Ying-Chun Liu

Fix Reference error on summary.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
lp:~paulliu/unity8/attribute updated
1080. By Ying-Chun Liu

Remove the TODO line.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
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

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'plugins/Dash/CardAttributes.qml'
--- plugins/Dash/CardAttributes.qml 1970-01-01 00:00:00 +0000
+++ plugins/Dash/CardAttributes.qml 2014-07-28 12:00:26 +0000
@@ -0,0 +1,65 @@
1/*
2 * Copyright 2014 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.2
18import QtQuick.Layouts 1.1
19import Ubuntu.Components 1.1
20import Ubuntu.Settings.Components 0.1
21
22GridLayout {
23 id: grid
24 anchors {
25 left: parent.left;
26 right: parent.right;
27 }
28 columns: 2 + repeater.count % 2
29 property alias model: repeater.model
30 property var color
31
32 Repeater {
33 id: repeater
34 delegate: Row {
35 spacing: units.gu(0.5)
36 readonly property int column: index % grid.columns;
37 Layout.alignment: {
38 if (column == 0) return Qt.AlignLeft;
39 if (column == grid.columns - 1 || index == repeater.count - 1) return Qt.AlignRight;
40 if (column == 1) return Qt.AlignHCenter;
41 }
42 Layout.columnSpan: index == repeater.count - 1 && grid.columns == 3 && column == 1 ? 2 : 1
43 Layout.maximumWidth: Math.max(icon.width, label.x + label.implicitWidth)
44 Layout.fillWidth: true
45 StatusIcon {
46 id: icon
47 height: units.gu(2)
48 sets: ["actions", "status", "apps"]
49 source: "icon" in modelData ? modelData["icon"] : ""
50 }
51 Label {
52 id: label
53 width: parent.width - x
54 anchors.verticalCenter: parent.verticalCenter
55 text: "value" in modelData ? modelData["value"] : "";
56 elide: Text.ElideRight
57 maximumLineCount: 1
58 font.weight: "style" in modelData && modelData["style"] == "highlighted" ? Font.DemiBold : Font.Light
59 fontSize: "small"
60 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale)
61 color: grid.color
62 }
63 }
64 }
65}
066
=== modified file 'plugins/Dash/CardCreator.js'
--- plugins/Dash/CardCreator.js 2014-07-09 19:44:44 +0000
+++ plugins/Dash/CardCreator.js 2014-07-28 12:00:26 +0000
@@ -193,6 +193,21 @@
193 ] \n\193 ] \n\
194 }\n';194 }\n';
195195
196// multiple column version of kHeaderColumnCode.
197function kHeaderColumnCodeGenerator() {
198 var headerColumnCodeTemplate = 'Column { \n\
199 anchors.verticalCenter: parent.verticalCenter; \n\
200 spacing: units.dp(2); \n\
201 width: parent.width - x;\n\
202 data: [ \n\
203 %1 \n\
204 ]\n\
205 }\n';
206 var args = Array.prototype.slice.call(arguments);
207 var code = headerColumnCodeTemplate.arg(args.join(',\n'));
208 return code;
209}
210
196// %1 is used as anchors of mascotShapeLoader211// %1 is used as anchors of mascotShapeLoader
197var kMascotShapeLoaderCode = 'Loader { \n\212var kMascotShapeLoaderCode = 'Loader { \n\
198 id: mascotShapeLoader; \n\213 id: mascotShapeLoader; \n\
@@ -224,7 +239,7 @@
224 }\n';239 }\n';
225240
226// %1 is used as anchors of titleLabel241// %1 is used as anchors of titleLabel
227// %1 is used as color of titleLabel242// %2 is used as color of titleLabel
228// %3 is used as extra condition for visible of titleLabel243// %3 is used as extra condition for visible of titleLabel
229var kTitleLabelCode = 'Label { \n\244var kTitleLabelCode = 'Label { \n\
230 id: titleLabel; \n\245 id: titleLabel; \n\
@@ -258,6 +273,15 @@
258 horizontalAlignment: root.headerAlignment; \n\273 horizontalAlignment: root.headerAlignment; \n\
259 }\n';274 }\n';
260275
276// %1 is used as anchors of attributesRow
277var kAttributesRowCode = 'CardAttributes { \n\
278 id: attributesRow; \n\
279 objectName: "attributesRow"; \n\
280 anchors { %1 } \n\
281 color: %2; \n\
282 model: cardData && cardData["attributes"] || undefined; \n\
283 }\n';
284
261// %1 is used as top anchor of summary285// %1 is used as top anchor of summary
262// %2 is used as topMargin anchor of summary286// %2 is used as topMargin anchor of summary
263// %3 is used as color of summary287// %3 is used as color of summary
@@ -308,6 +332,7 @@
308 var headerAsOverlay = hasArt && template && template["overlay"] === true && (hasTitle || hasMascot);332 var headerAsOverlay = hasArt && template && template["overlay"] === true && (hasTitle || hasMascot);
309 var hasSubtitle = hasTitle && components["subtitle"] || false;333 var hasSubtitle = hasTitle && components["subtitle"] || false;
310 var hasHeaderRow = hasMascot && hasTitle;334 var hasHeaderRow = hasMascot && hasTitle;
335 var hasAttributes = hasTitle && components["attributes"] || false;
311336
312 if (hasBackground) {337 if (hasBackground) {
313 code += kBackgroundLoaderCode;338 code += kBackgroundLoaderCode;
@@ -377,6 +402,14 @@
377 code += 'readonly property int headerHeight: row.height;\n'402 code += 'readonly property int headerHeight: row.height;\n'
378 } else if (hasMascot) {403 } else if (hasMascot) {
379 code += 'readonly property int headerHeight: mascotImage.height;\n'404 code += 'readonly property int headerHeight: mascotImage.height;\n'
405 } else if (hasAttributes) {
406 if (hasTitle && hasSubtitle) {
407 code += 'readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin + attributesRow.height + attributesRow.anchors.topMargin;\n'
408 } else if (hasTitle) {
409 code += 'readonly property int headerHeight: titleLabel.height + attributesRow.height + attributesRow.anchors.topMargin;\n'
410 } else {
411 code += 'readonly property int headerHeight: attributesRow.height;\n'
412 }
380 } else if (hasSubtitle) {413 } else if (hasSubtitle) {
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'
382 } else if (hasTitle) {415 } else if (hasTitle) {
@@ -425,10 +458,12 @@
425458
426 var titleAnchors;459 var titleAnchors;
427 var subtitleAnchors;460 var subtitleAnchors;
428 if (hasMascot && hasSubtitle) {461 var attributesAnchors;
462 if (hasMascot && (hasSubtitle || hasAttributes)) {
429 // Using row + column463 // Using row + column
430 titleAnchors = 'left: parent.left; right: parent.right';464 titleAnchors = 'left: parent.left; right: parent.right';
431 subtitleAnchors = titleAnchors;465 subtitleAnchors = titleAnchors;
466 attributesAnchors = subtitleAnchors;
432 } else if (hasMascot) {467 } else if (hasMascot) {
433 // Using row + label468 // Using row + label
434 titleAnchors = 'verticalCenter: parent.verticalCenter;\n'469 titleAnchors = 'verticalCenter: parent.verticalCenter;\n'
@@ -438,11 +473,13 @@
438 titleAnchors = 'left: parent.left; \n\473 titleAnchors = 'left: parent.left; \n\
439 leftMargin: units.gu(1); \n\474 leftMargin: units.gu(1); \n\
440 right: parent.right; \n\475 right: parent.right; \n\
476 rightMargin: units.gu(1); \n\
441 top: overlayLoader.top; \n\477 top: overlayLoader.top; \n\
442 topMargin: units.gu(1);\n';478 topMargin: units.gu(1);\n';
443 } else {479 } else {
444 // Using anchors to the mascot/parent480 // Using anchors to the mascot/parent
445 titleAnchors = "right: parent.right;";481 titleAnchors = "right: parent.right;\n";
482 titleAnchors += "rightMargin: units.gu(1);\n";
446 titleAnchors += headerLeftAnchor;483 titleAnchors += headerLeftAnchor;
447 titleAnchors += headerVerticalAnchors;484 titleAnchors += headerVerticalAnchors;
448 if (!headerLeftAnchorHasMargin) {485 if (!headerLeftAnchorHasMargin) {
@@ -452,8 +489,19 @@
452 subtitleAnchors = 'left: titleLabel.left; \n\489 subtitleAnchors = 'left: titleLabel.left; \n\
453 leftMargin: titleLabel.leftMargin; \n\490 leftMargin: titleLabel.leftMargin; \n\
454 right: titleLabel.right; \n\491 right: titleLabel.right; \n\
492 rightMargin: titleLabel.rightMargin; \n\
455 top: titleLabel.bottom; \n\493 top: titleLabel.bottom; \n\
456 topMargin: units.dp(2);\n';494 topMargin: units.dp(2);\n';
495 if (hasSubtitle) {
496 attributesAnchors = 'left: subtitleLabel.left; \n\
497 leftMargin: subtitleLabel.leftMargin; \n\
498 right: subtitleLabel.right; \n\
499 rightMargin: subtitleLabel.rightMargin; \n\
500 top: subtitleLabel.bottom; \n\
501 topMargin: units.dp(2);\n';
502 } else {
503 attributesAnchors = subtitleAnchors;
504 }
457 }505 }
458506
459 var titleLabelVisibleExtra = (headerAsOverlay ? '&& overlayLoader.active': '');507 var titleLabelVisibleExtra = (headerAsOverlay ? '&& overlayLoader.active': '');
@@ -463,11 +511,27 @@
463 subtitleCode += kSubtitleLabelCode.arg(subtitleAnchors).arg(color);511 subtitleCode += kSubtitleLabelCode.arg(subtitleAnchors).arg(color);
464 }512 }
465513
466 if (hasMascot && hasSubtitle) {514 if (hasMascot && (hasSubtitle || hasAttributes)) {
467 // If using row + column wrap the code in the column515 // If using row + column wrap the code in the column
468 titleSubtitleCode = kHeaderColumnCode.arg(titleCode).arg(subtitleCode);516 titleSubtitleCode = kHeaderColumnCode.arg(titleCode).arg(subtitleCode);
517 if (hasSubtitle && hasAttributes) {
518 var attributesCode = kAttributesRowCode.arg(attributesAnchors).arg(color);
519 titleSubtitleCode = kHeaderColumnCodeGenerator(titleCode, subtitleCode, attributesCode);
520 } else if (hasSubtitle) {
521 titleSubtitleCode = kHeaderColumnCode.arg(titleCode).arg(subtitleCode);
522 } else if (hasAttributes) {
523 var attributesCode = kAttributesRowCode.arg(attributesAnchors).arg(color);
524 titleSubtitleCode = kHeaderColumnCode.arg(titleCode).arg(attributesCode);
525 }
469 } else {526 } else {
470 titleSubtitleCode = titleCode + subtitleCode;527 titleSubtitleCode = titleCode;
528 if (hasSubtitle) {
529 titleSubtitleCode = titleSubtitleCode + subtitleCode;
530 }
531 if (hasAttributes) {
532 var attributesCode = kAttributesRowCode.arg(attributesAnchors).arg(color);
533 titleSubtitleCode = titleSubtitleCode + attributesCode;
534 }
471 }535 }
472 }536 }
473537
@@ -487,6 +551,7 @@
487 else if (headerAsOverlay && hasArt) summaryTopAnchor = "artShapeHolder.bottom";551 else if (headerAsOverlay && hasArt) summaryTopAnchor = "artShapeHolder.bottom";
488 else if (hasHeaderRow) summaryTopAnchor = "row.bottom";552 else if (hasHeaderRow) summaryTopAnchor = "row.bottom";
489 else if (hasMascot) summaryTopAnchor = "mascotImage.bottom";553 else if (hasMascot) summaryTopAnchor = "mascotImage.bottom";
554 else if (hasAttributes) summaryTopAnchor = "attributesRow.bottom";
490 else if (hasSubtitle) summaryTopAnchor = "subtitleLabel.bottom";555 else if (hasSubtitle) summaryTopAnchor = "subtitleLabel.bottom";
491 else if (hasTitle) summaryTopAnchor = "titleLabel.bottom";556 else if (hasTitle) summaryTopAnchor = "titleLabel.bottom";
492 else if (hasArt) summaryTopAnchor = "artShapeHolder.bottom";557 else if (hasArt) summaryTopAnchor = "artShapeHolder.bottom";
@@ -499,7 +564,7 @@
499 color = 'root.scopeStyle ? root.scopeStyle.foreground : "grey"';564 color = 'root.scopeStyle ? root.scopeStyle.foreground : "grey"';
500 }565 }
501566
502 var summaryTopMargin = (hasMascot || hasSubtitle ? 'anchors.margins' : '0');567 var summaryTopMargin = (hasMascot || hasSubtitle || hasAttributes ? 'anchors.margins' : '0');
503568
504 code += kSummaryLabelCode.arg(summaryTopAnchor).arg(summaryTopMargin).arg(color);569 code += kSummaryLabelCode.arg(summaryTopAnchor).arg(summaryTopMargin).arg(color);
505 }570 }
@@ -510,6 +575,8 @@
510 code += 'implicitHeight: row.y + row.height + units.gu(1);\n';575 code += 'implicitHeight: row.y + row.height + units.gu(1);\n';
511 } else if (hasMascot) {576 } else if (hasMascot) {
512 code += 'implicitHeight: mascotImage.y + mascotImage.height;\n';577 code += 'implicitHeight: mascotImage.y + mascotImage.height;\n';
578 } else if (hasAttributes) {
579 code += 'implicitHeight: attributesRow.y + attributesRow.height + units.gu(1);\n';
513 } else if (hasSubtitle) {580 } else if (hasSubtitle) {
514 code += 'implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1);\n';581 code += 'implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1);\n';
515 } else if (hasTitle) {582 } else if (hasTitle) {
@@ -526,8 +593,10 @@
526function createCardComponent(parent, template, components) {593function createCardComponent(parent, template, components) {
527 var imports = 'import QtQuick 2.2; \n\594 var imports = 'import QtQuick 2.2; \n\
528 import Ubuntu.Components 0.1; \n\595 import Ubuntu.Components 0.1; \n\
529 import Ubuntu.Thumbnailer 0.1;\n';596 import Ubuntu.Thumbnailer 0.1;\n\
597 import Dash 0.1;\n';
530 var card = cardString(template, components);598 var card = cardString(template, components);
531 var code = imports + 'Component {\n' + card + '}\n';599 var code = imports + 'Component {\n' + card + '}\n';
600
532 return Qt.createQmlObject(code, parent, "createCardComponent");601 return Qt.createQmlObject(code, parent, "createCardComponent");
533}602}
534603
=== modified file 'plugins/Dash/qmldir'
--- plugins/Dash/qmldir 2014-07-08 08:30:46 +0000
+++ plugins/Dash/qmldir 2014-07-28 12:00:26 +0000
@@ -3,3 +3,4 @@
3typeinfo Dash.qmltypes3typeinfo Dash.qmltypes
4singleton CardCreatorCache 0.1 CardCreatorCache.qml4singleton CardCreatorCache 0.1 CardCreatorCache.qml
5ScopeStyle 0.1 ScopeStyle.qml5ScopeStyle 0.1 ScopeStyle.qml
6CardAttributes 0.1 CardAttributes.qml
6\ No newline at end of file7\ No newline at end of file
78
=== modified file 'qml/Dash/CardTool.qml'
--- qml/Dash/CardTool.qml 2014-05-02 14:51:22 +0000
+++ qml/Dash/CardTool.qml 2014-07-28 12:00:26 +0000
@@ -165,15 +165,40 @@
165 }165 }
166 }166 }
167167
168 Item {
169 id: attributesModel
170 property int numOfAttributes: 0
171 property var model: []
172 property bool hasAttributes: {
173 var attributes = components["attributes"];
174 var hasAttributesFlag = (attributes != undefined) && attributes["field"];
175
176 if (hasAttributesFlag) {
177 if (attributes["max-count"]) {
178 numOfAttributes = attributes["max-count"];
179 }
180 }
181 return hasAttributesFlag
182 }
183
184 onNumOfAttributesChanged: {
185 model = []
186 for (var i = 0; i < numOfAttributes; i++) {
187 model.push( {"value":"text"+(i+1), "icon":"image://theme/ok" } );
188 }
189 }
190 }
191
168 Loader {192 Loader {
169 id: cardLoader193 id: cardLoader
170 property var fields: ["art", "mascot", "title", "subtitle", "summary"]194 property var fields: ["art", "mascot", "title", "subtitle", "summary", "attributes"]
171 property var maxData: {195 property var maxData: {
172 "art": Qt.resolvedUrl("graphics/checkers.png"),196 "art": Qt.resolvedUrl("graphics/checkers.png"),
173 "mascot": Qt.resolvedUrl("graphics/checkers.png"),197 "mascot": Qt.resolvedUrl("graphics/checkers.png"),
174 "title": "—\n—",198 "title": "—\n—",
175 "subtitle": "—",199 "subtitle": "—",
176 "summary": "—\n—\n—\n—\n—"200 "summary": "—\n—\n—\n—\n—",
201 "attributes": attributesModel.model
177 }202 }
178 sourceComponent: cardTool.cardComponent203 sourceComponent: cardTool.cardComponent
179 onLoaded: {204 onLoaded: {
180205
=== modified file 'tests/plugins/Dash/CMakeLists.txt'
--- tests/plugins/Dash/CMakeLists.txt 2014-07-08 08:35:20 +0000
+++ tests/plugins/Dash/CMakeLists.txt 2014-07-28 12:00:26 +0000
@@ -79,3 +79,4 @@
79set(qmltest_DEFAULT_PROPERTIES ENVIRONMENT "LC_ALL=C")79set(qmltest_DEFAULT_PROPERTIES ENVIRONMENT "LC_ALL=C")
80add_qml_test(. ScopeStyle IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins)80add_qml_test(. ScopeStyle IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins)
81add_qml_test(. ListViewWithPageHeaderQML IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins)81add_qml_test(. ListViewWithPageHeaderQML IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins)
82add_qml_test(. CardAttributes IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins)
8283
=== modified file 'tests/plugins/Dash/cardcreator/1.res'
--- tests/plugins/Dash/cardcreator/1.res 2014-07-08 12:37:34 +0000
+++ tests/plugins/Dash/cardcreator/1.res 2014-07-28 12:00:26 +0000
@@ -5,8 +5,8 @@
5 property var cardData; 5 property var cardData;
6 property var artShapeBorderSource: undefined; 6 property var artShapeBorderSource: undefined;
7 property real fontScale: 1.0; 7 property real fontScale: 1.0;
8 property var scopeStyle: null;8 property var scopeStyle: null;
9 property int headerAlignment: Text.AlignLeft;9 property int headerAlignment: Text.AlignLeft;
10 property int fixedHeaderHeight: -1; 10 property int fixedHeaderHeight: -1;
11 property size fixedArtShapeSize: Qt.size(-1, -1); 11 property size fixedArtShapeSize: Qt.size(-1, -1);
12 readonly property string title: cardData && cardData["title"] || ""; 12 readonly property string title: cardData && cardData["title"] || "";
@@ -16,71 +16,73 @@
16onArtShapeBorderSourceChanged: { if (artShapeBorderSource !== undefined && artShapeLoader.item) artShapeLoader.item.borderSource = artShapeBorderSource; } 16onArtShapeBorderSourceChanged: { if (artShapeBorderSource !== undefined && artShapeLoader.item) artShapeLoader.item.borderSource = artShapeBorderSource; }
17readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);17readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
18Item { 18Item {
19 id: artShapeHolder; 19 id: artShapeHolder;
20 height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height;20 height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height;
21 width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width;21 width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width;
22 anchors { horizontalCenter: parent.horizontalCenter; }22 anchors { horizontalCenter: parent.horizontalCenter; }
23 Loader { 23 Loader {
24 id: artShapeLoader; 24 id: artShapeLoader;
25 objectName: "artShapeLoader"; 25 objectName: "artShapeLoader";
26 active: cardData && cardData["art"] || false; 26 active: cardData && cardData["art"] || false;
27 asynchronous: root.asynchronous; 27 asynchronous: root.asynchronous;
28 visible: status == Loader.Ready; 28 visible: status == Loader.Ready;
29 sourceComponent: UbuntuShape { 29 sourceComponent: UbuntuShape {
30 id: artShape; 30 id: artShape;
31 objectName: "artShape"; 31 objectName: "artShape";
32 radius: "medium";32 radius: "medium";
33 visible: image.status == Image.Ready; 33 visible: image.status == Image.Ready;
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;
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;
36 readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect;36 readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect;
37 Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }37 Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
38 onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings();38 onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings();
39 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }39 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
40 function updateWidthHeightBindings() { 40 function updateWidthHeightBindings() {
41 if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {41 if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
42 width = root.fixedArtShapeSize.width;42 width = root.fixedArtShapeSize.width;
43 height = root.fixedArtShapeSize.height;43 height = root.fixedArtShapeSize.height;
44 } else if (aspectSmallerThanImageAspect) {44 } else if (aspectSmallerThanImageAspect) {
45 width = Qt.binding(function() { return !visible ? 0 : image.width }); 45 width = Qt.binding(function() { return !visible ? 0 : image.width });
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 });
47 } else { 47 } else {
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 });
49 height = Qt.binding(function() { return !visible ? 0 : image.height }); 49 height = Qt.binding(function() { return !visible ? 0 : image.height });
50 }
51 }
52 image: Image {
53 objectName: "artImage";
54 source: cardData && cardData["art"] || "";
55 cache: true;
56 asynchronous: root.asynchronous;
57 fillMode: components && components["art"]["fill-mode"] === "fit" ? Image.PreserveAspectFit: Image.PreserveAspectCrop;
58 readonly property real aspect: implicitWidth / implicitHeight;
59 width: root.width;
60 height: width / artShape.aspect;
61 }
50 } 62 }
51 } 63 }
52 image: Image { 64 }
53 objectName: "artImage";
54 source: cardData && cardData["art"] || "";
55 cache: true;
56 asynchronous: root.asynchronous;
57 fillMode: components && components["art"]["fill-mode"] === "fit" ? Image.PreserveAspectFit: Image.PreserveAspectCrop;
58 readonly property real aspect: implicitWidth / implicitHeight;
59 width: root.width;
60 height: width / artShape.aspect;
61 }
62 }
63 }
64 }
65readonly property int headerHeight: titleLabel.height;65readonly property int headerHeight: titleLabel.height;
66Label { 66Label {
67 id: titleLabel; 67 id: titleLabel;
68 objectName: "titleLabel"; 68 objectName: "titleLabel";
69 anchors { right: parent.right;left: parent.left;69 anchors { right: parent.right;
70rightMargin: units.gu(1);
71left: parent.left;
70top: artShapeHolder.bottom; 72top: artShapeHolder.bottom;
71 topMargin: units.gu(1);73 topMargin: units.gu(1);
72leftMargin: units.gu(1);74leftMargin: units.gu(1);
73 }75 }
74 elide: Text.ElideRight; 76 elide: Text.ElideRight;
75 fontSize: "small"; 77 fontSize: "small";
76 wrapMode: Text.Wrap; 78 wrapMode: Text.Wrap;
77 maximumLineCount: 2; 79 maximumLineCount: 2;
78 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); 80 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
79 color: root.scopeStyle ? root.scopeStyle.foreground : "grey";81 color: root.scopeStyle ? root.scopeStyle.foreground : "grey";
80 visible: showHeader ; 82 visible: showHeader ;
81 text: root.title; 83 text: root.title;
82 font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal; 84 font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
83 horizontalAlignment: root.headerAlignment; 85 horizontalAlignment: root.headerAlignment;
84 }86 }
85implicitHeight: titleLabel.y + titleLabel.height + units.gu(1);87implicitHeight: titleLabel.y + titleLabel.height + units.gu(1);
86}88}
8789
=== modified file 'tests/plugins/Dash/cardcreator/2.res'
--- tests/plugins/Dash/cardcreator/2.res 2014-07-08 12:53:51 +0000
+++ tests/plugins/Dash/cardcreator/2.res 2014-07-28 12:00:26 +0000
@@ -5,8 +5,8 @@
5 property var cardData; 5 property var cardData;
6 property var artShapeBorderSource: undefined; 6 property var artShapeBorderSource: undefined;
7 property real fontScale: 1.0; 7 property real fontScale: 1.0;
8 property var scopeStyle: null;8 property var scopeStyle: null;
9 property int headerAlignment: Text.AlignLeft;9 property int headerAlignment: Text.AlignLeft;
10 property int fixedHeaderHeight: -1; 10 property int fixedHeaderHeight: -1;
11 property size fixedArtShapeSize: Qt.size(-1, -1); 11 property size fixedArtShapeSize: Qt.size(-1, -1);
12 readonly property string title: cardData && cardData["title"] || ""; 12 readonly property string title: cardData && cardData["title"] || "";
@@ -14,104 +14,107 @@
14 property bool showHeader: true; 14 property bool showHeader: true;
15 implicitWidth: childrenRect.width; 15 implicitWidth: childrenRect.width;
16Loader {16Loader {
17 id: backgroundLoader; 17 id: backgroundLoader;
18 objectName: "backgroundLoader"; 18 objectName: "backgroundLoader";
19 anchors.fill: parent; 19 anchors.fill: parent;
20 asynchronous: root.asynchronous; 20 asynchronous: root.asynchronous;
21 visible: status == Loader.Ready; 21 visible: status == Loader.Ready;
22 sourceComponent: UbuntuShape { 22 sourceComponent: UbuntuShape {
23 objectName: "background"; 23 objectName: "background";
24 radius: "medium"; 24 radius: "medium";
25 color: getColor(0) || "white"; 25 color: getColor(0) || "white";
26 gradientColor: getColor(1) || color; 26 gradientColor: getColor(1) || color;
27 anchors.fill: parent; 27 anchors.fill: parent;
28 image: backgroundImage.source ? backgroundImage : null; 28 image: backgroundImage.source ? backgroundImage : null;
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;
30 property Image backgroundImage: Image { 30 property Image backgroundImage: Image {
31 objectName: "backgroundImage"; 31 objectName: "backgroundImage";
32 source: { 32 source: {
33 if (cardData && typeof cardData["background"] === "string") return cardData["background"]; 33 if (cardData && typeof cardData["background"] === "string") return cardData["background"];
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"];
35 else return ""; 35 else return "";
36 } 36 }
37 } 37 }
38 function getColor(index) { 38 function getColor(index) {
39 if (cardData && typeof cardData["background"] === "object" 39 if (cardData && typeof cardData["background"] === "object"
40 && (cardData["background"]["type"] === "color" || cardData["background"]["type"] === "gradient")) { 40 && (cardData["background"]["type"] === "color" || cardData["background"]["type"] === "gradient")) {
41 return cardData["background"]["elements"][index]; 41 return cardData["background"]["elements"][index];
42 } else if (template && typeof template["card-background"] === "object" 42 } else if (template && typeof template["card-background"] === "object"
43 && (template["card-background"]["type"] === "color" || template["card-background"]["type"] === "gradient")) { 43 && (template["card-background"]["type"] === "color" || template["card-background"]["type"] === "gradient")) {
44 return template["card-background"]["elements"][index]; 44 return template["card-background"]["elements"][index];
45 } else return undefined; 45 } else return undefined;
46 } 46 }
47 } 47 }
48 }48 }
49readonly property size artShapeSize: Qt.size(-1, -1);49readonly property size artShapeSize: Qt.size(-1, -1);
50readonly property int headerHeight: row.height;50readonly property int headerHeight: row.height;
51Row { 51Row {
52 id: row; 52 id: row;
53 objectName: "outerRow"; 53 objectName: "outerRow";
54 property real margins: units.gu(1); 54 property real margins: units.gu(1);
55 spacing: margins; 55 spacing: margins;
56 height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight; 56 height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
57 anchors { top: parent.top; 57 anchors { top: parent.top;
58 topMargin: units.gu(1);58 topMargin: units.gu(1);
59 left: parent.left;59left: parent.left;
60}60 }
61 anchors.right: parent.right; 61 anchors.right: parent.right;
62 anchors.margins: margins;62 anchors.margins: margins;
63data: [ Image { 63 data: [ Image {
64 id: mascotImage; 64 id: mascotImage;
65 objectName: "mascotImage"; 65 objectName: "mascotImage";
66 anchors { verticalCenter: parent.verticalCenter; }66 anchors { verticalCenter: parent.verticalCenter; }
67 readonly property int maxSize: Math.max(width, height) * 4; 67 readonly property int maxSize: Math.max(width, height) * 4;
68 source: cardData && cardData["mascot"]; 68 source: cardData && cardData["mascot"];
69 width: units.gu(6); 69 width: units.gu(6);
70 height: units.gu(5.625); 70 height: units.gu(5.625);
71 sourceSize { width: maxSize; height: maxSize } 71 sourceSize { width: maxSize; height: maxSize }
72 fillMode: Image.PreserveAspectCrop; 72 fillMode: Image.PreserveAspectCrop;
73 horizontalAlignment: Image.AlignHCenter; 73 horizontalAlignment: Image.AlignHCenter;
74 verticalAlignment: Image.AlignVCenter; 74 verticalAlignment: Image.AlignVCenter;
75 visible: showHeader; 75 visible: showHeader;
76 }76 }
77,
78Column {
79 anchors.verticalCenter: parent.verticalCenter;
80 spacing: units.dp(2);
81 width: parent.width - x;
82 data: [ Label {
83 id: titleLabel;
84 objectName: "titleLabel";
85 anchors { left: parent.left; right: parent.right }
86 elide: Text.ElideRight;
87 fontSize: "small";
88 wrapMode: Text.Wrap;
89 maximumLineCount: 2;
90 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
91 color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey");
92 visible: showHeader ;
93 text: root.title;
94 font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
95 horizontalAlignment: root.headerAlignment;
96 }
97,
98Label {
99 id: subtitleLabel;
100 objectName: "subtitleLabel";
101 anchors { left: parent.left; right: parent.right }
10277
78 ,
79 Column {
80 anchors.verticalCenter: parent.verticalCenter;
81 spacing: units.dp(2);
82 width: parent.width - x;
83 data: [ Label {
84 id: titleLabel;
85 objectName: "titleLabel";
86 anchors { left: parent.left; right: parent.right }
103 elide: Text.ElideRight; 87 elide: Text.ElideRight;
104 fontSize: "small"; 88 fontSize: "small";
89 wrapMode: Text.Wrap;
90 maximumLineCount: 2;
105 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); 91 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
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");
107 visible: titleLabel.visible && titleLabel.text; 93 visible: showHeader ;
108 text: cardData && cardData["subtitle"] || ""; 94 text: root.title;
109 font.weight: Font.Light; 95 font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
110 horizontalAlignment: root.headerAlignment; 96 horizontalAlignment: root.headerAlignment;
111 }97 }
112]98
113}99 ,
114]100 Label {
115}101 id: subtitleLabel;
102 objectName: "subtitleLabel";
103 anchors { left: parent.left; right: parent.right }
104 elide: Text.ElideRight;
105 fontSize: "small";
106 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
107 color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey");
108 visible: titleLabel.visible && titleLabel.text;
109 text: cardData && cardData["subtitle"] || "";
110 font.weight: Font.Light;
111 horizontalAlignment: root.headerAlignment;
112 }
113
114 ]
115 }
116
117 ]
118 }
116implicitHeight: row.y + row.height + units.gu(1);119implicitHeight: row.y + row.height + units.gu(1);
117}120}
118121
=== modified file 'tests/plugins/Dash/cardcreator/3.res'
--- tests/plugins/Dash/cardcreator/3.res 2014-07-08 12:37:34 +0000
+++ tests/plugins/Dash/cardcreator/3.res 2014-07-28 12:00:26 +0000
@@ -5,8 +5,8 @@
5 property var cardData; 5 property var cardData;
6 property var artShapeBorderSource: undefined; 6 property var artShapeBorderSource: undefined;
7 property real fontScale: 1.0; 7 property real fontScale: 1.0;
8 property var scopeStyle: null;8 property var scopeStyle: null;
9 property int headerAlignment: Text.AlignLeft;9 property int headerAlignment: Text.AlignLeft;
10 property int fixedHeaderHeight: -1; 10 property int fixedHeaderHeight: -1;
11 property size fixedArtShapeSize: Qt.size(-1, -1); 11 property size fixedArtShapeSize: Qt.size(-1, -1);
12 readonly property string title: cardData && cardData["title"] || ""; 12 readonly property string title: cardData && cardData["title"] || "";
@@ -16,89 +16,92 @@
16onArtShapeBorderSourceChanged: { if (artShapeBorderSource !== undefined && artShapeLoader.item) artShapeLoader.item.borderSource = artShapeBorderSource; } 16onArtShapeBorderSourceChanged: { if (artShapeBorderSource !== undefined && artShapeLoader.item) artShapeLoader.item.borderSource = artShapeBorderSource; }
17readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);17readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
18Item { 18Item {
19 id: artShapeHolder; 19 id: artShapeHolder;
20 height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height;20 height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height;
21 width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width;21 width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width;
22 anchors { horizontalCenter: parent.horizontalCenter; }22 anchors { horizontalCenter: parent.horizontalCenter; }
23 Loader { 23 Loader {
24 id: artShapeLoader; 24 id: artShapeLoader;
25 objectName: "artShapeLoader"; 25 objectName: "artShapeLoader";
26 active: cardData && cardData["art"] || false; 26 active: cardData && cardData["art"] || false;
27 asynchronous: root.asynchronous;
28 visible: status == Loader.Ready;
29 sourceComponent: UbuntuShape {
30 id: artShape;
31 objectName: "artShape";
32 radius: "medium";
33 visible: image.status == Image.Ready;
34 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
35 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
36 readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect;
37 Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
38 onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings();
39 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
40 function updateWidthHeightBindings() {
41 if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
42 width = root.fixedArtShapeSize.width;
43 height = root.fixedArtShapeSize.height;
44 } else if (aspectSmallerThanImageAspect) {
45 width = Qt.binding(function() { return !visible ? 0 : image.width });
46 height = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.height : width / image.aspect });
47 } else {
48 width = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.width : height * image.aspect });
49 height = Qt.binding(function() { return !visible ? 0 : image.height });
50 }
51 }
52 image: Image {
53 objectName: "artImage";
54 source: cardData && cardData["art"] || "";
55 cache: true;
56 asynchronous: root.asynchronous; 27 asynchronous: root.asynchronous;
57 fillMode: components && components["art"]["fill-mode"] === "fit" ? Image.PreserveAspectFit: Image.PreserveAspectCrop; 28 visible: status == Loader.Ready;
58 readonly property real aspect: implicitWidth / implicitHeight; 29 sourceComponent: UbuntuShape {
59 width: root.width; 30 id: artShape;
60 height: width / artShape.aspect;31 objectName: "artShape";
32 radius: "medium";
33 visible: image.status == Image.Ready;
34 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
35 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
36 readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect;
37 Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
38 onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings();
39 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
40 function updateWidthHeightBindings() {
41 if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
42 width = root.fixedArtShapeSize.width;
43 height = root.fixedArtShapeSize.height;
44 } else if (aspectSmallerThanImageAspect) {
45 width = Qt.binding(function() { return !visible ? 0 : image.width });
46 height = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.height : width / image.aspect });
47 } else {
48 width = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.width : height * image.aspect });
49 height = Qt.binding(function() { return !visible ? 0 : image.height });
50 }
51 }
52 image: Image {
53 objectName: "artImage";
54 source: cardData && cardData["art"] || "";
55 cache: true;
56 asynchronous: root.asynchronous;
57 fillMode: components && components["art"]["fill-mode"] === "fit" ? Image.PreserveAspectFit: Image.PreserveAspectCrop;
58 readonly property real aspect: implicitWidth / implicitHeight;
59 width: root.width;
60 height: width / artShape.aspect;
61 }
62 }
61 } 63 }
62 } 64 }
63 }
64 }
65readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;65readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;
66Label { 66Label {
67 id: titleLabel; 67 id: titleLabel;
68 objectName: "titleLabel"; 68 objectName: "titleLabel";
69 anchors { right: parent.right;left: parent.left;69 anchors { right: parent.right;
70rightMargin: units.gu(1);
71left: parent.left;
70top: artShapeHolder.bottom; 72top: artShapeHolder.bottom;
71 topMargin: units.gu(1);73 topMargin: units.gu(1);
72leftMargin: units.gu(1);74leftMargin: units.gu(1);
73}75 }
74 elide: Text.ElideRight;
75 fontSize: "small";
76 wrapMode: Text.Wrap;
77 maximumLineCount: 2;
78 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
79 color: root.scopeStyle ? root.scopeStyle.foreground : "grey";
80 visible: showHeader ;
81 text: root.title;
82 font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
83 horizontalAlignment: root.headerAlignment;
84 }
85Label {
86 id: subtitleLabel;
87 objectName: "subtitleLabel";
88 anchors { left: titleLabel.left;
89 leftMargin: titleLabel.leftMargin;
90 right: titleLabel.right;
91 top: titleLabel.bottom;
92 topMargin: units.dp(2);
93 }
94 elide: Text.ElideRight; 76 elide: Text.ElideRight;
95 fontSize: "small"; 77 fontSize: "small";
78 wrapMode: Text.Wrap;
79 maximumLineCount: 2;
96 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); 80 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
97 color: root.scopeStyle ? root.scopeStyle.foreground : "grey";81 color: root.scopeStyle ? root.scopeStyle.foreground : "grey";
98 visible: titleLabel.visible && titleLabel.text; 82 visible: showHeader ;
99 text: cardData && cardData["subtitle"] || ""; 83 text: root.title;
100 font.weight: Font.Light; 84 font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
101 horizontalAlignment: root.headerAlignment; 85 horizontalAlignment: root.headerAlignment;
102 }86 }
87Label {
88 id: subtitleLabel;
89 objectName: "subtitleLabel";
90 anchors { left: titleLabel.left;
91 leftMargin: titleLabel.leftMargin;
92 right: titleLabel.right;
93 rightMargin: titleLabel.rightMargin;
94 top: titleLabel.bottom;
95 topMargin: units.dp(2);
96 }
97 elide: Text.ElideRight;
98 fontSize: "small";
99 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
100 color: root.scopeStyle ? root.scopeStyle.foreground : "grey";
101 visible: titleLabel.visible && titleLabel.text;
102 text: cardData && cardData["subtitle"] || "";
103 font.weight: Font.Light;
104 horizontalAlignment: root.headerAlignment;
105 }
103implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1);106implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1);
104}107}
105108
=== modified file 'tests/plugins/Dash/cardcreator/5.res'
--- tests/plugins/Dash/cardcreator/5.res 2014-07-08 12:37:34 +0000
+++ tests/plugins/Dash/cardcreator/5.res 2014-07-28 12:00:26 +0000
@@ -4,9 +4,9 @@
4 property var components; 4 property var components;
5 property var cardData; 5 property var cardData;
6 property var artShapeBorderSource: undefined; 6 property var artShapeBorderSource: undefined;
7 property real fontScale: 1.0;7 property real fontScale: 1.0;
8 property var scopeStyle: null;8 property var scopeStyle: null;
9 property int headerAlignment: Text.AlignLeft;9 property int headerAlignment: Text.AlignLeft;
10 property int fixedHeaderHeight: -1; 10 property int fixedHeaderHeight: -1;
11 property size fixedArtShapeSize: Qt.size(-1, -1); 11 property size fixedArtShapeSize: Qt.size(-1, -1);
12 readonly property string title: cardData && cardData["title"] || ""; 12 readonly property string title: cardData && cardData["title"] || "";
@@ -16,130 +16,132 @@
16onArtShapeBorderSourceChanged: { if (artShapeBorderSource !== undefined && artShapeLoader.item) artShapeLoader.item.borderSource = artShapeBorderSource; } 16onArtShapeBorderSourceChanged: { if (artShapeBorderSource !== undefined && artShapeLoader.item) artShapeLoader.item.borderSource = artShapeBorderSource; }
17readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);17readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
18Item { 18Item {
19 id: artShapeHolder; 19 id: artShapeHolder;
20 height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height;20 height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height;
21 width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width;21 width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width;
22 anchors { horizontalCenter: parent.horizontalCenter; }22 anchors { horizontalCenter: parent.horizontalCenter; }
23 Loader { 23 Loader {
24 id: artShapeLoader; 24 id: artShapeLoader;
25 objectName: "artShapeLoader"; 25 objectName: "artShapeLoader";
26 active: cardData && cardData["art"] || false; 26 active: cardData && cardData["art"] || false;
27 asynchronous: root.asynchronous;
28 visible: status == Loader.Ready;
29 sourceComponent: UbuntuShape {
30 id: artShape;
31 objectName: "artShape";
32 radius: "medium";
33 visible: image.status == Image.Ready;
34 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
35 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
36 readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect;
37 Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
38 onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings();
39 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
40 function updateWidthHeightBindings() {
41 if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
42 width = root.fixedArtShapeSize.width;
43 height = root.fixedArtShapeSize.height;
44 } else if (aspectSmallerThanImageAspect) {
45 width = Qt.binding(function() { return !visible ? 0 : image.width });
46 height = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.height : width / image.aspect });
47 } else {
48 width = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.width : height * image.aspect });
49 height = Qt.binding(function() { return !visible ? 0 : image.height });
50 }
51 }
52 image: Image {
53 objectName: "artImage";
54 source: cardData && cardData["art"] || "";
55 cache: true;
56 asynchronous: root.asynchronous; 27 asynchronous: root.asynchronous;
57 fillMode: components && components["art"]["fill-mode"] === "fit" ? Image.PreserveAspectFit: Image.PreserveAspectCrop; 28 visible: status == Loader.Ready;
58 readonly property real aspect: implicitWidth / implicitHeight; 29 sourceComponent: UbuntuShape {
59 width: root.width; 30 id: artShape;
60 height: width / artShape.aspect;31 objectName: "artShape";
32 radius: "medium";
33 visible: image.status == Image.Ready;
34 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
35 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
36 readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect;
37 Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
38 onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings();
39 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
40 function updateWidthHeightBindings() {
41 if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
42 width = root.fixedArtShapeSize.width;
43 height = root.fixedArtShapeSize.height;
44 } else if (aspectSmallerThanImageAspect) {
45 width = Qt.binding(function() { return !visible ? 0 : image.width });
46 height = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.height : width / image.aspect });
47 } else {
48 width = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.width : height * image.aspect });
49 height = Qt.binding(function() { return !visible ? 0 : image.height });
50 }
51 }
52 image: Image {
53 objectName: "artImage";
54 source: cardData && cardData["art"] || "";
55 cache: true;
56 asynchronous: root.asynchronous;
57 fillMode: components && components["art"]["fill-mode"] === "fit" ? Image.PreserveAspectFit: Image.PreserveAspectCrop;
58 readonly property real aspect: implicitWidth / implicitHeight;
59 width: root.width;
60 height: width / artShape.aspect;
61 }
62 }
61 } 63 }
62 } 64 }
63 }
64 }
65Loader { 65Loader {
66 id: overlayLoader; 66 id: overlayLoader;
67 anchors { 67 anchors {
68 left: artShapeHolder.left; 68 left: artShapeHolder.left;
69 right: artShapeHolder.right; 69 right: artShapeHolder.right;
70 bottom: artShapeHolder.bottom; 70 bottom: artShapeHolder.bottom;
71 } 71 }
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;
73 asynchronous: root.asynchronous; 73 asynchronous: root.asynchronous;
74 visible: showHeader && status == Loader.Ready; 74 visible: showHeader && status == Loader.Ready;
75 sourceComponent: ShaderEffect { 75 sourceComponent: ShaderEffect {
76 id: overlay; 76 id: overlay;
77 height: (fixedHeaderHeight > 0 ? fixedHeaderHeight : headerHeight) + units.gu(2);77 height: (fixedHeaderHeight > 0 ? fixedHeaderHeight : headerHeight) + units.gu(2);
78 opacity: 0.6; 78 opacity: 0.6;
79 property var source: ShaderEffectSource { 79 property var source: ShaderEffectSource {
80 id: shaderSource; 80 id: shaderSource;
81 sourceItem: artShapeLoader.item; 81 sourceItem: artShapeLoader.item;
82 onVisibleChanged: if (visible) scheduleUpdate(); 82 onVisibleChanged: if (visible) scheduleUpdate();
83 live: false; 83 live: false;
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);
85 } 85 }
86 vertexShader: " 86 vertexShader: "
87 uniform highp mat4 qt_Matrix; 87 uniform highp mat4 qt_Matrix;
88 attribute highp vec4 qt_Vertex; 88 attribute highp vec4 qt_Vertex;
89 attribute highp vec2 qt_MultiTexCoord0; 89 attribute highp vec2 qt_MultiTexCoord0;
90 varying highp vec2 coord; 90 varying highp vec2 coord;
91 void main() { 91 void main() {
92 coord = qt_MultiTexCoord0; 92 coord = qt_MultiTexCoord0;
93 gl_Position = qt_Matrix * qt_Vertex; 93 gl_Position = qt_Matrix * qt_Vertex;
94 }"; 94 }";
95 fragmentShader: " 95 fragmentShader: "
96 varying highp vec2 coord; 96 varying highp vec2 coord;
97 uniform sampler2D source; 97 uniform sampler2D source;
98 uniform lowp float qt_Opacity; 98 uniform lowp float qt_Opacity;
99 void main() { 99 void main() {
100 lowp vec4 tex = texture2D(source, coord); 100 lowp vec4 tex = texture2D(source, coord);
101 gl_FragColor = vec4(0, 0, 0, tex.a) * qt_Opacity; 101 gl_FragColor = vec4(0, 0, 0, tex.a) * qt_Opacity;
102 }"; 102 }";
103 } 103 }
104 }104 }
105readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;105readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;
106Label { 106Label {
107 id: titleLabel; 107 id: titleLabel;
108 objectName: "titleLabel"; 108 objectName: "titleLabel";
109 anchors { left: parent.left; 109 anchors { left: parent.left;
110 leftMargin: units.gu(1); 110 leftMargin: units.gu(1);
111 right: parent.right; 111 right: parent.right;
112 top: overlayLoader.top; 112 rightMargin: units.gu(1);
113 topMargin: units.gu(1);113 top: overlayLoader.top;
114}114 topMargin: units.gu(1);
115 elide: Text.ElideRight; 115 }
116 fontSize: "small";
117 wrapMode: Text.Wrap;
118 maximumLineCount: 2;
119 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
120 color: "white";
121 visible: showHeader && overlayLoader.active;
122 text: root.title;
123 font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
124 horizontalAlignment: root.headerAlignment;
125 }
126Label {
127 id: subtitleLabel;
128 objectName: "subtitleLabel";
129 anchors { left: titleLabel.left;
130 leftMargin: titleLabel.leftMargin;
131 right: titleLabel.right;
132 top: titleLabel.bottom;
133 topMargin: units.dp(2);
134 }
135 elide: Text.ElideRight; 116 elide: Text.ElideRight;
136 fontSize: "small"; 117 fontSize: "small";
118 wrapMode: Text.Wrap;
119 maximumLineCount: 2;
137 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); 120 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
138 color: "white"; 121 color: "white";
139 visible: titleLabel.visible && titleLabel.text; 122 visible: showHeader && overlayLoader.active;
140 text: cardData && cardData["subtitle"] || ""; 123 text: root.title;
141 font.weight: Font.Light; 124 font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
142 horizontalAlignment: root.headerAlignment; 125 horizontalAlignment: root.headerAlignment;
143 }126 }
127Label {
128 id: subtitleLabel;
129 objectName: "subtitleLabel";
130 anchors { left: titleLabel.left;
131 leftMargin: titleLabel.leftMargin;
132 right: titleLabel.right;
133 rightMargin: titleLabel.rightMargin;
134 top: titleLabel.bottom;
135 topMargin: units.dp(2);
136 }
137 elide: Text.ElideRight;
138 fontSize: "small";
139 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
140 color: "white";
141 visible: titleLabel.visible && titleLabel.text;
142 text: cardData && cardData["subtitle"] || "";
143 font.weight: Font.Light;
144 horizontalAlignment: root.headerAlignment;
145 }
144implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1);146implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1);
145}147}
146148
=== added file 'tests/plugins/Dash/cardcreator/7.res'
--- tests/plugins/Dash/cardcreator/7.res 1970-01-01 00:00:00 +0000
+++ tests/plugins/Dash/cardcreator/7.res 2014-07-28 12:00:26 +0000
@@ -0,0 +1,128 @@
1AbstractButton {
2 id: root;
3 property var template;
4 property var components;
5 property var cardData;
6 property var artShapeBorderSource: undefined;
7 property real fontScale: 1.0;
8 property var scopeStyle: null;
9 property int headerAlignment: Text.AlignLeft;
10 property int fixedHeaderHeight: -1;
11 property size fixedArtShapeSize: Qt.size(-1, -1);
12 readonly property string title: cardData && cardData["title"] || "";
13 property bool asynchronous: true;
14 property bool showHeader: true;
15 implicitWidth: childrenRect.width;
16Loader {
17 id: backgroundLoader;
18 objectName: "backgroundLoader";
19 anchors.fill: parent;
20 asynchronous: root.asynchronous;
21 visible: status == Loader.Ready;
22 sourceComponent: UbuntuShape {
23 objectName: "background";
24 radius: "medium";
25 color: getColor(0) || "white";
26 gradientColor: getColor(1) || color;
27 anchors.fill: parent;
28 image: backgroundImage.source ? backgroundImage : null;
29 property real luminance: 0.2126 * color.r + 0.7152 * color.g + 0.0722 * color.b;
30 property Image backgroundImage: Image {
31 objectName: "backgroundImage";
32 source: {
33 if (cardData && typeof cardData["background"] === "string") return cardData["background"];
34 else if (template && typeof template["card-background"] === "string") return template["card-background"];
35 else return "";
36 }
37 }
38 function getColor(index) {
39 if (cardData && typeof cardData["background"] === "object"
40 && (cardData["background"]["type"] === "color" || cardData["background"]["type"] === "gradient")) {
41 return cardData["background"]["elements"][index];
42 } else if (template && typeof template["card-background"] === "object"
43 && (template["card-background"]["type"] === "color" || template["card-background"]["type"] === "gradient")) {
44 return template["card-background"]["elements"][index];
45 } else return undefined;
46 }
47 }
48 }
49readonly property size artShapeSize: Qt.size(-1, -1);
50readonly property int headerHeight: row.height;
51Row {
52 id: row;
53 objectName: "outerRow";
54 property real margins: units.gu(1);
55 spacing: margins;
56 height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
57 anchors { top: parent.top;
58 topMargin: units.gu(1);
59left: parent.left;
60 }
61 anchors.right: parent.right;
62 anchors.margins: margins;
63 data: [ Image {
64 id: mascotImage;
65 objectName: "mascotImage";
66 anchors { verticalCenter: parent.verticalCenter; }
67 readonly property int maxSize: Math.max(width, height) * 4;
68 source: cardData && cardData["mascot"];
69 width: units.gu(6);
70 height: units.gu(5.625);
71 sourceSize { width: maxSize; height: maxSize }
72 fillMode: Image.PreserveAspectCrop;
73 horizontalAlignment: Image.AlignHCenter;
74 verticalAlignment: Image.AlignVCenter;
75 visible: showHeader;
76 }
77
78 ,
79 Column {
80 anchors.verticalCenter: parent.verticalCenter;
81 spacing: units.dp(2);
82 width: parent.width - x;
83 data: [
84 Label {
85 id: titleLabel;
86 objectName: "titleLabel";
87 anchors { left: parent.left; right: parent.right }
88 elide: Text.ElideRight;
89 fontSize: "small";
90 wrapMode: Text.Wrap;
91 maximumLineCount: 2;
92 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
93 color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey");
94 visible: showHeader ;
95 text: root.title;
96 font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
97 horizontalAlignment: root.headerAlignment;
98 }
99,
100Label {
101 id: subtitleLabel;
102 objectName: "subtitleLabel";
103 anchors { left: parent.left; right: parent.right }
104 elide: Text.ElideRight;
105 fontSize: "small";
106 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
107 color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey");
108 visible: titleLabel.visible && titleLabel.text;
109 text: cardData && cardData["subtitle"] || "";
110 font.weight: Font.Light;
111 horizontalAlignment: root.headerAlignment;
112 }
113,
114CardAttributes {
115 id: attributesRow;
116 objectName: "attributesRow";
117 anchors { left: parent.left; right: parent.right }
118 color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey");
119 model: cardData["attributes"]
120 }
121
122 ]
123 }
124
125 ]
126 }
127implicitHeight: row.y + row.height + units.gu(1);
128}
0129
=== added file 'tests/plugins/Dash/cardcreator/7.tst'
--- tests/plugins/Dash/cardcreator/7.tst 1970-01-01 00:00:00 +0000
+++ tests/plugins/Dash/cardcreator/7.tst 2014-07-28 12:00:26 +0000
@@ -0,0 +1,3 @@
1template: {"card-background":{"elements":["#E9E9E9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2}
2components: {"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}}
3result: 7.res
04
=== modified file 'tests/plugins/Dash/cardcreatortest.cpp'
--- tests/plugins/Dash/cardcreatortest.cpp 2014-05-06 13:09:08 +0000
+++ tests/plugins/Dash/cardcreatortest.cpp 2014-07-28 12:00:26 +0000
@@ -19,6 +19,7 @@
19#include <QQuickItem>19#include <QQuickItem>
20#include <QQuickView>20#include <QQuickView>
21#include <QtTestGui>21#include <QtTestGui>
22#include <QTemporaryFile>
2223
23class CardCreatorTest : public QObject24class CardCreatorTest : public QObject
24{25{
@@ -74,7 +75,14 @@
74 QVERIFY(testResultFile.open(QIODevice::ReadOnly));75 QVERIFY(testResultFile.open(QIODevice::ReadOnly));
75 QTextStream ts2(&testResultFile);76 QTextStream ts2(&testResultFile);
76 const QString expectedResult = ts2.readAll();77 const QString expectedResult = ts2.readAll();
77 QCOMPARE(cardStringResult.toString().simplified(), expectedResult.simplified());78 const QString executedResult = cardStringResult.toString();
79 // Record failed results to /tmp
80 QTemporaryFile tmpFile(QDir::tempPath() + QDir::separator() + "testCardCreatorFailedResultXXXXXX");
81 tmpFile.open();
82 tmpFile.setAutoRemove(false);
83 tmpFile.write(executedResult.toUtf8().constData());
84 QCOMPARE(executedResult.simplified(), expectedResult.simplified());
85 tmpFile.setAutoRemove(true); // Remove the result if it passed
7886
79 QVariant createCardComponentResult;87 QVariant createCardComponentResult;
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));
8189
=== added file 'tests/plugins/Dash/tst_CardAttributes.qml'
--- tests/plugins/Dash/tst_CardAttributes.qml 1970-01-01 00:00:00 +0000
+++ tests/plugins/Dash/tst_CardAttributes.qml 2014-07-28 12:00:26 +0000
@@ -0,0 +1,54 @@
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import QtTest 1.0
19import Dash 0.1
20
21Item {
22 width: units.gu(40)
23 height: units.gu(4.5)
24
25 property var testData: [
26 [{"value":"text1","icon":"image://theme/ok"},{"value":"text2","icon":"image://theme/cancel"}],
27 [{"value":"text1","icon":"image://theme/ok"},{"value":"text2","icon":"image://theme/cancel"},{"value":"text3"}],
28 [{"value":"text1","icon":"image://theme/ok"},{"value":"text2","icon":"image://theme/cancel"},{"value":"text3"},{"value":"text4"}],
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"}]
30 ]
31
32 CardAttributes {
33 id: cardAttributes
34 model: testData[3]
35 clip: true
36 }
37
38 TestCase {
39 name: "CardAttributesTest"
40 when: windowShown
41
42 function init() {
43 }
44
45 function test_columns_data() {
46 return testData;
47 }
48
49 function test_columns(data) {
50 cardAttributes.model = data;
51 compare(cardAttributes.columns, 2 + data.length % 2);
52 }
53 }
54}
055
=== modified file 'tests/qmltests/Dash/CardHelpers.js'
--- tests/qmltests/Dash/CardHelpers.js 2014-02-04 18:14:07 +0000
+++ tests/qmltests/Dash/CardHelpers.js 2014-07-28 12:00:26 +0000
@@ -16,7 +16,7 @@
1616
17.pragma library17.pragma library
1818
19var components = ["title", "art", "subtitle", "mascot", "emblem", "old-price", "price", "alt-price", "rating", "alt-rating", "summary"]19var components = ["title", "art", "subtitle", "mascot", "emblem", "old-price", "price", "alt-price", "rating", "alt-rating", "summary", "attributes"]
2020
21var defaultLayout = ' \21var defaultLayout = ' \
22{ \22{ \
@@ -48,7 +48,8 @@
48 "empty": "image://theme/rating-star-empty" \48 "empty": "image://theme/rating-star-empty" \
49 }, \49 }, \
50 "alt-rating": null, \50 "alt-rating": null, \
51 "summary": null \51 "summary": null, \
52 "attributes": { "max-count": 2 } \
52 }, \53 }, \
53 "resources": {} \54 "resources": {} \
54}'55}'
@@ -59,7 +60,8 @@
59 "art": "art", \60 "art": "art", \
60 "subtitle": "subtitle", \61 "subtitle": "subtitle", \
61 "mascot": "mascot", \62 "mascot": "mascot", \
62 "summary": "summary" \63 "summary": "summary", \
64 "attributes": "attributes" \
63}'65}'
6466
6567
6668
=== modified file 'tests/qmltests/Dash/tst_Card.qml'
--- tests/qmltests/Dash/tst_Card.qml 2014-06-27 08:47:04 +0000
+++ tests/qmltests/Dash/tst_Card.qml 2014-07-28 12:00:26 +0000
@@ -33,7 +33,8 @@
33 "mascot": "../../../tests/qmltests/Dash/artwork/avatar.png",33 "mascot": "../../../tests/qmltests/Dash/artwork/avatar.png",
34 "title": "foo",34 "title": "foo",
35 "subtitle": "bar",35 "subtitle": "bar",
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.",
37 "attributes": [{"value":"text1","icon":"image://theme/ok"},{"value":"text2","icon":"image://theme/cancel"}]
37 }'38 }'
3839
39 property var cardsModel: [40 property var cardsModel: [
@@ -110,6 +111,7 @@
110 anchors { top: parent.top; left: parent.left; margins: units.gu(1) }111 anchors { top: parent.top; left: parent.left; margins: units.gu(1) }
111112
112 sourceComponent: cardTool.cardComponent113 sourceComponent: cardTool.cardComponent
114 clip: true
113 onLoaded: {115 onLoaded: {
114 item.template = Qt.binding(function() { return cardTool.template; });116 item.template = Qt.binding(function() { return cardTool.template; });
115 item.components = Qt.binding(function() { return cardTool.components; });117 item.components = Qt.binding(function() { return cardTool.components; });

Subscribers

People subscribed via source and target branches