on xenial help sign in
Merge from trunk
1263a72Michael Terry
Components/ApplicationManagerWrapper.qml+8−1
@@ -121,9 +121,16 @@ Item {
121 desktopFile = "/usr/share/applications/share-app.desktop"
121 desktopFile = "/usr/share/applications/share-app.desktop"
122 } else if (favoriteApplication == ApplicationManager.BrowserApplication) {
122 } else if (favoriteApplication == ApplicationManager.BrowserApplication) {
123 desktopFile = "/usr/share/applications/webbrowser-app.desktop"
123 desktopFile = "/usr/share/applications/webbrowser-app.desktop"
124− } else if (favoriteApplication == 4) { // ApplicationManager.PhoneApplication
124+ } else if (favoriteApplication == ApplicationManager.PhoneApplication) {
125 desktopFile = "/usr/share/applications/phone-app.desktop"
125 desktopFile = "/usr/share/applications/phone-app.desktop"
126+ } else if (favoriteApplication == ApplicationManager.DialerApplication) {
127+ desktopFile = "/usr/share/applications/dialer-app.desktop"
128+ } else if (favoriteApplication == ApplicationManager.MessagingApplication) {
129+ desktopFile = "/usr/share/applications/messaging-app.desktop"
130+ } else if (favoriteApplication == ApplicationManager.AddressbookApplication) {
131+ desktopFile = "/usr/share/applications/address-book-app.desktop"
126 }
132 }
133+
127 applicationManager.focusRequested(desktopFile);
134 applicationManager.focusRequested(desktopFile);
128 }
135 }
129 }
136 }
Dash/DashApps.qml+1−1
@@ -87,7 +87,7 @@ ScopeView {
87 model: scopeView.scope.categories
87 model: scopeView.scope.categories
88
88
89 delegate: Item {
89 delegate: Item {
90− Component.onCompleted: if (id == "installed") scopeView.installedModel = Qt.binding(function() { return model.results; });
90+ Component.onCompleted: if (categoryId == "installed") scopeView.installedModel = Qt.binding(function() { return model.results; });
91 }
91 }
92 }
92 }
93
93
Dash/DashMusic.qml+2−2
@@ -52,7 +52,7 @@ ScopeView {
52
52
53 function getRenderer(categoryId) {
53 function getRenderer(categoryId) {
54 switch (categoryId) {
54 switch (categoryId) {
55− case 1: return "Music/MusicCarousel.qml"
55+ case "featured": return "Music/MusicCarousel.qml"
56 default: return "Music/MusicFilterGrid.qml"
56 default: return "Music/MusicFilterGrid.qml"
57 }
57 }
58 }
58 }
@@ -69,7 +69,7 @@ ScopeView {
69 id: base
69 id: base
70 highlightWhenPressed: false
70 highlightWhenPressed: false
71
71
72− property int categoryId: id
72+ property string categoryId: model.categoryId
73
73
74 Loader {
74 Loader {
75 anchors { top: parent.top; left: parent.left; right: parent.right }
75 anchors { top: parent.top; left: parent.left; right: parent.right }
Dash/DashVideos.qml+2−3
@@ -53,7 +53,7 @@ ScopeView {
53
53
54 function getRenderer(categoryId) {
54 function getRenderer(categoryId) {
55 switch (categoryId) {
55 switch (categoryId) {
56− case 1: return "Video/VideosCarousel.qml"
56+ case "featured": return "Video/VideosCarousel.qml"
57 default: return "Video/VideosFilterGrid.qml"
57 default: return "Video/VideosFilterGrid.qml"
58 }
58 }
59 }
59 }
@@ -102,8 +102,7 @@ ScopeView {
102 delegate: ListItems.Base {
102 delegate: ListItems.Base {
103 id: base
103 id: base
104 highlightWhenPressed: false
104 highlightWhenPressed: false
105− property int categoryIndex: index
105+ property string categoryId: model.categoryId
106− property int categoryId: id
107
106
108 Loader {
107 Loader {
109 id: loader
108 id: loader
debian/changelog+25
@@ -1,3 +1,28 @@
1+unity8 (7.81.3+13.10.20130729ubuntu.unity.next-0ubuntu1) saucy; urgency=low
2+
3+ [ Michal Hruby ]
4+ * Remove the variant conversions methods as they were moved to dee-qt.
5+
6+ [ Michał Sawicz ]
7+ * Re-enable passphrase tests under UInput.
8+ * Use the new string categoryIds in custom video and music scope
9+ views. (LP: #1199322)
10+
11+ [ Nick Dedekind ]
12+ * Behavioural changes for indicators - Part 1 - Use standard
13+ animations. - Search bar animation less distracting. - Hinting
14+ animation shows header. - Vertical velocity detector to reduce
15+ accidental menu switches in dragging phase.
16+
17+ [ Gustavo Pichorim Boiko ]
18+ * Add entries to the new applications resulted from the split of the
19+ phone-app.
20+
21+ [ Ubuntu daily release ]
22+ * Automatic snapshot from revision 141 (ubuntu-unity/next)
23+
24+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Mon, 29 Jul 2013 03:41:07 +0000
25+
1unity8 (7.81.3+13.10.20130726ubuntu.unity.next-0ubuntu1) saucy; urgency=low
26unity8 (7.81.3+13.10.20130726ubuntu.unity.next-0ubuntu1) saucy; urgency=low
2
27
3 [ Michal Hruby ]
28 [ Michal Hruby ]
debian/control+1−1
@@ -4,7 +4,7 @@ Priority: optional
4Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
4Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
5Build-Depends: cmake,
5Build-Depends: cmake,
6 debhelper (>= 9),
6 debhelper (>= 9),
7− libdee-qt5-dev (>= 3.0),
7+ libdee-qt5-dev (>= 3.2),
8 libgl1-mesa-dev[!armhf] | libgl-dev[!armhf],
8 libgl1-mesa-dev[!armhf] | libgl-dev[!armhf],
9 libgl1-mesa-dri,
9 libgl1-mesa-dri,
10 libgles2-mesa-dev[armhf],
10 libgles2-mesa-dev[armhf],
plugins/ListViewWithPageHeader/CMakeLists.txt+5−1
@@ -4,7 +4,11 @@ include(Plugins)
4# There's no cmake var for v8 include path :-/
4# There's no cmake var for v8 include path :-/
5# so create one
5# so create one
6LIST(GET Qt5Core_INCLUDE_DIRS 0 QtCoreDir0)
6LIST(GET Qt5Core_INCLUDE_DIRS 0 QtCoreDir0)
7+if(${Qt5Core_VERSION_STRING} VERSION_LESS "5.1.0")
7−SET(Qt5V8_PRIVATE_INCLUDE_DIR ${QtCoreDir0}/../QtV8/${Qt5Core_VERSION_STRING}/QtV8)
8+ SET(Qt5V8_PRIVATE_INCLUDE_DIR ${QtCoreDir0}/../QtV8/${Qt5Core_VERSION_STRING}/QtV8)
9+else()
10+ SET(Qt5V8_PRIVATE_INCLUDE_DIR ${QtCoreDir0}/QtV8/${Qt5Core_VERSION_STRING}/QtV8)
11+endif()
8
12
9include_directories(
13include_directories(
10 ${CMAKE_CURRENT_SOURCE_DIR}
14 ${CMAKE_CURRENT_SOURCE_DIR}
plugins/ListViewWithPageHeader/listviewwithpageheader.cpp+62
@@ -96,7 +96,11 @@
96#include <qqmlengine.h>
96#include <qqmlengine.h>
97#pragma GCC diagnostic push
97#pragma GCC diagnostic push
98#pragma GCC diagnostic ignored "-pedantic"
98#pragma GCC diagnostic ignored "-pedantic"
99+#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
99#include <private/qquickvisualdatamodel_p.h>
100#include <private/qquickvisualdatamodel_p.h>
101+#else
102+#include <private/qqmldelegatemodel_p.h>
103+#endif
100#include <private/qqmlglobal_p.h>
104#include <private/qqmlglobal_p.h>
101#include <private/qquickitem_p.h>
105#include <private/qquickitem_p.h>
102#include <private/qquickanimation_p.h>
106#include <private/qquickanimation_p.h>
@@ -183,10 +187,17 @@ void ListViewWithPageHeader::setModel(QAbstractItemModel *model)
183 if (!m_delegateModel) {
187 if (!m_delegateModel) {
184 createDelegateModel();
188 createDelegateModel();
185 } else {
189 } else {
190+#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
186 disconnect(m_delegateModel, SIGNAL(modelUpdated(QQuickChangeSet,bool)), this, SLOT(onModelUpdated(QQuickChangeSet,bool)));
191 disconnect(m_delegateModel, SIGNAL(modelUpdated(QQuickChangeSet,bool)), this, SLOT(onModelUpdated(QQuickChangeSet,bool)));
187 }
192 }
188 m_delegateModel->setModel(QVariant::fromValue<QAbstractItemModel *>(model));
193 m_delegateModel->setModel(QVariant::fromValue<QAbstractItemModel *>(model));
189 connect(m_delegateModel, SIGNAL(modelUpdated(QQuickChangeSet,bool)), this, SLOT(onModelUpdated(QQuickChangeSet,bool)));
194 connect(m_delegateModel, SIGNAL(modelUpdated(QQuickChangeSet,bool)), this, SLOT(onModelUpdated(QQuickChangeSet,bool)));
195+#else
196+ disconnect(m_delegateModel, SIGNAL(modelUpdated(QQmlChangeSet,bool)), this, SLOT(onModelUpdated(QQmlChangeSet,bool)));
197+ }
198+ m_delegateModel->setModel(QVariant::fromValue<QAbstractItemModel *>(model));
199+ connect(m_delegateModel, SIGNAL(modelUpdated(QQmlChangeSet,bool)), this, SLOT(onModelUpdated(QQmlChangeSet,bool)));
200+#endif
190 Q_EMIT modelChanged();
201 Q_EMIT modelChanged();
191 // TODO?
202 // TODO?
192// Q_EMIT contentHeightChanged();
203// Q_EMIT contentHeightChanged();
@@ -446,8 +457,13 @@ void ListViewWithPageHeader::viewportMoved(Qt::Orientations orient)
446
457
447void ListViewWithPageHeader::createDelegateModel()
458void ListViewWithPageHeader::createDelegateModel()
448{
459{
460+#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
449 m_delegateModel = new QQuickVisualDataModel(qmlContext(this), this);
461 m_delegateModel = new QQuickVisualDataModel(qmlContext(this), this);
450 connect(m_delegateModel, SIGNAL(createdItem(int,QQuickItem*)), this, SLOT(itemCreated(int,QQuickItem*)));
462 connect(m_delegateModel, SIGNAL(createdItem(int,QQuickItem*)), this, SLOT(itemCreated(int,QQuickItem*)));
463+#else
464+ m_delegateModel = new QQmlDelegateModel(qmlContext(this), this);
465+ connect(m_delegateModel, SIGNAL(createdItem(int,QObject*)), this, SLOT(itemCreated(int,QObject*)));
466+#endif
451 if (isComponentComplete())
467 if (isComponentComplete())
452 m_delegateModel->componentComplete();
468 m_delegateModel->componentComplete();
453 updateWatchedRoles();
469 updateWatchedRoles();
@@ -528,8 +544,13 @@ bool ListViewWithPageHeader::addVisibleItems(qreal fillFrom, qreal fillTo, bool
528void ListViewWithPageHeader::reallyReleaseItem(ListItem *listItem)
544void ListViewWithPageHeader::reallyReleaseItem(ListItem *listItem)
529{
545{
530 QQuickItem *item = listItem->m_item;
546 QQuickItem *item = listItem->m_item;
547+#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
531 QQuickVisualModel::ReleaseFlags flags = m_delegateModel->release(item);
548 QQuickVisualModel::ReleaseFlags flags = m_delegateModel->release(item);
532 if (flags & QQuickVisualModel::Destroyed) {
549 if (flags & QQuickVisualModel::Destroyed) {
550+#else
551+ QQmlDelegateModel::ReleaseFlags flags = m_delegateModel->release(item);
552+ if (flags & QQmlDelegateModel::Destroyed) {
553+#endif
533 item->setParentItem(nullptr);
554 item->setParentItem(nullptr);
534 }
555 }
535 delete listItem->m_sectionItem;
556 delete listItem->m_sectionItem;
@@ -658,9 +679,27 @@ ListViewWithPageHeader::ListItem *ListViewWithPageHeader::createItem(int modelIn
658 return nullptr;
679 return nullptr;
659
680
660 m_asyncRequestedIndex = -1;
681 m_asyncRequestedIndex = -1;
682+#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
661 QQuickItem *item = m_delegateModel->item(modelIndex, asynchronous);
683 QQuickItem *item = m_delegateModel->item(modelIndex, asynchronous);
684+#else
685+ QObject* object = m_delegateModel->object(modelIndex, asynchronous);
686+ QQuickItem *item = qmlobject_cast<QQuickItem*>(object);
687+#endif
662 if (!item) {
688 if (!item) {
689+#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
663 m_asyncRequestedIndex = modelIndex;
690 m_asyncRequestedIndex = modelIndex;
691+#else
692+ if (object) {
693+ m_delegateModel->release(object);
694+ if (!m_delegateValidated) {
695+ m_delegateValidated = true;
696+ QObject* delegateObj = delegate();
697+ qmlInfo(delegateObj ? delegateObj : this) << "Delegate must be of Item type";
698+ }
699+ } else {
700+ m_asyncRequestedIndex = modelIndex;
701+ }
702+#endif
664 return 0;
703 return 0;
665 } else {
704 } else {
666// qDebug() << "ListViewWithPageHeader::createItem::We have the item" << modelIndex << item;
705// qDebug() << "ListViewWithPageHeader::createItem::We have the item" << modelIndex << item;
@@ -711,8 +750,18 @@ ListViewWithPageHeader::ListItem *ListViewWithPageHeader::createItem(int modelIn
711 }
750 }
712}
751}
713
752
753+#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
714void ListViewWithPageHeader::itemCreated(int modelIndex, QQuickItem *item)
754void ListViewWithPageHeader::itemCreated(int modelIndex, QQuickItem *item)
715{
755{
756+#else
757+void ListViewWithPageHeader::itemCreated(int modelIndex, QObject *object)
758+{
759+ QQuickItem *item = qmlobject_cast<QQuickItem*>(object);
760+ if (!item) {
761+ qWarning() << "ListViewWithPageHeader::itemCreated got a non item for index" << modelIndex;
762+ return;
763+ }
764+#endif
716// qDebug() << "ListViewWithPageHeader::itemCreated" << modelIndex << item;
765// qDebug() << "ListViewWithPageHeader::itemCreated" << modelIndex << item;
717
766
718 item->setParentItem(m_clipItem);
767 item->setParentItem(m_clipItem);
@@ -747,13 +796,22 @@ void ListViewWithPageHeader::onHeightChanged()
747 polish();
796 polish();
748}
797}
749
798
799+
800+#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
750void ListViewWithPageHeader::onModelUpdated(const QQuickChangeSet &changeSet, bool /*reset*/)
801void ListViewWithPageHeader::onModelUpdated(const QQuickChangeSet &changeSet, bool /*reset*/)
802+#else
803+void ListViewWithPageHeader::onModelUpdated(const QQmlChangeSet &changeSet, bool /*reset*/)
804+#endif
751{
805{
752 // TODO Do something with reset
806 // TODO Do something with reset
753// qDebug() << "ListViewWithPageHeader::onModelUpdated" << changeSet << reset;
807// qDebug() << "ListViewWithPageHeader::onModelUpdated" << changeSet << reset;
754 const auto oldFirstVisibleIndex = m_firstVisibleIndex;
808 const auto oldFirstVisibleIndex = m_firstVisibleIndex;
755
809
810+#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
756 Q_FOREACH(const QQuickChangeSet::Remove &remove, changeSet.removes()) {
811 Q_FOREACH(const QQuickChangeSet::Remove &remove, changeSet.removes()) {
812+#else
813+ Q_FOREACH(const QQmlChangeSet::Remove &remove, changeSet.removes()) {
814+#endif
757// qDebug() << "ListViewWithPageHeader::onModelUpdated Remove" << remove.index << remove.count;
815// qDebug() << "ListViewWithPageHeader::onModelUpdated Remove" << remove.index << remove.count;
758 if (remove.index + remove.count > m_firstVisibleIndex && remove.index < m_firstVisibleIndex + m_visibleItems.count()) {
816 if (remove.index + remove.count > m_firstVisibleIndex && remove.index < m_firstVisibleIndex + m_visibleItems.count()) {
759 const qreal oldFirstValidIndexPos = m_visibleItems.first()->y();
817 const qreal oldFirstValidIndexPos = m_visibleItems.first()->y();
@@ -807,7 +865,11 @@ void ListViewWithPageHeader::onModelUpdated(const QQuickChangeSet &changeSet, bo
807 }
865 }
808 }
866 }
809
867
868+#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
810 Q_FOREACH(const QQuickChangeSet::Insert &insert, changeSet.inserts()) {
869 Q_FOREACH(const QQuickChangeSet::Insert &insert, changeSet.inserts()) {
870+#else
871+ Q_FOREACH(const QQmlChangeSet::Insert &insert, changeSet.inserts()) {
872+#endif
811// qDebug() << "ListViewWithPageHeader::onModelUpdated Insert" << insert.index << insert.count;
873// qDebug() << "ListViewWithPageHeader::onModelUpdated Insert" << insert.index << insert.count;
812 const bool insertingInValidIndexes = insert.index > m_firstVisibleIndex && insert.index < m_firstVisibleIndex + m_visibleItems.count();
874 const bool insertingInValidIndexes = insert.index > m_firstVisibleIndex && insert.index < m_firstVisibleIndex + m_visibleItems.count();
813 const bool firstItemWithViewOnTop = insert.index == 0 && m_firstVisibleIndex == 0 && m_visibleItems.first()->y() + m_clipItem->y() > contentY();
875 const bool firstItemWithViewOnTop = insert.index == 0 && m_firstVisibleIndex == 0 && m_visibleItems.first()->y() + m_clipItem->y() > contentY();
plugins/ListViewWithPageHeader/listviewwithpageheader.h+18−1
@@ -24,9 +24,14 @@
24#pragma GCC diagnostic pop
24#pragma GCC diagnostic pop
25
25
26class QAbstractItemModel;
26class QAbstractItemModel;
27−class QQuickChangeSet;
28class QQuickNumberAnimation;
27class QQuickNumberAnimation;
28+#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
29+class QQuickChangeSet;
29class QQuickVisualDataModel;
30class QQuickVisualDataModel;
31+#else
32+class QQmlChangeSet;
33+class QQmlDelegateModel;
34+#endif
30
35
31
36
32/**
37/**
@@ -100,11 +105,19 @@ protected:
100 void updatePolish();
105 void updatePolish();
101
106
102private Q_SLOTS:
107private Q_SLOTS:
108+#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
103 void itemCreated(int modelIndex, QQuickItem *item);
109 void itemCreated(int modelIndex, QQuickItem *item);
110+#else
111+ void itemCreated(int modelIndex, QObject *object);
112+#endif
104 void onContentHeightChanged();
113 void onContentHeightChanged();
105 void onContentWidthChanged();
114 void onContentWidthChanged();
106 void onHeightChanged();
115 void onHeightChanged();
116+#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
107 void onModelUpdated(const QQuickChangeSet &changeSet, bool reset);
117 void onModelUpdated(const QQuickChangeSet &changeSet, bool reset);
118+#else
119+ void onModelUpdated(const QQmlChangeSet &changeSet, bool reset);
120+#endif
108 void onShowHeaderAnimationFinished();
121 void onShowHeaderAnimationFinished();
109
122
110private:
123private:
@@ -141,7 +154,11 @@ private:
141 QQuickItem *getSectionItem(int modelIndex, bool alreadyInserted);
154 QQuickItem *getSectionItem(int modelIndex, bool alreadyInserted);
142 QQuickItem *getSectionItem(const QString &sectionText);
155 QQuickItem *getSectionItem(const QString &sectionText);
143
156
157+#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
144 QQuickVisualDataModel *m_delegateModel;
158 QQuickVisualDataModel *m_delegateModel;
159+#else
160+ QQmlDelegateModel *m_delegateModel;
161+#endif
145
162
146 // Index we are waiting because we requested it asynchronously
163 // Index we are waiting because we requested it asynchronously
147 int m_asyncRequestedIndex;
164 int m_asyncRequestedIndex;
plugins/Unity/CMakeLists.txt+1−1
@@ -5,7 +5,7 @@ add_subdirectory(Indicators)
5
5
6# Dependencies
6# Dependencies
7include(FindPkgConfig)
7include(FindPkgConfig)
8−pkg_check_modules(QTDEE REQUIRED libdee-qt5)
8+pkg_check_modules(QTDEE REQUIRED libdee-qt5>=3.2)
9pkg_check_modules(UNITYCORE REQUIRED unity-core-6.0)
9pkg_check_modules(UNITYCORE REQUIRED unity-core-6.0)
10
10
11include_directories(
11include_directories(
plugins/Unity/categories.cpp+2−2
@@ -34,7 +34,7 @@ enum CategoryColumn {
34Categories::Categories(QObject* parent)
34Categories::Categories(QObject* parent)
35 : DeeListModel(parent)
35 : DeeListModel(parent)
36{
36{
37− m_roles[Categories::RoleId] = "id";
37+ m_roles[Categories::RoleCategoryId] = "categoryId";
38 m_roles[Categories::RoleName] = "name";
38 m_roles[Categories::RoleName] = "name";
39 m_roles[Categories::RoleIcon] = "icon";
39 m_roles[Categories::RoleIcon] = "icon";
40 m_roles[Categories::RoleRenderer] = "renderer";
40 m_roles[Categories::RoleRenderer] = "renderer";
@@ -131,7 +131,7 @@ Categories::data(const QModelIndex& index, int role) const
131 }
131 }
132
132
133 switch (role) {
133 switch (role) {
134− case RoleId:
134+ case RoleCategoryId:
135 return DeeListModel::data(index, CategoryColumn::ID);
135 return DeeListModel::data(index, CategoryColumn::ID);
136 case RoleName:
136 case RoleName:
137 return DeeListModel::data(index, CategoryColumn::DISPLAY_NAME);
137 return DeeListModel::data(index, CategoryColumn::DISPLAY_NAME);
plugins/Unity/categories.h+1−1
@@ -42,7 +42,7 @@ public:
42 explicit Categories(QObject* parent = 0);
42 explicit Categories(QObject* parent = 0);
43
43
44 enum Roles {
44 enum Roles {
45− RoleId,
45+ RoleCategoryId,
46 RoleName,
46 RoleName,
47 RoleIcon,
47 RoleIcon,
48 RoleRenderer,
48 RoleRenderer,
plugins/Unity/previewinfohint.cpp+2−2
@@ -17,9 +17,9 @@
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
18 */
19
19
20+#include <deelistmodel.h>
20// local
21// local
21#include "previewinfohint.h"
22#include "previewinfohint.h"
22−#include "variantutils.h"
23
23
24PreviewInfoHint::PreviewInfoHint(QObject *parent):
24PreviewInfoHint::PreviewInfoHint(QObject *parent):
25 QObject(parent),
25 QObject(parent),
@@ -61,7 +61,7 @@ QString PreviewInfoHint::iconHint() const
61QVariant PreviewInfoHint::value() const
61QVariant PreviewInfoHint::value() const
62{
62{
63 if (m_unityInfoHint) {
63 if (m_unityInfoHint) {
64− return QVariantFromGVariant(m_unityInfoHint->value);
64+ return DeeListModel::VariantForData(m_unityInfoHint->value);
65 }
65 }
66 return QVariant();
66 return QVariant();
67}
67}
plugins/Unity/variantutils.cpp+2−118
@@ -17,131 +17,15 @@
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
18 */
19
19
20+#include <deelistmodel.h>
20#include "variantutils.h"
21#include "variantutils.h"
21
22
22−/* Returns floating ref */
23−GVariant* GVariantFromQVariant(const QVariant &var)
24−{
25− GVariant *gv = nullptr;
26−
27− switch (var.type()) {
28− case QVariant::String:
29− gv = g_variant_new_string(var.toString().toUtf8());
30− break;
31− case QVariant::UInt:
32− gv = g_variant_new_uint32(var.toUInt());
33− break;
34− case QVariant::Int:
35− gv = g_variant_new_int32(var.toInt());
36− break;
37− case QVariant::LongLong:
38− gv = g_variant_new_int64(var.toLongLong());
39− break;
40− case QVariant::ULongLong:
41− gv = g_variant_new_uint64(var.toULongLong());
42− break;
43− case QVariant::Double:
44− gv = g_variant_new_double(var.toDouble());
45− break;
46− case QVariant::Bool:
47− gv = g_variant_new_boolean(var.toBool());
48− break;
49− case QVariant::Hash: {
50− const auto hash = var.toHash();
51− GVariant **children = new GVariant*[hash.size()];
52− int cnt = 0;
53− QHash<QString, QVariant>::const_iterator it = hash.constBegin();
54− while (it != hash.constEnd()) {
55− GVariant *key = g_variant_new_string(it.key().toUtf8());
56− children[cnt++] = g_variant_new_dict_entry(key, g_variant_new_variant(GVariantFromQVariant(it.value())));
57− ++it;
58− }
59− gv = g_variant_new_array(G_VARIANT_TYPE("{sv}"), children, hash.size());
60− delete [] children;
61− break;
62− }
63− default:
64− break;
65− }
66− return gv;
67−}
68−
69−// implementation of this conversion taken from libdee-qt private utility function.
70−QVariant QVariantFromGVariant(GVariant *value)
71−{
72− /* We need to special-case a{sv} here as G_VARIANT_CLASS_ARRAY handles simple arrays;
73− we need to create QVariantHash, not a list */
74− if (g_variant_is_of_type(value, G_VARIANT_TYPE_VARDICT)) {
75− const gsize nChildren = g_variant_n_children(value);
76− QVariantHash hash;
77− for (gsize i = 0; i < nChildren; ++i)
78− {
79− GVariant* dict_entry = g_variant_get_child_value(value, i);
80−
81− gchar* dict_key;
82− GVariant *dict_var;
83− g_variant_get(dict_entry, "{&sv}", &dict_key, &dict_var);
84− hash.insert(QString::fromUtf8(dict_key), QVariantFromGVariant(dict_var));
85− g_variant_unref(dict_var);
86− g_variant_unref(dict_entry);
87− }
88− return hash;
89− }
90−
91− switch (g_variant_classify(value)) {
92− case G_VARIANT_CLASS_BOOLEAN:
93− return QVariant((bool) g_variant_get_boolean(value));
94− case G_VARIANT_CLASS_BYTE:
95− return QVariant((uchar) g_variant_get_byte(value));
96− case G_VARIANT_CLASS_INT16:
97− return QVariant((qint16) g_variant_get_int16(value));
98− case G_VARIANT_CLASS_UINT16:
99− return QVariant((quint16) g_variant_get_uint16(value));
100− case G_VARIANT_CLASS_INT32:
101− return QVariant((qint32) g_variant_get_int32(value));
102− case G_VARIANT_CLASS_UINT32:
103− return QVariant((quint32) g_variant_get_uint32(value));
104− case G_VARIANT_CLASS_INT64:
105− return QVariant((qint64) g_variant_get_int64(value));
106− case G_VARIANT_CLASS_UINT64:
107− return QVariant((quint64) g_variant_get_uint64(value));
108− case G_VARIANT_CLASS_DOUBLE:
109− return QVariant(g_variant_get_double(value));
110− case G_VARIANT_CLASS_STRING:
111− return QVariant(QString::fromUtf8(g_variant_get_string(value, NULL)));
112− case G_VARIANT_CLASS_ARRAY:
113− case G_VARIANT_CLASS_TUPLE:
114− {
115− const gsize nChildren = g_variant_n_children(value);
116− QList<QVariant> array;
117− for (gsize i = 0; i < nChildren; ++i)
118− {
119− GVariant* gvariant = g_variant_get_child_value(value, i);
120− array << QVariantFromGVariant(gvariant);
121− g_variant_unref(gvariant);
122− }
123− return array;
124− }
125− default:
126− /* Fallback on an empty QVariant.
127− FIXME: Missing conversion of following GVariant types:
128− - G_VARIANT_CLASS_HANDLE
129− - G_VARIANT_CLASS_OBJECT_PATH
130− - G_VARIANT_CLASS_SIGNATURE
131− - G_VARIANT_CLASS_VARIANT
132− - G_VARIANT_CLASS_MAYBE
133− - G_VARIANT_CLASS_DICT_ENTRY
134− */
135− return QVariant();
136− }
137−}
138−
139unity::glib::HintsMap convertToHintsMap(const QHash<QString, QVariant> &val)
23unity::glib::HintsMap convertToHintsMap(const QHash<QString, QVariant> &val)
140{
24{
141 unity::glib::HintsMap hintsMap;
25 unity::glib::HintsMap hintsMap;
142 QHash<QString, QVariant>::const_iterator it = val.constBegin();
26 QHash<QString, QVariant>::const_iterator it = val.constBegin();
143 while (it != val.constEnd()) {
27 while (it != val.constEnd()) {
144− hintsMap[it.key().toStdString()] = GVariantFromQVariant(it.value());
28+ hintsMap[it.key().toStdString()] = DeeListModel::DataFromVariant(it.value());
145 ++it;
29 ++it;
146 }
30 }
147 return hintsMap;
31 return hintsMap;
plugins/Unity/variantutils.h−2
@@ -26,8 +26,6 @@
26// libunity-core
26// libunity-core
27#include <UnityCore/Variant.h>
27#include <UnityCore/Variant.h>
28
28
29−GVariant* GVariantFromQVariant(const QVariant &value);
30−QVariant QVariantFromGVariant(GVariant *value);
31unity::glib::HintsMap convertToHintsMap(const QHash<QString, QVariant> &val);
29unity::glib::HintsMap convertToHintsMap(const QHash<QString, QVariant> &val);
32unity::glib::HintsMap convertToHintsMap(const QVariant &var);
30unity::glib::HintsMap convertToHintsMap(const QVariant &var);
33
31
tests/plugins/ListViewWithPageHeader/CMakeLists.txt+6−1
@@ -1,7 +1,12 @@
1# There's no cmake var for v8 include path :-/
1# There's no cmake var for v8 include path :-/
2# so create one
2# so create one
3LIST(GET Qt5Core_INCLUDE_DIRS 0 QtCoreDir0)
3LIST(GET Qt5Core_INCLUDE_DIRS 0 QtCoreDir0)
4+if(${Qt5Core_VERSION_STRING} VERSION_LESS "5.1.0")
4−SET(Qt5V8_PRIVATE_INCLUDE_DIR ${QtCoreDir0}/../QtV8/${Qt5Core_VERSION_STRING}/QtV8)
5+ SET(Qt5V8_PRIVATE_INCLUDE_DIR ${QtCoreDir0}/../QtV8/${Qt5Core_VERSION_STRING}/QtV8)
6+else()
7+ SET(Qt5V8_PRIVATE_INCLUDE_DIR ${QtCoreDir0}/QtV8/${Qt5Core_VERSION_STRING}/QtV8)
8+endif()
9+
5
10
6include_directories(
11include_directories(
7 ${Qt5Qml_PRIVATE_INCLUDE_DIRS}
12 ${Qt5Qml_PRIVATE_INCLUDE_DIRS}
tests/plugins/ListViewWithPageHeader/listviewwithpageheadertest.cpp+12
@@ -22,7 +22,11 @@
22#include <QtTestGui>
22#include <QtTestGui>
23#pragma GCC diagnostic push
23#pragma GCC diagnostic push
24#pragma GCC diagnostic ignored "-pedantic"
24#pragma GCC diagnostic ignored "-pedantic"
25+#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
25#include <private/qquicklistmodel_p.h>
26#include <private/qquicklistmodel_p.h>
27+#else
28+#include <private/qqmllistmodel_p.h>
29+#endif
26#include <private/qquickanimation_p.h>
30#include <private/qquickanimation_p.h>
27#include <private/qquickitem_p.h>
31#include <private/qquickitem_p.h>
28#pragma GCC diagnostic pop
32#pragma GCC diagnostic pop
@@ -115,7 +119,11 @@ private Q_SLOTS:
115 view->engine()->addImportPath(BUILT_PLUGINS_DIR);
119 view->engine()->addImportPath(BUILT_PLUGINS_DIR);
116 view->setSource(QUrl::fromLocalFile(LISTVIEWWITHPAGEHEADER_FOLDER "/test.qml"));
120 view->setSource(QUrl::fromLocalFile(LISTVIEWWITHPAGEHEADER_FOLDER "/test.qml"));
117 lvwph = dynamic_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
121 lvwph = dynamic_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
122+#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
118 model = view->rootObject()->findChild<QQuickListModel*>();
123 model = view->rootObject()->findChild<QQuickListModel*>();
124+#else
125+ model = view->rootObject()->findChild<QQmlListModel*>();
126+#endif
119 otherDelegate = view->rootObject()->findChild<QQmlComponent*>();
127 otherDelegate = view->rootObject()->findChild<QQmlComponent*>();
120 QVERIFY(lvwph);
128 QVERIFY(lvwph);
121 QVERIFY(model);
129 QVERIFY(model);
@@ -1385,7 +1393,11 @@ private Q_SLOTS:
1385private:
1393private:
1386 QQuickView *view;
1394 QQuickView *view;
1387 ListViewWithPageHeader *lvwph;
1395 ListViewWithPageHeader *lvwph;
1396+#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
1388 QQuickListModel *model;
1397 QQuickListModel *model;
1398+#else
1399+ QQmlListModel *model;
1400+#endif
1389 QQmlComponent *otherDelegate;
1401 QQmlComponent *otherDelegate;
1390};
1402};
1391
1403
tests/plugins/ListViewWithPageHeader/listviewwithpageheadertestsection.cpp+12
@@ -22,7 +22,11 @@
22#include <QtTestGui>
22#include <QtTestGui>
23#pragma GCC diagnostic push
23#pragma GCC diagnostic push
24#pragma GCC diagnostic ignored "-pedantic"
24#pragma GCC diagnostic ignored "-pedantic"
25+#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
25#include <private/qquicklistmodel_p.h>
26#include <private/qquicklistmodel_p.h>
27+#else
28+#include <private/qqmllistmodel_p.h>
29+#endif
26#include <private/qquickanimation_p.h>
30#include <private/qquickanimation_p.h>
27#include <private/qquickitem_p.h>
31#include <private/qquickitem_p.h>
28#pragma GCC diagnostic pop
32#pragma GCC diagnostic pop
@@ -124,7 +128,11 @@ private Q_SLOTS:
124 view->engine()->addImportPath(BUILT_PLUGINS_DIR);
128 view->engine()->addImportPath(BUILT_PLUGINS_DIR);
125 view->setSource(QUrl::fromLocalFile(LISTVIEWWITHPAGEHEADER_FOLDER "/test_section.qml"));
129 view->setSource(QUrl::fromLocalFile(LISTVIEWWITHPAGEHEADER_FOLDER "/test_section.qml"));
126 lvwph = dynamic_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
130 lvwph = dynamic_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
131+#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
127 model = view->rootObject()->findChild<QQuickListModel*>();
132 model = view->rootObject()->findChild<QQuickListModel*>();
133+#else
134+ model = view->rootObject()->findChild<QQmlListModel*>();
135+#endif
128 otherDelegate = view->rootObject()->findChild<QQmlComponent*>();
136 otherDelegate = view->rootObject()->findChild<QQmlComponent*>();
129 QVERIFY(lvwph);
137 QVERIFY(lvwph);
130 QVERIFY(model);
138 QVERIFY(model);
@@ -1637,7 +1645,11 @@ private Q_SLOTS:
1637private:
1645private:
1638 QQuickView *view;
1646 QQuickView *view;
1639 ListViewWithPageHeader *lvwph;
1647 ListViewWithPageHeader *lvwph;
1648+#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
1640 QQuickListModel *model;
1649 QQuickListModel *model;
1650+#else
1651+ QQmlListModel *model;
1652+#endif
1641 QQmlComponent *otherDelegate;
1653 QQmlComponent *otherDelegate;
1642};
1654};
1643
1655
tests/plugins/Unity/Indicators/indicatorsmanagertest.cpp+1−1
@@ -134,5 +134,5 @@ private Q_SLOTS:
134 }
134 }
135};
135};
136
136
137−QTEST_MAIN(IndicatorsManagerTest)
137+QTEST_GUILESS_MAIN(IndicatorsManagerTest)
138#include "indicatorsmanagertest.moc"
138#include "indicatorsmanagertest.moc"
tests/plugins/Unity/Indicators/indicatorsmodeltest.cpp+1−1
@@ -97,6 +97,6 @@ private Q_SLOTS:
97 }
97 }
98};
98};
99
99
100−QTEST_MAIN(IndicatorsModelTest)
100+QTEST_GUILESS_MAIN(IndicatorsModelTest)
101
101
102#include "indicatorsmodeltest.moc"
102#include "indicatorsmodeltest.moc"
tests/plugins/Unity/Indicators/menucontentactivatortest.cpp+1−1
@@ -299,5 +299,5 @@ private:
299 QList<int> m_deltas;
299 QList<int> m_deltas;
300};
300};
301
301
302−QTEST_MAIN(MenuConentActivatorTest)
302+QTEST_GUILESS_MAIN(MenuConentActivatorTest)
303#include "menucontentactivatortest.moc"
303#include "menucontentactivatortest.moc"
tests/plugins/Utils/qlimitproxymodeltest.cpp+1−1
@@ -481,6 +481,6 @@ private Q_SLOTS:
481 }
481 }
482};
482};
483
483
484−QTEST_MAIN(QLimitProxyModelTest)
484+QTEST_GUILESS_MAIN(QLimitProxyModelTest)
485
485
486#include "qlimitproxymodeltest.moc"
486#include "qlimitproxymodeltest.moc"
tests/plugins/Utils/qsortfilterproxymodeltest.cpp+1−1
@@ -285,6 +285,6 @@ private Q_SLOTS:
285 }
285 }
286};
286};
287
287
288−QTEST_MAIN(QSortFilterProxyModelTest)
288+QTEST_GUILESS_MAIN(QSortFilterProxyModelTest)
289
289
290#include "qsortfilterproxymodeltest.moc"
290#include "qsortfilterproxymodeltest.moc"