on xenial help sign in
switch launcher plugin to implement the launcher API in unity-api
029cbb7Michael Zanetti
Launcher/Launcher.qml+2−5
@@ -19,6 +19,7 @@ import "../Components"
19import Ubuntu.Components 0.1
19import Ubuntu.Components 0.1
20import Ubuntu.Gestures 0.1
20import Ubuntu.Gestures 0.1
21import Unity 0.1
21import Unity 0.1
22+import Unity.Launcher 0.1
22
23
23Item {
24Item {
24 id: root
25 id: root
@@ -97,10 +98,6 @@ Item {
97 }
98 }
98 }
99 }
99
100
100− LauncherModel {
101− id: launcherModel
102− }
103−
104 MouseArea {
101 MouseArea {
105 id: launcherDragArea
102 id: launcherDragArea
106 enabled: root.state == "visible"
103 enabled: root.state == "visible"
@@ -153,7 +150,7 @@ Item {
153 bottom: parent.bottom
150 bottom: parent.bottom
154 }
151 }
155 x: -width
152 x: -width
156− model: launcherModel
153+ model: LauncherModel
157
154
158 property bool animate: true
155 property bool animate: true
159
156
Launcher/LauncherPanel.qml+2−1
@@ -17,6 +17,7 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import Ubuntu.Components 0.1
18import Ubuntu.Components 0.1
19import Unity 0.1
19import Unity 0.1
20+import Unity.Launcher 0.1
20import "../Components/ListItems"
21import "../Components/ListItems"
21
22
22Item {
23Item {
@@ -139,7 +140,7 @@ Item {
139 maxAngle: 60
140 maxAngle: 60
140
141
141 onClicked: {
142 onClicked: {
142− root.applicationSelected(launcherModel.get(index).desktopFile);
143+ root.applicationSelected(LauncherModel.get(index).desktopFile);
143 }
144 }
144 }
145 }
145
146
plugins/Unity/CMakeLists.txt+4−3
@@ -9,8 +9,6 @@ include_directories(
9 ${QTDEE_INCLUDE_DIRS}
9 ${QTDEE_INCLUDE_DIRS}
10 ${UNITYCORE_INCLUDE_DIRS}
10 ${UNITYCORE_INCLUDE_DIRS}
11 ${Qt5DBus_INCLUDE_DIRS}
11 ${Qt5DBus_INCLUDE_DIRS}
12−#TODO: remove this once unity-api is released to distro
13− /home/mzanetti/Development/unity-api/include
14)
12)
15
13
16set(QMLPLUGIN_SRC
14set(QMLPLUGIN_SRC
@@ -21,7 +19,6 @@ set(QMLPLUGIN_SRC
21 categoryfilter.cpp
19 categoryfilter.cpp
22 plugin.cpp
20 plugin.cpp
23 bottombarvisibilitycommunicatorshell.cpp
21 bottombarvisibilitycommunicatorshell.cpp
24− launchermodel.cpp
25 )
22 )
26
23
27add_library(Unity-qml MODULE
24add_library(Unity-qml MODULE
@@ -49,3 +46,7 @@ install(TARGETS Unity-qml
49install(FILES qmldir
46install(FILES qmldir
50 DESTINATION ${SHELL_APP_DIR}/plugins/Unity
47 DESTINATION ${SHELL_APP_DIR}/plugins/Unity
51 )
48 )
49+
50+
51+add_subdirectory(Launcher)
52+
plugins/Unity/Launcher/CMakeLists.txtnew file+42
@@ -0,0 +1,42 @@
1+# Dependencies
2+include(FindPkgConfig)
3+
4+#TODO: remove this once unity-api is released to distro
5+set(UNITY_API_DIR /home/mzanetti/Development/unity-api/include/)
6+
7+include_directories(
8+ ${CMAKE_CURRENT_SOURCE_DIR}
9+ ${CMAKE_CURRENT_BINARY_DIR}
10+ ${UNITY_API_DIR}
11+)
12+
13+set(QMLLAUNCHERPLUGIN_SRC
14+ plugin.cpp
15+ launchermodel.cpp
16+ launcheritem.cpp
17+ ${UNITY_API_DIR}/unity/shell/launcher/LauncherItemInterface.h
18+ ${UNITY_API_DIR}/unity/shell/launcher/LauncherModelInterface.h
19+ )
20+
21+add_library(UnityLauncher-qml MODULE
22+ ${QMLLAUNCHERPLUGIN_SRC}
23+ )
24+
25+#target_link_libraries(UnityLauncher-qml
26+# ${Qt5Gui_LIBRARIES}
27+# )
28+
29+qt5_use_modules(UnityLauncher-qml Qml)
30+
31+# copy qmldir file into build directory for shadow builds
32+file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/qmldir"
33+ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
34+ )
35+
36+install(TARGETS UnityLauncher-qml
37+ DESTINATION ${SHELL_APP_DIR}/plugins/Unity/Launcher/
38+ )
39+
40+install(FILES qmldir
41+ DESTINATION ${SHELL_APP_DIR}/plugins/Unity/Launcher/
42+ )
plugins/Unity/Launcher/launcheritem.cppnew file+114
@@ -0,0 +1,114 @@
1+/*
2+ * Copyright (C) 2013 Canonical, Ltd.
3+ *
4+ * Authors:
5+ * Michael Zanetti <michael.zanetti@canonical.com>
6+ *
7+ * This program is free software; you can redistribute it and/or modify
8+ * it under the terms of the GNU General Public License as published by
9+ * the Free Software Foundation; version 3.
10+ *
11+ * This program is distributed in the hope that it will be useful,
12+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+ * GNU General Public License for more details.
15+ *
16+ * You should have received a copy of the GNU General Public License
17+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
18+ */
19+
20+#include "launcheritem.h"
21+
22+LauncherItem::LauncherItem(const QString &desktopFile, const QString &name, const QString &icon, QObject *parent) :
23+ LauncherItemInterface(parent),
24+ m_desktopFile(desktopFile),
25+ m_name(name),
26+ m_icon(icon),
27+ m_favorite(false),
28+ m_running(false),
29+ m_recent(false),
30+ m_progress(-1),
31+ m_count(0)
32+{
33+
34+}
35+
36+QString LauncherItem::desktopFile() const
37+{
38+ return m_desktopFile;
39+}
40+
41+QString LauncherItem::name() const
42+{
43+ return m_name;
44+}
45+
46+QString LauncherItem::icon() const
47+{
48+ return m_icon;
49+}
50+
51+bool LauncherItem::favorite() const
52+{
53+ return m_favorite;
54+}
55+
56+void LauncherItem::setFavorite(bool favorite)
57+{
58+ if (m_favorite != favorite) {
59+ m_favorite = favorite;
60+ Q_EMIT favoriteChanged(favorite);
61+ }
62+}
63+
64+bool LauncherItem::running() const
65+{
66+ return m_running;
67+}
68+
69+void LauncherItem::setRunning(bool running)
70+{
71+ if (m_running != running) {
72+ m_running = running;
73+ Q_EMIT runningChanged(running);
74+ }
75+}
76+
77+bool LauncherItem::recent() const
78+{
79+ return m_recent;
80+}
81+
82+void LauncherItem::setRecent(bool recent)
83+{
84+ if (m_recent != recent) {
85+ m_recent = recent;
86+ Q_EMIT recentChanged(recent);
87+ }
88+}
89+
90+int LauncherItem::progress() const
91+{
92+ return m_progress;
93+}
94+
95+void LauncherItem::setProgress(int progress)
96+{
97+ if (m_progress != progress) {
98+ m_progress = progress;
99+ Q_EMIT progressChanged(progress);
100+ }
101+}
102+
103+int LauncherItem::count() const
104+{
105+ return m_count;
106+}
107+
108+void LauncherItem::setCount(int count)
109+{
110+ if (m_count != count) {
111+ m_count = count;
112+ Q_EMIT countChanged(count);
113+ }
114+}
plugins/Unity/launchermodel.h → plugins/Unity/Launcher/launcheritem.hrenamed+20−38
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright (C) 2011 Canonical, Ltd.
2+ * Copyright (C) 2013 Canonical, Ltd.
3 *
3 *
4 * Authors:
4 * Authors:
5 * Michael Zanetti <michael.zanetti@canonical.com>
5 * Michael Zanetti <michael.zanetti@canonical.com>
@@ -17,48 +17,16 @@
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 <QAbstractListModel>
20+#ifndef LAUNCHERITEM_H
21+#define LAUNCHERITEM_H
21
22
22−class LauncherItem;
23+#include <unity/shell/launcher/LauncherItemInterface.h>
23
24
24−class LauncherModel: public QAbstractListModel
25+using namespace unity::shell::launcher;
25−{
26− Q_OBJECT
27−
28−public:
29− enum Roles {
30− RoleDesktopFile = Qt::UserRole,
31− RoleName,
32− RoleIcon,
33− RoleFavorite,
34− RoleRunning
35− };
36−
37− LauncherModel(QObject *parent = 0);
38− ~LauncherModel();
39−
40− int rowCount(const QModelIndex &parent) const;
41−
42− QVariant data(const QModelIndex &index, int role) const;
43−
44− Q_INVOKABLE LauncherItem* get(int index) const;
45− Q_INVOKABLE void move(int oldIndex, int newIndex);
46−
47− QHash<int, QByteArray> roleNames() const;
48
26
49−private:
50− QList<LauncherItem*> m_list;
51−};
52−
53−class LauncherItem: public QObject
27+class LauncherItem: public LauncherItemInterface
54{
28{
55 Q_OBJECT
29 Q_OBJECT
56− Q_PROPERTY(QString desktopFile READ desktopFile CONSTANT)
57− Q_PROPERTY(QString name READ name CONSTANT)
58− Q_PROPERTY(QString icon READ icon CONSTANT)
59− Q_PROPERTY(bool favorite READ favorite WRITE setFavorite NOTIFY favoriteChanged)
60− Q_PROPERTY(bool running READ running WRITE setRunning NOTIFY runningChanged)
61−
62public:
30public:
63 LauncherItem(const QString &desktopFile, const QString &name, const QString &icon, QObject *parent = 0);
31 LauncherItem(const QString &desktopFile, const QString &name, const QString &icon, QObject *parent = 0);
64
32
@@ -73,6 +41,15 @@ public:
73 bool running() const;
41 bool running() const;
74 void setRunning(bool running);
42 void setRunning(bool running);
75
43
44+ bool recent() const;
45+ void setRecent(bool recent);
46+
47+ int progress() const;
48+ void setProgress(int progress);
49+
50+ int count() const;
51+ void setCount(int count);
52+
76Q_SIGNALS:
53Q_SIGNALS:
77 void favoriteChanged(bool favorite);
54 void favoriteChanged(bool favorite);
78 void runningChanged(bool running);
55 void runningChanged(bool running);
@@ -83,4 +60,9 @@ private:
83 QString m_icon;
60 QString m_icon;
84 bool m_favorite;
61 bool m_favorite;
85 bool m_running;
62 bool m_running;
63+ bool m_recent;
64+ int m_progress;
65+ int m_count;
86};
66};
67+
68+#endif // LAUNCHERITEM_H
plugins/Unity/launchermodel.cpp → plugins/Unity/Launcher/launchermodel.cpprenamed+4−55
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright (C) 2011 Canonical, Ltd.
2+ * Copyright (C) 2013 Canonical, Ltd.
3 *
3 *
4 * Authors:
4 * Authors:
5 * Michael Zanetti <michael.zanetti@canonical.com>
5 * Michael Zanetti <michael.zanetti@canonical.com>
@@ -18,8 +18,9 @@
18 */
18 */
19
19
20#include "launchermodel.h"
20#include "launchermodel.h"
21+#include "launcheritem.h"
21
22
22−LauncherModel::LauncherModel(QObject *parent): QAbstractListModel(parent)
23+LauncherModel::LauncherModel(QObject *parent): LauncherModelInterface(parent)
23{
24{
24 // FIXME: Dummy data... Aggregate real data from backends
25 // FIXME: Dummy data... Aggregate real data from backends
25
26
@@ -74,7 +75,7 @@ QVariant LauncherModel::data(const QModelIndex &index, int role) const
74 return QVariant();
75 return QVariant();
75}
76}
76
77
77−LauncherItem *LauncherModel::get(int index) const
78+unity::shell::launcher::LauncherItemInterface *LauncherModel::get(int index) const
78{
79{
79 if (index < 0 || index >= m_list.count()) {
80 if (index < 0 || index >= m_list.count()) {
80 return 0;
81 return 0;
@@ -99,55 +100,3 @@ QHash<int, QByteArray> LauncherModel::roleNames() const
99 roles.insert(RoleRunning, "runnng");
100 roles.insert(RoleRunning, "runnng");
100 return roles;
101 return roles;
101}
102}
102−
103−
104−LauncherItem::LauncherItem(const QString &desktopFile, const QString &name, const QString &icon, QObject *parent):
105− QObject(parent),
106− m_desktopFile(desktopFile),
107− m_name(name),
108− m_icon(icon),
109− m_favorite(false)
110−{
111−
112−}
113−
114−QString LauncherItem::desktopFile() const
115−{
116− return m_desktopFile;
117−}
118−
119−QString LauncherItem::name() const
120−{
121− return m_name;
122−}
123−
124−QString LauncherItem::icon() const
125−{
126− return m_icon;
127−}
128−
129−bool LauncherItem::favorite() const
130−{
131− return m_favorite;
132−}
133−
134−void LauncherItem::setFavorite(bool favorite)
135−{
136− if (m_favorite != favorite) {
137− m_favorite = favorite;
138− Q_EMIT favoriteChanged(m_favorite);
139− }
140−}
141−
142−bool LauncherItem::running() const
143−{
144− return m_running;
145−}
146−
147−void LauncherItem::setRunning(bool running)
148−{
149− if (m_running != running) {
150− m_running = running;
151− Q_EMIT runningChanged(running);
152− }
153−}
plugins/Unity/Launcher/launchermodel.hnew file+52
@@ -0,0 +1,52 @@
1+/*
2+ * Copyright (C) 2013 Canonical, Ltd.
3+ *
4+ * Authors:
5+ * Michael Zanetti <michael.zanetti@canonical.com>
6+ *
7+ * This program is free software; you can redistribute it and/or modify
8+ * it under the terms of the GNU General Public License as published by
9+ * the Free Software Foundation; version 3.
10+ *
11+ * This program is distributed in the hope that it will be useful,
12+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+ * GNU General Public License for more details.
15+ *
16+ * You should have received a copy of the GNU General Public License
17+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
18+ */
19+
20+#ifndef LAUNCHERMODELH
21+#define LAUNCHERMODEL_H
22+
23+#include <unity/shell/launcher/LauncherModelInterface.h>
24+
25+#include <QAbstractListModel>
26+
27+class LauncherItem;
28+
29+using namespace unity::shell::launcher;
30+
31+class LauncherModel: public LauncherModelInterface
32+{
33+ Q_OBJECT
34+
35+public:
36+ LauncherModel(QObject *parent = 0);
37+ ~LauncherModel();
38+
39+ int rowCount(const QModelIndex &parent) const;
40+
41+ QVariant data(const QModelIndex &index, int role) const;
42+
43+ Q_INVOKABLE unity::shell::launcher::LauncherItemInterface* get(int index) const;
44+ Q_INVOKABLE void move(int oldIndex, int newIndex);
45+
46+ QHash<int, QByteArray> roleNames() const;
47+
48+private:
49+ QList<LauncherItem*> m_list;
50+};
51+
52+#endif // LAUNCHERMODEL_H
plugins/Unity/Launcher/plugin.cppnew file+45
@@ -0,0 +1,45 @@
1+/*
2+ * Copyright (C) 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+ * Author: Michael Zanetti <michael.zanetti@canonical.com>
17+ */
18+
19+// Qt
20+#include <QtQml>
21+
22+// self
23+#include "plugin.h"
24+
25+// local
26+#include "launchermodel.h"
27+#include "launcheritem.h"
28+
29+
30+using namespace unity::shell::launcher;
31+
32+static QObject* modelProvider(QQmlEngine* /* engine */, QJSEngine* /* scriptEngine */)
33+{
34+ return new LauncherModel();
35+}
36+void UnityLauncherPlugin::registerTypes(const char *uri)
37+{
38+ Q_ASSERT(uri == QLatin1String("Unity.Launcher"));
39+
40+ qmlRegisterUncreatableType<LauncherModelInterface>(uri, 0, 1, "LauncherModelInterface", "Abstract Interface. Cannot be instantiated.");
41+ qmlRegisterUncreatableType<LauncherItemInterface>(uri, 0, 1, "LauncherItemInterface", "Abstract Interface. Cannot be instantiated.");
42+
43+ qmlRegisterSingletonType<LauncherModel>(uri, 0, 1, "LauncherModel", modelProvider);
44+ qmlRegisterUncreatableType<LauncherItem>(uri, 0, 1, "LauncherItem", "Can't create new Launcher Items in QML. Get them from the LauncherModel.");
45+}
plugins/Unity/Launcher/plugin.hnew file+34
@@ -0,0 +1,34 @@
1+/*
2+ * Copyright (C) 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+ * Author: Michael Zanetti <michael.zanetti@canonical.com>
17+ */
18+
19+#ifndef UNITY_LAUNCHER_PLUGIN_H
20+#define UNITY_LAUNCHER_PLUGIN_H
21+
22+#include <QtQml/QQmlEngine>
23+#include <QtQml/QQmlExtensionPlugin>
24+
25+class UnityLauncherPlugin : public QQmlExtensionPlugin
26+{
27+ Q_OBJECT
28+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
29+
30+public:
31+ void registerTypes(const char *uri);
32+};
33+
34+#endif
plugins/Unity/Launcher/qmldirnew file+2
@@ -0,0 +1,2 @@
1+module Unity.Launcher
2+plugin UnityLauncher-qml
plugins/Unity/plugin.cpp−3
@@ -29,7 +29,6 @@
29#include "categories.h"
29#include "categories.h"
30#include "categoryfilter.h"
30#include "categoryfilter.h"
31#include "bottombarvisibilitycommunicatorshell.h"
31#include "bottombarvisibilitycommunicatorshell.h"
32−#include "launchermodel.h"
33
32
34// libqtdee
33// libqtdee
35#include "deelistmodel.h"
34#include "deelistmodel.h"
@@ -45,8 +44,6 @@ void UnityPlugin::registerTypes(const char *uri)
45 qmlRegisterType<Categories>(uri, 0, 1, "Categories");
44 qmlRegisterType<Categories>(uri, 0, 1, "Categories");
46 qmlRegisterType<CategoryFilter>(uri, 0, 1, "CategoryFilter");
45 qmlRegisterType<CategoryFilter>(uri, 0, 1, "CategoryFilter");
47 qmlRegisterType<DeeListModel>(uri, 0, 1, "DeeListModel");
46 qmlRegisterType<DeeListModel>(uri, 0, 1, "DeeListModel");
48− qmlRegisterType<LauncherModel>(uri, 0, 1, "LauncherModel");
49− qmlRegisterUncreatableType<LauncherItem>(uri, 0, 1, "LauncherItem", "Can't create new Launcher Items in QML. Get them from the LauncherModel.");
50 qmlRegisterUncreatableType<BottomBarVisibilityCommunicatorShell>(uri, 0, 1, "BottomBarVisibilityCommunicatorShell", "Can't create BottomBarVisibilityCommunicatorShell");
47 qmlRegisterUncreatableType<BottomBarVisibilityCommunicatorShell>(uri, 0, 1, "BottomBarVisibilityCommunicatorShell", "Can't create BottomBarVisibilityCommunicatorShell");
51}
48}
52
49
tests/mocks/Unity/CMakeLists.txtnew file+1
@@ -0,0 +1 @@
1+add_subdirectory(Launcher)
tests/mocks/Unity/Launcher/CMakeLists.txtnew file+39
@@ -0,0 +1,39 @@
1+set(CMAKE_AUTOMOC ON)
2+
3+include(FindPkgConfig)
4+find_package(Qt5Core REQUIRED)
5+find_package(Qt5Quick REQUIRED)
6+
7+#TODO: fix this once unity-api is released to distro
8+set(UNITY_API_DIR /home/mzanetti/Development/unity-api/include/)
9+
10+include_directories(
11+ ${CMAKE_CURRENT_SOURCE_DIR}
12+ ${UNITY_API_DIR}
13+)
14+
15+set(MockLauncherModel_SOURCES
16+ ${UNITY_API_DIR}/unity/shell/launcher/LauncherModelInterface.h
17+ ${UNITY_API_DIR}/unity/shell/launcher/LauncherItemInterface.h
18+ plugin.cpp
19+ MockLauncherModel.cpp
20+ MockLauncherItem.cpp
21+)
22+
23+add_library(MockLauncherPlugin MODULE ${MockLauncherModel_SOURCES})
24+
25+qt5_use_modules(MockLauncherPlugin Core Quick)
26+
27+# copy files into build directory for shadow builds
28+add_custom_target(LauncherPluginQmlDirFile ALL
29+ COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/qmldir" ${CMAKE_CURRENT_BINARY_DIR}
30+ DEPENDS qmldir
31+)
32+
33+install(TARGETS MockLauncherPlugin
34+ DESTINATION ${SHELL_APP_DIR}/plugins/mocks/Unity/Launcher
35+ )
36+
37+install(FILES qmldir
38+ DESTINATION ${SHELL_APP_DIR}/plugins/mocks/Unity/Launcher
39+ )
tests/mocks/Unity/Launcher/MockLauncherItem.cppnew file+121
@@ -0,0 +1,121 @@
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 Lesser 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 Lesser General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU Lesser General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ *
16+ * Authors:
17+ * Michael Zanetti <michael.zanetti@canonical.com>
18+ */
19+
20+#include "MockLauncherItem.h"
21+
22+using namespace unity::shell::launcher;
23+
24+MockLauncherItem::MockLauncherItem(const QString& desktopFile, const QString& name, const QString& icon, QObject* parent):
25+ LauncherItemInterface(parent),
26+ m_desktopFile(desktopFile),
27+ m_name(name),
28+ m_icon(icon),
29+ m_favorite(false),
30+ m_running(false),
31+ m_recent(false),
32+ m_progress(8),
33+ m_count(8)
34+{
35+
36+}
37+
38+QString MockLauncherItem::desktopFile() const
39+{
40+ return m_desktopFile;
41+}
42+
43+QString MockLauncherItem::name() const
44+{
45+ return m_name;
46+}
47+
48+QString MockLauncherItem::icon() const
49+{
50+ return m_icon;
51+}
52+
53+bool MockLauncherItem::favorite() const
54+{
55+ return m_favorite;
56+}
57+
58+void MockLauncherItem::setFavorite(bool favorite)
59+{
60+ if (m_favorite != favorite)
61+ {
62+ m_favorite = favorite;
63+ Q_EMIT favoriteChanged(m_favorite);
64+ }
65+}
66+
67+bool MockLauncherItem::running() const
68+{
69+ return m_running;
70+}
71+
72+void MockLauncherItem::setRunning(bool running)
73+{
74+ if (m_running != running)
75+ {
76+ m_running = running;
77+ Q_EMIT runningChanged(running);
78+ }
79+}
80+
81+bool MockLauncherItem::recent() const
82+{
83+ return m_recent;
84+}
85+
86+void MockLauncherItem::setRecent(bool recent)
87+{
88+ if (m_recent != recent)
89+ {
90+ m_recent = recent;
91+ Q_EMIT recentChanged(recent);
92+ }
93+}
94+
95+int MockLauncherItem::progress() const
96+{
97+ return m_progress;
98+}
99+
100+void MockLauncherItem::setProgress(int progress)
101+{
102+ if (m_progress != progress)
103+ {
104+ m_progress = progress;
105+ Q_EMIT progressChanged(progress);
106+ }
107+}
108+
109+int MockLauncherItem::count() const
110+{
111+ return m_count;
112+}
113+
114+void MockLauncherItem::setCount(int count)
115+{
116+ if (m_count != count)
117+ {
118+ m_count = count;
119+ Q_EMIT countChanged(count);
120+ }
121+}
tests/mocks/Unity/Launcher/MockLauncherItem.hnew file+64
@@ -0,0 +1,64 @@
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 Lesser 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 Lesser General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU Lesser General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ *
16+ * Authors:
17+ * Michael Zanetti <michael.zanetti@canonical.com>
18+ */
19+
20+#ifndef MOCKLAUNCHERITEM_H
21+#define MOCKLAUNCHERITEM_H
22+
23+#include <unity/shell/launcher/LauncherItemInterface.h>
24+
25+using namespace unity::shell::launcher;
26+
27+class MockLauncherItem: public LauncherItemInterface
28+{
29+ Q_OBJECT
30+public:
31+ MockLauncherItem(const QString& desktopFile, const QString& name, const QString& icon, QObject* parent = 0);
32+
33+ QString desktopFile() const;
34+
35+ QString name() const;
36+ QString icon() const;
37+
38+ bool favorite() const;
39+ void setFavorite(bool favorite);
40+
41+ bool running() const;
42+ void setRunning(bool running);
43+
44+ bool recent() const;
45+ void setRecent(bool recent);
46+
47+ int progress() const;
48+ void setProgress(int progress);
49+
50+ int count() const;
51+ void setCount(int count);
52+
53+private:
54+ QString m_desktopFile;
55+ QString m_name;
56+ QString m_icon;
57+ bool m_favorite;
58+ bool m_running;
59+ bool m_recent;
60+ int m_progress;
61+ int m_count;
62+};
63+
64+#endif // MOCKLAUNCHERITEM_H
tests/mocks/Unity/Launcher/MockLauncherModel.cppnew file+102
@@ -0,0 +1,102 @@
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 Lesser 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 Lesser General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU Lesser General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ *
16+ * Authors:
17+ * Michael Zanetti <michael.zanetti@canonical.com>
18+ */
19+
20+#include "MockLauncherModel.h"
21+#include "MockLauncherItem.h"
22+
23+MockLauncherModel::MockLauncherModel(QObject* parent): LauncherModelInterface(parent)
24+{
25+ LauncherItemInterface *item = new MockLauncherItem("/usr/share/applications/phone-app.desktop", "Phone", "phone-app");
26+ m_list.append(item);
27+ item = new MockLauncherItem("/usr/share/applications/camera-app.desktop", "Camera", "camera");
28+ m_list.append(item);
29+ item = new MockLauncherItem("/usr/share/applications/gallery-app.desktop", "Gallery", "gallery");
30+ m_list.append(item);
31+ item = new MockLauncherItem("/usr/share/applications/facebook-webapp.desktop", "Facebook", "facebook");
32+ m_list.append(item);
33+ item = new MockLauncherItem("/usr/share/applications/webbrowser-app.desktop", "Browser", "browser");
34+ m_list.append(item);
35+ item = new MockLauncherItem("/usr/share/applications/twitter-webapp.desktop", "Twitter", "twitter");
36+ m_list.append(item);
37+ item = new MockLauncherItem("/usr/share/applications/gmail-webapp.desktop", "GMail", "gmail");
38+ m_list.append(item);
39+ item = new MockLauncherItem("/usr/share/applications/ubuntu-weather-app.desktop", "Weather", "weather");
40+ m_list.append(item);
41+ item = new MockLauncherItem("/usr/share/applications/notes-app.desktop", "Notepad", "notepad");
42+ m_list.append(item);
43+ item = new MockLauncherItem("/usr/share/applications/ubuntu-calendar-app.desktop","Calendar", "calendar");
44+ m_list.append(item);
45+}
46+
47+MockLauncherModel::~MockLauncherModel()
48+{
49+ while (!m_list.empty())
50+ {
51+ m_list.takeFirst()->deleteLater();
52+ }
53+}
54+
55+// cppcheck-suppress unusedFunction
56+int MockLauncherModel::rowCount(const QModelIndex& parent) const
57+{
58+ Q_UNUSED(parent)
59+ return m_list.count();
60+}
61+
62+QVariant MockLauncherModel::data(const QModelIndex& index, int role) const
63+{
64+ LauncherItemInterface *item = m_list.at(index.row());
65+ switch(role)
66+ {
67+ case RoleDesktopFile:
68+ return item->desktopFile();
69+ case RoleName:
70+ return item->name();
71+ case RoleIcon:
72+ return item->icon();
73+ case RoleFavorite:
74+ return item->favorite();
75+ case RoleRunning:
76+ return item->running();
77+ case RoleRecent:
78+ return item->recent();
79+ case RoleProgress:
80+ return item->progress();
81+ case RoleCount:
82+ return item->count();
83+ }
84+
85+ return QVariant();
86+}
87+
88+unity::shell::launcher::LauncherItemInterface *MockLauncherModel::get(int index) const
89+{
90+ if (index < 0 || index >= m_list.count())
91+ {
92+ return 0;
93+ }
94+ return m_list.at(index);
95+}
96+
97+void MockLauncherModel::move(int oldIndex, int newIndex)
98+{
99+ beginMoveRows(QModelIndex(), oldIndex, oldIndex, QModelIndex(), newIndex);
100+ m_list.move(oldIndex, newIndex);
101+ endMoveRows();
102+}
tests/mocks/Unity/Launcher/MockLauncherModel.hnew file+45
@@ -0,0 +1,45 @@
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 Lesser 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 Lesser General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU Lesser General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ *
16+ * Authors:
17+ * Michael Zanetti <michael.zanetti@canonical.com>
18+ */
19+
20+#ifndef MOCKLAUNCHERMODEL_H
21+#define MOCKLAUNCHERMODEL_H
22+
23+#include <unity/shell/launcher/LauncherModelInterface.h>
24+
25+using namespace unity::shell::launcher;
26+
27+class MockLauncherModel: public LauncherModelInterface
28+{
29+ Q_OBJECT
30+
31+public:
32+ MockLauncherModel(QObject* parent = 0);
33+ ~MockLauncherModel();
34+
35+ int rowCount(const QModelIndex& parent) const;
36+
37+ QVariant data(const QModelIndex& index, int role) const;
38+
39+ Q_INVOKABLE unity::shell::launcher::LauncherItemInterface *get(int index) const;
40+ Q_INVOKABLE void move(int oldIndex, int newIndex);
41+private:
42+ QList<LauncherItemInterface*> m_list;
43+};
44+
45+#endif // MOCKLAUNCHERMODEL_H
tests/mocks/Unity/Launcher/plugin.cppnew file+45
@@ -0,0 +1,45 @@
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 Lesser 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 Lesser General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU Lesser General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ *
16+ * Authors:
17+ * Michael Zanetti <michael.zanetti@canonical.com>
18+ */
19+
20+#include "plugin.h"
21+#include "MockLauncherModel.h"
22+#include "MockLauncherItem.h"
23+
24+#include <unity/shell/launcher/LauncherModelInterface.h>
25+#include <unity/shell/launcher/LauncherItemInterface.h>
26+
27+#include <QtQml/qqml.h>
28+
29+using namespace unity::shell::launcher;
30+
31+static QObject* modelProvider(QQmlEngine* /* engine */, QJSEngine* /* scriptEngine */)
32+{
33+ return new MockLauncherModel();
34+}
35+
36+// cppcheck-suppress unusedFunction
37+void TestLauncherPlugin::registerTypes(const char* uri)
38+{
39+ // @uri Unity.Launcher
40+ qmlRegisterUncreatableType<LauncherModelInterface>(uri, 0, 1, "LauncherModelInterface", "Abstract Interface. Cannot be instantiated.");
41+ qmlRegisterUncreatableType<LauncherItemInterface>(uri, 0, 1, "LauncherItemInterface", "Abstract Interface. Cannot be instantiated.");
42+
43+ qmlRegisterSingletonType<MockLauncherModel>(uri, 0, 1, "LauncherModel", modelProvider);
44+ qmlRegisterUncreatableType<MockLauncherItem>(uri, 0, 1, "LauncherItem", "Can't create LauncherItems in QML. Get them from the LauncherModel");
45+}
tests/mocks/Unity/Launcher/plugin.hnew file+35
@@ -0,0 +1,35 @@
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 Lesser 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 Lesser General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU Lesser General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ *
16+ * Authors:
17+ * Michael Zanetti <michael.zanetti@canonical.com>
18+ */
19+
20+
21+#ifndef TESTLAUNCHER_PLUGIN_H
22+#define TESTLAUNCHER_PLUGIN_H
23+
24+#include <QtQml/QQmlExtensionPlugin>
25+
26+class TestLauncherPlugin : public QQmlExtensionPlugin
27+{
28+ Q_OBJECT
29+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
30+
31+public:
32+ void registerTypes(const char* uri);
33+};
34+
35+#endif // TESTLAUNCHER_PLUGIN_H
tests/mocks/Unity/Launcher/qmldirnew file+2
@@ -0,0 +1,2 @@
1+module Unity.Launcher
2+plugin MockLauncherPlugin
tests/qmltests/CMakeLists.txt+1−1
@@ -56,7 +56,7 @@ add_qml_test(Greeter Infographics IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} $
56 ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/full")
56 ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/full")
57add_qml_test(Hud Hud)
57add_qml_test(Hud Hud)
58add_qml_test(Hud Result)
58add_qml_test(Hud Result)
59−add_qml_test(Launcher Launcher IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
59+add_qml_test(Launcher Launcher IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins/ ${CMAKE_BINARY_DIR}/tests/mocks/ ${qmltest_DEFAULT_IMPORT_PATHS})
60add_qml_test(Notifications Notifications IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_CURRENT_SOURCE_DIR}/plugins)
60add_qml_test(Notifications Notifications IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_CURRENT_SOURCE_DIR}/plugins)
61add_qml_test(Panel IndicatorRow)
61add_qml_test(Panel IndicatorRow)
62add_qml_test(Panel Indicators)
62add_qml_test(Panel Indicators)
tests/qmltests/plugins/Unity/CMakeLists.txt−1
@@ -25,7 +25,6 @@ set(UnityQML_SOURCES
25 fake_scope.cpp
25 fake_scope.cpp
26 fake_scopes.cpp
26 fake_scopes.cpp
27 fake_unity_plugin.cpp
27 fake_unity_plugin.cpp
28− fake_launchermodel.cpp
29)
28)
30
29
31add_library(FakeUnityQml MODULE ${UnityQML_SOURCES})
30add_library(FakeUnityQml MODULE ${UnityQML_SOURCES})
tests/qmltests/plugins/Unity/fake_launchermodel.cppdeleted−150
@@ -1,150 +0,0 @@
1−/*
2− * Copyright (C) 2011 Canonical, Ltd.
3− *
4− * Authors:
5− * Michael Zanetti <michael.zanetti@canonical.com>
6− *
7− * This program is free software; you can redistribute it and/or modify
8− * it under the terms of the GNU General Public License as published by
9− * the Free Software Foundation; version 3.
10− *
11− * This program is distributed in the hope that it will be useful,
12− * but WITHOUT ANY WARRANTY; without even the implied warranty of
13− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14− * GNU General Public License for more details.
15− *
16− * You should have received a copy of the GNU General Public License
17− * along with this program. If not, see <http://www.gnu.org/licenses/>.
18− */
19−
20−#include "launchermodel.h"
21−
22−LauncherModel::LauncherModel(QObject *parent): QAbstractListModel(parent)
23−{
24− LauncherItem *item = new LauncherItem("/usr/share/applications/phone-app.desktop", "Phone", "phone-app");
25− m_list.append(item);
26− item = new LauncherItem("/usr/share/applications/camera-app.desktop", "Camera", "camera");
27− m_list.append(item);
28− item = new LauncherItem("/usr/share/applications/gallery-app.desktop", "Gallery", "gallery");
29− m_list.append(item);
30− item = new LauncherItem("/usr/share/applications/facebook-webapp.desktop", "Facebook", "facebook");
31− m_list.append(item);
32− item = new LauncherItem("/usr/share/applications/webbrowser-app.desktop", "Browser", "browser");
33− m_list.append(item);
34− item = new LauncherItem("/usr/share/applications/twitter-webapp.desktop", "Twitter", "twitter");
35− m_list.append(item);
36− item = new LauncherItem("/usr/share/applications/gmail-webapp.desktop", "GMail", "gmail");
37− m_list.append(item);
38− item = new LauncherItem("/usr/share/applications/ubuntu-weather-app.desktop", "Weather", "weather");
39− m_list.append(item);
40− item = new LauncherItem("/usr/share/applications/notes-app.desktop", "Notepad", "notepad");
41− m_list.append(item);
42− item = new LauncherItem("/usr/share/applications/ubuntu-calendar-app.desktop","Calendar", "calendar");
43− m_list.append(item);
44−}
45−
46−LauncherModel::~LauncherModel()
47−{
48− while (!m_list.empty()) {
49− m_list.takeFirst()->deleteLater();
50− }
51−}
52−
53−int LauncherModel::rowCount(const QModelIndex &parent) const
54−{
55− Q_UNUSED(parent)
56− return m_list.count();
57−}
58−
59−QVariant LauncherModel::data(const QModelIndex &index, int role) const
60−{
61− LauncherItem *item = m_list.at(index.row());
62− switch(role) {
63− case RoleName:
64− return item->name();
65− case RoleIcon:
66− return item->icon();
67− case RoleFavorite:
68− return item->favorite();
69− }
70−
71− return QVariant();
72−}
73−
74−LauncherItem *LauncherModel::get(int index) const
75−{
76− if (index < 0 || index >= m_list.count()) {
77− return 0;
78− }
79− return m_list.at(index);
80−}
81−
82−void LauncherModel::move(int oldIndex, int newIndex)
83−{
84− beginMoveRows(QModelIndex(), oldIndex, oldIndex, QModelIndex(), newIndex);
85− m_list.move(oldIndex, newIndex);
86− endMoveRows();
87−}
88−
89−QHash<int, QByteArray> LauncherModel::roleNames() const
90−{
91− QHash<int, QByteArray> roles;
92− roles.insert(RoleDesktopFile, "desktopFile");
93− roles.insert(RoleName, "name");
94− roles.insert(RoleIcon, "icon");
95− roles.insert(RoleFavorite, "favorite");
96− roles.insert(RoleRunning, "runnng");
97− return roles;
98−}
99−
100−
101−LauncherItem::LauncherItem(const QString &desktopFile, const QString &name, const QString &icon, QObject *parent):
102− QObject(parent),
103− m_desktopFile(desktopFile),
104− m_name(name),
105− m_icon(icon),
106− m_favorite(false)
107−{
108−
109−}
110−
111−QString LauncherItem::desktopFile() const
112−{
113− return m_desktopFile;
114−}
115−
116−QString LauncherItem::name() const
117−{
118− return m_name;
119−}
120−
121−QString LauncherItem::icon() const
122−{
123− return m_icon;
124−}
125−
126−bool LauncherItem::favorite() const
127−{
128− return m_favorite;
129−}
130−
131−void LauncherItem::setFavorite(bool favorite)
132−{
133− if (m_favorite != favorite) {
134− m_favorite = favorite;
135− Q_EMIT favoriteChanged(m_favorite);
136− }
137−}
138−
139−bool LauncherItem::running() const
140−{
141− return m_running;
142−}
143−
144−void LauncherItem::setRunning(bool running)
145−{
146− if (m_running != running) {
147− m_running = running;
148− Q_EMIT runningChanged(running);
149− }
150−}
tests/qmltests/plugins/Unity/fake_launchermodel.hdeleted−86
@@ -1,86 +0,0 @@
1−/*
2− * Copyright (C) 2011 Canonical, Ltd.
3− *
4− * Authors:
5− * Michael Zanetti <michael.zanetti@canonical.com>
6− *
7− * This program is free software; you can redistribute it and/or modify
8− * it under the terms of the GNU General Public License as published by
9− * the Free Software Foundation; version 3.
10− *
11− * This program is distributed in the hope that it will be useful,
12− * but WITHOUT ANY WARRANTY; without even the implied warranty of
13− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14− * GNU General Public License for more details.
15− *
16− * You should have received a copy of the GNU General Public License
17− * along with this program. If not, see <http://www.gnu.org/licenses/>.
18− */
19−
20−#include <QAbstractListModel>
21−
22−class LauncherItem;
23−
24−class LauncherModel: public QAbstractListModel
25−{
26− Q_OBJECT
27−
28−public:
29− enum Roles {
30− RoleDesktopFile = Qt::UserRole,
31− RoleName,
32− RoleIcon,
33− RoleFavorite,
34− RoleRunning
35− };
36−
37− LauncherModel(QObject *parent = 0);
38− ~LauncherModel();
39−
40− int rowCount(const QModelIndex &parent) const;
41−
42− QVariant data(const QModelIndex &index, int role) const;
43−
44− Q_INVOKABLE LauncherItem* get(int index) const;
45− Q_INVOKABLE void move(int oldIndex, int newIndex);
46−
47− QHash<int, QByteArray> roleNames() const;
48−
49−private:
50− QList<LauncherItem*> m_list;
51−};
52−
53−class LauncherItem: public QObject
54−{
55− Q_OBJECT
56− Q_PROPERTY(QString desktopFile READ desktopFile CONSTANT)
57− Q_PROPERTY(QString name READ name CONSTANT)
58− Q_PROPERTY(QString icon READ icon CONSTANT)
59− Q_PROPERTY(bool favorite READ favorite WRITE setFavorite NOTIFY favoriteChanged)
60− Q_PROPERTY(bool running READ running WRITE setRunning NOTIFY runningChanged)
61−
62−public:
63− LauncherItem(const QString &desktopFile, const QString &name, const QString &icon, QObject *parent = 0);
64−
65− QString desktopFile() const;
66−
67− QString name() const;
68− QString icon() const;
69−
70− bool favorite() const;
71− void setFavorite(bool favorite);
72−
73− bool running() const;
74− void setRunning(bool running);
75−
76−Q_SIGNALS:
77− void favoriteChanged(bool favorite);
78− void runningChanged(bool running);
79−
80−private:
81− QString m_desktopFile;
82− QString m_name;
83− QString m_icon;
84− bool m_favorite;
85− bool m_running;
86−};
tests/qmltests/plugins/Unity/fake_unity_plugin.cpp−3
@@ -23,7 +23,6 @@
23#include "fake_scopes.h"
23#include "fake_scopes.h"
24#include "categories.h"
24#include "categories.h"
25#include "categoryfilter.h"
25#include "categoryfilter.h"
26−#include "fake_launchermodel.h"
27
26
28// External
27// External
29#include <glib-object.h>
28#include <glib-object.h>
@@ -41,6 +40,4 @@ void FakeUnityPlugin::registerTypes(const char *uri)
41 qmlRegisterType<Scope>(uri, 0, 1, "Scope");
40 qmlRegisterType<Scope>(uri, 0, 1, "Scope");
42 qmlRegisterType<Categories>(uri, 0, 1, "Categories");
41 qmlRegisterType<Categories>(uri, 0, 1, "Categories");
43 qmlRegisterType<CategoryFilter>(uri, 0, 1, "CategoryFilter");
42 qmlRegisterType<CategoryFilter>(uri, 0, 1, "CategoryFilter");
44− qmlRegisterType<LauncherModel>(uri, 0, 1, "LauncherModel");
45− qmlRegisterUncreatableType<LauncherItem>(uri, 0, 1, "LauncherItem", "Can't create");
46}
43}