forked from benlau/quickios
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqidevice.cpp
99 lines (74 loc) · 1.77 KB
/
qidevice.cpp
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
#include <QPointer>
#include <QCoreApplication>
#include "qidevice.h"
static QPointer<QIDevice> m_instance;
QIDevice::QIDevice(QObject* parent) : QObject(parent)
{
m_screenFillStatusBar = false;
m_screenWidth = -1;
m_screenHeight = -1;
QVariantMap data = fetch();
QStringList properties;
properties << "identifierForVendor";
for (int i = 0 ; i < properties.count() ;i++) {
QString property = properties.at(i);
if (data.contains(property)) {
setProperty(property.toLocal8Bit().constData(),
data[property]);
}
}
}
QString QIDevice::identifierForVendor() const
{
return m_identifierForVendor;
}
void QIDevice::setIdentifierForVendor(const QString &identifierForVendor)
{
m_identifierForVendor = identifierForVendor;
emit identifierForVendorChanged();
}
#ifndef Q_OS_IOS
QVariantMap QIDevice::fetch() const
{
QVariantMap data;
return data;
}
#endif
QIDevice::~QIDevice()
{
}
bool QIDevice::screenFillStatusBar() const
{
return m_screenFillStatusBar;
}
void QIDevice::setScreenFillStatusBar(bool screenFillStatusBar)
{
m_screenFillStatusBar = screenFillStatusBar;
emit screenFillStatusBarChanged();
}
int QIDevice::screenWidth() const
{
return m_screenWidth;
}
void QIDevice::setScreenWidth(int screenWidth)
{
m_screenWidth = screenWidth;
emit screenHeightChanged();
}
int QIDevice::screenHeight() const
{
return m_screenHeight;
}
void QIDevice::setScreenHeight(int screenHeight)
{
m_screenHeight = screenHeight;
emit screenHeightChanged();
}
QIDevice *QIDevice::instance()
{
if (m_instance.isNull()) {
QCoreApplication* app = QCoreApplication::instance();
m_instance = new QIDevice(app);
}
return m_instance;
}