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 nCategories)
28 : unity::shell::scopes::ScopeInterface(parent)
34 , m_currentDeparment("root")
35 , m_previewRendererName("preview-generic")
36 , m_categories(new Categories(nCategories, this))
40QString Scope::id() const {
44QString Scope::name() const {
48QString Scope::searchQuery() const {
52QString Scope::iconHint() const {
56QString Scope::description() const {
60QString Scope::searchHint() const {
64QString Scope::shortcut() const {
68bool Scope::searchInProgress() const {
72unity::shell::scopes::CategoriesInterface* Scope::categories() const {
76QString Scope::noResultsHint() const {
77 return m_noResultsHint;
80QString Scope::formFactor() const {
84bool Scope::visible() const {
88bool Scope::isActive() const {
92void Scope::setSearchQuery(const QString &str) {
93 if (str != m_searchQuery) {
95 Q_EMIT searchQueryChanged();
99void Scope::setFormFactor(const QString &str) {
100 if (str != m_formFactor) {
102 Q_EMIT formFactorChanged();
106void Scope::setActive(const bool active) {
107 if (active != m_isActive) {
109 Q_EMIT isActiveChanged();
113void Scope::setSearchInProgress(const bool inProg) {
114 if (inProg != m_searching) {
115 m_searching = inProg;
116 Q_EMIT searchInProgressChanged();
120void Scope::setNoResultsHint(const QString& str) {
121 if (str != m_noResultsHint) {
122 m_noResultsHint = str;
123 Q_EMIT noResultsHintChanged();
127void Scope::activate(QVariant const& result)
132PreviewStack* Scope::preview(QVariant const& result)
136 // This probably leaks, do we don't care
137 // it's a test after all
138 return new PreviewStack;
141void Scope::cancelActivation()
145void Scope::closeScope(unity::shell::scopes::ScopeInterface* /*scope*/)
147 qFatal("Scope::closeScope is not implemented");
150QString Scope::currentDepartmentId() const
152 return m_currentDeparment;
155bool Scope::hasDepartments() const
160QVariantMap Scope::customizations() const
163 if (m_id == "clickscope") {
164 m["background-color"] = "red";
165 m["foreground-color"] = "blue";
166 } else if (m_id == "MockScope5") {
167 QVariantMap pageHeader;
168 pageHeader["logo"] = QUrl("../../../tests/qmltests/Components/tst_PageHeader/logo-ubuntu-orange.svg");
169 m["page-header"] = pageHeader;
174unity::shell::scopes::DepartmentInterface* Scope::getDepartment(const QString& id)
181 if (id.startsWith("middle")) {
183 parentLabel = "root";
184 } else if (id.startsWith("child")) {
185 parentId = id.mid(5, 7);
186 parentLabel = parentId;
188 return new Department(id, id, "all"+id, parentId, parentLabel, this);
191void Scope::loadDepartment(const QString& id)
193 m_currentDeparment = id;
194 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