Merge lp:~zsombi/ubuntu-ui-toolkit/listitem_slowdown into lp:ubuntu-ui-toolkit/staging

Proposed by Zsombor Egri
Status: Merged
Approved by: Zsombor Egri
Approved revision: 1651
Merged at revision: 1656
Proposed branch: lp:~zsombi/ubuntu-ui-toolkit/listitem_slowdown
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 812 lines (+216/-201)
13 files modified
components.api (+5/-7)
src/Ubuntu/Components/plugin/plugin.cpp (+1/-2)
src/Ubuntu/Components/plugin/privates/listitemexpansion.cpp (+1/-1)
src/Ubuntu/Components/plugin/uclistitem.cpp (+70/-99)
src/Ubuntu/Components/plugin/uclistitem.h (+21/-49)
src/Ubuntu/Components/plugin/uclistitem_p.h (+18/-15)
src/Ubuntu/Components/plugin/ucstyleditembase.cpp (+15/-0)
src/Ubuntu/Components/plugin/ucviewitemsattached.cpp (+14/-26)
tests/unit/tst_performance/ListItemList13.qml (+30/-0)
tests/unit/tst_performance/ListOfCaptions13.qml (+35/-0)
tests/unit/tst_performance/StyledItemNewTheming.qml (+1/-1)
tests/unit/tst_performance/tst_performance.cpp (+2/-0)
tests/unit/tst_performance/tst_performance.pro (+3/-1)
To merge this branch: bzr merge lp:~zsombi/ubuntu-ui-toolkit/listitem_slowdown
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Cris Dywan Approve
Review via email: mp+272120@code.launchpad.net

Commit message

Boosting ListItem performance by removing the workaround brought in for 1.3 specific API.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

I am happy. and I am sad. for we can have theme versions without classes. but no longer is there a version for the attached properties in these cases.

The performance impact is a terrifying argument. I accept the trade-in given those numbers.

For the record, as the question came up in IRC, it's correct that the ListItem's merge in the components.api because it is indeed identical. The expansion property shows 1.3 so we know it's going to be inaccessible for 1.2 imports.

The merger is pretty straight-forward, and looks correct to me. There does seem to be an issue with the button handling judging by the failures on J... I'm not spotting it the way I'm reading the code, though. My guess would be that some code path is executed that used to be skipped conditional to the context menu.

review: Approve
1649. By Zsombor Egri

version detection

1650. By Zsombor Egri

staging sync

1651. By Zsombor Egri

regain ListItem speed by not using unique connection for expansion tracking

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'components.api'
2--- components.api 2015-09-24 20:03:02 +0000
3+++ components.api 2015-09-28 07:37:49 +0000
4@@ -503,7 +503,7 @@
5 Ubuntu.Layouts.Layouts 1.0 0.1: Item
6 readonly property string currentLayout
7 readonly property ConditionalLayout layouts
8-Ubuntu.Components.ListItem 1.2: StyledItem
9+Ubuntu.Components.ListItem 1.3 1.2: StyledItem
10 property Action action
11 property color color
12 readonly property Item contentItem
13@@ -511,6 +511,7 @@
14 readonly property UCListItemDivider divider
15 property bool dragMode
16 readonly property bool dragging
17+ readonly property UCListItemExpansion expansion 1.3
18 property color highlightColor
19 readonly property bool highlighted
20 property ListItemActions leadingActions
21@@ -523,8 +524,6 @@
22 property bool selectMode
23 property bool selected
24 property ListItemActions trailingActions
25-Ubuntu.Components.ListItem 1.3: ListItem
26- readonly property UCListItemExpansion expansion
27 Ubuntu.Components.ListItemActions 1.2: QtObject
28 readonly property Action actions
29 default readonly property QtObject data
30@@ -1506,13 +1505,12 @@
31 property var values
32 Ubuntu.Components.ViewItems 1.2: QtObject
33 property bool dragMode
34- signal dragUpdated(ListItemDrag event)
35- property bool selectMode
36- property QList<int> selectedIndices
37-Ubuntu.Components.ViewItems 1.3: ViewItems
38 property QList<int> expandedIndices
39 property int expansionFlags
40+ signal dragUpdated(ListItemDrag event)
41 signal expandedIndicesChanged(QList<int> indices)
42+ property bool selectMode
43+ property QList<int> selectedIndices
44 Ubuntu.Components.ViewItems.ExpansionFlag: Enum
45 CollapseOnOutsidePress
46 Exclusive
47
48=== modified file 'src/Ubuntu/Components/plugin/plugin.cpp'
49--- src/Ubuntu/Components/plugin/plugin.cpp 2015-09-24 05:10:12 +0000
50+++ src/Ubuntu/Components/plugin/plugin.cpp 2015-09-28 07:37:49 +0000
51@@ -229,9 +229,8 @@
52
53 // register 1.3 API
54 qmlRegisterType<UCItemAttached>();
55- qmlRegisterType<UCListItem13>(uri, 1, 3, "ListItem");
56+ qmlRegisterType<UCListItem, 1>(uri, 1, 3, "ListItem");
57 qmlRegisterType<UCListItemExpansion>();
58- qmlRegisterUncreatableType<UCViewItemsAttached13>(uri, 1, 3, "ViewItems", "No create");
59 qmlRegisterType<UCTheme>(uri, 1, 3, "ThemeSettings");
60 qmlRegisterType<UCStyledItemBase, 2>(uri, 1, 3, "StyledItem");
61 qmlRegisterSingletonType<UCNamespaceV13>(uri, 1, 3, "Ubuntu", registerUbuntuNamespace13);
62
63=== modified file 'src/Ubuntu/Components/plugin/privates/listitemexpansion.cpp'
64--- src/Ubuntu/Components/plugin/privates/listitemexpansion.cpp 2015-09-04 09:32:31 +0000
65+++ src/Ubuntu/Components/plugin/privates/listitemexpansion.cpp 2015-09-28 07:37:49 +0000
66@@ -19,7 +19,7 @@
67
68 UCListItemExpansion::UCListItemExpansion(QObject *parent)
69 : QObject(parent)
70- , m_listItem(static_cast<UCListItem13*>(parent))
71+ , m_listItem(static_cast<UCListItem*>(parent))
72 , m_height(0.0)
73 , m_filtering(false)
74 {
75
76=== modified file 'src/Ubuntu/Components/plugin/uclistitem.cpp'
77--- src/Ubuntu/Components/plugin/uclistitem.cpp 2015-09-18 10:49:07 +0000
78+++ src/Ubuntu/Components/plugin/uclistitem.cpp 2015-09-28 07:37:49 +0000
79@@ -184,23 +184,22 @@
80 */
81 UCListItemPrivate::UCListItemPrivate()
82 : UCStyledItemBasePrivate()
83- , defaultThemeVersion(0)
84+ , color(Qt::transparent)
85+ , highlightColor(Qt::transparent)
86+ , contentItem(new QQuickItem)
87+ , divider(new UCListItemDivider)
88+ , leadingActions(Q_NULLPTR)
89+ , trailingActions(Q_NULLPTR)
90+ , mainAction(Q_NULLPTR)
91+ , expansion(Q_NULLPTR)
92+ , xAxisMoveThresholdGU(DEFAULT_SWIPE_THRESHOLD_GU)
93+ , button(Qt::NoButton)
94 , highlighted(false)
95 , contentMoved(false)
96 , swiped(false)
97 , suppressClick(false)
98 , ready(false)
99 , customColor(false)
100- , xAxisMoveThresholdGU(DEFAULT_SWIPE_THRESHOLD_GU)
101- , color(Qt::transparent)
102- , highlightColor(Qt::transparent)
103- , parentAttached(0)
104- , contentItem(new QQuickItem)
105- , divider(new UCListItemDivider)
106- , leadingActions(0)
107- , trailingActions(0)
108- , mainAction(0)
109- , expansion(Q_NULLPTR)
110 {
111 }
112 UCListItemPrivate::~UCListItemPrivate()
113@@ -965,7 +964,6 @@
114 {
115 Q_D(UCListItem);
116 d->init();
117- d->defaultThemeVersion = BUILD_VERSION(1, 2);
118 }
119
120 UCListItem::~UCListItem()
121@@ -981,11 +979,6 @@
122 {
123 UCStyledItemBase::classBegin();
124 Q_D(UCListItem);
125- // initialize theme
126- UCTheme *theme = d->getTheme();
127- if (theme == &UCTheme::defaultTheme()) {
128- theme->setVersion(d->defaultThemeVersion);
129- }
130 d->_q_themeChanged();
131 d->divider->paletteChanged();
132 }
133@@ -1075,6 +1068,11 @@
134 myStyle->updateFlickable(d->flickable);
135 }
136
137+ if (d->parentAttached) {
138+ connect(d->parentAttached.data(), SIGNAL(expandedIndicesChanged(QList<int>)),
139+ this, SLOT(_q_updateExpansion(QList<int>)), Qt::DirectConnection);
140+ }
141+
142 if (parentAttachee) {
143 QObject::connect(parentAttachee, SIGNAL(widthChanged()), this, SLOT(_q_updateSize()), Qt::DirectConnection);
144 // update size
145@@ -1156,52 +1154,55 @@
146 if (d->canHighlight() && !d->highlighted && event->button() == Qt::LeftButton) {
147 d->handleLeftButtonPress(event);
148 }
149+ if (d->shouldShowContextMenu(event)) {
150+ d->showContextMenu();
151+ }
152 }
153
154-bool UCListItem13::shouldShowContextMenu(QMouseEvent *event)
155+bool UCListItemPrivate::shouldShowContextMenu(QMouseEvent *event)
156 {
157 if (event->button() != Qt::RightButton)
158 return false;
159- return leadingActions() || trailingActions();
160-}
161-
162-void UCListItem13::mousePressEvent(QMouseEvent *event)
163-{
164- UCListItem::mousePressEvent(event);
165- if (shouldShowContextMenu(event)) {
166- Q_D(UCListItem);
167-
168- // Highlight the Item while the menu is showing
169- d->setHighlighted(true);
170- // Reset the timer which otherwise is started with highlighting
171- d->pressAndHoldTimer.stop();
172-
173- quint16 version(d->getTheme()->version());
174- QString versionString(QStringLiteral("%1.%2").arg(MAJOR_VERSION(version)).arg(MINOR_VERSION(version)));
175- QUrl url(UbuntuComponentsPlugin::pluginUrl().resolved(versionString + "/ListItemPopover.qml"));
176-
177- // Open Popover
178- QQmlEngine* engine = qmlEngine(this);
179- QQmlComponent* component = new QQmlComponent(engine, url, QQmlComponent::PreferSynchronous, this);
180- if (component->isError()) {
181- qmlInfo(this) << component->errorString();
182- } else {
183- QQmlEngine::setContextForObject(component, qmlContext(this));
184- QQuickItem* item = static_cast<QQuickItem*>(component->create(qmlContext(this)));
185- item->setProperty("caller", QVariant::fromValue(this));
186- item->setParentItem(QuickUtils::instance().rootItem(this));
187- QMetaObject::invokeMethod(item, "show");
188- connect(item, &QQuickItem::visibleChanged, this,
189- &UCListItem13::popoverClosed, Qt::DirectConnection);
190- }
191- delete component;
192- }
193-}
194-
195-void UCListItem13::popoverClosed()
196-{
197- Q_D(UCListItem);
198- d->setHighlighted(false);
199+ return leadingActions || trailingActions;
200+}
201+
202+void UCListItemPrivate::_q_popoverClosed()
203+{
204+ setHighlighted(false);
205+}
206+
207+void UCListItemPrivate::showContextMenu()
208+{
209+ Q_Q(UCListItem);
210+ // themes 1.2 and below should not have context menu support, so leave
211+ quint16 version(getTheme()->version());
212+ if (version <= BUILD_VERSION(1, 2)) {
213+ return;
214+ }
215+
216+ // Highlight the Item while the menu is showing
217+ setHighlighted(true);
218+ // Reset the timer which otherwise is started with highlighting
219+ pressAndHoldTimer.stop();
220+
221+ QString versionString(QStringLiteral("%1.%2").arg(MAJOR_VERSION(version)).arg(MINOR_VERSION(version)));
222+ QUrl url(UbuntuComponentsPlugin::pluginUrl().resolved(versionString + "/ListItemPopover.qml"));
223+
224+ // Open Popover
225+ QQmlEngine* engine = qmlEngine(q);
226+ QQmlComponent* component = new QQmlComponent(engine, url, QQmlComponent::PreferSynchronous, q);
227+ if (component->isError()) {
228+ qmlInfo(q) << component->errorString();
229+ } else {
230+ QQmlEngine::setContextForObject(component, qmlContext(q));
231+ QQuickItem* item = static_cast<QQuickItem*>(component->create(qmlContext(q)));
232+ item->setProperty("caller", QVariant::fromValue(q));
233+ item->setParentItem(QuickUtils::instance().rootItem(q));
234+ QMetaObject::invokeMethod(item, "show");
235+ QObject::connect(item, SIGNAL(visibleChanged()), q,
236+ SLOT(_q_popoverClosed()), Qt::DirectConnection);
237+ }
238+ delete component;
239 }
240
241 // ungrabs any previously grabbed left mouse button event
242@@ -1239,17 +1240,15 @@
243
244 void UCListItem::mouseReleaseEvent(QMouseEvent *event)
245 {
246+ Q_D(UCListItem);
247+ if (d->shouldShowContextMenu(event)) {
248+ return;
249+ }
250+
251 UCStyledItemBase::mouseReleaseEvent(event);
252- Q_D(UCListItem);
253 d->handleLeftButtonRelease(event);
254 }
255
256-void UCListItem13::mouseReleaseEvent(QMouseEvent *event)
257-{
258- if (!shouldShowContextMenu(event))
259- UCListItem::mouseReleaseEvent(event);
260-}
261-
262 // returns true if the mouse is swiped over the threshold value
263 bool UCListItemPrivate::swipedOverThreshold(const QPointF &mousePos, const QPointF relativePos)
264 {
265@@ -1769,33 +1768,6 @@
266 return QQuickItemPrivate::get(contentItem)->children();
267 }
268
269-/******************************************************************************
270- * Versioning
271- */
272-UCListItem13::UCListItem13(QQuickItem *parent)
273- : UCListItem(parent)
274-{
275- Q_D(UCListItem);
276- d->defaultThemeVersion = BUILD_VERSION(1, 3);
277-}
278-
279-QObject *UCListItem13::attachedViewItems(QObject *object, bool create)
280-{
281- return qmlAttachedPropertiesObject<UCViewItemsAttached13>(object, create);
282-}
283-
284-void UCListItem13::itemChange(ItemChange change, const ItemChangeData &data)
285-{
286- UCListItem::itemChange(change, data);
287-
288- Q_D(UCListItem);
289- // ViewItems drives expansion
290- if (d->parentAttached) {
291- connect(d->parentAttached.data(), SIGNAL(expandedIndicesChanged(QList<int>)),
292- this, SLOT(_q_updateExpansion(QList<int>)), Qt::UniqueConnection);
293- }
294-}
295-
296 /*!
297 * \qmlpropertygroup ::ListItem::expansion
298 * \qmlproperty bool ListItem::expansion.expanded
299@@ -1803,7 +1775,7 @@
300 * \since Ubuntu.Components 1.3
301 * The group drefines the expansion state of the ListItem.
302 */
303-UCListItemExpansion *UCListItem13::expansion()
304+UCListItemExpansion *UCListItem::expansion()
305 {
306 Q_D(UCListItem);
307 if (!d->expansion) {
308@@ -1812,14 +1784,13 @@
309 return d->expansion;
310 }
311
312-void UCListItem13::_q_updateExpansion(const QList<int> &indices)
313+void UCListItemPrivate::_q_updateExpansion(const QList<int> &indices)
314 {
315- Q_UNUSED(indices);
316- Q_D(UCListItem);
317- Q_EMIT expansion()->expandedChanged();
318+ Q_Q(UCListItem);
319+ Q_EMIT q->expansion()->expandedChanged();
320 // make sure the style is loaded
321- if (indices.contains(d->index())) {
322- d->loadStyleItem();
323+ if (indices.contains(index())) {
324+ loadStyleItem();
325 }
326 }
327
328
329=== modified file 'src/Ubuntu/Components/plugin/uclistitem.h'
330--- src/Ubuntu/Components/plugin/uclistitem.h 2015-09-17 06:29:36 +0000
331+++ src/Ubuntu/Components/plugin/uclistitem.h 2015-09-28 07:37:49 +0000
332@@ -25,6 +25,7 @@
333 class UCListItemActions;
334 class UCAction;
335 class UCListItemPrivate;
336+class UCListItemExpansion;
337 class UCListItem : public UCStyledItemBase
338 {
339 Q_OBJECT
340@@ -44,6 +45,8 @@
341 Q_PRIVATE_PROPERTY(UCListItem::d_func(), QQmlListProperty<QObject> listItemData READ data DESIGNABLE false)
342 Q_PRIVATE_PROPERTY(UCListItem::d_func(), QQmlListProperty<QQuickItem> listItemChildren READ children NOTIFY listItemChildrenChanged DESIGNABLE false)
343 Q_CLASSINFO("DefaultProperty", "listItemData")
344+ // 1.3
345+ Q_PROPERTY(UCListItemExpansion* expansion READ expansion CONSTANT REVISION 1)
346 public:
347 explicit UCListItem(QQuickItem *parent = 0);
348 ~UCListItem();
349@@ -60,6 +63,8 @@
350 QColor highlightColor() const;
351 void setHighlightColor(const QColor &color);
352 void resetHighlightColor();
353+ // 1.3
354+ UCListItemExpansion *expansion();
355
356 protected:
357 virtual QObject *attachedViewItems(QObject *object, bool create);
358@@ -108,26 +113,8 @@
359 Q_PRIVATE_SLOT(d_func(), void _q_contentMoving())
360 Q_PRIVATE_SLOT(d_func(), void _q_syncSelectMode())
361 Q_PRIVATE_SLOT(d_func(), void _q_syncDragMode())
362-};
363-
364-class UCListItemExpansion;
365-class UCListItem13 : public UCListItem
366-{
367- Q_OBJECT
368- Q_PROPERTY(UCListItemExpansion* expansion READ expansion CONSTANT)
369-protected:
370- virtual QObject *attachedViewItems(QObject *object, bool create);
371- void itemChange(ItemChange change, const ItemChangeData &data);
372- void mousePressEvent(QMouseEvent *event);
373- void mouseReleaseEvent(QMouseEvent *event);
374-private:
375- Q_SLOT void _q_updateExpansion(const QList<int> &indices);
376- bool shouldShowContextMenu(QMouseEvent *event);
377- void popoverClosed();
378-public:
379- explicit UCListItem13(QQuickItem *parent = 0);
380-
381- UCListItemExpansion *expansion();
382+ Q_PRIVATE_SLOT(d_func(), void _q_updateExpansion(const QList<int> &indices))
383+ Q_PRIVATE_SLOT(d_func(), void _q_popoverClosed())
384 };
385
386 class UCListItemDividerPrivate;
387@@ -167,6 +154,10 @@
388 Q_PROPERTY(QList<int> selectedIndices READ selectedIndices WRITE setSelectedIndices NOTIFY selectedIndicesChanged)
389 Q_PROPERTY(bool dragMode READ dragMode WRITE setDragMode NOTIFY dragModeChanged)
390 Q_ENUMS(ExpansionFlag)
391+ // FIXME these should be revisioned, however bug doesn't allow us to do that
392+ // https://bugs.launchpad.net/ubuntu/+source/qtdeclarative-opensource-src/+bug/1389721
393+ Q_PROPERTY(QList<int> expandedIndices READ expandedIndices WRITE setExpandedIndices NOTIFY expandedIndicesChanged)
394+ Q_PROPERTY(int expansionFlags READ expansionFlags WRITE setExpansionFlags NOTIFY expansionFlagsChanged)
395 public:
396 enum ExpansionFlag {
397 Exclusive = 0x01,
398@@ -191,6 +182,12 @@
399 bool dragMode() const;
400 void setDragMode(bool value);
401
402+ // 1.3
403+ QList<int> expandedIndices() const;
404+ void setExpandedIndices(QList<int> indices);
405+ int expansionFlags() const;
406+ void setExpansionFlags(int flags);
407+
408 private Q_SLOTS:
409 void unbindItem();
410 void completed();
411@@ -202,39 +199,15 @@
412
413 void dragUpdated(UCDragEvent *event);
414
415+ // 1.3
416+ void expandedIndicesChanged(const QList<int> &indices);
417+ void expansionFlagsChanged();
418 private:
419 Q_DECLARE_PRIVATE(UCViewItemsAttached)
420 };
421 Q_DECLARE_OPERATORS_FOR_FLAGS(UCViewItemsAttached::ExpansionFlags)
422 QML_DECLARE_TYPEINFO(UCViewItemsAttached, QML_HAS_ATTACHED_PROPERTIES)
423
424-// FIXME keep the 1.3 properties in a separate class, workaround for bug
425-// https://bugs.launchpad.net/ubuntu/+source/qtdeclarative-opensource-src/+bug/1389721
426-// enums and flag are added to UCViewItemsAttached like normal
427-class UCViewItemsAttached13 : public UCViewItemsAttached
428-{
429- Q_OBJECT
430- Q_PROPERTY(QList<int> expandedIndices READ expandedIndices WRITE setExpandedIndices NOTIFY expandedIndicesChanged)
431- Q_PROPERTY(int expansionFlags READ expansionFlags WRITE setExpansionFlags NOTIFY expansionFlagsChanged)
432-public:
433- explicit UCViewItemsAttached13(QObject *owner = 0);
434- static UCViewItemsAttached13 *qmlAttachedProperties(QObject *owner);
435-
436- QList<int> expandedIndices() const;
437- void setExpandedIndices(QList<int> indices);
438- int expansionFlags() const;
439- void setExpansionFlags(int flags);
440-
441-Q_SIGNALS:
442- void expandedIndicesChanged(const QList<int> &indices);
443- void expansionFlagsChanged();
444-
445-private:
446- UCViewItemsAttachedPrivate *d_ptr;
447- Q_DECLARE_PRIVATE_D(d_ptr, UCViewItemsAttached)
448-};
449-QML_DECLARE_TYPEINFO(UCViewItemsAttached13, QML_HAS_ATTACHED_PROPERTIES)
450-
451 class UCListItemExpansion : public QObject
452 {
453 Q_OBJECT
454@@ -258,12 +231,11 @@
455 bool eventFilter(QObject *, QEvent *);
456
457 private:
458- UCListItem13 *m_listItem;
459+ UCListItem *m_listItem;
460 qreal m_height;
461 bool m_filtering:1;
462
463 friend class UCListItem;
464- friend class UCListItem13;
465 friend class UCListItemPrivate;
466 };
467
468
469=== modified file 'src/Ubuntu/Components/plugin/uclistitem_p.h'
470--- src/Ubuntu/Components/plugin/uclistitem_p.h 2015-09-17 08:05:07 +0000
471+++ src/Ubuntu/Components/plugin/uclistitem_p.h 2015-09-28 07:37:49 +0000
472@@ -59,6 +59,7 @@
473 void _q_contentMoving();
474 void _q_syncSelectMode();
475 void _q_syncDragMode();
476+ void _q_updateExpansion(const QList<int> &indices);
477 int index();
478 bool canHighlight();
479 void setHighlighted(bool pressed);
480@@ -71,32 +72,34 @@
481 void handleLeftButtonPress(QMouseEvent *event);
482 void handleLeftButtonRelease(QMouseEvent *event);
483 bool sendMouseEvent(QQuickItem *item, QMouseEvent *event);
484+ bool shouldShowContextMenu(QMouseEvent *event);
485+ void _q_popoverClosed();
486+ void showContextMenu();
487
488- quint16 defaultThemeVersion;
489- bool highlighted:1;
490- bool contentMoved:1;
491- bool swiped:1;
492- bool suppressClick:1;
493- bool ready:1;
494- bool customColor:1;
495- Qt::MouseButton button;
496- qreal xAxisMoveThresholdGU;
497+ QPointer<QQuickItem> countOwner;
498+ QPointer<QQuickFlickable> flickable;
499+ QPointer<UCViewItemsAttached> parentAttached;
500+ QPointer<ListItemDragHandler> dragHandler;
501 QBasicTimer pressAndHoldTimer;
502 QPointF lastPos;
503 QPointF pressedPos;
504 QPointF zeroPos;
505 QColor color;
506 QColor highlightColor;
507- QPointer<QQuickItem> countOwner;
508- QPointer<QQuickFlickable> flickable;
509- QPointer<UCViewItemsAttached> parentAttached;
510- QPointer<ListItemDragHandler> dragHandler;
511 QQuickItem *contentItem;
512 UCListItemDivider *divider;
513 UCListItemActions *leadingActions;
514 UCListItemActions *trailingActions;
515 UCAction *mainAction;
516 UCListItemExpansion *expansion;
517+ qreal xAxisMoveThresholdGU;
518+ Qt::MouseButton button;
519+ bool highlighted:1;
520+ bool contentMoved:1;
521+ bool swiped:1;
522+ bool suppressClick:1;
523+ bool ready:1;
524+ bool customColor:1;
525
526 // getters/setters
527 QQmlListProperty<QObject> data();
528@@ -148,13 +151,13 @@
529 void updateSelectedIndices(int fromIndex, int toIndex);
530
531 // expansion
532- void expand(int index, UCListItem13 *listItem, bool emitChangeSignal = true);
533+ void expand(int index, UCListItem *listItem, bool emitChangeSignal = true);
534 void collapse(int index, bool emitChangeSignal = true);
535 void collapseAll();
536 void toggleExpansionFlags(bool enable);
537
538 QSet<int> selectedList;
539- QMap<int, QPointer<UCListItem13> > expansionList;
540+ QMap<int, QPointer<UCListItem> > expansionList;
541 QList< QPointer<QQuickFlickable> > flickables;
542 QPointer<UCListItem> boundItem;
543 QQuickFlickable *listView;
544
545=== modified file 'src/Ubuntu/Components/plugin/ucstyleditembase.cpp'
546--- src/Ubuntu/Components/plugin/ucstyleditembase.cpp 2015-09-21 14:24:05 +0000
547+++ src/Ubuntu/Components/plugin/ucstyleditembase.cpp 2015-09-28 07:37:49 +0000
548@@ -21,6 +21,7 @@
549 #include "uctheme.h"
550 #include "ucstylehints.h"
551 #include "ucthemingextension.h"
552+#include "ucnamespace.h"
553 #include <QtQml/QQmlEngine>
554 #include <QtQuick/private/qquickanchors_p.h>
555
556@@ -465,6 +466,20 @@
557 {
558 QQuickItem::componentComplete();
559 Q_D(UCStyledItemBase);
560+
561+ QQmlData *data = QQmlData::get(this);
562+ QQmlContextData *cdata = QQmlContextData::get(qmlContext(this));
563+ QQmlPropertyData l;
564+ QQmlPropertyData *pdata = QQmlPropertyCache::property(qmlEngine(this), this, QStringLiteral("theme"), cdata, l);
565+ // FIXME MainView internal styler uses theme property, meaning imports13 will be true,
566+ // therefore we must check the type of the property as well in case anyone else overrides it
567+ bool imports13 = data->propertyCache->isAllowedInRevision(pdata) && (property("theme").type() != QVariant::String);
568+ if (!imports13) {
569+ // load 1.2 theme
570+ UCTheme *theme = d->getTheme();
571+ // FIXME: override the global theme version to be used when creating new themes!
572+ theme->setVersion(BUILD_VERSION(1, 2));
573+ }
574 // no animation at this time
575 // prepare style context if not been done yet
576 d->postStyleChanged();
577
578=== modified file 'src/Ubuntu/Components/plugin/ucviewitemsattached.cpp'
579--- src/Ubuntu/Components/plugin/ucviewitemsattached.cpp 2015-09-17 06:29:36 +0000
580+++ src/Ubuntu/Components/plugin/ucviewitemsattached.cpp 2015-09-28 07:37:49 +0000
581@@ -549,18 +549,6 @@
582 }
583 }
584
585-
586-UCViewItemsAttached13::UCViewItemsAttached13(QObject *owner)
587- : UCViewItemsAttached(owner)
588-{
589- d_ptr = UCViewItemsAttachedPrivate::get(this);
590-}
591-
592-UCViewItemsAttached13 *UCViewItemsAttached13::qmlAttachedProperties(QObject *owner)
593-{
594- return new UCViewItemsAttached13(owner);
595-}
596-
597 /*!
598 * \qmlattachedproperty list<int> ViewItems::expandedIndices
599 * \since Ubuntu.Components 1.3
600@@ -572,12 +560,12 @@
601 * flags set, only the last item from the list will be considered and set as
602 * expanded.
603 */
604-QList<int> UCViewItemsAttached13::expandedIndices() const
605+QList<int> UCViewItemsAttached::expandedIndices() const
606 {
607 Q_D(const UCViewItemsAttached);
608 return d->expansionList.keys();
609 }
610-void UCViewItemsAttached13::setExpandedIndices(QList<int> indices)
611+void UCViewItemsAttached::setExpandedIndices(QList<int> indices)
612 {
613 Q_UNUSED(indices);
614 Q_D(UCViewItemsAttached);
615@@ -585,10 +573,10 @@
616 if (indices.size() > 0) {
617 if (d->expansionFlags & UCViewItemsAttached::Exclusive) {
618 // take only the last one from the list
619- d->expand(indices.last(), QPointer<UCListItem13>(), false);
620+ d->expand(indices.last(), QPointer<UCListItem>(), false);
621 } else {
622 for (int i = 0; i < indices.size(); i++) {
623- d->expand(indices[i], QPointer<UCListItem13>(), false);
624+ d->expand(indices[i], QPointer<UCListItem>(), false);
625 }
626 }
627 }
628@@ -596,27 +584,27 @@
629 }
630
631 // insert listItem into the expanded indices map
632-void UCViewItemsAttachedPrivate::expand(int index, UCListItem13 *listItem, bool emitChangeSignal)
633+void UCViewItemsAttachedPrivate::expand(int index, UCListItem *listItem, bool emitChangeSignal)
634 {
635- expansionList.insert(index, QPointer<UCListItem13>(listItem));
636+ expansionList.insert(index, QPointer<UCListItem>(listItem));
637 if (listItem && ((expansionFlags & UCViewItemsAttached::CollapseOnOutsidePress) == UCViewItemsAttached::CollapseOnOutsidePress)) {
638 listItem->expansion()->enableClickFiltering(true);
639 }
640 if (emitChangeSignal) {
641- Q_EMIT static_cast<UCViewItemsAttached13*>(q_func())->expandedIndicesChanged(expansionList.keys());
642+ Q_EMIT static_cast<UCViewItemsAttached*>(q_func())->expandedIndicesChanged(expansionList.keys());
643 }
644 }
645
646 // collapse the item at index
647 void UCViewItemsAttachedPrivate::collapse(int index, bool emitChangeSignal)
648 {
649- UCListItem13 *item = expansionList.take(index).data();
650+ UCListItem *item = expansionList.take(index).data();
651 bool wasExpanded = item && item->expansion()->expanded();
652 if (item && ((expansionFlags & UCViewItemsAttached::CollapseOnOutsidePress) == UCViewItemsAttached::CollapseOnOutsidePress)) {
653 item->expansion()->enableClickFiltering(false);
654 }
655 if (emitChangeSignal && wasExpanded) {
656- Q_EMIT static_cast<UCViewItemsAttached13*>(q_func())->expandedIndicesChanged(expansionList.keys());
657+ Q_EMIT static_cast<UCViewItemsAttached*>(q_func())->expandedIndicesChanged(expansionList.keys());
658 }
659 }
660
661@@ -627,7 +615,7 @@
662 collapse(expansionList.keys().last(), false);
663 }
664 if (emitChangedSignal) {
665- Q_EMIT static_cast<UCViewItemsAttached13*>(q_func())->expandedIndicesChanged(expansionList.keys());
666+ Q_EMIT static_cast<UCViewItemsAttached*>(q_func())->expandedIndicesChanged(expansionList.keys());
667 }
668 }
669
670@@ -651,12 +639,12 @@
671 * outside of its area. The flag also turns \c ViewItems.Exclusive flag on.
672 * \endtable
673 */
674-int UCViewItemsAttached13::expansionFlags() const
675+int UCViewItemsAttached::expansionFlags() const
676 {
677 Q_D(const UCViewItemsAttached);
678 return d->expansionFlags;
679 }
680-void UCViewItemsAttached13::setExpansionFlags(int flags)
681+void UCViewItemsAttached::setExpansionFlags(int flags)
682 {
683 Q_D(UCViewItemsAttached);
684 if (d->expansionFlags == (ExpansionFlags)flags) {
685@@ -677,9 +665,9 @@
686 if (!hasClickOutsideFlag) {
687 return;
688 }
689- QMapIterator<int, QPointer<UCListItem13> > i(expansionList);
690+ QMapIterator<int, QPointer<UCListItem> > i(expansionList);
691 while (i.hasNext()) {
692- UCListItem13 *item = i.next().value().data();
693+ UCListItem *item = i.next().value().data();
694 // using expansion getter we will get the group created
695 if (item && item->expansion()) {
696 UCListItemPrivate *listItem = UCListItemPrivate::get(item);
697
698=== added file 'tests/unit/tst_performance/ListItemList13.qml'
699--- tests/unit/tst_performance/ListItemList13.qml 1970-01-01 00:00:00 +0000
700+++ tests/unit/tst_performance/ListItemList13.qml 2015-09-28 07:37:49 +0000
701@@ -0,0 +1,30 @@
702+/*
703+ * Copyright 2015 Canonical Ltd.
704+ *
705+ * This program is free software; you can redistribute it and/or modify
706+ * it under the terms of the GNU Lesser General Public License as published by
707+ * the Free Software Foundation; version 3.
708+ *
709+ * This program is distributed in the hope that it will be useful,
710+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
711+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
712+ * GNU Lesser General Public License for more details.
713+ *
714+ * You should have received a copy of the GNU Lesser General Public License
715+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
716+ */
717+
718+import QtQuick 2.3
719+import Ubuntu.Components 1.3
720+
721+Column {
722+ width: 800
723+ height: 600
724+ property alias count: repeater.count
725+ Repeater {
726+ id: repeater
727+ model: 5000
728+ ListItem {
729+ }
730+ }
731+}
732
733=== added file 'tests/unit/tst_performance/ListOfCaptions13.qml'
734--- tests/unit/tst_performance/ListOfCaptions13.qml 1970-01-01 00:00:00 +0000
735+++ tests/unit/tst_performance/ListOfCaptions13.qml 2015-09-28 07:37:49 +0000
736@@ -0,0 +1,35 @@
737+/*
738+ * Copyright 2015 Canonical Ltd.
739+ *
740+ * This program is free software; you can redistribute it and/or modify
741+ * it under the terms of the GNU Lesser General Public License as published by
742+ * the Free Software Foundation; version 3.
743+ *
744+ * This program is distributed in the hope that it will be useful,
745+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
746+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
747+ * GNU Lesser General Public License for more details.
748+ *
749+ * You should have received a copy of the GNU Lesser General Public License
750+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
751+ */
752+
753+import QtQuick 2.3
754+import Ubuntu.Components 1.3
755+import QtQuick.Layouts 1.1
756+
757+Column {
758+ width: 800
759+ height: 600
760+ Repeater {
761+ id: repeater
762+ model: 5000
763+ ListItem {
764+ RowLayout {
765+ anchors.fill: parent
766+ Captions {
767+ }
768+ }
769+ }
770+ }
771+}
772
773=== modified file 'tests/unit/tst_performance/StyledItemNewTheming.qml'
774--- tests/unit/tst_performance/StyledItemNewTheming.qml 2015-04-01 08:33:53 +0000
775+++ tests/unit/tst_performance/StyledItemNewTheming.qml 2015-09-28 07:37:49 +0000
776@@ -15,7 +15,7 @@
777 */
778
779 import QtQuick 2.4
780-import Ubuntu.Components 1.2
781+import Ubuntu.Components 1.3
782
783 StyledItem {
784 id: component1
785
786=== modified file 'tests/unit/tst_performance/tst_performance.cpp'
787--- tests/unit/tst_performance/tst_performance.cpp 2015-09-22 14:39:47 +0000
788+++ tests/unit/tst_performance/tst_performance.cpp 2015-09-28 07:37:49 +0000
789@@ -114,9 +114,11 @@
790 QTest::newRow("grid with Slider") << "SliderGrid.qml" << QUrl();
791 QTest::newRow("list with QtQuick Item") << "ItemList.qml" << QUrl();
792 QTest::newRow("list with new ListItem") << "ListItemList.qml" << QUrl();
793+ QTest::newRow("list with new ListItem 1.3") << "ListItemList13.qml" << QUrl();
794 QTest::newRow("list with new ListItem with actions") << "ListItemWithActionsList.qml" << QUrl();
795 QTest::newRow("list with new ListItem with inline actions") << "ListItemWithInlineActionsList.qml" << QUrl();
796 QTest::newRow("list with Captions, preset: caption") << "ListOfCaptions.qml" << QUrl();
797+ QTest::newRow("list with Captions 1.3, preset: caption") << "ListOfCaptions13.qml" << QUrl();
798 QTest::newRow("list with ListItems.Empty (equivalent to the new ListItem") << "ListItemsEmptyList.qml" << QUrl();
799 // disable this test as it takes >20 seconds. Kept still for measurements to be done during development
800 // QTest::newRow("list with ListItems.Base (one icon, one label and one chevron)") << "ListItemsBaseList.qml" << QUrl();
801
802=== modified file 'tests/unit/tst_performance/tst_performance.pro'
803--- tests/unit/tst_performance/tst_performance.pro 2015-09-06 17:59:49 +0000
804+++ tests/unit/tst_performance/tst_performance.pro 2015-09-28 07:37:49 +0000
805@@ -33,4 +33,6 @@
806 StyledItemNewTheming.qml \
807 AbstractButtonGrid.qml \
808 AbstractButton13Grid.qml \
809- LabelGrid13.qml
810+ LabelGrid13.qml \
811+ ListOfCaptions13.qml \
812+ ListItemList13.qml

Subscribers

People subscribed via source and target branches