summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXizhi Zhu <xizhi.zhu@gmail.com>2012-08-16 18:35:27 +0300
committerQt by Nokia <qt-info@nokia.com>2012-08-17 01:33:41 +0200
commita28c4c9eebe92c84b6b5c1792cd2bacaae94e58d (patch)
tree821738fd5434fdb6840c04e59ea9c47479f0f678
parent98483f9bc4862618634d73dbf99da2178cf64c5e (diff)
Removed JSONDB backend from SystemInfo.
Change-Id: I2e8c4312bdcf9eb93e3d4b6607b8c6596b9d8a19 Reviewed-by: Lorn Potter <lorn.potter@nokia.com>
-rw-r--r--src/systeminfo/qdeviceinfo_linux.cpp56
-rw-r--r--src/systeminfo/qdeviceinfo_linux_p.h11
-rw-r--r--src/systeminfo/qdeviceprofile.cpp36
-rw-r--r--src/systeminfo/qdeviceprofile.h4
-rw-r--r--src/systeminfo/qdeviceprofile_linux.cpp138
-rw-r--r--src/systeminfo/qdeviceprofile_linux_p.h98
-rw-r--r--src/systeminfo/qdisplayinfo.cpp31
-rw-r--r--src/systeminfo/qdisplayinfo.h4
-rw-r--r--src/systeminfo/qdisplayinfo_linux.cpp63
-rw-r--r--src/systeminfo/qdisplayinfo_linux_p.h29
-rw-r--r--src/systeminfo/qjsondbwrapper.cpp600
-rw-r--r--src/systeminfo/qjsondbwrapper_p.h139
-rw-r--r--src/systeminfo/qsysteminfo_simulator.cpp50
-rw-r--r--src/systeminfo/qsysteminfo_simulator_p.h9
-rw-r--r--src/systeminfo/systeminfo.pro23
15 files changed, 3 insertions, 1288 deletions
diff --git a/src/systeminfo/qdeviceinfo_linux.cpp b/src/systeminfo/qdeviceinfo_linux.cpp
index 43f2234a..12935304 100644
--- a/src/systeminfo/qdeviceinfo_linux.cpp
+++ b/src/systeminfo/qdeviceinfo_linux.cpp
@@ -41,10 +41,6 @@
#include "qdeviceinfo_linux_p.h"
-#if !defined(QT_NO_JSONDB)
-#include "qjsondbwrapper_p.h"
-#endif // QT_NO_JSONDB
-
#if !defined(QT_NO_OFONO)
#include "qofonowrapper_p.h"
#endif // QT_NO_OFONO
@@ -72,9 +68,6 @@ QDeviceInfoPrivate::QDeviceInfoPrivate(QDeviceInfo *parent)
#endif // QT_SIMULATOR
, watchThermalState(false)
, timer(0)
-#if !defined(QT_NO_JSONDB)
- , jsondbWrapper(0)
-#endif // QT_NO_JSONDB
#if !defined(QT_NO_OFONO)
, ofonoWrapper(0)
#endif // QT_NO_OFONO
@@ -175,11 +168,6 @@ bool QDeviceInfoPrivate::hasFeature(QDeviceInfo::Feature feature)
case QDeviceInfo::PositioningFeature:
// TODO: find the kernel interface for this
-#if !defined(QT_NO_JSONDB)
- if (!jsondbWrapper)
- jsondbWrapper = new QJsonDbWrapper(this);
- return jsondbWrapper->hasFeaturePositioning();
-#endif
return false;
case QDeviceInfo::VideoOutFeature: {
@@ -216,22 +204,11 @@ bool QDeviceInfoPrivate::hasFeature(QDeviceInfo::Feature feature)
QDeviceInfo::LockTypeFlags QDeviceInfoPrivate::activatedLocks()
{
-#if !defined(QT_NO_JSONDB)
- if (!jsondbWrapper)
- jsondbWrapper = new QJsonDbWrapper(this);
- return jsondbWrapper->activatedLockTypes();
-#endif
return QDeviceInfo::NoLock;
}
QDeviceInfo::LockTypeFlags QDeviceInfoPrivate::enabledLocks()
{
-#if !defined(QT_NO_JSONDB)
- if (!jsondbWrapper)
- jsondbWrapper = new QJsonDbWrapper(this);
- return jsondbWrapper->enabledLockTypes();
-#endif
-
QDeviceInfo::LockTypeFlags enabledLocks = QDeviceInfo::NoLock;
QScreenSaverPrivate screenSaver(0);
@@ -300,17 +277,9 @@ QString QDeviceInfoPrivate::manufacturer()
QString QDeviceInfoPrivate::model()
{
if (modelBuffer.isEmpty()) {
-#if !defined(QT_NO_JSONDB)
- if (!jsondbWrapper)
- jsondbWrapper = new QJsonDbWrapper(this);
- modelBuffer = jsondbWrapper->model();
- if (modelBuffer.startsWith(manufacturer()))
- modelBuffer = modelBuffer.right(modelBuffer.length() - manufacturerBuffer.length()).trimmed();
-#else
QFile file(QStringLiteral("/sys/devices/virtual/dmi/id/product_name"));
if (file.open(QIODevice::ReadOnly))
modelBuffer = QString::fromLocal8Bit(file.readAll().simplified().data());
-#endif
}
return modelBuffer;
@@ -403,19 +372,6 @@ extern QMetaMethod proxyToSourceSignal(const QMetaMethod &, QObject *);
void QDeviceInfoPrivate::connectNotify(const QMetaMethod &signal)
{
-#if !defined(QT_NO_JSONDB)
- static const QMetaMethod activatedLocksChangedSignal = QMetaMethod::fromSignal(&QDeviceInfoPrivate::activatedLocksChanged);
- static const QMetaMethod enabledLocksChangedSignal = QMetaMethod::fromSignal(&QDeviceInfoPrivate::enabledLocksChanged);
- if (signal == activatedLocksChangedSignal
- || signal == enabledLocksChangedSignal) {
- if (!jsondbWrapper)
- jsondbWrapper = new QJsonDbWrapper(this);
- QMetaMethod sourceSignal = proxyToSourceSignal(signal, jsondbWrapper);
- connect(jsondbWrapper, sourceSignal, this, signal, Qt::UniqueConnection);
- return;
- }
-#endif // // QT_NO_JSONDB
-
if (timer == 0) {
timer = new QTimer;
timer->setInterval(2000);
@@ -434,18 +390,6 @@ void QDeviceInfoPrivate::connectNotify(const QMetaMethod &signal)
void QDeviceInfoPrivate::disconnectNotify(const QMetaMethod &signal)
{
-#if !defined(QT_NO_JSONDB)
- static const QMetaMethod activatedLocksChangedSignal = QMetaMethod::fromSignal(&QDeviceInfoPrivate::activatedLocksChanged);
- static const QMetaMethod enabledLocksChangedSignal = QMetaMethod::fromSignal(&QDeviceInfoPrivate::enabledLocksChanged);
- if ((signal == activatedLocksChangedSignal
- || signal == enabledLocksChangedSignal)
- && jsondbWrapper) {
- QMetaMethod sourceSignal = proxyToSourceSignal(signal, jsondbWrapper);
- disconnect(jsondbWrapper, sourceSignal, this, signal);
- return;
- }
-#endif // QT_NO_JSONDB
-
static const QMetaMethod thermalStateChangedSignal = QMetaMethod::fromSignal(&QDeviceInfoPrivate::thermalStateChanged);
if (signal == thermalStateChangedSignal) {
watchThermalState = false;
diff --git a/src/systeminfo/qdeviceinfo_linux_p.h b/src/systeminfo/qdeviceinfo_linux_p.h
index c4f6c463..12368c67 100644
--- a/src/systeminfo/qdeviceinfo_linux_p.h
+++ b/src/systeminfo/qdeviceinfo_linux_p.h
@@ -65,10 +65,6 @@ QT_BEGIN_NAMESPACE
class QTimer;
-#if !defined(QT_NO_JSONDB)
-class QJsonDbWrapper;
-#endif // QT_NO_JSONDB
-
#if !defined(QT_NO_OFONO)
class QOfonoWrapper;
#endif // QT_NO_OFONO
@@ -93,10 +89,6 @@ public:
QString version(QDeviceInfo::Version type);
Q_SIGNALS:
-#if !defined(QT_NO_JSONDB)
- void activatedLocksChanged(QDeviceInfo::LockTypeFlags types);
- void enabledLocksChanged(QDeviceInfo::LockTypeFlags types);
-#endif // QT_NO_JSONDB
void thermalStateChanged(QDeviceInfo::ThermalState state);
protected:
@@ -127,9 +119,6 @@ private:
QDeviceInfo::ThermalState getThermalState();
-#if !defined(QT_NO_JSONDB)
- QJsonDbWrapper *jsondbWrapper;
-#endif // QT_NO_JSONDB
#if !defined(QT_NO_OFONO)
QOfonoWrapper *ofonoWrapper;
#endif // QT_NO_OFONO
diff --git a/src/systeminfo/qdeviceprofile.cpp b/src/systeminfo/qdeviceprofile.cpp
index 1b867c0e..34bddc84 100644
--- a/src/systeminfo/qdeviceprofile.cpp
+++ b/src/systeminfo/qdeviceprofile.cpp
@@ -41,9 +41,6 @@
#include <qdeviceprofile.h>
-#if defined(Q_OS_LINUX)
-# include "qdeviceprofile_linux_p.h"
-#else
QT_BEGIN_NAMESPACE
class QDeviceProfilePrivate
{
@@ -56,7 +53,6 @@ public:
QDeviceProfile::ProfileType currentProfileType() { return QDeviceProfile::UnknownProfile; }
};
QT_END_NAMESPACE
-#endif
#include <QtCore/qmetaobject.h>
@@ -167,36 +163,4 @@ QDeviceProfile::ProfileType QDeviceProfile::currentProfileType() const
return d_ptr->currentProfileType();
}
-extern QMetaMethod proxyToSourceSignal(const QMetaMethod &, QObject *);
-
-/*!
- \internal
-*/
-void QDeviceProfile::connectNotify(const QMetaMethod &signal)
-{
-#if defined(Q_OS_LINUX) || defined(QT_SIMULATOR)
- QMetaMethod sourceSignal = proxyToSourceSignal(signal, d_ptr);
- connect(d_ptr, sourceSignal, this, signal, Qt::UniqueConnection);
-#else
- Q_UNUSED(signal)
-#endif
-}
-
-/*!
- \internal
-*/
-void QDeviceProfile::disconnectNotify(const QMetaMethod &signal)
-{
-#if defined(Q_OS_LINUX) || defined(QT_SIMULATOR)
- // We can only disconnect with the private implementation, when there is no receivers for the signal.
- if (isSignalConnected(signal))
- return;
-
- QMetaMethod sourceSignal = proxyToSourceSignal(signal, d_ptr);
- disconnect(d_ptr, sourceSignal, this, signal);
-#else
- Q_UNUSED(signal)
-#endif
-}
-
QT_END_NAMESPACE
diff --git a/src/systeminfo/qdeviceprofile.h b/src/systeminfo/qdeviceprofile.h
index a0640d3b..6aa2d503 100644
--- a/src/systeminfo/qdeviceprofile.h
+++ b/src/systeminfo/qdeviceprofile.h
@@ -83,10 +83,6 @@ Q_SIGNALS:
void voiceRingtoneVolumeChanged(int volume);
void currentProfileTypeChanged(QDeviceProfile::ProfileType profile);
-protected:
- void connectNotify(const QMetaMethod &signal);
- void disconnectNotify(const QMetaMethod &signal);
-
private:
Q_DISABLE_COPY(QDeviceProfile)
QDeviceProfilePrivate * const d_ptr;
diff --git a/src/systeminfo/qdeviceprofile_linux.cpp b/src/systeminfo/qdeviceprofile_linux.cpp
deleted file mode 100644
index 1097b87c..00000000
--- a/src/systeminfo/qdeviceprofile_linux.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtSystems module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdeviceprofile_linux_p.h"
-
-#include <QtCore/qmetaobject.h>
-
-QT_BEGIN_NAMESPACE
-
-QDeviceProfilePrivate::QDeviceProfilePrivate(QDeviceProfile *parent)
- : QObject(parent)
- , q_ptr(parent)
-{
-#if !defined(QT_NO_JSONDB)
- // start querying for profile data
- jsondbWrapper.currentProfileType();
-#endif //QT_NO_JSONDB
-}
-
-QDeviceProfilePrivate::~QDeviceProfilePrivate()
-{
-}
-
-bool QDeviceProfilePrivate::isVibrationActivated()
-{
-#if !defined(QT_NO_JSONDB)
- return jsondbWrapper.isVibrationActivated();
-#endif //QT_NO_JSONDB
-
- return false;
-}
-
-int QDeviceProfilePrivate::messageRingtoneVolume()
-{
-#if !defined(QT_NO_JSONDB)
- return jsondbWrapper.ringtoneVolume();
-#endif //QT_NO_JSONDB
-
- return -1;
-}
-
-int QDeviceProfilePrivate::voiceRingtoneVolume()
-{
-#if !defined(QT_NO_JSONDB)
- return jsondbWrapper.ringtoneVolume();
-#endif //QT_NO_JSONDB
-
- return -1;
-}
-
-QDeviceProfile::ProfileType QDeviceProfilePrivate::currentProfileType()
-{
-#if !defined(QT_NO_JSONDB)
- return jsondbWrapper.currentProfileType();
-#endif //QT_NO_JSONDB
-
- return QDeviceProfile::UnknownProfile;
-}
-
-extern QMetaMethod proxyToSourceSignal(const QMetaMethod &, QObject *);
-
-void QDeviceProfilePrivate::connectNotify(const QMetaMethod &signal)
-{
-#if !defined(QT_NO_JSONDB)
- static const QMetaMethod vibrationActivatedChangedSignal = QMetaMethod::fromSignal(&QDeviceProfilePrivate::vibrationActivatedChanged);
- static const QMetaMethod messageRingtoneVolumeChangedSignal = QMetaMethod::fromSignal(&QDeviceProfilePrivate::messageRingtoneVolumeChanged);
- static const QMetaMethod voiceRingtoneVolumeChangedSignal = QMetaMethod::fromSignal(&QDeviceProfilePrivate::voiceRingtoneVolumeChanged);
- static const QMetaMethod currentProfileTypeChangedSignal = QMetaMethod::fromSignal(&QDeviceProfilePrivate::currentProfileTypeChanged);
- if (signal == vibrationActivatedChangedSignal
- || signal == currentProfileTypeChangedSignal) {
- QMetaMethod sourceSignal = proxyToSourceSignal(signal, &jsondbWrapper);
- connect(&jsondbWrapper, sourceSignal, this, signal, Qt::UniqueConnection);
- } else if (signal == messageRingtoneVolumeChangedSignal) {
- connect(&jsondbWrapper, SIGNAL(ringtoneVolumeChanged(int)), this, SIGNAL(messageRingtoneVolumeChanged(int)), Qt::UniqueConnection);
- } else if (signal == voiceRingtoneVolumeChangedSignal) {
- connect(&jsondbWrapper, SIGNAL(ringtoneVolumeChanged(int)), this, SIGNAL(voiceRingtoneVolumeChanged(int)), Qt::UniqueConnection);
- }
-#endif // // QT_NO_JSONDB
-}
-
-void QDeviceProfilePrivate::disconnectNotify(const QMetaMethod &signal)
-{
-#if !defined(QT_NO_JSONDB)
- static const QMetaMethod vibrationActivatedChangedSignal = QMetaMethod::fromSignal(&QDeviceProfilePrivate::vibrationActivatedChanged);
- static const QMetaMethod messageRingtoneVolumeChangedSignal = QMetaMethod::fromSignal(&QDeviceProfilePrivate::messageRingtoneVolumeChanged);
- static const QMetaMethod voiceRingtoneVolumeChangedSignal = QMetaMethod::fromSignal(&QDeviceProfilePrivate::voiceRingtoneVolumeChanged);
- static const QMetaMethod currentProfileTypeChangedSignal = QMetaMethod::fromSignal(&QDeviceProfilePrivate::currentProfileTypeChanged);
- if (signal == vibrationActivatedChangedSignal
- || signal == currentProfileTypeChangedSignal) {
- QMetaMethod sourceSignal = proxyToSourceSignal(signal, &jsondbWrapper);
- disconnect(&jsondbWrapper, sourceSignal, this, signal);
- } else if (signal == messageRingtoneVolumeChangedSignal) {
- disconnect(&jsondbWrapper, SIGNAL(ringtoneVolumeChanged(int)), this, SIGNAL(messageRingtoneVolumeChanged(int)));
- } else if (signal == voiceRingtoneVolumeChangedSignal) {
- disconnect(&jsondbWrapper, SIGNAL(ringtoneVolumeChanged(int)), this, SIGNAL(voiceRingtoneVolumeChanged(int)));
- }
-#endif // QT_NO_JSONDB
-}
-
-QT_END_NAMESPACE
diff --git a/src/systeminfo/qdeviceprofile_linux_p.h b/src/systeminfo/qdeviceprofile_linux_p.h
deleted file mode 100644
index ab16ff4e..00000000
--- a/src/systeminfo/qdeviceprofile_linux_p.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtSystems module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#ifndef QDEVICEPROFILE_LINUX_P_H
-#define QDEVICEPROFILE_LINUX_P_H
-
-#include <qdeviceprofile.h>
-
-#if !defined(QT_NO_JSONDB)
-#include <qjsondbwrapper_p.h>
-#endif //QT_NO_JSONDB
-
-QT_BEGIN_NAMESPACE
-
-class QDeviceProfilePrivate : public QObject
-{
- Q_OBJECT
-
-public:
- QDeviceProfilePrivate(QDeviceProfile *parent);
- ~QDeviceProfilePrivate();
-
- bool isVibrationActivated();
- int messageRingtoneVolume();
- int voiceRingtoneVolume();
- QDeviceProfile::ProfileType currentProfileType();
-
-Q_SIGNALS:
- void vibrationActivatedChanged(bool activated);
- void messageRingtoneVolumeChanged(int volume);
- void voiceRingtoneVolumeChanged(int volume);
- void currentProfileTypeChanged(QDeviceProfile::ProfileType profile);
-
-protected:
- void connectNotify(const QMetaMethod &signal);
- void disconnectNotify(const QMetaMethod &signal);
-
-private:
- QDeviceProfile * const q_ptr;
- Q_DECLARE_PUBLIC(QDeviceProfile)
-
-#if !defined(QT_NO_JSONDB)
- QJsonDbWrapper jsondbWrapper;
-#endif //QT_NO_JSONDB
-};
-
-QT_END_NAMESPACE
-
-#endif // QDEVICEPROFILE_LINUX_P_H
diff --git a/src/systeminfo/qdisplayinfo.cpp b/src/systeminfo/qdisplayinfo.cpp
index 9421ee97..295fde35 100644
--- a/src/systeminfo/qdisplayinfo.cpp
+++ b/src/systeminfo/qdisplayinfo.cpp
@@ -210,35 +210,4 @@ int QDisplayInfo::physicalWidth(int screen) const
return -1;
}
-extern QMetaMethod proxyToSourceSignal(const QMetaMethod &, QObject *);
-
-/*!
- \internal
-*/
-void QDisplayInfo::connectNotify(const QMetaMethod &signal)
-{
-#if (defined(Q_OS_LINUX) || defined(QT_SIMULATOR)) && !defined(QT_NO_JSONDB)
- QMetaMethod sourceSignal = proxyToSourceSignal(signal, d_ptr);
- connect(d_ptr, sourceSignal, this, signal, Qt::UniqueConnection);
-#else
- Q_UNUSED(signal)
-#endif
-}
-
-/*!
- \internal
-*/
-void QDisplayInfo::disconnectNotify(const QMetaMethod &signal)
-{
-#if (defined(Q_OS_LINUX) || defined(QT_SIMULATOR)) && !defined(QT_NO_JSONDB)
- // We can only disconnect with the private implementation, when there is no receivers for the signal.
- if (isSignalConnected(signal))
- return;
-
- QMetaMethod sourceSignal = proxyToSourceSignal(signal, d_ptr);
- disconnect(d_ptr, sourceSignal, this, signal);
-#else
- Q_UNUSED(signal)
-#endif
-}
QT_END_NAMESPACE
diff --git a/src/systeminfo/qdisplayinfo.h b/src/systeminfo/qdisplayinfo.h
index 169e3924..4ffcaef7 100644
--- a/src/systeminfo/qdisplayinfo.h
+++ b/src/systeminfo/qdisplayinfo.h
@@ -80,10 +80,6 @@ public:
Q_SIGNALS:
void backlightStateChanged(int screen, QDisplayInfo::BacklightState state);
-protected:
- void connectNotify(const QMetaMethod &signal);
- void disconnectNotify(const QMetaMethod &signal);
-
private:
Q_DISABLE_COPY(QDisplayInfo)
QDisplayInfoPrivate * const d_ptr;
diff --git a/src/systeminfo/qdisplayinfo_linux.cpp b/src/systeminfo/qdisplayinfo_linux.cpp
index 092cfef2..0f19784f 100644
--- a/src/systeminfo/qdisplayinfo_linux.cpp
+++ b/src/systeminfo/qdisplayinfo_linux.cpp
@@ -41,10 +41,6 @@
#include "qdisplayinfo_linux_p.h"
-#if !defined(QT_NO_JSONDB)
-#include "qjsondbwrapper_p.h"
-#endif // QT_NO_JSONDB
-
#include <QtCore/qdir.h>
#include <QtCore/qmap.h>
#include <QtCore/qmetaobject.h>
@@ -56,10 +52,6 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, GRAPHICS_SYSFS_PATH, (QStringLiteral("/
QDisplayInfoPrivate::QDisplayInfoPrivate(QDisplayInfo *parent)
: q_ptr(parent)
-#if !defined(QT_NO_JSONDB)
- , backlightStateWatcher(false)
- , jsondbWrapper(0)
-#endif // QT_NO_JSONDB
{
}
@@ -106,23 +98,6 @@ int QDisplayInfoPrivate::contrast(int screen)
QDisplayInfo::BacklightState QDisplayInfoPrivate::backlightState(int screen)
{
-#if !defined(QT_NO_JSONDB)
- if (backlightStates.size() == 0)
- initScreenMap();
- if (backlightStates[screen] == QDisplayInfo::BacklightUnknown) {
- int actualBrightness = brightness(screen);
-
- if (actualBrightness > 0)
- backlightStates[screen] = QDisplayInfo::BacklightOn;
- else if (actualBrightness == 0)
- backlightStates[screen] = QDisplayInfo::BacklightOff;
- if (!jsondbWrapper) {
- jsondbWrapper = new QJsonDbWrapper(this);
- connect(jsondbWrapper, SIGNAL(backlightStateChanged(int, QDisplayInfo::BacklightState)), this, SLOT(onBacklightStateChanged(int, QDisplayInfo::BacklightState)) , Qt::UniqueConnection);
- }
- }
- return backlightStates[screen];
-#else
int actualBrightness = brightness(screen);
if (actualBrightness > 0)
@@ -131,44 +106,6 @@ QDisplayInfo::BacklightState QDisplayInfoPrivate::backlightState(int screen)
return QDisplayInfo::BacklightOff;
else
return QDisplayInfo::BacklightUnknown;
-#endif // QT_NO_JSONDB
-}
-
-
-#if !defined(QT_NO_JSONDB)
-void QDisplayInfoPrivate::initScreenMap()
-{
- const QStringList dirs = QDir(*GRAPHICS_SYSFS_PATH()).entryList(QDir::Dirs | QDir::NoDotAndDotDot);
- for (int i = 0; i < dirs.size(); i++)
- backlightStates.insert(i, QDisplayInfo::BacklightUnknown);
-}
-
-void QDisplayInfoPrivate::onBacklightStateChanged(int screen, QDisplayInfo::BacklightState state)
-{
- if (backlightStates[screen] != state) {
- backlightStates[screen] = state;
- if (backlightStateWatcher)
- emit backlightStateChanged(screen, state);
- }
-}
-
-void QDisplayInfoPrivate::connectNotify(const QMetaMethod &signal)
-{
- static const QMetaMethod backlightStateChangedSignal = QMetaMethod::fromSignal(&QDisplayInfoPrivate::backlightStateChanged);
- if (!backlightStateWatcher && signal == backlightStateChangedSignal) {
- backlightStateWatcher = true;
- if (backlightStates.size() == 0)
- backlightState(0);
- }
-}
-
-void QDisplayInfoPrivate::disconnectNotify(const QMetaMethod &signal)
-{
- static const QMetaMethod backlightStateChangedSignal = QMetaMethod::fromSignal(&QDisplayInfoPrivate::backlightStateChanged);
- if (signal == backlightStateChangedSignal && jsondbWrapper) {
- backlightStateWatcher = false;
- }
}
-#endif // QT_NO_JSONDB
QT_END_NAMESPACE
diff --git a/src/systeminfo/qdisplayinfo_linux_p.h b/src/systeminfo/qdisplayinfo_linux_p.h
index e89e3fdf..dfc2eb6c 100644
--- a/src/systeminfo/qdisplayinfo_linux_p.h
+++ b/src/systeminfo/qdisplayinfo_linux_p.h
@@ -55,16 +55,8 @@
#include <qdisplayinfo.h>
-#if !defined(QT_NO_JSONDB)
-#include <QMap>
-#endif //QT_NO_JSONDB
-
QT_BEGIN_NAMESPACE
-#if !defined(QT_NO_JSONDB)
-class QJsonDbWrapper;
-#endif //QT_NO_JSONDB
-
class QDisplayInfoPrivate : public QObject
{
Q_OBJECT
@@ -76,30 +68,9 @@ public:
int contrast(int screen);
QDisplayInfo::BacklightState backlightState(int screen);
-#if !defined(QT_NO_JSONDB)
-Q_SIGNALS:
- void backlightStateChanged(int screen, QDisplayInfo::BacklightState state);
-
-private Q_SLOTS:
- void onBacklightStateChanged(int screen, QDisplayInfo::BacklightState state);
-
-protected:
- void connectNotify(const QMetaMethod &signal);
- void disconnectNotify(const QMetaMethod &signal);
-#endif
-
private:
QDisplayInfo * const q_ptr;
Q_DECLARE_PUBLIC(QDisplayInfo)
-
-
-#if !defined(QT_NO_JSONDB)
- QMap<int, QDisplayInfo::BacklightState> backlightStates;
- bool backlightStateWatcher;
- QJsonDbWrapper *jsondbWrapper;
-
- void initScreenMap();
-#endif //QT_NO_JSONDB
};
QT_END_NAMESPACE
diff --git a/src/systeminfo/qjsondbwrapper.cpp b/src/systeminfo/qjsondbwrapper.cpp
deleted file mode 100644
index 4147d886..00000000
--- a/src/systeminfo/qjsondbwrapper.cpp
+++ /dev/null
@@ -1,600 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtSystems module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qjsondbwrapper_p.h"
-
-#include <QtCore/qeventloop.h>
-#include <QtCore/qmetaobject.h>
-#include <QtCore/qtimer.h>
-#include <QtJsonDb/qjsondbreadrequest.h>
-#include <QtJsonDb/qjsondbwatcher.h>
-
-QT_USE_NAMESPACE_JSONDB
-
-QT_BEGIN_NAMESPACE
-
-const int JSON_EXPIRATION_TIMER(2000);
-
-QJsonDbWrapper::QJsonDbWrapper(QObject *parent)
- : QObject(parent)
- , locksWatcher(0)
- , soundSettingsWatcher(0)
- , backlightWatcher(0)
- , waitLoop(0)
- , timer(0)
- , watchActivatedLocks(false)
- , watchEnabledLocks(false)
- , watchProfile(false)
- , watchBacklightState(false)
- , activatedLocks(QDeviceInfo::UnknownLock)
- , enabledLocks(QDeviceInfo::UnknownLock)
- , isLockTypeRequested(false)
- , isSoundSettingsRequested(false)
- , vibrationActivated(false)
- , ringerVolume(-1)
- , profileType(QDeviceProfile::UnknownProfile)
-{
- connect(&jsonDbConnection, SIGNAL(error(QtJsonDb::QJsonDbConnection::ErrorCode,QString)),
- this, SLOT(onJsonDbConnectionError(QtJsonDb::QJsonDbConnection::ErrorCode,QString)));
-
- jsonDbConnection.connectToServer();
-}
-
-QJsonDbWrapper::~QJsonDbWrapper()
-{
-}
-
-QDeviceInfo::LockTypeFlags QJsonDbWrapper::activatedLockTypes()
-{
- if (!isLockTypeRequested && activatedLocks == QDeviceInfo::UnknownLock) {
- isLockTypeRequested = true;
- sendJsonDbLockObjectsReadRequest();
- }
-
- return activatedLocks;
-}
-
-QDeviceInfo::LockTypeFlags QJsonDbWrapper::enabledLockTypes()
-{
- if (!isLockTypeRequested && enabledLocks == QDeviceInfo::UnknownLock) {
- isLockTypeRequested = true;
- sendJsonDbLockObjectsReadRequest();
- }
-
- return enabledLocks;
-}
-
-bool QJsonDbWrapper::hasFeaturePositioning()
-{
- return getSystemSettingValue(QString(QStringLiteral("location")),
- QString(QStringLiteral("locationServicesFeatureEnabled"))).toBool();
-}
-
-QString QJsonDbWrapper::model()
-{
- return getSystemSettingValue(QString(QStringLiteral("sw_variant_configuration")),
- QString(QStringLiteral("productName"))).toString();
-}
-
-bool QJsonDbWrapper::isVibrationActivated()
-{
- if (!isSoundSettingsRequested && ringerVolume < 0) {
- isSoundSettingsRequested = true;
- sendJsonDbSoundSettingsReadRequest();
- }
-
- return vibrationActivated;
-}
-
-int QJsonDbWrapper::ringtoneVolume()
-{
- if (!isSoundSettingsRequested && ringerVolume < 0) {
- isSoundSettingsRequested = true;
- sendJsonDbSoundSettingsReadRequest();
- }
-
- return ringerVolume;
-}
-
-QDeviceProfile::ProfileType QJsonDbWrapper::currentProfileType()
-{
- if (!isSoundSettingsRequested && ringerVolume < 0) {
- isSoundSettingsRequested = true;
- sendJsonDbSoundSettingsReadRequest();
- }
-
- return profileType;
-}
-
-void QJsonDbWrapper::sendJsonDbLockObjectsReadRequest()
-{
- QJsonDbReadRequest *request = new QtJsonDb::QJsonDbReadRequest();
- request->setQuery(QString(QStringLiteral("[?_type in [\"com.nokia.mt.system.SecurityLock\",\"com.nokia.mt.system.Lockscreen\"]]")));
- request->setPartition(QString(QStringLiteral("Ephemeral")));
- connect(request, SIGNAL(error(QtJsonDb::QJsonDbRequest::ErrorCode,QString)),
- this, SLOT(onJsonDbReadRequestError(QtJsonDb::QJsonDbRequest::ErrorCode,QString)));
- connect(request, SIGNAL(finished()), this, SLOT(onJsonDbLockObjectsReadRequestFinished()));
- jsonDbConnection.send(request);
-}
-
-void QJsonDbWrapper::sendJsonDbSoundSettingsReadRequest()
-{
- QJsonDbReadRequest *request = new QJsonDbReadRequest();
- request->setQuery(QString(QStringLiteral("[?_type=\"com.nokia.mt.settings.SystemSettings\"][?identifier=\"com.nokia.mt.settings.sounds\"][={settings:settings}]")));
- request->setPartition(QString(QStringLiteral("com.nokia.mt.Settings")));
- connect(request, SIGNAL(error(QtJsonDb::QJsonDbRequest::ErrorCode,QString)),
- this, SLOT(onJsonDbReadRequestError(QtJsonDb::QJsonDbRequest::ErrorCode,QString)));
- connect(request, SIGNAL(finished()), this, SLOT(onJsonDbSoundSettingsReadRequestFinished()));
- jsonDbConnection.send(request);
-}
-
-QJsonValue QJsonDbWrapper::getSystemSettingValue(const QString &settingId, const QString &setting, const QString &partition)
-{
- QJsonDbReadRequest request;
- if (!partition.isEmpty())
- request.setPartition(partition);
- request.setQuery(QString(QStringLiteral("[?_type=\"com.nokia.mt.settings.SystemSettings\"][?identifier=\"com.nokia.mt.settings.%1\"][={settings:settings}]"))
- .arg(settingId));
- request.setPartition(QString(QStringLiteral("com.nokia.mt.Settings")));
- connect(&request, SIGNAL(error(QtJsonDb::QJsonDbRequest::ErrorCode,QString)),
- this, SLOT(onJsonDbSynchronousRequestError(QtJsonDb::QJsonDbRequest::ErrorCode,QString)));
- connect(&request, SIGNAL(finished()), this, SLOT(onJsonDbSynchronousRequestFinished()));
- if (jsonDbConnection.send(&request)) {
- waitForResponse();
- if (request.status() == QJsonDbRequest::Finished) {
- QList<QJsonObject> results = request.takeResults();
- if (results.size() > 0)
- return results.at(0).value(QStringLiteral("settings")).toObject().value(setting);
- }
- }
- return QJsonValue();
-}
-
-void QJsonDbWrapper::connectNotify(const QMetaMethod &signal)
-{
- static const QMetaMethod activatedLocksChangedSignal = QMetaMethod::fromSignal(&QJsonDbWrapper::activatedLocksChanged);
- static const QMetaMethod enabledLocksChangedSignal = QMetaMethod::fromSignal(&QJsonDbWrapper::enabledLocksChanged);
- static const QMetaMethod vibrationActivatedChangedSignal = QMetaMethod::fromSignal(&QJsonDbWrapper::vibrationActivatedChanged);
- static const QMetaMethod ringtoneVolumeChangedSignal = QMetaMethod::fromSignal(&QJsonDbWrapper::ringtoneVolumeChanged);
- static const QMetaMethod currentProfileTypeChangedSignal = QMetaMethod::fromSignal(&QJsonDbWrapper::currentProfileTypeChanged);
- static const QMetaMethod backlightStateChangedSignal = QMetaMethod::fromSignal(&QJsonDbWrapper::backlightStateChanged);
-
- if (watchActivatedLocks && watchEnabledLocks && watchProfile && watchBacklightState)
- return;
-
- bool needWatchActivatedLocks = (signal == activatedLocksChangedSignal);
- if (needWatchActivatedLocks) {
- if (watchActivatedLocks)
- return;
- activatedLocks = activatedLockTypes();
- }
-
- bool needWatchEnabledLocks = (signal == enabledLocksChangedSignal);
- if (needWatchEnabledLocks) {
- if (watchEnabledLocks)
- return;
- enabledLocks = enabledLockTypes();
- }
-
- if (needWatchActivatedLocks)
- watchActivatedLocks = true;
-
- if (needWatchEnabledLocks)
- watchEnabledLocks = true;
-
- bool needWatchProfiles = (signal == vibrationActivatedChangedSignal
- || signal == ringtoneVolumeChangedSignal
- || signal == currentProfileTypeChangedSignal);
- if (needWatchProfiles) {
- if (watchProfile)
- return;
- currentProfileType();
- watchProfile = true;
- }
-
- if (signal == backlightStateChangedSignal) {
- if (!backlightWatcher) {
- backlightWatcher = new QtJsonDb::QJsonDbWatcher(this);
- backlightWatcher->setPartition(QString(QStringLiteral("Ephemeral")));
- backlightWatcher->setWatchedActions(QJsonDbWatcher::Updated);
- backlightWatcher->setQuery(QString(QStringLiteral("[?_type=\"com.nokia.mt.system.DisplayState\"]")));
- connect(backlightWatcher, SIGNAL(notificationsAvailable(int)), this, SLOT(onJsonDbWatcherBacklightStateNotificationsAvailable()));
- }
- jsonDbConnection.addWatcher(backlightWatcher);
- watchBacklightState = true;
- }
-}
-
-void QJsonDbWrapper::disconnectNotify(const QMetaMethod &signal)
-{
- if (!watchActivatedLocks && !watchEnabledLocks && !watchBacklightState)
- return;
-
- static const QMetaMethod activatedLocksChangedSignal = QMetaMethod::fromSignal(&QJsonDbWrapper::activatedLocksChanged);
- static const QMetaMethod enabledLocksChangedSignal = QMetaMethod::fromSignal(&QJsonDbWrapper::enabledLocksChanged);
- static const QMetaMethod backlightStateChangedSignal = QMetaMethod::fromSignal(&QJsonDbWrapper::backlightStateChanged);
- if (signal == activatedLocksChangedSignal)
- watchActivatedLocks = false;
- else if (signal == enabledLocksChangedSignal)
- watchEnabledLocks = false;
- else if (signal == backlightStateChangedSignal)
- watchBacklightState = false;
-
- if (!watchBacklightState)
- jsonDbConnection.removeWatcher(backlightWatcher);
-}
-
-void QJsonDbWrapper::onJsonDbLockObjectsReadRequestFinished()
-{
- QtJsonDb::QJsonDbRequest *request = qobject_cast<QtJsonDb::QJsonDbRequest *>(sender());
- if (!request)
- return;
- QList<QJsonObject> results = request->takeResults();
- if (request)
- request->deleteLater();
-
- if (activatedLocks.testFlag(QDeviceInfo::UnknownLock))
- activatedLocks &= ~QDeviceInfo::UnknownLock;
- if (enabledLocks.testFlag(QDeviceInfo::UnknownLock))
- enabledLocks &= ~QDeviceInfo::UnknownLock;
-
- if (results.size() > 0) {
- for (int i = 0; i < results.size(); i++) {
- const QByteArray objectType = results.at(i).value(QStringLiteral("_type")).toString().toLatin1();
- if (objectType.size() == strlen("com.nokia.mt.system.Lockscreen") &&
- strcmp(objectType.constData(), "com.nokia.mt.system.Lockscreen") == 0) {
- if (!enabledLocks.testFlag(QDeviceInfo::TouchOrKeyboardLock))
- enabledLocks |= QDeviceInfo::TouchOrKeyboardLock;
- if (results.at(i).value(QString(QStringLiteral("isLocked"))).toBool()) {
- if (!activatedLocks.testFlag(QDeviceInfo::TouchOrKeyboardLock)) {
- activatedLocks |= QDeviceInfo::TouchOrKeyboardLock;
- emit activatedLocksChanged(activatedLocks);
- }
- } else {
- if (activatedLocks.testFlag(QDeviceInfo::TouchOrKeyboardLock)) {
- activatedLocks &= ~QDeviceInfo::TouchOrKeyboardLock;
- emit activatedLocksChanged(activatedLocks);
- }
- }
- } else if (objectType.size() == strlen("com.nokia.mt.system.SecurityLock") &&
- strcmp(objectType.constData(), "com.nokia.mt.system.SecurityLock") == 0) {
- if (!enabledLocks.testFlag(QDeviceInfo::PinLock))
- enabledLocks |= QDeviceInfo::PinLock;
- if (results.at(i).value(QString(QStringLiteral("active"))).toBool()) {
- if (!activatedLocks.testFlag(QDeviceInfo::PinLock)) {
- activatedLocks |= QDeviceInfo::PinLock;
- emit activatedLocksChanged(activatedLocks);
- }
- } else {
- if (activatedLocks.testFlag(QDeviceInfo::PinLock)) {
- activatedLocks &= ~QDeviceInfo::PinLock;
- emit activatedLocksChanged(activatedLocks);
- }
- }
- }
- }
- } else {
- if (activatedLocks.testFlag(QDeviceInfo::TouchOrKeyboardLock)) {
- activatedLocks &= ~QDeviceInfo::TouchOrKeyboardLock;
- emit activatedLocksChanged(activatedLocks);
- }
- if (activatedLocks.testFlag(QDeviceInfo::PinLock)) {
- activatedLocks &= ~QDeviceInfo::PinLock;
- emit activatedLocksChanged(activatedLocks);
- }
-
- if (enabledLocks.testFlag(QDeviceInfo::TouchOrKeyboardLock)) {
- enabledLocks &= ~QDeviceInfo::TouchOrKeyboardLock;
- emit enabledLocksChanged(enabledLocks);
- }
- if (enabledLocks.testFlag(QDeviceInfo::PinLock)) {
- enabledLocks &= ~QDeviceInfo::PinLock;
- emit enabledLocksChanged(enabledLocks);
- }
- }
-
- if (!locksWatcher) {
- locksWatcher = new QJsonDbWatcher(this);
- locksWatcher->setPartition(QStringLiteral("Ephemeral"));
- locksWatcher->setWatchedActions(QJsonDbWatcher::All);
- locksWatcher->setQuery(QString(QStringLiteral("[?_type in [\"com.nokia.mt.system.SecurityLock\",\"com.nokia.mt.system.Lockscreen\"]]")));
- connect(locksWatcher, SIGNAL(notificationsAvailable(int)), this, SLOT(onJsonDbWatcherLocksNotificationsAvailable()));
- jsonDbConnection.addWatcher(locksWatcher);
- }
-}
-
-void QJsonDbWrapper::onJsonDbSoundSettingsReadRequestFinished()
-{
- QtJsonDb::QJsonDbRequest *request = qobject_cast<QtJsonDb::QJsonDbRequest *>(sender());
- if (!request)
- return;
-
- if (request && request->status() == QJsonDbRequest::Finished) {
- QList<QJsonObject> results = request->takeResults();
- request->deleteLater();
- if (results.size() > 0) {
- QJsonObject soundSettings = results.at(0).value(QString(QStringLiteral("settings"))).toObject();
- bool vibration = false;
- if (!soundSettings.value(QString(QStringLiteral("vibrationOn"))).isUndefined())
- vibration = soundSettings.value(QString(QStringLiteral("vibrationOn"))).toBool();
- int volume = -1;
- if (!soundSettings.value(QString(QStringLiteral("ringerVolume"))).isUndefined())
- volume = int(soundSettings.value(QString(QStringLiteral("ringerVolume"))).toDouble());
-
- if (volume > -1) {
- QDeviceProfile::ProfileType profile = QDeviceProfile::UnknownProfile;
- if (volume > 0) {
- profile = QDeviceProfile::NormalProfile;
- } else {
- if (vibration)
- profile = QDeviceProfile::VibrationProfile;
- else
- profile = QDeviceProfile::SilentProfile;
- }
- if (ringerVolume != volume) {
- ringerVolume = volume;
- if (watchProfile)
- emit ringtoneVolumeChanged(ringerVolume);
- }
- if (vibrationActivated != vibration) {
- vibrationActivated = vibration;
- if (watchProfile)
- emit vibrationActivatedChanged(vibrationActivated);
- }
- if (profileType != profile) {
- profileType = profile;
- if (watchProfile)
- emit currentProfileTypeChanged(profileType);
- }
- }
- }
- }
-
- if (!soundSettingsWatcher) {
- soundSettingsWatcher = new QJsonDbWatcher(this);
- soundSettingsWatcher->setWatchedActions(QJsonDbWatcher::Updated);
- soundSettingsWatcher->setQuery(QString(QStringLiteral("[?_type=\"com.nokia.mt.settings.SystemSettings\"][?identifier=\"com.nokia.mt.settings.sounds\"][={settings:settings}]")));
- soundSettingsWatcher->setPartition(QString(QStringLiteral("com.nokia.mt.Settings")));
- connect(soundSettingsWatcher, SIGNAL(notificationsAvailable(int)),
- this, SLOT(onJsonDbWatcherSoundSettingsNotificationsAvailable()));
- jsonDbConnection.addWatcher(soundSettingsWatcher);
- }
-}
-
-void QJsonDbWrapper::onJsonDbWatcherLocksNotificationsAvailable()
-{
- QList<QJsonDbNotification> notifications = locksWatcher->takeNotifications();
- if (notifications.size() > 0) {
- const QJsonDbNotification notification = notifications.at(0);
- const QByteArray objectType = notification.object().value(QStringLiteral("_type")).toString().toLatin1();
- if (notification.action() == QJsonDbWatcher::Removed) {
- if (objectType.size() == strlen("com.nokia.mt.system.Lockscreen")
- && strcmp(objectType.constData(), "com.nokia.mt.system.Lockscreen") == 0) {
- if (activatedLocks.testFlag(QDeviceInfo::TouchOrKeyboardLock)) {
- activatedLocks &= ~QDeviceInfo::TouchOrKeyboardLock;
- if (watchActivatedLocks)
- emit activatedLocksChanged(activatedLocks);
- }
- if (enabledLocks.testFlag(QDeviceInfo::TouchOrKeyboardLock)) {
- enabledLocks &= ~QDeviceInfo::TouchOrKeyboardLock;
- if (watchEnabledLocks)
- emit enabledLocksChanged(enabledLocks);
- }
- } else if (objectType.size() == strlen("com.nokia.mt.system.SecurityLock")
- && strcmp(objectType.constData(), "com.nokia.mt.system.SecurityLock") == 0) {
- if (activatedLocks.testFlag(QDeviceInfo::PinLock)) {
- activatedLocks &= ~QDeviceInfo::PinLock;
- if (watchActivatedLocks)
- emit activatedLocksChanged(activatedLocks);
- }
- if (enabledLocks.testFlag(QDeviceInfo::PinLock)) {
- enabledLocks &= ~QDeviceInfo::PinLock;
- if (watchEnabledLocks)
- emit enabledLocksChanged(enabledLocks);
- }
- }
- } else {
- if (objectType.size() == strlen("com.nokia.mt.system.Lockscreen")
- && strcmp(objectType.constData(), "com.nokia.mt.system.Lockscreen") == 0) {
- if (notification.object().value(QString(QStringLiteral("isLocked"))).toBool()) {
- if (!activatedLocks.testFlag(QDeviceInfo::TouchOrKeyboardLock)) {
- activatedLocks |= QDeviceInfo::TouchOrKeyboardLock;
- if (watchActivatedLocks)
- emit activatedLocksChanged(activatedLocks);
- }
- } else {
- if (activatedLocks.testFlag(QDeviceInfo::TouchOrKeyboardLock)) {
- activatedLocks &= ~QDeviceInfo::TouchOrKeyboardLock;
- if (watchActivatedLocks)
- emit activatedLocksChanged(activatedLocks);
- }
- }
- if (notification.action() == QJsonDbWatcher::Created) {
- if (!enabledLocks.testFlag(QDeviceInfo::TouchOrKeyboardLock)) {
- enabledLocks |= QDeviceInfo::TouchOrKeyboardLock;
- if (watchEnabledLocks)
- emit enabledLocksChanged(enabledLocks);
- }
- }
- } else if (objectType.size() == strlen("com.nokia.mt.system.SecurityLock")
- && strcmp(objectType.constData(), "com.nokia.mt.system.SecurityLock") == 0) {
- if (notification.object().value(QString(QStringLiteral("active"))).toBool()) {
- if (!activatedLocks.testFlag(QDeviceInfo::PinLock)) {
- activatedLocks |= QDeviceInfo::PinLock;
- if (watchActivatedLocks)
- emit activatedLocksChanged(activatedLocks);
- }
- } else {
- if (activatedLocks.testFlag(QDeviceInfo::PinLock)) {
- activatedLocks &= ~QDeviceInfo::PinLock;
- if (watchActivatedLocks)
- emit activatedLocksChanged(activatedLocks);
- }
- }
- if (notification.action() == QJsonDbWatcher::Created) {
- if (!enabledLocks.testFlag(QDeviceInfo::PinLock)) {
- enabledLocks |= QDeviceInfo::PinLock;
- if (watchEnabledLocks)
- emit enabledLocksChanged(enabledLocks);
- }
- }
- }
- }
- }
-}
-
-void QJsonDbWrapper::onJsonDbWatcherSoundSettingsNotificationsAvailable()
-{
- QList<QJsonDbNotification> notifications = soundSettingsWatcher->takeNotifications();
- if (notifications.size() > 0) {
- const QJsonDbNotification notification = notifications.at(0);
- const QByteArray objectType = notification.object().value(QStringLiteral("_type")).toString().toLatin1();
- if (objectType.size() == strlen("com.nokia.mt.settings.SystemSettings")
- && strcmp(objectType.constData(), "com.nokia.mt.settings.SystemSettings") == 0) {
- const QByteArray identifier = notification.object().value(QStringLiteral("identifier")).toString().toLatin1();
- if (identifier.size() == strlen("com.nokia.mt.settings.sounds")
- && strcmp(identifier.constData(), "com.nokia.mt.settings.sounds") == 0) {
- bool vibration = notification.object().value(QString(QStringLiteral("settings"))).toObject().value(QString(QStringLiteral("vibrationOn"))).toBool();
- int volume = int(notification.object().value(QString(QStringLiteral("settings"))).toObject().value(QString(QStringLiteral("ringerVolume"))).toDouble());
- if (volume != ringerVolume || vibration != vibrationActivated) {
- QDeviceProfile::ProfileType profile = QDeviceProfile::UnknownProfile;
- if (volume > 0) {
- profile = QDeviceProfile::NormalProfile;
- } else {
- if (vibration)
- profile = QDeviceProfile::VibrationProfile;
- else
- profile = QDeviceProfile::SilentProfile;
- }
- if (ringerVolume != volume) {
- ringerVolume = volume;
- if (watchProfile)
- emit ringtoneVolumeChanged(ringerVolume);
- }
- if (vibrationActivated != vibration) {
- vibrationActivated = vibration;
- if (watchProfile)
- emit vibrationActivatedChanged(vibrationActivated);
- }
- if (profileType != profile) {
- profileType = profile;
- if (watchProfile)
- emit currentProfileTypeChanged(profileType);
- }
- }
- }
- }
- }
-}
-
-void QJsonDbWrapper::onJsonDbWatcherBacklightStateNotificationsAvailable()
-{
- QList<QJsonDbNotification> notifications = backlightWatcher->takeNotifications();
- if (notifications.size() > 0) {
- const QJsonDbNotification notification = notifications.at(0);
- const int screen = notification.object().value(QStringLiteral("displayIndex")).toString().toInt();
- QDisplayInfo::BacklightState state;
- if (notification.object().value(QStringLiteral("active")).toBool())
- state = QDisplayInfo::BacklightOn;
- else
- state = QDisplayInfo::BacklightOff;
- emit backlightStateChanged(screen, state);
- }
-}
-
-void QJsonDbWrapper::onJsonDbConnectionError(QtJsonDb::QJsonDbConnection::ErrorCode error, const QString &message)
-{
- Q_UNUSED(error)
- Q_UNUSED(message)
-
- if (timer)
- timer->stop();
- if (waitLoop)
- waitLoop->exit(0);
-}
-
-void QJsonDbWrapper::onJsonDbReadRequestError(QtJsonDb::QJsonDbRequest::ErrorCode error, const QString &message)
-{
- Q_UNUSED(error)
- Q_UNUSED(message)
-
- QtJsonDb::QJsonDbRequest *request = qobject_cast<QtJsonDb::QJsonDbRequest *>(sender());
- if (request)
- request->deleteLater();
-
- if (isLockTypeRequested && activatedLocks == QDeviceInfo::UnknownLock)
- isLockTypeRequested = false;
-
- if (isSoundSettingsRequested && ringerVolume == -1)
- isSoundSettingsRequested = false;
-}
-
-void QJsonDbWrapper::onJsonDbSynchronousRequestError(QtJsonDb::QJsonDbRequest::ErrorCode error, const QString &message)
-{
- Q_UNUSED(error)
- Q_UNUSED(message)
-
- timer->stop();
- waitLoop->exit(0);
-}
-
-void QJsonDbWrapper::onJsonDbSynchronousRequestFinished()
-{
- timer->stop();
- waitLoop->exit(0);
-}
-
-bool QJsonDbWrapper::waitForResponse()
-{
- if (!waitLoop)
- waitLoop = new QEventLoop(this);
- if (!timer) {
- timer = new QTimer(this);
- timer->setSingleShot(true);
- connect(timer, SIGNAL(timeout()), waitLoop, SLOT(quit()));
- }
- timer->start(JSON_EXPIRATION_TIMER);
- waitLoop->exec(QEventLoop::AllEvents);
-
- return true;
-}
-
-QT_END_NAMESPACE
diff --git a/src/systeminfo/qjsondbwrapper_p.h b/src/systeminfo/qjsondbwrapper_p.h
deleted file mode 100644
index 8e26c536..00000000
--- a/src/systeminfo/qjsondbwrapper_p.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtSystems module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#ifndef QJSONDBWRAPPER_P_H
-#define QJSONDBWRAPPER_P_H
-
-#include <qdeviceinfo.h>
-#include <qdeviceprofile.h>
-#include <qdisplayinfo.h>
-#include <QtJsonDb/qjsondbconnection.h>
-#include <QtJsonDb/qjsondbrequest.h>
-
-QT_BEGIN_NAMESPACE
-
-class QTimer;
-class QEventLoop;
-
-class QJsonDbWrapper : public QObject
-{
- Q_OBJECT
-public:
- QJsonDbWrapper(QObject *parent = 0);
- virtual ~QJsonDbWrapper();
-
- // DeviceInfo Interface
- QDeviceInfo::LockTypeFlags activatedLockTypes();
- QDeviceInfo::LockTypeFlags enabledLockTypes();
- bool hasFeaturePositioning();
- QString model();
-
- // DeviceProfile Interface
- bool isVibrationActivated();
- int ringtoneVolume();
- QDeviceProfile::ProfileType currentProfileType();
-
-Q_SIGNALS:
- void activatedLocksChanged(QDeviceInfo::LockTypeFlags types);
- void enabledLocksChanged(QDeviceInfo::LockTypeFlags types);
- void vibrationActivatedChanged(bool activated);
- void ringtoneVolumeChanged(int volume);
- void currentProfileTypeChanged(QDeviceProfile::ProfileType profile);
- void backlightStateChanged(int screen, QDisplayInfo::BacklightState state);
-
-protected:
- void connectNotify(const QMetaMethod &signal);
- void disconnectNotify(const QMetaMethod &signal);
-
-private Q_SLOTS:
- void onJsonDbConnectionError(QtJsonDb::QJsonDbConnection::ErrorCode error, const QString &message);
- void onJsonDbReadRequestError(QtJsonDb::QJsonDbRequest::ErrorCode error, const QString &message);
- void onJsonDbLockObjectsReadRequestFinished();
- void onJsonDbSoundSettingsReadRequestFinished();
- void onJsonDbWatcherLocksNotificationsAvailable();
- void onJsonDbWatcherSoundSettingsNotificationsAvailable();
- void onJsonDbWatcherBacklightStateNotificationsAvailable();
-
- void onJsonDbSynchronousRequestError(QtJsonDb::QJsonDbRequest::ErrorCode error, const QString &message);
- void onJsonDbSynchronousRequestFinished();
-
-private:
- void sendJsonDbLockObjectsReadRequest();
- void sendJsonDbSoundSettingsReadRequest();
-
- QJsonValue getSystemSettingValue(const QString &settingId, const QString &setting, const QString &partition = QString());
- bool waitForResponse();
-
- QtJsonDb::QJsonDbConnection jsonDbConnection;
- QtJsonDb::QJsonDbWatcher *locksWatcher;
- QtJsonDb::QJsonDbWatcher *soundSettingsWatcher;
- QtJsonDb::QJsonDbWatcher *backlightWatcher;
-
- QEventLoop *waitLoop;
- QTimer *timer;
-
- bool watchActivatedLocks;
- bool watchEnabledLocks;
- bool watchProfile;
- bool watchBacklightState;
- QDeviceInfo::LockTypeFlags activatedLocks;
- QDeviceInfo::LockTypeFlags enabledLocks;
- bool isLockTypeRequested;
- bool isSoundSettingsRequested;
- bool vibrationActivated;
- int ringerVolume;
- QDeviceProfile::ProfileType profileType;
-};
-
-QT_END_NAMESPACE
-
-#endif // QJSONDBWRAPPER_P_H
diff --git a/src/systeminfo/qsysteminfo_simulator.cpp b/src/systeminfo/qsysteminfo_simulator.cpp
index 96746a26..62729097 100644
--- a/src/systeminfo/qsysteminfo_simulator.cpp
+++ b/src/systeminfo/qsysteminfo_simulator.cpp
@@ -43,10 +43,6 @@
#include "qsysteminfobackend_simulator_p.h"
#include "qsysteminfoconnection_simulator_p.h"
-#if defined(Q_OS_LINUX) && !defined(QT_NO_JSONDB)
-# include "qdeviceinfo_linux_p.h"
-#endif
-
#if !defined(QT_NO_SFW_NETREG) || !defined(QT_NO_OFONO)
# include "qnetworkinfo_linux_p.h"
#endif
@@ -206,18 +202,12 @@ QDeviceInfoSimulator::QDeviceInfoSimulator(QDeviceInfo *parent)
: QObject(parent)
, q_ptr(parent)
, deviceInfoSimulatorBackend(QDeviceInfoSimulatorBackend::getSimulatorBackend())
-#if defined(Q_OS_LINUX) && !defined(QT_NO_JSONDB)
- , d_ptr(new QDeviceInfoPrivate())
-#endif
{
SystemInfoConnection::ensureSimulatorConnection();
}
QDeviceInfoSimulator::~QDeviceInfoSimulator()
{
-#if defined(Q_OS_LINUX) && !defined(QT_NO_JSONDB)
- delete d_ptr;
-#endif
}
bool QDeviceInfoSimulator::hasFeature(QDeviceInfo::Feature feature)
@@ -230,28 +220,16 @@ bool QDeviceInfoSimulator::hasFeature(QDeviceInfo::Feature feature)
QDeviceInfo::LockTypeFlags QDeviceInfoSimulator::activatedLocks()
{
-#if defined(Q_OS_LINUX) && !defined(QT_NO_JSONDB)
- if (d_ptr)
- return d_ptr->activatedLocks();
-#else
-
if (deviceInfoSimulatorBackend)
return deviceInfoSimulatorBackend->getActivatedLocks();
-#endif
return QDeviceInfo::NoLock;
}
QDeviceInfo::LockTypeFlags QDeviceInfoSimulator::enabledLocks()
{
-#if defined(Q_OS_LINUX) && !defined(QT_NO_JSONDB)
- if (d_ptr)
- return d_ptr->enabledLocks();
-#else
-
if (deviceInfoSimulatorBackend)
return deviceInfoSimulatorBackend->getEnabledLocks();
-#endif
return QDeviceInfo::NoLock;
}
@@ -314,14 +292,8 @@ QString QDeviceInfoSimulator::uniqueDeviceID()
QString QDeviceInfoSimulator::version(QDeviceInfo::Version type)
{
-#if defined(Q_OS_LINUX) && !defined(QT_NO_JSONDB)
- if (d_ptr)
- return d_ptr->version(type);
-#else
-
if (deviceInfoSimulatorBackend)
return deviceInfoSimulatorBackend->getVersion(type);
-#endif
return QString();
}
@@ -332,21 +304,12 @@ void QDeviceInfoSimulator::connectNotify(const QMetaMethod &signal)
static const QMetaMethod enabledLocksChangedSignal = QMetaMethod::fromSignal(&QDeviceInfoSimulator::enabledLocksChanged);
static const QMetaMethod thermalStateChangedSignal = QMetaMethod::fromSignal(&QDeviceInfoSimulator::thermalStateChanged);
- if (signal == activatedLocksChangedSignal
- || signal == enabledLocksChangedSignal) {
-#if defined(Q_OS_LINUX) && !defined(QT_NO_JSONDB)
- if (d_ptr) {
- QMetaMethod sourceSignal = proxyToSourceSignal(signal, d_ptr);
- connect(d_ptr, sourceSignal, this, signal, Qt::UniqueConnection);
- }
- return;
-#else
+ if (signal == activatedLocksChangedSignal || signal == enabledLocksChangedSignal) {
if (deviceInfoSimulatorBackend) {
QMetaMethod sourceSignal = proxyToSourceSignal(signal, deviceInfoSimulatorBackend);
connect(deviceInfoSimulatorBackend, sourceSignal, this, signal);
}
return;
-#endif
}
if (deviceInfoSimulatorBackend && signal == thermalStateChangedSignal) {
@@ -361,21 +324,12 @@ void QDeviceInfoSimulator::disconnectNotify(const QMetaMethod &signal)
static const QMetaMethod enabledLocksChangedSignal = QMetaMethod::fromSignal(&QDeviceInfoSimulator::enabledLocksChanged);
static const QMetaMethod thermalStateChangedSignal = QMetaMethod::fromSignal(&QDeviceInfoSimulator::thermalStateChanged);
- if (signal == activatedLocksChangedSignal
- || signal == enabledLocksChangedSignal) {
-#if defined(Q_OS_LINUX) && !defined(QT_NO_JSONDB)
- if (d_ptr) {
- QMetaMethod sourceSignal = proxyToSourceSignal(signal, d_ptr);
- disconnect(d_ptr, sourceSignal, this, signal);
- }
- return;
-#else
+ if (signal == activatedLocksChangedSignal || signal == enabledLocksChangedSignal) {
if (deviceInfoSimulatorBackend) {
QMetaMethod sourceSignal = proxyToSourceSignal(signal, deviceInfoSimulatorBackend);
disconnect(deviceInfoSimulatorBackend, sourceSignal, this, signal);
}
return;
-#endif
}
if (deviceInfoSimulatorBackend && signal == thermalStateChangedSignal) {
diff --git a/src/systeminfo/qsysteminfo_simulator_p.h b/src/systeminfo/qsysteminfo_simulator_p.h
index 305c2723..16bde4f7 100644
--- a/src/systeminfo/qsysteminfo_simulator_p.h
+++ b/src/systeminfo/qsysteminfo_simulator_p.h
@@ -64,10 +64,6 @@ class QBatteryInfoSimulatorBackend;
class QDeviceInfoSimulatorBackend;
class QNetworkInfoSimulatorBackend;
-#if defined(Q_OS_LINUX) && !defined(QT_NO_JSONDB)
-class QDeviceInfoPrivate;
-#endif
-
#if !defined(QT_NO_SFW_NETREG) || !defined(QT_NO_OFONO)
class QNetworkInfoPrivate;
#endif
@@ -146,11 +142,6 @@ private:
Q_DECLARE_PUBLIC(QDeviceInfo)
QDeviceInfoSimulatorBackend *deviceInfoSimulatorBackend;
-
-#if defined(Q_OS_LINUX) && !defined(QT_NO_JSONDB)
- QDeviceInfoPrivate * const d_ptr;
- Q_DECLARE_PRIVATE(QDeviceInfo)
-#endif
};
class QNetworkInfoSimulator : public QObject
diff --git a/src/systeminfo/systeminfo.pro b/src/systeminfo/systeminfo.pro
index 421a152c..be7d7f9b 100644
--- a/src/systeminfo/systeminfo.pro
+++ b/src/systeminfo/systeminfo.pro
@@ -72,8 +72,7 @@ linux-*: !simulator: {
qstorageinfo_linux.cpp \
qbatteryinfo_linux.cpp \
qnetworkinfo_linux.cpp \
- qscreensaver_linux.cpp \
- qdeviceprofile_linux.cpp
+ qscreensaver_linux.cpp
x11|config_x11 {
CONFIG += link_pkgconfig
@@ -82,14 +81,6 @@ linux-*: !simulator: {
DEFINES += QT_NO_X11
}
- contains(QT_CONFIG, jsondb): {
- QT += jsondb
- PRIVATE_HEADERS += qjsondbwrapper_p.h
- SOURCES += qjsondbwrapper.cpp
- } else: {
- DEFINES += QT_NO_JSONDB
- }
-
config_bluez {
CONFIG += link_pkgconfig
PKGCONFIG += bluez
@@ -165,7 +156,6 @@ simulator {
SOURCES += qdisplayinfo_linux.cpp \
qscreensaver_linux.cpp \
- qdeviceprofile_linux.cpp \
qstorageinfo_linux.cpp
x11|config_x11 {
@@ -175,17 +165,6 @@ simulator {
DEFINES += QT_NO_X11
}
- contains(QT_CONFIG, jsondb): {
- QT += jsondb
- PRIVATE_HEADERS += qjsondbwrapper_p.h \
- qdeviceinfo_linux_p.h
-
- SOURCES += qjsondbwrapper.cpp \
- qdeviceinfo_linux.cpp
- } else: {
- DEFINES += QT_NO_JSONDB
- }
-
config_bluez {
CONFIG += link_pkgconfig
PKGCONFIG += bluez