afd61145c20d95f74c96bd5ab2260a767ff57763
[staging/HomeScreen.git] / interfaces / src / appframework.cpp
1 /*
2  * Copyright (C) 2016 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 #include "include/appframework.hpp"
18
19 AppInfo::AppInfo(QObject *parent) :
20     QObject(parent)
21 {
22 }
23
24 AppInfo::AppInfo(const AppInfo &other) :
25     QObject(other.parent()),
26     name(other.getName()),
27     iconPath(other.getIconPath()),
28     description(other.getDescription())
29 {
30 }
31
32 AppInfo& AppInfo::operator=(const AppInfo &other)
33 {
34     setParent(other.parent());
35     name = other.getName();
36     iconPath = other.getIconPath();
37     description = other.getDescription();
38
39     return *this;
40 }
41
42 AppInfo::~AppInfo()
43 {
44 }
45
46 void AppInfo::registerMetaType()
47 {
48     qRegisterMetaType<AppInfo>("AppInfo");
49     qDBusRegisterMetaType<AppInfo>();
50 }
51
52
53 // Marshall the MyStructure data into a D-Bus argument
54 QDBusArgument &operator<<(QDBusArgument &argument, const AppInfo &appInfo)
55 {
56     argument.beginStructure();
57     argument << appInfo.name << appInfo.iconPath << appInfo.description;
58     argument.endStructure();
59     qDebug("appInfo.name:<< %s", appInfo.name.toStdString().c_str());
60     return argument;
61 }
62
63 // Retrieve the MyStructure data from the D-Bus argument
64 const QDBusArgument &operator>>(const QDBusArgument &argument, AppInfo &appInfo)
65 {
66     argument.beginStructure();
67     argument >> appInfo.name >> appInfo.iconPath >> appInfo.description;
68     argument.endStructure();
69     qDebug("appInfo.name:>> %s", appInfo.name.toStdString().c_str());
70     return argument;
71 }