parent
26c8884af0
commit
a74351495c
|
@ -874,7 +874,7 @@
|
||||||
</xs:simpleType>
|
</xs:simpleType>
|
||||||
<xs:simpleType name="shortMeasurementName">
|
<xs:simpleType name="shortMeasurementName">
|
||||||
<xs:restriction base="xs:string">
|
<xs:restriction base="xs:string">
|
||||||
<xs:pattern value="([\p{L}]|[^0-9])[_\p{L}0-9]*"/>
|
<xs:pattern value="^([^0-9-*/^+=\s\(\)%:;!]){1,1}([^-*/^+=\s\(\)%:;!]){0,}$"/>
|
||||||
</xs:restriction>
|
</xs:restriction>
|
||||||
</xs:simpleType>
|
</xs:simpleType>
|
||||||
<xs:simpleType name="units">
|
<xs:simpleType name="units">
|
||||||
|
|
|
@ -213,7 +213,7 @@
|
||||||
</xs:element>
|
</xs:element>
|
||||||
<xs:simpleType name="shortName">
|
<xs:simpleType name="shortName">
|
||||||
<xs:restriction base="xs:string">
|
<xs:restriction base="xs:string">
|
||||||
<xs:pattern value="([\p{L}]|[^0-9])[_\p{L}0-9]*"/>
|
<xs:pattern value="^([^0-9-*/^+=\s\(\)%:;!]){1,1}([^-*/^+=\s\(\)%:;!]){0,}$"/>
|
||||||
</xs:restriction>
|
</xs:restriction>
|
||||||
</xs:simpleType>
|
</xs:simpleType>
|
||||||
<xs:simpleType name="units">
|
<xs:simpleType name="units">
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</xs:element>
|
</xs:element>
|
||||||
<xs:simpleType name="shortMeasurementName">
|
<xs:simpleType name="shortMeasurementName">
|
||||||
<xs:restriction base="xs:string">
|
<xs:restriction base="xs:string">
|
||||||
<xs:pattern value="([\p{L}]|[^0-9])[_\p{L}0-9]*"/>
|
<xs:pattern value="^([^0-9-*/^+=\s\(\)%:;!]){1,1}([^-*/^+=\s\(\)%:;!]){0,}$"/>
|
||||||
</xs:restriction>
|
</xs:restriction>
|
||||||
</xs:simpleType>
|
</xs:simpleType>
|
||||||
<xs:simpleType name="units">
|
<xs:simpleType name="units">
|
||||||
|
|
|
@ -81,27 +81,20 @@ void VContainer::setData(const VContainer &data)
|
||||||
switch (i.value()->getType())
|
switch (i.value()->getType())
|
||||||
{
|
{
|
||||||
case (GObject::Arc):
|
case (GObject::Arc):
|
||||||
{
|
|
||||||
CopyGObject<VArc>(data, i.key());
|
CopyGObject<VArc>(data, i.key());
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case (GObject::Point):
|
case (GObject::Point):
|
||||||
{
|
|
||||||
CopyGObject<VPointF>(data, i.key());
|
CopyGObject<VPointF>(data, i.key());
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case (GObject::Spline):
|
case (GObject::Spline):
|
||||||
{
|
|
||||||
CopyGObject<VSpline>(data, i.key());
|
CopyGObject<VSpline>(data, i.key());
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case (GObject::SplinePath):
|
case (GObject::SplinePath):
|
||||||
{
|
|
||||||
CopyGObject<VSplinePath>(data, i.key());
|
CopyGObject<VSplinePath>(data, i.key());
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
qWarning()<<"Don't know how copy this type.";
|
qDebug()<<"Don't know how copy this type.";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
measurements = *data.DataMeasurements();
|
measurements = *data.DataMeasurements();
|
||||||
|
|
|
@ -272,6 +272,7 @@ public:
|
||||||
* @brief ClearIncrementTable clear increment table
|
* @brief ClearIncrementTable clear increment table
|
||||||
*/
|
*/
|
||||||
void ClearIncrementTable();
|
void ClearIncrementTable();
|
||||||
|
void ClearMeasurements();
|
||||||
/**
|
/**
|
||||||
* @brief ClearLengthLines clear length lines
|
* @brief ClearLengthLines clear length lines
|
||||||
*/
|
*/
|
||||||
|
@ -478,6 +479,11 @@ inline void VContainer::ClearIncrementTable()
|
||||||
increments.clear();
|
increments.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void VContainer::ClearMeasurements()
|
||||||
|
{
|
||||||
|
measurements.clear();
|
||||||
|
}
|
||||||
|
|
||||||
inline void VContainer::ClearLengthLines()
|
inline void VContainer::ClearLengthLines()
|
||||||
{
|
{
|
||||||
lengthLines.clear();
|
lengthLines.clear();
|
||||||
|
|
|
@ -170,7 +170,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
||||||
const QDomElement domElement = doc->elementById(QString().setNum(tool.getId()));
|
const QDomElement domElement = doc->elementById(QString().setNum(tool.getId()));
|
||||||
if (domElement.isElement() == false)
|
if (domElement.isElement() == false)
|
||||||
{
|
{
|
||||||
qWarning()<<"Can't find element by id"<<Q_FUNC_INFO;
|
qDebug()<<"Can't find element by id"<<Q_FUNC_INFO;
|
||||||
return QString(tr("Can't create record."));
|
return QString(tr("Can't create record."));
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
|
@ -283,7 +283,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qWarning()<<"Not enough points in splinepath"<<Q_FUNC_INFO;
|
qDebug()<<"Not enough points in splinepath"<<Q_FUNC_INFO;
|
||||||
return QString(tr("Can't create record."));
|
return QString(tr("Can't create record."));
|
||||||
}
|
}
|
||||||
return record;
|
return record;
|
||||||
|
@ -375,7 +375,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qWarning()<<"Not enough points in splinepath"<<Q_FUNC_INFO;
|
qDebug()<<"Not enough points in splinepath"<<Q_FUNC_INFO;
|
||||||
return QString(tr("Can't create record."));
|
return QString(tr("Can't create record."));
|
||||||
}
|
}
|
||||||
return record;
|
return record;
|
||||||
|
@ -395,13 +395,13 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
||||||
case Valentina::NodeSplinePath:
|
case Valentina::NodeSplinePath:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qWarning()<<"Got wrong tool type. Ignore.";
|
qDebug()<<"Got wrong tool type. Ignore.";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (const VExceptionBadId &e)
|
catch (const VExceptionBadId &e)
|
||||||
{
|
{
|
||||||
qWarning()<<e.ErrorMessage()<<Q_FUNC_INFO;
|
qDebug()<<e.ErrorMessage()<<Q_FUNC_INFO;
|
||||||
return QString(tr("Can't create record."));
|
return QString(tr("Can't create record."));
|
||||||
}
|
}
|
||||||
return QString();
|
return QString();
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include "../../widgets/doubledelegate.h"
|
#include "../../widgets/doubledelegate.h"
|
||||||
#include "../../widgets/textdelegate.h"
|
#include "../../widgets/textdelegate.h"
|
||||||
#include "../../exception/vexception.h"
|
#include "../../exception/vexception.h"
|
||||||
|
#include "../../xml/vstandardmeasurements.h"
|
||||||
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
@ -39,26 +40,48 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
|
||||||
:DialogTool(data, parent), ui(new Ui::DialogIncrements), data(data), doc(doc), row(0), column(0), m(nullptr)
|
:DialogTool(data, parent), ui(new Ui::DialogIncrements), data(data), doc(doc), row(0), column(0), m(nullptr)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
TextDelegate *textDelegate = new TextDelegate(ui->tableWidgetIncrement);
|
|
||||||
|
if (qApp->patternType() == Pattern::Individual)
|
||||||
|
{
|
||||||
|
const QString filePath = doc->MPath();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
VDomDocument::ValidateXML("://schema/individual_measurements.xsd", filePath);
|
||||||
|
m = new VIndividualMeasurements(data);
|
||||||
|
m->setContent(filePath);
|
||||||
|
}
|
||||||
|
catch(VException &e)
|
||||||
|
{
|
||||||
|
e.CriticalMessageBox(tr("File error."), this);
|
||||||
|
emit DialogClosed(QDialog::Rejected);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Same regex in each shema files. Don't forget synchronize.
|
||||||
|
TextDelegate *textDelegate = new TextDelegate("^([^0-9-*/^+=\\s\\(\\)%:;!]){1,1}([^-*/^+=\\s\\(\\)%:;!]){0,}$",
|
||||||
|
ui->tableWidgetIncrement);
|
||||||
ui->tableWidgetIncrement->setItemDelegateForColumn(0, textDelegate);// name
|
ui->tableWidgetIncrement->setItemDelegateForColumn(0, textDelegate);// name
|
||||||
DoubleSpinBoxDelegate *doubleDelegate = new DoubleSpinBoxDelegate(ui->tableWidgetIncrement);
|
DoubleSpinBoxDelegate *doubleDelegate = new DoubleSpinBoxDelegate(ui->tableWidgetIncrement);
|
||||||
ui->tableWidgetIncrement->setItemDelegateForColumn(2, doubleDelegate);// base value
|
ui->tableWidgetIncrement->setItemDelegateForColumn(2, doubleDelegate);// base value
|
||||||
ui->tableWidgetIncrement->setItemDelegateForColumn(3, doubleDelegate);// in sizes
|
ui->tableWidgetIncrement->setItemDelegateForColumn(3, doubleDelegate);// in sizes
|
||||||
ui->tableWidgetIncrement->setItemDelegateForColumn(4, doubleDelegate);// in heights
|
ui->tableWidgetIncrement->setItemDelegateForColumn(4, doubleDelegate);// in heights
|
||||||
|
|
||||||
|
FillMeasurements();
|
||||||
|
FillIncrements();
|
||||||
|
FillLengthLines();
|
||||||
|
FillLengthSplines();
|
||||||
|
FillLengthArcs();
|
||||||
|
|
||||||
if (qApp->patternType() == Pattern::Standard)
|
if (qApp->patternType() == Pattern::Standard)
|
||||||
{
|
{
|
||||||
ui->labelBirthDate->setVisible(false);
|
ui->pagePersonalInformation->setVisible(false);
|
||||||
ui->lineEditBirthDate->setVisible(false);
|
|
||||||
ui->labelFamilyName->setVisible(false);
|
|
||||||
ui->lineEditFamilyName->setVisible(false);
|
|
||||||
ui->labelGivenName->setVisible(false);
|
|
||||||
ui->lineEditGivenName->setVisible(false);
|
|
||||||
ui->labelSex->setVisible(false);
|
|
||||||
ui->lineEditSex->setVisible(false);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
QRegExpValidator *reg = new QRegExpValidator(QRegExp("\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*"));
|
||||||
|
ui->lineEditMail->setValidator(reg);
|
||||||
|
|
||||||
ui->tableWidgetMeasurements->setColumnHidden( 1, true );// calculated value
|
ui->tableWidgetMeasurements->setColumnHidden( 1, true );// calculated value
|
||||||
ui->tableWidgetMeasurements->setColumnHidden( 3, true );// in sizes
|
ui->tableWidgetMeasurements->setColumnHidden( 3, true );// in sizes
|
||||||
ui->tableWidgetMeasurements->setColumnHidden( 4, true );// in heights
|
ui->tableWidgetMeasurements->setColumnHidden( 4, true );// in heights
|
||||||
|
@ -69,17 +92,32 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
|
||||||
|
|
||||||
ui->tableWidgetMeasurements->setItemDelegateForColumn(2, doubleDelegate);// base value
|
ui->tableWidgetMeasurements->setItemDelegateForColumn(2, doubleDelegate);// base value
|
||||||
|
|
||||||
connect(ui->tableWidgetMeasurements, &QTableWidget::cellChanged, this, &DialogIncrements::MeasurementsChanged);
|
connect(ui->tableWidgetMeasurements, &QTableWidget::cellChanged, this, &DialogIncrements::MeasurementChanged);
|
||||||
|
|
||||||
|
ui->lineEditGivenName->setText(m->GivenName());
|
||||||
|
ui->lineEditFamilyName->setText(m->FamilyName());
|
||||||
|
|
||||||
|
ui->comboBoxSex->addItem(tr("male"),QVariant(m->GenderToStr(VIndividualMeasurements::Male)));
|
||||||
|
ui->comboBoxSex->addItem(tr("female"),QVariant(m->GenderToStr(VIndividualMeasurements::Female)));
|
||||||
|
qint32 index = ui->comboBoxSex->findData(m->GenderToStr(m->Sex()));
|
||||||
|
if (index != -1)
|
||||||
|
{
|
||||||
|
ui->comboBoxSex->setCurrentIndex(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->dateEditBirthDate->setDate(m->BirthDate());
|
||||||
|
ui->lineEditMail->setText(m->Mail());
|
||||||
|
|
||||||
|
connect(ui->lineEditGivenName, &QLineEdit::editingFinished, this, &DialogIncrements::SaveGivenName);
|
||||||
|
connect(ui->lineEditFamilyName, &QLineEdit::editingFinished, this, &DialogIncrements::SaveFamilyName);
|
||||||
|
connect(ui->lineEditMail, &QLineEdit::editingFinished, this, &DialogIncrements::SaveEmail);
|
||||||
|
connect(ui->comboBoxSex, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||||
|
&DialogIncrements::SaveSex);
|
||||||
|
connect(ui->dateEditBirthDate, &QDateEdit::dateChanged, this, &DialogIncrements::SaveBirthDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->toolBoxMeasurements->setCurrentIndex(1);
|
ui->toolBoxMeasurements->setCurrentIndex(1);
|
||||||
|
|
||||||
FillMeasurements();
|
|
||||||
FillIncrements();
|
|
||||||
FillLengthLines();
|
|
||||||
FillLengthSplines();
|
|
||||||
FillLengthArcs();
|
|
||||||
|
|
||||||
connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, &DialogIncrements::IncrementChanged);
|
connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, &DialogIncrements::IncrementChanged);
|
||||||
connect(ui->toolButtonAdd, &QPushButton::clicked, this, &DialogIncrements::clickedToolButtonAdd);
|
connect(ui->toolButtonAdd, &QPushButton::clicked, this, &DialogIncrements::clickedToolButtonAdd);
|
||||||
connect(ui->toolButtonRemove, &QPushButton::clicked, this, &DialogIncrements::clickedToolButtonRemove);
|
connect(ui->toolButtonRemove, &QPushButton::clicked, this, &DialogIncrements::clickedToolButtonRemove);
|
||||||
|
@ -90,22 +128,7 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
|
||||||
|
|
||||||
ui->tabWidget->setCurrentIndex(0);
|
ui->tabWidget->setCurrentIndex(0);
|
||||||
|
|
||||||
if (qApp->patternType() == Pattern::Individual)
|
connect(ui->toolButtonOpenMeasurements, &QToolButton::clicked, this, &DialogIncrements::OpenTable);
|
||||||
{
|
|
||||||
QString filePath = doc->MPath();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
VDomDocument::ValidateXML("://schema/individual_measurements.xsd", filePath);
|
|
||||||
m = new VIndividualMeasurements(data);
|
|
||||||
m->setContent(filePath);
|
|
||||||
}
|
|
||||||
catch(VException &e)
|
|
||||||
{
|
|
||||||
qWarning()<<"File error."<<e.ErrorMessage()<<e.DetailedInformation()<<Q_FUNC_INFO;
|
|
||||||
emit DialogClosed(QDialog::Rejected);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogIncrements::FillMeasurements()
|
void DialogIncrements::FillMeasurements()
|
||||||
|
@ -132,12 +155,20 @@ void DialogIncrements::FillMeasurements()
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
item->setFont(QFont("Times", 12, QFont::Bold));
|
item->setFont(QFont("Times", 12, QFont::Bold));
|
||||||
item->setToolTip(m.GetDescription());
|
item->setToolTip(m.GetDescription());
|
||||||
|
// set the item non-editable (view only), and non-selectable
|
||||||
|
Qt::ItemFlags flags = item->flags();
|
||||||
|
flags &= ~(Qt::ItemIsSelectable | Qt::ItemIsEditable); // reset/clear the flag
|
||||||
|
item->setFlags(flags);
|
||||||
ui->tableWidgetMeasurements->setItem(currentRow, 0, item);
|
ui->tableWidgetMeasurements->setItem(currentRow, 0, item);
|
||||||
|
|
||||||
if (qApp->patternType() == Pattern::Standard)
|
if (qApp->patternType() == Pattern::Standard)
|
||||||
{
|
{
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(QString().setNum(data->GetValueStandardTableRow(iMap.key())));
|
QTableWidgetItem *item = new QTableWidgetItem(QString().setNum(data->GetValueStandardTableRow(iMap.key())));
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
|
// set the item non-editable (view only), and non-selectable
|
||||||
|
Qt::ItemFlags flags = item->flags();
|
||||||
|
flags &= ~(Qt::ItemIsSelectable | Qt::ItemIsEditable); // reset/clear the flag
|
||||||
|
item->setFlags(flags);
|
||||||
ui->tableWidgetMeasurements->setItem(currentRow, 1, item);
|
ui->tableWidgetMeasurements->setItem(currentRow, 1, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,15 +180,27 @@ void DialogIncrements::FillMeasurements()
|
||||||
{
|
{
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(QString().setNum(m.GetKsize()));
|
QTableWidgetItem *item = new QTableWidgetItem(QString().setNum(m.GetKsize()));
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
|
// set the item non-editable (view only), and non-selectable
|
||||||
|
Qt::ItemFlags flags = item->flags();
|
||||||
|
flags &= ~(Qt::ItemIsSelectable | Qt::ItemIsEditable); // reset/clear the flag
|
||||||
|
item->setFlags(flags);
|
||||||
ui->tableWidgetMeasurements->setItem(currentRow, 3, item);
|
ui->tableWidgetMeasurements->setItem(currentRow, 3, item);
|
||||||
|
|
||||||
item = new QTableWidgetItem(QString().setNum(m.GetKheight()));
|
item = new QTableWidgetItem(QString().setNum(m.GetKheight()));
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
|
// set the item non-editable (view only), and non-selectable
|
||||||
|
flags = item->flags();
|
||||||
|
flags &= ~(Qt::ItemIsSelectable | Qt::ItemIsEditable); // reset/clear the flag
|
||||||
|
item->setFlags(flags);
|
||||||
ui->tableWidgetMeasurements->setItem(currentRow, 4, item);
|
ui->tableWidgetMeasurements->setItem(currentRow, 4, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
item = new QTableWidgetItem(m.GetNumber());
|
item = new QTableWidgetItem(m.GetNumber());
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
|
// set the item non-editable (view only), and non-selectable
|
||||||
|
flags = item->flags();
|
||||||
|
flags &= ~(Qt::ItemIsSelectable | Qt::ItemIsEditable); // reset/clear the flag
|
||||||
|
item->setFlags(flags);
|
||||||
ui->tableWidgetMeasurements->setItem(currentRow, 5, item);
|
ui->tableWidgetMeasurements->setItem(currentRow, 5, item);
|
||||||
}
|
}
|
||||||
ui->tableWidgetMeasurements->verticalHeader()->setDefaultSectionSize(20);
|
ui->tableWidgetMeasurements->verticalHeader()->setDefaultSectionSize(20);
|
||||||
|
@ -339,8 +382,10 @@ void DialogIncrements::FillLengthArcs()
|
||||||
|
|
||||||
void DialogIncrements::FullUpdateFromFile()
|
void DialogIncrements::FullUpdateFromFile()
|
||||||
{
|
{
|
||||||
|
disconnect(ui->tableWidgetMeasurements, &QTableWidget::cellChanged, this, &DialogIncrements::MeasurementChanged);
|
||||||
ui->tableWidgetMeasurements->clearContents();
|
ui->tableWidgetMeasurements->clearContents();
|
||||||
FillMeasurements();
|
FillMeasurements();
|
||||||
|
connect(ui->tableWidgetMeasurements, &QTableWidget::cellChanged, this, &DialogIncrements::MeasurementChanged);
|
||||||
|
|
||||||
disconnect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, &DialogIncrements::IncrementChanged);
|
disconnect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, &DialogIncrements::IncrementChanged);
|
||||||
ui->tableWidgetIncrement->clearContents();
|
ui->tableWidgetIncrement->clearContents();
|
||||||
|
@ -357,6 +402,139 @@ void DialogIncrements::FullUpdateFromFile()
|
||||||
FillLengthArcs();
|
FillLengthArcs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DialogIncrements::SaveGivenName()
|
||||||
|
{
|
||||||
|
m->setGivenName(ui->lineEditGivenName->text());
|
||||||
|
if (m->SaveDocument(doc->MPath()) == false)
|
||||||
|
{
|
||||||
|
qDebug()<<"Can't save GivenName";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogIncrements::SaveFamilyName()
|
||||||
|
{
|
||||||
|
|
||||||
|
m->setFamilyName(ui->lineEditFamilyName->text());
|
||||||
|
if (m->SaveDocument(doc->MPath()) == false)
|
||||||
|
{
|
||||||
|
qDebug()<<"Can't save FamilyName";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogIncrements::SaveEmail()
|
||||||
|
{
|
||||||
|
m->setMail(ui->lineEditMail->text());
|
||||||
|
if (m->SaveDocument(doc->MPath()) == false)
|
||||||
|
{
|
||||||
|
qDebug()<<"Can't save Email";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogIncrements::SaveSex(int index)
|
||||||
|
{
|
||||||
|
m->setSex(m->StrToGender(ui->comboBoxSex->itemData(index).toString()));
|
||||||
|
if (m->SaveDocument(doc->MPath()) == false)
|
||||||
|
{
|
||||||
|
qDebug()<<"Can't save Sex";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogIncrements::SaveBirthDate(const QDate & date)
|
||||||
|
{
|
||||||
|
m->setBirthDate(date);
|
||||||
|
if (m->SaveDocument(doc->MPath()) == false)
|
||||||
|
{
|
||||||
|
qDebug()<<"Can't save BirthDate";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogIncrements::OpenTable()
|
||||||
|
{
|
||||||
|
QString text = tr("Measurements use different units than pattern. This pattern required measurements in %1")
|
||||||
|
.arg(doc->UnitsToStr(qApp->patternUnit()));
|
||||||
|
if (qApp->patternType() == Pattern::Individual)
|
||||||
|
{
|
||||||
|
const QString filter(tr("Individual measurements (*.vit)"));
|
||||||
|
const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), QDir::homePath(), filter);
|
||||||
|
if (filePath.isEmpty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
VIndividualMeasurements *m1 = nullptr;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
VDomDocument::ValidateXML("://schema/individual_measurements.xsd", filePath);
|
||||||
|
|
||||||
|
m1 = new VIndividualMeasurements(data);
|
||||||
|
m1->setContent(filePath);
|
||||||
|
}
|
||||||
|
catch(VException &e)
|
||||||
|
{
|
||||||
|
e.CriticalMessageBox(tr("File error."), this);
|
||||||
|
delete m1;
|
||||||
|
emit DialogClosed(QDialog::Rejected);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Valentina::Units mUnit = m1->Unit();
|
||||||
|
if (qApp->patternUnit() != mUnit)
|
||||||
|
{
|
||||||
|
QMessageBox::critical(this, tr("Wrong units."), text);
|
||||||
|
delete m1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
delete m;
|
||||||
|
m = m1;
|
||||||
|
data->ClearMeasurements();
|
||||||
|
m->Measurements();
|
||||||
|
emit FullUpdateTree();
|
||||||
|
|
||||||
|
doc->SetPath(filePath);
|
||||||
|
emit haveLiteChange();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const QString filter(tr("Standard measurements (*.vst)"));
|
||||||
|
const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), QDir::homePath(), filter);
|
||||||
|
if (filePath.isEmpty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
VStandardMeasurements *m1 = nullptr;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
VDomDocument::ValidateXML("://schema/standard_measurements.xsd", filePath);
|
||||||
|
|
||||||
|
m1 = new VStandardMeasurements(data);
|
||||||
|
m1->setContent(filePath);
|
||||||
|
Valentina::Units mUnit = m1->Unit();
|
||||||
|
if (qApp->patternUnit() != mUnit)
|
||||||
|
{
|
||||||
|
QMessageBox::critical(this, tr("Wrong units."), text);
|
||||||
|
delete m1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m1->SetSize();
|
||||||
|
m1->SetHeight();
|
||||||
|
data->ClearMeasurements();
|
||||||
|
m1->Measurements();
|
||||||
|
delete m1;
|
||||||
|
emit FullUpdateTree();
|
||||||
|
|
||||||
|
doc->SetPath(filePath);
|
||||||
|
emit haveLiteChange();
|
||||||
|
}
|
||||||
|
catch(VException &e)
|
||||||
|
{
|
||||||
|
e.CriticalMessageBox(tr("File error."), this);
|
||||||
|
delete m1;
|
||||||
|
emit DialogClosed(QDialog::Rejected);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DialogIncrements::clickedToolButtonAdd()
|
void DialogIncrements::clickedToolButtonAdd()
|
||||||
{
|
{
|
||||||
ui->tableWidgetIncrement->setFocus(Qt::OtherFocusReason);
|
ui->tableWidgetIncrement->setFocus(Qt::OtherFocusReason);
|
||||||
|
@ -467,7 +645,7 @@ void DialogIncrements::IncrementChanged ( qint32 row, qint32 column )
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
if (domElement.isElement() == false)
|
if (domElement.isElement() == false)
|
||||||
{
|
{
|
||||||
qWarning()<<"Cant't find increment with id = "<<id<<Q_FUNC_INFO;
|
qDebug()<<"Cant't find increment with id = "<<id<<Q_FUNC_INFO;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this->row = row;
|
this->row = row;
|
||||||
|
@ -512,45 +690,50 @@ void DialogIncrements::IncrementChanged ( qint32 row, qint32 column )
|
||||||
emit haveLiteChange();
|
emit haveLiteChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogIncrements::MeasurementsChanged(qint32 row, qint32 column)
|
void DialogIncrements::MeasurementChanged(qint32 row, qint32 column)
|
||||||
{
|
{
|
||||||
|
switch (column)
|
||||||
|
{
|
||||||
|
case 2:// value column
|
||||||
|
{
|
||||||
const QTableWidgetItem *itemName = ui->tableWidgetMeasurements->item(row, 0);
|
const QTableWidgetItem *itemName = ui->tableWidgetMeasurements->item(row, 0);
|
||||||
QTableWidgetItem *item = ui->tableWidgetMeasurements->item(row, 2);
|
QTableWidgetItem *item = ui->tableWidgetMeasurements->item(row, 2);
|
||||||
|
|
||||||
VMeasurement measur = data->GetMeasurement(itemName->text());
|
VMeasurement measur = data->GetMeasurement(itemName->text());
|
||||||
const QString tag = measur.TagName();
|
const QString tag = measur.TagName();
|
||||||
VIndividualMeasurements m(data);
|
QDomNodeList list = m->elementsByTagName(tag);
|
||||||
QDomNodeList list = m.elementsByTagName(tag);
|
|
||||||
QDomElement domElement = list.at(0).toElement();
|
QDomElement domElement = list.at(0).toElement();
|
||||||
if (domElement.isElement() == false)
|
if (domElement.isElement() == false)
|
||||||
{
|
{
|
||||||
qWarning()<<"Cant't find measurement "<<tag<<Q_FUNC_INFO;
|
qDebug()<<"Cant't find measurement "<<tag<<Q_FUNC_INFO;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
switch (column)
|
|
||||||
|
m->SetAttribute(domElement, VIndividualMeasurements::AttrValue, item->text());
|
||||||
|
if (m->SaveDocument(doc->MPath()) == false)
|
||||||
{
|
{
|
||||||
case 2:
|
qDebug()<<"Can't save measurement";
|
||||||
{
|
}
|
||||||
m.SetAttribute(domElement, VIndividualMeasurements::AttrValue, item->text());
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
const qreal base = item->text().replace(",", ".").toDouble(&ok);
|
const qreal base = item->text().replace(",", ".").toDouble(&ok);
|
||||||
if (ok == false)
|
if (ok == false)
|
||||||
{
|
{
|
||||||
measur.setBase(0);
|
measur.setBase(0);
|
||||||
item->setText("0");
|
item->setText("0");
|
||||||
qWarning()<<"Can't convert toDouble measurement value"<<Q_FUNC_INFO;
|
qDebug()<<"Can't convert toDouble measurement value"<<Q_FUNC_INFO;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
measur.setBase(base);
|
measur.setBase(base);
|
||||||
}
|
}
|
||||||
data->UpdateMeasurement(itemName->text(), measur);
|
data->ClearMeasurements();
|
||||||
|
m->Measurements();
|
||||||
|
emit FullUpdateTree();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
emit haveLiteChange();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogIncrements::closeEvent(QCloseEvent *event)
|
void DialogIncrements::closeEvent(QCloseEvent *event)
|
||||||
|
@ -562,4 +745,5 @@ void DialogIncrements::closeEvent(QCloseEvent *event)
|
||||||
DialogIncrements::~DialogIncrements()
|
DialogIncrements::~DialogIncrements()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
|
delete m;
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,11 +68,17 @@ public slots:
|
||||||
* @param column number of column
|
* @param column number of column
|
||||||
*/
|
*/
|
||||||
void IncrementChanged ( qint32 row, qint32 column );
|
void IncrementChanged ( qint32 row, qint32 column );
|
||||||
void MeasurementsChanged ( qint32 row, qint32 column );
|
void MeasurementChanged ( qint32 row, qint32 column );
|
||||||
/**
|
/**
|
||||||
* @brief FullUpdateFromFile update information in tables form file
|
* @brief FullUpdateFromFile update information in tables form file
|
||||||
*/
|
*/
|
||||||
void FullUpdateFromFile();
|
void FullUpdateFromFile();
|
||||||
|
void SaveGivenName();
|
||||||
|
void SaveFamilyName();
|
||||||
|
void SaveEmail();
|
||||||
|
void SaveSex(int index);
|
||||||
|
void SaveBirthDate(const QDate & date);
|
||||||
|
void OpenTable();
|
||||||
signals:
|
signals:
|
||||||
/**
|
/**
|
||||||
* @brief FullUpdateTree signal update data for dom document
|
* @brief FullUpdateTree signal update data for dom document
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
<enum>QTabWidget::North</enum>
|
<enum>QTabWidget::North</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tabStandard">
|
<widget class="QWidget" name="tabStandard">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -71,7 +71,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item alignment="Qt::AlignTop">
|
<item alignment="Qt::AlignTop">
|
||||||
<widget class="QToolButton" name="toolButtonAnotherTable">
|
<widget class="QToolButton" name="toolButtonOpenMeasurements">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
@ -107,7 +107,10 @@
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>1</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="page">
|
<widget class="QWidget" name="pagePersonalInformation">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
|
@ -119,34 +122,8 @@
|
||||||
<attribute name="label">
|
<attribute name="label">
|
||||||
<string>Personal information</string>
|
<string>Personal information</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<item>
|
<item row="0" column="0" colspan="2">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<property name="sizeConstraint">
|
|
||||||
<enum>QLayout::SetDefaultConstraint</enum>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="labelFamilyName">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Family name</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="lineEditFamilyName"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="labelGivenName">
|
<widget class="QLabel" name="labelGivenName">
|
||||||
|
@ -172,7 +149,33 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="sizeConstraint">
|
||||||
|
<enum>QLayout::SetDefaultConstraint</enum>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
|
<widget class="QLabel" name="labelFamilyName">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Family name</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEditFamilyName"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="labelBirthDate">
|
<widget class="QLabel" name="labelBirthDate">
|
||||||
|
@ -194,11 +197,15 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="lineEditBirthDate"/>
|
<widget class="QDateEdit" name="dateEditBirthDate">
|
||||||
|
<property name="displayFormat">
|
||||||
|
<string>yyyy-MM-dd</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="1" column="1">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="labelSex">
|
<widget class="QLabel" name="labelSex">
|
||||||
|
@ -220,11 +227,18 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="lineEditSex"/>
|
<widget class="QComboBox" name="comboBoxSex">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="1" column="2">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="labelMail">
|
<widget class="QLabel" name="labelMail">
|
||||||
|
@ -251,14 +265,8 @@
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
<zorder></zorder>
|
|
||||||
<zorder></zorder>
|
|
||||||
<zorder></zorder>
|
|
||||||
<zorder></zorder>
|
|
||||||
<zorder>layoutWidget</zorder>
|
|
||||||
<zorder>label_5</zorder>
|
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="page_2">
|
<widget class="QWidget" name="pageMeasurements">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
|
@ -277,7 +285,7 @@
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="editTriggers">
|
<property name="editTriggers">
|
||||||
<set>QAbstractItemView::NoEditTriggers</set>
|
<set>QAbstractItemView::AnyKeyPressed|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed</set>
|
||||||
</property>
|
</property>
|
||||||
<property name="alternatingRowColors">
|
<property name="alternatingRowColors">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
|
|
@ -108,17 +108,17 @@ void DialogIndividualMeasurements::DialogAccepted()
|
||||||
QFile iMeasur(_tablePath);
|
QFile iMeasur(_tablePath);
|
||||||
if (iMeasur.open(QIODevice::WriteOnly| QIODevice::Truncate))
|
if (iMeasur.open(QIODevice::WriteOnly| QIODevice::Truncate))
|
||||||
{
|
{
|
||||||
const int Indent = 4;
|
const int indent = 4;
|
||||||
QTextStream out(&iMeasur);
|
QTextStream out(&iMeasur);
|
||||||
out.setCodec("UTF-8");
|
out.setCodec("UTF-8");
|
||||||
m.save(out, Indent);
|
m.save(out, indent);
|
||||||
iMeasur.close();
|
iMeasur.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(VException &e)
|
catch(VException &e)
|
||||||
{
|
{
|
||||||
e.CriticalMessageBox(tr("File error."), this);
|
e.CriticalMessageBox(tr("File error."), this);
|
||||||
qWarning()<<"File error."<<e.ErrorMessage()<<e.DetailedInformation()<<Q_FUNC_INFO;
|
qDebug()<<"File error."<<e.ErrorMessage()<<e.DetailedInformation()<<Q_FUNC_INFO;
|
||||||
DialogRejected();
|
DialogRejected();
|
||||||
}
|
}
|
||||||
accept();
|
accept();
|
||||||
|
@ -215,7 +215,7 @@ void DialogIndividualMeasurements::LoadIndividualTables()
|
||||||
}
|
}
|
||||||
catch(VException &e)
|
catch(VException &e)
|
||||||
{
|
{
|
||||||
qWarning()<<"File error."<<e.ErrorMessage()<<e.DetailedInformation()<<Q_FUNC_INFO;
|
qDebug()<<"File error."<<e.ErrorMessage()<<e.DetailedInformation()<<Q_FUNC_INFO;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -239,6 +239,11 @@ void DialogIndividualMeasurements::OpenTable()
|
||||||
{
|
{
|
||||||
const QString filter(tr("Individual measurements (*.vit)"));
|
const QString filter(tr("Individual measurements (*.vit)"));
|
||||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Open file"), QDir::homePath(), filter);
|
QString fileName = QFileDialog::getOpenFileName(this, tr("Open file"), QDir::homePath(), filter);
|
||||||
|
if (fileName.isEmpty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
VDomDocument::ValidateXML("://schema/individual_measurements.xsd", fileName);
|
VDomDocument::ValidateXML("://schema/individual_measurements.xsd", fileName);
|
||||||
|
|
|
@ -40,24 +40,24 @@ namespace Ui
|
||||||
class DialogIndividualMeasurements : public QDialog
|
class DialogIndividualMeasurements : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DialogIndividualMeasurements(VContainer *data, const QString &patternPieceName, QWidget *parent = nullptr);
|
DialogIndividualMeasurements(VContainer *data, const QString &patternPieceName, QWidget *parent = nullptr);
|
||||||
~DialogIndividualMeasurements();
|
~DialogIndividualMeasurements();
|
||||||
QString name() const;
|
QString name() const;
|
||||||
QString tablePath() const;
|
QString tablePath() const;
|
||||||
|
public slots:
|
||||||
|
void OpenTable();
|
||||||
|
void NewTable();
|
||||||
|
void CheckState();
|
||||||
|
void DialogAccepted();
|
||||||
|
void DialogRejected();
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(DialogIndividualMeasurements)
|
Q_DISABLE_COPY(DialogIndividualMeasurements)
|
||||||
Ui::DialogIndividualMeasurements *ui;
|
Ui::DialogIndividualMeasurements *ui;
|
||||||
QString _name;
|
QString _name;
|
||||||
QString _tablePath;
|
QString _tablePath;
|
||||||
VContainer *data;
|
VContainer *data;
|
||||||
void DialogAccepted();
|
|
||||||
void DialogRejected();
|
|
||||||
void CheckState();
|
|
||||||
void LoadIndividualTables();
|
void LoadIndividualTables();
|
||||||
void OpenTable();
|
|
||||||
void NewTable();
|
|
||||||
void InitUnits();
|
void InitUnits();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ void DialogStandardMeasurements::DialogAccepted()
|
||||||
catch(VException &e)
|
catch(VException &e)
|
||||||
{
|
{
|
||||||
e.CriticalMessageBox(tr("File error."), this);
|
e.CriticalMessageBox(tr("File error."), this);
|
||||||
qWarning()<<"File error."<<e.ErrorMessage()<<e.DetailedInformation()<<Q_FUNC_INFO;
|
qDebug()<<"File error."<<e.ErrorMessage()<<e.DetailedInformation()<<Q_FUNC_INFO;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ void DialogStandardMeasurements::LoadStandardTables()
|
||||||
}
|
}
|
||||||
catch(VException &e)
|
catch(VException &e)
|
||||||
{
|
{
|
||||||
qWarning()<<"File error."<<e.ErrorMessage()<<e.DetailedInformation()<<Q_FUNC_INFO;
|
qDebug()<<"File error."<<e.ErrorMessage()<<e.DetailedInformation()<<Q_FUNC_INFO;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,15 +45,16 @@ public:
|
||||||
~DialogStandardMeasurements();
|
~DialogStandardMeasurements();
|
||||||
QString name() const;
|
QString name() const;
|
||||||
QString tablePath() const;
|
QString tablePath() const;
|
||||||
|
public slots:
|
||||||
|
void DialogAccepted();
|
||||||
|
void DialogRejected();
|
||||||
|
void CheckState();
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(DialogStandardMeasurements)
|
Q_DISABLE_COPY(DialogStandardMeasurements)
|
||||||
Ui::DialogStandardMeasurements *ui;
|
Ui::DialogStandardMeasurements *ui;
|
||||||
VContainer *data;
|
VContainer *data;
|
||||||
QString _name;
|
QString _name;
|
||||||
QString _tablePath;
|
QString _tablePath;
|
||||||
void DialogAccepted();
|
|
||||||
void DialogRejected();
|
|
||||||
void CheckState();
|
|
||||||
void LoadStandardTables();
|
void LoadStandardTables();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ void DialogDetail::ChoosedObject(quint32 id, const Valentina::Scenes &type)
|
||||||
NewItem(id, Valentina::NodeSplinePath, NodeDetail::Contour);
|
NewItem(id, Valentina::NodeSplinePath, NodeDetail::Contour);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qWarning()<<tr("Got wrong scene object. Ignore.");
|
qDebug()<<tr("Got wrong scene object. Ignore.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ui.toolButtonDelete->setEnabled(true);
|
ui.toolButtonDelete->setEnabled(true);
|
||||||
|
@ -136,7 +136,7 @@ void DialogDetail::NewItem(quint32 id, const Valentina::Tools &typeTool, const N
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
qWarning()<<"Got wrong tools. Ignore.";
|
qDebug()<<"Got wrong tools. Ignore.";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -258,7 +258,7 @@ void DialogTool::ChangeCurrentText(QComboBox *box, const QString &value)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qWarning()<<"Can't find object by name"<<value;
|
qDebug()<<"Can't find object by name"<<value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ QPainterPath VArc::GetPath() const
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qWarning()<<"points.count() < 2"<<Q_FUNC_INFO;
|
qDebug()<<"points.count() < 2"<<Q_FUNC_INFO;
|
||||||
}
|
}
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,7 +115,7 @@ bool VDetail::OnEdge(const quint32 &p1, const quint32 &p2) const
|
||||||
QVector<VNodeDetail> list = listNodePoint();
|
QVector<VNodeDetail> list = listNodePoint();
|
||||||
if (list.size() < 3)
|
if (list.size() < 3)
|
||||||
{
|
{
|
||||||
qWarning()<<"Not enough points.";
|
qDebug()<<"Not enough points.";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ptrdiff_t i = indexOfNode(list, p1);
|
ptrdiff_t i = indexOfNode(list, p1);
|
||||||
|
@ -151,7 +151,7 @@ ptrdiff_t VDetail::Edge(const quint32 &p1, const quint32 &p2) const
|
||||||
{
|
{
|
||||||
if (OnEdge(p1, p2) == false)
|
if (OnEdge(p1, p2) == false)
|
||||||
{
|
{
|
||||||
qWarning()<<"Points don't on edge.";
|
qDebug()<<"Points don't on edge.";
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ void VDetail::NodeOnEdge(const quint32 &index, VNodeDetail &p1, VNodeDetail &p2)
|
||||||
QVector<VNodeDetail> list = listNodePoint();
|
QVector<VNodeDetail> list = listNodePoint();
|
||||||
if (index > static_cast<quint32>(list.size()))
|
if (index > static_cast<quint32>(list.size()))
|
||||||
{
|
{
|
||||||
qWarning()<<"Wrong edge index index ="<<index;
|
qDebug()<<"Wrong edge index index ="<<index;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
p1 = list.at(index);
|
p1 = list.at(index);
|
||||||
|
@ -277,6 +277,6 @@ ptrdiff_t VDetail::indexOfNode(const QVector<VNodeDetail> &list, const quint32 &
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
qWarning()<<"Can't find node.";
|
qDebug()<<"Can't find node.";
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,7 +125,7 @@ QPainterPath VEquidistant::ContourPath(const quint32 &idDetail, const VContainer
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qWarning()<<"Get wrong tool type. Ignore."<<detail.at(i).getTypeTool();
|
qDebug()<<"Get wrong tool type. Ignore."<<detail.at(i).getTypeTool();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -189,7 +189,7 @@ QVector<QPointF> VEquidistant::CorrectEquidistantPoints(const QVector<QPointF> &
|
||||||
QVector<QPointF> correctPoints;
|
QVector<QPointF> correctPoints;
|
||||||
if (points.size()<4)//Better don't check if only three points. We can destroy equidistant.
|
if (points.size()<4)//Better don't check if only three points. We can destroy equidistant.
|
||||||
{
|
{
|
||||||
qWarning()<<"Only three points.";
|
qDebug()<<"Only three points.";
|
||||||
return points;
|
return points;
|
||||||
}
|
}
|
||||||
//Clear equivalent points
|
//Clear equivalent points
|
||||||
|
@ -371,7 +371,7 @@ QVector<QPointF> VEquidistant::EkvPoint(const QLineF &line1, const QLineF &line2
|
||||||
QVector<QPointF> points;
|
QVector<QPointF> points;
|
||||||
if (line1.p2() != line2.p2())
|
if (line1.p2() != line2.p2())
|
||||||
{
|
{
|
||||||
qWarning()<<"Last point of two lines must be equal.";
|
qDebug()<<"Last point of two lines must be equal.";
|
||||||
}
|
}
|
||||||
QPointF CrosPoint;
|
QPointF CrosPoint;
|
||||||
QLineF bigLine1 = ParallelLine(line1, width );
|
QLineF bigLine1 = ParallelLine(line1, width );
|
||||||
|
|
|
@ -134,7 +134,7 @@ qreal VSpline::LengthT(qreal t) const
|
||||||
{
|
{
|
||||||
if (t < 0 || t > 1)
|
if (t < 0 || t > 1)
|
||||||
{
|
{
|
||||||
qWarning()<<"Wrong value t.";
|
qDebug()<<"Wrong value t.";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
QLineF seg1_2 ( GetP1 ().toQPointF(), GetP2 () );
|
QLineF seg1_2 ( GetP1 ().toQPointF(), GetP2 () );
|
||||||
|
@ -564,7 +564,7 @@ QPainterPath VSpline::GetPath() const
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qWarning()<<"points.count() < 2"<<Q_FUNC_INFO;
|
qDebug()<<"points.count() < 2"<<Q_FUNC_INFO;
|
||||||
}
|
}
|
||||||
return splinePath;
|
return splinePath;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ VSplinePoint::VSplinePoint(VPointF pSpline, qreal kAsm1, qreal angle1, qreal kAs
|
||||||
{
|
{
|
||||||
if (qFuzzyCompare(qAbs(angle1-angle2), 180) == false)
|
if (qFuzzyCompare(qAbs(angle1-angle2), 180) == false)
|
||||||
{
|
{
|
||||||
qWarning()<<"angle1 and angle2 are not equal.";
|
qDebug()<<"angle1 and angle2 are not equal.";
|
||||||
}
|
}
|
||||||
SetAngle2(angle2);
|
SetAngle2(angle2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,6 +108,11 @@ void MainWindow::ActionNewDraw()
|
||||||
{
|
{
|
||||||
patternPieceName = stMeasurements.name();
|
patternPieceName = stMeasurements.name();
|
||||||
path = stMeasurements.tablePath();
|
path = stMeasurements.tablePath();
|
||||||
|
VStandardMeasurements m(pattern);
|
||||||
|
m.setContent(path);
|
||||||
|
m.SetSize();
|
||||||
|
m.SetHeight();
|
||||||
|
m.Measurements();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -122,6 +127,9 @@ void MainWindow::ActionNewDraw()
|
||||||
{
|
{
|
||||||
patternPieceName = indMeasurements.name();
|
patternPieceName = indMeasurements.name();
|
||||||
path = indMeasurements.tablePath();
|
path = indMeasurements.tablePath();
|
||||||
|
VIndividualMeasurements m(pattern);
|
||||||
|
m.setContent(path);
|
||||||
|
m.Measurements();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -140,7 +148,7 @@ void MainWindow::ActionNewDraw()
|
||||||
}
|
}
|
||||||
if (doc->appendDraw(patternPieceName) == false)
|
if (doc->appendDraw(patternPieceName) == false)
|
||||||
{
|
{
|
||||||
qWarning()<<"Error creating pattern with the name "<<patternPieceName<<".";
|
qDebug()<<"Error creating pattern with the name "<<patternPieceName<<".";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
disconnect(comboBoxDraws, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
disconnect(comboBoxDraws, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||||
|
@ -742,7 +750,7 @@ void MainWindow::CancelTool()
|
||||||
currentScene->clearSelection();
|
currentScene->clearSelection();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qWarning()<<"Got wrong tool type. Ignored.";
|
qDebug()<<"Got wrong tool type. Ignored.";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1111,62 +1119,10 @@ void MainWindow::MinimumScrollBar()
|
||||||
|
|
||||||
bool MainWindow::SavePattern(const QString &fileName)
|
bool MainWindow::SavePattern(const QString &fileName)
|
||||||
{
|
{
|
||||||
try
|
|
||||||
{
|
|
||||||
doc->TestUniqueId();
|
|
||||||
}
|
|
||||||
catch (const VExceptionWrongId &e)
|
|
||||||
{
|
|
||||||
e.CriticalMessageBox(tr("Error no unique id."), this);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (fileName.isEmpty())
|
|
||||||
{
|
|
||||||
qWarning()<<"Got empty file name.";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
//Writing in temporary file
|
|
||||||
QFileInfo tempInfo(fileName);
|
QFileInfo tempInfo(fileName);
|
||||||
QString temp = tempInfo.absolutePath() + "/" + tempInfo.baseName() + ".tmp";
|
const bool result = doc->SaveDocument(fileName);
|
||||||
QFile tempFile(temp);
|
|
||||||
if (tempFile.open(QIODevice::WriteOnly| QIODevice::Truncate))
|
|
||||||
{
|
|
||||||
const int Indent = 4;
|
|
||||||
QTextStream out(&tempFile);
|
|
||||||
out.setCodec("UTF-8");
|
|
||||||
doc->save(out, Indent);
|
|
||||||
tempFile.close();
|
|
||||||
}
|
|
||||||
//Replace temp file our
|
|
||||||
bool result = false;
|
|
||||||
QFile patternFile(fileName);
|
|
||||||
// We need here temporary file because we need restore pattern after error of copying temp file.
|
|
||||||
QTemporaryFile tempOfPattern;
|
|
||||||
if (tempOfPattern.open())
|
|
||||||
{
|
|
||||||
patternFile.copy(tempOfPattern.fileName());
|
|
||||||
}
|
|
||||||
if ( patternFile.exists() == false || patternFile.remove() )
|
|
||||||
{
|
|
||||||
if ( tempFile.copy(patternFile.fileName()) == false )
|
|
||||||
{
|
|
||||||
qWarning()<<"Could not copy temp file to pattern file"<<Q_FUNC_INFO;
|
|
||||||
tempOfPattern.copy(fileName);
|
|
||||||
result = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
result = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
qWarning()<<"Could not remove pattern file"<<Q_FUNC_INFO;
|
|
||||||
result = false;
|
|
||||||
}
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
tempFile.remove();
|
|
||||||
if (tempInfo.suffix() != "autosave")
|
if (tempInfo.suffix() != "autosave")
|
||||||
{
|
{
|
||||||
setCurrentFile(fileName);
|
setCurrentFile(fileName);
|
||||||
|
@ -1183,7 +1139,7 @@ void MainWindow::AutoSavePattern()
|
||||||
QString autofile = curFile +".autosave";
|
QString autofile = curFile +".autosave";
|
||||||
if (SavePattern(autofile) == false)
|
if (SavePattern(autofile) == false)
|
||||||
{
|
{
|
||||||
qWarning()<<"Can not save pattern"<<Q_FUNC_INFO;
|
qDebug()<<"Can not save pattern"<<Q_FUNC_INFO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -240,7 +240,7 @@ void TableWindow::saveScene()
|
||||||
PsFile(name);
|
PsFile(name);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qWarning() << "Bad file suffix"<<Q_FUNC_INFO;
|
qDebug() << "Bad file suffix"<<Q_FUNC_INFO;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
paper->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthMainLine())));
|
paper->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthMainLine())));
|
||||||
|
|
|
@ -70,7 +70,7 @@ QPointF VToolShoulderPoint::FindPoint(const QPointF &p1Line, const QPointF &p2Li
|
||||||
qreal dist = line.length();
|
qreal dist = line.length();
|
||||||
if (dist>toolLength)
|
if (dist>toolLength)
|
||||||
{
|
{
|
||||||
qWarning()<<"Correction of length in shoulder point tool. Parameter length too small.";
|
qDebug()<<"Correction of length in shoulder point tool. Parameter length too small.";
|
||||||
toolLength = dist;
|
toolLength = dist;
|
||||||
}
|
}
|
||||||
if (qFuzzyCompare(dist, toolLength))
|
if (qFuzzyCompare(dist, toolLength))
|
||||||
|
|
|
@ -37,6 +37,7 @@ VToolSinglePoint::VToolSinglePoint (VPattern *doc, VContainer *data, quint32 id,
|
||||||
{
|
{
|
||||||
baseColor = Qt::red;
|
baseColor = Qt::red;
|
||||||
currentColor = baseColor;
|
currentColor = baseColor;
|
||||||
|
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor));
|
||||||
ignoreFullUpdate = true;
|
ignoreFullUpdate = true;
|
||||||
this->setFlag(QGraphicsItem::ItemIsMovable, true);
|
this->setFlag(QGraphicsItem::ItemIsMovable, true);
|
||||||
this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
||||||
|
|
|
@ -231,7 +231,7 @@ void VToolSplinePath::RefreshDataInFile()
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
if (domElement.isElement() == false)
|
if (domElement.isElement() == false)
|
||||||
{
|
{
|
||||||
qWarning()<<"Can't find element with id="<<id<<"in pattern file";
|
qDebug()<<"Can't find element with id="<<id<<"in pattern file";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
VSplinePath splPath = *VAbstractTool::data.GeometricObject<const VSplinePath *>(id);
|
VSplinePath splPath = *VAbstractTool::data.GeometricObject<const VSplinePath *>(id);
|
||||||
|
|
|
@ -152,7 +152,7 @@ QPointF VToolTriangle::FindPoint(const QPointF &axisP1, const QPointF &axisP2, c
|
||||||
if (c*c < a*a + b*b)
|
if (c*c < a*a + b*b)
|
||||||
{
|
{
|
||||||
//Still don't know why this code handled. Need to think about that.
|
//Still don't know why this code handled. Need to think about that.
|
||||||
qWarning()<<"Can't find point."<<Q_FUNC_INFO;
|
qDebug()<<"Can't find point."<<Q_FUNC_INFO;
|
||||||
return line.p2();
|
return line.p2();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,17 +58,17 @@ void VAbstractNode::DeleteNode()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qWarning()<<"parent isn't element"<<Q_FUNC_INFO;
|
qDebug()<<"parent isn't element"<<Q_FUNC_INFO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qWarning()<<"parent isNull"<<Q_FUNC_INFO;
|
qDebug()<<"parent isNull"<<Q_FUNC_INFO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qWarning()<<"Can't get element by id form file = "<<id<<Q_FUNC_INFO;
|
qDebug()<<"Can't get element by id form file = "<<id<<Q_FUNC_INFO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -241,17 +241,17 @@ void VAbstractTool::DeleteTool(QGraphicsItem *tool)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qWarning()<<"parent isn't element"<<Q_FUNC_INFO;
|
qDebug()<<"parent isn't element"<<Q_FUNC_INFO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qWarning()<<"parent isNull"<<Q_FUNC_INFO;
|
qDebug()<<"parent isNull"<<Q_FUNC_INFO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qWarning()<<"Can't get element by id form file = "<<id<<Q_FUNC_INFO;
|
qDebug()<<"Can't get element by id form file = "<<id<<Q_FUNC_INFO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ VToolDetail::VToolDetail(VPattern *doc, VContainer *data, const quint32 &id, con
|
||||||
InitTool<VNodeSplinePath>(scene, detail[i]);
|
InitTool<VNodeSplinePath>(scene, detail[i]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qWarning()<<"Get wrong tool type. Ignore.";
|
qDebug()<<"Get wrong tool type. Ignore.";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
doc->IncrementReferens(detail[i].getId());
|
doc->IncrementReferens(detail[i].getId());
|
||||||
|
@ -137,7 +137,7 @@ void VToolDetail::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qWarning()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
|
qDebug()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
VNodeDetail node(id, detail[i].getTypeTool(), NodeDetail::Contour);
|
VNodeDetail node(id, detail[i].getTypeTool(), NodeDetail::Contour);
|
||||||
|
@ -395,7 +395,7 @@ void VToolDetail::AddNode(QDomElement &domElement, const VNodeDetail &node)
|
||||||
doc->SetAttribute(nod, AttrType, NodeSplinePath);
|
doc->SetAttribute(nod, AttrType, NodeSplinePath);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qWarning()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
|
qDebug()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
domElement.appendChild(nod);
|
domElement.appendChild(nod);
|
||||||
|
|
|
@ -216,7 +216,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qWarning()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
|
qDebug()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
newDetail.append(VNodeDetail(id, det.at(i).getTypeTool(), NodeDetail::Contour));
|
newDetail.append(VNodeDetail(id, det.at(i).getTypeTool(), NodeDetail::Contour));
|
||||||
|
@ -364,7 +364,7 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qWarning()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
|
qDebug()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -682,7 +682,7 @@ void VToolUnionDetails::AddNode(QDomElement &domElement, const VNodeDetail &node
|
||||||
doc->SetAttribute(nod, AttrType, QStringLiteral("NodeSplinePath"));
|
doc->SetAttribute(nod, AttrType, QStringLiteral("NodeSplinePath"));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qWarning()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
|
qDebug()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
domElement.appendChild(nod);
|
domElement.appendChild(nod);
|
||||||
|
|
|
@ -30,7 +30,8 @@
|
||||||
|
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
|
||||||
TextDelegate::TextDelegate(QObject *parent): QItemDelegate(parent), lastText(QString("Name_"))
|
TextDelegate::TextDelegate(const QString ®ex, QObject *parent): QItemDelegate(parent), lastText(QString("Name_")),
|
||||||
|
regex(regex)
|
||||||
{
|
{
|
||||||
//Little hack. Help save lineedit text in const method.
|
//Little hack. Help save lineedit text in const method.
|
||||||
connect(this, &TextDelegate::SaveText, this, &TextDelegate::InitText);
|
connect(this, &TextDelegate::SaveText, this, &TextDelegate::InitText);
|
||||||
|
@ -42,7 +43,7 @@ QWidget *TextDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem
|
||||||
Q_UNUSED(index);
|
Q_UNUSED(index);
|
||||||
QLineEdit *editor = new QLineEdit(parent);
|
QLineEdit *editor = new QLineEdit(parent);
|
||||||
//Same regex pattern in xsd file
|
//Same regex pattern in xsd file
|
||||||
editor->setValidator( new QRegExpValidator(QRegExp("([\\p{L}]|[^0-9])[_\\p{L}0-9]*")) );
|
editor->setValidator( new QRegExpValidator(QRegExp(regex)) );
|
||||||
connect(editor, &QLineEdit::editingFinished, this, &TextDelegate::commitAndCloseEditor);
|
connect(editor, &QLineEdit::editingFinished, this, &TextDelegate::commitAndCloseEditor);
|
||||||
return editor;
|
return editor;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ public:
|
||||||
* @brief TextDelegate constructor.
|
* @brief TextDelegate constructor.
|
||||||
* @param parent parent widget.
|
* @param parent parent widget.
|
||||||
*/
|
*/
|
||||||
explicit TextDelegate(QObject *parent = nullptr);
|
TextDelegate(const QString ®ex, QObject *parent = nullptr);
|
||||||
/**
|
/**
|
||||||
* @brief createEditorReturns the widget used to edit the item specified by index for editing. The parent widget and
|
* @brief createEditorReturns the widget used to edit the item specified by index for editing. The parent widget and
|
||||||
* style option are used to control how the editor widget appears.
|
* style option are used to control how the editor widget appears.
|
||||||
|
@ -96,6 +96,7 @@ private:
|
||||||
* @brief lastValue last saved value.
|
* @brief lastValue last saved value.
|
||||||
*/
|
*/
|
||||||
QString lastText;
|
QString lastText;
|
||||||
|
QString regex;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TEXTDELEGATE_H
|
#endif // TEXTDELEGATE_H
|
||||||
|
|
|
@ -362,3 +362,81 @@ QString VDomDocument::UnitsToStr(const Valentina::Units &unit)
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool VDomDocument::SaveDocument(const QString &fileName)
|
||||||
|
{
|
||||||
|
if (fileName.isEmpty())
|
||||||
|
{
|
||||||
|
qDebug()<<"Got empty file name.";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//Writing in temporary file
|
||||||
|
QFileInfo tempInfo(fileName);
|
||||||
|
QString temp = tempInfo.absolutePath() + "/" + tempInfo.baseName() + ".tmp";
|
||||||
|
QFile tempFile(temp);
|
||||||
|
if (tempFile.open(QIODevice::WriteOnly| QIODevice::Truncate))
|
||||||
|
{
|
||||||
|
const int indent = 4;
|
||||||
|
QTextStream out(&tempFile);
|
||||||
|
out.setCodec("UTF-8");
|
||||||
|
save(out, indent);
|
||||||
|
tempFile.close();
|
||||||
|
}
|
||||||
|
//Replace temp file our
|
||||||
|
bool result = false;
|
||||||
|
QFile patternFile(fileName);
|
||||||
|
// We need here temporary file because we need restore document after error of copying temp file.
|
||||||
|
QTemporaryFile tempOfPattern;
|
||||||
|
if (tempOfPattern.open())
|
||||||
|
{
|
||||||
|
patternFile.copy(tempOfPattern.fileName());
|
||||||
|
}
|
||||||
|
if ( patternFile.exists() == false || patternFile.remove() )
|
||||||
|
{
|
||||||
|
if ( tempFile.copy(patternFile.fileName()) == false )
|
||||||
|
{
|
||||||
|
qDebug()<<"Could not copy temp file to document file"<<Q_FUNC_INFO;
|
||||||
|
tempOfPattern.copy(fileName);
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tempFile.remove();
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qDebug()<<"Could not remove document file"<<Q_FUNC_INFO;
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void VDomDocument::setTagText(const QString &tag, const QString &text)
|
||||||
|
{
|
||||||
|
const QDomNodeList nodeList = this->elementsByTagName(tag);
|
||||||
|
if (nodeList.isEmpty())
|
||||||
|
{
|
||||||
|
qDebug()<<"Can't save tag "<<tag<<Q_FUNC_INFO;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const QDomNode domNode = nodeList.at(0);
|
||||||
|
if (domNode.isNull() == false && domNode.isElement())
|
||||||
|
{
|
||||||
|
const QDomElement domElement = domNode.toElement();
|
||||||
|
if (domElement.isNull() == false)
|
||||||
|
{
|
||||||
|
QDomElement parent = domElement.parentNode().toElement();
|
||||||
|
QDomElement newTag = createElement(tag);
|
||||||
|
const QDomText newTagText = createTextNode(text);
|
||||||
|
newTag.appendChild(newTagText);
|
||||||
|
|
||||||
|
parent.replaceChild(newTag, domElement);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -123,11 +123,13 @@ public:
|
||||||
void setContent(const QString &fileName);
|
void setContent(const QString &fileName);
|
||||||
static Valentina::Units StrToUnits(const QString &unit);
|
static Valentina::Units StrToUnits(const QString &unit);
|
||||||
static QString UnitsToStr(const Valentina::Units &unit);
|
static QString UnitsToStr(const Valentina::Units &unit);
|
||||||
|
virtual bool SaveDocument(const QString &fileName);
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* @brief data container with data.
|
* @brief data container with data.
|
||||||
*/
|
*/
|
||||||
VContainer *data;
|
VContainer *data;
|
||||||
|
void setTagText(const QString &tag, const QString &text);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VDomDocument)
|
Q_DISABLE_COPY(VDomDocument)
|
||||||
|
|
|
@ -41,6 +41,10 @@ const QString VIndividualMeasurements::TagGiven_name = QStringLiteral("given-na
|
||||||
const QString VIndividualMeasurements::TagBirth_date = QStringLiteral("birth-date");
|
const QString VIndividualMeasurements::TagBirth_date = QStringLiteral("birth-date");
|
||||||
const QString VIndividualMeasurements::TagSex = QStringLiteral("sex");
|
const QString VIndividualMeasurements::TagSex = QStringLiteral("sex");
|
||||||
const QString VIndividualMeasurements::TagUnit = QStringLiteral("unit");
|
const QString VIndividualMeasurements::TagUnit = QStringLiteral("unit");
|
||||||
|
const QString VIndividualMeasurements::TagEmail = QStringLiteral("email");
|
||||||
|
|
||||||
|
const QString VIndividualMeasurements::SexMale = QStringLiteral("male");
|
||||||
|
const QString VIndividualMeasurements::SexFemale = QStringLiteral("female");
|
||||||
|
|
||||||
VIndividualMeasurements::VIndividualMeasurements(VContainer *data):VDomDocument(data)
|
VIndividualMeasurements::VIndividualMeasurements(VContainer *data):VDomDocument(data)
|
||||||
{
|
{
|
||||||
|
@ -54,30 +58,7 @@ Valentina::Units VIndividualMeasurements::Unit() const
|
||||||
|
|
||||||
void VIndividualMeasurements::setUnit(const Valentina::Units &unit)
|
void VIndividualMeasurements::setUnit(const Valentina::Units &unit)
|
||||||
{
|
{
|
||||||
const QDomNodeList nodeList = this->elementsByTagName(AttrUnit);
|
setTagText(TagUnit, UnitsToStr(unit));
|
||||||
if (nodeList.isEmpty())
|
|
||||||
{
|
|
||||||
qWarning()<<"Can't save measurements units"<<Q_FUNC_INFO;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const QDomNode domNode = nodeList.at(0);
|
|
||||||
if (domNode.isNull() == false && domNode.isElement())
|
|
||||||
{
|
|
||||||
const QDomElement domElement = domNode.toElement();
|
|
||||||
if (domElement.isNull() == false)
|
|
||||||
{
|
|
||||||
QDomElement parent = domElement.parentNode().toElement();
|
|
||||||
QDomElement newUnit = createElement(TagUnit);
|
|
||||||
QDomText newUnitValue = createTextNode(UnitsToStr(unit));
|
|
||||||
newUnit.appendChild(newUnitValue);
|
|
||||||
|
|
||||||
parent.replaceChild(newUnit, domElement);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VIndividualMeasurements::Measurements()
|
void VIndividualMeasurements::Measurements()
|
||||||
|
@ -176,7 +157,7 @@ void VIndividualMeasurements::Measurement(const QString &tag)
|
||||||
const QDomNodeList nodeList = this->elementsByTagName(tag);
|
const QDomNodeList nodeList = this->elementsByTagName(tag);
|
||||||
if (nodeList.isEmpty())
|
if (nodeList.isEmpty())
|
||||||
{
|
{
|
||||||
qWarning()<<"Measurement" << tag <<"doesn't exist"<<Q_FUNC_INFO;
|
qDebug()<<"Measurement" << tag <<"doesn't exist"<<Q_FUNC_INFO;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -207,7 +188,7 @@ void VIndividualMeasurements::Measurement(const QString &tag)
|
||||||
data->AddMeasurement(name, VMeasurement(value/10.0, gui_text, description, tag));
|
data->AddMeasurement(name, VMeasurement(value/10.0, gui_text, description, tag));
|
||||||
if (m_number.isEmpty())
|
if (m_number.isEmpty())
|
||||||
{
|
{
|
||||||
qWarning()<<"Can't find language-independent measurement name for "<< tag;
|
qDebug()<<"Can't find language-independent measurement name for "<< tag;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -222,7 +203,7 @@ void VIndividualMeasurements::Measurement(const QString &tag)
|
||||||
data->AddMeasurement(name, VMeasurement(value, gui_text, description, tag));
|
data->AddMeasurement(name, VMeasurement(value, gui_text, description, tag));
|
||||||
if (m_number.isEmpty())
|
if (m_number.isEmpty())
|
||||||
{
|
{
|
||||||
qWarning()<<"Can't find language-independent measurement name for "<< tag;
|
qDebug()<<"Can't find language-independent measurement name for "<< tag;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -237,27 +218,86 @@ void VIndividualMeasurements::Measurement(const QString &tag)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString VIndividualMeasurements::Language()
|
QString VIndividualMeasurements::Language() const
|
||||||
{
|
{
|
||||||
return UniqueTagText(TagLang, "en");
|
return UniqueTagText(TagLang, "en");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString VIndividualMeasurements::FamilyName()
|
QString VIndividualMeasurements::FamilyName() const
|
||||||
{
|
{
|
||||||
return UniqueTagText(TagFamily_name, "");
|
return UniqueTagText(TagFamily_name, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString VIndividualMeasurements::GivenName()
|
void VIndividualMeasurements::setFamilyName(const QString &text)
|
||||||
|
{
|
||||||
|
setTagText(TagFamily_name, text);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString VIndividualMeasurements::GivenName() const
|
||||||
{
|
{
|
||||||
return UniqueTagText(TagGiven_name, "");
|
return UniqueTagText(TagGiven_name, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString VIndividualMeasurements::BirthDate()
|
void VIndividualMeasurements::setGivenName(const QString &text)
|
||||||
{
|
{
|
||||||
return UniqueTagText(TagBirth_date, "");
|
setTagText(TagGiven_name, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString VIndividualMeasurements::Sex()
|
QDate VIndividualMeasurements::BirthDate() const
|
||||||
{
|
{
|
||||||
return UniqueTagText(TagSex, "");
|
const QString date = UniqueTagText(TagBirth_date, "1900-01-01");
|
||||||
|
return QDate::fromString(date, "yyyy-MM-dd");
|
||||||
|
}
|
||||||
|
|
||||||
|
void VIndividualMeasurements::setBirthDate(const QDate &date)
|
||||||
|
{
|
||||||
|
setTagText(TagBirth_date, date.toString("yyyy-MM-dd"));
|
||||||
|
}
|
||||||
|
|
||||||
|
VIndividualMeasurements::Genders VIndividualMeasurements::Sex() const
|
||||||
|
{
|
||||||
|
return StrToGender(UniqueTagText(TagSex, ""));
|
||||||
|
}
|
||||||
|
|
||||||
|
void VIndividualMeasurements::setSex(const VIndividualMeasurements::Genders &sex)
|
||||||
|
{
|
||||||
|
setTagText(TagSex, GenderToStr(sex));
|
||||||
|
}
|
||||||
|
|
||||||
|
QString VIndividualMeasurements::Mail() const
|
||||||
|
{
|
||||||
|
return UniqueTagText(TagEmail, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
void VIndividualMeasurements::setMail(const QString &text)
|
||||||
|
{
|
||||||
|
setTagText(TagEmail, text);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString VIndividualMeasurements::GenderToStr(const VIndividualMeasurements::Genders &sex)
|
||||||
|
{
|
||||||
|
switch (sex)
|
||||||
|
{
|
||||||
|
case Male:
|
||||||
|
return SexMale;
|
||||||
|
case Female:
|
||||||
|
return SexFemale;
|
||||||
|
default:
|
||||||
|
return SexMale;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VIndividualMeasurements::Genders VIndividualMeasurements::StrToGender(const QString &sex)
|
||||||
|
{
|
||||||
|
QStringList genders;
|
||||||
|
genders << SexMale << SexFemale;
|
||||||
|
switch (genders.indexOf(sex))
|
||||||
|
{
|
||||||
|
case 0: // SexMale
|
||||||
|
return Male;
|
||||||
|
case 1: // SexFemale
|
||||||
|
return Female;
|
||||||
|
default:
|
||||||
|
return Male;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,20 +30,29 @@
|
||||||
#define VINDIVIDUALMEASUREMENTS_H
|
#define VINDIVIDUALMEASUREMENTS_H
|
||||||
|
|
||||||
#include "vdomdocument.h"
|
#include "vdomdocument.h"
|
||||||
|
#include <QDate>
|
||||||
|
|
||||||
class VIndividualMeasurements:public VDomDocument
|
class VIndividualMeasurements:public VDomDocument
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
enum Sex { Male, Female };
|
||||||
|
Q_DECLARE_FLAGS(Genders, Sex)
|
||||||
|
|
||||||
VIndividualMeasurements(VContainer *data);
|
VIndividualMeasurements(VContainer *data);
|
||||||
Valentina::Units Unit() const;
|
Valentina::Units Unit() const;
|
||||||
void setUnit(const Valentina::Units &unit);
|
void setUnit(const Valentina::Units &unit);
|
||||||
void Measurements();
|
void Measurements();
|
||||||
void Measurement(const QString &tag);
|
QString Language() const;
|
||||||
QString Language();
|
QString FamilyName() const;
|
||||||
QString FamilyName();
|
void setFamilyName(const QString &text);
|
||||||
QString GivenName();
|
QString GivenName() const;
|
||||||
QString BirthDate();
|
void setGivenName(const QString &text);
|
||||||
QString Sex();
|
QDate BirthDate() const;
|
||||||
|
void setBirthDate(const QDate &date);
|
||||||
|
VIndividualMeasurements::Genders Sex() const;
|
||||||
|
void setSex(const VIndividualMeasurements::Genders &sex);
|
||||||
|
QString Mail() const;
|
||||||
|
void setMail(const QString &text);
|
||||||
static const QString AttrIgnore;
|
static const QString AttrIgnore;
|
||||||
static const QString AttrName;
|
static const QString AttrName;
|
||||||
static const QString AttrM_number;
|
static const QString AttrM_number;
|
||||||
|
@ -57,6 +66,17 @@ public:
|
||||||
static const QString TagBirth_date;
|
static const QString TagBirth_date;
|
||||||
static const QString TagSex;
|
static const QString TagSex;
|
||||||
static const QString TagUnit;
|
static const QString TagUnit;
|
||||||
|
static const QString TagEmail;
|
||||||
|
|
||||||
|
static const QString SexMale;
|
||||||
|
static const QString SexFemale;
|
||||||
|
|
||||||
|
static QString GenderToStr(const VIndividualMeasurements::Genders &sex);
|
||||||
|
static VIndividualMeasurements::Genders StrToGender(const QString &sex);
|
||||||
|
private:
|
||||||
|
void Measurement(const QString &tag);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Q_DECLARE_OPERATORS_FOR_FLAGS( VIndividualMeasurements::Genders )
|
||||||
|
|
||||||
#endif // VINDIVIDUALMEASUREMENTS_H
|
#endif // VINDIVIDUALMEASUREMENTS_H
|
||||||
|
|
|
@ -184,7 +184,7 @@ bool VPattern::SetNameDraw(const QString &name)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qWarning()<<"Can't find activ draw"<<Q_FUNC_INFO;
|
qDebug()<<"Can't find activ draw"<<Q_FUNC_INFO;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -237,7 +237,7 @@ void VPattern::Parse(const Document::Documents &parse, VMainGraphicsScene *scene
|
||||||
case 5: // TagMeasurements
|
case 5: // TagMeasurements
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qWarning()<<"Wrong tag name"<<Q_FUNC_INFO;
|
qDebug()<<"Wrong tag name"<<Q_FUNC_INFO;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -435,7 +435,7 @@ void VPattern::SetPath(const QString &path)
|
||||||
{
|
{
|
||||||
if (path.isEmpty())
|
if (path.isEmpty())
|
||||||
{
|
{
|
||||||
qWarning()<<"Path to measurements is empty"<<Q_FUNC_INFO;
|
qDebug()<<"Path to measurements is empty"<<Q_FUNC_INFO;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QDomNodeList list = elementsByTagName(TagMeasurements);
|
QDomNodeList list = elementsByTagName(TagMeasurements);
|
||||||
|
@ -447,7 +447,7 @@ void VPattern::SetPath(const QString &path)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qWarning()<<"Can't save path to measurements"<<Q_FUNC_INFO;
|
qDebug()<<"Can't save path to measurements"<<Q_FUNC_INFO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -510,6 +510,20 @@ Pattern::Measurements VPattern::MType() const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool VPattern::SaveDocument(const QString &fileName)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
TestUniqueId();
|
||||||
|
}
|
||||||
|
catch (const VExceptionWrongId &e)
|
||||||
|
{
|
||||||
|
e.CriticalMessageBox(tr("Error no unique id."));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return VDomDocument::SaveDocument(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
void VPattern::FullUpdateTree()
|
void VPattern::FullUpdateTree()
|
||||||
{
|
{
|
||||||
VMainGraphicsScene *scene = new VMainGraphicsScene();
|
VMainGraphicsScene *scene = new VMainGraphicsScene();
|
||||||
|
@ -578,7 +592,7 @@ void VPattern::ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphicsScen
|
||||||
ParseDetails(sceneDetail, domElement, parse);
|
ParseDetails(sceneDetail, domElement, parse);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qWarning()<<"Wrong tag name"<<Q_FUNC_INFO;
|
qDebug()<<"Wrong tag name"<<Q_FUNC_INFO;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -628,7 +642,7 @@ void VPattern::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *
|
||||||
ParseToolsElement(scene, domElement, parse, domElement.attribute(AttrType, ""));
|
ParseToolsElement(scene, domElement, parse, domElement.attribute(AttrType, ""));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qWarning()<<"Wrong tag name"<<Q_FUNC_INFO;
|
qDebug()<<"Wrong tag name"<<Q_FUNC_INFO;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -685,7 +699,7 @@ void VPattern::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomEle
|
||||||
tool = Valentina::NodeSplinePath;
|
tool = Valentina::NodeSplinePath;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qWarning()<<"Wrong node type."<<Q_FUNC_INFO;
|
qDebug()<<"Wrong node type."<<Q_FUNC_INFO;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
detail.append(VNodeDetail(id, tool, nodeType, mx, my));
|
detail.append(VNodeDetail(id, tool, nodeType, mx, my));
|
||||||
|
@ -1084,7 +1098,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qWarning() << "Illegal point type in VDomDocument::ParsePointElement().";
|
qDebug() << "Illegal point type in VDomDocument::ParsePointElement().";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1228,7 +1242,7 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qWarning() << "Illegal spline type in VDomDocument::ParseSplineElement().";
|
qDebug() << "Illegal spline type in VDomDocument::ParseSplineElement().";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1283,7 +1297,7 @@ void VPattern::ParseArcElement(VMainGraphicsScene *scene, const QDomElement &dom
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qWarning() << "Illegal arc type in VDomDocument::ParseArcElement().";
|
qDebug() << "Illegal arc type in VDomDocument::ParseArcElement().";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1320,7 +1334,7 @@ void VPattern::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &d
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qWarning() << "Illegal tools type in VDomDocument::ParseToolsElement().";
|
qDebug() << "Illegal tools type in VDomDocument::ParseToolsElement().";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,6 +193,7 @@ public:
|
||||||
static const QString IncrementKsize;
|
static const QString IncrementKsize;
|
||||||
static const QString IncrementKgrowth;
|
static const QString IncrementKgrowth;
|
||||||
static const QString IncrementDescription;
|
static const QString IncrementDescription;
|
||||||
|
virtual bool SaveDocument(const QString &fileName);
|
||||||
signals:
|
signals:
|
||||||
/**
|
/**
|
||||||
* @brief ChangedActivDraw change active pattern peace.
|
* @brief ChangedActivDraw change active pattern peace.
|
||||||
|
|
|
@ -55,7 +55,7 @@ QString VStandardMeasurements::Description()
|
||||||
const QString desc = UniqueTagText(TagDescription, "");
|
const QString desc = UniqueTagText(TagDescription, "");
|
||||||
if (desc.isEmpty())
|
if (desc.isEmpty())
|
||||||
{
|
{
|
||||||
qWarning()<<"Empty description in standard table."<<Q_FUNC_INFO;
|
qDebug()<<"Empty description in standard table."<<Q_FUNC_INFO;
|
||||||
}
|
}
|
||||||
return desc;
|
return desc;
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ void VStandardMeasurements::Measurements()
|
||||||
const QDomNodeList nodeList = this->elementsByTagName(TagMeasurement);
|
const QDomNodeList nodeList = this->elementsByTagName(TagMeasurement);
|
||||||
if (nodeList.isEmpty())
|
if (nodeList.isEmpty())
|
||||||
{
|
{
|
||||||
qWarning()<<"Measurement list is empty"<<Q_FUNC_INFO;
|
qDebug()<<"Measurement list is empty"<<Q_FUNC_INFO;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -170,8 +170,3 @@ void VStandardMeasurements::SetHeight()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VStandardMeasurements::Update()
|
|
||||||
{
|
|
||||||
Measurements();
|
|
||||||
}
|
|
||||||
|
|
|
@ -31,9 +31,8 @@
|
||||||
|
|
||||||
#include "vdomdocument.h"
|
#include "vdomdocument.h"
|
||||||
|
|
||||||
class VStandardMeasurements:public QObject, public VDomDocument
|
class VStandardMeasurements:public VDomDocument
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
|
||||||
public:
|
public:
|
||||||
VStandardMeasurements(VContainer *data);
|
VStandardMeasurements(VContainer *data);
|
||||||
Valentina::Units Unit();
|
Valentina::Units Unit();
|
||||||
|
@ -51,8 +50,6 @@ public:
|
||||||
static const QString AttrSize_increace;
|
static const QString AttrSize_increace;
|
||||||
static const QString AttrHeight_increase;
|
static const QString AttrHeight_increase;
|
||||||
static const QString AttrNumber;
|
static const QString AttrNumber;
|
||||||
public slots:
|
|
||||||
void Update();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VSTANDARDMEASUREMENTS_H
|
#endif // VSTANDARDMEASUREMENTS_H
|
||||||
|
|
Loading…
Reference in New Issue
Block a user