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_department.h"
22#include "fake_resultsmodel.h"
24Scope::Scope(QObject* parent) : Scope(QString(), QString(), false, parent)
28Scope::Scope(QString const& id, QString const& name, bool visible, QObject* parent)
29 : unity::shell::scopes::ScopeInterface(parent)
35 , m_currentDeparment("root")
36 , m_previewRendererName("preview-generic")
37 , m_categories(new Categories(20, this))
41QString Scope::id() const
46QString Scope::name() const
51QString Scope::searchQuery() const
56QString Scope::iconHint() const
61QString Scope::description() const
66QString Scope::searchHint() const
71QString Scope::shortcut() const
76bool Scope::searchInProgress() const
81unity::shell::scopes::CategoriesInterface* Scope::categories() const
86unity::shell::scopes::SettingsModelInterface* Scope::settings() const
91QString Scope::noResultsHint() const
93 return m_noResultsHint;
96QString Scope::formFactor() const
101bool Scope::visible() const
106bool Scope::isActive() const
111void Scope::setSearchQuery(const QString &str)
113 if (str != m_searchQuery) {
115 Q_EMIT searchQueryChanged();
119void Scope::setFormFactor(const QString &str)
121 if (str != m_formFactor) {
123 Q_EMIT formFactorChanged();
127void Scope::setActive(const bool active)
129 if (active != m_isActive) {
131 Q_EMIT isActiveChanged();
135void Scope::setSearchInProgress(const bool inProg)
137 if (inProg != m_searching) {
138 m_searching = inProg;
139 Q_EMIT searchInProgressChanged();
143void Scope::setNoResultsHint(const QString& str)
145 if (str != m_noResultsHint) {
146 m_noResultsHint = str;
147 Q_EMIT noResultsHintChanged();
151void Scope::activate(QVariant const& result)
153 qDebug() << "Called activate on scope" << m_id << "with result" << result;;
156PreviewStack* Scope::preview(QVariant const& result)
160 // This probably leaks, do we don't care
161 // it's a test after all
162 return new PreviewStack;
165void Scope::cancelActivation()
169void Scope::closeScope(unity::shell::scopes::ScopeInterface* /*scope*/)
171 qFatal("Scope::closeScope is not implemented");
174QString Scope::currentDepartmentId() const
176 return m_currentDeparment;
179bool Scope::hasDepartments() const
184QVariantMap Scope::customizations() const
187 if (m_id == "clickscope") {
188 m["background-color"] = "red";
189 m["foreground-color"] = "blue";
190 } else if (m_id == "MockScope5") {
191 QVariantMap pageHeader;
192 pageHeader["logo"] = QUrl("../../../tests/qmltests/Components/tst_PageHeader/logo-ubuntu-orange.svg");
193 m["page-header"] = pageHeader;
198unity::shell::scopes::DepartmentInterface* Scope::getDepartment(const QString& id)
205 if (id.startsWith("middle")) {
207 parentLabel = "root";
208 } else if (id.startsWith("child")) {
209 parentId = id.mid(5, 7);
210 parentLabel = parentId;
212 return new Department(id, id, "all"+id, parentId, parentLabel, this);
215void Scope::loadDepartment(const QString& id)
217 m_currentDeparment = id;
218 Q_EMIT currentDepartmentIdChanged();
221void Scope::performQuery(const QString& query)
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