Unity Scopes API
QActionMetadata.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 #pragma once
19 
20 #include <unity/util/DefinesPtrs.h>
21 
22 #include <QtCore/QVariantMap>
23 
24 namespace unity
25 {
26 
27 namespace scopes
28 {
29 
30 namespace qt
31 {
32 
33 class QPreviewQueryBaseAPI;
34 
35 namespace internal
36 {
37 class QActionMetadataImpl;
38 class QPreviewQueryBaseImpl;
39 }
40 
46 class QActionMetadata final
47 {
48 public:
50  UNITY_DEFINES_PTRS(QActionMetadata);
51 
52  ~QActionMetadata();
54 
60  QActionMetadata(QString const& locale, QString const& form_factor);
61 
66  void set_scope_data(QVariant const& data);
67 
72  QVariant scope_data() const;
73 
77  //{@
78  QActionMetadata(QActionMetadata const& other);
80 
81  QActionMetadata& operator=(QActionMetadata const& other);
82  QActionMetadata& operator=(QActionMetadata&&);
84 
91  void set_hint(QString const& key, QVariant const& value);
92 
99  QVariantMap hints() const;
100 
106  bool contains_hint(QString const& key) const;
107 
117  QVariant& operator[](QString const& key);
118 
128  QVariant const& operator[](QString const& key) const;
129 
130 private:
132  QActionMetadata(internal::QActionMetadataImpl* impl);
133 
134  std::unique_ptr<internal::QActionMetadataImpl> p;
135  friend class internal::QActionMetadataImpl;
136  friend class internal::QPreviewQueryBaseImpl;
137  friend class QPreviewQueryBaseAPI;
139 };
140 
141 } // namespace qt
142 
143 } // namespace scopes
144 
145 } // namespace unity
Definition: HttpAsyncReader.h:45
Metadata passed to scopes for preview and activation.
Definition: QActionMetadata.h:46
void set_hint(QString const &key, QVariant const &value)
Sets a hint.
QVariant & operator[](QString const &key)
Returns a reference to a hint.
Top-level namespace for all things Unity-related.
Definition: Version.h:49
Definition: ActionMetadata.h:31
QVariant scope_data() const
Get data attached to this ActionMetadata.
Abstract base class to represent a particular preview.
Definition: QPreviewQueryBaseAPI.h:63
void set_scope_data(QVariant const &data)
Attach arbitrary data to this ActionMetadata.
QVariantMap hints() const
Get all hints.
bool contains_hint(QString const &key) const
Check if this SearchMetadata has a hint.
QActionMetadata(QString const &locale, QString const &form_factor)
Create ActionMetadata with the given locale and form factor.