Refactoring.
--HG-- branch : feature
This commit is contained in:
parent
d5c2b1b50d
commit
10e1c2fbfa
|
@ -221,20 +221,13 @@ void DialogPatternProperties::Apply()
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
SaveDescription();
|
SaveDescription();
|
||||||
descriptionChanged = false;
|
|
||||||
emit doc->patternChanged(false);
|
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
SaveGradation();
|
SaveGradation();
|
||||||
gradationChanged = false;
|
|
||||||
SaveDefValues();
|
SaveDefValues();
|
||||||
defaultChanged = false;
|
|
||||||
emit doc->patternChanged(false);
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
doc->SetReadOnly(ui->checkBoxPatternReadOnly->isChecked());
|
SaveReadOnlyState();
|
||||||
securityChanged = false;
|
|
||||||
emit doc->patternChanged(false);
|
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
SaveLabelData();
|
SaveLabelData();
|
||||||
|
@ -248,34 +241,10 @@ void DialogPatternProperties::Apply()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPatternProperties::Ok()
|
void DialogPatternProperties::Ok()
|
||||||
{
|
{
|
||||||
if (descriptionChanged)
|
|
||||||
{
|
|
||||||
SaveDescription();
|
SaveDescription();
|
||||||
descriptionChanged = false;
|
|
||||||
emit doc->patternChanged(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gradationChanged)
|
|
||||||
{
|
|
||||||
SaveGradation();
|
SaveGradation();
|
||||||
gradationChanged = false;
|
|
||||||
emit doc->patternChanged(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (defaultChanged)
|
|
||||||
{
|
|
||||||
SaveDefValues();
|
SaveDefValues();
|
||||||
defaultChanged = false;
|
SaveReadOnlyState();
|
||||||
emit doc->patternChanged(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (securityChanged)
|
|
||||||
{
|
|
||||||
doc->SetReadOnly(ui->checkBoxPatternReadOnly->isChecked());
|
|
||||||
securityChanged = false;
|
|
||||||
emit doc->patternChanged(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
SaveLabelData();
|
SaveLabelData();
|
||||||
SaveTemplateData();
|
SaveTemplateData();
|
||||||
|
|
||||||
|
@ -565,22 +534,35 @@ void DialogPatternProperties::CheckApplyOk()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPatternProperties::SaveDescription()
|
void DialogPatternProperties::SaveDescription()
|
||||||
{
|
{
|
||||||
|
if (descriptionChanged)
|
||||||
|
{
|
||||||
doc->SetNotes(ui->plainTextEditTechNotes->document()->toPlainText());
|
doc->SetNotes(ui->plainTextEditTechNotes->document()->toPlainText());
|
||||||
doc->SetDescription(ui->plainTextEditDescription->document()->toPlainText());
|
doc->SetDescription(ui->plainTextEditDescription->document()->toPlainText());
|
||||||
doc->SetAuthor(ui->lineEditAuthor->text());
|
doc->SetAuthor(ui->lineEditAuthor->text());
|
||||||
|
|
||||||
|
descriptionChanged = false;
|
||||||
|
emit doc->patternChanged(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPatternProperties::SaveGradation()
|
void DialogPatternProperties::SaveGradation()
|
||||||
{
|
{
|
||||||
|
if (gradationChanged)
|
||||||
|
{
|
||||||
doc->SetGradationHeights(heights);
|
doc->SetGradationHeights(heights);
|
||||||
doc->SetGradationSizes(sizes);
|
doc->SetGradationSizes(sizes);
|
||||||
emit UpdateGradation();
|
emit UpdateGradation();
|
||||||
|
gradationChanged = false;
|
||||||
|
emit doc->patternChanged(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPatternProperties::SaveDefValues()
|
void DialogPatternProperties::SaveDefValues()
|
||||||
{
|
{
|
||||||
|
if (defaultChanged)
|
||||||
|
{
|
||||||
if (ui->radioButtonDefFromM->isChecked())
|
if (ui->radioButtonDefFromM->isChecked())
|
||||||
{
|
{
|
||||||
doc->SetDefCustom(false);
|
doc->SetDefCustom(false);
|
||||||
|
@ -592,6 +574,8 @@ void DialogPatternProperties::SaveDefValues()
|
||||||
doc->SetDefCustomSize(ui->comboBoxSize->currentText().toInt());
|
doc->SetDefCustomSize(ui->comboBoxSize->currentText().toInt());
|
||||||
}
|
}
|
||||||
defaultChanged = false;
|
defaultChanged = false;
|
||||||
|
emit doc->patternChanged(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -624,6 +608,17 @@ void DialogPatternProperties::SaveTemplateData()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPatternProperties::SaveReadOnlyState()
|
||||||
|
{
|
||||||
|
if (securityChanged)
|
||||||
|
{
|
||||||
|
doc->SetReadOnly(ui->checkBoxPatternReadOnly->isChecked());
|
||||||
|
securityChanged = false;
|
||||||
|
emit doc->patternChanged(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPatternProperties::SetDefaultHeight(const QString &def)
|
void DialogPatternProperties::SetDefaultHeight(const QString &def)
|
||||||
{
|
{
|
||||||
|
|
|
@ -104,6 +104,7 @@ private:
|
||||||
void SaveDefValues();
|
void SaveDefValues();
|
||||||
void SaveLabelData();
|
void SaveLabelData();
|
||||||
void SaveTemplateData();
|
void SaveTemplateData();
|
||||||
|
void SaveReadOnlyState();
|
||||||
|
|
||||||
void SetDefaultHeight(const QString &def);
|
void SetDefaultHeight(const QString &def);
|
||||||
void SetDefaultSize(const QString &def);
|
void SetDefaultSize(const QString &def);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user