Highlight start of method.

--HG--
branch : feature
This commit is contained in:
dismine 2014-05-02 14:11:30 +03:00
parent 9ca9455c80
commit bdb788e7a7
99 changed files with 1216 additions and 100 deletions

View File

@ -38,6 +38,7 @@
#define FINISHED 10 #define FINISHED 10
#define EOL 9 #define EOL 9
//---------------------------------------------------------------------------------------------------------------------
qreal Calculator::eval(QString prog, QString *errorMsg) qreal Calculator::eval(QString prog, QString *errorMsg)
{ {
this->errorMsg = errorMsg; this->errorMsg = errorMsg;
@ -53,6 +54,7 @@ qreal Calculator::eval(QString prog, QString *errorMsg)
return result; return result;
} }
//---------------------------------------------------------------------------------------------------------------------
qreal Calculator::get_exp() qreal Calculator::get_exp()
{ {
qreal result = 0; qreal result = 0;
@ -67,7 +69,7 @@ qreal Calculator::get_exp()
return result; return result;
} }
//---------------------------------------------------------------------------------------------------------------------
void Calculator::level2(qreal *result) void Calculator::level2(qreal *result)
{ {
QChar op; QChar op;
@ -82,6 +84,7 @@ void Calculator::level2(qreal *result)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void Calculator::level3(qreal *result) void Calculator::level3(qreal *result)
{ {
QChar op; QChar op;
@ -97,6 +100,7 @@ void Calculator::level3(qreal *result)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void Calculator::level4(qreal *result) void Calculator::level4(qreal *result)
{ {
qreal hold; qreal hold;
@ -110,6 +114,7 @@ void Calculator::level4(qreal *result)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void Calculator::level5(qreal *result) void Calculator::level5(qreal *result)
{ {
QChar op; QChar op;
@ -127,6 +132,7 @@ void Calculator::level5(qreal *result)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void Calculator::level6(qreal *result) void Calculator::level6(qreal *result)
{ {
if ((token[0] == '(') && (token_type == DELIMITER)) if ((token[0] == '(') && (token_type == DELIMITER))
@ -142,6 +148,7 @@ void Calculator::level6(qreal *result)
primitive(result); primitive(result);
} }
//---------------------------------------------------------------------------------------------------------------------
void Calculator::primitive(qreal *result) void Calculator::primitive(qreal *result)
{ {
QString str; QString str;
@ -164,6 +171,7 @@ void Calculator::primitive(qreal *result)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void Calculator::arith(QChar o, qreal *r, qreal *h) void Calculator::arith(QChar o, qreal *r, qreal *h)
{ {
qreal t;//, ex; qreal t;//, ex;
@ -194,6 +202,7 @@ void Calculator::arith(QChar o, qreal *r, qreal *h)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void Calculator::unary(QChar o, qreal *r) void Calculator::unary(QChar o, qreal *r)
{ {
if (o=='-') if (o=='-')
@ -202,6 +211,7 @@ void Calculator::unary(QChar o, qreal *r)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
qreal Calculator::find_var(QString s) qreal Calculator::find_var(QString s)
{ {
bool ok = false; bool ok = false;
@ -215,6 +225,7 @@ qreal Calculator::find_var(QString s)
return value; return value;
} }
//---------------------------------------------------------------------------------------------------------------------
void Calculator::serror(qint32 error) void Calculator::serror(qint32 error)
{ {
QString e[]= QString e[]=
@ -230,6 +241,7 @@ void Calculator::serror(qint32 error)
qDebug()<<e[error]; qDebug()<<e[error];
} }
//---------------------------------------------------------------------------------------------------------------------
char Calculator::look_up(QString s) char Calculator::look_up(QString s)
{ {
QString p; QString p;
@ -240,6 +252,7 @@ char Calculator::look_up(QString s)
return 0; return 0;
} }
//---------------------------------------------------------------------------------------------------------------------
bool Calculator::isdelim(QChar c) bool Calculator::isdelim(QChar c)
{ {
if (StrChr(" ;,+-<>/*%^=()", c) || c=='\n' || c=='\r' || c=='\0') if (StrChr(" ;,+-<>/*%^=()", c) || c=='\n' || c=='\r' || c=='\0')
@ -249,6 +262,7 @@ bool Calculator::isdelim(QChar c)
return false; return false;
} }
//---------------------------------------------------------------------------------------------------------------------
bool Calculator::iswhite(QChar c) bool Calculator::iswhite(QChar c)
{ {
if (c==' ' || c=='\t') if (c==' ' || c=='\t')
@ -261,6 +275,7 @@ bool Calculator::iswhite(QChar c)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void Calculator::get_token() void Calculator::get_token()
{ {
QString *temp; QString *temp;
@ -355,11 +370,13 @@ void Calculator::get_token()
return; return;
} }
//---------------------------------------------------------------------------------------------------------------------
bool Calculator::StrChr(QString string, QChar c) bool Calculator::StrChr(QString string, QChar c)
{ {
return string.contains(c, Qt::CaseInsensitive); return string.contains(c, Qt::CaseInsensitive);
} }
//---------------------------------------------------------------------------------------------------------------------
void Calculator::putback() void Calculator::putback()
{ {
QString t; QString t;

View File

@ -34,20 +34,22 @@
quint32 VContainer::_id = 0; quint32 VContainer::_id = 0;
//---------------------------------------------------------------------------------------------------------------------
VContainer::VContainer() VContainer::VContainer()
:_size(50), sizeName("Сг"), _height(176), heightName("P"), gObjects(QHash<quint32, VGObject *>()), :_size(50), sizeName("Сг"), _height(176), heightName("P"), gObjects(QHash<quint32, VGObject *>()),
measurements(QHash<QString, VMeasurement>()), increments(QHash<QString, VIncrement>()), measurements(QHash<QString, VMeasurement>()), increments(QHash<QString, VIncrement>()),
lengthLines(QHash<QString, qreal>()), lineAngles(QHash<QString, qreal>()), lengthSplines(QHash<QString, qreal>()), lengthLines(QHash<QString, qreal>()), lineAngles(QHash<QString, qreal>()), lengthSplines(QHash<QString, qreal>()),
lengthArcs(QHash<QString, qreal>()), details(QHash<quint32, VDetail>()) lengthArcs(QHash<QString, qreal>()), details(QHash<quint32, VDetail>())
{ {}
}
//---------------------------------------------------------------------------------------------------------------------
VContainer &VContainer::operator =(const VContainer &data) VContainer &VContainer::operator =(const VContainer &data)
{ {
setData(data); setData(data);
return *this; return *this;
} }
//---------------------------------------------------------------------------------------------------------------------
VContainer::VContainer(const VContainer &data) VContainer::VContainer(const VContainer &data)
:_size(50), sizeName("Сг"), _height(176), heightName("P"), gObjects(QHash<quint32, VGObject *>()), :_size(50), sizeName("Сг"), _height(176), heightName("P"), gObjects(QHash<quint32, VGObject *>()),
measurements(QHash<QString, VMeasurement>()), increments(QHash<QString, VIncrement>()), measurements(QHash<QString, VMeasurement>()), increments(QHash<QString, VIncrement>()),
@ -57,12 +59,14 @@ VContainer::VContainer(const VContainer &data)
setData(data); setData(data);
} }
//---------------------------------------------------------------------------------------------------------------------
VContainer::~VContainer() VContainer::~VContainer()
{ {
qDeleteAll(gObjects); qDeleteAll(gObjects);
gObjects.clear(); gObjects.clear();
} }
//---------------------------------------------------------------------------------------------------------------------
void VContainer::setData(const VContainer &data) void VContainer::setData(const VContainer &data)
{ {
_size = data.size(); _size = data.size();
@ -106,12 +110,14 @@ void VContainer::setData(const VContainer &data)
details = *data.DataDetails(); details = *data.DataDetails();
} }
//---------------------------------------------------------------------------------------------------------------------
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
const VGObject *VContainer::GetGObject(quint32 id)const const VGObject *VContainer::GetGObject(quint32 id)const
{ {
return GetObject(gObjects, id); return GetObject(gObjects, id);
} }
//---------------------------------------------------------------------------------------------------------------------
template <typename key, typename val> template <typename key, typename val>
const val VContainer::GetObject(const QHash<key, val> &obj, key id) const const val VContainer::GetObject(const QHash<key, val> &obj, key id) const
{ {
@ -125,6 +131,7 @@ const val VContainer::GetObject(const QHash<key, val> &obj, key id) const
} }
} }
//---------------------------------------------------------------------------------------------------------------------
template <typename key, typename val> template <typename key, typename val>
val VContainer::GetVariable(const QHash<key, val> &obj, key id) const val VContainer::GetVariable(const QHash<key, val> &obj, key id) const
{ {
@ -138,52 +145,61 @@ val VContainer::GetVariable(const QHash<key, val> &obj, key id) const
} }
} }
//---------------------------------------------------------------------------------------------------------------------
const VMeasurement VContainer::GetMeasurement(const QString &name) const const VMeasurement VContainer::GetMeasurement(const QString &name) const
{ {
Q_ASSERT(name.isEmpty()==false); Q_ASSERT(name.isEmpty()==false);
return GetVariable(measurements, name); return GetVariable(measurements, name);
} }
//---------------------------------------------------------------------------------------------------------------------
const VIncrement VContainer::GetIncrement(const QString& name) const const VIncrement VContainer::GetIncrement(const QString& name) const
{ {
Q_ASSERT(name.isEmpty()==false); Q_ASSERT(name.isEmpty()==false);
return GetVariable(increments, name); return GetVariable(increments, name);
} }
//---------------------------------------------------------------------------------------------------------------------
qreal VContainer::GetLine(const QString &name) const qreal VContainer::GetLine(const QString &name) const
{ {
Q_ASSERT(name.isEmpty()==false); Q_ASSERT(name.isEmpty()==false);
return GetVariable(lengthLines, name); return GetVariable(lengthLines, name);
} }
//---------------------------------------------------------------------------------------------------------------------
qreal VContainer::GetLengthArc(const QString &name) const qreal VContainer::GetLengthArc(const QString &name) const
{ {
Q_ASSERT(name.isEmpty()==false); Q_ASSERT(name.isEmpty()==false);
return GetVariable(lengthArcs, name); return GetVariable(lengthArcs, name);
} }
//---------------------------------------------------------------------------------------------------------------------
qreal VContainer::GetLengthSpline(const QString &name) const qreal VContainer::GetLengthSpline(const QString &name) const
{ {
Q_ASSERT(name.isEmpty()==false); Q_ASSERT(name.isEmpty()==false);
return GetVariable(lengthSplines, name); return GetVariable(lengthSplines, name);
} }
//---------------------------------------------------------------------------------------------------------------------
qreal VContainer::GetLineAngle(const QString &name) const qreal VContainer::GetLineAngle(const QString &name) const
{ {
Q_ASSERT(name.isEmpty()==false); Q_ASSERT(name.isEmpty()==false);
return GetVariable(lineAngles, name); return GetVariable(lineAngles, name);
} }
//---------------------------------------------------------------------------------------------------------------------
const VDetail VContainer::GetDetail(quint32 id) const const VDetail VContainer::GetDetail(quint32 id) const
{ {
return GetVariable(details, id); return GetVariable(details, id);
} }
//---------------------------------------------------------------------------------------------------------------------
quint32 VContainer::AddGObject(VGObject *obj) quint32 VContainer::AddGObject(VGObject *obj)
{ {
return AddObject(gObjects, obj); return AddObject(gObjects, obj);
} }
//---------------------------------------------------------------------------------------------------------------------
quint32 VContainer::AddDetail(VDetail detail) quint32 VContainer::AddDetail(VDetail detail)
{ {
quint32 id = getNextId(); quint32 id = getNextId();
@ -191,17 +207,20 @@ quint32 VContainer::AddDetail(VDetail detail)
return id; return id;
} }
//---------------------------------------------------------------------------------------------------------------------
void VContainer::AddIncrement(const QString &name, VIncrement incr) void VContainer::AddIncrement(const QString &name, VIncrement incr)
{ {
increments[name] = incr; increments[name] = incr;
} }
//---------------------------------------------------------------------------------------------------------------------
quint32 VContainer::getNextId() quint32 VContainer::getNextId()
{ {
_id++; _id++;
return _id; return _id;
} }
//---------------------------------------------------------------------------------------------------------------------
void VContainer::UpdateId(quint32 newId) void VContainer::UpdateId(quint32 newId)
{ {
if (newId > _id) if (newId > _id)
@ -210,6 +229,7 @@ void VContainer::UpdateId(quint32 newId)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
template <typename val> template <typename val>
void VContainer::UpdateObject(QHash<quint32, val> &obj, const quint32 &id, val point) void VContainer::UpdateObject(QHash<quint32, val> &obj, const quint32 &id, val point)
{ {
@ -225,24 +245,28 @@ void VContainer::UpdateObject(QHash<quint32, val> &obj, const quint32 &id, val p
UpdateId(id); UpdateId(id);
} }
//---------------------------------------------------------------------------------------------------------------------
void VContainer::AddLengthSpline(const QString &name, const qreal &value) void VContainer::AddLengthSpline(const QString &name, const qreal &value)
{ {
Q_ASSERT(name.isEmpty() == false); Q_ASSERT(name.isEmpty() == false);
lengthSplines[name] = value; lengthSplines[name] = value;
} }
//---------------------------------------------------------------------------------------------------------------------
void VContainer::AddLengthArc(const quint32 &id) void VContainer::AddLengthArc(const quint32 &id)
{ {
const VArc * arc = GeometricObject<const VArc *>(id); const VArc * arc = GeometricObject<const VArc *>(id);
lengthArcs[arc->name()] = qApp->fromPixel(arc->GetLength()); lengthArcs[arc->name()] = qApp->fromPixel(arc->GetLength());
} }
//---------------------------------------------------------------------------------------------------------------------
void VContainer::AddLineAngle(const QString &name, const qreal &value) void VContainer::AddLineAngle(const QString &name, const qreal &value)
{ {
Q_ASSERT(name.isEmpty() == false); Q_ASSERT(name.isEmpty() == false);
lineAngles[name] = value; lineAngles[name] = value;
} }
//---------------------------------------------------------------------------------------------------------------------
qreal VContainer::GetValueStandardTableRow(const QString& name) const qreal VContainer::GetValueStandardTableRow(const QString& name) const
{ {
const VMeasurement m = GetMeasurement(name); const VMeasurement m = GetMeasurement(name);
@ -256,6 +280,7 @@ qreal VContainer::GetValueStandardTableRow(const QString& name) const
} }
} }
//---------------------------------------------------------------------------------------------------------------------
qreal VContainer::GetValueIncrementTableRow(const QString& name) const qreal VContainer::GetValueIncrementTableRow(const QString& name) const
{ {
const VIncrement icr = GetIncrement(name); const VIncrement icr = GetIncrement(name);
@ -269,6 +294,7 @@ qreal VContainer::GetValueIncrementTableRow(const QString& name) const
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VContainer::Clear() void VContainer::Clear()
{ {
_id = 0; _id = 0;
@ -282,6 +308,7 @@ void VContainer::Clear()
ClearGObjects(); ClearGObjects();
} }
//---------------------------------------------------------------------------------------------------------------------
void VContainer::ClearGObjects() void VContainer::ClearGObjects()
{ {
if (gObjects.size()>0) if (gObjects.size()>0)
@ -291,6 +318,7 @@ void VContainer::ClearGObjects()
gObjects.clear(); gObjects.clear();
} }
//---------------------------------------------------------------------------------------------------------------------
void VContainer::ClearCalculationGObjects() void VContainer::ClearCalculationGObjects()
{ {
if (gObjects.size()>0) if (gObjects.size()>0)
@ -308,6 +336,7 @@ void VContainer::ClearCalculationGObjects()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
qreal VContainer::FindVar(const QString &name, bool *ok)const qreal VContainer::FindVar(const QString &name, bool *ok)const
{ {
if (sizeName == name) if (sizeName == name)
@ -354,6 +383,7 @@ qreal VContainer::FindVar(const QString &name, bool *ok)const
return 0; return 0;
} }
//---------------------------------------------------------------------------------------------------------------------
void VContainer::AddLine(const quint32 &firstPointId, const quint32 &secondPointId) void VContainer::AddLine(const quint32 &firstPointId, const quint32 &secondPointId)
{ {
QString nameLine = GetNameLine(firstPointId, secondPointId); QString nameLine = GetNameLine(firstPointId, secondPointId);
@ -364,6 +394,7 @@ void VContainer::AddLine(const quint32 &firstPointId, const quint32 &secondPoint
AddLineAngle(nameLine, QLineF(first->toQPointF(), second->toQPointF()).angle()); AddLineAngle(nameLine, QLineF(first->toQPointF(), second->toQPointF()).angle());
} }
//---------------------------------------------------------------------------------------------------------------------
template <typename key, typename val> template <typename key, typename val>
quint32 VContainer::AddObject(QHash<key, val> &obj, val value) quint32 VContainer::AddObject(QHash<key, val> &obj, val value)
{ {
@ -374,6 +405,7 @@ quint32 VContainer::AddObject(QHash<key, val> &obj, val value)
return id; return id;
} }
//---------------------------------------------------------------------------------------------------------------------
QString VContainer::GetNameLine(const quint32 &firstPoint, const quint32 &secondPoint) const QString VContainer::GetNameLine(const quint32 &firstPoint, const quint32 &secondPoint) const
{ {
const VPointF *first = GeometricObject<const VPointF *>(firstPoint); const VPointF *first = GeometricObject<const VPointF *>(firstPoint);
@ -382,6 +414,7 @@ QString VContainer::GetNameLine(const quint32 &firstPoint, const quint32 &second
return QString("Line_%1_%2").arg(first->name(), second->name()); return QString("Line_%1_%2").arg(first->name(), second->name());
} }
//---------------------------------------------------------------------------------------------------------------------
QString VContainer::GetNameLineAngle(const quint32 &firstPoint, const quint32 &secondPoint) const QString VContainer::GetNameLineAngle(const quint32 &firstPoint, const quint32 &secondPoint) const
{ {
const VPointF *first = GeometricObject<const VPointF *>(firstPoint); const VPointF *first = GeometricObject<const VPointF *>(firstPoint);
@ -390,11 +423,13 @@ QString VContainer::GetNameLineAngle(const quint32 &firstPoint, const quint32 &s
return QString("AngleLine_%1_%2").arg(first->name(), second->name()); return QString("AngleLine_%1_%2").arg(first->name(), second->name());
} }
//---------------------------------------------------------------------------------------------------------------------
void VContainer::UpdateGObject(quint32 id, VGObject* obj) void VContainer::UpdateGObject(quint32 id, VGObject* obj)
{ {
UpdateObject(gObjects, id, obj); UpdateObject(gObjects, id, obj);
} }
//---------------------------------------------------------------------------------------------------------------------
void VContainer::UpdateDetail(quint32 id, const VDetail &detail) void VContainer::UpdateDetail(quint32 id, const VDetail &detail)
{ {
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
@ -402,6 +437,7 @@ void VContainer::UpdateDetail(quint32 id, const VDetail &detail)
UpdateId(id); UpdateId(id);
} }
//---------------------------------------------------------------------------------------------------------------------
void VContainer::AddLengthLine(const QString &name, const qreal &value) void VContainer::AddLengthLine(const QString &name, const qreal &value)
{ {
Q_ASSERT(name.isEmpty() == false); Q_ASSERT(name.isEmpty() == false);

View File

@ -28,17 +28,21 @@
#include "vincrement.h" #include "vincrement.h"
//---------------------------------------------------------------------------------------------------------------------
VIncrement::VIncrement() VIncrement::VIncrement()
:id(0), base(0), ksize(50.0), kheight(176.0), description(QString()){} :id(0), base(0), ksize(50.0), kheight(176.0), description(QString()){}
VIncrement::VIncrement(quint32 id, qreal base, qreal ksize, qreal kheight, QString description) VIncrement::VIncrement(quint32 id, qreal base, qreal ksize, qreal kheight, QString description)
:id(id), base(base), ksize(ksize), kheight(kheight), description(description){} :id(id), base(base), ksize(ksize), kheight(kheight), description(description)
{}
//---------------------------------------------------------------------------------------------------------------------
qreal VIncrement::GetValue() const qreal VIncrement::GetValue() const
{ {
return base; return base;
} }
//---------------------------------------------------------------------------------------------------------------------
qreal VIncrement::GetValue(const qreal &size, const qreal &height) const qreal VIncrement::GetValue(const qreal &size, const qreal &height) const
{ {
const qreal k_size = ( size - 50.0 ) / 2.0; const qreal k_size = ( size - 50.0 ) / 2.0;

View File

@ -28,33 +28,32 @@
#include "vmeasurement.h" #include "vmeasurement.h"
//---------------------------------------------------------------------------------------------------------------------
VMeasurement::VMeasurement() VMeasurement::VMeasurement()
:base(0), ksize(50.0), kheight(176.0), gui_text(QString()), number(QString()), virtualM(false), :base(0), ksize(50.0), kheight(176.0), gui_text(QString()), number(QString()), virtualM(false),
_tagName(QString()) _tagName(QString())
{ {}
}
//---------------------------------------------------------------------------------------------------------------------
VMeasurement::VMeasurement(const qreal &base, const qreal &ksize, const qreal &kgrowth, VMeasurement::VMeasurement(const qreal &base, const qreal &ksize, const qreal &kgrowth,
const QString &gui_text, const QString &number, const QString &tagName) const QString &gui_text, const QString &number, const QString &tagName)
:base(base), ksize(ksize), kheight(kgrowth), gui_text(gui_text), number(number), virtualM(false), :base(base), ksize(ksize), kheight(kgrowth), gui_text(gui_text), number(number), virtualM(false),
_tagName(tagName) _tagName(tagName)
{ {}
}
//---------------------------------------------------------------------------------------------------------------------
VMeasurement::VMeasurement(const qreal &base, const QString &gui_text, const QString &number, const QString &tagName) VMeasurement::VMeasurement(const qreal &base, const QString &gui_text, const QString &number, const QString &tagName)
:base(base), ksize(50.0), kheight(176.0), gui_text(gui_text), number(number), virtualM(false), :base(base), ksize(50.0), kheight(176.0), gui_text(gui_text), number(number), virtualM(false),
_tagName(tagName) _tagName(tagName)
{ {}
}
//---------------------------------------------------------------------------------------------------------------------
qreal VMeasurement::GetValue() const qreal VMeasurement::GetValue() const
{ {
return base; return base;
} }
//---------------------------------------------------------------------------------------------------------------------
qreal VMeasurement::GetValue(const qreal &size, const qreal &height) const qreal VMeasurement::GetValue(const qreal &size, const qreal &height) const
{ {
const qreal k_size = ( size - 50.0 ) / 2.0; const qreal k_size = ( size - 50.0 ) / 2.0;

View File

@ -28,6 +28,7 @@
#include "configdialog.h" #include "configdialog.h"
//---------------------------------------------------------------------------------------------------------------------
ConfigDialog::ConfigDialog(QWidget *parent) : ConfigDialog::ConfigDialog(QWidget *parent) :
QDialog(parent), contentsWidget(nullptr), pagesWidget(nullptr), configurationPage(nullptr), patternPage(nullptr) QDialog(parent), contentsWidget(nullptr), pagesWidget(nullptr), configurationPage(nullptr), patternPage(nullptr)
{ {
@ -76,6 +77,7 @@ ConfigDialog::ConfigDialog(QWidget *parent) :
setWindowTitle(tr("Config Dialog")); setWindowTitle(tr("Config Dialog"));
} }
//---------------------------------------------------------------------------------------------------------------------
void ConfigDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous) void ConfigDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous)
{ {
if (current == false) if (current == false)
@ -85,6 +87,7 @@ void ConfigDialog::changePage(QListWidgetItem *current, QListWidgetItem *previou
pagesWidget->setCurrentIndex(contentsWidget->row(current)); pagesWidget->setCurrentIndex(contentsWidget->row(current));
} }
//---------------------------------------------------------------------------------------------------------------------
void ConfigDialog::closeEvent(QCloseEvent *event) void ConfigDialog::closeEvent(QCloseEvent *event)
{ {
if (result() == QDialog::Accepted) if (result() == QDialog::Accepted)
@ -94,6 +97,7 @@ void ConfigDialog::closeEvent(QCloseEvent *event)
event->accept(); event->accept();
} }
//---------------------------------------------------------------------------------------------------------------------
void ConfigDialog::createIcons() void ConfigDialog::createIcons()
{ {
QListWidgetItem *configButton = new QListWidgetItem(contentsWidget); QListWidgetItem *configButton = new QListWidgetItem(contentsWidget);
@ -111,6 +115,7 @@ void ConfigDialog::createIcons()
connect(contentsWidget, &QListWidget::currentItemChanged, this, &ConfigDialog::changePage); connect(contentsWidget, &QListWidget::currentItemChanged, this, &ConfigDialog::changePage);
} }
//---------------------------------------------------------------------------------------------------------------------
void ConfigDialog::Apply() void ConfigDialog::Apply()
{ {
switch (contentsWidget->currentRow()) switch (contentsWidget->currentRow())
@ -127,6 +132,7 @@ void ConfigDialog::Apply()
setResult(QDialog::Accepted); setResult(QDialog::Accepted);
} }
//---------------------------------------------------------------------------------------------------------------------
void ConfigDialog::Ok() void ConfigDialog::Ok()
{ {
Apply(); Apply();

View File

@ -38,6 +38,7 @@
#include <QDebug> #include <QDebug>
#include <QPushButton> #include <QPushButton>
//---------------------------------------------------------------------------------------------------------------------
DialogHistory::DialogHistory(VContainer *data, VPattern *doc, QWidget *parent) DialogHistory::DialogHistory(VContainer *data, VPattern *doc, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogHistory), doc(doc), cursorRow(0), :DialogTool(data, parent), ui(new Ui::DialogHistory), doc(doc), cursorRow(0),
cursorToolRecordRow(0) cursorToolRecordRow(0)
@ -55,11 +56,13 @@ DialogHistory::DialogHistory(VContainer *data, VPattern *doc, QWidget *parent)
ShowPoint(); ShowPoint();
} }
//---------------------------------------------------------------------------------------------------------------------
DialogHistory::~DialogHistory() DialogHistory::~DialogHistory()
{ {
delete ui; delete ui;
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogHistory::DialogAccepted() void DialogHistory::DialogAccepted()
{ {
QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0); QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0);
@ -68,6 +71,7 @@ void DialogHistory::DialogAccepted()
emit DialogClosed(QDialog::Accepted); emit DialogClosed(QDialog::Accepted);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogHistory::cellClicked(int row, int column) void DialogHistory::cellClicked(int row, int column)
{ {
if (column == 0) if (column == 0)
@ -96,6 +100,7 @@ void DialogHistory::cellClicked(int row, int column)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogHistory::ChangedCursor(quint32 id) void DialogHistory::ChangedCursor(quint32 id)
{ {
for (qint32 i = 0; i< ui->tableWidget->rowCount(); ++i) for (qint32 i = 0; i< ui->tableWidget->rowCount(); ++i)
@ -112,12 +117,14 @@ void DialogHistory::ChangedCursor(quint32 id)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogHistory::UpdateHistory() void DialogHistory::UpdateHistory()
{ {
FillTable(); FillTable();
InitialTable(); InitialTable();
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogHistory::FillTable() void DialogHistory::FillTable()
{ {
ui->tableWidget->clear(); ui->tableWidget->clear();
@ -165,6 +172,7 @@ void DialogHistory::FillTable()
ui->tableWidget->verticalHeader()->setDefaultSectionSize(20); ui->tableWidget->verticalHeader()->setDefaultSectionSize(20);
} }
//---------------------------------------------------------------------------------------------------------------------
QString DialogHistory::Record(const VToolRecord &tool) QString DialogHistory::Record(const VToolRecord &tool)
{ {
const QDomElement domElement = doc->elementById(QString().setNum(tool.getId())); const QDomElement domElement = doc->elementById(QString().setNum(tool.getId()));
@ -407,6 +415,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
return QString(); return QString();
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogHistory::InitialTable() void DialogHistory::InitialTable()
{ {
ui->tableWidget->setSortingEnabled(false); ui->tableWidget->setSortingEnabled(false);
@ -414,6 +423,7 @@ void DialogHistory::InitialTable()
ui->tableWidget->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Tool"))); ui->tableWidget->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Tool")));
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogHistory::ShowPoint() void DialogHistory::ShowPoint()
{ {
QVector<VToolRecord> *history = doc->getHistory(); QVector<VToolRecord> *history = doc->getHistory();
@ -428,6 +438,7 @@ void DialogHistory::ShowPoint()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogHistory::closeEvent(QCloseEvent *event) void DialogHistory::closeEvent(QCloseEvent *event)
{ {
QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0); QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0);

View File

@ -40,6 +40,7 @@
#include <QMessageBox> #include <QMessageBox>
#include <QCloseEvent> #include <QCloseEvent>
//---------------------------------------------------------------------------------------------------------------------
DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *parent) DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *parent)
: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)
{ {
@ -135,6 +136,7 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
connect(ui->toolButtonOpenMeasurements, &QToolButton::clicked, this, &DialogIncrements::OpenTable); connect(ui->toolButtonOpenMeasurements, &QToolButton::clicked, this, &DialogIncrements::OpenTable);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::FillMeasurements() void DialogIncrements::FillMeasurements()
{ {
const QHash<QString, VMeasurement> *table = data->DataMeasurements(); const QHash<QString, VMeasurement> *table = data->DataMeasurements();
@ -212,6 +214,7 @@ void DialogIncrements::FillMeasurements()
ui->tableWidgetMeasurements->resizeRowsToContents(); ui->tableWidgetMeasurements->resizeRowsToContents();
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::FillIncrements() void DialogIncrements::FillIncrements()
{ {
const QHash<QString, VIncrement> *increments = data->DataIncrements(); const QHash<QString, VIncrement> *increments = data->DataIncrements();
@ -279,6 +282,7 @@ void DialogIncrements::FillIncrements()
ui->tableWidgetIncrement->setCurrentCell( row, column ); ui->tableWidgetIncrement->setCurrentCell( row, column );
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::FillLengthLines() void DialogIncrements::FillLengthLines()
{ {
const QHash<QString, qreal> *linesTable = data->DataLengthLines(); const QHash<QString, qreal> *linesTable = data->DataLengthLines();
@ -314,6 +318,7 @@ void DialogIncrements::FillLengthLines()
ui->tableWidgetLines->verticalHeader()->setDefaultSectionSize(20); ui->tableWidgetLines->verticalHeader()->setDefaultSectionSize(20);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::FillLengthSplines() void DialogIncrements::FillLengthSplines()
{ {
const QHash<QString, qreal> *splinesTable = data->DataLengthSplines(); const QHash<QString, qreal> *splinesTable = data->DataLengthSplines();
@ -349,6 +354,7 @@ void DialogIncrements::FillLengthSplines()
ui->tableWidgetSplines->verticalHeader()->setDefaultSectionSize(20); ui->tableWidgetSplines->verticalHeader()->setDefaultSectionSize(20);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::FillLengthArcs() void DialogIncrements::FillLengthArcs()
{ {
const QHash<QString, qreal> *arcsTable = data->DataLengthArcs(); const QHash<QString, qreal> *arcsTable = data->DataLengthArcs();
@ -384,6 +390,7 @@ void DialogIncrements::FillLengthArcs()
ui->tableWidgetArcs->resizeRowsToContents(); ui->tableWidgetArcs->resizeRowsToContents();
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::FullUpdateFromFile() void DialogIncrements::FullUpdateFromFile()
{ {
disconnect(ui->tableWidgetMeasurements, &QTableWidget::cellChanged, this, &DialogIncrements::MeasurementChanged); disconnect(ui->tableWidgetMeasurements, &QTableWidget::cellChanged, this, &DialogIncrements::MeasurementChanged);
@ -406,6 +413,7 @@ void DialogIncrements::FullUpdateFromFile()
FillLengthArcs(); FillLengthArcs();
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::SaveGivenName() void DialogIncrements::SaveGivenName()
{ {
m->setGivenName(ui->lineEditGivenName->text()); m->setGivenName(ui->lineEditGivenName->text());
@ -415,6 +423,7 @@ void DialogIncrements::SaveGivenName()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::SaveFamilyName() void DialogIncrements::SaveFamilyName()
{ {
@ -425,6 +434,7 @@ void DialogIncrements::SaveFamilyName()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::SaveEmail() void DialogIncrements::SaveEmail()
{ {
m->setMail(ui->lineEditMail->text()); m->setMail(ui->lineEditMail->text());
@ -434,6 +444,7 @@ void DialogIncrements::SaveEmail()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::SaveSex(int index) void DialogIncrements::SaveSex(int index)
{ {
m->setSex(m->StrToGender(ui->comboBoxSex->itemData(index).toString())); m->setSex(m->StrToGender(ui->comboBoxSex->itemData(index).toString()));
@ -443,6 +454,7 @@ void DialogIncrements::SaveSex(int index)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::SaveBirthDate(const QDate & date) void DialogIncrements::SaveBirthDate(const QDate & date)
{ {
m->setBirthDate(date); m->setBirthDate(date);
@ -452,6 +464,7 @@ void DialogIncrements::SaveBirthDate(const QDate & date)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::OpenTable() void DialogIncrements::OpenTable()
{ {
QString text = tr("Measurements use different units than pattern. This pattern required measurements in %1") QString text = tr("Measurements use different units than pattern. This pattern required measurements in %1")
@ -539,6 +552,7 @@ void DialogIncrements::OpenTable()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::clickedToolButtonAdd() void DialogIncrements::clickedToolButtonAdd()
{ {
ui->tableWidgetIncrement->setFocus(Qt::OtherFocusReason); ui->tableWidgetIncrement->setFocus(Qt::OtherFocusReason);
@ -599,6 +613,7 @@ void DialogIncrements::clickedToolButtonAdd()
emit haveLiteChange(); emit haveLiteChange();
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::clickedToolButtonRemove() void DialogIncrements::clickedToolButtonRemove()
{ {
disconnect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, disconnect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this,
@ -624,6 +639,7 @@ void DialogIncrements::clickedToolButtonRemove()
emit haveLiteChange(); emit haveLiteChange();
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::AddIncrementToFile(const quint32 &id, const QString &name, const qreal &base, const qreal &ksize, void DialogIncrements::AddIncrementToFile(const quint32 &id, const QString &name, const qreal &base, const qreal &ksize,
const qreal &kheight, const QString &description) const qreal &kheight, const QString &description)
{ {
@ -640,6 +656,7 @@ void DialogIncrements::AddIncrementToFile(const quint32 &id, const QString &name
list.at(0).appendChild(element); list.at(0).appendChild(element);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::IncrementChanged ( qint32 row, qint32 column ) void DialogIncrements::IncrementChanged ( qint32 row, qint32 column )
{ {
@ -694,6 +711,7 @@ void DialogIncrements::IncrementChanged ( qint32 row, qint32 column )
emit haveLiteChange(); emit haveLiteChange();
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::MeasurementChanged(qint32 row, qint32 column) void DialogIncrements::MeasurementChanged(qint32 row, qint32 column)
{ {
switch (column) switch (column)
@ -740,12 +758,14 @@ void DialogIncrements::MeasurementChanged(qint32 row, qint32 column)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::closeEvent(QCloseEvent *event) void DialogIncrements::closeEvent(QCloseEvent *event)
{ {
emit DialogClosed(QDialog::Accepted); emit DialogClosed(QDialog::Accepted);
event->accept(); event->accept();
} }
//---------------------------------------------------------------------------------------------------------------------
DialogIncrements::~DialogIncrements() DialogIncrements::~DialogIncrements()
{ {
delete ui; delete ui;

View File

@ -36,6 +36,7 @@
#include "../../widgets/vapplication.h" #include "../../widgets/vapplication.h"
#include <QPushButton> #include <QPushButton>
//---------------------------------------------------------------------------------------------------------------------
DialogIndividualMeasurements::DialogIndividualMeasurements(VContainer *data, const QString &patternPieceName, DialogIndividualMeasurements::DialogIndividualMeasurements(VContainer *data, const QString &patternPieceName,
QWidget *parent) : QWidget *parent) :
QDialog(parent), ui(new Ui::DialogIndividualMeasurements), _name(patternPieceName), _tablePath(QString()), QDialog(parent), ui(new Ui::DialogIndividualMeasurements), _name(patternPieceName), _tablePath(QString()),
@ -67,11 +68,13 @@ DialogIndividualMeasurements::DialogIndividualMeasurements(VContainer *data, con
connect(ui->toolButtonOpenNew, &QToolButton::clicked, this, &DialogIndividualMeasurements::NewTable); connect(ui->toolButtonOpenNew, &QToolButton::clicked, this, &DialogIndividualMeasurements::NewTable);
} }
//---------------------------------------------------------------------------------------------------------------------
DialogIndividualMeasurements::~DialogIndividualMeasurements() DialogIndividualMeasurements::~DialogIndividualMeasurements()
{ {
delete ui; delete ui;
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogIndividualMeasurements::DialogAccepted() void DialogIndividualMeasurements::DialogAccepted()
{ {
_name = ui->lineEditName->text(); _name = ui->lineEditName->text();
@ -125,6 +128,7 @@ void DialogIndividualMeasurements::DialogAccepted()
accept(); accept();
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogIndividualMeasurements::DialogRejected() void DialogIndividualMeasurements::DialogRejected()
{ {
_name.clear(); _name.clear();
@ -132,6 +136,7 @@ void DialogIndividualMeasurements::DialogRejected()
reject(); reject();
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogIndividualMeasurements::CheckState() void DialogIndividualMeasurements::CheckState()
{ {
bool flagName = false; bool flagName = false;
@ -187,6 +192,7 @@ void DialogIndividualMeasurements::CheckState()
bOk->setEnabled(flagName && flagPath && flagLang); bOk->setEnabled(flagName && flagPath && flagLang);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogIndividualMeasurements::LoadIndividualTables() void DialogIndividualMeasurements::LoadIndividualTables()
{ {
QStringList filters; QStringList filters;
@ -236,6 +242,7 @@ void DialogIndividualMeasurements::LoadIndividualTables()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogIndividualMeasurements::OpenTable() void DialogIndividualMeasurements::OpenTable()
{ {
const QString filter(tr("Individual measurements (*.vit)")); const QString filter(tr("Individual measurements (*.vit)"));
@ -259,6 +266,7 @@ void DialogIndividualMeasurements::OpenTable()
CheckState(); CheckState();
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogIndividualMeasurements::NewTable() void DialogIndividualMeasurements::NewTable()
{ {
QString dir = QDir::homePath()+"/measurements.vit"; QString dir = QDir::homePath()+"/measurements.vit";
@ -281,6 +289,7 @@ void DialogIndividualMeasurements::NewTable()
CheckState(); CheckState();
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogIndividualMeasurements::InitUnits() void DialogIndividualMeasurements::InitUnits()
{ {
ui->comboBoxUnits->addItem(tr("centimeter"), QVariant(VDomDocument::UnitsToStr(Valentina::Cm))); ui->comboBoxUnits->addItem(tr("centimeter"), QVariant(VDomDocument::UnitsToStr(Valentina::Cm)));

View File

@ -29,6 +29,7 @@
#include "dialogmeasurements.h" #include "dialogmeasurements.h"
#include "ui_dialogmeasurements.h" #include "ui_dialogmeasurements.h"
//---------------------------------------------------------------------------------------------------------------------
DialogMeasurements::DialogMeasurements(QWidget *parent) : DialogMeasurements::DialogMeasurements(QWidget *parent) :
QDialog(parent), ui(new Ui::DialogMeasurements), result(Measurements::Individual) QDialog(parent), ui(new Ui::DialogMeasurements), result(Measurements::Individual)
{ {
@ -37,22 +38,26 @@ DialogMeasurements::DialogMeasurements(QWidget *parent) :
connect(ui->toolButtonIndividual, &QToolButton::clicked, this, &DialogMeasurements::IndividualMeasurements); connect(ui->toolButtonIndividual, &QToolButton::clicked, this, &DialogMeasurements::IndividualMeasurements);
} }
//---------------------------------------------------------------------------------------------------------------------
DialogMeasurements::~DialogMeasurements() DialogMeasurements::~DialogMeasurements()
{ {
delete ui; delete ui;
} }
//---------------------------------------------------------------------------------------------------------------------
Measurements::Type DialogMeasurements::type() const Measurements::Type DialogMeasurements::type() const
{ {
return result; return result;
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogMeasurements::StandardMeasurements() void DialogMeasurements::StandardMeasurements()
{ {
result = Measurements::Standard; result = Measurements::Standard;
accept(); accept();
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogMeasurements::IndividualMeasurements() void DialogMeasurements::IndividualMeasurements()
{ {
result = Measurements::Individual; result = Measurements::Individual;

View File

@ -31,6 +31,7 @@
#include <QSettings> #include <QSettings>
#include <QPushButton> #include <QPushButton>
//---------------------------------------------------------------------------------------------------------------------
DialogPatternProperties::DialogPatternProperties(VPattern *doc, QWidget *parent) : DialogPatternProperties::DialogPatternProperties(VPattern *doc, QWidget *parent) :
QDialog(parent), ui(new Ui::DialogPatternProperties), doc(doc) QDialog(parent), ui(new Ui::DialogPatternProperties), doc(doc)
{ {
@ -61,11 +62,13 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, QWidget *parent)
connect(this, &DialogPatternProperties::haveChange, this->doc, &VPattern::haveLiteChange); connect(this, &DialogPatternProperties::haveChange, this->doc, &VPattern::haveLiteChange);
} }
//---------------------------------------------------------------------------------------------------------------------
DialogPatternProperties::~DialogPatternProperties() DialogPatternProperties::~DialogPatternProperties()
{ {
delete ui; delete ui;
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogPatternProperties::Apply() void DialogPatternProperties::Apply()
{ {
Write("notes", ui->plainTextEditTechNotes->document()->toPlainText()); Write("notes", ui->plainTextEditTechNotes->document()->toPlainText());
@ -75,6 +78,7 @@ void DialogPatternProperties::Apply()
close(); close();
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogPatternProperties::Write(const QString &tagName, const QString &text) const void DialogPatternProperties::Write(const QString &tagName, const QString &text) const
{ {
QDomNodeList nodeList = doc->elementsByTagName(tagName); QDomNodeList nodeList = doc->elementsByTagName(tagName);

View File

@ -33,6 +33,7 @@
#include "../../widgets/vapplication.h" #include "../../widgets/vapplication.h"
#include <QPushButton> #include <QPushButton>
//---------------------------------------------------------------------------------------------------------------------
DialogStandardMeasurements::DialogStandardMeasurements(VContainer *data, const QString &patternPieceName, DialogStandardMeasurements::DialogStandardMeasurements(VContainer *data, const QString &patternPieceName,
QWidget *parent) : QWidget *parent) :
QDialog(parent), ui(new Ui::DialogStandardMeasurements), data(data), _name(patternPieceName), _tablePath(QString()) QDialog(parent), ui(new Ui::DialogStandardMeasurements), data(data), _name(patternPieceName), _tablePath(QString())
@ -58,21 +59,25 @@ DialogStandardMeasurements::DialogStandardMeasurements(VContainer *data, const Q
connect(ui->lineEditName, &QLineEdit::textChanged, this, &DialogStandardMeasurements::CheckState); connect(ui->lineEditName, &QLineEdit::textChanged, this, &DialogStandardMeasurements::CheckState);
} }
//---------------------------------------------------------------------------------------------------------------------
DialogStandardMeasurements::~DialogStandardMeasurements() DialogStandardMeasurements::~DialogStandardMeasurements()
{ {
delete ui; delete ui;
} }
//---------------------------------------------------------------------------------------------------------------------
QString DialogStandardMeasurements::name() const QString DialogStandardMeasurements::name() const
{ {
return _name; return _name;
} }
//---------------------------------------------------------------------------------------------------------------------
QString DialogStandardMeasurements::tablePath() const QString DialogStandardMeasurements::tablePath() const
{ {
return _tablePath; return _tablePath;
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogStandardMeasurements::DialogAccepted() void DialogStandardMeasurements::DialogAccepted()
{ {
_name = ui->lineEditName->text(); _name = ui->lineEditName->text();
@ -96,6 +101,7 @@ void DialogStandardMeasurements::DialogAccepted()
accept(); accept();
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogStandardMeasurements::DialogRejected() void DialogStandardMeasurements::DialogRejected()
{ {
_name.clear(); _name.clear();
@ -103,6 +109,7 @@ void DialogStandardMeasurements::DialogRejected()
reject(); reject();
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogStandardMeasurements::CheckState() void DialogStandardMeasurements::CheckState()
{ {
bool flagName = false; bool flagName = false;
@ -126,6 +133,7 @@ void DialogStandardMeasurements::CheckState()
bOk->setEnabled(flagTable && flagName); bOk->setEnabled(flagTable && flagName);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogStandardMeasurements::LoadStandardTables() void DialogStandardMeasurements::LoadStandardTables()
{ {
QStringList filters; QStringList filters;

View File

@ -30,6 +30,7 @@
#include "../../options.h" #include "../../options.h"
#include "../../widgets/vapplication.h" #include "../../widgets/vapplication.h"
//---------------------------------------------------------------------------------------------------------------------
ConfigurationPage::ConfigurationPage(QWidget *parent): ConfigurationPage::ConfigurationPage(QWidget *parent):
QWidget(parent), autoSaveCheck(0), autoTime(0), langCombo(0), osOptionCheck(0), langChanged(false) QWidget(parent), autoSaveCheck(0), autoTime(0), langCombo(0), osOptionCheck(0), langChanged(false)
{ {
@ -43,6 +44,7 @@ ConfigurationPage::ConfigurationPage(QWidget *parent):
setLayout(mainLayout); setLayout(mainLayout);
} }
//---------------------------------------------------------------------------------------------------------------------
void ConfigurationPage::Apply() void ConfigurationPage::Apply()
{ {
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(), QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
@ -61,11 +63,13 @@ void ConfigurationPage::Apply()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void ConfigurationPage::LangChenged() void ConfigurationPage::LangChenged()
{ {
langChanged = true; langChanged = true;
} }
//---------------------------------------------------------------------------------------------------------------------
QGroupBox *ConfigurationPage::SaveGroup() QGroupBox *ConfigurationPage::SaveGroup()
{ {
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(), QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
@ -101,6 +105,7 @@ QGroupBox *ConfigurationPage::SaveGroup()
return saveGroup; return saveGroup;
} }
//---------------------------------------------------------------------------------------------------------------------
QGroupBox *ConfigurationPage::LangGroup() QGroupBox *ConfigurationPage::LangGroup()
{ {
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(), QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
@ -168,7 +173,7 @@ QGroupBox *ConfigurationPage::LangGroup()
return langGroup; return langGroup;
} }
//---------------------------------------------------------------------------------------------------------------------
PatternPage::PatternPage(QWidget *parent): PatternPage::PatternPage(QWidget *parent):
QWidget(parent), userName(0), graphOutputCheck(0), undoneCount(0) QWidget(parent), userName(0), graphOutputCheck(0), undoneCount(0)
{ {
@ -184,6 +189,7 @@ PatternPage::PatternPage(QWidget *parent):
setLayout(mainLayout); setLayout(mainLayout);
} }
//---------------------------------------------------------------------------------------------------------------------
void PatternPage::Apply() void PatternPage::Apply()
{ {
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(), QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
@ -193,6 +199,7 @@ void PatternPage::Apply()
settings.setValue("pattern/undone", undoneCount->value()); settings.setValue("pattern/undone", undoneCount->value());
} }
//---------------------------------------------------------------------------------------------------------------------
QGroupBox *PatternPage::UserGroup() QGroupBox *PatternPage::UserGroup()
{ {
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(), QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
@ -219,6 +226,7 @@ QGroupBox *PatternPage::UserGroup()
return userGroup; return userGroup;
} }
//---------------------------------------------------------------------------------------------------------------------
QGroupBox *PatternPage::GraphOutputGroup() QGroupBox *PatternPage::GraphOutputGroup()
{ {
// QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(), // QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
@ -240,6 +248,7 @@ QGroupBox *PatternPage::GraphOutputGroup()
return graphOutputGroup; return graphOutputGroup;
} }
//---------------------------------------------------------------------------------------------------------------------
QGroupBox *PatternPage::UndoneGroup() QGroupBox *PatternPage::UndoneGroup()
{ {
// QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(), // QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),

View File

@ -31,6 +31,7 @@
#include <QPushButton> #include <QPushButton>
//---------------------------------------------------------------------------------------------------------------------
DialogAlongLine::DialogAlongLine(const VContainer *data, QWidget *parent) DialogAlongLine::DialogAlongLine(const VContainer *data, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogAlongLine), number(0), pointName(QString()), :DialogTool(data, parent), ui(new Ui::DialogAlongLine), number(0), pointName(QString()),
typeLine(QString()), formula(QString()), firstPointId(0), secondPointId(0) typeLine(QString()), formula(QString()), firstPointId(0), secondPointId(0)
@ -59,11 +60,13 @@ DialogAlongLine::DialogAlongLine(const VContainer *data, QWidget *parent)
connect(listWidget, &QListWidget::itemDoubleClicked, this, &DialogTool::PutVal); connect(listWidget, &QListWidget::itemDoubleClicked, this, &DialogTool::PutVal);
} }
//---------------------------------------------------------------------------------------------------------------------
DialogAlongLine::~DialogAlongLine() DialogAlongLine::~DialogAlongLine()
{ {
delete ui; delete ui;
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogAlongLine::ChoosedObject(quint32 id, const Valentina::Scenes &type) void DialogAlongLine::ChoosedObject(quint32 id, const Valentina::Scenes &type)
{ {
if (type == Valentina::Point) if (type == Valentina::Point)
@ -90,6 +93,7 @@ void DialogAlongLine::ChoosedObject(quint32 id, const Valentina::Scenes &type)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogAlongLine::DialogAccepted() void DialogAlongLine::DialogAccepted()
{ {
pointName = ui->lineEditNamePoint->text(); pointName = ui->lineEditNamePoint->text();
@ -100,28 +104,33 @@ void DialogAlongLine::DialogAccepted()
emit DialogClosed(QDialog::Accepted); emit DialogClosed(QDialog::Accepted);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogAlongLine::setSecondPointId(const quint32 &value, const quint32 &id) void DialogAlongLine::setSecondPointId(const quint32 &value, const quint32 &id)
{ {
setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id); setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogAlongLine::setFirstPointId(const quint32 &value, const quint32 &id) void DialogAlongLine::setFirstPointId(const quint32 &value, const quint32 &id)
{ {
setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id); setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogAlongLine::setFormula(const QString &value) void DialogAlongLine::setFormula(const QString &value)
{ {
formula = value; formula = value;
ui->lineEditFormula->setText(formula); ui->lineEditFormula->setText(formula);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogAlongLine::setTypeLine(const QString &value) void DialogAlongLine::setTypeLine(const QString &value)
{ {
typeLine = value; typeLine = value;
SetupTypeLine(ui->comboBoxLineType, value); SetupTypeLine(ui->comboBoxLineType, value);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogAlongLine::setPointName(const QString &value) void DialogAlongLine::setPointName(const QString &value)
{ {
pointName = value; pointName = value;

View File

@ -32,6 +32,7 @@
#include <QPushButton> #include <QPushButton>
#include <QtWidgets> #include <QtWidgets>
//---------------------------------------------------------------------------------------------------------------------
DialogArc::DialogArc(const VContainer *data, QWidget *parent) DialogArc::DialogArc(const VContainer *data, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogArc), flagRadius(false), flagF1(false), flagF2(false), :DialogTool(data, parent), ui(new Ui::DialogArc), flagRadius(false), flagF1(false), flagF2(false),
timerRadius(nullptr), timerF1(nullptr), timerF2(nullptr), center(0), radius(QString()), f1(QString()), f2(QString()) timerRadius(nullptr), timerF1(nullptr), timerF2(nullptr), center(0), radius(QString()), f1(QString()), f2(QString())
@ -68,35 +69,41 @@ DialogArc::DialogArc(const VContainer *data, QWidget *parent)
connect(ui->lineEditF2, &QLineEdit::textChanged, this, &DialogArc::F2Changed); connect(ui->lineEditF2, &QLineEdit::textChanged, this, &DialogArc::F2Changed);
} }
//---------------------------------------------------------------------------------------------------------------------
DialogArc::~DialogArc() DialogArc::~DialogArc()
{ {
delete ui; delete ui;
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::SetCenter(const quint32 &value) void DialogArc::SetCenter(const quint32 &value)
{ {
center = value; center = value;
ChangeCurrentData(ui->comboBoxBasePoint, center); ChangeCurrentData(ui->comboBoxBasePoint, center);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::SetF2(const QString &value) void DialogArc::SetF2(const QString &value)
{ {
f2 = value; f2 = value;
ui->lineEditF2->setText(f2); ui->lineEditF2->setText(f2);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::SetF1(const QString &value) void DialogArc::SetF1(const QString &value)
{ {
f1 = value; f1 = value;
ui->lineEditF1->setText(f1); ui->lineEditF1->setText(f1);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::SetRadius(const QString &value) void DialogArc::SetRadius(const QString &value)
{ {
radius = value; radius = value;
ui->lineEditRadius->setText(radius); ui->lineEditRadius->setText(radius);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::ChoosedObject(quint32 id, const Valentina::Scenes &type) void DialogArc::ChoosedObject(quint32 id, const Valentina::Scenes &type)
{ {
if (type == Valentina::Point) if (type == Valentina::Point)
@ -109,6 +116,7 @@ void DialogArc::ChoosedObject(quint32 id, const Valentina::Scenes &type)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::DialogAccepted() void DialogArc::DialogAccepted()
{ {
radius = ui->lineEditRadius->text(); radius = ui->lineEditRadius->text();
@ -118,6 +126,7 @@ void DialogArc::DialogAccepted()
emit DialogClosed(QDialog::Accepted); emit DialogClosed(QDialog::Accepted);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::ValChenged(int row) void DialogArc::ValChenged(int row)
{ {
if (ui->listWidget->count() == 0) if (ui->listWidget->count() == 0)
@ -135,68 +144,80 @@ void DialogArc::ValChenged(int row)
DialogTool::ValChenged(row); DialogTool::ValChenged(row);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::PutRadius() void DialogArc::PutRadius()
{ {
PutValHere(ui->lineEditRadius, ui->listWidget); PutValHere(ui->lineEditRadius, ui->listWidget);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::PutF1() void DialogArc::PutF1()
{ {
PutValHere(ui->lineEditF1, ui->listWidget); PutValHere(ui->lineEditF1, ui->listWidget);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::PutF2() void DialogArc::PutF2()
{ {
PutValHere(ui->lineEditF2, ui->listWidget); PutValHere(ui->lineEditF2, ui->listWidget);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::LineAngles() void DialogArc::LineAngles()
{ {
ShowLineAngles(); ShowLineAngles();
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::RadiusChanged() void DialogArc::RadiusChanged()
{ {
labelEditFormula = ui->labelEditRadius; labelEditFormula = ui->labelEditRadius;
ValFormulaChanged(flagRadius, ui->lineEditRadius, timerRadius); ValFormulaChanged(flagRadius, ui->lineEditRadius, timerRadius);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::F1Changed() void DialogArc::F1Changed()
{ {
labelEditFormula = ui->labelEditF1; labelEditFormula = ui->labelEditF1;
ValFormulaChanged(flagF1, ui->lineEditF1, timerF1); ValFormulaChanged(flagF1, ui->lineEditF1, timerF1);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::F2Changed() void DialogArc::F2Changed()
{ {
labelEditFormula = ui->labelEditF2; labelEditFormula = ui->labelEditF2;
ValFormulaChanged(flagF2, ui->lineEditF2, timerF2); ValFormulaChanged(flagF2, ui->lineEditF2, timerF2);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::CheckState() void DialogArc::CheckState()
{ {
Q_CHECK_PTR(bOk); Q_CHECK_PTR(bOk);
bOk->setEnabled(flagRadius && flagF1 && flagF2); bOk->setEnabled(flagRadius && flagF1 && flagF2);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::EvalRadius() void DialogArc::EvalRadius()
{ {
labelEditFormula = ui->labelEditRadius; labelEditFormula = ui->labelEditRadius;
Eval(ui->lineEditRadius, flagRadius, timerRadius, ui->labelResultRadius); Eval(ui->lineEditRadius, flagRadius, timerRadius, ui->labelResultRadius);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::EvalF1() void DialogArc::EvalF1()
{ {
labelEditFormula = ui->labelEditF1; labelEditFormula = ui->labelEditF1;
Eval(ui->lineEditF1, flagF1, timerF1, ui->labelResultF1); Eval(ui->lineEditF1, flagF1, timerF1, ui->labelResultF1);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::EvalF2() void DialogArc::EvalF2()
{ {
labelEditFormula = ui->labelEditF2; labelEditFormula = ui->labelEditF2;
Eval(ui->lineEditF2, flagF2, timerF2, ui->labelResultF2); Eval(ui->lineEditF2, flagF2, timerF2, ui->labelResultF2);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::ShowLineAngles() void DialogArc::ShowLineAngles()
{ {
disconnect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged); disconnect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged);

View File

@ -31,6 +31,7 @@
#include <QPushButton> #include <QPushButton>
//---------------------------------------------------------------------------------------------------------------------
DialogBisector::DialogBisector(const VContainer *data, QWidget *parent) DialogBisector::DialogBisector(const VContainer *data, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogBisector), number(0), pointName(QString()), :DialogTool(data, parent), ui(new Ui::DialogBisector), number(0), pointName(QString()),
typeLine(QString()), formula(QString()), firstPointId(0), secondPointId(0), thirdPointId(0) typeLine(QString()), formula(QString()), firstPointId(0), secondPointId(0), thirdPointId(0)
@ -59,11 +60,13 @@ DialogBisector::DialogBisector(const VContainer *data, QWidget *parent)
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogBisector::FormulaChanged); connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogBisector::FormulaChanged);
} }
//---------------------------------------------------------------------------------------------------------------------
DialogBisector::~DialogBisector() DialogBisector::~DialogBisector()
{ {
delete ui; delete ui;
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogBisector::ChoosedObject(quint32 id, const Valentina::Scenes &type) void DialogBisector::ChoosedObject(quint32 id, const Valentina::Scenes &type)
{ {
if (type == Valentina::Point) if (type == Valentina::Point)
@ -108,39 +111,46 @@ void DialogBisector::ChoosedObject(quint32 id, const Valentina::Scenes &type)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogBisector::setPointName(const QString &value) void DialogBisector::setPointName(const QString &value)
{ {
pointName = value; pointName = value;
ui->lineEditNamePoint->setText(pointName); ui->lineEditNamePoint->setText(pointName);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogBisector::setTypeLine(const QString &value) void DialogBisector::setTypeLine(const QString &value)
{ {
typeLine = value; typeLine = value;
SetupTypeLine(ui->comboBoxLineType, value); SetupTypeLine(ui->comboBoxLineType, value);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogBisector::setFormula(const QString &value) void DialogBisector::setFormula(const QString &value)
{ {
formula = value; formula = value;
ui->lineEditFormula->setText(formula); ui->lineEditFormula->setText(formula);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogBisector::setFirstPointId(const quint32 &value, const quint32 &id) void DialogBisector::setFirstPointId(const quint32 &value, const quint32 &id)
{ {
setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id); setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogBisector::setSecondPointId(const quint32 &value, const quint32 &id) void DialogBisector::setSecondPointId(const quint32 &value, const quint32 &id)
{ {
setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id); setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogBisector::setThirdPointId(const quint32 &value, const quint32 &id) void DialogBisector::setThirdPointId(const quint32 &value, const quint32 &id)
{ {
setCurrentPointId(ui->comboBoxThirdPoint, thirdPointId, value, id); setCurrentPointId(ui->comboBoxThirdPoint, thirdPointId, value, id);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogBisector::DialogAccepted() void DialogBisector::DialogAccepted()
{ {
pointName = ui->lineEditNamePoint->text(); pointName = ui->lineEditNamePoint->text();

View File

@ -29,6 +29,7 @@
#include "dialogcutarc.h" #include "dialogcutarc.h"
#include "ui_dialogcutarc.h" #include "ui_dialogcutarc.h"
//---------------------------------------------------------------------------------------------------------------------
DialogCutArc::DialogCutArc(const VContainer *data, QWidget *parent) : DialogCutArc::DialogCutArc(const VContainer *data, QWidget *parent) :
DialogTool(data, parent), ui(new Ui::DialogCutArc), pointName(QString()), formula(QString()), arcId(0) DialogTool(data, parent), ui(new Ui::DialogCutArc), pointName(QString()), formula(QString()), arcId(0)
{ {
@ -54,11 +55,13 @@ DialogCutArc::DialogCutArc(const VContainer *data, QWidget *parent) :
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogCutArc::FormulaChanged); connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogCutArc::FormulaChanged);
} }
//---------------------------------------------------------------------------------------------------------------------
DialogCutArc::~DialogCutArc() DialogCutArc::~DialogCutArc()
{ {
delete ui; delete ui;
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogCutArc::ChoosedObject(quint32 id, const Valentina::Scenes &type) void DialogCutArc::ChoosedObject(quint32 id, const Valentina::Scenes &type)
{ {
if (type == Valentina::Arc) if (type == Valentina::Arc)
@ -70,6 +73,7 @@ void DialogCutArc::ChoosedObject(quint32 id, const Valentina::Scenes &type)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogCutArc::DialogAccepted() void DialogCutArc::DialogAccepted()
{ {
pointName = ui->lineEditNamePoint->text(); pointName = ui->lineEditNamePoint->text();
@ -78,17 +82,20 @@ void DialogCutArc::DialogAccepted()
emit DialogClosed(QDialog::Accepted); emit DialogClosed(QDialog::Accepted);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogCutArc::setArcId(const quint32 &value, const quint32 &id) void DialogCutArc::setArcId(const quint32 &value, const quint32 &id)
{ {
setCurrentArcId(ui->comboBoxArc, arcId, value, id, ComboMode::CutArc); setCurrentArcId(ui->comboBoxArc, arcId, value, id, ComboMode::CutArc);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogCutArc::setFormula(const QString &value) void DialogCutArc::setFormula(const QString &value)
{ {
formula = value; formula = value;
ui->lineEditFormula->setText(formula); ui->lineEditFormula->setText(formula);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogCutArc::setPointName(const QString &value) void DialogCutArc::setPointName(const QString &value)
{ {
pointName = value; pointName = value;

View File

@ -29,6 +29,7 @@
#include "dialogcutspline.h" #include "dialogcutspline.h"
#include "ui_dialogcutspline.h" #include "ui_dialogcutspline.h"
//---------------------------------------------------------------------------------------------------------------------
DialogCutSpline::DialogCutSpline(const VContainer *data, QWidget *parent) DialogCutSpline::DialogCutSpline(const VContainer *data, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogCutSpline), pointName(QString()), formula(QString()), splineId(0) :DialogTool(data, parent), ui(new Ui::DialogCutSpline), pointName(QString()), formula(QString()), splineId(0)
{ {
@ -53,28 +54,33 @@ DialogCutSpline::DialogCutSpline(const VContainer *data, QWidget *parent)
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogCutSpline::FormulaChanged); connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogCutSpline::FormulaChanged);
} }
//---------------------------------------------------------------------------------------------------------------------
DialogCutSpline::~DialogCutSpline() DialogCutSpline::~DialogCutSpline()
{ {
delete ui; delete ui;
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogCutSpline::setPointName(const QString &value) void DialogCutSpline::setPointName(const QString &value)
{ {
pointName = value; pointName = value;
ui->lineEditNamePoint->setText(pointName); ui->lineEditNamePoint->setText(pointName);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogCutSpline::setFormula(const QString &value) void DialogCutSpline::setFormula(const QString &value)
{ {
formula = value; formula = value;
ui->lineEditFormula->setText(formula); ui->lineEditFormula->setText(formula);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogCutSpline::setSplineId(const quint32 &value, const quint32 &id) void DialogCutSpline::setSplineId(const quint32 &value, const quint32 &id)
{ {
setCurrentSplineId(ui->comboBoxSpline, splineId, value, id, ComboMode::CutSpline); setCurrentSplineId(ui->comboBoxSpline, splineId, value, id, ComboMode::CutSpline);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogCutSpline::ChoosedObject(quint32 id, const Valentina::Scenes &type) void DialogCutSpline::ChoosedObject(quint32 id, const Valentina::Scenes &type)
{ {
if (type == Valentina::Spline) if (type == Valentina::Spline)
@ -86,6 +92,7 @@ void DialogCutSpline::ChoosedObject(quint32 id, const Valentina::Scenes &type)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogCutSpline::DialogAccepted() void DialogCutSpline::DialogAccepted()
{ {
pointName = ui->lineEditNamePoint->text(); pointName = ui->lineEditNamePoint->text();

View File

@ -29,6 +29,7 @@
#include "dialogcutsplinepath.h" #include "dialogcutsplinepath.h"
#include "ui_dialogcutsplinepath.h" #include "ui_dialogcutsplinepath.h"
//---------------------------------------------------------------------------------------------------------------------
DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, QWidget *parent) DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogCutSplinePath), pointName(QString()), formula(QString()), :DialogTool(data, parent), ui(new Ui::DialogCutSplinePath), pointName(QString()), formula(QString()),
splinePathId(0) splinePathId(0)
@ -54,28 +55,33 @@ DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, QWidget *parent
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogCutSplinePath::FormulaChanged); connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogCutSplinePath::FormulaChanged);
} }
//---------------------------------------------------------------------------------------------------------------------
DialogCutSplinePath::~DialogCutSplinePath() DialogCutSplinePath::~DialogCutSplinePath()
{ {
delete ui; delete ui;
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogCutSplinePath::setPointName(const QString &value) void DialogCutSplinePath::setPointName(const QString &value)
{ {
pointName = value; pointName = value;
ui->lineEditNamePoint->setText(pointName); ui->lineEditNamePoint->setText(pointName);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogCutSplinePath::setFormula(const QString &value) void DialogCutSplinePath::setFormula(const QString &value)
{ {
formula = value; formula = value;
ui->lineEditFormula->setText(formula); ui->lineEditFormula->setText(formula);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogCutSplinePath::setSplinePathId(const quint32 &value, const quint32 &id) void DialogCutSplinePath::setSplinePathId(const quint32 &value, const quint32 &id)
{ {
setCurrentSplinePathId(ui->comboBoxSplinePath, splinePathId, value, id, ComboMode::CutSpline); setCurrentSplinePathId(ui->comboBoxSplinePath, splinePathId, value, id, ComboMode::CutSpline);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogCutSplinePath::ChoosedObject(quint32 id, const Valentina::Scenes &type) void DialogCutSplinePath::ChoosedObject(quint32 id, const Valentina::Scenes &type)
{ {
if (type == Valentina::SplinePath) if (type == Valentina::SplinePath)
@ -87,6 +93,7 @@ void DialogCutSplinePath::ChoosedObject(quint32 id, const Valentina::Scenes &typ
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogCutSplinePath::DialogAccepted() void DialogCutSplinePath::DialogAccepted()
{ {
pointName = ui->lineEditNamePoint->text(); pointName = ui->lineEditNamePoint->text();

View File

@ -31,6 +31,7 @@
#include <QPushButton> #include <QPushButton>
#include <QDebug> #include <QDebug>
//---------------------------------------------------------------------------------------------------------------------
DialogDetail::DialogDetail(const VContainer *data, QWidget *parent) DialogDetail::DialogDetail(const VContainer *data, QWidget *parent)
:DialogTool(data, parent), ui(), details(VDetail()), supplement(true), closed(true) :DialogTool(data, parent), ui(), details(VDetail()), supplement(true), closed(true)
{ {
@ -62,6 +63,7 @@ DialogDetail::DialogDetail(const VContainer *data, QWidget *parent)
connect(ui.toolButtonDelete, &QToolButton::clicked, this, &DialogDetail::DeleteItem); connect(ui.toolButtonDelete, &QToolButton::clicked, this, &DialogDetail::DeleteItem);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogDetail::ChoosedObject(quint32 id, const Valentina::Scenes &type) void DialogDetail::ChoosedObject(quint32 id, const Valentina::Scenes &type)
{ {
if (type != Valentina::Line && type != Valentina::Detail) if (type != Valentina::Line && type != Valentina::Detail)
@ -89,6 +91,7 @@ void DialogDetail::ChoosedObject(quint32 id, const Valentina::Scenes &type)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogDetail::DialogAccepted() void DialogDetail::DialogAccepted()
{ {
details.Clear(); details.Clear();
@ -105,6 +108,7 @@ void DialogDetail::DialogAccepted()
emit DialogClosed(QDialog::Accepted); emit DialogClosed(QDialog::Accepted);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogDetail::NewItem(quint32 id, const Valentina::Tools &typeTool, const NodeDetail::NodeDetails &typeNode, void DialogDetail::NewItem(quint32 id, const Valentina::Tools &typeTool, const NodeDetail::NodeDetails &typeNode,
qreal mx, qreal my) qreal mx, qreal my)
{ {
@ -158,6 +162,7 @@ void DialogDetail::NewItem(quint32 id, const Valentina::Tools &typeTool, const N
this, &DialogDetail::BiasYChanged); this, &DialogDetail::BiasYChanged);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogDetail::setDetails(const VDetail &value) void DialogDetail::setDetails(const VDetail &value)
{ {
details = value; details = value;
@ -178,6 +183,7 @@ void DialogDetail::setDetails(const VDetail &value)
ui.toolButtonDelete->setEnabled(true); ui.toolButtonDelete->setEnabled(true);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogDetail::BiasXChanged(qreal d) void DialogDetail::BiasXChanged(qreal d)
{ {
qint32 row = ui.listWidget->currentRow(); qint32 row = ui.listWidget->currentRow();
@ -188,6 +194,7 @@ void DialogDetail::BiasXChanged(qreal d)
item->setData(Qt::UserRole, QVariant::fromValue(node)); item->setData(Qt::UserRole, QVariant::fromValue(node));
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogDetail::BiasYChanged(qreal d) void DialogDetail::BiasYChanged(qreal d)
{ {
qint32 row = ui.listWidget->currentRow(); qint32 row = ui.listWidget->currentRow();
@ -198,6 +205,7 @@ void DialogDetail::BiasYChanged(qreal d)
item->setData(Qt::UserRole, QVariant::fromValue(node)); item->setData(Qt::UserRole, QVariant::fromValue(node));
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogDetail::ClickedSeams(bool checked) void DialogDetail::ClickedSeams(bool checked)
{ {
supplement = checked; supplement = checked;
@ -205,11 +213,13 @@ void DialogDetail::ClickedSeams(bool checked)
ui.spinBoxSeams->setEnabled(checked); ui.spinBoxSeams->setEnabled(checked);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogDetail::ClickedClosed(bool checked) void DialogDetail::ClickedClosed(bool checked)
{ {
closed = checked; closed = checked;
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogDetail::ObjectChanged(int row) void DialogDetail::ObjectChanged(int row)
{ {
if (ui.listWidget->count() == 0) if (ui.listWidget->count() == 0)
@ -222,6 +232,7 @@ void DialogDetail::ObjectChanged(int row)
ui.spinBoxBiasY->setValue(static_cast<qint32>(qApp->fromPixel(node.getMy()))); ui.spinBoxBiasY->setValue(static_cast<qint32>(qApp->fromPixel(node.getMy())));
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogDetail::DeleteItem() void DialogDetail::DeleteItem()
{ {
qint32 row = ui.listWidget->currentRow(); qint32 row = ui.listWidget->currentRow();

View File

@ -31,6 +31,7 @@
#include <QPushButton> #include <QPushButton>
//---------------------------------------------------------------------------------------------------------------------
DialogEndLine::DialogEndLine(const VContainer *data, QWidget *parent) DialogEndLine::DialogEndLine(const VContainer *data, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogEndLine), pointName(QString()), typeLine(QString()), :DialogTool(data, parent), ui(new Ui::DialogEndLine), pointName(QString()), typeLine(QString()),
formula(QString()), angle(0), basePointId(0) formula(QString()), angle(0), basePointId(0)
@ -59,6 +60,7 @@ DialogEndLine::DialogEndLine(const VContainer *data, QWidget *parent)
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogEndLine::FormulaChanged); connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogEndLine::FormulaChanged);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogEndLine::ChoosedObject(quint32 id, const Valentina::Scenes &type) void DialogEndLine::ChoosedObject(quint32 id, const Valentina::Scenes &type)
{ {
if (type == Valentina::Point) if (type == Valentina::Point)
@ -70,35 +72,41 @@ void DialogEndLine::ChoosedObject(quint32 id, const Valentina::Scenes &type)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogEndLine::setPointName(const QString &value) void DialogEndLine::setPointName(const QString &value)
{ {
pointName = value; pointName = value;
ui->lineEditNamePoint->setText(pointName); ui->lineEditNamePoint->setText(pointName);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogEndLine::setTypeLine(const QString &value) void DialogEndLine::setTypeLine(const QString &value)
{ {
typeLine = value; typeLine = value;
SetupTypeLine(ui->comboBoxLineType, value); SetupTypeLine(ui->comboBoxLineType, value);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogEndLine::setFormula(const QString &value) void DialogEndLine::setFormula(const QString &value)
{ {
formula = value; formula = value;
ui->lineEditFormula->setText(formula); ui->lineEditFormula->setText(formula);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogEndLine::setAngle(const qreal &value) void DialogEndLine::setAngle(const qreal &value)
{ {
angle = value; angle = value;
ui->doubleSpinBoxAngle->setValue(angle); ui->doubleSpinBoxAngle->setValue(angle);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogEndLine::setBasePointId(const quint32 &value, const quint32 &id) void DialogEndLine::setBasePointId(const quint32 &value, const quint32 &id)
{ {
setCurrentPointId(ui->comboBoxBasePoint, basePointId, value, id); setCurrentPointId(ui->comboBoxBasePoint, basePointId, value, id);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogEndLine::DialogAccepted() void DialogEndLine::DialogAccepted()
{ {
pointName = ui->lineEditNamePoint->text(); pointName = ui->lineEditNamePoint->text();
@ -109,6 +117,7 @@ void DialogEndLine::DialogAccepted()
emit DialogClosed(QDialog::Accepted); emit DialogClosed(QDialog::Accepted);
} }
//---------------------------------------------------------------------------------------------------------------------
DialogEndLine::~DialogEndLine() DialogEndLine::~DialogEndLine()
{ {
delete ui; delete ui;

View File

@ -31,6 +31,7 @@
#include <QPushButton> #include <QPushButton>
//---------------------------------------------------------------------------------------------------------------------
DialogHeight::DialogHeight(const VContainer *data, QWidget *parent) DialogHeight::DialogHeight(const VContainer *data, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogHeight), number(0), pointName(QString()), :DialogTool(data, parent), ui(new Ui::DialogHeight), number(0), pointName(QString()),
typeLine(QString()), basePointId(0), p1LineId(0), p2LineId(0) typeLine(QString()), basePointId(0), p1LineId(0), p2LineId(0)
@ -48,41 +49,48 @@ DialogHeight::DialogHeight(const VContainer *data, QWidget *parent)
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogHeight::NamePointChanged); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogHeight::NamePointChanged);
} }
//---------------------------------------------------------------------------------------------------------------------
DialogHeight::~DialogHeight() DialogHeight::~DialogHeight()
{ {
delete ui; delete ui;
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogHeight::setPointName(const QString &value) void DialogHeight::setPointName(const QString &value)
{ {
pointName = value; pointName = value;
ui->lineEditNamePoint->setText(pointName); ui->lineEditNamePoint->setText(pointName);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogHeight::setTypeLine(const QString &value) void DialogHeight::setTypeLine(const QString &value)
{ {
typeLine = value; typeLine = value;
SetupTypeLine(ui->comboBoxLineType, value); SetupTypeLine(ui->comboBoxLineType, value);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogHeight::setBasePointId(const quint32 &value, const quint32 &id) void DialogHeight::setBasePointId(const quint32 &value, const quint32 &id)
{ {
basePointId = value; basePointId = value;
setCurrentPointId(ui->comboBoxBasePoint, basePointId, value, id); setCurrentPointId(ui->comboBoxBasePoint, basePointId, value, id);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogHeight::setP1LineId(const quint32 &value, const quint32 &id) void DialogHeight::setP1LineId(const quint32 &value, const quint32 &id)
{ {
p1LineId = value; p1LineId = value;
setCurrentPointId(ui->comboBoxP1Line, p1LineId, value, id); setCurrentPointId(ui->comboBoxP1Line, p1LineId, value, id);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogHeight::setP2LineId(const quint32 &value, const quint32 &id) void DialogHeight::setP2LineId(const quint32 &value, const quint32 &id)
{ {
p2LineId = value; p2LineId = value;
setCurrentPointId(ui->comboBoxP2Line, p2LineId, value, id); setCurrentPointId(ui->comboBoxP2Line, p2LineId, value, id);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogHeight::ChoosedObject(quint32 id, const Valentina::Scenes &type) void DialogHeight::ChoosedObject(quint32 id, const Valentina::Scenes &type)
{ {
if (type == Valentina::Point) if (type == Valentina::Point)
@ -115,6 +123,7 @@ void DialogHeight::ChoosedObject(quint32 id, const Valentina::Scenes &type)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogHeight::DialogAccepted() void DialogHeight::DialogAccepted()
{ {
pointName = ui->lineEditNamePoint->text(); pointName = ui->lineEditNamePoint->text();

View File

@ -31,6 +31,7 @@
#include <QPushButton> #include <QPushButton>
//---------------------------------------------------------------------------------------------------------------------
DialogLine::DialogLine(const VContainer *data, QWidget *parent) DialogLine::DialogLine(const VContainer *data, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogLine), number(0), firstPoint(0), secondPoint(0), typeLine(QString()) :DialogTool(data, parent), ui(new Ui::DialogLine), number(0), firstPoint(0), secondPoint(0), typeLine(QString())
{ {
@ -44,11 +45,13 @@ DialogLine::DialogLine(const VContainer *data, QWidget *parent)
number = 0; number = 0;
} }
//---------------------------------------------------------------------------------------------------------------------
DialogLine::~DialogLine() DialogLine::~DialogLine()
{ {
delete ui; delete ui;
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogLine::setSecondPoint(const quint32 &value) void DialogLine::setSecondPoint(const quint32 &value)
{ {
secondPoint = value; secondPoint = value;
@ -60,12 +63,14 @@ void DialogLine::setSecondPoint(const quint32 &value)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogLine::setTypeLine(const QString &value) void DialogLine::setTypeLine(const QString &value)
{ {
typeLine = value; typeLine = value;
SetupTypeLine(ui->comboBoxLineType, value); SetupTypeLine(ui->comboBoxLineType, value);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogLine::setFirstPoint(const quint32 &value) void DialogLine::setFirstPoint(const quint32 &value)
{ {
firstPoint = value; firstPoint = value;
@ -77,7 +82,7 @@ void DialogLine::setFirstPoint(const quint32 &value)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogLine::DialogAccepted() void DialogLine::DialogAccepted()
{ {
qint32 index = ui->comboBoxFirstPoint->currentIndex(); qint32 index = ui->comboBoxFirstPoint->currentIndex();
@ -88,6 +93,7 @@ void DialogLine::DialogAccepted()
DialogClosed(QDialog::Accepted); DialogClosed(QDialog::Accepted);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogLine::ChoosedObject(quint32 id, const Valentina::Scenes &type) void DialogLine::ChoosedObject(quint32 id, const Valentina::Scenes &type)
{ {
if (type == Valentina::Point) if (type == Valentina::Point)

View File

@ -31,6 +31,7 @@
#include <QPushButton> #include <QPushButton>
//---------------------------------------------------------------------------------------------------------------------
DialogLineIntersect::DialogLineIntersect(const VContainer *data, QWidget *parent) DialogLineIntersect::DialogLineIntersect(const VContainer *data, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogLineIntersect), number(0), pointName(QString()), :DialogTool(data, parent), ui(new Ui::DialogLineIntersect), number(0), pointName(QString()),
p1Line1(0), p2Line1(0), p1Line2(0), p2Line2(0), flagPoint(true) p1Line1(0), p2Line1(0), p1Line2(0), p2Line2(0), flagPoint(true)
@ -49,11 +50,13 @@ DialogLineIntersect::DialogLineIntersect(const VContainer *data, QWidget *parent
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogLineIntersect::NamePointChanged); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogLineIntersect::NamePointChanged);
} }
//---------------------------------------------------------------------------------------------------------------------
DialogLineIntersect::~DialogLineIntersect() DialogLineIntersect::~DialogLineIntersect()
{ {
delete ui; delete ui;
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogLineIntersect::ChoosedObject(quint32 id, const Valentina::Scenes &type) void DialogLineIntersect::ChoosedObject(quint32 id, const Valentina::Scenes &type)
{ {
if (type == Valentina::Point) if (type == Valentina::Point)
@ -127,6 +130,7 @@ void DialogLineIntersect::ChoosedObject(quint32 id, const Valentina::Scenes &typ
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogLineIntersect::DialogAccepted() void DialogLineIntersect::DialogAccepted()
{ {
pointName = ui->lineEditNamePoint->text(); pointName = ui->lineEditNamePoint->text();
@ -137,6 +141,7 @@ void DialogLineIntersect::DialogAccepted()
emit DialogClosed(QDialog::Accepted); emit DialogClosed(QDialog::Accepted);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogLineIntersect::P1Line1Changed( int index) void DialogLineIntersect::P1Line1Changed( int index)
{ {
p1Line1 = qvariant_cast<quint32>(ui->comboBoxP1Line1->itemData(index)); p1Line1 = qvariant_cast<quint32>(ui->comboBoxP1Line1->itemData(index));
@ -144,6 +149,7 @@ void DialogLineIntersect::P1Line1Changed( int index)
CheckState(); CheckState();
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogLineIntersect::P2Line1Changed(int index) void DialogLineIntersect::P2Line1Changed(int index)
{ {
p2Line1 = qvariant_cast<quint32>(ui->comboBoxP2Line1->itemData(index)); p2Line1 = qvariant_cast<quint32>(ui->comboBoxP2Line1->itemData(index));
@ -151,6 +157,7 @@ void DialogLineIntersect::P2Line1Changed(int index)
CheckState(); CheckState();
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogLineIntersect::P1Line2Changed(int index) void DialogLineIntersect::P1Line2Changed(int index)
{ {
p1Line2 = qvariant_cast<quint32>(ui->comboBoxP1Line2->itemData(index)); p1Line2 = qvariant_cast<quint32>(ui->comboBoxP1Line2->itemData(index));
@ -158,6 +165,7 @@ void DialogLineIntersect::P1Line2Changed(int index)
CheckState(); CheckState();
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogLineIntersect::P2Line2Changed(int index) void DialogLineIntersect::P2Line2Changed(int index)
{ {
p2Line2 = qvariant_cast<quint32>(ui->comboBoxP2Line2->itemData(index)); p2Line2 = qvariant_cast<quint32>(ui->comboBoxP2Line2->itemData(index));
@ -165,12 +173,14 @@ void DialogLineIntersect::P2Line2Changed(int index)
CheckState(); CheckState();
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogLineIntersect::CheckState() void DialogLineIntersect::CheckState()
{ {
Q_CHECK_PTR(bOk); Q_CHECK_PTR(bOk);
bOk->setEnabled(flagName && flagPoint); bOk->setEnabled(flagName && flagPoint);
} }
//---------------------------------------------------------------------------------------------------------------------
bool DialogLineIntersect::CheckIntersecion() bool DialogLineIntersect::CheckIntersecion()
{ {
const VPointF *p1L1 = data->GeometricObject<const VPointF *>(p1Line1); const VPointF *p1L1 = data->GeometricObject<const VPointF *>(p1Line1);
@ -192,30 +202,35 @@ bool DialogLineIntersect::CheckIntersecion()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogLineIntersect::setP2Line2(const quint32 &value) void DialogLineIntersect::setP2Line2(const quint32 &value)
{ {
p2Line2 = value; p2Line2 = value;
ChangeCurrentData(ui->comboBoxP2Line2, value); ChangeCurrentData(ui->comboBoxP2Line2, value);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogLineIntersect::setP1Line2(const quint32 &value) void DialogLineIntersect::setP1Line2(const quint32 &value)
{ {
p1Line2 = value; p1Line2 = value;
ChangeCurrentData(ui->comboBoxP1Line2, value); ChangeCurrentData(ui->comboBoxP1Line2, value);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogLineIntersect::setP2Line1(const quint32 &value) void DialogLineIntersect::setP2Line1(const quint32 &value)
{ {
p2Line1 = value; p2Line1 = value;
ChangeCurrentData(ui->comboBoxP2Line1, value); ChangeCurrentData(ui->comboBoxP2Line1, value);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogLineIntersect::setP1Line1(const quint32 &value) void DialogLineIntersect::setP1Line1(const quint32 &value)
{ {
p1Line1 = value; p1Line1 = value;
ChangeCurrentData(ui->comboBoxP1Line1, value); ChangeCurrentData(ui->comboBoxP1Line1, value);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogLineIntersect::setPointName(const QString &value) void DialogLineIntersect::setPointName(const QString &value)
{ {
pointName = value; pointName = value;

View File

@ -31,6 +31,7 @@
#include <QPushButton> #include <QPushButton>
//---------------------------------------------------------------------------------------------------------------------
DialogNormal::DialogNormal(const VContainer *data, QWidget *parent) DialogNormal::DialogNormal(const VContainer *data, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogNormal), number(0), pointName(QString()), :DialogTool(data, parent), ui(new Ui::DialogNormal), number(0), pointName(QString()),
typeLine(QString()), formula(QString()), angle(0), firstPointId(0), secondPointId(0) typeLine(QString()), formula(QString()), angle(0), firstPointId(0), secondPointId(0)
@ -60,11 +61,13 @@ DialogNormal::DialogNormal(const VContainer *data, QWidget *parent)
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogNormal::FormulaChanged); connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogNormal::FormulaChanged);
} }
//---------------------------------------------------------------------------------------------------------------------
DialogNormal::~DialogNormal() DialogNormal::~DialogNormal()
{ {
delete ui; delete ui;
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogNormal::ChoosedObject(quint32 id, const Valentina::Scenes &type) void DialogNormal::ChoosedObject(quint32 id, const Valentina::Scenes &type)
{ {
if (type == Valentina::Point) if (type == Valentina::Point)
@ -91,6 +94,7 @@ void DialogNormal::ChoosedObject(quint32 id, const Valentina::Scenes &type)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogNormal::DialogAccepted() void DialogNormal::DialogAccepted()
{ {
pointName = ui->lineEditNamePoint->text(); pointName = ui->lineEditNamePoint->text();
@ -102,34 +106,40 @@ void DialogNormal::DialogAccepted()
emit DialogClosed(QDialog::Accepted); emit DialogClosed(QDialog::Accepted);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogNormal::setSecondPointId(const quint32 &value, const quint32 &id) void DialogNormal::setSecondPointId(const quint32 &value, const quint32 &id)
{ {
setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id); setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogNormal::setFirstPointId(const quint32 &value, const quint32 &id) void DialogNormal::setFirstPointId(const quint32 &value, const quint32 &id)
{ {
setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id); setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogNormal::setAngle(const qreal &value) void DialogNormal::setAngle(const qreal &value)
{ {
angle = value; angle = value;
ui->doubleSpinBoxAngle->setValue(angle); ui->doubleSpinBoxAngle->setValue(angle);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogNormal::setFormula(const QString &value) void DialogNormal::setFormula(const QString &value)
{ {
formula = value; formula = value;
ui->lineEditFormula->setText(formula); ui->lineEditFormula->setText(formula);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogNormal::setTypeLine(const QString &value) void DialogNormal::setTypeLine(const QString &value)
{ {
typeLine = value; typeLine = value;
SetupTypeLine(ui->comboBoxLineType, value); SetupTypeLine(ui->comboBoxLineType, value);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogNormal::setPointName(const QString &value) void DialogNormal::setPointName(const QString &value)
{ {
pointName = value; pointName = value;

View File

@ -30,6 +30,7 @@
#include <QPushButton> #include <QPushButton>
//---------------------------------------------------------------------------------------------------------------------
DialogPointOfContact::DialogPointOfContact(const VContainer *data, QWidget *parent) DialogPointOfContact::DialogPointOfContact(const VContainer *data, QWidget *parent)
:DialogTool(data, parent), ui(), number(0), pointName(QString()), radius(QString()), center(0), :DialogTool(data, parent), ui(), number(0), pointName(QString()), radius(QString()), center(0),
firstPoint(0), secondPoint(0) firstPoint(0), secondPoint(0)
@ -87,6 +88,7 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, QWidget *pare
connect(ui.lineEditFormula, &QLineEdit::textChanged, this, &DialogPointOfContact::FormulaChanged); connect(ui.lineEditFormula, &QLineEdit::textChanged, this, &DialogPointOfContact::FormulaChanged);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogPointOfContact::ChoosedObject(quint32 id, const Valentina::Scenes &type) void DialogPointOfContact::ChoosedObject(quint32 id, const Valentina::Scenes &type)
{ {
if (type == Valentina::Point) if (type == Valentina::Point)
@ -131,6 +133,7 @@ void DialogPointOfContact::ChoosedObject(quint32 id, const Valentina::Scenes &ty
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogPointOfContact::DialogAccepted() void DialogPointOfContact::DialogAccepted()
{ {
pointName = ui.lineEditNamePoint->text(); pointName = ui.lineEditNamePoint->text();
@ -141,28 +144,33 @@ void DialogPointOfContact::DialogAccepted()
emit DialogClosed(QDialog::Accepted); emit DialogClosed(QDialog::Accepted);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogPointOfContact::setSecondPoint(const quint32 &value, const quint32 &id) void DialogPointOfContact::setSecondPoint(const quint32 &value, const quint32 &id)
{ {
setCurrentPointId(ui.comboBoxSecondPoint, secondPoint, value, id); setCurrentPointId(ui.comboBoxSecondPoint, secondPoint, value, id);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogPointOfContact::setFirstPoint(const quint32 &value, const quint32 &id) void DialogPointOfContact::setFirstPoint(const quint32 &value, const quint32 &id)
{ {
setCurrentPointId(ui.comboBoxFirstPoint, firstPoint, value, id); setCurrentPointId(ui.comboBoxFirstPoint, firstPoint, value, id);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogPointOfContact::setCenter(const quint32 &value, const quint32 &id) void DialogPointOfContact::setCenter(const quint32 &value, const quint32 &id)
{ {
setCurrentPointId(ui.comboBoxCenter, center, value, id); setCurrentPointId(ui.comboBoxCenter, center, value, id);
center = value; center = value;
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogPointOfContact::setRadius(const QString &value) void DialogPointOfContact::setRadius(const QString &value)
{ {
radius = value; radius = value;
ui.lineEditFormula->setText(radius); ui.lineEditFormula->setText(radius);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogPointOfContact::setPointName(const QString &value) void DialogPointOfContact::setPointName(const QString &value)
{ {
pointName = value; pointName = value;

View File

@ -31,6 +31,7 @@
#include <QPushButton> #include <QPushButton>
//---------------------------------------------------------------------------------------------------------------------
DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, QWidget *parent) DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogPointOfIntersection), number(0), pointName(QString()), :DialogTool(data, parent), ui(new Ui::DialogPointOfIntersection), number(0), pointName(QString()),
firstPointId(0), secondPointId(0) firstPointId(0), secondPointId(0)
@ -47,17 +48,20 @@ DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, QWi
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogPointOfIntersection::NamePointChanged); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogPointOfIntersection::NamePointChanged);
} }
//---------------------------------------------------------------------------------------------------------------------
DialogPointOfIntersection::~DialogPointOfIntersection() DialogPointOfIntersection::~DialogPointOfIntersection()
{ {
delete ui; delete ui;
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogPointOfIntersection::setSecondPointId(const quint32 &value, const quint32 &id) void DialogPointOfIntersection::setSecondPointId(const quint32 &value, const quint32 &id)
{ {
secondPointId = value; secondPointId = value;
setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id); setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogPointOfIntersection::ChoosedObject(quint32 id, const Valentina::Scenes &type) void DialogPointOfIntersection::ChoosedObject(quint32 id, const Valentina::Scenes &type)
{ {
if (type == Valentina::Point) if (type == Valentina::Point)
@ -91,6 +95,7 @@ void DialogPointOfIntersection::ChoosedObject(quint32 id, const Valentina::Scene
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogPointOfIntersection::DialogAccepted() void DialogPointOfIntersection::DialogAccepted()
{ {
pointName = ui->lineEditNamePoint->text(); pointName = ui->lineEditNamePoint->text();
@ -99,12 +104,14 @@ void DialogPointOfIntersection::DialogAccepted()
emit DialogClosed(QDialog::Accepted); emit DialogClosed(QDialog::Accepted);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogPointOfIntersection::setFirstPointId(const quint32 &value, const quint32 &id) void DialogPointOfIntersection::setFirstPointId(const quint32 &value, const quint32 &id)
{ {
firstPointId = value; firstPointId = value;
setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id); setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogPointOfIntersection::setPointName(const QString &value) void DialogPointOfIntersection::setPointName(const QString &value)
{ {
pointName = value; pointName = value;

View File

@ -31,6 +31,7 @@
#include <QPushButton> #include <QPushButton>
//---------------------------------------------------------------------------------------------------------------------
DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, QWidget *parent) DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogShoulderPoint), number(0), pointName(QString()), :DialogTool(data, parent), ui(new Ui::DialogShoulderPoint), number(0), pointName(QString()),
typeLine(QString()), formula(QString()), p1Line(0), p2Line(0), pShoulder(0) typeLine(QString()), formula(QString()), p1Line(0), p2Line(0), pShoulder(0)
@ -60,11 +61,13 @@ DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, QWidget *parent
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogShoulderPoint::FormulaChanged); connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogShoulderPoint::FormulaChanged);
} }
//---------------------------------------------------------------------------------------------------------------------
DialogShoulderPoint::~DialogShoulderPoint() DialogShoulderPoint::~DialogShoulderPoint()
{ {
delete ui; delete ui;
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogShoulderPoint::ChoosedObject(quint32 id, const Valentina::Scenes &type) void DialogShoulderPoint::ChoosedObject(quint32 id, const Valentina::Scenes &type)
{ {
if (type == Valentina::Point) if (type == Valentina::Point)
@ -109,6 +112,7 @@ void DialogShoulderPoint::ChoosedObject(quint32 id, const Valentina::Scenes &typ
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogShoulderPoint::DialogAccepted() void DialogShoulderPoint::DialogAccepted()
{ {
pointName = ui->lineEditNamePoint->text(); pointName = ui->lineEditNamePoint->text();
@ -120,33 +124,39 @@ void DialogShoulderPoint::DialogAccepted()
emit DialogClosed(QDialog::Accepted); emit DialogClosed(QDialog::Accepted);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogShoulderPoint::setPShoulder(const quint32 &value, const quint32 &id) void DialogShoulderPoint::setPShoulder(const quint32 &value, const quint32 &id)
{ {
setCurrentPointId(ui->comboBoxPShoulder, pShoulder, value, id); setCurrentPointId(ui->comboBoxPShoulder, pShoulder, value, id);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogShoulderPoint::setP2Line(const quint32 &value, const quint32 &id) void DialogShoulderPoint::setP2Line(const quint32 &value, const quint32 &id)
{ {
setCurrentPointId(ui->comboBoxP2Line, p2Line, value, id); setCurrentPointId(ui->comboBoxP2Line, p2Line, value, id);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogShoulderPoint::setP1Line(const quint32 &value, const quint32 &id) void DialogShoulderPoint::setP1Line(const quint32 &value, const quint32 &id)
{ {
setCurrentPointId(ui->comboBoxP1Line, p1Line, value, id); setCurrentPointId(ui->comboBoxP1Line, p1Line, value, id);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogShoulderPoint::setFormula(const QString &value) void DialogShoulderPoint::setFormula(const QString &value)
{ {
formula = value; formula = value;
ui->lineEditFormula->setText(formula); ui->lineEditFormula->setText(formula);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogShoulderPoint::setTypeLine(const QString &value) void DialogShoulderPoint::setTypeLine(const QString &value)
{ {
typeLine = value; typeLine = value;
SetupTypeLine(ui->comboBoxLineType, value); SetupTypeLine(ui->comboBoxLineType, value);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogShoulderPoint::setPointName(const QString &value) void DialogShoulderPoint::setPointName(const QString &value)
{ {
pointName = value; pointName = value;

View File

@ -31,6 +31,7 @@
#include <QPushButton> #include <QPushButton>
//---------------------------------------------------------------------------------------------------------------------
DialogSinglePoint::DialogSinglePoint(const VContainer *data, QWidget *parent) DialogSinglePoint::DialogSinglePoint(const VContainer *data, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogSinglePoint), name(QString()), :DialogTool(data, parent), ui(new Ui::DialogSinglePoint), name(QString()),
point(QPointF()) point(QPointF())
@ -47,6 +48,7 @@ DialogSinglePoint::DialogSinglePoint(const VContainer *data, QWidget *parent)
connect(ui->lineEditName, &QLineEdit::textChanged, this, &DialogSinglePoint::NamePointChanged); connect(ui->lineEditName, &QLineEdit::textChanged, this, &DialogSinglePoint::NamePointChanged);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogSinglePoint::mousePress(const QPointF &scenePos) void DialogSinglePoint::mousePress(const QPointF &scenePos)
{ {
if (isInitialized == false) if (isInitialized == false)
@ -62,6 +64,7 @@ void DialogSinglePoint::mousePress(const QPointF &scenePos)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogSinglePoint::DialogAccepted() void DialogSinglePoint::DialogAccepted()
{ {
point = QPointF(qApp->toPixel(ui->doubleSpinBoxX->value()), qApp->toPixel(ui->doubleSpinBoxY->value())); point = QPointF(qApp->toPixel(ui->doubleSpinBoxX->value()), qApp->toPixel(ui->doubleSpinBoxY->value()));
@ -69,6 +72,7 @@ void DialogSinglePoint::DialogAccepted()
emit DialogClosed(QDialog::Accepted); emit DialogClosed(QDialog::Accepted);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogSinglePoint::setData(const QString &name, const QPointF &point) void DialogSinglePoint::setData(const QString &name, const QPointF &point)
{ {
this->name = name; this->name = name;
@ -79,6 +83,7 @@ void DialogSinglePoint::setData(const QString &name, const QPointF &point)
ui->doubleSpinBoxY->setValue(qApp->fromPixel(point.y())); ui->doubleSpinBoxY->setValue(qApp->fromPixel(point.y()));
} }
//---------------------------------------------------------------------------------------------------------------------
DialogSinglePoint::~DialogSinglePoint() DialogSinglePoint::~DialogSinglePoint()
{ {
delete ui; delete ui;

View File

@ -31,6 +31,7 @@
#include <QPushButton> #include <QPushButton>
//---------------------------------------------------------------------------------------------------------------------
DialogSpline::DialogSpline(const VContainer *data, QWidget *parent) DialogSpline::DialogSpline(const VContainer *data, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogSpline), number(0), p1(0), p4(0), angle1(0), angle2(0), :DialogTool(data, parent), ui(new Ui::DialogSpline), number(0), p1(0), p4(0), angle1(0), angle2(0),
kAsm1(1), kAsm2(1), kCurve(1) kAsm1(1), kAsm2(1), kCurve(1)
@ -42,16 +43,19 @@ DialogSpline::DialogSpline(const VContainer *data, QWidget *parent)
FillComboBoxPoints(ui->comboBoxP4); FillComboBoxPoints(ui->comboBoxP4);
} }
//---------------------------------------------------------------------------------------------------------------------
DialogSpline::~DialogSpline() DialogSpline::~DialogSpline()
{ {
delete ui; delete ui;
} }
//---------------------------------------------------------------------------------------------------------------------
quint32 DialogSpline::getP1() const quint32 DialogSpline::getP1() const
{ {
return p1; return p1;
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogSpline::ChoosedObject(quint32 id, const Valentina::Scenes &type) void DialogSpline::ChoosedObject(quint32 id, const Valentina::Scenes &type)
{ {
if (type == Valentina::Point) if (type == Valentina::Point)
@ -93,6 +97,7 @@ void DialogSpline::ChoosedObject(quint32 id, const Valentina::Scenes &type)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogSpline::DialogAccepted() void DialogSpline::DialogAccepted()
{ {
p1 = getCurrentObjectId(ui->comboBoxP1); p1 = getCurrentObjectId(ui->comboBoxP1);
@ -105,48 +110,56 @@ void DialogSpline::DialogAccepted()
emit DialogClosed(QDialog::Accepted); emit DialogClosed(QDialog::Accepted);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogSpline::setKCurve(const qreal &value) void DialogSpline::setKCurve(const qreal &value)
{ {
kCurve = value; kCurve = value;
ui->doubleSpinBoxKcurve->setValue(value); ui->doubleSpinBoxKcurve->setValue(value);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogSpline::setKAsm2(const qreal &value) void DialogSpline::setKAsm2(const qreal &value)
{ {
kAsm2 = value; kAsm2 = value;
ui->doubleSpinBoxKasm2->setValue(value); ui->doubleSpinBoxKasm2->setValue(value);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogSpline::setKAsm1(const qreal &value) void DialogSpline::setKAsm1(const qreal &value)
{ {
kAsm1 = value; kAsm1 = value;
ui->doubleSpinBoxKasm1->setValue(value); ui->doubleSpinBoxKasm1->setValue(value);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogSpline::setAngle2(const qreal &value) void DialogSpline::setAngle2(const qreal &value)
{ {
angle2 = value; angle2 = value;
ui->spinBoxAngle2->setValue(static_cast<qint32>(value)); ui->spinBoxAngle2->setValue(static_cast<qint32>(value));
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogSpline::setAngle1(const qreal &value) void DialogSpline::setAngle1(const qreal &value)
{ {
angle1 = value; angle1 = value;
ui->spinBoxAngle1->setValue(static_cast<qint32>(value)); ui->spinBoxAngle1->setValue(static_cast<qint32>(value));
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogSpline::setP4(const quint32 &value) void DialogSpline::setP4(const quint32 &value)
{ {
p4 = value; p4 = value;
ChangeCurrentData(ui->comboBoxP4, value); ChangeCurrentData(ui->comboBoxP4, value);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogSpline::setP1(const quint32 &value) void DialogSpline::setP1(const quint32 &value)
{ {
p1 = value; p1 = value;
ChangeCurrentData(ui->comboBoxP1, value); ChangeCurrentData(ui->comboBoxP1, value);
} }
//---------------------------------------------------------------------------------------------------------------------
quint32 DialogSpline::getP4() const quint32 DialogSpline::getP4() const
{ {
return p4; return p4;

View File

@ -32,6 +32,7 @@
#include <QPushButton> #include <QPushButton>
//---------------------------------------------------------------------------------------------------------------------
DialogSplinePath::DialogSplinePath(const VContainer *data, QWidget *parent) DialogSplinePath::DialogSplinePath(const VContainer *data, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogSplinePath), path(VSplinePath()) :DialogTool(data, parent), ui(new Ui::DialogSplinePath), path(VSplinePath())
{ {
@ -54,11 +55,13 @@ DialogSplinePath::DialogSplinePath(const VContainer *data, QWidget *parent)
this, &DialogSplinePath::KAsm2Changed); this, &DialogSplinePath::KAsm2Changed);
} }
//---------------------------------------------------------------------------------------------------------------------
DialogSplinePath::~DialogSplinePath() DialogSplinePath::~DialogSplinePath()
{ {
delete ui; delete ui;
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogSplinePath::SetPath(const VSplinePath &value) void DialogSplinePath::SetPath(const VSplinePath &value)
{ {
this->path = value; this->path = value;
@ -71,7 +74,7 @@ void DialogSplinePath::SetPath(const VSplinePath &value)
ui->doubleSpinBoxKcurve->setValue(path.getKCurve()); ui->doubleSpinBoxKcurve->setValue(path.getKCurve());
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogSplinePath::ChoosedObject(quint32 id, const Valentina::Scenes &type) void DialogSplinePath::ChoosedObject(quint32 id, const Valentina::Scenes &type)
{ {
if (type == Valentina::Point) if (type == Valentina::Point)
@ -82,6 +85,7 @@ void DialogSplinePath::ChoosedObject(quint32 id, const Valentina::Scenes &type)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogSplinePath::DialogAccepted() void DialogSplinePath::DialogAccepted()
{ {
path.Clear(); path.Clear();
@ -95,6 +99,7 @@ void DialogSplinePath::DialogAccepted()
emit DialogClosed(QDialog::Accepted); emit DialogClosed(QDialog::Accepted);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogSplinePath::PointChanged(int row) void DialogSplinePath::PointChanged(int row)
{ {
if (ui->listWidget->count() == 0) if (ui->listWidget->count() == 0)
@ -107,6 +112,7 @@ void DialogSplinePath::PointChanged(int row)
EnableFields(); EnableFields();
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogSplinePath::currentPointChanged(int index) void DialogSplinePath::currentPointChanged(int index)
{ {
quint32 id = qvariant_cast<quint32>(ui->comboBoxPoint->itemData(index)); quint32 id = qvariant_cast<quint32>(ui->comboBoxPoint->itemData(index));
@ -120,6 +126,7 @@ void DialogSplinePath::currentPointChanged(int index)
item->setData(Qt::UserRole, QVariant::fromValue(p)); item->setData(Qt::UserRole, QVariant::fromValue(p));
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogSplinePath::Angle1Changed(qreal index) void DialogSplinePath::Angle1Changed(qreal index)
{ {
qint32 row = ui->listWidget->currentRow(); qint32 row = ui->listWidget->currentRow();
@ -131,6 +138,7 @@ void DialogSplinePath::Angle1Changed(qreal index)
item->setData(Qt::UserRole, QVariant::fromValue(p)); item->setData(Qt::UserRole, QVariant::fromValue(p));
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogSplinePath::Angle2Changed(qreal index) void DialogSplinePath::Angle2Changed(qreal index)
{ {
qint32 row = ui->listWidget->currentRow(); qint32 row = ui->listWidget->currentRow();
@ -142,6 +150,7 @@ void DialogSplinePath::Angle2Changed(qreal index)
item->setData(Qt::UserRole, QVariant::fromValue(p)); item->setData(Qt::UserRole, QVariant::fromValue(p));
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogSplinePath::KAsm1Changed(qreal d) void DialogSplinePath::KAsm1Changed(qreal d)
{ {
qint32 row = ui->listWidget->currentRow(); qint32 row = ui->listWidget->currentRow();
@ -151,6 +160,7 @@ void DialogSplinePath::KAsm1Changed(qreal d)
item->setData(Qt::UserRole, QVariant::fromValue(p)); item->setData(Qt::UserRole, QVariant::fromValue(p));
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogSplinePath::KAsm2Changed(qreal d) void DialogSplinePath::KAsm2Changed(qreal d)
{ {
qint32 row = ui->listWidget->currentRow(); qint32 row = ui->listWidget->currentRow();
@ -160,6 +170,7 @@ void DialogSplinePath::KAsm2Changed(qreal d)
item->setData(Qt::UserRole, QVariant::fromValue(p)); item->setData(Qt::UserRole, QVariant::fromValue(p));
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogSplinePath::NewItem(quint32 id, qreal kAsm1, qreal angle1, qreal kAsm2, qreal angle2) void DialogSplinePath::NewItem(quint32 id, qreal kAsm1, qreal angle1, qreal kAsm2, qreal angle2)
{ {
const VPointF *point = data->GeometricObject<const VPointF *>(id); const VPointF *point = data->GeometricObject<const VPointF *>(id);
@ -178,6 +189,7 @@ void DialogSplinePath::NewItem(quint32 id, qreal kAsm1, qreal angle1, qreal kAsm
EnableFields(); EnableFields();
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogSplinePath::DataPoint(quint32 id, qreal kAsm1, qreal angle1, qreal kAsm2, qreal angle2) void DialogSplinePath::DataPoint(quint32 id, qreal kAsm1, qreal angle1, qreal kAsm2, qreal angle2)
{ {
disconnect(ui->comboBoxPoint, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), disconnect(ui->comboBoxPoint, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
@ -209,6 +221,7 @@ void DialogSplinePath::DataPoint(quint32 id, qreal kAsm1, qreal angle1, qreal kA
this, &DialogSplinePath::KAsm2Changed); this, &DialogSplinePath::KAsm2Changed);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogSplinePath::EnableFields() void DialogSplinePath::EnableFields()
{ {
ui->doubleSpinBoxKasm1->setEnabled(true); ui->doubleSpinBoxKasm1->setEnabled(true);

View File

@ -33,6 +33,7 @@
#include <QtWidgets> #include <QtWidgets>
//---------------------------------------------------------------------------------------------------------------------
DialogTool::DialogTool(const VContainer *data, QWidget *parent) DialogTool::DialogTool(const VContainer *data, QWidget *parent)
:QDialog(parent), data(data), isInitialized(false), flagName(true), flagFormula(true), timerFormula(nullptr), :QDialog(parent), data(data), isInitialized(false), flagName(true), flagFormula(true), timerFormula(nullptr),
bOk(nullptr), spinBoxAngle(nullptr), lineEditFormula(nullptr), listWidget(nullptr), bOk(nullptr), spinBoxAngle(nullptr), lineEditFormula(nullptr), listWidget(nullptr),
@ -51,12 +52,14 @@ DialogTool::DialogTool(const VContainer *data, QWidget *parent)
setWindowFlags(flags | Qt::WindowStaysOnTopHint); setWindowFlags(flags | Qt::WindowStaysOnTopHint);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::closeEvent(QCloseEvent *event) void DialogTool::closeEvent(QCloseEvent *event)
{ {
DialogClosed(QDialog::Rejected); DialogClosed(QDialog::Rejected);
event->accept(); event->accept();
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::showEvent(QShowEvent *event) void DialogTool::showEvent(QShowEvent *event)
{ {
QDialog::showEvent( event ); QDialog::showEvent( event );
@ -71,6 +74,7 @@ void DialogTool::showEvent(QShowEvent *event)
isInitialized = true;//first show windows are held isInitialized = true;//first show windows are held
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::FillComboBoxPoints(QComboBox *box, const quint32 &id) const void DialogTool::FillComboBoxPoints(QComboBox *box, const quint32 &id) const
{ {
Q_CHECK_PTR(box); Q_CHECK_PTR(box);
@ -93,6 +97,7 @@ void DialogTool::FillComboBoxPoints(QComboBox *box, const quint32 &id) const
FillList(box, list); FillList(box, list);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::FillComboBoxArcs(QComboBox *box, const quint32 &id, ComboMode::ComboBoxCutArc cut) const void DialogTool::FillComboBoxArcs(QComboBox *box, const quint32 &id, ComboMode::ComboBoxCutArc cut) const
{ {
Q_CHECK_PTR(box); Q_CHECK_PTR(box);
@ -130,6 +135,7 @@ void DialogTool::FillComboBoxArcs(QComboBox *box, const quint32 &id, ComboMode::
FillList(box, list); FillList(box, list);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::FillComboBoxSplines(QComboBox *box, const quint32 &id, ComboMode::ComboBoxCutSpline cut) const void DialogTool::FillComboBoxSplines(QComboBox *box, const quint32 &id, ComboMode::ComboBoxCutSpline cut) const
{ {
Q_CHECK_PTR(box); Q_CHECK_PTR(box);
@ -167,6 +173,7 @@ void DialogTool::FillComboBoxSplines(QComboBox *box, const quint32 &id, ComboMod
FillList(box, list); FillList(box, list);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::FillComboBoxSplinesPath(QComboBox *box, const quint32 &id, ComboMode::ComboBoxCutSpline cut) const void DialogTool::FillComboBoxSplinesPath(QComboBox *box, const quint32 &id, ComboMode::ComboBoxCutSpline cut) const
{ {
Q_CHECK_PTR(box); Q_CHECK_PTR(box);
@ -204,6 +211,7 @@ void DialogTool::FillComboBoxSplinesPath(QComboBox *box, const quint32 &id, Comb
FillList(box, list); FillList(box, list);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::FillComboBoxTypeLine(QComboBox *box) const void DialogTool::FillComboBoxTypeLine(QComboBox *box) const
{ {
Q_CHECK_PTR(box); Q_CHECK_PTR(box);
@ -211,6 +219,7 @@ void DialogTool::FillComboBoxTypeLine(QComboBox *box) const
box->setCurrentIndex(1); box->setCurrentIndex(1);
} }
//---------------------------------------------------------------------------------------------------------------------
QString DialogTool::GetTypeLine(const QComboBox *box) const QString DialogTool::GetTypeLine(const QComboBox *box) const
{ {
switch (lineStyles.indexOf(box->currentText())) switch (lineStyles.indexOf(box->currentText()))
@ -239,6 +248,7 @@ QString DialogTool::GetTypeLine(const QComboBox *box) const
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::SetupTypeLine(QComboBox *box, const QString &value) void DialogTool::SetupTypeLine(QComboBox *box, const QString &value)
{ {
QStringList styles = VAbstractTool::Styles(); QStringList styles = VAbstractTool::Styles();
@ -249,6 +259,7 @@ void DialogTool::SetupTypeLine(QComboBox *box, const QString &value)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::ChangeCurrentText(QComboBox *box, const QString &value) void DialogTool::ChangeCurrentText(QComboBox *box, const QString &value)
{ {
qint32 index = box->findText(value); qint32 index = box->findText(value);
@ -262,6 +273,7 @@ void DialogTool::ChangeCurrentText(QComboBox *box, const QString &value)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::ChangeCurrentData(QComboBox *box, const quint32 &value) const void DialogTool::ChangeCurrentData(QComboBox *box, const quint32 &value) const
{ {
qint32 index = box->findData(value); qint32 index = box->findData(value);
@ -271,6 +283,7 @@ void DialogTool::ChangeCurrentData(QComboBox *box, const quint32 &value) const
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::PutValHere(QLineEdit *lineEdit, QListWidget *listWidget) void DialogTool::PutValHere(QLineEdit *lineEdit, QListWidget *listWidget)
{ {
Q_CHECK_PTR(lineEdit); Q_CHECK_PTR(lineEdit);
@ -283,6 +296,7 @@ void DialogTool::PutValHere(QLineEdit *lineEdit, QListWidget *listWidget)
lineEdit->setCursorPosition(pos + item->text().size()); lineEdit->setCursorPosition(pos + item->text().size());
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer *timer) void DialogTool::ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer *timer)
{ {
Q_CHECK_PTR(edit); Q_CHECK_PTR(edit);
@ -300,6 +314,7 @@ void DialogTool::ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer *timer)
timer->start(1000); timer->start(1000);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label) void DialogTool::Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label)
{ {
Q_CHECK_PTR(edit); Q_CHECK_PTR(edit);
@ -335,6 +350,7 @@ void DialogTool::Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label)
labelEditFormula->setPalette(palette); labelEditFormula->setPalette(palette);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::setCurrentPointId(QComboBox *box, quint32 &pointId, const quint32 &value, const quint32 &id) const void DialogTool::setCurrentPointId(QComboBox *box, quint32 &pointId, const quint32 &value, const quint32 &id) const
{ {
Q_CHECK_PTR(box); Q_CHECK_PTR(box);
@ -343,6 +359,7 @@ void DialogTool::setCurrentPointId(QComboBox *box, quint32 &pointId, const quint
ChangeCurrentData(box, value); ChangeCurrentData(box, value);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::setCurrentSplineId(QComboBox *box, quint32 &splineId, const quint32 &value, const quint32 &id, void DialogTool::setCurrentSplineId(QComboBox *box, quint32 &splineId, const quint32 &value, const quint32 &id,
ComboMode::ComboBoxCutSpline cut) const ComboMode::ComboBoxCutSpline cut) const
{ {
@ -352,6 +369,7 @@ void DialogTool::setCurrentSplineId(QComboBox *box, quint32 &splineId, const qui
ChangeCurrentData(box, value); ChangeCurrentData(box, value);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::setCurrentArcId(QComboBox *box, quint32 &arcId, const quint32 &value, const quint32 &id, void DialogTool::setCurrentArcId(QComboBox *box, quint32 &arcId, const quint32 &value, const quint32 &id,
ComboMode::ComboBoxCutArc cut) const ComboMode::ComboBoxCutArc cut) const
{ {
@ -361,6 +379,7 @@ void DialogTool::setCurrentArcId(QComboBox *box, quint32 &arcId, const quint32 &
ChangeCurrentData(box, value); ChangeCurrentData(box, value);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::setCurrentSplinePathId(QComboBox *box, quint32 &splinePathId, const quint32 &value, void DialogTool::setCurrentSplinePathId(QComboBox *box, quint32 &splinePathId, const quint32 &value,
const quint32 &id, ComboMode::ComboBoxCutSpline cut) const const quint32 &id, ComboMode::ComboBoxCutSpline cut) const
{ {
@ -370,6 +389,7 @@ void DialogTool::setCurrentSplinePathId(QComboBox *box, quint32 &splinePathId, c
ChangeCurrentData(box, value); ChangeCurrentData(box, value);
} }
//---------------------------------------------------------------------------------------------------------------------
quint32 DialogTool::getCurrentObjectId(QComboBox *box) const quint32 DialogTool::getCurrentObjectId(QComboBox *box) const
{ {
Q_CHECK_PTR(box); Q_CHECK_PTR(box);
@ -385,6 +405,7 @@ quint32 DialogTool::getCurrentObjectId(QComboBox *box) const
} }
} }
//---------------------------------------------------------------------------------------------------------------------
bool DialogTool::ChoosedPoint(const quint32 &id, QComboBox *box, const QString &toolTip) bool DialogTool::ChoosedPoint(const quint32 &id, QComboBox *box, const QString &toolTip)
{ {
Q_CHECK_PTR(box); Q_CHECK_PTR(box);
@ -400,6 +421,7 @@ bool DialogTool::ChoosedPoint(const quint32 &id, QComboBox *box, const QString &
return false; return false;
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::FillList(QComboBox *box, const QMap<QString, quint32> &list) const void DialogTool::FillList(QComboBox *box, const QMap<QString, quint32> &list) const
{ {
Q_CHECK_PTR(box); Q_CHECK_PTR(box);
@ -413,18 +435,21 @@ void DialogTool::FillList(QComboBox *box, const QMap<QString, quint32> &list) co
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::CheckState() void DialogTool::CheckState()
{ {
Q_CHECK_PTR(bOk); Q_CHECK_PTR(bOk);
bOk->setEnabled(flagFormula && flagName); bOk->setEnabled(flagFormula && flagName);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::ChoosedObject(quint32 id, const Valentina::Scenes &type) void DialogTool::ChoosedObject(quint32 id, const Valentina::Scenes &type)
{ {
Q_UNUSED(id); Q_UNUSED(id);
Q_UNUSED(type); Q_UNUSED(type);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::NamePointChanged() void DialogTool::NamePointChanged()
{ {
Q_CHECK_PTR(labelEditNamePoint); Q_CHECK_PTR(labelEditNamePoint);
@ -450,16 +475,19 @@ void DialogTool::NamePointChanged()
CheckState(); CheckState();
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::DialogAccepted() void DialogTool::DialogAccepted()
{ {
emit DialogClosed(QDialog::Accepted); emit DialogClosed(QDialog::Accepted);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::DialogRejected() void DialogTool::DialogRejected()
{ {
emit DialogClosed(QDialog::Rejected); emit DialogClosed(QDialog::Rejected);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::FormulaChanged() void DialogTool::FormulaChanged()
{ {
QLineEdit* edit = qobject_cast<QLineEdit*>(sender()); QLineEdit* edit = qobject_cast<QLineEdit*>(sender());
@ -469,54 +497,63 @@ void DialogTool::FormulaChanged()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::ArrowUp() void DialogTool::ArrowUp()
{ {
Q_CHECK_PTR(spinBoxAngle); Q_CHECK_PTR(spinBoxAngle);
spinBoxAngle->setValue(90); spinBoxAngle->setValue(90);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::ArrowDown() void DialogTool::ArrowDown()
{ {
Q_CHECK_PTR(spinBoxAngle); Q_CHECK_PTR(spinBoxAngle);
spinBoxAngle->setValue(270); spinBoxAngle->setValue(270);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::ArrowLeft() void DialogTool::ArrowLeft()
{ {
Q_CHECK_PTR(spinBoxAngle); Q_CHECK_PTR(spinBoxAngle);
spinBoxAngle->setValue(180); spinBoxAngle->setValue(180);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::ArrowRight() void DialogTool::ArrowRight()
{ {
Q_CHECK_PTR(spinBoxAngle); Q_CHECK_PTR(spinBoxAngle);
spinBoxAngle->setValue(0); spinBoxAngle->setValue(0);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::ArrowLeftUp() void DialogTool::ArrowLeftUp()
{ {
Q_CHECK_PTR(spinBoxAngle); Q_CHECK_PTR(spinBoxAngle);
spinBoxAngle->setValue(135); spinBoxAngle->setValue(135);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::ArrowLeftDown() void DialogTool::ArrowLeftDown()
{ {
Q_CHECK_PTR(spinBoxAngle); Q_CHECK_PTR(spinBoxAngle);
spinBoxAngle->setValue(225); spinBoxAngle->setValue(225);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::ArrowRightUp() void DialogTool::ArrowRightUp()
{ {
Q_CHECK_PTR(spinBoxAngle); Q_CHECK_PTR(spinBoxAngle);
spinBoxAngle->setValue(45); spinBoxAngle->setValue(45);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::ArrowRightDown() void DialogTool::ArrowRightDown()
{ {
Q_CHECK_PTR(spinBoxAngle); Q_CHECK_PTR(spinBoxAngle);
spinBoxAngle->setValue(315); spinBoxAngle->setValue(315);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::EvalFormula() void DialogTool::EvalFormula()
{ {
Q_CHECK_PTR(lineEditFormula); Q_CHECK_PTR(lineEditFormula);
@ -524,6 +561,7 @@ void DialogTool::EvalFormula()
Eval(lineEditFormula, flagFormula, timerFormula, labelResultCalculation); Eval(lineEditFormula, flagFormula, timerFormula, labelResultCalculation);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::SizeHeight() void DialogTool::SizeHeight()
{ {
Q_CHECK_PTR(listWidget); Q_CHECK_PTR(listWidget);
@ -544,36 +582,43 @@ void DialogTool::SizeHeight()
listWidget->setCurrentRow (0); listWidget->setCurrentRow (0);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::Measurements() void DialogTool::Measurements()
{ {
ShowVariable(data->DataMeasurements()); ShowVariable(data->DataMeasurements());
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::LengthLines() void DialogTool::LengthLines()
{ {
ShowVariable(data->DataLengthLines()); ShowVariable(data->DataLengthLines());
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::LengthArcs() void DialogTool::LengthArcs()
{ {
ShowVariable(data->DataLengthArcs()); ShowVariable(data->DataLengthArcs());
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::LengthCurves() void DialogTool::LengthCurves()
{ {
ShowVariable(data->DataLengthSplines()); ShowVariable(data->DataLengthSplines());
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::Increments() void DialogTool::Increments()
{ {
ShowVariable(data->DataIncrements()); ShowVariable(data->DataIncrements());
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::PutHere() void DialogTool::PutHere()
{ {
PutValHere(lineEditFormula, listWidget); PutValHere(lineEditFormula, listWidget);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::PutVal(QListWidgetItem *item) void DialogTool::PutVal(QListWidgetItem *item)
{ {
Q_CHECK_PTR(lineEditFormula); Q_CHECK_PTR(lineEditFormula);
@ -585,6 +630,7 @@ void DialogTool::PutVal(QListWidgetItem *item)
lineEditFormula->setCursorPosition(pos + item->text().size()); lineEditFormula->setCursorPosition(pos + item->text().size());
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::ValChenged(int row) void DialogTool::ValChenged(int row)
{ {
Q_CHECK_PTR(listWidget); Q_CHECK_PTR(listWidget);
@ -653,6 +699,7 @@ void DialogTool::ValChenged(int row)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::UpdateList() void DialogTool::UpdateList()
{ {
Q_CHECK_PTR(radioButtonSizeGrowth); Q_CHECK_PTR(radioButtonSizeGrowth);
@ -688,6 +735,7 @@ void DialogTool::UpdateList()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
template <class key, class val> template <class key, class val>
void DialogTool::ShowVariable(const QHash<key, val> *var) void DialogTool::ShowVariable(const QHash<key, val> *var)
{ {

View File

@ -31,6 +31,7 @@
#include <QPushButton> #include <QPushButton>
//---------------------------------------------------------------------------------------------------------------------
DialogTriangle::DialogTriangle(const VContainer *data, QWidget *parent) DialogTriangle::DialogTriangle(const VContainer *data, QWidget *parent)
:DialogTool(data, parent), ui(new Ui::DialogTriangle), number(0), pointName(QString()), axisP1Id(0), :DialogTool(data, parent), ui(new Ui::DialogTriangle), number(0), pointName(QString()), axisP1Id(0),
axisP2Id(0), firstPointId(0), secondPointId(0) axisP2Id(0), firstPointId(0), secondPointId(0)
@ -49,11 +50,13 @@ DialogTriangle::DialogTriangle(const VContainer *data, QWidget *parent)
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogTriangle::NamePointChanged); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogTriangle::NamePointChanged);
} }
//---------------------------------------------------------------------------------------------------------------------
DialogTriangle::~DialogTriangle() DialogTriangle::~DialogTriangle()
{ {
delete ui; delete ui;
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTriangle::ChoosedObject(quint32 id, const Valentina::Scenes &type) void DialogTriangle::ChoosedObject(quint32 id, const Valentina::Scenes &type)
{ {
if (type == Valentina::Point) if (type == Valentina::Point)
@ -91,6 +94,7 @@ void DialogTriangle::ChoosedObject(quint32 id, const Valentina::Scenes &type)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTriangle::DialogAccepted() void DialogTriangle::DialogAccepted()
{ {
pointName = ui->lineEditNamePoint->text(); pointName = ui->lineEditNamePoint->text();
@ -101,30 +105,35 @@ void DialogTriangle::DialogAccepted()
emit DialogClosed(QDialog::Accepted); emit DialogClosed(QDialog::Accepted);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTriangle::setPointName(const QString &value) void DialogTriangle::setPointName(const QString &value)
{ {
pointName = value; pointName = value;
ui->lineEditNamePoint->setText(pointName); ui->lineEditNamePoint->setText(pointName);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTriangle::setSecondPointId(const quint32 &value, const quint32 &id) void DialogTriangle::setSecondPointId(const quint32 &value, const quint32 &id)
{ {
secondPointId = value; secondPointId = value;
setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id); setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTriangle::setFirstPointId(const quint32 &value, const quint32 &id) void DialogTriangle::setFirstPointId(const quint32 &value, const quint32 &id)
{ {
firstPointId = value; firstPointId = value;
setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id); setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTriangle::setAxisP2Id(const quint32 &value, const quint32 &id) void DialogTriangle::setAxisP2Id(const quint32 &value, const quint32 &id)
{ {
axisP2Id = value; axisP2Id = value;
setCurrentPointId(ui->comboBoxAxisP2, axisP2Id, value, id); setCurrentPointId(ui->comboBoxAxisP2, axisP2Id, value, id);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogTriangle::setAxisP1Id(const quint32 &value, const quint32 &id) void DialogTriangle::setAxisP1Id(const quint32 &value, const quint32 &id)
{ {
axisP1Id = value; axisP1Id = value;

View File

@ -29,6 +29,7 @@
#include "dialoguniondetails.h" #include "dialoguniondetails.h"
#include "ui_dialoguniondetails.h" #include "ui_dialoguniondetails.h"
//---------------------------------------------------------------------------------------------------------------------
DialogUnionDetails::DialogUnionDetails(const VContainer *data, QWidget *parent) : DialogUnionDetails::DialogUnionDetails(const VContainer *data, QWidget *parent) :
DialogTool(data, parent), ui(new Ui::DialogUnionDetails), indexD1(0), indexD2(0), d1(0), d2(0), numberD(0), DialogTool(data, parent), ui(new Ui::DialogUnionDetails), indexD1(0), indexD2(0), d1(0), d2(0), numberD(0),
numberP(0), p1(0), p2(0) numberP(0), p1(0), p2(0)
@ -37,11 +38,13 @@ DialogUnionDetails::DialogUnionDetails(const VContainer *data, QWidget *parent)
InitOkCansel(ui); InitOkCansel(ui);
} }
//---------------------------------------------------------------------------------------------------------------------
DialogUnionDetails::~DialogUnionDetails() DialogUnionDetails::~DialogUnionDetails()
{ {
delete ui; delete ui;
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogUnionDetails::ChoosedObject(quint32 id, const Valentina::Scenes &type) void DialogUnionDetails::ChoosedObject(quint32 id, const Valentina::Scenes &type)
{ {
if (numberD == 0) if (numberD == 0)
@ -54,11 +57,13 @@ void DialogUnionDetails::ChoosedObject(quint32 id, const Valentina::Scenes &type
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogUnionDetails::DialogAccepted() void DialogUnionDetails::DialogAccepted()
{ {
emit DialogClosed(QDialog::Accepted); emit DialogClosed(QDialog::Accepted);
} }
//---------------------------------------------------------------------------------------------------------------------
bool DialogUnionDetails::CheckObject(const quint32 &id, const quint32 &idDetail) const bool DialogUnionDetails::CheckObject(const quint32 &id, const quint32 &idDetail) const
{ {
if (idDetail == 0) if (idDetail == 0)
@ -69,6 +74,7 @@ bool DialogUnionDetails::CheckObject(const quint32 &id, const quint32 &idDetail)
return det.Containes(id); return det.Containes(id);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogUnionDetails::ChoosedDetail(const quint32 &id, const Valentina::Scenes &type, quint32 &idDetail, void DialogUnionDetails::ChoosedDetail(const quint32 &id, const Valentina::Scenes &type, quint32 &idDetail,
ptrdiff_t &index) ptrdiff_t &index)
{ {

View File

@ -31,22 +31,24 @@
#include <QSpacerItem> #include <QSpacerItem>
#include <QGridLayout> #include <QGridLayout>
//---------------------------------------------------------------------------------------------------------------------
VException::VException(const QString &what):QException(), what(what), moreInfo(QString()) VException::VException(const QString &what):QException(), what(what), moreInfo(QString())
{ {
Q_ASSERT_X(what.isEmpty() == false, Q_FUNC_INFO, "Error message is empty"); Q_ASSERT_X(what.isEmpty() == false, Q_FUNC_INFO, "Error message is empty");
} }
//---------------------------------------------------------------------------------------------------------------------
VException::VException(const VException &e):what(e.What()), moreInfo(e.MoreInformation()) VException::VException(const VException &e):what(e.What()), moreInfo(e.MoreInformation())
{ {}
}
//---------------------------------------------------------------------------------------------------------------------
QString VException::ErrorMessage() const QString VException::ErrorMessage() const
{ {
QString error = QString("Exception: %1").arg(what); QString error = QString("Exception: %1").arg(what);
return error; return error;
} }
//---------------------------------------------------------------------------------------------------------------------
void VException::CriticalMessageBox(const QString &situation, QWidget * parent) const void VException::CriticalMessageBox(const QString &situation, QWidget * parent) const
{ {
QMessageBox msgBox(parent); QMessageBox msgBox(parent);
@ -67,6 +69,7 @@ void VException::CriticalMessageBox(const QString &situation, QWidget * parent)
msgBox.exec(); msgBox.exec();
} }
//---------------------------------------------------------------------------------------------------------------------
void VException::AddMoreInformation(const QString &info) void VException::AddMoreInformation(const QString &info)
{ {
if (info.isEmpty()) if (info.isEmpty())
@ -76,6 +79,7 @@ void VException::AddMoreInformation(const QString &info)
moreInfo = QString("%1\n%2").arg(moreInfo, info); moreInfo = QString("%1\n%2").arg(moreInfo, info);
} }
//---------------------------------------------------------------------------------------------------------------------
QString VException::MoreInfo(const QString &detInfo) const QString VException::MoreInfo(const QString &detInfo) const
{ {
if (moreInfo.isEmpty() == false) if (moreInfo.isEmpty() == false)

View File

@ -28,6 +28,7 @@
#include "vexceptionbadid.h" #include "vexceptionbadid.h"
//---------------------------------------------------------------------------------------------------------------------
QString VExceptionBadId::ErrorMessage() const QString VExceptionBadId::ErrorMessage() const
{ {
QString error; QString error;

View File

@ -28,18 +28,19 @@
#include "vexceptionconversionerror.h" #include "vexceptionconversionerror.h"
//---------------------------------------------------------------------------------------------------------------------
VExceptionConversionError::VExceptionConversionError(const QString &what, const QString &str) VExceptionConversionError::VExceptionConversionError(const QString &what, const QString &str)
:VException(what), str(str) :VException(what), str(str)
{ {
Q_ASSERT_X(str.isEmpty() == false, Q_FUNC_INFO, "Error converting string is empty"); Q_ASSERT_X(str.isEmpty() == false, Q_FUNC_INFO, "Error converting string is empty");
} }
//---------------------------------------------------------------------------------------------------------------------
VExceptionConversionError::VExceptionConversionError(const VExceptionConversionError &e) VExceptionConversionError::VExceptionConversionError(const VExceptionConversionError &e)
:VException(e), str(e.String()) :VException(e), str(e.String())
{ {}
}
//---------------------------------------------------------------------------------------------------------------------
QString VExceptionConversionError::ErrorMessage() const QString VExceptionConversionError::ErrorMessage() const
{ {
QString error = QString("ExceptionConversionError: %1 %2").arg(what, str); QString error = QString("ExceptionConversionError: %1 %2").arg(what, str);

View File

@ -30,6 +30,7 @@
#include <QtWidgets> #include <QtWidgets>
//---------------------------------------------------------------------------------------------------------------------
VExceptionEmptyParameter::VExceptionEmptyParameter(const QString &what, const QString &name, VExceptionEmptyParameter::VExceptionEmptyParameter(const QString &what, const QString &name,
const QDomElement &domElement) const QDomElement &domElement)
: VException(what), name(name), tagText(QString()), tagName(QString()), lineNumber(-1) : VException(what), name(name), tagText(QString()), tagName(QString()), lineNumber(-1)
@ -42,18 +43,19 @@ VExceptionEmptyParameter::VExceptionEmptyParameter(const QString &what, const QS
lineNumber = domElement.lineNumber(); lineNumber = domElement.lineNumber();
} }
//---------------------------------------------------------------------------------------------------------------------
VExceptionEmptyParameter::VExceptionEmptyParameter(const VExceptionEmptyParameter &e) VExceptionEmptyParameter::VExceptionEmptyParameter(const VExceptionEmptyParameter &e)
:VException(e), name(e.Name()), tagText(e.TagText()), tagName(e.TagName()), lineNumber(e.LineNumber()) :VException(e), name(e.Name()), tagText(e.TagText()), tagName(e.TagName()), lineNumber(e.LineNumber())
{ {}
}
//---------------------------------------------------------------------------------------------------------------------
QString VExceptionEmptyParameter::ErrorMessage() const QString VExceptionEmptyParameter::ErrorMessage() const
{ {
QString error = QString("ExceptionEmptyParameter: %1 %2").arg(what, name); QString error = QString("ExceptionEmptyParameter: %1 %2").arg(what, name);
return error; return error;
} }
//---------------------------------------------------------------------------------------------------------------------
QString VExceptionEmptyParameter::DetailedInformation() const QString VExceptionEmptyParameter::DetailedInformation() const
{ {
return MoreInfo(QString("tag: %1 in line %2\nFull tag:\n%3").arg(tagName).arg(lineNumber).arg(tagText)); return MoreInfo(QString("tag: %1 in line %2\nFull tag:\n%3").arg(tagName).arg(lineNumber).arg(tagText));

View File

@ -29,6 +29,7 @@
#include "vexceptionobjecterror.h" #include "vexceptionobjecterror.h"
#include <QDebug> #include <QDebug>
//---------------------------------------------------------------------------------------------------------------------
VExceptionObjectError::VExceptionObjectError(const QString &what, const QDomElement &domElement) VExceptionObjectError::VExceptionObjectError(const QString &what, const QDomElement &domElement)
:VException(what), tagText(QString()), tagName(QString()), lineNumber(-1) :VException(what), tagText(QString()), tagName(QString()), lineNumber(-1)
{ {
@ -39,18 +40,19 @@ VExceptionObjectError::VExceptionObjectError(const QString &what, const QDomElem
lineNumber = domElement.lineNumber(); lineNumber = domElement.lineNumber();
} }
//---------------------------------------------------------------------------------------------------------------------
VExceptionObjectError::VExceptionObjectError(const VExceptionObjectError &e) VExceptionObjectError::VExceptionObjectError(const VExceptionObjectError &e)
:VException(e), tagText(e.TagText()), tagName(e.TagName()), lineNumber(e.LineNumber()) :VException(e), tagText(e.TagText()), tagName(e.TagName()), lineNumber(e.LineNumber())
{ {}
}
//---------------------------------------------------------------------------------------------------------------------
QString VExceptionObjectError::ErrorMessage() const QString VExceptionObjectError::ErrorMessage() const
{ {
QString error = QString("ExceptionObjectError: %1").arg(what); QString error = QString("ExceptionObjectError: %1").arg(what);
return error; return error;
} }
//---------------------------------------------------------------------------------------------------------------------
QString VExceptionObjectError::DetailedInformation() const QString VExceptionObjectError::DetailedInformation() const
{ {
return MoreInfo(QString("tag: %1 in line %2\n%3").arg(tagName).arg(lineNumber).arg(tagText)); return MoreInfo(QString("tag: %1 in line %2\n%3").arg(tagName).arg(lineNumber).arg(tagText));

View File

@ -29,6 +29,7 @@
#include "vexceptionwrongid.h" #include "vexceptionwrongid.h"
#include <QDebug> #include <QDebug>
//---------------------------------------------------------------------------------------------------------------------
VExceptionWrongId::VExceptionWrongId(const QString &what, const QDomElement &domElement) VExceptionWrongId::VExceptionWrongId(const QString &what, const QDomElement &domElement)
:VException(what), tagText(QString()), tagName(QString()), lineNumber(-1) :VException(what), tagText(QString()), tagName(QString()), lineNumber(-1)
{ {
@ -39,18 +40,19 @@ VExceptionWrongId::VExceptionWrongId(const QString &what, const QDomElement &dom
lineNumber = domElement.lineNumber(); lineNumber = domElement.lineNumber();
} }
//---------------------------------------------------------------------------------------------------------------------
VExceptionWrongId::VExceptionWrongId(const VExceptionWrongId &e) VExceptionWrongId::VExceptionWrongId(const VExceptionWrongId &e)
:VException(e), tagText(e.TagText()), tagName(e.TagName()), lineNumber(e.LineNumber()) :VException(e), tagText(e.TagText()), tagName(e.TagName()), lineNumber(e.LineNumber())
{ {}
}
//---------------------------------------------------------------------------------------------------------------------
QString VExceptionWrongId::ErrorMessage() const QString VExceptionWrongId::ErrorMessage() const
{ {
QString error = QString("ExceptionWrongId: %1").arg(what); QString error = QString("ExceptionWrongId: %1").arg(what);
return error; return error;
} }
//---------------------------------------------------------------------------------------------------------------------
QString VExceptionWrongId::DetailedInformation() const QString VExceptionWrongId::DetailedInformation() const
{ {
return MoreInfo(QString("tag: %1 in line %2\nFull tag:\n%3").arg(tagName).arg(lineNumber).arg(tagText)); return MoreInfo(QString("tag: %1 in line %2\nFull tag:\n%3").arg(tagName).arg(lineNumber).arg(tagText));

View File

@ -33,12 +33,13 @@
class QRectF; class QRectF;
//---------------------------------------------------------------------------------------------------------------------
VArc::VArc () VArc::VArc ()
:VGObject(GObject::Arc), f1(0), formulaF1(QString()), f2(0), formulaF2(QString()), radius(0), :VGObject(GObject::Arc), f1(0), formulaF1(QString()), f2(0), formulaF2(QString()), radius(0),
formulaRadius(QString()), center(VPointF()) formulaRadius(QString()), center(VPointF())
{ {}
}
//---------------------------------------------------------------------------------------------------------------------
VArc::VArc (VPointF center, qreal radius, QString formulaRadius, qreal f1, QString formulaF1, qreal f2, VArc::VArc (VPointF center, qreal radius, QString formulaRadius, qreal f1, QString formulaF1, qreal f2,
QString formulaF2, quint32 idObject, Valentina::Draws mode) QString formulaF2, quint32 idObject, Valentina::Draws mode)
: VGObject(GObject::Arc, idObject, mode), f1(f1), formulaF1(formulaF1), f2(f2), formulaF2(formulaF2), : VGObject(GObject::Arc, idObject, mode), f1(f1), formulaF1(formulaF1), f2(f2), formulaF2(formulaF2),
@ -47,13 +48,14 @@ VArc::VArc (VPointF center, qreal radius, QString formulaRadius, qreal f1, QStri
_name = QString ("Arc_%1").arg(this->GetCenter().name()); _name = QString ("Arc_%1").arg(this->GetCenter().name());
} }
//---------------------------------------------------------------------------------------------------------------------
VArc::VArc(const VArc &arc) VArc::VArc(const VArc &arc)
: VGObject(arc), f1(arc.GetF1()), formulaF1(arc.GetFormulaF1()), f2(arc.GetF2()), : VGObject(arc), f1(arc.GetF1()), formulaF1(arc.GetFormulaF1()), f2(arc.GetF2()),
formulaF2(arc.GetFormulaF2()), radius(arc.GetRadius()), formulaRadius(arc.GetFormulaRadius()), formulaF2(arc.GetFormulaF2()), radius(arc.GetRadius()), formulaRadius(arc.GetFormulaRadius()),
center(arc.GetCenter()) center(arc.GetCenter())
{ {}
}
//---------------------------------------------------------------------------------------------------------------------
VArc &VArc::operator =(const VArc &arc) VArc &VArc::operator =(const VArc &arc)
{ {
VGObject::operator=(arc); VGObject::operator=(arc);
@ -67,11 +69,13 @@ VArc &VArc::operator =(const VArc &arc)
return *this; return *this;
} }
//---------------------------------------------------------------------------------------------------------------------
qreal VArc::GetLength() const qreal VArc::GetLength() const
{ {
return (M_PI * radius)/180 * AngleArc(); return (M_PI * radius)/180 * AngleArc();
} }
//---------------------------------------------------------------------------------------------------------------------
QPointF VArc::GetP1() const QPointF VArc::GetP1() const
{ {
QPointF p1 ( GetCenter().x () + radius, GetCenter().y () ); QPointF p1 ( GetCenter().x () + radius, GetCenter().y () );
@ -80,6 +84,7 @@ QPointF VArc::GetP1() const
return centerP1.p2(); return centerP1.p2();
} }
//---------------------------------------------------------------------------------------------------------------------
QPointF VArc::GetP2 () const QPointF VArc::GetP2 () const
{ {
QPointF p2 ( GetCenter().x () + radius, GetCenter().y () ); QPointF p2 ( GetCenter().x () + radius, GetCenter().y () );
@ -88,6 +93,7 @@ QPointF VArc::GetP2 () const
return centerP2.p2(); return centerP2.p2();
} }
//---------------------------------------------------------------------------------------------------------------------
QPainterPath VArc::GetPath() const QPainterPath VArc::GetPath() const
{ {
QPainterPath path; QPainterPath path;
@ -108,6 +114,7 @@ QPainterPath VArc::GetPath() const
return path; return path;
} }
//---------------------------------------------------------------------------------------------------------------------
qreal VArc::AngleArc() const qreal VArc::AngleArc() const
{ {
QLineF l1(0, 0, 100, 100); QLineF l1(0, 0, 100, 100);
@ -117,6 +124,7 @@ qreal VArc::AngleArc() const
return l1.angleTo(l2); return l1.angleTo(l2);
} }
//---------------------------------------------------------------------------------------------------------------------
QVector<QPointF> VArc::GetPoints() const QVector<QPointF> VArc::GetPoints() const
{ {
QVector<QPointF> points; QVector<QPointF> points;
@ -140,11 +148,13 @@ QVector<QPointF> VArc::GetPoints() const
return points; return points;
} }
//---------------------------------------------------------------------------------------------------------------------
QString VArc::name() const QString VArc::name() const
{ {
return _name; return _name;
} }
//---------------------------------------------------------------------------------------------------------------------
QPointF VArc::CutArc(const qreal &length, VArc &arc1, VArc &arc2) const QPointF VArc::CutArc(const qreal &length, VArc &arc1, VArc &arc2) const
{ {
//Always need return two arcs, so we must correct wrong length. //Always need return two arcs, so we must correct wrong length.
@ -174,6 +184,7 @@ QPointF VArc::CutArc(const qreal &length, VArc &arc1, VArc &arc2) const
return line.p2(); return line.p2();
} }
//---------------------------------------------------------------------------------------------------------------------
void VArc::setId(const quint32 &id) void VArc::setId(const quint32 &id)
{ {
_id = id; _id = id;

View File

@ -29,10 +29,13 @@
#include "vdetail.h" #include "vdetail.h"
#include <QDebug> #include <QDebug>
//---------------------------------------------------------------------------------------------------------------------
VDetail::VDetail() VDetail::VDetail()
:_id(0), nodes(QVector<VNodeDetail>()), name(QString()), mx(0), my(0), seamAllowance(true), closed(true), :_id(0), nodes(QVector<VNodeDetail>()), name(QString()), mx(0), my(0), seamAllowance(true), closed(true),
width(10){} width(10)
{}
//---------------------------------------------------------------------------------------------------------------------
VDetail::VDetail(const QString &name, const QVector<VNodeDetail> &nodes) VDetail::VDetail(const QString &name, const QVector<VNodeDetail> &nodes)
:_id(0), nodes(QVector<VNodeDetail>()), name(name), mx(0), my(0), seamAllowance(true), closed(true), :_id(0), nodes(QVector<VNodeDetail>()), name(name), mx(0), my(0), seamAllowance(true), closed(true),
width(10) width(10)
@ -40,10 +43,13 @@ VDetail::VDetail(const QString &name, const QVector<VNodeDetail> &nodes)
this->nodes = nodes; this->nodes = nodes;
} }
//---------------------------------------------------------------------------------------------------------------------
VDetail::VDetail(const VDetail &detail) VDetail::VDetail(const VDetail &detail)
:_id(0), nodes(detail.getNodes()), name(detail.getName()), mx(detail.getMx()), my(detail.getMy()), :_id(0), nodes(detail.getNodes()), name(detail.getName()), mx(detail.getMx()), my(detail.getMy()),
seamAllowance(detail.getSeamAllowance()), closed(detail.getClosed()), width(detail.getWidth()){} seamAllowance(detail.getSeamAllowance()), closed(detail.getClosed()), width(detail.getWidth())
{}
//---------------------------------------------------------------------------------------------------------------------
VDetail &VDetail::operator =(const VDetail &detail) VDetail &VDetail::operator =(const VDetail &detail)
{ {
_id = detail.id(); _id = detail.id();
@ -57,6 +63,7 @@ VDetail &VDetail::operator =(const VDetail &detail)
return *this; return *this;
} }
//---------------------------------------------------------------------------------------------------------------------
void VDetail::Clear() void VDetail::Clear()
{ {
nodes.clear(); nodes.clear();
@ -68,11 +75,13 @@ void VDetail::Clear()
width = 10; width = 10;
} }
//---------------------------------------------------------------------------------------------------------------------
void VDetail::ClearNodes() void VDetail::ClearNodes()
{ {
nodes.clear(); nodes.clear();
} }
//---------------------------------------------------------------------------------------------------------------------
bool VDetail::Containes(const quint32 &id) const bool VDetail::Containes(const quint32 &id) const
{ {
for (ptrdiff_t i = 0; i < nodes.size(); ++i) for (ptrdiff_t i = 0; i < nodes.size(); ++i)
@ -86,31 +95,37 @@ bool VDetail::Containes(const quint32 &id) const
return false; return false;
} }
//---------------------------------------------------------------------------------------------------------------------
VNodeDetail &VDetail::operator [](ptrdiff_t indx) VNodeDetail &VDetail::operator [](ptrdiff_t indx)
{ {
return nodes[indx]; return nodes[indx];
} }
//---------------------------------------------------------------------------------------------------------------------
const VNodeDetail &VDetail::at(ptrdiff_t indx) const const VNodeDetail &VDetail::at(ptrdiff_t indx) const
{ {
return nodes[indx]; return nodes[indx];
} }
//---------------------------------------------------------------------------------------------------------------------
ptrdiff_t VDetail::indexOfNode(const quint32 &id) const ptrdiff_t VDetail::indexOfNode(const quint32 &id) const
{ {
return indexOfNode(nodes, id); return indexOfNode(nodes, id);
} }
//---------------------------------------------------------------------------------------------------------------------
quint32 VDetail::id() const quint32 VDetail::id() const
{ {
return _id; return _id;
} }
//---------------------------------------------------------------------------------------------------------------------
void VDetail::setId(const quint32 &id) void VDetail::setId(const quint32 &id)
{ {
_id = id; _id = id;
} }
//---------------------------------------------------------------------------------------------------------------------
bool VDetail::OnEdge(const quint32 &p1, const quint32 &p2) const bool VDetail::OnEdge(const quint32 &p1, const quint32 &p2) const
{ {
QVector<VNodeDetail> list = listNodePoint(); QVector<VNodeDetail> list = listNodePoint();
@ -148,6 +163,7 @@ bool VDetail::OnEdge(const quint32 &p1, const quint32 &p2) const
} }
} }
//---------------------------------------------------------------------------------------------------------------------
ptrdiff_t VDetail::Edge(const quint32 &p1, const quint32 &p2) const ptrdiff_t VDetail::Edge(const quint32 &p1, const quint32 &p2) const
{ {
if (OnEdge(p1, p2) == false) if (OnEdge(p1, p2) == false)
@ -172,6 +188,7 @@ ptrdiff_t VDetail::Edge(const quint32 &p1, const quint32 &p2) const
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VDetail::NodeOnEdge(const quint32 &index, VNodeDetail &p1, VNodeDetail &p2) const void VDetail::NodeOnEdge(const quint32 &index, VNodeDetail &p1, VNodeDetail &p2) const
{ {
QVector<VNodeDetail> list = listNodePoint(); QVector<VNodeDetail> list = listNodePoint();
@ -191,6 +208,7 @@ void VDetail::NodeOnEdge(const quint32 &index, VNodeDetail &p1, VNodeDetail &p2)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
VDetail VDetail::RemoveEdge(const quint32 &index) const VDetail VDetail::RemoveEdge(const quint32 &index) const
{ {
VDetail det(*this); VDetail det(*this);
@ -233,6 +251,7 @@ VDetail VDetail::RemoveEdge(const quint32 &index) const
return det; return det;
} }
//---------------------------------------------------------------------------------------------------------------------
QList<quint32> VDetail::Missing(const VDetail &det) const QList<quint32> VDetail::Missing(const VDetail &det) const
{ {
QList<quint32> list; QList<quint32> list;
@ -256,6 +275,7 @@ QList<quint32> VDetail::Missing(const VDetail &det) const
return list; return list;
} }
//---------------------------------------------------------------------------------------------------------------------
QVector<VNodeDetail> VDetail::listNodePoint() const QVector<VNodeDetail> VDetail::listNodePoint() const
{ {
QVector<VNodeDetail> list; QVector<VNodeDetail> list;
@ -269,6 +289,7 @@ QVector<VNodeDetail> VDetail::listNodePoint() const
return list; return list;
} }
//---------------------------------------------------------------------------------------------------------------------
ptrdiff_t VDetail::indexOfNode(const QVector<VNodeDetail> &list, const quint32 &id) ptrdiff_t VDetail::indexOfNode(const QVector<VNodeDetail> &list, const quint32 &id)
{ {
for (ptrdiff_t i = 0; i < list.size(); ++i) for (ptrdiff_t i = 0; i < list.size(); ++i)

View File

@ -30,6 +30,7 @@
#include "../widgets/vapplication.h" #include "../widgets/vapplication.h"
#include <QDebug> #include <QDebug>
//---------------------------------------------------------------------------------------------------------------------
QPainterPath VEquidistant::ContourPath(const quint32 &idDetail, const VContainer *data) const QPainterPath VEquidistant::ContourPath(const quint32 &idDetail, const VContainer *data) const
{ {
Q_CHECK_PTR(data); Q_CHECK_PTR(data);
@ -159,6 +160,7 @@ QPainterPath VEquidistant::ContourPath(const quint32 &idDetail, const VContainer
return path; return path;
} }
//---------------------------------------------------------------------------------------------------------------------
qreal VEquidistant::GetLengthContour(const QVector<QPointF> &contour, const QVector<QPointF> &newPoints) qreal VEquidistant::GetLengthContour(const QVector<QPointF> &contour, const QVector<QPointF> &newPoints)
{ {
qreal length = 0; qreal length = 0;
@ -172,6 +174,7 @@ qreal VEquidistant::GetLengthContour(const QVector<QPointF> &contour, const QVec
return length; return length;
} }
//---------------------------------------------------------------------------------------------------------------------
QVector<QPointF> VEquidistant::biasPoints(const QVector<QPointF> &points, const qreal &mx, const qreal &my) QVector<QPointF> VEquidistant::biasPoints(const QVector<QPointF> &points, const qreal &mx, const qreal &my)
{ {
QVector<QPointF> p; QVector<QPointF> p;
@ -185,6 +188,7 @@ QVector<QPointF> VEquidistant::biasPoints(const QVector<QPointF> &points, const
return p; return p;
} }
//---------------------------------------------------------------------------------------------------------------------
QVector<QPointF> VEquidistant::CorrectEquidistantPoints(const QVector<QPointF> &points) QVector<QPointF> VEquidistant::CorrectEquidistantPoints(const QVector<QPointF> &points)
{ {
QVector<QPointF> correctPoints; QVector<QPointF> correctPoints;
@ -230,6 +234,7 @@ QVector<QPointF> VEquidistant::CorrectEquidistantPoints(const QVector<QPointF> &
return correctPoints; return correctPoints;
} }
//---------------------------------------------------------------------------------------------------------------------
QPainterPath VEquidistant::Equidistant(QVector<QPointF> points, const Detail::Equidistant &eqv, QPainterPath VEquidistant::Equidistant(QVector<QPointF> points, const Detail::Equidistant &eqv,
const qreal &width) const qreal &width)
{ {
@ -297,6 +302,7 @@ QPainterPath VEquidistant::Equidistant(QVector<QPointF> points, const Detail::Eq
return ekv; return ekv;
} }
//---------------------------------------------------------------------------------------------------------------------
QVector<QPointF> VEquidistant::CheckLoops(const QVector<QPointF> &points) QVector<QPointF> VEquidistant::CheckLoops(const QVector<QPointF> &points)
{ {
QVector<QPointF> ekvPoints; QVector<QPointF> ekvPoints;
@ -355,6 +361,7 @@ QVector<QPointF> VEquidistant::CheckLoops(const QVector<QPointF> &points)
return ekvPoints; return ekvPoints;
} }
//---------------------------------------------------------------------------------------------------------------------
QVector<QPointF> VEquidistant::GetReversePoint(const QVector<QPointF> &points) QVector<QPointF> VEquidistant::GetReversePoint(const QVector<QPointF> &points)
{ {
Q_ASSERT(points.size() > 0); Q_ASSERT(points.size() > 0);
@ -366,6 +373,7 @@ QVector<QPointF> VEquidistant::GetReversePoint(const QVector<QPointF> &points)
return reversePoints; return reversePoints;
} }
//---------------------------------------------------------------------------------------------------------------------
QVector<QPointF> VEquidistant::EkvPoint(const QLineF &line1, const QLineF &line2, const qreal &width) QVector<QPointF> VEquidistant::EkvPoint(const QLineF &line1, const QLineF &line2, const qreal &width)
{ {
Q_ASSERT(width > 0); Q_ASSERT(width > 0);
@ -415,6 +423,7 @@ QVector<QPointF> VEquidistant::EkvPoint(const QLineF &line1, const QLineF &line2
return points; return points;
} }
//---------------------------------------------------------------------------------------------------------------------
QLineF VEquidistant::ParallelLine(const QLineF &line, qreal width) QLineF VEquidistant::ParallelLine(const QLineF &line, qreal width)
{ {
Q_ASSERT(width > 0); Q_ASSERT(width > 0);
@ -423,6 +432,7 @@ QLineF VEquidistant::ParallelLine(const QLineF &line, qreal width)
return paralel; return paralel;
} }
//---------------------------------------------------------------------------------------------------------------------
QPointF VEquidistant::SingleParallelPoint(const QLineF &line, const qreal &angle, const qreal &width) QPointF VEquidistant::SingleParallelPoint(const QLineF &line, const qreal &angle, const qreal &width)
{ {
Q_ASSERT(width > 0); Q_ASSERT(width > 0);

View File

@ -28,21 +28,22 @@
#include "vgobject.h" #include "vgobject.h"
//---------------------------------------------------------------------------------------------------------------------
VGObject::VGObject() VGObject::VGObject()
:_id(0), type(GObject::Point), idObject(0), _name(QString()), mode(Valentina::Calculation) :_id(0), type(GObject::Point), idObject(0), _name(QString()), mode(Valentina::Calculation)
{ {}
}
//---------------------------------------------------------------------------------------------------------------------
VGObject::VGObject(const GObject::Type &type, const quint32 &idObject, const Valentina::Draws &mode) VGObject::VGObject(const GObject::Type &type, const quint32 &idObject, const Valentina::Draws &mode)
:_id(0), type(type), idObject(idObject), _name(QString()), mode(mode) :_id(0), type(type), idObject(idObject), _name(QString()), mode(mode)
{ {}
}
//---------------------------------------------------------------------------------------------------------------------
VGObject::VGObject(const VGObject &obj) VGObject::VGObject(const VGObject &obj)
:_id(obj.id()), type(obj.getType()), idObject(obj.getIdObject()), _name(obj.name()), mode(obj.getMode()) :_id(obj.id()), type(obj.getType()), idObject(obj.getIdObject()), _name(obj.name()), mode(obj.getMode())
{ {}
}
//---------------------------------------------------------------------------------------------------------------------
VGObject &VGObject::operator=(const VGObject &obj) VGObject &VGObject::operator=(const VGObject &obj)
{ {
this->_id = obj.id(); this->_id = obj.id();
@ -53,21 +54,25 @@ VGObject &VGObject::operator=(const VGObject &obj)
return *this; return *this;
} }
//---------------------------------------------------------------------------------------------------------------------
quint32 VGObject::getIdObject() const quint32 VGObject::getIdObject() const
{ {
return idObject; return idObject;
} }
//---------------------------------------------------------------------------------------------------------------------
void VGObject::setIdObject(const quint32 &value) void VGObject::setIdObject(const quint32 &value)
{ {
idObject = value; idObject = value;
} }
//---------------------------------------------------------------------------------------------------------------------
QString VGObject::name() const QString VGObject::name() const
{ {
return _name; return _name;
} }
//---------------------------------------------------------------------------------------------------------------------
void VGObject::setName(const QString &name) void VGObject::setName(const QString &name)
{ {
_name = name; _name = name;
@ -78,21 +83,25 @@ Valentina::Draws VGObject::getMode() const
return mode; return mode;
} }
//---------------------------------------------------------------------------------------------------------------------
void VGObject::setMode(const Valentina::Draws &value) void VGObject::setMode(const Valentina::Draws &value)
{ {
mode = value; mode = value;
} }
//---------------------------------------------------------------------------------------------------------------------
GObject::Type VGObject::getType() const GObject::Type VGObject::getType() const
{ {
return type; return type;
} }
//---------------------------------------------------------------------------------------------------------------------
quint32 VGObject::id() const quint32 VGObject::id() const
{ {
return _id; return _id;
} }
//---------------------------------------------------------------------------------------------------------------------
void VGObject::setId(const quint32 &id) void VGObject::setId(const quint32 &id)
{ {
_id = id; _id = id;

View File

@ -28,15 +28,22 @@
#include "vnodedetail.h" #include "vnodedetail.h"
//---------------------------------------------------------------------------------------------------------------------
VNodeDetail::VNodeDetail() VNodeDetail::VNodeDetail()
:id(0), typeTool(Valentina::NodePoint), typeNode(NodeDetail::Contour), mx(0), my(0){} :id(0), typeTool(Valentina::NodePoint), typeNode(NodeDetail::Contour), mx(0), my(0)
{}
//---------------------------------------------------------------------------------------------------------------------
VNodeDetail::VNodeDetail(quint32 id, Valentina::Tools typeTool, NodeDetail::NodeDetails typeNode, qreal mx, qreal my) VNodeDetail::VNodeDetail(quint32 id, Valentina::Tools typeTool, NodeDetail::NodeDetails typeNode, qreal mx, qreal my)
:id(id), typeTool(typeTool), typeNode(typeNode), mx(mx), my(my){} :id(id), typeTool(typeTool), typeNode(typeNode), mx(mx), my(my)
{}
//---------------------------------------------------------------------------------------------------------------------
VNodeDetail::VNodeDetail(const VNodeDetail &node) VNodeDetail::VNodeDetail(const VNodeDetail &node)
:id(node.getId()), typeTool(node.getTypeTool()), typeNode(node.getTypeNode()), mx(node.getMx()), my(node.getMy()){} :id(node.getId()), typeTool(node.getTypeTool()), typeNode(node.getTypeNode()), mx(node.getMx()), my(node.getMy())
{}
//---------------------------------------------------------------------------------------------------------------------
VNodeDetail &VNodeDetail::operator =(const VNodeDetail &node) VNodeDetail &VNodeDetail::operator =(const VNodeDetail &node)
{ {
id = node.getId(); id = node.getId();

View File

@ -28,27 +28,26 @@
#include "vpointf.h" #include "vpointf.h"
//---------------------------------------------------------------------------------------------------------------------
VPointF::VPointF(qreal x, qreal y, QString name, qreal mx, qreal my, quint32 idObject, Valentina::Draws mode) VPointF::VPointF(qreal x, qreal y, QString name, qreal mx, qreal my, quint32 idObject, Valentina::Draws mode)
:VGObject(GObject::Point, idObject, mode), _mx(mx), _my(my), _x(x), _y(y) :VGObject(GObject::Point, idObject, mode), _mx(mx), _my(my), _x(x), _y(y)
{ {
this->_name = name; this->_name = name;
} }
//---------------------------------------------------------------------------------------------------------------------
VPointF::VPointF() :VGObject(GObject::Point, 0, Valentina::Calculation), _mx(0), _my(0), _x(0), _y(0) VPointF::VPointF() :VGObject(GObject::Point, 0, Valentina::Calculation), _mx(0), _my(0), _x(0), _y(0)
{ {}
}
//---------------------------------------------------------------------------------------------------------------------
VPointF::VPointF(const VPointF &point) :VGObject(point), _mx(point.mx()), _my(point.my()), _x(point.x()), _y(point.y()) VPointF::VPointF(const VPointF &point) :VGObject(point), _mx(point.mx()), _my(point.my()), _x(point.x()), _y(point.y())
{ {}
}
//---------------------------------------------------------------------------------------------------------------------
VPointF::VPointF(const QPointF &point) :VGObject(VPointF()), _mx(0), _my(0), _x(point.x()), _y(point.y()) VPointF::VPointF(const QPointF &point) :VGObject(VPointF()), _mx(0), _my(0), _x(point.x()), _y(point.y())
{ {}
}
//---------------------------------------------------------------------------------------------------------------------
VPointF &VPointF::operator =(const VPointF &point) VPointF &VPointF::operator =(const VPointF &point)
{ {
VGObject::operator=(point); VGObject::operator=(point);

View File

@ -30,15 +30,20 @@
#include <QDebug> #include <QDebug>
//---------------------------------------------------------------------------------------------------------------------
VSpline::VSpline() VSpline::VSpline()
:VGObject(GObject::Spline), p1(VPointF()), p2(QPointF()), p3(QPointF()), p4(VPointF()), angle1(0), angle2(0), :VGObject(GObject::Spline), p1(VPointF()), p2(QPointF()), p3(QPointF()), p4(VPointF()), angle1(0), angle2(0),
kAsm1(1), kAsm2(1), kCurve(1){} kAsm1(1), kAsm2(1), kCurve(1)
{}
//---------------------------------------------------------------------------------------------------------------------
VSpline::VSpline ( const VSpline & spline ) VSpline::VSpline ( const VSpline & spline )
:VGObject(spline), p1(spline.GetP1 ()), p2(spline.GetP2 ()), p3(spline.GetP3 ()), p4(spline.GetP4 ()), :VGObject(spline), p1(spline.GetP1 ()), p2(spline.GetP2 ()), p3(spline.GetP3 ()), p4(spline.GetP4 ()),
angle1(spline.GetAngle1 ()), angle2(spline.GetAngle2 ()), kAsm1(spline.GetKasm1()), kAsm2(spline.GetKasm2()), angle1(spline.GetAngle1 ()), angle2(spline.GetAngle2 ()), kAsm1(spline.GetKasm1()), kAsm2(spline.GetKasm2()),
kCurve(spline.GetKcurve()){} kCurve(spline.GetKcurve())
{}
//---------------------------------------------------------------------------------------------------------------------
VSpline::VSpline (VPointF p1, VPointF p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve, VSpline::VSpline (VPointF p1, VPointF p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve,
quint32 idObject, Valentina::Draws mode) quint32 idObject, Valentina::Draws mode)
:VGObject(GObject::Spline, idObject, mode), p1(p1), p2(QPointF()), p3(QPointF()), p4(p4), angle1(angle1), :VGObject(GObject::Spline, idObject, mode), p1(p1), p2(QPointF()), p3(QPointF()), p4(p4), angle1(angle1),
@ -67,6 +72,7 @@ VSpline::VSpline (VPointF p1, VPointF p4, qreal angle1, qreal angle2, qreal kAsm
this->p3 = p4p3.p2(); this->p3 = p4p3.p2();
} }
//---------------------------------------------------------------------------------------------------------------------
VSpline::VSpline (VPointF p1, QPointF p2, QPointF p3, VPointF p4, qreal kCurve, quint32 idObject, Valentina::Draws mode) VSpline::VSpline (VPointF p1, QPointF p2, QPointF p3, VPointF p4, qreal kCurve, quint32 idObject, Valentina::Draws mode)
:VGObject(GObject::Spline, idObject, mode), p1(p1), p2(p2), p3(p3), p4(p4), angle1(0), angle2(0), kAsm1(1), :VGObject(GObject::Spline, idObject, mode), p1(p1), p2(p2), p3(p3), p4(p4), angle1(0), angle2(0), kAsm1(1),
kAsm2(1), kCurve(1) kAsm2(1), kCurve(1)
@ -91,16 +97,19 @@ VSpline::VSpline (VPointF p1, QPointF p2, QPointF p3, VPointF p4, qreal kCurve,
this->kAsm2 = QLineF ( GetP4().toQPointF(), p3 ).length()/L; this->kAsm2 = QLineF ( GetP4().toQPointF(), p3 ).length()/L;
} }
//---------------------------------------------------------------------------------------------------------------------
qreal VSpline::GetLength () const qreal VSpline::GetLength () const
{ {
return LengthBezier ( GetP1().toQPointF(), this->p2, this->p3, GetP4().toQPointF()); return LengthBezier ( GetP1().toQPointF(), this->p2, this->p3, GetP4().toQPointF());
} }
//---------------------------------------------------------------------------------------------------------------------
QString VSpline::name() const QString VSpline::name() const
{ {
return _name; return _name;
} }
//---------------------------------------------------------------------------------------------------------------------
QLineF::IntersectType VSpline::CrossingSplLine ( const QLineF &line, QPointF *intersectionPoint ) const QLineF::IntersectType VSpline::CrossingSplLine ( const QLineF &line, QPointF *intersectionPoint ) const
{ {
QVector<qreal> px; QVector<qreal> px;
@ -130,6 +139,7 @@ QLineF::IntersectType VSpline::CrossingSplLine ( const QLineF &line, QPointF *in
throw "Can't found point of intersection spline and line."; throw "Can't found point of intersection spline and line.";
} }
//---------------------------------------------------------------------------------------------------------------------
qreal VSpline::LengthT(qreal t) const qreal VSpline::LengthT(qreal t) const
{ {
if (t < 0 || t > 1) if (t < 0 || t > 1)
@ -164,6 +174,7 @@ qreal VSpline::LengthT(qreal t) const
return LengthBezier ( GetP1().toQPointF(), p12, p123, p1234); return LengthBezier ( GetP1().toQPointF(), p12, p123, p1234);
} }
//---------------------------------------------------------------------------------------------------------------------
QPointF VSpline::CutSpline ( qreal length, QPointF &spl1p2, QPointF &spl1p3, QPointF &spl2p2, QPointF &spl2p3 ) const QPointF VSpline::CutSpline ( qreal length, QPointF &spl1p2, QPointF &spl1p3, QPointF &spl2p2, QPointF &spl2p3 ) const
{ {
//Always need return two splines, so we must correct wrong length. //Always need return two splines, so we must correct wrong length.
@ -223,11 +234,13 @@ QPointF VSpline::CutSpline ( qreal length, QPointF &spl1p2, QPointF &spl1p3, QPo
return p1234; return p1234;
} }
//---------------------------------------------------------------------------------------------------------------------
QVector<QPointF> VSpline::GetPoints () const QVector<QPointF> VSpline::GetPoints () const
{ {
return GetPoints(GetP1().toQPointF(), p2, p3, GetP4().toQPointF()); return GetPoints(GetP1().toQPointF(), p2, p3, GetP4().toQPointF());
} }
//---------------------------------------------------------------------------------------------------------------------
QVector<QPointF> VSpline::GetPoints (const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4) QVector<QPointF> VSpline::GetPoints (const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4)
{ {
QVector<QPointF> pvector; QVector<QPointF> pvector;
@ -248,6 +261,7 @@ QVector<QPointF> VSpline::GetPoints (const QPointF &p1, const QPointF &p2, const
return pvector; return pvector;
} }
//---------------------------------------------------------------------------------------------------------------------
qreal VSpline::LengthBezier ( const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4 ) const qreal VSpline::LengthBezier ( const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4 ) const
{ {
QPainterPath splinePath; QPainterPath splinePath;
@ -260,6 +274,7 @@ qreal VSpline::LengthBezier ( const QPointF &p1, const QPointF &p2, const QPoint
return splinePath.length(); return splinePath.length();
} }
//---------------------------------------------------------------------------------------------------------------------
void VSpline::PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2, void VSpline::PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2,
qreal x3, qreal y3, qreal x4, qreal y4, qreal x3, qreal y3, qreal x4, qreal y4,
qint16 level, QVector<qreal> &px, QVector<qreal> &py) qint16 level, QVector<qreal> &px, QVector<qreal> &py)
@ -271,15 +286,15 @@ void VSpline::PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2,
const double m_cusp_limit = 0.0; const double m_cusp_limit = 0.0;
double m_approximation_scale = 1.0; double m_approximation_scale = 1.0;
double m_distance_tolerance_square; double m_distance_tolerance_square;
m_distance_tolerance_square = 0.5 / m_approximation_scale; m_distance_tolerance_square = 0.5 / m_approximation_scale;
m_distance_tolerance_square *= m_distance_tolerance_square; m_distance_tolerance_square *= m_distance_tolerance_square;
if (level > curve_recursion_limit) if (level > curve_recursion_limit)
{ {
return; return;
} }
// Calculate all the mid-points of the line segments // Calculate all the mid-points of the line segments
//---------------------- //----------------------
const double x12 = (x1 + x2) / 2; const double x12 = (x1 + x2) / 2;
@ -294,16 +309,16 @@ void VSpline::PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2,
const double y234 = (y23 + y34) / 2; const double y234 = (y23 + y34) / 2;
const double x1234 = (x123 + x234) / 2; const double x1234 = (x123 + x234) / 2;
const double y1234 = (y123 + y234) / 2; const double y1234 = (y123 + y234) / 2;
// Try to approximate the full cubic curve by a single straight line // Try to approximate the full cubic curve by a single straight line
//------------------ //------------------
const double dx = x4-x1; const double dx = x4-x1;
const double dy = y4-y1; const double dy = y4-y1;
double d2 = fabs((x2 - x4) * dy - (y2 - y4) * dx); double d2 = fabs((x2 - x4) * dy - (y2 - y4) * dx);
double d3 = fabs((x3 - x4) * dy - (y3 - y4) * dx); double d3 = fabs((x3 - x4) * dy - (y3 - y4) * dx);
switch ((static_cast<int>(d2 > curve_collinearity_epsilon) << 1) + switch ((static_cast<int>(d2 > curve_collinearity_epsilon) << 1) +
static_cast<int>(d3 > curve_collinearity_epsilon)) static_cast<int>(d3 > curve_collinearity_epsilon))
{ {
@ -531,13 +546,14 @@ void VSpline::PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2,
default: default:
break; break;
} }
// Continue subdivision // Continue subdivision
//---------------------- //----------------------
PointBezier_r(x1, y1, x12, y12, x123, y123, x1234, y1234, static_cast<qint16>(level + 1), px, py); PointBezier_r(x1, y1, x12, y12, x123, y123, x1234, y1234, static_cast<qint16>(level + 1), px, py);
PointBezier_r(x1234, y1234, x234, y234, x34, y34, x4, y4, static_cast<qint16>(level + 1), px, py); PointBezier_r(x1234, y1234, x234, y234, x34, y34, x4, y4, static_cast<qint16>(level + 1), px, py);
} }
//---------------------------------------------------------------------------------------------------------------------
qreal VSpline::CalcSqDistance (qreal x1, qreal y1, qreal x2, qreal y2) qreal VSpline::CalcSqDistance (qreal x1, qreal y1, qreal x2, qreal y2)
{ {
qreal dx = x2 - x1; qreal dx = x2 - x1;
@ -545,11 +561,13 @@ qreal VSpline::CalcSqDistance (qreal x1, qreal y1, qreal x2, qreal y2)
return dx * dx + dy * dy; return dx * dx + dy * dy;
} }
//---------------------------------------------------------------------------------------------------------------------
void VSpline::CreateName() void VSpline::CreateName()
{ {
_name = QString("Spl_%1_%2").arg(this->GetP1().name(), this->GetP4().name()); _name = QString("Spl_%1_%2").arg(this->GetP1().name(), this->GetP4().name());
} }
//---------------------------------------------------------------------------------------------------------------------
QPainterPath VSpline::GetPath() const QPainterPath VSpline::GetPath() const
{ {
QPainterPath splinePath; QPainterPath splinePath;
@ -569,6 +587,7 @@ QPainterPath VSpline::GetPath() const
return splinePath; return splinePath;
} }
//---------------------------------------------------------------------------------------------------------------------
QVector<QPointF> VSpline::SplinePoints(const QPointF &p1, const QPointF &p4, qreal angle1, qreal angle2, qreal kAsm1, QVector<QPointF> VSpline::SplinePoints(const QPointF &p1, const QPointF &p4, qreal angle1, qreal angle2, qreal kAsm1,
qreal kAsm2, qreal kCurve) qreal kAsm2, qreal kCurve)
{ {
@ -586,6 +605,7 @@ QVector<QPointF> VSpline::SplinePoints(const QPointF &p1, const QPointF &p4, qre
return GetPoints(p1, p2, p3, p4); return GetPoints(p1, p2, p3, p4);
} }
//---------------------------------------------------------------------------------------------------------------------
VSpline &VSpline::operator =(const VSpline &spline) VSpline &VSpline::operator =(const VSpline &spline)
{ {
VGObject::operator=(spline); VGObject::operator=(spline);

View File

@ -29,17 +29,18 @@
#include "vsplinepath.h" #include "vsplinepath.h"
#include "../exception/vexception.h" #include "../exception/vexception.h"
//---------------------------------------------------------------------------------------------------------------------
VSplinePath::VSplinePath(qreal kCurve, quint32 idObject, Valentina::Draws mode) VSplinePath::VSplinePath(qreal kCurve, quint32 idObject, Valentina::Draws mode)
: VGObject(GObject::SplinePath, idObject, mode), path(QVector<VSplinePoint>()), kCurve(kCurve), maxCountPoints(0) : VGObject(GObject::SplinePath, idObject, mode), path(QVector<VSplinePoint>()), kCurve(kCurve), maxCountPoints(0)
{ {}
}
//---------------------------------------------------------------------------------------------------------------------
VSplinePath::VSplinePath(const VSplinePath &splPath) VSplinePath::VSplinePath(const VSplinePath &splPath)
: VGObject(splPath), path(*splPath.GetPoint()), kCurve(splPath.getKCurve()), : VGObject(splPath), path(*splPath.GetPoint()), kCurve(splPath.getKCurve()),
maxCountPoints(splPath.getMaxCountPoints()) maxCountPoints(splPath.getMaxCountPoints())
{ {}
}
//---------------------------------------------------------------------------------------------------------------------
void VSplinePath::append(const VSplinePoint &point) void VSplinePath::append(const VSplinePoint &point)
{ {
path.append(point); path.append(point);
@ -51,6 +52,7 @@ void VSplinePath::append(const VSplinePoint &point)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
qint32 VSplinePath::Count() const qint32 VSplinePath::Count() const
{ {
if (path.size() == 0) if (path.size() == 0)
@ -63,6 +65,7 @@ qint32 VSplinePath::Count() const
} }
} }
//---------------------------------------------------------------------------------------------------------------------
VSpline VSplinePath::GetSpline(qint32 index) const VSpline VSplinePath::GetSpline(qint32 index) const
{ {
if (Count()<1) if (Count()<1)
@ -78,6 +81,7 @@ VSpline VSplinePath::GetSpline(qint32 index) const
return spl; return spl;
} }
//---------------------------------------------------------------------------------------------------------------------
QPainterPath VSplinePath::GetPath() const QPainterPath VSplinePath::GetPath() const
{ {
QPainterPath painterPath; QPainterPath painterPath;
@ -90,6 +94,7 @@ QPainterPath VSplinePath::GetPath() const
return painterPath; return painterPath;
} }
//---------------------------------------------------------------------------------------------------------------------
QVector<QPointF> VSplinePath::GetPathPoints() const QVector<QPointF> VSplinePath::GetPathPoints() const
{ {
QVector<QPointF> pathPoints; QVector<QPointF> pathPoints;
@ -102,6 +107,7 @@ QVector<QPointF> VSplinePath::GetPathPoints() const
return pathPoints; return pathPoints;
} }
//---------------------------------------------------------------------------------------------------------------------
qreal VSplinePath::GetLength() const qreal VSplinePath::GetLength() const
{ {
qreal length = 0; qreal length = 0;
@ -114,6 +120,7 @@ qreal VSplinePath::GetLength() const
return length; return length;
} }
//---------------------------------------------------------------------------------------------------------------------
void VSplinePath::UpdatePoint(qint32 indexSpline, const SplinePoint::Position &pos, const VSplinePoint &point) void VSplinePath::UpdatePoint(qint32 indexSpline, const SplinePoint::Position &pos, const VSplinePoint &point)
{ {
if (indexSpline < 1 || indexSpline > Count()) if (indexSpline < 1 || indexSpline > Count())
@ -130,6 +137,7 @@ void VSplinePath::UpdatePoint(qint32 indexSpline, const SplinePoint::Position &p
} }
} }
//---------------------------------------------------------------------------------------------------------------------
VSplinePoint VSplinePath::GetSplinePoint(qint32 indexSpline, SplinePoint::Position pos) const VSplinePoint VSplinePath::GetSplinePoint(qint32 indexSpline, SplinePoint::Position pos) const
{ {
if (indexSpline < 1 || indexSpline > Count()) if (indexSpline < 1 || indexSpline > Count())
@ -146,6 +154,7 @@ VSplinePoint VSplinePath::GetSplinePoint(qint32 indexSpline, SplinePoint::Positi
} }
} }
//---------------------------------------------------------------------------------------------------------------------
VSplinePath &VSplinePath::operator =(const VSplinePath &path) VSplinePath &VSplinePath::operator =(const VSplinePath &path)
{ {
VGObject::operator=(path); VGObject::operator=(path);
@ -155,16 +164,19 @@ VSplinePath &VSplinePath::operator =(const VSplinePath &path)
return *this; return *this;
} }
//---------------------------------------------------------------------------------------------------------------------
VSplinePoint & VSplinePath::operator[](ptrdiff_t indx) VSplinePoint & VSplinePath::operator[](ptrdiff_t indx)
{ {
return path[indx]; return path[indx];
} }
//---------------------------------------------------------------------------------------------------------------------
const VSplinePoint &VSplinePath::at(ptrdiff_t indx) const const VSplinePoint &VSplinePath::at(ptrdiff_t indx) const
{ {
return path[indx]; return path[indx];
} }
//---------------------------------------------------------------------------------------------------------------------
QPointF VSplinePath::CutSplinePath(qreal length, qint32 &p1, qint32 &p2, QPointF &spl1p2, QPointF &spl1p3, QPointF VSplinePath::CutSplinePath(qreal length, qint32 &p1, qint32 &p2, QPointF &spl1p2, QPointF &spl1p3,
QPointF &spl2p2, QPointF &spl2p3) const QPointF &spl2p2, QPointF &spl2p3) const
{ {
@ -199,11 +211,14 @@ QPointF VSplinePath::CutSplinePath(qreal length, qint32 &p1, qint32 &p2, QPointF
} }
return QPointF(); return QPointF();
} }
//---------------------------------------------------------------------------------------------------------------------
qint32 VSplinePath::getMaxCountPoints() const qint32 VSplinePath::getMaxCountPoints() const
{ {
return maxCountPoints; return maxCountPoints;
} }
//---------------------------------------------------------------------------------------------------------------------
void VSplinePath::setMaxCountPoints(const qint32 &value) void VSplinePath::setMaxCountPoints(const qint32 &value)
{ {
maxCountPoints = value; maxCountPoints = value;

View File

@ -29,9 +29,12 @@
#include "vsplinepoint.h" #include "vsplinepoint.h"
#include <QDebug> #include <QDebug>
//---------------------------------------------------------------------------------------------------------------------
VSplinePoint::VSplinePoint() VSplinePoint::VSplinePoint()
:pSpline(VPointF()), angle1(0), angle2(180), kAsm1(1), kAsm2(1){} :pSpline(VPointF()), angle1(0), angle2(180), kAsm1(1), kAsm2(1)
{}
//---------------------------------------------------------------------------------------------------------------------
VSplinePoint::VSplinePoint(VPointF pSpline, qreal kAsm1, qreal angle1, qreal kAsm2, qreal angle2) VSplinePoint::VSplinePoint(VPointF pSpline, qreal kAsm1, qreal angle1, qreal kAsm2, qreal angle2)
:pSpline(pSpline), angle1(0), angle2(180), kAsm1(kAsm1), kAsm2(kAsm2) :pSpline(pSpline), angle1(0), angle2(180), kAsm1(kAsm1), kAsm2(kAsm2)
{ {
@ -42,9 +45,12 @@ VSplinePoint::VSplinePoint(VPointF pSpline, qreal kAsm1, qreal angle1, qreal kAs
SetAngle2(angle2); SetAngle2(angle2);
} }
//---------------------------------------------------------------------------------------------------------------------
VSplinePoint::VSplinePoint(const VSplinePoint &point) VSplinePoint::VSplinePoint(const VSplinePoint &point)
:pSpline(point.P()), angle1(point.Angle1()), angle2(point.Angle2()), kAsm1(point.KAsm1()), kAsm2(point.KAsm2()){} :pSpline(point.P()), angle1(point.Angle1()), angle2(point.Angle2()), kAsm1(point.KAsm1()), kAsm2(point.KAsm2())
{}
//---------------------------------------------------------------------------------------------------------------------
void VSplinePoint::SetAngle1(const qreal &value) void VSplinePoint::SetAngle1(const qreal &value)
{ {
QLineF line(0, 0, 100, 0); QLineF line(0, 0, 100, 0);
@ -55,6 +61,7 @@ void VSplinePoint::SetAngle1(const qreal &value)
angle2 = line.angle(); angle2 = line.angle();
} }
//---------------------------------------------------------------------------------------------------------------------
void VSplinePoint::SetAngle2(const qreal &value) void VSplinePoint::SetAngle2(const qreal &value)
{ {
QLineF line(0, 0, 100, 0); QLineF line(0, 0, 100, 0);

View File

@ -35,6 +35,7 @@
#include "tablewindow.h" #include "tablewindow.h"
#include "version.h" #include "version.h"
//---------------------------------------------------------------------------------------------------------------------
void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg) void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{ {
// Why on earth didn't Qt want to make failed signal/slot connections qWarning? // Why on earth didn't Qt want to make failed signal/slot connections qWarning?
@ -116,6 +117,7 @@ void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &context, c
} }
} }
//---------------------------------------------------------------------------------------------------------------------
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
Q_INIT_RESOURCE(cursor); Q_INIT_RESOURCE(cursor);

View File

@ -46,6 +46,7 @@
#include <QFileDialog> #include <QFileDialog>
#include <QSourceLocation> #include <QSourceLocation>
//---------------------------------------------------------------------------------------------------------------------
MainWindow::MainWindow(QWidget *parent) MainWindow::MainWindow(QWidget *parent)
:QMainWindow(parent), ui(new Ui::MainWindow), pattern(nullptr), doc(nullptr), tool(Valentina::ArrowTool), :QMainWindow(parent), ui(new Ui::MainWindow), pattern(nullptr), doc(nullptr), tool(Valentina::ArrowTool),
currentScene(nullptr), sceneDraw(nullptr), sceneDetails(nullptr), mouseCoordinate(nullptr), helpLabel(nullptr), currentScene(nullptr), sceneDraw(nullptr), sceneDetails(nullptr), mouseCoordinate(nullptr), helpLabel(nullptr),
@ -92,6 +93,7 @@ MainWindow::MainWindow(QWidget *parent)
setCurrentFile(""); setCurrentFile("");
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ActionNewDraw() void MainWindow::ActionNewDraw()
{ {
QString patternPieceName = QString(tr("Pattern piece %1")).arg(comboBoxDraws->count()+1); QString patternPieceName = QString(tr("Pattern piece %1")).arg(comboBoxDraws->count()+1);
@ -180,6 +182,7 @@ void MainWindow::ActionNewDraw()
&MainWindow::currentDrawChanged); &MainWindow::currentDrawChanged);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::OptionDraw() void MainWindow::OptionDraw()
{ {
const QString activDraw = doc->GetNameActivDraw(); const QString activDraw = doc->GetNameActivDraw();
@ -198,6 +201,7 @@ void MainWindow::OptionDraw()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
template <typename Dialog, typename Func> template <typename Dialog, typename Func>
void MainWindow::SetToolButton(bool checked, Valentina::Tools t, const QString &cursor, const QString &toolTip, void MainWindow::SetToolButton(bool checked, Valentina::Tools t, const QString &cursor, const QString &toolTip,
Func closeDialogSlot) Func closeDialogSlot)
@ -226,6 +230,7 @@ void MainWindow::SetToolButton(bool checked, Valentina::Tools t, const QString &
} }
} }
//---------------------------------------------------------------------------------------------------------------------
template <typename DrawTool> template <typename DrawTool>
void MainWindow::ClosedDialog(int result) void MainWindow::ClosedDialog(int result)
{ {
@ -237,127 +242,150 @@ void MainWindow::ClosedDialog(int result)
ArrowTool(); ArrowTool();
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolEndLine(bool checked) void MainWindow::ToolEndLine(bool checked)
{ {
SetToolButton<DialogEndLine>(checked, Valentina::EndLineTool, ":/cursor/endline_cursor.png", tr("Select point"), SetToolButton<DialogEndLine>(checked, Valentina::EndLineTool, ":/cursor/endline_cursor.png", tr("Select point"),
&MainWindow::ClosedDialogEndLine); &MainWindow::ClosedDialogEndLine);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ClosedDialogEndLine(int result) void MainWindow::ClosedDialogEndLine(int result)
{ {
ClosedDialog<VToolEndLine>(result); ClosedDialog<VToolEndLine>(result);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolLine(bool checked) void MainWindow::ToolLine(bool checked)
{ {
SetToolButton<DialogLine>(checked, Valentina::LineTool, ":/cursor/line_cursor.png", tr("Select first point"), SetToolButton<DialogLine>(checked, Valentina::LineTool, ":/cursor/line_cursor.png", tr("Select first point"),
&MainWindow::ClosedDialogLine); &MainWindow::ClosedDialogLine);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ClosedDialogLine(int result) void MainWindow::ClosedDialogLine(int result)
{ {
ClosedDialog<VToolLine>(result); ClosedDialog<VToolLine>(result);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolAlongLine(bool checked) void MainWindow::ToolAlongLine(bool checked)
{ {
SetToolButton<DialogAlongLine>(checked, Valentina::AlongLineTool, ":/cursor/alongline_cursor.png", SetToolButton<DialogAlongLine>(checked, Valentina::AlongLineTool, ":/cursor/alongline_cursor.png",
tr("Select point"), &MainWindow::ClosedDialogAlongLine); tr("Select point"), &MainWindow::ClosedDialogAlongLine);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ClosedDialogAlongLine(int result) void MainWindow::ClosedDialogAlongLine(int result)
{ {
ClosedDialog<VToolAlongLine>(result); ClosedDialog<VToolAlongLine>(result);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolShoulderPoint(bool checked) void MainWindow::ToolShoulderPoint(bool checked)
{ {
SetToolButton<DialogShoulderPoint>(checked, Valentina::ShoulderPointTool, ":/cursor/shoulder_cursor.png", SetToolButton<DialogShoulderPoint>(checked, Valentina::ShoulderPointTool, ":/cursor/shoulder_cursor.png",
tr("Select first point of line"), &MainWindow::ClosedDialogShoulderPoint); tr("Select first point of line"), &MainWindow::ClosedDialogShoulderPoint);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ClosedDialogShoulderPoint(int result) void MainWindow::ClosedDialogShoulderPoint(int result)
{ {
ClosedDialog<VToolShoulderPoint>(result); ClosedDialog<VToolShoulderPoint>(result);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolNormal(bool checked) void MainWindow::ToolNormal(bool checked)
{ {
SetToolButton<DialogNormal>(checked, Valentina::NormalTool, ":/cursor/normal_cursor.png", SetToolButton<DialogNormal>(checked, Valentina::NormalTool, ":/cursor/normal_cursor.png",
tr("Select first point of line"), &MainWindow::ClosedDialogNormal); tr("Select first point of line"), &MainWindow::ClosedDialogNormal);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ClosedDialogNormal(int result) void MainWindow::ClosedDialogNormal(int result)
{ {
ClosedDialog<VToolNormal>(result); ClosedDialog<VToolNormal>(result);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolBisector(bool checked) void MainWindow::ToolBisector(bool checked)
{ {
SetToolButton<DialogBisector>(checked, Valentina::BisectorTool, ":/cursor/bisector_cursor.png", SetToolButton<DialogBisector>(checked, Valentina::BisectorTool, ":/cursor/bisector_cursor.png",
tr("Select first point of angle"), &MainWindow::ClosedDialogBisector); tr("Select first point of angle"), &MainWindow::ClosedDialogBisector);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ClosedDialogBisector(int result) void MainWindow::ClosedDialogBisector(int result)
{ {
ClosedDialog<VToolBisector>(result); ClosedDialog<VToolBisector>(result);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolLineIntersect(bool checked) void MainWindow::ToolLineIntersect(bool checked)
{ {
SetToolButton<DialogLineIntersect>(checked, Valentina::LineIntersectTool, ":/cursor/intersect_cursor.png", SetToolButton<DialogLineIntersect>(checked, Valentina::LineIntersectTool, ":/cursor/intersect_cursor.png",
tr("Select first point of first line"), &MainWindow::ClosedDialogLineIntersect); tr("Select first point of first line"), &MainWindow::ClosedDialogLineIntersect);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ClosedDialogLineIntersect(int result) void MainWindow::ClosedDialogLineIntersect(int result)
{ {
ClosedDialog<VToolLineIntersect>(result); ClosedDialog<VToolLineIntersect>(result);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolSpline(bool checked) void MainWindow::ToolSpline(bool checked)
{ {
SetToolButton<DialogSpline>(checked, Valentina::SplineTool, ":/cursor/spline_cursor.png", SetToolButton<DialogSpline>(checked, Valentina::SplineTool, ":/cursor/spline_cursor.png",
tr("Select first point curve"), &MainWindow::ClosedDialogSpline); tr("Select first point curve"), &MainWindow::ClosedDialogSpline);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ClosedDialogSpline(int result) void MainWindow::ClosedDialogSpline(int result)
{ {
ClosedDialog<VToolSpline>(result); ClosedDialog<VToolSpline>(result);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolCutSpline(bool checked) void MainWindow::ToolCutSpline(bool checked)
{ {
SetToolButton<DialogCutSpline>(checked, Valentina::CutSplineTool, ":/cursor/spline_cut_point_cursor.png", SetToolButton<DialogCutSpline>(checked, Valentina::CutSplineTool, ":/cursor/spline_cut_point_cursor.png",
tr("Select simple curve"), &MainWindow::ClosedDialogCutSpline); tr("Select simple curve"), &MainWindow::ClosedDialogCutSpline);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ClosedDialogCutSpline(int result) void MainWindow::ClosedDialogCutSpline(int result)
{ {
ClosedDialog<VToolCutSpline>(result); ClosedDialog<VToolCutSpline>(result);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolArc(bool checked) void MainWindow::ToolArc(bool checked)
{ {
SetToolButton<DialogArc>(checked, Valentina::ArcTool, ":/cursor/arc_cursor.png", SetToolButton<DialogArc>(checked, Valentina::ArcTool, ":/cursor/arc_cursor.png",
tr("Select point of center of arc"), &MainWindow::ClosedDialogArc); tr("Select point of center of arc"), &MainWindow::ClosedDialogArc);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ClosedDialogArc(int result) void MainWindow::ClosedDialogArc(int result)
{ {
ClosedDialog<VToolArc>(result); ClosedDialog<VToolArc>(result);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolSplinePath(bool checked) void MainWindow::ToolSplinePath(bool checked)
{ {
SetToolButton<DialogSplinePath>(checked, Valentina::SplinePathTool, ":/cursor/splinepath_cursor.png", SetToolButton<DialogSplinePath>(checked, Valentina::SplinePathTool, ":/cursor/splinepath_cursor.png",
tr("Select point of curve path"), &MainWindow::ClosedDialogSplinePath); tr("Select point of curve path"), &MainWindow::ClosedDialogSplinePath);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ClosedDialogSplinePath(int result) void MainWindow::ClosedDialogSplinePath(int result)
{ {
ClosedDialog<VToolSplinePath>(result); ClosedDialog<VToolSplinePath>(result);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolCutSplinePath(bool checked) void MainWindow::ToolCutSplinePath(bool checked)
{ {
SetToolButton<DialogCutSplinePath>(checked, Valentina::CutSplinePathTool, SetToolButton<DialogCutSplinePath>(checked, Valentina::CutSplinePathTool,
@ -365,28 +393,33 @@ void MainWindow::ToolCutSplinePath(bool checked)
&MainWindow::ClosedDialogCutSplinePath); &MainWindow::ClosedDialogCutSplinePath);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ClosedDialogCutSplinePath(int result) void MainWindow::ClosedDialogCutSplinePath(int result)
{ {
ClosedDialog<VToolCutSplinePath>(result); ClosedDialog<VToolCutSplinePath>(result);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolPointOfContact(bool checked) void MainWindow::ToolPointOfContact(bool checked)
{ {
SetToolButton<DialogPointOfContact>(checked, Valentina::PointOfContact, ":/cursor/pointcontact_cursor.png", SetToolButton<DialogPointOfContact>(checked, Valentina::PointOfContact, ":/cursor/pointcontact_cursor.png",
tr("Select first point of line"), &MainWindow::ClosedDialogPointOfContact); tr("Select first point of line"), &MainWindow::ClosedDialogPointOfContact);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ClosedDialogPointOfContact(int result) void MainWindow::ClosedDialogPointOfContact(int result)
{ {
ClosedDialog<VToolPointOfContact>(result); ClosedDialog<VToolPointOfContact>(result);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolDetail(bool checked) void MainWindow::ToolDetail(bool checked)
{ {
SetToolButton<DialogDetail>(checked, Valentina::DetailTool, "://cursor/new_detail_cursor.png", SetToolButton<DialogDetail>(checked, Valentina::DetailTool, "://cursor/new_detail_cursor.png",
tr("Select points, arcs, curves clockwise."), &MainWindow::ClosedDialogDetail); tr("Select points, arcs, curves clockwise."), &MainWindow::ClosedDialogDetail);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ClosedDialogDetail(int result) void MainWindow::ClosedDialogDetail(int result)
{ {
if (result == QDialog::Accepted) if (result == QDialog::Accepted)
@ -397,28 +430,33 @@ void MainWindow::ClosedDialogDetail(int result)
doc->FullUpdateTree(); doc->FullUpdateTree();
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolHeight(bool checked) void MainWindow::ToolHeight(bool checked)
{ {
SetToolButton<DialogHeight>(checked, Valentina::Height, ":/cursor/height_cursor.png", tr("Select base point"), SetToolButton<DialogHeight>(checked, Valentina::Height, ":/cursor/height_cursor.png", tr("Select base point"),
&MainWindow::ClosedDialogHeight); &MainWindow::ClosedDialogHeight);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ClosedDialogHeight(int result) void MainWindow::ClosedDialogHeight(int result)
{ {
ClosedDialog<VToolHeight>(result); ClosedDialog<VToolHeight>(result);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolTriangle(bool checked) void MainWindow::ToolTriangle(bool checked)
{ {
SetToolButton<DialogTriangle>(checked, Valentina::Triangle, ":/cursor/triangle_cursor.png", SetToolButton<DialogTriangle>(checked, Valentina::Triangle, ":/cursor/triangle_cursor.png",
tr("Select first point of axis"), &MainWindow::ClosedDialogTriangle); tr("Select first point of axis"), &MainWindow::ClosedDialogTriangle);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ClosedDialogTriangle(int result) void MainWindow::ClosedDialogTriangle(int result)
{ {
ClosedDialog<VToolTriangle>(result); ClosedDialog<VToolTriangle>(result);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolPointOfIntersection(bool checked) void MainWindow::ToolPointOfIntersection(bool checked)
{ {
SetToolButton<DialogPointOfIntersection>(checked, Valentina::PointOfIntersection, SetToolButton<DialogPointOfIntersection>(checked, Valentina::PointOfIntersection,
@ -426,11 +464,13 @@ void MainWindow::ToolPointOfIntersection(bool checked)
&MainWindow::ClosedDialogPointOfIntersection); &MainWindow::ClosedDialogPointOfIntersection);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ClosedDialogPointOfIntersection(int result) void MainWindow::ClosedDialogPointOfIntersection(int result)
{ {
ClosedDialog<VToolPointOfIntersection>(result); ClosedDialog<VToolPointOfIntersection>(result);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolUnionDetails(bool checked) void MainWindow::ToolUnionDetails(bool checked)
{ {
SetToolButton<DialogUnionDetails>(checked, Valentina::UnionDetails, ":/cursor/union_cursor.png", SetToolButton<DialogUnionDetails>(checked, Valentina::UnionDetails, ":/cursor/union_cursor.png",
@ -439,23 +479,27 @@ void MainWindow::ToolUnionDetails(bool checked)
disconnect(doc, &VPattern::FullUpdateFromFile, dialogTool, &DialogTool::UpdateList); disconnect(doc, &VPattern::FullUpdateFromFile, dialogTool, &DialogTool::UpdateList);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ClosedDialogUnionDetails(int result) void MainWindow::ClosedDialogUnionDetails(int result)
{ {
ClosedDialog<VToolUnionDetails>(result); ClosedDialog<VToolUnionDetails>(result);
doc->FullUpdateTree(); doc->FullUpdateTree();
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolCutArc(bool checked) void MainWindow::ToolCutArc(bool checked)
{ {
SetToolButton<DialogCutArc>(checked, Valentina::CutArcTool, ":/cursor/arc_cut_cursor.png", tr("Select arc"), SetToolButton<DialogCutArc>(checked, Valentina::CutArcTool, ":/cursor/arc_cut_cursor.png", tr("Select arc"),
&MainWindow::ClosedDialogCutArc); &MainWindow::ClosedDialogCutArc);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ClosedDialogCutArc(int result) void MainWindow::ClosedDialogCutArc(int result)
{ {
ClosedDialog<VToolCutArc>(result); ClosedDialog<VToolCutArc>(result);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::About() void MainWindow::About()
{ {
QDate date = QLocale(QLocale::C).toDate(QString(__DATE__).simplified(), QLatin1String("MMM d yyyy")); QDate date = QLocale(QLocale::C).toDate(QString(__DATE__).simplified(), QLatin1String("MMM d yyyy"));
@ -468,22 +512,26 @@ void MainWindow::About()
QMessageBox::about(this, tr("About Valentina"), about); QMessageBox::about(this, tr("About Valentina"), about);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::AboutQt() void MainWindow::AboutQt()
{ {
QMessageBox::aboutQt(this, tr("About Qt")); QMessageBox::aboutQt(this, tr("About Qt"));
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ShowToolTip(const QString &toolTip) void MainWindow::ShowToolTip(const QString &toolTip)
{ {
helpLabel->setText(toolTip); helpLabel->setText(toolTip);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::tableClosed() void MainWindow::tableClosed()
{ {
show(); show();
MinimumScrollBar(); MinimumScrollBar();
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::OpenRecentFile() void MainWindow::OpenRecentFile()
{ {
QAction *action = qobject_cast<QAction *>(sender()); QAction *action = qobject_cast<QAction *>(sender());
@ -493,12 +541,14 @@ void MainWindow::OpenRecentFile()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::PatternProperties() void MainWindow::PatternProperties()
{ {
DialogPatternProperties proper(doc, this); DialogPatternProperties proper(doc, this);
proper.exec(); proper.exec();
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::showEvent( QShowEvent *event ) void MainWindow::showEvent( QShowEvent *event )
{ {
QMainWindow::showEvent( event ); QMainWindow::showEvent( event );
@ -518,6 +568,7 @@ void MainWindow::showEvent( QShowEvent *event )
isInitialized = true;//first show windows are held isInitialized = true;//first show windows are held
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::closeEvent(QCloseEvent *event) void MainWindow::closeEvent(QCloseEvent *event)
{ {
if (MaybeSave()) if (MaybeSave())
@ -531,6 +582,7 @@ void MainWindow::closeEvent(QCloseEvent *event)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolBarOption() void MainWindow::ToolBarOption()
{ {
if (qApp->patternType() == Pattern::Standard) if (qApp->patternType() == Pattern::Standard)
@ -566,6 +618,7 @@ void MainWindow::ToolBarOption()
ui->toolBarOption->addWidget(mouseCoordinate); ui->toolBarOption->addWidget(mouseCoordinate);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolBarDraws() void MainWindow::ToolBarDraws()
{ {
QLabel *labelPtternPieceName = new QLabel(tr("Pattern Piece: ")); QLabel *labelPtternPieceName = new QLabel(tr("Pattern Piece: "));
@ -592,6 +645,7 @@ void MainWindow::ToolBarDraws()
ui->actionLayout->setEnabled(false); ui->actionLayout->setEnabled(false);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::InitToolButtons() void MainWindow::InitToolButtons()
{ {
connect(ui->toolButtonEndLine, &QToolButton::clicked, this, &MainWindow::ToolEndLine); connect(ui->toolButtonEndLine, &QToolButton::clicked, this, &MainWindow::ToolEndLine);
@ -615,6 +669,7 @@ void MainWindow::InitToolButtons()
connect(ui->toolButtonArcCutPoint, &QToolButton::clicked, this, &MainWindow::ToolCutArc); connect(ui->toolButtonArcCutPoint, &QToolButton::clicked, this, &MainWindow::ToolCutArc);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::currentDrawChanged( int index ) void MainWindow::currentDrawChanged( int index )
{ {
if (index != -1) if (index != -1)
@ -634,6 +689,7 @@ void MainWindow::currentDrawChanged( int index )
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::mouseMove(const QPointF &scenePos) void MainWindow::mouseMove(const QPointF &scenePos)
{ {
QString string = QString("%1, %2").arg(static_cast<qint32>(qApp->fromPixel(scenePos.x()))) QString string = QString("%1, %2").arg(static_cast<qint32>(qApp->fromPixel(scenePos.x())))
@ -644,6 +700,7 @@ void MainWindow::mouseMove(const QPointF &scenePos)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::CancelTool() void MainWindow::CancelTool()
{ {
delete dialogTool; delete dialogTool;
@ -757,6 +814,7 @@ void MainWindow::CancelTool()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ArrowTool() void MainWindow::ArrowTool()
{ {
CancelTool(); CancelTool();
@ -767,11 +825,13 @@ void MainWindow::ArrowTool()
helpLabel->setText(""); helpLabel->setText("");
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ActionAroowTool() void MainWindow::ActionAroowTool()
{ {
ArrowTool(); ArrowTool();
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::keyPressEvent ( QKeyEvent * event ) void MainWindow::keyPressEvent ( QKeyEvent * event )
{ {
switch (event->key()) switch (event->key())
@ -785,6 +845,7 @@ void MainWindow::keyPressEvent ( QKeyEvent * event )
QMainWindow::keyPressEvent ( event ); QMainWindow::keyPressEvent ( event );
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::SaveCurrentScene() void MainWindow::SaveCurrentScene()
{ {
/*Save transform*/ /*Save transform*/
@ -796,6 +857,7 @@ void MainWindow::SaveCurrentScene()
currentScene->setVerScrollBar(verScrollBar->value()); currentScene->setVerScrollBar(verScrollBar->value());
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::RestoreCurrentScene() void MainWindow::RestoreCurrentScene()
{ {
/*Set transform for current scene*/ /*Set transform for current scene*/
@ -807,6 +869,7 @@ void MainWindow::RestoreCurrentScene()
verScrollBar->setValue(currentScene->getVerScrollBar()); verScrollBar->setValue(currentScene->getVerScrollBar());
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ActionDraw(bool checked) void MainWindow::ActionDraw(bool checked)
{ {
if (checked) if (checked)
@ -839,6 +902,7 @@ void MainWindow::ActionDraw(bool checked)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ActionDetails(bool checked) void MainWindow::ActionDetails(bool checked)
{ {
if (checked) if (checked)
@ -873,6 +937,7 @@ void MainWindow::ActionDetails(bool checked)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
bool MainWindow::SaveAs() bool MainWindow::SaveAs()
{ {
QString filters(tr("Pattern files (*.val)")); QString filters(tr("Pattern files (*.val)"));
@ -899,6 +964,7 @@ bool MainWindow::SaveAs()
return SavePattern(fileName); return SavePattern(fileName);
} }
//---------------------------------------------------------------------------------------------------------------------
bool MainWindow::Save() bool MainWindow::Save()
{ {
if (curFile.isEmpty()) if (curFile.isEmpty())
@ -918,6 +984,7 @@ bool MainWindow::Save()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::Open() void MainWindow::Open()
{ {
if (MaybeSave()) if (MaybeSave())
@ -943,6 +1010,7 @@ void MainWindow::Open()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::Options() void MainWindow::Options()
{ {
ConfigDialog dlg(this); ConfigDialog dlg(this);
@ -952,6 +1020,7 @@ void MainWindow::Options()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::Clear() void MainWindow::Clear()
{ {
setCurrentFile(""); setCurrentFile("");
@ -973,6 +1042,7 @@ void MainWindow::Clear()
#endif #endif
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::NewPattern() void MainWindow::NewPattern()
{ {
QProcess *v = new QProcess(this); QProcess *v = new QProcess(this);
@ -980,12 +1050,14 @@ void MainWindow::NewPattern()
delete v; delete v;
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::PatternWasModified() void MainWindow::PatternWasModified()
{ {
setWindowModified(doc->isPatternModified()); setWindowModified(doc->isPatternModified());
ui->actionSave->setEnabled(true); ui->actionSave->setEnabled(true);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ChangedSize(const QString & text) void MainWindow::ChangedSize(const QString & text)
{ {
qint32 size = text.toInt(); qint32 size = text.toInt();
@ -993,6 +1065,7 @@ void MainWindow::ChangedSize(const QString & text)
doc->FullUpdateTree(); doc->FullUpdateTree();
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ChangedHeight(const QString &text) void MainWindow::ChangedHeight(const QString &text)
{ {
qint32 growth = text.toInt(); qint32 growth = text.toInt();
@ -1000,6 +1073,7 @@ void MainWindow::ChangedHeight(const QString &text)
doc->FullUpdateTree(); doc->FullUpdateTree();
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::SetEnableWidgets(bool enable) void MainWindow::SetEnableWidgets(bool enable)
{ {
ui->actionSaveAs->setEnabled(enable); ui->actionSaveAs->setEnabled(enable);
@ -1014,6 +1088,7 @@ void MainWindow::SetEnableWidgets(bool enable)
ui->actionHistory->setEnabled(enable); ui->actionHistory->setEnabled(enable);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ActionTable(bool checked) void MainWindow::ActionTable(bool checked)
{ {
if (checked) if (checked)
@ -1029,6 +1104,7 @@ void MainWindow::ActionTable(bool checked)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ClosedActionTable() void MainWindow::ClosedActionTable()
{ {
ui->actionTable->setChecked(false); ui->actionTable->setChecked(false);
@ -1036,6 +1112,7 @@ void MainWindow::ClosedActionTable()
dialogTable = nullptr; dialogTable = nullptr;
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ActionHistory(bool checked) void MainWindow::ActionHistory(bool checked)
{ {
if (checked) if (checked)
@ -1052,6 +1129,7 @@ void MainWindow::ActionHistory(bool checked)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ActionLayout(bool checked) void MainWindow::ActionLayout(bool checked)
{ {
Q_UNUSED(checked); Q_UNUSED(checked);
@ -1069,12 +1147,14 @@ void MainWindow::ActionLayout(bool checked)
emit ModelChosen(listDetails, curFile, description); emit ModelChosen(listDetails, curFile, description);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ClosedActionHistory() void MainWindow::ClosedActionHistory()
{ {
ui->actionHistory->setChecked(false); ui->actionHistory->setChecked(false);
delete dialogHistory; delete dialogHistory;
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::SetEnableTool(bool enable) void MainWindow::SetEnableTool(bool enable)
{ {
bool drawTools = false; bool drawTools = false;
@ -1111,6 +1191,7 @@ void MainWindow::SetEnableTool(bool enable)
ui->toolButtonUnionDetails->setEnabled(modelingTools); ui->toolButtonUnionDetails->setEnabled(modelingTools);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::MinimumScrollBar() void MainWindow::MinimumScrollBar()
{ {
QScrollBar *horScrollBar = view->horizontalScrollBar(); QScrollBar *horScrollBar = view->horizontalScrollBar();
@ -1119,6 +1200,7 @@ void MainWindow::MinimumScrollBar()
verScrollBar->setValue(verScrollBar->minimum()); verScrollBar->setValue(verScrollBar->minimum());
} }
//---------------------------------------------------------------------------------------------------------------------
bool MainWindow::SavePattern(const QString &fileName) bool MainWindow::SavePattern(const QString &fileName)
{ {
QFileInfo tempInfo(fileName); QFileInfo tempInfo(fileName);
@ -1134,6 +1216,7 @@ bool MainWindow::SavePattern(const QString &fileName)
return result; return result;
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::AutoSavePattern() void MainWindow::AutoSavePattern()
{ {
if (curFile.isEmpty() == false && doc->isPatternModified() == true) if (curFile.isEmpty() == false && doc->isPatternModified() == true)
@ -1146,6 +1229,7 @@ void MainWindow::AutoSavePattern()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::setCurrentFile(const QString &fileName) void MainWindow::setCurrentFile(const QString &fileName)
{ {
curFile = fileName; curFile = fileName;
@ -1176,6 +1260,7 @@ void MainWindow::setCurrentFile(const QString &fileName)
setWindowTitle(shownName); setWindowTitle(shownName);
} }
//---------------------------------------------------------------------------------------------------------------------
QString MainWindow::strippedName(const QString &fullFileName) QString MainWindow::strippedName(const QString &fullFileName)
{ {
return QFileInfo(fullFileName).fileName(); return QFileInfo(fullFileName).fileName();
@ -1191,6 +1276,7 @@ void MainWindow::ReadSettings()
move(pos); move(pos);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::WriteSettings() void MainWindow::WriteSettings()
{ {
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(), QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
@ -1199,6 +1285,7 @@ void MainWindow::WriteSettings()
settings.setValue("size", size()); settings.setValue("size", size());
} }
//---------------------------------------------------------------------------------------------------------------------
bool MainWindow::MaybeSave() bool MainWindow::MaybeSave()
{ {
if (doc->isPatternModified()) if (doc->isPatternModified())
@ -1219,6 +1306,7 @@ bool MainWindow::MaybeSave()
return true; return true;
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::UpdateRecentFileActions() void MainWindow::UpdateRecentFileActions()
{ {
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(), QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
@ -1242,6 +1330,7 @@ void MainWindow::UpdateRecentFileActions()
separatorAct->setVisible(numRecentFiles > 0); separatorAct->setVisible(numRecentFiles > 0);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::CreateMenus() void MainWindow::CreateMenus()
{ {
for (int i = 0; i < MaxRecentFiles; ++i) for (int i = 0; i < MaxRecentFiles; ++i)
@ -1254,6 +1343,7 @@ void MainWindow::CreateMenus()
UpdateRecentFileActions(); UpdateRecentFileActions();
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::CreateActions() void MainWindow::CreateActions()
{ {
ui->setupUi(this); ui->setupUi(this);
@ -1284,6 +1374,7 @@ void MainWindow::CreateActions()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::InitAutoSave() void MainWindow::InitAutoSave()
{ {
//Autosaving file each 5 minutes //Autosaving file each 5 minutes
@ -1309,6 +1400,7 @@ void MainWindow::InitAutoSave()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
QString MainWindow::PatternPieceName(const QString &text) QString MainWindow::PatternPieceName(const QString &text)
{ {
QInputDialog *dlg = new QInputDialog(this); QInputDialog *dlg = new QInputDialog(this);
@ -1337,6 +1429,7 @@ QString MainWindow::PatternPieceName(const QString &text)
return nameDraw; return nameDraw;
} }
//---------------------------------------------------------------------------------------------------------------------
MainWindow::~MainWindow() MainWindow::~MainWindow()
{ {
CancelTool(); CancelTool();
@ -1348,6 +1441,7 @@ MainWindow::~MainWindow()
delete sceneDraw; delete sceneDraw;
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::LoadPattern(const QString &fileName) void MainWindow::LoadPattern(const QString &fileName)
{ {
try try
@ -1470,6 +1564,7 @@ void MainWindow::LoadPattern(const QString &fileName)
helpLabel->setText(tr("File loaded")); helpLabel->setText(tr("File loaded"));
} }
//---------------------------------------------------------------------------------------------------------------------
QString MainWindow::CheckPathToMeasurements(const QString &path, const Pattern::Measurements &patternType) QString MainWindow::CheckPathToMeasurements(const QString &path, const Pattern::Measurements &patternType)
{ {
QFile table(path); QFile table(path);

View File

@ -33,6 +33,7 @@
#include <QPrinter> #include <QPrinter>
#include "widgets/vapplication.h" #include "widgets/vapplication.h"
//---------------------------------------------------------------------------------------------------------------------
TableWindow::TableWindow(QWidget *parent) TableWindow::TableWindow(QWidget *parent)
:QMainWindow(parent), numberDetal(nullptr), colission(nullptr), ui(new Ui::TableWindow), :QMainWindow(parent), numberDetal(nullptr), colission(nullptr), ui(new Ui::TableWindow),
listDetails(QVector<VItem*>()), outItems(false), collidingItems(false), tableScene(nullptr), listDetails(QVector<VItem*>()), outItems(false), collidingItems(false), tableScene(nullptr),
@ -67,12 +68,14 @@ TableWindow::TableWindow(QWidget *parent)
connect(view, &VTableGraphicsView::itemChect, this, &TableWindow::itemChect); connect(view, &VTableGraphicsView::itemChect, this, &TableWindow::itemChect);
} }
//---------------------------------------------------------------------------------------------------------------------
TableWindow::~TableWindow() TableWindow::~TableWindow()
{ {
delete tableScene; delete tableScene;
delete ui; delete ui;
} }
//---------------------------------------------------------------------------------------------------------------------
void TableWindow::AddPaper() void TableWindow::AddPaper()
{ {
qreal x1, y1, x2, y2; qreal x1, y1, x2, y2;
@ -87,6 +90,7 @@ void TableWindow::AddPaper()
qDebug()<<paper->rect().size().toSize(); qDebug()<<paper->rect().size().toSize();
} }
//---------------------------------------------------------------------------------------------------------------------
void TableWindow::AddDetail() void TableWindow::AddDetail()
{ {
if (indexDetail<listDetails.count()) if (indexDetail<listDetails.count())
@ -115,6 +119,7 @@ void TableWindow::AddDetail()
numberDetal->setText(QString(tr("%1 details left.")).arg(listDetails.count()-indexDetail)); numberDetal->setText(QString(tr("%1 details left.")).arg(listDetails.count()-indexDetail));
} }
//---------------------------------------------------------------------------------------------------------------------
/* /*
* Get details for creation layout. * Get details for creation layout.
*/ */
@ -142,12 +147,14 @@ void TableWindow::ModelChosen(QVector<VItem*> listDetails, const QString &fileNa
show(); show();
} }
//---------------------------------------------------------------------------------------------------------------------
void TableWindow::closeEvent(QCloseEvent *event) void TableWindow::closeEvent(QCloseEvent *event)
{ {
event->ignore(); event->ignore();
StopTable(); StopTable();
} }
//---------------------------------------------------------------------------------------------------------------------
void TableWindow::moveToCenter() void TableWindow::moveToCenter()
{ {
QRect rect = frameGeometry(); QRect rect = frameGeometry();
@ -155,12 +162,14 @@ void TableWindow::moveToCenter()
move(rect.topLeft()); move(rect.topLeft());
} }
//---------------------------------------------------------------------------------------------------------------------
void TableWindow::showEvent ( QShowEvent * event ) void TableWindow::showEvent ( QShowEvent * event )
{ {
QMainWindow::showEvent(event); QMainWindow::showEvent(event);
moveToCenter(); moveToCenter();
} }
//---------------------------------------------------------------------------------------------------------------------
void TableWindow::StopTable() void TableWindow::StopTable()
{ {
hide(); hide();
@ -172,6 +181,7 @@ void TableWindow::StopTable()
emit closed(); emit closed();
} }
//---------------------------------------------------------------------------------------------------------------------
void TableWindow::saveScene() void TableWindow::saveScene()
{ {
QMap<QString, QString> extByMessage; QMap<QString, QString> extByMessage;
@ -251,12 +261,14 @@ void TableWindow::saveScene()
delete brush; delete brush;
} }
//---------------------------------------------------------------------------------------------------------------------
void TableWindow::itemChect(bool flag) void TableWindow::itemChect(bool flag)
{ {
ui->actionTurn->setDisabled(flag); ui->actionTurn->setDisabled(flag);
ui->actionMirror->setDisabled(flag); ui->actionMirror->setDisabled(flag);
} }
//---------------------------------------------------------------------------------------------------------------------
void TableWindow::checkNext() void TableWindow::checkNext()
{ {
if (outItems == true && collidingItems == true) if (outItems == true && collidingItems == true)
@ -281,6 +293,7 @@ void TableWindow::checkNext()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void TableWindow::itemOut(int number, bool flag) void TableWindow::itemOut(int number, bool flag)
{ {
listOutItems->setBit(number, flag); listOutItems->setBit(number, flag);
@ -298,6 +311,7 @@ void TableWindow::itemOut(int number, bool flag)
checkNext(); checkNext();
} }
//---------------------------------------------------------------------------------------------------------------------
void TableWindow::itemColliding(QList<QGraphicsItem *> list, int number) void TableWindow::itemColliding(QList<QGraphicsItem *> list, int number)
{ {
//qDebug()<<"number="<<number; //qDebug()<<"number="<<number;
@ -364,11 +378,13 @@ void TableWindow::itemColliding(QList<QGraphicsItem *> list, int number)
checkNext(); checkNext();
} }
//---------------------------------------------------------------------------------------------------------------------
void TableWindow::GetNextDetail() void TableWindow::GetNextDetail()
{ {
AddDetail(); AddDetail();
} }
//---------------------------------------------------------------------------------------------------------------------
void TableWindow::AddLength() void TableWindow::AddLength()
{ {
QRectF rect = tableScene->sceneRect(); QRectF rect = tableScene->sceneRect();
@ -384,6 +400,7 @@ void TableWindow::AddLength()
emit LengthChanged(); emit LengthChanged();
} }
//---------------------------------------------------------------------------------------------------------------------
void TableWindow::RemoveLength() void TableWindow::RemoveLength()
{ {
if (sceneRect.height() <= tableScene->sceneRect().height() - 100) if (sceneRect.height() <= tableScene->sceneRect().height() - 100)
@ -409,6 +426,7 @@ void TableWindow::RemoveLength()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void TableWindow::keyPressEvent ( QKeyEvent * event ) void TableWindow::keyPressEvent ( QKeyEvent * event )
{ {
if ( event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return ) if ( event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return )
@ -422,7 +440,7 @@ void TableWindow::keyPressEvent ( QKeyEvent * event )
QMainWindow::keyPressEvent ( event ); QMainWindow::keyPressEvent ( event );
} }
//---------------------------------------------------------------------------------------------------------------------
void TableWindow::SvgFile(const QString &name) const void TableWindow::SvgFile(const QString &name) const
{ {
QSvgGenerator generator; QSvgGenerator generator;
@ -442,6 +460,7 @@ void TableWindow::SvgFile(const QString &name) const
painter.end(); painter.end();
} }
//---------------------------------------------------------------------------------------------------------------------
void TableWindow::PngFile(const QString &name) const void TableWindow::PngFile(const QString &name) const
{ {
QRectF r = paper->rect(); QRectF r = paper->rect();
@ -459,6 +478,7 @@ void TableWindow::PngFile(const QString &name) const
image.save(name); image.save(name);
} }
//---------------------------------------------------------------------------------------------------------------------
void TableWindow::PdfFile(const QString &name) const void TableWindow::PdfFile(const QString &name) const
{ {
QPrinter printer; QPrinter printer;
@ -483,6 +503,7 @@ void TableWindow::PdfFile(const QString &name) const
painter.end(); painter.end();
} }
//---------------------------------------------------------------------------------------------------------------------
void TableWindow::EpsFile(const QString &name) const void TableWindow::EpsFile(const QString &name) const
{ {
QTemporaryFile tmp; QTemporaryFile tmp;
@ -497,6 +518,7 @@ void TableWindow::EpsFile(const QString &name) const
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void TableWindow::PsFile(const QString &name) const void TableWindow::PsFile(const QString &name) const
{ {
QTemporaryFile tmp; QTemporaryFile tmp;
@ -511,6 +533,7 @@ void TableWindow::PsFile(const QString &name) const
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void TableWindow::PdfToPs(const QStringList &params) const void TableWindow::PdfToPs(const QStringList &params) const
{ {
#ifndef QT_NO_CURSOR #ifndef QT_NO_CURSOR

View File

@ -31,17 +31,20 @@
const QString VAbstractSpline::TagName = QStringLiteral("spline"); const QString VAbstractSpline::TagName = QStringLiteral("spline");
//---------------------------------------------------------------------------------------------------------------------
VAbstractSpline::VAbstractSpline(VPattern *doc, VContainer *data, quint32 id, QGraphicsItem *parent) VAbstractSpline::VAbstractSpline(VPattern *doc, VContainer *data, quint32 id, QGraphicsItem *parent)
:VDrawTool(doc, data, id), QGraphicsPathItem(parent), controlPoints(QVector<VControlPointSpline *>()) :VDrawTool(doc, data, id), QGraphicsPathItem(parent), controlPoints(QVector<VControlPointSpline *>())
{ {
ignoreFullUpdate = true; ignoreFullUpdate = true;
} }
//---------------------------------------------------------------------------------------------------------------------
void VAbstractSpline::FullUpdateFromFile() void VAbstractSpline::FullUpdateFromFile()
{ {
RefreshGeometry(); RefreshGeometry();
} }
//---------------------------------------------------------------------------------------------------------------------
void VAbstractSpline::ChangedActivDraw(const QString &newName) void VAbstractSpline::ChangedActivDraw(const QString &newName)
{ {
bool selectable = false; bool selectable = false;
@ -62,17 +65,20 @@ void VAbstractSpline::ChangedActivDraw(const QString &newName)
VDrawTool::ChangedActivDraw(newName); VDrawTool::ChangedActivDraw(newName);
} }
//---------------------------------------------------------------------------------------------------------------------
void VAbstractSpline::ShowTool(quint32 id, Qt::GlobalColor color, bool enable) void VAbstractSpline::ShowTool(quint32 id, Qt::GlobalColor color, bool enable)
{ {
ShowItem(this, id, color, enable); ShowItem(this, id, color, enable);
} }
//---------------------------------------------------------------------------------------------------------------------
void VAbstractSpline::SetFactor(qreal factor) void VAbstractSpline::SetFactor(qreal factor)
{ {
VDrawTool::SetFactor(factor); VDrawTool::SetFactor(factor);
RefreshGeometry(); RefreshGeometry();
} }
//---------------------------------------------------------------------------------------------------------------------
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void VAbstractSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VAbstractSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
@ -80,6 +86,7 @@ void VAbstractSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthMainLine())/factor)); this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthMainLine())/factor));
} }
//---------------------------------------------------------------------------------------------------------------------
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void VAbstractSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VAbstractSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
@ -87,6 +94,7 @@ void VAbstractSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor)); this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor));
} }
//---------------------------------------------------------------------------------------------------------------------
QVariant VAbstractSpline::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) QVariant VAbstractSpline::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
{ {
if (change == QGraphicsItem::ItemSelectedChange) if (change == QGraphicsItem::ItemSelectedChange)
@ -105,6 +113,7 @@ QVariant VAbstractSpline::itemChange(QGraphicsItem::GraphicsItemChange change, c
return QGraphicsItem::itemChange(change, value); return QGraphicsItem::itemChange(change, value);
} }
//---------------------------------------------------------------------------------------------------------------------
void VAbstractSpline::keyReleaseEvent(QKeyEvent *event) void VAbstractSpline::keyReleaseEvent(QKeyEvent *event)
{ {
switch (event->key()) switch (event->key())

View File

@ -30,6 +30,7 @@
qreal VDrawTool::factor = 1; qreal VDrawTool::factor = 1;
//---------------------------------------------------------------------------------------------------------------------
VDrawTool::VDrawTool(VPattern *doc, VContainer *data, quint32 id) VDrawTool::VDrawTool(VPattern *doc, VContainer *data, quint32 id)
:VAbstractTool(doc, data, id), ignoreContextMenuEvent(false), ignoreFullUpdate(false), :VAbstractTool(doc, data, id), ignoreContextMenuEvent(false), ignoreFullUpdate(false),
nameActivDraw(doc->GetNameActivDraw()), dialog(nullptr) nameActivDraw(doc->GetNameActivDraw()), dialog(nullptr)
@ -39,11 +40,13 @@ VDrawTool::VDrawTool(VPattern *doc, VContainer *data, quint32 id)
connect(this->doc, &VPattern::ShowTool, this, &VDrawTool::ShowTool); connect(this->doc, &VPattern::ShowTool, this, &VDrawTool::ShowTool);
} }
//---------------------------------------------------------------------------------------------------------------------
VDrawTool::~VDrawTool() VDrawTool::~VDrawTool()
{ {
delete dialog; delete dialog;
} }
//---------------------------------------------------------------------------------------------------------------------
void VDrawTool::ShowTool(quint32 id, Qt::GlobalColor color, bool enable) void VDrawTool::ShowTool(quint32 id, Qt::GlobalColor color, bool enable)
{ {
Q_UNUSED(id); Q_UNUSED(id);
@ -51,6 +54,7 @@ void VDrawTool::ShowTool(quint32 id, Qt::GlobalColor color, bool enable)
Q_UNUSED(enable); Q_UNUSED(enable);
} }
//---------------------------------------------------------------------------------------------------------------------
void VDrawTool::ChangedActivDraw(const QString &newName) void VDrawTool::ChangedActivDraw(const QString &newName)
{ {
if (nameActivDraw == newName) if (nameActivDraw == newName)
@ -63,6 +67,7 @@ void VDrawTool::ChangedActivDraw(const QString &newName)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VDrawTool::ChangedNameDraw(const QString &oldName, const QString &newName) void VDrawTool::ChangedNameDraw(const QString &oldName, const QString &newName)
{ {
if (nameActivDraw == oldName) if (nameActivDraw == oldName)
@ -71,6 +76,7 @@ void VDrawTool::ChangedNameDraw(const QString &oldName, const QString &newName)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VDrawTool::FullUpdateFromGui(int result) void VDrawTool::FullUpdateFromGui(int result)
{ {
if (result == QDialog::Accepted) if (result == QDialog::Accepted)
@ -88,6 +94,7 @@ void VDrawTool::FullUpdateFromGui(int result)
dialog = nullptr; dialog = nullptr;
} }
//---------------------------------------------------------------------------------------------------------------------
void VDrawTool::SetFactor(qreal factor) void VDrawTool::SetFactor(qreal factor)
{ {
if (factor <= 2 && factor >= 0.5) if (factor <= 2 && factor >= 0.5)
@ -96,6 +103,7 @@ void VDrawTool::SetFactor(qreal factor)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VDrawTool::AddToCalculation(const QDomElement &domElement) void VDrawTool::AddToCalculation(const QDomElement &domElement)
{ {
QDomElement calcElement; QDomElement calcElement;

View File

@ -32,6 +32,7 @@
const QString VToolAlongLine::ToolType = QStringLiteral("alongLine"); const QString VToolAlongLine::ToolType = QStringLiteral("alongLine");
//---------------------------------------------------------------------------------------------------------------------
VToolAlongLine::VToolAlongLine(VPattern *doc, VContainer *data, quint32 id, const QString &formula, VToolAlongLine::VToolAlongLine(VPattern *doc, VContainer *data, quint32 id, const QString &formula,
const quint32 &firstPointId, const quint32 &secondPointId, const quint32 &firstPointId, const quint32 &secondPointId,
const QString &typeLine, const Valentina::Sources &typeCreation, const QString &typeLine, const Valentina::Sources &typeCreation,
@ -49,6 +50,7 @@ VToolAlongLine::VToolAlongLine(VPattern *doc, VContainer *data, quint32 id, cons
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolAlongLine::FullUpdateFromFile() void VToolAlongLine::FullUpdateFromFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -62,23 +64,27 @@ void VToolAlongLine::FullUpdateFromFile()
RefreshGeometry(); RefreshGeometry();
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolAlongLine::SetFactor(qreal factor) void VToolAlongLine::SetFactor(qreal factor)
{ {
VDrawTool::SetFactor(factor); VDrawTool::SetFactor(factor);
RefreshGeometry(); RefreshGeometry();
} }
//---------------------------------------------------------------------------------------------------------------------
//cppcheck-suppress unusedFunction //cppcheck-suppress unusedFunction
void VToolAlongLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolAlongLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogAlongLine>(this, event); ContextMenu<DialogAlongLine>(this, event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolAlongLine::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) void VToolAlongLine::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogAlongLine>(this, event); ContextMenu<DialogAlongLine>(this, event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolAlongLine::AddToFile() void VToolAlongLine::AddToFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -98,6 +104,7 @@ void VToolAlongLine::AddToFile()
AddToCalculation(domElement); AddToCalculation(domElement);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolAlongLine::RefreshDataInFile() void VToolAlongLine::RefreshDataInFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -114,12 +121,14 @@ void VToolAlongLine::RefreshDataInFile()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolAlongLine::RemoveReferens() void VToolAlongLine::RemoveReferens()
{ {
doc->DecrementReferens(secondPointId); doc->DecrementReferens(secondPointId);
VToolLinePoint::RemoveReferens(); VToolLinePoint::RemoveReferens();
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolAlongLine::SaveDialog(QDomElement &domElement) void VToolAlongLine::SaveDialog(QDomElement &domElement)
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -132,6 +141,7 @@ void VToolAlongLine::SaveDialog(QDomElement &domElement)
doc->SetAttribute(domElement, AttrSecondPoint, dialogTool->getSecondPointId()); doc->SetAttribute(domElement, AttrSecondPoint, dialogTool->getSecondPointId());
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolAlongLine::setDialog() void VToolAlongLine::setDialog()
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -145,6 +155,7 @@ void VToolAlongLine::setDialog()
dialogTool->setPointName(p->name()); dialogTool->setPointName(p->name());
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolAlongLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) void VToolAlongLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -159,6 +170,7 @@ void VToolAlongLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPatt
Document::FullParse, Valentina::FromGui); Document::FullParse, Valentina::FromGui);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolAlongLine::Create(const quint32 _id, const QString &pointName, const QString &typeLine, void VToolAlongLine::Create(const quint32 _id, const QString &pointName, const QString &typeLine,
const QString &formula, const quint32 &firstPointId, const quint32 &secondPointId, const QString &formula, const quint32 &firstPointId, const quint32 &secondPointId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,

View File

@ -34,6 +34,7 @@
const QString VToolArc::TagName = QStringLiteral("arc"); const QString VToolArc::TagName = QStringLiteral("arc");
const QString VToolArc::ToolType = QStringLiteral("simple"); const QString VToolArc::ToolType = QStringLiteral("simple");
//---------------------------------------------------------------------------------------------------------------------
VToolArc::VToolArc(VPattern *doc, VContainer *data, quint32 id, const Valentina::Sources &typeCreation, VToolArc::VToolArc(VPattern *doc, VContainer *data, quint32 id, const Valentina::Sources &typeCreation,
QGraphicsItem *parent) QGraphicsItem *parent)
:VDrawTool(doc, data, id), QGraphicsPathItem(parent) :VDrawTool(doc, data, id), QGraphicsPathItem(parent)
@ -58,6 +59,7 @@ VToolArc::VToolArc(VPattern *doc, VContainer *data, quint32 id, const Valentina:
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolArc::setDialog() void VToolArc::setDialog()
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -70,6 +72,7 @@ void VToolArc::setDialog()
dialogTool->SetRadius(arc->GetFormulaRadius()); dialogTool->SetRadius(arc->GetFormulaRadius());
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, void VToolArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data) VContainer *data)
{ {
@ -83,6 +86,7 @@ void VToolArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *d
Create(0, center, radius, f1, f2, scene, doc, data, Document::FullParse, Valentina::FromGui); Create(0, center, radius, f1, f2, scene, doc, data, Document::FullParse, Valentina::FromGui);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolArc::Create(const quint32 _id, const quint32 &center, const QString &radius, const QString &f1, void VToolArc::Create(const quint32 _id, const quint32 &center, const QString &radius, const QString &f1,
const QString &f2, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const QString &f2, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document::Documents &parse, const Valentina::Sources &typeCreation) const Document::Documents &parse, const Valentina::Sources &typeCreation)
@ -138,11 +142,13 @@ void VToolArc::Create(const quint32 _id, const quint32 &center, const QString &r
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolArc::FullUpdateFromFile() void VToolArc::FullUpdateFromFile()
{ {
RefreshGeometry(); RefreshGeometry();
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolArc::ChangedActivDraw(const QString &newName) void VToolArc::ChangedActivDraw(const QString &newName)
{ {
bool selectable = false; bool selectable = false;
@ -162,22 +168,26 @@ void VToolArc::ChangedActivDraw(const QString &newName)
VDrawTool::ChangedActivDraw(newName); VDrawTool::ChangedActivDraw(newName);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolArc::ShowTool(quint32 id, Qt::GlobalColor color, bool enable) void VToolArc::ShowTool(quint32 id, Qt::GlobalColor color, bool enable)
{ {
ShowItem(this, id, color, enable); ShowItem(this, id, color, enable);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolArc::SetFactor(qreal factor) void VToolArc::SetFactor(qreal factor)
{ {
VDrawTool::SetFactor(factor); VDrawTool::SetFactor(factor);
RefreshGeometry(); RefreshGeometry();
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolArc::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolArc::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogArc>(this, event); ContextMenu<DialogArc>(this, event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolArc::AddToFile() void VToolArc::AddToFile()
{ {
const VArc *arc = VAbstractTool::data.GeometricObject<const VArc *>(id); const VArc *arc = VAbstractTool::data.GeometricObject<const VArc *>(id);
@ -193,6 +203,7 @@ void VToolArc::AddToFile()
AddToCalculation(domElement); AddToCalculation(domElement);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolArc::RefreshDataInFile() void VToolArc::RefreshDataInFile()
{ {
const VArc *arc = VAbstractTool::data.GeometricObject<const VArc *>(id); const VArc *arc = VAbstractTool::data.GeometricObject<const VArc *>(id);
@ -206,6 +217,7 @@ void VToolArc::RefreshDataInFile()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VToolArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{ {
if (event->button() == Qt::LeftButton) if (event->button() == Qt::LeftButton)
@ -215,6 +227,7 @@ void VToolArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
QGraphicsItem::mouseReleaseEvent(event); QGraphicsItem::mouseReleaseEvent(event);
} }
//---------------------------------------------------------------------------------------------------------------------
//cppcheck-suppress unusedFunction //cppcheck-suppress unusedFunction
void VToolArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VToolArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
@ -222,6 +235,7 @@ void VToolArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthMainLine())/factor)); this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthMainLine())/factor));
} }
//---------------------------------------------------------------------------------------------------------------------
//cppcheck-suppress unusedFunction //cppcheck-suppress unusedFunction
void VToolArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VToolArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
@ -229,12 +243,14 @@ void VToolArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor)); this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor));
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolArc::RemoveReferens() void VToolArc::RemoveReferens()
{ {
const VArc *arc = VAbstractTool::data.GeometricObject<const VArc *>(id); const VArc *arc = VAbstractTool::data.GeometricObject<const VArc *>(id);
doc->DecrementReferens(arc->GetCenter().id()); doc->DecrementReferens(arc->GetCenter().id());
} }
//---------------------------------------------------------------------------------------------------------------------
QVariant VToolArc::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) QVariant VToolArc::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
{ {
if (change == QGraphicsItem::ItemSelectedChange) if (change == QGraphicsItem::ItemSelectedChange)
@ -253,6 +269,7 @@ QVariant VToolArc::itemChange(QGraphicsItem::GraphicsItemChange change, const QV
return QGraphicsItem::itemChange(change, value); return QGraphicsItem::itemChange(change, value);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolArc::keyReleaseEvent(QKeyEvent *event) void VToolArc::keyReleaseEvent(QKeyEvent *event)
{ {
switch (event->key()) switch (event->key())
@ -266,6 +283,7 @@ void VToolArc::keyReleaseEvent(QKeyEvent *event)
QGraphicsItem::keyReleaseEvent ( event ); QGraphicsItem::keyReleaseEvent ( event );
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolArc::SaveDialog(QDomElement &domElement) void VToolArc::SaveDialog(QDomElement &domElement)
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -277,6 +295,7 @@ void VToolArc::SaveDialog(QDomElement &domElement)
doc->SetAttribute(domElement, AttrAngle2, dialogTool->GetF2()); doc->SetAttribute(domElement, AttrAngle2, dialogTool->GetF2());
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolArc::RefreshGeometry() void VToolArc::RefreshGeometry()
{ {
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor)); this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor));

View File

@ -32,6 +32,7 @@
const QString VToolBisector::ToolType = QStringLiteral("bisector"); const QString VToolBisector::ToolType = QStringLiteral("bisector");
//---------------------------------------------------------------------------------------------------------------------
VToolBisector::VToolBisector(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, VToolBisector::VToolBisector(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
const QString &formula, const quint32 &firstPointId, const quint32 &secondPointId, const QString &formula, const quint32 &firstPointId, const quint32 &secondPointId,
const quint32 &thirdPointId, const Valentina::Sources &typeCreation, QGraphicsItem *parent) const quint32 &thirdPointId, const Valentina::Sources &typeCreation, QGraphicsItem *parent)
@ -50,6 +51,7 @@ VToolBisector::VToolBisector(VPattern *doc, VContainer *data, const quint32 &id,
} }
} }
//---------------------------------------------------------------------------------------------------------------------
QPointF VToolBisector::FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, QPointF VToolBisector::FindPoint(const QPointF &firstPoint, const QPointF &secondPoint,
const QPointF &thirdPoint, const qreal &length) const QPointF &thirdPoint, const qreal &length)
{ {
@ -69,6 +71,7 @@ QPointF VToolBisector::FindPoint(const QPointF &firstPoint, const QPointF &secon
return line1.p2(); return line1.p2();
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolBisector::setDialog() void VToolBisector::setDialog()
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -83,6 +86,7 @@ void VToolBisector::setDialog()
dialogTool->setPointName(p->name()); dialogTool->setPointName(p->name());
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolBisector::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, void VToolBisector::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data) VContainer *data)
{ {
@ -99,6 +103,7 @@ void VToolBisector::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPatte
Document::FullParse, Valentina::FromGui); Document::FullParse, Valentina::FromGui);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolBisector::Create(const quint32 _id, const QString &formula, const quint32 &firstPointId, void VToolBisector::Create(const quint32 _id, const QString &formula, const quint32 &firstPointId,
const quint32 &secondPointId, const quint32 &thirdPointId, const QString &typeLine, const quint32 &secondPointId, const quint32 &thirdPointId, const QString &typeLine,
const QString &pointName, const qreal &mx, const qreal &my, const QString &pointName, const qreal &mx, const qreal &my,
@ -147,6 +152,7 @@ void VToolBisector::Create(const quint32 _id, const QString &formula, const quin
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolBisector::FullUpdateFromFile() void VToolBisector::FullUpdateFromFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -161,22 +167,26 @@ void VToolBisector::FullUpdateFromFile()
RefreshGeometry(); RefreshGeometry();
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolBisector::SetFactor(qreal factor) void VToolBisector::SetFactor(qreal factor)
{ {
VDrawTool::SetFactor(factor); VDrawTool::SetFactor(factor);
RefreshGeometry(); RefreshGeometry();
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolBisector::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) void VToolBisector::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogBisector>(this, event); ContextMenu<DialogBisector>(this, event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolBisector::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolBisector::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogBisector>(this, event); ContextMenu<DialogBisector>(this, event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolBisector::AddToFile() void VToolBisector::AddToFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -197,6 +207,7 @@ void VToolBisector::AddToFile()
AddToCalculation(domElement); AddToCalculation(domElement);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolBisector::RefreshDataInFile() void VToolBisector::RefreshDataInFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -214,6 +225,7 @@ void VToolBisector::RefreshDataInFile()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolBisector::RemoveReferens() void VToolBisector::RemoveReferens()
{ {
doc->DecrementReferens(firstPointId); doc->DecrementReferens(firstPointId);
@ -221,6 +233,7 @@ void VToolBisector::RemoveReferens()
VToolLinePoint::RemoveReferens(); VToolLinePoint::RemoveReferens();
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolBisector::SaveDialog(QDomElement &domElement) void VToolBisector::SaveDialog(QDomElement &domElement)
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);

View File

@ -33,6 +33,7 @@
const QString VToolCutArc::ToolType = QStringLiteral("cutArc"); const QString VToolCutArc::ToolType = QStringLiteral("cutArc");
const QString VToolCutArc::AttrArc = QStringLiteral("arc"); const QString VToolCutArc::AttrArc = QStringLiteral("arc");
//---------------------------------------------------------------------------------------------------------------------
VToolCutArc::VToolCutArc(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula, VToolCutArc::VToolCutArc(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
const quint32 &arcId, const quint32 &arc1id, const quint32 &arc2id, const quint32 &arcId, const quint32 &arc1id, const quint32 &arc2id,
const Valentina::Sources &typeCreation, QGraphicsItem * parent) const Valentina::Sources &typeCreation, QGraphicsItem * parent)
@ -63,6 +64,7 @@ VToolCutArc::VToolCutArc(VPattern *doc, VContainer *data, const quint32 &id, con
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutArc::setDialog() void VToolCutArc::setDialog()
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -74,6 +76,7 @@ void VToolCutArc::setDialog()
dialogTool->setPointName(point->name()); dialogTool->setPointName(point->name());
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, void VToolCutArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data) VContainer *data)
{ {
@ -86,6 +89,7 @@ void VToolCutArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern
Create(0, pointName, formula, arcId, 5, 10, scene, doc, data, Document::FullParse, Valentina::FromGui); Create(0, pointName, formula, arcId, 5, 10, scene, doc, data, Document::FullParse, Valentina::FromGui);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutArc::Create(const quint32 _id, const QString &pointName, const QString &formula, const quint32 &arcId, void VToolCutArc::Create(const quint32 _id, const QString &pointName, const QString &formula, const quint32 &arcId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document::Documents &parse, const Valentina::Sources &typeCreation) VContainer *data, const Document::Documents &parse, const Valentina::Sources &typeCreation)
@ -151,6 +155,7 @@ void VToolCutArc::Create(const quint32 _id, const QString &pointName, const QStr
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutArc::FullUpdateFromFile() void VToolCutArc::FullUpdateFromFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -162,11 +167,13 @@ void VToolCutArc::FullUpdateFromFile()
RefreshGeometry(); RefreshGeometry();
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutArc::ArcChoosed(quint32 id) void VToolCutArc::ArcChoosed(quint32 id)
{ {
emit ChoosedTool(id, Valentina::Arc); emit ChoosedTool(id, Valentina::Arc);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutArc::ChangedActivDraw(const QString &newName) void VToolCutArc::ChangedActivDraw(const QString &newName)
{ {
if (nameActivDraw == newName) if (nameActivDraw == newName)
@ -190,16 +197,19 @@ void VToolCutArc::ChangedActivDraw(const QString &newName)
VToolPoint::ChangedActivDraw(newName); VToolPoint::ChangedActivDraw(newName);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutArc::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) void VToolCutArc::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogCutArc>(this, event); ContextMenu<DialogCutArc>(this, event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutArc::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolCutArc::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogCutArc>(this, event); ContextMenu<DialogCutArc>(this, event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutArc::AddToFile() void VToolCutArc::AddToFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -217,6 +227,7 @@ void VToolCutArc::AddToFile()
AddToCalculation(domElement); AddToCalculation(domElement);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutArc::RefreshDataInFile() void VToolCutArc::RefreshDataInFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -231,6 +242,7 @@ void VToolCutArc::RefreshDataInFile()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutArc::RefreshGeometry() void VToolCutArc::RefreshGeometry()
{ {
RefreshArc(firstArc, arc1id, SimpleArc::ForthPoint); RefreshArc(firstArc, arc1id, SimpleArc::ForthPoint);
@ -238,6 +250,7 @@ void VToolCutArc::RefreshGeometry()
VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<const VPointF *>(id)); VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<const VPointF *>(id));
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutArc::SaveDialog(QDomElement &domElement) void VToolCutArc::SaveDialog(QDomElement &domElement)
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -248,6 +261,7 @@ void VToolCutArc::SaveDialog(QDomElement &domElement)
doc->SetAttribute(domElement, AttrArc, QString().setNum(dialogTool->getArcId())); doc->SetAttribute(domElement, AttrArc, QString().setNum(dialogTool->getArcId()));
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutArc::RefreshArc(VSimpleArc *sArc, quint32 arcid, SimpleArc::Translation tr) void VToolCutArc::RefreshArc(VSimpleArc *sArc, quint32 arcid, SimpleArc::Translation tr)
{ {
const VArc *arc = VAbstractTool::data.GeometricObject<const VArc *>(arcid); const VArc *arc = VAbstractTool::data.GeometricObject<const VArc *>(arcid);

View File

@ -33,6 +33,7 @@
const QString VToolCutSpline::ToolType = QStringLiteral("cutSpline"); const QString VToolCutSpline::ToolType = QStringLiteral("cutSpline");
const QString VToolCutSpline::AttrSpline = QStringLiteral("spline"); const QString VToolCutSpline::AttrSpline = QStringLiteral("spline");
//---------------------------------------------------------------------------------------------------------------------
VToolCutSpline::VToolCutSpline(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula, VToolCutSpline::VToolCutSpline(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
const quint32 &splineId, const quint32 &spl1id, const quint32 &spl2id, const quint32 &splineId, const quint32 &spl1id, const quint32 &spl2id,
const Valentina::Sources &typeCreation, QGraphicsItem *parent) const Valentina::Sources &typeCreation, QGraphicsItem *parent)
@ -63,6 +64,7 @@ VToolCutSpline::VToolCutSpline(VPattern *doc, VContainer *data, const quint32 &i
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutSpline::setDialog() void VToolCutSpline::setDialog()
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -74,6 +76,7 @@ void VToolCutSpline::setDialog()
dialogTool->setPointName(point->name()); dialogTool->setPointName(point->name());
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene, void VToolCutSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene,
VPattern *doc, VContainer *data) VPattern *doc, VContainer *data)
{ {
@ -86,6 +89,7 @@ void VToolCutSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene,
Create(0, pointName, formula, splineId, 5, 10, scene, doc, data, Document::FullParse, Valentina::FromGui); Create(0, pointName, formula, splineId, 5, 10, scene, doc, data, Document::FullParse, Valentina::FromGui);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutSpline::Create(const quint32 _id, const QString &pointName, void VToolCutSpline::Create(const quint32 _id, const QString &pointName,
const QString &formula, const quint32 &splineId, const qreal &mx, const qreal &my, const QString &formula, const quint32 &splineId, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
@ -152,6 +156,7 @@ void VToolCutSpline::Create(const quint32 _id, const QString &pointName,
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutSpline::FullUpdateFromFile() void VToolCutSpline::FullUpdateFromFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -163,11 +168,13 @@ void VToolCutSpline::FullUpdateFromFile()
RefreshGeometry(); RefreshGeometry();
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutSpline::SplineChoosed(quint32 id) void VToolCutSpline::SplineChoosed(quint32 id)
{ {
emit ChoosedTool(id, Valentina::Spline); emit ChoosedTool(id, Valentina::Spline);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutSpline::ChangedActivDraw(const QString &newName) void VToolCutSpline::ChangedActivDraw(const QString &newName)
{ {
bool flag = true; bool flag = true;
@ -186,16 +193,19 @@ void VToolCutSpline::ChangedActivDraw(const QString &newName)
VToolPoint::ChangedActivDraw(newName); VToolPoint::ChangedActivDraw(newName);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutSpline::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) void VToolCutSpline::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogCutSpline>(this, event); ContextMenu<DialogCutSpline>(this, event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutSpline::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolCutSpline::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogCutSpline>(this, event); ContextMenu<DialogCutSpline>(this, event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutSpline::AddToFile() void VToolCutSpline::AddToFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -213,6 +223,7 @@ void VToolCutSpline::AddToFile()
AddToCalculation(domElement); AddToCalculation(domElement);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutSpline::RefreshDataInFile() void VToolCutSpline::RefreshDataInFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -227,6 +238,7 @@ void VToolCutSpline::RefreshDataInFile()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutSpline::RefreshGeometry() void VToolCutSpline::RefreshGeometry()
{ {
RefreshSpline(firstSpline, spl1id, SimpleSpline::ForthPoint); RefreshSpline(firstSpline, spl1id, SimpleSpline::ForthPoint);
@ -234,11 +246,13 @@ void VToolCutSpline::RefreshGeometry()
VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<const VPointF *>(id)); VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<const VPointF *>(id));
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutSpline::RemoveReferens() void VToolCutSpline::RemoveReferens()
{ {
doc->DecrementReferens(splineId); doc->DecrementReferens(splineId);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutSpline::SaveDialog(QDomElement &domElement) void VToolCutSpline::SaveDialog(QDomElement &domElement)
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -249,6 +263,7 @@ void VToolCutSpline::SaveDialog(QDomElement &domElement)
doc->SetAttribute(domElement, AttrSpline, QString().setNum(dialogTool->getSplineId())); doc->SetAttribute(domElement, AttrSpline, QString().setNum(dialogTool->getSplineId()));
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutSpline::RefreshSpline(VSimpleSpline *spline, quint32 splid, SimpleSpline::Translation tr) void VToolCutSpline::RefreshSpline(VSimpleSpline *spline, quint32 splid, SimpleSpline::Translation tr)
{ {
const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(splid); const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(splid);

View File

@ -33,6 +33,7 @@
const QString VToolCutSplinePath::ToolType = QStringLiteral("cutSplinePath"); const QString VToolCutSplinePath::ToolType = QStringLiteral("cutSplinePath");
const QString VToolCutSplinePath::AttrSplinePath = QStringLiteral("splinePath"); const QString VToolCutSplinePath::AttrSplinePath = QStringLiteral("splinePath");
//---------------------------------------------------------------------------------------------------------------------
VToolCutSplinePath::VToolCutSplinePath(VPattern *doc, VContainer *data, const quint32 &id, VToolCutSplinePath::VToolCutSplinePath(VPattern *doc, VContainer *data, const quint32 &id,
const QString &formula, const quint32 &splinePathId, const QString &formula, const quint32 &splinePathId,
const quint32 &splPath1id, const quint32 &splPath2id, const quint32 &splPath1id, const quint32 &splPath2id,
@ -64,6 +65,7 @@ VToolCutSplinePath::VToolCutSplinePath(VPattern *doc, VContainer *data, const qu
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutSplinePath::setDialog() void VToolCutSplinePath::setDialog()
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -75,6 +77,7 @@ void VToolCutSplinePath::setDialog()
dialogTool->setPointName(point->name()); dialogTool->setPointName(point->name());
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) void VToolCutSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -86,6 +89,7 @@ void VToolCutSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, V
Create(0, pointName, formula, splinePathId, 5, 10, scene, doc, data, Document::FullParse, Valentina::FromGui); Create(0, pointName, formula, splinePathId, 5, 10, scene, doc, data, Document::FullParse, Valentina::FromGui);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, const QString &formula, void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, const QString &formula,
const quint32 &splinePathId, const qreal &mx, const qreal &my, const quint32 &splinePathId, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
@ -226,6 +230,7 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, con
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutSplinePath::FullUpdateFromFile() void VToolCutSplinePath::FullUpdateFromFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -237,11 +242,13 @@ void VToolCutSplinePath::FullUpdateFromFile()
RefreshGeometry(); RefreshGeometry();
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutSplinePath::SplineChoosed(quint32 id) void VToolCutSplinePath::SplineChoosed(quint32 id)
{ {
emit ChoosedTool(id, Valentina::SplinePath); emit ChoosedTool(id, Valentina::SplinePath);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutSplinePath::ChangedActivDraw(const QString &newName) void VToolCutSplinePath::ChangedActivDraw(const QString &newName)
{ {
bool flag = true; bool flag = true;
@ -260,16 +267,19 @@ void VToolCutSplinePath::ChangedActivDraw(const QString &newName)
VToolPoint::ChangedActivDraw(newName); VToolPoint::ChangedActivDraw(newName);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutSplinePath::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) void VToolCutSplinePath::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogCutSplinePath>(this, event); ContextMenu<DialogCutSplinePath>(this, event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutSplinePath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolCutSplinePath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogCutSplinePath>(this, event); ContextMenu<DialogCutSplinePath>(this, event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutSplinePath::AddToFile() void VToolCutSplinePath::AddToFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -287,6 +297,7 @@ void VToolCutSplinePath::AddToFile()
AddToCalculation(domElement); AddToCalculation(domElement);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutSplinePath::RefreshDataInFile() void VToolCutSplinePath::RefreshDataInFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -301,6 +312,7 @@ void VToolCutSplinePath::RefreshDataInFile()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutSplinePath::RefreshGeometry() void VToolCutSplinePath::RefreshGeometry()
{ {
RefreshSpline(firstSpline, splPath1id, SimpleSpline::ForthPoint); RefreshSpline(firstSpline, splPath1id, SimpleSpline::ForthPoint);
@ -308,11 +320,13 @@ void VToolCutSplinePath::RefreshGeometry()
VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<const VPointF *>(id)); VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<const VPointF *>(id));
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutSplinePath::RemoveReferens() void VToolCutSplinePath::RemoveReferens()
{ {
doc->DecrementReferens(splinePathId); doc->DecrementReferens(splinePathId);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutSplinePath::SaveDialog(QDomElement &domElement) void VToolCutSplinePath::SaveDialog(QDomElement &domElement)
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -323,6 +337,7 @@ void VToolCutSplinePath::SaveDialog(QDomElement &domElement)
doc->SetAttribute(domElement, AttrSplinePath, QString().setNum(dialogTool->getSplinePathId())); doc->SetAttribute(domElement, AttrSplinePath, QString().setNum(dialogTool->getSplinePathId()));
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolCutSplinePath::RefreshSpline(VSimpleSpline *spline, quint32 splPathid, SimpleSpline::Translation tr) void VToolCutSplinePath::RefreshSpline(VSimpleSpline *spline, quint32 splPathid, SimpleSpline::Translation tr)
{ {
const VSplinePath *splPath = VAbstractTool::data.GeometricObject<const VSplinePath *>(splPathid); const VSplinePath *splPath = VAbstractTool::data.GeometricObject<const VSplinePath *>(splPathid);

View File

@ -33,6 +33,7 @@
const QString VToolEndLine::ToolType = QStringLiteral("endLine"); const QString VToolEndLine::ToolType = QStringLiteral("endLine");
//---------------------------------------------------------------------------------------------------------------------
VToolEndLine::VToolEndLine(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, VToolEndLine::VToolEndLine(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
const QString &formula, const qreal &angle, const quint32 &basePointId, const QString &formula, const qreal &angle, const quint32 &basePointId,
const Valentina::Sources &typeCreation, QGraphicsItem *parent) const Valentina::Sources &typeCreation, QGraphicsItem *parent)
@ -49,6 +50,7 @@ VToolEndLine::VToolEndLine(VPattern *doc, VContainer *data, const quint32 &id,
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolEndLine::setDialog() void VToolEndLine::setDialog()
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -62,6 +64,7 @@ void VToolEndLine::setDialog()
dialogTool->setPointName(p->name()); dialogTool->setPointName(p->name());
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolEndLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, void VToolEndLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data) VContainer *data)
{ {
@ -77,6 +80,7 @@ void VToolEndLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPatter
Valentina::FromGui); Valentina::FromGui);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolEndLine::Create(const quint32 _id, const QString &pointName, const QString &typeLine, void VToolEndLine::Create(const quint32 _id, const QString &pointName, const QString &typeLine,
const QString &formula, const qreal &angle, const quint32 &basePointId, const QString &formula, const qreal &angle, const quint32 &basePointId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
@ -120,6 +124,7 @@ void VToolEndLine::Create(const quint32 _id, const QString &pointName, const QSt
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolEndLine::FullUpdateFromFile() void VToolEndLine::FullUpdateFromFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -133,16 +138,19 @@ void VToolEndLine::FullUpdateFromFile()
RefreshGeometry(); RefreshGeometry();
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolEndLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolEndLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogEndLine>(this, event); ContextMenu<DialogEndLine>(this, event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolEndLine::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) void VToolEndLine::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogEndLine>(this, event); ContextMenu<DialogEndLine>(this, event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolEndLine::AddToFile() void VToolEndLine::AddToFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -162,6 +170,7 @@ void VToolEndLine::AddToFile()
AddToCalculation(domElement); AddToCalculation(domElement);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolEndLine::RefreshDataInFile() void VToolEndLine::RefreshDataInFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -178,6 +187,7 @@ void VToolEndLine::RefreshDataInFile()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolEndLine::SaveDialog(QDomElement &domElement) void VToolEndLine::SaveDialog(QDomElement &domElement)
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);

View File

@ -31,6 +31,7 @@
const QString VToolHeight::ToolType = QStringLiteral("height"); const QString VToolHeight::ToolType = QStringLiteral("height");
//---------------------------------------------------------------------------------------------------------------------
VToolHeight::VToolHeight(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, VToolHeight::VToolHeight(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
const quint32 &basePointId, const quint32 &p1LineId, const quint32 &p2LineId, const quint32 &basePointId, const quint32 &p1LineId, const quint32 &p2LineId,
const Valentina::Sources &typeCreation, QGraphicsItem * parent) const Valentina::Sources &typeCreation, QGraphicsItem * parent)
@ -47,6 +48,7 @@ VToolHeight::VToolHeight(VPattern *doc, VContainer *data, const quint32 &id, con
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolHeight::setDialog() void VToolHeight::setDialog()
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -60,6 +62,7 @@ void VToolHeight::setDialog()
dialogTool->setPointName(p->name()); dialogTool->setPointName(p->name());
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolHeight::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, void VToolHeight::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data) VContainer *data)
{ {
@ -76,6 +79,7 @@ void VToolHeight::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern
Document::FullParse, Valentina::FromGui); Document::FullParse, Valentina::FromGui);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolHeight::Create(const quint32 _id, const QString &pointName, const QString &typeLine, void VToolHeight::Create(const quint32 _id, const QString &pointName, const QString &typeLine,
const quint32 &basePointId, const quint32 &p1LineId, const quint32 &p2LineId, const quint32 &basePointId, const quint32 &p1LineId, const quint32 &p2LineId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
@ -120,11 +124,13 @@ void VToolHeight::Create(const quint32 _id, const QString &pointName, const QStr
} }
} }
//---------------------------------------------------------------------------------------------------------------------
QPointF VToolHeight::FindPoint(const QLineF &line, const QPointF &point) QPointF VToolHeight::FindPoint(const QLineF &line, const QPointF &point)
{ {
return VAbstractTool::ClosestPoint(line, point); return VAbstractTool::ClosestPoint(line, point);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolHeight::FullUpdateFromFile() void VToolHeight::FullUpdateFromFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -139,16 +145,19 @@ void VToolHeight::FullUpdateFromFile()
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolHeight::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) void VToolHeight::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogHeight>(this, event); ContextMenu<DialogHeight>(this, event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolHeight::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolHeight::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogHeight>(this, event); ContextMenu<DialogHeight>(this, event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolHeight::AddToFile() void VToolHeight::AddToFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -169,6 +178,7 @@ void VToolHeight::AddToFile()
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolHeight::RefreshDataInFile() void VToolHeight::RefreshDataInFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -185,6 +195,7 @@ void VToolHeight::RefreshDataInFile()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolHeight::SaveDialog(QDomElement &domElement) void VToolHeight::SaveDialog(QDomElement &domElement)
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);

View File

@ -32,6 +32,7 @@
const QString VToolLine::TagName = QStringLiteral("line"); const QString VToolLine::TagName = QStringLiteral("line");
//---------------------------------------------------------------------------------------------------------------------
VToolLine::VToolLine(VPattern *doc, VContainer *data, quint32 id, quint32 firstPoint, quint32 secondPoint, VToolLine::VToolLine(VPattern *doc, VContainer *data, quint32 id, quint32 firstPoint, quint32 secondPoint,
const QString &typeLine, const Valentina::Sources &typeCreation, QGraphicsItem *parent) const QString &typeLine, const Valentina::Sources &typeCreation, QGraphicsItem *parent)
:VDrawTool(doc, data, id), QGraphicsLineItem(parent), firstPoint(firstPoint), secondPoint(secondPoint) :VDrawTool(doc, data, id), QGraphicsLineItem(parent), firstPoint(firstPoint), secondPoint(secondPoint)
@ -58,6 +59,7 @@ VToolLine::VToolLine(VPattern *doc, VContainer *data, quint32 id, quint32 firstP
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolLine::setDialog() void VToolLine::setDialog()
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -68,6 +70,7 @@ void VToolLine::setDialog()
dialogTool->setTypeLine(typeLine); dialogTool->setTypeLine(typeLine);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) void VToolLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -79,6 +82,7 @@ void VToolLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *
Create(0, firstPoint, secondPoint, typeLine, scene, doc, data, Document::FullParse, Valentina::FromGui); Create(0, firstPoint, secondPoint, typeLine, scene, doc, data, Document::FullParse, Valentina::FromGui);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, const quint32 &secondPoint, void VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, const quint32 &secondPoint,
const QString &typeLine, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const QString &typeLine, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document::Documents &parse, const Valentina::Sources &typeCreation) const Document::Documents &parse, const Valentina::Sources &typeCreation)
@ -114,22 +118,26 @@ void VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, const quin
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolLine::FullUpdateFromFile() void VToolLine::FullUpdateFromFile()
{ {
RefreshGeometry(); RefreshGeometry();
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolLine::ShowTool(quint32 id, Qt::GlobalColor color, bool enable) void VToolLine::ShowTool(quint32 id, Qt::GlobalColor color, bool enable)
{ {
ShowItem(this, id, color, enable); ShowItem(this, id, color, enable);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolLine::SetFactor(qreal factor) void VToolLine::SetFactor(qreal factor)
{ {
VDrawTool::SetFactor(factor); VDrawTool::SetFactor(factor);
RefreshGeometry(); RefreshGeometry();
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolLine::ChangedActivDraw(const QString &newName) void VToolLine::ChangedActivDraw(const QString &newName)
{ {
bool selectable = false; bool selectable = false;
@ -148,11 +156,13 @@ void VToolLine::ChangedActivDraw(const QString &newName)
VDrawTool::ChangedActivDraw(newName); VDrawTool::ChangedActivDraw(newName);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogLine>(this, event); ContextMenu<DialogLine>(this, event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolLine::AddToFile() void VToolLine::AddToFile()
{ {
QDomElement domElement = doc->createElement(TagName); QDomElement domElement = doc->createElement(TagName);
@ -164,6 +174,7 @@ void VToolLine::AddToFile()
AddToCalculation(domElement); AddToCalculation(domElement);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolLine::RefreshDataInFile() void VToolLine::RefreshDataInFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -175,24 +186,28 @@ void VToolLine::RefreshDataInFile()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolLine::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VToolLine::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthMainLine())/factor, LineStyle())); this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthMainLine())/factor, LineStyle()));
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VToolLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor, LineStyle())); this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor, LineStyle()));
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolLine::RemoveReferens() void VToolLine::RemoveReferens()
{ {
doc->DecrementReferens(firstPoint); doc->DecrementReferens(firstPoint);
doc->DecrementReferens(secondPoint); doc->DecrementReferens(secondPoint);
} }
//---------------------------------------------------------------------------------------------------------------------
QVariant VToolLine::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) QVariant VToolLine::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
{ {
if (change == QGraphicsItem::ItemSelectedChange) if (change == QGraphicsItem::ItemSelectedChange)
@ -211,6 +226,7 @@ QVariant VToolLine::itemChange(QGraphicsItem::GraphicsItemChange change, const Q
return QGraphicsItem::itemChange(change, value); return QGraphicsItem::itemChange(change, value);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolLine::keyReleaseEvent(QKeyEvent *event) void VToolLine::keyReleaseEvent(QKeyEvent *event)
{ {
switch (event->key()) switch (event->key())
@ -224,6 +240,7 @@ void VToolLine::keyReleaseEvent(QKeyEvent *event)
QGraphicsItem::keyReleaseEvent ( event ); QGraphicsItem::keyReleaseEvent ( event );
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolLine::SaveDialog(QDomElement &domElement) void VToolLine::SaveDialog(QDomElement &domElement)
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -234,6 +251,7 @@ void VToolLine::SaveDialog(QDomElement &domElement)
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine()); doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolLine::RefreshGeometry() void VToolLine::RefreshGeometry()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));

View File

@ -31,6 +31,7 @@
const QString VToolLineIntersect::ToolType = QStringLiteral("lineIntersect"); const QString VToolLineIntersect::ToolType = QStringLiteral("lineIntersect");
//---------------------------------------------------------------------------------------------------------------------
VToolLineIntersect::VToolLineIntersect(VPattern *doc, VContainer *data, const quint32 &id, VToolLineIntersect::VToolLineIntersect(VPattern *doc, VContainer *data, const quint32 &id,
const quint32 &p1Line1, const quint32 &p2Line1, const quint32 &p1Line2, const quint32 &p1Line1, const quint32 &p2Line1, const quint32 &p1Line2,
const quint32 &p2Line2, const Valentina::Sources &typeCreation, const quint32 &p2Line2, const Valentina::Sources &typeCreation,
@ -49,6 +50,7 @@ VToolLineIntersect::VToolLineIntersect(VPattern *doc, VContainer *data, const qu
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolLineIntersect::setDialog() void VToolLineIntersect::setDialog()
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -62,6 +64,7 @@ void VToolLineIntersect::setDialog()
dialogTool->setPointName(p->name()); dialogTool->setPointName(p->name());
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolLineIntersect::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) void VToolLineIntersect::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -76,6 +79,7 @@ void VToolLineIntersect::Create(DialogTool *dialog, VMainGraphicsScene *scene, V
Document::FullParse, Valentina::FromGui); Document::FullParse, Valentina::FromGui);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolLineIntersect::Create(const quint32 _id, const quint32 &p1Line1Id, const quint32 &p2Line1Id, void VToolLineIntersect::Create(const quint32 _id, const quint32 &p1Line1Id, const quint32 &p2Line1Id,
const quint32 &p1Line2Id, const quint32 &p2Line2Id, const QString &pointName, const quint32 &p1Line2Id, const quint32 &p2Line2Id, const QString &pointName,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
@ -131,6 +135,7 @@ void VToolLineIntersect::Create(const quint32 _id, const quint32 &p1Line1Id, con
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolLineIntersect::FullUpdateFromFile() void VToolLineIntersect::FullUpdateFromFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -144,22 +149,26 @@ void VToolLineIntersect::FullUpdateFromFile()
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<const VPointF *>(id)); RefreshPointGeometry(*VAbstractTool::data.GeometricObject<const VPointF *>(id));
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolLineIntersect::SetFactor(qreal factor) void VToolLineIntersect::SetFactor(qreal factor)
{ {
VDrawTool::SetFactor(factor); VDrawTool::SetFactor(factor);
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<const VPointF *>(id)); RefreshPointGeometry(*VAbstractTool::data.GeometricObject<const VPointF *>(id));
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolLineIntersect::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) void VToolLineIntersect::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogLineIntersect>(this, event); ContextMenu<DialogLineIntersect>(this, event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolLineIntersect::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolLineIntersect::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogLineIntersect>(this, event); ContextMenu<DialogLineIntersect>(this, event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolLineIntersect::AddToFile() void VToolLineIntersect::AddToFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -179,6 +188,7 @@ void VToolLineIntersect::AddToFile()
AddToCalculation(domElement); AddToCalculation(domElement);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolLineIntersect::RefreshDataInFile() void VToolLineIntersect::RefreshDataInFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -195,6 +205,7 @@ void VToolLineIntersect::RefreshDataInFile()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolLineIntersect::RemoveReferens() void VToolLineIntersect::RemoveReferens()
{ {
doc->DecrementReferens(p1Line1); doc->DecrementReferens(p1Line1);
@ -203,6 +214,7 @@ void VToolLineIntersect::RemoveReferens()
doc->DecrementReferens(p2Line2); doc->DecrementReferens(p2Line2);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolLineIntersect::SaveDialog(QDomElement &domElement) void VToolLineIntersect::SaveDialog(QDomElement &domElement)
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);

View File

@ -28,6 +28,7 @@
#include "vtoollinepoint.h" #include "vtoollinepoint.h"
//---------------------------------------------------------------------------------------------------------------------
VToolLinePoint::VToolLinePoint(VPattern *doc, VContainer *data, const quint32 &id, VToolLinePoint::VToolLinePoint(VPattern *doc, VContainer *data, const quint32 &id,
const QString &typeLine, const QString &formula, const quint32 &basePointId, const QString &typeLine, const QString &formula, const quint32 &basePointId,
const qreal &angle, QGraphicsItem *parent) const qreal &angle, QGraphicsItem *parent)
@ -43,6 +44,7 @@ VToolLinePoint::VToolLinePoint(VPattern *doc, VContainer *data, const quint32 &i
mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true); mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolLinePoint::ChangedActivDraw(const QString &newName) void VToolLinePoint::ChangedActivDraw(const QString &newName)
{ {
if (nameActivDraw == newName) if (nameActivDraw == newName)
@ -57,6 +59,7 @@ void VToolLinePoint::ChangedActivDraw(const QString &newName)
VToolPoint::ChangedActivDraw(newName); VToolPoint::ChangedActivDraw(newName);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolLinePoint::RefreshGeometry() void VToolLinePoint::RefreshGeometry()
{ {
mainLine->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor, LineStyle())); mainLine->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor, LineStyle()));
@ -66,6 +69,7 @@ void VToolLinePoint::RefreshGeometry()
mainLine->setLine(QLineF(basePoint - point, QPointF())); mainLine->setLine(QLineF(basePoint - point, QPointF()));
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolLinePoint::SetFactor(qreal factor) void VToolLinePoint::SetFactor(qreal factor)
{ {
VDrawTool::SetFactor(factor); VDrawTool::SetFactor(factor);

View File

@ -32,6 +32,7 @@
const QString VToolNormal::ToolType = QStringLiteral("normal"); const QString VToolNormal::ToolType = QStringLiteral("normal");
//---------------------------------------------------------------------------------------------------------------------
VToolNormal::VToolNormal(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, VToolNormal::VToolNormal(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
const QString &formula, const qreal &angle, const quint32 &firstPointId, const QString &formula, const qreal &angle, const quint32 &firstPointId,
const quint32 &secondPointId, const Valentina::Sources &typeCreation, QGraphicsItem *parent) const quint32 &secondPointId, const Valentina::Sources &typeCreation, QGraphicsItem *parent)
@ -49,6 +50,7 @@ VToolNormal::VToolNormal(VPattern *doc, VContainer *data, const quint32 &id, con
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolNormal::setDialog() void VToolNormal::setDialog()
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -63,6 +65,7 @@ void VToolNormal::setDialog()
dialogTool->setPointName(p->name()); dialogTool->setPointName(p->name());
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolNormal::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) void VToolNormal::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -78,6 +81,7 @@ void VToolNormal::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern
Document::FullParse, Valentina::FromGui); Document::FullParse, Valentina::FromGui);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolNormal::Create(const quint32 _id, const QString &formula, const quint32 &firstPointId, void VToolNormal::Create(const quint32 _id, const QString &formula, const quint32 &firstPointId,
const quint32 &secondPointId, const QString &typeLine, const QString &pointName, const quint32 &secondPointId, const QString &typeLine, const QString &pointName,
const qreal angle, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, const qreal angle, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
@ -123,6 +127,7 @@ void VToolNormal::Create(const quint32 _id, const QString &formula, const quint3
} }
} }
//---------------------------------------------------------------------------------------------------------------------
QPointF VToolNormal::FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, const qreal &length, QPointF VToolNormal::FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, const qreal &length,
const qreal &angle) const qreal &angle)
{ {
@ -133,6 +138,7 @@ QPointF VToolNormal::FindPoint(const QPointF &firstPoint, const QPointF &secondP
return normal.p2(); return normal.p2();
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolNormal::FullUpdateFromFile() void VToolNormal::FullUpdateFromFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -147,22 +153,26 @@ void VToolNormal::FullUpdateFromFile()
RefreshGeometry(); RefreshGeometry();
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolNormal::SetFactor(qreal factor) void VToolNormal::SetFactor(qreal factor)
{ {
VDrawTool::SetFactor(factor); VDrawTool::SetFactor(factor);
RefreshGeometry(); RefreshGeometry();
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolNormal::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) void VToolNormal::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogNormal>(this, event); ContextMenu<DialogNormal>(this, event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolNormal::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolNormal::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogNormal>(this, event); ContextMenu<DialogNormal>(this, event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolNormal::AddToFile() void VToolNormal::AddToFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -183,6 +193,7 @@ void VToolNormal::AddToFile()
AddToCalculation(domElement); AddToCalculation(domElement);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolNormal::RefreshDataInFile() void VToolNormal::RefreshDataInFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -200,12 +211,14 @@ void VToolNormal::RefreshDataInFile()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolNormal::RemoveReferens() void VToolNormal::RemoveReferens()
{ {
doc->DecrementReferens(secondPointId); doc->DecrementReferens(secondPointId);
VToolLinePoint::RemoveReferens(); VToolLinePoint::RemoveReferens();
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolNormal::SaveDialog(QDomElement &domElement) void VToolNormal::SaveDialog(QDomElement &domElement)
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);

View File

@ -33,6 +33,7 @@ const QString VToolPoint::TagName = QStringLiteral("point");
#define DefRadius 2.0//mm #define DefRadius 2.0//mm
//---------------------------------------------------------------------------------------------------------------------
VToolPoint::VToolPoint(VPattern *doc, VContainer *data, quint32 id, QGraphicsItem *parent):VDrawTool(doc, data, id), VToolPoint::VToolPoint(VPattern *doc, VContainer *data, quint32 id, QGraphicsItem *parent):VDrawTool(doc, data, id),
QGraphicsEllipseItem(parent), radius(DefRadius), namePoint(0), lineName(0) QGraphicsEllipseItem(parent), radius(DefRadius), namePoint(0), lineName(0)
{ {
@ -65,6 +66,7 @@ VToolPoint::VToolPoint(VPattern *doc, VContainer *data, quint32 id, QGraphicsIte
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<const VPointF *>(id)); RefreshPointGeometry(*VAbstractTool::data.GeometricObject<const VPointF *>(id));
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolPoint::NameChangePosition(const QPointF &pos) void VToolPoint::NameChangePosition(const QPointF &pos)
{ {
VPointF *point = new VPointF(*VAbstractTool::data.GeometricObject<const VPointF *>(id)); VPointF *point = new VPointF(*VAbstractTool::data.GeometricObject<const VPointF *>(id));
@ -76,6 +78,7 @@ void VToolPoint::NameChangePosition(const QPointF &pos)
VAbstractTool::data.UpdateGObject(id, point); VAbstractTool::data.UpdateGObject(id, point);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolPoint::UpdateNamePosition(qreal mx, qreal my) void VToolPoint::UpdateNamePosition(qreal mx, qreal my)
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -87,6 +90,7 @@ void VToolPoint::UpdateNamePosition(qreal mx, qreal my)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolPoint::ChangedActivDraw(const QString &newName) void VToolPoint::ChangedActivDraw(const QString &newName)
{ {
bool selectable = false; bool selectable = false;
@ -112,22 +116,26 @@ void VToolPoint::ChangedActivDraw(const QString &newName)
VDrawTool::ChangedActivDraw(newName); VDrawTool::ChangedActivDraw(newName);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolPoint::ShowTool(quint32 id, Qt::GlobalColor color, bool enable) void VToolPoint::ShowTool(quint32 id, Qt::GlobalColor color, bool enable)
{ {
ShowItem(this, id, color, enable); ShowItem(this, id, color, enable);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolPoint::SetFactor(qreal factor) void VToolPoint::SetFactor(qreal factor)
{ {
VDrawTool::SetFactor(factor); VDrawTool::SetFactor(factor);
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<const VPointF *>(id)); RefreshPointGeometry(*VAbstractTool::data.GeometricObject<const VPointF *>(id));
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolPoint::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) void VToolPoint::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolPoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VToolPoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{ {
if (event->button() == Qt::LeftButton) if (event->button() == Qt::LeftButton)
@ -137,18 +145,21 @@ void VToolPoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
QGraphicsItem::mouseReleaseEvent(event); QGraphicsItem::mouseReleaseEvent(event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolPoint::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VToolPoint::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthMainLine())/factor)); this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthMainLine())/factor));
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolPoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VToolPoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor)); this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor));
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolPoint::RefreshPointGeometry(const VPointF &point) void VToolPoint::RefreshPointGeometry(const VPointF &point)
{ {
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor)); this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor));
@ -166,6 +177,7 @@ void VToolPoint::RefreshPointGeometry(const VPointF &point)
RefreshLine(); RefreshLine();
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolPoint::RefreshLine() void VToolPoint::RefreshLine()
{ {
QRectF nameRec = namePoint->sceneBoundingRect(); QRectF nameRec = namePoint->sceneBoundingRect();
@ -191,6 +203,7 @@ void VToolPoint::RefreshLine()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
QVariant VToolPoint::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) QVariant VToolPoint::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
{ {
if (change == QGraphicsItem::ItemSelectedChange) if (change == QGraphicsItem::ItemSelectedChange)
@ -209,6 +222,7 @@ QVariant VToolPoint::itemChange(QGraphicsItem::GraphicsItemChange change, const
return QGraphicsItem::itemChange(change, value); return QGraphicsItem::itemChange(change, value);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolPoint::keyReleaseEvent(QKeyEvent *event) void VToolPoint::keyReleaseEvent(QKeyEvent *event)
{ {
switch (event->key()) switch (event->key())

View File

@ -32,6 +32,7 @@
const QString VToolPointOfContact::ToolType = QStringLiteral("pointOfContact"); const QString VToolPointOfContact::ToolType = QStringLiteral("pointOfContact");
//---------------------------------------------------------------------------------------------------------------------
VToolPointOfContact::VToolPointOfContact(VPattern *doc, VContainer *data, const quint32 &id, VToolPointOfContact::VToolPointOfContact(VPattern *doc, VContainer *data, const quint32 &id,
const QString &radius, const quint32 &center, const QString &radius, const quint32 &center,
const quint32 &firstPointId, const quint32 &secondPointId, const quint32 &firstPointId, const quint32 &secondPointId,
@ -49,6 +50,7 @@ VToolPointOfContact::VToolPointOfContact(VPattern *doc, VContainer *data, const
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfContact::setDialog() void VToolPointOfContact::setDialog()
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -62,6 +64,7 @@ void VToolPointOfContact::setDialog()
dialogTool->setPointName(p->name()); dialogTool->setPointName(p->name());
} }
//---------------------------------------------------------------------------------------------------------------------
QPointF VToolPointOfContact::FindPoint(const qreal &radius, const QPointF &center, const QPointF &firstPoint, QPointF VToolPointOfContact::FindPoint(const qreal &radius, const QPointF &center, const QPointF &firstPoint,
const QPointF &secondPoint) const QPointF &secondPoint)
{ {
@ -88,6 +91,7 @@ QPointF VToolPointOfContact::FindPoint(const qreal &radius, const QPointF &cente
return pArc; return pArc;
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfContact::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) void VToolPointOfContact::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -102,6 +106,7 @@ void VToolPointOfContact::Create(DialogTool *dialog, VMainGraphicsScene *scene,
Document::FullParse, Valentina::FromGui); Document::FullParse, Valentina::FromGui);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfContact::Create(const quint32 _id, const QString &radius, const quint32 &center, void VToolPointOfContact::Create(const quint32 _id, const QString &radius, const quint32 &center,
const quint32 &firstPointId, const quint32 &secondPointId, const quint32 &firstPointId, const quint32 &secondPointId,
const QString &pointName, const qreal &mx, const qreal &my, const QString &pointName, const qreal &mx, const qreal &my,
@ -154,6 +159,7 @@ void VToolPointOfContact::Create(const quint32 _id, const QString &radius, const
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfContact::FullUpdateFromFile() void VToolPointOfContact::FullUpdateFromFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -167,22 +173,26 @@ void VToolPointOfContact::FullUpdateFromFile()
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<const VPointF *>(id)); RefreshPointGeometry(*VAbstractTool::data.GeometricObject<const VPointF *>(id));
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfContact::SetFactor(qreal factor) void VToolPointOfContact::SetFactor(qreal factor)
{ {
VDrawTool::SetFactor(factor); VDrawTool::SetFactor(factor);
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<const VPointF *>(id)); RefreshPointGeometry(*VAbstractTool::data.GeometricObject<const VPointF *>(id));
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfContact::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) void VToolPointOfContact::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogPointOfContact>(this, event); ContextMenu<DialogPointOfContact>(this, event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfContact::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolPointOfContact::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogPointOfContact>(this, event); ContextMenu<DialogPointOfContact>(this, event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfContact::AddToFile() void VToolPointOfContact::AddToFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -202,6 +212,7 @@ void VToolPointOfContact::AddToFile()
AddToCalculation(domElement); AddToCalculation(domElement);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfContact::RefreshDataInFile() void VToolPointOfContact::RefreshDataInFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -218,6 +229,7 @@ void VToolPointOfContact::RefreshDataInFile()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfContact::RemoveReferens() void VToolPointOfContact::RemoveReferens()
{ {
doc->DecrementReferens(center); doc->DecrementReferens(center);
@ -225,6 +237,7 @@ void VToolPointOfContact::RemoveReferens()
doc->DecrementReferens(secondPointId); doc->DecrementReferens(secondPointId);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfContact::SaveDialog(QDomElement &domElement) void VToolPointOfContact::SaveDialog(QDomElement &domElement)
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);

View File

@ -31,6 +31,7 @@
const QString VToolPointOfIntersection::ToolType = QStringLiteral("pointOfIntersection"); const QString VToolPointOfIntersection::ToolType = QStringLiteral("pointOfIntersection");
//---------------------------------------------------------------------------------------------------------------------
VToolPointOfIntersection::VToolPointOfIntersection(VPattern *doc, VContainer *data, const quint32 &id, VToolPointOfIntersection::VToolPointOfIntersection(VPattern *doc, VContainer *data, const quint32 &id,
const quint32 &firstPointId, const quint32 &secondPointId, const quint32 &firstPointId, const quint32 &secondPointId,
const Valentina::Sources &typeCreation, QGraphicsItem *parent) const Valentina::Sources &typeCreation, QGraphicsItem *parent)
@ -47,6 +48,7 @@ VToolPointOfIntersection::VToolPointOfIntersection(VPattern *doc, VContainer *da
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersection::setDialog() void VToolPointOfIntersection::setDialog()
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -58,6 +60,7 @@ void VToolPointOfIntersection::setDialog()
dialogTool->setPointName(p->name()); dialogTool->setPointName(p->name());
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersection::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, void VToolPointOfIntersection::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data) VContainer *data)
{ {
@ -70,6 +73,7 @@ void VToolPointOfIntersection::Create(DialogTool *dialog, VMainGraphicsScene *sc
Create(0, pointName, firstPointId, secondPointId, 5, 10, scene, doc, data, Document::FullParse, Valentina::FromGui); Create(0, pointName, firstPointId, secondPointId, 5, 10, scene, doc, data, Document::FullParse, Valentina::FromGui);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersection::Create(const quint32 _id, const QString &pointName, const quint32 &firstPointId, void VToolPointOfIntersection::Create(const quint32 _id, const QString &pointName, const quint32 &firstPointId,
const quint32 &secondPointId, const qreal &mx, const qreal &my, const quint32 &secondPointId, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
@ -106,6 +110,7 @@ void VToolPointOfIntersection::Create(const quint32 _id, const QString &pointNam
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersection::FullUpdateFromFile() void VToolPointOfIntersection::FullUpdateFromFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -117,22 +122,26 @@ void VToolPointOfIntersection::FullUpdateFromFile()
VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<const VPointF *>(id)); VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<const VPointF *>(id));
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersection::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) void VToolPointOfIntersection::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogPointOfIntersection>(this, event); ContextMenu<DialogPointOfIntersection>(this, event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersection::RemoveReferens() void VToolPointOfIntersection::RemoveReferens()
{ {
doc->DecrementReferens(firstPointId); doc->DecrementReferens(firstPointId);
doc->DecrementReferens(secondPointId); doc->DecrementReferens(secondPointId);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersection::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolPointOfIntersection::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogPointOfIntersection>(this, event); ContextMenu<DialogPointOfIntersection>(this, event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersection::AddToFile() void VToolPointOfIntersection::AddToFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -150,6 +159,7 @@ void VToolPointOfIntersection::AddToFile()
AddToCalculation(domElement); AddToCalculation(domElement);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersection::RefreshDataInFile() void VToolPointOfIntersection::RefreshDataInFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -164,6 +174,7 @@ void VToolPointOfIntersection::RefreshDataInFile()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersection::SaveDialog(QDomElement &domElement) void VToolPointOfIntersection::SaveDialog(QDomElement &domElement)
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);

View File

@ -32,6 +32,7 @@
const QString VToolShoulderPoint::ToolType = QStringLiteral("shoulder"); const QString VToolShoulderPoint::ToolType = QStringLiteral("shoulder");
//---------------------------------------------------------------------------------------------------------------------
VToolShoulderPoint::VToolShoulderPoint(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, VToolShoulderPoint::VToolShoulderPoint(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
const QString &formula, const quint32 &p1Line, const quint32 &p2Line, const QString &formula, const quint32 &p1Line, const quint32 &p2Line,
const quint32 &pShoulder, const Valentina::Sources &typeCreation, const quint32 &pShoulder, const Valentina::Sources &typeCreation,
@ -48,6 +49,7 @@ VToolShoulderPoint::VToolShoulderPoint(VPattern *doc, VContainer *data, const qu
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolShoulderPoint::setDialog() void VToolShoulderPoint::setDialog()
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -62,6 +64,7 @@ void VToolShoulderPoint::setDialog()
dialogTool->setPointName(p->name()); dialogTool->setPointName(p->name());
} }
//---------------------------------------------------------------------------------------------------------------------
QPointF VToolShoulderPoint::FindPoint(const QPointF &p1Line, const QPointF &p2Line, const QPointF &pShoulder, QPointF VToolShoulderPoint::FindPoint(const QPointF &p1Line, const QPointF &p2Line, const QPointF &pShoulder,
const qreal &length) const qreal &length)
{ {
@ -89,6 +92,7 @@ QPointF VToolShoulderPoint::FindPoint(const QPointF &p1Line, const QPointF &p2Li
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolShoulderPoint::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) void VToolShoulderPoint::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -104,6 +108,7 @@ void VToolShoulderPoint::Create(DialogTool *dialog, VMainGraphicsScene *scene, V
Document::FullParse, Valentina::FromGui); Document::FullParse, Valentina::FromGui);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolShoulderPoint::Create(const quint32 _id, const QString &formula, const quint32 &p1Line, void VToolShoulderPoint::Create(const quint32 _id, const QString &formula, const quint32 &p1Line,
const quint32 &p2Line, const quint32 &pShoulder, const QString &typeLine, const quint32 &p2Line, const quint32 &pShoulder, const QString &typeLine,
const QString &pointName, const qreal &mx, const qreal &my, const QString &pointName, const qreal &mx, const qreal &my,
@ -155,6 +160,7 @@ void VToolShoulderPoint::Create(const quint32 _id, const QString &formula, const
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolShoulderPoint::FullUpdateFromFile() void VToolShoulderPoint::FullUpdateFromFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -169,22 +175,26 @@ void VToolShoulderPoint::FullUpdateFromFile()
RefreshGeometry(); RefreshGeometry();
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolShoulderPoint::SetFactor(qreal factor) void VToolShoulderPoint::SetFactor(qreal factor)
{ {
VDrawTool::SetFactor(factor); VDrawTool::SetFactor(factor);
RefreshGeometry(); RefreshGeometry();
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolShoulderPoint::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) void VToolShoulderPoint::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogShoulderPoint>(this, event); ContextMenu<DialogShoulderPoint>(this, event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolShoulderPoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolShoulderPoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogShoulderPoint>(this, event); ContextMenu<DialogShoulderPoint>(this, event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolShoulderPoint::AddToFile() void VToolShoulderPoint::AddToFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -205,6 +215,7 @@ void VToolShoulderPoint::AddToFile()
AddToCalculation(domElement); AddToCalculation(domElement);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolShoulderPoint::RefreshDataInFile() void VToolShoulderPoint::RefreshDataInFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -222,6 +233,7 @@ void VToolShoulderPoint::RefreshDataInFile()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolShoulderPoint::RemoveReferens() void VToolShoulderPoint::RemoveReferens()
{ {
doc->DecrementReferens(p2Line); doc->DecrementReferens(p2Line);
@ -229,6 +241,7 @@ void VToolShoulderPoint::RemoveReferens()
VToolLinePoint::RemoveReferens(); VToolLinePoint::RemoveReferens();
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolShoulderPoint::SaveDialog(QDomElement &domElement) void VToolShoulderPoint::SaveDialog(QDomElement &domElement)
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);

View File

@ -31,6 +31,7 @@
const QString VToolSinglePoint::ToolType = QStringLiteral("single"); const QString VToolSinglePoint::ToolType = QStringLiteral("single");
//---------------------------------------------------------------------------------------------------------------------
VToolSinglePoint::VToolSinglePoint (VPattern *doc, VContainer *data, quint32 id, const Valentina::Sources &typeCreation, VToolSinglePoint::VToolSinglePoint (VPattern *doc, VContainer *data, quint32 id, const Valentina::Sources &typeCreation,
QGraphicsItem * parent ) QGraphicsItem * parent )
:VToolPoint(doc, data, id, parent) :VToolPoint(doc, data, id, parent)
@ -53,6 +54,7 @@ VToolSinglePoint::VToolSinglePoint (VPattern *doc, VContainer *data, quint32 id,
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolSinglePoint::setDialog() void VToolSinglePoint::setDialog()
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -62,6 +64,7 @@ void VToolSinglePoint::setDialog()
dialogTool->setData(p->name(), p->toQPointF()); dialogTool->setData(p->name(), p->toQPointF());
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolSinglePoint::AddToFile() void VToolSinglePoint::AddToFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -78,6 +81,7 @@ void VToolSinglePoint::AddToFile()
AddToCalculation(domElement); AddToCalculation(domElement);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolSinglePoint::RefreshDataInFile() void VToolSinglePoint::RefreshDataInFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -92,6 +96,7 @@ void VToolSinglePoint::RefreshDataInFile()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
QVariant VToolSinglePoint::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) QVariant VToolSinglePoint::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
{ {
if (change == ItemPositionChange && scene()) if (change == ItemPositionChange && scene())
@ -128,6 +133,7 @@ QVariant VToolSinglePoint::itemChange(QGraphicsItem::GraphicsItemChange change,
return QGraphicsItem::itemChange(change, value); return QGraphicsItem::itemChange(change, value);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolSinglePoint::decrementReferens() void VToolSinglePoint::decrementReferens()
{ {
if (_referens > 1) if (_referens > 1)
@ -136,6 +142,7 @@ void VToolSinglePoint::decrementReferens()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolSinglePoint::SaveDialog(QDomElement &domElement) void VToolSinglePoint::SaveDialog(QDomElement &domElement)
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -148,23 +155,27 @@ void VToolSinglePoint::SaveDialog(QDomElement &domElement)
doc->SetAttribute(domElement, AttrY, QString().setNum(qApp->fromPixel(p.y()))); doc->SetAttribute(domElement, AttrY, QString().setNum(qApp->fromPixel(p.y())));
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolSinglePoint::setColorLabel(const Qt::GlobalColor &color) void VToolSinglePoint::setColorLabel(const Qt::GlobalColor &color)
{ {
namePoint->setBrush(color); namePoint->setBrush(color);
lineName->setPen(QPen(color, qApp->toPixel(qApp->widthHairLine())/factor)); lineName->setPen(QPen(color, qApp->toPixel(qApp->widthHairLine())/factor));
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolSinglePoint::contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) void VToolSinglePoint::contextMenuEvent ( QGraphicsSceneContextMenuEvent * event )
{ {
ContextMenu<DialogSinglePoint>(this, event, false); ContextMenu<DialogSinglePoint>(this, event, false);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolSinglePoint::FullUpdateFromFile() void VToolSinglePoint::FullUpdateFromFile()
{ {
VPointF point = *VAbstractTool::data.GeometricObject<const VPointF *>(id); VPointF point = *VAbstractTool::data.GeometricObject<const VPointF *>(id);
RefreshPointGeometry(point); RefreshPointGeometry(point);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolSinglePoint::ChangedActivDraw(const QString &newName) void VToolSinglePoint::ChangedActivDraw(const QString &newName)
{ {
if (nameActivDraw == newName) if (nameActivDraw == newName)
@ -181,12 +192,14 @@ void VToolSinglePoint::ChangedActivDraw(const QString &newName)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolSinglePoint::SetFactor(qreal factor) void VToolSinglePoint::SetFactor(qreal factor)
{ {
VDrawTool::SetFactor(factor); VDrawTool::SetFactor(factor);
RefreshPointGeometry(*(VAbstractTool::data.GeometricObject<const VPointF *>(id))); RefreshPointGeometry(*(VAbstractTool::data.GeometricObject<const VPointF *>(id)));
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolSinglePoint::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) void VToolSinglePoint::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogSinglePoint>(this, event, false); ContextMenu<DialogSinglePoint>(this, event, false);

View File

@ -32,6 +32,7 @@
const QString VToolSpline::ToolType = QStringLiteral("simple"); const QString VToolSpline::ToolType = QStringLiteral("simple");
//---------------------------------------------------------------------------------------------------------------------
VToolSpline::VToolSpline(VPattern *doc, VContainer *data, quint32 id, const Valentina::Sources &typeCreation, VToolSpline::VToolSpline(VPattern *doc, VContainer *data, quint32 id, const Valentina::Sources &typeCreation,
QGraphicsItem *parent) :VAbstractSpline(doc, data, id, parent) QGraphicsItem *parent) :VAbstractSpline(doc, data, id, parent)
{ {
@ -71,6 +72,7 @@ VToolSpline::VToolSpline(VPattern *doc, VContainer *data, quint32 id, const Vale
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolSpline::setDialog() void VToolSpline::setDialog()
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -86,6 +88,7 @@ void VToolSpline::setDialog()
dialogTool->setKCurve(spl->GetKcurve()); dialogTool->setKCurve(spl->GetKcurve());
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, void VToolSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data) VContainer *data)
{ {
@ -103,6 +106,7 @@ void VToolSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern
Valentina::FromGui); Valentina::FromGui);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolSpline::Create(const quint32 _id, const quint32 &p1, const quint32 &p4, const qreal &kAsm1, void VToolSpline::Create(const quint32 _id, const quint32 &p1, const quint32 &p4, const qreal &kAsm1,
const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve, const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
@ -139,6 +143,7 @@ void VToolSpline::Create(const quint32 _id, const quint32 &p1, const quint32 &p4
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolSpline::ControlPointChangePosition(const qint32 &indexSpline, const SplinePoint::Position &position, void VToolSpline::ControlPointChangePosition(const qint32 &indexSpline, const SplinePoint::Position &position,
const QPointF &pos) const QPointF &pos)
{ {
@ -166,6 +171,7 @@ void VToolSpline::ControlPointChangePosition(const qint32 &indexSpline, const Sp
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolSpline::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolSpline::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogSpline>(this, event); ContextMenu<DialogSpline>(this, event);
@ -189,6 +195,7 @@ void VToolSpline::AddToFile()
AddToCalculation(domElement); AddToCalculation(domElement);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolSpline::RefreshDataInFile() void VToolSpline::RefreshDataInFile()
{ {
const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(id); const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(id);
@ -205,6 +212,7 @@ void VToolSpline::RefreshDataInFile()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VToolSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{ {
if (event->button() == Qt::LeftButton) if (event->button() == Qt::LeftButton)
@ -214,6 +222,7 @@ void VToolSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
QGraphicsItem::mouseReleaseEvent(event); QGraphicsItem::mouseReleaseEvent(event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolSpline::RemoveReferens() void VToolSpline::RemoveReferens()
{ {
const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(id); const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(id);
@ -221,6 +230,7 @@ void VToolSpline::RemoveReferens()
doc->DecrementReferens(spl->GetP4().id()); doc->DecrementReferens(spl->GetP4().id());
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolSpline::SaveDialog(QDomElement &domElement) void VToolSpline::SaveDialog(QDomElement &domElement)
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -254,6 +264,7 @@ void VToolSpline::SaveDialog(QDomElement &domElement)
doc->SetAttribute(domElement, AttrKCurve, spl.GetKcurve()); doc->SetAttribute(domElement, AttrKCurve, spl.GetKcurve());
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolSpline::RefreshGeometry() void VToolSpline::RefreshGeometry()
{ {
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor)); this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor));

View File

@ -31,6 +31,7 @@
const QString VToolSplinePath::ToolType = QStringLiteral("path"); const QString VToolSplinePath::ToolType = QStringLiteral("path");
//---------------------------------------------------------------------------------------------------------------------
VToolSplinePath::VToolSplinePath(VPattern *doc, VContainer *data, quint32 id, const Valentina::Sources &typeCreation, VToolSplinePath::VToolSplinePath(VPattern *doc, VContainer *data, quint32 id, const Valentina::Sources &typeCreation,
QGraphicsItem *parent) :VAbstractSpline(doc, data, id, parent) QGraphicsItem *parent) :VAbstractSpline(doc, data, id, parent)
{ {
@ -72,6 +73,7 @@ VToolSplinePath::VToolSplinePath(VPattern *doc, VContainer *data, quint32 id, co
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolSplinePath::setDialog() void VToolSplinePath::setDialog()
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -81,6 +83,7 @@ void VToolSplinePath::setDialog()
dialogTool->SetPath(*splPath); dialogTool->SetPath(*splPath);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) void VToolSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -94,6 +97,7 @@ void VToolSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPat
Create(0, path, scene, doc, data, Document::FullParse, Valentina::FromGui); Create(0, path, scene, doc, data, Document::FullParse, Valentina::FromGui);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolSplinePath::Create(const quint32 _id, VSplinePath *path, VMainGraphicsScene *scene, void VToolSplinePath::Create(const quint32 _id, VSplinePath *path, VMainGraphicsScene *scene,
VPattern *doc, VContainer *data, const Document::Documents &parse, VPattern *doc, VContainer *data, const Document::Documents &parse,
const Valentina::Sources &typeCreation) const Valentina::Sources &typeCreation)
@ -124,6 +128,7 @@ void VToolSplinePath::Create(const quint32 _id, VSplinePath *path, VMainGraphics
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolSplinePath::ControlPointChangePosition(const qint32 &indexSpline, const SplinePoint::Position &position, void VToolSplinePath::ControlPointChangePosition(const qint32 &indexSpline, const SplinePoint::Position &position,
const QPointF &pos) const QPointF &pos)
{ {
@ -149,6 +154,7 @@ void VToolSplinePath::ControlPointChangePosition(const qint32 &indexSpline, cons
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolSplinePath::CorectControlPoints(const VSpline &spl, VSplinePath &splPath, const qint32 &indexSpline) void VToolSplinePath::CorectControlPoints(const VSpline &spl, VSplinePath &splPath, const qint32 &indexSpline)
{ {
VSplinePoint p = splPath.GetSplinePoint(indexSpline, SplinePoint::FirstPoint); VSplinePoint p = splPath.GetSplinePoint(indexSpline, SplinePoint::FirstPoint);
@ -162,6 +168,7 @@ void VToolSplinePath::CorectControlPoints(const VSpline &spl, VSplinePath &splPa
splPath.UpdatePoint(indexSpline, SplinePoint::LastPoint, p); splPath.UpdatePoint(indexSpline, SplinePoint::LastPoint, p);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolSplinePath::RefreshSplinePath(VSplinePath &splPath) void VToolSplinePath::RefreshSplinePath(VSplinePath &splPath)
{ {
for (qint32 i = 1; i<=splPath.Count(); ++i) for (qint32 i = 1; i<=splPath.Count(); ++i)
@ -186,6 +193,7 @@ void VToolSplinePath::RefreshSplinePath(VSplinePath &splPath)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolSplinePath::UpdatePathPoint(QDomNode& node, VSplinePath &path) void VToolSplinePath::UpdatePathPoint(QDomNode& node, VSplinePath &path)
{ {
QDomNodeList nodeList = node.childNodes(); QDomNodeList nodeList = node.childNodes();
@ -204,11 +212,13 @@ void VToolSplinePath::UpdatePathPoint(QDomNode& node, VSplinePath &path)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolSplinePath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolSplinePath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogSplinePath>(this, event); ContextMenu<DialogSplinePath>(this, event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolSplinePath::AddToFile() void VToolSplinePath::AddToFile()
{ {
VSplinePath splPath = *VAbstractTool::data.GeometricObject<const VSplinePath *>(id); VSplinePath splPath = *VAbstractTool::data.GeometricObject<const VSplinePath *>(id);
@ -226,6 +236,7 @@ void VToolSplinePath::AddToFile()
AddToCalculation(domElement); AddToCalculation(domElement);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolSplinePath::RefreshDataInFile() void VToolSplinePath::RefreshDataInFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -240,6 +251,7 @@ void VToolSplinePath::RefreshDataInFile()
UpdatePathPoint(domElement, splPath); UpdatePathPoint(domElement, splPath);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolSplinePath::AddPathPoint(QDomElement &domElement, const VSplinePoint &splPoint) void VToolSplinePath::AddPathPoint(QDomElement &domElement, const VSplinePoint &splPoint)
{ {
QDomElement pathPoint = doc->createElement(AttrPathPoint); QDomElement pathPoint = doc->createElement(AttrPathPoint);
@ -252,6 +264,7 @@ void VToolSplinePath::AddPathPoint(QDomElement &domElement, const VSplinePoint &
domElement.appendChild(pathPoint); domElement.appendChild(pathPoint);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VToolSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{ {
if (event->button() == Qt::LeftButton) if (event->button() == Qt::LeftButton)
@ -261,6 +274,7 @@ void VToolSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
QGraphicsItem::mouseReleaseEvent(event); QGraphicsItem::mouseReleaseEvent(event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolSplinePath::RemoveReferens() void VToolSplinePath::RemoveReferens()
{ {
VSplinePath splPath = *VAbstractTool::data.GeometricObject<const VSplinePath *>(id); VSplinePath splPath = *VAbstractTool::data.GeometricObject<const VSplinePath *>(id);
@ -270,6 +284,7 @@ void VToolSplinePath::RemoveReferens()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolSplinePath::SaveDialog(QDomElement &domElement) void VToolSplinePath::SaveDialog(QDomElement &domElement)
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -282,6 +297,7 @@ void VToolSplinePath::SaveDialog(QDomElement &domElement)
UpdatePathPoint(domElement, splPath); UpdatePathPoint(domElement, splPath);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolSplinePath::RefreshGeometry() void VToolSplinePath::RefreshGeometry()
{ {
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor)); this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor));

View File

@ -31,6 +31,7 @@
const QString VToolTriangle::ToolType = QStringLiteral("triangle"); const QString VToolTriangle::ToolType = QStringLiteral("triangle");
//---------------------------------------------------------------------------------------------------------------------
VToolTriangle::VToolTriangle(VPattern *doc, VContainer *data, const quint32 &id, const quint32 &axisP1Id, VToolTriangle::VToolTriangle(VPattern *doc, VContainer *data, const quint32 &id, const quint32 &axisP1Id,
const quint32 &axisP2Id, const quint32 &firstPointId, const quint32 &secondPointId, const quint32 &axisP2Id, const quint32 &firstPointId, const quint32 &secondPointId,
const Valentina::Sources &typeCreation, QGraphicsItem *parent) const Valentina::Sources &typeCreation, QGraphicsItem *parent)
@ -48,6 +49,7 @@ VToolTriangle::VToolTriangle(VPattern *doc, VContainer *data, const quint32 &id,
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolTriangle::setDialog() void VToolTriangle::setDialog()
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -61,6 +63,7 @@ void VToolTriangle::setDialog()
dialogTool->setPointName(p->name()); dialogTool->setPointName(p->name());
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolTriangle::Create(DialogTool *dialog, VMainGraphicsScene *scene, void VToolTriangle::Create(DialogTool *dialog, VMainGraphicsScene *scene,
VPattern *doc, VContainer *data) VPattern *doc, VContainer *data)
{ {
@ -76,6 +79,7 @@ void VToolTriangle::Create(DialogTool *dialog, VMainGraphicsScene *scene,
Document::FullParse, Valentina::FromGui); Document::FullParse, Valentina::FromGui);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolTriangle::Create(const quint32 _id, const QString &pointName, const quint32 &axisP1Id, void VToolTriangle::Create(const quint32 _id, const QString &pointName, const quint32 &axisP1Id,
const quint32 &axisP2Id, const quint32 &firstPointId, const quint32 &secondPointId, const quint32 &axisP2Id, const quint32 &firstPointId, const quint32 &secondPointId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
@ -117,6 +121,7 @@ void VToolTriangle::Create(const quint32 _id, const QString &pointName, const qu
} }
} }
//---------------------------------------------------------------------------------------------------------------------
QPointF VToolTriangle::FindPoint(const QPointF &axisP1, const QPointF &axisP2, const QPointF &firstPoint, QPointF VToolTriangle::FindPoint(const QPointF &axisP1, const QPointF &axisP2, const QPointF &firstPoint,
const QPointF &secondPoint) const QPointF &secondPoint)
{ {
@ -158,6 +163,7 @@ QPointF VToolTriangle::FindPoint(const QPointF &axisP1, const QPointF &axisP2, c
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolTriangle::FullUpdateFromFile() void VToolTriangle::FullUpdateFromFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -171,11 +177,13 @@ void VToolTriangle::FullUpdateFromFile()
VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<const VPointF *>(id)); VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<const VPointF *>(id));
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolTriangle::ShowContextMenu(QGraphicsSceneContextMenuEvent *event) void VToolTriangle::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogTriangle>(this, event); ContextMenu<DialogTriangle>(this, event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolTriangle::RemoveReferens() void VToolTriangle::RemoveReferens()
{ {
doc->DecrementReferens(axisP1Id); doc->DecrementReferens(axisP1Id);
@ -184,11 +192,13 @@ void VToolTriangle::RemoveReferens()
doc->DecrementReferens(secondPointId); doc->DecrementReferens(secondPointId);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolTriangle::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolTriangle::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
ContextMenu<DialogTriangle>(this, event); ContextMenu<DialogTriangle>(this, event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolTriangle::AddToFile() void VToolTriangle::AddToFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -208,6 +218,7 @@ void VToolTriangle::AddToFile()
AddToCalculation(domElement); AddToCalculation(domElement);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolTriangle::RefreshDataInFile() void VToolTriangle::RefreshDataInFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -224,6 +235,7 @@ void VToolTriangle::RefreshDataInFile()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolTriangle::SaveDialog(QDomElement &domElement) void VToolTriangle::SaveDialog(QDomElement &domElement)
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);

View File

@ -32,6 +32,7 @@
const QString VAbstractNode::AttrIdObject = QStringLiteral("idObject"); const QString VAbstractNode::AttrIdObject = QStringLiteral("idObject");
const QString VAbstractNode::AttrIdTool = QStringLiteral("idTool"); const QString VAbstractNode::AttrIdTool = QStringLiteral("idTool");
//---------------------------------------------------------------------------------------------------------------------
VAbstractNode::VAbstractNode(VPattern *doc, VContainer *data, const quint32 &id, const quint32 &idNode, VAbstractNode::VAbstractNode(VPattern *doc, VContainer *data, const quint32 &id, const quint32 &idNode,
const quint32 &idTool, QObject *parent) const quint32 &idTool, QObject *parent)
: VAbstractTool(doc, data, id, parent), idNode(idNode), idTool(idTool) : VAbstractTool(doc, data, id, parent), idNode(idNode), idTool(idTool)
@ -39,6 +40,7 @@ VAbstractNode::VAbstractNode(VPattern *doc, VContainer *data, const quint32 &id,
_referens = 0; _referens = 0;
} }
//---------------------------------------------------------------------------------------------------------------------
void VAbstractNode::DeleteNode() void VAbstractNode::DeleteNode()
{ {
if (_referens <= 1) if (_referens <= 1)
@ -73,6 +75,7 @@ void VAbstractNode::DeleteNode()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VAbstractNode::AddToModeling(const QDomElement &domElement) void VAbstractNode::AddToModeling(const QDomElement &domElement)
{ {
QDomElement modelingElement; QDomElement modelingElement;
@ -88,6 +91,7 @@ void VAbstractNode::AddToModeling(const QDomElement &domElement)
emit toolhaveChange(); emit toolhaveChange();
} }
//---------------------------------------------------------------------------------------------------------------------
void VAbstractNode::decrementReferens() void VAbstractNode::decrementReferens()
{ {
if (_referens > 0) if (_referens > 0)

View File

@ -34,6 +34,7 @@
const QString VNodeArc::TagName = QStringLiteral("arc"); const QString VNodeArc::TagName = QStringLiteral("arc");
const QString VNodeArc::ToolType = QStringLiteral("modeling"); const QString VNodeArc::ToolType = QStringLiteral("modeling");
//---------------------------------------------------------------------------------------------------------------------
VNodeArc::VNodeArc(VPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Valentina::Sources &typeCreation, VNodeArc::VNodeArc(VPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Valentina::Sources &typeCreation,
const quint32 &idTool, QObject *qoParent, QGraphicsItem *parent) const quint32 &idTool, QObject *qoParent, QGraphicsItem *parent)
:VAbstractNode(doc, data, id, idArc, idTool, qoParent), QGraphicsPathItem(parent) :VAbstractNode(doc, data, id, idArc, idTool, qoParent), QGraphicsPathItem(parent)
@ -51,6 +52,7 @@ VNodeArc::VNodeArc(VPattern *doc, VContainer *data, quint32 id, quint32 idArc, c
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodeArc::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Document::Documents &parse, void VNodeArc::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Document::Documents &parse,
const Valentina::Sources &typeCreation, const quint32 &idTool, QObject *parent) const Valentina::Sources &typeCreation, const quint32 &idTool, QObject *parent)
{ {
@ -78,17 +80,20 @@ void VNodeArc::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idArc
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodeArc::DeleteNode() void VNodeArc::DeleteNode()
{ {
VAbstractNode::DeleteNode(); VAbstractNode::DeleteNode();
this->setVisible(false); this->setVisible(false);
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodeArc::FullUpdateFromFile() void VNodeArc::FullUpdateFromFile()
{ {
RefreshGeometry(); RefreshGeometry();
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodeArc::AddToFile() void VNodeArc::AddToFile()
{ {
QDomElement domElement = doc->createElement(TagName); QDomElement domElement = doc->createElement(TagName);
@ -104,6 +109,7 @@ void VNodeArc::AddToFile()
AddToModeling(domElement); AddToModeling(domElement);
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodeArc::RefreshDataInFile() void VNodeArc::RefreshDataInFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -117,6 +123,7 @@ void VNodeArc::RefreshDataInFile()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodeArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VNodeArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{ {
if (event->button() == Qt::LeftButton) if (event->button() == Qt::LeftButton)
@ -126,18 +133,21 @@ void VNodeArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
QGraphicsItem::mouseReleaseEvent(event); QGraphicsItem::mouseReleaseEvent(event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodeArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VNodeArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthMainLine()))); this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthMainLine())));
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodeArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VNodeArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine()))); this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())));
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodeArc::RefreshGeometry() void VNodeArc::RefreshGeometry()
{ {
const VArc *arc = VAbstractTool::data.GeometricObject<const VArc *>(id); const VArc *arc = VAbstractTool::data.GeometricObject<const VArc *>(id);

View File

@ -34,6 +34,7 @@
const QString VNodePoint::TagName = QStringLiteral("point"); const QString VNodePoint::TagName = QStringLiteral("point");
const QString VNodePoint::ToolType = QStringLiteral("modeling"); const QString VNodePoint::ToolType = QStringLiteral("modeling");
//---------------------------------------------------------------------------------------------------------------------
VNodePoint::VNodePoint(VPattern *doc, VContainer *data, quint32 id, quint32 idPoint, VNodePoint::VNodePoint(VPattern *doc, VContainer *data, quint32 id, quint32 idPoint,
const Valentina::Sources &typeCreation, const quint32 &idTool, QObject *qoParent, const Valentina::Sources &typeCreation, const quint32 &idTool, QObject *qoParent,
QGraphicsItem *parent) QGraphicsItem *parent)
@ -59,6 +60,7 @@ VNodePoint::VNodePoint(VPattern *doc, VContainer *data, quint32 id, quint32 idPo
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodePoint::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idPoint, void VNodePoint::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idPoint,
const Document::Documents &parse, const Valentina::Sources &typeCreation, const quint32 &idTool, const Document::Documents &parse, const Valentina::Sources &typeCreation, const quint32 &idTool,
QObject *parent) QObject *parent)
@ -89,17 +91,20 @@ void VNodePoint::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idP
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodePoint::DeleteNode() void VNodePoint::DeleteNode()
{ {
VAbstractNode::DeleteNode(); VAbstractNode::DeleteNode();
this->setVisible(false); this->setVisible(false);
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodePoint::FullUpdateFromFile() void VNodePoint::FullUpdateFromFile()
{ {
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<const VPointF *>(id)); RefreshPointGeometry(*VAbstractTool::data.GeometricObject<const VPointF *>(id));
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodePoint::AddToFile() void VNodePoint::AddToFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -118,6 +123,7 @@ void VNodePoint::AddToFile()
AddToModeling(domElement); AddToModeling(domElement);
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodePoint::RefreshDataInFile() void VNodePoint::RefreshDataInFile()
{ {
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id); const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
@ -134,6 +140,7 @@ void VNodePoint::RefreshDataInFile()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodePoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VNodePoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{ {
if (event->button() == Qt::LeftButton) if (event->button() == Qt::LeftButton)
@ -143,19 +150,21 @@ void VNodePoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
QGraphicsItem::mouseReleaseEvent(event); QGraphicsItem::mouseReleaseEvent(event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodePoint::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VNodePoint::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthMainLine()))); this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthMainLine())));
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodePoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VNodePoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine()))); this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())));
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodePoint::NameChangePosition(const QPointF &pos) void VNodePoint::NameChangePosition(const QPointF &pos)
{ {
VPointF *point = new VPointF(*VAbstractTool::data.GeometricObject<const VPointF *>(id)); VPointF *point = new VPointF(*VAbstractTool::data.GeometricObject<const VPointF *>(id));
@ -167,6 +176,7 @@ void VNodePoint::NameChangePosition(const QPointF &pos)
VAbstractTool::data.UpdateGObject(id, point); VAbstractTool::data.UpdateGObject(id, point);
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodePoint::UpdateNamePosition(qreal mx, qreal my) void VNodePoint::UpdateNamePosition(qreal mx, qreal my)
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -178,6 +188,7 @@ void VNodePoint::UpdateNamePosition(qreal mx, qreal my)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodePoint::RefreshPointGeometry(const VPointF &point) void VNodePoint::RefreshPointGeometry(const VPointF &point)
{ {
QRectF rec = QRectF(0, 0, radius*2, radius*2); QRectF rec = QRectF(0, 0, radius*2, radius*2);
@ -194,6 +205,7 @@ void VNodePoint::RefreshPointGeometry(const VPointF &point)
RefreshLine(); RefreshLine();
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodePoint::RefreshLine() void VNodePoint::RefreshLine()
{ {
QRectF nameRec = namePoint->sceneBoundingRect(); QRectF nameRec = namePoint->sceneBoundingRect();

View File

@ -34,6 +34,7 @@
const QString VNodeSpline::TagName = QStringLiteral("spline"); const QString VNodeSpline::TagName = QStringLiteral("spline");
const QString VNodeSpline::ToolType = QStringLiteral("modelingSpline"); const QString VNodeSpline::ToolType = QStringLiteral("modelingSpline");
//---------------------------------------------------------------------------------------------------------------------
VNodeSpline::VNodeSpline(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline, VNodeSpline::VNodeSpline(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline,
const Valentina::Sources &typeCreation, const quint32 &idTool, QObject *qoParent, const Valentina::Sources &typeCreation, const quint32 &idTool, QObject *qoParent,
QGraphicsItem * parent) QGraphicsItem * parent)
@ -52,6 +53,7 @@ VNodeSpline::VNodeSpline(VPattern *doc, VContainer *data, quint32 id, quint32 id
} }
} }
//---------------------------------------------------------------------------------------------------------------------
VNodeSpline *VNodeSpline::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline, VNodeSpline *VNodeSpline::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline,
const Document::Documents &parse, const Valentina::Sources &typeCreation, const Document::Documents &parse, const Valentina::Sources &typeCreation,
const quint32 &idTool, QObject *parent) const quint32 &idTool, QObject *parent)
@ -82,17 +84,20 @@ VNodeSpline *VNodeSpline::Create(VPattern *doc, VContainer *data, quint32 id, qu
return spl; return spl;
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodeSpline::DeleteNode() void VNodeSpline::DeleteNode()
{ {
VAbstractNode::DeleteNode(); VAbstractNode::DeleteNode();
this->setVisible(false); this->setVisible(false);
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodeSpline::FullUpdateFromFile() void VNodeSpline::FullUpdateFromFile()
{ {
RefreshGeometry(); RefreshGeometry();
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodeSpline::AddToFile() void VNodeSpline::AddToFile()
{ {
QDomElement domElement = doc->createElement(TagName); QDomElement domElement = doc->createElement(TagName);
@ -108,6 +113,7 @@ void VNodeSpline::AddToFile()
AddToModeling(domElement); AddToModeling(domElement);
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodeSpline::RefreshDataInFile() void VNodeSpline::RefreshDataInFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -121,6 +127,7 @@ void VNodeSpline::RefreshDataInFile()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodeSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VNodeSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{ {
if (event->button() == Qt::LeftButton) if (event->button() == Qt::LeftButton)
@ -130,18 +137,21 @@ void VNodeSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
QGraphicsItem::mouseReleaseEvent(event); QGraphicsItem::mouseReleaseEvent(event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodeSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VNodeSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthMainLine()))); this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthMainLine())));
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodeSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VNodeSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine()))); this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())));
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodeSpline::RefreshGeometry() void VNodeSpline::RefreshGeometry()
{ {
const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(id); const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(id);

View File

@ -34,6 +34,7 @@
const QString VNodeSplinePath::TagName = QStringLiteral("spline"); const QString VNodeSplinePath::TagName = QStringLiteral("spline");
const QString VNodeSplinePath::ToolType = QStringLiteral("modelingPath"); const QString VNodeSplinePath::ToolType = QStringLiteral("modelingPath");
//---------------------------------------------------------------------------------------------------------------------
VNodeSplinePath::VNodeSplinePath(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline, VNodeSplinePath::VNodeSplinePath(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline,
const Valentina::Sources &typeCreation, const quint32 &idTool, QObject *qoParent, const Valentina::Sources &typeCreation, const quint32 &idTool, QObject *qoParent,
QGraphicsItem * parent) QGraphicsItem * parent)
@ -52,6 +53,7 @@ VNodeSplinePath::VNodeSplinePath(VPattern *doc, VContainer *data, quint32 id, qu
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodeSplinePath::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline, void VNodeSplinePath::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline,
const Document::Documents &parse, const Valentina::Sources &typeCreation, const Document::Documents &parse, const Valentina::Sources &typeCreation,
const quint32 &idTool, QObject *parent) const quint32 &idTool, QObject *parent)
@ -85,17 +87,20 @@ void VNodeSplinePath::Create(VPattern *doc, VContainer *data, quint32 id, quint3
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodeSplinePath::DeleteNode() void VNodeSplinePath::DeleteNode()
{ {
VAbstractNode::DeleteNode(); VAbstractNode::DeleteNode();
this->setVisible(false); this->setVisible(false);
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodeSplinePath::FullUpdateFromFile() void VNodeSplinePath::FullUpdateFromFile()
{ {
RefreshGeometry(); RefreshGeometry();
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodeSplinePath::AddToFile() void VNodeSplinePath::AddToFile()
{ {
QDomElement domElement = doc->createElement(TagName); QDomElement domElement = doc->createElement(TagName);
@ -111,6 +116,7 @@ void VNodeSplinePath::AddToFile()
AddToModeling(domElement); AddToModeling(domElement);
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodeSplinePath::RefreshDataInFile() void VNodeSplinePath::RefreshDataInFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -124,6 +130,7 @@ void VNodeSplinePath::RefreshDataInFile()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodeSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VNodeSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{ {
if (event->button() == Qt::LeftButton) if (event->button() == Qt::LeftButton)
@ -133,18 +140,21 @@ void VNodeSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
QGraphicsItem::mouseReleaseEvent(event); QGraphicsItem::mouseReleaseEvent(event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodeSplinePath::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VNodeSplinePath::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthMainLine()))); this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthMainLine())));
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodeSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VNodeSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine()))); this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())));
} }
//---------------------------------------------------------------------------------------------------------------------
void VNodeSplinePath::RefreshGeometry() void VNodeSplinePath::RefreshGeometry()
{ {
const VSplinePath *splPath = VAbstractTool::data.GeometricObject<const VSplinePath *>(id); const VSplinePath *splPath = VAbstractTool::data.GeometricObject<const VSplinePath *>(id);

View File

@ -70,6 +70,7 @@ const QString VAbstractTool::TypeLineDotLine = QStringLiteral("dotLine");
const QString VAbstractTool::TypeLineDashDotLine = QStringLiteral("dashDotLine"); const QString VAbstractTool::TypeLineDashDotLine = QStringLiteral("dashDotLine");
const QString VAbstractTool::TypeLineDashDotDotLine = QStringLiteral("dashDotDotLine"); const QString VAbstractTool::TypeLineDashDotDotLine = QStringLiteral("dashDotDotLine");
//---------------------------------------------------------------------------------------------------------------------
VAbstractTool::VAbstractTool(VPattern *doc, VContainer *data, quint32 id, QObject *parent) VAbstractTool::VAbstractTool(VPattern *doc, VContainer *data, quint32 id, QObject *parent)
:VDataTool(data, parent), doc(doc), id(id), baseColor(Qt::black), currentColor(Qt::black), typeLine(TypeLineLine) :VDataTool(data, parent), doc(doc), id(id), baseColor(Qt::black), currentColor(Qt::black), typeLine(TypeLineLine)
{ {
@ -80,6 +81,7 @@ VAbstractTool::VAbstractTool(VPattern *doc, VContainer *data, quint32 id, QObjec
emit toolhaveChange(); emit toolhaveChange();
} }
//---------------------------------------------------------------------------------------------------------------------
void VAbstractTool::NewSceneRect(QGraphicsScene *sc, QGraphicsView *view) void VAbstractTool::NewSceneRect(QGraphicsScene *sc, QGraphicsView *view)
{ {
QRectF rect = sc->itemsBoundingRect(); QRectF rect = sc->itemsBoundingRect();
@ -108,6 +110,7 @@ void VAbstractTool::NewSceneRect(QGraphicsScene *sc, QGraphicsView *view)
sc->setSceneRect(rec1); sc->setSceneRect(rec1);
} }
//---------------------------------------------------------------------------------------------------------------------
QPointF VAbstractTool::LineIntersectRect(QRectF rec, QLineF line) QPointF VAbstractTool::LineIntersectRect(QRectF rec, QLineF line)
{ {
qreal x1, y1, x2, y2; qreal x1, y1, x2, y2;
@ -137,6 +140,7 @@ QPointF VAbstractTool::LineIntersectRect(QRectF rec, QLineF line)
return point; return point;
} }
//---------------------------------------------------------------------------------------------------------------------
qint32 VAbstractTool::LineIntersectCircle(const QPointF &center, qreal radius, const QLineF &line, QPointF &p1, qint32 VAbstractTool::LineIntersectCircle(const QPointF &center, qreal radius, const QLineF &line, QPointF &p1,
QPointF &p2) QPointF &p2)
{ {
@ -172,6 +176,7 @@ qint32 VAbstractTool::LineIntersectCircle(const QPointF &center, qreal radius, c
return flag; return flag;
} }
//---------------------------------------------------------------------------------------------------------------------
QPointF VAbstractTool::ClosestPoint(const QLineF &line, const QPointF &point) QPointF VAbstractTool::ClosestPoint(const QLineF &line, const QPointF &point)
{ {
qreal a = 0, b = 0, c = 0; qreal a = 0, b = 0, c = 0;
@ -191,11 +196,13 @@ QPointF VAbstractTool::ClosestPoint(const QLineF &line, const QPointF &point)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
QPointF VAbstractTool::addVector(const QPointF &p, const QPointF &p1, const QPointF &p2, qreal k) QPointF VAbstractTool::addVector(const QPointF &p, const QPointF &p1, const QPointF &p2, qreal k)
{ {
return QPointF (p.x() + (p2.x() - p1.x()) * k, p.y() + (p2.y() - p1.y()) * k); return QPointF (p.x() + (p2.x() - p1.x()) * k, p.y() + (p2.y() - p1.y()) * k);
} }
//---------------------------------------------------------------------------------------------------------------------
void VAbstractTool::RemoveAllChild(QDomElement &domElement) void VAbstractTool::RemoveAllChild(QDomElement &domElement)
{ {
if ( domElement.hasChildNodes() ) if ( domElement.hasChildNodes() )
@ -207,6 +214,7 @@ void VAbstractTool::RemoveAllChild(QDomElement &domElement)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VAbstractTool::DeleteTool(QGraphicsItem *tool) void VAbstractTool::DeleteTool(QGraphicsItem *tool)
{ {
if (_referens <= 1) if (_referens <= 1)
@ -257,6 +265,7 @@ void VAbstractTool::DeleteTool(QGraphicsItem *tool)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
Qt::PenStyle VAbstractTool::LineStyle() Qt::PenStyle VAbstractTool::LineStyle()
{ {
QStringList styles = Styles(); QStringList styles = Styles();
@ -286,6 +295,7 @@ Qt::PenStyle VAbstractTool::LineStyle()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VAbstractTool::LineCoefficients(const QLineF &line, qreal *a, qreal *b, qreal *c) void VAbstractTool::LineCoefficients(const QLineF &line, qreal *a, qreal *b, qreal *c)
{ {
//coefficient for equation of segment //coefficient for equation of segment
@ -295,6 +305,7 @@ void VAbstractTool::LineCoefficients(const QLineF &line, qreal *a, qreal *b, qre
*c = - *a * p1.x() - *b * p1.y(); *c = - *a * p1.x() - *b * p1.y();
} }
//---------------------------------------------------------------------------------------------------------------------
const QStringList VAbstractTool::Styles() const QStringList VAbstractTool::Styles()
{ {
//Keep synchronize with DialogTool lineStyles list!!! //Keep synchronize with DialogTool lineStyles list!!!
@ -304,6 +315,7 @@ const QStringList VAbstractTool::Styles()
return styles; return styles;
} }
//---------------------------------------------------------------------------------------------------------------------
void VAbstractTool::AddRecord(const quint32 id, const Valentina::Tools &toolType, VPattern *doc) void VAbstractTool::AddRecord(const quint32 id, const Valentina::Tools &toolType, VPattern *doc)
{ {
quint32 cursor = doc->getCursor(); quint32 cursor = doc->getCursor();

View File

@ -28,11 +28,13 @@
#include "vdatatool.h" #include "vdatatool.h"
//---------------------------------------------------------------------------------------------------------------------
VDataTool::VDataTool(VContainer *data, QObject *parent): QObject(parent), data(*data), _referens(1) VDataTool::VDataTool(VContainer *data, QObject *parent): QObject(parent), data(*data), _referens(1)
{ {
Q_CHECK_PTR(data); Q_CHECK_PTR(data);
} }
//---------------------------------------------------------------------------------------------------------------------
VDataTool &VDataTool::operator =(const VDataTool &tool) VDataTool &VDataTool::operator =(const VDataTool &tool)
{ {
data = tool.getData(); data = tool.getData();
@ -40,6 +42,7 @@ VDataTool &VDataTool::operator =(const VDataTool &tool)
return *this; return *this;
} }
//---------------------------------------------------------------------------------------------------------------------
void VDataTool::decrementReferens() void VDataTool::decrementReferens()
{ {
if (_referens > 0) if (_referens > 0)

View File

@ -50,6 +50,7 @@ const QString VToolDetail::NodePoint = QStringLiteral("NodePoint");
const QString VToolDetail::NodeSpline = QStringLiteral("NodeSpline"); const QString VToolDetail::NodeSpline = QStringLiteral("NodeSpline");
const QString VToolDetail::NodeSplinePath = QStringLiteral("NodeSplinePath"); const QString VToolDetail::NodeSplinePath = QStringLiteral("NodeSplinePath");
//---------------------------------------------------------------------------------------------------------------------
VToolDetail::VToolDetail(VPattern *doc, VContainer *data, const quint32 &id, const Valentina::Sources &typeCreation, VToolDetail::VToolDetail(VPattern *doc, VContainer *data, const quint32 &id, const Valentina::Sources &typeCreation,
VMainGraphicsScene *scene, QGraphicsItem *parent) VMainGraphicsScene *scene, QGraphicsItem *parent)
:VAbstractTool(doc, data, id), QGraphicsPathItem(parent), dialog(nullptr), sceneDetails(scene) :VAbstractTool(doc, data, id), QGraphicsPathItem(parent), dialog(nullptr), sceneDetails(scene)
@ -89,11 +90,13 @@ VToolDetail::VToolDetail(VPattern *doc, VContainer *data, const quint32 &id, con
} }
} }
//---------------------------------------------------------------------------------------------------------------------
VToolDetail::~VToolDetail() VToolDetail::~VToolDetail()
{ {
delete dialog; delete dialog;
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolDetail::setDialog() void VToolDetail::setDialog()
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -103,6 +106,7 @@ void VToolDetail::setDialog()
dialogTool->setDetails(detail); dialogTool->setDetails(detail);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolDetail::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) void VToolDetail::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -150,6 +154,7 @@ void VToolDetail::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern
Create(0, det, scene, doc, data, Document::FullParse, Valentina::FromGui); Create(0, det, scene, doc, data, Document::FullParse, Valentina::FromGui);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolDetail::Create(const quint32 &_id, const VDetail &newDetail, VMainGraphicsScene *scene, VPattern *doc, void VToolDetail::Create(const quint32 &_id, const VDetail &newDetail, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document::Documents &parse, const Valentina::Sources &typeCreation) VContainer *data, const Document::Documents &parse, const Valentina::Sources &typeCreation)
{ {
@ -177,16 +182,19 @@ void VToolDetail::Create(const quint32 &_id, const VDetail &newDetail, VMainGrap
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolDetail::Remove() void VToolDetail::Remove()
{ {
DeleteTool(this); DeleteTool(this);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolDetail::FullUpdateFromFile() void VToolDetail::FullUpdateFromFile()
{ {
RefreshGeometry(); RefreshGeometry();
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolDetail::FullUpdateFromGui(int result) void VToolDetail::FullUpdateFromGui(int result)
{ {
if (result == QDialog::Accepted) if (result == QDialog::Accepted)
@ -226,6 +234,7 @@ void VToolDetail::FullUpdateFromGui(int result)
dialog = 0; dialog = 0;
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolDetail::AddToFile() void VToolDetail::AddToFile()
{ {
VDetail detail = VAbstractTool::data.GetDetail(id); VDetail detail = VAbstractTool::data.GetDetail(id);
@ -252,6 +261,7 @@ void VToolDetail::AddToFile()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolDetail::RefreshDataInFile() void VToolDetail::RefreshDataInFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -270,6 +280,7 @@ void VToolDetail::RefreshDataInFile()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
QVariant VToolDetail::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) QVariant VToolDetail::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
{ {
if (change == ItemPositionHasChanged && scene()) if (change == ItemPositionHasChanged && scene())
@ -306,6 +317,7 @@ QVariant VToolDetail::itemChange(QGraphicsItem::GraphicsItemChange change, const
return QGraphicsItem::itemChange(change, value); return QGraphicsItem::itemChange(change, value);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolDetail::keyReleaseEvent(QKeyEvent *event) void VToolDetail::keyReleaseEvent(QKeyEvent *event)
{ {
switch (event->key()) switch (event->key())
@ -319,6 +331,7 @@ void VToolDetail::keyReleaseEvent(QKeyEvent *event)
QGraphicsItem::keyReleaseEvent ( event ); QGraphicsItem::keyReleaseEvent ( event );
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolDetail::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VToolDetail::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{ {
if (event->button() == Qt::LeftButton) if (event->button() == Qt::LeftButton)
@ -328,6 +341,7 @@ void VToolDetail::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
QGraphicsItem::mouseReleaseEvent(event); QGraphicsItem::mouseReleaseEvent(event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolDetail::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolDetail::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
QMenu menu; QMenu menu;
@ -359,6 +373,7 @@ void VToolDetail::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolDetail::RemoveReferens() void VToolDetail::RemoveReferens()
{ {
VDetail detail = VAbstractTool::data.GetDetail(id); VDetail detail = VAbstractTool::data.GetDetail(id);
@ -368,6 +383,7 @@ void VToolDetail::RemoveReferens()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolDetail::AddNode(QDomElement &domElement, const VNodeDetail &node) void VToolDetail::AddNode(QDomElement &domElement, const VNodeDetail &node)
{ {
QDomElement nod = doc->createElement(TagNode); QDomElement nod = doc->createElement(TagNode);
@ -404,12 +420,14 @@ void VToolDetail::AddNode(QDomElement &domElement, const VNodeDetail &node)
domElement.appendChild(nod); domElement.appendChild(nod);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolDetail::RefreshGeometry() void VToolDetail::RefreshGeometry()
{ {
QPainterPath path = VEquidistant().ContourPath(id, this->getData()); QPainterPath path = VEquidistant().ContourPath(id, this->getData());
this->setPath(path); this->setPath(path);
} }
//---------------------------------------------------------------------------------------------------------------------
template <typename Tool> template <typename Tool>
//cppcheck-suppress unusedFunction //cppcheck-suppress unusedFunction
void VToolDetail::InitTool(VMainGraphicsScene *scene, const VNodeDetail &node) void VToolDetail::InitTool(VMainGraphicsScene *scene, const VNodeDetail &node)

View File

@ -41,6 +41,7 @@ const QString VToolUnionDetails::AttrNodeType = QStringLiteral("nodeType");
const QString VToolUnionDetails::NodeTypeContour = QStringLiteral("Contour"); const QString VToolUnionDetails::NodeTypeContour = QStringLiteral("Contour");
const QString VToolUnionDetails::NodeTypeModeling = QStringLiteral("Modeling"); const QString VToolUnionDetails::NodeTypeModeling = QStringLiteral("Modeling");
//---------------------------------------------------------------------------------------------------------------------
VToolUnionDetails::VToolUnionDetails(VPattern *doc, VContainer *data, const quint32 &id, const VDetail &d1, VToolUnionDetails::VToolUnionDetails(VPattern *doc, VContainer *data, const quint32 &id, const VDetail &d1,
const VDetail &d2, const quint32 &indexD1, const quint32 &indexD2, const VDetail &d2, const quint32 &indexD1, const quint32 &indexD2,
const Valentina::Sources &typeCreation, QObject *parent) const Valentina::Sources &typeCreation, QObject *parent)
@ -56,6 +57,7 @@ VToolUnionDetails::VToolUnionDetails(VPattern *doc, VContainer *data, const quin
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer *data, VDetail &newDetail, void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer *data, VDetail &newDetail,
const VDetail &det, const ptrdiff_t &i, const quint32 &idTool, const qreal &dx, const VDetail &det, const ptrdiff_t &i, const quint32 &idTool, const qreal &dx,
const qreal &dy, const quint32 &pRotate, const qreal &angle) const qreal &dy, const quint32 &pRotate, const qreal &angle)
@ -222,6 +224,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer
newDetail.append(VNodeDetail(id, det.at(i).getTypeTool(), NodeDetail::Contour)); newDetail.append(VNodeDetail(id, det.at(i).getTypeTool(), NodeDetail::Contour));
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, const VDetail &det, const ptrdiff_t &i, void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, const VDetail &det, const ptrdiff_t &i,
quint32 &idCount, const qreal &dx, const qreal &dy, const quint32 &pRotate, quint32 &idCount, const qreal &dx, const qreal &dy, const quint32 &pRotate,
const qreal &angle) const qreal &angle)
@ -369,6 +372,7 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data,
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolUnionDetails::BiasRotatePoint(VPointF *point, const qreal &dx, const qreal &dy, const QPointF &pRotate, void VToolUnionDetails::BiasRotatePoint(VPointF *point, const qreal &dx, const qreal &dy, const QPointF &pRotate,
const qreal angle) const qreal angle)
{ {
@ -380,6 +384,7 @@ void VToolUnionDetails::BiasRotatePoint(VPointF *point, const qreal &dx, const q
point->setY(line.p2().y()); point->setY(line.p2().y());
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolUnionDetails::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) void VToolUnionDetails::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{ {
Q_CHECK_PTR(dialog); Q_CHECK_PTR(dialog);
@ -393,6 +398,7 @@ void VToolUnionDetails::Create(DialogTool *dialog, VMainGraphicsScene *scene, VP
Valentina::FromGui); Valentina::FromGui);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolUnionDetails::Create(const quint32 _id, const VDetail &d1, const VDetail &d2, const quint32 &d1id, void VToolUnionDetails::Create(const quint32 _id, const VDetail &d1, const VDetail &d2, const quint32 &d1id,
const quint32 &d2id, const quint32 &indexD1, const quint32 &indexD2, const quint32 &d2id, const quint32 &indexD1, const quint32 &indexD2,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
@ -528,6 +534,7 @@ void VToolUnionDetails::Create(const quint32 _id, const VDetail &d1, const VDeta
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolUnionDetails::PointsOnEdge(const VDetail &d, const qint32 &index, VPointF &p1, VPointF &p2, VContainer *data) void VToolUnionDetails::PointsOnEdge(const VDetail &d, const qint32 &index, VPointF &p1, VPointF &p2, VContainer *data)
{ {
VNodeDetail det2p1; VNodeDetail det2p1;
@ -537,6 +544,7 @@ void VToolUnionDetails::PointsOnEdge(const VDetail &d, const qint32 &index, VPoi
p2 = VPointF(*data->GeometricObject<const VPointF *>(det2p2.getId())); p2 = VPointF(*data->GeometricObject<const VPointF *>(det2p2.getId()));
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolUnionDetails::FindJ(const qint32 &pointsD2, const VDetail &d2, const qint32 &indexD2, qint32 &j) void VToolUnionDetails::FindJ(const qint32 &pointsD2, const VDetail &d2, const qint32 &indexD2, qint32 &j)
{ {
if (pointsD2 == 0) if (pointsD2 == 0)
@ -556,6 +564,7 @@ void VToolUnionDetails::FindJ(const qint32 &pointsD2, const VDetail &d2, const q
} }
} }
//---------------------------------------------------------------------------------------------------------------------
QVector<VDetail> VToolUnionDetails::GetDetailFromFile(VPattern *doc, const QDomElement &domElement) QVector<VDetail> VToolUnionDetails::GetDetailFromFile(VPattern *doc, const QDomElement &domElement)
{ {
QVector<VDetail> vector; QVector<VDetail> vector;
@ -611,6 +620,7 @@ QVector<VDetail> VToolUnionDetails::GetDetailFromFile(VPattern *doc, const QDomE
return vector; return vector;
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolUnionDetails::AddToFile() void VToolUnionDetails::AddToFile()
{ {
QDomElement domElement = doc->createElement(TagName); QDomElement domElement = doc->createElement(TagName);
@ -626,6 +636,7 @@ void VToolUnionDetails::AddToFile()
AddToModeling(domElement); AddToModeling(domElement);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolUnionDetails::RefreshDataInFile() void VToolUnionDetails::RefreshDataInFile()
{ {
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
@ -640,6 +651,7 @@ void VToolUnionDetails::RefreshDataInFile()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolUnionDetails::AddDetail(QDomElement &domElement, VDetail &d) void VToolUnionDetails::AddDetail(QDomElement &domElement, VDetail &d)
{ {
QDomElement det = doc->createElement(TagDetail); QDomElement det = doc->createElement(TagDetail);
@ -652,6 +664,7 @@ void VToolUnionDetails::AddDetail(QDomElement &domElement, VDetail &d)
domElement.appendChild(det); domElement.appendChild(det);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolUnionDetails::AddNode(QDomElement &domElement, const VNodeDetail &node) void VToolUnionDetails::AddNode(QDomElement &domElement, const VNodeDetail &node)
{ {
QDomElement nod = doc->createElement(TagNode); QDomElement nod = doc->createElement(TagNode);
@ -688,6 +701,7 @@ void VToolUnionDetails::AddNode(QDomElement &domElement, const VNodeDetail &node
domElement.appendChild(nod); domElement.appendChild(nod);
} }
//---------------------------------------------------------------------------------------------------------------------
QDomNode VToolUnionDetails::UpdateDetail(const QDomNode &domNode, const VDetail &d) QDomNode VToolUnionDetails::UpdateDetail(const QDomNode &domNode, const VDetail &d)
{ {
//QDomNode domNode = domElement.firstChild(); //QDomNode domNode = domElement.firstChild();
@ -713,6 +727,7 @@ QDomNode VToolUnionDetails::UpdateDetail(const QDomNode &domNode, const VDetail
return domNode.nextSibling(); return domNode.nextSibling();
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolUnionDetails::AddToModeling(const QDomElement &domElement) void VToolUnionDetails::AddToModeling(const QDomElement &domElement)
{ {
QDomElement modelingElement; QDomElement modelingElement;

View File

@ -30,6 +30,7 @@
#include <QDoubleSpinBox> #include <QDoubleSpinBox>
//---------------------------------------------------------------------------------------------------------------------
//cppcheck-suppress unusedFunction //cppcheck-suppress unusedFunction
QWidget *DoubleSpinBoxDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, QWidget *DoubleSpinBoxDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option,
const QModelIndex &index ) const const QModelIndex &index ) const
@ -43,6 +44,7 @@ QWidget *DoubleSpinBoxDelegate::createEditor(QWidget *parent, const QStyleOption
return editor; return editor;
} }
//---------------------------------------------------------------------------------------------------------------------
//cppcheck-suppress unusedFunction //cppcheck-suppress unusedFunction
void DoubleSpinBoxDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const void DoubleSpinBoxDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{ {
@ -53,6 +55,7 @@ void DoubleSpinBoxDelegate::setEditorData(QWidget *editor, const QModelIndex &in
spinBox->setValue(value); spinBox->setValue(value);
} }
//---------------------------------------------------------------------------------------------------------------------
//cppcheck-suppress unusedFunction //cppcheck-suppress unusedFunction
void DoubleSpinBoxDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const void DoubleSpinBoxDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
{ {
@ -64,6 +67,7 @@ void DoubleSpinBoxDelegate::setModelData(QWidget *editor, QAbstractItemModel *mo
model->setData(index, value, Qt::EditRole); model->setData(index, value, Qt::EditRole);
} }
//---------------------------------------------------------------------------------------------------------------------
//cppcheck-suppress unusedFunction //cppcheck-suppress unusedFunction
void DoubleSpinBoxDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, void DoubleSpinBoxDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option,
const QModelIndex &index) const const QModelIndex &index) const
@ -72,6 +76,7 @@ void DoubleSpinBoxDelegate::updateEditorGeometry(QWidget *editor, const QStyleOp
editor->setGeometry(option.rect); editor->setGeometry(option.rect);
} }
//---------------------------------------------------------------------------------------------------------------------
void DoubleSpinBoxDelegate::commitAndCloseEditor() void DoubleSpinBoxDelegate::commitAndCloseEditor()
{ {
QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox*>(sender()); QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox*>(sender());

View File

@ -30,6 +30,7 @@
#include <QLineEdit> #include <QLineEdit>
//---------------------------------------------------------------------------------------------------------------------
TextDelegate::TextDelegate(const QString &regex, QObject *parent): QItemDelegate(parent), lastText(QString("Name_")), TextDelegate::TextDelegate(const QString &regex, QObject *parent): QItemDelegate(parent), lastText(QString("Name_")),
regex(regex) regex(regex)
{ {
@ -37,6 +38,7 @@ TextDelegate::TextDelegate(const QString &regex, QObject *parent): QItemDelegate
connect(this, &TextDelegate::SaveText, this, &TextDelegate::InitText); connect(this, &TextDelegate::SaveText, this, &TextDelegate::InitText);
} }
//---------------------------------------------------------------------------------------------------------------------
QWidget *TextDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const QWidget *TextDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
{ {
Q_UNUSED(option); Q_UNUSED(option);
@ -48,6 +50,7 @@ QWidget *TextDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem
return editor; return editor;
} }
//---------------------------------------------------------------------------------------------------------------------
void TextDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const void TextDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{ {
QString text = index.model()->data(index, Qt::EditRole).toString(); QString text = index.model()->data(index, Qt::EditRole).toString();
@ -62,6 +65,7 @@ void TextDelegate::setEditorData(QWidget *editor, const QModelIndex &index) cons
lineEdit->setText(text); lineEdit->setText(text);
} }
//---------------------------------------------------------------------------------------------------------------------
void TextDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const void TextDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
{ {
QLineEdit *lineEdit = qobject_cast<QLineEdit*>(editor); QLineEdit *lineEdit = qobject_cast<QLineEdit*>(editor);
@ -75,6 +79,7 @@ void TextDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, cons
model->setData(index, text, Qt::EditRole); model->setData(index, text, Qt::EditRole);
} }
//---------------------------------------------------------------------------------------------------------------------
void TextDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, void TextDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option,
const QModelIndex &index) const const QModelIndex &index) const
{ {
@ -82,6 +87,7 @@ void TextDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewI
editor->setGeometry(option.rect); editor->setGeometry(option.rect);
} }
//---------------------------------------------------------------------------------------------------------------------
void TextDelegate::commitAndCloseEditor() void TextDelegate::commitAndCloseEditor()
{ {
QLineEdit *lineEdit = qobject_cast<QLineEdit*>(sender()); QLineEdit *lineEdit = qobject_cast<QLineEdit*>(sender());
@ -100,6 +106,7 @@ void TextDelegate::commitAndCloseEditor()
emit closeEditor(lineEdit); emit closeEditor(lineEdit);
} }
//---------------------------------------------------------------------------------------------------------------------
void TextDelegate::InitText(const QString &text) void TextDelegate::InitText(const QString &text)
{ {
lastText = text; lastText = text;

View File

@ -40,6 +40,7 @@ const qreal VApplication::PrintDPI = 96.0;
#define DefWidth 1.2//mm #define DefWidth 1.2//mm
//---------------------------------------------------------------------------------------------------------------------
VApplication::VApplication(int &argc, char **argv) VApplication::VApplication(int &argc, char **argv)
: QApplication(argc, argv), _patternUnit(Valentina::Cm), _patternType(Pattern::Individual), : QApplication(argc, argv), _patternUnit(Valentina::Cm), _patternType(Pattern::Individual),
_widthMainLine(DefWidth), _widthHairLine(DefWidth/3.0) _widthMainLine(DefWidth), _widthHairLine(DefWidth/3.0)
@ -47,6 +48,7 @@ VApplication::VApplication(int &argc, char **argv)
InitLineWidth(); InitLineWidth();
} }
//---------------------------------------------------------------------------------------------------------------------
// reimplemented from QApplication so we can throw exceptions in slots // reimplemented from QApplication so we can throw exceptions in slots
bool VApplication::notify(QObject *receiver, QEvent *event) bool VApplication::notify(QObject *receiver, QEvent *event)
{ {
@ -91,6 +93,7 @@ bool VApplication::notify(QObject *receiver, QEvent *event)
return false; return false;
} }
//---------------------------------------------------------------------------------------------------------------------
double VApplication::toPixel(double unit) const double VApplication::toPixel(double unit) const
{ {
double result = 0; double result = 0;
@ -111,6 +114,7 @@ double VApplication::toPixel(double unit) const
return result; return result;
} }
//---------------------------------------------------------------------------------------------------------------------
double VApplication::fromPixel(double pix) const double VApplication::fromPixel(double pix) const
{ {
double result = 0; double result = 0;
@ -130,6 +134,8 @@ double VApplication::fromPixel(double pix) const
} }
return result; return result;
} }
//---------------------------------------------------------------------------------------------------------------------
QString VApplication::pathToTables() const QString VApplication::pathToTables() const
{ {
if (_patternType == Pattern::Individual) if (_patternType == Pattern::Individual)
@ -158,6 +164,7 @@ QString VApplication::pathToTables() const
} }
} }
//---------------------------------------------------------------------------------------------------------------------
QString VApplication::translationsPath() const QString VApplication::translationsPath() const
{ {
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
@ -171,7 +178,7 @@ QString VApplication::translationsPath() const
#endif #endif
} }
//---------------------------------------------------------------------------------------------------------------------
void VApplication::InitLineWidth() void VApplication::InitLineWidth()
{ {
switch (_patternUnit) switch (_patternUnit)
@ -192,7 +199,7 @@ void VApplication::InitLineWidth()
_widthHairLine = _widthMainLine/3.0; _widthHairLine = _widthMainLine/3.0;
} }
//---------------------------------------------------------------------------------------------------------------------
void VApplication::setPatternUnit(const Valentina::Units &patternUnit) void VApplication::setPatternUnit(const Valentina::Units &patternUnit)
{ {
_patternUnit = patternUnit; _patternUnit = patternUnit;

View File

@ -32,6 +32,7 @@
#include <QPen> #include <QPen>
#include "../widgets/vapplication.h" #include "../widgets/vapplication.h"
//---------------------------------------------------------------------------------------------------------------------
VControlPointSpline::VControlPointSpline(const qint32 &indexSpline, SplinePoint::Position position, VControlPointSpline::VControlPointSpline(const qint32 &indexSpline, SplinePoint::Position position,
const QPointF &controlPoint, const QPointF &splinePoint, const QPointF &controlPoint, const QPointF &splinePoint,
QGraphicsItem *parent) QGraphicsItem *parent)
@ -57,18 +58,21 @@ VControlPointSpline::VControlPointSpline(const qint32 &indexSpline, SplinePoint:
controlLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true); controlLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
} }
//---------------------------------------------------------------------------------------------------------------------
void VControlPointSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VControlPointSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthMainLine()))); this->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthMainLine())));
} }
//---------------------------------------------------------------------------------------------------------------------
void VControlPointSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VControlPointSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthHairLine()))); this->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthHairLine())));
} }
//---------------------------------------------------------------------------------------------------------------------
QVariant VControlPointSpline::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) QVariant VControlPointSpline::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
{ {
if (change == ItemPositionChange && scene()) if (change == ItemPositionChange && scene())
@ -80,6 +84,7 @@ QVariant VControlPointSpline::itemChange(QGraphicsItem::GraphicsItemChange chang
return QGraphicsItem::itemChange(change, value); return QGraphicsItem::itemChange(change, value);
} }
//---------------------------------------------------------------------------------------------------------------------
void VControlPointSpline::RefreshLine(const qint32 &indexSpline, SplinePoint::Position pos, void VControlPointSpline::RefreshLine(const qint32 &indexSpline, SplinePoint::Position pos,
const QPointF &controlPoint, const QPointF &splinePoint) const QPointF &controlPoint, const QPointF &splinePoint)
{ {
@ -91,6 +96,7 @@ void VControlPointSpline::RefreshLine(const qint32 &indexSpline, SplinePoint::Po
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VControlPointSpline::setEnabledPoint(bool enable) void VControlPointSpline::setEnabledPoint(bool enable)
{ {
if (enable == true) if (enable == true)

View File

@ -30,6 +30,7 @@
#include <QtWidgets> #include <QtWidgets>
//---------------------------------------------------------------------------------------------------------------------
VGraphicsSimpleTextItem::VGraphicsSimpleTextItem(QGraphicsItem * parent) VGraphicsSimpleTextItem::VGraphicsSimpleTextItem(QGraphicsItem * parent)
:QGraphicsSimpleTextItem(parent), fontSize(0) :QGraphicsSimpleTextItem(parent), fontSize(0)
{ {
@ -43,6 +44,7 @@ VGraphicsSimpleTextItem::VGraphicsSimpleTextItem(QGraphicsItem * parent)
this->setFont(font); this->setFont(font);
} }
//---------------------------------------------------------------------------------------------------------------------
VGraphicsSimpleTextItem::VGraphicsSimpleTextItem( const QString & text, QGraphicsItem * parent ) VGraphicsSimpleTextItem::VGraphicsSimpleTextItem( const QString & text, QGraphicsItem * parent )
:QGraphicsSimpleTextItem(text, parent), fontSize(0) :QGraphicsSimpleTextItem(text, parent), fontSize(0)
{ {
@ -52,6 +54,7 @@ VGraphicsSimpleTextItem::VGraphicsSimpleTextItem( const QString & text, QGraphic
this->setAcceptHoverEvents(true); this->setAcceptHoverEvents(true);
} }
//---------------------------------------------------------------------------------------------------------------------
QVariant VGraphicsSimpleTextItem::itemChange(GraphicsItemChange change, const QVariant &value) QVariant VGraphicsSimpleTextItem::itemChange(GraphicsItemChange change, const QVariant &value)
{ {
if (change == ItemPositionChange && scene()) if (change == ItemPositionChange && scene())
@ -62,18 +65,21 @@ QVariant VGraphicsSimpleTextItem::itemChange(GraphicsItemChange change, const QV
return QGraphicsItem::itemChange(change, value); return QGraphicsItem::itemChange(change, value);
} }
//---------------------------------------------------------------------------------------------------------------------
void VGraphicsSimpleTextItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VGraphicsSimpleTextItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->setBrush(Qt::green); this->setBrush(Qt::green);
} }
//---------------------------------------------------------------------------------------------------------------------
void VGraphicsSimpleTextItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VGraphicsSimpleTextItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->setBrush(Qt::black); this->setBrush(Qt::black);
} }
//---------------------------------------------------------------------------------------------------------------------
void VGraphicsSimpleTextItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VGraphicsSimpleTextItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
emit ShowContextMenu(event); emit ShowContextMenu(event);

View File

@ -32,22 +32,21 @@
#include <QDebug> #include <QDebug>
#include "../widgets/vapplication.h" #include "../widgets/vapplication.h"
//---------------------------------------------------------------------------------------------------------------------
VItem::VItem (const QPainterPath & path, int numInList, QGraphicsItem * parent ) VItem::VItem (const QPainterPath & path, int numInList, QGraphicsItem * parent )
:QGraphicsPathItem ( path, parent ), numInOutList(numInList), paper(nullptr) :QGraphicsPathItem ( path, parent ), numInOutList(numInList), paper(nullptr)
{ {}
}
//---------------------------------------------------------------------------------------------------------------------
VItem::VItem():numInOutList(0), paper(nullptr) VItem::VItem():numInOutList(0), paper(nullptr)
{ {}
}
//---------------------------------------------------------------------------------------------------------------------
VItem::VItem(int numInList, QGraphicsItem *parent):QGraphicsPathItem (parent), numInOutList(numInList), VItem::VItem(int numInList, QGraphicsItem *parent):QGraphicsPathItem (parent), numInOutList(numInList),
paper(nullptr) paper(nullptr)
{ {}
}
//---------------------------------------------------------------------------------------------------------------------
void VItem::checkItemChange() void VItem::checkItemChange()
{ {
QRectF rect; QRectF rect;
@ -87,6 +86,7 @@ void VItem::checkItemChange()
//qDebug()<<"list="<<list.size(); //qDebug()<<"list="<<list.size();
} }
//---------------------------------------------------------------------------------------------------------------------
QVariant VItem::itemChange( GraphicsItemChange change, const QVariant &value ) QVariant VItem::itemChange( GraphicsItemChange change, const QVariant &value )
{ {
if ( change == QGraphicsItem::ItemPositionHasChanged && scene() ) if ( change == QGraphicsItem::ItemPositionHasChanged && scene() )
@ -102,6 +102,7 @@ QVariant VItem::itemChange( GraphicsItemChange change, const QVariant &value )
return QGraphicsPathItem::itemChange( change, value ); return QGraphicsPathItem::itemChange( change, value );
} }
//---------------------------------------------------------------------------------------------------------------------
void VItem::LengthChanged() void VItem::LengthChanged()
{ {
checkItemChange(); checkItemChange();

View File

@ -30,43 +30,49 @@
#include <QtWidgets> #include <QtWidgets>
//---------------------------------------------------------------------------------------------------------------------
VMainGraphicsScene::VMainGraphicsScene() VMainGraphicsScene::VMainGraphicsScene()
:QGraphicsScene(), horScrollBar(0), verScrollBar(0), scaleFactor(1), _transform(QTransform()) :QGraphicsScene(), horScrollBar(0), verScrollBar(0), scaleFactor(1), _transform(QTransform())
{ {}
}
//---------------------------------------------------------------------------------------------------------------------
VMainGraphicsScene::VMainGraphicsScene(const QRectF & sceneRect, QObject * parent) VMainGraphicsScene::VMainGraphicsScene(const QRectF & sceneRect, QObject * parent)
:QGraphicsScene ( sceneRect, parent ), horScrollBar(0), verScrollBar(0), scaleFactor(1), _transform(QTransform()) :QGraphicsScene ( sceneRect, parent ), horScrollBar(0), verScrollBar(0), scaleFactor(1), _transform(QTransform())
{ {}
}
//---------------------------------------------------------------------------------------------------------------------
void VMainGraphicsScene::mouseMoveEvent(QGraphicsSceneMouseEvent* event) void VMainGraphicsScene::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
{ {
emit mouseMove(event->scenePos()); emit mouseMove(event->scenePos());
QGraphicsScene::mouseMoveEvent(event); QGraphicsScene::mouseMoveEvent(event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VMainGraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent *event) void VMainGraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent *event)
{ {
emit mousePress(event->scenePos()); emit mousePress(event->scenePos());
QGraphicsScene::mousePressEvent(event); QGraphicsScene::mousePressEvent(event);
} }
//---------------------------------------------------------------------------------------------------------------------
QTransform VMainGraphicsScene::transform() const QTransform VMainGraphicsScene::transform() const
{ {
return _transform; return _transform;
} }
//---------------------------------------------------------------------------------------------------------------------
void VMainGraphicsScene::setTransform(const QTransform &transform) void VMainGraphicsScene::setTransform(const QTransform &transform)
{ {
_transform = transform; _transform = transform;
} }
//---------------------------------------------------------------------------------------------------------------------
void VMainGraphicsScene::ChoosedItem(quint32 id, const Valentina::Scenes &type) void VMainGraphicsScene::ChoosedItem(quint32 id, const Valentina::Scenes &type)
{ {
emit ChoosedObject(id, type); emit ChoosedObject(id, type);
} }
//---------------------------------------------------------------------------------------------------------------------
void VMainGraphicsScene::SetFactor(qreal factor) void VMainGraphicsScene::SetFactor(qreal factor)
{ {
scaleFactor=scaleFactor*factor; scaleFactor=scaleFactor*factor;

View File

@ -34,6 +34,7 @@
#include <QScrollBar> #include <QScrollBar>
#include "../tools/vabstracttool.h" #include "../tools/vabstracttool.h"
//---------------------------------------------------------------------------------------------------------------------
VMainGraphicsView::VMainGraphicsView(QWidget *parent) VMainGraphicsView::VMainGraphicsView(QWidget *parent)
:QGraphicsView(parent), _numScheduledScalings(0) :QGraphicsView(parent), _numScheduledScalings(0)
{ {
@ -42,6 +43,7 @@ VMainGraphicsView::VMainGraphicsView(QWidget *parent)
this->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); this->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
} }
//---------------------------------------------------------------------------------------------------------------------
//cppcheck-suppress unusedFunction //cppcheck-suppress unusedFunction
void VMainGraphicsView::wheelEvent(QWheelEvent *event) void VMainGraphicsView::wheelEvent(QWheelEvent *event)
{ {
@ -68,6 +70,7 @@ void VMainGraphicsView::wheelEvent(QWheelEvent *event)
anim->start(); anim->start();
} }
//---------------------------------------------------------------------------------------------------------------------
void VMainGraphicsView::scalingTime(qreal x) void VMainGraphicsView::scalingTime(qreal x)
{ {
Q_UNUSED(x); Q_UNUSED(x);
@ -86,6 +89,7 @@ void VMainGraphicsView::scalingTime(qreal x)
emit NewFactor(factor); emit NewFactor(factor);
} }
//---------------------------------------------------------------------------------------------------------------------
void VMainGraphicsView::scrollingTime(qreal x) void VMainGraphicsView::scrollingTime(qreal x)
{ {
Q_UNUSED(x); Q_UNUSED(x);
@ -105,6 +109,7 @@ void VMainGraphicsView::scrollingTime(qreal x)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VMainGraphicsView::animFinished() void VMainGraphicsView::animFinished()
{ {
if (_numScheduledScalings > 0) if (_numScheduledScalings > 0)
@ -118,6 +123,7 @@ void VMainGraphicsView::animFinished()
sender()->~QObject(); sender()->~QObject();
} }
//---------------------------------------------------------------------------------------------------------------------
void VMainGraphicsView::mousePressEvent(QMouseEvent *mousePress) void VMainGraphicsView::mousePressEvent(QMouseEvent *mousePress)
{ {
if (mousePress->button() & Qt::LeftButton) if (mousePress->button() & Qt::LeftButton)
@ -135,6 +141,7 @@ void VMainGraphicsView::mousePressEvent(QMouseEvent *mousePress)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VMainGraphicsView::mouseReleaseEvent(QMouseEvent *event) void VMainGraphicsView::mouseReleaseEvent(QMouseEvent *event)
{ {
QGraphicsView::mouseReleaseEvent ( event ); QGraphicsView::mouseReleaseEvent ( event );

View File

@ -31,6 +31,7 @@
#include <QPen> #include <QPen>
#include <QGraphicsSceneMouseEvent> #include <QGraphicsSceneMouseEvent>
//---------------------------------------------------------------------------------------------------------------------
VSimpleArc::VSimpleArc(quint32 id, Qt::GlobalColor *currentColor, qreal *factor, QObject *parent) VSimpleArc::VSimpleArc(quint32 id, Qt::GlobalColor *currentColor, qreal *factor, QObject *parent)
:QObject(parent), QGraphicsPathItem(), id (id), factor(factor), currentColor(currentColor) :QObject(parent), QGraphicsPathItem(), id (id), factor(factor), currentColor(currentColor)
{ {
@ -46,6 +47,7 @@ VSimpleArc::VSimpleArc(quint32 id, Qt::GlobalColor *currentColor, qreal *factor,
setAcceptHoverEvents(true); setAcceptHoverEvents(true);
} }
//---------------------------------------------------------------------------------------------------------------------
void VSimpleArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VSimpleArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{ {
if (event->button() == Qt::LeftButton) if (event->button() == Qt::LeftButton)
@ -55,6 +57,7 @@ void VSimpleArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
QGraphicsItem::mouseReleaseEvent(event); QGraphicsItem::mouseReleaseEvent(event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VSimpleArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VSimpleArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
@ -68,6 +71,7 @@ void VSimpleArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VSimpleArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VSimpleArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);

View File

@ -30,6 +30,7 @@
#include "../widgets/vapplication.h" #include "../widgets/vapplication.h"
#include <QPen> #include <QPen>
//---------------------------------------------------------------------------------------------------------------------
VSimpleSpline::VSimpleSpline(quint32 id, Qt::GlobalColor *currentColor, qreal *factor, QObject *parent) VSimpleSpline::VSimpleSpline(quint32 id, Qt::GlobalColor *currentColor, qreal *factor, QObject *parent)
:QObject(parent), QGraphicsPathItem(), id (id), factor(factor), currentColor(currentColor) :QObject(parent), QGraphicsPathItem(), id (id), factor(factor), currentColor(currentColor)
{ {
@ -45,6 +46,7 @@ VSimpleSpline::VSimpleSpline(quint32 id, Qt::GlobalColor *currentColor, qreal *f
setAcceptHoverEvents(true); setAcceptHoverEvents(true);
} }
//---------------------------------------------------------------------------------------------------------------------
void VSimpleSpline::ChangedActivDraw(const bool &flag) void VSimpleSpline::ChangedActivDraw(const bool &flag)
{ {
setFlag(QGraphicsItem::ItemIsSelectable, flag); setFlag(QGraphicsItem::ItemIsSelectable, flag);
@ -52,6 +54,7 @@ void VSimpleSpline::ChangedActivDraw(const bool &flag)
setPen(QPen(*currentColor, qApp->toPixel(qApp->widthHairLine())/ *factor)); setPen(QPen(*currentColor, qApp->toPixel(qApp->widthHairLine())/ *factor));
} }
//---------------------------------------------------------------------------------------------------------------------
void VSimpleSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VSimpleSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{ {
if (event->button() == Qt::LeftButton) if (event->button() == Qt::LeftButton)
@ -61,6 +64,7 @@ void VSimpleSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
QGraphicsItem::mouseReleaseEvent(event); QGraphicsItem::mouseReleaseEvent(event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VSimpleSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VSimpleSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
@ -74,6 +78,7 @@ void VSimpleSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VSimpleSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VSimpleSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);

View File

@ -30,11 +30,12 @@
#include "../widgets/vapplication.h" #include "../widgets/vapplication.h"
#include <QGraphicsSceneMouseEvent> #include <QGraphicsSceneMouseEvent>
//---------------------------------------------------------------------------------------------------------------------
VSimpleSplinePath::VSimpleSplinePath(VPattern *doc, VContainer *data, quint32 id, qreal *factor) VSimpleSplinePath::VSimpleSplinePath(VPattern *doc, VContainer *data, quint32 id, qreal *factor)
:VAbstractTool(doc, data, id), factor(factor) :VAbstractTool(doc, data, id), factor(factor)
{ {}
}
//---------------------------------------------------------------------------------------------------------------------
void VSimpleSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VSimpleSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{ {
if (event->button() == Qt::LeftButton) if (event->button() == Qt::LeftButton)
@ -44,12 +45,14 @@ void VSimpleSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
QGraphicsItem::mouseReleaseEvent(event); QGraphicsItem::mouseReleaseEvent(event);
} }
//---------------------------------------------------------------------------------------------------------------------
void VSimpleSplinePath::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VSimpleSplinePath::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthMainLine())/ *factor)); this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthMainLine())/ *factor));
} }
//---------------------------------------------------------------------------------------------------------------------
void VSimpleSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VSimpleSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);

View File

@ -32,6 +32,7 @@
#include <QtWidgets> #include <QtWidgets>
#include <QWheelEvent> #include <QWheelEvent>
//---------------------------------------------------------------------------------------------------------------------
VTableGraphicsView::VTableGraphicsView(QGraphicsScene* pScene, QWidget *parent) VTableGraphicsView::VTableGraphicsView(QGraphicsScene* pScene, QWidget *parent)
:QGraphicsView(pScene, parent) :QGraphicsView(pScene, parent)
{ {
@ -39,6 +40,7 @@ VTableGraphicsView::VTableGraphicsView(QGraphicsScene* pScene, QWidget *parent)
connect(pScene, &QGraphicsScene::selectionChanged, this, &VTableGraphicsView::selectionChanged); connect(pScene, &QGraphicsScene::selectionChanged, this, &VTableGraphicsView::selectionChanged);
} }
//---------------------------------------------------------------------------------------------------------------------
void VTableGraphicsView::selectionChanged() void VTableGraphicsView::selectionChanged()
{ {
QList<QGraphicsItem *> listSelectedItems = scene()->selectedItems(); QList<QGraphicsItem *> listSelectedItems = scene()->selectedItems();
@ -54,6 +56,7 @@ void VTableGraphicsView::selectionChanged()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VTableGraphicsView::MirrorItem() void VTableGraphicsView::MirrorItem()
{ {
QList<QGraphicsItem *> list = scene()->selectedItems(); QList<QGraphicsItem *> list = scene()->selectedItems();
@ -94,6 +97,7 @@ void VTableGraphicsView::MirrorItem()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VTableGraphicsView::wheelEvent(QWheelEvent *event) void VTableGraphicsView::wheelEvent(QWheelEvent *event)
{ {
if (QGuiApplication::keyboardModifiers() == Qt::ControlModifier) if (QGuiApplication::keyboardModifiers() == Qt::ControlModifier)
@ -114,6 +118,7 @@ void VTableGraphicsView::wheelEvent(QWheelEvent *event)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VTableGraphicsView::mousePressEvent(QMouseEvent *mousePress) void VTableGraphicsView::mousePressEvent(QMouseEvent *mousePress)
{ {
if (mousePress->button() & Qt::LeftButton) if (mousePress->button() & Qt::LeftButton)
@ -131,12 +136,14 @@ void VTableGraphicsView::mousePressEvent(QMouseEvent *mousePress)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VTableGraphicsView::mouseReleaseEvent(QMouseEvent *event) void VTableGraphicsView::mouseReleaseEvent(QMouseEvent *event)
{ {
QGraphicsView::mouseReleaseEvent ( event ); QGraphicsView::mouseReleaseEvent ( event );
QGraphicsView::setDragMode( QGraphicsView::RubberBandDrag ); QGraphicsView::setDragMode( QGraphicsView::RubberBandDrag );
} }
//---------------------------------------------------------------------------------------------------------------------
void VTableGraphicsView::keyPressEvent(QKeyEvent *event) void VTableGraphicsView::keyPressEvent(QKeyEvent *event)
{ {
switch (event->key()) switch (event->key())
@ -162,6 +169,7 @@ void VTableGraphicsView::keyPressEvent(QKeyEvent *event)
QGraphicsView::keyPressEvent ( event ); QGraphicsView::keyPressEvent ( event );
} }
//---------------------------------------------------------------------------------------------------------------------
void VTableGraphicsView::rotateIt() void VTableGraphicsView::rotateIt()
{ {
QList<QGraphicsItem *> list = scene()->selectedItems(); QList<QGraphicsItem *> list = scene()->selectedItems();
@ -177,6 +185,7 @@ void VTableGraphicsView::rotateIt()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VTableGraphicsView::MoveItem(VTableGraphicsView::typeMove_e move) void VTableGraphicsView::MoveItem(VTableGraphicsView::typeMove_e move)
{ {
qreal dx = 0, dy = 0; qreal dx = 0, dy = 0;

View File

@ -64,16 +64,19 @@ private:
QSourceLocation m_sourceLocation; QSourceLocation m_sourceLocation;
}; };
//---------------------------------------------------------------------------------------------------------------------
inline QString MessageHandler::statusMessage() const inline QString MessageHandler::statusMessage() const
{ {
return m_description; return m_description;
} }
//---------------------------------------------------------------------------------------------------------------------
inline qint64 MessageHandler::line() const inline qint64 MessageHandler::line() const
{ {
return m_sourceLocation.line(); return m_sourceLocation.line();
} }
//---------------------------------------------------------------------------------------------------------------------
inline qint64 MessageHandler::column() const inline qint64 MessageHandler::column() const
{ {
return m_sourceLocation.column(); return m_sourceLocation.column();
@ -85,12 +88,12 @@ const QString VDomDocument::UnitMM = QStringLiteral("mm");
const QString VDomDocument::UnitCM = QStringLiteral("cm"); const QString VDomDocument::UnitCM = QStringLiteral("cm");
const QString VDomDocument::UnitINCH = QStringLiteral("inch"); const QString VDomDocument::UnitINCH = QStringLiteral("inch");
//---------------------------------------------------------------------------------------------------------------------
VDomDocument::VDomDocument(VContainer *data) VDomDocument::VDomDocument(VContainer *data)
: QDomDocument(), data(data), map(QHash<QString, QDomElement>()) : QDomDocument(), data(data), map(QHash<QString, QDomElement>())
{ {}
}
//---------------------------------------------------------------------------------------------------------------------
QDomElement VDomDocument::elementById(const QString& id) QDomElement VDomDocument::elementById(const QString& id)
{ {
if (map.contains(id)) if (map.contains(id))
@ -111,6 +114,7 @@ QDomElement VDomDocument::elementById(const QString& id)
return QDomElement(); return QDomElement();
} }
//---------------------------------------------------------------------------------------------------------------------
void VDomDocument::removeAllChilds(QDomElement &element) void VDomDocument::removeAllChilds(QDomElement &element)
{ {
QDomNode domNode = element.firstChild(); QDomNode domNode = element.firstChild();
@ -128,6 +132,7 @@ void VDomDocument::removeAllChilds(QDomElement &element)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
bool VDomDocument::find(const QDomElement &node, const QString& id) bool VDomDocument::find(const QDomElement &node, const QString& id)
{ {
if (node.hasAttribute(AttrId)) if (node.hasAttribute(AttrId))
@ -154,6 +159,7 @@ bool VDomDocument::find(const QDomElement &node, const QString& id)
return false; return false;
} }
//---------------------------------------------------------------------------------------------------------------------
quint32 VDomDocument::GetParametrUInt(const QDomElement &domElement, const QString &name, const QString &defValue) const quint32 VDomDocument::GetParametrUInt(const QDomElement &domElement, const QString &name, const QString &defValue) const
{ {
Q_ASSERT_X(name.isEmpty() == false, Q_FUNC_INFO, "name of parametr is empty"); Q_ASSERT_X(name.isEmpty() == false, Q_FUNC_INFO, "name of parametr is empty");
@ -183,6 +189,7 @@ quint32 VDomDocument::GetParametrUInt(const QDomElement &domElement, const QStri
return id; return id;
} }
//---------------------------------------------------------------------------------------------------------------------
QString VDomDocument::GetParametrString(const QDomElement &domElement, const QString &name, QString VDomDocument::GetParametrString(const QDomElement &domElement, const QString &name,
const QString &defValue) const const QString &defValue) const
{ {
@ -203,6 +210,7 @@ QString VDomDocument::GetParametrString(const QDomElement &domElement, const QSt
return parameter; return parameter;
} }
//---------------------------------------------------------------------------------------------------------------------
qreal VDomDocument::GetParametrDouble(const QDomElement &domElement, const QString &name, const QString &defValue) const qreal VDomDocument::GetParametrDouble(const QDomElement &domElement, const QString &name, const QString &defValue) const
{ {
Q_ASSERT_X(name.isEmpty() == false, Q_FUNC_INFO, "name of parametr is empty"); Q_ASSERT_X(name.isEmpty() == false, Q_FUNC_INFO, "name of parametr is empty");
@ -230,6 +238,7 @@ qreal VDomDocument::GetParametrDouble(const QDomElement &domElement, const QStri
return param; return param;
} }
//---------------------------------------------------------------------------------------------------------------------
QString VDomDocument::UniqueTagText(const QString &tagName, const QString &defVal) const QString VDomDocument::UniqueTagText(const QString &tagName, const QString &defVal) const
{ {
const QDomNodeList nodeList = this->elementsByTagName(tagName); const QDomNodeList nodeList = this->elementsByTagName(tagName);
@ -252,6 +261,7 @@ QString VDomDocument::UniqueTagText(const QString &tagName, const QString &defVa
return defVal; return defVal;
} }
//---------------------------------------------------------------------------------------------------------------------
void VDomDocument::ValidateXML(const QString &schema, const QString &fileName) void VDomDocument::ValidateXML(const QString &schema, const QString &fileName)
{ {
QFile pattern(fileName); QFile pattern(fileName);
@ -301,6 +311,7 @@ void VDomDocument::ValidateXML(const QString &schema, const QString &fileName)
fileSchema.close(); fileSchema.close();
} }
//---------------------------------------------------------------------------------------------------------------------
void VDomDocument::setContent(const QString &fileName) void VDomDocument::setContent(const QString &fileName)
{ {
QFile file(fileName); QFile file(fileName);
@ -322,6 +333,7 @@ void VDomDocument::setContent(const QString &fileName)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
Valentina::Units VDomDocument::StrToUnits(const QString &unit) Valentina::Units VDomDocument::StrToUnits(const QString &unit)
{ {
QStringList units; QStringList units;
@ -345,6 +357,7 @@ Valentina::Units VDomDocument::StrToUnits(const QString &unit)
return result; return result;
} }
//---------------------------------------------------------------------------------------------------------------------
QString VDomDocument::UnitsToStr(const Valentina::Units &unit) QString VDomDocument::UnitsToStr(const Valentina::Units &unit)
{ {
QString result; QString result;
@ -366,6 +379,7 @@ QString VDomDocument::UnitsToStr(const Valentina::Units &unit)
return result; return result;
} }
//---------------------------------------------------------------------------------------------------------------------
bool VDomDocument::SaveDocument(const QString &fileName) bool VDomDocument::SaveDocument(const QString &fileName)
{ {
if (fileName.isEmpty()) if (fileName.isEmpty())
@ -416,6 +430,7 @@ bool VDomDocument::SaveDocument(const QString &fileName)
return result; return result;
} }
//---------------------------------------------------------------------------------------------------------------------
void VDomDocument::setTagText(const QString &tag, const QString &text) void VDomDocument::setTagText(const QString &tag, const QString &text)
{ {
const QDomNodeList nodeList = this->elementsByTagName(tag); const QDomNodeList nodeList = this->elementsByTagName(tag);

View File

@ -46,21 +46,24 @@ const QString VIndividualMeasurements::TagEmail = QStringLiteral("email")
const QString VIndividualMeasurements::SexMale = QStringLiteral("male"); const QString VIndividualMeasurements::SexMale = QStringLiteral("male");
const QString VIndividualMeasurements::SexFemale = QStringLiteral("female"); const QString VIndividualMeasurements::SexFemale = QStringLiteral("female");
//---------------------------------------------------------------------------------------------------------------------
VIndividualMeasurements::VIndividualMeasurements(VContainer *data):VDomDocument(data) VIndividualMeasurements::VIndividualMeasurements(VContainer *data):VDomDocument(data)
{ {}
}
//---------------------------------------------------------------------------------------------------------------------
Valentina::Units VIndividualMeasurements::Unit() const Valentina::Units VIndividualMeasurements::Unit() const
{ {
const QString unit = UniqueTagText(TagUnit, UnitCM); const QString unit = UniqueTagText(TagUnit, UnitCM);
return VDomDocument::StrToUnits(unit); return VDomDocument::StrToUnits(unit);
} }
//---------------------------------------------------------------------------------------------------------------------
void VIndividualMeasurements::setUnit(const Valentina::Units &unit) void VIndividualMeasurements::setUnit(const Valentina::Units &unit)
{ {
setTagText(TagUnit, UnitsToStr(unit)); setTagText(TagUnit, UnitsToStr(unit));
} }
//---------------------------------------------------------------------------------------------------------------------
void VIndividualMeasurements::Measurements() void VIndividualMeasurements::Measurements()
{ {
//head and neck //head and neck
@ -152,6 +155,7 @@ void VIndividualMeasurements::Measurements()
Measurement("crotch_height"); Measurement("crotch_height");
} }
//---------------------------------------------------------------------------------------------------------------------
void VIndividualMeasurements::Measurement(const QString &tag) void VIndividualMeasurements::Measurement(const QString &tag)
{ {
const QDomNodeList nodeList = this->elementsByTagName(tag); const QDomNodeList nodeList = this->elementsByTagName(tag);
@ -218,62 +222,74 @@ void VIndividualMeasurements::Measurement(const QString &tag)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
QString VIndividualMeasurements::Language() const QString VIndividualMeasurements::Language() const
{ {
return UniqueTagText(TagLang, "en"); return UniqueTagText(TagLang, "en");
} }
//---------------------------------------------------------------------------------------------------------------------
QString VIndividualMeasurements::FamilyName() const QString VIndividualMeasurements::FamilyName() const
{ {
return UniqueTagText(TagFamily_name, ""); return UniqueTagText(TagFamily_name, "");
} }
//---------------------------------------------------------------------------------------------------------------------
void VIndividualMeasurements::setFamilyName(const QString &text) void VIndividualMeasurements::setFamilyName(const QString &text)
{ {
setTagText(TagFamily_name, text); setTagText(TagFamily_name, text);
} }
//---------------------------------------------------------------------------------------------------------------------
QString VIndividualMeasurements::GivenName() const QString VIndividualMeasurements::GivenName() const
{ {
return UniqueTagText(TagGiven_name, ""); return UniqueTagText(TagGiven_name, "");
} }
//---------------------------------------------------------------------------------------------------------------------
void VIndividualMeasurements::setGivenName(const QString &text) void VIndividualMeasurements::setGivenName(const QString &text)
{ {
setTagText(TagGiven_name, text); setTagText(TagGiven_name, text);
} }
//---------------------------------------------------------------------------------------------------------------------
QDate VIndividualMeasurements::BirthDate() const QDate VIndividualMeasurements::BirthDate() const
{ {
const QString date = UniqueTagText(TagBirth_date, "1900-01-01"); const QString date = UniqueTagText(TagBirth_date, "1900-01-01");
return QDate::fromString(date, "yyyy-MM-dd"); return QDate::fromString(date, "yyyy-MM-dd");
} }
//---------------------------------------------------------------------------------------------------------------------
void VIndividualMeasurements::setBirthDate(const QDate &date) void VIndividualMeasurements::setBirthDate(const QDate &date)
{ {
setTagText(TagBirth_date, date.toString("yyyy-MM-dd")); setTagText(TagBirth_date, date.toString("yyyy-MM-dd"));
} }
//---------------------------------------------------------------------------------------------------------------------
VIndividualMeasurements::Genders VIndividualMeasurements::Sex() const VIndividualMeasurements::Genders VIndividualMeasurements::Sex() const
{ {
return StrToGender(UniqueTagText(TagSex, "")); return StrToGender(UniqueTagText(TagSex, ""));
} }
//---------------------------------------------------------------------------------------------------------------------
void VIndividualMeasurements::setSex(const VIndividualMeasurements::Genders &sex) void VIndividualMeasurements::setSex(const VIndividualMeasurements::Genders &sex)
{ {
setTagText(TagSex, GenderToStr(sex)); setTagText(TagSex, GenderToStr(sex));
} }
//---------------------------------------------------------------------------------------------------------------------
QString VIndividualMeasurements::Mail() const QString VIndividualMeasurements::Mail() const
{ {
return UniqueTagText(TagEmail, ""); return UniqueTagText(TagEmail, "");
} }
//---------------------------------------------------------------------------------------------------------------------
void VIndividualMeasurements::setMail(const QString &text) void VIndividualMeasurements::setMail(const QString &text)
{ {
setTagText(TagEmail, text); setTagText(TagEmail, text);
} }
//---------------------------------------------------------------------------------------------------------------------
QString VIndividualMeasurements::GenderToStr(const VIndividualMeasurements::Genders &sex) QString VIndividualMeasurements::GenderToStr(const VIndividualMeasurements::Genders &sex)
{ {
switch (sex) switch (sex)
@ -287,6 +303,7 @@ QString VIndividualMeasurements::GenderToStr(const VIndividualMeasurements::Gend
} }
} }
//---------------------------------------------------------------------------------------------------------------------
VIndividualMeasurements::Genders VIndividualMeasurements::StrToGender(const QString &sex) VIndividualMeasurements::Genders VIndividualMeasurements::StrToGender(const QString &sex)
{ {
QStringList genders; QStringList genders;

View File

@ -67,12 +67,13 @@ const QString VPattern::IncrementKsize = QStringLiteral("ksize");
const QString VPattern::IncrementKgrowth = QStringLiteral("kgrowth"); const QString VPattern::IncrementKgrowth = QStringLiteral("kgrowth");
const QString VPattern::IncrementDescription = QStringLiteral("description"); const QString VPattern::IncrementDescription = QStringLiteral("description");
//---------------------------------------------------------------------------------------------------------------------
VPattern::VPattern(VContainer *data, QComboBox *comboBoxDraws, Valentina::Draws *mode, QObject *parent) VPattern::VPattern(VContainer *data, QComboBox *comboBoxDraws, Valentina::Draws *mode, QObject *parent)
: QObject(parent), VDomDocument(data), nameActivDraw(QString()), tools(QHash<quint32, VDataTool*>()), : QObject(parent), VDomDocument(data), nameActivDraw(QString()), tools(QHash<quint32, VDataTool*>()),
history(QVector<VToolRecord>()), cursor(0), comboBoxDraws(comboBoxDraws), mode(mode), patternModified(false) history(QVector<VToolRecord>()), cursor(0), comboBoxDraws(comboBoxDraws), mode(mode), patternModified(false)
{ {}
}
//---------------------------------------------------------------------------------------------------------------------
void VPattern::CreateEmptyFile(const QString &tablePath) void VPattern::CreateEmptyFile(const QString &tablePath)
{ {
if (tablePath.isEmpty()) if (tablePath.isEmpty())
@ -98,6 +99,7 @@ void VPattern::CreateEmptyFile(const QString &tablePath)
insertBefore(createProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\""), this->firstChild()); insertBefore(createProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\""), this->firstChild());
} }
//---------------------------------------------------------------------------------------------------------------------
void VPattern::ChangeActivDraw(const QString &name, const Document::Documents &parse) void VPattern::ChangeActivDraw(const QString &name, const Document::Documents &parse)
{ {
Q_ASSERT_X(name.isEmpty() == false, "ChangeActivDraw", "name draw is empty"); Q_ASSERT_X(name.isEmpty() == false, "ChangeActivDraw", "name draw is empty");
@ -111,6 +113,7 @@ void VPattern::ChangeActivDraw(const QString &name, const Document::Documents &p
} }
} }
//---------------------------------------------------------------------------------------------------------------------
bool VPattern::GetActivDrawElement(QDomElement &element) bool VPattern::GetActivDrawElement(QDomElement &element)
{ {
if (nameActivDraw.isEmpty() == false) if (nameActivDraw.isEmpty() == false)
@ -136,6 +139,7 @@ bool VPattern::GetActivDrawElement(QDomElement &element)
return false; return false;
} }
//---------------------------------------------------------------------------------------------------------------------
bool VPattern::appendDraw(const QString &name) bool VPattern::appendDraw(const QString &name)
{ {
Q_ASSERT_X(name.isEmpty() == false, "appendDraw", "name draw is empty"); Q_ASSERT_X(name.isEmpty() == false, "appendDraw", "name draw is empty");
@ -169,6 +173,7 @@ bool VPattern::appendDraw(const QString &name)
return false; return false;
} }
//---------------------------------------------------------------------------------------------------------------------
bool VPattern::SetNameDraw(const QString &name) bool VPattern::SetNameDraw(const QString &name)
{ {
Q_ASSERT_X(name.isEmpty() == false, "SetNameDraw", "name draw is empty"); Q_ASSERT_X(name.isEmpty() == false, "SetNameDraw", "name draw is empty");
@ -189,6 +194,7 @@ bool VPattern::SetNameDraw(const QString &name)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VPattern::Parse(const Document::Documents &parse, VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail) void VPattern::Parse(const Document::Documents &parse, VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail)
{ {
Q_CHECK_PTR(sceneDraw); Q_CHECK_PTR(sceneDraw);
@ -246,6 +252,7 @@ void VPattern::Parse(const Document::Documents &parse, VMainGraphicsScene *scene
} }
} }
//---------------------------------------------------------------------------------------------------------------------
VDataTool *VPattern::getTool(const quint32 &id) VDataTool *VPattern::getTool(const quint32 &id)
{ {
if (tools.contains(id)) if (tools.contains(id))
@ -260,12 +267,14 @@ VDataTool *VPattern::getTool(const quint32 &id)
return 0; return 0;
} }
//---------------------------------------------------------------------------------------------------------------------
void VPattern::setCursor(const quint32 &value) void VPattern::setCursor(const quint32 &value)
{ {
cursor = value; cursor = value;
emit ChangedCursor(cursor); emit ChangedCursor(cursor);
} }
//---------------------------------------------------------------------------------------------------------------------
void VPattern::setCurrentData() void VPattern::setCurrentData()
{ {
if (*mode == Valentina::Calculation) if (*mode == Valentina::Calculation)
@ -305,6 +314,7 @@ void VPattern::setCurrentData()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VPattern::AddTool(const quint32 &id, VDataTool *tool) void VPattern::AddTool(const quint32 &id, VDataTool *tool)
{ {
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
@ -312,6 +322,7 @@ void VPattern::AddTool(const quint32 &id, VDataTool *tool)
tools.insert(id, tool); tools.insert(id, tool);
} }
//---------------------------------------------------------------------------------------------------------------------
void VPattern::UpdateToolData(const quint32 &id, VContainer *data) void VPattern::UpdateToolData(const quint32 &id, VContainer *data)
{ {
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
@ -321,6 +332,7 @@ void VPattern::UpdateToolData(const quint32 &id, VContainer *data)
tool->VDataTool::setData(data); tool->VDataTool::setData(data);
} }
//---------------------------------------------------------------------------------------------------------------------
void VPattern::IncrementReferens(quint32 id) const void VPattern::IncrementReferens(quint32 id) const
{ {
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
@ -329,6 +341,7 @@ void VPattern::IncrementReferens(quint32 id) const
tool->incrementReferens(); tool->incrementReferens();
} }
//---------------------------------------------------------------------------------------------------------------------
void VPattern::DecrementReferens(quint32 id) const void VPattern::DecrementReferens(quint32 id) const
{ {
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
@ -337,12 +350,14 @@ void VPattern::DecrementReferens(quint32 id) const
tool->decrementReferens(); tool->decrementReferens();
} }
//---------------------------------------------------------------------------------------------------------------------
void VPattern::TestUniqueId() const void VPattern::TestUniqueId() const
{ {
QVector<quint32> vector; QVector<quint32> vector;
CollectId(documentElement(), vector); CollectId(documentElement(), vector);
} }
//---------------------------------------------------------------------------------------------------------------------
quint32 VPattern::SPointActiveDraw() quint32 VPattern::SPointActiveDraw()
{ {
QDomElement calcElement; QDomElement calcElement;
@ -365,6 +380,7 @@ quint32 VPattern::SPointActiveDraw()
return 0; return 0;
} }
//---------------------------------------------------------------------------------------------------------------------
bool VPattern::CheckNameDraw(const QString &name) const bool VPattern::CheckNameDraw(const QString &name) const
{ {
Q_ASSERT_X(name.isEmpty() == false, "CheckNameDraw", "name draw is empty"); Q_ASSERT_X(name.isEmpty() == false, "CheckNameDraw", "name draw is empty");
@ -387,12 +403,14 @@ bool VPattern::CheckNameDraw(const QString &name) const
return false; return false;
} }
//---------------------------------------------------------------------------------------------------------------------
void VPattern::SetActivDraw(const QString &name) void VPattern::SetActivDraw(const QString &name)
{ {
Q_ASSERT_X(name.isEmpty() == false, "SetActivDraw", "name draw is empty"); Q_ASSERT_X(name.isEmpty() == false, "SetActivDraw", "name draw is empty");
this->nameActivDraw = name; this->nameActivDraw = name;
} }
//---------------------------------------------------------------------------------------------------------------------
bool VPattern::GetActivNodeElement(const QString &name, QDomElement &element) bool VPattern::GetActivNodeElement(const QString &name, QDomElement &element)
{ {
Q_ASSERT_X(name.isEmpty() == false, "GetActivNodeElement", "name draw is empty"); Q_ASSERT_X(name.isEmpty() == false, "GetActivNodeElement", "name draw is empty");
@ -417,6 +435,7 @@ bool VPattern::GetActivNodeElement(const QString &name, QDomElement &element)
return false; return false;
} }
//---------------------------------------------------------------------------------------------------------------------
QString VPattern::MPath() const QString VPattern::MPath() const
{ {
QDomNodeList list = elementsByTagName(TagMeasurements); QDomNodeList list = elementsByTagName(TagMeasurements);
@ -431,6 +450,7 @@ QString VPattern::MPath() const
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VPattern::SetPath(const QString &path) void VPattern::SetPath(const QString &path)
{ {
if (path.isEmpty()) if (path.isEmpty())
@ -451,6 +471,7 @@ void VPattern::SetPath(const QString &path)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
Valentina::Units VPattern::MUnit() const Valentina::Units VPattern::MUnit() const
{ {
QDomNodeList list = elementsByTagName(VPattern::TagMeasurements); QDomNodeList list = elementsByTagName(VPattern::TagMeasurements);
@ -482,6 +503,7 @@ Valentina::Units VPattern::MUnit() const
} }
} }
//---------------------------------------------------------------------------------------------------------------------
Pattern::Measurements VPattern::MType() const Pattern::Measurements VPattern::MType() const
{ {
QDomNodeList list = elementsByTagName(VPattern::TagMeasurements); QDomNodeList list = elementsByTagName(VPattern::TagMeasurements);
@ -510,6 +532,7 @@ Pattern::Measurements VPattern::MType() const
} }
} }
//---------------------------------------------------------------------------------------------------------------------
bool VPattern::SaveDocument(const QString &fileName) bool VPattern::SaveDocument(const QString &fileName)
{ {
try try
@ -524,6 +547,7 @@ bool VPattern::SaveDocument(const QString &fileName)
return VDomDocument::SaveDocument(fileName); return VDomDocument::SaveDocument(fileName);
} }
//---------------------------------------------------------------------------------------------------------------------
void VPattern::FullUpdateTree() void VPattern::FullUpdateTree()
{ {
VMainGraphicsScene *scene = new VMainGraphicsScene(); VMainGraphicsScene *scene = new VMainGraphicsScene();
@ -555,17 +579,20 @@ void VPattern::FullUpdateTree()
emit FullUpdateFromFile(); emit FullUpdateFromFile();
} }
//---------------------------------------------------------------------------------------------------------------------
void VPattern::haveLiteChange() void VPattern::haveLiteChange()
{ {
patternModified = true; patternModified = true;
emit patternChanged(); emit patternChanged();
} }
//---------------------------------------------------------------------------------------------------------------------
void VPattern::ShowHistoryTool(quint32 id, Qt::GlobalColor color, bool enable) void VPattern::ShowHistoryTool(quint32 id, Qt::GlobalColor color, bool enable)
{ {
emit ShowTool(id, color, enable); emit ShowTool(id, color, enable);
} }
//---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, const QDomNode &node, void VPattern::ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, const QDomNode &node,
const Document::Documents &parse) const Document::Documents &parse)
{ {
@ -601,6 +628,7 @@ void VPattern::ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphicsScen
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, const QDomNode &node, void VPattern::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, const QDomNode &node,
const Document::Documents &parse, const Valentina::Draws &mode) const Document::Documents &parse, const Valentina::Draws &mode)
{ {
@ -649,6 +677,7 @@ void VPattern::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomElement &domElement, void VPattern::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomElement &domElement,
const Document::Documents &parse) const Document::Documents &parse)
{ {
@ -716,6 +745,7 @@ void VPattern::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomEle
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseDetails(VMainGraphicsScene *sceneDetail, const QDomElement &domElement, void VPattern::ParseDetails(VMainGraphicsScene *sceneDetail, const QDomElement &domElement,
const Document::Documents &parse) const Document::Documents &parse)
{ {
@ -739,6 +769,7 @@ void VPattern::ParseDetails(VMainGraphicsScene *sceneDetail, const QDomElement &
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &domElement, void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &domElement,
const Document::Documents &parse, const QString &type) const Document::Documents &parse, const QString &type)
{ {
@ -1104,6 +1135,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &domElement, void VPattern::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &domElement,
const Document::Documents &parse) const Document::Documents &parse)
{ {
@ -1127,6 +1159,7 @@ void VPattern::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &do
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &domElement, void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &domElement,
const Document::Documents &parse, const QString &type) const Document::Documents &parse, const QString &type)
{ {
@ -1248,6 +1281,7 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseArcElement(VMainGraphicsScene *scene, const QDomElement &domElement, void VPattern::ParseArcElement(VMainGraphicsScene *scene, const QDomElement &domElement,
const Document::Documents &parse, const QString &type) const Document::Documents &parse, const QString &type)
{ {
@ -1303,6 +1337,7 @@ void VPattern::ParseArcElement(VMainGraphicsScene *scene, const QDomElement &dom
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &domElement, void VPattern::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &domElement,
const Document::Documents &parse, const QString &type) const Document::Documents &parse, const QString &type)
{ {
@ -1340,6 +1375,7 @@ void VPattern::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &d
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseIncrementsElement(const QDomNode &node) void VPattern::ParseIncrementsElement(const QDomNode &node)
{ {
QDomNode domNode = node.firstChild(); QDomNode domNode = node.firstChild();
@ -1367,6 +1403,7 @@ void VPattern::ParseIncrementsElement(const QDomNode &node)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
quint32 VPattern::GetParametrId(const QDomElement &domElement) const quint32 VPattern::GetParametrId(const QDomElement &domElement) const
{ {
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
@ -1391,6 +1428,7 @@ quint32 VPattern::GetParametrId(const QDomElement &domElement) const
return id; return id;
} }
//---------------------------------------------------------------------------------------------------------------------
void VPattern::CollectId(const QDomElement &node, QVector<quint32> &vector) const void VPattern::CollectId(const QDomElement &node, QVector<quint32> &vector) const
{ {
if (node.hasAttribute(VDomDocument::AttrId)) if (node.hasAttribute(VDomDocument::AttrId))
@ -1413,6 +1451,7 @@ void VPattern::CollectId(const QDomElement &node, QVector<quint32> &vector) cons
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VPattern::PrepareForParse(const Document::Documents &parse, VMainGraphicsScene *sceneDraw, void VPattern::PrepareForParse(const Document::Documents &parse, VMainGraphicsScene *sceneDraw,
VMainGraphicsScene *sceneDetail) VMainGraphicsScene *sceneDetail)
{ {
@ -1438,6 +1477,7 @@ void VPattern::PrepareForParse(const Document::Documents &parse, VMainGraphicsSc
history.clear(); history.clear();
} }
//---------------------------------------------------------------------------------------------------------------------
void VPattern::UpdateMeasurements() void VPattern::UpdateMeasurements()
{ {
const QString path = MPath(); const QString path = MPath();

View File

@ -40,16 +40,18 @@ const QString VStandardMeasurements::AttrSize_increace = QStringLiteral("size_
const QString VStandardMeasurements::AttrHeight_increase = QStringLiteral("height_increase"); const QString VStandardMeasurements::AttrHeight_increase = QStringLiteral("height_increase");
const QString VStandardMeasurements::AttrNumber = QStringLiteral("number"); const QString VStandardMeasurements::AttrNumber = QStringLiteral("number");
//---------------------------------------------------------------------------------------------------------------------
VStandardMeasurements::VStandardMeasurements(VContainer *data):VDomDocument(data) VStandardMeasurements::VStandardMeasurements(VContainer *data):VDomDocument(data)
{ {}
}
//---------------------------------------------------------------------------------------------------------------------
Valentina::Units VStandardMeasurements::Unit() Valentina::Units VStandardMeasurements::Unit()
{ {
const QString unit = UniqueTagText(AttrUnit, UnitCM); const QString unit = UniqueTagText(AttrUnit, UnitCM);
return VDomDocument::StrToUnits(unit); return VDomDocument::StrToUnits(unit);
} }
//---------------------------------------------------------------------------------------------------------------------
QString VStandardMeasurements::Description() QString VStandardMeasurements::Description()
{ {
const QString desc = UniqueTagText(TagDescription, ""); const QString desc = UniqueTagText(TagDescription, "");
@ -60,6 +62,7 @@ QString VStandardMeasurements::Description()
return desc; return desc;
} }
//---------------------------------------------------------------------------------------------------------------------
void VStandardMeasurements::Measurements() void VStandardMeasurements::Measurements()
{ {
const QDomNodeList nodeList = this->elementsByTagName(TagMeasurement); const QDomNodeList nodeList = this->elementsByTagName(TagMeasurement);
@ -105,6 +108,7 @@ void VStandardMeasurements::Measurements()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VStandardMeasurements::SetSize() void VStandardMeasurements::SetSize()
{ {
const QDomNodeList nodeList = this->elementsByTagName(TagSize); const QDomNodeList nodeList = this->elementsByTagName(TagSize);
@ -138,6 +142,7 @@ void VStandardMeasurements::SetSize()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VStandardMeasurements::SetHeight() void VStandardMeasurements::SetHeight()
{ {
const QDomNodeList nodeList = this->elementsByTagName(TagHeight); const QDomNodeList nodeList = this->elementsByTagName(TagHeight);

View File

@ -28,8 +28,12 @@
#include "vtoolrecord.h" #include "vtoolrecord.h"
//---------------------------------------------------------------------------------------------------------------------
VToolRecord::VToolRecord() VToolRecord::VToolRecord()
:id(0), typeTool(Valentina::ArrowTool), nameDraw(QString()){} :id(0), typeTool(Valentina::ArrowTool), nameDraw(QString())
{}
//---------------------------------------------------------------------------------------------------------------------
VToolRecord::VToolRecord(const quint32 &id, const Valentina::Tools &typeTool, const QString &nameDraw) VToolRecord::VToolRecord(const quint32 &id, const Valentina::Tools &typeTool, const QString &nameDraw)
:id(id), typeTool(typeTool), nameDraw(nameDraw){} :id(id), typeTool(typeTool), nameDraw(nameDraw)
{}