From 0056ec49e03412e3fbf99adcc1e5c880d4da6979 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 10 Feb 2015 21:27:11 +0200 Subject: [PATCH] Set locale according to global options. --HG-- branch : feature --- src/app/core/vapplication.cpp | 1 - src/app/core/vapplication.h | 2 +- src/app/dialogs/app/configdialog.cpp | 3 +++ src/app/dialogs/app/dialogaboutapp.cpp | 3 +++ src/app/dialogs/app/dialoghistory.cpp | 3 +++ src/app/dialogs/app/dialogincrements.cpp | 2 ++ src/app/dialogs/app/dialogindividualmeasurements.cpp | 2 ++ src/app/dialogs/app/dialoglayoutprogress.cpp | 4 ++++ src/app/dialogs/app/dialoglayoutsettings.cpp | 3 +++ src/app/dialogs/app/dialogmeasurements.cpp | 4 ++++ src/app/dialogs/app/dialogpatternproperties.cpp | 2 ++ src/app/dialogs/app/dialogpatternxmledit.cpp | 4 +++- src/app/dialogs/app/dialogsavelayout.cpp | 2 ++ src/app/dialogs/app/dialogstandardmeasurements.cpp | 2 ++ src/app/dialogs/app/dialogundo.cpp | 2 ++ src/app/dialogs/tools/dialogtool.cpp | 2 -- src/app/dialogs/tools/dialogtool.h | 2 ++ src/app/mainwindow.cpp | 8 ++++++++ src/app/mainwindow.h | 1 + src/app/tablewindow.cpp | 3 +++ 20 files changed, 50 insertions(+), 5 deletions(-) diff --git a/src/app/core/vapplication.cpp b/src/app/core/vapplication.cpp index 34b5f0ad7..fc4256c2c 100644 --- a/src/app/core/vapplication.cpp +++ b/src/app/core/vapplication.cpp @@ -35,7 +35,6 @@ #include "vmaingraphicsview.h" #include "../container/calculator.h" #include "../version.h" -#include "vsettings.h" #include #include diff --git a/src/app/core/vapplication.h b/src/app/core/vapplication.h index b3e944d05..25f44bf36 100644 --- a/src/app/core/vapplication.h +++ b/src/app/core/vapplication.h @@ -33,6 +33,7 @@ #include "../options.h" #include "../widgets/vmaingraphicsview.h" #include "../../libs/qmuparser/qmutranslation.h" +#include "vsettings.h" class VApplication;// used in define class QUndoStack; @@ -40,7 +41,6 @@ class VMainGraphicsView; class VMainGraphicsScene; class VPattern; class QFile; -class VSettings; class QLockFile; #if defined(qApp) diff --git a/src/app/dialogs/app/configdialog.cpp b/src/app/dialogs/app/configdialog.cpp index c210cdf12..181b2006a 100644 --- a/src/app/dialogs/app/configdialog.cpp +++ b/src/app/dialogs/app/configdialog.cpp @@ -33,6 +33,7 @@ #include #include #include +#include "../core/vapplication.h" //--------------------------------------------------------------------------------------------------------------------- ConfigDialog::ConfigDialog(QWidget *parent) : @@ -93,6 +94,7 @@ ConfigDialog::ConfigDialog(QWidget *parent) : this->setFixedSize(QSize(750, 550)); this->setWindowFlags(Qt::Tool | Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::CustomizeWindowHint); + qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C)); } //--------------------------------------------------------------------------------------------------------------------- @@ -156,6 +158,7 @@ void ConfigDialog::Apply() default: break; } + qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C)); emit UpdateProperties(); setResult(QDialog::Accepted); } diff --git a/src/app/dialogs/app/dialogaboutapp.cpp b/src/app/dialogs/app/dialogaboutapp.cpp index 1961177c9..11d8ec5dc 100644 --- a/src/app/dialogs/app/dialogaboutapp.cpp +++ b/src/app/dialogs/app/dialogaboutapp.cpp @@ -33,6 +33,7 @@ #include #include #include "../../options.h" +#include "../core/vapplication.h" //--------------------------------------------------------------------------------------------------------------------- DialogAboutApp::DialogAboutApp(QWidget *parent) : @@ -41,6 +42,8 @@ DialogAboutApp::DialogAboutApp(QWidget *parent) : { ui->setupUi(this); + qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C)); + ui->label_Valentina_Version->setText(QString("Valentina %1").arg(APP_VERSION)); ui->labelBuildRevision->setText(QString("Build revision: %1").arg(BUILD_REVISION)); ui->label_QT_Version->setText(buildCompatibilityString()); diff --git a/src/app/dialogs/app/dialoghistory.cpp b/src/app/dialogs/app/dialoghistory.cpp index 6e70e1b97..b284365ad 100644 --- a/src/app/dialogs/app/dialoghistory.cpp +++ b/src/app/dialogs/app/dialoghistory.cpp @@ -49,6 +49,9 @@ DialogHistory::DialogHistory(VContainer *data, VPattern *doc, QWidget *parent) cursorToolRecordRow(0) { ui->setupUi(this); + + qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C)); + bOk = ui->buttonBox->button(QDialogButtonBox::Ok); connect(bOk, &QPushButton::clicked, this, &DialogHistory::DialogAccepted); FillTable(); diff --git a/src/app/dialogs/app/dialogincrements.cpp b/src/app/dialogs/app/dialogincrements.cpp index 62f5d47fb..809bbce06 100644 --- a/src/app/dialogs/app/dialogincrements.cpp +++ b/src/app/dialogs/app/dialogincrements.cpp @@ -55,6 +55,8 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par { ui->setupUi(this); + qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C)); + qCDebug(vDialog)<<"Showing variables."; if (qApp->patternType() == MeasurementsType::Individual) { diff --git a/src/app/dialogs/app/dialogindividualmeasurements.cpp b/src/app/dialogs/app/dialogindividualmeasurements.cpp index 8fedf9f43..f85925557 100644 --- a/src/app/dialogs/app/dialogindividualmeasurements.cpp +++ b/src/app/dialogs/app/dialogindividualmeasurements.cpp @@ -47,6 +47,8 @@ DialogIndividualMeasurements::DialogIndividualMeasurements(VContainer *data, con { ui->setupUi(this); + qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C)); + QRect position = this->frameGeometry(); position.moveCenter(QDesktopWidget().availableGeometry().center()); move(position.topLeft()); diff --git a/src/app/dialogs/app/dialoglayoutprogress.cpp b/src/app/dialogs/app/dialoglayoutprogress.cpp index d7d5fb620..7244cdbb5 100644 --- a/src/app/dialogs/app/dialoglayoutprogress.cpp +++ b/src/app/dialogs/app/dialoglayoutprogress.cpp @@ -29,6 +29,7 @@ #include "dialoglayoutprogress.h" #include "ui_dialoglayoutprogress.h" #include "../options.h" +#include "../core/vapplication.h" #include #include @@ -38,6 +39,9 @@ DialogLayoutProgress::DialogLayoutProgress(int count, QWidget *parent) :QDialog(parent), ui(new Ui::DialogLayoutProgress) { ui->setupUi(this); + + qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C)); + ui->progressBar->setMaximum(count); ui->progressBar->setValue(0); diff --git a/src/app/dialogs/app/dialoglayoutsettings.cpp b/src/app/dialogs/app/dialoglayoutsettings.cpp index a96b4a30f..2d81b2d33 100644 --- a/src/app/dialogs/app/dialoglayoutsettings.cpp +++ b/src/app/dialogs/app/dialoglayoutsettings.cpp @@ -42,6 +42,9 @@ DialogLayoutSettings::DialogLayoutSettings(QWidget *parent) : QDialog(parent), ui(new Ui::DialogLayoutSettings), oldPaperUnit(Unit::Mm), oldLayoutUnit(Unit::Mm) { ui->setupUi(this); + + qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C)); + InitPaperUnits(); InitLayoutUnits(); InitTemplates(); diff --git a/src/app/dialogs/app/dialogmeasurements.cpp b/src/app/dialogs/app/dialogmeasurements.cpp index af84fc440..f58ed626f 100644 --- a/src/app/dialogs/app/dialogmeasurements.cpp +++ b/src/app/dialogs/app/dialogmeasurements.cpp @@ -28,12 +28,16 @@ #include "dialogmeasurements.h" #include "ui_dialogmeasurements.h" +#include "../core/vapplication.h" //--------------------------------------------------------------------------------------------------------------------- DialogMeasurements::DialogMeasurements(QWidget *parent) : QDialog(parent), ui(new Ui::DialogMeasurements), result(MeasurementsType::Individual) { ui->setupUi(this); + + qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C)); + connect(ui->toolButtonStandard, &QToolButton::clicked, this, &DialogMeasurements::StandardMeasurements); connect(ui->toolButtonIndividual, &QToolButton::clicked, this, &DialogMeasurements::IndividualMeasurements); } diff --git a/src/app/dialogs/app/dialogpatternproperties.cpp b/src/app/dialogs/app/dialogpatternproperties.cpp index 51e68a418..3229aceda 100644 --- a/src/app/dialogs/app/dialogpatternproperties.cpp +++ b/src/app/dialogs/app/dialogpatternproperties.cpp @@ -45,6 +45,8 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, QWidget *parent) SCASSERT(doc != nullptr); + qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C)); + ui->lineEditAuthor->setText(doc->GetAuthor()); connect(ui->lineEditAuthor, &QLineEdit::editingFinished, this, &DialogPatternProperties::DescEdited); diff --git a/src/app/dialogs/app/dialogpatternxmledit.cpp b/src/app/dialogs/app/dialogpatternxmledit.cpp index 6339ff47c..2e4701137 100644 --- a/src/app/dialogs/app/dialogpatternxmledit.cpp +++ b/src/app/dialogs/app/dialogpatternxmledit.cpp @@ -28,6 +28,7 @@ #include "dialogpatternxmledit.h" #include "ui_dialogpatternxmledit.h" +#include "../core/vapplication.h" #include #include @@ -36,7 +37,6 @@ const short int DialogPatternXmlEdit::ChangeTypeDelete=1; const short int DialogPatternXmlEdit::ChangeTypeAdd=2; const short int DialogPatternXmlEdit::ChangeTypeModify=3; - //--------------------------------------------------------------------------------------------------------------------- DialogPatternXmlEdit::DialogPatternXmlEdit(QWidget *parent, VPattern *xmldoc) :QDialog(parent), treeChange(false), currentNodeEdited(nullptr), currentNodeEditedStatus(0), @@ -46,6 +46,8 @@ DialogPatternXmlEdit::DialogPatternXmlEdit(QWidget *parent, VPattern *xmldoc) { ui->setupUi(this); + qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C)); + this->xmlmodel = new VXMLTreeView(); this->doc=xmldoc; this->root = this->doc->documentElement(); diff --git a/src/app/dialogs/app/dialogsavelayout.cpp b/src/app/dialogs/app/dialogsavelayout.cpp index 3a427a76b..94b3c55ab 100644 --- a/src/app/dialogs/app/dialogsavelayout.cpp +++ b/src/app/dialogs/app/dialogsavelayout.cpp @@ -43,6 +43,8 @@ DialogSaveLayout::DialogSaveLayout(const QMap &formates, int c { ui->setupUi(this); + qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C)); + QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok); SCASSERT(bOk != nullptr); bOk->setEnabled(false); diff --git a/src/app/dialogs/app/dialogstandardmeasurements.cpp b/src/app/dialogs/app/dialogstandardmeasurements.cpp index f3a8fc4f1..5b4bc433b 100644 --- a/src/app/dialogs/app/dialogstandardmeasurements.cpp +++ b/src/app/dialogs/app/dialogstandardmeasurements.cpp @@ -46,6 +46,8 @@ DialogStandardMeasurements::DialogStandardMeasurements(VContainer *data, const Q { ui->setupUi(this); + qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C)); + QRect position = this->frameGeometry(); position.moveCenter(QDesktopWidget().availableGeometry().center()); move(position.topLeft()); diff --git a/src/app/dialogs/app/dialogundo.cpp b/src/app/dialogs/app/dialogundo.cpp index 705adee55..a26fff415 100644 --- a/src/app/dialogs/app/dialogundo.cpp +++ b/src/app/dialogs/app/dialogundo.cpp @@ -39,6 +39,8 @@ DialogUndo::DialogUndo(QWidget *parent) { ui->setupUi(this); + qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C)); + bool opening = qApp->getOpeningPattern(); if (opening) { diff --git a/src/app/dialogs/tools/dialogtool.cpp b/src/app/dialogs/tools/dialogtool.cpp index 4605dff65..043c49042 100644 --- a/src/app/dialogs/tools/dialogtool.cpp +++ b/src/app/dialogs/tools/dialogtool.cpp @@ -34,8 +34,6 @@ #include "../../geometry/vsplinepath.h" #include "../../tools/vabstracttool.h" #include "../../../libs/qmuparser/qmuparsererror.h" -#include "../../core/vapplication.h" -#include "../../core/vsettings.h" #include "../../libs/ifc/xml/vdomdocument.h" #include #include diff --git a/src/app/dialogs/tools/dialogtool.h b/src/app/dialogs/tools/dialogtool.h index 8cd7cece1..191195b6d 100644 --- a/src/app/dialogs/tools/dialogtool.h +++ b/src/app/dialogs/tools/dialogtool.h @@ -321,6 +321,8 @@ protected: QPushButton *bCancel = ui->buttonBox->button(QDialogButtonBox::Cancel); SCASSERT(bCancel != nullptr); connect(bCancel, &QPushButton::clicked, this, &DialogTool::DialogRejected); + + qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C)); } template /** diff --git a/src/app/mainwindow.cpp b/src/app/mainwindow.cpp index 56b43ca2b..b06ca4732 100644 --- a/src/app/mainwindow.cpp +++ b/src/app/mainwindow.cpp @@ -84,6 +84,7 @@ MainWindow::MainWindow(QWidget *parent) recentFileActs[i] = nullptr; } + WindowsLocale(); CreateActions(); CreateMenus(); ToolBarDraws(); @@ -1403,6 +1404,7 @@ void MainWindow::Preferences() { ConfigDialog dlg(this); connect(&dlg, &ConfigDialog::UpdateProperties, toolOptions, &VToolOptionsPropertyBrowser::UpdateOptions); + connect(&dlg, &ConfigDialog::UpdateProperties, this, &MainWindow::WindowsLocale); if (dlg.exec() == QDialog::Accepted) { InitAutoSave(); @@ -2474,6 +2476,12 @@ QStringList MainWindow::GetUnlokedRestoreFileList() const return restoreFiles; } +//--------------------------------------------------------------------------------------------------------------------- +void MainWindow::WindowsLocale() +{ + qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C)); +} + //--------------------------------------------------------------------------------------------------------------------- void MainWindow::ReopenFilesAfterCrash(QStringList &args) { diff --git a/src/app/mainwindow.h b/src/app/mainwindow.h index 3e1a2c210..8cb40ce60 100644 --- a/src/app/mainwindow.h +++ b/src/app/mainwindow.h @@ -130,6 +130,7 @@ public slots: void Layout(); void UpdateGradation(); void GlobalChangePP(const QString &patternPiece); + void WindowsLocale(); signals: /** * @brief ModelChosen emit after calculation all details. diff --git a/src/app/tablewindow.cpp b/src/app/tablewindow.cpp index 30649add5..c2fa61c10 100644 --- a/src/app/tablewindow.cpp +++ b/src/app/tablewindow.cpp @@ -60,6 +60,9 @@ TableWindow::TableWindow(QWidget *parent) description(QString()), tempScene(nullptr) { ui->setupUi(this); + + qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C)); + tempScene = new QGraphicsScene(QRectF(0, 0, qApp->toPixel(823, Unit::Mm), qApp->toPixel(1171, Unit::Mm))); QBrush brush; brush.setStyle( Qt::SolidPattern );