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
112 QString AppInfo::description() const
114 return d->description;
117 QString AppInfo::shortname() const
122 QString AppInfo::author() const
127 QString AppInfo::iconPath() const
132 void AppInfo::read(const QJsonObject &json)
134 d->id = json["id"].toString();
135 d->version = json["version"].toString();
136 d->width = json["width"].toInt();
137 d->height = json["height"].toInt();
138 d->name = json["name"].toString();
139 d->description = json["description"].toString();
140 d->shortname = json["shortname"].toString();
141 d->author = json["author"].toString();
142 d->iconPath = json["iconPath"].toString();
145 QDBusArgument &operator <<(QDBusArgument &argument, const AppInfo &appInfo)
147 argument.beginStructure();
148 argument << appInfo.d->id;
149 argument << appInfo.d->version;
150 argument << appInfo.d->width;
151 argument << appInfo.d->height;
152 argument << appInfo.d->name;
153 argument << appInfo.d->description;
154 argument << appInfo.d->shortname;
155 argument << appInfo.d->author;
156 argument << appInfo.d->iconPath;
157 argument.endStructure();
162 const QDBusArgument &operator >>(const QDBusArgument &argument, AppInfo &appInfo)
164 argument.beginStructure();
165 argument >> appInfo.d->id;
166 argument >> appInfo.d->version;
167 argument >> appInfo.d->width;
168 argument >> appInfo.d->height;
169 argument >> appInfo.d->name;
170 argument >> appInfo.d->description;
171 argument >> appInfo.d->shortname;
172 argument >> appInfo.d->author;
173 argument >> appInfo.d->iconPath;
174 argument.endStructure();