My Project
Loading...
Searching...
No Matches
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
25namespace unity
26{
27namespace shell
28{
29namespace scopes
30{
31
32class CategoriesInterface;
33class PreviewModelInterface;
34class NavigationInterface;
35class SettingsModelInterface;
36class FiltersInterface;
37class FilterBaseInterface;
38
42class UNITY_API ScopeInterface : public QObject
43{
44 Q_OBJECT
45
49 Q_PROPERTY(QString id READ id NOTIFY idChanged)
50
51
54 Q_PROPERTY(QString name READ name NOTIFY nameChanged)
55
56
59 Q_PROPERTY(QString iconHint READ iconHint NOTIFY iconHintChanged)
60
61
64 Q_PROPERTY(QString description READ description NOTIFY descriptionChanged)
65
66
69 Q_PROPERTY(QString searchHint READ searchHint NOTIFY searchHintChanged)
70
71
74 Q_PROPERTY(bool searchInProgress READ searchInProgress NOTIFY searchInProgressChanged)
75
76
79 Q_PROPERTY(bool activationInProgress READ activationInProgress NOTIFY activationInProgressChanged)
80
81
84 Q_PROPERTY(bool favorite READ favorite WRITE setFavorite NOTIFY favoriteChanged)
88 Q_PROPERTY(QString shortcut READ shortcut NOTIFY shortcutChanged)
89
90
93 Q_PROPERTY(unity::shell::scopes::CategoriesInterface* categories READ categories NOTIFY categoriesChanged)
94
95
98 Q_PROPERTY(unity::shell::scopes::SettingsModelInterface* settings READ settings NOTIFY settingsChanged)
99
100
103 Q_PROPERTY(unity::shell::scopes::FilterBaseInterface* primaryNavigationFilter READ primaryNavigationFilter NOTIFY primaryNavigationFilterChanged)
104
105
110 Q_PROPERTY(QString searchQuery READ searchQuery WRITE setSearchQuery NOTIFY searchQueryChanged)
111
112
115 Q_PROPERTY(QString noResultsHint READ noResultsHint WRITE setNoResultsHint NOTIFY noResultsHintChanged)
116
117
124 Q_PROPERTY(QString formFactor READ formFactor WRITE setFormFactor NOTIFY formFactorChanged)
125
126
129 Q_PROPERTY(bool isActive READ isActive WRITE setActive NOTIFY isActiveChanged)
130
131
134 Q_PROPERTY(QString currentNavigationId READ currentNavigationId NOTIFY currentNavigationIdChanged)
135
136
139 Q_PROPERTY(bool hasNavigation READ hasNavigation NOTIFY hasNavigationChanged)
140
141
144 Q_PROPERTY(QVariantMap customizations READ customizations NOTIFY customizationsChanged)
145
146
149 Q_PROPERTY(unity::shell::scopes::ScopeInterface::Status status READ status NOTIFY statusChanged)
150
151
154 Q_PROPERTY(unity::shell::scopes::FiltersInterface* filters READ filters NOTIFY filtersChanged)
155
156
159 Q_PROPERTY(QString primaryNavigationTag READ primaryNavigationTag NOTIFY primaryNavigationTagChanged)
160
161
164 Q_PROPERTY(int activeFiltersCount READ activeFiltersCount NOTIFY activeFiltersCountChanged)
165
166protected:
168 explicit ScopeInterface(QObject* parent = 0) : QObject(parent) { }
170
171public:
175 enum class Status
176 {
177 Okay, // Everything is fine
178 NoInternet, // No Internet access
179 NoLocationData, // No location data available
180 Unknown, // A code unknown to the run-time was used
181 };
182 Q_ENUM(Status)
183
184 // @cond
185 virtual QString id() const = 0;
186 virtual QString name() const = 0;
187 virtual QString iconHint() const = 0;
188 virtual QString description() const = 0;
189 virtual QString searchHint() const = 0;
190 virtual QString shortcut() const = 0;
191 virtual bool searchInProgress() const = 0;
192 virtual bool activationInProgress() const = 0;
193 virtual bool favorite() const = 0;
194 virtual CategoriesInterface* categories() const = 0;
195 virtual SettingsModelInterface* settings() const = 0;
196 virtual FilterBaseInterface* primaryNavigationFilter() const = 0;
197 virtual QString searchQuery() const = 0;
198 virtual QString noResultsHint() const = 0;
199 virtual QString formFactor() const = 0;
200 virtual bool isActive() const = 0;
201 virtual QString currentNavigationId() const = 0;
202 virtual bool hasNavigation() const = 0;
203 virtual Status status() const = 0;
204 virtual QVariantMap customizations() const = 0;
205 virtual FiltersInterface* filters() const = 0;
206 virtual QString primaryNavigationTag() const = 0;
207 virtual int activeFiltersCount() const = 0;
208
209 /* setters */
210 virtual void setSearchQuery(const QString& search_query) = 0;
211 virtual void setNoResultsHint(const QString& hint) = 0;
212 virtual void setFormFactor(const QString& form_factor) = 0;
213 virtual void setActive(const bool) = 0;
214 virtual void setFavorite(const bool) = 0;
215 // @endcond
216
220 Q_INVOKABLE virtual void activate(QVariant const& result, QString const& categoryId) = 0;
221
228 Q_INVOKABLE virtual unity::shell::scopes::PreviewModelInterface* preview(QVariant const& result, QString const& categoryId) = 0;
229
233 Q_INVOKABLE virtual void cancelActivation() = 0;
234
238 Q_INVOKABLE virtual void closeScope(unity::shell::scopes::ScopeInterface* scope) = 0;
239
243 Q_INVOKABLE virtual unity::shell::scopes::NavigationInterface* getNavigation(QString const& navigationId) = 0;
244
248 Q_INVOKABLE virtual void setNavigationState(QString const& navId) = 0;
249
253 Q_INVOKABLE virtual void performQuery(QString const& cannedQuery) = 0;
254
258 Q_INVOKABLE virtual void refresh() = 0;
259
263 Q_INVOKABLE virtual void resetPrimaryNavigationTag() = 0;
264
268 Q_INVOKABLE virtual void resetFilters() = 0;
269
270 /*
271 * @brief Method used to activate an action of a result.
272 */
273 Q_INVOKABLE virtual void activateAction(QVariant const& result, QString const& categoryId, QString const& actionId) = 0;
274
275Q_SIGNALS:
276 // @cond
277 void idChanged();
278 void nameChanged();
279 void iconHintChanged();
280 void descriptionChanged();
281 void searchHintChanged();
282 void searchInProgressChanged();
283 void activationInProgressChanged();
284 void favoriteChanged();
285 void shortcutChanged();
286 void categoriesChanged();
287 void settingsChanged();
288 void searchQueryChanged();
289 void noResultsHintChanged();
290 void formFactorChanged();
291 void isActiveChanged();
292 void hasNavigationChanged();
293 void currentNavigationIdChanged();
294 void customizationsChanged();
295 void statusChanged();
296 void detailsChanged();
297 void filtersChanged();
298 void primaryNavigationTagChanged();
299 void activeFiltersCountChanged();
300 void primaryNavigationFilterChanged();
301 // @endcond
302
303 // signals triggered by activate(..) or preview(..) requests.
309 void showDash();
310
316 void hideDash();
317
323 void gotoUri(QString const& uri);
324
330 void previewRequested(QVariant const& result);
331
335 void gotoScope(QString const& scopeId);
336
341};
342
343}
344}
345}
346
347Q_DECLARE_METATYPE(unity::shell::scopes::ScopeInterface*)
348
349#endif
A list of categories for a particular search.
Definition: CategoriesInterface.h:38
Definition: FilterBaseInterface.h:31
Definition: FiltersInterface.h:32
Object representing department instance, which exposes model(s) with results.
Definition: NavigationInterface.h:35
A list of PreviewWidgetModelInterface instances.
Definition: PreviewModelInterface.h:38
Object representing scope instance, which exposes model(s) with results.
Definition: ScopeInterface.h:43
virtual Q_INVOKABLE void cancelActivation()=0
Cancels the current activation.
virtual Q_INVOKABLE void resetFilters()=0
Reset filters to default values.
void showDash()
Signal requesting to show the dash.
void hideDash()
Signal requesting to hide the dash.
void gotoUri(QString const &uri)
Signal requesting to open a uri.
virtual Q_INVOKABLE unity::shell::scopes::PreviewModelInterface * preview(QVariant const &result, QString const &categoryId)=0
Method used to preview a result.
void openScope(unity::shell::scopes::ScopeInterface *scope)
Signal requesting to show a temporary scope.
virtual Q_INVOKABLE unity::shell::scopes::NavigationInterface * getNavigation(QString const &navigationId)=0
Get a NavigationInterface instance for the passed navigationId.
virtual Q_INVOKABLE void performQuery(QString const &cannedQuery)=0
Execute canned query.
virtual Q_INVOKABLE void closeScope(unity::shell::scopes::ScopeInterface *scope)=0
Closes the temporary scope which got opened when openScope was emitted.
void gotoScope(QString const &scopeId)
Signal requesting to change the currently focused scope.
void previewRequested(QVariant const &result)
Signal requesting to preview a result.
virtual Q_INVOKABLE void activate(QVariant const &result, QString const &categoryId)=0
Method used to activate a result.
virtual Q_INVOKABLE void setNavigationState(QString const &navId)=0
Request change to the current navigation id.
Status
Status info code following the last operation.
Definition: ScopeInterface.h:176
virtual Q_INVOKABLE void refresh()=0
Force refresh of the scope contents.
virtual Q_INVOKABLE void resetPrimaryNavigationTag()=0
Reset primary navigation filter and its tag in the search bar.
Definition: SettingsModelInterface.h:32
Top-level namespace for all things Unity-related.
Definition: Version.h:38