on 4e4dafa help sign in
unity8/plugins/Unity/result.h
69 lines 2.1 kB history raw
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * Authors:
5 * Pawel Stolowski <pawel.stolowski@canonical.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 3.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
20#ifndef RESULT_H
21#define RESULT_H
23// Qt
24#include <QObject>
25#include <QVariant>
27// libunity-core
28#include <UnityCore/Preview.h>
30class Q_DECL_EXPORT Result : public QObject
32 Q_OBJECT
34 Q_PROPERTY(QString uri READ uri CONSTANT)
35 Q_PROPERTY(QString iconHint READ iconHint CONSTANT)
36 Q_PROPERTY(unsigned categoryIndex READ categoryIndex CONSTANT)
37 Q_PROPERTY(unsigned resultType READ resultType CONSTANT)
38 Q_PROPERTY(QString mimeType READ mimeType CONSTANT)
39 Q_PROPERTY(QString title READ title CONSTANT)
40 Q_PROPERTY(QString comment READ comment CONSTANT)
41 Q_PROPERTY(QString dndUri READ dndUri CONSTANT)
42 Q_PROPERTY(QVariant metadata READ metadata CONSTANT)
44public:
45 Result(QObject *parent = nullptr);
46 Result(unity::dash::Preview::Ptr preview, QObject *parent = nullptr);
48 void setPreview(unity::dash::Preview::Ptr preview);
50 QString uri() const;
51 QString iconHint() const;
52 unsigned categoryIndex() const;
53 unsigned resultType() const;
54 QString mimeType() const;
55 QString title() const;
56 QString comment() const;
57 QString dndUri() const;
58 QVariant metadata() const;
60private:
61 /* Keep reference to the original preview to access result attributes via it, rather than keeping copies of them;
62 this will save us a bit on copying, especially as UI is mostly interested in just uri.
63 */
64 unity::dash::Preview::Ptr m_preview;
65};
67Q_DECLARE_METATYPE(Result *)
69#endif