on xenial help sign in
Renamed Lens/Lenses to Scope/Scopes.
commit38257fa3e56617168fb6dac3a7cb1e5dc0d6f3e9 authorPawel Stolowski <pawel.stolowski@canonical.com> dateThu 6 Jun 2013, 12:37 (13 years ago) parent5fbee09
5 files changed+163−169
plugins/Unity/lens.cpp+79−79 plugins/Unity/lens.h+9−9 plugins/Unity/lenses.cpp+59−65 plugins/Unity/lenses.h+14−14 plugins/Unity/plugin.cpp+2−2
plugins/Unity/lens.cpp+79−79
@@ -28,7 +28,7 @@
2828
2929#include <libintl.h>
3030
31−Lens::Lens(QObject *parent) :
31+Scope::Scope(QObject *parent) :
3232 QObject(parent)
3333{
3434 m_results = new DeeListModel(this);
@@ -37,77 +37,77 @@ Lens::Lens(QObject *parent) :
3737 m_categories->setResultModel(m_results);
3838}
3939
40−QString Lens::id() const
40+QString Scope::id() const
4141{
42− return QString::fromStdString(m_unityLens->id());
42+ return QString::fromStdString(m_unityScope->id());
4343}
4444
45−QString Lens::name() const
45+QString Scope::name() const
4646{
47− return QString::fromStdString(m_unityLens->name());
47+ return QString::fromStdString(m_unityScope->name());
4848}
4949
50−QString Lens::iconHint() const
50+QString Scope::iconHint() const
5151{
52− return QString::fromStdString(m_unityLens->icon_hint());
52+ return QString::fromStdString(m_unityScope->icon_hint());
5353}
5454
55−QString Lens::description() const
55+QString Scope::description() const
5656{
57− return QString::fromStdString(m_unityLens->description());
57+ return QString::fromStdString(m_unityScope->description());
5858}
5959
60−QString Lens::searchHint() const
60+QString Scope::searchHint() const
6161{
62− return QString::fromStdString(m_unityLens->search_hint());
62+ return QString::fromStdString(m_unityScope->search_hint());
6363}
6464
65−bool Lens::visible() const
65+bool Scope::visible() const
6666{
67− return m_unityLens->visible();
67+ return m_unityScope->visible();
6868}
6969
70−QString Lens::shortcut() const
70+QString Scope::shortcut() const
7171{
72− return QString::fromStdString(m_unityLens->shortcut());
72+ return QString::fromStdString(m_unityScope->shortcut());
7373}
7474
75−bool Lens::connected() const
75+bool Scope::connected() const
7676{
77− return m_unityLens->connected();
77+ return m_unityScope->connected();
7878}
7979
80−DeeListModel* Lens::results() const
80+DeeListModel* Scope::results() const
8181{
8282 return m_results;
8383}
8484
85−Categories* Lens::categories() const
85+Categories* Scope::categories() const
8686{
8787 return m_categories;
8888}
8989
90−Lens::ViewType Lens::viewType() const
90+Scope::ViewType Scope::viewType() const
9191{
92− return (Lens::ViewType) m_unityLens->view_type();
92+ return (Scope::ViewType) m_unityScope->view_type();
9393}
9494
95−QString Lens::searchQuery() const
95+QString Scope::searchQuery() const
9696{
9797 return m_searchQuery;
9898}
9999
100−QString Lens::noResultsHint() const
100+QString Scope::noResultsHint() const
101101{
102102 return m_noResultsHint;
103103}
104104
105−void Lens::setViewType(const Lens::ViewType& viewType)
105+void Scope::setViewType(const Scope::ViewType& viewType)
106106{
107− m_unityLens->view_type = (unity::dash::ScopeViewType) viewType;
107+ m_unityScope->view_type = (unity::dash::ScopeViewType) viewType;
108108}
109109
110−void Lens::setSearchQuery(const QString& search_query)
110+void Scope::setSearchQuery(const QString& search_query)
111111{
112112 /* Checking for m_searchQuery.isNull() which returns true only when the string
113113 has never been set is necessary because when search_query is the empty
@@ -116,31 +116,31 @@ void Lens::setSearchQuery(const QString& search_query)
116116 */
117117 if (m_searchQuery.isNull() || search_query != m_searchQuery) {
118118 m_searchQuery = search_query;
119− m_unityLens->Search(search_query.toStdString(), sigc::mem_fun(this, &Lens::searchFinished));
119+ m_unityScope->Search(search_query.toStdString(), sigc::mem_fun(this, &Scope::searchFinished));
120120 Q_EMIT searchQueryChanged();
121121 }
122122}
123123
124−void Lens::setNoResultsHint(const QString& hint) {
124+void Scope::setNoResultsHint(const QString& hint) {
125125 if (hint != m_noResultsHint) {
126126 m_noResultsHint = hint;
127127 Q_EMIT noResultsHintChanged();
128128 }
129129}
130130
131−void Lens::activate(const QString& uri)
131+void Scope::activate(const QString& uri)
132132{
133−// m_unityLens->Activate(QByteArray::fromPercentEncoding(uri.toUtf8()).constData()); FIXME pawel
133+// m_unityScope->Activate(QByteArray::fromPercentEncoding(uri.toUtf8()).constData()); FIXME pawel
134134}
135135
136−void Lens::onActivated(unity::dash::LocalResult const& result, unity::dash::ScopeHandledType type, unity::glib::HintsMap const&)
136+void Scope::onActivated(unity::dash::LocalResult const& result, unity::dash::ScopeHandledType type, unity::glib::HintsMap const&)
137137{
138138 if (type == unity::dash::NOT_HANDLED) {
139139 fallbackActivate(QString::fromStdString(result.uri));
140140 }
141141}
142142
143−void Lens::fallbackActivate(const QString& uri)
143+void Scope::fallbackActivate(const QString& uri)
144144{
145145 /* FIXME: stripping all content before the first column because for some
146146 reason the lenses give uri with junk content at their beginning.
@@ -174,110 +174,110 @@ void Lens::fallbackActivate(const QString& uri)
174174 QDesktopServices::openUrl(url);
175175}
176176
177−void Lens::setUnityLens(const unity::dash::Scope::Ptr& lens)
177+void Scope::setUnityScope(const unity::dash::Scope::Ptr& lens)
178178{
179− m_unityLens = lens;
179+ m_unityScope = lens;
180180
181− if (QString::fromStdString(m_unityLens->results()->swarm_name) == QString(":local")) {
182− m_results->setModel(m_unityLens->results()->model());
181+ if (QString::fromStdString(m_unityScope->results()->swarm_name) == QString(":local")) {
182+ m_results->setModel(m_unityScope->results()->model());
183183 } else {
184− m_results->setName(QString::fromStdString(m_unityLens->results()->swarm_name));
184+ m_results->setName(QString::fromStdString(m_unityScope->results()->swarm_name));
185185 }
186186
187− if (QString::fromStdString(m_unityLens->categories()->swarm_name) == QString(":local")) {
188− m_categories->setModel(m_unityLens->categories()->model());
187+ if (QString::fromStdString(m_unityScope->categories()->swarm_name) == QString(":local")) {
188+ m_categories->setModel(m_unityScope->categories()->model());
189189 } else {
190− m_categories->setName(QString::fromStdString(m_unityLens->categories()->swarm_name));
190+ m_categories->setName(QString::fromStdString(m_unityScope->categories()->swarm_name));
191191 }
192192
193193 /* Property change signals */
194− m_unityLens->id.changed.connect(sigc::mem_fun(this, &Lens::idChanged));
195− m_unityLens->name.changed.connect(sigc::mem_fun(this, &Lens::nameChanged));
196− m_unityLens->icon_hint.changed.connect(sigc::mem_fun(this, &Lens::iconHintChanged));
197− m_unityLens->description.changed.connect(sigc::mem_fun(this, &Lens::descriptionChanged));
198− m_unityLens->search_hint.changed.connect(sigc::mem_fun(this, &Lens::searchHintChanged));
199− m_unityLens->visible.changed.connect(sigc::mem_fun(this, &Lens::visibleChanged));
200− m_unityLens->shortcut.changed.connect(sigc::mem_fun(this, &Lens::shortcutChanged));
201− m_unityLens->connected.changed.connect(sigc::mem_fun(this, &Lens::connectedChanged));
202− m_unityLens->results.changed.connect(sigc::mem_fun(this, &Lens::onResultsChanged));
203− m_unityLens->results()->swarm_name.changed.connect(sigc::mem_fun(this, &Lens::onResultsSwarmNameChanged));
204− m_unityLens->results()->model.changed.connect(sigc::mem_fun(this, &Lens::onResultsModelChanged));
205− m_unityLens->categories()->model.changed.connect(sigc::mem_fun(this, &Lens::onCategoriesModelChanged));
206− m_unityLens->categories.changed.connect(sigc::mem_fun(this, &Lens::onCategoriesChanged));
207− m_unityLens->categories()->swarm_name.changed.connect(sigc::mem_fun(this, &Lens::onCategoriesSwarmNameChanged));
208− m_unityLens->view_type.changed.connect(sigc::mem_fun(this, &Lens::onViewTypeChanged));
194+ m_unityScope->id.changed.connect(sigc::mem_fun(this, &Scope::idChanged));
195+ m_unityScope->name.changed.connect(sigc::mem_fun(this, &Scope::nameChanged));
196+ m_unityScope->icon_hint.changed.connect(sigc::mem_fun(this, &Scope::iconHintChanged));
197+ m_unityScope->description.changed.connect(sigc::mem_fun(this, &Scope::descriptionChanged));
198+ m_unityScope->search_hint.changed.connect(sigc::mem_fun(this, &Scope::searchHintChanged));
199+ m_unityScope->visible.changed.connect(sigc::mem_fun(this, &Scope::visibleChanged));
200+ m_unityScope->shortcut.changed.connect(sigc::mem_fun(this, &Scope::shortcutChanged));
201+ m_unityScope->connected.changed.connect(sigc::mem_fun(this, &Scope::connectedChanged));
202+ m_unityScope->results.changed.connect(sigc::mem_fun(this, &Scope::onResultsChanged));
203+ m_unityScope->results()->swarm_name.changed.connect(sigc::mem_fun(this, &Scope::onResultsSwarmNameChanged));
204+ m_unityScope->results()->model.changed.connect(sigc::mem_fun(this, &Scope::onResultsModelChanged));
205+ m_unityScope->categories()->model.changed.connect(sigc::mem_fun(this, &Scope::onCategoriesModelChanged));
206+ m_unityScope->categories.changed.connect(sigc::mem_fun(this, &Scope::onCategoriesChanged));
207+ m_unityScope->categories()->swarm_name.changed.connect(sigc::mem_fun(this, &Scope::onCategoriesSwarmNameChanged));
208+ m_unityScope->view_type.changed.connect(sigc::mem_fun(this, &Scope::onViewTypeChanged));
209209
210210 /* Signals forwarding */
211211 connect(this, SIGNAL(searchFinished(const std::string &, unity::glib::HintsMap const &, unity::glib::Error const &)), SLOT(onSearchFinished(const std::string &, unity::glib::HintsMap const &)));
212212
213213 /* FIXME: signal should be forwarded instead of calling the handler directly */
214− m_unityLens->activated.connect(sigc::mem_fun(this, &Lens::onActivated));
214+ m_unityScope->activated.connect(sigc::mem_fun(this, &Scope::onActivated));
215215
216− /* Synchronize local states with m_unityLens right now and whenever
217− m_unityLens becomes connected */
216+ /* Synchronize local states with m_unityScope right now and whenever
217+ m_unityScope becomes connected */
218218 /* FIXME: should emit change notification signals for all properties */
219219 connect(this, SIGNAL(connectedChanged(bool)), SLOT(synchronizeStates()));
220220 synchronizeStates();
221221}
222222
223−unity::dash::Scope::Ptr Lens::unityLens() const
223+unity::dash::Scope::Ptr Scope::unityScope() const
224224{
225− return m_unityLens;
225+ return m_unityScope;
226226}
227227
228−void Lens::synchronizeStates()
228+void Scope::synchronizeStates()
229229{
230230 if (connected()) {
231− /* Forward local states to m_unityLens */
231+ /* Forward local states to m_unityScope */
232232 if (!m_searchQuery.isNull()) {
233− m_unityLens->Search(m_searchQuery.toStdString());
233+ m_unityScope->Search(m_searchQuery.toStdString());
234234 }
235235 }
236236}
237237
238−void Lens::onResultsSwarmNameChanged(const std::string& /* swarm_name */)
238+void Scope::onResultsSwarmNameChanged(const std::string& /* swarm_name */)
239239{
240− m_results->setName(QString::fromStdString(m_unityLens->results()->swarm_name));
240+ m_results->setName(QString::fromStdString(m_unityScope->results()->swarm_name));
241241}
242242
243−void Lens::onResultsChanged(const unity::dash::Results::Ptr& /* results */)
243+void Scope::onResultsChanged(const unity::dash::Results::Ptr& /* results */)
244244{
245− m_results->setName(QString::fromStdString(m_unityLens->results()->swarm_name));
245+ m_results->setName(QString::fromStdString(m_unityScope->results()->swarm_name));
246246}
247247
248−void Lens::onResultsModelChanged(unity::glib::Object<DeeModel> model)
248+void Scope::onResultsModelChanged(unity::glib::Object<DeeModel> model)
249249{
250− m_results->setModel(m_unityLens->results()->model());
250+ m_results->setModel(m_unityScope->results()->model());
251251}
252252
253−void Lens::onCategoriesSwarmNameChanged(const std::string& /* swarm_name */)
253+void Scope::onCategoriesSwarmNameChanged(const std::string& /* swarm_name */)
254254{
255− m_categories->setName(QString::fromStdString(m_unityLens->categories()->swarm_name));
255+ m_categories->setName(QString::fromStdString(m_unityScope->categories()->swarm_name));
256256}
257257
258−void Lens::onCategoriesChanged(const unity::dash::Categories::Ptr& /* categories */)
258+void Scope::onCategoriesChanged(const unity::dash::Categories::Ptr& /* categories */)
259259{
260260 qWarning() << "categories changed!";
261− m_categories->setName(QString::fromStdString(m_unityLens->categories()->swarm_name));
261+ m_categories->setName(QString::fromStdString(m_unityScope->categories()->swarm_name));
262262}
263263
264−void Lens::onCategoriesModelChanged(unity::glib::Object<DeeModel> model)
264+void Scope::onCategoriesModelChanged(unity::glib::Object<DeeModel> model)
265265{
266266 qWarning() << "categories model changed!";
267267 m_categories->setModel(model);
268268}
269269
270−void Lens::onViewTypeChanged(unity::dash::ScopeViewType viewType)
270+void Scope::onViewTypeChanged(unity::dash::ScopeViewType viewType)
271271{
272− Q_EMIT viewTypeChanged( (Lens::ViewType) viewType);
272+ Q_EMIT viewTypeChanged( (Scope::ViewType) viewType);
273273}
274274
275−void Lens::onSearchFinished(const std::string &query, unity::glib::HintsMap const &hints)
275+void Scope::onSearchFinished(const std::string &query, unity::glib::HintsMap const &hints)
276276{
277277 QString hint;
278278
279− qWarning() << "Result count:" << id() << m_unityLens->results()->count() << QString::fromStdString(m_unityLens->results()->swarm_name) << m_categories->rowCount();
280− if (!m_unityLens->results()->count()) {
279+ qWarning() << "Result count:" << id() << m_unityScope->results()->count() << QString::fromStdString(m_unityScope->results()->swarm_name) << m_categories->rowCount();
280+ if (!m_unityScope->results()->count()) {
281281 unity::glib::HintsMap::const_iterator it = hints.find("no-results-hint");
282282 if (it != hints.end()) {
283283 hint = QString::fromStdString(it->second.GetString());
plugins/Unity/lens.h+9−9
@@ -17,8 +17,8 @@
1717 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1818 */
1919
20−#ifndef LENS_H
21−#define LENS_H
20+#ifndef SCOPE_H
21+#define SCOPE_H
2222
2323// Qt
2424#include <QObject>
@@ -35,7 +35,7 @@
3535
3636class Categories;
3737
38−class Lens : public QObject
38+class Scope : public QObject
3939{
4040 Q_OBJECT
4141 Q_ENUMS(ViewType)
@@ -56,7 +56,7 @@ class Lens : public QObject
5656 Q_PROPERTY(QString noResultsHint READ noResultsHint WRITE setNoResultsHint NOTIFY noResultsHintChanged)
5757
5858public:
59− explicit Lens(QObject *parent = 0);
59+ explicit Scope(QObject *parent = 0);
6060
6161 enum ViewType {
6262 Hidden,
@@ -86,8 +86,8 @@ public:
8686 void setNoResultsHint(const QString& hint);
8787
8888 Q_INVOKABLE void activate(const QString& uri);
89− void setUnityLens(const unity::dash::Scope::Ptr& lens);
90− unity::dash::Scope::Ptr unityLens() const;
89+ void setUnityScope(const unity::dash::Scope::Ptr& scope);
90+ unity::dash::Scope::Ptr unityScope() const;
9191
9292Q_SIGNALS:
9393 void idChanged(const std::string&);
@@ -123,13 +123,13 @@ private:
123123 void onActivated(unity::dash::LocalResult const& result, unity::dash::ScopeHandledType type, unity::glib::HintsMap const&);
124124 void fallbackActivate(const QString& uri);
125125
126− unity::dash::Scope::Ptr m_unityLens;
126+ unity::dash::Scope::Ptr m_unityScope;
127127 DeeListModel* m_results;
128128 Categories* m_categories;
129129 QString m_searchQuery;
130130 QString m_noResultsHint;
131131};
132132
133−Q_DECLARE_METATYPE(Lens*)
133+Q_DECLARE_METATYPE(Scope*)
134134
135−#endif // LENS_H
135+#endif // SCOPE_H
plugins/Unity/lenses.cpp+59−65
@@ -28,37 +28,34 @@
2828#include <QtCore/QStringList>
2929#include <QtGui/QKeySequence>
3030
31−Lenses::Lenses(QObject *parent)
31+Scopes::Scopes(QObject *parent)
3232 : QAbstractListModel(parent)
33− , m_unityLenses(std::make_shared<unity::dash::GSettingsScopes>())
34−/* , m_homeLens(std::make_shared<unity::dash::HomeLens>(QString::fromUtf8(dgettext("unity", "Home")).toStdString(),
35− QString::fromUtf8(dgettext("unity", "Home screen")).toStdString(),
36− QString::fromUtf8(dgettext("unity", "Search")).toStdString()))*/
33+ , m_unityScopes(std::make_shared<unity::dash::GSettingsScopes>())
3734 , m_loaded(false)
3835{
39− m_roles[Lenses::RoleLens] = "lens";
40− m_roles[Lenses::RoleId] = "id";
41− m_roles[Lenses::RoleVisible] = "visible";
42−
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();
36+ m_roles[Scopes::RoleLens] = "lens";
37+ m_roles[Scopes::RoleId] = "id";
38+ m_roles[Scopes::RoleVisible] = "visible";
39+
40+ m_unityScopes->scope_added.connect(sigc::mem_fun(this, &Scopes::onScopeAdded));
41+ m_unityScopes->scope_removed.connect(sigc::mem_fun(this, &Scopes::onScopeRemoved));
42+ m_unityScopes->scopes_reordered.connect(sigc::mem_fun(this, &Scopes::onScopesReordered));
43+ m_unityScopes->LoadScopes();
4744}
4845
49−QHash<int, QByteArray> Lenses::roleNames() const
46+QHash<int, QByteArray> Scopes::roleNames() const
5047{
5148 return m_roles;
5249}
5350
54−int Lenses::rowCount(const QModelIndex& parent) const
51+int Scopes::rowCount(const QModelIndex& parent) const
5552{
5653 Q_UNUSED(parent)
5754
58− return m_lenses.count();
55+ return m_scopes.count();
5956}
6057
61−QVariant Lenses::data(const QModelIndex& index, int role) const
58+QVariant Scopes::data(const QModelIndex& index, int role) const
6259{
6360 Q_UNUSED(role)
6461
@@ -66,45 +63,45 @@ QVariant Lenses::data(const QModelIndex& index, int role) const
6663 return QVariant();
6764 }
6865
69− Lens* lens = m_lenses.at(index.row());
66+ Scope* scope = m_scopes.at(index.row());
7067
71− if (role == Lenses::RoleLens) {
72− return QVariant::fromValue(lens);
73− } else if (role == Lenses::RoleId) {
74− return QVariant::fromValue(lens->id());
75− } else if (role == Lenses::RoleVisible) {
76− return QVariant::fromValue(lens->visible());
68+ if (role == Scopes::RoleLens) {
69+ return QVariant::fromValue(scope);
70+ } else if (role == Scopes::RoleId) {
71+ return QVariant::fromValue(scope->id());
72+ } else if (role == Scopes::RoleVisible) {
73+ return QVariant::fromValue(scope->visible());
7774 } else {
7875 return QVariant();
7976 }
8077}
8178
82−QVariant Lenses::get(int row) const
79+QVariant Scopes::get(int row) const
8380{
8481 return data(QAbstractListModel::index(row), 0);
8582}
8683
87−QVariant Lenses::get(const QString& lens_id) const
84+QVariant Scopes::get(const QString& scope_id) const
8885{
89− Q_FOREACH(Lens* lens, m_lenses) {
90− if (lens->id() == lens_id) {
91− return QVariant::fromValue(lens);
86+ Q_FOREACH(Scope* scope, m_scopes) {
87+ if (scope->id() == scope_id) {
88+ return QVariant::fromValue(scope);
9289 }
9390 }
9491
9592 return QVariant();
9693}
9794
98−bool Lenses::loaded() const
95+bool Scopes::loaded() const
9996{
10097 return m_loaded;
10198}
10299
103−void Lenses::onScopeAdded(const unity::dash::Scope::Ptr& scope, int position)
100+void Scopes::onScopeAdded(const unity::dash::Scope::Ptr& scope, int position)
104101{
105− int index = m_lenses.count();
102+ int index = m_scopes.count();
106103 beginInsertRows(QModelIndex(), index, index);
107− addUnityLens(scope);
104+ addUnityScope(scope);
108105 endInsertRows();
109106
110107 // FIXME: do only once after all loaded?
@@ -112,79 +109,76 @@ void Lenses::onScopeAdded(const unity::dash::Scope::Ptr& scope, int position)
112109 Q_EMIT loadedChanged(m_loaded);
113110}
114111
115−void Lenses::onScopeRemoved(const unity::dash::Scope::Ptr& scope)
112+void Scopes::onScopeRemoved(const unity::dash::Scope::Ptr& scope)
116113{
117114 //TODO
118115}
119116
120−void Lenses::onScopesReordered(const unity::dash::Scopes::ScopeList& scopes)
117+void Scopes::onScopesReordered(const unity::dash::Scopes::ScopeList& scopes)
121118{
122119 //TODO
123120}
124121
125−void Lenses::loadMocks()
122+void Scopes::loadMocks()
126123{
127124 /* FIXME: this is temporary code that is required on mobile to order
128125 the lenses according to the design.
129126 */
130− QStringList staticLenses;
131− staticLenses << "mockmusic.lens" << "people.lens" << "home.lens" << "applications.lens" << "mockvideos.lens";
127+ QStringList staticScopes;
128+ staticScopes << "mockmusic.lens" << "people.lens" << "home.lens" << "applications.lens" << "mockvideos.lens";
132129
133130 // not all the lenses are guaranteed to go into the model (only if their UnitCore counterparts exist);
134131 // so build up a list of the valid ones, then add them later.
135− QList<unity::dash::Scope::Ptr> added_lenses;
132+ QList<unity::dash::Scope::Ptr> added_scopes;
136133
137134 // add statically ordered lenses
138− Q_FOREACH(QString lensId, staticLenses) {
139− unity::dash::Scope::Ptr lens = m_unityLenses->GetScope(lensId.toStdString());
135+ Q_FOREACH(QString lensId, staticScopes) {
136+ unity::dash::Scope::Ptr lens = m_unityScopes->GetScope(lensId.toStdString());
140137 if (lens != NULL) {
141− added_lenses << lens;
138+ added_scopes << lens;
142139 }
143140 }
144141
145142 // add remaining lenses
146− unity::dash::Scopes::ScopeList lensesList = m_unityLenses->GetScopes();
147− for(auto it = lensesList.begin(); it != lensesList.end(); ++it) {
148− unity::dash::Scope::Ptr lens = (*it);
149− if (!staticLenses.contains(QString::fromStdString(lens->id))) {
150− added_lenses << lens;
143+ unity::dash::Scopes::ScopeList scopesList = m_unityScopes->GetScopes();
144+ for(auto it = scopesList.begin(); it != scopesList.end(); ++it) {
145+ unity::dash::Scope::Ptr scope = (*it);
146+ if (!staticScopes.contains(QString::fromStdString(scope->id))) {
147+ added_scopes << scope;
151148 }
152149 }
153150
154− if (added_lenses.count() > 0) {
151+ if (added_scopes.count() > 0) {
155152 int index = rowCount();
156− beginInsertRows(QModelIndex(), index, index+added_lenses.count()-1);
157− Q_FOREACH(unity::dash::Scope::Ptr lens, added_lenses) {
158− addUnityLens(lens);
153+ beginInsertRows(QModelIndex(), index, index+added_scopes.count()-1);
154+ Q_FOREACH(unity::dash::Scope::Ptr scope, added_scopes) {
155+ addUnityScope(scope);
159156 }
160157 endInsertRows();
161158 }
162159
163160 m_loaded = true;
164161 Q_EMIT loadedChanged(m_loaded);
165−
166− // listen to dynamically added lenses
167− //m_homeLens->lens_added.connect(sigc::mem_fun(this, &Lenses::onLensAdded)); //FIXME
168162}
169163
170−void Lenses::onLensPropertyChanged()
164+void Scopes::onScopePropertyChanged()
171165{
172− QModelIndex lensIndex = index(m_lenses.indexOf(qobject_cast<Lens*>(sender())));
173− Q_EMIT dataChanged(lensIndex, lensIndex);
166+ QModelIndex scopeIndex = index(m_scopes.indexOf(qobject_cast<Scope*>(sender())));
167+ Q_EMIT dataChanged(scopeIndex, scopeIndex);
174168}
175169
176−void Lenses::addUnityLens(const unity::dash::Scope::Ptr& unity_lens)
170+void Scopes::addUnityScope(const unity::dash::Scope::Ptr& unity_scope)
177171{
178− Lens* lens = new Lens(this);
179− lens->setUnityLens(unity_lens);
172+ Scope* scope = new Scope(this);
173+ scope->setUnityScope(unity_scope);
180174 /* DOCME */
181− QObject::connect(lens, SIGNAL(visibleChanged(bool)), this, SLOT(onLensPropertyChanged()));
182− m_lenses.append(lens);
175+ QObject::connect(scope, SIGNAL(visibleChanged(bool)), this, SLOT(onLensPropertyChanged()));
176+ m_scopes.append(scope);
183177}
184178
185−void Lenses::removeUnityLens(int index)
179+void Scopes::removeUnityScope(int index)
186180{
187− Lens* lens = m_lenses.takeAt(index);
181+ Scope* scope = m_scopes.takeAt(index);
188182
189− delete lens;
183+ delete scope;
190184}
plugins/Unity/lenses.h+14−14
@@ -17,8 +17,8 @@
1717 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1818 */
1919
20−#ifndef LENSES_H
21−#define LENSES_H
20+#ifndef SCOPES_H
21+#define SCOPES_H
2222
2323// Qt
2424#include <QAbstractListModel>
@@ -32,14 +32,14 @@ namespace unity
3232{
3333namespace dash
3434{
35−class Lenses;
35+class Scopes;
3636}
3737}
3838
3939class Hotkey;
40−class Lens;
40+class Scope;
4141
42−class Lenses : public QAbstractListModel
42+class Scopes : public QAbstractListModel
4343{
4444 Q_OBJECT
4545
@@ -48,8 +48,8 @@ class Lenses : public QAbstractListModel
4848 Q_PROPERTY(bool loaded READ loaded NOTIFY loadedChanged)
4949
5050public:
51− explicit Lenses(QObject *parent = 0);
52− ~Lenses() = default;
51+ explicit Scopes(QObject *parent = 0);
52+ ~Scopes() = default;
5353
5454 enum Roles {
5555 RoleLens,
@@ -68,25 +68,25 @@ public:
6868 bool loaded() const;
6969
7070Q_SIGNALS:
71− void activateLensRequested(const QString& lens_id);
71+ void activateScopeRequested(const QString& scope_id);
7272 void loadedChanged(bool loaded);
7373
7474private Q_SLOTS:
7575 void loadMocks();
76− void onScopeAdded(const unity::dash::Scope::Ptr& lens, int position);
76+ void onScopeAdded(const unity::dash::Scope::Ptr& scope, int position);
7777 void onScopeRemoved(const unity::dash::Scope::Ptr& scope);
7878 void onScopesReordered(const unity::dash::Scopes::ScopeList& scopes);
79− void onLensPropertyChanged();
79+ void onScopePropertyChanged();
8080
8181private:
8282 unity::dash::GSettingsScopesReader::Ptr m_scopesReader;
83− unity::dash::Scopes::Ptr m_unityLenses;
84− QList<Lens*> m_lenses;
83+ unity::dash::Scopes::Ptr m_unityScopes;
84+ QList<Scope*> m_scopes;
8585 QHash<int, QByteArray> m_roles;
8686 bool m_loaded;
8787
88− void addUnityLens(const unity::dash::Scope::Ptr& unity_lens);
89− void removeUnityLens(int index);
88+ void addUnityScope(const unity::dash::Scope::Ptr& unity_scope);
89+ void removeUnityScope(int index);
9090};
9191
9292#endif // LENSES_H
plugins/Unity/plugin.cpp+2−2
@@ -40,8 +40,8 @@ static const char* DBUS_SERVICE = "com.canonical.Shell.BottomBarVisibilityCommun
4040void UnityPlugin::registerTypes(const char *uri)
4141{
4242 Q_ASSERT(uri == QLatin1String("Unity"));
43− qmlRegisterType<Lens>(uri, 0, 1, "Lens");
44− qmlRegisterType<Lenses>(uri, 0, 1, "Lenses");
43+ qmlRegisterType<Scope>(uri, 0, 1, "Lens");
44+ qmlRegisterType<Scopes>(uri, 0, 1, "Lenses");
4545 qmlRegisterType<Categories>(uri, 0, 1, "Categories");
4646 qmlRegisterType<CategoryFilter>(uri, 0, 1, "CategoryFilter");
4747 qmlRegisterType<DeeListModel>(uri, 0, 1, "DeeListModel");