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 #include <QVariantMap>
24 
25 namespace unity
26 {
27 namespace shell
28 {
29 namespace scopes
30 {
31 
32 class CategoriesInterface;
33 class PreviewStackInterface;
34 class DepartmentInterface;
35 class SettingsModelInterface;
36 
40 class UNITY_API ScopeInterface : public QObject
41 {
42  Q_OBJECT
43 
47  Q_PROPERTY(QString id READ id NOTIFY idChanged)
48 
49 
52  Q_PROPERTY(QString name READ name NOTIFY nameChanged)
53 
57  Q_PROPERTY(QString iconHint READ iconHint NOTIFY iconHintChanged)
58 
62  Q_PROPERTY(QString description READ description NOTIFY descriptionChanged)
63 
67  Q_PROPERTY(QString searchHint READ searchHint NOTIFY searchHintChanged)
68 
72  Q_PROPERTY(bool searchInProgress READ searchInProgress NOTIFY searchInProgressChanged)
73 
77  Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged)
78 
82  Q_PROPERTY(QString shortcut READ shortcut NOTIFY shortcutChanged)
83 
87  Q_PROPERTY(unity::shell::scopes::CategoriesInterface* categories READ categories NOTIFY categoriesChanged)
88 
92  Q_PROPERTY(unity::shell::scopes::SettingsModelInterface* settings READ settings NOTIFY settingsChanged)
93 
99  Q_PROPERTY(QString searchQuery READ searchQuery WRITE setSearchQuery NOTIFY searchQueryChanged)
100 
104  Q_PROPERTY(QString noResultsHint READ noResultsHint WRITE setNoResultsHint NOTIFY noResultsHintChanged)
105 
113  Q_PROPERTY(QString formFactor READ formFactor WRITE setFormFactor NOTIFY formFactorChanged)
114 
118  Q_PROPERTY(bool isActive READ isActive WRITE setActive NOTIFY isActiveChanged)
119 
123  Q_PROPERTY(QString currentDepartmentId READ currentDepartmentId NOTIFY currentDepartmentIdChanged)
124 
128  Q_PROPERTY(bool hasDepartments READ hasDepartments NOTIFY hasDepartmentsChanged)
129 
133  Q_PROPERTY(QVariantMap customizations READ customizations NOTIFY customizationsChanged)
134 
135 protected:
137  explicit ScopeInterface(QObject* parent = 0) : QObject(parent) { }
139 
140 public:
141 
142  // @cond
143  virtual QString id() const = 0;
144  virtual QString name() const = 0;
145  virtual QString iconHint() const = 0;
146  virtual QString description() const = 0;
147  virtual QString searchHint() const = 0;
148  virtual bool visible() const = 0;
149  virtual QString shortcut() const = 0;
150  virtual bool searchInProgress() const = 0;
151  virtual CategoriesInterface* categories() const = 0;
152  virtual SettingsModelInterface* settings() const = 0;
153  virtual QString searchQuery() const = 0;
154  virtual QString noResultsHint() const = 0;
155  virtual QString formFactor() const = 0;
156  virtual bool isActive() const = 0;
157  virtual QString currentDepartmentId() const = 0;
158  virtual bool hasDepartments() const = 0;
159  virtual QVariantMap customizations() const = 0;
160 
161  /* setters */
162  virtual void setSearchQuery(const QString& search_query) = 0;
163  virtual void setNoResultsHint(const QString& hint) = 0;
164  virtual void setFormFactor(const QString& form_factor) = 0;
165  virtual void setActive(const bool) = 0;
166  // @endcond
167 
171  Q_INVOKABLE virtual void activate(QVariant const& result) = 0;
172 
179  Q_INVOKABLE virtual unity::shell::scopes::PreviewStackInterface* preview(QVariant const& result) = 0;
180 
184  Q_INVOKABLE virtual void cancelActivation() = 0;
185 
189  Q_INVOKABLE virtual void closeScope(unity::shell::scopes::ScopeInterface* scope) = 0;
190 
194  Q_INVOKABLE virtual unity::shell::scopes::DepartmentInterface* getDepartment(QString const& departmentId) = 0;
195 
201  Q_INVOKABLE virtual void loadDepartment(QString const& departmentId) = 0;
202 
206  Q_INVOKABLE virtual void performQuery(QString const& cannedQuery) = 0;
207 
208 Q_SIGNALS:
209  // @cond
210  void idChanged();
211  void nameChanged();
212  void iconHintChanged();
213  void descriptionChanged();
214  void searchHintChanged();
215  void searchInProgressChanged();
216  void visibleChanged();
217  void shortcutChanged();
218  void categoriesChanged();
219  void settingsChanged();
220  void searchQueryChanged();
221  void noResultsHintChanged();
222  void formFactorChanged();
223  void isActiveChanged();
224  void hasDepartmentsChanged();
225  void currentDepartmentIdChanged();
226  void customizationsChanged();
227  // @endcond
228 
229  // signals triggered by activate(..) or preview(..) requests.
235  void showDash();
236 
242  void hideDash();
243 
249  void gotoUri(QString const& uri);
250 
256  void previewRequested(QVariant const& result);
257 
261  void gotoScope(QString const& scopeId);
262 
266  void openScope(unity::shell::scopes::ScopeInterface* scope);
267 
271  void activateApplication(QString const& desktop);
272 };
273 
274 }
275 }
276 }
277 
278 Q_DECLARE_METATYPE(unity::shell::scopes::ScopeInterface*)
279 
280 #endif
Object representing department instance, which exposes model(s) with results.
Definition: DepartmentInterface.h:34
Definition: SettingsModelInterface.h:31
Object representing scope instance, which exposes model(s) with results.
Definition: ScopeInterface.h:40
A master model for previews.
Definition: PreviewStackInterface.h:40
A list of categories for a particular search.
Definition: CategoriesInterface.h:37