blob: f7b766cba43c6896477b0f4ed599b030d0647014 (
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
|
#include <QtCore/QRegularExpression>
#include "widgetinfo.h"
struct WidgetInfoData : public QSharedData
{
QUrl url;
QString desc;
bool invert;
short page;
WidgetInfo::WidgetSize size;
WidgetInfo::WidgetPosition pos;
};
WidgetInfo::WidgetInfo()
: d(new WidgetInfoData)
{
}
WidgetInfo::WidgetInfo(const WidgetInfo &other)
: d(other.d)
{
}
WidgetInfo::~WidgetInfo()
{
}
WidgetInfo& WidgetInfo::operator =(const WidgetInfo &other)
{
if (this != &other) {
d = other.d;
}
return *this;
}
bool WidgetInfo::valid() const
{
return !d->url.isEmpty();
}
QUrl WidgetInfo::url() const
{
return d->url;
}
void WidgetInfo::setUrl(const QUrl &url)
{
d->url = url;
}
int WidgetInfo::builtinClockfaceId() const
{
QString file = d->url.toLocalFile();
if (file.isEmpty()) return -1;
// I'm definitely evil:
static const QRegularExpression re("qml/watch/faces/builtinface([0-9]+).qml$");
QRegularExpressionMatch match = re.match(file);
if (match.hasMatch()) {
return match.captured(1).toInt();
} else {
return -1;
}
}
QString WidgetInfo::description() const
{
return d->desc;
}
void WidgetInfo::setDescription(const QString &desc)
{
d->desc = desc;
}
bool WidgetInfo::invert() const
{
return d->invert;
}
void WidgetInfo::setInvert(bool invert)
{
d->invert = invert;
}
int WidgetInfo::page() const
{
return d->page;
}
void WidgetInfo::setPage(int page)
{
d->page = page;
}
WidgetInfo::WidgetSize WidgetInfo::size() const
{
return d->size;
}
void WidgetInfo::setSize(const WidgetSize &size)
{
d->size = size;
}
WidgetInfo::WidgetPosition WidgetInfo::position() const
{
return d->pos;
}
void WidgetInfo::setPosition(const WidgetPosition &pos)
{
d->pos = pos;
}
|