Unity Scopes API
QPreviewReply.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/QColumnLayout.h>
31 #include <unity/scopes/qt/QPreviewWidget.h>
32 
33 #pragma GCC diagnostic push
34 #pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
35 #include <QtCore/QVariant>
36 #pragma GCC diagnostic pop
37 #include <QtCore/QObject>
38 
39 namespace unity
40 {
41 
42 namespace scopes
43 {
44 
45 namespace qt
46 {
47 
48 class QPreviewQueryBaseAPI;
49 
50 namespace internal
51 {
52 class QPreviewReplyImpl;
53 }
54 
59 class QPreviewReply : public QObject
60 {
61  Q_OBJECT
62 public:
64  NONCOPYABLE(QPreviewReply);
65  UNITY_DEFINES_PTRS(QPreviewReply);
67 
75  bool register_layout(QColumnLayoutList const& layouts);
76 
83  bool push(QPreviewWidgetList const& widget_list);
84 
89  bool push(QString const& key, QVariant const& value);
90 
92  virtual ~QPreviewReply();
94 
95 protected:
97  QPreviewReply(unity::scopes::PreviewReplyProxy& reply, QObject* parent = 0);
98 
99 private:
100  std::unique_ptr<internal::QPreviewReplyImpl> p;
101  friend class QPreviewQueryBaseAPI;
103 };
104 
105 } // namespace qt
106 
107 } // namespace scopes
108 
109 } // namespace unity
Top-level namespace for all things Unity-related.
Definition: Version.h:49
Definition: ActionMetadata.h:31
bool push(QPreviewWidgetList const &widget_list)
Sends widget definitions to the sender of the preview query.
bool register_layout(QColumnLayoutList const &layouts)
Registers a list of column layouts for the current preview.
std::shared_ptr< PreviewReply > PreviewReplyProxy
Convenience type definition.
Definition: PreviewReplyProxyFwd.h:34
Abstract base class to represent a particular preview.
Definition: QPreviewQueryBaseAPI.h:72
Allows the results of a preview to be sent to the preview requester.
Definition: QPreviewReply.h:59