Add gitlab issue/merge request templates
[apps/launcher.git] / launcher / src / appinfo.cpp
1 /*
2  * Copyright (C) 2016, 2017 Mentor Graphics Development (Deutschland) GmbH
3  * Copyright (C) 2016 The Qt Company Ltd.
4  * Copyright (c) 2018 TOYOTA MOTOR CORPORATION
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18
19 #include "appinfo.h"
20
21 #include <QtCore/QJsonObject>
22
23 class AppInfo::Private : public QSharedData
24 {
25 public:
26     Private();
27     Private(const Private &other);
28
29     QString id;
30     QString name;
31     QString iconPath;
32 };
33
34 AppInfo::Private::Private()
35 {
36 }
37
38 AppInfo::Private::Private(const Private &other)
39     : QSharedData(other)
40     , id(other.id)
41     , name(other.name)
42     , iconPath(other.iconPath)
43 {
44 }
45
46 AppInfo::AppInfo()
47     : d(new Private)
48 {
49 }
50
51 AppInfo::AppInfo(const QString &icon, const QString &name, const QString &id)
52     : d(new Private)
53 {
54     d->iconPath = icon;
55     d->name = name;
56     d->id = id;
57 }
58
59 AppInfo::AppInfo(const AppInfo &other)
60     : d(other.d)
61 {
62 }
63
64 AppInfo::~AppInfo()
65 {
66 }
67
68 AppInfo &AppInfo::operator =(const AppInfo &other)
69 {
70     d = other.d;
71     return *this;
72 }
73
74 QString AppInfo::id() const
75 {
76     return d->id;
77 }
78
79 QString AppInfo::name() const
80 {
81     return d->name;
82 }
83
84 QString AppInfo::iconPath() const
85 {
86     return d->iconPath;
87 }
88
89 void AppInfo::read(const QJsonObject &json)
90 {
91     d->id = json["id"].toString();
92     d->name = json["name"].toString();
93     d->iconPath = json["iconPath"].toString();
94 }