From 6f127035f4ad2cda612f064995cc1a7e35f1a143 Mon Sep 17 00:00:00 2001 From: dismine Date: Wed, 9 Jul 2014 15:35:52 +0300 Subject: [PATCH] Show default unit in dialog individual measurements. --HG-- branch : develop --- .../app/configpages/configurationpage.cpp | 2 +- .../dialogs/app/dialogindividualmeasurements.cpp | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/app/dialogs/app/configpages/configurationpage.cpp b/src/app/dialogs/app/configpages/configurationpage.cpp index e8617ddeb..2a90dd244 100644 --- a/src/app/dialogs/app/configpages/configurationpage.cpp +++ b/src/app/dialogs/app/configpages/configurationpage.cpp @@ -92,7 +92,7 @@ void ConfigurationPage::Apply() QString unit = qvariant_cast(this->unitCombo->itemData(this->unitCombo->currentIndex())); settings.setValue("configuration/unit", unit); this->unitChanged = false; - QString text = QString(tr("Default unit updated and will be used the next pattern load")); + QString text = QString(tr("Default unit updated and will be used the next pattern creation")); QMessageBox::information(this, QApplication::applicationName(), text); } } diff --git a/src/app/dialogs/app/dialogindividualmeasurements.cpp b/src/app/dialogs/app/dialogindividualmeasurements.cpp index abad62366..b9a7ee734 100644 --- a/src/app/dialogs/app/dialogindividualmeasurements.cpp +++ b/src/app/dialogs/app/dialogindividualmeasurements.cpp @@ -248,6 +248,18 @@ void DialogIndividualMeasurements::NewTable() //--------------------------------------------------------------------------------------------------------------------- void DialogIndividualMeasurements::InitUnits() { - ui->comboBoxUnits->addItem(tr("centimeter"), QVariant(VDomDocument::UnitsToStr(Unit::Cm))); - ui->comboBoxUnits->addItem(tr("inch"), QVariant(VDomDocument::UnitsToStr(Unit::Inch))); + QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(), + QApplication::applicationName()); + + ui->comboBoxUnits->addItem(tr("Centimeters"), QVariant(VDomDocument::UnitsToStr(Unit::Cm))); + ui->comboBoxUnits->addItem(tr("Milimiters"), QVariant(VDomDocument::UnitsToStr(Unit::Mm))); + ui->comboBoxUnits->addItem(tr("Inches"), QVariant(VDomDocument::UnitsToStr(Unit::Inch, true))); + + const QString checkedUnit = settings.value("configuration/unit", "cm").toString(); + // set default unit + const qint32 indexUnit = ui->comboBoxUnits->findData(checkedUnit); + if (indexUnit != -1) + { + ui->comboBoxUnits->setCurrentIndex(indexUnit); + } }