Added general info parameters to VPattern and updated pattern properties dialog accordingly
--HG-- branch : feature
This commit is contained in:
parent
e68fa3a0f3
commit
065621f8c2
|
@ -55,6 +55,7 @@ DialogPatternProperties::DialogPatternProperties(const QString &filePath, VPatte
|
|||
gradationChanged(false),
|
||||
defaultChanged(false),
|
||||
securityChanged(false),
|
||||
generalInfoChanged(false),
|
||||
deleteAction(nullptr),
|
||||
changeImageAction(nullptr),
|
||||
saveImageAction(nullptr),
|
||||
|
@ -159,6 +160,17 @@ DialogPatternProperties::DialogPatternProperties(const QString &filePath, VPatte
|
|||
gradationChanged = false;
|
||||
defaultChanged = false;
|
||||
securityChanged = false;
|
||||
|
||||
ui->lineEditPatternName->setText(doc->GetPatternName());
|
||||
ui->lineEditPatternNumber->setText(doc->GetPatternNumber());
|
||||
ui->lineEditCompanyName->setText(doc->GetCompanyName());
|
||||
ui->lineEditCustomerName->setText(doc->GetCustomerName());
|
||||
ui->labelCreationDate->setText(doc->GetCreationDate().toString(Qt::SystemLocaleLongDate));
|
||||
|
||||
connect(ui->lineEditPatternName, &QLineEdit::editingFinished, this, &DialogPatternProperties::GeneralInfoChanged);
|
||||
connect(ui->lineEditPatternNumber, &QLineEdit::editingFinished, this, &DialogPatternProperties::GeneralInfoChanged);
|
||||
connect(ui->lineEditCompanyName, &QLineEdit::editingFinished, this, &DialogPatternProperties::GeneralInfoChanged);
|
||||
connect(ui->lineEditCustomerName, &QLineEdit::editingFinished, this, &DialogPatternProperties::GeneralInfoChanged);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -189,6 +201,12 @@ void DialogPatternProperties::Apply()
|
|||
securityChanged = false;
|
||||
emit doc->patternChanged(false);
|
||||
break;
|
||||
case 3:
|
||||
SaveGeneralInfo();
|
||||
generalInfoChanged = false;
|
||||
emit doc->patternChanged(false);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -225,6 +243,13 @@ void DialogPatternProperties::Ok()
|
|||
emit doc->patternChanged(false);
|
||||
}
|
||||
|
||||
if (generalInfoChanged == true)
|
||||
{
|
||||
SaveGeneralInfo();
|
||||
generalInfoChanged = false;
|
||||
emit doc->patternChanged(false);
|
||||
}
|
||||
|
||||
close();
|
||||
}
|
||||
|
||||
|
@ -378,6 +403,12 @@ void DialogPatternProperties::SecurityValueChanged()
|
|||
securityChanged = true;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPatternProperties::GeneralInfoChanged()
|
||||
{
|
||||
generalInfoChanged = true;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPatternProperties::SetHeightsChecked(bool enabled)
|
||||
{
|
||||
|
@ -514,6 +545,15 @@ void DialogPatternProperties::SaveDefValues()
|
|||
defaultChanged = false;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPatternProperties::SaveGeneralInfo()
|
||||
{
|
||||
doc->SetPatternName(ui->lineEditPatternName->text());
|
||||
doc->SetPatternNumber(ui->lineEditPatternNumber->text());
|
||||
doc->SetCompanyName(ui->lineEditCompanyName->text());
|
||||
doc->SetCustomerName(ui->lineEditCustomerName->text());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPatternProperties::SetDefaultHeight(const QString &def)
|
||||
{
|
||||
|
|
|
@ -64,6 +64,7 @@ private slots:
|
|||
void ToggleComboBox();
|
||||
void DefValueChanged();
|
||||
void SecurityValueChanged();
|
||||
void GeneralInfoChanged();
|
||||
void DeleteImage();
|
||||
void SaveImage();
|
||||
void ShowImage();
|
||||
|
@ -81,6 +82,7 @@ private:
|
|||
bool gradationChanged;
|
||||
bool defaultChanged;
|
||||
bool securityChanged;
|
||||
bool generalInfoChanged;
|
||||
QAction *deleteAction;
|
||||
QAction *changeImageAction;
|
||||
QAction *saveImageAction;
|
||||
|
@ -101,6 +103,7 @@ private:
|
|||
void SaveDescription();
|
||||
void SaveGradation();
|
||||
void SaveDefValues();
|
||||
void SaveGeneralInfo();
|
||||
|
||||
void SetDefaultHeight(const QString &def);
|
||||
void SetDefaultSize(const QString &def);
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>3</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
|
@ -1043,6 +1043,80 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_4">
|
||||
<attribute name="title">
|
||||
<string>General info</string>
|
||||
</attribute>
|
||||
<widget class="QWidget" name="formLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>401</width>
|
||||
<height>171</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Pattern name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="lineEditPatternName"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Pattern number:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="lineEditPatternNumber"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Company/Designer name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="lineEditCompanyName"/>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Customer name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="lineEditCustomerName"/>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Created:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLabel" name="labelCreationDate">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
|
|
@ -62,6 +62,11 @@ const QString VAbstractPattern::TagSizes = QStringLiteral("sizes");
|
|||
const QString VAbstractPattern::TagUnit = QStringLiteral("unit");
|
||||
const QString VAbstractPattern::TagData = QStringLiteral("data");
|
||||
const QString VAbstractPattern::TagMCP = QStringLiteral("mcp");
|
||||
const QString VAbstractPattern::TagPatternName = QStringLiteral("patternName");
|
||||
const QString VAbstractPattern::TagPatternNum = QStringLiteral("patternNumber");
|
||||
const QString VAbstractPattern::TagCustomerName = QStringLiteral("customer");
|
||||
const QString VAbstractPattern::TagCompanyName = QStringLiteral("company");
|
||||
const QString VAbstractPattern::TagCreationDate = QStringLiteral("created");
|
||||
|
||||
const QString VAbstractPattern::AttrName = QStringLiteral("name");
|
||||
const QString VAbstractPattern::AttrVisible = QStringLiteral("visible");
|
||||
|
@ -985,6 +990,89 @@ void VAbstractPattern::SetNotes(const QString &text)
|
|||
emit patternChanged(false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VAbstractPattern::GetPatternName() const
|
||||
{
|
||||
return UniqueTagText(TagPatternName);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractPattern::SetPatternName(QString qsName)
|
||||
{
|
||||
CheckTagExists(TagPatternName);
|
||||
setTagText(TagPatternName, qsName);
|
||||
modified = true;
|
||||
emit patternChanged(false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VAbstractPattern::GetCompanyName() const
|
||||
{
|
||||
return UniqueTagText(TagCompanyName);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractPattern::SetCompanyName(QString qsName)
|
||||
{
|
||||
CheckTagExists(TagCompanyName);
|
||||
setTagText(TagCompanyName, qsName);
|
||||
modified = true;
|
||||
emit patternChanged(false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VAbstractPattern::GetPatternNumber() const
|
||||
{
|
||||
return UniqueTagText(TagPatternNum);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractPattern::SetPatternNumber(QString qsNum)
|
||||
{
|
||||
CheckTagExists(TagPatternNum);
|
||||
setTagText(TagPatternNum, qsNum);
|
||||
modified = true;
|
||||
emit patternChanged(false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VAbstractPattern::GetCustomerName() const
|
||||
{
|
||||
return UniqueTagText(TagCustomerName);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractPattern::SetCustomerName(QString qsName)
|
||||
{
|
||||
CheckTagExists(TagCustomerName);
|
||||
setTagText(TagCustomerName, qsName);
|
||||
modified = true;
|
||||
emit patternChanged(false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QDate VAbstractPattern::GetCreationDate() const
|
||||
{
|
||||
QStringList qsl = UniqueTagText(TagCreationDate).split(".");
|
||||
if (qsl.count() == 3)
|
||||
{
|
||||
bool bDay;
|
||||
bool bMonth;
|
||||
bool bYear;
|
||||
int iDay = qsl[0].toInt(&bDay);
|
||||
int iMonth = qsl[1].toInt(&bMonth);
|
||||
int iYear = qsl[2].toInt(&bYear);
|
||||
|
||||
if (bDay == true && bMonth == true && bYear == true)
|
||||
{
|
||||
QDate date;
|
||||
date.setDate(iYear, iMonth, iDay);
|
||||
return date;
|
||||
}
|
||||
}
|
||||
return QDate::currentDate();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VAbstractPattern::GetImage() const
|
||||
{
|
||||
|
@ -1109,7 +1197,8 @@ QDomElement VAbstractPattern::CheckTagExists(const QString &tag)
|
|||
if (list.isEmpty())
|
||||
{
|
||||
const QStringList tags = QStringList() << TagUnit << TagImage << TagAuthor << TagDescription << TagNotes
|
||||
<< TagGradation;
|
||||
<< TagGradation << TagPatternName << TagPatternNum << TagCompanyName
|
||||
<< TagCustomerName << TagCreationDate;
|
||||
switch (tags.indexOf(tag))
|
||||
{
|
||||
case 0: //TagUnit
|
||||
|
@ -1150,6 +1239,32 @@ QDomElement VAbstractPattern::CheckTagExists(const QString &tag)
|
|||
element.appendChild(sizes);
|
||||
break;
|
||||
}
|
||||
case 6: // TagPatternName
|
||||
{
|
||||
element = createElement(TagPatternName);
|
||||
break;
|
||||
}
|
||||
case 7: // TagPatternName
|
||||
{
|
||||
element = createElement(TagPatternNum);
|
||||
break;
|
||||
}
|
||||
case 8: // TagPatternName
|
||||
{
|
||||
element = createElement(TagCompanyName);
|
||||
break;
|
||||
}
|
||||
case 9: // TagPatternName
|
||||
{
|
||||
element = createElement(TagCustomerName);
|
||||
break;
|
||||
}
|
||||
case 10: // TagPatternName
|
||||
{
|
||||
element = createElement(TagCreationDate);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
return QDomElement();
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "vtoolrecord.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QDate>
|
||||
|
||||
enum class Document : char { LiteParse, LitePPParse, FullParse };
|
||||
enum class LabelType : char {NewPatternPiece, NewLabel};
|
||||
|
@ -107,6 +108,16 @@ public:
|
|||
QString GetNotes() const;
|
||||
void SetNotes(const QString &text);
|
||||
|
||||
QString GetPatternName() const;
|
||||
void SetPatternName(QString qsName);
|
||||
QString GetCompanyName() const;
|
||||
void SetCompanyName(QString qsName);
|
||||
QString GetPatternNumber() const;
|
||||
void SetPatternNumber(QString qsNum);
|
||||
QString GetCustomerName() const;
|
||||
void SetCustomerName(QString qsName);
|
||||
QDate GetCreationDate() const;
|
||||
|
||||
QString GetImage() const;
|
||||
QString GetImageExtension() const;
|
||||
void SetImage(const QString &text, const QString &extension);
|
||||
|
@ -157,6 +168,11 @@ public:
|
|||
static const QString TagUnit;
|
||||
static const QString TagData;
|
||||
static const QString TagMCP;
|
||||
static const QString TagPatternName;
|
||||
static const QString TagPatternNum;
|
||||
static const QString TagCompanyName;
|
||||
static const QString TagCustomerName;
|
||||
static const QString TagCreationDate;
|
||||
|
||||
static const QString AttrName;
|
||||
static const QString AttrVisible;
|
||||
|
|
Loading…
Reference in New Issue
Block a user