Ask about change of label data.
User must save data before editing a template to be able to see changes in template. --HG-- branch : feature
This commit is contained in:
parent
4aa002f510
commit
67cee35426
|
@ -33,6 +33,8 @@
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QDate>
|
#include <QDate>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
#include "../xml/vpattern.h"
|
#include "../xml/vpattern.h"
|
||||||
#include "../vpatterndb/vcontainer.h"
|
#include "../vpatterndb/vcontainer.h"
|
||||||
#include "../core/vapplication.h"
|
#include "../core/vapplication.h"
|
||||||
|
@ -59,7 +61,8 @@ DialogPatternProperties::DialogPatternProperties(const QString &filePath, VPatte
|
||||||
gradationChanged(false),
|
gradationChanged(false),
|
||||||
defaultChanged(false),
|
defaultChanged(false),
|
||||||
securityChanged(false),
|
securityChanged(false),
|
||||||
generalInfoChanged(false),
|
labelDataChanged(false),
|
||||||
|
askSaveLabelData(false),
|
||||||
deleteAction(nullptr),
|
deleteAction(nullptr),
|
||||||
changeImageAction(nullptr),
|
changeImageAction(nullptr),
|
||||||
saveImageAction(nullptr),
|
saveImageAction(nullptr),
|
||||||
|
@ -195,13 +198,13 @@ DialogPatternProperties::DialogPatternProperties(const QString &filePath, VPatte
|
||||||
ui->checkBoxShowMeasurements->setChecked(doc->IsMeasurementsVisible());
|
ui->checkBoxShowMeasurements->setChecked(doc->IsMeasurementsVisible());
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(ui->lineEditPatternName, &QLineEdit::editingFinished, this, &DialogPatternProperties::GeneralInfoChanged);
|
connect(ui->lineEditPatternName, &QLineEdit::editingFinished, this, &DialogPatternProperties::LabelDataChanged);
|
||||||
connect(ui->lineEditPatternNumber, &QLineEdit::editingFinished, this, &DialogPatternProperties::GeneralInfoChanged);
|
connect(ui->lineEditPatternNumber, &QLineEdit::editingFinished, this, &DialogPatternProperties::LabelDataChanged);
|
||||||
connect(ui->lineEditCompanyName, &QLineEdit::editingFinished, this, &DialogPatternProperties::GeneralInfoChanged);
|
connect(ui->lineEditCompanyName, &QLineEdit::editingFinished, this, &DialogPatternProperties::LabelDataChanged);
|
||||||
connect(ui->lineEditCustomerName, &QLineEdit::editingFinished, this, &DialogPatternProperties::GeneralInfoChanged);
|
connect(ui->lineEditCustomerName, &QLineEdit::editingFinished, this, &DialogPatternProperties::LabelDataChanged);
|
||||||
connect(ui->lineEditSize, &QLineEdit::editingFinished, this, &DialogPatternProperties::GeneralInfoChanged);
|
connect(ui->lineEditSize, &QLineEdit::editingFinished, this, &DialogPatternProperties::LabelDataChanged);
|
||||||
connect(ui->checkBoxShowDate, &QCheckBox::stateChanged, this, &DialogPatternProperties::GeneralInfoChanged);
|
connect(ui->checkBoxShowDate, &QCheckBox::stateChanged, this, &DialogPatternProperties::LabelDataChanged);
|
||||||
connect(ui->checkBoxShowMeasurements, &QCheckBox::stateChanged, this, &DialogPatternProperties::GeneralInfoChanged);
|
connect(ui->checkBoxShowMeasurements, &QCheckBox::stateChanged, this, &DialogPatternProperties::LabelDataChanged);
|
||||||
connect(ui->pushButtonEditPatternLabel, &QPushButton::clicked, this, &DialogPatternProperties::EditLabel);
|
connect(ui->pushButtonEditPatternLabel, &QPushButton::clicked, this, &DialogPatternProperties::EditLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,11 +237,8 @@ void DialogPatternProperties::Apply()
|
||||||
emit doc->patternChanged(false);
|
emit doc->patternChanged(false);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
SaveGeneralInfo();
|
SaveLabelData();
|
||||||
generalInfoChanged = false;
|
|
||||||
emit doc->patternChanged(false);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -275,11 +275,9 @@ void DialogPatternProperties::Ok()
|
||||||
emit doc->patternChanged(false);
|
emit doc->patternChanged(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (generalInfoChanged == true)
|
if (labelDataChanged == true)
|
||||||
{
|
{
|
||||||
SaveGeneralInfo();
|
SaveLabelData();
|
||||||
generalInfoChanged = false;
|
|
||||||
emit doc->patternChanged(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
close();
|
close();
|
||||||
|
@ -423,9 +421,10 @@ void DialogPatternProperties::DefValueChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPatternProperties::GeneralInfoChanged()
|
void DialogPatternProperties::LabelDataChanged()
|
||||||
{
|
{
|
||||||
generalInfoChanged = true;
|
labelDataChanged = true;
|
||||||
|
askSaveLabelData = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -597,7 +596,7 @@ void DialogPatternProperties::SaveDefValues()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPatternProperties::SaveGeneralInfo()
|
void DialogPatternProperties::SaveLabelData()
|
||||||
{
|
{
|
||||||
doc->SetPatternName(ui->lineEditPatternName->text());
|
doc->SetPatternName(ui->lineEditPatternName->text());
|
||||||
doc->SetPatternNumber(ui->lineEditPatternNumber->text());
|
doc->SetPatternNumber(ui->lineEditPatternNumber->text());
|
||||||
|
@ -606,6 +605,10 @@ void DialogPatternProperties::SaveGeneralInfo()
|
||||||
doc->SetPatternSize(ui->lineEditSize->text());
|
doc->SetPatternSize(ui->lineEditSize->text());
|
||||||
doc->SetDateVisible(ui->checkBoxShowDate->isChecked());
|
doc->SetDateVisible(ui->checkBoxShowDate->isChecked());
|
||||||
doc->SetMesurementsVisible(ui->checkBoxShowMeasurements->isChecked());
|
doc->SetMesurementsVisible(ui->checkBoxShowMeasurements->isChecked());
|
||||||
|
|
||||||
|
labelDataChanged = false;
|
||||||
|
askSaveLabelData = false;
|
||||||
|
emit doc->patternChanged(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -855,6 +858,22 @@ void DialogPatternProperties::SaveImage()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPatternProperties::EditLabel()
|
void DialogPatternProperties::EditLabel()
|
||||||
{
|
{
|
||||||
|
if (labelDataChanged && askSaveLabelData)
|
||||||
|
{
|
||||||
|
QMessageBox::StandardButton answer = QMessageBox::question(this, tr("Save label data."),
|
||||||
|
tr("Label data were changed. Do you want to save them before editing label template?"),
|
||||||
|
QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes);
|
||||||
|
|
||||||
|
if (answer == QMessageBox::Yes)
|
||||||
|
{
|
||||||
|
SaveLabelData();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
askSaveLabelData = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DialogEditLabel editor;
|
DialogEditLabel editor;
|
||||||
editor.exec();
|
editor.exec();
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ signals:
|
||||||
void UpdateGradation();
|
void UpdateGradation();
|
||||||
private slots:
|
private slots:
|
||||||
void DefValueChanged();
|
void DefValueChanged();
|
||||||
void GeneralInfoChanged();
|
void LabelDataChanged();
|
||||||
void Apply();
|
void Apply();
|
||||||
void Ok();
|
void Ok();
|
||||||
void SelectAll(int state);
|
void SelectAll(int state);
|
||||||
|
@ -77,7 +77,8 @@ private:
|
||||||
bool gradationChanged;
|
bool gradationChanged;
|
||||||
bool defaultChanged;
|
bool defaultChanged;
|
||||||
bool securityChanged;
|
bool securityChanged;
|
||||||
bool generalInfoChanged;
|
bool labelDataChanged;
|
||||||
|
bool askSaveLabelData;
|
||||||
QAction *deleteAction;
|
QAction *deleteAction;
|
||||||
QAction *changeImageAction;
|
QAction *changeImageAction;
|
||||||
QAction *saveImageAction;
|
QAction *saveImageAction;
|
||||||
|
@ -98,7 +99,7 @@ private:
|
||||||
void SaveDescription();
|
void SaveDescription();
|
||||||
void SaveGradation();
|
void SaveGradation();
|
||||||
void SaveDefValues();
|
void SaveDefValues();
|
||||||
void SaveGeneralInfo();
|
void SaveLabelData();
|
||||||
|
|
||||||
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