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/>.
19#include "fake_scope.h"
20#include "fake_department.h"
21#include "fake_resultsmodel.h"
23Scope::Scope(QObject* parent) : Scope(QString(), QString(), false, parent)
27Scope::Scope(QString const& id, QString const& name, bool visible, QObject* parent, int categories)
28 : unity::shell::scopes::ScopeInterface(parent)
34 , m_currentDeparment("root")
35 , m_previewRendererName("preview-generic")
36 , m_categories(new Categories(categories, this))
40QString Scope::id() const
45QString Scope::name() const
50QString Scope::searchQuery() const
55QString Scope::iconHint() const
60QString Scope::description() const
65QString Scope::searchHint() const
70QString Scope::shortcut() const
75bool Scope::searchInProgress() const
80unity::shell::scopes::CategoriesInterface* Scope::categories() const
85unity::shell::scopes::SettingsModelInterface* Scope::settings() const
90QString Scope::noResultsHint() const
92 return m_noResultsHint;
95QString Scope::formFactor() const
100bool Scope::visible() const
105bool Scope::isActive() const
110void Scope::setSearchQuery(const QString &str)
112 if (str != m_searchQuery) {
114 Q_EMIT searchQueryChanged();
118void Scope::setFormFactor(const QString &str)
120 if (str != m_formFactor) {
122 Q_EMIT formFactorChanged();
126void Scope::setActive(const bool active)
128 if (active != m_isActive) {
130 Q_EMIT isActiveChanged();
134void Scope::setSearchInProgress(const bool inProg)
136 if (inProg != m_searching) {
137 m_searching = inProg;
138 Q_EMIT searchInProgressChanged();
142void Scope::setNoResultsHint(const QString& str)
144 if (str != m_noResultsHint) {
145 m_noResultsHint = str;
146 Q_EMIT noResultsHintChanged();
150void Scope::activate(QVariant const& result)
155PreviewStack* Scope::preview(QVariant const& result)
159 // This probably leaks, do we don't care
160 // it's a test after all
161 return new PreviewStack;
164void Scope::cancelActivation()
168void Scope::closeScope(unity::shell::scopes::ScopeInterface* /*scope*/)
170 qFatal("Scope::closeScope is not implemented");
173QString Scope::currentDepartmentId() const
175 return m_currentDeparment;
178bool Scope::hasDepartments() const
183QVariantMap Scope::customizations() const
186 if (m_id == "clickscope") {
187 h["foreground-color"] = "yellow";
188 m["background-color"] = "red";
189 m["foreground-color"] = "blue";
190 m["page-header"] = h;
191 } else if (m_id == "MockScope5") {
192 h["background"] = "gradient:///lightgrey/grey";
193 h["logo"] = QUrl("../../../tests/qmltests/Components/tst_PageHeader/logo-ubuntu-orange.svg");
194 m["page-header"] = h;
199unity::shell::scopes::DepartmentInterface* Scope::getDepartment(const QString& id)
206 if (id.startsWith("middle")) {
208 parentLabel = "root";
209 } else if (id.startsWith("child")) {
210 parentId = id.mid(5, 7);
211 parentLabel = parentId;
213 return new Department(id, id, "all"+id, parentId, parentLabel, this);
216void Scope::loadDepartment(const QString& id)
218 m_currentDeparment = id;
219 Q_EMIT currentDepartmentIdChanged();
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