diff --git a/src/app/tape/tmainwindow.cpp b/src/app/tape/tmainwindow.cpp index b3106a4f6..342cafa84 100644 --- a/src/app/tape/tmainwindow.cpp +++ b/src/app/tape/tmainwindow.cpp @@ -561,6 +561,8 @@ void TMainWindow::changeEvent(QEvent *event) if (mType == MeasurementsType::Multisize) { + actionFullCircumference->setText(tr("Use full circumference")); + ui->labelMType->setText(tr("Multisize measurements")); InitDimensionsBaseValue(); @@ -1915,6 +1917,14 @@ void TMainWindow::SaveMFullName() } } +//--------------------------------------------------------------------------------------------------------------------- +void TMainWindow::FullCircumferenceChanged(bool checked) +{ + m->SetFullCircumference(checked); + MeasurementsWereSaved(false); + InitDimensionsBaseValue(); +} + //--------------------------------------------------------------------------------------------------------------------- void TMainWindow::SetupMenu() { @@ -2022,6 +2032,7 @@ void TMainWindow::InitWindow() if (mType == MeasurementsType::Multisize) { + InitMenu(); ui->labelMType->setText(tr("Multisize measurements")); InitDimensionsBaseValue(); @@ -2175,13 +2186,29 @@ void TMainWindow::InitWindow() InitTable(); } +//--------------------------------------------------------------------------------------------------------------------- +void TMainWindow::InitMenu() +{ + if (mType == MeasurementsType::Multisize) + { + ui->menuMeasurements->addSeparator(); + + actionFullCircumference = new QAction(tr("Use full circumference"), this); + actionFullCircumference->setCheckable(true); + actionFullCircumference->setChecked(m->IsFullCircumference()); + ui->menuMeasurements->addAction(actionFullCircumference); + connect(actionFullCircumference, &QAction::triggered, this, &TMainWindow::FullCircumferenceChanged); + } +} + //--------------------------------------------------------------------------------------------------------------------- void TMainWindow::InitDimensionsBaseValue() { const QList dimensions = m->Dimensions().values(); const QString unit = UnitsToStr(m->MUnit(), true); + const bool fc = m->IsFullCircumference(); - auto DimensionsBaseValue = [this, dimensions, unit](int index, QLabel *name, QLabel *base) + auto DimensionsBaseValue = [this, dimensions, unit, fc](int index, QLabel *name, QLabel *base) { SCASSERT(name != nullptr) SCASSERT(base != nullptr) @@ -2194,7 +2221,14 @@ void TMainWindow::InitDimensionsBaseValue() if (dimension->IsCircumference() || dimension->Type() == MeasurementDimension::X) { - base->setText(QString("%1 %2").arg(dimension->BaseValue()).arg(unit)); + if (dimension->Type() != MeasurementDimension::X && fc) + { + base->setText(QString("%1 %2").arg(dimension->BaseValue()*2).arg(unit)); + } + else + { + base->setText(QString("%1 %2").arg(dimension->BaseValue()).arg(unit)); + } } else { diff --git a/src/app/tape/tmainwindow.h b/src/app/tape/tmainwindow.h index de44cd2d3..f96367ea4 100644 --- a/src/app/tape/tmainwindow.h +++ b/src/app/tape/tmainwindow.h @@ -127,6 +127,8 @@ private slots: void SaveMDescription(); void SaveMFullName(); + void FullCircumferenceChanged(bool checked); + private: Q_DISABLE_COPY(TMainWindow) Ui::TMainWindow *ui; @@ -150,11 +152,13 @@ private: QLabel *labelPatternUnit; bool isInitialized; bool mIsReadOnly; + QAction *actionFullCircumference{nullptr}; QVector hackedWidgets; void SetupMenu(); void InitWindow(); + void InitMenu(); void InitDimensionsBaseValue(); void InitTable(); void SetDecimals(); diff --git a/src/app/tape/tmainwindow.ui b/src/app/tape/tmainwindow.ui index 511467ada..cd66e0e29 100644 --- a/src/app/tape/tmainwindow.ui +++ b/src/app/tape/tmainwindow.ui @@ -47,7 +47,7 @@ - 1 + 0