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"
22#include "fake_department.h"
23#include "fake_resultsmodel.h"
24#include "fake_scopes.h"
26Scope::Scope(Scopes* parent) : Scope(QString(), QString(), false, parent)
30Scope::Scope(QString const& id, QString const& name, bool visible, Scopes* parent, int categories)
31 : unity::shell::scopes::ScopeInterface(parent)
37 , m_currentDeparment("root")
38 , m_previewRendererName("preview-generic")
39 , m_categories(new Categories(categories, this))
40 , m_openScope(nullptr)
44QString Scope::id() const
49QString Scope::name() const
54QString Scope::searchQuery() const
59QString Scope::iconHint() const
64QString Scope::description() const
69QString Scope::searchHint() const
74QString Scope::shortcut() const
79bool Scope::searchInProgress() const
84unity::shell::scopes::CategoriesInterface* Scope::categories() const
89unity::shell::scopes::SettingsModelInterface* Scope::settings() const
94QString Scope::noResultsHint() const
96 return m_noResultsHint;
99QString Scope::formFactor() const
104bool Scope::visible() const
109bool Scope::isActive() const
114void Scope::setSearchQuery(const QString &str)
116 if (str != m_searchQuery) {
118 Q_EMIT searchQueryChanged();
122void Scope::setFormFactor(const QString &str)
124 if (str != m_formFactor) {
126 Q_EMIT formFactorChanged();
130void Scope::setActive(const bool active)
132 if (active != m_isActive) {
134 Q_EMIT isActiveChanged();
138void Scope::setSearchInProgress(const bool inProg)
140 if (inProg != m_searching) {
141 m_searching = inProg;
142 Q_EMIT searchInProgressChanged();
146void Scope::setNoResultsHint(const QString& str)
148 if (str != m_noResultsHint) {
149 m_noResultsHint = str;
150 Q_EMIT noResultsHintChanged();
154void Scope::activate(QVariant const& result)
156 qDebug() << "Called activate on scope" << m_id << "with result" << result;
157 if (result.toString() == "Result.2.2") {
158 Scopes *scopes = dynamic_cast<Scopes*>(parent());
159 m_openScope = scopes->getScopeFromAll("MockScope9");
160 Q_EMIT openScope(m_openScope);
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 if (scope != m_openScope) {
180 qDebug() << scope << m_openScope;
181 qFatal("Scope::closeScope got wrong scope in closeScope");
183 m_openScope = nullptr;
186QString Scope::currentDepartmentId() const
188 return m_currentDeparment;
191bool Scope::hasDepartments() const
196QVariantMap Scope::customizations() const
199 if (m_id == "clickscope") {
200 h["foreground-color"] = "yellow";
201 m["background-color"] = "red";
202 m["foreground-color"] = "blue";
203 m["page-header"] = h;
204 } else if (m_id == "MockScope5") {
205 h["background"] = "gradient:///lightgrey/grey";
206 h["logo"] = QUrl("../../../tests/qmltests/Components/tst_PageHeader/logo-ubuntu-orange.svg");
207 m["page-header"] = h;
212unity::shell::scopes::DepartmentInterface* Scope::getDepartment(const QString& id)
219 if (id.startsWith("middle")) {
221 parentLabel = "root";
222 } else if (id.startsWith("child")) {
223 parentId = id.mid(5, 7);
224 parentLabel = parentId;
226 return new Department(id, id, "all"+id, parentId, parentLabel, this);
229void Scope::loadDepartment(const QString& id)
231 m_currentDeparment = id;
232 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