BlackBerry: The MeasurementSystem port was for BlackBerry OS not QNX
Change-Id: I87708aad18ebe1c6a08fe89376290be66f9c0577 Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com> Reviewed-by: Sérgio Martins <sergio.martins.qnx@kdab.com> Reviewed-by: Nicolas Arnaud-Cormos <nicolas@kdab.com>
This commit is contained in:
parent
3249439b20
commit
18260ed212
@ -59,7 +59,7 @@
|
|||||||
|
|
||||||
#include "qlocale.h"
|
#include "qlocale.h"
|
||||||
|
|
||||||
#if defined(Q_OS_QNX)
|
#if defined(Q_OS_BLACKBERRY)
|
||||||
#include "qsocketnotifier.h"
|
#include "qsocketnotifier.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -373,17 +373,17 @@ inline char QLocalePrivate::digitToCLocale(QChar in) const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(Q_OS_QNX)
|
#if defined(Q_OS_BLACKBERRY)
|
||||||
class QBBLocaleData: public QObject
|
class QQNXLocaleData: public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
QBBLocaleData();
|
QQNXLocaleData();
|
||||||
virtual ~QBBLocaleData();
|
virtual ~QQNXLocaleData();
|
||||||
void readPPSLocale();
|
void readPPSLocale();
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void updateMesurementSystem();
|
void updateMeasurementSystem();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
uint ppsMeasurement;
|
uint ppsMeasurement;
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
#include "qvariant.h"
|
#include "qvariant.h"
|
||||||
#include "qreadwritelock.h"
|
#include "qreadwritelock.h"
|
||||||
|
|
||||||
#if defined(Q_OS_QNX)
|
#if defined(Q_OS_BLACKBERRY)
|
||||||
#include <QtCore/private/qcore_unix_p.h>
|
#include <QtCore/private/qcore_unix_p.h>
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -57,24 +57,24 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
#if defined(Q_OS_QNX)
|
#if defined(Q_OS_BLACKBERRY)
|
||||||
static const char ppsServicePath[] = "/pps/services/locale/uom";
|
static const char ppsServicePath[] = "/pps/services/locale/uom";
|
||||||
static const size_t ppsBufferSize = 256;
|
static const size_t ppsBufferSize = 256;
|
||||||
|
|
||||||
QBBLocaleData::QBBLocaleData()
|
QQNXLocaleData::QQNXLocaleData()
|
||||||
:ppsNotifier(0)
|
:ppsNotifier(0)
|
||||||
,ppsFd(-1)
|
,ppsFd(-1)
|
||||||
{
|
{
|
||||||
readPPSLocale();
|
readPPSLocale();
|
||||||
}
|
}
|
||||||
|
|
||||||
QBBLocaleData::~QBBLocaleData()
|
QQNXLocaleData::~QQNXLocaleData()
|
||||||
{
|
{
|
||||||
if (ppsFd != -1)
|
if (ppsFd != -1)
|
||||||
qt_safe_close(ppsFd);
|
qt_safe_close(ppsFd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QBBLocaleData::updateMesurementSystem()
|
void QQNXLocaleData::updateMeasurementSystem()
|
||||||
{
|
{
|
||||||
char buffer[ppsBufferSize];
|
char buffer[ppsBufferSize];
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ void QBBLocaleData::updateMesurementSystem()
|
|||||||
ppsMeasurement = QLocale::MetricSystem;
|
ppsMeasurement = QLocale::MetricSystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QBBLocaleData::readPPSLocale()
|
void QQNXLocaleData::readPPSLocale()
|
||||||
{
|
{
|
||||||
errno = 0;
|
errno = 0;
|
||||||
ppsFd = qt_safe_open(ppsServicePath, O_RDONLY);
|
ppsFd = qt_safe_open(ppsServicePath, O_RDONLY);
|
||||||
@ -115,8 +115,8 @@ void QBBLocaleData::readPPSLocale()
|
|||||||
}
|
}
|
||||||
|
|
||||||
ppsNotifier = new QSocketNotifier(ppsFd, QSocketNotifier::Read, this);
|
ppsNotifier = new QSocketNotifier(ppsFd, QSocketNotifier::Read, this);
|
||||||
updateMesurementSystem();
|
updateMeasurementSystem();
|
||||||
QObject::connect(ppsNotifier, SIGNAL(activated(int)), this, SLOT(updateMesurementSystem()));
|
QObject::connect(ppsNotifier, SIGNAL(activated(int)), this, SLOT(updateMeasurementSystem()));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -176,8 +176,8 @@ void QSystemLocaleData::readEnvironment()
|
|||||||
|
|
||||||
|
|
||||||
Q_GLOBAL_STATIC(QSystemLocaleData, qSystemLocaleData)
|
Q_GLOBAL_STATIC(QSystemLocaleData, qSystemLocaleData)
|
||||||
#if defined(Q_OS_QNX)
|
#if defined(Q_OS_BLACKBERRY)
|
||||||
Q_GLOBAL_STATIC(QBBLocaleData, qbbLocaleData)
|
Q_GLOBAL_STATIC(QQNXLocaleData, qqnxLocaleData)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -210,8 +210,8 @@ QLocale QSystemLocale::fallbackUiLocale() const
|
|||||||
QVariant QSystemLocale::query(QueryType type, QVariant in) const
|
QVariant QSystemLocale::query(QueryType type, QVariant in) const
|
||||||
{
|
{
|
||||||
QSystemLocaleData *d = qSystemLocaleData();
|
QSystemLocaleData *d = qSystemLocaleData();
|
||||||
#if defined(Q_OS_QNX)
|
#if defined(Q_OS_BLACKBERRY)
|
||||||
QBBLocaleData *bbd = qbbLocaleData();
|
QQNXLocaleData *qnxd = qqnxLocaleData();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (type == LocaleChanged) {
|
if (type == LocaleChanged) {
|
||||||
@ -300,8 +300,8 @@ QVariant QSystemLocale::query(QueryType type, QVariant in) const
|
|||||||
return QLocale::MetricSystem;
|
return QLocale::MetricSystem;
|
||||||
if (meas_locale.compare(QLatin1String("Other"), Qt::CaseInsensitive) == 0)
|
if (meas_locale.compare(QLatin1String("Other"), Qt::CaseInsensitive) == 0)
|
||||||
return QLocale::MetricSystem;
|
return QLocale::MetricSystem;
|
||||||
#if defined(Q_OS_QNX)
|
#if defined(Q_OS_BLACKBERRY)
|
||||||
return bbd->ppsMeasurement;
|
return qnxd->ppsMeasurement;
|
||||||
#endif
|
#endif
|
||||||
return QVariant((int)QLocale(meas_locale).measurementSystem());
|
return QVariant((int)QLocale(meas_locale).measurementSystem());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user