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