Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/mobility/organizertreemodel.cpp b/src/mobility/organizertreemodel.cpp
- index bca8f8a..db4b25f 100644
- --- a/src/mobility/organizertreemodel.cpp
- +++ b/src/mobility/organizertreemodel.cpp
- @@ -13,15 +13,15 @@ using namespace QtMobility;
- namespace {
- int itemIdFromPath(const QString &path) {
- - return path.section("/", 1, 1).toInt();
- + return QLocale().toInt(path.section("/", 1, 1));
- }
- int detailIdFromPath(const QString &path) {
- - return path.section("/", 3, 3).toInt();
- + return QLocale().toInt(path.section("/", 3, 3));
- }
- int valueKeyIdFromPath(const QString &path) {
- - return path.section("/", 5, 5).toInt();
- + return QLocale().toInt(path.section("/", 5, 5));
- }
- }
- @@ -214,17 +214,17 @@ QModelIndex OrganizerTreeModel::index(int row, int column, const QModelIndex &pa
- }
- path = parentPath + "/value/%1";
- - path = path.arg(QString::number(row));
- + path = path.arg(QLocale().toString(row));
- } else if (parentPath.contains("QOrganizerItemId")) { //parent is an organizer item
- if (itemFromPath(parentPath).details().count() <= row) {
- return QModelIndex();
- }
- path = parentPath + "/QOrganizerItemDetail/%1";
- - path = path.arg(QString::number(row));
- + path = path.arg(QLocale().toString(row));
- }
- } else { //no parent means it is a root item
- path = "QOrganizerItemId/%1";
- - path = path.arg(QString::number(row));
- + path = path.arg(QLocale().toString(row));
- }
- return createIndex(row, column, cachedPostion(path));
- }
- diff --git a/src/other/applicationmanager.cpp b/src/other/applicationmanager.cpp
- index b59a534..d2c43a0 100644
- --- a/src/other/applicationmanager.cpp
- +++ b/src/other/applicationmanager.cpp
- @@ -115,7 +115,7 @@ void ApplicationManager::registerApplication(Application *newApp)
- // add to debug application table
- mTableWidget->insertRow(0);
- - QTableWidgetItem *item = new QTableWidgetItem(QString::number(newApp->id()));
- + QTableWidgetItem *item = new QTableWidgetItem(QLocale().toString(newApp->id()));
- item->setData(0, newApp->id());
- mTableWidget->setItem(0, 0, item);
- mTableWidget->setItem(0, 1, new QTableWidgetItem(newApp->name()));
- diff --git a/src/other/widgetmanager.cpp b/src/other/widgetmanager.cpp
- index 257d451..46573e7 100644
- --- a/src/other/widgetmanager.cpp
- +++ b/src/other/widgetmanager.cpp
- @@ -35,6 +35,7 @@
- #include <QtCore/QDebug>
- #include <QtCore/QSharedMemory>
- +#include <QtCore/QLocale>
- #include <QtGui/QWidget>
- #include <QtGui/QTableWidget>
- #include <QtGui/QLayout>
- @@ -46,8 +47,9 @@ namespace {
- inline QString stringForCoord(QRect geometry)
- {
- QString result;
- - result += QString::number(geometry.left()) + QLatin1String(",") + QString::number(geometry.top()) + QLatin1String(";");
- - result += QString::number(geometry.width()) + QLatin1String(",") + QString::number(geometry.height());
- + QLocale locale;
- + result += locale.toString(geometry.left()) + QLatin1String(",") + locale.toString(geometry.top()) + QLatin1String(";");
- + result += locale.toString(geometry.width()) + QLatin1String(",") + locale.toString(geometry.height());
- return result;
- }
- @@ -178,7 +180,7 @@ QtSimulatorPrivate::NewWindowInfo WidgetManager::create(
- // insert into debug window widgets list
- tableWidget->insertRow(0);
- - tableWidget->setItem(0, 0, new QTableWidgetItem(QString::number(w->widgetId)));
- + tableWidget->setItem(0, 0, new QTableWidgetItem(QLocale().toString(w->widgetId)));
- tableWidget->setItem(0, 1, new QTableWidgetItem(w->title));
- tableWidget->setItem(0, 2, new QTableWidgetItem(stringForCoord(w->geometry())));
- @@ -244,7 +246,7 @@ void WidgetManager::updateLogItem(int id)
- // Find the list item
- int row = -1;
- for (int i = 0; i < tableWidget->rowCount(); ++i) {
- - if (tableWidget->item(i,0)->text().toInt() == id) {
- + if (QLocale().toInt(tableWidget->item(i,0)->text()) == id) {
- row = i;
- break;
- }
- @@ -261,12 +263,13 @@ void WidgetManager::updateLogItem(int id)
- if (row == -1 || w == 0)
- return;
- + QLocale locale;
- // update the content
- - tableWidget->setItem(row, 0, new QTableWidgetItem(QString::number(w->widgetId)));
- + tableWidget->setItem(row, 0, new QTableWidgetItem(locale.toString(w->widgetId)));
- tableWidget->setItem(row, 1, new QTableWidgetItem(w->title));
- QRect actualGeometry = w->geometry();
- actualGeometry.adjust(-mOffset.x(), -mOffset.y(), 0, 0);
- - tableWidget->setItem(row, 2, new QTableWidgetItem(stringForCoord(actualGeometry) + QString(";z:") + QString::number(w->zValue())));
- + tableWidget->setItem(row, 2, new QTableWidgetItem(stringForCoord(actualGeometry) + QString(";z:") + locale.toString(w->zValue())));
- }
- void WidgetManager::hideWidget(int id)
- @@ -322,7 +325,7 @@ void WidgetManager::removeWidgetFromTable(int id)
- // Find the list item
- int row = -1;
- for (int i = 0; i < tableWidget->rowCount(); ++i) {
- - if (tableWidget->item(i,0)->text().toInt() == id) {
- + if (QLocale().toInt(tableWidget->item(i,0)->text()) == id) {
- row = i;
- break;
- }
- diff --git a/src/ui/docgalleryui.cpp b/src/ui/docgalleryui.cpp
- index c3a1065..1ef59cd 100644
- --- a/src/ui/docgalleryui.cpp
- +++ b/src/ui/docgalleryui.cpp
- @@ -46,6 +46,7 @@ void DocGalleryUi::addStandardItems()
- // Add some images
- QString modelPath = qApp->applicationDirPath() + "/models";
- QDirIterator it(modelPath, QDirIterator::Subdirectories);
- + QLocale locale;
- while (it.hasNext()) {
- QString item = it.next();
- QImage image(item);
- @@ -53,8 +54,8 @@ void DocGalleryUi::addStandardItems()
- continue;
- QTreeWidgetItem* treeItem = new QTreeWidgetItem(imageHead);
- treeItem->setText(0, item);
- - treeItem->setText(1, QString::number(image.width()));
- - treeItem->setText(2, QString::number(image.height()));
- + treeItem->setText(1, locale.toString(image.width()));
- + treeItem->setText(2, locale.toString(image.height()));
- treeItem->setText(3, QLatin1String("Some model image"));
- treeItem->setText(4, QLatin1String("Simulator Model"));
- diff --git a/src/ui/feedbackui.cpp b/src/ui/feedbackui.cpp
- index 6dc5096..7d8581c 100644
- --- a/src/ui/feedbackui.cpp
- +++ b/src/ui/feedbackui.cpp
- @@ -115,7 +115,7 @@ void FeedbackUi::showActuatorInfo()
- return;
- }
- - int actuatorId = mActuators->itemData(mActuators->currentIndex()).toInt();
- + int actuatorId = QLocale().toInt(mActuators->itemData(mActuators->currentIndex()));
- const QtMobility::ActuatorData &actuator = mFeedback->actuator(actuatorId);
- if (actuator.id != actuatorId) {
- setEnabled(false);
- @@ -142,7 +142,7 @@ void FeedbackUi::showActuatorInfo()
- if (effect.duration == QtMobility::QFeedbackEffect::Infinite)
- mEffectDuration->setText(tr("infinite"));
- else
- - mEffectDuration->setText(QString::number(effect.duration));
- + mEffectDuration->setText(QLocale().toString(effect.duration));
- }
- }
- @@ -155,7 +155,7 @@ void FeedbackUi::addActuator(const QtMobility::ActuatorData &data)
- void FeedbackUi::removeActuator(int actuatorId)
- {
- for (int i = mActuators->count()-1; i >= 0; --i) {
- - const int itemActuatorId = mActuators->itemData(i).toInt();
- + const int itemActuatorId = QLocale().toInt(mActuators->itemData(i));
- if (itemActuatorId == actuatorId)
- mActuators->removeItem(i);
- }
- @@ -182,7 +182,7 @@ void FeedbackUi::removeActuatorClicked()
- if (mActuators->count() == 0)
- return;
- - const int actuatorId = mActuators->itemData(mActuators->currentIndex()).toInt();
- + const int actuatorId = QLocale().toInt(mActuators->itemData(mActuators->currentIndex()));
- mFeedback->removeActuator(actuatorId);
- }
- @@ -191,7 +191,7 @@ void FeedbackUi::changeActuatorData()
- if (mActuators->count() == 0)
- return;
- - const int actuatorId = mActuators->itemData(mActuators->currentIndex()).toInt();
- + const int actuatorId = QLocale().toInt(mActuators->itemData(mActuators->currentIndex()));
- const QtMobility::ActuatorData &actuator = mFeedback->actuator(actuatorId);
- if (actuator.id != actuatorId)
- return;
- @@ -212,7 +212,7 @@ void FeedbackUi::changeEffectState()
- if (mActuators->count() == 0)
- return;
- - const int actuatorId = mActuators->itemData(mActuators->currentIndex()).toInt();
- + const int actuatorId = QLocale().toInt(mActuators->itemData(mActuators->currentIndex()));
- mFeedback->setEffectState(actuatorId, static_cast<QtMobility::QFeedbackEffect::State>(mEffectState->currentIndex()));
- }
- diff --git a/src/ui/sensorsui.cpp b/src/ui/sensorsui.cpp
- index 15ff564..728ac6b 100644
- --- a/src/ui/sensorsui.cpp
- +++ b/src/ui/sensorsui.cpp
- @@ -73,7 +73,7 @@ void SensorDoubleEdit::setValue(double newValue, bool skipSignal)
- if (mValue != newValue)
- {
- mValue = newValue;
- - mLineEdit->setText(QString::number(newValue, 'f', mDecimalPlaces));
- + mLineEdit->setText(QLocale().toString(newValue, 'f', mDecimalPlaces));
- int sliderPos = qRound(newValue * mCorrectionFactor);
- if (mSlider->value() != sliderPos)
- mSlider->setValue(sliderPos);
- @@ -92,11 +92,11 @@ void SensorDoubleEdit::changeValue(int newValue)
- void SensorDoubleEdit::updateValueFromLineEdit()
- {
- - double newValue = mLineEdit->text().toDouble(0);
- + double newValue = QLocale().toDouble(mLineEdit->text());
- if (newValue >= mRange.first && newValue <= mRange.second)
- setValue(newValue);
- else
- - mLineEdit->setText(QString::number(mValue));
- + mLineEdit->setText(QLocale().toString(mValue));
- }
- void SensorDoubleEdit::setRange(double min, double max)
- diff --git a/src/ui/systeminfostorageui.cpp b/src/ui/systeminfostorageui.cpp
- index 4916874..d896930 100644
- --- a/src/ui/systeminfostorageui.cpp
- +++ b/src/ui/systeminfostorageui.cpp
- @@ -158,8 +158,9 @@ void StorageSystemInfoUi::showDriveInfo()
- const QString curDrive = systemInfoDrives->currentText();
- systemInfoDriveType->setCurrentIndex(static_cast<int>(mScriptInterface->typeForDrive(curDrive)));
- - systemInfoDriveAvailableSpace->setText(QString::number(mScriptInterface->availableDiskSpace(curDrive)));
- - systemInfoDriveTotalSpace->setText(QString::number(mScriptInterface->totalDiskSpace(curDrive)));
- + QLocale locale;
- + systemInfoDriveAvailableSpace->setText(locale.toString(mScriptInterface->availableDiskSpace(curDrive)));
- + systemInfoDriveTotalSpace->setText(locale.toString(mScriptInterface->totalDiskSpace(curDrive)));
- }
- void StorageSystemInfoUi::editDriveInfo()
- @@ -167,11 +168,12 @@ void StorageSystemInfoUi::editDriveInfo()
- if (systemInfoDrives->count() == 0)
- return;
- + QLocale locale;
- const QString curDrive = systemInfoDrives->currentText();
- StorageData::DriveInfo &driveInfo = mData.drives[curDrive];
- driveInfo.type = static_cast<StorageSystemInfoScriptInterface::DriveType>(systemInfoDriveType->currentIndex());
- - driveInfo.totalSpace = systemInfoDriveTotalSpace->text().toLongLong();
- - driveInfo.availableSpace = systemInfoDriveAvailableSpace->text().toLongLong();
- + driveInfo.totalSpace = locale.toLongLong(systemInfoDriveTotalSpace->text());
- + driveInfo.availableSpace = locale.toLongLong(systemInfoDriveAvailableSpace->text());
- emitStorageDataChange();
- }
- diff --git a/src/ui/viewconfiguration.cpp b/src/ui/viewconfiguration.cpp
- index c472a2c..4838c46 100644
- --- a/src/ui/viewconfiguration.cpp
- +++ b/src/ui/viewconfiguration.cpp
- @@ -47,7 +47,7 @@ ViewConfiguration::ViewConfiguration(qreal correctionFactor, QWidget *parent)
- qreal widthInInch = qApp->desktop()->width() / qApp->desktop()->logicalDpiX();
- qreal heightInInch = qApp->desktop()->height() / qApp->desktop()->logicalDpiY();
- mDiagonalInInch = sqrt(pow(widthInInch, 2) + pow(heightInInch, 2));
- - ui.diagonalInInch->setText(QString::number(mDiagonalInInch));
- + ui.diagonalInInch->setText(QLocale().toString(mDiagonalInInch));
- connect(ui.horizontalSlider, SIGNAL(valueChanged(int)), SLOT(updateCorrectionFromSlider()));
- connect(ui.cmRadioButton, SIGNAL(toggled(bool)), SLOT(updateUnit()));
- @@ -68,8 +68,9 @@ void ViewConfiguration::updateValues(qreal factor)
- {
- ui.horizontalSlider->setValue(factor * 100);
- updateLine();
- - ui.correctionFactorEdit->setText(QString::number(factor));
- - ui.diagonalInInch->setText(QString::number(mDiagonalInInch / factor));
- + QLocale locale;
- + ui.correctionFactorEdit->setText(locale.toString(factor));
- + ui.diagonalInInch->setText(locale.toString(mDiagonalInInch / factor));
- }
- void ViewConfiguration::updateLine()
- {
- @@ -103,7 +104,7 @@ void ViewConfiguration::updateCorrectionFromSlider()
- void ViewConfiguration::updateCorrectionFromMonitorValues()
- {
- - mCurrentCorrectionFactor = mDiagonalInInch / ui.diagonalInInch->text().toDouble();
- + mCurrentCorrectionFactor = mDiagonalInInch / QLocale().toDouble(ui.diagonalInInch->text());
- if (mCurrentCorrectionFactor > 2)
- mCurrentCorrectionFactor = 2;
- else if (mCurrentCorrectionFactor < 0.5)
- @@ -113,7 +114,7 @@ void ViewConfiguration::updateCorrectionFromMonitorValues()
- void ViewConfiguration::updateCorrectionFromLineEdit()
- {
- - qreal newValue = ui.correctionFactorEdit->text().toDouble();
- + qreal newValue = QLocale().toDouble(ui.correctionFactorEdit->text());
- if (newValue < 0.5)
- newValue = 0.5;
- else if (newValue > 2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement