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);
30ScopesOverviewCategories::ScopesOverviewCategories(Scopes *scopes, QObject* parent)
31 : unity::shell::scopes::CategoriesInterface(parent)
36int ScopesOverviewCategories::rowCount(const QModelIndex& /*parent*/) const
41void ScopesOverviewCategories::addSpecialCategory(QString const&, QString const&, QString const&, QString const&, QObject*)
43 qFatal("Using un-implemented ScopesOverviewCategories::addSpecialCategory");
46bool ScopesOverviewCategories::overrideCategoryJson(QString const& /* categoryId */, QString const& /* json */)
48 qFatal("Using un-implemented ScopesOverviewCategories::overrideCategoryJson");
52ScopesOverviewCategories::data(const QModelIndex& index, int role) const
54 if (!index.isValid()) {
58 unity::shell::scopes::ResultsModelInterface *resultsModel = m_resultsModels[index.row()];
60 QObject *that = const_cast<ScopesOverviewCategories*>(this);
61 resultsModel = new ScopesOverviewResultsModel(m_scopes, index.row() == 0, that);
62 m_resultsModels[index.row()] = resultsModel;
66 return index.row() == 0 ? "favourites" : "all";
68 return index.row() == 0 ? "Favourites" : "All";
71 case RoleRawRendererTemplate:
72 qFatal("Using un-implemented RoleRawRendererTemplate Categories role");
77 map["category-layout"] = "grid";
78 map["card-size"] = "small";
79 map["overlay"] = true;
84 QVariantMap map, artMap;
85 artMap["aspect-ratio"] = "0.5";
86 artMap["field"] = "art";
88 map["title"] = "HOLA";
92 return QVariant::fromValue(resultsModel);
94 return resultsModel->rowCount();
96 qFatal("Using un-implemented Categories role");
101ScopesOverviewResultsModel::ScopesOverviewResultsModel(Scopes *scopes, bool isFavoriteCategory, QObject* parent)
102 : unity::shell::scopes::ResultsModelInterface(parent)
104 , m_isFavoriteCategory(isFavoriteCategory)
108QString ScopesOverviewResultsModel::categoryId() const
110 return m_isFavoriteCategory ? "favourites" : "all";
113void ScopesOverviewResultsModel::setCategoryId(QString const& /*id*/)
115 qFatal("Calling un-implemented ScopesOverviewResultsModel::setCategoryId");
118int ScopesOverviewResultsModel::rowCount(const QModelIndex& parent) const
122 return m_scopes->count(m_isFavoriteCategory);
125int ScopesOverviewResultsModel::count() const
131ScopesOverviewResultsModel::data(const QModelIndex& index, int role) const
140 return m_scopes->scopeAt(index.row(), m_isFavoriteCategory)->name();
142 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