Clang warnings.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-09-02 15:37:52 +03:00
parent fd2f977e44
commit ec0c69c738
3 changed files with 10 additions and 83 deletions

View File

@ -979,16 +979,7 @@ void DialogIncrements::SaveIncrName(const QString &text)
newName = name; newName = name;
} }
if (lineEdit == ui->lineEditName) doc->SetIncrementName(nameField->text(), newName);
{
doc->SetIncrementName(nameField->text(), newName);
}
else if (lineEdit == ui->lineEditNamePC)
{
doc->SetPreviewCalculationName(nameField->text(), newName);
}
QVector<VFormulaField> expression = doc->ListIncrementExpressions(); QVector<VFormulaField> expression = doc->ListIncrementExpressions();
doc->ReplaceNameInFormula(expression, nameField->text(), newName); doc->ReplaceNameInFormula(expression, nameField->text(), newName);
@ -1030,16 +1021,7 @@ void DialogIncrements::SaveIncrDescription()
} }
const QTableWidgetItem *nameField = table->item(row, 0); const QTableWidgetItem *nameField = table->item(row, 0);
doc->SetIncrementDescription(nameField->text(), textEdit->toPlainText());
if (textEdit == ui->plainTextEditDescription)
{
doc->SetIncrementDescription(nameField->text(), textEdit->toPlainText());
}
else if (textEdit == ui->plainTextEditDescriptionPC)
{
doc->SetPreviewCalculationDescription(nameField->text(), textEdit->toPlainText());
}
LocalUpdateTree(); LocalUpdateTree();
const QTextCursor cursor = textEdit->textCursor(); const QTextCursor cursor = textEdit->textCursor();
@ -1112,16 +1094,7 @@ void DialogIncrements::SaveIncrFormula()
try try
{ {
const QString formula = qApp->TrVars()->FormulaFromUser(text, qApp->Settings()->GetOsSeparator()); const QString formula = qApp->TrVars()->FormulaFromUser(text, qApp->Settings()->GetOsSeparator());
doc->SetIncrementFormula(nameField->text(), formula);
if (textEdit == ui->plainTextEditFormula)
{
doc->SetIncrementFormula(nameField->text(), formula);
}
else if (textEdit == ui->plainTextEditFormulaPC)
{
doc->SetPreviewCalculationFormula(nameField->text(), formula);
}
} }
catch (qmu::QmuParserError &e) // Just in case something bad will happen catch (qmu::QmuParserError &e) // Just in case something bad will happen
{ {

View File

@ -3161,34 +3161,12 @@ void VPattern::MoveDownIncrement(const QString &type, const QString &name)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::SetIncrementName(const QString &type, const QString &name, const QString &text) void VPattern::SetIncrementAttribute(const QString &name, const QString &attr, const QString &text)
{ {
QDomElement node = FindIncrement(name); QDomElement node = FindIncrement(name);
if (not node.isNull()) if (not node.isNull())
{ {
SetAttribute(node, IncrementName, text); SetAttribute(node, attr, text);
emit patternChanged(false);
}
}
//---------------------------------------------------------------------------------------------------------------------
void VPattern::SetIncrementFormula(const QString &type, const QString &name, const QString &text)
{
QDomElement node = FindIncrement(name);
if (not node.isNull())
{
SetAttribute(node, IncrementFormula, text);
emit patternChanged(false);
}
}
//---------------------------------------------------------------------------------------------------------------------
void VPattern::SetIncrementDescription(const QString &type, const QString &name, const QString &text)
{
QDomElement node = FindIncrement(name);
if (not node.isNull())
{
SetAttribute(node, IncrementDescription, text);
emit patternChanged(false); emit patternChanged(false);
} }
} }
@ -3552,37 +3530,19 @@ void VPattern::MoveDownPreviewCalculation(const QString &name)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::SetIncrementName(const QString &name, const QString &text) void VPattern::SetIncrementName(const QString &name, const QString &text)
{ {
SetIncrementName(TagIncrement, name, text); SetIncrementAttribute(name, IncrementName, text);
}
//---------------------------------------------------------------------------------------------------------------------
void VPattern::SetPreviewCalculationName(const QString &name, const QString &text)
{
SetIncrementName(TagPreviewCalculations, name, text);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::SetIncrementFormula(const QString &name, const QString &text) void VPattern::SetIncrementFormula(const QString &name, const QString &text)
{ {
SetIncrementFormula(TagIncrement, name, text); SetIncrementAttribute(name, IncrementFormula, text);
}
//---------------------------------------------------------------------------------------------------------------------
void VPattern::SetPreviewCalculationFormula(const QString &name, const QString &text)
{
SetIncrementFormula(TagPreviewCalculations, name, text);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::SetIncrementDescription(const QString &name, const QString &text) void VPattern::SetIncrementDescription(const QString &name, const QString &text)
{ {
SetIncrementDescription(TagIncrement, name, text); SetIncrementAttribute(name, IncrementDescription, text);
}
//---------------------------------------------------------------------------------------------------------------------
void VPattern::SetPreviewCalculationDescription(const QString &name, const QString &text)
{
SetIncrementDescription(TagPreviewCalculations, name, text);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -82,13 +82,8 @@ public:
void MoveDownPreviewCalculation(const QString &name); void MoveDownPreviewCalculation(const QString &name);
void SetIncrementName(const QString &name, const QString &text); void SetIncrementName(const QString &name, const QString &text);
void SetPreviewCalculationName(const QString &name, const QString &text);
void SetIncrementFormula(const QString &name, const QString &text); void SetIncrementFormula(const QString &name, const QString &text);
void SetPreviewCalculationFormula(const QString &name, const QString &text);
void SetIncrementDescription(const QString &name, const QString &text); void SetIncrementDescription(const QString &name, const QString &text);
void SetPreviewCalculationDescription(const QString &name, const QString &text);
void ReplaceNameInFormula(QVector<VFormulaField> &expressions, const QString &name, const QString &newName); void ReplaceNameInFormula(QVector<VFormulaField> &expressions, const QString &name, const QString &newName);
@ -242,9 +237,8 @@ private:
void RemoveIncrement(const QString &type, const QString &name); void RemoveIncrement(const QString &type, const QString &name);
void MoveUpIncrement(const QString &type, const QString &name); void MoveUpIncrement(const QString &type, const QString &name);
void MoveDownIncrement(const QString &type, const QString &name); void MoveDownIncrement(const QString &type, const QString &name);
void SetIncrementName(const QString &type, const QString &name, const QString &text);
void SetIncrementFormula(const QString &type, const QString &name, const QString &text); void SetIncrementAttribute(const QString &name, const QString &attr, const QString &text);
void SetIncrementDescription(const QString &type, const QString &name, const QString &text);
}; };
#endif // VPATTERN_H #endif // VPATTERN_H