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/>.
17#include "fake_scope.h"
18#include "fake_department.h"
19#include "fake_resultsmodel.h"
21Scope::Scope(QObject* parent) : Scope(QString(), QString(), false, parent)
25Scope::Scope(QString const& id, QString const& name, bool visible, QObject* parent)
26 : unity::shell::scopes::ScopeInterface(parent)
32 , m_currentDeparment("root")
33 , m_previewRendererName("preview-generic")
34 , m_categories(new Categories(20, this))
38QString Scope::id() const {
42QString Scope::name() const {
46QString Scope::searchQuery() const {
50QString Scope::iconHint() const {
54QString Scope::description() const {
58QString Scope::searchHint() const {
62QString Scope::shortcut() const {
66bool Scope::searchInProgress() const {
70unity::shell::scopes::CategoriesInterface* Scope::categories() const {
74QString Scope::noResultsHint() const {
75 return m_noResultsHint;
78QString Scope::formFactor() const {
82bool Scope::visible() const {
86bool Scope::isActive() const {
90void Scope::setSearchQuery(const QString &str) {
91 if (str != m_searchQuery) {
93 Q_EMIT searchQueryChanged();
97void Scope::setFormFactor(const QString &str) {
98 if (str != m_formFactor) {
100 Q_EMIT formFactorChanged();
104void Scope::setActive(const bool active) {
105 if (active != m_isActive) {
107 Q_EMIT isActiveChanged();
111void Scope::setSearchInProgress(const bool inProg) {
112 if (inProg != m_searching) {
113 m_searching = inProg;
114 Q_EMIT searchInProgressChanged();
118void Scope::setNoResultsHint(const QString& str) {
119 if (str != m_noResultsHint) {
120 m_noResultsHint = str;
121 Q_EMIT noResultsHintChanged();
125void Scope::activate(QVariant const& result)
130PreviewStack* Scope::preview(QVariant const& result)
134 // This probably leaks, do we don't care
135 // it's a test after all
136 return new PreviewStack;
139void Scope::cancelActivation()
143void Scope::closeScope(unity::shell::scopes::ScopeInterface* /*scope*/)
145 qFatal("Scope::closeScope is not implemented");
148QString Scope::currentDepartmentId() const
150 return m_currentDeparment;
153bool Scope::hasDepartments() const
158unity::shell::scopes::DepartmentInterface* Scope::getDepartment(const QString& id)
165 if (id.startsWith("middle")) {
167 parentLabel = "root";
168 } else if (id.startsWith("child")) {
169 parentId = id.mid(5, 7);
170 parentLabel = parentId;
172 return new Department(id, id, "all"+id, parentId, parentLabel, this);
175void Scope::loadDepartment(const QString& id)
177 m_currentDeparment = id;
178 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