diff --git a/.hgignore b/.hgignore
index 2e058acbc..bdc63555d 100644
--- a/.hgignore
+++ b/.hgignore
@@ -19,9 +19,20 @@ syntax: glob
# Ignore this directory.
html/
latex/
+bin/
+moc/
+obj/
+uic/
+rcc/
# Ignore file used QtCreator for user profile.
*.pro.user
# Ignore file Qt translation.
*.qm
+
+# Ignore Mercurial .orig files
+*.orig
+
+# Ignore Makefile
+Makefile
diff --git a/Valentina.pro b/Valentina.pro
index f13d13f7b..9c5f07496 100644
--- a/Valentina.pro
+++ b/Valentina.pro
@@ -78,24 +78,24 @@ CONFIG(debug, debug|release){
-isystem "/usr/include/qt5/QtCore" -isystem "$${UI_DIR}" -isystem "$${MOC_DIR}" \
-isystem "$${RCC_DIR}" \
-O0 -Wall -Wextra -pedantic -Weffc++ -Woverloaded-virtual -Wctor-dtor-privacy \
- -Wnon-virtual-dtor -Wold-style-cast -Wconversion -Winit-self \
+ -Wnon-virtual-dtor -Wold-style-cast -Wconversion -Winit-self -Wstack-protector \
-Wunreachable-code -Wcast-align -Wcast-qual -Wdisabled-optimization -Wfloat-equal \
- -Wformat -Wformat=2 -Wformat-nonliteral -Wformat-security -Wformat-y2k \
+ -Wformat=2 -Wimport \
-Winvalid-pch -Wunsafe-loop-optimizations -Wlong-long -Wmissing-format-attribute \
- -Wmissing-include-dirs -Wpacked -Wredundant-decls \
- -Wswitch-default -Wswitch-enum -Wuninitialized -Wunused-parameter -Wvariadic-macros \
- -Wlogical-op -Wnoexcept \
+ -Wmissing-include-dirs -Wpacked -Wredundant-decls -Winline \
+ -Wswitch-default -Wswitch-enum -Wuninitialized -Wvariadic-macros \
+ -Wlogical-op -Wnoexcept -Wmissing-noreturn -Wpointer-arith\
-Wstrict-null-sentinel -Wstrict-overflow=5 -Wundef -Wno-unused -gdwarf-3
}
} else {
*-g++{#Don't use additional GCC keys on Windows system.
- QMAKE_CXXFLAGS += -Og -Wall -Wextra -pedantic
+ QMAKE_CXXFLAGS += -O0 -Wall -Wextra -pedantic
}
}
}else{
# Release
*-g++{
- QMAKE_CXXFLAGS += -O1
+ QMAKE_CXXFLAGS += -O2
}
DEFINES += QT_NO_DEBUG_OUTPUT
@@ -131,6 +131,10 @@ INSTALL_TRANSLATIONS += share/translations/valentina_ru.qm \
share/translations/valentina_he_IL.qm \
share/translations/valentina_fr.qm
+INSTALL_STANDARD_MEASHUREMENTS += share/tables/standard/GOST_man_ru.vst
+
+INSTALL_INDIVIDUAL_MEASHUREMENTS += share/tables/individual/indivindual_ru.vit
+
unix {
#VARIABLES
isEmpty(PREFIX) {
@@ -147,10 +151,16 @@ pixmaps.path = $$DATADIR/pixmaps/
pixmaps.files += dist/$${TARGET}.png
translations.path = $$DATADIR/$${TARGET}/translations/
translations.files = $$INSTALL_TRANSLATIONS
+standard.path = $$DATADIR/$${TARGET}/tables/standard/
+standard.files = $$INSTALL_STANDARD_MEASHUREMENTS
+individual.path = $$DATADIR/$${TARGET}/tables/individual/
+individual.files = $$INSTALL_INDIVIDUAL_MEASHUREMENTS
INSTALLS += target \
desktop \
pixmaps \
- translations
+ translations \
+ standard \
+ individual
}
!isEmpty(TRANSLATIONS): {
@@ -187,3 +197,19 @@ for(DIR, INSTALL_TRANSLATIONS) {
}
copyToDestdir($$tr_path, $$shell_path($$OUT_PWD/$$DESTDIR/translations))
+
+for(DIR, INSTALL_STANDARD_MEASHUREMENTS) {
+ #add these absolute paths to a variable which
+ #ends up as 'mkcommands = path1 path2 path3 ...'
+ st_path += $$PWD/$$DIR
+}
+
+copyToDestdir($$st_path, $$shell_path($$OUT_PWD/$$DESTDIR/tables/standard))
+
+for(DIR, INSTALL_INDIVIDUAL_MEASHUREMENTS) {
+ #add these absolute paths to a variable which
+ #ends up as 'mkcommands = path1 path2 path3 ...'
+ ind_path += $$PWD/$$DIR
+}
+
+copyToDestdir($$ind_path, $$shell_path($$OUT_PWD/$$DESTDIR/tables/individual))
diff --git a/share/resources/icon.qrc b/share/resources/icon.qrc
index 504b28697..64d48ee8e 100644
--- a/share/resources/icon.qrc
+++ b/share/resources/icon.qrc
@@ -50,5 +50,7 @@
icon/flags/he_IL.png
icon/flags/ru.png
icon/flags/uk.png
+ icon/Graduation.png
+ icon/individual.png
diff --git a/share/resources/icon/Graduation.png b/share/resources/icon/Graduation.png
new file mode 100644
index 000000000..461bc95d1
Binary files /dev/null and b/share/resources/icon/Graduation.png differ
diff --git a/share/resources/icon/individual.png b/share/resources/icon/individual.png
new file mode 100644
index 000000000..9081d75c2
Binary files /dev/null and b/share/resources/icon/individual.png differ
diff --git a/share/resources/schema.qrc b/share/resources/schema.qrc
index ddc4b4e88..9209df5ca 100644
--- a/share/resources/schema.qrc
+++ b/share/resources/schema.qrc
@@ -1,5 +1,7 @@
schema/pattern.xsd
+ schema/individual_measurements.xsd
+ schema/standard_measurements.xsd
diff --git a/share/resources/schema/individual_measurements.xsd b/share/resources/schema/individual_measurements.xsd
new file mode 100644
index 000000000..55cd7f9a3
--- /dev/null
+++ b/share/resources/schema/individual_measurements.xsd
@@ -0,0 +1,893 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/share/resources/schema/pattern.xsd b/share/resources/schema/pattern.xsd
index 8c8394d6a..1f1b0c00c 100644
--- a/share/resources/schema/pattern.xsd
+++ b/share/resources/schema/pattern.xsd
@@ -4,19 +4,26 @@
-
-
-
+
+
+
+
+
+
+
+
+
+
-
+
-
+
@@ -32,51 +39,51 @@
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
+
-
+
@@ -86,21 +93,21 @@
-
+
-
+
-
-
+
+
@@ -113,31 +120,31 @@
-
-
-
+
+
+
-
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
@@ -149,9 +156,9 @@
-
-
-
+
+
+
@@ -159,10 +166,10 @@
-
+
-
-
+
+
@@ -178,20 +185,20 @@
-
-
-
+
+
+
-
-
+
+
-
+
-
+
@@ -204,4 +211,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/share/resources/schema/standard_measurements.xsd b/share/resources/schema/standard_measurements.xsd
new file mode 100644
index 000000000..4ac6eb0d5
--- /dev/null
+++ b/share/resources/schema/standard_measurements.xsd
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/share/tables/individual/indivindual_ru.vit b/share/tables/individual/indivindual_ru.vit
new file mode 100644
index 000000000..b7329e774
--- /dev/null
+++ b/share/tables/individual/indivindual_ru.vit
@@ -0,0 +1,108 @@
+
+
+ ru
+
+
+
+ 1900-01-01
+ male
+ username@example.com
+
+
+ mm
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/share/tables/standard/GOST_man_ru.vst b/share/tables/standard/GOST_man_ru.vst
new file mode 100644
index 000000000..ca4a1c00a
--- /dev/null
+++ b/share/tables/standard/GOST_man_ru.vst
@@ -0,0 +1,87 @@
+
+
+ Типовые фигуры мужчин 1-й полнотной группы, обхват груди 100 см
+ mm
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/container/calculator.h b/src/container/calculator.h
index 6618e310a..00b0fe7ef 100644
--- a/src/container/calculator.h
+++ b/src/container/calculator.h
@@ -42,8 +42,8 @@ public:
* @brief Calculator class constructor.
* @param data pointer to a variable container.
*/
- explicit Calculator(const VContainer *data):errorMsg(0), token(QString()), tok(0), token_type(0), prog(QString()),
- index(0), data(data), debugFormula(QString()){}
+ explicit Calculator(const VContainer *data):errorMsg(nullptr), token(QString()), tok(0), token_type(0),
+ prog(QString()), index(0), data(data), debugFormula(QString()){}
/**
* @brief eval calculate formula.
* @param prog string of formula.
diff --git a/src/container/container.pri b/src/container/container.pri
index 5fe8d435f..fcd3ba862 100644
--- a/src/container/container.pri
+++ b/src/container/container.pri
@@ -1,11 +1,11 @@
SOURCES += \
- src/container/vincrementtablerow.cpp \
src/container/vcontainer.cpp \
src/container/calculator.cpp \
- src/container/vstandardtablerow.cpp
+ src/container/vmeasurement.cpp \
+ src/container/vincrement.cpp
HEADERS += \
- src/container/vincrementtablerow.h \
src/container/vcontainer.h \
src/container/calculator.h \
- src/container/vstandardtablerow.h
+ src/container/vmeasurement.h \
+ src/container/vincrement.h
diff --git a/src/container/vcontainer.cpp b/src/container/vcontainer.cpp
index ddac8b87a..b108b3b81 100644
--- a/src/container/vcontainer.cpp
+++ b/src/container/vcontainer.cpp
@@ -30,18 +30,16 @@
#include
#include
+#include "../widgets/vapplication.h"
-qint64 VContainer::_id = 0;
+quint32 VContainer::_id = 0;
VContainer::VContainer()
- :base(QHash()), gObjects(QHash()),
- standardTable(QHash()), incrementTable(QHash()),
+ :_size(50), sizeName("Сг"), _height(176), heightName("P"), gObjects(QHash()),
+ measurements(QHash()), increments(QHash()),
lengthLines(QHash()), lineAngles(QHash()), lengthSplines(QHash()),
- lengthArcs(QHash()), details(QHash())
+ lengthArcs(QHash()), details(QHash())
{
- SetSize(500);
- SetGrowth(1760);
- CreateManTableIGroup ();
}
VContainer &VContainer::operator =(const VContainer &data)
@@ -51,10 +49,10 @@ VContainer &VContainer::operator =(const VContainer &data)
}
VContainer::VContainer(const VContainer &data)
- :base(QHash()), gObjects(QHash()),
- standardTable(QHash()), incrementTable(QHash()),
+ :_size(50), sizeName("Сг"), _height(176), heightName("P"), gObjects(QHash()),
+ measurements(QHash()), increments(QHash()),
lengthLines(QHash()), lineAngles(QHash()), lengthSplines(QHash()),
- lengthArcs(QHash()), details(QHash())
+ lengthArcs(QHash()), details(QHash())
{
setData(data);
}
@@ -67,44 +65,40 @@ VContainer::~VContainer()
void VContainer::setData(const VContainer &data)
{
- base = *data.DataBase();
+ _size = data.size();
+ sizeName = data.SizeName();
+ _height = data.height();
+ heightName = data.HeightName();
qDeleteAll(gObjects);
gObjects.clear();
- const QHash *obj = data.DataGObjects();
+ const QHash *obj = data.DataGObjects();
Q_CHECK_PTR(obj);
- QHashIterator i(*obj);
+ QHashIterator i(*obj);
while (i.hasNext())
{
i.next();
switch (i.value()->getType())
{
case (GObject::Arc):
- {
CopyGObject(data, i.key());
break;
- }
case (GObject::Point):
- {
CopyGObject(data, i.key());
break;
- }
case (GObject::Spline):
- {
CopyGObject(data, i.key());
break;
- }
case (GObject::SplinePath):
- {
CopyGObject(data, i.key());
break;
- }
default:
- qWarning()<<"Don't know how copy this type.";
+ qDebug()<<"Don't know how copy this type.";
+ break;
}
}
- standardTable = *data.DataStandardTable();
- incrementTable = *data.DataIncrementTable();
+ measurements = *data.DataMeasurements();
+ increments = *data.DataIncrements();
lengthLines = *data.DataLengthLines();
lineAngles = *data.DataLineAngles();
lengthSplines = *data.DataLengthSplines();
@@ -112,7 +106,7 @@ void VContainer::setData(const VContainer &data)
details = *data.DataDetails();
}
-const VGObject *VContainer::GetGObject(qint64 id)const
+const VGObject *VContainer::GetGObject(quint32 id)const
{
return GetObject(gObjects, id);
}
@@ -143,16 +137,16 @@ val VContainer::GetVariable(const QHash &obj, key id) const
}
}
-const VStandardTableRow VContainer::GetStandardTableCell(const QString &name) const
+const VMeasurement VContainer::GetMeasurement(const QString &name) const
{
Q_ASSERT(name.isEmpty()==false);
- return GetVariable(standardTable, name);
+ return GetVariable(measurements, name);
}
-const VIncrementTableRow VContainer::GetIncrementTableRow(const QString& name) const
+const VIncrement VContainer::GetIncrement(const QString& name) const
{
Q_ASSERT(name.isEmpty()==false);
- return GetVariable(incrementTable, name);
+ return GetVariable(increments, name);
}
qreal VContainer::GetLine(const QString &name) const
@@ -179,35 +173,35 @@ qreal VContainer::GetLineAngle(const QString &name) const
return GetVariable(lineAngles, name);
}
-const VDetail VContainer::GetDetail(qint64 id) const
+const VDetail VContainer::GetDetail(quint32 id) const
{
return GetVariable(details, id);
}
-qint64 VContainer::AddGObject(VGObject *obj)
+quint32 VContainer::AddGObject(VGObject *obj)
{
return AddObject(gObjects, obj);
}
-qint64 VContainer::AddDetail(VDetail detail)
+quint32 VContainer::AddDetail(VDetail detail)
{
- qint64 id = getNextId();
+ quint32 id = getNextId();
details[id] = detail;
return id;
}
-void VContainer::AddIncrementTableRow(const QString &name, VIncrementTableRow row)
+void VContainer::AddIncrement(const QString &name, VIncrement incr)
{
- incrementTable[name] = row;
+ increments[name] = incr;
}
-qint64 VContainer::getNextId()
+quint32 VContainer::getNextId()
{
_id++;
return _id;
}
-void VContainer::UpdateId(qint64 newId)
+void VContainer::UpdateId(quint32 newId)
{
if (newId > _id)
{
@@ -216,7 +210,7 @@ void VContainer::UpdateId(qint64 newId)
}
template
-void VContainer::UpdateObject(QHash &obj, const qint64 &id, val point)
+void VContainer::UpdateObject(QHash &obj, const quint32 &id, val point)
{
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
Q_CHECK_PTR(point);
@@ -236,10 +230,10 @@ void VContainer::AddLengthSpline(const QString &name, const qreal &value)
lengthSplines[name] = value;
}
-void VContainer::AddLengthArc(const qint64 &id)
+void VContainer::AddLengthArc(const quint32 &id)
{
const VArc * arc = GeometricObject(id);
- lengthArcs[arc->name()] = toMM(arc->GetLength());
+ lengthArcs[arc->name()] = qApp->fromPixel(arc->GetLength());
}
void VContainer::AddLineAngle(const QString &name, const qreal &value)
@@ -248,33 +242,42 @@ void VContainer::AddLineAngle(const QString &name, const qreal &value)
lineAngles[name] = value;
}
-qreal VContainer::GetValueStandardTableCell(const QString& name) const
+qreal VContainer::GetValueStandardTableRow(const QString& name) const
{
- VStandardTableRow cell = GetStandardTableCell(name);
- qreal k_size = ( static_cast (size()/10.0) - 50.0 ) / 2.0;
- qreal k_growth = ( static_cast (growth()/10.0) - 176.0 ) / 6.0;
- qreal value = cell.GetBase() + k_size*cell.GetKsize() + k_growth*cell.GetKgrowth();
- return value;
+ const VMeasurement m = GetMeasurement(name);
+ if (qApp->patternType() == Pattern::Individual)
+ {
+ return m.GetValue();
+ }
+ else
+ {
+ return m.GetValue(size(), height());
+ }
}
qreal VContainer::GetValueIncrementTableRow(const QString& name) const
{
- VIncrementTableRow cell = GetIncrementTableRow(name);
- qreal k_size = ( static_cast (size()/10.0) - 50.0 ) / 2.0;
- qreal k_growth = ( static_cast (growth()/10.0) - 176.0 ) / 6.0;
- qreal value = cell.getBase() + k_size*cell.getKsize() + k_growth*cell.getKgrowth();
- return value;
+ const VIncrement icr = GetIncrement(name);
+ if (qApp->patternType() == Pattern::Individual)
+ {
+ return icr.GetValue();
+ }
+ else
+ {
+ return icr.GetValue(size(), height());
+ }
}
void VContainer::Clear()
{
_id = 0;
- standardTable.clear();
- incrementTable.clear();
+ measurements.clear();
+ increments.clear();
lengthLines.clear();
lengthArcs.clear();
lineAngles.clear();
details.clear();
+ lengthSplines.clear();
ClearGObjects();
}
@@ -291,11 +294,11 @@ void VContainer::ClearCalculationGObjects()
{
if (gObjects.size()>0)
{
- QHashIterator i(gObjects);
+ QHashIterator i(gObjects);
while (i.hasNext())
{
i.next();
- if (i.value()->getMode() == Draw::Calculation)
+ if (i.value()->getMode() == Valentina::Calculation)
{
delete i.value();
gObjects.remove(i.key());
@@ -306,18 +309,22 @@ void VContainer::ClearCalculationGObjects()
qreal VContainer::FindVar(const QString &name, bool *ok)const
{
- if (base.contains(name))
+ if (sizeName == name)
{
*ok = true;
- return base.value(name);
+ return _size;
}
-
- if (standardTable.contains(name))
+ if (heightName == name)
{
*ok = true;
- return GetValueStandardTableCell(name);
+ return _height;
}
- if (incrementTable.contains(name))
+ if (measurements.contains(name))
+ {
+ *ok = true;
+ return GetValueStandardTableRow(name);
+ }
+ if (increments.contains(name))
{
*ok = true;
return GetValueIncrementTableRow(name);
@@ -346,27 +353,27 @@ qreal VContainer::FindVar(const QString &name, bool *ok)const
return 0;
}
-void VContainer::AddLine(const qint64 &firstPointId, const qint64 &secondPointId)
+void VContainer::AddLine(const quint32 &firstPointId, const quint32 &secondPointId)
{
QString nameLine = GetNameLine(firstPointId, secondPointId);
const VPointF *first = GeometricObject(firstPointId);
const VPointF *second = GeometricObject(secondPointId);
- AddLengthLine(nameLine, toMM(QLineF(first->toQPointF(), second->toQPointF()).length()));
+ AddLengthLine(nameLine, qApp->fromPixel(QLineF(first->toQPointF(), second->toQPointF()).length()));
nameLine = GetNameLineAngle(firstPointId, secondPointId);
AddLineAngle(nameLine, QLineF(first->toQPointF(), second->toQPointF()).angle());
}
template
-qint64 VContainer::AddObject(QHash &obj, val value)
+quint32 VContainer::AddObject(QHash &obj, val value)
{
Q_CHECK_PTR(value);
- qint64 id = getNextId();
+ quint32 id = getNextId();
value->setId(id);
obj[id] = value;
return id;
}
-QString VContainer::GetNameLine(const qint64 &firstPoint, const qint64 &secondPoint) const
+QString VContainer::GetNameLine(const quint32 &firstPoint, const quint32 &secondPoint) const
{
const VPointF *first = GeometricObject(firstPoint);
const VPointF *second = GeometricObject(secondPoint);
@@ -374,7 +381,7 @@ QString VContainer::GetNameLine(const qint64 &firstPoint, const qint64 &secondPo
return QString("Line_%1_%2").arg(first->name(), second->name());
}
-QString VContainer::GetNameLineAngle(const qint64 &firstPoint, const qint64 &secondPoint) const
+QString VContainer::GetNameLineAngle(const quint32 &firstPoint, const quint32 &secondPoint) const
{
const VPointF *first = GeometricObject(firstPoint);
const VPointF *second = GeometricObject(secondPoint);
@@ -382,12 +389,12 @@ QString VContainer::GetNameLineAngle(const qint64 &firstPoint, const qint64 &sec
return QString("AngleLine_%1_%2").arg(first->name(), second->name());
}
-void VContainer::UpdateGObject(qint64 id, VGObject* obj)
+void VContainer::UpdateGObject(quint32 id, VGObject* obj)
{
UpdateObject(gObjects, id, obj);
}
-void VContainer::UpdateDetail(qint64 id, const VDetail &detail)
+void VContainer::UpdateDetail(quint32 id, const VDetail &detail)
{
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
details[id] = detail;
@@ -399,65 +406,3 @@ void VContainer::AddLengthLine(const QString &name, const qreal &value)
Q_ASSERT(name.isEmpty() == false);
lengthLines[name] = value;
}
-
-void VContainer::CreateManTableIGroup ()
-{
- AddStandardTableCell("Pkor", VStandardTableRow(84, 0, 3));
- AddStandardTableCell("Vtos", VStandardTableRow(1450, 2, 51));
- AddStandardTableCell("Vtosh", VStandardTableRow(1506, 2, 54));
- AddStandardTableCell("Vpt", VStandardTableRow(1438, 3, 52));
- AddStandardTableCell("Vst", VStandardTableRow(1257, -1, 49));
- AddStandardTableCell("Vlt", VStandardTableRow(1102, 0, 43));
- AddStandardTableCell("Vk", VStandardTableRow(503, 0, 22));
- AddStandardTableCell("Vsht", VStandardTableRow(1522, 2, 54));
- AddStandardTableCell("Vzy", VStandardTableRow(1328, 0, 49));
- AddStandardTableCell("Vlop", VStandardTableRow(1320, 0, 49));
- AddStandardTableCell("Vps", VStandardTableRow(811, -1, 36));
- AddStandardTableCell("Ssh", VStandardTableRow(202, 4, 1));
- AddStandardTableCell("SgI", VStandardTableRow(517, 18, 2));
- AddStandardTableCell("SgII", VStandardTableRow(522, 19, 1));
- AddStandardTableCell("SgIII", VStandardTableRow(500, 20, 0));
- AddStandardTableCell("SbI", VStandardTableRow(482, 12, 6));
- AddStandardTableCell("Obed", VStandardTableRow(566, 18, 6));
- AddStandardTableCell("Ok", VStandardTableRow(386, 8, 8));
- AddStandardTableCell("Oi", VStandardTableRow(380, 8, 6));
- AddStandardTableCell("Osch", VStandardTableRow(234, 4, 4));
- AddStandardTableCell("Dsb", VStandardTableRow(1120, 0, 44));
- AddStandardTableCell("Dsp", VStandardTableRow(1110, 0, 43));
- AddStandardTableCell("Dn", VStandardTableRow(826, -3, 37));
- AddStandardTableCell("Dps", VStandardTableRow(316, 4, 7));
- AddStandardTableCell("Dpob", VStandardTableRow(783, 14, 15));
- AddStandardTableCell("Ds", VStandardTableRow(260, 1, 6));
- AddStandardTableCell("Op", VStandardTableRow(316, 12, 0));
- AddStandardTableCell("Ozap", VStandardTableRow(180, 4, 0));
- AddStandardTableCell("Pkis", VStandardTableRow(250, 4, 0));
- AddStandardTableCell("SHp", VStandardTableRow(160, 1, 4));
- AddStandardTableCell("Dlych", VStandardTableRow(500, 2, 15));
- AddStandardTableCell("Dzap", VStandardTableRow(768, 2, 24));
- AddStandardTableCell("DIIIp", VStandardTableRow(970, 2, 29));
- AddStandardTableCell("Vprp", VStandardTableRow(214, 3, 3));
- AddStandardTableCell("Vg", VStandardTableRow(262, 8, 3));
- AddStandardTableCell("Dtp", VStandardTableRow(460, 7, 9));
- AddStandardTableCell("Dp", VStandardTableRow(355, 5, 5));
- AddStandardTableCell("Vprz", VStandardTableRow(208, 3, 5));
- AddStandardTableCell("Dts", VStandardTableRow(438, 2, 10));
- AddStandardTableCell("DtsI", VStandardTableRow(469, 2, 10));
- AddStandardTableCell("Dvcht", VStandardTableRow(929, 9, 19));
- AddStandardTableCell("SHg", VStandardTableRow(370, 14, 4));
- AddStandardTableCell("Cg", VStandardTableRow(224, 6, 0));
- AddStandardTableCell("SHs", VStandardTableRow(416, 10, 2));
- AddStandardTableCell("dpzr", VStandardTableRow(121, 6, 0));
- AddStandardTableCell("Ogol", VStandardTableRow(576, 4, 4));
- AddStandardTableCell("Ssh1", VStandardTableRow(205, 5, 0));
-
- //TODO Posible duplicate. Need check.
- //AddStandardTableCell("St", VStandardTableRow(410, 20, 0));
- AddStandardTableCell("St", VStandardTableRow(390, 20, 0));
-
- AddStandardTableCell("Drzap", VStandardTableRow(594, 3, 19));
- AddStandardTableCell("DbII", VStandardTableRow(1020, 0, 44));
-
- //TODO Posible duplicate. Need check.
- //AddStandardTableCell("Sb", VStandardTableRow(504, 15, 4));
- AddStandardTableCell("Sb", VStandardTableRow(492, 15, 5));
-}
diff --git a/src/container/vcontainer.h b/src/container/vcontainer.h
index 87508a6b8..6ccf5c1e1 100644
--- a/src/container/vcontainer.h
+++ b/src/container/vcontainer.h
@@ -29,8 +29,8 @@
#ifndef VCONTAINER_H
#define VCONTAINER_H
-#include "vstandardtablerow.h"
-#include "vincrementtablerow.h"
+#include "vmeasurement.h"
+#include "vincrement.h"
#include "../geometry/varc.h"
#include "../geometry/vsplinepath.h"
#include "../geometry/vdetail.h"
@@ -62,10 +62,9 @@ public:
VContainer(const VContainer &data);
~VContainer();
template
- void CopyGObject(const VContainer &data, const qint64 &id)
+ void CopyGObject(const VContainer &data, const quint32 &id)
{
T *obj = new T(*data.GeometricObject(id));
- Q_CHECK_PTR(obj);
UpdateGObject(id, obj);
}
/**
@@ -74,9 +73,9 @@ public:
*/
void setData(const VContainer &data);
template
- const T GeometricObject(qint64 id) const
+ const T GeometricObject(const quint32 &id) const
{
- VGObject *gObj = 0;
+ VGObject *gObj = nullptr;
if (gObjects.contains(id))
{
gObj = gObjects.value(id);
@@ -84,10 +83,21 @@ public:
else
{
throw VExceptionBadId(tr("Can't find object"), id);
+ return nullptr;
}
- T obj = dynamic_cast(gObj);
- Q_CHECK_PTR(obj);
- return obj;
+
+ try
+ {
+ T obj = dynamic_cast(gObj);
+ Q_CHECK_PTR(obj);
+ return obj;
+ }
+ catch (const std::bad_alloc &)
+ {
+ throw VExceptionBadId(tr("Can't cast object"), id);
+ return nullptr;
+ }
+ return nullptr;
}
/**
@@ -95,19 +105,19 @@ public:
* @param id id of point
* @return point
*/
- const VGObject *GetGObject(qint64 id) const;
+ const VGObject *GetGObject(quint32 id) const;
/**
- * @brief GetStandardTableCell return standard table row by name
- * @param name name of standard table row
- * @return row of standard table
+ * @brief GetMeasurement return measurement by name
+ * @param name short measurement name
+ * @return measurement
*/
- const VStandardTableRow GetStandardTableCell(const QString& name) const;
+ const VMeasurement GetMeasurement(const QString& name) const;
/**
- * @brief GetIncrementTableRow return increment table row by name
+ * @brief GetIncrement return increment table row by name
* @param name name of increment table row
- * @return row of increment table
+ * @return increment
*/
- const VIncrementTableRow GetIncrementTableRow(const QString& name) const;
+ const VIncrement GetIncrement(const QString& name) const;
/**
* @brief GetLine return length of line by name
* @param name name of line
@@ -137,37 +147,36 @@ public:
* @param id id of detail
* @return detail
*/
- const VDetail GetDetail(qint64 id) const;
+ const VDetail GetDetail(quint32 id) const;
/**
* @brief getId return current id
* @return current id
*/
- static qint64 getId() {return _id;}
+ static quint32 getId() {return _id;}
/**
* @brief AddPoint add new point to container
* @param point new point
* @return return id of new point in container
*/
- qint64 AddGObject(VGObject *obj);
+ quint32 AddGObject(VGObject *obj);
/**
* @brief AddDetail add new detail to container
* @param detail new detail
* @return return id of new detail in container
*/
- qint64 AddDetail(VDetail detail);
+ quint32 AddDetail(VDetail detail);
/**
- * @brief AddStandardTableCell add new row of standard table
- * @param name name of row of standard table
- * @param cell row of standard table
+ * @brief AddMeasurement add new measurement
+ * @param name short measurement name
+ * @param row measurement
*/
- inline void AddStandardTableCell(const QString& name, const VStandardTableRow &cell)
- {standardTable[name] = cell;}
+ void AddMeasurement(const QString& name, const VMeasurement &m);
/**
- * @brief AddIncrementTableRow add new row of increment table
+ * @brief AddIncrement add new row of increment table
* @param name name of new row of increment table
* @param row new row of increment table
*/
- void AddIncrementTableRow(const QString& name, VIncrementTableRow row);
+ void AddIncrement(const QString& name, VIncrement incr);
/**
* @brief AddLengthLine add length of line to container
* @param name name of line
@@ -184,7 +193,7 @@ public:
* @brief AddLengthArc add length of arc to container
* @param id id of arc
*/
- void AddLengthArc(const qint64 &id);
+ void AddLengthArc(const quint32 &id);
/**
* @brief AddLineAngle add angle of line to container
* @param name name of line angle
@@ -197,7 +206,7 @@ public:
* @param secondPointId id of second point of line
* @param mode mode of line
*/
- void AddLine(const qint64 &firstPointId, const qint64 &secondPointId);
+ void AddLine(const quint32 &firstPointId, const quint32 &secondPointId);
/**
* @brief GetNameLine return name of line
* @param firstPoint id of first point of line
@@ -205,7 +214,7 @@ public:
* @return name of line
*/
// cppcheck-suppress functionStatic
- QString GetNameLine(const qint64 &firstPoint, const qint64 &secondPoint) const;
+ QString GetNameLine(const quint32 &firstPoint, const quint32 &secondPoint) const;
/**
* @brief GetNameLineAngle return name of line angle
* @param firstPoint id of first point of line
@@ -213,39 +222,37 @@ public:
* @return name of angle of line
*/
// cppcheck-suppress functionStatic
- QString GetNameLineAngle(const qint64 &firstPoint, const qint64 &secondPoint) const;
+ QString GetNameLineAngle(const quint32 &firstPoint, const quint32 &secondPoint) const;
/**
* @brief UpdatePoint update point by id
* @param id id of existing point
* @param point point
*/
- void UpdateGObject(qint64 id, VGObject* obj);
+ void UpdateGObject(quint32 id, VGObject* obj);
/**
* @brief UpdateDetail update detail by id
* @param id id of existing detail
* @param detail detail
*/
- void UpdateDetail(qint64 id, const VDetail &detail);
+ void UpdateDetail(quint32 id, const VDetail &detail);
/**
- * @brief UpdateStandardTableCell update standard table row by name
- * @param name name of row
- * @param cell row of standard table
+ * @brief UpdateMeasurement update measurement by name
+ * @param name short measurement name
+ * @param m measurement
*/
- inline void UpdateStandardTableCell(const QString& name, VStandardTableRow cell)
- {standardTable[name] = cell;}
+ void UpdateMeasurement(const QString& name, VMeasurement m);
/**
- * @brief UpdateIncrementTableRow update increment table row by name
+ * @brief UpdateIncrement update increment table row by name
* @param name name of row
* @param row row
*/
- inline void UpdateIncrementTableRow(const QString& name, VIncrementTableRow row)
- {incrementTable[name] = row;}
+ void UpdateIncrement(const QString& name, VIncrement incr);
/**
- * @brief GetValueStandardTableCell return value of standard table row by name
- * @param name name of row
- * @return value in mm
+ * @brief GetValueStandardTableRow return value of measurement by name
+ * @param name name of measurement
+ * @return value in measurement units
*/
- qreal GetValueStandardTableCell(const QString& name) const;
+ qreal GetValueStandardTableRow(const QString& name) const;
/**
* @brief GetValueIncrementTableRow return value of increment table row by name
* @param name name of row
@@ -264,44 +271,49 @@ public:
/**
* @brief ClearIncrementTable clear increment table
*/
- inline void ClearIncrementTable() {incrementTable.clear();}
+ void ClearIncrementTable();
+ void ClearMeasurements();
/**
* @brief ClearLengthLines clear length lines
*/
- inline void ClearLengthLines() {lengthLines.clear();}
+ void ClearLengthLines();
/**
* @brief ClearLengthSplines clear length splines
*/
- inline void ClearLengthSplines() {lengthSplines.clear();}
+ void ClearLengthSplines();
/**
* @brief ClearLengthArcs clear length arcs
*/
- inline void ClearLengthArcs() {lengthArcs.clear();}
+ void ClearLengthArcs();
/**
* @brief ClearLineAngles clear angles of lines
*/
- inline void ClearLineAngles() {lineAngles.clear();}
- inline void ClearDetails() {details.clear();}
+ void ClearLineAngles();
+ void ClearDetails();
/**
* @brief SetSize set value of size
- * @param size value of size in mm
+ * @param size value of size
*/
- inline void SetSize(qint32 size) {base["Сг"] = size;}
+ void SetSize(qreal size);
+ void SetSizeName(const QString &name);
/**
* @brief SetGrowth set value of growth
- * @param growth value of growth in mm
+ * @param growth value of growth
*/
- inline void SetGrowth(qint32 growth) {base["Р"] = growth;}
+ void SetHeight(qreal height);
+ void SetHeightName(const QString &name);
/**
* @brief size return size
* @return size in mm
*/
- inline qint32 size() const {return base.value("Сг");}
+ qreal size() const;
+ QString SizeName()const;
/**
- * @brief growth return growth
- * @return growth in mm
+ * @brief height return height
+ * @return height in pattern units
*/
- inline qint32 growth() const {return base.value("Р");}
+ qreal height() const;
+ QString HeightName()const;
/**
* @brief FindVar return value of variable by name
* @param name name of variable
@@ -314,92 +326,83 @@ public:
* @param name name of row
* @return true if contains
*/
- inline bool IncrementTableContains(const QString& name) {return incrementTable.contains(name);}
+ bool IncrementTableContains(const QString& name);
/**
* @brief getNextId generate next unique id
* @return next unique id
*/
- static qint64 getNextId();
+ static quint32 getNextId();
/**
* @brief RemoveIncrementTableRow remove row by name from increment table
* @param name name of existing row
*/
- inline void RemoveIncrementTableRow(const QString& name) {incrementTable.remove(name);}
+ void RemoveIncrementTableRow(const QString& name);
/**
* @brief data container with datagObjects return container of gObjects
* @return pointer on container of gObjects
*/
- inline const QHash *DataGObjects() const {return &gObjects;}
+ const QHash *DataGObjects() const;
/**
- * @brief data container with dataBase return container of data
- * @return pointer on container of base data
+ * @brief DataMeasurements container with measurements.
+ * @return pointer to measurements.
*/
- inline const QHash *DataBase() const {return &base;}
+ const QHash *DataMeasurements() const;
/**
- * @brief data container with dataStandardTable return container of standard table
- * @return pointer on container of standard table
- */
- inline const QHash *DataStandardTable() const {return &standardTable;}
- /**
- * @brief data container with dataIncrementTable return container of increment table
+ * @brief data container with dataIncrements return container of increment table
* @return pointer on container of increment table
*/
- inline const QHash *DataIncrementTable() const {return &incrementTable;}
+ const QHash *DataIncrements() const;
/**
* @brief data container with dataLengthLines return container of lines lengths
* @return pointer on container of lines lengths
*/
- inline const QHash *DataLengthLines() const {return &lengthLines;}
+ const QHash *DataLengthLines() const;
/**
* @brief data container with dataLengthSplines return container of splines lengths
* @return pointer on container of splines lengths
*/
- inline const QHash *DataLengthSplines() const {return &lengthSplines;}
+ const QHash *DataLengthSplines() const;
/**
* @brief data container with dataLengthArcs return container of arcs length
* @return pointer on container of arcs length
*/
- inline const QHash *DataLengthArcs() const {return &lengthArcs;}
+ const QHash *DataLengthArcs() const;
/**
* @brief data container with dataLineAngles return container of angles of line
* @return pointer on container of angles of line
*/
- inline const QHash *DataLineAngles() const {return &lineAngles;}
+ const QHash *DataLineAngles() const;
/**
* @brief data container with dataDetails return container of details
* @return pointer on container of details
*/
- inline const QHash *DataDetails() const {return &details;}
+ const QHash *DataDetails() const;
/**
* @brief UpdateId update id. If new id bigger when current save new like current.
* @param newId id
*/
- static void UpdateId(qint64 newId);
- /**
- * @brief CreateManTableIGroup generate man standard table of measurements
- */
- void CreateManTableIGroup ();
+ static void UpdateId(quint32 newId);
private:
/**
* @brief _id current id. New object will have value +1. For empty class equal 0.
*/
- static qint64 _id;
- /**
- * @brief base container of base data (size and growth)
- */
- QHash base;
+ static quint32 _id;
+ qreal _size;
+ QString sizeName;
+ qreal _height;
+ QString heightName;
/**
* @brief gObjects graphicals objects of pattern.
*/
- QHash gObjects;
+ QHash gObjects;
/**
- * @brief standardTable container of standard table rows
+ * @brief measurements container of measurements.
*/
- QHash standardTable;
+ QHash measurements;
/**
- * @brief incrementTable
+ * @brief increments
*/
- QHash incrementTable;
+ QHash increments;
/**
* @brief lengthLines container of lines lengths
*/
@@ -419,7 +422,7 @@ private:
/**
* @brief details container of details
*/
- QHash details;
+ QHash details;
template
/**
* @brief GetObject return object from container
@@ -445,7 +448,7 @@ private:
* @param id id of existing object
* @param point object
*/
- void UpdateObject(QHash &obj, const qint64 &id, val point);
+ void UpdateObject(QHash &obj, const quint32 &id, val point);
template
/**
* @brief AddObject add object to container
@@ -453,7 +456,147 @@ private:
* @param value object
* @return id of object in container
*/
- static qint64 AddObject(QHash &obj, val value);
+ static quint32 AddObject(QHash &obj, val value);
};
+inline void VContainer::AddMeasurement(const QString &name, const VMeasurement &m)
+{
+ measurements[name] = m;
+}
+
+inline void VContainer::UpdateMeasurement(const QString &name, VMeasurement m)
+{
+ measurements[name] = m;
+}
+
+inline void VContainer::UpdateIncrement(const QString &name, VIncrement incr)
+{
+ increments[name] = incr;
+}
+
+inline void VContainer::ClearIncrementTable()
+{
+ increments.clear();
+}
+
+inline void VContainer::ClearMeasurements()
+{
+ measurements.clear();
+}
+
+inline void VContainer::ClearLengthLines()
+{
+ lengthLines.clear();
+}
+
+inline void VContainer::ClearLengthSplines()
+{
+ lengthSplines.clear();
+}
+
+inline void VContainer::ClearLengthArcs()
+{
+ lengthArcs.clear();
+}
+
+inline void VContainer::ClearLineAngles()
+{
+ lineAngles.clear();
+}
+
+inline void VContainer::ClearDetails()
+{
+ details.clear();
+}
+
+inline void VContainer::SetSize(qreal size)
+{
+ _size = size;
+}
+
+inline void VContainer::SetSizeName(const QString &name)
+{
+ sizeName = name;
+}
+
+inline void VContainer::SetHeight(qreal height)
+{
+ _height = height;
+}
+
+inline void VContainer::SetHeightName(const QString &name)
+{
+ heightName = name;
+}
+
+inline qreal VContainer::size() const
+{
+ return _size;
+}
+
+inline QString VContainer::SizeName() const
+{
+ return sizeName;
+}
+
+inline qreal VContainer::height() const
+{
+ return _height;
+}
+
+inline QString VContainer::HeightName() const
+{
+ return heightName;
+}
+
+inline bool VContainer::IncrementTableContains(const QString &name)
+{
+ return increments.contains(name);
+}
+
+inline void VContainer::RemoveIncrementTableRow(const QString &name)
+{
+ increments.remove(name);
+}
+
+inline const QHash *VContainer::DataGObjects() const
+{
+ return &gObjects;
+}
+
+inline const QHash *VContainer::DataMeasurements() const
+{
+ return &measurements;
+}
+
+inline const QHash *VContainer::DataIncrements() const
+{
+ return &increments;
+}
+
+inline const QHash *VContainer::DataLengthLines() const
+{
+ return &lengthLines;
+}
+
+inline const QHash *VContainer::DataLengthSplines() const
+{
+ return &lengthSplines;
+}
+
+inline const QHash *VContainer::DataLengthArcs() const
+{
+ return &lengthArcs;
+}
+
+inline const QHash *VContainer::DataLineAngles() const
+{
+ return &lineAngles;
+}
+
+inline const QHash *VContainer::DataDetails() const
+{
+ return &details;
+}
+
#endif // VCONTAINER_H
diff --git a/src/container/vincrementtablerow.cpp b/src/container/vincrement.cpp
similarity index 68%
rename from src/container/vincrementtablerow.cpp
rename to src/container/vincrement.cpp
index 7b7b00655..bcabed46c 100644
--- a/src/container/vincrementtablerow.cpp
+++ b/src/container/vincrement.cpp
@@ -26,10 +26,22 @@
**
*************************************************************************/
-#include "vincrementtablerow.h"
+#include "vincrement.h"
-VIncrementTableRow::VIncrementTableRow()
- :id(0), base(0), ksize(0), kgrowth(0), description(QString()){}
+VIncrement::VIncrement()
+ :id(0), base(0), ksize(50.0), kheight(176.0), description(QString()){}
-VIncrementTableRow::VIncrementTableRow(qint64 id, qreal base, qreal ksize, qreal kgrowth, QString description)
- :id(id), base(base), ksize(ksize), kgrowth(kgrowth), description(description){}
+VIncrement::VIncrement(quint32 id, qreal base, qreal ksize, qreal kheight, QString description)
+ :id(id), base(base), ksize(ksize), kheight(kheight), description(description){}
+
+qreal VIncrement::GetValue() const
+{
+ return base;
+}
+
+qreal VIncrement::GetValue(const qreal &size, const qreal &height) const
+{
+ const qreal k_size = ( size - 50.0 ) / 2.0;
+ const qreal k_height = ( height - 176.0 ) / 6.0;
+ return base + k_size * ksize + k_height * kheight;
+}
diff --git a/src/container/vincrementtablerow.h b/src/container/vincrement.h
similarity index 65%
rename from src/container/vincrementtablerow.h
rename to src/container/vincrement.h
index 493967569..943dc6683 100644
--- a/src/container/vincrementtablerow.h
+++ b/src/container/vincrement.h
@@ -32,15 +32,15 @@
#include
/**
- * @brief The VIncrementTableRow class keep data row of increment table
+ * @brief The VIncrement class keep data row of increment table
*/
-class VIncrementTableRow
+class VIncrement
{
public:
/**
* @brief VIncrementTableRow create enpty row
*/
- VIncrementTableRow();
+ VIncrement();
/**
* @brief VIncrementTableRow create row
* @param id id
@@ -49,63 +49,64 @@ public:
* @param kgrowth increment in growths
* @param description description of increment
*/
- VIncrementTableRow(qint64 id, qreal base, qreal ksize, qreal kgrowth,
- QString description = QString());
+ VIncrement(quint32 id, qreal base, qreal ksize, qreal kheight, QString description = QString());
/**
* @brief getId return id of row
* @return id
*/
- inline qint64 getId() const {return id;}
+ quint32 getId() const;
/**
* @brief setId set id of row
* @param value id
*/
- inline void setId(const qint64 &value) {id = value;}
+ void setId(const quint32 &value);
/**
* @brief getBase return value in base size and growth
* @return value
*/
- inline qreal getBase() const {return base;}
+ qreal getBase() const;
/**
* @brief setBase set value in base size and growth
* @param value base value
*/
- inline void setBase(const qreal &value) {base = value;}
+ void setBase(const qreal &value);
/**
* @brief getKsize return increment in sizes
* @return increment
*/
- inline qreal getKsize() const {return ksize;}
+ qreal getKsize() const;
/**
* @brief setKsize set increment in sizes
* @param value value of increment
*/
- inline void setKsize(const qreal &value) {ksize = value;}
+ void setKsize(const qreal &value);
/**
- * @brief getKgrowth return increment in growths
+ * @brief getKheight return increment in growths
* @return increment
*/
- inline qreal getKgrowth() const {return kgrowth;}
+ qreal getKheight() const;
/**
- * @brief setKgrowth set increment in growths
+ * @brief setKheight set increment in growths
* @param value value of increment
*/
- inline void setKgrowth(const qreal &value) {kgrowth = value;}
+ void setKheight(const qreal &value);
/**
* @brief getDescription return description
* @return description
*/
- inline QString getDescription() const {return description;}
+ QString getDescription() const;
/**
* @brief setDescription set description for row
* @param value description
*/
- inline void setDescription(const QString &value) {description = value;}
+ void setDescription(const QString &value);
+ qreal GetValue() const;
+ qreal GetValue(const qreal &size, const qreal &height) const;
private:
/**
* @brief id identificator
*/
- qint64 id;
+ quint32 id;
/**
* @brief base value in base size and growth
*/
@@ -117,11 +118,61 @@ private:
/**
* @brief kgrowth increment in growths
*/
- qreal kgrowth;
+ qreal kheight;
/**
* @brief description description of increment
*/
QString description;
};
+inline quint32 VIncrement::getId() const
+{
+ return id;
+}
+
+inline void VIncrement::setId(const quint32 &value)
+{
+ id = value;
+}
+
+inline qreal VIncrement::getBase() const
+{
+ return base;
+}
+
+inline void VIncrement::setBase(const qreal &value)
+{
+ base = value;
+}
+
+inline qreal VIncrement::getKsize() const
+{
+ return ksize;
+}
+
+inline void VIncrement::setKsize(const qreal &value)
+{
+ ksize = value;
+}
+
+inline qreal VIncrement::getKheight() const
+{
+ return kheight;
+}
+
+inline void VIncrement::setKheight(const qreal &value)
+{
+ kheight = value;
+}
+
+inline QString VIncrement::getDescription() const
+{
+ return description;
+}
+
+inline void VIncrement::setDescription(const QString &value)
+{
+ description = value;
+}
+
#endif // VINCREMENTTABLEROW_H
diff --git a/src/container/vmeasurement.cpp b/src/container/vmeasurement.cpp
new file mode 100644
index 000000000..3aa743ce6
--- /dev/null
+++ b/src/container/vmeasurement.cpp
@@ -0,0 +1,67 @@
+/************************************************************************
+ **
+ ** @file vstandardtablecell.cpp
+ ** @author Roman Telezhinsky
+ ** @date November 15, 2013
+ **
+ ** @brief
+ ** @copyright
+ ** This source code is part of the Valentine project, a pattern making
+ ** program, whose allow create and modeling patterns of clothing.
+ ** Copyright (C) 2013 Valentina project
+ ** All Rights Reserved.
+ **
+ ** Valentina is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU General Public License as published by
+ ** the Free Software Foundation, either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** Valentina is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU General Public License for more details.
+ **
+ ** You should have received a copy of the GNU General Public License
+ ** along with Valentina. If not, see .
+ **
+ *************************************************************************/
+
+#include "vmeasurement.h"
+
+VMeasurement::VMeasurement()
+ :base(0), ksize(50.0), kheight(176.0), gui_text(QString()), number(QString()), virtualM(false),
+ _tagName(QString())
+{
+
+}
+
+VMeasurement::VMeasurement(const qreal &base, const qreal &ksize, const qreal &kgrowth,
+ const QString &gui_text, const QString &number, const QString &tagName)
+ :base(base), ksize(ksize), kheight(kgrowth), gui_text(gui_text), number(number), virtualM(false),
+ _tagName(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),
+ _tagName(tagName)
+{
+
+}
+
+qreal VMeasurement::GetValue() const
+{
+ return base;
+}
+
+qreal VMeasurement::GetValue(const qreal &size, const qreal &height) const
+{
+ const qreal k_size = ( size - 50.0 ) / 2.0;
+ const qreal k_height = ( height - 176.0 ) / 6.0;
+ return base + k_size * ksize + k_height * kheight;
+}
+
+
+
+
diff --git a/src/container/vstandardtablerow.h b/src/container/vmeasurement.h
similarity index 55%
rename from src/container/vstandardtablerow.h
rename to src/container/vmeasurement.h
index 7f6298392..4dab3e8f4 100644
--- a/src/container/vstandardtablerow.h
+++ b/src/container/vmeasurement.h
@@ -32,15 +32,15 @@
#include
/**
- * @brief The VStandardTableRow class keep data row of standard table
+ * @brief The VMeasurement class keep data row of standard table
*/
-class VStandardTableRow
+class VMeasurement
{
public:
/**
* @brief VStandardTableRow create empty row
*/
- VStandardTableRow();
+ VMeasurement();
/**
* @brief VStandardTableRow create row
* @param base value in base size and growth
@@ -48,34 +48,45 @@ public:
* @param kgrowth increment in growths
* @param description description of increment
*/
- VStandardTableRow(const qint32 &base, const qreal &ksize, const qreal &kgrowth,
- const QString &description = QString());
- ~VStandardTableRow(){}
+ VMeasurement(const qreal &base, const qreal &ksize, const qreal &kheight,
+ const QString &gui_text = QString(), const QString &number = QString(),
+ const QString &TagName = QString());
+ VMeasurement(const qreal &base, const QString &gui_text = QString(),
+ const QString &number = QString(), const QString &TagName = QString());
+ ~VMeasurement(){}
/**
* @brief GetBase return value in base size and growth
* @return value
*/
- inline qint32 GetBase() const {return base;}
+ qreal GetBase() const;
+ void setBase(const qreal &value);
/**
* @brief GetKsize return increment in sizes
* @return increment
*/
- inline qreal GetKsize() const {return ksize;}
+ qreal GetKsize() const;
/**
* @brief GetKgrowth return increment in growths
* @return increment
*/
- inline qreal GetKgrowth() const {return kgrowth;}
+ qreal GetKheight() const;
/**
* @brief GetDescription return description
* @return description
*/
- inline QString GetDescription() const {return description;}
+ QString GetDescription() const;
+ QString GetNumber() const;
+ qreal GetValue() const;
+ qreal GetValue(const qreal &size, const qreal &height) const;
+ QString TagName() const;
+ void setTagName(const QString &TagName);
+ bool Virtual() const;
+ void setVirtual(bool value);
private:
/**
* @brief base value in base size and growth
*/
- qint32 base;
+ qreal base;
/**
* @brief ksize increment in sizes
*/
@@ -83,11 +94,64 @@ private:
/**
* @brief kgrowth increment in growths
*/
- qreal kgrowth;
+ qreal kheight;
/**
* @brief description description measurement
*/
- QString description;
+ QString gui_text;
+ QString number;
+ bool virtualM;
+ QString _tagName;
};
+inline qreal VMeasurement::GetBase() const
+{
+ return base;
+}
+
+inline void VMeasurement::setBase(const qreal &value)
+{
+ base = value;
+}
+
+inline qreal VMeasurement::GetKsize() const
+{
+ return ksize;
+}
+
+inline qreal VMeasurement::GetKheight() const
+{
+ return kheight;
+}
+
+inline QString VMeasurement::GetDescription() const
+{
+ return gui_text;
+}
+
+inline QString VMeasurement::GetNumber() const
+{
+ return number;
+}
+
+inline QString VMeasurement::TagName() const
+{
+ return _tagName;
+}
+
+inline void VMeasurement::setTagName(const QString &tagName)
+{
+ _tagName = tagName;
+}
+
+inline bool VMeasurement::Virtual() const
+{
+ return virtualM;
+}
+
+inline void VMeasurement::setVirtual(bool value)
+{
+ virtualM = value;
+}
+
#endif // VSTANDARDTABLEROW_H
diff --git a/src/dialogs/configdialog.cpp b/src/dialogs/app/configdialog.cpp
similarity index 88%
rename from src/dialogs/configdialog.cpp
rename to src/dialogs/app/configdialog.cpp
index 1cfdb228b..a5e1a1244 100644
--- a/src/dialogs/configdialog.cpp
+++ b/src/dialogs/app/configdialog.cpp
@@ -29,10 +29,9 @@
#include "configdialog.h"
ConfigDialog::ConfigDialog(QWidget *parent) :
- QDialog(parent), contentsWidget(0), pagesWidget(0), configurationPage(0), patternPage(0)
+ QDialog(parent), contentsWidget(nullptr), pagesWidget(nullptr), configurationPage(nullptr), patternPage(nullptr)
{
contentsWidget = new QListWidget;
- Q_CHECK_PTR(contentsWidget);
contentsWidget->setViewMode(QListView::IconMode);
contentsWidget->setIconSize(QSize(96, 84));
contentsWidget->setMovement(QListView::Static);
@@ -41,20 +40,14 @@ ConfigDialog::ConfigDialog(QWidget *parent) :
contentsWidget->setSpacing(12);
pagesWidget = new QStackedWidget;
- Q_CHECK_PTR(pagesWidget);
configurationPage = new ConfigurationPage();
- Q_CHECK_PTR(configurationPage);
pagesWidget->addWidget(configurationPage);
patternPage = new PatternPage();
- Q_CHECK_PTR(patternPage);
pagesWidget->addWidget(patternPage);
QPushButton *applyButton = new QPushButton(tr("Apply"));
- Q_CHECK_PTR(applyButton);
QPushButton *canselButton = new QPushButton(tr("&Cancel"));
- Q_CHECK_PTR(canselButton);
QPushButton *okButton = new QPushButton(tr("&Ok"));
- Q_CHECK_PTR(okButton);
createIcons();
contentsWidget->setCurrentRow(0);
@@ -64,19 +57,16 @@ ConfigDialog::ConfigDialog(QWidget *parent) :
connect(okButton, &QPushButton::clicked, this, &ConfigDialog::Ok);
QHBoxLayout *horizontalLayout = new QHBoxLayout;
- Q_CHECK_PTR(horizontalLayout);
horizontalLayout->addWidget(contentsWidget);
horizontalLayout->addWidget(pagesWidget, 1);
QHBoxLayout *buttonsLayout = new QHBoxLayout;
- Q_CHECK_PTR(buttonsLayout);
buttonsLayout->addStretch(1);
buttonsLayout->addWidget(applyButton);
buttonsLayout->addWidget(canselButton);
buttonsLayout->addWidget(okButton);
QVBoxLayout *mainLayout = new QVBoxLayout;
- Q_CHECK_PTR(mainLayout);
mainLayout->addLayout(horizontalLayout);
mainLayout->addStretch(1);
mainLayout->addSpacing(12);
@@ -107,14 +97,12 @@ void ConfigDialog::closeEvent(QCloseEvent *event)
void ConfigDialog::createIcons()
{
QListWidgetItem *configButton = new QListWidgetItem(contentsWidget);
- Q_CHECK_PTR(configButton);
configButton->setIcon(QIcon("://icon/config.png"));
configButton->setText(tr("Configuration"));
configButton->setTextAlignment(Qt::AlignHCenter);
configButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
QListWidgetItem *patternButton = new QListWidgetItem(contentsWidget);
- Q_CHECK_PTR(patternButton);
patternButton->setIcon(QIcon("://icon/pattern_config.png"));
patternButton->setText(tr("Pattern"));
patternButton->setTextAlignment(Qt::AlignHCenter);
@@ -125,12 +113,12 @@ void ConfigDialog::createIcons()
void ConfigDialog::Apply()
{
- switch(contentsWidget->currentRow())
+ switch (contentsWidget->currentRow())
{
- case(0):
+ case (0):
configurationPage->Apply();
break;
- case(1):
+ case (1):
patternPage->Apply();
break;
default:
diff --git a/src/dialogs/configdialog.h b/src/dialogs/app/configdialog.h
similarity index 97%
rename from src/dialogs/configdialog.h
rename to src/dialogs/app/configdialog.h
index 9acc653aa..d1bfef44f 100644
--- a/src/dialogs/configdialog.h
+++ b/src/dialogs/app/configdialog.h
@@ -40,7 +40,7 @@ class ConfigDialog : public QDialog
{
Q_OBJECT
public:
- explicit ConfigDialog(QWidget *parent = 0);
+ explicit ConfigDialog(QWidget *parent = nullptr);
public slots:
void changePage(QListWidgetItem *current, QListWidgetItem *previous);
protected:
diff --git a/src/dialogs/app/dialoghistory.cpp b/src/dialogs/app/dialoghistory.cpp
new file mode 100644
index 000000000..5c21887d8
--- /dev/null
+++ b/src/dialogs/app/dialoghistory.cpp
@@ -0,0 +1,437 @@
+/************************************************************************
+ **
+ ** @file dialoghistory.cpp
+ ** @author Roman Telezhinsky
+ ** @date November 15, 2013
+ **
+ ** @brief
+ ** @copyright
+ ** This source code is part of the Valentine project, a pattern making
+ ** program, whose allow create and modeling patterns of clothing.
+ ** Copyright (C) 2013 Valentina project
+ ** All Rights Reserved.
+ **
+ ** Valentina is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU General Public License as published by
+ ** the Free Software Foundation, either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** Valentina is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU General Public License for more details.
+ **
+ ** You should have received a copy of the GNU General Public License
+ ** along with Valentina. If not, see .
+ **
+ *************************************************************************/
+
+#include "dialoghistory.h"
+#include "ui_dialoghistory.h"
+#include "../../geometry/varc.h"
+#include "../../geometry/vspline.h"
+#include "../../geometry/vsplinepath.h"
+#include "../../tools/vabstracttool.h"
+#include "../../tools/drawTools/vtoolcutspline.h"
+#include "../../tools/drawTools/vtoolcutsplinepath.h"
+#include "../../tools/drawTools/vtoolcutarc.h"
+#include
+#include
+
+DialogHistory::DialogHistory(VContainer *data, VPattern *doc, QWidget *parent)
+ :DialogTool(data, parent), ui(new Ui::DialogHistory), doc(doc), cursorRow(0),
+ cursorToolRecordRow(0)
+{
+ ui->setupUi(this);
+ bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
+ connect(bOk, &QPushButton::clicked, this, &DialogHistory::DialogAccepted);
+ FillTable();
+ InitialTable();
+ connect(ui->tableWidget, &QTableWidget::cellClicked, this, &DialogHistory::cellClicked);
+ connect(this, &DialogHistory::ShowHistoryTool, doc, &VPattern::ShowHistoryTool);
+ connect(doc, &VPattern::ChangedCursor, this, &DialogHistory::ChangedCursor);
+ connect(doc, &VPattern::patternChanged, this, &DialogHistory::UpdateHistory);
+ connect(doc, &VPattern::ChangedActivDraw, this, &DialogHistory::UpdateHistory);
+ ShowPoint();
+}
+
+DialogHistory::~DialogHistory()
+{
+ delete ui;
+}
+
+void DialogHistory::DialogAccepted()
+{
+ QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0);
+ quint32 id = qvariant_cast(item->data(Qt::UserRole));
+ emit ShowHistoryTool(id, Qt::green, false);
+ emit DialogClosed(QDialog::Accepted);
+}
+
+void DialogHistory::cellClicked(int row, int column)
+{
+ if (column == 0)
+ {
+ QTableWidgetItem *item = ui->tableWidget->item(cursorRow, 0);
+ item->setIcon(QIcon());
+
+ item = ui->tableWidget->item(row, 0);
+ cursorRow = row;
+ item->setIcon(QIcon("://icon/32x32/put_after.png"));
+ quint32 id = qvariant_cast(item->data(Qt::UserRole));
+ disconnect(doc, &VPattern::ChangedCursor, this, &DialogHistory::ChangedCursor);
+ doc->setCursor(id);
+ connect(doc, &VPattern::ChangedCursor, this, &DialogHistory::ChangedCursor);
+ }
+ else
+ {
+ QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0);
+ quint32 id = qvariant_cast(item->data(Qt::UserRole));
+ emit ShowHistoryTool(id, Qt::green, false);
+
+ cursorToolRecordRow = row;
+ item = ui->tableWidget->item(cursorToolRecordRow, 0);
+ id = qvariant_cast(item->data(Qt::UserRole));
+ emit ShowHistoryTool(id, Qt::green, true);
+ }
+}
+
+void DialogHistory::ChangedCursor(quint32 id)
+{
+ for (qint32 i = 0; i< ui->tableWidget->rowCount(); ++i)
+ {
+ QTableWidgetItem *item = ui->tableWidget->item(i, 0);
+ quint32 rId = qvariant_cast(item->data(Qt::UserRole));
+ if (rId == id)
+ {
+ QTableWidgetItem *oldCursorItem = ui->tableWidget->item(cursorRow, 0);
+ oldCursorItem->setIcon(QIcon());
+ cursorRow = i;
+ item->setIcon(QIcon("://icon/32x32/put_after.png"));
+ }
+ }
+}
+
+void DialogHistory::UpdateHistory()
+{
+ FillTable();
+ InitialTable();
+}
+
+void DialogHistory::FillTable()
+{
+ ui->tableWidget->clear();
+ const QVector *history = doc->getHistory();
+ Q_CHECK_PTR(history);
+ qint32 currentRow = -1;
+ qint32 count = 0;
+ ui->tableWidget->setRowCount(history->size());
+ for (qint32 i = 0; i< history->size(); ++i)
+ {
+ const VToolRecord tool = history->at(i);
+ if (tool.getNameDraw() != doc->GetNameActivDraw())
+ {
+ continue;
+ }
+ const QString historyRecord = Record(tool);
+ if (historyRecord.isEmpty() ==false)
+ {
+ currentRow++;
+
+ {
+ QTableWidgetItem *item = new QTableWidgetItem(QString());
+ item->setTextAlignment(Qt::AlignHCenter);
+ item->setData(Qt::UserRole, tool.getId());
+ ui->tableWidget->setItem(currentRow, 0, item);
+ }
+
+ QTableWidgetItem *item = new QTableWidgetItem(historyRecord);
+ item->setFont(QFont("Times", 12, QFont::Bold));
+ item->setFlags(item->flags() ^ Qt::ItemIsEditable);
+ ui->tableWidget->setItem(currentRow, 1, item);
+ ++count;
+ }
+ }
+ ui->tableWidget->setRowCount(count);
+ if (history->size()>0)
+ {
+ cursorRow = currentRow;
+ QTableWidgetItem *item = ui->tableWidget->item(cursorRow, 0);
+ Q_CHECK_PTR(item);
+ item->setIcon(QIcon("://icon/32x32/put_after.png"));
+ }
+ ui->tableWidget->resizeColumnsToContents();
+ ui->tableWidget->resizeRowsToContents();
+ ui->tableWidget->verticalHeader()->setDefaultSectionSize(20);
+}
+
+QString DialogHistory::Record(const VToolRecord &tool)
+{
+ const QDomElement domElement = doc->elementById(QString().setNum(tool.getId()));
+ if (domElement.isElement() == false)
+ {
+ qDebug()<<"Can't find element by id"<GeometricObject(tool.getId())->name();
+ return QString(tr("%1 - Base point")).arg(name);
+ }
+ case Valentina::EndLineTool:
+ {
+ const quint32 basePointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrBasePoint, "0");
+ const QString basePointIdName = data->GeometricObject(basePointId)->name();
+ const QString toolIdName = data->GeometricObject(tool.getId())->name();
+ return QString(tr("%1_%2 - Line from point %1 to point %2")).arg(basePointIdName, toolIdName);
+ }
+ case Valentina::LineTool:
+ {
+ const quint32 firstPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0");
+ const quint32 secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0");
+ const QString firstPointIdName = data->GeometricObject(firstPointId)->name();
+ const QString secondPointIdName = data->GeometricObject(secondPointId)->name();
+ return QString(tr("%1_%2 - Line from point %1 to point %2")).arg(firstPointIdName, secondPointIdName);
+ }
+ case Valentina::AlongLineTool:
+ {
+ const quint32 basePointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0");
+ const quint32 secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0");
+ const QString basePointIdName = data->GeometricObject(basePointId)->name();
+ const QString secondPointIdName = data->GeometricObject(secondPointId)->name();
+ const QString toolIdName = data->GeometricObject(tool.getId())->name();
+ return QString(tr("%3 - Point along line %1_%2")).arg(basePointIdName, secondPointIdName, toolIdName);
+ }
+ case Valentina::ShoulderPointTool:
+ {
+ const QString name = data->GeometricObject(tool.getId())->name();
+ return QString(tr("%1 - Point of shoulder")).arg(name);
+ }
+ case Valentina::NormalTool:
+ {
+ const quint32 basePointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0");
+ const quint32 secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0");
+ const QString basePointIdName = data->GeometricObject(basePointId)->name();
+ const QString secondPointIdName = data->GeometricObject(secondPointId)->name();
+ const QString toolIdName = data->GeometricObject(tool.getId())->name();
+ return QString(tr("%3 - normal to line %1_%2")).arg(basePointIdName, secondPointIdName, toolIdName);
+ }
+ case Valentina::BisectorTool:
+ {
+ const quint32 firstPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0");
+ const quint32 secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0");
+ const quint32 thirdPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrThirdPoint, "0");
+ const QString firstPointIdName = data->GeometricObject(firstPointId)->name();
+ const QString secondPointIdName = data->GeometricObject(secondPointId)->name();
+ const QString thirdPointIdName = data->GeometricObject(thirdPointId)->name();
+ const QString toolIdName = data->GeometricObject(tool.getId())->name();
+ return QString(tr("%4 - bisector of angle %1_%2_%3")).arg(firstPointIdName, secondPointIdName,
+ thirdPointIdName, toolIdName);
+ }
+ case Valentina::LineIntersectTool:
+ {
+ const quint32 p1Line1 = doc->GetParametrUInt(domElement, VAbstractTool::AttrP1Line1, "0");
+ const quint32 p2Line1 = doc->GetParametrUInt(domElement, VAbstractTool::AttrP2Line1, "0");
+ const quint32 p1Line2 = doc->GetParametrUInt(domElement, VAbstractTool::AttrP1Line2, "0");
+ const quint32 p2Line2 = doc->GetParametrUInt(domElement, VAbstractTool::AttrP2Line2, "0");
+ const QString p1Line1Name = data->GeometricObject(p1Line1)->name();
+ const QString p2Line1Name = data->GeometricObject(p2Line1)->name();
+ const QString p1Line2Name = data->GeometricObject(p1Line2)->name();
+ const QString p2Line2Name = data->GeometricObject(p2Line2)->name();
+ const QString toolIdName = data->GeometricObject(tool.getId())->name();
+ return QString(tr("%5 - intersection of lines %1_%2 and %3_%4")).arg(p1Line1Name, p2Line1Name,
+ p1Line2Name, p2Line2Name,
+ toolIdName);
+ }
+ case Valentina::SplineTool:
+ {
+ const VSpline *spl = data->GeometricObject(tool.getId());
+ Q_CHECK_PTR(spl);
+ const QString splP1Name = data->GeometricObject(spl->GetP1().id())->name();
+ const QString splP4Name = data->GeometricObject(spl->GetP4().id())->name();
+ return QString(tr("Curve %1_%2")).arg(splP1Name, splP4Name);
+ }
+ case Valentina::ArcTool:
+ {
+ const VArc *arc = data->GeometricObject(tool.getId());
+ Q_CHECK_PTR(arc);
+ const QString arcCenterName = data->GeometricObject(arc->GetCenter().id())->name();
+ return QString(tr("Arc with center in point %1")).arg(arcCenterName);
+ }
+ case Valentina::SplinePathTool:
+ {
+ const VSplinePath *splPath = data->GeometricObject(tool.getId());
+ Q_CHECK_PTR(splPath);
+ const QVector points = splPath->GetSplinePath();
+ QString record;
+ if (points.size() != 0 )
+ {
+ const QString pName = data->GeometricObject(points.at(0).P().id())->name();
+ record = QString(tr("Curve point %1")).arg(pName);
+ if (points.size() > 1)
+ {
+ const QString pName = data->GeometricObject(points.last().P().id())->name();
+ record.append(QString("_%1").arg(pName));
+ }
+ }
+ else
+ {
+ qDebug()<<"Not enough points in splinepath"<GetParametrUInt(domElement, VAbstractTool::AttrCenter, "0");
+ const quint32 firstPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0");
+ const quint32 secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0");
+ const QString firstPointIdName = data->GeometricObject(firstPointId)->name();
+ const QString centerName = data->GeometricObject(center)->name();
+ const QString secondPointIdName = data->GeometricObject(secondPointId)->name();
+ const QString toolIdName = data->GeometricObject(tool.getId())->name();
+ return QString(tr("%4 - point of contact of arc with the center in point %1 and line %2_%3")).arg(
+ centerName, firstPointIdName, secondPointIdName, toolIdName);
+ }
+ case Valentina::Height:
+ {
+ const quint32 basePointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrBasePoint, "0");
+ const quint32 p1LineId = doc->GetParametrUInt(domElement, VAbstractTool::AttrP1Line, "0");
+ const quint32 p2LineId = doc->GetParametrUInt(domElement, VAbstractTool::AttrP2Line, "0");
+ const QString basePointIdName = data->GeometricObject(basePointId)->name();
+ const QString p1LineIdName = data->GeometricObject(p1LineId)->name();
+ const QString p2LineIdName = data->GeometricObject(p2LineId)->name();
+ return QString(tr("Point of perpendicular from point %1 to line %2_%3")).arg(basePointIdName,
+ p1LineIdName,
+ p2LineIdName);
+ }
+ case Valentina::Triangle:
+ {
+ const quint32 axisP1Id = doc->GetParametrUInt(domElement, VAbstractTool::AttrAxisP1, "0");
+ const quint32 axisP2Id = doc->GetParametrUInt(domElement, VAbstractTool::AttrAxisP2, "0");
+ const quint32 firstPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0");
+ const quint32 secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0");
+ const QString axisP1IdName = data->GeometricObject(axisP1Id)->name();
+ const QString axisP2IdName = data->GeometricObject(axisP2Id)->name();
+ const QString firstPointIdName = data->GeometricObject(firstPointId)->name();
+ const QString secondPointIdName = data->GeometricObject(secondPointId)->name();
+ return QString(tr("Triangle: axis %1_%2, points %3 and %4")).arg(axisP1IdName, axisP2IdName,
+ firstPointIdName, secondPointIdName);
+ }
+ case Valentina::PointOfIntersection:
+ {
+ const quint32 firstPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0");
+ const quint32 secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0");
+ const QString firstPointIdName = data->GeometricObject(firstPointId)->name();
+ const QString secondPointIdName = data->GeometricObject(secondPointId)->name();
+ const QString toolIdName = data->GeometricObject(tool.getId())->name();
+ return QString(tr("%1 - point of intersection %2 and %3")).arg(toolIdName, firstPointIdName,
+ secondPointIdName);
+ }
+ case Valentina::CutArcTool:
+ {
+ const quint32 arcId = doc->GetParametrUInt(domElement, VToolCutArc::AttrArc, "0");
+ const VArc *arc = data->GeometricObject(arcId);
+ Q_CHECK_PTR(arc);
+ const QString arcCenterName = data->GeometricObject(arc->GetCenter().id())->name();
+ const QString toolIdName = data->GeometricObject(tool.getId())->name();
+ return QString(tr("%1 - cut arc with center %2")).arg(toolIdName, arcCenterName);
+ }
+ case Valentina::CutSplineTool:
+ {
+ const quint32 splineId = doc->GetParametrUInt(domElement, VToolCutSpline::AttrSpline, "0");
+ const VSpline *spl = data->GeometricObject(splineId);
+ Q_CHECK_PTR(spl);
+ const QString toolIdName = data->GeometricObject(tool.getId())->name();
+ const QString splP1Name = data->GeometricObject(spl->GetP1().id())->name();
+ const QString splP4Name = data->GeometricObject(spl->GetP4().id())->name();
+ return QString(tr("%1 - cut curve %2_%3")).arg(toolIdName, splP1Name, splP4Name);
+ }
+ case Valentina::CutSplinePathTool:
+ {
+ const quint32 splinePathId = doc->GetParametrUInt(domElement, VToolCutSplinePath::AttrSplinePath, "0");
+ const VSplinePath *splPath = data->GeometricObject(splinePathId);
+ Q_CHECK_PTR(splPath);
+ const QVector points = splPath->GetSplinePath();
+ QString record;
+ if (points.size() != 0 )
+ {
+ const QString toolIdName = data->GeometricObject(tool.getId())->name();
+ const QString pName = data->GeometricObject(points.at(0).P().id())->name();
+ record = QString(tr("%1 - cut curve path %2")).arg(toolIdName, pName);
+ if (points.size() > 1)
+ {
+ const QString pName = data->GeometricObject(points.last().P().id())->name();
+ const QString name = QString("_%1").arg(pName);
+ record.append(name);
+ }
+ }
+ else
+ {
+ qDebug()<<"Not enough points in splinepath"<tableWidget->setSortingEnabled(false);
+ ui->tableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem(" "));
+ ui->tableWidget->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Tool")));
+}
+
+void DialogHistory::ShowPoint()
+{
+ QVector *history = doc->getHistory();
+ if (history->size()>0)
+ {
+ QTableWidgetItem *item = ui->tableWidget->item(0, 1);
+ item->setSelected(true);
+ cursorToolRecordRow = 0;
+ item = ui->tableWidget->item(0, 0);
+ quint32 id = qvariant_cast(item->data(Qt::UserRole));
+ emit ShowHistoryTool(id, Qt::green, true);
+ }
+}
+
+void DialogHistory::closeEvent(QCloseEvent *event)
+{
+ QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0);
+ quint32 id = qvariant_cast(item->data(Qt::UserRole));
+ emit ShowHistoryTool(id, Qt::green, false);
+ DialogTool::closeEvent(event);
+}
diff --git a/src/dialogs/dialoghistory.h b/src/dialogs/app/dialoghistory.h
similarity index 91%
rename from src/dialogs/dialoghistory.h
rename to src/dialogs/app/dialoghistory.h
index 120fff0ee..9b1337df4 100644
--- a/src/dialogs/dialoghistory.h
+++ b/src/dialogs/app/dialoghistory.h
@@ -29,8 +29,8 @@
#ifndef DIALOGHISTORY_H
#define DIALOGHISTORY_H
-#include "dialogtool.h"
-#include "../xml/vdomdocument.h"
+#include "../tools/dialogtool.h"
+#include "../../xml/vpattern.h"
namespace Ui
{
@@ -50,7 +50,7 @@ public:
* @param doc dom document container
* @param parent parent widget
*/
- DialogHistory(VContainer *data, VDomDocument *doc, QWidget *parent = 0);
+ DialogHistory(VContainer *data, VPattern *doc, QWidget *parent = nullptr);
virtual ~DialogHistory();
public slots:
/**
@@ -67,7 +67,7 @@ public slots:
* @brief ChangedCursor changed cursor of input. Cursor show after what record we will insert new object
* @param id id of object
*/
- void ChangedCursor(qint64 id);
+ void ChangedCursor(quint32 id);
/**
* @brief UpdateHistory update history table
*/
@@ -79,7 +79,7 @@ signals:
* @param color new color of tool
* @param enable true enable selection, false disable selection
*/
- void ShowHistoryTool(qint64 id, Qt::GlobalColor color, bool enable);
+ void ShowHistoryTool(quint32 id, Qt::GlobalColor color, bool enable);
protected:
/**
* @brief closeEvent handle when windows is closing
@@ -95,7 +95,7 @@ private:
/**
* @brief doc dom document container
*/
- VDomDocument *doc;
+ VPattern *doc;
/**
* @brief cursorRow save number of row where is cursor
*/
diff --git a/src/dialogs/dialoghistory.ui b/src/dialogs/app/dialoghistory.ui
similarity index 100%
rename from src/dialogs/dialoghistory.ui
rename to src/dialogs/app/dialoghistory.ui
diff --git a/src/dialogs/app/dialogincrements.cpp b/src/dialogs/app/dialogincrements.cpp
new file mode 100644
index 000000000..1012c1d26
--- /dev/null
+++ b/src/dialogs/app/dialogincrements.cpp
@@ -0,0 +1,749 @@
+/************************************************************************
+ **
+ ** @file dialogincrements.cpp
+ ** @author Roman Telezhinsky
+ ** @date November 15, 2013
+ **
+ ** @brief
+ ** @copyright
+ ** This source code is part of the Valentine project, a pattern making
+ ** program, whose allow create and modeling patterns of clothing.
+ ** Copyright (C) 2013 Valentina project
+ ** All Rights Reserved.
+ **
+ ** Valentina is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU General Public License as published by
+ ** the Free Software Foundation, either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** Valentina is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU General Public License for more details.
+ **
+ ** You should have received a copy of the GNU General Public License
+ ** along with Valentina. If not, see .
+ **
+ *************************************************************************/
+
+#include "dialogincrements.h"
+#include "ui_dialogincrements.h"
+#include "../../widgets/doubledelegate.h"
+#include "../../widgets/textdelegate.h"
+#include "../../exception/vexception.h"
+#include "../../xml/vstandardmeasurements.h"
+
+#include
+#include
+
+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)
+{
+ ui->setupUi(this);
+
+ if (qApp->patternType() == Pattern::Individual)
+ {
+ const QString filePath = doc->MPath();
+ try
+ {
+ VDomDocument::ValidateXML("://schema/individual_measurements.xsd", filePath);
+ m = new VIndividualMeasurements(data);
+ m->setContent(filePath);
+ }
+ catch(VException &e)
+ {
+ e.CriticalMessageBox(tr("File error."), this);
+ emit DialogClosed(QDialog::Rejected);
+ return;
+ }
+ }
+
+ //Same regex in each shema files. Don't forget synchronize.
+ TextDelegate *textDelegate = new TextDelegate("^([^0-9-*/^+=\\s\\(\\)%:;!]){1,1}([^-*/^+=\\s\\(\\)%:;!]){0,}$",
+ ui->tableWidgetIncrement);
+ ui->tableWidgetIncrement->setItemDelegateForColumn(0, textDelegate);// name
+ DoubleSpinBoxDelegate *doubleDelegate = new DoubleSpinBoxDelegate(ui->tableWidgetIncrement);
+ ui->tableWidgetIncrement->setItemDelegateForColumn(2, doubleDelegate);// base value
+ ui->tableWidgetIncrement->setItemDelegateForColumn(3, doubleDelegate);// in sizes
+ ui->tableWidgetIncrement->setItemDelegateForColumn(4, doubleDelegate);// in heights
+
+ FillMeasurements();
+ FillIncrements();
+ FillLengthLines();
+ FillLengthSplines();
+ FillLengthArcs();
+
+ if (qApp->patternType() == Pattern::Standard)
+ {
+ ui->pagePersonalInformation->setVisible(false);
+ }
+ else
+ {
+ QRegExpValidator *reg = new QRegExpValidator(QRegExp("\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*"));
+ ui->lineEditMail->setValidator(reg);
+
+ ui->tableWidgetMeasurements->setColumnHidden( 1, true );// calculated value
+ ui->tableWidgetMeasurements->setColumnHidden( 3, true );// in sizes
+ ui->tableWidgetMeasurements->setColumnHidden( 4, true );// in heights
+
+ ui->tableWidgetIncrement->setColumnHidden( 1, true );// calculated value
+ ui->tableWidgetIncrement->setColumnHidden( 3, true );// in sizes
+ ui->tableWidgetIncrement->setColumnHidden( 4, true );// in heights
+
+ ui->tableWidgetMeasurements->setItemDelegateForColumn(2, doubleDelegate);// base value
+
+ connect(ui->tableWidgetMeasurements, &QTableWidget::cellChanged, this, &DialogIncrements::MeasurementChanged);
+
+ ui->lineEditGivenName->setText(m->GivenName());
+ ui->lineEditFamilyName->setText(m->FamilyName());
+
+ ui->comboBoxSex->addItem(tr("male"),QVariant(m->GenderToStr(VIndividualMeasurements::Male)));
+ ui->comboBoxSex->addItem(tr("female"),QVariant(m->GenderToStr(VIndividualMeasurements::Female)));
+ qint32 index = ui->comboBoxSex->findData(m->GenderToStr(m->Sex()));
+ if (index != -1)
+ {
+ ui->comboBoxSex->setCurrentIndex(index);
+ }
+
+ ui->dateEditBirthDate->setDate(m->BirthDate());
+ ui->lineEditMail->setText(m->Mail());
+
+ connect(ui->lineEditGivenName, &QLineEdit::editingFinished, this, &DialogIncrements::SaveGivenName);
+ connect(ui->lineEditFamilyName, &QLineEdit::editingFinished, this, &DialogIncrements::SaveFamilyName);
+ connect(ui->lineEditMail, &QLineEdit::editingFinished, this, &DialogIncrements::SaveEmail);
+ connect(ui->comboBoxSex, static_cast(&QComboBox::currentIndexChanged), this,
+ &DialogIncrements::SaveSex);
+ connect(ui->dateEditBirthDate, &QDateEdit::dateChanged, this, &DialogIncrements::SaveBirthDate);
+ }
+
+ ui->toolBoxMeasurements->setCurrentIndex(1);
+
+ connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, &DialogIncrements::IncrementChanged);
+ connect(ui->toolButtonAdd, &QPushButton::clicked, this, &DialogIncrements::clickedToolButtonAdd);
+ connect(ui->toolButtonRemove, &QPushButton::clicked, this, &DialogIncrements::clickedToolButtonRemove);
+
+ connect(this, &DialogIncrements::FullUpdateTree, this->doc, &VPattern::FullUpdateTree);
+ connect(this, &DialogIncrements::haveLiteChange, this->doc, &VPattern::haveLiteChange);
+ connect(this->doc, &VPattern::FullUpdateFromFile, this, &DialogIncrements::FullUpdateFromFile);
+
+ ui->tabWidget->setCurrentIndex(0);
+
+ connect(ui->toolButtonOpenMeasurements, &QToolButton::clicked, this, &DialogIncrements::OpenTable);
+}
+
+void DialogIncrements::FillMeasurements()
+{
+ const QHash *table = data->DataMeasurements();
+ QHashIterator i(*table);
+ QMap map;
+ //Sorting QHash by id
+ while (i.hasNext())
+ {
+ i.next();
+ map.insert(i.key(), i.value());
+ }
+ qint32 currentRow = -1;
+ QMapIterator iMap(map);
+ ui->tableWidgetMeasurements->setRowCount ( table->size() );
+ while (iMap.hasNext())
+ {
+ iMap.next();
+ VMeasurement m = iMap.value();
+ currentRow++;
+
+ QTableWidgetItem *item = new QTableWidgetItem(QString(iMap.key()));
+ item->setTextAlignment(Qt::AlignHCenter);
+ item->setFont(QFont("Times", 12, QFont::Bold));
+ item->setToolTip(m.GetDescription());
+ // set the item non-editable (view only), and non-selectable
+ Qt::ItemFlags flags = item->flags();
+ flags &= ~(Qt::ItemIsSelectable | Qt::ItemIsEditable); // reset/clear the flag
+ item->setFlags(flags);
+ ui->tableWidgetMeasurements->setItem(currentRow, 0, item);
+
+ if (qApp->patternType() == Pattern::Standard)
+ {
+ QTableWidgetItem *item = new QTableWidgetItem(QString().setNum(data->GetValueStandardTableRow(iMap.key())));
+ item->setTextAlignment(Qt::AlignHCenter);
+ // set the item non-editable (view only), and non-selectable
+ Qt::ItemFlags flags = item->flags();
+ flags &= ~(Qt::ItemIsSelectable | Qt::ItemIsEditable); // reset/clear the flag
+ item->setFlags(flags);
+ ui->tableWidgetMeasurements->setItem(currentRow, 1, item);
+ }
+
+ item = new QTableWidgetItem(QString().setNum(m.GetBase()));
+ item->setTextAlignment(Qt::AlignHCenter);
+ ui->tableWidgetMeasurements->setItem(currentRow, 2, item);
+
+ if (qApp->patternType() == Pattern::Standard)
+ {
+ QTableWidgetItem *item = new QTableWidgetItem(QString().setNum(m.GetKsize()));
+ item->setTextAlignment(Qt::AlignHCenter);
+ // set the item non-editable (view only), and non-selectable
+ Qt::ItemFlags flags = item->flags();
+ flags &= ~(Qt::ItemIsSelectable | Qt::ItemIsEditable); // reset/clear the flag
+ item->setFlags(flags);
+ ui->tableWidgetMeasurements->setItem(currentRow, 3, item);
+
+ item = new QTableWidgetItem(QString().setNum(m.GetKheight()));
+ item->setTextAlignment(Qt::AlignHCenter);
+ // set the item non-editable (view only), and non-selectable
+ flags = item->flags();
+ flags &= ~(Qt::ItemIsSelectable | Qt::ItemIsEditable); // reset/clear the flag
+ item->setFlags(flags);
+ ui->tableWidgetMeasurements->setItem(currentRow, 4, item);
+ }
+
+ item = new QTableWidgetItem(m.GetNumber());
+ item->setTextAlignment(Qt::AlignHCenter);
+ // set the item non-editable (view only), and non-selectable
+ flags = item->flags();
+ flags &= ~(Qt::ItemIsSelectable | Qt::ItemIsEditable); // reset/clear the flag
+ item->setFlags(flags);
+ ui->tableWidgetMeasurements->setItem(currentRow, 5, item);
+ }
+ ui->tableWidgetMeasurements->verticalHeader()->setDefaultSectionSize(20);
+ ui->tableWidgetMeasurements->resizeColumnsToContents();
+ ui->tableWidgetMeasurements->resizeRowsToContents();
+}
+
+void DialogIncrements::FillIncrements()
+{
+ const QHash *increments = data->DataIncrements();
+ QHashIterator i(*increments);
+ QMap map;
+ //Sorting QHash by id
+ while (i.hasNext())
+ {
+ i.next();
+ VIncrement incr = i.value();
+ map.insert(incr.getId(), i.key());
+ }
+
+ qint32 currentRow = -1;
+ QMapIterator iMap(map);
+ while (iMap.hasNext())
+ {
+ iMap.next();
+ VIncrement incr = increments->value(iMap.value());
+ currentRow++;
+ ui->tableWidgetIncrement->setRowCount ( increments->size() );
+
+ QTableWidgetItem *item = new QTableWidgetItem(iMap.value());
+ item->setTextAlignment(Qt::AlignHCenter);
+ item->setFont(QFont("Times", 12, QFont::Bold));
+ item->setData(Qt::UserRole, incr.getId());
+ ui->tableWidgetIncrement->setItem(currentRow, 0, item);
+
+ if (qApp->patternType() == Pattern::Standard)
+ {
+ item = new QTableWidgetItem(QString().setNum(data->GetValueIncrementTableRow(iMap.value())));
+ item->setTextAlignment(Qt::AlignHCenter);
+ // set the item non-editable (view only), and non-selectable
+ Qt::ItemFlags flags = item->flags();
+ flags &= ~(Qt::ItemIsSelectable | Qt::ItemIsEditable); // reset/clear the flag
+ item->setFlags(flags);
+ ui->tableWidgetIncrement->setItem(currentRow, 1, item);
+ }
+
+ item = new QTableWidgetItem(QString().setNum(incr.getBase()));
+ item->setTextAlignment(Qt::AlignHCenter);
+ ui->tableWidgetIncrement->setItem(currentRow, 2, item);
+
+ if (qApp->patternType() == Pattern::Standard)
+ {
+ item = new QTableWidgetItem(QString().setNum(incr.getKsize()));
+ item->setTextAlignment(Qt::AlignHCenter);
+ ui->tableWidgetIncrement->setItem(currentRow, 3, item);
+
+ item = new QTableWidgetItem(QString().setNum(incr.getKheight()));
+ item->setTextAlignment(Qt::AlignHCenter);
+ ui->tableWidgetIncrement->setItem(currentRow, 4, item);
+ }
+
+ item = new QTableWidgetItem(incr.getDescription());
+ item->setTextAlignment(Qt::AlignLeft);
+ ui->tableWidgetIncrement->setItem(currentRow, 5, item);
+ }
+ if (ui->tableWidgetIncrement->rowCount()>0)
+ {
+ ui->toolButtonRemove->setEnabled(true);
+ }
+ ui->tableWidgetIncrement->resizeColumnsToContents();
+ ui->tableWidgetIncrement->resizeRowsToContents();
+ ui->tableWidgetIncrement->setCurrentCell( row, column );
+}
+
+void DialogIncrements::FillLengthLines()
+{
+ const QHash *linesTable = data->DataLengthLines();
+ QHashIterator iHash(*linesTable);
+ QMap map;
+ //Sorting QHash by name
+ while (iHash.hasNext())
+ {
+ iHash.next();
+ map.insert(iHash.key(), iHash.value());
+ }
+
+ qint32 currentRow = -1;
+ QMapIterator i(map);
+ while (i.hasNext())
+ {
+ i.next();
+ qreal length = i.value();
+ currentRow++;
+ ui->tableWidgetLines->setRowCount ( linesTable->size() );
+
+ QTableWidgetItem *item = new QTableWidgetItem(QString(i.key()));
+ item->setTextAlignment(Qt::AlignHCenter);
+ item->setFont(QFont("Times", 12, QFont::Bold));
+ ui->tableWidgetLines->setItem(currentRow, 0, item);
+
+ item = new QTableWidgetItem(QString().setNum(length));
+ item->setTextAlignment(Qt::AlignHCenter);
+ ui->tableWidgetLines->setItem(currentRow, 1, item);
+ }
+ ui->tableWidgetLines->resizeColumnsToContents();
+ ui->tableWidgetLines->resizeRowsToContents();
+ ui->tableWidgetLines->verticalHeader()->setDefaultSectionSize(20);
+}
+
+void DialogIncrements::FillLengthSplines()
+{
+ const QHash *splinesTable = data->DataLengthSplines();
+ QHashIterator iHash(*splinesTable);
+ QMap map;
+ //Sorting QHash by name
+ while (iHash.hasNext())
+ {
+ iHash.next();
+ map.insert(iHash.key(), iHash.value());
+ }
+
+ qint32 currentRow = -1;
+ QMapIterator i(map);
+ while (i.hasNext())
+ {
+ i.next();
+ qreal length = i.value();
+ currentRow++;
+ ui->tableWidgetSplines->setRowCount ( splinesTable->size() );
+
+ QTableWidgetItem *item = new QTableWidgetItem(QString(i.key()));
+ item->setTextAlignment(Qt::AlignLeft);
+ item->setFont(QFont("Times", 12, QFont::Bold));
+ ui->tableWidgetSplines->setItem(currentRow, 0, item);
+
+ item = new QTableWidgetItem(QString().setNum(length));
+ item->setTextAlignment(Qt::AlignHCenter);
+ ui->tableWidgetSplines->setItem(currentRow, 1, item);
+ }
+ ui->tableWidgetSplines->resizeColumnsToContents();
+ ui->tableWidgetSplines->resizeRowsToContents();
+ ui->tableWidgetSplines->verticalHeader()->setDefaultSectionSize(20);
+}
+
+void DialogIncrements::FillLengthArcs()
+{
+ const QHash *arcsTable = data->DataLengthArcs();
+ QHashIterator iHash(*arcsTable);
+ QMap map;
+ //Sorting QHash by name
+ while (iHash.hasNext())
+ {
+ iHash.next();
+ map.insert(iHash.key(), iHash.value());
+ }
+
+ qint32 currentRow = -1;
+ QMapIterator i(map);
+ while (i.hasNext())
+ {
+ i.next();
+ qreal length = i.value();
+ currentRow++;
+ ui->tableWidgetArcs->setRowCount ( arcsTable->size() );
+
+ QTableWidgetItem *item = new QTableWidgetItem(QString(i.key()));
+ item->setTextAlignment(Qt::AlignHCenter);
+ item->setFont(QFont("Times", 12, QFont::Bold));
+ ui->tableWidgetArcs->setItem(currentRow, 0, item);
+
+ item = new QTableWidgetItem(QString().setNum(length));
+ item->setTextAlignment(Qt::AlignHCenter);
+ ui->tableWidgetArcs->setItem(currentRow, 1, item);
+ }
+ ui->tableWidgetArcs->verticalHeader()->setDefaultSectionSize(20);
+ ui->tableWidgetArcs->resizeColumnsToContents();
+ ui->tableWidgetArcs->resizeRowsToContents();
+}
+
+void DialogIncrements::FullUpdateFromFile()
+{
+ disconnect(ui->tableWidgetMeasurements, &QTableWidget::cellChanged, this, &DialogIncrements::MeasurementChanged);
+ ui->tableWidgetMeasurements->clearContents();
+ FillMeasurements();
+ connect(ui->tableWidgetMeasurements, &QTableWidget::cellChanged, this, &DialogIncrements::MeasurementChanged);
+
+ disconnect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, &DialogIncrements::IncrementChanged);
+ ui->tableWidgetIncrement->clearContents();
+ FillIncrements();
+ connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, &DialogIncrements::IncrementChanged);
+
+ ui->tableWidgetLines->clearContents();
+ FillLengthLines();
+
+ ui->tableWidgetSplines->clearContents();
+ FillLengthSplines();
+
+ ui->tableWidgetArcs->clearContents();
+ FillLengthArcs();
+}
+
+void DialogIncrements::SaveGivenName()
+{
+ m->setGivenName(ui->lineEditGivenName->text());
+ if (m->SaveDocument(doc->MPath()) == false)
+ {
+ qDebug()<<"Can't save GivenName";
+ }
+}
+
+void DialogIncrements::SaveFamilyName()
+{
+
+ m->setFamilyName(ui->lineEditFamilyName->text());
+ if (m->SaveDocument(doc->MPath()) == false)
+ {
+ qDebug()<<"Can't save FamilyName";
+ }
+}
+
+void DialogIncrements::SaveEmail()
+{
+ m->setMail(ui->lineEditMail->text());
+ if (m->SaveDocument(doc->MPath()) == false)
+ {
+ qDebug()<<"Can't save Email";
+ }
+}
+
+void DialogIncrements::SaveSex(int index)
+{
+ m->setSex(m->StrToGender(ui->comboBoxSex->itemData(index).toString()));
+ if (m->SaveDocument(doc->MPath()) == false)
+ {
+ qDebug()<<"Can't save Sex";
+ }
+}
+
+void DialogIncrements::SaveBirthDate(const QDate & date)
+{
+ m->setBirthDate(date);
+ if (m->SaveDocument(doc->MPath()) == false)
+ {
+ qDebug()<<"Can't save BirthDate";
+ }
+}
+
+void DialogIncrements::OpenTable()
+{
+ QString text = tr("Measurements use different units than pattern. This pattern required measurements in %1")
+ .arg(doc->UnitsToStr(qApp->patternUnit()));
+ if (qApp->patternType() == Pattern::Individual)
+ {
+ const QString filter(tr("Individual measurements (*.vit)"));
+ const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), QDir::homePath(), filter);
+ if (filePath.isEmpty())
+ {
+ return;
+ }
+
+ VIndividualMeasurements *m1 = nullptr;
+ try
+ {
+ VDomDocument::ValidateXML("://schema/individual_measurements.xsd", filePath);
+
+ m1 = new VIndividualMeasurements(data);
+ m1->setContent(filePath);
+ }
+ catch(VException &e)
+ {
+ e.CriticalMessageBox(tr("File error."), this);
+ delete m1;
+ emit DialogClosed(QDialog::Rejected);
+ return;
+ }
+ Valentina::Units mUnit = m1->Unit();
+ if (qApp->patternUnit() != mUnit)
+ {
+ QMessageBox::critical(this, tr("Wrong units."), text);
+ delete m1;
+ return;
+ }
+ delete m;
+ m = m1;
+ data->ClearMeasurements();
+ m->Measurements();
+ emit FullUpdateTree();
+
+ doc->SetPath(filePath);
+ emit haveLiteChange();
+ }
+ else
+ {
+ const QString filter(tr("Standard measurements (*.vst)"));
+ const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), QDir::homePath(), filter);
+ if (filePath.isEmpty())
+ {
+ return;
+ }
+
+ VStandardMeasurements *m1 = nullptr;
+ try
+ {
+ VDomDocument::ValidateXML("://schema/standard_measurements.xsd", filePath);
+
+ m1 = new VStandardMeasurements(data);
+ m1->setContent(filePath);
+ Valentina::Units mUnit = m1->Unit();
+ if (qApp->patternUnit() != mUnit)
+ {
+ QMessageBox::critical(this, tr("Wrong units."), text);
+ delete m1;
+ return;
+ }
+ m1->SetSize();
+ m1->SetHeight();
+ data->ClearMeasurements();
+ m1->Measurements();
+ delete m1;
+ emit FullUpdateTree();
+
+ doc->SetPath(filePath);
+ emit haveLiteChange();
+ }
+ catch(VException &e)
+ {
+ e.CriticalMessageBox(tr("File error."), this);
+ delete m1;
+ emit DialogClosed(QDialog::Rejected);
+ return;
+ }
+ }
+}
+
+void DialogIncrements::clickedToolButtonAdd()
+{
+ ui->tableWidgetIncrement->setFocus(Qt::OtherFocusReason);
+ disconnect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this,
+ &DialogIncrements::IncrementChanged);
+ qint32 currentRow = ui->tableWidgetIncrement->rowCount();
+ ui->tableWidgetIncrement->insertRow( currentRow );
+
+ qint32 num = 1;
+ QString name;
+ do
+ {
+ name = QString(tr("Name_%1")).arg(num);
+ num++;
+ } while (data->IncrementTableContains(name));
+
+ const quint32 id = data->getNextId();
+ const QString description(tr("Description"));
+ VIncrement incr = VIncrement(id, 0, 0, 0, description);
+ data->AddIncrement(name, incr);
+
+ AddIncrementToFile(id, name, 0, 0, 0, description);
+
+ QTableWidgetItem *item = new QTableWidgetItem(name);
+ item->setTextAlignment(Qt::AlignHCenter);
+ item->setFont(QFont("Times", 12, QFont::Bold));
+ item->setData(Qt::UserRole, id);
+ ui->tableWidgetIncrement->setItem(currentRow, 0, item);
+ ui->tableWidgetIncrement->setCurrentCell(currentRow, 0, QItemSelectionModel::ClearAndSelect);
+
+ item = new QTableWidgetItem("0");// calculated value
+ item->setTextAlignment(Qt::AlignHCenter);
+ // set the item non-editable (view only), and non-selectable
+ Qt::ItemFlags flags = item->flags();
+ flags &= ~(Qt::ItemIsSelectable | Qt::ItemIsEditable); // reset/clear the flag
+ item->setFlags(flags);
+ ui->tableWidgetIncrement->setItem(currentRow, 1, item);
+
+ item = new QTableWidgetItem("0");// base value
+ item->setTextAlignment(Qt::AlignHCenter);
+ ui->tableWidgetIncrement->setItem(currentRow, 2, item);
+
+ item = new QTableWidgetItem("0");// in sizes
+ item->setTextAlignment(Qt::AlignHCenter);
+ ui->tableWidgetIncrement->setItem(currentRow, 3, item);
+
+ item = new QTableWidgetItem("0"); // in heights
+ item->setTextAlignment(Qt::AlignHCenter);
+ ui->tableWidgetIncrement->setItem(currentRow, 4, item);
+
+ item = new QTableWidgetItem(description);
+ item->setTextAlignment(Qt::AlignHCenter);
+ ui->tableWidgetIncrement->setItem(currentRow, 5, item);
+
+ ui->toolButtonRemove->setEnabled(true);
+ connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this,
+ &DialogIncrements::IncrementChanged);
+ emit haveLiteChange();
+}
+
+void DialogIncrements::clickedToolButtonRemove()
+{
+ disconnect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this,
+ &DialogIncrements::IncrementChanged);
+ QTableWidgetItem *item = ui->tableWidgetIncrement->currentItem();
+ qint32 row = item->row();
+ QTableWidgetItem *itemName = ui->tableWidgetIncrement->item(row, 0);
+ data->RemoveIncrementTableRow(itemName->text());
+ quint32 id = qvariant_cast(item->data(Qt::UserRole));
+ QDomElement domElement = doc->elementById(QString().setNum(id));
+ if (domElement.isElement())
+ {
+ QDomNodeList list = doc->elementsByTagName(VPattern::TagIncrements);
+ list.at(0).removeChild(domElement);
+ }
+ ui->tableWidgetIncrement->removeRow(row);
+ if (ui->tableWidgetIncrement->rowCount() == 0)
+ {
+ ui->toolButtonRemove->setEnabled(false);
+ }
+ connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this,
+ &DialogIncrements::IncrementChanged);
+ emit haveLiteChange();
+}
+
+void DialogIncrements::AddIncrementToFile(const quint32 &id, const QString &name, const qreal &base, const qreal &ksize,
+ const qreal &kheight, const QString &description)
+{
+ QDomElement element = doc->createElement(VPattern::TagIncrement);
+
+ doc->SetAttribute(element, VDomDocument::AttrId, id);
+ doc->SetAttribute(element, VPattern::IncrementName, name);
+ doc->SetAttribute(element, VPattern::IncrementBase, base);
+ doc->SetAttribute(element, VPattern::IncrementKsize, ksize);
+ doc->SetAttribute(element, VPattern::IncrementKgrowth, kheight);
+ doc->SetAttribute(element, VPattern::IncrementDescription, description);
+
+ QDomNodeList list = doc->elementsByTagName(VPattern::TagIncrements);
+ list.at(0).appendChild(element);
+}
+
+void DialogIncrements::IncrementChanged ( qint32 row, qint32 column )
+{
+
+ const QTableWidgetItem *itemName = ui->tableWidgetIncrement->item(row, 0);
+ const QTableWidgetItem *item = ui->tableWidgetIncrement->item(row, column);
+ const quint32 id = qvariant_cast(itemName->data(Qt::UserRole));
+ QDomElement domElement = doc->elementById(QString().setNum(id));
+ if (domElement.isElement() == false)
+ {
+ qDebug()<<"Cant't find increment with id = "<row = row;
+ switch (column)
+ {
+ case 0: // VPattern::IncrementName
+ doc->SetAttribute(domElement, VPattern::IncrementName, item->text());
+ data->ClearIncrementTable();
+ this->column = 2;
+ emit FullUpdateTree();
+ break;
+ case 2: // VPattern::IncrementBase
+ doc->SetAttribute(domElement, VPattern::IncrementBase, item->text());
+ this->column = 3;
+ emit FullUpdateTree();
+ break;
+ case 3: // VPattern::IncrementKsize
+ doc->SetAttribute(domElement, VPattern::IncrementKsize, item->text());
+ this->column = 4;
+ emit FullUpdateTree();
+ break;
+ case 4: // VPattern::IncrementKgrowth
+ doc->SetAttribute(domElement, VPattern::IncrementKgrowth, item->text());
+ this->column = 5;
+ emit FullUpdateTree();
+ break;
+ case 5: // VPattern::IncrementDescription
+ {
+ doc->SetAttribute(domElement, VPattern::IncrementDescription, item->text());
+ VIncrement incr = data->GetIncrement(itemName->text());
+ incr.setDescription(item->text());
+ data->UpdateIncrement(itemName->text(), incr);
+ ui->tableWidgetIncrement->resizeColumnsToContents();
+ ui->tableWidgetIncrement->resizeRowsToContents();
+ this->column = 0;
+ ui->tableWidgetIncrement->setCurrentCell( row, this->column );
+ break;
+ }
+ default:
+ break;
+ }
+ emit haveLiteChange();
+}
+
+void DialogIncrements::MeasurementChanged(qint32 row, qint32 column)
+{
+ switch (column)
+ {
+ case 2:// value column
+ {
+ const QTableWidgetItem *itemName = ui->tableWidgetMeasurements->item(row, 0);
+ QTableWidgetItem *item = ui->tableWidgetMeasurements->item(row, 2);
+
+ VMeasurement measur = data->GetMeasurement(itemName->text());
+ const QString tag = measur.TagName();
+ QDomNodeList list = m->elementsByTagName(tag);
+ QDomElement domElement = list.at(0).toElement();
+ if (domElement.isElement() == false)
+ {
+ qDebug()<<"Cant't find measurement "<SetAttribute(domElement, VIndividualMeasurements::AttrValue, item->text());
+ if (m->SaveDocument(doc->MPath()) == false)
+ {
+ qDebug()<<"Can't save measurement";
+ }
+ bool ok = false;
+ const qreal base = item->text().replace(",", ".").toDouble(&ok);
+ if (ok == false)
+ {
+ measur.setBase(0);
+ item->setText("0");
+ qDebug()<<"Can't convert toDouble measurement value"<ClearMeasurements();
+ m->Measurements();
+ emit FullUpdateTree();
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+void DialogIncrements::closeEvent(QCloseEvent *event)
+{
+ emit DialogClosed(QDialog::Accepted);
+ event->accept();
+}
+
+DialogIncrements::~DialogIncrements()
+{
+ delete ui;
+ delete m;
+}
diff --git a/src/dialogs/dialogincrements.h b/src/dialogs/app/dialogincrements.h
similarity index 78%
rename from src/dialogs/dialogincrements.h
rename to src/dialogs/app/dialogincrements.h
index 156e0c78f..c988f5b1e 100644
--- a/src/dialogs/dialogincrements.h
+++ b/src/dialogs/app/dialogincrements.h
@@ -29,8 +29,9 @@
#ifndef DIALOGINCREMENTS_H
#define DIALOGINCREMENTS_H
-#include "dialogtool.h"
-#include "../xml/vdomdocument.h"
+#include "../tools/dialogtool.h"
+#include "../../xml/vpattern.h"
+#include "../../xml/vindividualmeasurements.h"
namespace Ui
{
@@ -50,7 +51,7 @@ public:
* @param doc dom document container
* @param parent parent widget
*/
- DialogIncrements(VContainer *data, VDomDocument *doc, QWidget *parent = 0);
+ DialogIncrements(VContainer *data, VPattern *doc, QWidget *parent = nullptr);
~DialogIncrements();
public slots:
/**
@@ -66,11 +67,18 @@ public slots:
* @param row number of row
* @param column number of column
*/
- void cellChanged ( qint32 row, qint32 column );
+ void IncrementChanged ( qint32 row, qint32 column );
+ void MeasurementChanged ( qint32 row, qint32 column );
/**
* @brief FullUpdateFromFile update information in tables form file
*/
void FullUpdateFromFile();
+ void SaveGivenName();
+ void SaveFamilyName();
+ void SaveEmail();
+ void SaveSex(int index);
+ void SaveBirthDate(const QDate & date);
+ void OpenTable();
signals:
/**
* @brief FullUpdateTree signal update data for dom document
@@ -95,7 +103,7 @@ private:
/**
* @brief doc dom document container
*/
- VDomDocument *doc;
+ VPattern *doc;
/**
* @brief row save number of row current selected cell
*/
@@ -104,14 +112,15 @@ private:
* @brief column save number of column current selected cell
*/
qint32 column;
+ VIndividualMeasurements *m;
/**
- * @brief FillStandardTable fill data for standard table
+ * @brief FillMeasurements load measurements data
*/
- void FillStandardTable();
+ void FillMeasurements();
/**
* @brief FillIncrementTable fill data for increment table
*/
- void FillIncrementTable();
+ void FillIncrements();
/**
* @brief FillLengthLines fill data for table of lines lengths
*/
@@ -130,11 +139,11 @@ private:
* @param name name
* @param base base value
* @param ksize increment in sizes
- * @param kgrowth increment in growths
+ * @param kheight increment in heights
* @param description description of increment
*/
- void AddIncrementToFile(qint64 id, QString name, qreal base, qreal ksize, qreal kgrowth,
- QString description);
+ void AddIncrementToFile(const quint32 &id, const QString &name, const qreal &base,
+ const qreal &ksize, const qreal &kheight, const QString &description);
};
#endif // DIALOGINCREMENTS_H
diff --git a/src/dialogs/app/dialogincrements.ui b/src/dialogs/app/dialogincrements.ui
new file mode 100644
index 000000000..f3a0d3c19
--- /dev/null
+++ b/src/dialogs/app/dialogincrements.ui
@@ -0,0 +1,605 @@
+
+
+ DialogIncrements
+
+
+
+ 0
+ 0
+ 979
+ 574
+
+
+
+
+ 800
+ 0
+
+
+
+ Increments
+
+
+
+ :/icon/64x64/icon64x64.png:/icon/64x64/icon64x64.png
+
+
+
+
+
+ -
+
+
+
+ 1
+ 0
+
+
+
+ QTabWidget::North
+
+
+ 1
+
+
+
+
+ 0
+ 0
+
+
+
+ Measurements
+
+
+
-
+
+
+ 6
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Load another measurements table
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ ...
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 1
+
+
+
+
+ 0
+ 0
+
+
+
+ 1
+
+
+
+ true
+
+
+
+ 0
+ 0
+ 939
+ 411
+
+
+
+ Personal information
+
+
+
-
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 84
+ 0
+
+
+
+ Given name
+
+
+
+ -
+
+
+
+
+ -
+
+
+ 6
+
+
+ QLayout::SetDefaultConstraint
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Family name
+
+
+
+ -
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 84
+ 0
+
+
+
+ Birth date
+
+
+
+ -
+
+
+ yyyy-MM-dd
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 84
+ 0
+
+
+
+ Sex
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 84
+ 0
+
+
+
+ Mail
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 939
+ 411
+
+
+
+ Measurements
+
+
+ -
+
+
+ true
+
+
+ QAbstractItemView::AnyKeyPressed|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed
+
+
+ true
+
+
+ QAbstractItemView::SingleSelection
+
+
+ QAbstractItemView::SelectRows
+
+
+ true
+
+
+ false
+
+
+ 95
+
+
+ 25
+
+
+ false
+
+
+ true
+
+
+ false
+
+
+ 45
+
+
+ 8
+
+
+
+ Name
+
+
+
+
+ The calculated value
+
+
+
+
+ Base value
+
+
+
+
+ In sizes
+
+
+
+
+ In heights
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+
+
+
+
+ Increments
+
+
+ -
+
+
+ true
+
+
+ QAbstractItemView::SingleSelection
+
+
+ false
+
+
+ true
+
+
+ false
+
+
+ 95
+
+
+ 17
+
+
+ false
+
+
+ true
+
+
+ false
+
+
+ false
+
+
+ 20
+
+
+ false
+
+
+
+ Name
+
+
+
+
+ The calculated value
+
+
+
+
+ Base value
+
+
+
+
+ In sizes
+
+
+
+
+ In heights
+
+
+
+
+ Description
+
+
+
+
+ -
+
+
+ ...
+
+
+
+
+
+
+
+
+ -
+
+
+ false
+
+
+ ...
+
+
+
+
+
+
+
+
+
+
+
+
+ Lines
+
+
+ -
+
+
+ QAbstractItemView::NoEditTriggers
+
+
+ true
+
+
+ false
+
+
+ 137
+
+
+ false
+
+
+ false
+
+
+
+ Line
+
+
+
+
+ Length
+
+
+
+
+
+
+
+
+ Curves
+
+
+ -
+
+
+ QAbstractItemView::NoEditTriggers
+
+
+ true
+
+
+ false
+
+
+ 137
+
+
+ false
+
+
+ false
+
+
+
+ Curve
+
+
+
+
+ Length
+
+
+
+
+
+
+
+
+ Arcs
+
+
+ -
+
+
+ QAbstractItemView::NoEditTriggers
+
+
+ true
+
+
+ false
+
+
+ 137
+
+
+ false
+
+
+ false
+
+
+
+ Arc
+
+
+
+
+ Length
+
+
+
+
+
+
+
+
+
+
+
+ tableWidgetMeasurements
+ tableWidgetIncrement
+ toolButtonAdd
+ toolButtonRemove
+ tableWidgetLines
+ tableWidgetSplines
+ tableWidgetArcs
+
+
+
+
+
+
diff --git a/src/dialogs/app/dialogindividualmeasurements.cpp b/src/dialogs/app/dialogindividualmeasurements.cpp
new file mode 100644
index 000000000..ef332c049
--- /dev/null
+++ b/src/dialogs/app/dialogindividualmeasurements.cpp
@@ -0,0 +1,287 @@
+/************************************************************************
+ **
+ ** @file dialogindividualmeasurements.cpp
+ ** @author Roman Telezhinsky
+ ** @date 22 2, 2014
+ **
+ ** @brief
+ ** @copyright
+ ** This source code is part of the Valentine project, a pattern making
+ ** program, whose allow create and modeling patterns of clothing.
+ ** Copyright (C) 2013 Valentina project
+ ** All Rights Reserved.
+ **
+ ** Valentina is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU General Public License as published by
+ ** the Free Software Foundation, either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** Valentina is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU General Public License for more details.
+ **
+ ** You should have received a copy of the GNU General Public License
+ ** along with Valentina. If not, see .
+ **
+ *************************************************************************/
+
+#include "dialogindividualmeasurements.h"
+#include "ui_dialogindividualmeasurements.h"
+#include
+#include "../../xml/vindividualmeasurements.h"
+#include
+#include
+#include
+#include "../../widgets/vapplication.h"
+
+DialogIndividualMeasurements::DialogIndividualMeasurements(VContainer *data, const QString &patternPieceName,
+ QWidget *parent) :
+ QDialog(parent), ui(new Ui::DialogIndividualMeasurements), _name(patternPieceName), _tablePath(QString()),
+ data(data)
+{
+ ui->setupUi(this);
+
+ {
+ const QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
+ Q_CHECK_PTR(bOk);
+ connect(bOk, &QPushButton::clicked, this, &DialogIndividualMeasurements::DialogAccepted);
+ }
+ {
+ const QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
+ Q_CHECK_PTR(bCansel);
+ connect(bCansel, &QPushButton::clicked, this, &DialogIndividualMeasurements::DialogRejected);
+ }
+
+ ui->lineEditName->setText(_name);
+
+ LoadIndividualTables();
+ InitUnits();
+
+ CheckState();
+ connect(ui->lineEditName, &QLineEdit::textChanged, this, &DialogIndividualMeasurements::CheckState);
+ connect(ui->buttonGroupPath, static_cast(&QButtonGroup::buttonClicked), this,
+ &DialogIndividualMeasurements::CheckState);
+ connect(ui->toolButtonOpenExist, &QToolButton::clicked, this, &DialogIndividualMeasurements::OpenTable);
+ connect(ui->toolButtonOpenNew, &QToolButton::clicked, this, &DialogIndividualMeasurements::NewTable);
+}
+
+DialogIndividualMeasurements::~DialogIndividualMeasurements()
+{
+ delete ui;
+}
+
+void DialogIndividualMeasurements::DialogAccepted()
+{
+ _name = ui->lineEditName->text();
+ if (ui->radioButtonExistM->isChecked())
+ {
+ _tablePath = ui->lineEditPathExistM->text();
+ }
+ else
+ {
+ _tablePath = ui->lineEditPathNewM->text();
+ QFile table(_tablePath);
+ if (table.exists())
+ {
+ table.remove();
+ }
+
+ const qint32 index = ui->comboBoxLang->currentIndex();
+ QString path = ui->comboBoxLang->itemData(index).toString();
+ QFile iMeasur(path);
+ if ( iMeasur.copy(_tablePath) == false )
+ {
+ QMessageBox::warning(this, tr("Could not create measurements file"), tr("Please try again or change file"));
+ DialogRejected();
+ }
+ }
+ try
+ {
+ VDomDocument::ValidateXML("://schema/individual_measurements.xsd", _tablePath);
+ VIndividualMeasurements m(data);
+ m.setContent(_tablePath);
+ const qint32 index = ui->comboBoxUnits->currentIndex();
+ Valentina::Units unit = VDomDocument::StrToUnits(ui->comboBoxUnits->itemData(index).toString());
+ m.setUnit(unit);
+ qApp->setPatternUnit( m.Unit());
+ QFile iMeasur(_tablePath);
+ if (iMeasur.open(QIODevice::WriteOnly| QIODevice::Truncate))
+ {
+ const int indent = 4;
+ QTextStream out(&iMeasur);
+ out.setCodec("UTF-8");
+ m.save(out, indent);
+ iMeasur.close();
+ }
+ }
+ catch(VException &e)
+ {
+ e.CriticalMessageBox(tr("File error."), this);
+ qDebug()<<"File error."<lineEditName->text().isEmpty() == false)
+ {
+ flagName = true;
+ }
+
+ bool flagPath = false;
+ if (ui->radioButtonExistM->isChecked())
+ {
+ ui->lineEditPathExistM->setEnabled(true);
+ ui->toolButtonOpenExist->setEnabled(true);
+
+ ui->lineEditPathNewM->setEnabled(false);
+ ui->toolButtonOpenNew->setEnabled(false);
+ ui->comboBoxLang->setEnabled(false);
+ ui->comboBoxUnits->setEnabled(false);
+
+ if (ui->lineEditPathExistM->text().isEmpty() == false)
+ {
+ flagPath = true;
+ }
+ }
+ else
+ {
+ ui->lineEditPathNewM->setEnabled(true);
+ ui->toolButtonOpenNew->setEnabled(true);
+ ui->comboBoxLang->setEnabled(true);
+ ui->comboBoxUnits->setEnabled(true);
+
+ ui->toolButtonOpenExist->setEnabled(false);
+ ui->lineEditPathExistM->setEnabled(false);
+
+ if (ui->lineEditPathNewM->text().isEmpty() == false)
+ {
+ flagPath = true;
+ }
+ }
+
+ bool flagLang = false;
+ {
+ const QComboBox *box = ui->comboBoxLang;
+ Q_CHECK_PTR(box);
+ if (box->count() > 0 && box->currentIndex() != -1)
+ {
+ flagLang = true;
+ }
+ }
+
+ QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
+ Q_CHECK_PTR(bOk);
+ bOk->setEnabled(flagName && flagPath && flagLang);
+}
+
+void DialogIndividualMeasurements::LoadIndividualTables()
+{
+ QStringList filters;
+ filters << "*.vit";
+ QDir tablesDir(qApp->pathToTables());
+ tablesDir.setNameFilters(filters);
+ tablesDir.setCurrent(qApp->pathToTables());
+
+ const QStringList allFiles = tablesDir.entryList(QDir::NoDotAndDotDot | QDir::Files);
+ if (allFiles.isEmpty() == true)
+ {
+ ui->comboBoxLang->clear();
+ CheckState();
+ return;
+ }
+
+ for (int i = 0; i < allFiles.size(); ++i)
+ {
+ QFileInfo fi(allFiles.at(i));
+ try
+ {
+ VDomDocument::ValidateXML("://schema/individual_measurements.xsd", fi.absoluteFilePath());
+ VIndividualMeasurements m(data);
+ m.setContent(fi.absoluteFilePath());
+ const QString lang = QLocale(m.Language()).nativeLanguageName();
+ ui->comboBoxLang->addItem(lang, QVariant(fi.absoluteFilePath()));
+ }
+ catch(VException &e)
+ {
+ qDebug()<<"File error."<comboBoxLang->findData(checkedLocale);
+ if (index != -1)
+ {
+ ui->comboBoxLang->setCurrentIndex(index);
+ }
+}
+
+void DialogIndividualMeasurements::OpenTable()
+{
+ const QString filter(tr("Individual measurements (*.vit)"));
+ QString fileName = QFileDialog::getOpenFileName(this, tr("Open file"), QDir::homePath(), filter);
+ if (fileName.isEmpty())
+ {
+ return;
+ }
+
+ try
+ {
+ VDomDocument::ValidateXML("://schema/individual_measurements.xsd", fileName);
+ }
+ catch(VException &e)
+ {
+ e.CriticalMessageBox(tr("File error."), this);
+ fileName.clear();
+ }
+ ui->lineEditPathExistM->setText(fileName);
+ ui->lineEditPathExistM->setToolTip(fileName);
+ CheckState();
+}
+
+void DialogIndividualMeasurements::NewTable()
+{
+ QString dir = QDir::homePath()+"/measurements.vit";
+ QString name = QFileDialog::getSaveFileName(this, tr("Where save measurements?"), dir,
+ tr("Individual measurements (*.vit)"));
+
+ if (name.isEmpty())
+ {
+ return;
+ }
+
+ // what if the users did not specify a suffix...?
+ QFileInfo f( name );
+ if (f.suffix().isEmpty() && f.suffix() != "vit")
+ {
+ name += ".vit";
+ }
+ ui->lineEditPathNewM->setText(name);
+ ui->lineEditPathNewM->setToolTip(name);
+ CheckState();
+}
+
+void DialogIndividualMeasurements::InitUnits()
+{
+ ui->comboBoxUnits->addItem(tr("centimeter"), QVariant(VDomDocument::UnitsToStr(Valentina::Cm)));
+ ui->comboBoxUnits->addItem(tr("inch"), QVariant(VDomDocument::UnitsToStr(Valentina::Inch)));
+}
diff --git a/src/dialogs/app/dialogindividualmeasurements.h b/src/dialogs/app/dialogindividualmeasurements.h
new file mode 100644
index 000000000..338391b5c
--- /dev/null
+++ b/src/dialogs/app/dialogindividualmeasurements.h
@@ -0,0 +1,74 @@
+/************************************************************************
+ **
+ ** @file dialogindividualmeasurements.h
+ ** @author Roman Telezhinsky
+ ** @date 22 2, 2014
+ **
+ ** @brief
+ ** @copyright
+ ** This source code is part of the Valentine project, a pattern making
+ ** program, whose allow create and modeling patterns of clothing.
+ ** Copyright (C) 2013 Valentina project
+ ** All Rights Reserved.
+ **
+ ** Valentina is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU General Public License as published by
+ ** the Free Software Foundation, either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** Valentina is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU General Public License for more details.
+ **
+ ** You should have received a copy of the GNU General Public License
+ ** along with Valentina. If not, see .
+ **
+ *************************************************************************/
+
+#ifndef DIALOGINDIVIDUALMEASUREMENTS_H
+#define DIALOGINDIVIDUALMEASUREMENTS_H
+
+#include
+#include "../../container/vcontainer.h"
+
+namespace Ui
+{
+ class DialogIndividualMeasurements;
+}
+
+class DialogIndividualMeasurements : public QDialog
+{
+ Q_OBJECT
+public:
+ DialogIndividualMeasurements(VContainer *data, const QString &patternPieceName, QWidget *parent = nullptr);
+ ~DialogIndividualMeasurements();
+ QString name() const;
+ QString tablePath() const;
+public slots:
+ void OpenTable();
+ void NewTable();
+ void CheckState();
+ void DialogAccepted();
+ void DialogRejected();
+private:
+ Q_DISABLE_COPY(DialogIndividualMeasurements)
+ Ui::DialogIndividualMeasurements *ui;
+ QString _name;
+ QString _tablePath;
+ VContainer *data;
+ void LoadIndividualTables();
+ void InitUnits();
+};
+
+inline QString DialogIndividualMeasurements::name() const
+{
+ return _name;
+}
+
+inline QString DialogIndividualMeasurements::tablePath() const
+{
+ return _tablePath;
+}
+
+#endif // DIALOGINDIVIDUALMEASUREMENTS_H
diff --git a/src/dialogs/app/dialogindividualmeasurements.ui b/src/dialogs/app/dialogindividualmeasurements.ui
new file mode 100644
index 000000000..522a6a3de
--- /dev/null
+++ b/src/dialogs/app/dialogindividualmeasurements.ui
@@ -0,0 +1,216 @@
+
+
+ DialogIndividualMeasurements
+
+
+
+ 0
+ 0
+ 397
+ 280
+
+
+
+ Dialog
+
+
+ -
+
+
-
+
+
+ Pattern piece name
+
+
+
+ -
+
+
+
+
+ -
+
+
-
+
+
+ Exist measurements
+
+
+ false
+
+
+ buttonGroupPath
+
+
+
+ -
+
+
-
+
+
+ Path:
+
+
+
+ -
+
+
+ true
+
+
+
+ -
+
+
+ ...
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
-
+
+
+ New measurements
+
+
+ true
+
+
+ buttonGroupPath
+
+
+
+ -
+
+
-
+
+
+ Language:
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 0
+
+
+
+
+
+
+ -
+
+
-
+
+
+ Units:
+
+
+
+ -
+
+
+
+
+ -
+
+
-
+
+
+ Path:
+
+
+
+ -
+
+
+ true
+
+
+
+ -
+
+
+ ...
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+
+
+
+
+
+ buttonBox
+ accepted()
+ DialogIndividualMeasurements
+ accept()
+
+
+ 248
+ 254
+
+
+ 157
+ 274
+
+
+
+
+ buttonBox
+ rejected()
+ DialogIndividualMeasurements
+ reject()
+
+
+ 316
+ 260
+
+
+ 286
+ 274
+
+
+
+
+
+
+
+
diff --git a/src/dialogs/app/dialogmeasurements.cpp b/src/dialogs/app/dialogmeasurements.cpp
new file mode 100644
index 000000000..55e2e954b
--- /dev/null
+++ b/src/dialogs/app/dialogmeasurements.cpp
@@ -0,0 +1,60 @@
+/************************************************************************
+ **
+ ** @file dialogpatterntype.cpp
+ ** @author Roman Telezhinsky
+ ** @date 21 2, 2014
+ **
+ ** @brief
+ ** @copyright
+ ** This source code is part of the Valentine project, a pattern making
+ ** program, whose allow create and modeling patterns of clothing.
+ ** Copyright (C) 2013 Valentina project
+ ** All Rights Reserved.
+ **
+ ** Valentina is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU General Public License as published by
+ ** the Free Software Foundation, either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** Valentina is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU General Public License for more details.
+ **
+ ** You should have received a copy of the GNU General Public License
+ ** along with Valentina. If not, see .
+ **
+ *************************************************************************/
+
+#include "dialogmeasurements.h"
+#include "ui_dialogmeasurements.h"
+
+DialogMeasurements::DialogMeasurements(QWidget *parent) :
+ QDialog(parent), ui(new Ui::DialogMeasurements), result(Measurements::Individual)
+{
+ ui->setupUi(this);
+ connect(ui->toolButtonStandard, &QToolButton::clicked, this, &DialogMeasurements::StandardMeasurements);
+ connect(ui->toolButtonIndividual, &QToolButton::clicked, this, &DialogMeasurements::IndividualMeasurements);
+}
+
+DialogMeasurements::~DialogMeasurements()
+{
+ delete ui;
+}
+
+Measurements::Type DialogMeasurements::type() const
+{
+ return result;
+}
+
+void DialogMeasurements::StandardMeasurements()
+{
+ result = Measurements::Standard;
+ accept();
+}
+
+void DialogMeasurements::IndividualMeasurements()
+{
+ result = Measurements::Individual;
+ accept();
+}
diff --git a/src/exception/vexceptionuniqueid.cpp b/src/dialogs/app/dialogmeasurements.h
similarity index 58%
rename from src/exception/vexceptionuniqueid.cpp
rename to src/dialogs/app/dialogmeasurements.h
index 9232d0ca7..23ef5a64e 100644
--- a/src/exception/vexceptionuniqueid.cpp
+++ b/src/dialogs/app/dialogmeasurements.h
@@ -1,8 +1,8 @@
/************************************************************************
**
- ** @file vexceptionuniqueid.cpp
+ ** @file dialogpatterntype.h
** @author Roman Telezhinsky
- ** @date November 15, 2013
+ ** @date 21 2, 2014
**
** @brief
** @copyright
@@ -26,28 +26,39 @@
**
*************************************************************************/
-#include "vexceptionuniqueid.h"
+#ifndef DIALOGMEASUREMENTS_H
+#define DIALOGMEASUREMENTS_H
-#include
+#include
-VExceptionUniqueId::VExceptionUniqueId(const QString &what, const QDomElement &domElement)
- :VException(what), tagText(QString()), tagName(QString()), lineNumber(-1)
+namespace Ui
{
- Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
- QTextStream stream(&tagText);
- domElement.save(stream, 4);
- tagName = domElement.tagName();
- lineNumber = domElement.lineNumber();
+ class DialogMeasurements;
}
-QString VExceptionUniqueId::ErrorMessage() const
+namespace Measurements
{
- QString error = QString("ExceptionUniqueId: %1").arg(what);
- return error;
+ /**
+ * @brief The Type enum pattern measurements.
+ */
+ enum Type { Standard, Individual };
+ Q_DECLARE_FLAGS(Types, Type)
}
+Q_DECLARE_OPERATORS_FOR_FLAGS( Measurements::Types )
-QString VExceptionUniqueId::DetailedInformation() const
+class DialogMeasurements : public QDialog
{
- QString detail = QString("tag: %1 in line %2\nFull tag:\n%3").arg(tagName).arg(lineNumber).arg(tagText);
- return detail;
-}
+ Q_OBJECT
+public:
+ explicit DialogMeasurements(QWidget *parent = nullptr);
+ ~DialogMeasurements();
+ Measurements::Type type() const;
+private:
+ Q_DISABLE_COPY(DialogMeasurements)
+ Ui::DialogMeasurements *ui;
+ Measurements::Type result;
+ void StandardMeasurements();
+ void IndividualMeasurements();
+};
+
+#endif // DIALOGMEASUREMENTS_H
diff --git a/src/dialogs/app/dialogmeasurements.ui b/src/dialogs/app/dialogmeasurements.ui
new file mode 100644
index 000000000..93ebb16e5
--- /dev/null
+++ b/src/dialogs/app/dialogmeasurements.ui
@@ -0,0 +1,139 @@
+
+
+ DialogMeasurements
+
+
+
+ 0
+ 0
+ 385
+ 244
+
+
+
+ Measurements
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ <html><head/><body><p><span style=" font-size:18pt;">Please, choose pattern type.</span></p></body></html>
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+ 13
+
+
-
+
+
+ 5
+
+
+ 5
+
+
+ 5
+
+
+ 5
+
+
-
+
+
+ Graduation
+
+
+
+ :/icon/Graduation.png:/icon/Graduation.png
+
+
+
+ 160
+ 120
+
+
+
+
+ -
+
+
+ Use for creation pattern standard measurement table
+
+
+ true
+
+
+
+
+
+ -
+
+
+ 6
+
+
+ 5
+
+
+ 5
+
+
+ 5
+
+
+ 5
+
+
-
+
+
+ Individual
+
+
+
+ :/icon/individual.png:/icon/individual.png
+
+
+
+ 160
+ 120
+
+
+
+
+ -
+
+
+ Use for creation pattern individual measurements
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+ toolButtonIndividual
+ toolButtonStandard
+
+
+
+
+
+
diff --git a/src/dialogs/dialogpatternproperties.cpp b/src/dialogs/app/dialogpatternproperties.cpp
similarity index 96%
rename from src/dialogs/dialogpatternproperties.cpp
rename to src/dialogs/app/dialogpatternproperties.cpp
index 82527f731..6d7f922aa 100644
--- a/src/dialogs/dialogpatternproperties.cpp
+++ b/src/dialogs/app/dialogpatternproperties.cpp
@@ -30,7 +30,7 @@
#include "ui_dialogpatternproperties.h"
#include
-DialogPatternProperties::DialogPatternProperties(VDomDocument *doc, QWidget *parent) :
+DialogPatternProperties::DialogPatternProperties(VPattern *doc, QWidget *parent) :
QDialog(parent), ui(new Ui::DialogPatternProperties), doc(doc)
{
ui->setupUi(this);
@@ -39,7 +39,7 @@ DialogPatternProperties::DialogPatternProperties(VDomDocument *doc, QWidget *par
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
QApplication::applicationName());
-#ifdef Q_OS_WIN32
+#ifdef Q_OS_WIN
QString user = settings.value("pattern/user", QString::fromLocal8Bit(qgetenv("USERNAME").constData())).toString();
#else
QString user = settings.value("pattern/user", QString::fromLocal8Bit(qgetenv("USER").constData())).toString();
@@ -57,7 +57,7 @@ DialogPatternProperties::DialogPatternProperties(VDomDocument *doc, QWidget *par
Q_CHECK_PTR(bCansel);
connect(bCansel, &QPushButton::clicked, this, &DialogPatternProperties::close);
- connect(this, &DialogPatternProperties::haveChange, this->doc, &VDomDocument::haveLiteChange);
+ connect(this, &DialogPatternProperties::haveChange, this->doc, &VPattern::haveLiteChange);
}
DialogPatternProperties::~DialogPatternProperties()
diff --git a/src/dialogs/dialogpatternproperties.h b/src/dialogs/app/dialogpatternproperties.h
similarity index 90%
rename from src/dialogs/dialogpatternproperties.h
rename to src/dialogs/app/dialogpatternproperties.h
index d65c834d8..3c4fae0c5 100644
--- a/src/dialogs/dialogpatternproperties.h
+++ b/src/dialogs/app/dialogpatternproperties.h
@@ -30,17 +30,18 @@
#define DIALOGPATTERNPROPERTIES_H
#include
-#include "../xml/vdomdocument.h"
+#include "../../xml/vpattern.h"
-namespace Ui {
-class DialogPatternProperties;
+namespace Ui
+{
+ class DialogPatternProperties;
}
class DialogPatternProperties : public QDialog
{
Q_OBJECT
public:
- DialogPatternProperties(VDomDocument *doc, QWidget *parent = 0);
+ DialogPatternProperties(VPattern *doc, QWidget *parent = nullptr);
virtual ~DialogPatternProperties();
signals:
void haveChange();
@@ -49,7 +50,7 @@ public slots:
private:
Q_DISABLE_COPY(DialogPatternProperties)
Ui::DialogPatternProperties *ui;
- VDomDocument *doc;
+ VPattern *doc;
void Write(const QString &tagName, const QString &text) const;
};
diff --git a/src/dialogs/dialogpatternproperties.ui b/src/dialogs/app/dialogpatternproperties.ui
similarity index 100%
rename from src/dialogs/dialogpatternproperties.ui
rename to src/dialogs/app/dialogpatternproperties.ui
diff --git a/src/dialogs/app/dialogstandardmeasurements.cpp b/src/dialogs/app/dialogstandardmeasurements.cpp
new file mode 100644
index 000000000..604681017
--- /dev/null
+++ b/src/dialogs/app/dialogstandardmeasurements.cpp
@@ -0,0 +1,160 @@
+/************************************************************************
+ **
+ ** @file dialogstandardmeasurements.cpp
+ ** @author Roman Telezhinsky
+ ** @date 21 2, 2014
+ **
+ ** @brief
+ ** @copyright
+ ** This source code is part of the Valentine project, a pattern making
+ ** program, whose allow create and modeling patterns of clothing.
+ ** Copyright (C) 2013 Valentina project
+ ** All Rights Reserved.
+ **
+ ** Valentina is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU General Public License as published by
+ ** the Free Software Foundation, either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** Valentina is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU General Public License for more details.
+ **
+ ** You should have received a copy of the GNU General Public License
+ ** along with Valentina. If not, see .
+ **
+ *************************************************************************/
+
+#include "dialogstandardmeasurements.h"
+#include "ui_dialogstandardmeasurements.h"
+#include
+#include "../../xml/vstandardmeasurements.h"
+#include "../../widgets/vapplication.h"
+
+DialogStandardMeasurements::DialogStandardMeasurements(VContainer *data, const QString &patternPieceName,
+ QWidget *parent) :
+ QDialog(parent), ui(new Ui::DialogStandardMeasurements), data(data), _name(patternPieceName), _tablePath(QString())
+{
+ ui->setupUi(this);
+
+ {
+ const QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
+ Q_CHECK_PTR(bOk);
+ connect(bOk, &QPushButton::clicked, this, &DialogStandardMeasurements::DialogAccepted);
+ }
+ {
+ const QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
+ Q_CHECK_PTR(bCansel);
+ connect(bCansel, &QPushButton::clicked, this, &DialogStandardMeasurements::DialogRejected);
+ }
+
+ ui->lineEditName->setText(_name);
+
+ LoadStandardTables();
+
+ CheckState();
+ connect(ui->lineEditName, &QLineEdit::textChanged, this, &DialogStandardMeasurements::CheckState);
+}
+
+DialogStandardMeasurements::~DialogStandardMeasurements()
+{
+ delete ui;
+}
+
+QString DialogStandardMeasurements::name() const
+{
+ return _name;
+}
+
+QString DialogStandardMeasurements::tablePath() const
+{
+ return _tablePath;
+}
+
+void DialogStandardMeasurements::DialogAccepted()
+{
+ _name = ui->lineEditName->text();
+ const qint32 index = ui->comboBoxTables->currentIndex();
+ _tablePath = ui->comboBoxTables->itemData(index).toString();
+
+ try
+ {
+ VDomDocument::ValidateXML("://schema/standard_measurements.xsd", _tablePath);
+ VStandardMeasurements m(data);
+ m.setContent(_tablePath);
+ qApp->setPatternUnit(m.Unit());
+ }
+ catch(VException &e)
+ {
+ e.CriticalMessageBox(tr("File error."), this);
+ qDebug()<<"File error."<lineEditName->text().isEmpty() == false)
+ {
+ flagName = true;
+ }
+
+ bool flagTable = false;
+ {
+ const QComboBox *box = ui->comboBoxTables;
+ Q_CHECK_PTR(box);
+ if (box->count() > 0 && box->currentIndex() != -1)
+ {
+ flagTable = true;
+ }
+ }
+
+ QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
+ Q_CHECK_PTR(bOk);
+ bOk->setEnabled(flagTable && flagName);
+}
+
+void DialogStandardMeasurements::LoadStandardTables()
+{
+ QStringList filters;
+ filters << "*.vst";
+ QDir tablesDir(qApp->pathToTables());
+ tablesDir.setNameFilters(filters);
+ tablesDir.setCurrent(qApp->pathToTables());
+
+ const QStringList allFiles = tablesDir.entryList(QDir::NoDotAndDotDot | QDir::Files);
+ if (allFiles.isEmpty() == true)
+ {
+ ui->comboBoxTables->clear();
+ CheckState();
+ return;
+ }
+
+ for (int i = 0; i < allFiles.size(); ++i)
+ {
+ QFileInfo fi(allFiles.at(i));
+ try
+ {
+ VDomDocument::ValidateXML("://schema/standard_measurements.xsd", fi.absoluteFilePath());
+ VStandardMeasurements m(data);
+ m.setContent(fi.absoluteFilePath());
+ ui->comboBoxTables->addItem(m.Description(), QVariant(fi.absoluteFilePath()));
+ }
+ catch(VException &e)
+ {
+ qDebug()<<"File error."<
+ ** @date 21 2, 2014
+ **
+ ** @brief
+ ** @copyright
+ ** This source code is part of the Valentine project, a pattern making
+ ** program, whose allow create and modeling patterns of clothing.
+ ** Copyright (C) 2013 Valentina project
+ ** All Rights Reserved.
+ **
+ ** Valentina is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU General Public License as published by
+ ** the Free Software Foundation, either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** Valentina is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU General Public License for more details.
+ **
+ ** You should have received a copy of the GNU General Public License
+ ** along with Valentina. If not, see .
+ **
+ *************************************************************************/
+
+#ifndef DIALOGSTANDARDMEASUREMENTS_H
+#define DIALOGSTANDARDMEASUREMENTS_H
+
+#include
+#include "../../container/vcontainer.h"
+
+namespace Ui
+{
+ class DialogStandardMeasurements;
+}
+
+class DialogStandardMeasurements : public QDialog
+{
+ Q_OBJECT
+public:
+ DialogStandardMeasurements(VContainer *data, const QString &patternPieceName, QWidget *parent = nullptr);
+ ~DialogStandardMeasurements();
+ QString name() const;
+ QString tablePath() const;
+public slots:
+ void DialogAccepted();
+ void DialogRejected();
+ void CheckState();
+private:
+ Q_DISABLE_COPY(DialogStandardMeasurements)
+ Ui::DialogStandardMeasurements *ui;
+ VContainer *data;
+ QString _name;
+ QString _tablePath;
+ void LoadStandardTables();
+};
+
+#endif // DIALOGSTANDARDMEASUREMENTS_H
diff --git a/src/dialogs/app/dialogstandardmeasurements.ui b/src/dialogs/app/dialogstandardmeasurements.ui
new file mode 100644
index 000000000..92fce6de8
--- /dev/null
+++ b/src/dialogs/app/dialogstandardmeasurements.ui
@@ -0,0 +1,127 @@
+
+
+ DialogStandardMeasurements
+
+
+
+ 0
+ 0
+ 452
+ 115
+
+
+
+ Standard table
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 206
+ 0
+
+
+
+ Pattern piece name
+
+
+ 0
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Standard measurements table
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+
+
+
+
+
+ buttonBox
+ accepted()
+ DialogStandardMeasurements
+ accept()
+
+
+ 248
+ 254
+
+
+ 157
+ 274
+
+
+
+
+ buttonBox
+ rejected()
+ DialogStandardMeasurements
+ reject()
+
+
+ 316
+ 260
+
+
+ 286
+ 274
+
+
+
+
+
diff --git a/src/dialogs/pages.cpp b/src/dialogs/app/pages.cpp
similarity index 90%
rename from src/dialogs/pages.cpp
rename to src/dialogs/app/pages.cpp
index eecaf4e58..68b27a7c9 100644
--- a/src/dialogs/pages.cpp
+++ b/src/dialogs/app/pages.cpp
@@ -27,7 +27,8 @@
*************************************************************************/
#include "pages.h"
-#include "../options.h"
+#include "../../options.h"
+#include "../../widgets/vapplication.h"
ConfigurationPage::ConfigurationPage(QWidget *parent):
QWidget(parent), autoSaveCheck(0), autoTime(0), langCombo(0), osOptionCheck(0), langChanged(false)
@@ -71,18 +72,14 @@ QGroupBox *ConfigurationPage::SaveGroup()
QApplication::applicationName());
QGroupBox *saveGroup = new QGroupBox(tr("Save"));
- Q_CHECK_PTR(saveGroup);
autoSaveCheck = new QCheckBox(tr("Auto-save modified pattern"));
- Q_CHECK_PTR(autoSaveCheck);
bool autoSaveValue = settings.value("configuration/autosave/state", 1).toBool();
autoSaveCheck->setChecked(autoSaveValue);
QLabel *intervalLabel = new QLabel(tr("Interval:"));
- Q_CHECK_PTR(intervalLabel);
autoTime = new QSpinBox();
- Q_CHECK_PTR(autoTime);
bool ok = true;
qint32 autoTimeValue = settings.value("configuration/autosave/time", 5).toInt(&ok);
if (ok == false)
@@ -94,13 +91,11 @@ QGroupBox *ConfigurationPage::SaveGroup()
autoTime->setSuffix(tr("min"));
QHBoxLayout *autosaveLayout = new QHBoxLayout;
- Q_CHECK_PTR(autosaveLayout);
autosaveLayout->addWidget(autoSaveCheck);
autosaveLayout->addWidget(intervalLabel);
autosaveLayout->addWidget(autoTime);
QVBoxLayout *saveLayout = new QVBoxLayout;
- Q_CHECK_PTR(saveLayout);
saveLayout->addLayout(autosaveLayout);
saveGroup->setLayout(saveLayout);
return saveGroup;
@@ -112,21 +107,15 @@ QGroupBox *ConfigurationPage::LangGroup()
QApplication::applicationName());
QGroupBox *langGroup = new QGroupBox(tr("Language"));
- Q_CHECK_PTR(langGroup);
-
QLabel *guiLabel = new QLabel(tr("GUI language"));
- Q_CHECK_PTR(guiLabel);
-
langCombo = new QComboBox;
- Q_CHECK_PTR(langCombo);
// format systems language
QString defaultLocale = QLocale::system().name(); // e.g. "de_DE"
defaultLocale.truncate(defaultLocale.lastIndexOf('_')); // e.g. "de"
QString checkedLocale = settings.value("configuration/locale", defaultLocale).toString();
- QString m_langPath = QApplication::applicationDirPath();
- m_langPath.append(translationsPath);
+ QString m_langPath = qApp->translationsPath();
QDir dir(m_langPath);
QStringList fileNames = dir.entryList(QStringList("valentina_*.qm"));
@@ -158,26 +147,21 @@ QGroupBox *ConfigurationPage::LangGroup()
&ConfigurationPage::LangChenged);
QHBoxLayout *guiLangLayout = new QHBoxLayout;
- Q_CHECK_PTR(guiLangLayout);
guiLangLayout->addWidget(guiLabel);
guiLangLayout->addWidget(langCombo);
QLabel *separatorLabel = new QLabel(tr("Decimal separator parts"));
- Q_CHECK_PTR(separatorLabel);
osOptionCheck = new QCheckBox(tr("With OS options (.)"));
- Q_CHECK_PTR(osOptionCheck);
//bool osOptionValue = settings.value("configuration/osSeparator", 1).toBool();
//osOptionCheck->setChecked(osOptionValue);
osOptionCheck->setEnabled(false);
QHBoxLayout *separatorLayout = new QHBoxLayout;
- Q_CHECK_PTR(separatorLayout);
separatorLayout->addWidget(separatorLabel);
separatorLayout->addWidget(osOptionCheck);
QVBoxLayout *langLayout = new QVBoxLayout;
- Q_CHECK_PTR(langLayout);
langLayout->addLayout(guiLangLayout);
langLayout->addLayout(separatorLayout);
langGroup->setLayout(langLayout);
@@ -215,14 +199,10 @@ QGroupBox *PatternPage::UserGroup()
QApplication::applicationName());
QGroupBox *userGroup = new QGroupBox(tr("User"));
- Q_CHECK_PTR(userGroup);
-
QLabel *nameLabel = new QLabel(tr("User name"));
- Q_CHECK_PTR(nameLabel);
userName = new QLineEdit;
- Q_CHECK_PTR(userName);
-#ifdef Q_OS_WIN32
+#ifdef Q_OS_WIN
QString user = settings.value("pattern/user", QString::fromLocal8Bit(qgetenv("USERNAME").constData())).toString();
#else
QString user = settings.value("pattern/user", QString::fromLocal8Bit(qgetenv("USER").constData())).toString();
@@ -230,12 +210,10 @@ QGroupBox *PatternPage::UserGroup()
userName->setText(user);
QHBoxLayout *nameLayout = new QHBoxLayout;
- Q_CHECK_PTR(nameLayout);
nameLayout->addWidget(nameLabel);
nameLayout->addWidget(userName);
QVBoxLayout *userLayout = new QVBoxLayout;
- Q_CHECK_PTR(userLayout);
userLayout->addLayout(nameLayout);
userGroup->setLayout(userLayout);
return userGroup;
@@ -247,20 +225,16 @@ QGroupBox *PatternPage::GraphOutputGroup()
// QApplication::applicationName());
QGroupBox *graphOutputGroup = new QGroupBox(tr("Graphical output"));
- Q_CHECK_PTR(graphOutputGroup);
graphOutputCheck = new QCheckBox(tr("Use antialiasing"));
- Q_CHECK_PTR(graphOutputCheck);
//bool graphOutputValue = settings.value("pattern/graphicalOutput", 1).toBool();
//graphOutputCheck->setChecked(graphOutputValue);
graphOutputCheck->setEnabled(false);
QHBoxLayout *graphLayout = new QHBoxLayout;
- Q_CHECK_PTR(graphLayout);
graphLayout->addWidget(graphOutputCheck);
QVBoxLayout *graphOutputLayout = new QVBoxLayout;
- Q_CHECK_PTR(graphOutputLayout);
graphOutputLayout->addLayout(graphLayout);
graphOutputGroup->setLayout(graphOutputLayout);
return graphOutputGroup;
@@ -272,13 +246,8 @@ QGroupBox *PatternPage::UndoneGroup()
// QApplication::applicationName());
QGroupBox *undoneGroup = new QGroupBox(tr("Undone"));
- Q_CHECK_PTR(undoneGroup);
-
QLabel *undoneLabel = new QLabel(tr("Count steps"));
- Q_CHECK_PTR(undoneLabel);
-
undoneCount = new QSpinBox;
- Q_CHECK_PTR(undoneCount);
// bool ok = true;
// qint32 count = settings.value("pattern/undone", 100).toInt(&ok);
// if (ok == false)
@@ -289,12 +258,10 @@ QGroupBox *PatternPage::UndoneGroup()
undoneCount->setEnabled(false);
QHBoxLayout *countLayout = new QHBoxLayout;
- Q_CHECK_PTR(countLayout);
countLayout->addWidget(undoneLabel);
countLayout->addWidget(undoneCount);
QVBoxLayout *undoneLayout = new QVBoxLayout;
- Q_CHECK_PTR(undoneLayout);
undoneLayout->addLayout(countLayout);
undoneGroup->setLayout(undoneLayout);
return undoneGroup;
diff --git a/src/dialogs/pages.h b/src/dialogs/app/pages.h
similarity index 95%
rename from src/dialogs/pages.h
rename to src/dialogs/app/pages.h
index dc52a36f4..ef8e96e1c 100644
--- a/src/dialogs/pages.h
+++ b/src/dialogs/app/pages.h
@@ -35,7 +35,7 @@ class ConfigurationPage : public QWidget
{
Q_OBJECT
public:
- ConfigurationPage(QWidget *parent = 0);
+ ConfigurationPage(QWidget *parent = nullptr);
void Apply();
public slots:
void LangChenged();
@@ -54,7 +54,7 @@ class PatternPage : public QWidget
{
Q_OBJECT
public:
- PatternPage(QWidget *parent = 0);
+ PatternPage(QWidget *parent = nullptr);
void Apply();
private:
Q_DISABLE_COPY(PatternPage)
diff --git a/src/dialogs/dialoghistory.cpp b/src/dialogs/dialoghistory.cpp
deleted file mode 100644
index 2a6794364..000000000
--- a/src/dialogs/dialoghistory.cpp
+++ /dev/null
@@ -1,483 +0,0 @@
-/************************************************************************
- **
- ** @file dialoghistory.cpp
- ** @author Roman Telezhinsky
- ** @date November 15, 2013
- **
- ** @brief
- ** @copyright
- ** This source code is part of the Valentine project, a pattern making
- ** program, whose allow create and modeling patterns of clothing.
- ** Copyright (C) 2013 Valentina project
- ** All Rights Reserved.
- **
- ** Valentina is free software: you can redistribute it and/or modify
- ** it under the terms of the GNU General Public License as published by
- ** the Free Software Foundation, either version 3 of the License, or
- ** (at your option) any later version.
- **
- ** Valentina is distributed in the hope that it will be useful,
- ** but WITHOUT ANY WARRANTY; without even the implied warranty of
- ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ** GNU General Public License for more details.
- **
- ** You should have received a copy of the GNU General Public License
- ** along with Valentina. If not, see .
- **
- *************************************************************************/
-
-#include "dialoghistory.h"
-#include "ui_dialoghistory.h"
-#include "../geometry/varc.h"
-#include "../geometry/vspline.h"
-#include "../geometry/vsplinepath.h"
-#include "../tools/vabstracttool.h"
-#include "../tools/drawTools/vtoolcutspline.h"
-#include "../tools/drawTools/vtoolcutsplinepath.h"
-#include "../tools/drawTools/vtoolcutarc.h"
-#include
-#include
-
-DialogHistory::DialogHistory(VContainer *data, VDomDocument *doc, QWidget *parent)
- :DialogTool(data, parent), ui(new Ui::DialogHistory), doc(doc), cursorRow(0),
- cursorToolRecordRow(0)
-{
- ui->setupUi(this);
- bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
- connect(bOk, &QPushButton::clicked, this, &DialogHistory::DialogAccepted);
- FillTable();
- InitialTable();
- connect(ui->tableWidget, &QTableWidget::cellClicked, this, &DialogHistory::cellClicked);
- connect(this, &DialogHistory::ShowHistoryTool, doc, &VDomDocument::ShowHistoryTool);
- connect(doc, &VDomDocument::ChangedCursor, this, &DialogHistory::ChangedCursor);
- connect(doc, &VDomDocument::patternChanged, this, &DialogHistory::UpdateHistory);
- connect(doc, &VDomDocument::ChangedActivDraw, this, &DialogHistory::UpdateHistory);
- ShowPoint();
-}
-
-DialogHistory::~DialogHistory()
-{
- delete ui;
-}
-
-void DialogHistory::DialogAccepted()
-{
- QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0);
- qint64 id = qvariant_cast(item->data(Qt::UserRole));
- emit ShowHistoryTool(id, Qt::green, false);
- emit DialogClosed(QDialog::Accepted);
-}
-
-void DialogHistory::cellClicked(int row, int column)
-{
- if (column == 0)
- {
- QTableWidgetItem *item = ui->tableWidget->item(cursorRow, 0);
- item->setIcon(QIcon());
-
- item = ui->tableWidget->item(row, 0);
- cursorRow = row;
- item->setIcon(QIcon("://icon/32x32/put_after.png"));
- qint64 id = qvariant_cast(item->data(Qt::UserRole));
- disconnect(doc, &VDomDocument::ChangedCursor, this, &DialogHistory::ChangedCursor);
- doc->setCursor(id);
- connect(doc, &VDomDocument::ChangedCursor, this, &DialogHistory::ChangedCursor);
- }
- else
- {
- QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0);
- qint64 id = qvariant_cast(item->data(Qt::UserRole));
- emit ShowHistoryTool(id, Qt::green, false);
-
- cursorToolRecordRow = row;
- item = ui->tableWidget->item(cursorToolRecordRow, 0);
- id = qvariant_cast(item->data(Qt::UserRole));
- emit ShowHistoryTool(id, Qt::green, true);
- }
-}
-
-void DialogHistory::ChangedCursor(qint64 id)
-{
- for (qint32 i = 0; i< ui->tableWidget->rowCount(); ++i)
- {
- QTableWidgetItem *item = ui->tableWidget->item(i, 0);
- qint64 rId = qvariant_cast(item->data(Qt::UserRole));
- if (rId == id)
- {
- QTableWidgetItem *oldCursorItem = ui->tableWidget->item(cursorRow, 0);
- oldCursorItem->setIcon(QIcon());
- cursorRow = i;
- item->setIcon(QIcon("://icon/32x32/put_after.png"));
- }
- }
-}
-
-void DialogHistory::UpdateHistory()
-{
- FillTable();
- InitialTable();
-}
-
-void DialogHistory::FillTable()
-{
- ui->tableWidget->clear();
- QVector *history = doc->getHistory();
- qint32 currentRow = -1;
- qint32 count = 0;
- ui->tableWidget->setRowCount(history->size());
- for (qint32 i = 0; i< history->size(); ++i)
- {
- VToolRecord tool = history->at(i);
- if (tool.getNameDraw() != doc->GetNameActivDraw())
- {
- continue;
- }
- currentRow++;
-
- QTableWidgetItem *item = new QTableWidgetItem(QString());
- item->setTextAlignment(Qt::AlignHCenter);
- item->setData(Qt::UserRole, tool.getId());
- ui->tableWidget->setItem(currentRow, 0, item);
-
- QString historyRecord = Record(tool);
- item = new QTableWidgetItem(historyRecord);
- item->setFont(QFont("Times", 12, QFont::Bold));
- item->setFlags(item->flags() ^ Qt::ItemIsEditable);
- ui->tableWidget->setItem(currentRow, 1, item);
- ++count;
- }
- ui->tableWidget->setRowCount(count);
- if (history->size()>0)
- {
- cursorRow = currentRow;
- QTableWidgetItem *item = ui->tableWidget->item(cursorRow, 0);
- item->setIcon(QIcon("://icon/32x32/put_after.png"));
- }
- ui->tableWidget->resizeColumnsToContents();
- ui->tableWidget->resizeRowsToContents();
- ui->tableWidget->verticalHeader()->setDefaultSectionSize(20);
-}
-
-QString DialogHistory::Record(const VToolRecord &tool)
-{
- QString record = QString();
- qint64 basePointId = 0;
- qint64 secondPointId = 0;
- qint64 firstPointId = 0;
- qint64 thirdPointId = 0;
- qint64 p1Line1 = 0;
- qint64 p2Line1 = 0;
- qint64 p1Line2 = 0;
- qint64 p2Line2 = 0;
- qint64 center = 0;
- QDomElement domElement;
- switch ( tool.getTypeTool() )
- {
- case Tool::ArrowTool:
- break;
- case Tool::SinglePointTool:
- {
- QString name = data->GeometricObject(tool.getId())->name();
- record = QString(tr("%1 - Base point")).arg(name);
- break;
- }
- case Tool::EndLineTool:
- {
- domElement = doc->elementById(QString().setNum(tool.getId()));
- if (domElement.isElement())
- {
- basePointId = doc->GetParametrLongLong(domElement, VAbstractTool::AttrBasePoint, "0");
- }
- QString basePointIdName = data->GeometricObject(basePointId)->name();
- QString toolIdName = data->GeometricObject(tool.getId())->name();
- record = QString(tr("%1_%2 - Line from point %1 to point %2")).arg(basePointIdName, toolIdName);
- break;
- }
- case Tool::LineTool:
- {
- domElement = doc->elementById(QString().setNum(tool.getId()));
- if (domElement.isElement())
- {
- firstPointId = doc->GetParametrLongLong(domElement, VAbstractTool::AttrFirstPoint, "0");
- secondPointId = doc->GetParametrLongLong(domElement, VAbstractTool::AttrSecondPoint, "0");
- }
- QString firstPointIdName = data->GeometricObject(firstPointId)->name();
- QString secondPointIdName = data->GeometricObject(secondPointId)->name();
- record = QString(tr("%1_%2 - Line from point %1 to point %2")).arg(firstPointIdName, secondPointIdName);
- break;
- }
- case Tool::AlongLineTool:
- {
- domElement = doc->elementById(QString().setNum(tool.getId()));
- if (domElement.isElement())
- {
- basePointId = doc->GetParametrLongLong(domElement, VAbstractTool::AttrFirstPoint, "0");
- secondPointId = doc->GetParametrLongLong(domElement, VAbstractTool::AttrSecondPoint, "0");
- }
- QString basePointIdName = data->GeometricObject(basePointId)->name();
- QString secondPointIdName = data->GeometricObject(secondPointId)->name();
- QString toolIdName = data->GeometricObject(tool.getId())->name();
- record = QString(tr("%3 - Point along line %1_%2")).arg(basePointIdName, secondPointIdName, toolIdName);
- break;
- }
- case Tool::ShoulderPointTool:
- {
- QString name = data->GeometricObject(tool.getId())->name();
- record = QString(tr("%1 - Point of shoulder")).arg(name);
- break;
- }
- case Tool::NormalTool:
- {
- domElement = doc->elementById(QString().setNum(tool.getId()));
- if (domElement.isElement())
- {
- basePointId = doc->GetParametrLongLong(domElement, VAbstractTool::AttrFirstPoint, "0");
- secondPointId = doc->GetParametrLongLong(domElement, VAbstractTool::AttrSecondPoint, "0");
- }
- QString basePointIdName = data->GeometricObject