Set locale according to global options.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2015-02-10 21:27:11 +02:00
parent a12eb73bec
commit 0056ec49e0
20 changed files with 50 additions and 5 deletions

View File

@ -35,7 +35,6 @@
#include "vmaingraphicsview.h" #include "vmaingraphicsview.h"
#include "../container/calculator.h" #include "../container/calculator.h"
#include "../version.h" #include "../version.h"
#include "vsettings.h"
#include <QDebug> #include <QDebug>
#include <QDir> #include <QDir>

View File

@ -33,6 +33,7 @@
#include "../options.h" #include "../options.h"
#include "../widgets/vmaingraphicsview.h" #include "../widgets/vmaingraphicsview.h"
#include "../../libs/qmuparser/qmutranslation.h" #include "../../libs/qmuparser/qmutranslation.h"
#include "vsettings.h"
class VApplication;// used in define class VApplication;// used in define
class QUndoStack; class QUndoStack;
@ -40,7 +41,6 @@ class VMainGraphicsView;
class VMainGraphicsScene; class VMainGraphicsScene;
class VPattern; class VPattern;
class QFile; class QFile;
class VSettings;
class QLockFile; class QLockFile;
#if defined(qApp) #if defined(qApp)

View File

@ -33,6 +33,7 @@
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QStackedWidget> #include <QStackedWidget>
#include <QCloseEvent> #include <QCloseEvent>
#include "../core/vapplication.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
ConfigDialog::ConfigDialog(QWidget *parent) : ConfigDialog::ConfigDialog(QWidget *parent) :
@ -93,6 +94,7 @@ ConfigDialog::ConfigDialog(QWidget *parent) :
this->setFixedSize(QSize(750, 550)); this->setFixedSize(QSize(750, 550));
this->setWindowFlags(Qt::Tool | Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::CustomizeWindowHint); 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: default:
break; break;
} }
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
emit UpdateProperties(); emit UpdateProperties();
setResult(QDialog::Accepted); setResult(QDialog::Accepted);
} }

View File

@ -33,6 +33,7 @@
#include <QDesktopServices> #include <QDesktopServices>
#include <QMessageBox> #include <QMessageBox>
#include "../../options.h" #include "../../options.h"
#include "../core/vapplication.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogAboutApp::DialogAboutApp(QWidget *parent) : DialogAboutApp::DialogAboutApp(QWidget *parent) :
@ -41,6 +42,8 @@ DialogAboutApp::DialogAboutApp(QWidget *parent) :
{ {
ui->setupUi(this); 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->label_Valentina_Version->setText(QString("Valentina %1").arg(APP_VERSION));
ui->labelBuildRevision->setText(QString("Build revision: %1").arg(BUILD_REVISION)); ui->labelBuildRevision->setText(QString("Build revision: %1").arg(BUILD_REVISION));
ui->label_QT_Version->setText(buildCompatibilityString()); ui->label_QT_Version->setText(buildCompatibilityString());

View File

@ -49,6 +49,9 @@ DialogHistory::DialogHistory(VContainer *data, VPattern *doc, QWidget *parent)
cursorToolRecordRow(0) cursorToolRecordRow(0)
{ {
ui->setupUi(this); ui->setupUi(this);
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
bOk = ui->buttonBox->button(QDialogButtonBox::Ok); bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogHistory::DialogAccepted); connect(bOk, &QPushButton::clicked, this, &DialogHistory::DialogAccepted);
FillTable(); FillTable();

View File

@ -55,6 +55,8 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
{ {
ui->setupUi(this); ui->setupUi(this);
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
qCDebug(vDialog)<<"Showing variables."; qCDebug(vDialog)<<"Showing variables.";
if (qApp->patternType() == MeasurementsType::Individual) if (qApp->patternType() == MeasurementsType::Individual)
{ {

View File

@ -47,6 +47,8 @@ DialogIndividualMeasurements::DialogIndividualMeasurements(VContainer *data, con
{ {
ui->setupUi(this); ui->setupUi(this);
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
QRect position = this->frameGeometry(); QRect position = this->frameGeometry();
position.moveCenter(QDesktopWidget().availableGeometry().center()); position.moveCenter(QDesktopWidget().availableGeometry().center());
move(position.topLeft()); move(position.topLeft());

View File

@ -29,6 +29,7 @@
#include "dialoglayoutprogress.h" #include "dialoglayoutprogress.h"
#include "ui_dialoglayoutprogress.h" #include "ui_dialoglayoutprogress.h"
#include "../options.h" #include "../options.h"
#include "../core/vapplication.h"
#include <QMessageBox> #include <QMessageBox>
#include <QPushButton> #include <QPushButton>
@ -38,6 +39,9 @@ DialogLayoutProgress::DialogLayoutProgress(int count, QWidget *parent)
:QDialog(parent), ui(new Ui::DialogLayoutProgress) :QDialog(parent), ui(new Ui::DialogLayoutProgress)
{ {
ui->setupUi(this); ui->setupUi(this);
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
ui->progressBar->setMaximum(count); ui->progressBar->setMaximum(count);
ui->progressBar->setValue(0); ui->progressBar->setValue(0);

View File

@ -42,6 +42,9 @@ DialogLayoutSettings::DialogLayoutSettings(QWidget *parent)
: QDialog(parent), ui(new Ui::DialogLayoutSettings), oldPaperUnit(Unit::Mm), oldLayoutUnit(Unit::Mm) : QDialog(parent), ui(new Ui::DialogLayoutSettings), oldPaperUnit(Unit::Mm), oldLayoutUnit(Unit::Mm)
{ {
ui->setupUi(this); ui->setupUi(this);
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
InitPaperUnits(); InitPaperUnits();
InitLayoutUnits(); InitLayoutUnits();
InitTemplates(); InitTemplates();

View File

@ -28,12 +28,16 @@
#include "dialogmeasurements.h" #include "dialogmeasurements.h"
#include "ui_dialogmeasurements.h" #include "ui_dialogmeasurements.h"
#include "../core/vapplication.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogMeasurements::DialogMeasurements(QWidget *parent) : DialogMeasurements::DialogMeasurements(QWidget *parent) :
QDialog(parent), ui(new Ui::DialogMeasurements), result(MeasurementsType::Individual) QDialog(parent), ui(new Ui::DialogMeasurements), result(MeasurementsType::Individual)
{ {
ui->setupUi(this); ui->setupUi(this);
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
connect(ui->toolButtonStandard, &QToolButton::clicked, this, &DialogMeasurements::StandardMeasurements); connect(ui->toolButtonStandard, &QToolButton::clicked, this, &DialogMeasurements::StandardMeasurements);
connect(ui->toolButtonIndividual, &QToolButton::clicked, this, &DialogMeasurements::IndividualMeasurements); connect(ui->toolButtonIndividual, &QToolButton::clicked, this, &DialogMeasurements::IndividualMeasurements);
} }

View File

@ -45,6 +45,8 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, QWidget *parent)
SCASSERT(doc != nullptr); SCASSERT(doc != nullptr);
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
ui->lineEditAuthor->setText(doc->GetAuthor()); ui->lineEditAuthor->setText(doc->GetAuthor());
connect(ui->lineEditAuthor, &QLineEdit::editingFinished, this, &DialogPatternProperties::DescEdited); connect(ui->lineEditAuthor, &QLineEdit::editingFinished, this, &DialogPatternProperties::DescEdited);

View File

@ -28,6 +28,7 @@
#include "dialogpatternxmledit.h" #include "dialogpatternxmledit.h"
#include "ui_dialogpatternxmledit.h" #include "ui_dialogpatternxmledit.h"
#include "../core/vapplication.h"
#include <QInputDialog> #include <QInputDialog>
#include <QMessageBox> #include <QMessageBox>
@ -36,7 +37,6 @@ const short int DialogPatternXmlEdit::ChangeTypeDelete=1;
const short int DialogPatternXmlEdit::ChangeTypeAdd=2; const short int DialogPatternXmlEdit::ChangeTypeAdd=2;
const short int DialogPatternXmlEdit::ChangeTypeModify=3; const short int DialogPatternXmlEdit::ChangeTypeModify=3;
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogPatternXmlEdit::DialogPatternXmlEdit(QWidget *parent, VPattern *xmldoc) DialogPatternXmlEdit::DialogPatternXmlEdit(QWidget *parent, VPattern *xmldoc)
:QDialog(parent), treeChange(false), currentNodeEdited(nullptr), currentNodeEditedStatus(0), :QDialog(parent), treeChange(false), currentNodeEdited(nullptr), currentNodeEditedStatus(0),
@ -46,6 +46,8 @@ DialogPatternXmlEdit::DialogPatternXmlEdit(QWidget *parent, VPattern *xmldoc)
{ {
ui->setupUi(this); ui->setupUi(this);
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
this->xmlmodel = new VXMLTreeView(); this->xmlmodel = new VXMLTreeView();
this->doc=xmldoc; this->doc=xmldoc;
this->root = this->doc->documentElement(); this->root = this->doc->documentElement();

View File

@ -43,6 +43,8 @@ DialogSaveLayout::DialogSaveLayout(const QMap<QString, QString> &formates, int c
{ {
ui->setupUi(this); ui->setupUi(this);
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok); QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
SCASSERT(bOk != nullptr); SCASSERT(bOk != nullptr);
bOk->setEnabled(false); bOk->setEnabled(false);

View File

@ -46,6 +46,8 @@ DialogStandardMeasurements::DialogStandardMeasurements(VContainer *data, const Q
{ {
ui->setupUi(this); ui->setupUi(this);
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
QRect position = this->frameGeometry(); QRect position = this->frameGeometry();
position.moveCenter(QDesktopWidget().availableGeometry().center()); position.moveCenter(QDesktopWidget().availableGeometry().center());
move(position.topLeft()); move(position.topLeft());

View File

@ -39,6 +39,8 @@ DialogUndo::DialogUndo(QWidget *parent)
{ {
ui->setupUi(this); ui->setupUi(this);
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
bool opening = qApp->getOpeningPattern(); bool opening = qApp->getOpeningPattern();
if (opening) if (opening)
{ {

View File

@ -34,8 +34,6 @@
#include "../../geometry/vsplinepath.h" #include "../../geometry/vsplinepath.h"
#include "../../tools/vabstracttool.h" #include "../../tools/vabstracttool.h"
#include "../../../libs/qmuparser/qmuparsererror.h" #include "../../../libs/qmuparser/qmuparsererror.h"
#include "../../core/vapplication.h"
#include "../../core/vsettings.h"
#include "../../libs/ifc/xml/vdomdocument.h" #include "../../libs/ifc/xml/vdomdocument.h"
#include <QTimer> #include <QTimer>
#include <QCloseEvent> #include <QCloseEvent>

View File

@ -321,6 +321,8 @@ protected:
QPushButton *bCancel = ui->buttonBox->button(QDialogButtonBox::Cancel); QPushButton *bCancel = ui->buttonBox->button(QDialogButtonBox::Cancel);
SCASSERT(bCancel != nullptr); SCASSERT(bCancel != nullptr);
connect(bCancel, &QPushButton::clicked, this, &DialogTool::DialogRejected); connect(bCancel, &QPushButton::clicked, this, &DialogTool::DialogRejected);
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
} }
template <typename T> template <typename T>
/** /**

View File

@ -84,6 +84,7 @@ MainWindow::MainWindow(QWidget *parent)
recentFileActs[i] = nullptr; recentFileActs[i] = nullptr;
} }
WindowsLocale();
CreateActions(); CreateActions();
CreateMenus(); CreateMenus();
ToolBarDraws(); ToolBarDraws();
@ -1403,6 +1404,7 @@ void MainWindow::Preferences()
{ {
ConfigDialog dlg(this); ConfigDialog dlg(this);
connect(&dlg, &ConfigDialog::UpdateProperties, toolOptions, &VToolOptionsPropertyBrowser::UpdateOptions); connect(&dlg, &ConfigDialog::UpdateProperties, toolOptions, &VToolOptionsPropertyBrowser::UpdateOptions);
connect(&dlg, &ConfigDialog::UpdateProperties, this, &MainWindow::WindowsLocale);
if (dlg.exec() == QDialog::Accepted) if (dlg.exec() == QDialog::Accepted)
{ {
InitAutoSave(); InitAutoSave();
@ -2474,6 +2476,12 @@ QStringList MainWindow::GetUnlokedRestoreFileList() const
return restoreFiles; return restoreFiles;
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::WindowsLocale()
{
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void MainWindow::ReopenFilesAfterCrash(QStringList &args) void MainWindow::ReopenFilesAfterCrash(QStringList &args)
{ {

View File

@ -130,6 +130,7 @@ public slots:
void Layout(); void Layout();
void UpdateGradation(); void UpdateGradation();
void GlobalChangePP(const QString &patternPiece); void GlobalChangePP(const QString &patternPiece);
void WindowsLocale();
signals: signals:
/** /**
* @brief ModelChosen emit after calculation all details. * @brief ModelChosen emit after calculation all details.

View File

@ -60,6 +60,9 @@ TableWindow::TableWindow(QWidget *parent)
description(QString()), tempScene(nullptr) description(QString()), tempScene(nullptr)
{ {
ui->setupUi(this); 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))); tempScene = new QGraphicsScene(QRectF(0, 0, qApp->toPixel(823, Unit::Mm), qApp->toPixel(1171, Unit::Mm)));
QBrush brush; QBrush brush;
brush.setStyle( Qt::SolidPattern ); brush.setStyle( Qt::SolidPattern );