Fix issue with passing incorrect number of dimension to Tape.
This commit is contained in:
parent
5fd4b8f563
commit
8476b50a24
|
@ -35,6 +35,7 @@
|
|||
- Tool box redesign.
|
||||
- Increased requirement for minimal Qt version.
|
||||
- Support for Dark mode.
|
||||
- Fix issue with passing incorrect number of dimension to Tape.
|
||||
|
||||
# Valentina 0.7.52 September 12, 2022
|
||||
- Fix crash when default locale is ru.
|
||||
|
|
|
@ -864,19 +864,19 @@ auto MApplication::StartWithFiles(QCommandLineParser &parser) -> bool
|
|||
continue;
|
||||
}
|
||||
|
||||
if (flagDimensionA && not MainWindow()->SetDimensionABase(dimensionAValue))
|
||||
if (flagDimensionA)
|
||||
{
|
||||
parser.showHelp(V_EX_USAGE);
|
||||
MainWindow()->SetDimensionABase(dimensionAValue);
|
||||
}
|
||||
|
||||
if (flagDimensionB && not MainWindow()->SetDimensionBBase(dimensionBValue))
|
||||
if (flagDimensionB)
|
||||
{
|
||||
parser.showHelp(V_EX_USAGE);
|
||||
MainWindow()->SetDimensionBBase(dimensionBValue);
|
||||
}
|
||||
|
||||
if (flagDimensionC && not MainWindow()->SetDimensionCBase(dimensionCValue))
|
||||
if (flagDimensionC)
|
||||
{
|
||||
parser.showHelp(V_EX_USAGE);
|
||||
MainWindow()->SetDimensionCBase(dimensionCValue);
|
||||
}
|
||||
|
||||
if (flagUnits)
|
||||
|
|
|
@ -343,14 +343,14 @@ void TMainWindow::RetranslateTable()
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto TMainWindow::SetDimensionABase(int base) -> bool
|
||||
void TMainWindow::SetDimensionABase(int base)
|
||||
{
|
||||
const QList<MeasurementDimension_p> dimensions = m_m->Dimensions().values();
|
||||
|
||||
if (dimensions.isEmpty())
|
||||
{
|
||||
qCCritical(tMainWindow, "%s\n", qPrintable(tr("The table doesn't provide dimensions")));
|
||||
return false;
|
||||
qCWarning(tMainWindow, "%s\n", qPrintable(tr("The table doesn't provide dimensions")));
|
||||
return;
|
||||
}
|
||||
|
||||
const qint32 i = m_gradationDimensionA->findData(base);
|
||||
|
@ -361,21 +361,20 @@ auto TMainWindow::SetDimensionABase(int base) -> bool
|
|||
|
||||
if (not VFuzzyComparePossibleNulls(base, m_currentDimensionA))
|
||||
{
|
||||
qCCritical(tMainWindow, "%s\n", qPrintable(tr("Invalid base value for dimension A")));
|
||||
return false;
|
||||
qCWarning(tMainWindow, "%s\n", qPrintable(tr("Invalid base value for dimension A")));
|
||||
return;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto TMainWindow::SetDimensionBBase(int base) -> bool
|
||||
void TMainWindow::SetDimensionBBase(int base)
|
||||
{
|
||||
const QList<MeasurementDimension_p> dimensions = m_m->Dimensions().values();
|
||||
|
||||
if (dimensions.size() <= 1)
|
||||
{
|
||||
qCCritical(tMainWindow, "%s\n", qPrintable(tr("The table doesn't support dimension B")));
|
||||
return false;
|
||||
qCWarning(tMainWindow, "%s\n", qPrintable(tr("The table doesn't support dimension B")));
|
||||
return;
|
||||
}
|
||||
|
||||
const qint32 i = m_gradationDimensionB->findData(base);
|
||||
|
@ -386,22 +385,20 @@ auto TMainWindow::SetDimensionBBase(int base) -> bool
|
|||
|
||||
if (not VFuzzyComparePossibleNulls(base, m_currentDimensionB))
|
||||
{
|
||||
qCCritical(tMainWindow, "%s\n", qPrintable(tr("Invalid base value for dimension B")));
|
||||
return false;
|
||||
qCWarning(tMainWindow, "%s\n", qPrintable(tr("Invalid base value for dimension B")));
|
||||
return;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto TMainWindow::SetDimensionCBase(int base) -> bool
|
||||
void TMainWindow::SetDimensionCBase(int base)
|
||||
{
|
||||
const QList<MeasurementDimension_p> dimensions = m_m->Dimensions().values();
|
||||
|
||||
if (dimensions.size() <= 2)
|
||||
{
|
||||
qCCritical(tMainWindow, "%s\n", qPrintable(tr("The table doesn't support dimension C")));
|
||||
return false;
|
||||
qCWarning(tMainWindow, "%s\n", qPrintable(tr("The table doesn't support dimension C")));
|
||||
return;
|
||||
}
|
||||
|
||||
const qint32 i = m_gradationDimensionC->findData(base);
|
||||
|
@ -412,10 +409,9 @@ auto TMainWindow::SetDimensionCBase(int base) -> bool
|
|||
|
||||
if (not VFuzzyComparePossibleNulls(base, m_currentDimensionC))
|
||||
{
|
||||
qCCritical(tMainWindow, "%s\n", qPrintable(tr("Invalid base value for dimension C")));
|
||||
return false;
|
||||
qCWarning(tMainWindow, "%s\n", qPrintable(tr("Invalid base value for dimension C")));
|
||||
return;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -58,9 +58,9 @@ public:
|
|||
|
||||
void RetranslateTable();
|
||||
|
||||
auto SetDimensionABase(int base) -> bool;
|
||||
auto SetDimensionBBase(int base) -> bool;
|
||||
auto SetDimensionCBase(int base) -> bool;
|
||||
void SetDimensionABase(int base);
|
||||
void SetDimensionBBase(int base);
|
||||
void SetDimensionCBase(int base);
|
||||
void SetPUnit(Unit unit);
|
||||
|
||||
auto LoadFile(const QString &path) -> bool;
|
||||
|
|
|
@ -902,16 +902,26 @@ void VAbstractPattern::SetMPath(const QString &path)
|
|||
QDomElement domElement = UniqueTag(TagMeasurements);
|
||||
if (not domElement.isNull())
|
||||
{
|
||||
auto RemoveDimensions = [&domElement]()
|
||||
{
|
||||
domElement.removeAttribute(AttrDimensionA);
|
||||
domElement.removeAttribute(AttrDimensionB);
|
||||
domElement.removeAttribute(AttrDimensionC);
|
||||
};
|
||||
|
||||
if (not path.isEmpty())
|
||||
{
|
||||
SetAttribute(domElement, AttrPath, path);
|
||||
|
||||
if (path.endsWith(QStringLiteral(".vit")) || QFileInfo(m_MPath).fileName() != QFileInfo(path).fileName())
|
||||
{
|
||||
RemoveDimensions();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
domElement.removeAttribute(AttrPath);
|
||||
domElement.removeAttribute(AttrDimensionA);
|
||||
domElement.removeAttribute(AttrDimensionB);
|
||||
domElement.removeAttribute(AttrDimensionC);
|
||||
RemoveDimensions();
|
||||
}
|
||||
m_MPath = path;
|
||||
patternLabelWasChanged = true;
|
||||
|
|
Loading…
Reference in New Issue
Block a user