Unity Scopes API
QScopeBase.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Canonical Ltd
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License version 3 as
6  * published by the Free Software Foundation.
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 Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Xavi Garcia <xavi.garcia.mena@canonical.com>
17  */
18 
19 #pragma once
20 
21 #include <unity/scopes/qt/QSearchQueryBase.h>
22 #include <unity/scopes/qt/QPreviewQueryBase.h>
23 
24 #include <unity/util/DefinesPtrs.h>
25 #include <unity/util/NonCopyable.h>
26 
27 #include <QtCore/QString>
28 #include <QtCore/QObject>
29 
30 namespace unity
31 {
32 
33 namespace scopes
34 {
35 
36 class SearchMetadata;
37 class CannedQuery;
38 
39 namespace qt
40 {
41 
42 namespace internal
43 {
44 class QScopeBaseImpl;
45 }
46 
113 class QScopeBase : public QObject
114 {
115  Q_OBJECT
116 public:
118  NONCOPYABLE(QScopeBase);
119  UNITY_DEFINES_PTRS(QScopeBase);
120 
121  QScopeBase(QObject* parent = 0);
122  virtual ~QScopeBase();
124 
128  virtual void start(QString const&);
129 
133  virtual void stop();
134 
138  virtual QPreviewQueryBase::UPtr preview(const QResult&, const QActionMetadata&) = 0;
139 
143  virtual QSearchQueryBase::UPtr search(unity::scopes::CannedQuery const& q,
144  unity::scopes::SearchMetadata const&) = 0;
145 
146 private:
147  std::unique_ptr<internal::QScopeBaseImpl> p;
148  friend class internal::QScopeBaseImpl;
149 };
150 
151 } // namespace qt
152 
153 } // namespace scopes
154 
155 } // namespace unity
virtual QSearchQueryBase::UPtr search(unity::scopes::CannedQuery const &q, unity::scopes::SearchMetadata const &)=0
Definition: HttpAsyncReader.h:45
Metadata passed with search requests.
Definition: SearchMetadata.h:43
Metadata passed to scopes for preview and activation.
Definition: QActionMetadata.h:46
virtual void stop()
Definition: QScopeBase.cpp:41
virtual void start(QString const &)
Definition: QScopeBase.cpp:36
Top-level namespace for all things Unity-related.
Definition: Version.h:49
The attributes of a result returned by a Scope.
Definition: QResult.h:56
Definition: ActionMetadata.h:31
Parameters of a search query.
Definition: CannedQuery.h:45
Base class for a scope implementation.
Definition: QScopeBase.h:113
virtual QPreviewQueryBase::UPtr preview(const QResult &, const QActionMetadata &)=0