Fix highlight on Shortcut area
[staging/HomeScreen.git] / HomeScreen / src / appinfo.h
1 /*
2  * Copyright (C) 2016 Mentor Graphics Development (Deutschland) GmbH
3  * Copyright (C) 2016 The Qt Company Ltd.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17
18 #ifndef APPINFO_H
19 #define APPINFO_H
20
21 #include <QtCore/QSharedDataPointer>
22 #include <QtDBus/QDBusArgument>
23
24 class AppInfo
25 {
26     Q_GADGET
27     Q_PROPERTY(QString id READ id)
28     Q_PROPERTY(QString version READ version)
29     Q_PROPERTY(int width READ width)
30     Q_PROPERTY(int height READ height)
31     Q_PROPERTY(QString name READ name)
32     Q_PROPERTY(QString description READ description)
33     Q_PROPERTY(QString shortname READ shortname)
34     Q_PROPERTY(QString author READ author)
35     Q_PROPERTY(QString iconPath READ iconPath)
36 public:
37     AppInfo();
38     AppInfo(const QString &icon, const QString &name, const QString &id);
39     AppInfo(const AppInfo &other);
40     virtual ~AppInfo();
41     AppInfo &operator =(const AppInfo &other);
42     void swap(AppInfo &other) { qSwap(d, other.d); }
43
44     QString id() const;
45     QString version() const;
46     int width() const;
47     int height() const;
48     QString name() const;
49     QString description() const;
50     QString shortname() const;
51     QString author() const;
52     QString iconPath() const;
53
54     void read(const QJsonObject &json);
55
56     friend QDBusArgument &operator <<(QDBusArgument &argument, const AppInfo &appInfo);
57     friend const QDBusArgument &operator >>(const QDBusArgument &argument, AppInfo &appInfo);
58
59 private:
60     class Private;
61     QSharedDataPointer<Private> d;
62 };
63
64 Q_DECLARE_SHARED(AppInfo)
65 Q_DECLARE_METATYPE(AppInfo)
66 Q_DECLARE_METATYPE(QList<AppInfo>)
67
68 #endif // APPINFO_H