2 * Copyright (C) 2013, 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/>.
20#include "fake_scope.h"
21#include "fake_navigation.h"
22#include "fake_resultsmodel.h"
24Scope::Scope(QObject* parent) : Scope(QString(), QString(), false, parent)
28Scope::Scope(QString const& id, QString const& name, bool favorite, QObject* parent, int categories)
29 : unity::shell::scopes::ScopeInterface(parent)
33 , m_favorite(favorite)
35 , m_currentNavigationId("root")
36 , m_currentAltNavigationId("altroot")
37 , m_previewRendererName("preview-generic")
38 , m_categories(new Categories(categories, this))
42QString Scope::id() const
47QString Scope::name() const
52QString Scope::searchQuery() const
57QString Scope::iconHint() const
62QString Scope::description() const
67QString Scope::searchHint() const
72QString Scope::shortcut() const
77bool Scope::searchInProgress() const
82bool Scope::favorite() const
87unity::shell::scopes::CategoriesInterface* Scope::categories() const
92unity::shell::scopes::SettingsModelInterface* Scope::settings() const
97QString Scope::noResultsHint() const
99 return m_noResultsHint;
102QString Scope::formFactor() const
107bool Scope::isActive() const
112void Scope::setSearchQuery(const QString &str)
114 if (str != m_searchQuery) {
116 Q_EMIT searchQueryChanged();
120void Scope::setFormFactor(const QString &str)
122 if (str != m_formFactor) {
124 Q_EMIT formFactorChanged();
128void Scope::setActive(const bool active)
130 if (active != m_isActive) {
132 Q_EMIT isActiveChanged();
136void Scope::setFavorite(const bool favorite)
138 if (favorite != m_favorite) {
139 m_favorite = favorite;
140 Q_EMIT favoriteChanged();
143void Scope::setSearchInProgress(const bool inProg)
145 if (inProg != m_searching) {
146 m_searching = inProg;
147 Q_EMIT searchInProgressChanged();
151void Scope::setNoResultsHint(const QString& str)
153 if (str != m_noResultsHint) {
154 m_noResultsHint = str;
155 Q_EMIT noResultsHintChanged();
159void Scope::activate(QVariant const& result)
164PreviewStack* Scope::preview(QVariant const& result)
168 // This probably leaks, do we don't care
169 // it's a test after all
170 return new PreviewStack;
173void Scope::cancelActivation()
177void Scope::closeScope(unity::shell::scopes::ScopeInterface* /*scope*/)
179 qFatal("Scope::closeScope is not implemented");
182QString Scope::currentNavigationId() const
184 return m_currentNavigationId;
187bool Scope::hasNavigation() const
192QString Scope::currentAltNavigationId() const
194 return m_currentAltNavigationId;
197bool Scope::hasAltNavigation() const
202Scope::Status Scope::status() const
207QVariantMap Scope::customizations() const
210 if (m_id == "clickscope") {
211 h["foreground-color"] = "yellow";
212 m["background-color"] = "red";
213 m["foreground-color"] = "blue";
214 m["page-header"] = h;
215 } else if (m_id == "MockScope5") {
216 h["background"] = "gradient:///lightgrey/grey";
217 h["logo"] = QUrl("../../../tests/qmltests/Components/tst_PageHeader/logo-ubuntu-orange.svg");
218 m["page-header"] = h;
225 qDebug() << "Scope::refresh is currently not implmented in the fake scopes plugin";
228unity::shell::scopes::NavigationInterface* Scope::getNavigation(const QString& id)
235 if (id.startsWith("middle")) {
237 parentLabel = "root";
238 } else if (id.startsWith("child")) {
239 parentId = id.mid(5, 7);
240 parentLabel = parentId;
242 return new Navigation(id, id, "all"+id, parentId, parentLabel, this);
245unity::shell::scopes::NavigationInterface* Scope::getAltNavigation(QString const& id)
252 if (id.startsWith("altmiddle")) {
253 parentId = "altroot";
254 parentLabel = "altroot";
256 return new Navigation(id, id, "all"+id, parentId, parentLabel, this);
259void Scope::setNavigationState(const QString &navigationId, bool isAltNavigation)
261 if (isAltNavigation) {
262 m_currentAltNavigationId = navigationId;
263 Q_EMIT currentAltNavigationIdChanged();
265 m_currentNavigationId = navigationId;
266 Q_EMIT currentNavigationIdChanged();
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