My Project
 All Classes Namespaces Files Functions Typedefs Enumerations Enumerator Properties Macros
ScopeInterface.h
1 /*
2  * Copyright (C) 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  */
16 
17 #ifndef UNITY_SHELL_SCOPES_SCOPEINTERFACE_H
18 #define UNITY_SHELL_SCOPES_SCOPEINTERFACE_H
19 
20 #include <unity/SymbolExport.h>
21 
22 #include <QObject>
23 
24 namespace unity
25 {
26 namespace shell
27 {
28 namespace scopes
29 {
30 
31 class CategoriesInterface;
32 class PreviewStackInterface;
33 class DepartmentInterface;
34 
38 class UNITY_API ScopeInterface : public QObject
39 {
40  Q_OBJECT
41 
45  Q_PROPERTY(QString id READ id NOTIFY idChanged)
46 
47 
50  Q_PROPERTY(QString name READ name NOTIFY nameChanged)
51 
55  Q_PROPERTY(QString iconHint READ iconHint NOTIFY iconHintChanged)
56 
60  Q_PROPERTY(QString description READ description NOTIFY descriptionChanged)
61 
65  Q_PROPERTY(QString searchHint READ searchHint NOTIFY searchHintChanged)
66 
70  Q_PROPERTY(bool searchInProgress READ searchInProgress NOTIFY searchInProgressChanged)
71 
75  Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged)
76 
80  Q_PROPERTY(QString shortcut READ shortcut NOTIFY shortcutChanged)
81 
85  Q_PROPERTY(unity::shell::scopes::CategoriesInterface* categories READ categories NOTIFY categoriesChanged)
86 
92  Q_PROPERTY(QString searchQuery READ searchQuery WRITE setSearchQuery NOTIFY searchQueryChanged)
93 
97  Q_PROPERTY(QString noResultsHint READ noResultsHint WRITE setNoResultsHint NOTIFY noResultsHintChanged)
98 
106  Q_PROPERTY(QString formFactor READ formFactor WRITE setFormFactor NOTIFY formFactorChanged)
107 
111  Q_PROPERTY(bool isActive READ isActive WRITE setActive NOTIFY isActiveChanged)
112 
116  Q_PROPERTY(QString currentDepartmentId READ currentDepartmentId NOTIFY currentDepartmentIdChanged)
117 
121  Q_PROPERTY(bool hasDepartments READ hasDepartments NOTIFY hasDepartmentsChanged)
122 
123 protected:
125  explicit ScopeInterface(QObject* parent = 0) : QObject(parent) { }
127 
128 public:
129 
130  // @cond
131  virtual QString id() const = 0;
132  virtual QString name() const = 0;
133  virtual QString iconHint() const = 0;
134  virtual QString description() const = 0;
135  virtual QString searchHint() const = 0;
136  virtual bool visible() const = 0;
137  virtual QString shortcut() const = 0;
138  virtual bool searchInProgress() const = 0;
139  virtual CategoriesInterface* categories() const = 0;
140  virtual QString searchQuery() const = 0;
141  virtual QString noResultsHint() const = 0;
142  virtual QString formFactor() const = 0;
143  virtual bool isActive() const = 0;
144  virtual QString currentDepartmentId() const = 0;
145  virtual bool hasDepartments() const = 0;
146 
147  /* setters */
148  virtual void setSearchQuery(const QString& search_query) = 0;
149  virtual void setNoResultsHint(const QString& hint) = 0;
150  virtual void setFormFactor(const QString& form_factor) = 0;
151  virtual void setActive(const bool) = 0;
152  // @endcond
153 
157  Q_INVOKABLE virtual void activate(QVariant const& result) = 0;
158 
165  Q_INVOKABLE virtual unity::shell::scopes::PreviewStackInterface* preview(QVariant const& result) = 0;
166 
170  Q_INVOKABLE virtual void cancelActivation() = 0;
171 
175  Q_INVOKABLE virtual void closeScope(unity::shell::scopes::ScopeInterface* scope) = 0;
176 
180  Q_INVOKABLE virtual unity::shell::scopes::DepartmentInterface* getDepartment(QString const& departmentId) = 0;
181 
187  Q_INVOKABLE virtual void loadDepartment(QString const& departmentId) = 0;
188 
189 Q_SIGNALS:
190  // @cond
191  void idChanged();
192  void nameChanged();
193  void iconHintChanged();
194  void descriptionChanged();
195  void searchHintChanged();
196  void searchInProgressChanged();
197  void visibleChanged();
198  void shortcutChanged();
199  void categoriesChanged();
200  void searchQueryChanged();
201  void noResultsHintChanged();
202  void formFactorChanged();
203  void isActiveChanged();
204  void hasDepartmentsChanged();
205  void currentDepartmentIdChanged();
206  // @endcond
207 
208  // signals triggered by activate(..) or preview(..) requests.
214  void showDash();
215 
221  void hideDash();
222 
228  void gotoUri(QString const& uri);
229 
235  void previewRequested(QVariant const& result);
236 
240  void gotoScope(QString const& scopeId);
241 
245  void openScope(unity::shell::scopes::ScopeInterface* scope);
246 
250  void activateApplication(QString const& desktop);
251 };
252 
253 }
254 }
255 }
256 
257 Q_DECLARE_METATYPE(unity::shell::scopes::ScopeInterface*)
258 
259 #endif
Object representing department instance, which exposes model(s) with results.
Definition: DepartmentInterface.h:34
Object representing scope instance, which exposes model(s) with results.
Definition: ScopeInterface.h:38
A master model for previews.
Definition: PreviewStackInterface.h:40
A list of categories for a particular search.
Definition: CategoriesInterface.h:37