2 * Copyright (C) 2016, 2017 Mentor Graphics Development (Deutschland) GmbH
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #include "include/appframework.hpp"
19 #include <QtCore/QJsonObject>
21 class AppInfo::Private : public QSharedData
25 Private(const Private &other);
38 AppInfo::Private::Private()
44 AppInfo::Private::Private(const Private &other)
47 , version(other.version)
49 , height(other.height)
51 , description(other.description)
52 , shortname(other.shortname)
53 , author(other.author)
54 , iconPath(other.iconPath)
63 AppInfo::AppInfo(const AppInfo &other)
72 AppInfo &AppInfo::operator =(const AppInfo &other)
78 QString AppInfo::id() const
83 QString AppInfo::version() const
88 int AppInfo::width() const
93 int AppInfo::height() const
98 QString AppInfo::name() const
103 QString AppInfo::description() const
105 return d->description;
108 QString AppInfo::shortname() const
113 QString AppInfo::author() const
118 QString AppInfo::iconPath() const
123 void AppInfo::read(const QJsonObject &json)
125 d->id = json["id"].toString();
126 d->version = json["version"].toString();
127 d->width = json["width"].toInt();
128 d->height = json["height"].toInt();
129 d->name = json["name"].toString();
130 d->description = json["description"].toString();
131 d->shortname = json["shortname"].toString();
132 d->author = json["author"].toString();
133 d->iconPath = json["iconPath"].toString();
136 QDBusArgument &operator <<(QDBusArgument &argument, const AppInfo &appInfo)
138 argument.beginStructure();
139 argument << appInfo.d->id;
140 argument << appInfo.d->version;
141 argument << appInfo.d->width;
142 argument << appInfo.d->height;
143 argument << appInfo.d->name;
144 argument << appInfo.d->description;
145 argument << appInfo.d->shortname;
146 argument << appInfo.d->author;
147 argument << appInfo.d->iconPath;
148 argument.endStructure();
153 const QDBusArgument &operator >>(const QDBusArgument &argument, AppInfo &appInfo)
155 argument.beginStructure();
156 argument >> appInfo.d->id;
157 argument >> appInfo.d->version;
158 argument >> appInfo.d->width;
159 argument >> appInfo.d->height;
160 argument >> appInfo.d->name;
161 argument >> appInfo.d->description;
162 argument >> appInfo.d->shortname;
163 argument >> appInfo.d->author;
164 argument >> appInfo.d->iconPath;
165 argument.endStructure();