From 4cea74d63b895dd2d49d293a1a2113b14f8bf38c Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 15 Oct 2020 18:05:21 +0300 Subject: [PATCH] Loading measurements in Valentina. --- src/app/tape/mapplication.cpp | 2 +- src/app/valentina/core/vapplication.cpp | 6 +- src/app/valentina/core/vapplication.h | 7 +- .../core/vtooloptionspropertybrowser.cpp | 8 +- .../dialogs/dialogfinalmeasurements.cpp | 10 +- .../valentina/dialogs/dialogincrements.cpp | 10 +- .../valentina/dialogs/dialoglayoutscale.cpp | 8 +- .../dialogs/dialogpatternproperties.cpp | 6 +- .../valentina/dialogs/dialogsavelayout.cpp | 8 +- src/app/valentina/dialogs/vwidgetdetails.cpp | 2 +- src/app/valentina/dialogs/vwidgetgroups.cpp | 2 +- src/app/valentina/mainwindow.cpp | 679 ++++++++++++------ src/app/valentina/mainwindow.h | 47 +- src/app/valentina/mainwindowsnogui.cpp | 32 +- src/app/valentina/mainwindowsnogui.h | 5 +- src/app/valentina/xml/vpattern.cpp | 2 +- src/app/valentina/xml/vpattern.h | 2 + src/libs/fervor/fvupdater.cpp | 2 +- src/libs/ifc/xml/vabstractpattern.cpp | 2 +- .../vdxf/libdxfrw/intern/drw_textcodec.cpp | 5 +- src/libs/vformat/vmeasurements.h | 2 +- src/libs/vformat/vpatternrecipe.cpp | 4 +- src/libs/vgeometry/vabstractcurve.cpp | 4 +- src/libs/vgeometry/varc_p.h | 2 +- src/libs/vgeometry/vellipticalarc_p.h | 2 +- src/libs/vgeometry/vspline_p.h | 2 +- src/libs/vlayout/vabstractpiece.cpp | 4 +- src/libs/vlayout/vbank.cpp | 10 +- src/libs/vlayout/vlayoutpiece.cpp | 16 +- src/libs/vlayout/vposter.cpp | 9 +- src/libs/vlayout/vtextmanager.cpp | 8 +- src/libs/vmisc/def.h | 2 +- src/libs/vmisc/dialogs/dialogexporttocsv.cpp | 1 + src/libs/vmisc/testvapplication.h | 1 + src/libs/vmisc/vabstractapplication.cpp | 174 +---- src/libs/vmisc/vabstractapplication.h | 142 +--- src/libs/vmisc/vabstractvalapplication.cpp | 80 +++ src/libs/vmisc/vabstractvalapplication.h | 394 ++++++++++ src/libs/vmisc/vmisc.pri | 2 + src/libs/vpatterndb/variables/vmeasurement.h | 1 + src/libs/vpatterndb/vpassmark.cpp | 22 +- src/libs/vpatterndb/vpiece.cpp | 10 +- src/libs/vpatterndb/vpiecenode.cpp | 12 +- src/libs/vpatterndb/vpiecepath.cpp | 6 +- .../dialogs/support/dialogeditlabel.cpp | 24 +- .../support/dialogeditwrongformula.cpp | 12 +- .../vtools/dialogs/support/dialogundo.cpp | 2 +- .../vtools/dialogs/tools/dialogalongline.cpp | 4 +- src/libs/vtools/dialogs/tools/dialogarc.cpp | 4 +- .../dialogs/tools/dialogarcwithlength.cpp | 8 +- .../vtools/dialogs/tools/dialogbisector.cpp | 4 +- .../vtools/dialogs/tools/dialogcutarc.cpp | 4 +- .../vtools/dialogs/tools/dialogcutspline.cpp | 4 +- .../dialogs/tools/dialogcutsplinepath.cpp | 4 +- .../dialogs/tools/dialogellipticalarc.cpp | 6 +- .../vtools/dialogs/tools/dialogendline.cpp | 4 +- src/libs/vtools/dialogs/tools/dialogmove.cpp | 4 +- .../vtools/dialogs/tools/dialognormal.cpp | 4 +- .../tools/dialogpointfromcircleandtangent.cpp | 4 +- .../dialogs/tools/dialogpointofcontact.cpp | 4 +- .../dialogpointofintersectioncircles.cpp | 8 +- .../dialogs/tools/dialogshoulderpoint.cpp | 4 +- .../vtools/dialogs/tools/dialogspline.cpp | 8 +- .../vtools/dialogs/tools/dialogsplinepath.cpp | 8 +- .../dialogs/tools/piece/dialogpiecepath.cpp | 22 +- .../dialogs/tools/piece/dialogplacelabel.cpp | 12 +- .../tools/piece/dialogseamallowance.cpp | 32 +- .../operation/vabstractoperation.cpp | 2 +- .../tools/drawTools/operation/vtoolmove.cpp | 4 +- .../drawTools/toolcurve/vabstractspline.cpp | 2 +- .../tools/drawTools/toolcurve/vtoolarc.cpp | 4 +- .../toolcurve/vtoolarcwithlength.cpp | 6 +- .../toolcurve/vtoolellipticalarc.cpp | 6 +- .../toolsinglepoint/toolcut/vtoolcut.cpp | 2 +- .../toolsinglepoint/toolcut/vtoolcutarc.cpp | 2 +- .../toolcut/vtoolcutspline.cpp | 2 +- .../toolcut/vtoolcutsplinepath.cpp | 2 +- .../toollinepoint/vtoolalongline.cpp | 2 +- .../toollinepoint/vtoolcurveintersectaxis.cpp | 2 +- .../toollinepoint/vtoolheight.cpp | 2 +- .../toollinepoint/vtoollineintersectaxis.cpp | 4 +- .../toollinepoint/vtoollinepoint.cpp | 4 +- .../toollinepoint/vtoolshoulderpoint.cpp | 2 +- .../toolsinglepoint/vtoollineintersect.cpp | 4 +- .../vtoolpointfromarcandtangent.cpp | 2 +- .../vtoolpointfromcircleandtangent.cpp | 4 +- .../toolsinglepoint/vtoolpointofcontact.cpp | 6 +- .../vtoolpointofintersectionarcs.cpp | 2 +- .../vtoolpointofintersectioncircles.cpp | 6 +- .../vtoolpointofintersectioncurves.cpp | 2 +- .../toolsinglepoint/vtooltriangle.cpp | 2 +- src/libs/vtools/tools/drawTools/vtoolline.cpp | 2 +- src/libs/vtools/tools/vtoolseamallowance.cpp | 2 +- src/libs/vtools/undocommands/addtocalc.cpp | 2 +- .../undocommands/deletepatternpiece.cpp | 2 +- src/libs/vtools/undocommands/deltool.cpp | 2 +- src/libs/vtools/undocommands/movespline.cpp | 2 +- src/libs/vtools/undocommands/movespoint.cpp | 2 +- src/libs/vtools/undocommands/undogroup.cpp | 2 +- .../line/operation/vistoolmove.cpp | 2 +- .../visualization/line/vistoolendline.cpp | 2 +- src/libs/vtools/visualization/visualization.h | 2 +- src/libs/vwidgets/vgraphicssimpletextitem.cpp | 2 +- src/libs/vwidgets/vmaingraphicsview.cpp | 2 +- src/test/ValentinaTest/tst_vpiece.cpp | 4 +- 105 files changed, 1227 insertions(+), 824 deletions(-) create mode 100644 src/libs/vmisc/vabstractvalapplication.cpp create mode 100644 src/libs/vmisc/vabstractvalapplication.h diff --git a/src/app/tape/mapplication.cpp b/src/app/tape/mapplication.cpp index 2773da8ce..f0056eeab 100644 --- a/src/app/tape/mapplication.cpp +++ b/src/app/tape/mapplication.cpp @@ -216,7 +216,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con { if (topWinAllowsPop) { - messageBox.setText(VAbstractApplication::ClearMessage(msg)); + messageBox.setText(msg); messageBox.setStandardButtons(QMessageBox::Ok); messageBox.setWindowModality(Qt::ApplicationModal); messageBox.setModal(true); diff --git a/src/app/valentina/core/vapplication.cpp b/src/app/valentina/core/vapplication.cpp index 4392fd613..e76c3d7ab 100644 --- a/src/app/valentina/core/vapplication.cpp +++ b/src/app/valentina/core/vapplication.cpp @@ -150,7 +150,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con const bool isPatternMessage = qApp->IsPatternMessage(msg); if (isPatternMessage) { - logMsg = logMsg.remove(VAbstractApplication::patternMessageSignature); + logMsg = logMsg.remove(VAbstractValApplication::patternMessageSignature); } { @@ -249,7 +249,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con break; } - messageBox.setText(VAbstractApplication::ClearMessage(logMsg)); + messageBox.setText(VAbstractValApplication::ClearMessage(logMsg)); messageBox.setStandardButtons(QMessageBox::Ok); messageBox.setWindowModality(Qt::ApplicationModal); messageBox.setModal(true); @@ -287,7 +287,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con * @param argv command line. */ VApplication::VApplication(int &argc, char **argv) - : VAbstractApplication(argc, argv), + : VAbstractValApplication(argc, argv), trVars(nullptr), autoSaveTimer(nullptr), lockLog(), diff --git a/src/app/valentina/core/vapplication.h b/src/app/valentina/core/vapplication.h index d01d0f2ab..b025e82b3 100644 --- a/src/app/valentina/core/vapplication.h +++ b/src/app/valentina/core/vapplication.h @@ -29,11 +29,12 @@ #ifndef VAPPLICATION_H #define VAPPLICATION_H -#include "../vmisc/vabstractapplication.h" +#include "../vmisc/vabstractvalapplication.h" #include "../vwidgets/vmaingraphicsview.h" #include "../vpatterndb/vtranslatevars.h" #include "vsettings.h" #include "vcmdexport.h" +#include "vlockguard.h" class VApplication;// use in define @@ -45,7 +46,7 @@ class VApplication;// use in define /** * @brief The VApplication class reimplamentation QApplication class. */ -class VApplication : public VAbstractApplication +class VApplication : public VAbstractValApplication { Q_OBJECT public: @@ -114,7 +115,5 @@ inline void VApplication::setAutoSaveTimer(QTimer *value) { autoSaveTimer = value; } -//--------------------------------------------------------------------------------------------------------------------- - #endif // VAPPLICATION_H diff --git a/src/app/valentina/core/vtooloptionspropertybrowser.cpp b/src/app/valentina/core/vtooloptionspropertybrowser.cpp index 2c8f9bd16..874c154cc 100644 --- a/src/app/valentina/core/vtooloptionspropertybrowser.cpp +++ b/src/app/valentina/core/vtooloptionspropertybrowser.cpp @@ -2318,7 +2318,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolSpline(QGraphicsItem *item) VFormula length1(spl.GetC1LengthFormula(), i->getData()); length1.setCheckZero(false); length1.setToolId(i->getId()); - length1.setPostfix(UnitsToStr(qApp->patternUnit())); + length1.setPostfix(UnitsToStr(qApp->patternUnits())); length1.Eval(); AddPropertyFormula(tr("C1: length:"), length1, AttrLength1); @@ -2332,7 +2332,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolSpline(QGraphicsItem *item) VFormula length2(spl.GetC2LengthFormula(), i->getData()); length2.setCheckZero(false); length2.setToolId(i->getId()); - length2.setPostfix(UnitsToStr(qApp->patternUnit())); + length2.setPostfix(UnitsToStr(qApp->patternUnits())); length2.Eval(); AddPropertyFormula(tr("C2: length:"), length2, AttrLength2); @@ -3046,7 +3046,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSpline() VFormula length1F(spl.GetC1LengthFormula(), i->getData()); length1F.setCheckZero(false); length1F.setToolId(i->getId()); - length1F.setPostfix(UnitsToStr(qApp->patternUnit())); + length1F.setPostfix(UnitsToStr(qApp->patternUnits())); length1F.Eval(); QVariant length1; length1.setValue(length1F); @@ -3064,7 +3064,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSpline() VFormula length2F(spl.GetC2LengthFormula(), i->getData()); length2F.setCheckZero(false); length2F.setToolId(i->getId()); - length2F.setPostfix(UnitsToStr(qApp->patternUnit())); + length2F.setPostfix(UnitsToStr(qApp->patternUnits())); length2F.Eval(); QVariant length2; length2.setValue(length2F); diff --git a/src/app/valentina/dialogs/dialogfinalmeasurements.cpp b/src/app/valentina/dialogs/dialogfinalmeasurements.cpp index eed634d6a..923e22a69 100644 --- a/src/app/valentina/dialogs/dialogfinalmeasurements.cpp +++ b/src/app/valentina/dialogs/dialogfinalmeasurements.cpp @@ -373,7 +373,7 @@ void DialogFinalMeasurements::SaveFormula() { QTableWidgetItem *result = ui->tableWidget->item(row, 1); //Show unit in dialog lable (cm, mm or inch) - const QString postfix = UnitsToStr(qApp->patternUnit()); + const QString postfix = UnitsToStr(qApp->patternUnits()); ui->labelCalculatedValue->setText(result->text() + QChar(QChar::Space) +postfix); return; } @@ -381,7 +381,7 @@ void DialogFinalMeasurements::SaveFormula() if (text.isEmpty()) { //Show unit in dialog lable (cm, mm or inch) - const QString postfix = UnitsToStr(qApp->patternUnit()); + const QString postfix = UnitsToStr(qApp->patternUnits()); ui->labelCalculatedValue->setText(tr("Error") + " (" + postfix + "). " + tr("Empty field.")); return; } @@ -455,7 +455,7 @@ void DialogFinalMeasurements::Fx() dialog->setWindowTitle(tr("Edit measurement")); dialog->SetFormula(qApp->TrVars()->TryFormulaFromUser(ui->plainTextEditFormula->toPlainText(), qApp->Settings()->GetOsSeparator())); - const QString postfix = UnitsToStr(qApp->patternUnit(), true); + const QString postfix = UnitsToStr(qApp->patternUnits(), true); dialog->setPostfix(postfix);//Show unit in dialog lable (cm, mm or inch) if (dialog->exec() == QDialog::Accepted) @@ -513,7 +513,7 @@ void DialogFinalMeasurements::FillFinalMeasurements(bool freshCall) //--------------------------------------------------------------------------------------------------------------------- void DialogFinalMeasurements::ShowUnits() { - const QString unit = UnitsToStr(qApp->patternUnit()); + const QString unit = UnitsToStr(qApp->patternUnits()); { // calculated value @@ -554,7 +554,7 @@ void DialogFinalMeasurements::AddCell(const QString &text, int row, int column, //--------------------------------------------------------------------------------------------------------------------- bool DialogFinalMeasurements::EvalUserFormula(const QString &formula, bool fromUser) { - const QString postfix = UnitsToStr(qApp->patternUnit());//Show unit in dialog lable (cm, mm or inch) + const QString postfix = UnitsToStr(qApp->patternUnits());//Show unit in dialog lable (cm, mm or inch) if (formula.isEmpty()) { ui->labelCalculatedValue->setText(tr("Error") + " (" + postfix + "). " + tr("Empty field.")); diff --git a/src/app/valentina/dialogs/dialogincrements.cpp b/src/app/valentina/dialogs/dialogincrements.cpp index 890452cb4..da7c69478 100644 --- a/src/app/valentina/dialogs/dialogincrements.cpp +++ b/src/app/valentina/dialogs/dialogincrements.cpp @@ -268,7 +268,7 @@ void DialogIncrements::FillAnglesCurves() //--------------------------------------------------------------------------------------------------------------------- void DialogIncrements::ShowUnits() { - const QString unit = UnitsToStr(qApp->patternUnit()); + const QString unit = UnitsToStr(qApp->patternUnits()); ShowHeaderUnits(ui->tableWidgetIncrement, 1, unit);// calculated value ShowHeaderUnits(ui->tableWidgetIncrement, 2, unit);// formula @@ -361,7 +361,7 @@ QString DialogIncrements::ClearIncrementName(const QString &name) const //--------------------------------------------------------------------------------------------------------------------- bool DialogIncrements::EvalIncrementFormula(const QString &formula, bool fromUser, VContainer *data, QLabel *label) { - const QString postfix = UnitsToStr(qApp->patternUnit());//Show unit in dialog lable (cm, mm or inch) + const QString postfix = UnitsToStr(qApp->patternUnits());//Show unit in dialog lable (cm, mm or inch) if (formula.isEmpty()) { label->setText(tr("Error") + " (" + postfix + "). " + tr("Empty field.")); @@ -1228,7 +1228,7 @@ void DialogIncrements::SaveIncrFormula() { QTableWidgetItem *result = table->item(row, 1); //Show unit in dialog lable (cm, mm or inch) - const QString postfix = UnitsToStr(qApp->patternUnit()); + const QString postfix = UnitsToStr(qApp->patternUnits()); labelCalculatedValue->setText(result->text() + QChar(QChar::Space) +postfix); return; } @@ -1236,7 +1236,7 @@ void DialogIncrements::SaveIncrFormula() if (text.isEmpty()) { //Show unit in dialog lable (cm, mm or inch) - const QString postfix = UnitsToStr(qApp->patternUnit()); + const QString postfix = UnitsToStr(qApp->patternUnits()); labelCalculatedValue->setText(tr("Error") + " (" + postfix + "). " + tr("Empty field.")); return; } @@ -1374,7 +1374,7 @@ void DialogIncrements::Fx() dialog->SetFormula(qApp->TrVars()->TryFormulaFromUser(plainTextEditFormula->toPlainText(), qApp->Settings()->GetOsSeparator())); - const QString postfix = UnitsToStr(qApp->patternUnit(), true); + const QString postfix = UnitsToStr(qApp->patternUnits(), true); dialog->setPostfix(postfix);//Show unit in dialog lable (cm, mm or inch) if (dialog->exec() == QDialog::Accepted) diff --git a/src/app/valentina/dialogs/dialoglayoutscale.cpp b/src/app/valentina/dialogs/dialoglayoutscale.cpp index 256c66f14..e2d374a9b 100644 --- a/src/app/valentina/dialogs/dialoglayoutscale.cpp +++ b/src/app/valentina/dialogs/dialoglayoutscale.cpp @@ -71,7 +71,7 @@ DialogLayoutScale::~DialogLayoutScale() void DialogLayoutScale::SetTiledMargins(QMarginsF margins) { // read Margins top, right, bottom, left - margins = UnitConvertor(margins, Unit::Mm, qApp->patternUnit()); + margins = UnitConvertor(margins, Unit::Mm, qApp->patternUnits()); ui->doubleSpinBoxLeftField->setValue(margins.left()); ui->doubleSpinBoxTopField->setValue(margins.top()); @@ -89,7 +89,7 @@ QMarginsF DialogLayoutScale::GetTiledMargins() const ui->doubleSpinBoxBottomField->value() ); - return UnitConvertor(margins, qApp->patternUnit(), Unit::Mm); + return UnitConvertor(margins, qApp->patternUnits(), Unit::Mm); } //--------------------------------------------------------------------------------------------------------------------- @@ -181,7 +181,7 @@ void DialogLayoutScale::VerticalScaleChanged(double d) void DialogLayoutScale::ReadSettings() { VSettings *settings = qApp->ValentinaSettings(); - const Unit unit = qApp->patternUnit(); + const Unit unit = qApp->patternUnits(); // read Margins top, right, bottom, left const QMarginsF margins = settings->GetTiledPDFMargins(unit); @@ -201,7 +201,7 @@ void DialogLayoutScale::ReadSettings() void DialogLayoutScale::WriteSettings() const { VSettings *settings = qApp->ValentinaSettings(); - const Unit unit = qApp->patternUnit(); + const Unit unit = qApp->patternUnits(); // write Margins top, right, bottom, left QMarginsF margins = QMarginsF( diff --git a/src/app/valentina/dialogs/dialogpatternproperties.cpp b/src/app/valentina/dialogs/dialogpatternproperties.cpp index a4a70120a..068d20550 100644 --- a/src/app/valentina/dialogs/dialogpatternproperties.cpp +++ b/src/app/valentina/dialogs/dialogpatternproperties.cpp @@ -140,7 +140,7 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pat connect(bCancel, &QPushButton::clicked, this, &DialogPatternProperties::close); ui->tabWidget->setCurrentIndex(0); - if (qApp->patternType() != MeasurementsType::Multisize) + if (qApp->GetMeasurementsType() != MeasurementsType::Multisize) { ui->tabWidget->setTabEnabled(1, false); } @@ -198,7 +198,7 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pat ui->lineEditPatternNumber->setText(doc->GetPatternNumber()); ui->lineEditCompanyName->setText(doc->GetCompanyName()); - if (qApp->patternType() == MeasurementsType::Individual) + if (qApp->GetMeasurementsType() == MeasurementsType::Individual) { ui->lineEditCustomerName->setText(qApp->GetCustomerName()); ui->lineEditCustomerName->setReadOnly(true); @@ -629,7 +629,7 @@ void DialogPatternProperties::SaveLabelData() doc->SetPatternName(ui->lineEditPatternName->text()); doc->SetPatternNumber(ui->lineEditPatternNumber->text()); doc->SetCompanyName(ui->lineEditCompanyName->text()); - if (qApp->patternType() != MeasurementsType::Individual) + if (qApp->GetMeasurementsType() != MeasurementsType::Individual) { doc->SetCustomerName(ui->lineEditCustomerName->text()); } diff --git a/src/app/valentina/dialogs/dialogsavelayout.cpp b/src/app/valentina/dialogs/dialogsavelayout.cpp index c17f43f19..af2a962c9 100644 --- a/src/app/valentina/dialogs/dialogsavelayout.cpp +++ b/src/app/valentina/dialogs/dialogsavelayout.cpp @@ -676,7 +676,7 @@ void DialogSaveLayout::SetTiledExportMode(bool tiledExportMode) void DialogSaveLayout::SetTiledMargins(QMarginsF margins) { // read Margins top, right, bottom, left - margins = UnitConvertor(margins, Unit::Mm, qApp->patternUnit()); + margins = UnitConvertor(margins, Unit::Mm, qApp->patternUnits()); ui->doubleSpinBoxLeftField->setValue(margins.left()); ui->doubleSpinBoxTopField->setValue(margins.top()); @@ -694,7 +694,7 @@ QMarginsF DialogSaveLayout::GetTiledMargins() const ui->doubleSpinBoxBottomField->value() ); - return UnitConvertor(margins, qApp->patternUnit(), Unit::Mm); + return UnitConvertor(margins, qApp->patternUnits(), Unit::Mm); } //--------------------------------------------------------------------------------------------------------------------- @@ -892,7 +892,7 @@ void DialogSaveLayout::RemoveFormatFromList(LayoutExportFormats format) void DialogSaveLayout::ReadSettings() { VSettings *settings = qApp->ValentinaSettings(); - const Unit unit = qApp->patternUnit(); + const Unit unit = qApp->patternUnits(); // read Margins top, right, bottom, left const QMarginsF margins = settings->GetTiledPDFMargins(unit); @@ -946,7 +946,7 @@ void DialogSaveLayout::WriteSettings() const } VSettings *settings = qApp->ValentinaSettings(); - const Unit unit = qApp->patternUnit(); + const Unit unit = qApp->patternUnits(); // write Margins top, right, bottom, left QMarginsF margins = QMarginsF( diff --git a/src/app/valentina/dialogs/vwidgetdetails.cpp b/src/app/valentina/dialogs/vwidgetdetails.cpp index 084ababfa..609d533a9 100644 --- a/src/app/valentina/dialogs/vwidgetdetails.cpp +++ b/src/app/valentina/dialogs/vwidgetdetails.cpp @@ -297,7 +297,7 @@ void VWidgetDetails::ShowContextMenu(const QPoint &pos) catch (const VExceptionBadId &) { const QString errorMsg = tr("Cannot find piece by id '%1'").arg(id); - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; } } diff --git a/src/app/valentina/dialogs/vwidgetgroups.cpp b/src/app/valentina/dialogs/vwidgetgroups.cpp index 827bf5ee2..af6bb0c5a 100644 --- a/src/app/valentina/dialogs/vwidgetgroups.cpp +++ b/src/app/valentina/dialogs/vwidgetgroups.cpp @@ -230,7 +230,7 @@ void VWidgetGroups::CtxMenu(const QPoint &pos) } else if (selectedAction == actionPreferences) { - QScopedPointer fackeContainer(new VContainer(qApp->TrVars(), qApp->patternUnitP(), + QScopedPointer fackeContainer(new VContainer(qApp->TrVars(), qApp->patternUnitsP(), VContainer::UniqueNamespace())); QScopedPointer dialog(new DialogGroup(fackeContainer.data(), NULL_ID, this)); dialog->SetName(doc->GetGroupName(id)); diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index e3651d4ec..7297708f8 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -173,7 +173,7 @@ void WarningNotUniquePieceName(const QHash *allDetails) { const QString errorMsg = QObject::tr("Piece name '%1' is not unique.").arg(pieceName); qApp->IsPedantic() ? throw VException(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; } ++i; @@ -200,23 +200,20 @@ MainWindow::MainWindow(QWidget *parent) currentDrawIndex(0), currentToolBoxIndex(0), drawMode(true), leftGoToStage(nullptr), rightGoToStage(nullptr), autoSaveTimer(nullptr), guiEnabled(true), - gradationHeights(nullptr), - gradationSizes(nullptr), - gradationHeightsLabel(nullptr), - gradationSizesLabel(nullptr), - zoomScale(nullptr), - doubleSpinBoxScale(nullptr), toolOptions(nullptr), groupsWidget(nullptr), detailsWidget(nullptr), lock(nullptr), toolButtonPointerList(), m_progressBar(new QProgressBar(this)), - m_statusLabel(new QLabel(this)) + m_statusLabel(new QLabel(this)), + m_gradation(new QTimer(this)) { CreateActions(); InitScenes(); + connect(m_gradation, &QTimer::timeout, this, &MainWindow::GradationChanged); + doc = new VPattern(pattern, sceneDraw, sceneDetails); connect(doc, &VPattern::ClearMainWindow, this, &MainWindow::Clear); connect(doc, &VPattern::patternChanged, this, &MainWindow::PatternChangesWereSaved); @@ -510,33 +507,33 @@ void MainWindow::InitScenes() //--------------------------------------------------------------------------------------------------------------------- bool MainWindow::LoadMeasurements(const QString &path) { - QSharedPointer m = OpenMeasurementFile(path); + m = OpenMeasurementFile(path); if (m->isNull()) { return false; } - if (qApp->patternUnit() == Unit::Inch && m->Type() == MeasurementsType::Multisize) - { - qWarning()<DimensionABase(), m->MUnit(), *m->GetData()->GetPatternUnit()); - const qreal height = UnitConvertor(m->DimensionBBase(), m->MUnit(), *m->GetData()->GetPatternUnit()); - try { - qApp->setPatternType(m->Type()); + qApp->SetMeasurementsType(m->Type()); if (m->Type() == MeasurementsType::Individual) { qApp->SetCustomerName(m->Customer()); + qApp->SetCustomerBirthDate(m->BirthDate()); + qApp->SetCustomerEmail(m->Email()); + } + else if (m->Type() == MeasurementsType::Multisize) + { + m_currentDimensionA = m->DimensionABase(); + m_currentDimensionB = m->DimensionBBase(); + m_currentDimensionC = m->DimensionCBase(); } ToolBarOption(); + SetDimensionBases(); pattern->ClearVariables(VarType::Measurement); m->StoreNames(false); - m->ReadMeasurements(height, size); + m->ReadMeasurements(m_currentDimensionA, m_currentDimensionB, m_currentDimensionC); } catch (VExceptionEmptyParameter &e) { @@ -551,31 +548,33 @@ bool MainWindow::LoadMeasurements(const QString &path) if (m->Type() == MeasurementsType::Multisize) { - pattern->SetSize(size); - pattern->SetHeight(height); + StoreMultisizeMDimensions(); doc->SetPatternWasChanged(true); emit doc->UpdatePatternLabel(); } else if (m->Type() == MeasurementsType::Individual) { - SetSizeHeightForIndividualM(); + StoreIndividualMDimensions(); + + doc->SetPatternWasChanged(true); + emit doc->UpdatePatternLabel(); } return true; } //--------------------------------------------------------------------------------------------------------------------- -bool MainWindow::UpdateMeasurements(const QString &path, int size, int height) +bool MainWindow::UpdateMeasurements(const QString &path, int baseA, int baseB, int baseC) { - QSharedPointer m = OpenMeasurementFile(path); + m = OpenMeasurementFile(path); if (m->isNull()) { return false; } - if (qApp->patternType() != m->Type()) + if (qApp->GetMeasurementsType() != m->Type()) { qCCritical(vMainWindow, "%s", qUtf8Printable(tr("Measurement files types have not match."))); if (not VApplication::IsGUIMode()) @@ -589,10 +588,12 @@ bool MainWindow::UpdateMeasurements(const QString &path, int size, int height) { pattern->ClearVariables(VarType::Measurement); m->StoreNames(false); - m->ReadMeasurements(height, size); + m->ReadMeasurements(baseA, baseB, baseC); if (m->Type() == MeasurementsType::Individual) { qApp->SetCustomerName(m->Customer()); + qApp->SetCustomerBirthDate(m->BirthDate()); + qApp->SetCustomerEmail(m->Email()); } } catch (VExceptionEmptyParameter &e) @@ -608,15 +609,17 @@ bool MainWindow::UpdateMeasurements(const QString &path, int size, int height) if (m->Type() == MeasurementsType::Multisize) { - pattern->SetSize(size); - pattern->SetHeight(height); + StoreMultisizeMDimensions(); doc->SetPatternWasChanged(true); emit doc->UpdatePatternLabel(); } else if (m->Type() == MeasurementsType::Individual) { - SetSizeHeightForIndividualM(); + StoreIndividualMDimensions(); + + doc->SetPatternWasChanged(true); + emit doc->UpdatePatternLabel(); } return true; @@ -1570,6 +1573,8 @@ void MainWindow::changeEvent(QEvent *event) ui->dockWidgetGroups->setToolTip(tr("Show which details will go in layout")); } + ToolBarOption(); + UpdateWindowTitle(); emit sceneDetails->LanguageChanged(); } @@ -1792,14 +1797,14 @@ void MainWindow::LoadMultisize() if (not mPath.isEmpty()) { QString hText; - if (not gradationHeights.isNull()) + if (not dimensionA.isNull()) { - hText = gradationHeights->currentText(); + hText = dimensionA->currentText(); } QString sText; - if (not gradationSizes.isNull()) + if (not dimensionB.isNull()) { - sText = gradationSizes->currentText(); + sText = dimensionB->currentText(); } if(LoadMeasurements(mPath)) @@ -1818,16 +1823,16 @@ void MainWindow::LoadMultisize() UpdateWindowTitle(); - if (qApp->patternType() == MeasurementsType::Multisize) + if (qApp->GetMeasurementsType() == MeasurementsType::Multisize) { - if (not hText.isEmpty() && not gradationHeights.isNull()) + if (not hText.isEmpty() && not dimensionA.isNull()) { - gradationHeights->setCurrentText(hText); + dimensionA->setCurrentText(hText); } - if (not sText.isEmpty() && not gradationSizes.isNull()) + if (not sText.isEmpty() && not dimensionB.isNull()) { - gradationSizes->setCurrentText(sText); + dimensionB->setCurrentText(sText); } } } @@ -1846,11 +1851,35 @@ void MainWindow::UnloadMeasurements() if (doc->ListMeasurements().isEmpty()) { watcher->removePath(AbsoluteMPath(qApp->GetPatternPath(), doc->MPath())); - if (qApp->patternType() == MeasurementsType::Multisize) + + const MeasurementsType oldType = qApp->GetMeasurementsType(); + qApp->SetMeasurementsType(MeasurementsType::Unknown); + + m.clear(); + + if (oldType == MeasurementsType::Multisize) { + m_currentDimensionA = 0; + m_currentDimensionB = 0; + m_currentDimensionC = 0; + ToolBarOption(); } - qApp->setPatternType(MeasurementsType::Unknown); + else if (oldType == MeasurementsType::Individual) + { + qApp->SetCustomerBirthDate(QDate()); + qApp->SetCustomerEmail(QString()); + qApp->SetCustomerName(QString()); + + qApp->SetDimensionHeight(0); + qApp->SetDimensionSize(0); + qApp->SetDimensionHip(0); + qApp->SetDimensionWaist(0); + + qApp->SetMeasurementsUnits(Unit::LAST_UNIT_DO_NOT_USE); + qApp->SetDimensionSizeUnits(Unit::LAST_UNIT_DO_NOT_USE); + } + doc->SetMPath(QString()); emit doc->UpdatePatternLabel(); PatternChangesWereSaved(false); @@ -1875,12 +1904,12 @@ void MainWindow::ShowMeasurements() const QString absoluteMPath = AbsoluteMPath(qApp->GetPatternPath(), doc->MPath()); QStringList arguments; - if (qApp->patternType() == MeasurementsType::Multisize) + if (qApp->GetMeasurementsType() == MeasurementsType::Multisize) { arguments = QStringList() << absoluteMPath << "-u" - << UnitsToStr(qApp->patternUnit()) + << UnitsToStr(qApp->patternUnits()) << "-e" << QString().setNum(static_cast(UnitConvertor(pattern->height(), doc->MUnit(), Unit::Cm))) << "-s" @@ -1890,7 +1919,7 @@ void MainWindow::ShowMeasurements() { arguments = QStringList() << absoluteMPath << "-u" - << UnitsToStr(qApp->patternUnit()); + << UnitsToStr(qApp->patternUnits()); } if (isNoScaling) @@ -1945,7 +1974,7 @@ void MainWindow::SyncMeasurements() if (mChanges) { const QString path = AbsoluteMPath(qApp->GetPatternPath(), doc->MPath()); - if(UpdateMeasurements(path, static_cast(pattern->size()), static_cast(pattern->height()))) + if(UpdateMeasurements(path, m_currentDimensionA, m_currentDimensionB, m_currentDimensionC)) { if (not watcher->files().contains(path)) { @@ -2031,6 +2060,150 @@ void MainWindow::CleanWaterkmarkEditors() } } +//--------------------------------------------------------------------------------------------------------------------- +void MainWindow::StoreMultisizeMDimensions() +{ + qApp->SetMeasurementsUnits(m->MUnit()); + + QList dimensions = m->Dimensions().values(); + + auto StoreDimension = [this, dimensions](int index, int currentBase) + { + if (dimensions.size() > index) + { + MeasurementDimension_p dimension = dimensions.at(index); + + switch(dimension->Type()) + { + case MeasurementDimension::X: + qApp->SetDimensionHeight(currentBase); + break; + case MeasurementDimension::Y: + { + const bool fc = m->IsFullCircumference(); + qApp->SetDimensionSize(fc ? currentBase*2 : currentBase); + const bool circumference = dimension->IsCircumference(); + qApp->SetDimensionSizeUnits(circumference ? m->MUnit() : Unit::LAST_UNIT_DO_NOT_USE); + break; + } + case MeasurementDimension::W: + Q_FALLTHROUGH(); + case MeasurementDimension::Z: + { + const bool fc = m->IsFullCircumference(); + qApp->SetDimensionSize(fc ? currentBase*2 : currentBase); + break; + } + default: + break; + } + } + }; + + StoreDimension(0, m_currentDimensionA); + StoreDimension(1, m_currentDimensionB); + StoreDimension(2, m_currentDimensionC); +} + +//--------------------------------------------------------------------------------------------------------------------- +void MainWindow::StoreIndividualMDimensions() +{ + QMap > measurements = pattern->DataMeasurements(); + + auto StoreDimension = [this, measurements](IMD type) + { + const QString name = m->MeasurementForDimension(type); + if (not name.isEmpty() && measurements.contains(name)) + { + switch(type) + { + case IMD::X: + qApp->SetDimensionHeight(*measurements.value(name)->GetValue()); + break; + case IMD::Y: + qApp->SetDimensionSize(*measurements.value(name)->GetValue()); + break; + case IMD::W: + qApp->SetDimensionHip(*measurements.value(name)->GetValue()); + break; + case IMD::Z: + qApp->SetDimensionWaist(*measurements.value(name)->GetValue()); + break; + case IMD::N: + default: + break; + } + } + }; + + StoreDimension(IMD::X); + StoreDimension(IMD::Y); + StoreDimension(IMD::W); + StoreDimension(IMD::Z); +} + +//--------------------------------------------------------------------------------------------------------------------- +QVector MainWindow::DimensionRestrictedValues(int index, const MeasurementDimension_p &dimension) +{ + QPair restriction; + + if (index == 0) + { + return dimension->ValidBases(); + } + else if (index == 1) + { + restriction = m->Restriction(m_currentDimensionA); + } + else + { + restriction = m->Restriction(m_currentDimensionA, m_currentDimensionB); + } + + const QVector bases = dimension->ValidBases(); + + int min = bases.indexOf(restriction.first) != -1 ? restriction.first : dimension->MinValue(); + int max = bases.indexOf(restriction.second) != -1 ? restriction.second : dimension->MaxValue(); + + if (min > max) + { + min = dimension->MinValue(); + max = dimension->MaxValue(); + } + + return VAbstartMeasurementDimension::ValidBases(min, max, dimension->Step()); +} + +//--------------------------------------------------------------------------------------------------------------------- +void MainWindow::SetDimensionBases() +{ + const QList dimensions = m->Dimensions().values(); + + auto SetBase = [dimensions](int index, QPointer control, int &value) + { + if (dimensions.size() > index) + { + SCASSERT(control != nullptr) + + MeasurementDimension_p dimension = dimensions.at(index); + + const qint32 i = control->findData(value); + if (i != -1) + { + control->setCurrentIndex(i); + } + else + { + value = control->currentData().toInt(); + } + } + }; + + SetBase(0, dimensionA, m_currentDimensionA); + SetBase(1, dimensionB, m_currentDimensionB); + SetBase(2, dimensionC, m_currentDimensionC); +} + //--------------------------------------------------------------------------------------------------------------------- #if defined(Q_OS_MAC) void MainWindow::OpenAt(QAction *where) @@ -2053,22 +2226,7 @@ void MainWindow::OpenAt(QAction *where) void MainWindow::ToolBarOption() { ui->toolBarOption->clear(); - if (not gradationHeights.isNull()) - { - delete gradationHeights; - } - if (not gradationSizes.isNull()) - { - delete gradationSizes; - } - if (not gradationHeightsLabel.isNull()) - { - delete gradationHeightsLabel; - } - if (not gradationSizesLabel.isNull()) - { - delete gradationSizesLabel; - } + if (not zoomScale.isNull()) { delete zoomScale; @@ -2078,32 +2236,18 @@ void MainWindow::ToolBarOption() delete doubleSpinBoxScale; } - if (qApp->patternType() == MeasurementsType::Multisize) + if (not m_mouseCoordinate.isNull()) { - const QStringList listHeights = VMeasurement::ListHeights(doc->GetGradationHeights(), qApp->patternUnit()); - const QStringList listSizes = VMeasurement::ListSizes(doc->GetGradationSizes(), qApp->patternUnit()); - - gradationHeightsLabel = new QLabel(tr("Height:"), this); - gradationHeights = SetGradationList(gradationHeightsLabel, listHeights); - - // set default height - SetDefaultHeight(); - - connect(gradationHeights.data(), &QComboBox::currentTextChanged, - this, &MainWindow::ChangedHeight); - - gradationSizesLabel = new QLabel(tr("Size:"), this); - gradationSizes = SetGradationList(gradationSizesLabel, listSizes); - - // set default size - SetDefaultSize(); - - connect(gradationSizes.data(), &QComboBox::currentTextChanged, - this, &MainWindow::ChangedSize); - - ui->toolBarOption->addSeparator(); + delete m_mouseCoordinate; } + if (not m_unreadPatternMessage.isNull()) + { + delete m_unreadPatternMessage; + } + + InitDimensionControls(); + zoomScale = new QLabel(tr("Scale:"), this); ui->toolBarOption->addWidget(zoomScale); @@ -2111,13 +2255,13 @@ void MainWindow::ToolBarOption() doubleSpinBoxScale->setDecimals(1); doubleSpinBoxScale->setSuffix("%"); ScaleChanged(ui->view->transform().m11()); - connect(doubleSpinBoxScale.data(), QOverload::of(&QDoubleSpinBox::valueChanged), + connect(doubleSpinBoxScale, QOverload::of(&QDoubleSpinBox::valueChanged), this, [this](double d){ui->view->Zoom(d/100.0);}); ui->toolBarOption->addWidget(doubleSpinBoxScale); ui->toolBarOption->addSeparator(); - m_mouseCoordinate = new QLabel(QString("0, 0 (%1)").arg(UnitsToStr(qApp->patternUnit(), true))); + m_mouseCoordinate = new QLabel(QString("0, 0 (%1)").arg(UnitsToStr(qApp->patternUnits(), true))); ui->toolBarOption->addWidget(m_mouseCoordinate); ui->toolBarOption->addSeparator(); @@ -2125,18 +2269,6 @@ void MainWindow::ToolBarOption() ui->toolBarOption->addWidget(m_unreadPatternMessage); } -//--------------------------------------------------------------------------------------------------------------------- -QComboBox *MainWindow::SetGradationList(QLabel *label, const QStringList &list) -{ - ui->toolBarOption->addWidget(label); - - QComboBox *comboBox = new QComboBox(this); - comboBox->addItems(list); - ui->toolBarOption->addWidget(comboBox); - - return comboBox; -} - //--------------------------------------------------------------------------------------------------------------------- void MainWindow::ToolBarStages() { @@ -2363,7 +2495,7 @@ void MainWindow::MouseMove(const QPointF &scenePos) m_mouseCoordinate->setText(QStringLiteral("%1, %2 (%3)") .arg(static_cast(qApp->fromPixel(scenePos.x()))) .arg(static_cast(qApp->fromPixel(scenePos.y()))) - .arg(UnitsToStr(qApp->patternUnit(), true))); + .arg(UnitsToStr(qApp->patternUnits(), true))); } } @@ -2714,7 +2846,7 @@ void MainWindow::ActionDraw(bool checked) SetEnableWidgets(true); ui->toolBox->setCurrentIndex(currentToolBoxIndex); - if (qApp->patternType() == MeasurementsType::Multisize) + if (qApp->GetMeasurementsType() == MeasurementsType::Multisize) { ui->toolBarOption->setVisible(true); } @@ -2789,7 +2921,7 @@ void MainWindow::ActionDetails(bool checked) SetEnableWidgets(true); ui->toolBox->setCurrentIndex(ui->toolBox->indexOf(ui->detailPage)); - if (qApp->patternType() == MeasurementsType::Multisize) + if (qApp->GetMeasurementsType() == MeasurementsType::Multisize) { ui->toolBarOption->setVisible(true); } @@ -2904,7 +3036,7 @@ void MainWindow::ActionLayout(bool checked) m_mouseCoordinate->setText(QString()); } - if (qApp->patternType() == MeasurementsType::Multisize) + if (qApp->GetMeasurementsType() == MeasurementsType::Multisize) { ui->toolBarOption->setVisible(false); } @@ -3227,8 +3359,8 @@ void MainWindow::Clear() ui->actionPreviousPatternPiece->setEnabled(false); ui->actionNextPatternPiece->setEnabled(false); SetEnableTool(false); - qApp->setPatternUnit(Unit::Cm); - qApp->setPatternType(MeasurementsType::Unknown); + qApp->SetPatternUnits(Unit::Cm); + qApp->SetMeasurementsType(MeasurementsType::Unknown); ui->toolBarOption->clear(); #ifndef QT_NO_CURSOR QGuiApplication::restoreOverrideCursor(); @@ -3626,56 +3758,6 @@ void MainWindow::SetEnableWidgets(bool enable) ui->view->setEnabled(enable); } -//--------------------------------------------------------------------------------------------------------------------- -void MainWindow::UpdateHeightsList(const QStringList &list) -{ - QString val; - if (gradationHeights->currentIndex() != -1) - { - val = gradationHeights->currentText(); - } - - gradationHeights->blockSignals(true); - gradationHeights->clear(); - gradationHeights->addItems(list); - gradationHeights->blockSignals(false); - - int index = gradationHeights->findText(val); - if (index != -1) - { - gradationHeights->setCurrentIndex(index); - } - else - { - ChangedHeight(list.at(0)); - } -} - -//--------------------------------------------------------------------------------------------------------------------- -void MainWindow::UpdateSizesList(const QStringList &list) -{ - QString val; - if (gradationSizes->currentIndex() != -1) - { - val = gradationSizes->currentText(); - } - - gradationSizes->blockSignals(true); - gradationSizes->clear(); - gradationSizes->addItems(list); - gradationSizes->blockSignals(false); - - int index = gradationSizes->findText(val); - if (index != -1) - { - gradationSizes->setCurrentIndex(index); - } - else - { - ChangedSize(list.at(0)); - } -} - //--------------------------------------------------------------------------------------------------------------------- /** * @brief on_actionNew_triggered create new empty pattern. @@ -3693,7 +3775,7 @@ void MainWindow::on_actionNew_triggered() if (newPattern.exec() == QDialog::Accepted) { patternPieceName = newPattern.name(); - qApp->setPatternUnit(newPattern.PatternUnit()); + qApp->SetPatternUnits(newPattern.PatternUnit()); qCDebug(vMainWindow, "PP name: %s", qUtf8Printable(patternPieceName)); } else @@ -3708,7 +3790,7 @@ void MainWindow::on_actionNew_triggered() AddPP(patternPieceName); - m_mouseCoordinate = new QLabel(QString("0, 0 (%1)").arg(UnitsToStr(qApp->patternUnit(), true))); + m_mouseCoordinate = new QLabel(QString("0, 0 (%1)").arg(UnitsToStr(qApp->patternUnits(), true))); ui->toolBarOption->addWidget(m_mouseCoordinate); m_curFileFormatVersion = VPatternConverter::PatternMaxVer; @@ -3739,45 +3821,55 @@ void MainWindow::PatternChangesWereSaved(bool saved) } //--------------------------------------------------------------------------------------------------------------------- -/** - * @brief ChangedSize change new size value. - * @param text value size. - */ -void MainWindow::ChangedSize(const QString & text) +void MainWindow::DimensionABaseChanged() { - const int size = static_cast(pattern->size()); - if (UpdateMeasurements(AbsoluteMPath(qApp->GetPatternPath(), doc->MPath()), text.toInt(), - static_cast(pattern->height()))) - { - doc->LiteParseTree(Document::FullLiteParse); - emit sceneDetails->DimensionsChanged(); - } - else - { - qCWarning(vMainWindow, "%s", qUtf8Printable(tr("Couldn't update measurements."))); + m_currentDimensionA = dimensionA->currentData().toInt(); - const qint32 index = gradationSizes->findText(QString().setNum(size)); - if (index != -1) + const QList dimensions = m->Dimensions().values(); + if (dimensions.size() > 1) + { + MeasurementDimension_p dimension = dimensions.at(1); + InitDimensionGradation(1, dimension, dimensionB); + + if (dimensions.size() > 2) { - gradationSizes->setCurrentIndex(index); - } - else - { - qCDebug(vMainWindow, "Couldn't restore size value."); + dimension = dimensions.at(2); + InitDimensionGradation(2, dimension, dimensionC); } } + + m_gradation->start(); } //--------------------------------------------------------------------------------------------------------------------- -/** - * @brief ChangedGrowth change new height value. - * @param text value height. - */ -void MainWindow::ChangedHeight(const QString &text) +void MainWindow::DimensionBBaseChanged() { - const int height = static_cast(pattern->height()); - if (UpdateMeasurements(AbsoluteMPath(qApp->GetPatternPath(), doc->MPath()), static_cast(pattern->size()), - text.toInt())) + m_currentDimensionB = dimensionB->currentData().toInt(); + + const QList dimensions = m->Dimensions().values(); + + if (dimensions.size() > 2) + { + MeasurementDimension_p dimension = dimensions.at(2); + InitDimensionGradation(2, dimension, dimensionC); + } + + m_gradation->start(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void MainWindow::DimensionCBaseChanged() +{ + m_currentDimensionC = dimensionC->currentData().toInt(); + m_gradation->start(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void MainWindow::GradationChanged() +{ + m_gradation->stop(); + if (UpdateMeasurements(AbsoluteMPath(qApp->GetPatternPath(), doc->MPath()), m_currentDimensionA, + m_currentDimensionB, m_currentDimensionC)) { doc->LiteParseTree(Document::FullLiteParse); emit sceneDetails->DimensionsChanged(); @@ -3785,16 +3877,6 @@ void MainWindow::ChangedHeight(const QString &text) else { qCWarning(vMainWindow, "%s", qUtf8Printable(tr("Couldn't update measurements."))); - - const qint32 index = gradationHeights->findText(QString().setNum(height)); - if (index != -1) - { - gradationHeights->setCurrentIndex(index); - } - else - { - qCDebug(vMainWindow, "Couldn't restore height value."); - } } } @@ -3823,43 +3905,181 @@ void MainWindow::ClearPatternMessages() } //--------------------------------------------------------------------------------------------------------------------- -void MainWindow::SetDefaultHeight() +void MainWindow::InitDimensionControls() { - const QString defHeight = QString().setNum(doc->GetDefCustomHeight()); - int index = gradationHeights->findText(defHeight); - if (index != -1) + if (not dimensionA.isNull()) { - gradationHeights->setCurrentIndex(index); + delete dimensionA; } - else + if (not dimensionALabel.isNull()) { - index = gradationHeights->findText(QString().setNum(pattern->height())); - if (index != -1) + delete dimensionALabel; + } + + if (not dimensionB.isNull()) + { + delete dimensionB; + } + if (not dimensionBLabel.isNull()) + { + delete dimensionBLabel; + } + + if (not dimensionC.isNull()) + { + delete dimensionC; + } + if (not dimensionCLabel.isNull()) + { + delete dimensionCLabel; + } + + if (qApp->GetMeasurementsType() == MeasurementsType::Multisize) + { + const QList dimensions = m->Dimensions().values(); + const QString unit = UnitsToStr(qApp->MeasurementsUnits(), true); + + auto InitControl = [this, dimensions, unit](int index, QPointer &name, QPointer &control) { - gradationHeights->setCurrentIndex(index); + if (dimensions.size() > index) + { + MeasurementDimension_p dimension = dimensions.at(index); + + if (name.isNull()) + { + name = new QLabel(VAbstartMeasurementDimension::DimensionName(dimension->Type())+QChar(':')); + } + else + { + name->setText(VAbstartMeasurementDimension::DimensionName(dimension->Type())+QChar(':')); + } + name->setToolTip(VAbstartMeasurementDimension::DimensionToolTip(dimension->Type(), + dimension->IsCircumference(), + m->IsFullCircumference())); + + if (control.isNull()) + { + control = new QComboBox; + } + + InitDimensionGradation(index, dimension, control); + + ui->toolBarOption->addWidget(name); + ui->toolBarOption->addWidget(control); + } + }; + + InitControl(0, dimensionALabel, dimensionA); + InitControl(1, dimensionBLabel, dimensionB); + InitControl(2, dimensionCLabel, dimensionC); + + if (not dimensionA.isNull()) + { + connect(dimensionA, QOverload::of(&QComboBox::currentIndexChanged), + this, &MainWindow::DimensionABaseChanged); } + + if (not dimensionB.isNull()) + { + connect(dimensionB, QOverload::of(&QComboBox::currentIndexChanged), + this, &MainWindow::DimensionBBaseChanged); + } + + if (not dimensionC.isNull()) + { + connect(dimensionC, QOverload::of(&QComboBox::currentIndexChanged), + this, &MainWindow::DimensionCBaseChanged); + } + + ui->toolBarOption->addSeparator(); } - pattern->SetHeight(gradationHeights->currentText().toInt()); } //--------------------------------------------------------------------------------------------------------------------- -void MainWindow::SetDefaultSize() +void MainWindow::InitDimensionGradation(int index, const MeasurementDimension_p &dimension, QPointer control) { - const QString defSize = QString().setNum(doc->GetDefCustomSize()); - int index = gradationSizes->findText(defSize); - if (index != -1) + SCASSERT(control != nullptr) + + const bool fc = m->IsFullCircumference(); + const QString unit = UnitsToStr(qApp->MeasurementsUnits(), true); + + int current = -1; + if (control->currentIndex() != -1) { - gradationSizes->setCurrentIndex(index); + current = control->currentData().toInt(); + } + + control->blockSignals(true); + control->clear(); + + const QVector bases = DimensionRestrictedValues(index, dimension); + const DimesionLabels labels = dimension->Labels(); + + if (dimension->Type() == MeasurementDimension::X) + { + for(auto base : bases) + { + if (labels.contains(base) && not labels.value(base).isEmpty()) + { + control->addItem(labels.value(base), base); + } + else + { + control->addItem(QString("%1 %2").arg(base).arg(unit), base); + } + } + } + else if (dimension->Type() == MeasurementDimension::Y) + { + for(auto base : bases) + { + if (labels.contains(base) && not labels.value(base).isEmpty()) + { + control->addItem(labels.value(base), base); + } + else + { + if (dimension->IsCircumference()) + { + control->addItem(QString("%1 %2").arg(fc ? base*2 : base).arg(unit), base); + } + else + { + control->addItem(QString::number(base), base); + } + } + } + } + else if (dimension->Type() == MeasurementDimension::W || dimension->Type() == MeasurementDimension::Z) + { + for(auto base : bases) + { + if (labels.contains(base) && not labels.value(base).isEmpty()) + { + control->addItem(labels.value(base), base); + } + else + { + control->addItem(QString("%1 %2").arg(fc ? base*2 : base).arg(unit), base); + } + } + } + + // after initialization the current index is 0. The signal for changing the index will not be triggered if not make + // it invalid first + control->setCurrentIndex(-1); + + int i = control->findData(current); + if (i != -1) + { + control->setCurrentIndex(i); + control->blockSignals(false); } else { - index = gradationSizes->findText(QString().setNum(pattern->size())); - if (index != -1) - { - gradationSizes->setCurrentIndex(index); - } + control->blockSignals(false); + control->setCurrentIndex(0); } - pattern->SetSize(gradationSizes->currentText().toInt()); } //--------------------------------------------------------------------------------------------------------------------- @@ -4629,11 +4849,6 @@ void MainWindow::CreateActions() connect(ui->actionPattern_properties, &QAction::triggered, this, [this]() { DialogPatternProperties proper(doc, pattern, this); - connect(&proper, &DialogPatternProperties::UpdateGradation, this, [this]() - { - UpdateHeightsList(VMeasurement::ListHeights(doc->GetGradationHeights(), qApp->patternUnit())); - UpdateSizesList(VMeasurement::ListSizes(doc->GetGradationSizes(), qApp->patternUnit())); - }); proper.exec(); }); @@ -4909,7 +5124,7 @@ bool MainWindow::LoadPattern(QString fileName, const QString& customMeasureFile) { doc->SetMPath(RelativeMPath(fileName, customMeasureFile)); } - qApp->setPatternUnit(doc->MUnit()); + qApp->SetPatternUnits(doc->MUnit()); QString path = AbsoluteMPath(fileName, doc->MPath()); QString fixedMPath; @@ -4976,7 +5191,7 @@ bool MainWindow::LoadPattern(QString fileName, const QString& customMeasureFile) } } - if (qApp->patternType() == MeasurementsType::Unknown) + if (qApp->GetMeasurementsType() == MeasurementsType::Unknown) {// Show toolbar only if was not uploaded any measurements. ToolBarOption(); } @@ -4996,7 +5211,7 @@ bool MainWindow::LoadPattern(QString fileName, const QString& customMeasureFile) { doc->SetMPath(RelativeMPath(fileName, fixedMPath)); } - qApp->setPatternUnit(doc->MUnit()); + qApp->SetPatternUnits(doc->MUnit()); } } catch (VException &e) @@ -5463,7 +5678,7 @@ QString MainWindow::CheckPathToMeasurements(const QString &patternPath, const QS CheckRequiredMeasurements(m.data()); - qApp->setPatternType(patternType); + qApp->SetMeasurementsType(patternType); doc->SetMPath(RelativeMPath(patternPath, mPath)); return mPath; } @@ -5700,13 +5915,13 @@ bool MainWindow::SetSize(const QString &text) { if (this->isWindowModified() || not qApp->GetPatternPath().isEmpty()) { - if (qApp->patternType() == MeasurementsType::Multisize) + if (qApp->GetMeasurementsType() == MeasurementsType::Multisize) { const int size = static_cast(UnitConvertor(text.toInt(), Unit::Cm, *pattern->GetPatternUnit())); - const qint32 index = gradationSizes->findText(QString().setNum(size)); + const qint32 index = dimensionB->findText(QString().setNum(size)); if (index != -1) { - gradationSizes->setCurrentIndex(index); + dimensionB->setCurrentIndex(index); } else { @@ -5743,13 +5958,13 @@ bool MainWindow::SetHeight(const QString &text) { if (this->isWindowModified() || not qApp->GetPatternPath().isEmpty()) { - if (qApp->patternType() == MeasurementsType::Multisize) + if (qApp->GetMeasurementsType() == MeasurementsType::Multisize) { const int height = static_cast(UnitConvertor(text.toInt(), Unit::Cm, *pattern->GetPatternUnit())); - const qint32 index = gradationHeights->findText(QString().setNum(height)); + const qint32 index = dimensionA->findText(QString().setNum(height)); if (index != -1) { - gradationHeights->setCurrentIndex(index); + dimensionA->setCurrentIndex(index); } else { diff --git a/src/app/valentina/mainwindow.h b/src/app/valentina/mainwindow.h index 1ec84656f..fd8e2f172 100644 --- a/src/app/valentina/mainwindow.h +++ b/src/app/valentina/mainwindow.h @@ -32,7 +32,9 @@ #include "mainwindowsnogui.h" #include "core/vcmdexport.h" #include "../vmisc/vlockguard.h" +#include "../vformat/vdimensions.h" +#include #include namespace Ui @@ -51,7 +53,6 @@ class DialogFinalMeasurements; class VWidgetGroups; class VWidgetDetails; class QToolButton; -class QDoubleSpinBox; class QProgressBar; class WatermarkWindow; @@ -208,8 +209,11 @@ private slots: void OpenAt(QAction *where); #endif //defined(Q_OS_MAC) - void ChangedSize(const QString &text); - void ChangedHeight(const QString &text); + void DimensionABaseChanged(); + void DimensionBBaseChanged(); + void DimensionCBaseChanged(); + + void GradationChanged(); void ShowProgress(); void ClearPatternMessages(); @@ -267,12 +271,14 @@ private: QLabel *rightGoToStage; QTimer *autoSaveTimer; bool guiEnabled; - QPointer gradationHeights; - QPointer gradationSizes; - QPointer gradationHeightsLabel; - QPointer gradationSizesLabel; - QPointer zoomScale; - QPointer doubleSpinBoxScale; + QPointer dimensionA{nullptr}; + QPointer dimensionB{nullptr}; + QPointer dimensionC{nullptr}; + QPointer dimensionALabel{nullptr}; + QPointer dimensionBLabel{nullptr}; + QPointer dimensionCLabel{nullptr}; + QPointer zoomScale{nullptr}; + QPointer doubleSpinBoxScale{nullptr}; VToolOptionsPropertyBrowser *toolOptions; VWidgetGroups *groupsWidget; VWidgetDetails *detailsWidget; @@ -285,8 +291,16 @@ private: QList> m_watermarkEditors{}; - void SetDefaultHeight(); - void SetDefaultSize(); + int m_currentDimensionA{0}; + int m_currentDimensionB{0}; + int m_currentDimensionC{0}; + + QSharedPointer m{}; + + QTimer *m_gradation; + + void InitDimensionControls(); + void InitDimensionGradation(int index, const MeasurementDimension_p &dimension, QPointer control); void ToolBarOption(); void ToolBarStages(); @@ -338,15 +352,12 @@ private: void InitAutoSave(); bool PatternPieceName(QString &name); QString CheckPathToMeasurements(const QString &patternPath, const QString &path); - QComboBox *SetGradationList(QLabel *label, const QStringList &list); void ChangePP(int index, bool zoomBestFit = true); /** * @brief EndVisualization try show dialog after and working with tool visualization. */ void EndVisualization(bool click = false); void ZoomFirstShow(); - void UpdateHeightsList(const QStringList &list); - void UpdateSizesList(const QStringList &list); void AddDocks(); void InitDocksContain(); @@ -360,7 +371,7 @@ private: void InitScenes(); bool LoadMeasurements(const QString &path); - bool UpdateMeasurements(const QString &path, int size, int height); + bool UpdateMeasurements(const QString &path, int baseA, int baseB, int baseC); void ReopenFilesAfterCrash(QStringList &args); bool DoExport(const VCommandLinePtr& expParams); @@ -393,6 +404,12 @@ private: void OpenWatermark(const QString &path = QString()); void CleanWaterkmarkEditors(); + + void StoreMultisizeMDimensions(); + void StoreIndividualMDimensions(); + + QVector DimensionRestrictedValues(int index, const MeasurementDimension_p &dimension); + void SetDimensionBases(); }; #endif // MAINWINDOW_H diff --git a/src/app/valentina/mainwindowsnogui.cpp b/src/app/valentina/mainwindowsnogui.cpp index 119693d95..5798faabb 100644 --- a/src/app/valentina/mainwindowsnogui.cpp +++ b/src/app/valentina/mainwindowsnogui.cpp @@ -136,7 +136,7 @@ MainWindowsNoGUI::MainWindowsNoGUI(QWidget *parent) listDetails(), currentScene(nullptr), tempSceneLayout(nullptr), - pattern(new VContainer(qApp->TrVars(), qApp->patternUnitP(), valentinaNamespace)), + pattern(new VContainer(qApp->TrVars(), qApp->patternUnitsP(), valentinaNamespace)), doc(nullptr), papers(), shadows(), @@ -155,7 +155,6 @@ MainWindowsNoGUI::MainWindowsNoGUI(QWidget *parent) margins(), paperSize(), m_dialogSaveLayout(), - m_mouseCoordinate(), #if defined(Q_OS_WIN32) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0) m_taskbarButton(new QWinTaskbarButton(this)), m_taskbarProgress(nullptr), @@ -930,7 +929,7 @@ void MainWindowsNoGUI::PrintPages(QPrinter *printer) { const QString errorMsg = tr("File error.\n\n%1\n\n%2").arg(e.ErrorMessage(), e.DetailedInformation()); qApp->IsPedantic() ? throw VException(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; } } @@ -2047,33 +2046,6 @@ QString MainWindowsNoGUI::FileName() const return QFileInfo(fileName).baseName(); } -//--------------------------------------------------------------------------------------------------------------------- -void MainWindowsNoGUI::SetSizeHeightForIndividualM() const -{ - const QHash > * vars = pattern->DataVariables(); - - if (vars->contains(size_M)) - { - pattern->SetSize(*vars->value(size_M)->GetValue()); - } - else - { - pattern->SetSize(0); - } - - if (vars->contains(height_M)) - { - pattern->SetHeight(*vars->value(height_M)->GetValue()); - } - else - { - pattern->SetHeight(0); - } - - doc->SetPatternWasChanged(true); - emit doc->UpdatePatternLabel(); -} - //--------------------------------------------------------------------------------------------------------------------- bool MainWindowsNoGUI::ExportFMeasurementsToCSVData(const QString &fileName, bool withHeader, int mib, const QChar &separator) const diff --git a/src/app/valentina/mainwindowsnogui.h b/src/app/valentina/mainwindowsnogui.h index 77a69eb86..409398df6 100644 --- a/src/app/valentina/mainwindowsnogui.h +++ b/src/app/valentina/mainwindowsnogui.h @@ -122,8 +122,8 @@ protected: QSharedPointer m_dialogSaveLayout; /** @brief mouseCoordinate pointer to label who show mouse coordinate. */ - QPointer m_mouseCoordinate; - QPointer m_unreadPatternMessage{}; + QPointer m_mouseCoordinate{nullptr}; + QPointer m_unreadPatternMessage{nullptr}; #if defined(Q_OS_WIN) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0) QWinTaskbarButton *m_taskbarButton; @@ -142,7 +142,6 @@ protected: bool GenerateLayout(VLayoutGenerator& lGenerator); int ContinueIfLayoutStale(); QString FileName() const; - void SetSizeHeightForIndividualM() const; bool ExportFMeasurementsToCSVData(const QString &fileName, bool withHeader, int mib, const QChar &separator) const; diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index 763ae9415..500fd223e 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -127,7 +127,7 @@ void VPattern::CreateEmptyFile() patternElement.appendChild(createComment(FileComment())); patternElement.appendChild(CreateElementWithText(TagVersion, VPatternConverter::PatternMaxVerStr)); - patternElement.appendChild(CreateElementWithText(TagUnit, UnitsToStr(qApp->patternUnit()))); + patternElement.appendChild(CreateElementWithText(TagUnit, UnitsToStr(qApp->patternUnits()))); patternElement.appendChild(createElement(TagDescription)); patternElement.appendChild(createElement(TagNotes)); diff --git a/src/app/valentina/xml/vpattern.h b/src/app/valentina/xml/vpattern.h index 599b282c6..8605e0ce4 100644 --- a/src/app/valentina/xml/vpattern.h +++ b/src/app/valentina/xml/vpattern.h @@ -100,9 +100,11 @@ public: bool IsDefCustom() const; void SetDefCustom(bool value); + // TODO: remove int GetDefCustomHeight() const; void SetDefCustomHeight(int value); + // TODO: remove int GetDefCustomSize() const; void SetDefCustomSize(int value); diff --git a/src/libs/fervor/fvupdater.cpp b/src/libs/fervor/fvupdater.cpp index 854dd46b3..e9ee9128c 100644 --- a/src/libs/fervor/fvupdater.cpp +++ b/src/libs/fervor/fvupdater.cpp @@ -48,7 +48,7 @@ #include "../ifc/exception/vexception.h" #include "../ifc/xml/vabstractconverter.h" #include "../vmisc/projectversion.h" -#include "../vmisc/vabstractapplication.h" +#include "../vmisc/vabstractvalapplication.h" #include "../vmisc/vcommonsettings.h" #include "fvavailableupdate.h" #include "fvupdatewindow.h" diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp index c45c7a026..6d0e3857d 100644 --- a/src/libs/ifc/xml/vabstractpattern.cpp +++ b/src/libs/ifc/xml/vabstractpattern.cpp @@ -54,7 +54,7 @@ #include "vpatternconverter.h" #include "vdomdocument.h" #include "vtoolrecord.h" -#include "../vmisc/vabstractapplication.h" +#include "../vmisc/vabstractvalapplication.h" #include "../vmisc/compatibility.h" #include "../vlayout/vtextmanager.h" diff --git a/src/libs/vdxf/libdxfrw/intern/drw_textcodec.cpp b/src/libs/vdxf/libdxfrw/intern/drw_textcodec.cpp index 796b41bb6..3cfd120c0 100644 --- a/src/libs/vdxf/libdxfrw/intern/drw_textcodec.cpp +++ b/src/libs/vdxf/libdxfrw/intern/drw_textcodec.cpp @@ -4,8 +4,9 @@ #include #include #include +#include #include "../drw_base.h" -#include "../vmisc/vabstractapplication.h" +#include "../vmisc/vabstractvalapplication.h" #include "../ifc/exception/vexception.h" namespace @@ -112,7 +113,7 @@ void DRW_TextCodec::setCodePage(const std::string *c, bool dxfFormat){ const QString errorMsg = QCoreApplication::translate("DRW_TextCodec", "No available codec for code page '%1'.") .arg(cp.c_str()); qApp->IsPedantic() ? throw VException(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; if (version < DRW::AC1021 && cp == "UTF-8") { diff --git a/src/libs/vformat/vmeasurements.h b/src/libs/vformat/vmeasurements.h index cffb1bc0b..b8415e621 100644 --- a/src/libs/vformat/vmeasurements.h +++ b/src/libs/vformat/vmeasurements.h @@ -89,7 +89,7 @@ public: void SetBirthDate(const QDate &date); GenderType Gender() const; - void SetGender(const GenderType &gender); + void SetGender(const GenderType &gender); QString PMSystem() const; void SetPMSystem(const QString &system); diff --git a/src/libs/vformat/vpatternrecipe.cpp b/src/libs/vformat/vpatternrecipe.cpp index 6a2756448..921781aa6 100644 --- a/src/libs/vformat/vpatternrecipe.cpp +++ b/src/libs/vformat/vpatternrecipe.cpp @@ -118,7 +118,7 @@ QDomElement VPatternRecipe::Prerequisite() QDomElement prerequisiteElement = createElement(QStringLiteral("prerequisite")); prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("valentina"), APP_VERSION_STR)); - prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("unit"), UnitsToStr(qApp->patternUnit()))); + prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("unit"), UnitsToStr(qApp->patternUnits()))); prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("author"), m_pattern->GetCompanyName())); prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("pattenName"), m_pattern->GetPatternName())); prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("description"), m_pattern->GetDescription())); @@ -437,7 +437,7 @@ QDomElement VPatternRecipe::FinalMeasurement(const VFinalMeasurement &fm) tr("Value for final measurtement '%1' is infinite or NaN. " "Please, check your calculations.").arg(fm.name)); qApp->IsPedantic() ? throw VException(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; } SetAttribute(recipeFinalMeasurement, QStringLiteral("value"), result); diff --git a/src/libs/vgeometry/vabstractcurve.cpp b/src/libs/vgeometry/vabstractcurve.cpp index 15e6d466d..2636be479 100644 --- a/src/libs/vgeometry/vabstractcurve.cpp +++ b/src/libs/vgeometry/vabstractcurve.cpp @@ -36,7 +36,7 @@ #include #include "vabstractcurve_p.h" -#include "../vmisc/vabstractapplication.h" +#include "../vmisc/vabstractvalapplication.h" #include "../vmisc/compatibility.h" #include "../ifc/exception/vexceptionobjecterror.h" @@ -146,7 +146,7 @@ QVector VAbstractCurve::GetSegmentPoints(const QPointF &begin, const QP .arg(piece, name(), error); } qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; } return segment; diff --git a/src/libs/vgeometry/varc_p.h b/src/libs/vgeometry/varc_p.h index 53f6289d1..4530b02a2 100644 --- a/src/libs/vgeometry/varc_p.h +++ b/src/libs/vgeometry/varc_p.h @@ -31,7 +31,7 @@ #include #include "vgeometrydef.h" -#include "../vmisc/vabstractapplication.h" +#include "../vmisc/vabstractvalapplication.h" #include "../vmisc/diagnostic.h" QT_WARNING_PUSH diff --git a/src/libs/vgeometry/vellipticalarc_p.h b/src/libs/vgeometry/vellipticalarc_p.h index 869ba0945..ee00d533d 100644 --- a/src/libs/vgeometry/vellipticalarc_p.h +++ b/src/libs/vgeometry/vellipticalarc_p.h @@ -2,7 +2,7 @@ #define VELLIPTICALARC_P #include -#include "../vmisc/vabstractapplication.h" +#include "../vmisc/vabstractvalapplication.h" #include "../vmisc/diagnostic.h" #include "vpointf.h" diff --git a/src/libs/vgeometry/vspline_p.h b/src/libs/vgeometry/vspline_p.h index 0c76aa5b3..1b71ca5a6 100644 --- a/src/libs/vgeometry/vspline_p.h +++ b/src/libs/vgeometry/vspline_p.h @@ -33,7 +33,7 @@ #include #include "vpointf.h" -#include "../vmisc/vabstractapplication.h" +#include "../vmisc/vabstractvalapplication.h" #include "../vmisc/vmath.h" QT_WARNING_PUSH diff --git a/src/libs/vlayout/vabstractpiece.cpp b/src/libs/vlayout/vabstractpiece.cpp index 4ba2d8b78..85f9d0d16 100644 --- a/src/libs/vlayout/vabstractpiece.cpp +++ b/src/libs/vlayout/vabstractpiece.cpp @@ -28,7 +28,7 @@ #include "vabstractpiece.h" #include "vabstractpiece_p.h" -#include "../vmisc/vabstractapplication.h" +#include "../vmisc/vabstractvalapplication.h" #include "../vgeometry/vpointf.h" #include "../ifc/exception/vexception.h" #include "../vmisc/vmath.h" @@ -1072,7 +1072,7 @@ QVector VAbstractPiece::Equidistant(QVector points, qreal wid { const QString errorMsg = tr("Piece '%1'. Not enough points to build seam allowance.").arg(name); qApp->IsPedantic() ? throw VException(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; return QVector(); } diff --git a/src/libs/vlayout/vbank.cpp b/src/libs/vlayout/vbank.cpp index 1df82536c..12861e401 100644 --- a/src/libs/vlayout/vbank.cpp +++ b/src/libs/vlayout/vbank.cpp @@ -32,7 +32,7 @@ #include #include "../vmisc/diagnostic.h" -#include "../vmisc/vabstractapplication.h" +#include "../vmisc/vabstractvalapplication.h" #include "../vmisc/compatibility.h" #include "vlayoutdef.h" #include "../ifc/exception/vexception.h" @@ -335,7 +335,7 @@ bool VBank::PrepareUnsorted() const qint64 square = details.at(i).Square(); if (square <= 0) { - qCCritical(lBank) << VAbstractApplication::patternMessageSignature + + qCCritical(lBank) << VAbstractValApplication::patternMessageSignature + tr("Preparing data for layout error: Detail '%1' square <= 0") .arg(details.at(i).GetName()); prepare = false; @@ -360,7 +360,7 @@ bool VBank::PrepareDetails() { if (layoutWidth <= 0) { - qCCritical(lBank) << VAbstractApplication::patternMessageSignature + + qCCritical(lBank) << VAbstractValApplication::patternMessageSignature + tr("Preparing data for layout error: Layout paper sheet <= 0"); prepare = false; return prepare; @@ -368,7 +368,7 @@ bool VBank::PrepareDetails() if (details.isEmpty()) { - qCCritical(lBank) << VAbstractApplication::patternMessageSignature + + qCCritical(lBank) << VAbstractValApplication::patternMessageSignature + tr("Preparing data for layout error: List of details is empty"); prepare = false; return prepare; @@ -391,7 +391,7 @@ bool VBank::PrepareDetails() const QString errorMsg = QObject::tr("Piece '%1' has invalid layout allowance. Please, check seam allowance" " to check how seam allowance behave.").arg(details.at(i).GetName()); qApp->IsPedantic() ? throw VException(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; } const qreal d = details.at(i).Diagonal(); diff --git a/src/libs/vlayout/vlayoutpiece.cpp b/src/libs/vlayout/vlayoutpiece.cpp index b9fc0c890..6f0d74f9f 100644 --- a/src/libs/vlayout/vlayoutpiece.cpp +++ b/src/libs/vlayout/vlayoutpiece.cpp @@ -48,7 +48,7 @@ #include "../vpatterndb/floatItemData/vpatternlabeldata.h" #include "../vpatterndb/floatItemData/vpiecelabeldata.h" #include "../vmisc/vmath.h" -#include "../vmisc/vabstractapplication.h" +#include "../vmisc/vabstractvalapplication.h" #include "../vmisc/compatibility.h" #include "../vpatterndb/vcontainer.h" #include "../vpatterndb/calculator.h" @@ -269,7 +269,7 @@ QVector ConvertPassmarks(const VPiece &piece, const VContainer QObject::tr("Cannot prepare builtin passmark '%1' for piece '%2'. Passmark is empty.") .arg(pData.nodeName, piece.GetName()); qApp->IsPedantic() ? throw VException(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; return; } @@ -283,7 +283,7 @@ QVector ConvertPassmarks(const VPiece &piece, const VContainer "empty.") .arg(pData.nodeName, piece.GetName()); qApp->IsPedantic() ? throw VException(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; return; } layoutPassmark.baseLine = ConstFirst (baseLines); @@ -300,7 +300,7 @@ QVector ConvertPassmarks(const VPiece &piece, const VContainer QObject::tr("Passmark '%1' is not part of piece '%2'.") .arg(pData.nodeName, piece.GetName()); qApp->IsPedantic() ? throw VException(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; } }; @@ -326,7 +326,7 @@ QVector ConvertPassmarks(const VPiece &piece, const VContainer QObject::tr("Cannot prepare passmark '%1' for piece '%2'. Passmark base line is empty.") .arg(pData.nodeName, piece.GetName()); qApp->IsPedantic() ? throw VException(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; return; } @@ -346,7 +346,7 @@ QVector ConvertPassmarks(const VPiece &piece, const VContainer QObject::tr("Cannot prepare passmark '%1' for piece '%2'. Passmark is empty.") .arg(pData.nodeName, piece.GetName()); qApp->IsPedantic() ? throw VException(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; return; } @@ -362,7 +362,7 @@ QVector ConvertPassmarks(const VPiece &piece, const VContainer QObject::tr("Passmark '%1' is not part of piece '%2'.") .arg(pData.nodeName, piece.GetName()); qApp->IsPedantic() ? throw VException(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; } }; @@ -508,7 +508,7 @@ VLayoutPiece VLayoutPiece::Create(const VPiece &piece, vidtype id, const VContai const QString errorMsg = QObject::tr("Piece '%1'. Seam allowance is not valid.") .arg(piece.GetName()); qApp->IsPedantic() ? throw VException(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; } det.SetCountourPoints(futureMainPath.result(), diff --git a/src/libs/vlayout/vposter.cpp b/src/libs/vlayout/vposter.cpp index 82069b214..f7d73c80e 100644 --- a/src/libs/vlayout/vposter.cpp +++ b/src/libs/vlayout/vposter.cpp @@ -43,10 +43,11 @@ #include #include #include +#include #include "../vmisc/vmath.h" #include "../vmisc/def.h" -#include "../vmisc/vabstractapplication.h" +#include "../vmisc/vabstractvalapplication.h" #include "../ifc/exception/vexception.h" namespace @@ -309,7 +310,7 @@ QVector VPoster::ImageWatermark(QGraphicsItem *parent, const Po { const QString errorMsg = tr("Cannot open the watermark image.") + QChar(' ') + error; qApp->IsPedantic() ? throw VException(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; return data; } @@ -319,7 +320,7 @@ QVector VPoster::ImageWatermark(QGraphicsItem *parent, const Po { const QString errorMsg = tr("Not supported file suffix '%1'").arg(f.suffix()); qApp->IsPedantic() ? throw VException(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; return data; } @@ -455,7 +456,7 @@ void VPoster::Ruler(QVector &data, QGraphicsItem *parent, QRect const qreal notchHeight = ToPixel(3); // mm const qreal shortNotchHeight = ToPixel(1.1); // mm - Unit patternUnits = qApp->patternUnit(); + Unit patternUnits = qApp->patternUnits(); const qreal step = UnitConvertor(1, patternUnits, Unit::Px); double marksCount = rec.width() / step; int i = 0; diff --git a/src/libs/vlayout/vtextmanager.cpp b/src/libs/vlayout/vtextmanager.cpp index ec1300081..c6ff72ff7 100644 --- a/src/libs/vlayout/vtextmanager.cpp +++ b/src/libs/vlayout/vtextmanager.cpp @@ -37,7 +37,7 @@ #include "../ifc/xml/vabstractpattern.h" #include "../vpatterndb/floatItemData/vpiecelabeldata.h" -#include "../vmisc/vabstractapplication.h" +#include "../vmisc/vabstractvalapplication.h" #include "../vmisc/vmath.h" #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) # include "../vmisc/vdatastreamenum.h" @@ -185,7 +185,7 @@ QMap PreparePlaceholders(const VAbstractPattern *doc) placeholders.insert(pl_patternNumber, doc->GetPatternNumber()); placeholders.insert(pl_author, doc->GetCompanyName()); - if (qApp->patternType() == MeasurementsType::Individual) + if (qApp->GetMeasurementsType() == MeasurementsType::Individual) { placeholders.insert(pl_customer, qApp->GetCustomerName()); } @@ -201,13 +201,13 @@ QMap PreparePlaceholders(const VAbstractPattern *doc) QString curSize; QString curHeight; QString mExt; - if (qApp->patternType() == MeasurementsType::Multisize) + if (qApp->GetMeasurementsType() == MeasurementsType::Multisize) { curSize = QString::number(VContainer::size(valentinaNamespace)); curHeight = QString::number(VContainer::height(valentinaNamespace)); mExt = QStringLiteral("vst"); } - else if (qApp->patternType() == MeasurementsType::Individual) + else if (qApp->GetMeasurementsType() == MeasurementsType::Individual) { curSize = QString::number(VContainer::size(valentinaNamespace)); curHeight = QString::number(VContainer::height(valentinaNamespace)); diff --git a/src/libs/vmisc/def.h b/src/libs/vmisc/def.h index 619469ddb..7aa912374 100644 --- a/src/libs/vmisc/def.h +++ b/src/libs/vmisc/def.h @@ -82,7 +82,7 @@ extern const int maxLabelFontSize; enum class NodeDetail : qint8 { Contour, Modeling }; enum class SceneObject : qint8 { Point, Line, Spline, Arc, ElArc, SplinePath, Detail, Unknown }; -enum class MeasurementsType : qint8 { Multisize, Individual , Unknown}; +enum class MeasurementsType : qint8 { Multisize, Individual, Unknown}; enum class Unit : qint8 { Mm = 0, Cm, Inch, Px, LAST_UNIT_DO_NOT_USE}; enum class Source : qint8 { FromGui, FromFile, FromTool }; enum class NodeUsage : bool {NotInUse = false, InUse = true}; diff --git a/src/libs/vmisc/dialogs/dialogexporttocsv.cpp b/src/libs/vmisc/dialogs/dialogexporttocsv.cpp index afe54328d..c6ae57e5d 100644 --- a/src/libs/vmisc/dialogs/dialogexporttocsv.cpp +++ b/src/libs/vmisc/dialogs/dialogexporttocsv.cpp @@ -36,6 +36,7 @@ #include #include #include +#include //--------------------------------------------------------------------------------------------------------------------- DialogExportToCSV::DialogExportToCSV(QWidget *parent) diff --git a/src/libs/vmisc/testvapplication.h b/src/libs/vmisc/testvapplication.h index b19c21541..a4eea8699 100644 --- a/src/libs/vmisc/testvapplication.h +++ b/src/libs/vmisc/testvapplication.h @@ -31,6 +31,7 @@ #include "vabstractapplication.h" #include "projectversion.h" +#include "../vmisc/vsettings.h" #if defined(qApp) #undef qApp diff --git a/src/libs/vmisc/vabstractapplication.cpp b/src/libs/vmisc/vabstractapplication.cpp index f201134e7..78d06a864 100644 --- a/src/libs/vmisc/vabstractapplication.cpp +++ b/src/libs/vmisc/vabstractapplication.cpp @@ -42,9 +42,6 @@ #include #include -#include "../vmisc/def.h" -#include "../vmisc/customevents.h" - #ifdef Q_OS_UNIX # include #endif @@ -53,29 +50,10 @@ # include "appimage.h" #endif // defined(APPIMAGE) && defined(Q_OS_LINUX) -const QString VAbstractApplication::patternMessageSignature = QStringLiteral("[PATTERN MESSAGE]"); - //--------------------------------------------------------------------------------------------------------------------- VAbstractApplication::VAbstractApplication(int &argc, char **argv) :QApplication(argc, argv), - undoStack(new QUndoStack(this)), - mainWindow(nullptr), - settings(nullptr), - qtTranslator(nullptr), - qtxmlTranslator(nullptr), - qtBaseTranslator(nullptr), - appTranslator(nullptr), - pmsTranslator(nullptr), - _patternUnit(Unit::Cm), - _patternType(MeasurementsType::Unknown), - patternFilePath(), - currentScene(nullptr), - sceneView(nullptr), - doc(nullptr), - m_customerName(), - m_userMaterials(), - openingPattern(false), - mode(Draw::Calculation) + undoStack(new QUndoStack(this)) { QString rules; @@ -121,10 +99,6 @@ VAbstractApplication::VAbstractApplication(int &argc, char **argv) connect(this, &QApplication::aboutToQuit, this, &VAbstractApplication::AboutToQuit); } -//--------------------------------------------------------------------------------------------------------------------- -VAbstractApplication::~VAbstractApplication() -{} - //--------------------------------------------------------------------------------------------------------------------- /** * @brief translationsPath return path to the root directory that contain QM files. @@ -189,56 +163,6 @@ QString VAbstractApplication::translationsPath(const QString &locale) const #endif } -//--------------------------------------------------------------------------------------------------------------------- -MeasurementsType VAbstractApplication::patternType() const -{ - return _patternType; -} - -//--------------------------------------------------------------------------------------------------------------------- -void VAbstractApplication::setPatternType(const MeasurementsType &patternType) -{ - _patternType = patternType; -} - -//--------------------------------------------------------------------------------------------------------------------- -void VAbstractApplication::setCurrentDocument(VAbstractPattern *doc) -{ - this->doc = doc; -} - -//--------------------------------------------------------------------------------------------------------------------- -VAbstractPattern *VAbstractApplication::getCurrentDocument() const -{ - SCASSERT(doc != nullptr) - return doc; -} - -//--------------------------------------------------------------------------------------------------------------------- -bool VAbstractApplication::getOpeningPattern() const -{ - return openingPattern; -} - -//--------------------------------------------------------------------------------------------------------------------- -void VAbstractApplication::setOpeningPattern() -{ - openingPattern = !openingPattern; -} - -//--------------------------------------------------------------------------------------------------------------------- -QWidget *VAbstractApplication::getMainWindow() const -{ - return mainWindow; -} - -//--------------------------------------------------------------------------------------------------------------------- -void VAbstractApplication::setMainWindow(QWidget *value) -{ - SCASSERT(value != nullptr) - mainWindow = value; -} - //--------------------------------------------------------------------------------------------------------------------- QUndoStack *VAbstractApplication::getUndoStack() const { @@ -251,47 +175,6 @@ bool VAbstractApplication::IsPedantic() const return false; } -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief ClearMessage helps to clear a message string from standard Qt function. - * @param msg the message that contains '"' at the start and at the end - * @return cleared string - */ -QString VAbstractApplication::ClearMessage(QString msg) -{ - if (msg.startsWith('"') && msg.endsWith('"')) - { - msg.remove(0, 1); - msg.chop(1); - } - - return msg; -} - -//--------------------------------------------------------------------------------------------------------------------- -const Draw &VAbstractApplication::GetDrawMode() const -{ - return mode; -} - -//--------------------------------------------------------------------------------------------------------------------- -void VAbstractApplication::SetDrawMode(const Draw &value) -{ - mode = value; -} - -//--------------------------------------------------------------------------------------------------------------------- -void VAbstractApplication::PostPatternMessage(const QString &message, QtMsgType severity) const -{ - QApplication::postEvent(mainWindow, new PatternMessageEvent(VAbstractApplication::ClearMessage(message), severity)); -} - -//--------------------------------------------------------------------------------------------------------------------- -bool VAbstractApplication::IsPatternMessage(const QString &message) const -{ - return VAbstractApplication::ClearMessage(message).startsWith(patternMessageSignature); -} - //--------------------------------------------------------------------------------------------------------------------- #if defined(Q_OS_WIN) void VAbstractApplication::WinAttachConsole() @@ -312,24 +195,6 @@ void VAbstractApplication::WinAttachConsole() } #endif -//--------------------------------------------------------------------------------------------------------------------- -Unit VAbstractApplication::patternUnit() const -{ - return _patternUnit; -} - -//--------------------------------------------------------------------------------------------------------------------- -const Unit *VAbstractApplication::patternUnitP() const -{ - return &_patternUnit; -} - -//--------------------------------------------------------------------------------------------------------------------- -void VAbstractApplication::setPatternUnit(const Unit &patternUnit) -{ - _patternUnit = patternUnit; -} - //--------------------------------------------------------------------------------------------------------------------- /** * @brief getSettings hide settings constructor. @@ -341,43 +206,6 @@ VCommonSettings *VAbstractApplication::Settings() return settings; } -//--------------------------------------------------------------------------------------------------------------------- -QGraphicsScene *VAbstractApplication::getCurrentScene() const -{ - SCASSERT(*currentScene != nullptr) - return *currentScene; -} - -//--------------------------------------------------------------------------------------------------------------------- -void VAbstractApplication::setCurrentScene(QGraphicsScene **value) -{ - currentScene = value; -} - -//--------------------------------------------------------------------------------------------------------------------- -VMainGraphicsView *VAbstractApplication::getSceneView() const -{ - return sceneView; -} - -//--------------------------------------------------------------------------------------------------------------------- -void VAbstractApplication::setSceneView(VMainGraphicsView *value) -{ - sceneView = value; -} - -//--------------------------------------------------------------------------------------------------------------------- -double VAbstractApplication::toPixel(double val) const -{ - return ToPixel(val, _patternUnit); -} - -//--------------------------------------------------------------------------------------------------------------------- -double VAbstractApplication::fromPixel(double pix) const -{ - return FromPixel(pix, _patternUnit); -} - //--------------------------------------------------------------------------------------------------------------------- void VAbstractApplication::LoadTranslation(const QString &locale) { diff --git a/src/libs/vmisc/vabstractapplication.h b/src/libs/vmisc/vabstractapplication.h index d3e16cd5a..b7f9e5231 100644 --- a/src/libs/vmisc/vabstractapplication.h +++ b/src/libs/vmisc/vabstractapplication.h @@ -32,25 +32,21 @@ #include #include #include -#include #include #include #include #include #include #include +#include #include "../vmisc/def.h" #include "../vpatterndb/vtranslatevars.h" -#include "def.h" #include "vcommonsettings.h" -#include "vlockguard.h" -#include "vsettings.h" class QUndoStack; class VAbstractApplication;// use in define -class VAbstractPattern; -class VMainGraphicsView; +class VCommonSettings; #if defined(qApp) #undef qApp @@ -62,92 +58,42 @@ class VAbstractApplication : public QApplication Q_OBJECT public: VAbstractApplication(int &argc, char ** argv); - virtual ~VAbstractApplication() override; + virtual ~VAbstractApplication() =default; virtual const VTranslateVars *TrVars()=0; - QString translationsPath(const QString &locale = QString()) const; + QString translationsPath(const QString &locale = QString()) const; - void LoadTranslation(const QString &locale); - - Unit patternUnit() const; - const Unit *patternUnitP() const; - void setPatternUnit(const Unit &patternUnit); - - MeasurementsType patternType() const; - void setPatternType(const MeasurementsType &patternType); - - QString GetCustomerName() const; - void SetCustomerName(const QString &name); + void LoadTranslation(const QString &locale); virtual void OpenSettings()=0; VCommonSettings *Settings(); template - QString LocaleToString(const T &value); + QString LocaleToString(const T &value); - QGraphicsScene *getCurrentScene() const; - void setCurrentScene(QGraphicsScene **value); + QUndoStack *getUndoStack() const; - VMainGraphicsView *getSceneView() const; - void setSceneView(VMainGraphicsView *value); - - double toPixel(double val) const; - double fromPixel(double pix) const; - - void setCurrentDocument(VAbstractPattern *doc); - VAbstractPattern *getCurrentDocument()const; - - bool getOpeningPattern() const; - void setOpeningPattern(); - - QWidget *getMainWindow() const; - void setMainWindow(QWidget *value); - - QUndoStack *getUndoStack() const; - - virtual bool IsAppInGUIMode()const =0; - virtual bool IsPedantic() const; - - QString GetPatternPath() const; - void SetPatternPath(const QString &value); + virtual bool IsAppInGUIMode()const =0; + virtual bool IsPedantic() const; #if defined(Q_OS_WIN) static void WinAttachConsole(); #endif - static QString ClearMessage(QString msg); - - QMap GetUserMaterials() const; - void SetUserMaterials(const QMap &userMaterials); - - const Draw &GetDrawMode() const; - void SetDrawMode(const Draw &value); - - void PostPatternMessage(const QString &message, QtMsgType severity) const; - - static const QString patternMessageSignature; - bool IsPatternMessage(const QString &message) const; - protected: - QUndoStack *undoStack; - - /** - * @brief mainWindow pointer to main window. Usefull if need create modal dialog. Without pointer to main window - * modality doesn't work. - */ - QWidget *mainWindow; + QUndoStack *undoStack; /** * @brief settings pointer to settings. Help hide constructor creation settings. Make make code more readable. */ - VCommonSettings *settings; + VCommonSettings *settings{nullptr}; - QPointer qtTranslator; - QPointer qtxmlTranslator; - QPointer qtBaseTranslator; - QPointer appTranslator; - QPointer pmsTranslator; + QPointer qtTranslator{nullptr}; + QPointer qtxmlTranslator{nullptr}; + QPointer qtBaseTranslator{nullptr}; + QPointer appTranslator{nullptr}; + QPointer pmsTranslator{nullptr}; virtual void InitTrVars()=0; @@ -156,66 +102,10 @@ protected slots: private: Q_DISABLE_COPY(VAbstractApplication) - Unit _patternUnit; - MeasurementsType _patternType; - QString patternFilePath; - - QGraphicsScene **currentScene; - VMainGraphicsView *sceneView; - - VAbstractPattern *doc; - QString m_customerName; - - QMap m_userMaterials; - - /** - * @brief openingPattern true when we opening pattern. If something will be wrong in formula this help understand if - * we can allow user use Undo option. - */ - bool openingPattern; - - /** @brief mode keep current draw mode. */ - Draw mode; void ClearTranslation(); }; -//--------------------------------------------------------------------------------------------------------------------- -inline QString VAbstractApplication::GetCustomerName() const -{ - return m_customerName; -} - -//--------------------------------------------------------------------------------------------------------------------- -inline void VAbstractApplication::SetCustomerName(const QString &name) -{ - m_customerName = name; -} - -//--------------------------------------------------------------------------------------------------------------------- -inline QString VAbstractApplication::GetPatternPath() const -{ - return patternFilePath; -} - -//--------------------------------------------------------------------------------------------------------------------- -inline void VAbstractApplication::SetPatternPath(const QString &value) -{ - patternFilePath = value; -} - -//--------------------------------------------------------------------------------------------------------------------- -inline QMap VAbstractApplication::GetUserMaterials() const -{ - return m_userMaterials; -} - -//--------------------------------------------------------------------------------------------------------------------- -inline void VAbstractApplication::SetUserMaterials(const QMap &userMaterials) -{ - m_userMaterials = userMaterials; -} - //--------------------------------------------------------------------------------------------------------------------- template inline QString VAbstractApplication::LocaleToString(const T &value) diff --git a/src/libs/vmisc/vabstractvalapplication.cpp b/src/libs/vmisc/vabstractvalapplication.cpp new file mode 100644 index 000000000..f9bec265a --- /dev/null +++ b/src/libs/vmisc/vabstractvalapplication.cpp @@ -0,0 +1,80 @@ +/************************************************************************ + ** + ** @file vabstractvalapplication.cpp + ** @author Roman Telezhynskyi + ** @date 15 10, 2020 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentina project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2020 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ +#include "vabstractvalapplication.h" +#include "../vmisc/customevents.h" + +#include + +const QString VAbstractValApplication::patternMessageSignature = QStringLiteral("[PATTERN MESSAGE]"); + +//--------------------------------------------------------------------------------------------------------------------- +VAbstractValApplication::VAbstractValApplication(int &argc, char **argv) + : VAbstractApplication(argc, argv) +{} + +//--------------------------------------------------------------------------------------------------------------------- +double VAbstractValApplication::toPixel(double val) const +{ + return ToPixel(val, m_patternUnits); +} + +//--------------------------------------------------------------------------------------------------------------------- +double VAbstractValApplication::fromPixel(double pix) const +{ + return FromPixel(pix, m_patternUnits); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VAbstractValApplication::PostPatternMessage(const QString &message, QtMsgType severity) const +{ + QApplication::postEvent(mainWindow, + new PatternMessageEvent(VAbstractValApplication::ClearMessage(message), severity)); +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief ClearMessage helps to clear a message string from standard Qt function. + * @param msg the message that contains '"' at the start and at the end + * @return cleared string + */ +QString VAbstractValApplication::ClearMessage(QString msg) +{ + if (msg.startsWith('"') && msg.endsWith('"')) + { + msg.remove(0, 1); + msg.chop(1); + } + + return msg; +} + +//--------------------------------------------------------------------------------------------------------------------- +bool VAbstractValApplication::IsPatternMessage(const QString &message) const +{ + return VAbstractValApplication::ClearMessage(message).startsWith(patternMessageSignature); +} diff --git a/src/libs/vmisc/vabstractvalapplication.h b/src/libs/vmisc/vabstractvalapplication.h new file mode 100644 index 000000000..105040311 --- /dev/null +++ b/src/libs/vmisc/vabstractvalapplication.h @@ -0,0 +1,394 @@ +/************************************************************************ + ** + ** @file vabstractvalapplication.h + ** @author Roman Telezhynskyi + ** @date 15 10, 2020 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentina project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2020 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ +#ifndef VABSTRACTVALAPPLICATION_H +#define VABSTRACTVALAPPLICATION_H + +#include "vabstractapplication.h" + +#include + +class VAbstractValApplication;// use in define +class VAbstractPattern; +class VMainGraphicsView; +class QGraphicsScene; + +#if defined(qApp) +#undef qApp +#endif +#define qApp (static_cast(QCoreApplication::instance())) + +class VAbstractValApplication : public VAbstractApplication +{ + Q_OBJECT +public: + VAbstractValApplication(int &argc, char **argv); + virtual ~VAbstractValApplication() =default; + + QString GetCustomerName() const; + void SetCustomerName(const QString &name); + + QDate GetCustomerBirthDate() const; + void SetCustomerBirthDate(const QDate &date); + + QString CustomerEmail() const; + void SetCustomerEmail(const QString &email); + + Unit patternUnits() const; + const Unit *patternUnitsP() const; + void SetPatternUnits(const Unit &patternUnit); + + MeasurementsType GetMeasurementsType() const; + void SetMeasurementsType(const MeasurementsType &patternType); + + Unit MeasurementsUnits() const; + void SetMeasurementsUnits(const Unit &measurementsUnits); + + Unit DimensionSizeUnits() const; + void SetDimensionSizeUnits(const Unit &sizeUnits); + + double toPixel(double val) const; + double fromPixel(double pix) const; + + void setCurrentDocument(VAbstractPattern *doc); + VAbstractPattern *getCurrentDocument() const; + + VMainGraphicsView *getSceneView() const; + void setSceneView(VMainGraphicsView *value); + + QGraphicsScene *getCurrentScene() const; + void setCurrentScene(QGraphicsScene **value); + + QWidget *getMainWindow() const; + void setMainWindow(QWidget *value); + + QString GetPatternPath() const; + void SetPatternPath(const QString &value); + + QMap GetUserMaterials() const; + void SetUserMaterials(const QMap &userMaterials); + + const Draw &GetDrawMode() const; + void SetDrawMode(const Draw &value); + + bool getOpeningPattern() const; + void setOpeningPattern(); + + void PostPatternMessage(const QString &message, QtMsgType severity) const; + + static QString ClearMessage(QString msg); + + static const QString patternMessageSignature; + bool IsPatternMessage(const QString &message) const; + + qreal GetDimensionHeight() const; + void SetDimensionHeight(qreal dimensionHeight); + + qreal GetDimensionSize() const; + void SetDimensionSize(qreal dimensionSize); + + qreal GetDimensionHip() const; + void SetDimensionHip(qreal dimensionHip); + + qreal GetDimensionWaist() const; + void SetDimensionWaist(qreal dimensionWaist); + +protected: + QString m_customerName{}; + QDate m_customerBirthDate{}; + QString m_customerEmail{}; + + Unit m_patternUnits{Unit::Cm}; + MeasurementsType m_measurementsType{MeasurementsType::Unknown}; + Unit m_measurementsUnits{Unit::Cm}; + VAbstractPattern *m_doc{nullptr}; + VMainGraphicsView *m_sceneView{nullptr}; + QGraphicsScene **m_currentScene{nullptr}; + QString m_patternFilePath{}; + QMap m_userMaterials{}; + + qreal m_dimensionHeight{0}; + qreal m_dimensionSize{0}; + qreal m_dimensionHip{0}; + qreal m_dimensionWaist{0}; + + Unit m_dimensionSizeUnits{Unit::Cm}; + + /** + * @brief mainWindow pointer to main window. Usefull if need create modal dialog. Without pointer to main window + * modality doesn't work. + */ + QWidget *mainWindow{nullptr}; + + /** @brief mode keep current draw mode. */ + Draw m_mode{Draw::Calculation}; + + /** + * @brief openingPattern true when we opening pattern. If something will be wrong in formula this help understand if + * we can allow user use Undo option. + */ + bool openingPattern{false}; + +private: + Q_DISABLE_COPY(VAbstractValApplication) +}; + +//--------------------------------------------------------------------------------------------------------------------- +inline QString VAbstractValApplication::GetCustomerName() const +{ + return m_customerName; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline void VAbstractValApplication::SetCustomerName(const QString &name) +{ + m_customerName = name; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline Unit VAbstractValApplication::patternUnits() const +{ + return m_patternUnits; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline const Unit *VAbstractValApplication::patternUnitsP() const +{ + return &m_patternUnits; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline void VAbstractValApplication::SetPatternUnits(const Unit &patternUnit) +{ + m_patternUnits = patternUnit; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline MeasurementsType VAbstractValApplication::GetMeasurementsType() const +{ + return m_measurementsType; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline void VAbstractValApplication::SetMeasurementsType(const MeasurementsType &patternType) +{ + m_measurementsType = patternType; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline Unit VAbstractValApplication::MeasurementsUnits() const +{ + return m_measurementsUnits; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline void VAbstractValApplication::SetMeasurementsUnits(const Unit &measurementsUnits) +{ + m_measurementsUnits = measurementsUnits; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline Unit VAbstractValApplication::DimensionSizeUnits() const +{ + return m_dimensionSizeUnits; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline void VAbstractValApplication::SetDimensionSizeUnits(const Unit &sizeUnits) +{ + m_dimensionSizeUnits = sizeUnits; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline void VAbstractValApplication::setCurrentDocument(VAbstractPattern *doc) +{ + m_doc = doc; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline VAbstractPattern *VAbstractValApplication::getCurrentDocument() const +{ + return m_doc; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline VMainGraphicsView *VAbstractValApplication::getSceneView() const +{ + return m_sceneView; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline void VAbstractValApplication::setSceneView(VMainGraphicsView *value) +{ + m_sceneView = value; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline QGraphicsScene *VAbstractValApplication::getCurrentScene() const +{ + return *m_currentScene; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline void VAbstractValApplication::setCurrentScene(QGraphicsScene **value) +{ + m_currentScene = value; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline QWidget *VAbstractValApplication::getMainWindow() const +{ + return mainWindow; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline void VAbstractValApplication::setMainWindow(QWidget *value) +{ + mainWindow = value; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline QString VAbstractValApplication::GetPatternPath() const +{ + return m_patternFilePath; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline void VAbstractValApplication::SetPatternPath(const QString &value) +{ + m_patternFilePath = value; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline QMap VAbstractValApplication::GetUserMaterials() const +{ + return m_userMaterials; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline void VAbstractValApplication::SetUserMaterials(const QMap &userMaterials) +{ + m_userMaterials = userMaterials; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline const Draw &VAbstractValApplication::GetDrawMode() const +{ + return m_mode; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline void VAbstractValApplication::SetDrawMode(const Draw &value) +{ + m_mode = value; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline bool VAbstractValApplication::getOpeningPattern() const +{ + return openingPattern; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline void VAbstractValApplication::setOpeningPattern() +{ + openingPattern = !openingPattern; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline qreal VAbstractValApplication::GetDimensionHeight() const +{ + return m_dimensionHeight; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline void VAbstractValApplication::SetDimensionHeight(qreal dimensionHeight) +{ + m_dimensionHeight = dimensionHeight; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline qreal VAbstractValApplication::GetDimensionSize() const +{ + return m_dimensionSize; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline void VAbstractValApplication::SetDimensionSize(qreal dimensionSize) +{ + m_dimensionSize = dimensionSize; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline qreal VAbstractValApplication::GetDimensionHip() const +{ + return m_dimensionHip; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline void VAbstractValApplication::SetDimensionHip(qreal dimensionHip) +{ + m_dimensionHip = dimensionHip; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline qreal VAbstractValApplication::GetDimensionWaist() const +{ + return m_dimensionWaist; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline void VAbstractValApplication::SetDimensionWaist(qreal dimensionWaist) +{ + m_dimensionWaist = dimensionWaist; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline QDate VAbstractValApplication::GetCustomerBirthDate() const +{ + return m_customerBirthDate; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline void VAbstractValApplication::SetCustomerBirthDate(const QDate &date) +{ + m_customerBirthDate = date; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline QString VAbstractValApplication::CustomerEmail() const +{ + return m_customerEmail; +} + +//--------------------------------------------------------------------------------------------------------------------- +inline void VAbstractValApplication::SetCustomerEmail(const QString &email) +{ + m_customerEmail = email; +} + +#endif // VABSTRACTVALAPPLICATION_H diff --git a/src/libs/vmisc/vmisc.pri b/src/libs/vmisc/vmisc.pri index e62231411..0381a3d48 100644 --- a/src/libs/vmisc/vmisc.pri +++ b/src/libs/vmisc/vmisc.pri @@ -3,6 +3,7 @@ SOURCES += \ $$PWD/def.cpp \ + $$PWD/vabstractvalapplication.cpp \ $$PWD/vsettings.cpp \ $$PWD/vabstractapplication.cpp \ $$PWD/projectversion.cpp \ @@ -27,6 +28,7 @@ HEADERS += \ $$PWD/compatibility.h \ $$PWD/stable.h \ $$PWD/def.h \ + $$PWD/vabstractvalapplication.h \ $$PWD/vmath.h \ $$PWD/vsettings.h \ $$PWD/vabstractapplication.h \ diff --git a/src/libs/vpatterndb/variables/vmeasurement.h b/src/libs/vpatterndb/variables/vmeasurement.h index d54ea5f50..41f340965 100644 --- a/src/libs/vpatterndb/variables/vmeasurement.h +++ b/src/libs/vpatterndb/variables/vmeasurement.h @@ -116,6 +116,7 @@ public: QMap GetCorrections() const; void SetCorrections(const QMap &corrections); + // TODO: remove static QStringList ListHeights(const QMap &heights, Unit patternUnit); static QStringList ListSizes(const QMap &sizes, Unit patternUnit); static QStringList WholeListHeights(Unit patternUnit); diff --git a/src/libs/vpatterndb/vpassmark.cpp b/src/libs/vpatterndb/vpassmark.cpp index 88a7597bc..5edeb1ae5 100644 --- a/src/libs/vpatterndb/vpassmark.cpp +++ b/src/libs/vpatterndb/vpassmark.cpp @@ -29,7 +29,7 @@ #include #include "vpassmark.h" -#include "../vmisc/vabstractapplication.h" +#include "../vmisc/vabstractvalapplication.h" #include "../ifc/exception/vexceptioninvalidnotch.h" #include "../vgeometry/vabstractcurve.h" #include "../vgeometry/varc.h" @@ -579,7 +579,7 @@ QVector PassmarkBisectorBaseLine(PassmarkStatus seamPassmarkType, const "than minimal allowed.") .arg(passmarkData.nodeName, passmarkData.pieceName); qApp->IsPedantic() ? throw VException(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; return QVector(); } @@ -788,7 +788,7 @@ QVector VPassmark::BuiltInSAPassmarkBaseLine(const VPiece &piece) const "than minimal allowed.") .arg(m_data.nodeName, m_data.pieceName); qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; return QVector(); } } @@ -804,7 +804,7 @@ QVector VPassmark::BuiltInSAPassmarkBaseLine(const VPiece &piece) const "seam allowance. User must manually provide length.") .arg(m_data.nodeName, m_data.pieceName); qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; return QVector(); } } @@ -848,7 +848,7 @@ QVector VPassmark::SAPassmarkBaseLine(const QVector &seamAllowa const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2'. Seam allowance is " "empty.").arg(m_data.nodeName, m_data.pieceName); qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; return QVector(); // Something wrong } @@ -860,7 +860,7 @@ QVector VPassmark::SAPassmarkBaseLine(const QVector &seamAllowa "position for a notch.") .arg(m_data.nodeName, m_data.pieceName); qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; return QVector(); // Something wrong } @@ -870,7 +870,7 @@ QVector VPassmark::SAPassmarkBaseLine(const QVector &seamAllowa "notch position.") .arg(m_data.nodeName, m_data.pieceName); qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; } auto PassmarkIntersection = [this, seamAllowance] (QLineF line, qreal width) @@ -892,7 +892,7 @@ QVector VPassmark::SAPassmarkBaseLine(const QVector &seamAllowa "less than minimal allowed.") .arg(m_data.nodeName, m_data.pieceName); qApp->IsPedantic() ? throw VException(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; return QLineF(); } line.setLength(length); @@ -909,7 +909,7 @@ QVector VPassmark::SAPassmarkBaseLine(const QVector &seamAllowa "collapse.") .arg(m_data.nodeName, m_data.pieceName); qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; } } else @@ -918,7 +918,7 @@ QVector VPassmark::SAPassmarkBaseLine(const QVector &seamAllowa "intersection.") .arg(m_data.nodeName, m_data.pieceName); qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; } return QLineF(); @@ -933,7 +933,7 @@ QVector VPassmark::SAPassmarkBaseLine(const QVector &seamAllowa "than minimal allowed.") .arg(m_data.nodeName, m_data.pieceName); qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; } else { diff --git a/src/libs/vpatterndb/vpiece.cpp b/src/libs/vpatterndb/vpiece.cpp index 44ee8202a..b5c7ff486 100644 --- a/src/libs/vpatterndb/vpiece.cpp +++ b/src/libs/vpatterndb/vpiece.cpp @@ -34,7 +34,7 @@ #include "../vgeometry/vplacelabelitem.h" #include "../vgeometry/varc.h" #include "vcontainer.h" -#include "../vmisc/vabstractapplication.h" +#include "../vmisc/vabstractvalapplication.h" #include "../vmisc/compatibility.h" #include "../ifc/exception/vexceptioninvalidnotch.h" #include "../vlayout/testpath.h" @@ -937,7 +937,7 @@ bool VPiece::GetPassmarkPreviousSAPoints(const QVector &path, int in const QString errorMsg = tr("Cannot calculate a notch for point '%1' in piece '%2'.") .arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName()); qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; return false; // Something wrong } @@ -976,7 +976,7 @@ bool VPiece::GetPassmarkNextSAPoints(const QVector &path, int index, const QString errorMsg = tr("Cannot calculate a notch for point '%1' in piece '%2'.") .arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName()); qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; return false; // Something wrong } @@ -1060,7 +1060,7 @@ VPassmark VPiece::CreatePassmark(const QVector &path, int previousIn const QString errorMsg = tr("Cannot calculate a notch for point '%1' in piece '%2'.") .arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName()); qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; return VPassmark(); } @@ -1089,7 +1089,7 @@ VPassmark VPiece::CreatePassmark(const QVector &path, int previousIn const QString infoMsg = tr("Notch for point '%1' in piece '%2' will be disabled. Manual length is less than " "allowed value.") .arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName()); - qInfo() << VAbstractApplication::patternMessageSignature + infoMsg; + qInfo() << VAbstractValApplication::patternMessageSignature + infoMsg; return VPassmark(); } diff --git a/src/libs/vpatterndb/vpiecenode.cpp b/src/libs/vpatterndb/vpiecenode.cpp index db9b995bb..1798f2a02 100644 --- a/src/libs/vpatterndb/vpiecenode.cpp +++ b/src/libs/vpatterndb/vpiecenode.cpp @@ -31,7 +31,7 @@ #include "vcontainer.h" #include "calculator.h" #include "vformula.h" -#include "../vmisc/vabstractapplication.h" +#include "../vmisc/vabstractvalapplication.h" #include #include @@ -162,7 +162,7 @@ qreal VPieceNode::GetSABefore(const VContainer *data) const const QString errorMsg = QObject::tr("Cannot calculate seam allowance before for point '%1'. Reason: %2.") .arg(nodeName, formula.Reason()); qApp->IsPedantic() ? throw VException(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; return -1; } return formula.getDoubleValue(); @@ -193,7 +193,7 @@ qreal VPieceNode::GetSABefore(const VContainer *data, Unit unit) const const QString errorMsg = QObject::tr("Cannot calculate seam allowance before for point '%1'. Reason: %2.") .arg(nodeName, formula.Reason()); qApp->IsPedantic() ? throw VException(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; return -1; } @@ -245,7 +245,7 @@ qreal VPieceNode::GetSAAfter(const VContainer *data) const const QString errorMsg = QObject::tr("Cannot calculate seam allowance after for point '%1'. Reason: %2.") .arg(nodeName, formula.Reason()); qApp->IsPedantic() ? throw VException(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; return -1; } @@ -277,7 +277,7 @@ qreal VPieceNode::GetSAAfter(const VContainer *data, Unit unit) const const QString errorMsg = QObject::tr("Cannot calculate seam allowance after for point '%1'. Reason: ") .arg(nodeName, formula.Reason()); qApp->IsPedantic() ? throw VException(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; return -1; } @@ -343,7 +343,7 @@ qreal VPieceNode::GetPassmarkLength(const VContainer *data, Unit unit) const const QString errorMsg = QObject::tr("Cannot calculate passmark length for point '%1'. Reason: %2.") .arg(nodeName, formula.Reason()); qApp->IsPedantic() ? throw VException(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; return VSAPoint::maxPassmarkLength; } diff --git a/src/libs/vpatterndb/vpiecepath.cpp b/src/libs/vpatterndb/vpiecepath.cpp index 9ba8fa888..59c2ebb73 100644 --- a/src/libs/vpatterndb/vpiecepath.cpp +++ b/src/libs/vpatterndb/vpiecepath.cpp @@ -32,7 +32,7 @@ #include "../vgeometry/vpointf.h" #include "../vlayout/vabstractpiece.h" #include "calculator.h" -#include "../vmisc/vabstractapplication.h" +#include "../vmisc/vabstractvalapplication.h" #include "../vmisc/compatibility.h" #include "../ifc/exception/vexceptionobjecterror.h" @@ -385,7 +385,7 @@ QVector VPiecePath::PathPoints(const VContainer *data, const QVectorIsPedantic() ? throw VExceptionObjectError(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; } } @@ -402,7 +402,7 @@ QVector VPiecePath::PathPoints(const VContainer *data, const QVectorIsPedantic() ? throw VExceptionObjectError(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; } } diff --git a/src/libs/vtools/dialogs/support/dialogeditlabel.cpp b/src/libs/vtools/dialogs/support/dialogeditlabel.cpp index 8dd194a58..d31ccd589 100644 --- a/src/libs/vtools/dialogs/support/dialogeditlabel.cpp +++ b/src/libs/vtools/dialogs/support/dialogeditlabel.cpp @@ -500,7 +500,7 @@ void DialogEditLabel::InitPlaceholders() m_placeholders.insert(pl_patternNumber, qMakePair(tr("Pattern number"), m_doc->GetPatternNumber())); m_placeholders.insert(pl_author, qMakePair(tr("Company name or designer name"), m_doc->GetCompanyName())); - if (qApp->patternType() == MeasurementsType::Individual) + if (qApp->GetMeasurementsType() == MeasurementsType::Individual) { m_placeholders.insert(pl_customer, qMakePair(tr("Customer name"), qApp->GetCustomerName())); } @@ -520,13 +520,13 @@ void DialogEditLabel::InitPlaceholders() QString curSize; QString curHeight; QString mExt; - if (qApp->patternType() == MeasurementsType::Multisize) + if (qApp->GetMeasurementsType() == MeasurementsType::Multisize) { curSize = QString::number(VContainer::size(valentinaNamespace)); curHeight = QString::number(VContainer::height(valentinaNamespace)); mExt = "vst"; } - else if (qApp->patternType() == MeasurementsType::Individual) + else if (qApp->GetMeasurementsType() == MeasurementsType::Individual) { curSize = QString::number(VContainer::size(valentinaNamespace)); curHeight = QString::number(VContainer::height(valentinaNamespace)); @@ -553,20 +553,20 @@ void DialogEditLabel::InitPlaceholders() } // Piece tags - m_placeholders.insert(pl_pLetter, qMakePair(tr("Piece letter"), QString(QString()))); - m_placeholders.insert(pl_pAnnotation, qMakePair(tr("Piece annotation"), QString(QString()))); - m_placeholders.insert(pl_pOrientation, qMakePair(tr("Piece orientation"), QString(QString()))); - m_placeholders.insert(pl_pRotation, qMakePair(tr("Piece rotation"), QString(QString()))); - m_placeholders.insert(pl_pTilt, qMakePair(tr("Piece tilt"), QString(QString()))); - m_placeholders.insert(pl_pFoldPosition, qMakePair(tr("Piece fold position"), QString(QString()))); - m_placeholders.insert(pl_pName, qMakePair(tr("Piece name"), QString(QString()))); - m_placeholders.insert(pl_pQuantity, qMakePair(tr("Quantity"), QString(QString()))); + m_placeholders.insert(pl_pLetter, qMakePair(tr("Piece letter"), QString())); + m_placeholders.insert(pl_pAnnotation, qMakePair(tr("Piece annotation"), QString())); + m_placeholders.insert(pl_pOrientation, qMakePair(tr("Piece orientation"), QString())); + m_placeholders.insert(pl_pRotation, qMakePair(tr("Piece rotation"), QString())); + m_placeholders.insert(pl_pTilt, qMakePair(tr("Piece tilt"), QString())); + m_placeholders.insert(pl_pFoldPosition, qMakePair(tr("Piece fold position"), QString())); + m_placeholders.insert(pl_pName, qMakePair(tr("Piece name"), QString())); + m_placeholders.insert(pl_pQuantity, qMakePair(tr("Quantity"), QString())); m_placeholders.insert(pl_mFabric, qMakePair(tr("Material: Fabric"), tr("Fabric"))); m_placeholders.insert(pl_mLining, qMakePair(tr("Material: Lining"), tr("Lining"))); m_placeholders.insert(pl_mInterfacing, qMakePair(tr("Material: Interfacing"), tr("Interfacing"))); m_placeholders.insert(pl_mInterlining, qMakePair(tr("Material: Interlining"), tr("Interlining"))); m_placeholders.insert(pl_wCut, qMakePair(tr("Word: Cut"), tr("Cut"))); - m_placeholders.insert(pl_wOnFold, qMakePair(tr("Word: on fold"), QString(QString())));// By default should be empty + m_placeholders.insert(pl_wOnFold, qMakePair(tr("Word: on fold"), QString()));// By default should be empty } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp b/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp index a7d3663ab..2d09c188f 100644 --- a/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp +++ b/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp @@ -191,30 +191,30 @@ void DialogEditWrongFormula::ValChanged(int row) if (ui->radioButtonStandardTable->isChecked()) { const QSharedPointer stable = data->GetVariable(name); - SetDescription(item->text(), *stable->GetValue(), UnitsToStr(qApp->patternUnit(), true), + SetDescription(item->text(), *stable->GetValue(), UnitsToStr(qApp->patternUnits(), true), stable->GetGuiText()); } else if (ui->radioButtonIncrements->isChecked()) { const QSharedPointer incr = data->GetVariable(name); - SetDescription(item->text(), *incr->GetValue(), UnitsToStr(qApp->patternUnit(), true), + SetDescription(item->text(), *incr->GetValue(), UnitsToStr(qApp->patternUnits(), true), incr->GetDescription()); } else if (ui->radioButtonPC->isChecked()) { const QSharedPointer incr = data->GetVariable(name); - SetDescription(item->text(), *incr->GetValue(), UnitsToStr(qApp->patternUnit(), true), + SetDescription(item->text(), *incr->GetValue(), UnitsToStr(qApp->patternUnits(), true), incr->GetDescription()); } else if (ui->radioButtonLengthLine->isChecked()) { SetDescription(item->text(), *data->GetVariable(name)->GetValue(), - UnitsToStr(qApp->patternUnit(), true), tr("Line length")); + UnitsToStr(qApp->patternUnits(), true), tr("Line length")); } else if (ui->radioButtonLengthSpline->isChecked()) { SetDescription(item->text(), *data->GetVariable(name)->GetValue(), - UnitsToStr(qApp->patternUnit(), true), tr("Curve length")); + UnitsToStr(qApp->patternUnits(), true), tr("Curve length")); } else if (ui->radioButtonAngleLine->isChecked()) { @@ -224,7 +224,7 @@ void DialogEditWrongFormula::ValChanged(int row) else if (ui->radioButtonRadiusesArcs->isChecked()) { SetDescription(item->text(), *data->GetVariable(name)->GetValue(), - UnitsToStr(qApp->patternUnit(), true), tr("Arc radius")); + UnitsToStr(qApp->patternUnits(), true), tr("Arc radius")); } else if (ui->radioButtonAnglesCurves->isChecked()) { diff --git a/src/libs/vtools/dialogs/support/dialogundo.cpp b/src/libs/vtools/dialogs/support/dialogundo.cpp index 658ca7041..ba6d48eec 100644 --- a/src/libs/vtools/dialogs/support/dialogundo.cpp +++ b/src/libs/vtools/dialogs/support/dialogundo.cpp @@ -33,7 +33,7 @@ #include #include -#include "../vmisc/vabstractapplication.h" +#include "../vmisc/vabstractvalapplication.h" #include "../vmisc/vcommonsettings.h" #include "ui_dialogundo.h" diff --git a/src/libs/vtools/dialogs/tools/dialogalongline.cpp b/src/libs/vtools/dialogs/tools/dialogalongline.cpp index 787dad156..7a3da95c7 100644 --- a/src/libs/vtools/dialogs/tools/dialogalongline.cpp +++ b/src/libs/vtools/dialogs/tools/dialogalongline.cpp @@ -141,7 +141,7 @@ void DialogAlongLine::FXLength() DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit length")); dialog->SetFormula(GetFormula()); - dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true)); if (dialog->exec() == QDialog::Accepted) { SetFormula(dialog->GetFormula()); @@ -157,7 +157,7 @@ void DialogAlongLine::EvalFormula() formulaData.variables = data->DataVariables(); formulaData.labelEditFormula = ui->labelEditFormula; formulaData.labelResult = ui->labelResultCalculation; - formulaData.postfix = UnitsToStr(qApp->patternUnit(), true); + formulaData.postfix = UnitsToStr(qApp->patternUnits(), true); formulaData.checkZero = false; Eval(formulaData, flagFormula); diff --git a/src/libs/vtools/dialogs/tools/dialogarc.cpp b/src/libs/vtools/dialogs/tools/dialogarc.cpp index beaed8f44..b69adf174 100644 --- a/src/libs/vtools/dialogs/tools/dialogarc.cpp +++ b/src/libs/vtools/dialogs/tools/dialogarc.cpp @@ -328,7 +328,7 @@ void DialogArc::FXRadius() DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit radius")); dialog->SetFormula(GetRadius()); - dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true)); if (dialog->exec() == QDialog::Accepted) { SetRadius(dialog->GetFormula()); @@ -375,7 +375,7 @@ void DialogArc::EvalRadius() formulaData.variables = data->DataVariables(); formulaData.labelEditFormula = ui->labelEditRadius; formulaData.labelResult = ui->labelResultRadius; - formulaData.postfix = UnitsToStr(qApp->patternUnit(), true); + formulaData.postfix = UnitsToStr(qApp->patternUnits(), true); const qreal radius = Eval(formulaData, flagRadius); diff --git a/src/libs/vtools/dialogs/tools/dialogarcwithlength.cpp b/src/libs/vtools/dialogs/tools/dialogarcwithlength.cpp index ee683aa07..36c8f9126 100644 --- a/src/libs/vtools/dialogs/tools/dialogarcwithlength.cpp +++ b/src/libs/vtools/dialogs/tools/dialogarcwithlength.cpp @@ -290,7 +290,7 @@ void DialogArcWithLength::FXRadius() DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit radius")); dialog->SetFormula(GetRadius()); - dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true)); if (dialog->exec() == QDialog::Accepted) { SetRadius(dialog->GetFormula()); @@ -318,7 +318,7 @@ void DialogArcWithLength::FXLength() DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit the arc length")); dialog->SetFormula(GetLength()); - dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true)); if (dialog->exec() == QDialog::Accepted) { SetLength(dialog->GetFormula()); @@ -367,7 +367,7 @@ void DialogArcWithLength::Radius() formulaData.variables = data->DataVariables(); formulaData.labelEditFormula = ui->labelEditRadius; formulaData.labelResult = ui->labelResultRadius; - formulaData.postfix = UnitsToStr(qApp->patternUnit(), true); + formulaData.postfix = UnitsToStr(qApp->patternUnits(), true); formulaData.checkLessThanZero = true; Eval(formulaData, flagRadius); @@ -381,7 +381,7 @@ void DialogArcWithLength::Length() formulaData.variables = data->DataVariables(); formulaData.labelEditFormula = ui->labelEditLength; formulaData.labelResult = ui->labelResultLength; - formulaData.postfix = UnitsToStr(qApp->patternUnit(), true); + formulaData.postfix = UnitsToStr(qApp->patternUnits(), true); Eval(formulaData, flagLength); } diff --git a/src/libs/vtools/dialogs/tools/dialogbisector.cpp b/src/libs/vtools/dialogs/tools/dialogbisector.cpp index 802538840..02149eb73 100644 --- a/src/libs/vtools/dialogs/tools/dialogbisector.cpp +++ b/src/libs/vtools/dialogs/tools/dialogbisector.cpp @@ -139,7 +139,7 @@ void DialogBisector::FXLength() DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit length")); dialog->SetFormula(GetFormula()); - dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true)); if (dialog->exec() == QDialog::Accepted) { SetFormula(dialog->GetFormula()); @@ -155,7 +155,7 @@ void DialogBisector::EvalFormula() formulaData.variables = data->DataVariables(); formulaData.labelEditFormula = ui->labelEditFormula; formulaData.labelResult = ui->labelResultCalculation; - formulaData.postfix = UnitsToStr(qApp->patternUnit(), true); + formulaData.postfix = UnitsToStr(qApp->patternUnits(), true); formulaData.checkZero = false; Eval(formulaData, flagFormula); diff --git a/src/libs/vtools/dialogs/tools/dialogcutarc.cpp b/src/libs/vtools/dialogs/tools/dialogcutarc.cpp index f69231475..58a4e1132 100644 --- a/src/libs/vtools/dialogs/tools/dialogcutarc.cpp +++ b/src/libs/vtools/dialogs/tools/dialogcutarc.cpp @@ -102,7 +102,7 @@ void DialogCutArc::FXLength() DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit length")); dialog->SetFormula(GetFormula()); - dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true)); if (dialog->exec() == QDialog::Accepted) { SetFormula(dialog->GetFormula()); @@ -118,7 +118,7 @@ void DialogCutArc::EvalFormula() formulaData.variables = data->DataVariables(); formulaData.labelEditFormula = ui->labelEditFormula; formulaData.labelResult = ui->labelResultCalculation; - formulaData.postfix = UnitsToStr(qApp->patternUnit(), true); + formulaData.postfix = UnitsToStr(qApp->patternUnits(), true); formulaData.checkZero = false; Eval(formulaData, flagFormula); diff --git a/src/libs/vtools/dialogs/tools/dialogcutspline.cpp b/src/libs/vtools/dialogs/tools/dialogcutspline.cpp index 9b6c00ec0..57eca1a02 100644 --- a/src/libs/vtools/dialogs/tools/dialogcutspline.cpp +++ b/src/libs/vtools/dialogs/tools/dialogcutspline.cpp @@ -217,7 +217,7 @@ void DialogCutSpline::FXLength() DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit length")); dialog->SetFormula(GetFormula()); - dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true)); if (dialog->exec() == QDialog::Accepted) { SetFormula(dialog->GetFormula()); @@ -233,7 +233,7 @@ void DialogCutSpline::EvalFormula() formulaData.variables = data->DataVariables(); formulaData.labelEditFormula = ui->labelEditFormula; formulaData.labelResult = ui->labelResultCalculation; - formulaData.postfix = UnitsToStr(qApp->patternUnit(), true); + formulaData.postfix = UnitsToStr(qApp->patternUnits(), true); formulaData.checkZero = false; Eval(formulaData, flagFormula); diff --git a/src/libs/vtools/dialogs/tools/dialogcutsplinepath.cpp b/src/libs/vtools/dialogs/tools/dialogcutsplinepath.cpp index 3492f4dcd..500c44bd4 100644 --- a/src/libs/vtools/dialogs/tools/dialogcutsplinepath.cpp +++ b/src/libs/vtools/dialogs/tools/dialogcutsplinepath.cpp @@ -217,7 +217,7 @@ void DialogCutSplinePath::FXLength() DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit length")); dialog->SetFormula(GetFormula()); - dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true)); if (dialog->exec() == QDialog::Accepted) { SetFormula(dialog->GetFormula()); @@ -233,7 +233,7 @@ void DialogCutSplinePath::EvalFormula() formulaData.variables = data->DataVariables(); formulaData.labelEditFormula = ui->labelEditFormula; formulaData.labelResult = ui->labelResultCalculation; - formulaData.postfix = UnitsToStr(qApp->patternUnit(), true); + formulaData.postfix = UnitsToStr(qApp->patternUnits(), true); formulaData.checkZero = false; Eval(formulaData, flagFormula); diff --git a/src/libs/vtools/dialogs/tools/dialogellipticalarc.cpp b/src/libs/vtools/dialogs/tools/dialogellipticalarc.cpp index 03284d2c5..6c5a409a6 100644 --- a/src/libs/vtools/dialogs/tools/dialogellipticalarc.cpp +++ b/src/libs/vtools/dialogs/tools/dialogellipticalarc.cpp @@ -387,7 +387,7 @@ void DialogEllipticalArc::EvalRadiuses() formulaData.variables = data->DataVariables(); formulaData.labelEditFormula = ui->labelEditRadius1; formulaData.labelResult = ui->labelResultRadius1; - formulaData.postfix = UnitsToStr(qApp->patternUnit(), true); + formulaData.postfix = UnitsToStr(qApp->patternUnits(), true); formulaData.checkLessThanZero = true; Eval(formulaData, flagRadius1); @@ -434,7 +434,7 @@ void DialogEllipticalArc::FXRadius1() DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit radius1")); dialog->SetFormula(GetRadius1()); - dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true)); if (dialog->exec() == QDialog::Accepted) { SetRadius1(dialog->GetFormula()); @@ -448,7 +448,7 @@ void DialogEllipticalArc::FXRadius2() DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit radius2")); dialog->SetFormula(GetRadius2()); - dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true)); if (dialog->exec() == QDialog::Accepted) { SetRadius2(dialog->GetFormula()); diff --git a/src/libs/vtools/dialogs/tools/dialogendline.cpp b/src/libs/vtools/dialogs/tools/dialogendline.cpp index b8cef020f..89f1e4801 100644 --- a/src/libs/vtools/dialogs/tools/dialogendline.cpp +++ b/src/libs/vtools/dialogs/tools/dialogendline.cpp @@ -150,7 +150,7 @@ void DialogEndLine::EvalLength() formulaData.variables = data->DataVariables(); formulaData.labelEditFormula = ui->labelEditFormula; formulaData.labelResult = ui->labelResultCalculation; - formulaData.postfix = UnitsToStr(qApp->patternUnit(), true); + formulaData.postfix = UnitsToStr(qApp->patternUnits(), true); formulaData.checkLessThanZero = false; Eval(formulaData, flagFormula); @@ -188,7 +188,7 @@ void DialogEndLine::FXLength() DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit length")); dialog->SetFormula(GetFormula()); - dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true)); if (dialog->exec() == QDialog::Accepted) { SetFormula(dialog->GetFormula()); diff --git a/src/libs/vtools/dialogs/tools/dialogmove.cpp b/src/libs/vtools/dialogs/tools/dialogmove.cpp index c079a97a5..0105f8e4b 100644 --- a/src/libs/vtools/dialogs/tools/dialogmove.cpp +++ b/src/libs/vtools/dialogs/tools/dialogmove.cpp @@ -479,7 +479,7 @@ void DialogMove::FXLength() DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit length")); dialog->SetFormula(GetLength()); - dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true)); if (dialog->exec() == QDialog::Accepted) { SetLength(dialog->GetFormula()); @@ -630,7 +630,7 @@ void DialogMove::EvalLength() formulaData.variables = data->DataVariables(); formulaData.labelEditFormula = ui->labelEditLength; formulaData.labelResult = ui->labelResultLength; - formulaData.postfix = UnitsToStr(qApp->patternUnit(), true); + formulaData.postfix = UnitsToStr(qApp->patternUnits(), true); Eval(formulaData, flagLength); } diff --git a/src/libs/vtools/dialogs/tools/dialognormal.cpp b/src/libs/vtools/dialogs/tools/dialognormal.cpp index 749d0931d..3c727291f 100644 --- a/src/libs/vtools/dialogs/tools/dialognormal.cpp +++ b/src/libs/vtools/dialogs/tools/dialognormal.cpp @@ -141,7 +141,7 @@ void DialogNormal::FXLength() DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit length")); dialog->SetFormula(GetFormula()); - dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true)); if (dialog->exec() == QDialog::Accepted) { SetFormula(dialog->GetFormula()); @@ -157,7 +157,7 @@ void DialogNormal::EvalFormula() formulaData.variables = data->DataVariables(); formulaData.labelEditFormula = ui->labelEditFormula; formulaData.labelResult = ui->labelResultCalculation; - formulaData.postfix = UnitsToStr(qApp->patternUnit(), true); + formulaData.postfix = UnitsToStr(qApp->patternUnits(), true); Eval(formulaData, flagFormula); } diff --git a/src/libs/vtools/dialogs/tools/dialogpointfromcircleandtangent.cpp b/src/libs/vtools/dialogs/tools/dialogpointfromcircleandtangent.cpp index 1ea5dc7d6..cf7e656c1 100644 --- a/src/libs/vtools/dialogs/tools/dialogpointfromcircleandtangent.cpp +++ b/src/libs/vtools/dialogs/tools/dialogpointfromcircleandtangent.cpp @@ -272,7 +272,7 @@ void DialogPointFromCircleAndTangent::FXCircleRadius() DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit radius")); dialog->SetFormula(GetCircleRadius()); - dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true)); if (dialog->exec() == QDialog::Accepted) { SetCircleRadius(dialog->GetFormula()); @@ -288,7 +288,7 @@ void DialogPointFromCircleAndTangent::EvalCircleRadius() formulaData.variables = data->DataVariables(); formulaData.labelEditFormula = ui->labelEditRadius; formulaData.labelResult = ui->labelResultCircleRadius; - formulaData.postfix = UnitsToStr(qApp->patternUnit(), true); + formulaData.postfix = UnitsToStr(qApp->patternUnits(), true); const qreal radius = Eval(formulaData, flagCircleRadius); diff --git a/src/libs/vtools/dialogs/tools/dialogpointofcontact.cpp b/src/libs/vtools/dialogs/tools/dialogpointofcontact.cpp index 74743ca3a..36f303936 100644 --- a/src/libs/vtools/dialogs/tools/dialogpointofcontact.cpp +++ b/src/libs/vtools/dialogs/tools/dialogpointofcontact.cpp @@ -149,7 +149,7 @@ void DialogPointOfContact::FXRadius() DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit radius")); dialog->SetFormula(getRadius()); - dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true)); if (dialog->exec() == QDialog::Accepted) { setRadius(dialog->GetFormula()); @@ -165,7 +165,7 @@ void DialogPointOfContact::EvalFormula() formulaData.variables = data->DataVariables(); formulaData.labelEditFormula = ui->labelEditFormula; formulaData.labelResult = ui->labelResultCalculation; - formulaData.postfix = UnitsToStr(qApp->patternUnit(), true); + formulaData.postfix = UnitsToStr(qApp->patternUnits(), true); Eval(formulaData, flagFormula); } diff --git a/src/libs/vtools/dialogs/tools/dialogpointofintersectioncircles.cpp b/src/libs/vtools/dialogs/tools/dialogpointofintersectioncircles.cpp index 9691d0775..ee63bcc80 100644 --- a/src/libs/vtools/dialogs/tools/dialogpointofintersectioncircles.cpp +++ b/src/libs/vtools/dialogs/tools/dialogpointofintersectioncircles.cpp @@ -323,7 +323,7 @@ void DialogPointOfIntersectionCircles::FXCircle1Radius() DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit first circle radius")); dialog->SetFormula(GetFirstCircleRadius()); - dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true)); if (dialog->exec() == QDialog::Accepted) { SetFirstCircleRadius(dialog->GetFormula()); @@ -337,7 +337,7 @@ void DialogPointOfIntersectionCircles::FXCircle2Radius() DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit second circle radius")); dialog->SetFormula(GetSecondCircleRadius()); - dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true)); if (dialog->exec() == QDialog::Accepted) { SetSecondCircleRadius(dialog->GetFormula()); @@ -353,7 +353,7 @@ void DialogPointOfIntersectionCircles::EvalCircle1Radius() formulaData.variables = data->DataVariables(); formulaData.labelEditFormula = ui->labelEditCircle1Radius; formulaData.labelResult = ui->labelResultCircle1Radius; - formulaData.postfix = UnitsToStr(qApp->patternUnit(), true); + formulaData.postfix = UnitsToStr(qApp->patternUnits(), true); const qreal radius = Eval(formulaData, flagCircle1Radius); @@ -376,7 +376,7 @@ void DialogPointOfIntersectionCircles::EvalCircle2Radius() formulaData.variables = data->DataVariables(); formulaData.labelEditFormula = ui->labelEditCircle2Radius; formulaData.labelResult = ui->labelResultCircle2Radius; - formulaData.postfix = UnitsToStr(qApp->patternUnit(), true); + formulaData.postfix = UnitsToStr(qApp->patternUnits(), true); const qreal radius = Eval(formulaData, flagCircle2Radius); diff --git a/src/libs/vtools/dialogs/tools/dialogshoulderpoint.cpp b/src/libs/vtools/dialogs/tools/dialogshoulderpoint.cpp index affd4479d..8c8d6b5d4 100644 --- a/src/libs/vtools/dialogs/tools/dialogshoulderpoint.cpp +++ b/src/libs/vtools/dialogs/tools/dialogshoulderpoint.cpp @@ -139,7 +139,7 @@ void DialogShoulderPoint::FXLength() DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit length")); dialog->SetFormula(GetFormula()); - dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true)); if (dialog->exec() == QDialog::Accepted) { SetFormula(dialog->GetFormula()); @@ -155,7 +155,7 @@ void DialogShoulderPoint::EvalFormula() formulaData.variables = data->DataVariables(); formulaData.labelEditFormula = ui->labelEditFormula; formulaData.labelResult = ui->labelResultCalculation; - formulaData.postfix = UnitsToStr(qApp->patternUnit(), true); + formulaData.postfix = UnitsToStr(qApp->patternUnits(), true); Eval(formulaData, flagFormula); } diff --git a/src/libs/vtools/dialogs/tools/dialogspline.cpp b/src/libs/vtools/dialogs/tools/dialogspline.cpp index e6da0a10f..0cda9f9da 100644 --- a/src/libs/vtools/dialogs/tools/dialogspline.cpp +++ b/src/libs/vtools/dialogs/tools/dialogspline.cpp @@ -321,7 +321,7 @@ void DialogSpline::FXLength1() QString length1F = qApp->TrVars()->TryFormulaFromUser(ui->plainTextEditLength1F->toPlainText(), qApp->Settings()->GetOsSeparator()); dialog->SetFormula(length1F); - dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true)); if (dialog->exec() == QDialog::Accepted) { length1F = qApp->TrVars()->FormulaToUser(dialog->GetFormula(), qApp->Settings()->GetOsSeparator()); @@ -344,7 +344,7 @@ void DialogSpline::FXLength2() QString length2F = qApp->TrVars()->TryFormulaFromUser(ui->plainTextEditLength2F->toPlainText(), qApp->Settings()->GetOsSeparator()); dialog->SetFormula(length2F); - dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true)); if (dialog->exec() == QDialog::Accepted) { length2F = qApp->TrVars()->FormulaToUser(dialog->GetFormula(), qApp->Settings()->GetOsSeparator()); @@ -407,7 +407,7 @@ void DialogSpline::EvalLength1() formulaData.variables = data->DataVariables(); formulaData.labelEditFormula = ui->labelEditLength1; formulaData.labelResult = ui->labelResultLength1; - formulaData.postfix = UnitsToStr(qApp->patternUnit(), true); + formulaData.postfix = UnitsToStr(qApp->patternUnits(), true); formulaData.checkZero = false; formulaData.checkLessThanZero = true; @@ -422,7 +422,7 @@ void DialogSpline::EvalLength2() formulaData.variables = data->DataVariables(); formulaData.labelEditFormula = ui->labelEditLength2; formulaData.labelResult = ui->labelResultLength2; - formulaData.postfix = UnitsToStr(qApp->patternUnit(), true); + formulaData.postfix = UnitsToStr(qApp->patternUnits(), true); formulaData.checkZero = false; formulaData.checkLessThanZero = true; diff --git a/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp b/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp index ab2f9694a..232e2c6c3 100644 --- a/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp +++ b/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp @@ -447,7 +447,7 @@ void DialogSplinePath::FXLength1() qApp->Settings()->GetOsSeparator()); dialog->SetFormula(length1F); - dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true)); if (dialog->exec() == QDialog::Accepted) { length1F = VTranslateVars::TryFormulaToUser(dialog->GetFormula(), qApp->Settings()->GetOsSeparator()); @@ -472,7 +472,7 @@ void DialogSplinePath::FXLength2() qApp->Settings()->GetOsSeparator()); dialog->SetFormula(length2F); - dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true)); if (dialog->exec() == QDialog::Accepted) { length2F = VTranslateVars::TryFormulaToUser(dialog->GetFormula(), qApp->Settings()->GetOsSeparator()); @@ -553,7 +553,7 @@ void DialogSplinePath::EvalLength1() formulaData.variables = data->DataVariables(); formulaData.labelEditFormula = ui->labelEditLength1; formulaData.labelResult = ui->labelResultLength1; - formulaData.postfix = UnitsToStr(qApp->patternUnit(), true); + formulaData.postfix = UnitsToStr(qApp->patternUnits(), true); formulaData.checkZero = false; formulaData.checkLessThanZero = true; @@ -580,7 +580,7 @@ void DialogSplinePath::EvalLength2() formulaData.variables = data->DataVariables(); formulaData.labelEditFormula = ui->labelEditLength2; formulaData.labelResult = ui->labelResultLength2; - formulaData.postfix = UnitsToStr(qApp->patternUnit(), true); + formulaData.postfix = UnitsToStr(qApp->patternUnits(), true); formulaData.checkZero = false; formulaData.checkLessThanZero = true; diff --git a/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp b/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp index d87813835..19ec44b48 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp +++ b/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp @@ -545,7 +545,7 @@ void DialogPiecePath::PassmarkChanged(int index) if (passmarkLength.isEmpty()) { - qreal length = UnitConvertor(1, Unit::Cm, qApp->patternUnit()); + qreal length = UnitConvertor(1, Unit::Cm, qApp->patternUnits()); ui->plainTextEditPassmarkLength->setPlainText(qApp->LocaleToString(length)); } else @@ -555,7 +555,7 @@ void DialogPiecePath::PassmarkChanged(int index) } else { - qreal length = UnitConvertor(1, Unit::Cm, qApp->patternUnit()); + qreal length = UnitConvertor(1, Unit::Cm, qApp->patternUnits()); ui->plainTextEditPassmarkLength->setPlainText(qApp->LocaleToString(length)); } @@ -796,7 +796,7 @@ void DialogPiecePath::EvalWidth() formulaData.variables = data->DataVariables(); formulaData.labelEditFormula = ui->labelEditWidth; formulaData.labelResult = ui->labelResultWidth; - formulaData.postfix = UnitsToStr(qApp->patternUnit(), true); + formulaData.postfix = UnitsToStr(qApp->patternUnits(), true); formulaData.checkZero = false; formulaData.checkLessThanZero = true; @@ -827,7 +827,7 @@ void DialogPiecePath::EvalWidthBefore() formulaData.variables = data->DataVariables(); formulaData.labelEditFormula = ui->labelEditBefore; formulaData.labelResult = ui->labelResultBefore; - formulaData.postfix = UnitsToStr(qApp->patternUnit(), true); + formulaData.postfix = UnitsToStr(qApp->patternUnits(), true); formulaData.checkZero = false; formulaData.checkLessThanZero = true; @@ -862,7 +862,7 @@ void DialogPiecePath::EvalWidthAfter() formulaData.variables = data->DataVariables(); formulaData.labelEditFormula = ui->labelEditAfter; formulaData.labelResult = ui->labelResultAfter; - formulaData.postfix = UnitsToStr(qApp->patternUnit(), true); + formulaData.postfix = UnitsToStr(qApp->patternUnits(), true); formulaData.checkZero = false; formulaData.checkLessThanZero = true; @@ -910,7 +910,7 @@ void DialogPiecePath::EvalPassmarkLength() formulaData.variables = data->DataVariables(); formulaData.labelEditFormula = ui->labelEditPassmarkLength; formulaData.labelResult = ui->labelResultPassmarkLength; - formulaData.postfix = UnitsToStr(qApp->patternUnit(), true); + formulaData.postfix = UnitsToStr(qApp->patternUnits(), true); formulaData.checkZero = false; formulaData.checkLessThanZero = false; @@ -927,7 +927,7 @@ void DialogPiecePath::FXWidth() dialog->setWindowTitle(tr("Edit seam allowance width")); dialog->SetFormula(GetFormulaSAWidth()); dialog->setCheckLessThanZero(true); - dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true)); if (dialog->exec() == QDialog::Accepted) { SetFormulaSAWidth(dialog->GetFormula()); @@ -941,7 +941,7 @@ void DialogPiecePath::FXWidthBefore() dialog->setWindowTitle(tr("Edit seam allowance width before")); dialog->SetFormula(GetFormulaSAWidthBefore()); dialog->setCheckLessThanZero(true); - dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true)); if (dialog->exec() == QDialog::Accepted) { SetCurrentSABefore(dialog->GetFormula()); @@ -955,7 +955,7 @@ void DialogPiecePath::FXWidthAfter() dialog->setWindowTitle(tr("Edit seam allowance width after")); dialog->SetFormula(GetFormulaSAWidthAfter()); dialog->setCheckLessThanZero(true); - dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true)); if (dialog->exec() == QDialog::Accepted) { SetCurrentSAAfter(dialog->GetFormula()); @@ -980,7 +980,7 @@ void DialogPiecePath::FXPassmarkLength() QScopedPointer dialog(new DialogEditWrongFormula(data, toolId, this)); dialog->setWindowTitle(tr("Edit passmark length")); dialog->SetFormula(GetFormulaPassmarkLength()); - dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true)); if (dialog->exec() == QDialog::Accepted) { SetFormulaPassmarkLength(dialog->GetFormula()); @@ -1099,7 +1099,7 @@ void DialogPiecePath::InitSeamAllowanceTab() connect(m_timerWidthAfter, &QTimer::timeout, this, &DialogPiecePath::EvalWidthAfter); // Default value for seam allowence is 1 cm. But pattern have different units, so just set 1 in dialog not enough. - m_saWidth = UnitConvertor(1, Unit::Cm, qApp->patternUnit()); + m_saWidth = UnitConvertor(1, Unit::Cm, qApp->patternUnits()); ui->plainTextEditFormulaWidth->setPlainText(qApp->LocaleToString(m_saWidth)); InitNodesList(); diff --git a/src/libs/vtools/dialogs/tools/piece/dialogplacelabel.cpp b/src/libs/vtools/dialogs/tools/piece/dialogplacelabel.cpp index da2049771..b5e4e59b4 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialogplacelabel.cpp +++ b/src/libs/vtools/dialogs/tools/piece/dialogplacelabel.cpp @@ -315,7 +315,7 @@ void DialogPlaceLabel::EvalWidth() formulaData.variables = data->DataVariables(); formulaData.labelEditFormula = ui->labelEditFormulaWidth; formulaData.labelResult = ui->labelResultCalculationWidth; - formulaData.postfix = UnitsToStr(qApp->patternUnit(), true); + formulaData.postfix = UnitsToStr(qApp->patternUnits(), true); formulaData.checkLessThanZero = true; Eval(formulaData, m_flagWidth); @@ -329,7 +329,7 @@ void DialogPlaceLabel::EvalHeight() formulaData.variables = data->DataVariables(); formulaData.labelEditFormula = ui->labelEditFormulaHeight; formulaData.labelResult = ui->labelResultCalculationHeight; - formulaData.postfix = UnitsToStr(qApp->patternUnit(), true); + formulaData.postfix = UnitsToStr(qApp->patternUnits(), true); formulaData.checkLessThanZero = true; Eval(formulaData, m_flagHeight); @@ -370,7 +370,7 @@ void DialogPlaceLabel::FXWidth() QScopedPointer dialog(new DialogEditWrongFormula(data, toolId, this)); dialog->setWindowTitle(tr("Edit rectangle width")); dialog->SetFormula(GetWidth()); - dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true)); if (dialog->exec() == QDialog::Accepted) { SetWidth(dialog->GetFormula()); @@ -383,7 +383,7 @@ void DialogPlaceLabel::FXHeight() QScopedPointer dialog(new DialogEditWrongFormula(data, toolId, this)); dialog->setWindowTitle(tr("Edit rectangle width")); dialog->SetFormula(GetHeight()); - dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true)); if (dialog->exec() == QDialog::Accepted) { SetHeight(dialog->GetFormula()); @@ -429,8 +429,8 @@ void DialogPlaceLabel::InitPlaceLabelTab() ui->plainTextEditFormulaHeight->installEventFilter(this); ui->plainTextEditFormulaAngle->installEventFilter(this); - ui->plainTextEditFormulaWidth->setPlainText(QString::number(UnitConvertor(1, Unit::Cm, qApp->patternUnit()))); - ui->plainTextEditFormulaHeight->setPlainText(QString::number(UnitConvertor(1, Unit::Cm, qApp->patternUnit()))); + ui->plainTextEditFormulaWidth->setPlainText(QString::number(UnitConvertor(1, Unit::Cm, qApp->patternUnits()))); + ui->plainTextEditFormulaHeight->setPlainText(QString::number(UnitConvertor(1, Unit::Cm, qApp->patternUnits()))); connect(ui->toolButtonExprWidth, &QPushButton::clicked, this, &DialogPlaceLabel::FXWidth); connect(ui->toolButtonExprHeight, &QPushButton::clicked, this, &DialogPlaceLabel::FXHeight); diff --git a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp index 964493504..73103d4c8 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp @@ -1050,7 +1050,7 @@ void DialogSeamAllowance::PassmarkChanged(int index) if (passmarkLength.isEmpty()) { - qreal length = UnitConvertor(1, Unit::Cm, qApp->patternUnit()); + qreal length = UnitConvertor(1, Unit::Cm, qApp->patternUnits()); uiTabPassmarks->plainTextEditPassmarkLength->setPlainText(qApp->LocaleToString(length)); } else @@ -1060,7 +1060,7 @@ void DialogSeamAllowance::PassmarkChanged(int index) } else { - qreal length = UnitConvertor(1, Unit::Cm, qApp->patternUnit()); + qreal length = UnitConvertor(1, Unit::Cm, qApp->patternUnits()); uiTabPassmarks->plainTextEditPassmarkLength->setPlainText(qApp->LocaleToString(length)); } @@ -1598,7 +1598,7 @@ void DialogSeamAllowance::UpdateGrainlineValues() { plbVal = uiTabGrainline->labelLen; plbText = uiTabGrainline->labelEditLen; - qsUnit = QChar(QChar::Space) + UnitsToStr(qApp->patternUnit()); + qsUnit = QChar(QChar::Space) + UnitsToStr(qApp->patternUnits()); } plbVal->setToolTip(tr("Value")); @@ -1667,13 +1667,13 @@ void DialogSeamAllowance::UpdateDetailLabelValues() { plbVal = uiTabLabels->labelDLWidth; plbText = uiTabLabels->labelEditDLWidth; - qsUnit = QChar(QChar::Space) + UnitsToStr(qApp->patternUnit()); + qsUnit = QChar(QChar::Space) + UnitsToStr(qApp->patternUnits()); } else if (i == 1) { plbVal = uiTabLabels->labelDLHeight; plbText = uiTabLabels->labelEditDLHeight; - qsUnit = QChar(QChar::Space) + UnitsToStr(qApp->patternUnit()); + qsUnit = QChar(QChar::Space) + UnitsToStr(qApp->patternUnits()); } else { @@ -1753,13 +1753,13 @@ void DialogSeamAllowance::UpdatePatternLabelValues() { plbVal = uiTabLabels->labelPLWidth; plbText = uiTabLabels->labelEditPLWidth; - qsUnit = QChar(QChar::Space) + UnitsToStr(qApp->patternUnit()); + qsUnit = QChar(QChar::Space) + UnitsToStr(qApp->patternUnits()); } else if (i == 1) { plbVal = uiTabLabels->labelPLHeight; plbText = uiTabLabels->labelEditPLHeight; - qsUnit = QChar(QChar::Space) + UnitsToStr(qApp->patternUnit()); + qsUnit = QChar(QChar::Space) + UnitsToStr(qApp->patternUnits()); } else { @@ -2133,7 +2133,7 @@ void DialogSeamAllowance::EvalWidth() formulaData.variables = data->DataVariables(); formulaData.labelEditFormula = uiTabPaths->labelEditWidth; formulaData.labelResult = uiTabPaths->labelResultWidth; - formulaData.postfix = UnitsToStr(qApp->patternUnit(), true); + formulaData.postfix = UnitsToStr(qApp->patternUnits(), true); formulaData.checkZero = false; formulaData.checkLessThanZero = true; @@ -2166,7 +2166,7 @@ void DialogSeamAllowance::EvalWidthBefore() formulaData.variables = data->DataVariables(); formulaData.labelEditFormula = uiTabPaths->labelEditBefore; formulaData.labelResult = uiTabPaths->labelResultBefore; - formulaData.postfix = UnitsToStr(qApp->patternUnit(), true); + formulaData.postfix = UnitsToStr(qApp->patternUnits(), true); formulaData.checkZero = false; formulaData.checkLessThanZero = true; @@ -2197,7 +2197,7 @@ void DialogSeamAllowance::EvalWidthAfter() formulaData.variables = data->DataVariables(); formulaData.labelEditFormula = uiTabPaths->labelEditAfter; formulaData.labelResult = uiTabPaths->labelResultAfter; - formulaData.postfix = UnitsToStr(qApp->patternUnit(), true); + formulaData.postfix = UnitsToStr(qApp->patternUnits(), true); formulaData.checkZero = false; formulaData.checkLessThanZero = true; @@ -2228,7 +2228,7 @@ void DialogSeamAllowance::EvalPassmarkLength() formulaData.variables = data->DataVariables(); formulaData.labelEditFormula = uiTabPassmarks->labelEditPassmarkLength; formulaData.labelResult = uiTabPassmarks->labelResultPassmarkLength; - formulaData.postfix = UnitsToStr(qApp->patternUnit(), true); + formulaData.postfix = UnitsToStr(qApp->patternUnits(), true); formulaData.checkZero = false; formulaData.checkLessThanZero = false; @@ -2252,7 +2252,7 @@ void DialogSeamAllowance::FXWidth() dialog->setWindowTitle(tr("Edit seam allowance width")); dialog->SetFormula(GetFormulaSAWidth()); dialog->setCheckLessThanZero(true); - dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true)); if (dialog->exec() == QDialog::Accepted) { SetFormulaSAWidth(dialog->GetFormula()); @@ -2266,7 +2266,7 @@ void DialogSeamAllowance::FXWidthBefore() dialog->setWindowTitle(tr("Edit seam allowance width before")); dialog->SetFormula(GetFormulaFromUser(uiTabPaths->plainTextEditFormulaWidthBefore)); dialog->setCheckLessThanZero(true); - dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true)); if (dialog->exec() == QDialog::Accepted) { SetCurrentSABefore(dialog->GetFormula()); @@ -2280,7 +2280,7 @@ void DialogSeamAllowance::FXWidthAfter() dialog->setWindowTitle(tr("Edit seam allowance width after")); dialog->SetFormula(GetFormulaFromUser(uiTabPaths->plainTextEditFormulaWidthAfter)); dialog->setCheckLessThanZero(true); - dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true)); if (dialog->exec() == QDialog::Accepted) { SetCurrentSAAfter(dialog->GetFormula()); @@ -2293,7 +2293,7 @@ void DialogSeamAllowance::FXPassmarkLength() QScopedPointer dialog(new DialogEditWrongFormula(data, toolId, this)); dialog->setWindowTitle(tr("Edit passmark length")); dialog->SetFormula(GetFormulaFromUser(uiTabPassmarks->plainTextEditPassmarkLength)); - dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true)); if (dialog->exec() == QDialog::Accepted) { SetFormularPassmarkLength(dialog->GetFormula()); @@ -2923,7 +2923,7 @@ void DialogSeamAllowance::InitSeamAllowanceTab() // init the default seam allowance, convert the value if app unit is different than pattern unit m_saWidth = UnitConvertor(qApp->Settings()->GetDefaultSeamAllowance(), - StrToUnits(qApp->Settings()->GetUnit()), qApp->patternUnit()); + StrToUnits(qApp->Settings()->GetUnit()), qApp->patternUnits()); uiTabPaths->plainTextEditFormulaWidth->setPlainText(qApp->LocaleToString(m_saWidth)); diff --git a/src/libs/vtools/tools/drawTools/operation/vabstractoperation.cpp b/src/libs/vtools/tools/drawTools/operation/vabstractoperation.cpp index cda19cca6..434741545 100644 --- a/src/libs/vtools/tools/drawTools/operation/vabstractoperation.cpp +++ b/src/libs/vtools/tools/drawTools/operation/vabstractoperation.cpp @@ -890,7 +890,7 @@ QString VAbstractOperation::ComplexCurveToolTip(quint32 itemId) const "") .arg(tr("Label"), curve->name(), tr("Length")) .arg(qApp->fromPixel(curve->GetLength())) - .arg(UnitsToStr(qApp->patternUnit(), true), MakeToolTip()); + .arg(UnitsToStr(qApp->patternUnits(), true), MakeToolTip()); return toolTip; } diff --git a/src/libs/vtools/tools/drawTools/operation/vtoolmove.cpp b/src/libs/vtools/tools/drawTools/operation/vtoolmove.cpp index 1e494a755..37621d7a7 100644 --- a/src/libs/vtools/tools/drawTools/operation/vtoolmove.cpp +++ b/src/libs/vtools/tools/drawTools/operation/vtoolmove.cpp @@ -398,7 +398,7 @@ VFormula VToolMove::GetFormulaLength() const VFormula fLength(formulaLength, getData()); fLength.setCheckZero(true); fLength.setToolId(m_id); - fLength.setPostfix(UnitsToStr(qApp->patternUnit())); + fLength.setPostfix(UnitsToStr(qApp->patternUnits())); fLength.Eval(); return fLength; } @@ -523,7 +523,7 @@ QString VToolMove::MakeToolTip() const .arg(GetFormulaAngle().getDoubleValue()) // 2 .arg(tr("Length")) // 3 .arg(GetFormulaLength().getDoubleValue()) // 4 - .arg(UnitsToStr(qApp->patternUnit(), true), // 5 + .arg(UnitsToStr(qApp->patternUnits(), true), // 5 tr("Rotation angle")) // 6 .arg(GetFormulaRotationAngle().getDoubleValue()) // 7 .arg(tr("Rotation origin point"), // 8 diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp index ccf490ad5..39963cb20 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp @@ -202,7 +202,7 @@ QString VAbstractSpline::MakeToolTip() const "") .arg(tr("Length")) .arg(qApp->fromPixel(curve->GetLength())) - .arg(UnitsToStr(qApp->patternUnit(), true), tr("Label"), curve->name()); + .arg(UnitsToStr(qApp->patternUnits(), true), tr("Label"), curve->name()); return toolTip; } diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp index 2331135d7..801137749 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp @@ -192,7 +192,7 @@ VFormula VToolArc::GetFormulaRadius() const VFormula radius(arc->GetFormulaRadius(), getData()); radius.setCheckZero(true); radius.setToolId(m_id); - radius.setPostfix(UnitsToStr(qApp->patternUnit())); + radius.setPostfix(UnitsToStr(qApp->patternUnits())); radius.Eval(); return radius; } @@ -387,7 +387,7 @@ QString VToolArc::MakeToolTip() const "") .arg(tr("Length")) .arg(qApp->fromPixel(arc->GetLength())) - .arg(UnitsToStr(qApp->patternUnit(), true), tr("Radius")) + .arg(UnitsToStr(qApp->patternUnits(), true), tr("Radius")) .arg(qApp->fromPixel(arc->GetRadius())) .arg(tr("Start angle")) .arg(arc->GetStartAngle()) diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp index 466066be4..dfa297148 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp @@ -173,7 +173,7 @@ VFormula VToolArcWithLength::GetFormulaRadius() const VFormula radius(arc->GetFormulaRadius(), getData()); radius.setCheckZero(true); radius.setToolId(m_id); - radius.setPostfix(UnitsToStr(qApp->patternUnit())); + radius.setPostfix(UnitsToStr(qApp->patternUnits())); radius.Eval(); return radius; } @@ -232,7 +232,7 @@ VFormula VToolArcWithLength::GetFormulaLength() const VFormula radius(arc->GetFormulaLength(), getData()); radius.setCheckZero(true); radius.setToolId(m_id); - radius.setPostfix(UnitsToStr(qApp->patternUnit())); + radius.setPostfix(UnitsToStr(qApp->patternUnits())); radius.Eval(); return radius; } @@ -366,7 +366,7 @@ QString VToolArcWithLength::MakeToolTip() const "") .arg(tr("Length")) .arg(qApp->fromPixel(arc->GetLength())) - .arg(UnitsToStr(qApp->patternUnit(), true), tr("Radius")) + .arg(UnitsToStr(qApp->patternUnits(), true), tr("Radius")) .arg(qApp->fromPixel(arc->GetRadius())) .arg(tr("Start angle")) .arg(arc->GetStartAngle()) diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.cpp index 3f0ba3fab..556faf696 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.cpp @@ -201,7 +201,7 @@ VFormula VToolEllipticalArc::GetFormulaRadius1() const VFormula radius1(elArc->GetFormulaRadius1(), getData()); radius1.setCheckZero(true); radius1.setToolId(m_id); - radius1.setPostfix(UnitsToStr(qApp->patternUnit())); + radius1.setPostfix(UnitsToStr(qApp->patternUnits())); radius1.Eval(); return radius1; } @@ -230,7 +230,7 @@ VFormula VToolEllipticalArc::GetFormulaRadius2() const VFormula radius2(elArc->GetFormulaRadius2(), getData()); radius2.setCheckZero(true); radius2.setToolId(m_id); - radius2.setPostfix(UnitsToStr(qApp->patternUnit())); + radius2.setPostfix(UnitsToStr(qApp->patternUnits())); radius2.Eval(); return radius2; } @@ -440,7 +440,7 @@ QString VToolEllipticalArc::MakeToolTip() const "") .arg(tr("Length")) // 1 .arg(qApp->fromPixel(elArc->GetLength())) // 2 - .arg(UnitsToStr(qApp->patternUnit(), true), // 3 + .arg(UnitsToStr(qApp->patternUnits(), true), // 3 tr("Radius") + QLatin1Char('1')) // 4 .arg(qApp->fromPixel(elArc->GetRadius1())) // 5 .arg(tr("Radius") + QLatin1Char('2')) // 6 diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.cpp index 8977b5fe1..f0de213d4 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.cpp @@ -83,7 +83,7 @@ VFormula VToolCut::GetFormula() const VFormula val(formula, getData()); val.setCheckZero(true); val.setToolId(m_id); - val.setPostfix(UnitsToStr(qApp->patternUnit())); + val.setPostfix(UnitsToStr(qApp->patternUnits())); val.Eval(); return val; } diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp index 96d8c3a6d..9231b893d 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp @@ -283,7 +283,7 @@ QString VToolCutArc::MakeToolTip() const " %8: %9° ") .arg(arcStr + arcNumber + QChar(QChar::Space) + lengthStr) .arg(qApp->fromPixel(arc.GetLength())) - .arg(UnitsToStr(qApp->patternUnit(), true), arcStr + arcNumber + QChar(QChar::Space) + radiusStr) + .arg(UnitsToStr(qApp->patternUnits(), true), arcStr + arcNumber + QChar(QChar::Space) + radiusStr) .arg(qApp->fromPixel(arc.GetRadius())) .arg(arcStr + arcNumber + QChar(QChar::Space) + startAngleStr) .arg(arc.GetStartAngle()) diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp index 5468ff2ce..9e056c490 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp @@ -277,7 +277,7 @@ QString VToolCutSpline::MakeToolTip() const "") .arg(curveStr + QLatin1String("1 ") + lengthStr) .arg(qApp->fromPixel(spline1.GetLength())) - .arg(UnitsToStr(qApp->patternUnit(), true), curveStr + QLatin1String("2 ") + lengthStr) + .arg(UnitsToStr(qApp->patternUnits(), true), curveStr + QLatin1String("2 ") + lengthStr) .arg(qApp->fromPixel(spline2.GetLength())) .arg(curveStr + QLatin1String(" 1") + tr("label"), spline1.name(), curveStr + QLatin1String(" 2") + tr("label"), spline2.name()); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp index 4bd33786f..d37b00fa2 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp @@ -367,7 +367,7 @@ QString VToolCutSplinePath::MakeToolTip() const "") .arg(curveStr + QLatin1String("1 ") + lengthStr) .arg(qApp->fromPixel(splPath1->GetLength())) - .arg(UnitsToStr(qApp->patternUnit(), true), curveStr + QLatin1String("2 ") + lengthStr) + .arg(UnitsToStr(qApp->patternUnits(), true), curveStr + QLatin1String("2 ") + lengthStr) .arg(qApp->fromPixel(splPath2->GetLength())) .arg(curveStr + QLatin1String(" 1") + tr("label"), splPath1->name(), curveStr + QLatin1String(" 2") + tr("label"), splPath2->name()); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp index 206cfe524..9e1cffc36 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp @@ -162,7 +162,7 @@ QString VToolAlongLine::MakeToolTip() const "") .arg(tr("Length")) .arg(qApp->fromPixel(curLine.length())) - .arg(UnitsToStr(qApp->patternUnit(), true), tr("Angle")) + .arg(UnitsToStr(qApp->patternUnits(), true), tr("Angle")) .arg(curLine.angle()) .arg(QStringLiteral("%1->%2").arg(basePoint->name(), current->name()), QStringLiteral("%1->%2").arg(current->name(), secondPoint->name())) diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp index 6e5735029..1ea2ef245 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp @@ -143,7 +143,7 @@ VToolCurveIntersectAxis *VToolCurveIntersectAxis::Create(VToolCurveIntersectAxis " through point '%3' with angle %4°") .arg(initData.name, curve->name(), basePoint->name()).arg(angle); qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; } const qreal segLength = curve->GetLengthByPoint(fPoint); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp index b6e02024b..40c28fd76 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp @@ -281,7 +281,7 @@ QString VToolHeight::MakeToolTip() const "") .arg(tr("Length")) .arg(qApp->fromPixel(curLine.length())) - .arg(UnitsToStr(qApp->patternUnit(), true), tr("Angle")) + .arg(UnitsToStr(qApp->patternUnits(), true), tr("Angle")) .arg(curLine.angle()) .arg(QString("%1->%2").arg(p1Line->name(), current->name())) .arg(qApp->fromPixel(p1ToCur.length())) diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp index 7c9cc6b96..a154972ba 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp @@ -135,7 +135,7 @@ VToolLineIntersectAxis *VToolLineIntersectAxis::Create(VToolLineIntersectAxisIni "through point '%4' and angle %5°") .arg(initData.name, firstPoint->name(), secondPoint->name(), basePoint->name()).arg(axis.angle()); qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; } VPointF *p = new VPointF(fPoint, initData.name, initData.mx, initData.my); @@ -342,7 +342,7 @@ QString VToolLineIntersectAxis::MakeToolTip() const "") .arg(tr("Length")) .arg(qApp->fromPixel(curLine.length())) - .arg(UnitsToStr(qApp->patternUnit(), true), tr("Angle")) + .arg(UnitsToStr(qApp->patternUnits(), true), tr("Angle")) .arg(curLine.angle()) .arg(QString("%1->%2").arg(firstPoint->name(), current->name())) .arg(qApp->fromPixel(firstToCur.length())) diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.cpp index 9e36108f4..eff502941 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.cpp @@ -158,7 +158,7 @@ QString VToolLinePoint::MakeToolTip() const "") .arg(tr("Length")) .arg(qApp->fromPixel(line.length())) - .arg(UnitsToStr(qApp->patternUnit(), true), tr("Angle")) + .arg(UnitsToStr(qApp->patternUnits(), true), tr("Angle")) .arg(line.angle()) .arg(tr("Label"), second->name()); return toolTip; @@ -217,7 +217,7 @@ VFormula VToolLinePoint::GetFormulaLength() const VFormula fLength(formulaLength, this->getData()); fLength.setCheckZero(false); fLength.setToolId(m_id); - fLength.setPostfix(UnitsToStr(qApp->patternUnit())); + fLength.setPostfix(UnitsToStr(qApp->patternUnits())); fLength.Eval(); return fLength; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp index e85768593..bd87e2e88 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp @@ -339,7 +339,7 @@ QString VToolShoulderPoint::MakeToolTip() const "") .arg(tr("Length")) .arg(qApp->fromPixel(firstToCur.length())) - .arg(UnitsToStr(qApp->patternUnit(), true), tr("Angle")) + .arg(UnitsToStr(qApp->patternUnits(), true), tr("Angle")) .arg(firstToCur.angle()) .arg(QString("%1->%2").arg(second->name(), current->name())) .arg(qApp->fromPixel(secondToCur.length())) diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp index 99b269d9e..5a34b2776 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp @@ -150,7 +150,7 @@ VToolLineIntersect* VToolLineIntersect::Create(VToolLineIntersectInitData initDa "intersection") .arg(initData.name, p1Line1->name(), p2Line1->name(), p1Line2->name(), p2Line2->name()); qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; } VPointF *p = new VPointF(fPoint, initData.name, initData.mx, initData.my); @@ -321,7 +321,7 @@ QString VToolLineIntersect::MakeToolTip() const "") .arg(QString("%1->%2").arg(p1L1->name(), current->name())) .arg(qApp->fromPixel(p1L1ToCur.length())) - .arg(UnitsToStr(qApp->patternUnit(), true), QString("%1->%2").arg(current->name(), p2L1->name())) + .arg(UnitsToStr(qApp->patternUnits(), true), QString("%1->%2").arg(current->name(), p2L1->name())) .arg(qApp->fromPixel(curToP2L1.length())) .arg(QString("%1->%2").arg(p1L2->name(), current->name())) .arg(qApp->fromPixel(p1L2ToCur.length())) diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp index b9974f66e..f99b82692 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp @@ -122,7 +122,7 @@ VToolPointFromArcAndTangent *VToolPointFromArcAndTangent::Create(VToolPointFromA const QString errorMsg = tr("Error calculating point '%1'. Tangent to arc '%2' from point '%3' cannot be found") .arg(initData.name, arc.name(), tPoint.name()); qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; } VPointF *p = new VPointF(point, initData.name, initData.mx, initData.my); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp index 53acddb37..230df2356 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp @@ -131,7 +131,7 @@ VToolPointFromCircleAndTangent *VToolPointFromCircleAndTangent::Create(VToolPoin .arg(initData.name, cPoint.name()).arg(radius).arg(tPoint.name()); qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; } VPointF *p = new VPointF(point, initData.name, initData.mx, initData.my); @@ -206,7 +206,7 @@ VFormula VToolPointFromCircleAndTangent::GetCircleRadius() const VFormula radius(circleRadius, getData()); radius.setCheckZero(true); radius.setToolId(m_id); - radius.setPostfix(UnitsToStr(qApp->patternUnit())); + radius.setPostfix(UnitsToStr(qApp->patternUnits())); radius.Eval(); return radius; } diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp index d771b059b..9aa1ad7ac 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp @@ -217,7 +217,7 @@ VToolPointOfContact* VToolPointOfContact::Create(VToolPointOfContactInitData &in "intersection with line (%4;%5)") .arg(initData.name, centerP->name()).arg(result).arg(firstP->name(), secondP->name()); qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; } VPointF *p = new VPointF(fPoint, initData.name, initData.mx, initData.my); @@ -373,7 +373,7 @@ QString VToolPointOfContact::MakeToolTip() const "") .arg(QStringLiteral("%1->%2").arg(p1->name(), current->name())) .arg(qApp->fromPixel(p1ToCur.length())) - .arg(UnitsToStr(qApp->patternUnit(), true), QStringLiteral("%1->%2").arg(p2->name(), current->name())) + .arg(UnitsToStr(qApp->patternUnits(), true), QStringLiteral("%1->%2").arg(p2->name(), current->name())) .arg(qApp->fromPixel(p2ToCur.length())) .arg(QStringLiteral("%1 %2->%3").arg(tr("Length"), centerP->name(), current->name())) .arg(qApp->fromPixel(centerToCur.length())) @@ -409,7 +409,7 @@ VFormula VToolPointOfContact::getArcRadius() const VFormula radius(arcRadius, this->getData()); radius.setCheckZero(true); radius.setToolId(m_id); - radius.setPostfix(UnitsToStr(qApp->patternUnit())); + radius.setPostfix(UnitsToStr(qApp->patternUnits())); radius.Eval(); return radius; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp index 8e258a64b..081c3b8d4 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp @@ -121,7 +121,7 @@ VToolPointOfIntersectionArcs *VToolPointOfIntersectionArcs::Create(VToolPointOfI const QString errorMsg = tr("Error calculating point '%1'. Arcs '%2' and '%3' have no point of intersection") .arg(initData.name, firstArc->name(), secondArc->name()); qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; } VPointF *p = new VPointF(point, initData.name, initData.mx, initData.my); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp index 61e5a68a0..80cd70d7c 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp @@ -135,7 +135,7 @@ VToolPointOfIntersectionCircles::Create(VToolPointOfIntersectionCirclesInitData const QString errorMsg = tr("Error calculating point '%1'. Circles with centers in points '%2' and '%3' have " "no point of intersection").arg(initData.name, c1Point.name(), c2Point.name()); qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; } VPointF *p = new VPointF(point, initData.name, initData.mx, initData.my); @@ -219,7 +219,7 @@ VFormula VToolPointOfIntersectionCircles::GetFirstCircleRadius() const VFormula radius(firstCircleRadius, getData()); radius.setCheckZero(true); radius.setToolId(m_id); - radius.setPostfix(UnitsToStr(qApp->patternUnit())); + radius.setPostfix(UnitsToStr(qApp->patternUnits())); radius.Eval(); return radius; } @@ -244,7 +244,7 @@ VFormula VToolPointOfIntersectionCircles::GetSecondCircleRadius() const VFormula radius(secondCircleRadius, getData()); radius.setCheckZero(true); radius.setToolId(m_id); - radius.setPostfix(UnitsToStr(qApp->patternUnit())); + radius.setPostfix(UnitsToStr(qApp->patternUnits())); radius.Eval(); return radius; } diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp index 1c1f23e07..9927b79d0 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp @@ -126,7 +126,7 @@ VToolPointOfIntersectionCurves *VToolPointOfIntersectionCurves::Create(VToolPoin const QString errorMsg = tr("Error calculating point '%1'. Curves '%2' and '%3' have no point of intersection") .arg(initData.name, curve1->name(), curve2->name()); qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; } VPointF *p = new VPointF(point, initData.name, initData.mx, initData.my); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp index 67b0c80dd..d71ee141c 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp @@ -148,7 +148,7 @@ VToolTriangle* VToolTriangle::Create(VToolTriangleInitData initData) const QString errorMsg = tr("Error calculating point '%1'. Point of intersection cannot be found") .arg(initData.name); qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; } VPointF *p = new VPointF(point, initData.name, initData.mx, initData.my); diff --git a/src/libs/vtools/tools/drawTools/vtoolline.cpp b/src/libs/vtools/tools/drawTools/vtoolline.cpp index c6db258d9..b054c4edd 100644 --- a/src/libs/vtools/tools/drawTools/vtoolline.cpp +++ b/src/libs/vtools/tools/drawTools/vtoolline.cpp @@ -442,7 +442,7 @@ QString VToolLine::MakeToolTip() const "") .arg(tr("Length")) .arg(qApp->fromPixel(line.length())) - .arg(UnitsToStr(qApp->patternUnit(), true), tr("Angle")) + .arg(UnitsToStr(qApp->patternUnits(), true), tr("Angle")) .arg(line.angle()); return toolTip; } diff --git a/src/libs/vtools/tools/vtoolseamallowance.cpp b/src/libs/vtools/tools/vtoolseamallowance.cpp index 261691386..c5646374e 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.cpp +++ b/src/libs/vtools/tools/vtoolseamallowance.cpp @@ -1321,7 +1321,7 @@ void VToolSeamAllowance::RefreshGeometry(bool updateChildren) const QString errorMsg = QObject::tr("Piece '%1'. Seam allowance is not valid.") .arg(detail.GetName()); qApp->IsPedantic() ? throw VException(errorMsg) : - qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg; } path.addPath(detail.SeamAllowancePath(futureSeamAllowance.result())); path.setFillRule(Qt::OddEvenFill); diff --git a/src/libs/vtools/undocommands/addtocalc.cpp b/src/libs/vtools/undocommands/addtocalc.cpp index af22114b7..a91bc142c 100644 --- a/src/libs/vtools/undocommands/addtocalc.cpp +++ b/src/libs/vtools/undocommands/addtocalc.cpp @@ -33,7 +33,7 @@ #include "../vwidgets/vmaingraphicsview.h" #include "../ifc/xml/vabstractpattern.h" #include "../ifc/ifcdef.h" -#include "../vmisc/vabstractapplication.h" +#include "../vmisc/vabstractvalapplication.h" #include "../vmisc/customevents.h" #include "vundocommand.h" diff --git a/src/libs/vtools/undocommands/deletepatternpiece.cpp b/src/libs/vtools/undocommands/deletepatternpiece.cpp index 240906984..43f930a5b 100644 --- a/src/libs/vtools/undocommands/deletepatternpiece.cpp +++ b/src/libs/vtools/undocommands/deletepatternpiece.cpp @@ -31,7 +31,7 @@ #include #include -#include "../vmisc/vabstractapplication.h" +#include "../vmisc/vabstractvalapplication.h" #include "../ifc/xml/vabstractpattern.h" #include "vundocommand.h" diff --git a/src/libs/vtools/undocommands/deltool.cpp b/src/libs/vtools/undocommands/deltool.cpp index 30e89c96c..cf4642163 100644 --- a/src/libs/vtools/undocommands/deltool.cpp +++ b/src/libs/vtools/undocommands/deltool.cpp @@ -32,7 +32,7 @@ #include "../ifc/ifcdef.h" #include "../ifc/xml/vabstractpattern.h" -#include "../vmisc/vabstractapplication.h" +#include "../vmisc/vabstractvalapplication.h" #include "vundocommand.h" //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/undocommands/movespline.cpp b/src/libs/vtools/undocommands/movespline.cpp index 785f01a69..170839705 100644 --- a/src/libs/vtools/undocommands/movespline.cpp +++ b/src/libs/vtools/undocommands/movespline.cpp @@ -32,7 +32,7 @@ #include "../ifc/ifcdef.h" #include "../ifc/xml/vabstractpattern.h" -#include "../vmisc/vabstractapplication.h" +#include "../vmisc/vabstractvalapplication.h" #include "../vmisc/def.h" #include "../vwidgets/vmaingraphicsview.h" #include "../vgeometry/vpointf.h" diff --git a/src/libs/vtools/undocommands/movespoint.cpp b/src/libs/vtools/undocommands/movespoint.cpp index 2ba0029a7..123ecf020 100644 --- a/src/libs/vtools/undocommands/movespoint.cpp +++ b/src/libs/vtools/undocommands/movespoint.cpp @@ -32,7 +32,7 @@ #include "../ifc/xml/vabstractpattern.h" #include "../ifc/ifcdef.h" -#include "../vmisc/vabstractapplication.h" +#include "../vmisc/vabstractvalapplication.h" #include "../vmisc/def.h" #include "vundocommand.h" diff --git a/src/libs/vtools/undocommands/undogroup.cpp b/src/libs/vtools/undocommands/undogroup.cpp index 1ef1cec28..3dde2498a 100644 --- a/src/libs/vtools/undocommands/undogroup.cpp +++ b/src/libs/vtools/undocommands/undogroup.cpp @@ -31,7 +31,7 @@ #include #include -#include "../vmisc/vabstractapplication.h" +#include "../vmisc/vabstractvalapplication.h" #include "../vmisc/def.h" #include "../vwidgets/vmaingraphicsview.h" #include "../ifc/xml/vabstractpattern.h" diff --git a/src/libs/vtools/visualization/line/operation/vistoolmove.cpp b/src/libs/vtools/visualization/line/operation/vistoolmove.cpp index 627df2a79..984540d0f 100644 --- a/src/libs/vtools/visualization/line/operation/vistoolmove.cpp +++ b/src/libs/vtools/visualization/line/operation/vistoolmove.cpp @@ -170,7 +170,7 @@ void VisToolMove::RefreshGeometry() DrawLine(this, line, supportColor2, Qt::DashLine); DrawPoint(pointFinish, line.p2(), supportColor); - static const QString prefix = UnitsToStr(qApp->patternUnit(), true); + static const QString prefix = UnitsToStr(qApp->patternUnits(), true); if (qFuzzyIsNull(length)) { Visualization::toolTip = tr("Length = %1%2, angle = %3°, %4 - sticking angle, " diff --git a/src/libs/vtools/visualization/line/vistoolendline.cpp b/src/libs/vtools/visualization/line/vistoolendline.cpp index 654f9275c..88e9e6906 100644 --- a/src/libs/vtools/visualization/line/vistoolendline.cpp +++ b/src/libs/vtools/visualization/line/vistoolendline.cpp @@ -79,7 +79,7 @@ void VisToolEndLine::RefreshGeometry() DrawPoint(point, line.p2(), mainColor); } DrawLine(this, line, mainColor, lineStyle); - static const QString prefix = UnitsToStr(qApp->patternUnit(), true); + static const QString prefix = UnitsToStr(qApp->patternUnits(), true); Visualization::toolTip = tr("Point at distance and angle: angle = %1°, length = %2%3; " "%4 - sticking angle, %5 - finish creation") .arg(this->line().angle()) diff --git a/src/libs/vtools/visualization/visualization.h b/src/libs/vtools/visualization/visualization.h index 1a302820e..8c7014411 100644 --- a/src/libs/vtools/visualization/visualization.h +++ b/src/libs/vtools/visualization/visualization.h @@ -36,7 +36,7 @@ #include #include "../vmisc/def.h" -#include "../vmisc/vabstractapplication.h" +#include "../vmisc/vabstractvalapplication.h" #include "../vwidgets/vmaingraphicsscene.h" #include "../vwidgets/vcurvepathitem.h" #include "../vwidgets/global.h" diff --git a/src/libs/vwidgets/vgraphicssimpletextitem.cpp b/src/libs/vwidgets/vgraphicssimpletextitem.cpp index 370bc876f..3d3762187 100644 --- a/src/libs/vwidgets/vgraphicssimpletextitem.cpp +++ b/src/libs/vwidgets/vgraphicssimpletextitem.cpp @@ -48,7 +48,7 @@ #include "global.h" #include "vscenepoint.h" #include "../vmisc/vmath.h" -#include "../vmisc/vabstractapplication.h" +#include "../vmisc/vabstractvalapplication.h" //--------------------------------------------------------------------------------------------------------------------- /** diff --git a/src/libs/vwidgets/vmaingraphicsview.cpp b/src/libs/vwidgets/vmaingraphicsview.cpp index 8351784c7..1e9a3c65a 100644 --- a/src/libs/vwidgets/vmaingraphicsview.cpp +++ b/src/libs/vwidgets/vmaingraphicsview.cpp @@ -55,7 +55,7 @@ #include "vmaingraphicsscene.h" #include "vsimplecurve.h" #include "vcontrolpointspline.h" -#include "../vmisc/vabstractapplication.h" +#include "../vmisc/vabstractvalapplication.h" #include "../vmisc/vsettings.h" #include "vabstractmainwindow.h" #include "global.h" diff --git a/src/test/ValentinaTest/tst_vpiece.cpp b/src/test/ValentinaTest/tst_vpiece.cpp index 0db6fcee6..26f816a35 100644 --- a/src/test/ValentinaTest/tst_vpiece.cpp +++ b/src/test/ValentinaTest/tst_vpiece.cpp @@ -33,7 +33,7 @@ #include "../vpatterndb/vpiecenode.h" #include "../vpatterndb/vpiecepath.h" #include "../vgeometry/vsplinepath.h" -#include "../vmisc/vabstractapplication.h" +#include "../vmisc/vabstractvalapplication.h" #include #include "../vpatterndb/vpiece.h" @@ -51,7 +51,7 @@ void TST_VPiece::Issue620() // Check main path const Unit unit = Unit::Cm; QSharedPointer data(new VContainer(nullptr, &unit, VContainer::UniqueNamespace())); - qApp->setPatternUnit(unit); + qApp->SetPatternUnits(unit); VPiece detail; AbstractTest::PieceFromJson(QStringLiteral("://Issue_620/input.json"), detail, data);