on fab9bd9 help sign in
unity8/tests/mocks/Unity/fake_scope.h
90 lines 3.0 kB history raw
1/*
2 * Copyright (C) 2013, 2014 Canonical, Ltd.
3 *
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.
7 *
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.
12 *
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/>.
15 */
17#ifndef FAKE_SCOPE_H
18#define FAKE_SCOPE_H
20#include <unity/shell/scopes/ScopeInterface.h>
22#include "fake_categories.h"
23#include "fake_previewstack.h"
25#include <QTimer>
27class Scope : public unity::shell::scopes::ScopeInterface
29 Q_OBJECT
31public:
32 Scope(QObject* parent = 0);
33 Scope(QString const& id, QString const& name, bool visible, QObject* parent = 0);
35 /* getters */
36 QString id() const override;
37 QString name() const override;
38 QString iconHint() const override;
39 QString description() const override;
40 QString searchHint() const override;
41 bool visible() const override;
42 QString shortcut() const override;
43 bool searchInProgress() const override;
44 unity::shell::scopes::CategoriesInterface* categories() const override;
45 QString searchQuery() const override;
46 QString noResultsHint() const override;
47 QString formFactor() const override;
48 bool isActive() const override;
49 unity::shell::scopes::SettingsModelInterface* settings() const override;
51 /* setters */
52 void setSearchQuery(const QString& search_query) override;
53 void setNoResultsHint(const QString& hint) override;
54 void setFormFactor(const QString& form_factor) override;
55 void setActive(const bool) override;
56 Q_INVOKABLE void setSearchInProgress(const bool inProg); // This is not invokable in the Interface, here for testing benefits
58 Q_INVOKABLE void activate(QVariant const& result) override;
59 Q_INVOKABLE PreviewStack* preview(QVariant const& result) override;
60 Q_INVOKABLE void cancelActivation() override;
61 Q_INVOKABLE void closeScope(unity::shell::scopes::ScopeInterface* scope) override;
63 QString currentDepartmentId() const override;
64 bool hasDepartments() const override;
65 Q_INVOKABLE unity::shell::scopes::DepartmentInterface* getDepartment(const QString& id) override;
66 Q_INVOKABLE void loadDepartment(const QString& id) override;
67 Q_INVOKABLE void performQuery(const QString& query) override;
69 QVariantMap customizations() const override;
71protected:
73 QString m_id;
74 QString m_iconHint;
75 QString m_description;
76 QString m_name;
77 QString m_searchQuery;
78 QString m_noResultsHint;
79 QString m_formFactor;
80 bool m_visible;
81 bool m_searching;
82 bool m_isActive;
83 QString m_currentDeparment;
85 QString m_previewRendererName;
87 Categories* m_categories;
88};
90#endif // FAKE_SCOPE_H