on xenial help sign in
First cut at port to new UnityCore and libunity 7.0.
commit0b01bee6e034e8a89f604e88000be69dadb247fc authorPawel Stolowski <pawel.stolowski@canonical.com> dateThu 6 Jun 2013, 12:37 (13 years ago) parente8b206a
13 files changed+168−823
Dash/GenericLensView.qml+1−1 build_unity+9−7 plugins/Unity/CMakeLists.txt−1 plugins/Unity/categories.cpp+20−13 plugins/Unity/categories.h+8−8 plugins/Unity/lens.cpp+56−39 plugins/Unity/lens.h+29−26 plugins/Unity/lenses.cpp+35−26 plugins/Unity/lenses.h+8−6 plugins/Unity/peoplepreviewdata.cpp−438 plugins/Unity/peoplepreviewdata.h−251 plugins/Unity/plugin.cpp−5 tests/qmltests/plugins/Unity/fake_lens.cpp+2−2
Dash/GenericLensView.qml+1−1
@@ -71,7 +71,7 @@ LensView {
7171 delegate: Tile {
7272 width: filtergrid.cellWidth
7373 height: filtergrid.cellHeight
74− text: column_4 ? column_4 : "" // FIXME: this shouldn't be necessary
74+ text: column_5 ? column_5 : "" // FIXME: this shouldn't be necessary
7575 imageWidth: units.gu(11)
7676 imageHeight: units.gu(16)
7777 source: column_1 ? column_1 : "" // FIXME: ditto
build_unity+9−7
@@ -9,8 +9,8 @@ NUM_JOBS=$(( `grep -c ^processor /proc/cpuinfo` + 1 ))
99LENSES="applications mockmusic mockvideos"
1010
1111# verified working revisions
12−LIBUNITY_REV=215
13−UNITY_REV=3260
12+LIBUNITY_REV=219
13+UNITY_REV=3343
1414PEOPLE_LENS_REV=74
1515HUD_REV=252
1616
@@ -49,12 +49,13 @@ install_dependencies() {
4949
5050branch_libunity() {
5151 echo "Branching libunity.."
52− bzr branch lp:libunity/phablet $TARGET_DIR/libunity
52+ bzr branch lp:libunity $TARGET_DIR/libunity
5353}
5454
5555branch_unity() {
5656 echo "Branching Unity.."
57− bzr branch lp:unity/phablet-mods $TARGET_DIR/unity
57+# bzr branch lp:unity/phablet-mods $TARGET_DIR/unity
58+ bzr branch lp:unity $TARGET_DIR/unity
5859}
5960
6061branch_people_lens() {
@@ -95,7 +96,8 @@ compile_libunity() {
9596 cd $TARGET_DIR/libunity
9697 bzr revert --quiet -r $LIBUNITY_REV || exit 8
9798
98− ./autogen.sh --prefix $BUILD_DIR --disable-debug
99+ # FIXME: gi overrides
100+ ./autogen.sh --prefix $BUILD_DIR --disable-debug --with-pygi-overrides-dir=$BUILD_DIR/gi-overrides
99101
100102 echo "Building libunity and installing in " $BUILD_DIR
101103 make -j$NUM_JOBS install
@@ -181,8 +183,8 @@ else
181183 mkdir -p $BUILD_DIR
182184 compile_libunity
183185 compile_unity_core
184− compile_people_lens
186+# compile_people_lens
185187 compile_hud
186− link_lenses
188+# link_lenses
187189fi
188190
plugins/Unity/CMakeLists.txt−1
@@ -17,7 +17,6 @@ set(QMLPLUGIN_SRC
1717 lenses.cpp
1818 categories.cpp
1919 categoryfilter.cpp
20− peoplepreviewdata.cpp
2120 plugin.cpp
2221 bottombarvisibilitycommunicatorshell.cpp
2322 launchermodel.cpp
plugins/Unity/categories.cpp+20−13
@@ -20,11 +20,12 @@
2020// self
2121#include "categories.h"
2222#include "categoryfilter.h"
23+#include <QDebug>
2324
2425Categories::Categories(QObject* parent)
2526 : DeeListModel(parent)
2627 , m_resultModel(0)
27− , m_globalResultModel(0)
28+// , m_globalResultModel(0)
2829{
2930 // FIXME: need to clean up unused filters on countChanged
3031 m_roles[Categories::RoleId] = "id";
@@ -48,7 +49,7 @@ Categories::Categories(QObject* parent)
4849Categories::~Categories()
4950{
5051 qDeleteAll(m_filters);
51− qDeleteAll(m_globalFilters);
52+// qDeleteAll(m_globalFilters);
5253}
5354
5455CategoryFilter*
@@ -66,7 +67,7 @@ Categories::getFilter(int index) const
6667 return m_filters[index];
6768}
6869
69−CategoryFilter*
70+/*CategoryFilter*
7071Categories::getGlobalFilter(int index) const
7172{
7273 if (!m_globalFilters.contains(index)) {
@@ -79,7 +80,7 @@ Categories::getGlobalFilter(int index) const
7980 }
8081
8182 return m_globalFilters[index];
82−}
83+ }*/
8384
8485void
8586Categories::setResultModel(DeeListModel* model)
@@ -95,6 +96,7 @@ Categories::setResultModel(DeeListModel* model)
9596 }
9697}
9798
99+/*
98100void
99101Categories::setGlobalResultModel(DeeListModel* model)
100102{
@@ -107,7 +109,7 @@ Categories::setGlobalResultModel(DeeListModel* model)
107109
108110 Q_EMIT globalResultModelChanged(m_globalResultModel);
109111 }
110−}
112+ }*/
111113
112114void
113115Categories::onCountChanged()
@@ -131,6 +133,7 @@ Categories::onEmitCountChanged()
131133 m_timerFilters.clear();
132134}
133135
136+/*
134137void
135138Categories::onGlobalCountChanged()
136139{
@@ -141,7 +144,7 @@ Categories::onGlobalCountChanged()
141144 roles.append(Categories::RoleGlobalCount);
142145 Q_EMIT dataChanged(changedIndex, changedIndex, roles);
143146 }
144−}
147+ }*/
145148
146149QHash<int, QByteArray>
147150Categories::roleNames() const
@@ -159,23 +162,27 @@ Categories::data(const QModelIndex& index, int role) const
159162 if (role == RoleId) {
160163 return QVariant::fromValue(index.row());
161164 } else if (role == RoleName) {
162− return QVariant::fromValue(DeeListModel::data(index, 0));
165+ return QVariant::fromValue(DeeListModel::data(index, 1)); //DISPLAY_NAME
163166 } else if (role == RoleIcon) {
164− return QVariant::fromValue(DeeListModel::data(index, 1));
167+ return QVariant::fromValue(DeeListModel::data(index, 2)); //ICON_HINT
165168 } else if (role == RoleRenderer) {
166− return QVariant::fromValue(DeeListModel::data(index, 2));
169+ return QVariant::fromValue(DeeListModel::data(index, 3)); //RENDERER_NAME
167170 } else if (role == RoleHints) {
168− return QVariant::fromValue(DeeListModel::data(index, 3));
171+ return QVariant::fromValue(DeeListModel::data(index, 4)); //HINTS
169172 } else if (role == RoleResults) {
170173 return QVariant::fromValue(getFilter(index.row()));
171174 } else if (role == RoleGlobalResults) {
172− return QVariant::fromValue(getGlobalFilter(index.row()));
175+ qWarning() << "GLOBAL RESULTS???";
176+// return QVariant::fromValue(getGlobalFilter(index.row()));
177+ return QVariant();
173178 } else if (role == RoleCount) {
174179 CategoryFilter* filter = getFilter(index.row());
175180 return QVariant::fromValue(filter->rowCount());
176181 } else if (role == RoleGlobalCount) {
177− QSortFilterProxyModel* filter = getGlobalFilter(index.row());
178− return QVariant::fromValue(filter->rowCount());
182+ qWarning() << "GLOBAL COUNT???";
183+// QSortFilterProxyModel* filter = getGlobalFilter(index.row());
184+ // return QVariant::fromValue(filter->rowCount());
185+ return QVariant();
179186 } else {
180187 return QVariant();
181188 }
plugins/Unity/categories.h+8−8
@@ -36,7 +36,7 @@ class Categories : public DeeListModel
3636 Q_ENUMS(Roles)
3737
3838 Q_PROPERTY(DeeListModel* resultModel READ resultModel WRITE setResultModel NOTIFY resultModelChanged)
39− Q_PROPERTY(DeeListModel* globalResultModel READ globalResultModel WRITE setResultModel NOTIFY globalResultModelChanged)
39+// Q_PROPERTY(DeeListModel* globalResultModel READ globalResultModel WRITE setResultModel NOTIFY globalResultModelChanged)
4040
4141public:
4242 explicit Categories(QObject* parent = 0);
@@ -60,32 +60,32 @@ public:
6060
6161 /* getters */
6262 DeeListModel* resultModel() { return m_resultModel; }
63− DeeListModel* globalResultModel() { return m_globalResultModel; }
63+// DeeListModel* globalResultModel() { return m_globalResultModel; }
6464
6565 /* setters */
6666 void setResultModel(DeeListModel*);
67− void setGlobalResultModel(DeeListModel*);
67+// void setGlobalResultModel(DeeListModel*);
6868
6969Q_SIGNALS:
7070 void resultModelChanged(DeeListModel*);
71− void globalResultModelChanged(DeeListModel*);
71+// void globalResultModelChanged(DeeListModel*);
7272
7373private Q_SLOTS:
7474 void onCountChanged();
75− void onGlobalCountChanged();
75+// void onGlobalCountChanged();
7676 void onEmitCountChanged();
7777
7878private:
7979 CategoryFilter* getFilter(int index) const;
80− CategoryFilter* getGlobalFilter(int index) const;
80+// CategoryFilter* getGlobalFilter(int index) const;
8181
8282 QTimer m_timer;
8383 QSet<CategoryFilter*> m_timerFilters;
8484 QHash<int, QByteArray> m_roles;
8585 DeeListModel* m_resultModel;
86− DeeListModel* m_globalResultModel;
86+// DeeListModel* m_globalResultModel;
8787 mutable QMap<int, CategoryFilter*> m_filters;
88− mutable QMap<int, CategoryFilter*> m_globalFilters;
88+// mutable QMap<int, CategoryFilter*> m_globalFilters;
8989};
9090
9191#endif // CATEGORIES_H
plugins/Unity/lens.cpp+56−39
@@ -32,11 +32,11 @@ Lens::Lens(QObject *parent) :
3232 QObject(parent)
3333{
3434 m_results = new DeeListModel(this);
35− m_globalResults = new DeeListModel(this);
35+ //m_globalResults = new DeeListModel(this);
3636 m_categories = new Categories(this);
3737
3838 m_categories->setResultModel(m_results);
39− m_categories->setGlobalResultModel(m_globalResults);
39+// m_categories->setGlobalResultModel(m_globalResults);
4040}
4141
4242QString Lens::id() const
@@ -44,7 +44,7 @@ QString Lens::id() const
4444 return QString::fromStdString(m_unityLens->id());
4545}
4646
47−QString Lens::dbusName() const
47+/*QString Lens::dbusName() const
4848{
4949 return QString::fromStdString(m_unityLens->dbus_name());
5050}
@@ -52,7 +52,7 @@ QString Lens::dbusName() const
5252QString Lens::dbusPath() const
5353{
5454 return QString::fromStdString(m_unityLens->dbus_path());
55−}
55+ }*/
5656
5757QString Lens::name() const
5858{
@@ -79,10 +79,10 @@ bool Lens::visible() const
7979 return m_unityLens->visible();
8080}
8181
82−bool Lens::searchInGlobal() const
82+/*bool Lens::searchInGlobal() const
8383{
8484 return m_unityLens->search_in_global();
85−}
85+ }*/
8686
8787QString Lens::shortcut() const
8888{
@@ -99,10 +99,10 @@ DeeListModel* Lens::results() const
9999 return m_results;
100100}
101101
102−DeeListModel* Lens::globalResults() const
102+/*DeeListModel* Lens::globalResults() const
103103{
104104 return m_globalResults;
105−}
105+}*/
106106
107107Categories* Lens::categories() const
108108{
@@ -119,10 +119,10 @@ QString Lens::searchQuery() const
119119 return m_searchQuery;
120120}
121121
122−QString Lens::globalSearchQuery() const
122+/*QString Lens::globalSearchQuery() const
123123{
124124 return m_globalSearchQuery;
125−}
125+}*/
126126
127127QString Lens::noResultsHint() const
128128{
@@ -131,7 +131,7 @@ QString Lens::noResultsHint() const
131131
132132void Lens::setViewType(const Lens::ViewType& viewType)
133133{
134− m_unityLens->view_type = (unity::dash::ViewType) viewType;
134+ m_unityLens->view_type = (unity::dash::ScopeViewType) viewType;
135135}
136136
137137void Lens::setSearchQuery(const QString& search_query)
@@ -148,19 +148,19 @@ void Lens::setSearchQuery(const QString& search_query)
148148 }
149149}
150150
151−void Lens::setGlobalSearchQuery(const QString& search_query)
152−{
151+//void Lens::setGlobalSearchQuery(const QString& search_query)
152+//{
153153 /* Checking for m_globalSearchQuery.isNull() which returns true only when the string
154154 has never been set is necessary because when search_query is the empty
155155 string ("") and m_globalSearchQuery is the null string,
156156 search_query != m_globalSearchQuery is still true.
157157 */
158− if (m_globalSearchQuery.isNull() || search_query != m_globalSearchQuery) {
158+/* if (m_globalSearchQuery.isNull() || search_query != m_globalSearchQuery) {
159159 m_globalSearchQuery = search_query;
160160 m_unityLens->GlobalSearch(search_query.toStdString(), sigc::mem_fun(this, &Lens::globalSearchFinished));
161161 Q_EMIT globalSearchQueryChanged();
162162 }
163−}
163+}*/
164164
165165void Lens::setNoResultsHint(const QString& hint) {
166166 if (hint != m_noResultsHint) {
@@ -171,10 +171,10 @@ void Lens::setNoResultsHint(const QString& hint) {
171171
172172void Lens::activate(const QString& uri)
173173{
174− m_unityLens->Activate(QByteArray::fromPercentEncoding(uri.toUtf8()).constData());
174+ // m_unityLens->Activate(QByteArray::fromPercentEncoding(uri.toUtf8()).constData()); FIXME pawel
175175}
176176
177−void Lens::onActivated(std::string const& uri, unity::dash::HandledType type, unity::dash::Lens::Hints const&)
177+void Lens::onActivated(std::string const& uri, unity::dash::ScopeHandledType type, unity::glib::HintsMap const&)
178178{
179179 if (type == unity::dash::NOT_HANDLED) {
180180 fallbackActivate(QString::fromStdString(uri));
@@ -215,20 +215,22 @@ void Lens::fallbackActivate(const QString& uri)
215215 QDesktopServices::openUrl(url);
216216}
217217
218−void Lens::setUnityLens(const unity::dash::Lens::Ptr& lens)
218+void Lens::setUnityLens(const unity::dash::Scope::Ptr& lens)
219219{
220220 m_unityLens = lens;
221+// m_results->setModel(m_unityLens->results()->model());
221222
222223 if (QString::fromStdString(m_unityLens->results()->swarm_name) == QString(":local")) {
223224 m_results->setModel(m_unityLens->results()->model());
224225 } else {
225226 m_results->setName(QString::fromStdString(m_unityLens->results()->swarm_name));
226227 }
227− if (QString::fromStdString(m_unityLens->global_results()->swarm_name) == QString(":local")) {
228+/* if (QString::fromStdString(m_unityLens->global_results()->swarm_name) == QString(":local")) {
228229 m_globalResults->setModel(m_unityLens->global_results()->model());
229230 } else {
230231 m_globalResults->setName(QString::fromStdString(m_unityLens->global_results()->swarm_name));
231− }
232+ }*/
233+
232234 if (QString::fromStdString(m_unityLens->categories()->swarm_name) == QString(":local")) {
233235 m_categories->setModel(m_unityLens->categories()->model());
234236 } else {
@@ -237,29 +239,31 @@ void Lens::setUnityLens(const unity::dash::Lens::Ptr& lens)
237239
238240 /* Property change signals */
239241 m_unityLens->id.changed.connect(sigc::mem_fun(this, &Lens::idChanged));
240− m_unityLens->dbus_name.changed.connect(sigc::mem_fun(this, &Lens::dbusNameChanged));
241− m_unityLens->dbus_path.changed.connect(sigc::mem_fun(this, &Lens::dbusPathChanged));
242+// m_unityLens->dbus_name.changed.connect(sigc::mem_fun(this, &Lens::dbusNameChanged));
243+// m_unityLens->dbus_path.changed.connect(sigc::mem_fun(this, &Lens::dbusPathChanged));
242244 m_unityLens->name.changed.connect(sigc::mem_fun(this, &Lens::nameChanged));
243245 m_unityLens->icon_hint.changed.connect(sigc::mem_fun(this, &Lens::iconHintChanged));
244246 m_unityLens->description.changed.connect(sigc::mem_fun(this, &Lens::descriptionChanged));
245247 m_unityLens->search_hint.changed.connect(sigc::mem_fun(this, &Lens::searchHintChanged));
246248 m_unityLens->visible.changed.connect(sigc::mem_fun(this, &Lens::visibleChanged));
247− m_unityLens->search_in_global.changed.connect(sigc::mem_fun(this, &Lens::searchInGlobalChanged));
249+// m_unityLens->search_in_global.changed.connect(sigc::mem_fun(this, &Lens::searchInGlobalChanged));
248250 m_unityLens->shortcut.changed.connect(sigc::mem_fun(this, &Lens::shortcutChanged));
249251 m_unityLens->connected.changed.connect(sigc::mem_fun(this, &Lens::connectedChanged));
250252 m_unityLens->results.changed.connect(sigc::mem_fun(this, &Lens::onResultsChanged));
251253 m_unityLens->results()->swarm_name.changed.connect(sigc::mem_fun(this, &Lens::onResultsSwarmNameChanged));
252− m_unityLens->global_results.changed.connect(sigc::mem_fun(this, &Lens::onGlobalResultsChanged));
253− m_unityLens->global_results()->swarm_name.changed.connect(sigc::mem_fun(this, &Lens::onGlobalResultsSwarmNameChanged));
254+ m_unityLens->results()->model.changed.connect(sigc::mem_fun(this, &Lens::onResultsModelChanged));
255+// m_unityLens->global_results.changed.connect(sigc::mem_fun(this, &Lens::onGlobalResultsChanged));
256+// m_unityLens->global_results()->swarm_name.changed.connect(sigc::mem_fun(this, &Lens::onGlobalResultsSwarmNameChanged));
257+ m_unityLens->categories()->model.changed.connect(sigc::mem_fun(this, &Lens::onCategoriesModelChanged));
254258 m_unityLens->categories.changed.connect(sigc::mem_fun(this, &Lens::onCategoriesChanged));
255259 m_unityLens->categories()->swarm_name.changed.connect(sigc::mem_fun(this, &Lens::onCategoriesSwarmNameChanged));
256260 m_unityLens->view_type.changed.connect(sigc::mem_fun(this, &Lens::onViewTypeChanged));
257261
258262 /* Signals forwarding */
259− connect(this, SIGNAL(searchFinished(unity::dash::Lens::Hints const &, unity::glib::Error const &)), SLOT(onSearchFinished(unity::dash::Lens::Hints const &)));
263+ connect(this, SIGNAL(searchFinished(const std::string &, unity::glib::HintsMap const &, unity::glib::Error const &)), SLOT(onSearchFinished(const std::string &, unity::glib::HintsMap const &)));
260264
261265 /* FIXME: signal should be forwarded instead of calling the handler directly */
262− m_unityLens->activated.connect(sigc::mem_fun(this, &Lens::onActivated));
266+ //unityLens->activated.connect(sigc::mem_fun(this, &Lens::onActivated)); //FIXME pawel
263267
264268 /* Synchronize local states with m_unityLens right now and whenever
265269 m_unityLens becomes connected */
@@ -268,7 +272,7 @@ void Lens::setUnityLens(const unity::dash::Lens::Ptr& lens)
268272 synchronizeStates();
269273}
270274
271−unity::dash::Lens::Ptr Lens::unityLens() const
275+unity::dash::Scope::Ptr Lens::unityLens() const
272276{
273277 return m_unityLens;
274278}
@@ -280,9 +284,9 @@ void Lens::synchronizeStates()
280284 if (!m_searchQuery.isNull()) {
281285 m_unityLens->Search(m_searchQuery.toStdString());
282286 }
283− if (!m_globalSearchQuery.isNull()) {
287+ /*if (!m_globalSearchQuery.isNull()) {
284288 m_unityLens->GlobalSearch(m_globalSearchQuery.toStdString());
285− }
289+ }*/
286290 }
287291}
288292
@@ -296,15 +300,20 @@ void Lens::onResultsChanged(const unity::dash::Results::Ptr& /* results */)
296300 m_results->setName(QString::fromStdString(m_unityLens->results()->swarm_name));
297301}
298302
299−void Lens::onGlobalResultsSwarmNameChanged(const std::string& /* swarm_name */)
303+void Lens::onResultsModelChanged(unity::glib::Object<DeeModel> model)
300304{
301− m_globalResults->setName(QString::fromStdString(m_unityLens->global_results()->swarm_name));
305+ m_results->setModel(m_unityLens->results()->model());
302306}
303307
304−void Lens::onGlobalResultsChanged(const unity::dash::Results::Ptr& /* global_results */)
305−{
306− m_globalResults->setName(QString::fromStdString(m_unityLens->global_results()->swarm_name));
307−}
308+//void Lens::onGlobalResultsSwarmNameChanged(const std::string& /* swarm_name */)
309+//{
310+// m_globalResults->setName(QString::fromStdString(m_unityLens->global_results()->swarm_name));
311+//
312+
313+//id Lens::onGlobalResultsChanged(const unity::dash::Results::Ptr& /* global_results */)
314+//
315+// m_globalResults->setName(QString::fromStdString(m_unityLens->global_results()->swarm_name));
316+//}
308317
309318void Lens::onCategoriesSwarmNameChanged(const std::string& /* swarm_name */)
310319{
@@ -313,20 +322,28 @@ void Lens::onCategoriesSwarmNameChanged(const std::string& /* swarm_name */)
313322
314323void Lens::onCategoriesChanged(const unity::dash::Categories::Ptr& /* categories */)
315324{
325+ qWarning() << "categories changed!";
316326 m_categories->setName(QString::fromStdString(m_unityLens->categories()->swarm_name));
317327}
318328
319−void Lens::onViewTypeChanged(unity::dash::ViewType viewType)
329+void Lens::onCategoriesModelChanged(unity::glib::Object<DeeModel> model)
330+{
331+ qWarning() << "categories model changed!";
332+ m_categories->setModel(model);
333+}
334+
335+void Lens::onViewTypeChanged(unity::dash::ScopeViewType viewType)
320336{
321337 Q_EMIT viewTypeChanged( (Lens::ViewType) viewType);
322338}
323339
324−void Lens::onSearchFinished(unity::dash::Lens::Hints const &hints)
340+void Lens::onSearchFinished(const std::string &query, unity::glib::HintsMap const &hints)
325341{
326342 QString hint;
327343
344+ qWarning() << "Result count:" << id() << m_unityLens->results()->count() << QString::fromStdString(m_unityLens->results()->swarm_name) << m_categories->rowCount();
328345 if (!m_unityLens->results()->count()) {
329− unity::dash::Lens::Hints::const_iterator it = hints.find("no-results-hint");
346+ unity::glib::HintsMap::const_iterator it = hints.find("no-results-hint");
330347 if (it != hints.end()) {
331348 hint = QString::fromStdString(it->second.GetString());
332349 } else {
plugins/Unity/lens.h+29−26
@@ -26,7 +26,8 @@
2626#include <QMetaType>
2727
2828// libunity-core
29−#include <UnityCore/Lens.h>
29+#include <UnityCore/Scope.h>
30+#include <UnityCore/Variant.h>
3031
3132// dee-qt
3233#include "deelistmodel.h"
@@ -39,23 +40,23 @@ class Lens : public QObject
3940 Q_ENUMS(ViewType)
4041
4142 Q_PROPERTY(QString id READ id NOTIFY idChanged)
42− Q_PROPERTY(QString dbusName READ dbusName NOTIFY dbusNameChanged)
43− Q_PROPERTY(QString dbusPath READ dbusPath NOTIFY dbusPathChanged)
43+// Q_PROPERTY(QString dbusName READ dbusName NOTIFY dbusNameChanged)
44+// Q_PROPERTY(QString dbusPath READ dbusPath NOTIFY dbusPathChanged)
4445 Q_PROPERTY(QString name READ name NOTIFY nameChanged)
4546 Q_PROPERTY(QString iconHint READ iconHint NOTIFY iconHintChanged)
4647 Q_PROPERTY(QString description READ description NOTIFY descriptionChanged)
4748 Q_PROPERTY(QString searchHint READ searchHint NOTIFY searchHintChanged)
4849 Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged)
49− Q_PROPERTY(bool searchInGlobal READ searchInGlobal NOTIFY searchInGlobalChanged)
50+// Q_PROPERTY(bool searchInGlobal READ searchInGlobal NOTIFY searchInGlobalChanged)
5051 Q_PROPERTY(QString shortcut READ shortcut NOTIFY shortcutChanged)
5152 Q_PROPERTY(bool connected READ connected NOTIFY connectedChanged)
5253 Q_PROPERTY(DeeListModel* results READ results NOTIFY resultsChanged)
53− Q_PROPERTY(DeeListModel* globalResults READ globalResults NOTIFY globalResultsChanged)
54+// Q_PROPERTY(DeeListModel* globalResults READ globalResults NOTIFY globalResultsChanged)
5455 Q_PROPERTY(Categories* categories READ categories NOTIFY categoriesChanged)
5556 Q_PROPERTY(ViewType viewType READ viewType WRITE setViewType NOTIFY viewTypeChanged)
5657
5758 Q_PROPERTY(QString searchQuery READ searchQuery WRITE setSearchQuery NOTIFY searchQueryChanged)
58− Q_PROPERTY(QString globalSearchQuery READ globalSearchQuery WRITE setGlobalSearchQuery NOTIFY globalSearchQueryChanged)
59+// Q_PROPERTY(QString globalSearchQuery READ globalSearchQuery WRITE setGlobalSearchQuery NOTIFY globalSearchQueryChanged)
5960 Q_PROPERTY(QString noResultsHint READ noResultsHint WRITE setNoResultsHint NOTIFY noResultsHintChanged)
6061
6162public:
@@ -69,14 +70,14 @@ public:
6970
7071 /* getters */
7172 QString id() const;
72− QString dbusName() const;
73− QString dbusPath() const;
73+// QString dbusName() const;
74+// QString dbusPath() const;
7475 QString name() const;
7576 QString iconHint() const;
7677 QString description() const;
7778 QString searchHint() const;
7879 bool visible() const;
79− bool searchInGlobal() const;
80+// bool searchInGlobal() const;
8081 QString shortcut() const;
8182 bool connected() const;
8283 DeeListModel* results() const;
@@ -84,18 +85,18 @@ public:
8485 Categories* categories() const;
8586 ViewType viewType() const;
8687 QString searchQuery() const;
87− QString globalSearchQuery() const;
88+// QString globalSearchQuery() const;
8889 QString noResultsHint() const;
8990
9091 /* setters */
9192 void setViewType(const ViewType& viewType);
9293 void setSearchQuery(const QString& search_query);
93− void setGlobalSearchQuery(const QString& search_query);
94+// void setGlobalSearchQuery(const QString& search_query);
9495 void setNoResultsHint(const QString& hint);
9596
9697 Q_INVOKABLE void activate(const QString& uri);
97− void setUnityLens(const unity::dash::Lens::Ptr& lens);
98− unity::dash::Lens::Ptr unityLens() const;
98+ void setUnityLens(const unity::dash::Scope::Ptr& lens);
99+ unity::dash::Scope::Ptr unityLens() const;
99100
100101Q_SIGNALS:
101102 void idChanged(const std::string&);
@@ -106,41 +107,43 @@ Q_SIGNALS:
106107 void descriptionChanged(const std::string&);
107108 void searchHintChanged(const std::string&);
108109 void visibleChanged(bool);
109− void searchInGlobalChanged(bool);
110+// void searchInGlobalChanged(bool);
110111 void shortcutChanged(const std::string&);
111112 void connectedChanged(bool);
112113 void resultsChanged();
113− void globalResultsChanged();
114+// void globalResultsChanged();
114115 void categoriesChanged();
115116 void viewTypeChanged(ViewType);
116− void searchFinished(unity::dash::Lens::Hints const&, unity::glib::Error const&);
117− void globalSearchFinished(unity::dash::Lens::Hints const&, unity::glib::Error const&);
117+ void searchFinished(const std::string&, unity::glib::HintsMap const&, unity::glib::Error const&);
118+// void globalSearchFinished(unity::dash::Lens::Hints const&, unity::glib::Error const&); FIXME pawel
118119 void searchQueryChanged();
119− void globalSearchQueryChanged();
120+// void globalSearchQueryChanged();
120121 void noResultsHintChanged();
121122
122123private Q_SLOTS:
123124 void synchronizeStates();
124− void onSearchFinished(unity::dash::Lens::Hints const &);
125+ void onSearchFinished(const std::string &, unity::glib::HintsMap const &);
125126
126127private:
127128 void onResultsSwarmNameChanged(const std::string&);
128129 void onResultsChanged(const unity::dash::Results::Ptr&);
129− void onGlobalResultsSwarmNameChanged(const std::string&);
130− void onGlobalResultsChanged(const unity::dash::Results::Ptr&);
130+ void onResultsModelChanged(unity::glib::Object<DeeModel>);
131+// void onGlobalResultsSwarmNameChanged(const std::string&);
132+// void onGlobalResultsChanged(const unity::dash::Results::Ptr&);
131133 void onCategoriesSwarmNameChanged(const std::string&);
134+ void onCategoriesModelChanged(unity::glib::Object<DeeModel>);
132135 void onCategoriesChanged(const unity::dash::Categories::Ptr&);
133− void onViewTypeChanged(unity::dash::ViewType);
136+ void onViewTypeChanged(unity::dash::ScopeViewType);
134137
135− void onActivated(std::string const& uri, unity::dash::HandledType type, unity::dash::Lens::Hints const&);
138+ void onActivated(std::string const& uri, unity::dash::ScopeHandledType type, unity::glib::HintsMap const&);
136139 void fallbackActivate(const QString& uri);
137140
138− unity::dash::Lens::Ptr m_unityLens;
141+ unity::dash::Scope::Ptr m_unityLens;
139142 DeeListModel* m_results;
140− DeeListModel* m_globalResults;
143+// DeeListModel* m_globalResults;
141144 Categories* m_categories;
142145 QString m_searchQuery;
143− QString m_globalSearchQuery;
146+// QString m_globalSearchQuery;
144147 QString m_noResultsHint;
145148};
146149
plugins/Unity/lenses.cpp+35−26
@@ -28,24 +28,23 @@
2828#include <QtCore/QStringList>
2929#include <QtGui/QKeySequence>
3030
31−// libunity-core
32−#include <UnityCore/FilesystemLenses.h>
33−#include <UnityCore/HomeLens.h>
34−
3531Lenses::Lenses(QObject *parent)
3632 : QAbstractListModel(parent)
37− , m_unityLenses(std::make_shared<unity::dash::FilesystemLenses>())
38− , m_homeLens(std::make_shared<unity::dash::HomeLens>(QString::fromUtf8(dgettext("unity", "Home")).toStdString(),
33+ , m_unityLenses(std::make_shared<unity::dash::GSettingsScopes>())
34+/* , m_homeLens(std::make_shared<unity::dash::HomeLens>(QString::fromUtf8(dgettext("unity", "Home")).toStdString(),
3935 QString::fromUtf8(dgettext("unity", "Home screen")).toStdString(),
40− QString::fromUtf8(dgettext("unity", "Search")).toStdString()))
36+ QString::fromUtf8(dgettext("unity", "Search")).toStdString()))*/
4137 , m_loaded(false)
4238{
4339 m_roles[Lenses::RoleLens] = "lens";
4440 m_roles[Lenses::RoleId] = "id";
4541 m_roles[Lenses::RoleVisible] = "visible";
4642
47− m_homeLens->AddLenses(m_unityLenses);
48− std::dynamic_pointer_cast<unity::dash::FilesystemLenses>(m_unityLenses)->lenses_loaded.connect(sigc::mem_fun(this, &Lenses::onLensesLoaded));
43+ m_unityLenses->scope_added.connect(sigc::mem_fun(this, &Lenses::onScopeAdded));
44+ m_unityLenses->scope_removed.connect(sigc::mem_fun(this, &Lenses::onScopeRemoved));
45+ m_unityLenses->scopes_reordered.connect(sigc::mem_fun(this, &Lenses::onScopesReordered));
46+ m_unityLenses->LoadScopes();
47+ //std::dynamic_pointer_cast<unity::dash::FilesystemLenses>(m_unityLenses)->lenses_loaded.connect(sigc::mem_fun(this, &Lenses::onLensesLoaded));
4948}
5049
5150QHash<int, QByteArray> Lenses::roleNames() const
@@ -102,12 +101,26 @@ bool Lenses::loaded() const
102101 return m_loaded;
103102}
104103
105−void Lenses::onLensAdded(const unity::dash::Lens::Ptr& lens)
104+void Lenses::onScopeAdded(const unity::dash::Scope::Ptr& scope, int position)
106105{
107106 int index = m_lenses.count();
108107 beginInsertRows(QModelIndex(), index, index);
109− addUnityLens(lens);
108+ addUnityLens(scope);
110109 endInsertRows();
110+
111+ // FIXME: do only once after all loaded?
112+ m_loaded = true;
113+ Q_EMIT loadedChanged(m_loaded);
114+}
115+
116+void Lenses::onScopeRemoved(const unity::dash::Scope::Ptr& scope)
117+{
118+ //TODO pawel
119+}
120+
121+void Lenses::onScopesReordered(const unity::dash::Scopes::ScopeList& scopes)
122+{
123+ //TODO pawel
111124}
112125
113126void Lenses::onLensesLoaded()
@@ -115,29 +128,25 @@ void Lenses::onLensesLoaded()
115128 /* FIXME: this is temporary code that is required on mobile to order
116129 the lenses according to the design.
117130 */
118− QStringList staticLenses;
131+ /*QStringList staticLenses;
119132 staticLenses << "mockmusic.lens" << "people.lens" << "home.lens" << "applications.lens" << "mockvideos.lens";
120133
121134 // not all the lenses are guaranteed to go into the model (only if their UnitCore counterparts exist);
122135 // so build up a list of the valid ones, then add them later.
123− QList<unity::dash::Lens::Ptr> added_lenses;
136+ QList<unity::dash::Scope::Ptr> added_lenses;
124137
125138 // add statically ordered lenses
126139 Q_FOREACH(QString lensId, staticLenses) {
127− if (lensId == "home.lens") {
128− added_lenses << m_homeLens;
129− } else {
130− unity::dash::Lens::Ptr lens = m_unityLenses->GetLens(lensId.toStdString());
131− if (lens != NULL) {
132− added_lenses << lens;
133− }
140+ unity::dash::Scope::Ptr lens = m_unityLenses->GetScope(lensId.toStdString());
141+ if (lens != NULL) {
142+ added_lenses << lens;
134143 }
135144 }
136145
137146 // add remaining lenses
138− unity::dash::Lenses::LensList lensesList = m_unityLenses->GetLenses();
147+ unity::dash::Scopes::ScopeList lensesList = m_unityLenses->GetScopes();
139148 for(auto it = lensesList.begin(); it != lensesList.end(); ++it) {
140− unity::dash::Lens::Ptr lens = (*it);
149+ unity::dash::Scope::Ptr lens = (*it);
141150 if (!staticLenses.contains(QString::fromStdString(lens->id))) {
142151 added_lenses << lens;
143152 }
@@ -146,17 +155,17 @@ void Lenses::onLensesLoaded()
146155 if (added_lenses.count() > 0) {
147156 int index = rowCount();
148157 beginInsertRows(QModelIndex(), index, index+added_lenses.count()-1);
149− Q_FOREACH(unity::dash::Lens::Ptr lens, added_lenses) {
158+ Q_FOREACH(unity::dash::Scope::Ptr lens, added_lenses) {
150159 addUnityLens(lens);
151160 }
152161 endInsertRows();
153− }
162+ }*/
154163
155164 m_loaded = true;
156165 Q_EMIT loadedChanged(m_loaded);
157166
158167 // listen to dynamically added lenses
159− m_homeLens->lens_added.connect(sigc::mem_fun(this, &Lenses::onLensAdded));
168+ //m_homeLens->lens_added.connect(sigc::mem_fun(this, &Lenses::onLensAdded)); //FIXME
160169}
161170
162171void Lenses::onLensPropertyChanged()
@@ -165,7 +174,7 @@ void Lenses::onLensPropertyChanged()
165174 Q_EMIT dataChanged(lensIndex, lensIndex);
166175}
167176
168−void Lenses::addUnityLens(const unity::dash::Lens::Ptr& unity_lens)
177+void Lenses::addUnityLens(const unity::dash::Scope::Ptr& unity_lens)
169178{
170179 Lens* lens = new Lens(this);
171180 lens->setUnityLens(unity_lens);
plugins/Unity/lenses.h+8−6
@@ -25,8 +25,8 @@
2525#include <QList>
2626
2727// libunity-core
28−#include <UnityCore/Lens.h>
29−#include <UnityCore/HomeLens.h>
28+#include <UnityCore/Scope.h>
29+#include <UnityCore/GSettingsScopes.h>
3030
3131namespace unity
3232{
@@ -72,18 +72,20 @@ Q_SIGNALS:
7272 void loadedChanged(bool loaded);
7373
7474private Q_SLOTS:
75− void onLensAdded(const unity::dash::Lens::Ptr& lens);
75+ void onScopeAdded(const unity::dash::Scope::Ptr& lens, int position);
76+ void onScopeRemoved(const unity::dash::Scope::Ptr& scope);
77+ void onScopesReordered(const unity::dash::Scopes::ScopeList& scopes);
7678 void onLensesLoaded();
7779 void onLensPropertyChanged();
7880
7981private:
80− unity::dash::Lenses::Ptr m_unityLenses;
81− unity::dash::HomeLens::Ptr m_homeLens;
82+ unity::dash::GSettingsScopesReader::Ptr m_scopesReader;
83+ unity::dash::Scopes::Ptr m_unityLenses;
8284 QList<Lens*> m_lenses;
8385 QHash<int, QByteArray> m_roles;
8486 bool m_loaded;
8587
86− void addUnityLens(const unity::dash::Lens::Ptr& unity_lens);
88+ void addUnityLens(const unity::dash::Scope::Ptr& unity_lens);
8789 void removeUnityLens(int index);
8890};
8991
plugins/Unity/peoplepreviewdata.cppdeleted−438
@@ -1,438 +0,0 @@
1−/*
2− * Copyright (C) 2012 Canonical, Ltd.
3− *
4− * Authors:
5− * Guenter Schwann <guenter.schwann@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 "peoplepreviewdata.h"
21−
22−#include <QDebug>
23−
24−#include "lens.h"
25−
26−static void phoneAppend(QQmlListProperty<PeoplePhoneData> *property, PeoplePhoneData *val)
27−{
28− Q_UNUSED(val);
29− Q_UNUSED(property);
30−}
31−static PeoplePhoneData *phoneAt(QQmlListProperty<PeoplePhoneData> *property, int index)
32−{
33− PeoplePreviewData *d = static_cast<PeoplePreviewData*>(property->data);
34− return d->phoneNumberList().at(index);
35−}
36−static int phoneCount(QQmlListProperty<PeoplePhoneData> *property)
37−{
38− PeoplePreviewData *d = static_cast<PeoplePreviewData*>(property->data);
39− return d->phoneNumberList().count();
40−}
41−static void phoneClear(QQmlListProperty<PeoplePhoneData> *property)
42−{
43− Q_UNUSED(property);
44−}
45−
46−static void emailAppend(QQmlListProperty<PeopleAddressData> *property, PeopleAddressData *val)
47−{
48− Q_UNUSED(val);
49− Q_UNUSED(property);
50−}
51−static PeopleAddressData *emailAt(QQmlListProperty<PeopleAddressData> *property, int index)
52−{
53− PeoplePreviewData *d = static_cast<PeoplePreviewData*>(property->data);
54− return d->emailAddressesList().at(index);
55−}
56−static int emailCount(QQmlListProperty<PeopleAddressData> *property)
57−{
58− PeoplePreviewData *d = static_cast<PeoplePreviewData*>(property->data);
59− return d->emailAddressesList().count();
60−}
61−static void emailClear(QQmlListProperty<PeopleAddressData> *property)
62−{
63− Q_UNUSED(property);
64−}
65−
66−static void imAppend(QQmlListProperty<PeopleIMData> *property, PeopleIMData *val)
67−{
68− Q_UNUSED(val);
69− Q_UNUSED(property);
70−}
71−static PeopleIMData *imAt(QQmlListProperty<PeopleIMData> *property, int index)
72−{
73− PeoplePreviewData *d = static_cast<PeoplePreviewData*>(property->data);
74− return d->imAccountsList().at(index);
75−}
76−static int imCount(QQmlListProperty<PeopleIMData> *property)
77−{
78− PeoplePreviewData *d = static_cast<PeoplePreviewData*>(property->data);
79− return d->imAccountsList().count();
80−}
81−static void imClear(QQmlListProperty<PeopleIMData> *property)
82−{
83− Q_UNUSED(property);
84−}
85−
86−static void addressAppend(QQmlListProperty<PeopleAddressData> *property, PeopleAddressData *val)
87−{
88− Q_UNUSED(val);
89− Q_UNUSED(property);
90−}
91−static PeopleAddressData *addressAt(QQmlListProperty<PeopleAddressData> *property, int index)
92−{
93− PeoplePreviewData *d = static_cast<PeoplePreviewData*>(property->data);
94− return d->addressesList().at(index);
95−}
96−static int addressCount(QQmlListProperty<PeopleAddressData> *property)
97−{
98− PeoplePreviewData *d = static_cast<PeoplePreviewData*>(property->data);
99− return d->addressesList().count();
100−}
101−static void addressClear(QQmlListProperty<PeopleAddressData> *property)
102−{
103− Q_UNUSED(property);
104−}
105−
106−
107−using namespace unity;
108−
109−PeoplePreviewData::PeoplePreviewData(QObject *parent)
110−: QObject(parent)
111−, m_lens(0)
112−, m_ready(false)
113−{
114−}
115−
116−PeoplePreviewData::~PeoplePreviewData()
117−{
118− clearData();
119−}
120−
121−Lens *PeoplePreviewData::lens() const
122−{
123− return m_lens;
124−}
125−
126−void PeoplePreviewData::setLens(Lens *lens)
127−{
128− if (lens == m_lens)
129− return;
130−
131− setReady(false);
132−
133− if (m_lensConnection.connected())
134− m_lensConnection.disconnect();
135−
136− m_lens = lens;
137− m_lensConnection = m_lens->unityLens()->preview_ready.connect(
138− sigc::mem_fun(this, &PeoplePreviewData::setUnityPreview));
139− Q_EMIT lensChanged();
140−
141− if (!m_uri.isEmpty() && !m_lens)
142− getPeoplePreview();
143−}
144−
145−QString PeoplePreviewData::uri() const
146−{
147− return m_uri;
148−}
149−
150−void PeoplePreviewData::setUri(const QString &uri)
151−{
152− if (uri == m_uri)
153− return;
154−
155− setReady(false);
156−
157− m_uri = uri;
158− Q_EMIT uriChanged();
159− if (!m_uri.isEmpty() && m_lens)
160− getPeoplePreview();
161−}
162−
163−bool PeoplePreviewData::ready() const
164−{
165− return m_ready;
166−}
167−
168−void PeoplePreviewData::setReady(const bool &ready)
169−{
170− if (ready == m_ready)
171− return;
172−
173− m_ready = ready;
174− Q_EMIT readyChanged();
175−}
176−
177−QString PeoplePreviewData::renderName() const
178−{
179− if (!m_unityPreview)
180− return QLatin1String("");
181−
182− return QString::fromStdString(m_unityPreview->renderer_name());
183−}
184−
185−QString PeoplePreviewData::title() const
186−{
187− if (!m_unityPreview)
188− return QLatin1String("");
189−
190− return QString::fromStdString(m_unityPreview->title());
191−}
192−
193−QString PeoplePreviewData::subTitle() const
194−{
195− if (!m_unityPreview)
196− return QLatin1String("");
197−
198− return QString::fromStdString(m_unityPreview->subtitle());
199−}
200−
201−QString PeoplePreviewData::description() const
202−{
203− if (!m_unityPreview)
204− return QLatin1String("");
205−
206− return QString::fromStdString(m_unityPreview->description());
207−}
208−
209−QString PeoplePreviewData::imageSource() const
210−{
211− if (!m_unityPreview)
212− return QLatin1String("");
213−
214− return QString::fromStdString(m_unityPreview->image_source_uri());
215−}
216−
217−QQmlListProperty<PeoplePhoneData> PeoplePreviewData::phoneNumbers()
218−{
219− return QQmlListProperty<PeoplePhoneData> (this, this,
220− phoneAppend,
221− phoneCount,
222− phoneAt,
223− phoneClear);
224−}
225−
226−QQmlListProperty<PeopleAddressData> PeoplePreviewData::emailAddresses()
227−{
228− return QQmlListProperty<PeopleAddressData> (this, this,
229− emailAppend,
230− emailCount,
231− emailAt,
232− emailClear);
233−}
234−
235−QQmlListProperty<PeopleIMData> PeoplePreviewData::imAccounts()
236−{
237− return QQmlListProperty<PeopleIMData> (this, this,
238− imAppend,
239− imCount,
240− imAt,
241− imClear);
242−}
243−
244−QString PeoplePreviewData::displayName() const
245−{
246− if (!m_unityPreview)
247− return QLatin1String("");
248−
249− return QString::fromStdString(m_unityPreview->display_name());
250−}
251−
252−QString PeoplePreviewData::status() const
253−{
254− if (!m_unityPreview)
255− return QLatin1String("");
256−
257− return QString::fromStdString(m_unityPreview->status());
258−}
259−
260−QString PeoplePreviewData::statusTime() const
261−{
262− if (!m_unityPreview)
263− return QLatin1String("");
264−
265− return QString::fromStdString(m_unityPreview->status_time());
266−}
267−
268−QString PeoplePreviewData::statusService() const
269−{
270− if (!m_unityPreview)
271− return QLatin1String("");
272−
273− return QString::fromStdString(m_unityPreview->status_service());
274−}
275−
276−QString PeoplePreviewData::statusServiceIcon() const
277−{
278− if (!m_unityPreview)
279− return QLatin1String("");
280−
281− glib::Object<GIcon> icon = m_unityPreview->status_service_icon();
282− if (!icon)
283− return QLatin1String("");
284−
285− return QString(g_icon_to_string(icon));
286−}
287−
288−QString PeoplePreviewData::statusPostUri() const
289−{
290− if (!m_unityPreview)
291− return QLatin1String("");
292−
293− return QString::fromStdString(m_unityPreview->status_post_uri());
294−}
295−
296−QQmlListProperty<PeopleAddressData> PeoplePreviewData::addresses()
297−{
298− return QQmlListProperty<PeopleAddressData> (this, this,
299− addressAppend,
300− addressCount,
301− addressAt,
302− addressClear);
303−}
304−
305−QString PeoplePreviewData::avatar() const
306−{
307− if (!m_unityPreview)
308− return QLatin1String("");
309−
310− glib::Object<GIcon> avatar = m_unityPreview->avatar();
311− if (!avatar)
312− return QLatin1String("");
313−
314− return QString(g_icon_to_string(avatar));
315−}
316−
317−void PeoplePreviewData::getPeoplePreview()
318−{
319− m_lens->unityLens()->Preview(m_uri.toStdString());
320−}
321−
322−void PeoplePreviewData::setUnityPreview(std::string const& uri, dash::Preview::Ptr const& preview)
323−{
324− if (uri != m_uri.toStdString())
325− return;
326−
327− dash::PeoplePreview::Ptr peoplePtr = std::dynamic_pointer_cast<dash::PeoplePreview>(preview);
328− if (peoplePtr == nullptr) {
329− qWarning() << "Backend returned a dash::Preview that isn't a dash::PeoplePreview";
330− Q_EMIT error();
331− return;
332− }
333−
334− clearData();
335− m_unityPreview = peoplePtr;
336− getPhoneData();
337− getEmailAddresses();
338− getImAccounts();
339− getAddresses();
340−
341− Q_EMIT renderNameChanged();
342− Q_EMIT titleChanged();
343− Q_EMIT subTitleChanged();
344− Q_EMIT descriptionChanged();
345− Q_EMIT imageSourceChanged();
346− Q_EMIT phoneNumbersChanged();
347− Q_EMIT emailAddressesChanged();
348− Q_EMIT imAccountsChanged();
349− Q_EMIT displayNameChanged();
350− Q_EMIT statusChanged();
351− Q_EMIT statusTimeChanged();
352− Q_EMIT statusServiceChanged();
353− Q_EMIT addressesChanged();
354− Q_EMIT avatarChanged();
355−
356− setReady(true);
357−}
358−
359−void PeoplePreviewData::clearData()
360−{
361− while (!m_phoneList.empty()) {
362− PeoplePhoneData *phone = m_phoneList.takeLast();
363− delete phone;
364− }
365− while (!m_emailList.empty()) {
366− PeopleAddressData *email = m_emailList.takeLast();
367− delete email;
368− }
369− while (!m_imList.empty()) {
370− PeopleIMData *im = m_imList.takeLast();
371− delete im;
372− }
373− while (!m_addressList.empty()) {
374− PeopleAddressData *address = m_addressList.takeLast();
375− delete address;
376− }
377−}
378−
379−void PeoplePreviewData::getPhoneData()
380−{
381− dash::PeoplePreview::PhonePtrList uPhoneList;
382− uPhoneList = m_unityPreview->GetPhone();
383−
384− for (size_t i=0; i<uPhoneList.size(); ++i) {
385− PeoplePhoneData *phone = new PeoplePhoneData;
386− phone->m_type = QString::fromStdString(uPhoneList[i]->type);
387− phone->m_location = QString::fromStdString(uPhoneList[i]->location);
388− phone->m_number = QString::fromStdString(uPhoneList[i]->number);
389− m_phoneList.append(phone);
390− }
391−}
392−
393−void PeoplePreviewData::getEmailAddresses()
394−{
395− dash::PeoplePreview::EmailPtrList uEmailList;
396− uEmailList = m_unityPreview->GetEmail();
397−
398− for (size_t i=0; i<uEmailList.size(); ++i) {
399− PeopleAddressData *email = new PeopleAddressData;
400− email->m_type = QString::fromStdString(uEmailList[i]->type);
401− email->m_address = QString::fromStdString(uEmailList[i]->address);
402− m_emailList.append(email);
403− }
404−}
405−
406−void PeoplePreviewData::getImAccounts()
407−{
408− dash::PeoplePreview::IMAccountPtrList uIMList;
409− uIMList = m_unityPreview->GetIMAccount();
410−
411− for (size_t i=0; i<uIMList.size(); ++i) {
412− PeopleIMData *im = new PeopleIMData;
413− im->m_protocol = QString::fromStdString(uIMList[i]->protocol);
414− im->m_address = QString::fromStdString(uIMList[i]->address);
415− m_imList.append(im);
416− }
417−}
418−
419−void PeoplePreviewData::getAddresses()
420−{
421− dash::PeoplePreview::AddressPtrList uAddressList;
422− uAddressList = m_unityPreview->GetAddress();
423−
424− for (size_t i=0; i<uAddressList.size(); ++i) {
425− PeopleAddressData *address = new PeopleAddressData;
426− address->m_type = QString::fromStdString(uAddressList[i]->type);
427− address->m_address = QString::fromStdString(uAddressList[i]->address);
428− address->m_poBox = QString::fromStdString(uAddressList[i]->po_box);
429− address->m_extension = QString::fromStdString(uAddressList[i]->extension);
430− address->m_street = QString::fromStdString(uAddressList[i]->street);
431− address->m_locality = QString::fromStdString(uAddressList[i]->locality);
432− address->m_region = QString::fromStdString(uAddressList[i]->region);
433− address->m_postalCode = QString::fromStdString(uAddressList[i]->postal_code);
434− address->m_country = QString::fromStdString(uAddressList[i]->country);
435− address->m_addressFormat = QString::fromStdString(uAddressList[i]->address_format);
436− m_addressList.append(address);
437− }
438−}
plugins/Unity/peoplepreviewdata.hdeleted−251
@@ -1,251 +0,0 @@
1−/*
2− * Copyright (C) 2012 Canonical, Ltd.
3− *
4− * Authors:
5− * Guenter Schwann <guenter.schwann@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 PEOPLEPREVIEWDATA_H
21−#define PEOPLEPREVIEWDATA_H
22−
23−#include <QList>
24−#include <QObject>
25−#include <qqmllist.h>
26−#include <QString>
27−
28−// libunity-core
29−#include <UnityCore/PeoplePreview.h>
30−
31−#include <sigc++/connection.h>
32−
33−class Lens;
34−
35−/*!
36− * \brief The PeoplePhoneData class stores the data for one phone number
37− */
38−class PeoplePhoneData : public QObject
39−{
40− Q_OBJECT
41− Q_PROPERTY(QString type READ type NOTIFY typeChanged)
42− Q_PROPERTY(QString location READ location NOTIFY locationChanged)
43− Q_PROPERTY(QString number READ number NOTIFY numberChanged)
44−
45−Q_SIGNALS:
46− void typeChanged();
47− void locationChanged();
48− void numberChanged();
49−
50−public:
51− explicit PeoplePhoneData(QObject *parent = 0) : QObject(parent) {}
52− QString type() const { return m_type; }
53− QString location() const { return m_location; }
54− QString number() const { return m_number; }
55−
56−private:
57− QString m_type;
58− QString m_location;
59− QString m_number;
60− friend class PeoplePreviewData;
61−};
62−
63−/*!
64− * \brief The PeopleAddressData class stores the data for one single post/email address
65− */
66−class PeopleAddressData : public QObject
67−{
68− Q_OBJECT
69− Q_PROPERTY(QString type READ type NOTIFY typeChanged)
70− Q_PROPERTY(QString address READ address NOTIFY addressChanged)
71− Q_PROPERTY(QString poBox READ poBox NOTIFY poBoxChanged)
72− Q_PROPERTY(QString extension READ extension NOTIFY extensionChanged)
73− Q_PROPERTY(QString street READ street NOTIFY streetChanged)
74− Q_PROPERTY(QString locality READ locality NOTIFY localityChanged)
75− Q_PROPERTY(QString region READ region NOTIFY regionChanged)
76− Q_PROPERTY(QString postalCode READ postalCode NOTIFY postalCodeChanged)
77− Q_PROPERTY(QString country READ country NOTIFY countryChanged)
78− Q_PROPERTY(QString addressFormat READ addressFormat NOTIFY addressFormatChanged)
79−
80−Q_SIGNALS:
81− void typeChanged();
82− void addressChanged();
83− void poBoxChanged();
84− void extensionChanged();
85− void streetChanged();
86− void localityChanged();
87− void regionChanged();
88− void postalCodeChanged();
89− void countryChanged();
90− void addressFormatChanged();
91−
92−public:
93− explicit PeopleAddressData(QObject *parent = 0) : QObject(parent) {}
94− QString type() const { return m_type; }
95− QString address() const { return m_address; }
96− QString poBox() const { return m_poBox; }
97− QString extension() const { return m_extension; }
98− QString street() const { return m_street; }
99− QString locality() const { return m_locality; }
100− QString region() const { return m_region; }
101− QString postalCode() const { return m_postalCode; }
102− QString country() const { return m_country; }
103− QString addressFormat() const { return m_addressFormat; }
104−
105−private:
106− QString m_type;
107− QString m_address;
108− QString m_poBox;
109− QString m_extension;
110− QString m_street;
111− QString m_locality;
112− QString m_region;
113− QString m_postalCode;
114− QString m_country;
115− QString m_addressFormat;
116− friend class PeoplePreviewData;
117−};
118−
119−/*!
120− * \brief The PeopleIMData class stores the data for one single post/email address
121− */
122−class PeopleIMData : public QObject
123−{
124− Q_OBJECT
125− Q_PROPERTY(QString protocol READ protocol NOTIFY protocolChanged)
126− Q_PROPERTY(QString address READ address NOTIFY addressChanged)
127−
128−Q_SIGNALS:
129− void protocolChanged();
130− void addressChanged();
131−
132−public:
133− explicit PeopleIMData(QObject *parent = 0) : QObject(parent) {}
134− QString protocol() const { return m_protocol; }
135− QString address() const { return m_address; }
136−
137−private:
138− QString m_protocol;
139− QString m_address;
140− friend class PeoplePreviewData;
141−};
142−
143−
144−/*!
145− * \brief The PeoplePreviewData class providing information for one person
146− */
147−class PeoplePreviewData : public QObject
148−{
149− Q_OBJECT
150−
151− // These properties need to be set from QML
152− Q_PROPERTY(Lens* lens READ lens WRITE setLens NOTIFY lensChanged)
153− Q_PROPERTY(QString uri READ uri WRITE setUri NOTIFY uriChanged)
154− // Read only properties containing general Preview information
155− Q_PROPERTY(bool ready READ ready NOTIFY readyChanged)
156− Q_PROPERTY(QString renderName READ renderName NOTIFY renderNameChanged)
157− Q_PROPERTY(QString title READ title NOTIFY titleChanged)
158− Q_PROPERTY(QString subTitle READ subTitle NOTIFY subTitleChanged)
159− Q_PROPERTY(QString description READ description NOTIFY descriptionChanged)
160− Q_PROPERTY(QString imageSource READ imageSource NOTIFY imageSourceChanged)
161− // Read only properties containing PeoplePreview specific information
162− Q_PROPERTY(QString displayName READ displayName NOTIFY displayNameChanged)
163− Q_PROPERTY(QQmlListProperty<PeopleAddressData> emailAddresses READ emailAddresses NOTIFY emailAddressesChanged)
164− Q_PROPERTY(QQmlListProperty<PeoplePhoneData> phoneNumbers READ phoneNumbers NOTIFY phoneNumbersChanged)
165− Q_PROPERTY(QQmlListProperty<PeopleIMData> imAccounts READ imAccounts NOTIFY imAccountsChanged)
166− Q_PROPERTY(QString status READ status NOTIFY statusChanged)
167− Q_PROPERTY(QString statusTime READ statusTime NOTIFY statusTimeChanged)
168− Q_PROPERTY(QString statusService READ statusService NOTIFY statusServiceChanged)
169− Q_PROPERTY(QString statusServiceIcon READ statusServiceIcon NOTIFY statusServiceIconChanged)
170− Q_PROPERTY(QString statusPostUri READ statusPostUri NOTIFY statusPostUriChanged)
171− Q_PROPERTY(QQmlListProperty<PeopleAddressData> addresses READ addresses NOTIFY addressesChanged)
172− Q_PROPERTY(QString avatar READ avatar NOTIFY avatarChanged)
173−
174−public:
175− PeoplePreviewData(QObject *parent = 0);
176− ~PeoplePreviewData();
177−
178− void setUnityPeoplePreview(const unity::dash::Preview::Ptr& preview);
179− void setLens(Lens *lens);
180− void setUri(const QString &uri);
181−
182− Lens *lens() const;
183− QString uri() const;
184− bool ready() const;
185− QString renderName() const;
186− QString title() const;
187− QString subTitle() const;
188− QString description() const;
189− QString imageSource() const;
190− QString displayName() const;
191− QQmlListProperty<PeoplePhoneData> phoneNumbers();
192− QQmlListProperty<PeopleAddressData> emailAddresses();
193− QQmlListProperty<PeopleIMData> imAccounts();
194− QString status() const;
195− QString statusTime() const;
196− QString statusService() const;
197− QString statusServiceIcon() const;
198− QString statusPostUri() const;
199− QQmlListProperty<PeopleAddressData> addresses();
200− QString avatar() const;
201−
202− QList<PeoplePhoneData*> &phoneNumberList() { return m_phoneList; }
203− QList<PeopleAddressData*> &emailAddressesList() { return m_emailList; }
204− QList<PeopleIMData*> &imAccountsList() { return m_imList; }
205− QList<PeopleAddressData*> &addressesList() { return m_addressList; }
206−
207−Q_SIGNALS:
208− void lensChanged();
209− void uriChanged();
210− void readyChanged();
211− void renderNameChanged();
212− void titleChanged();
213− void subTitleChanged();
214− void descriptionChanged();
215− void imageSourceChanged();
216− void displayNameChanged();
217− void phoneNumbersChanged();
218− void emailAddressesChanged();
219− void imAccountsChanged();
220− void statusChanged();
221− void statusTimeChanged();
222− void statusServiceChanged();
223− void statusServiceIconChanged();
224− void statusPostUriChanged();
225− void addressesChanged();
226− void avatarChanged();
227− void error();
228−
229−private:
230− void setReady(const bool &ready);
231− void getPeoplePreview();
232− void setUnityPreview(std::string const& uri, unity::dash::Preview::Ptr const& preview);
233− void clearData();
234− void getPhoneData();
235− void getEmailAddresses();
236− void getImAccounts();
237− void getAddresses();
238−
239− Lens *m_lens;
240− sigc::connection m_lensConnection;
241− QString m_uri;
242− bool m_ready;
243− unity::dash::PeoplePreview::Ptr m_unityPreview;
244−
245− QList<PeoplePhoneData*> m_phoneList;
246− QList<PeopleAddressData*> m_addressList;
247− QList<PeopleIMData*> m_imList;
248− QList<PeopleAddressData*> m_emailList;
249−};
250−
251−#endif // PEOPLEPREVIEWDATA_H
plugins/Unity/plugin.cpp−5
@@ -28,7 +28,6 @@
2828#include "lenses.h"
2929#include "categories.h"
3030#include "categoryfilter.h"
31−#include "peoplepreviewdata.h"
3231#include "bottombarvisibilitycommunicatorshell.h"
3332#include "launchermodel.h"
3433
@@ -46,10 +45,6 @@ void UnityPlugin::registerTypes(const char *uri)
4645 qmlRegisterType<Categories>(uri, 0, 1, "Categories");
4746 qmlRegisterType<CategoryFilter>(uri, 0, 1, "CategoryFilter");
4847 qmlRegisterType<DeeListModel>(uri, 0, 1, "DeeListModel");
49− qmlRegisterType<PeoplePreviewData>(uri, 0, 1, "PeoplePreviewData");
50− qmlRegisterType<PeoplePhoneData>(uri, 0, 1, "PeoplePhoneData");
51− qmlRegisterType<PeopleAddressData>(uri, 0, 1, "PeopleAddressData");
52− qmlRegisterType<PeopleIMData>(uri, 0, 1, "PeopleIMData");
5348 qmlRegisterType<LauncherModel>(uri, 0, 1, "LauncherModel");
5449 qmlRegisterUncreatableType<LauncherItem>(uri, 0, 1, "LauncherItem", "Can't create new Launcher Items in QML. Get them from the LauncherModel.");
5550 qmlRegisterUncreatableType<BottomBarVisibilityCommunicatorShell>(uri, 0, 1, "BottomBarVisibilityCommunicatorShell", "Can't create BottomBarVisibilityCommunicatorShell");
tests/qmltests/plugins/Unity/fake_lens.cpp+2−2
@@ -35,7 +35,7 @@ Lens::Lens(QObject* parent)
3535 m_results->setModel(create_results_model(4, 30));
3636
3737 m_categories->setResultModel(m_results);
38− m_categories->setGlobalResultModel(m_results);
38+// m_categories->setGlobalResultModel(m_results);
3939}
4040
4141Lens::Lens(QString const& id,
@@ -53,7 +53,7 @@ Lens::Lens(QString const& id,
5353 m_results->setModel(create_results_model(4, 30));
5454
5555 m_categories->setResultModel(m_results);
56− m_categories->setGlobalResultModel(m_results);
56+// m_categories->setGlobalResultModel(m_results);
5757}
5858
5959QString Lens::id() const {