summaryrefslogtreecommitdiff
path: root/daemon/appinfo.cpp
blob: e2406b834b89eb0b77ae14c9d677f11343348e55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#include "appinfo.h"
#include <QSharedData>

struct AppInfoData : public QSharedData {
    QUuid uuid;
    QString shortName;
    QString longName;
    QString companyName;
    int versionCode;
    QString versionLabel;
    bool watchface;
    bool jskit;
    QHash<QString, int> keyInts;
    QHash<int, QString> keyNames;
    QString path;
};

AppInfo::AppInfo() : d(new AppInfoData)
{
    d->versionCode = 0;
    d->watchface = false;
    d->jskit = false;
}

AppInfo::AppInfo(const AppInfo &rhs) : d(rhs.d)
{
}

AppInfo &AppInfo::operator=(const AppInfo &rhs)
{
    if (this != &rhs)
        d.operator=(rhs.d);
    return *this;
}

AppInfo::~AppInfo()
{
}

QUuid AppInfo::uuid() const
{
    return d->uuid;
}

void AppInfo::setUuid(const QUuid &uuid)
{
    d->uuid = uuid;
}

QString AppInfo::shortName() const
{
    return d->shortName;
}

void AppInfo::setShortName(const QString &string)
{
    d->shortName = string;
}

QString AppInfo::longName() const
{
    return d->longName;
}

void AppInfo::setLongName(const QString &string)
{
    d->longName = string;
}

QString AppInfo::companyName() const
{
    return d->companyName;
}

void AppInfo::setCompanyName(const QString &string)
{
    d->companyName = string;
}

int AppInfo::versionCode() const
{
    return d->versionCode;
}

void AppInfo::setVersionCode(int code)
{
    d->versionCode = code;
}

QString AppInfo::versionLabel() const
{
    return d->versionLabel;
}

void AppInfo::setVersionLabel(const QString &string)
{
    d->versionLabel = string;
}

bool AppInfo::isWatchface() const
{
    return d->watchface;
}

void AppInfo::setWatchface(bool b)
{
    d->watchface = b;
}

bool AppInfo::isJSKit() const
{
    return d->jskit;
}

void AppInfo::setJSKit(bool b)
{
    d->jskit = b;
}

void AppInfo::addAppKey(const QString &key, int value)
{
    d->keyInts.insert(key, value);
    d->keyNames.insert(value, key);
}

bool AppInfo::hasAppKeyValue(int value) const
{
    return d->keyNames.contains(value);
}

QString AppInfo::appKeyForValue(int value) const
{
    return d->keyNames.value(value);
}

bool AppInfo::hasAppKey(const QString &key) const
{
    return d->keyInts.contains(key);
}

int AppInfo::valueForAppKey(const QString &key) const
{
    return d->keyInts.value(key, -1);
}

QString AppInfo::path() const
{
    return d->path;
}

void AppInfo::setPath(const QString &string)
{
    d->path = string;
}