Instead of method QLocale::system() better to use the default constructor.
Usefull in case we will deside change default locale. --HG-- branch : develop
This commit is contained in:
parent
704f44feeb
commit
86f4b21879
|
@ -193,7 +193,7 @@ QGroupBox *TapeConfigurationPage::LangGroup()
|
|||
//-------------------- Decimal separator setup
|
||||
separatorLabel = new QLabel(tr("Decimal separator parts:"));
|
||||
|
||||
osOptionCheck = new QCheckBox(tr("With OS options (%1)").arg(QLocale::system().decimalPoint().toLatin1()));
|
||||
osOptionCheck = new QCheckBox(tr("With OS options (%1)").arg(QLocale().decimalPoint()));
|
||||
osOptionCheck->setChecked(settings->GetOsSeparator());
|
||||
|
||||
langLayout->addRow(separatorLabel, osOptionCheck);
|
||||
|
@ -322,7 +322,7 @@ void TapeConfigurationPage::RetranslateUi()
|
|||
langGroup->setTitle(tr("Language"));
|
||||
guiLabel->setText(tr("GUI language:"));
|
||||
separatorLabel->setText(tr("Decimal separator parts:"));
|
||||
osOptionCheck->setText(tr("With OS options (%1)").arg(QLocale::system().decimalPoint().toLatin1()));
|
||||
osOptionCheck->setText(tr("With OS options (%1)").arg(QLocale().decimalPoint()));
|
||||
|
||||
pmSystemGroup->setTitle(tr("Pattern making system"));
|
||||
systemLabel->setText(tr("Pattern making system:"));
|
||||
|
|
|
@ -47,7 +47,7 @@ DialogAboutTape::DialogAboutTape(QWidget *parent)
|
|||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
//mApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale::c());
|
||||
//mApp->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
||||
|
||||
RetranslateUi();
|
||||
connect(ui->pushButton_Web_Site, &QPushButton::clicked, RECEIVER(this)[this]()
|
||||
|
|
|
@ -105,7 +105,7 @@ TapeConfigDialog::TapeConfigDialog(QWidget *parent)
|
|||
|
||||
setWindowTitle(tr("Config Dialog"));
|
||||
|
||||
qApp->TapeSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale::c());
|
||||
qApp->TapeSettings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -193,7 +193,7 @@ void TapeConfigDialog::Apply()
|
|||
configurationPage->Apply();
|
||||
pathPage->Apply();
|
||||
|
||||
qApp->TapeSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale::c());
|
||||
qApp->TapeSettings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
||||
emit UpdateProperties();
|
||||
setResult(QDialog::Accepted);
|
||||
}
|
||||
|
|
|
@ -392,7 +392,7 @@ void MApplication::InitOptions()
|
|||
qCDebug(mApp, "Command-line arguments: %s", qUtf8Printable(this->arguments().join(", ")));
|
||||
qCDebug(mApp, "Process ID: %s", qUtf8Printable(QString().setNum(this->applicationPid())));
|
||||
|
||||
LoadTranslation(QLocale::system().name());// By default the console version uses system locale
|
||||
LoadTranslation(QLocale().name());// By default the console version uses system locale
|
||||
|
||||
static const char * GENERIC_ICON_TO_CHECK = "document-open";
|
||||
if (QIcon::hasThemeIcon(GENERIC_ICON_TO_CHECK) == false)
|
||||
|
|
|
@ -101,7 +101,7 @@ TMainWindow::TMainWindow(QWidget *parent)
|
|||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale::c());
|
||||
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
|
||||
ui->lineEditFind->setClearButtonEnabled(true);
|
||||
|
@ -476,7 +476,7 @@ void TMainWindow::changeEvent(QEvent *event)
|
|||
{
|
||||
if (event->type() == QEvent::LanguageChange)
|
||||
{
|
||||
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale::c());
|
||||
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
||||
|
||||
// retranslate designer form (single inheritance approach)
|
||||
ui->retranslateUi(this);
|
||||
|
@ -570,7 +570,7 @@ bool TMainWindow::eventFilter(QObject *object, QEvent *event)
|
|||
{
|
||||
if (qApp->Settings()->GetOsSeparator())
|
||||
{
|
||||
plainTextEdit->insertPlainText(QLocale::system().decimalPoint());
|
||||
plainTextEdit->insertPlainText(QLocale().decimalPoint());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -589,7 +589,7 @@ bool TMainWindow::eventFilter(QObject *object, QEvent *event)
|
|||
{
|
||||
if (qApp->Settings()->GetOsSeparator())
|
||||
{
|
||||
textEdit->insert(QLocale::system().decimalPoint());
|
||||
textEdit->insert(QLocale().decimalPoint());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1945,7 +1945,7 @@ void TMainWindow::InitWindow()
|
|||
const qint32 index = ui->comboBoxGender->findData(static_cast<int>(m->Gender()));
|
||||
ui->comboBoxGender->setCurrentIndex(index);
|
||||
|
||||
ui->dateEditBirthDate->setDisplayFormat(QLocale::system().dateFormat());
|
||||
ui->dateEditBirthDate->setDisplayFormat(QLocale().dateFormat());
|
||||
ui->dateEditBirthDate->setDate(m->BirthDate());
|
||||
ui->lineEditEmail->setText(m->Email());
|
||||
|
||||
|
|
|
@ -274,7 +274,7 @@ VApplication::VApplication(int &argc, char **argv)
|
|||
|
||||
// making sure will create new instance...just in case we will ever do 2 objects of VApplication
|
||||
VCommandLine::Reset();
|
||||
LoadTranslation(QLocale::system().name());// By default the console version uses system locale
|
||||
LoadTranslation(QLocale().name());// By default the console version uses system locale
|
||||
VCommandLine::Get(*this);
|
||||
undoStack = new QUndoStack(this);
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ ConfigDialog::ConfigDialog(QWidget *parent) :
|
|||
|
||||
setWindowTitle(tr("Config Dialog"));
|
||||
|
||||
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale::c());
|
||||
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -196,7 +196,7 @@ void ConfigDialog::Apply()
|
|||
communityPage->Apply();
|
||||
pathPage->Apply();
|
||||
|
||||
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale::c());
|
||||
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
||||
emit UpdateProperties();
|
||||
setResult(QDialog::Accepted);
|
||||
}
|
||||
|
|
|
@ -250,7 +250,7 @@ QGroupBox *ConfigurationPage::LangGroup()
|
|||
|
||||
//-------------------- Decimal separator setup
|
||||
separatorLabel = new QLabel(tr("Decimal separator parts:"));
|
||||
osOptionCheck = new QCheckBox(tr("With OS options (%1)").arg(QLocale::system().decimalPoint().toLatin1()));
|
||||
osOptionCheck = new QCheckBox(tr("With OS options (%1)").arg(QLocale().decimalPoint()));
|
||||
osOptionCheck->setChecked(settings->GetOsSeparator());
|
||||
langLayout->addRow(separatorLabel, osOptionCheck);
|
||||
|
||||
|
@ -448,7 +448,7 @@ void ConfigurationPage::RetranslateUi()
|
|||
guiLabel->setText(tr("GUI language:"));
|
||||
|
||||
separatorLabel->setText(tr("Decimal separator parts:"));
|
||||
osOptionCheck->setText(tr("With OS options (%1)").arg(QLocale::system().decimalPoint().toLatin1()));
|
||||
osOptionCheck->setText(tr("With OS options (%1)").arg(QLocale().decimalPoint()));
|
||||
|
||||
unitLabel->setText(tr("Default unit:"));
|
||||
this->unitCombo->setItemText(0, tr("Centimeters"));
|
||||
|
|
|
@ -45,7 +45,7 @@ DialogAboutApp::DialogAboutApp(QWidget *parent) :
|
|||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale::c());
|
||||
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
||||
|
||||
ui->label_Valentina_Version->setText(QString("Valentina %1").arg(APP_VERSION_STR));
|
||||
ui->labelBuildRevision->setText(QString("Build revision: %1").arg(BUILD_REVISION));
|
||||
|
|
|
@ -55,7 +55,7 @@ DialogHistory::DialogHistory(VContainer *data, VPattern *doc, QWidget *parent)
|
|||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale::c());
|
||||
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
||||
|
||||
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||
connect(bOk, &QPushButton::clicked, this, &DialogHistory::DialogAccepted);
|
||||
|
|
|
@ -75,7 +75,7 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
|
|||
formulaBaseHeight = ui->plainTextEditFormula->height();
|
||||
ui->plainTextEditFormula->installEventFilter(this);
|
||||
|
||||
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale::c());
|
||||
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
||||
|
||||
qCDebug(vDialog, "Showing variables.");
|
||||
ShowUnits();
|
||||
|
@ -762,7 +762,7 @@ bool DialogIncrements::eventFilter(QObject *object, QEvent *event)
|
|||
{
|
||||
if (qApp->Settings()->GetOsSeparator())
|
||||
{
|
||||
textEdit->insert(QLocale::system().decimalPoint());
|
||||
textEdit->insert(QLocale().decimalPoint());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -42,7 +42,7 @@ DialogLayoutProgress::DialogLayoutProgress(int count, QWidget *parent)
|
|||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale::c());
|
||||
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
||||
|
||||
ui->progressBar->setMaximum(maxCount);
|
||||
ui->progressBar->setValue(0);
|
||||
|
|
|
@ -60,7 +60,7 @@ DialogLayoutSettings::DialogLayoutSettings(VLayoutGenerator *generator, QWidget
|
|||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale::c());
|
||||
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
||||
|
||||
//moved from ReadSettings - well...it seems it can be done once only (i.e. constructor) because Init funcs dont
|
||||
//even cleanse lists before adding
|
||||
|
|
|
@ -49,7 +49,7 @@ DialogNewPattern::DialogNewPattern(VContainer *data, const QString &patternPiece
|
|||
ui->lineEditName->setClearButtonEnabled(true);
|
||||
#endif
|
||||
|
||||
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale::c());
|
||||
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
||||
|
||||
QRect position = this->frameGeometry();
|
||||
position.moveCenter(QDesktopWidget().availableGeometry().center());
|
||||
|
|
|
@ -71,7 +71,7 @@ DialogPatternProperties::DialogPatternProperties(const QString &filePath, VPatte
|
|||
|
||||
SCASSERT(doc != nullptr)
|
||||
|
||||
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale::c());
|
||||
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
||||
|
||||
if (m_filePath.isEmpty())
|
||||
{
|
||||
|
|
|
@ -46,7 +46,7 @@ DialogPatternXmlEdit::DialogPatternXmlEdit(QWidget *parent, VPattern *xmldoc)
|
|||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale::c());
|
||||
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
||||
|
||||
this->xmlmodel = new VXMLTreeView();
|
||||
this->doc=xmldoc;
|
||||
|
|
|
@ -56,7 +56,7 @@ DialogSaveLayout::DialogSaveLayout(int count, const QString &fileName, QWidget *
|
|||
ui->lineEditFileName->setClearButtonEnabled(true);
|
||||
#endif
|
||||
|
||||
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale::c());
|
||||
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
||||
|
||||
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||
SCASSERT(bOk != nullptr)
|
||||
|
|
|
@ -4016,7 +4016,7 @@ QStringList MainWindow::GetUnlokedRestoreFileList() const
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void MainWindow::WindowsLocale()
|
||||
{
|
||||
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale::c());
|
||||
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -159,7 +159,7 @@ template <typename T>
|
|||
inline QString VAbstractApplication::LocaleToString(const T &value)
|
||||
{
|
||||
QLocale loc;
|
||||
qApp->Settings()->GetOsSeparator() ? loc = QLocale::system() : loc = QLocale::c();
|
||||
qApp->Settings()->GetOsSeparator() ? loc = QLocale() : loc = QLocale::c();
|
||||
return loc.toString(value);
|
||||
}
|
||||
|
||||
|
|
|
@ -263,7 +263,7 @@ void VCommonSettings::SetSendReportState(const bool &value)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VCommonSettings::GetLocale() const
|
||||
{
|
||||
return value(SettingConfigurationLocale, QLocale::system().name()).toString();
|
||||
return value(SettingConfigurationLocale, QLocale().name()).toString();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -90,7 +90,7 @@ VSettings::VSettings(Format format, Scope scope, const QString &organization, co
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VSettings::GetLabelLanguage() const
|
||||
{
|
||||
return value(SettingConfigurationLabelLanguage, QLocale::system().bcp47Name()).toString();
|
||||
return value(SettingConfigurationLabelLanguage, QLocale().bcp47Name()).toString();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -782,14 +782,14 @@ QString VTranslateVars::FormulaFromUser(const QString &formula, bool osSeparator
|
|||
}
|
||||
}
|
||||
|
||||
QLocale loc = QLocale::system(); // User locale
|
||||
QLocale loc = QLocale(); // User locale
|
||||
if (loc != QLocale::c() && osSeparator)
|
||||
{// User want use Os separator
|
||||
QList<int> nKeys = numbers.keys();// Positions for all numbers in expression
|
||||
QList<QString> nValues = numbers.values();
|
||||
for (int i = 0; i < nKeys.size(); ++i)
|
||||
{
|
||||
loc = QLocale::system();// From system locale
|
||||
loc = QLocale();// From system locale
|
||||
bool ok = false;
|
||||
const qreal d = loc.toDouble(nValues.at(i), &ok);
|
||||
if (ok == false)
|
||||
|
@ -919,7 +919,7 @@ QString VTranslateVars::FormulaToUser(const QString &formula, bool osSeparator)
|
|||
}
|
||||
}
|
||||
|
||||
QLocale loc = QLocale::system();// User locale
|
||||
QLocale loc = QLocale();// User locale
|
||||
if (loc != QLocale::C && osSeparator)
|
||||
{// User want use Os separator
|
||||
QList<int> nKeys = numbers.keys();// Positions for all numbers in expression
|
||||
|
@ -935,7 +935,7 @@ QString VTranslateVars::FormulaToUser(const QString &formula, bool osSeparator)
|
|||
continue;//Leave with out translation
|
||||
}
|
||||
|
||||
loc = QLocale::system();// To user locale
|
||||
loc = QLocale();// To user locale
|
||||
QString dStr = loc.toString(d);// Number string in user locale
|
||||
const QChar thSep = loc.groupSeparator();
|
||||
if (thSep.isSpace())
|
||||
|
|
|
@ -166,7 +166,7 @@ bool VPE::VStringProperty::eventFilter(QObject *object, QEvent *event)
|
|||
{
|
||||
if (m_osSeparator)
|
||||
{
|
||||
textEdit->insert(QLocale::system().decimalPoint());
|
||||
textEdit->insert(QLocale().decimalPoint());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -46,7 +46,7 @@ DialogUndo::DialogUndo(QWidget *parent)
|
|||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale::c());
|
||||
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
||||
|
||||
bool opening = qApp->getOpeningPattern();
|
||||
if (opening)
|
||||
|
|
|
@ -363,7 +363,7 @@ bool DialogTool::eventFilter(QObject *object, QEvent *event)
|
|||
{
|
||||
if (qApp->Settings()->GetOsSeparator())
|
||||
{
|
||||
plainTextEdit->insertPlainText(QLocale::system().decimalPoint());
|
||||
plainTextEdit->insertPlainText(QLocale().decimalPoint());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -342,7 +342,7 @@ inline void DialogTool::InitOkCancel(T *ui)
|
|||
SCASSERT(bCancel != nullptr)
|
||||
connect(bCancel, &QPushButton::clicked, this, &DialogTool::DialogRejected);
|
||||
|
||||
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale::c());
|
||||
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue
Block a user