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 #ifndef _ENABLE_QT_EXPERIMENTAL_
22 #error You should define _ENABLE_QT_EXPERIMENTAL_ in order to use this experimental header file.
23 #endif
24 
25 #include <unity/scopes/qt/QSearchQueryBase.h>
26 #include <unity/scopes/qt/QPreviewQueryBase.h>
27 
28 #include <unity/util/DefinesPtrs.h>
29 #include <unity/util/NonCopyable.h>
30 
31 #include <QtCore/QString>
32 #include <QtCore/QObject>
33 
34 namespace unity
35 {
36 
37 namespace scopes
38 {
39 
40 class SearchMetadata;
41 class CannedQuery;
42 
43 namespace qt
44 {
45 
46 namespace internal
47 {
48 class QScopeBaseImpl;
49 }
50 
115 class QScopeBase : public QObject
116 {
117  Q_OBJECT
118 public:
120  NONCOPYABLE(QScopeBase);
121  UNITY_DEFINES_PTRS(QScopeBase);
122 
123  QScopeBase(QObject* parent = 0);
124  virtual ~QScopeBase();
126 
130  virtual void start(QString const&);
131 
135  virtual void stop();
136 
140  virtual QPreviewQueryBase::UPtr preview(const QResult&, const QActionMetadata&) = 0;
141 
145  virtual QSearchQueryBase::UPtr search(unity::scopes::CannedQuery const& q,
146  unity::scopes::SearchMetadata const&) = 0;
147 
148 private:
149  std::unique_ptr<internal::QScopeBaseImpl> p;
150 };
151 
152 } // namespace qt
153 
154 } // namespace scopes
155 
156 } // namespace unity
virtual QSearchQueryBase::UPtr search(unity::scopes::CannedQuery const &q, unity::scopes::SearchMetadata const &)=0
Metadata passed with search requests.
Definition: SearchMetadata.h:45
Metadata passed to scopes for preview and activation.
Definition: QActionMetadata.h:54
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:63
Definition: ActionMetadata.h:31
Parameters of a search query.
Definition: CannedQuery.h:49
Base class for a scope implementation.
Definition: QScopeBase.h:115
virtual QPreviewQueryBase::UPtr preview(const QResult &, const QActionMetadata &)=0