2 * Copyright (C) 2016, 2017 Mentor Graphics Development (Deutschland) GmbH
3 * Copyright (C) 2016 The Qt Company Ltd.
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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
20 #include <QtCore/QJsonObject>
22 class AppInfo::Private : public QSharedData
26 Private(const Private &other);
39 AppInfo::Private::Private()
45 AppInfo::Private::Private(const Private &other)
48 , version(other.version)
50 , height(other.height)
52 , description(other.description)
53 , shortname(other.shortname)
54 , author(other.author)
55 , iconPath(other.iconPath)
64 AppInfo::AppInfo(const QString &icon, const QString &name, const QString &id)
72 AppInfo::AppInfo(const AppInfo &other)
81 AppInfo &AppInfo::operator =(const AppInfo &other)
87 QString AppInfo::id() const
92 QString AppInfo::version() const
97 int AppInfo::width() const
102 int AppInfo::height() const
107 QString AppInfo::name() const
111 void AppInfo::setName(const QString &name)
116 QString AppInfo::description() const
118 return d->description;
121 QString AppInfo::shortname() const
126 QString AppInfo::author() const
131 QString AppInfo::iconPath() const
136 void AppInfo::read(const QJsonObject &json)
138 d->id = json["id"].toString();
139 d->version = json["version"].toString();
140 d->width = json["width"].toInt();
141 d->height = json["height"].toInt();
142 d->name = json["name"].toString();
143 d->description = json["description"].toString();
144 d->shortname = json["shortname"].toString();
145 d->author = json["author"].toString();
146 d->iconPath = json["iconPath"].toString();
149 QDBusArgument &operator <<(QDBusArgument &argument, const AppInfo &appInfo)
151 argument.beginStructure();
152 argument << appInfo.d->id;
153 argument << appInfo.d->version;
154 argument << appInfo.d->width;
155 argument << appInfo.d->height;
156 argument << appInfo.d->name;
157 argument << appInfo.d->description;
158 argument << appInfo.d->shortname;
159 argument << appInfo.d->author;
160 argument << appInfo.d->iconPath;
161 argument.endStructure();
166 const QDBusArgument &operator >>(const QDBusArgument &argument, AppInfo &appInfo)
168 argument.beginStructure();
169 argument >> appInfo.d->id;
170 argument >> appInfo.d->version;
171 argument >> appInfo.d->width;
172 argument >> appInfo.d->height;
173 argument >> appInfo.d->name;
174 argument >> appInfo.d->description;
175 argument >> appInfo.d->shortname;
176 argument >> appInfo.d->author;
177 argument >> appInfo.d->iconPath;
178 argument.endStructure();