Unity Scopes API
QPreviewQueryBase.h
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/util/DefinesPtrs.h>
26 #include <unity/util/NonCopyable.h>
27 
28 #include <unity/scopes/PreviewReplyProxyFwd.h>
29 
30 #include <unity/scopes/qt/QActionMetadata.h>
31 #include <unity/scopes/qt/QCannedQuery.h>
32 #include <unity/scopes/qt/QPreviewReplyProxy.h>
33 #include <unity/scopes/qt/QResult.h>
34 
35 #include <QtCore/QObject>
36 
37 namespace unity
38 {
39 
40 namespace scopes
41 {
42 
43 class SearchMetadata;
44 class CannedQuery;
45 class ActionMetadata;
46 
47 namespace qt
48 {
49 
50 class QResult;
51 
52 namespace internal
53 {
54 class QPreviewQueryBaseImpl;
55 }
56 
57 class QPreviewQueryBaseAPI;
58 
67 class QPreviewQueryBase : public QObject
68 {
69  Q_OBJECT
70 public:
72  NONCOPYABLE(QPreviewQueryBase);
73  UNITY_DEFINES_PTRS(QPreviewQueryBase);
75 
76  virtual ~QPreviewQueryBase();
77 
95  virtual void run(unity::scopes::qt::QPreviewReplyProxy const& reply) = 0;
96 
107  virtual void cancelled() = 0; // Originator cancelled the query
108 
114  QResult result() const;
115 
122 
123 protected:
125  QPreviewQueryBase(QObject* parent = 0);
126 
127 private:
128  void init(QPreviewQueryBaseAPI* query_api);
129 
130  std::unique_ptr<internal::QPreviewQueryBaseImpl> p;
131  friend class QPreviewQueryBaseAPI;
133 };
134 
135 } // namespace qt
136 
137 } // namespace scopes
138 
139 } // namespace unity
virtual void run(unity::scopes::qt::QPreviewReplyProxy const &reply)=0
Called by scopes run time to start the query.
Metadata passed to scopes for preview and activation.
Definition: QActionMetadata.h:54
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
Abstract base class to represent a particular preview.
Definition: QPreviewQueryBaseAPI.h:72
QActionMetadata action_metadata() const
Get metadata for this preview request.
virtual void cancelled()=0
Called by the scopes run time when the query originator cancels a query.
QResult result() const
Get result for this preview request.
Abstract base class to represent a particular preview.
Definition: QPreviewQueryBase.h:67