Fix showing warning for labels.
--HG-- branch : feature
This commit is contained in:
parent
728b0e79d4
commit
988da5fd19
|
@ -73,11 +73,11 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 &
|
||||||
flagGPin(true),
|
flagGPin(true),
|
||||||
flagDPin(true),
|
flagDPin(true),
|
||||||
flagPPin(true),
|
flagPPin(true),
|
||||||
flagGFormulas(false),
|
flagGFormulas(true),
|
||||||
flagDLAngle(false),
|
flagDLAngle(true),
|
||||||
flagDLFormulas(false),
|
flagDLFormulas(true),
|
||||||
flagPLAngle(false),
|
flagPLAngle(true),
|
||||||
flagPLFormulas(false),
|
flagPLFormulas(true),
|
||||||
m_bAddMode(true),
|
m_bAddMode(true),
|
||||||
m_mx(0),
|
m_mx(0),
|
||||||
m_my(0),
|
m_my(0),
|
||||||
|
@ -363,8 +363,8 @@ void DialogSeamAllowance::SaveData()
|
||||||
void DialogSeamAllowance::CheckState()
|
void DialogSeamAllowance::CheckState()
|
||||||
{
|
{
|
||||||
SCASSERT(bOk != nullptr);
|
SCASSERT(bOk != nullptr);
|
||||||
bOk->setEnabled(flagName && flagError && flagFormula && flagDPin && flagPPin && (flagGFormulas || flagGPin)
|
bOk->setEnabled(flagName && flagError && flagFormula && (flagGFormulas || flagGPin)
|
||||||
&& flagDLAngle && (flagDLFormulas || flagGPin) && flagPLAngle && (flagPLFormulas || flagPPin));
|
&& flagDLAngle && (flagDLFormulas || flagDPin) && flagPLAngle && (flagPLFormulas || flagPPin));
|
||||||
// In case dialog hasn't apply button
|
// In case dialog hasn't apply button
|
||||||
if ( bApply != nullptr && applyAllowed)
|
if ( bApply != nullptr && applyAllowed)
|
||||||
{
|
{
|
||||||
|
@ -967,10 +967,8 @@ void DialogSeamAllowance::TabChanged(int index)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSeamAllowance::UpdateGrainlineValues()
|
void DialogSeamAllowance::UpdateGrainlineValues()
|
||||||
{
|
{
|
||||||
QPlainTextEdit* apleSender[2];
|
QPlainTextEdit* apleSender[2] = {ui->lineEditRotFormula, ui->lineEditLenFormula};
|
||||||
apleSender[0] = ui->lineEditRotFormula;
|
bool bFormulasOK[2] = {true, true};
|
||||||
apleSender[1] = ui->lineEditLenFormula;
|
|
||||||
bool bFormulasOK = true;
|
|
||||||
|
|
||||||
for (int i = 0; i < 2; ++i)
|
for (int i = 0; i < 2; ++i)
|
||||||
{
|
{
|
||||||
|
@ -1017,26 +1015,19 @@ void DialogSeamAllowance::UpdateGrainlineValues()
|
||||||
catch (qmu::QmuParserError &e)
|
catch (qmu::QmuParserError &e)
|
||||||
{
|
{
|
||||||
qsVal = tr("Error");
|
qsVal = tr("Error");
|
||||||
if (not flagGPin)
|
not flagGPin ? ChangeColor(plbText, Qt::red) : ChangeColor(plbText, okColor);
|
||||||
{
|
bFormulasOK[i] = false;
|
||||||
ChangeColor(plbText, Qt::red);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ChangeColor(plbText, okColor);
|
|
||||||
}
|
|
||||||
bFormulasOK = false;
|
|
||||||
plbVal->setToolTip(tr("Parser error: %1").arg(e.GetMsg()));
|
plbVal->setToolTip(tr("Parser error: %1").arg(e.GetMsg()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bFormulasOK && qsVal.isEmpty() == false)
|
if (bFormulasOK[i] && qsVal.isEmpty() == false)
|
||||||
{
|
{
|
||||||
qsVal += qsUnit;
|
qsVal += qsUnit;
|
||||||
}
|
}
|
||||||
plbVal->setText(qsVal);
|
plbVal->setText(qsVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
flagGFormulas = bFormulasOK;
|
flagGFormulas = bFormulasOK[0] && bFormulasOK[1];
|
||||||
if (not flagGFormulas && not flagGPin)
|
if (not flagGFormulas && not flagGPin)
|
||||||
{
|
{
|
||||||
QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png");
|
QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png");
|
||||||
|
@ -1052,12 +1043,9 @@ void DialogSeamAllowance::UpdateGrainlineValues()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSeamAllowance::UpdateDetailLabelValues()
|
void DialogSeamAllowance::UpdateDetailLabelValues()
|
||||||
{
|
{
|
||||||
QPlainTextEdit* apleSender[3];
|
QPlainTextEdit* apleSender[3] = {ui->lineEditDLWidthFormula, ui->lineEditDLHeightFormula,
|
||||||
apleSender[0] = ui->lineEditDLWidthFormula;
|
ui->lineEditDLAngleFormula};
|
||||||
apleSender[1] = ui->lineEditDLHeightFormula;
|
bool bFormulasOK[3] = {true, true, true};
|
||||||
apleSender[2] = ui->lineEditDLAngleFormula;
|
|
||||||
bool bFormulasOK = true;
|
|
||||||
bool angleFormulaOk = true;
|
|
||||||
|
|
||||||
for (int i = 0; i < 3; ++i)
|
for (int i = 0; i < 3; ++i)
|
||||||
{
|
{
|
||||||
|
@ -1110,46 +1098,21 @@ void DialogSeamAllowance::UpdateDetailLabelValues()
|
||||||
catch (qmu::QmuParserError &e)
|
catch (qmu::QmuParserError &e)
|
||||||
{
|
{
|
||||||
qsVal = tr("Error");
|
qsVal = tr("Error");
|
||||||
if (not flagDPin)
|
not flagDPin ? ChangeColor(plbText, Qt::red) : ChangeColor(plbText, okColor);
|
||||||
{
|
bFormulasOK[i] = false;
|
||||||
ChangeColor(plbText, Qt::red);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ChangeColor(plbText, okColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i == 3)
|
|
||||||
{
|
|
||||||
angleFormulaOk = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bFormulasOK = false;
|
|
||||||
}
|
|
||||||
plbVal->setToolTip(tr("Parser error: %1").arg(e.GetMsg()));
|
plbVal->setToolTip(tr("Parser error: %1").arg(e.GetMsg()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == 3)
|
if (bFormulasOK[i] && qsVal.isEmpty() == false)
|
||||||
{
|
|
||||||
if (angleFormulaOk && qsVal.isEmpty() == false)
|
|
||||||
{
|
{
|
||||||
qsVal += qsUnit;
|
qsVal += qsUnit;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (bFormulasOK && qsVal.isEmpty() == false)
|
|
||||||
{
|
|
||||||
qsVal += qsUnit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
plbVal->setText(qsVal);
|
plbVal->setText(qsVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
flagDLAngle = angleFormulaOk;
|
flagDLAngle = bFormulasOK[2];
|
||||||
flagDLFormulas = bFormulasOK;
|
flagDLFormulas = bFormulasOK[0] && bFormulasOK[1];
|
||||||
if (not flagDLAngle && not flagDLFormulas && not flagDPin && not flagPLAngle && not flagPLFormulas && not flagPPin)
|
if (not flagDLAngle && not (flagDLFormulas || flagDPin) && not flagPLAngle && not (flagPLFormulas || flagPPin))
|
||||||
{
|
{
|
||||||
QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png");
|
QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png");
|
||||||
ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabLabels), icon);
|
ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabLabels), icon);
|
||||||
|
@ -1164,12 +1127,9 @@ void DialogSeamAllowance::UpdateDetailLabelValues()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSeamAllowance::UpdatePatternLabelValues()
|
void DialogSeamAllowance::UpdatePatternLabelValues()
|
||||||
{
|
{
|
||||||
QPlainTextEdit* apleSender[3];
|
QPlainTextEdit* apleSender[3] = {ui->lineEditPLWidthFormula, ui->lineEditPLHeightFormula,
|
||||||
apleSender[0] = ui->lineEditPLWidthFormula;
|
ui->lineEditPLAngleFormula};
|
||||||
apleSender[1] = ui->lineEditPLHeightFormula;
|
bool bFormulasOK[3] = {true, true, true};
|
||||||
apleSender[2] = ui->lineEditPLAngleFormula;
|
|
||||||
bool bFormulasOK = true;
|
|
||||||
bool angleFormulaOk = true;
|
|
||||||
|
|
||||||
for (int i = 0; i < 3; ++i)
|
for (int i = 0; i < 3; ++i)
|
||||||
{
|
{
|
||||||
|
@ -1222,46 +1182,21 @@ void DialogSeamAllowance::UpdatePatternLabelValues()
|
||||||
catch (qmu::QmuParserError &e)
|
catch (qmu::QmuParserError &e)
|
||||||
{
|
{
|
||||||
qsVal = tr("Error");
|
qsVal = tr("Error");
|
||||||
if (not flagPPin)
|
not flagPPin ? ChangeColor(plbText, Qt::red) : ChangeColor(plbText, okColor);
|
||||||
{
|
bFormulasOK[i] = false;
|
||||||
ChangeColor(plbText, Qt::red);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ChangeColor(plbText, okColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i == 3)
|
|
||||||
{
|
|
||||||
angleFormulaOk = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bFormulasOK = false;
|
|
||||||
}
|
|
||||||
plbVal->setToolTip(tr("Parser error: %1").arg(e.GetMsg()));
|
plbVal->setToolTip(tr("Parser error: %1").arg(e.GetMsg()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == 3)
|
if (bFormulasOK[i] && qsVal.isEmpty() == false)
|
||||||
{
|
|
||||||
if (angleFormulaOk && qsVal.isEmpty() == false)
|
|
||||||
{
|
{
|
||||||
qsVal += qsUnit;
|
qsVal += qsUnit;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (bFormulasOK && qsVal.isEmpty() == false)
|
|
||||||
{
|
|
||||||
qsVal += qsUnit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
plbVal->setText(qsVal);
|
plbVal->setText(qsVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
flagPLAngle = angleFormulaOk;
|
flagPLAngle = bFormulasOK[2];
|
||||||
flagPLFormulas = bFormulasOK;
|
flagPLFormulas = bFormulasOK[0] && bFormulasOK[1];
|
||||||
if (not flagDLAngle && not flagDLFormulas && not flagDPin && not flagPLAngle && not flagPLFormulas && not flagPPin)
|
if (not flagDLAngle && not (flagDLFormulas || flagDPin) && not flagPLAngle && not (flagPLFormulas || flagPPin))
|
||||||
{
|
{
|
||||||
QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png");
|
QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png");
|
||||||
ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabLabels), icon);
|
ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabLabels), icon);
|
||||||
|
@ -1332,6 +1267,7 @@ void DialogSeamAllowance::EnabledGrainline()
|
||||||
{
|
{
|
||||||
flagGFormulas = true;
|
flagGFormulas = true;
|
||||||
ResetGrainlineWarning();
|
ResetGrainlineWarning();
|
||||||
|
CheckState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1348,6 +1284,7 @@ void DialogSeamAllowance::EnabledDetailLabel()
|
||||||
flagDLAngle = true;
|
flagDLAngle = true;
|
||||||
flagDLFormulas = true;
|
flagDLFormulas = true;
|
||||||
ResetLabelsWarning();
|
ResetLabelsWarning();
|
||||||
|
CheckState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1364,6 +1301,7 @@ void DialogSeamAllowance::EnabledPatternLabel()
|
||||||
flagPLAngle = true;
|
flagPLAngle = true;
|
||||||
flagPLFormulas = true;
|
flagPLFormulas = true;
|
||||||
ResetLabelsWarning();
|
ResetLabelsWarning();
|
||||||
|
CheckState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1780,8 +1718,7 @@ void DialogSeamAllowance::DetailPinPointChanged()
|
||||||
QColor color = okColor;
|
QColor color = okColor;
|
||||||
const quint32 topPinId = getCurrentObjectId(ui->comboBoxDLTopLeftPin);
|
const quint32 topPinId = getCurrentObjectId(ui->comboBoxDLTopLeftPin);
|
||||||
const quint32 bottomPinId = getCurrentObjectId(ui->comboBoxDLBottomRightPin);
|
const quint32 bottomPinId = getCurrentObjectId(ui->comboBoxDLBottomRightPin);
|
||||||
if ((topPinId == NULL_ID && bottomPinId == NULL_ID)
|
if (topPinId != NULL_ID && bottomPinId != NULL_ID && topPinId != bottomPinId)
|
||||||
|| (topPinId != NULL_ID && bottomPinId != NULL_ID && topPinId != bottomPinId))
|
|
||||||
{
|
{
|
||||||
flagDPin = true;
|
flagDPin = true;
|
||||||
color = okColor;
|
color = okColor;
|
||||||
|
@ -1794,7 +1731,7 @@ void DialogSeamAllowance::DetailPinPointChanged()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
flagDPin = false;
|
flagDPin = false;
|
||||||
color = errorColor;
|
topPinId == NULL_ID && bottomPinId == NULL_ID ? color = okColor : color = errorColor;
|
||||||
|
|
||||||
QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png");
|
QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png");
|
||||||
ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabLabels), icon);
|
ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabLabels), icon);
|
||||||
|
@ -1811,8 +1748,7 @@ void DialogSeamAllowance::PatternPinPointChanged()
|
||||||
QColor color = okColor;
|
QColor color = okColor;
|
||||||
const quint32 topPinId = getCurrentObjectId(ui->comboBoxPLTopLeftPin);
|
const quint32 topPinId = getCurrentObjectId(ui->comboBoxPLTopLeftPin);
|
||||||
const quint32 bottomPinId = getCurrentObjectId(ui->comboBoxPLBottomRightPin);
|
const quint32 bottomPinId = getCurrentObjectId(ui->comboBoxPLBottomRightPin);
|
||||||
if ((topPinId == NULL_ID && bottomPinId == NULL_ID)
|
if (topPinId != NULL_ID && bottomPinId != NULL_ID && topPinId != bottomPinId)
|
||||||
|| (topPinId != NULL_ID && bottomPinId != NULL_ID && topPinId != bottomPinId))
|
|
||||||
{
|
{
|
||||||
flagPPin = true;
|
flagPPin = true;
|
||||||
color = okColor;
|
color = okColor;
|
||||||
|
@ -1825,7 +1761,7 @@ void DialogSeamAllowance::PatternPinPointChanged()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
flagPPin = false;
|
flagPPin = false;
|
||||||
color = errorColor;
|
topPinId == NULL_ID && bottomPinId == NULL_ID ? color = okColor : color = errorColor;
|
||||||
|
|
||||||
QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png");
|
QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png");
|
||||||
ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabLabels), icon);
|
ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabLabels), icon);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user