From c368a956b89d3920a82b8787e60185fa57ca5c66 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 17 Aug 2017 19:57:46 +0300 Subject: [PATCH] Fix bug. Changing pattern or measurements file name do not imidiatelly update pattern label. --HG-- branch : feature --- src/app/valentina/dialogs/dialogpatternproperties.cpp | 3 +++ src/app/valentina/mainwindow.cpp | 3 ++- src/libs/ifc/xml/vabstractpattern.cpp | 1 + src/libs/ifc/xml/vabstractpattern.h | 1 + src/libs/vtools/tools/vtoolseamallowance.cpp | 2 +- 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/app/valentina/dialogs/dialogpatternproperties.cpp b/src/app/valentina/dialogs/dialogpatternproperties.cpp index 5cd288afb..24dad193e 100644 --- a/src/app/valentina/dialogs/dialogpatternproperties.cpp +++ b/src/app/valentina/dialogs/dialogpatternproperties.cpp @@ -515,6 +515,7 @@ void DialogPatternProperties::SaveDescription() descriptionChanged = false; emit doc->patternChanged(false); + emit doc->UpdatePatternLabel(); } } @@ -564,6 +565,7 @@ void DialogPatternProperties::SaveLabelData() labelDataChanged = false; askSaveLabelData = false; emit doc->patternChanged(false); + emit doc->UpdatePatternLabel(); } } @@ -575,6 +577,7 @@ void DialogPatternProperties::SaveTemplateData() doc->SetPatternLabelTemplate(templateLines); templateDataChanged = false; emit doc->patternChanged(false); + emit doc->UpdatePatternLabel(); } } diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 17af52e75..9ee2bd557 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -3435,6 +3435,7 @@ void MainWindow::setCurrentFile(const QString &fileName) { qCDebug(vMainWindow, "Set current name to \"%s\"", qUtf8Printable(fileName)); qApp->SetPPath(fileName); + emit doc->UpdatePatternLabel(); qApp->getUndoStack()->setClean(); if (not qApp->GetPPath().isEmpty() && VApplication::IsGUIMode()) @@ -4679,9 +4680,9 @@ QString MainWindow::CheckPathToMeasurements(const QString &patternPath, const QS CheckRequiredMeasurements(m.data()); + qApp->setPatternType(patternType); doc->SetMPath(RelativeMPath(patternPath, mPath)); PatternChangesWereSaved(false); - qApp->setPatternType(patternType); return mPath; } } diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp index da75bc159..77602144c 100644 --- a/src/libs/ifc/xml/vabstractpattern.cpp +++ b/src/libs/ifc/xml/vabstractpattern.cpp @@ -794,6 +794,7 @@ void VAbstractPattern::SetMPath(const QString &path) if (setTagText(TagMeasurements, path)) { emit patternChanged(false); + emit UpdatePatternLabel(); } else { diff --git a/src/libs/ifc/xml/vabstractpattern.h b/src/libs/ifc/xml/vabstractpattern.h index c6653c3c1..e5d78660f 100644 --- a/src/libs/ifc/xml/vabstractpattern.h +++ b/src/libs/ifc/xml/vabstractpattern.h @@ -338,6 +338,7 @@ signals: * @brief patternChanged emit if we have unsaved change. */ void patternChanged(bool saved); + void UpdatePatternLabel(); /** * @brief ShowTool highlight tool. * @param id tool id. diff --git a/src/libs/vtools/tools/vtoolseamallowance.cpp b/src/libs/vtools/tools/vtoolseamallowance.cpp index 4f753e06e..1a4d7e02f 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.cpp +++ b/src/libs/vtools/tools/vtoolseamallowance.cpp @@ -1151,7 +1151,7 @@ VToolSeamAllowance::VToolSeamAllowance(VAbstractPattern *doc, VContainer *data, connect(m_grainLine, &VGrainlineItem::SignalResized, this, &VToolSeamAllowance::SaveResizeGrainline); connect(m_grainLine, &VGrainlineItem::SignalRotated, this, &VToolSeamAllowance::SaveRotateGrainline); - connect(doc, &VAbstractPattern::patternChanged, this, &VToolSeamAllowance::UpdatePatternInfo); + connect(doc, &VAbstractPattern::UpdatePatternLabel, this, &VToolSeamAllowance::UpdatePatternInfo); connect(doc, &VAbstractPattern::CheckLayout, this, &VToolSeamAllowance::UpdateDetailLabel); connect(doc, &VAbstractPattern::CheckLayout, this, &VToolSeamAllowance::UpdatePatternInfo); connect(doc, &VAbstractPattern::CheckLayout, this, &VToolSeamAllowance::UpdateGrainline);