2 * Copyright (C) 2014 Canonical, Ltd.
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.
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.
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/>.
17#include "fake_scopesoverview.h"
19#include "fake_scopes.h"
23ScopesOverview::ScopesOverview(Scopes* parent)
24 : Scope("scopesOverview", "Scopes Overview", false, parent)
27 m_categories = new ScopesOverviewCategories(parent, this);
30void ScopesOverview::activate(QVariant const& result)
32 Scopes *scopes = dynamic_cast<Scopes*>(parent());
33 Q_EMIT openScope(scopes->getScope(result.toString()));
38ScopesOverviewCategories::ScopesOverviewCategories(Scopes *scopes, QObject* parent)
39 : unity::shell::scopes::CategoriesInterface(parent)
44int ScopesOverviewCategories::rowCount(const QModelIndex& /*parent*/) const
49void ScopesOverviewCategories::addSpecialCategory(QString const&, QString const&, QString const&, QString const&, QObject*)
51 qFatal("Using un-implemented ScopesOverviewCategories::addSpecialCategory");
54bool ScopesOverviewCategories::overrideCategoryJson(QString const& /* categoryId */, QString const& /* json */)
56 qFatal("Using un-implemented ScopesOverviewCategories::overrideCategoryJson");
60ScopesOverviewCategories::data(const QModelIndex& index, int role) const
62 if (!index.isValid()) {
66 unity::shell::scopes::ResultsModelInterface *resultsModel = m_resultsModels[index.row()];
68 QObject *that = const_cast<ScopesOverviewCategories*>(this);
69 resultsModel = new ScopesOverviewResultsModel(m_scopes, index.row() == 0, that);
70 m_resultsModels[index.row()] = resultsModel;
74 return index.row() == 0 ? "favourites" : "all";
76 return index.row() == 0 ? "Favourites" : "All";
79 case RoleRawRendererTemplate:
80 qFatal("Using un-implemented RoleRawRendererTemplate Categories role");
85 map["category-layout"] = "grid";
86 map["card-size"] = "small";
87 map["overlay"] = true;
92 QVariantMap map, artMap;
93 artMap["aspect-ratio"] = "0.5";
94 artMap["field"] = "art";
96 map["title"] = "HOLA";
100 return QVariant::fromValue(resultsModel);
102 return resultsModel->rowCount();
104 qFatal("Using un-implemented Categories role");
111ScopesOverviewResultsModel::ScopesOverviewResultsModel(Scopes *scopes, bool isFavoriteCategory, QObject* parent)
112 : unity::shell::scopes::ResultsModelInterface(parent)
114 , m_isFavoriteCategory(isFavoriteCategory)
118QString ScopesOverviewResultsModel::categoryId() const
120 return m_isFavoriteCategory ? "favourites" : "all";
123void ScopesOverviewResultsModel::setCategoryId(QString const& /*id*/)
125 qFatal("Calling un-implemented ScopesOverviewResultsModel::setCategoryId");
128int ScopesOverviewResultsModel::rowCount(const QModelIndex& parent) const
132 return m_scopes->count(m_isFavoriteCategory);
135int ScopesOverviewResultsModel::count() const
141ScopesOverviewResultsModel::data(const QModelIndex& index, int role) const
149 return m_scopes->scopeAt(index.row(), m_isFavoriteCategory)->id();
151 return m_scopes->scopeAt(index.row(), m_isFavoriteCategory)->name();
153 return qmlDirectory() + "graphics/applicationIcons/dash.png";
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list