Merge with develop

This commit is contained in:
dismine 2013-10-29 19:50:05 +02:00
commit e4dd9c7b97
224 changed files with 10649 additions and 5092 deletions

View File

@ -22,3 +22,6 @@ latex/
# Ignore file used QtCreator for user profile. # Ignore file used QtCreator for user profile.
*.pro.user *.pro.user
# Ignore file Qt translation.
*.qm

View File

@ -11,7 +11,8 @@ QT += core gui widgets xml svg
TARGET = Valentina TARGET = Valentina
TEMPLATE = app TEMPLATE = app
CONFIG -= debug_and_release debug_and_release_target CONFIG -= debug_and_release debug_and_release_target
CONFIG += c++11 CONFIG += c++11 precompile_header
QMAKE_CXX = ccache g++
SOURCES += main.cpp\ SOURCES += main.cpp\
mainwindow.cpp \ mainwindow.cpp \
@ -95,7 +96,17 @@ SOURCES += main.cpp\
exception/vexceptionconversionerror.cpp \ exception/vexceptionconversionerror.cpp \
exception/vexceptionemptyparameter.cpp \ exception/vexceptionemptyparameter.cpp \
exception/vexceptionobjecterror.cpp \ exception/vexceptionobjecterror.cpp \
widgets/vapplication.cpp widgets/vapplication.cpp \
exception/vexceptionuniqueid.cpp \
tools/drawTools/vtoolheight.cpp \
tools/modelingTools/vmodelingheight.cpp \
dialogs/dialogheight.cpp \
tools/drawTools/vtooltriangle.cpp \
tools/modelingTools/vmodelingtriangle.cpp \
dialogs/dialogtriangle.cpp \
dialogs/dialogpointofintersection.cpp \
tools/drawTools/vtoolpointofintersection.cpp \
tools/modelingTools/vmodelingpointofintersection.cpp
HEADERS += mainwindow.h \ HEADERS += mainwindow.h \
widgets/vmaingraphicsscene.h \ widgets/vmaingraphicsscene.h \
@ -185,7 +196,18 @@ HEADERS += mainwindow.h \
exception/vexceptionconversionerror.h \ exception/vexceptionconversionerror.h \
exception/vexceptionemptyparameter.h \ exception/vexceptionemptyparameter.h \
exception/vexceptionobjecterror.h \ exception/vexceptionobjecterror.h \
widgets/vapplication.h widgets/vapplication.h \
exception/vexceptionuniqueid.h \
tools/drawTools/vtoolheight.h \
tools/modelingTools/vmodelingheight.h \
dialogs/dialogheight.h \
tools/drawTools/vtooltriangle.h \
tools/modelingTools/vmodelingtriangle.h \
dialogs/dialogtriangle.h \
dialogs/dialogpointofintersection.h \
tools/drawTools/vtoolpointofintersection.h \
tools/modelingTools/vmodelingpointofintersection.h \
version.h
FORMS += mainwindow.ui \ FORMS += mainwindow.ui \
dialogs/dialogsinglepoint.ui \ dialogs/dialogsinglepoint.ui \
@ -203,7 +225,10 @@ FORMS += mainwindow.ui \
dialogs/dialoghistory.ui \ dialogs/dialoghistory.ui \
dialogs/dialogpointofcontact.ui \ dialogs/dialogpointofcontact.ui \
dialogs/dialogdetail.ui \ dialogs/dialogdetail.ui \
tablewindow.ui tablewindow.ui \
dialogs/dialogheight.ui \
dialogs/dialogtriangle.ui \
dialogs/dialogpointofintersection.ui
RESOURCES += \ RESOURCES += \
icon.qrc \ icon.qrc \
@ -245,7 +270,7 @@ CONFIG(debug, debug|release){
QMAKE_EXTRA_COMPILERS += lrelease QMAKE_EXTRA_COMPILERS += lrelease
lrelease.input = TRANSLATIONS lrelease.input = TRANSLATIONS
lrelease.output = ${QMAKE_FILE_BASE}.qm lrelease.output = ${QMAKE_FILE_BASE}.qm
lrelease.commands = $$[QT_INSTALL_BINS]/lrelease ${QMAKE_FILE_IN} -qm ${DESTDIR}${QMAKE_FILE_BASE}.qm lrelease.commands = $$[QT_INSTALL_BINS]/lrelease ${QMAKE_FILE_IN} -qm "bin/"${QMAKE_FILE_BASE}.qm
lrelease.CONFIG += no_link target_predeps lrelease.CONFIG += no_link target_predeps
} }
@ -261,5 +286,3 @@ message(Data files: $$[QT_INSTALL_DATA])
message(Translation files: $$[QT_INSTALL_TRANSLATIONS]) message(Translation files: $$[QT_INSTALL_TRANSLATIONS])
message(Settings: $$[QT_INSTALL_SETTINGS]) message(Settings: $$[QT_INSTALL_SETTINGS])
message(Examples: $$[QT_INSTALL_EXAMPLES]) message(Examples: $$[QT_INSTALL_EXAMPLES])

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -20,7 +20,6 @@
****************************************************************************/ ****************************************************************************/
#include "calculator.h" #include "calculator.h"
#include <QDebug>
#define DELIMITER 1 #define DELIMITER 1
#define VARIABLE 2 #define VARIABLE 2

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -22,15 +22,13 @@
#ifndef CALCULATOR_H #ifndef CALCULATOR_H
#define CALCULATOR_H #define CALCULATOR_H
#include <QString>
#include "vcontainer.h" #include "vcontainer.h"
/** /**
* @brief The Calculator клас калькулятора формул лекал. Виконує розрахунок формул з підставлянням * @brief The Calculator клас калькулятора формул лекал. Виконує розрахунок формул з підставлянням
* значеннь зміних. * значеннь зміних.
*/ */
class Calculator class Calculator{
{
public: public:
/** /**
* @brief Calculator конструктор класу. Використовується при розрахунку лекала. * @brief Calculator конструктор класу. Використовується при розрахунку лекала.

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -20,21 +20,19 @@
****************************************************************************/ ****************************************************************************/
#include "vcontainer.h" #include "vcontainer.h"
#include <QDebug>
#include "options.h"
#include <exception/vexceptionbadid.h> #include <exception/vexceptionbadid.h>
qint64 VContainer::_id = 0; qint64 VContainer::_id = 0;
VContainer::VContainer():base(QMap<QString, qint32>()), points(QMap<qint64, VPointF>()), VContainer::VContainer():base(QHash<QString, qint32>()), points(QHash<qint64, VPointF>()),
modelingPoints(QMap<qint64, VPointF>()), modelingPoints(QHash<qint64, VPointF>()),
standartTable(QMap<QString, VStandartTableCell>()), incrementTable(QMap<QString, VIncrementTableRow>()), standartTable(QHash<QString, VStandartTableCell>()), incrementTable(QHash<QString, VIncrementTableRow>()),
lengthLines(QMap<QString, qreal>()), lineAngles(QMap<QString, qreal>()), splines(QMap<qint64, VSpline>()), lengthLines(QHash<QString, qreal>()), lineAngles(QHash<QString, qreal>()), splines(QHash<qint64, VSpline>()),
modelingSplines(QMap<qint64, VSpline>()), modelingSplines(QHash<qint64, VSpline>()),
lengthSplines(QMap<QString, qreal>()), arcs(QMap<qint64, VArc>()), modelingArcs(QMap<qint64, VArc>()), lengthSplines(QHash<QString, qreal>()), arcs(QHash<qint64, VArc>()), modelingArcs(QHash<qint64, VArc>()),
lengthArcs(QMap<QString, qreal>()), lengthArcs(QHash<QString, qreal>()),
splinePaths(QMap<qint64, VSplinePath>()), modelingSplinePaths(QMap<qint64, VSplinePath>()), splinePaths(QHash<qint64, VSplinePath>()), modelingSplinePaths(QHash<qint64, VSplinePath>()),
details(QMap<qint64, VDetail>()){ details(QHash<qint64, VDetail>()){
SetSize(500); SetSize(500);
SetGrowth(1760); SetGrowth(1760);
CreateManTableIGroup (); CreateManTableIGroup ();
@ -45,15 +43,15 @@ VContainer &VContainer::operator =(const VContainer &data){
return *this; return *this;
} }
VContainer::VContainer(const VContainer &data):base(QMap<QString, qint32>()), points(QMap<qint64, VPointF>()), VContainer::VContainer(const VContainer &data):base(QHash<QString, qint32>()), points(QHash<qint64, VPointF>()),
modelingPoints(QMap<qint64, VPointF>()), modelingPoints(QHash<qint64, VPointF>()),
standartTable(QMap<QString, VStandartTableCell>()), incrementTable(QMap<QString, VIncrementTableRow>()), standartTable(QHash<QString, VStandartTableCell>()), incrementTable(QHash<QString, VIncrementTableRow>()),
lengthLines(QMap<QString, qreal>()), lineAngles(QMap<QString, qreal>()), splines(QMap<qint64, VSpline>()), lengthLines(QHash<QString, qreal>()), lineAngles(QHash<QString, qreal>()), splines(QHash<qint64, VSpline>()),
modelingSplines(QMap<qint64, VSpline>()), modelingSplines(QHash<qint64, VSpline>()),
lengthSplines(QMap<QString, qreal>()), arcs(QMap<qint64, VArc>()), modelingArcs(QMap<qint64, VArc>()), lengthSplines(QHash<QString, qreal>()), arcs(QHash<qint64, VArc>()), modelingArcs(QHash<qint64, VArc>()),
lengthArcs(QMap<QString, qreal>()), lengthArcs(QHash<QString, qreal>()),
splinePaths(QMap<qint64, VSplinePath>()), modelingSplinePaths(QMap<qint64, VSplinePath>()), splinePaths(QHash<qint64, VSplinePath>()), modelingSplinePaths(QHash<qint64, VSplinePath>()),
details(QMap<qint64, VDetail>()){ details(QHash<qint64, VDetail>()){
setData(data); setData(data);
} }
@ -64,7 +62,7 @@ void VContainer::setData(const VContainer &data){
standartTable = *data.DataStandartTable(); standartTable = *data.DataStandartTable();
incrementTable = *data.DataIncrementTable(); incrementTable = *data.DataIncrementTable();
lengthLines = *data.DataLengthLines(); lengthLines = *data.DataLengthLines();
lineAngles = *data.DataLengthArcs(); lineAngles = *data.DataLineAngles();
splines = *data.DataSplines(); splines = *data.DataSplines();
modelingSplines = *data.DataModelingSplines(); modelingSplines = *data.DataModelingSplines();
lengthSplines = *data.DataLengthSplines(); lengthSplines = *data.DataLengthSplines();
@ -77,7 +75,7 @@ void VContainer::setData(const VContainer &data){
} }
template <typename key, typename val> template <typename key, typename val>
val VContainer::GetObject(const QMap<key,val> &obj, key id){ val VContainer::GetObject(const QHash<key, val> &obj, key id){
if(obj.contains(id)){ if(obj.contains(id)){
return obj.value(id); return obj.value(id);
} else { } else {
@ -85,15 +83,6 @@ val VContainer::GetObject(const QMap<key,val> &obj, key id){
} }
} }
VPointF VContainer::GetPoint(qint64 id) const{
return GetObject(points, id);
}
VPointF VContainer::GetModelingPoint(qint64 id) const{
return GetObject(modelingPoints, id);
}
VStandartTableCell VContainer::GetStandartTableCell(const QString &name) const{ VStandartTableCell VContainer::GetStandartTableCell(const QString &name) const{
Q_ASSERT(!name.isEmpty()); Q_ASSERT(!name.isEmpty());
return GetObject(standartTable, name); return GetObject(standartTable, name);
@ -109,49 +98,31 @@ qreal VContainer::GetLine(const QString &name) const{
return GetObject(lengthLines, name); return GetObject(lengthLines, name);
} }
qreal VContainer::GetLineArc(const QString &name) const{ qreal VContainer::GetLengthArc(const QString &name) const{
Q_ASSERT(!name.isEmpty());
return GetObject(lengthArcs, name);
}
qreal VContainer::GetLengthSpline(const QString &name) const{
Q_ASSERT(!name.isEmpty());
return GetObject(lengthSplines, name);
}
qreal VContainer::GetLineAngle(const QString &name) const{
Q_ASSERT(!name.isEmpty()); Q_ASSERT(!name.isEmpty());
return GetObject(lineAngles, name); return GetObject(lineAngles, name);
} }
VSpline VContainer::GetSpline(qint64 id) const{ qint64 VContainer::AddPoint(const VPointF &point){
return GetObject(splines, id); return AddObject(points, point);
} }
VSpline VContainer::GetModelingSpline(qint64 id) const{ qint64 VContainer::AddModelingPoint(const VPointF &point){
return GetObject(modelingSplines, id); return AddObject(modelingPoints, point);
} }
VArc VContainer::GetArc(qint64 id) const{ qint64 VContainer::AddDetail(const VDetail &detail){
return GetObject(arcs, id); return AddObject(details, detail);
}
VArc VContainer::GetModelingArc(qint64 id) const{
return GetObject(modelingArcs, id);
}
VSplinePath VContainer::GetSplinePath(qint64 id) const{
return GetObject(splinePaths, id);
}
VSplinePath VContainer::GetModelingSplinePath(qint64 id) const{
return GetObject(modelingSplinePaths, id);
}
VDetail VContainer::GetDetail(qint64 id) const{
return GetObject(details, id);
}
void VContainer::AddStandartTableCell(const QString& name, const VStandartTableCell& cell){
standartTable[name] = cell;
}
void VContainer::AddIncrementTableRow(const QString& name, const VIncrementTableRow& cell){
incrementTable[name] = cell;
}
qint64 VContainer::getId(){
return _id;
} }
qint64 VContainer::getNextId(){ qint64 VContainer::getNextId(){
@ -168,11 +139,18 @@ void VContainer::UpdateId(qint64 newId){
QPainterPath VContainer::ContourPath(qint64 idDetail) const{ QPainterPath VContainer::ContourPath(qint64 idDetail) const{
VDetail detail = GetDetail(idDetail); VDetail detail = GetDetail(idDetail);
QVector<QPointF> points; QVector<QPointF> points;
QVector<QPointF> pointsEkv;
for(qint32 i = 0; i< detail.CountNode(); ++i){ for(qint32 i = 0; i< detail.CountNode(); ++i){
switch(detail[i].getTypeTool()){ switch(detail[i].getTypeTool()){
case(Tool::NodePoint):{ case(Tool::NodePoint):{
VPointF point = GetModelingPoint(detail[i].getId()); VPointF point = GetModelingPoint(detail[i].getId());
points.append(point.toQPointF()); points.append(point.toQPointF());
if(detail.getSupplement() == true){
QPointF pEkv = point.toQPointF();
pEkv.setX(pEkv.x()+detail[i].getMx());
pEkv.setY(pEkv.y()+detail[i].getMy());
pointsEkv.append(pEkv);
}
} }
break; break;
case(Tool::NodeArc):{ case(Tool::NodeArc):{
@ -181,8 +159,15 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const{
qreal lenReverse = GetLengthContour(points, GetReversePoint(arc.GetPoints())); qreal lenReverse = GetLengthContour(points, GetReversePoint(arc.GetPoints()));
if(len1 <= lenReverse){ if(len1 <= lenReverse){
points << arc.GetPoints(); points << arc.GetPoints();
if(detail.getSupplement() == true){
pointsEkv << biasPoints(arc.GetPoints(), detail[i].getMx(), detail[i].getMy());
}
} else { } else {
points << GetReversePoint(arc.GetPoints()); points << GetReversePoint(arc.GetPoints());
if(detail.getSupplement() == true){
pointsEkv << biasPoints(GetReversePoint(arc.GetPoints()), detail[i].getMx(),
detail[i].getMy());
}
} }
} }
break; break;
@ -192,8 +177,15 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const{
qreal lenReverse = GetLengthContour(points, GetReversePoint(spline.GetPoints())); qreal lenReverse = GetLengthContour(points, GetReversePoint(spline.GetPoints()));
if(len1 <= lenReverse){ if(len1 <= lenReverse){
points << spline.GetPoints(); points << spline.GetPoints();
if(detail.getSupplement() == true){
pointsEkv << biasPoints(spline.GetPoints(), detail[i].getMx(), detail[i].getMy());
}
} else { } else {
points << GetReversePoint(spline.GetPoints()); points << GetReversePoint(spline.GetPoints());
if(detail.getSupplement() == true){
pointsEkv << biasPoints(GetReversePoint(spline.GetPoints()), detail[i].getMx(),
detail[i].getMy());
}
} }
} }
break; break;
@ -203,27 +195,57 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const{
qreal lenReverse = GetLengthContour(points, GetReversePoint(splinePath.GetPathPoints())); qreal lenReverse = GetLengthContour(points, GetReversePoint(splinePath.GetPathPoints()));
if(len1 <= lenReverse){ if(len1 <= lenReverse){
points << splinePath.GetPathPoints(); points << splinePath.GetPathPoints();
if(detail.getSupplement() == true){
pointsEkv << biasPoints(splinePath.GetPathPoints(), detail[i].getMx(), detail[i].getMy());
}
} else { } else {
points << GetReversePoint(splinePath.GetPathPoints()); points << GetReversePoint(splinePath.GetPathPoints());
if(detail.getSupplement() == true){
pointsEkv << biasPoints(GetReversePoint(splinePath.GetPathPoints()), detail[i].getMx(),
detail[i].getMy());
}
} }
} }
break; break;
case(Tool::SplineTool):
break;//Nothing to do, just ignore.
default: default:
qWarning()<<"Get wrong tool type. Ignore."<<detail[i].getTypeTool(); qWarning()<<"Get wrong tool type. Ignore."<<detail[i].getTypeTool();
break; break;
} }
} }
QPainterPath ekv = Equidistant(points, Detail::CloseEquidistant, toPixel(10));
QPainterPath path; QPainterPath path;
path.moveTo(points[0]); path.moveTo(points[0]);
for (qint32 i = 1; i < points.count(); ++i){ for (qint32 i = 1; i < points.count(); ++i){
path.lineTo(points[i]); path.lineTo(points[i]);
} }
path.lineTo(points[0]); path.lineTo(points[0]);
if(detail.getSupplement() == true){
QPainterPath ekv;
if(detail.getClosed() == true){
ekv = Equidistant(pointsEkv, Detail::CloseEquidistant, toPixel(detail.getWidth()));
} else {
ekv = Equidistant(pointsEkv, Detail::OpenEquidistant, toPixel(detail.getWidth()));
}
path.addPath(ekv); path.addPath(ekv);
path.setFillRule(Qt::WindingFill);
}
return path; return path;
} }
QVector<QPointF> VContainer::biasPoints(const QVector<QPointF> &points, const qreal &mx, const qreal &my) const{
QVector<QPointF> p;
for(qint32 i = 0; i < points.size(); ++i){
QPointF point = points.at(i);
point.setX(point.x() + mx);
point.setY(point.x() + my);
p.append(point);
}
return p;
}
QPainterPath VContainer::Equidistant(QVector<QPointF> points, const Detail::Equidistant &eqv, QPainterPath VContainer::Equidistant(QVector<QPointF> points, const Detail::Equidistant &eqv,
const qreal &width) const{ const qreal &width) const{
QPainterPath ekv; QPainterPath ekv;
@ -377,75 +399,27 @@ QVector<QPointF> VContainer::CheckLoops(const QVector<QPointF> &points) const{
} }
void VContainer::PrepareDetails(QVector<VItem *> &list) const{ void VContainer::PrepareDetails(QVector<VItem *> &list) const{
QMapIterator<qint64, VDetail> iDetail(details); QHashIterator<qint64, VDetail> iDetail(details);
while (iDetail.hasNext()) { while (iDetail.hasNext()) {
iDetail.next(); iDetail.next();
list.append(new VItem(ContourPath(iDetail.key()), list.size())); list.append(new VItem(ContourPath(iDetail.key()), list.size()));
} }
} }
void VContainer::RemoveIncrementTableRow(const QString& name){
incrementTable.remove(name);
}
template <typename val> template <typename val>
void VContainer::UpdateObject(QMap<qint64, val> &obj, const qint64 &id, const val& point){ void VContainer::UpdateObject(QHash<qint64, val> &obj, const qint64 &id, const val& point){
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
obj[id] = point; obj[id] = point;
UpdateId(id); UpdateId(id);
} }
void VContainer::UpdatePoint(qint64 id, const VPointF& point){
UpdateObject(points, id, point);
}
void VContainer::UpdateModelingPoint(qint64 id, const VPointF &point){
UpdateObject(modelingPoints, id, point);
}
void VContainer::UpdateDetail(qint64 id, const VDetail &detail){
UpdateObject(details, id, detail);
}
void VContainer::UpdateSpline(qint64 id, const VSpline &spl){
UpdateObject(splines, id, spl);
}
void VContainer::UpdateModelingSpline(qint64 id, const VSpline &spl){
UpdateObject(modelingSplines, id, spl);
}
void VContainer::UpdateSplinePath(qint64 id, const VSplinePath &splPath){
UpdateObject(splinePaths, id, splPath);
}
void VContainer::UpdateModelingSplinePath(qint64 id, const VSplinePath &splPath){
UpdateObject(modelingSplinePaths, id, splPath);
}
void VContainer::UpdateArc(qint64 id, const VArc &arc){
UpdateObject(arcs, id, arc);
}
void VContainer::UpdateModelingArc(qint64 id, const VArc &arc){
UpdateObject(modelingArcs, id, arc);
}
void VContainer::UpdateStandartTableCell(const QString& name, const VStandartTableCell& cell){
standartTable[name] = cell;
}
void VContainer::UpdateIncrementTableRow(const QString& name, const VIncrementTableRow& cell){
incrementTable[name] = cell;
}
void VContainer::AddLengthSpline(const QString &name, const qreal &value){ void VContainer::AddLengthSpline(const QString &name, const qreal &value){
Q_ASSERT(!name.isEmpty()); Q_ASSERT(!name.isEmpty());
lengthSplines[name] = value; lengthSplines[name] = value;
} }
void VContainer::AddLengthArc(const qint64 &center, const qint64 &id){ void VContainer::AddLengthArc(const qint64 &center, const qint64 &id){
AddLengthArc(GetNameArc(center, id), GetArc(id).GetLength()); AddLengthArc(GetNameArc(center, id), toMM(GetArc(id).GetLength()));
} }
void VContainer::AddLengthArc(const QString &name, const qreal &value){ void VContainer::AddLengthArc(const QString &name, const qreal &value){
@ -497,46 +471,6 @@ void VContainer::ClearObject(){
splinePaths.clear(); splinePaths.clear();
} }
void VContainer::ClearIncrementTable(){
incrementTable.clear();
}
void VContainer::ClearLengthLines(){
lengthLines.clear();
}
void VContainer::ClearLengthSplines(){
lengthSplines.clear();
}
void VContainer::ClearLengthArcs(){
lengthArcs.clear();
}
void VContainer::ClearLineAngles(){
lineAngles.clear();
}
void VContainer::SetSize(qint32 size){
base["Сг"] = size;
}
void VContainer::SetGrowth(qint32 growth){
base["Р"] = growth;
}
qint32 VContainer::size() const{
return base.value("Сг");
}
qint32 VContainer::growth() const{
return base.value("Р");
}
bool VContainer::IncrementTableContains(const QString& name){
return incrementTable.contains(name);
}
qreal VContainer::FindVar(const QString &name, bool *ok)const{ qreal VContainer::FindVar(const QString &name, bool *ok)const{
if(base.contains(name)){ if(base.contains(name)){
*ok = true; *ok = true;
@ -563,74 +497,14 @@ qreal VContainer::FindVar(const QString &name, bool *ok)const{
*ok = true; *ok = true;
return lineAngles.value(name); return lineAngles.value(name);
} }
if(lengthSplines.contains(name)){
*ok = true;
return lengthSplines.value(name);
}
*ok = false; *ok = false;
return 0; return 0;
} }
const QMap<qint64, VPointF> *VContainer::DataPoints() const{
return &points;
}
const QMap<qint64, VPointF> *VContainer::DataModelingPoints() const{
return &modelingPoints;
}
const QMap<qint64, VSpline> *VContainer::DataSplines() const{
return &splines;
}
const QMap<qint64, VSpline> *VContainer::DataModelingSplines() const{
return &modelingSplines;
}
const QMap<qint64, VArc> *VContainer::DataArcs() const{
return &arcs;
}
const QMap<qint64, VArc> *VContainer::DataModelingArcs() const{
return &modelingArcs;
}
const QMap<QString, qint32> *VContainer::DataBase() const{
return &base;
}
const QMap<QString, VStandartTableCell> *VContainer::DataStandartTable() const{
return &standartTable;
}
const QMap<QString, VIncrementTableRow> *VContainer::DataIncrementTable() const{
return &incrementTable;
}
const QMap<QString, qreal> *VContainer::DataLengthLines() const{
return &lengthLines;
}
const QMap<QString, qreal> *VContainer::DataLengthSplines() const{
return &lengthSplines;
}
const QMap<QString, qreal> *VContainer::DataLengthArcs() const{
return &lengthArcs;
}
const QMap<QString, qreal> *VContainer::DataLineAngles() const{
return &lineAngles;
}
const QMap<qint64, VSplinePath> *VContainer::DataSplinePaths() const{
return &splinePaths;
}
const QMap<qint64, VSplinePath> *VContainer::DataModelingSplinePaths() const{
return &modelingSplinePaths;
}
const QMap<qint64, VDetail> *VContainer::DataDetails() const{
return &details;
}
void VContainer::AddLine(const qint64 &firstPointId, const qint64 &secondPointId, Draw::Draws mode){ void VContainer::AddLine(const qint64 &firstPointId, const qint64 &secondPointId, Draw::Draws mode){
QString nameLine = GetNameLine(firstPointId, secondPointId, mode); QString nameLine = GetNameLine(firstPointId, secondPointId, mode);
VPointF first; VPointF first;
@ -642,30 +516,11 @@ void VContainer::AddLine(const qint64 &firstPointId, const qint64 &secondPointId
first = GetModelingPoint(firstPointId); first = GetModelingPoint(firstPointId);
second = GetModelingPoint(secondPointId); second = GetModelingPoint(secondPointId);
} }
AddLengthLine(nameLine, QLineF(first.toQPointF(), second.toQPointF()).length()/PrintDPI*25.4); AddLengthLine(nameLine, toMM(QLineF(first.toQPointF(), second.toQPointF()).length()));
nameLine = GetNameLineAngle(firstPointId, secondPointId, mode); nameLine = GetNameLineAngle(firstPointId, secondPointId, mode);
AddLineAngle(nameLine, QLineF(first.toQPointF(), second.toQPointF()).angle()); AddLineAngle(nameLine, QLineF(first.toQPointF(), second.toQPointF()).angle());
} }
template <typename key, typename val>
qint64 VContainer::AddObject(QMap<key, val> &obj, const val& value){
qint64 id = getNextId();
obj[id] = value;
return id;
}
qint64 VContainer::AddPoint(const VPointF& point){
return AddObject(points, point);
}
qint64 VContainer::AddModelingPoint(const VPointF &point){
return AddObject(modelingPoints, point);
}
qint64 VContainer::AddDetail(const VDetail &detail){
return AddObject(details, detail);
}
qint64 VContainer::AddSpline(const VSpline &spl){ qint64 VContainer::AddSpline(const VSpline &spl){
return AddObject(splines, spl); return AddObject(splines, spl);
} }
@ -690,6 +545,13 @@ qint64 VContainer::AddModelingArc(const VArc &arc){
return AddObject(modelingArcs, arc); return AddObject(modelingArcs, arc);
} }
template <typename key, typename val>
qint64 VContainer::AddObject(QHash<key, val> &obj, const val& value){
qint64 id = getNextId();
obj[id] = value;
return id;
}
QString VContainer::GetNameLine(const qint64 &firstPoint, const qint64 &secondPoint, Draw::Draws mode) const{ QString VContainer::GetNameLine(const qint64 &firstPoint, const qint64 &secondPoint, Draw::Draws mode) const{
VPointF first; VPointF first;
VPointF second; VPointF second;
@ -760,7 +622,43 @@ QString VContainer::GetNameArc(const qint64 &center, const qint64 &id, Draw::Dra
} else { } else {
centerPoint = GetModelingPoint(center); centerPoint = GetModelingPoint(center);
} }
return QString ("Arc(%1)%2").arg(centerPoint.name()).arg(id); return QString ("Arc_%1_%2").arg(centerPoint.name()).arg(id);
}
void VContainer::UpdatePoint(qint64 id, const VPointF &point){
UpdateObject(points, id, point);
}
void VContainer::UpdateModelingPoint(qint64 id, const VPointF &point){
UpdateObject(modelingPoints, id, point);
}
void VContainer::UpdateDetail(qint64 id, const VDetail &detail){
UpdateObject(details, id, detail);
}
void VContainer::UpdateSpline(qint64 id, const VSpline &spl){
UpdateObject(splines, id, spl);
}
void VContainer::UpdateModelingSpline(qint64 id, const VSpline &spl){
UpdateObject(modelingSplines, id, spl);
}
void VContainer::UpdateSplinePath(qint64 id, const VSplinePath &splPath){
UpdateObject(splinePaths, id, splPath);
}
void VContainer::UpdateModelingSplinePath(qint64 id, const VSplinePath &splPath){
UpdateObject(modelingSplinePaths, id, splPath);
}
void VContainer::UpdateArc(qint64 id, const VArc &arc){
UpdateObject(arcs, id, arc);
}
void VContainer::UpdateModelingArc(qint64 id, const VArc &arc){
UpdateObject(modelingArcs, id, arc);
} }
void VContainer::AddLengthLine(const QString &name, const qreal &value){ void VContainer::AddLengthLine(const QString &name, const qreal &value){
@ -768,20 +666,6 @@ void VContainer::AddLengthLine(const QString &name, const qreal &value){
lengthLines[name] = value; lengthLines[name] = value;
} }
void VContainer::AddLengthSpline(const qint64 &firstPointId, const qint64 &secondPointId, Draw::Draws mode){
QString nameLine = GetNameSpline(firstPointId, secondPointId, mode);
VPointF first;
VPointF second;
if(mode == Draw::Calculation){
first = GetPoint(firstPointId);
second = GetPoint(secondPointId);
} else {
first = GetModelingPoint(firstPointId);
second = GetModelingPoint(secondPointId);
}
AddLengthSpline(nameLine, QLineF(first.toQPointF(), second.toQPointF()).length());
}
void VContainer::CreateManTableIGroup (){ void VContainer::CreateManTableIGroup (){
AddStandartTableCell("Pkor", VStandartTableCell(84, 0, 3)); AddStandartTableCell("Pkor", VStandartTableCell(84, 0, 3));
AddStandartTableCell("Pkor", VStandartTableCell(84, 0, 3)); AddStandartTableCell("Pkor", VStandartTableCell(84, 0, 3));
@ -795,18 +679,17 @@ void VContainer::CreateManTableIGroup (){
AddStandartTableCell("Vzy", VStandartTableCell(1328, 0, 49)); AddStandartTableCell("Vzy", VStandartTableCell(1328, 0, 49));
AddStandartTableCell("Vlop", VStandartTableCell(1320, 0, 49)); AddStandartTableCell("Vlop", VStandartTableCell(1320, 0, 49));
AddStandartTableCell("Vps", VStandartTableCell(811, -1, 36)); AddStandartTableCell("Vps", VStandartTableCell(811, -1, 36));
AddStandartTableCell("Osh", VStandartTableCell(404,8, 2)); AddStandartTableCell("Ssh", VStandartTableCell(202,4, 1));
AddStandartTableCell("OgI", VStandartTableCell(1034, 36, 4)); AddStandartTableCell("SgI", VStandartTableCell(517, 18, 2));
AddStandartTableCell("OgII", VStandartTableCell(1044, 38, 2)); AddStandartTableCell("SgII", VStandartTableCell(522, 19, 1));
AddStandartTableCell("OgIII", VStandartTableCell(1000, 40, 0)); AddStandartTableCell("SgIII", VStandartTableCell(500, 20, 0));
AddStandartTableCell("Ot", VStandartTableCell(780, 40, 0)); AddStandartTableCell("St", VStandartTableCell(390, 20, 0));
AddStandartTableCell("Ob", VStandartTableCell(984, 30, 10)); AddStandartTableCell("Sb", VStandartTableCell(492, 15, 5));
AddStandartTableCell("ObI", VStandartTableCell(964, 24, 12)); AddStandartTableCell("SbI", VStandartTableCell(482, 12, 6));
AddStandartTableCell("Obed", VStandartTableCell(566, 18, 6)); AddStandartTableCell("Obed", VStandartTableCell(566, 18, 6));
AddStandartTableCell("Ok", VStandartTableCell(386, 8, 8)); AddStandartTableCell("Ok", VStandartTableCell(386, 8, 8));
AddStandartTableCell("Oi", VStandartTableCell(380, 8, 6)); AddStandartTableCell("Oi", VStandartTableCell(380, 8, 6));
AddStandartTableCell("Osch", VStandartTableCell(234, 4, 4)); AddStandartTableCell("Osch", VStandartTableCell(234, 4, 4));
AddStandartTableCell("Os", VStandartTableCell(350, 2, 8));
AddStandartTableCell("Dsb", VStandartTableCell(1120, 0, 44)); AddStandartTableCell("Dsb", VStandartTableCell(1120, 0, 44));
AddStandartTableCell("Dsp", VStandartTableCell(1110, 0, 43)); AddStandartTableCell("Dsp", VStandartTableCell(1110, 0, 43));
AddStandartTableCell("Dn", VStandartTableCell(826, -3, 37)); AddStandartTableCell("Dn", VStandartTableCell(826, -3, 37));

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -22,20 +22,17 @@
#ifndef VCONTAINER_H #ifndef VCONTAINER_H
#define VCONTAINER_H #define VCONTAINER_H
#include <QTableWidget>
#include "vstandarttablecell.h" #include "vstandarttablecell.h"
#include "vincrementtablerow.h" #include "vincrementtablerow.h"
#include "geometry/varc.h" #include "geometry/varc.h"
#include "geometry/vsplinepath.h" #include "geometry/vsplinepath.h"
#include "geometry/vdetail.h" #include "geometry/vdetail.h"
#include "widgets/vitem.h" #include "widgets/vitem.h"
#include <QCoreApplication>
/** /**
* @brief The VContainer class * @brief The VContainer class
*/ */
class VContainer class VContainer{
{
Q_DECLARE_TR_FUNCTIONS(VContainer) Q_DECLARE_TR_FUNCTIONS(VContainer)
public: public:
/** /**
@ -50,28 +47,30 @@ public:
* @param id * @param id
* @return * @return
*/ */
VPointF GetPoint(qint64 id) const; inline VPointF GetPoint(qint64 id) const {return GetObject(points, id);}
VPointF GetModelingPoint(qint64 id) const; inline VPointF GetModelingPoint(qint64 id) const {return GetObject(modelingPoints, id);}
VStandartTableCell GetStandartTableCell(const QString& name) const; VStandartTableCell GetStandartTableCell(const QString& name) const;
VIncrementTableRow GetIncrementTableRow(const QString& name) const; VIncrementTableRow GetIncrementTableRow(const QString& name) const;
qreal GetLine(const QString &name) const; qreal GetLine(const QString &name) const;
qreal GetLineArc(const QString &name) const; qreal GetLengthArc(const QString &name) const;
VSpline GetSpline(qint64 id) const; qreal GetLengthSpline(const QString &name) const;
VSpline GetModelingSpline(qint64 id) const; qreal GetLineAngle(const QString &name) const;
VArc GetArc(qint64 id) const; inline VSpline GetSpline(qint64 id) const {return GetObject(splines, id);}
VArc GetModelingArc(qint64 id) const; inline VSpline GetModelingSpline(qint64 id) const {return GetObject(modelingSplines, id);}
VSplinePath GetSplinePath(qint64 id) const; inline VArc GetArc(qint64 id) const {return GetObject(arcs, id);}
VSplinePath GetModelingSplinePath(qint64 id) const; inline VArc GetModelingArc(qint64 id) const {return GetObject(modelingArcs, id);}
VDetail GetDetail(qint64 id) const; inline VSplinePath GetSplinePath(qint64 id) const {return GetObject(splinePaths, id);}
static qint64 getId(); inline VSplinePath GetModelingSplinePath(qint64 id) const {return GetObject(modelingSplinePaths, id);}
inline VDetail GetDetail(qint64 id) const {return GetObject(details, id);}
static qint64 getId() {return _id;}
qint64 AddPoint(const VPointF& point); qint64 AddPoint(const VPointF& point);
qint64 AddModelingPoint(const VPointF& point); qint64 AddModelingPoint(const VPointF& point);
qint64 AddDetail(const VDetail& detail); qint64 AddDetail(const VDetail& detail);
void AddStandartTableCell(const QString& name, const VStandartTableCell& cell); inline void AddStandartTableCell(const QString& name, const VStandartTableCell& cell)
void AddIncrementTableRow(const QString& name, const VIncrementTableRow &cell); {standartTable[name] = cell;}
inline void AddIncrementTableRow(const QString& name, const VIncrementTableRow &cell)
{incrementTable[name] = cell;}
void AddLengthLine(const QString &name, const qreal &value); void AddLengthLine(const QString &name, const qreal &value);
void AddLengthSpline(const qint64 &firstPointId, const qint64 &secondPointId,
Draw::Draws mode = Draw::Calculation);
void AddLengthSpline(const QString &name, const qreal &value); void AddLengthSpline(const QString &name, const qreal &value);
void AddLengthArc(const qint64 &center, const qint64 &id); void AddLengthArc(const qint64 &center, const qint64 &id);
void AddLengthArc(const QString &name, const qreal &value); void AddLengthArc(const QString &name, const qreal &value);
@ -92,8 +91,7 @@ public:
Draw::Draws mode = Draw::Calculation) const; Draw::Draws mode = Draw::Calculation) const;
QString GetNameSplinePath(const VSplinePath &path, QString GetNameSplinePath(const VSplinePath &path,
Draw::Draws mode = Draw::Calculation) const; Draw::Draws mode = Draw::Calculation) const;
QString GetNameArc(const qint64 &center, const qint64 &id, QString GetNameArc(const qint64 &center, const qint64 &id, Draw::Draws mode = Draw::Calculation) const;
Draw::Draws mode = Draw::Calculation) const;
void UpdatePoint(qint64 id, const VPointF& point); void UpdatePoint(qint64 id, const VPointF& point);
void UpdateModelingPoint(qint64 id, const VPointF& point); void UpdateModelingPoint(qint64 id, const VPointF& point);
void UpdateDetail(qint64 id, const VDetail& detail); void UpdateDetail(qint64 id, const VDetail& detail);
@ -103,75 +101,76 @@ public:
void UpdateModelingSplinePath(qint64 id, const VSplinePath& splPath); void UpdateModelingSplinePath(qint64 id, const VSplinePath& splPath);
void UpdateArc(qint64 id, const VArc& arc); void UpdateArc(qint64 id, const VArc& arc);
void UpdateModelingArc(qint64 id, const VArc& arc); void UpdateModelingArc(qint64 id, const VArc& arc);
void UpdateStandartTableCell(const QString& name, const VStandartTableCell& cell); inline void UpdateStandartTableCell(const QString& name, const VStandartTableCell& cell)
void UpdateIncrementTableRow(const QString& name, const VIncrementTableRow& cell); {standartTable[name] = cell;}
inline void UpdateIncrementTableRow(const QString& name, const VIncrementTableRow& cell)
{incrementTable[name] = cell;}
qreal GetValueStandartTableCell(const QString& name) const; qreal GetValueStandartTableCell(const QString& name) const;
qreal GetValueIncrementTableRow(const QString& name) const; qreal GetValueIncrementTableRow(const QString& name) const;
void Clear(); void Clear();
void ClearObject(); void ClearObject();
void ClearIncrementTable(); inline void ClearIncrementTable() {incrementTable.clear();}
void ClearLengthLines(); inline void ClearLengthLines() {lengthLines.clear();}
void ClearLengthSplines(); inline void ClearLengthSplines() {lengthSplines.clear();}
void ClearLengthArcs(); inline void ClearLengthArcs() {lengthArcs.clear();}
void ClearLineAngles(); inline void ClearLineAngles() {lineAngles.clear();}
void SetSize(qint32 size); inline void SetSize(qint32 size) {base["Сг"] = size;}
void SetGrowth(qint32 growth); inline void SetGrowth(qint32 growth) {base["Р"] = growth;}
qint32 size() const; inline qint32 size() const {return base.value("Сг");}
qint32 growth() const; inline qint32 growth() const {return base.value("Р");}
qreal FindVar(const QString& name, bool *ok)const; qreal FindVar(const QString& name, bool *ok)const;
bool IncrementTableContains(const QString& name); inline bool IncrementTableContains(const QString& name) {return incrementTable.contains(name);}
static qint64 getNextId(); static qint64 getNextId();
void RemoveIncrementTableRow(const QString& name); inline void RemoveIncrementTableRow(const QString& name) {incrementTable.remove(name);}
const QMap<qint64, VPointF> *DataPoints() const; inline const QHash<qint64, VPointF> *DataPoints() const {return &points;}
const QMap<qint64, VPointF> *DataModelingPoints() const; inline const QHash<qint64, VPointF> *DataModelingPoints() const {return &modelingPoints;}
const QMap<qint64, VSpline> *DataSplines() const; inline const QHash<qint64, VSpline> *DataSplines() const {return &splines;}
const QMap<qint64, VSpline> *DataModelingSplines() const; inline const QHash<qint64, VSpline> *DataModelingSplines() const {return &modelingSplines;}
const QMap<qint64, VArc> *DataArcs() const; inline const QHash<qint64, VArc> *DataArcs() const {return &arcs;}
const QMap<qint64, VArc> *DataModelingArcs() const; inline const QHash<qint64, VArc> *DataModelingArcs() const {return &modelingArcs;}
const QMap<QString, qint32> *DataBase() const; inline const QHash<QString, qint32> *DataBase() const {return &base;}
const QMap<QString, VStandartTableCell> *DataStandartTable() const; inline const QHash<QString, VStandartTableCell> *DataStandartTable() const {return &standartTable;}
const QMap<QString, VIncrementTableRow> *DataIncrementTable() const; inline const QHash<QString, VIncrementTableRow> *DataIncrementTable() const {return &incrementTable;}
const QMap<QString, qreal> *DataLengthLines() const; inline const QHash<QString, qreal> *DataLengthLines() const {return &lengthLines;}
const QMap<QString, qreal> *DataLengthSplines() const; inline const QHash<QString, qreal> *DataLengthSplines() const {return &lengthSplines;}
const QMap<QString, qreal> *DataLengthArcs() const; inline const QHash<QString, qreal> *DataLengthArcs() const {return &lengthArcs;}
const QMap<QString, qreal> *DataLineAngles() const; inline const QHash<QString, qreal> *DataLineAngles() const {return &lineAngles;}
const QMap<qint64, VSplinePath> *DataSplinePaths() const; inline const QHash<qint64, VSplinePath> *DataSplinePaths() const {return &splinePaths;}
const QMap<qint64, VSplinePath> *DataModelingSplinePaths() const; inline const QHash<qint64, VSplinePath> *DataModelingSplinePaths() const {return &modelingSplinePaths;}
const QMap<qint64, VDetail> *DataDetails() const; inline const QHash<qint64, VDetail> *DataDetails() const {return &details;}
static void UpdateId(qint64 newId); static void UpdateId(qint64 newId);
QPainterPath ContourPath(qint64 idDetail) const; QPainterPath ContourPath(qint64 idDetail) const;
QPainterPath Equidistant(QVector<QPointF> points, const Detail::Equidistant &eqv, QVector<QPointF> biasPoints(const QVector<QPointF> &points, const qreal &mx, const qreal &my) const;
const qreal &width)const; QPainterPath Equidistant(QVector<QPointF> points, const Detail::Equidistant &eqv, const qreal &width)const;
static QLineF ParallelLine(const QLineF &line, qreal width ); static QLineF ParallelLine(const QLineF &line, qreal width );
static QPointF SingleParallelPoint(const QLineF &line, const qreal &angle, const qreal &width); static QPointF SingleParallelPoint(const QLineF &line, const qreal &angle, const qreal &width);
QVector<QPointF> EkvPoint(const QLineF &line1, const QLineF &line2, const qreal &width)const; QVector<QPointF> EkvPoint(const QLineF &line1, const QLineF &line2, const qreal &width)const;
QVector<QPointF> CheckLoops(const QVector<QPointF> &points) const; QVector<QPointF> CheckLoops(const QVector<QPointF> &points) const;
void PrepareDetails(QVector<VItem*> & list)const; void PrepareDetails(QVector<VItem *> & list) const;
private: private:
static qint64 _id; static qint64 _id;
QMap<QString, qint32> base; QHash<QString, qint32> base;
QMap<qint64, VPointF> points; QHash<qint64, VPointF> points;
QMap<qint64, VPointF> modelingPoints; QHash<qint64, VPointF> modelingPoints;
QMap<QString, VStandartTableCell> standartTable; QHash<QString, VStandartTableCell> standartTable;
QMap<QString, VIncrementTableRow> incrementTable; QHash<QString, VIncrementTableRow> incrementTable;
QMap<QString, qreal> lengthLines; QHash<QString, qreal> lengthLines;
QMap<QString, qreal> lineAngles; QHash<QString, qreal> lineAngles;
QMap<qint64, VSpline> splines; QHash<qint64, VSpline> splines;
QMap<qint64, VSpline> modelingSplines; QHash<qint64, VSpline> modelingSplines;
QMap<QString, qreal> lengthSplines; QHash<QString, qreal> lengthSplines;
QMap<qint64, VArc> arcs; QHash<qint64, VArc> arcs;
QMap<qint64, VArc> modelingArcs; QHash<qint64, VArc> modelingArcs;
QMap<QString, qreal> lengthArcs; QHash<QString, qreal> lengthArcs;
QMap<qint64, VSplinePath> splinePaths; QHash<qint64, VSplinePath> splinePaths;
QMap<qint64, VSplinePath> modelingSplinePaths; QHash<qint64, VSplinePath> modelingSplinePaths;
QMap<qint64, VDetail> details; QHash<qint64, VDetail> details;
template <typename key, typename val> static val GetObject(const QMap<key,val> &obj, key id);
template <typename val> static void UpdateObject(QMap<qint64, val> &obj, const qint64 &id,
const val& point);
template <typename key, typename val> static qint64 AddObject(QMap<key, val> &obj, const val& value);
void CreateManTableIGroup (); void CreateManTableIGroup ();
QVector<QPointF> GetReversePoint(const QVector<QPointF> &points)const; QVector<QPointF> GetReversePoint(const QVector<QPointF> &points)const;
qreal GetLengthContour(const QVector<QPointF> &contour, const QVector<QPointF> &newPoints)const; qreal GetLengthContour(const QVector<QPointF> &contour, const QVector<QPointF> &newPoints)const;
template <typename key, typename val> static val GetObject(const QHash<key,val> &obj, key id);
template <typename val> static void UpdateObject(QHash<qint64, val> &obj, const qint64 &id, const val& point);
template <typename key, typename val> static qint64 AddObject(QHash<key, val> &obj, const val& value);
}; };
#endif // VCONTAINER_H #endif // VCONTAINER_H

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -29,42 +29,4 @@ VIncrementTableRow::VIncrementTableRow(qint64 id, qreal base, qreal ksize, qreal
kgrowth(kgrowth), description(description){ kgrowth(kgrowth), description(description){
} }
QString VIncrementTableRow::getDescription() const{
return description;
}
void VIncrementTableRow::setDescription(const QString &value){
description = value;
}
qreal VIncrementTableRow::getKgrowth() const{
return kgrowth;
}
void VIncrementTableRow::setKgrowth(const qreal &value){
kgrowth = value;
}
qreal VIncrementTableRow::getKsize() const{
return ksize;
}
void VIncrementTableRow::setKsize(const qreal &value){
ksize = value;
}
qreal VIncrementTableRow::getBase() const{
return base;
}
void VIncrementTableRow::setBase(const qreal &value){
base = value;
}
qint64 VIncrementTableRow::getId() const{
return id;
}
void VIncrementTableRow::setId(const qint64 &value){
id = value;
}

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -22,29 +22,21 @@
#ifndef VINCREMENTTABLEROW_H #ifndef VINCREMENTTABLEROW_H
#define VINCREMENTTABLEROW_H #define VINCREMENTTABLEROW_H
#include <QString> class VIncrementTableRow{
class VIncrementTableRow
{
public: public:
VIncrementTableRow(); VIncrementTableRow();
VIncrementTableRow(qint64 id, qreal base, qreal ksize, qreal kgrowth, VIncrementTableRow(qint64 id, qreal base, qreal ksize, qreal kgrowth,
QString description = QString()); QString description = QString());
qint64 getId() const; inline qint64 getId() const {return id;}
void setId(const qint64 &value); inline void setId(const qint64 &value) {id = value;}
inline qreal getBase() const {return base;}
qreal getBase() const; inline void setBase(const qreal &value) {base = value;}
void setBase(const qreal &value); inline qreal getKsize() const {return ksize;}
inline void setKsize(const qreal &value) {ksize = value;}
qreal getKsize() const; inline qreal getKgrowth() const {return kgrowth;}
void setKsize(const qreal &value); inline void setKgrowth(const qreal &value) {kgrowth = value;}
inline QString getDescription() const {return description;}
qreal getKgrowth() const; inline void setDescription(const QString &value) {description = value;}
void setKgrowth(const qreal &value);
QString getDescription() const;
void setDescription(const QString &value);
private: private:
qint64 id; qint64 id;
qreal base; qreal base;

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -22,10 +22,6 @@
#ifndef VPOINTF_H #ifndef VPOINTF_H
#define VPOINTF_H #define VPOINTF_H
#include <QPointF>
#include <QString>
#include "options.h"
class VPointF{ class VPointF{
public: public:
inline VPointF () inline VPointF ()

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -27,19 +27,3 @@ VStandartTableCell::VStandartTableCell():base(0), ksize(0), kgrowth(0), descript
VStandartTableCell::VStandartTableCell(qint32 base, qreal ksize, qreal kgrowth, QString description):base(base), VStandartTableCell::VStandartTableCell(qint32 base, qreal ksize, qreal kgrowth, QString description):base(base),
ksize(ksize), kgrowth(kgrowth), description(description){ ksize(ksize), kgrowth(kgrowth), description(description){
} }
qint32 VStandartTableCell::GetBase() const{
return base;
}
qreal VStandartTableCell::GetKsize() const{
return ksize;
}
qreal VStandartTableCell::GetKgrowth() const{
return kgrowth;
}
QString VStandartTableCell::GetDescription() const{
return description;
}

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -22,17 +22,14 @@
#ifndef VSTANDARTTABLECELL_H #ifndef VSTANDARTTABLECELL_H
#define VSTANDARTTABLECELL_H #define VSTANDARTTABLECELL_H
#include <QString> class VStandartTableCell{
class VStandartTableCell
{
public: public:
VStandartTableCell(); VStandartTableCell();
VStandartTableCell(qint32 base, qreal ksize, qreal kgrowth, QString description = QString()); VStandartTableCell(qint32 base, qreal ksize, qreal kgrowth, QString description = QString());
qint32 GetBase() const; inline qint32 GetBase() const {return base;}
qreal GetKsize() const; inline qreal GetKsize() const {return ksize;}
qreal GetKgrowth() const; inline qreal GetKgrowth() const {return kgrowth;}
QString GetDescription() const; inline QString GetDescription() const {return description;}
private: private:
qint32 base; qint32 base;
qreal ksize; qreal ksize;

View File

@ -12,5 +12,8 @@
<file>cursor/splinepath_cursor.png</file> <file>cursor/splinepath_cursor.png</file>
<file>cursor/pointcontact_cursor.png</file> <file>cursor/pointcontact_cursor.png</file>
<file>cursor/new_detail_cursor.png</file> <file>cursor/new_detail_cursor.png</file>
<file>cursor/height_cursor.png</file>
<file>cursor/triangle_cursor.png</file>
<file>cursor/pointofintersect_cursor.png</file>
</qresource> </qresource>
</RCC> </RCC>

BIN
cursor/height_cursor.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
cursor/triangle_cursor.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -33,7 +33,11 @@ DialogAlongLine::DialogAlongLine(const VContainer *data, Draw::Draws mode, QWidg
radioButtonStandartTable = ui->radioButtonStandartTable; radioButtonStandartTable = ui->radioButtonStandartTable;
radioButtonIncrements = ui->radioButtonIncrements; radioButtonIncrements = ui->radioButtonIncrements;
radioButtonLengthLine = ui->radioButtonLengthLine; radioButtonLengthLine = ui->radioButtonLengthLine;
radioButtonLengthArc = ui->radioButtonLengthArc;
radioButtonLengthCurve = ui->radioButtonLengthSpline;
lineEditFormula = ui->lineEditFormula; lineEditFormula = ui->lineEditFormula;
labelEditFormula = ui->labelEditFormula;
labelEditNamePoint = ui->labelEditNamePoint;
flagFormula = false; flagFormula = false;
bOk = ui->buttonBox->button(QDialogButtonBox::Ok); bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogAlongLine::DialogAccepted); connect(bOk, &QPushButton::clicked, this, &DialogAlongLine::DialogAccepted);
@ -42,6 +46,7 @@ DialogAlongLine::DialogAlongLine(const VContainer *data, Draw::Draws mode, QWidg
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
connect(bCansel, &QPushButton::clicked, this, &DialogAlongLine::DialogRejected); connect(bCansel, &QPushButton::clicked, this, &DialogAlongLine::DialogRejected);
FillComboBoxTypeLine(ui->comboBoxLineType); FillComboBoxTypeLine(ui->comboBoxLineType);
ui->comboBoxLineType->setCurrentIndex(1);
FillComboBoxPoints(ui->comboBoxFirstPoint); FillComboBoxPoints(ui->comboBoxFirstPoint);
FillComboBoxPoints(ui->comboBoxSecondPoint); FillComboBoxPoints(ui->comboBoxSecondPoint);
@ -54,13 +59,14 @@ DialogAlongLine::DialogAlongLine(const VContainer *data, Draw::Draws mode, QWidg
connect(ui->radioButtonStandartTable, &QRadioButton::clicked, this, &DialogAlongLine::StandartTable); connect(ui->radioButtonStandartTable, &QRadioButton::clicked, this, &DialogAlongLine::StandartTable);
connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogAlongLine::Increments); connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogAlongLine::Increments);
connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogAlongLine::LengthLines); connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogAlongLine::LengthLines);
connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogAlongLine::LengthArcs);
connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogAlongLine::LengthCurves);
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogAlongLine::EvalFormula); connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogAlongLine::EvalFormula);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogAlongLine::NamePointChanged); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogAlongLine::NamePointChanged);
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogAlongLine::FormulaChanged); connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogAlongLine::FormulaChanged);
} }
DialogAlongLine::~DialogAlongLine() DialogAlongLine::~DialogAlongLine(){
{
delete ui; delete ui;
} }
@ -88,6 +94,7 @@ void DialogAlongLine::ChoosedObject(qint64 id, Scene::Scenes type){
if ( index != -1 ) { // -1 for not found if ( index != -1 ) { // -1 for not found
ui->comboBoxFirstPoint->setCurrentIndex(index); ui->comboBoxFirstPoint->setCurrentIndex(index);
number++; number++;
emit ToolTip(tr("Select second point of line"));
return; return;
} }
} }
@ -96,6 +103,7 @@ void DialogAlongLine::ChoosedObject(qint64 id, Scene::Scenes type){
if ( index != -1 ) { // -1 for not found if ( index != -1 ) { // -1 for not found
ui->comboBoxSecondPoint->setCurrentIndex(index); ui->comboBoxSecondPoint->setCurrentIndex(index);
number = 0; number = 0;
emit ToolTip("");
} }
if(!isInitialized){ if(!isInitialized){
this->show(); this->show();
@ -113,44 +121,24 @@ void DialogAlongLine::DialogAccepted(){
emit DialogClosed(QDialog::Accepted); emit DialogClosed(QDialog::Accepted);
} }
qint64 DialogAlongLine::getSecondPointId() const{
return secondPointId;
}
void DialogAlongLine::setSecondPointId(const qint64 &value, const qint64 &id){ void DialogAlongLine::setSecondPointId(const qint64 &value, const qint64 &id){
setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id); setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id);
} }
qint64 DialogAlongLine::getFirstPointId() const{
return firstPointId;
}
void DialogAlongLine::setFirstPointId(const qint64 &value, const qint64 &id){ void DialogAlongLine::setFirstPointId(const qint64 &value, const qint64 &id){
setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id); setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id);
} }
QString DialogAlongLine::getFormula() const{
return formula;
}
void DialogAlongLine::setFormula(const QString &value){ void DialogAlongLine::setFormula(const QString &value){
formula = value; formula = value;
ui->lineEditFormula->setText(formula); ui->lineEditFormula->setText(formula);
} }
QString DialogAlongLine::getTypeLine() const{
return typeLine;
}
void DialogAlongLine::setTypeLine(const QString &value){ void DialogAlongLine::setTypeLine(const QString &value){
typeLine = value; typeLine = value;
SetupTypeLine(ui->comboBoxLineType, value); SetupTypeLine(ui->comboBoxLineType, value);
} }
QString DialogAlongLine::getPointName() const{
return pointName;
}
void DialogAlongLine::setPointName(const QString &value){ void DialogAlongLine::setPointName(const QString &value){
pointName = value; pointName = value;
ui->lineEditNamePoint->setText(pointName); ui->lineEditNamePoint->setText(pointName);

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -23,28 +23,26 @@
#define DIALOGALONGLINE_H #define DIALOGALONGLINE_H
#include "dialogtool.h" #include "dialogtool.h"
#include "container/calculator.h"
namespace Ui { namespace Ui {
class DialogAlongLine; class DialogAlongLine;
} }
class DialogAlongLine : public DialogTool class DialogAlongLine : public DialogTool{
{
Q_OBJECT Q_OBJECT
public: public:
explicit DialogAlongLine(const VContainer *data, Draw::Draws mode = Draw::Calculation, DialogAlongLine(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0); QWidget *parent = 0);
~DialogAlongLine(); ~DialogAlongLine();
QString getPointName() const; inline QString getPointName() const {return pointName;}
void setPointName(const QString &value); void setPointName(const QString &value);
QString getTypeLine() const; inline QString getTypeLine() const {return typeLine;}
void setTypeLine(const QString &value); void setTypeLine(const QString &value);
QString getFormula() const; inline QString getFormula() const {return formula;}
void setFormula(const QString &value); void setFormula(const QString &value);
qint64 getFirstPointId() const; inline qint64 getFirstPointId() const {return firstPointId;}
void setFirstPointId(const qint64 &value, const qint64 &id); void setFirstPointId(const qint64 &value, const qint64 &id);
qint64 getSecondPointId() const; inline qint64 getSecondPointId() const {return secondPointId;}
void setSecondPointId(const qint64 &value, const qint64 &id); void setSecondPointId(const qint64 &value, const qint64 &id);
public slots: public slots:
virtual void ChoosedObject(qint64 id, Scene::Scenes type); virtual void ChoosedObject(qint64 id, Scene::Scenes type);

View File

@ -24,23 +24,67 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="labelEditFormula">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred"> <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text"> <property name="text">
<string>Length</string> <string>Length</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLineEdit" name="lineEditFormula"/> <widget class="QLineEdit" name="lineEditFormula">
<property name="toolTip">
<string>Formula calculation of length of line</string>
</property>
</widget>
</item> </item>
<item> <item>
<widget class="QToolButton" name="toolButtonEqual"> <widget class="QToolButton" name="toolButtonEqual">
<property name="toolTip">
<string>Calculate formula</string>
</property>
<property name="text"> <property name="text">
<string>...</string> <string>...</string>
</property> </property>
@ -76,6 +120,9 @@
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="toolTip">
<string>Value of length</string>
</property>
<property name="text"> <property name="text">
<string>_</string> <string>_</string>
</property> </property>
@ -90,7 +137,44 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<item> <item>
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="labelEditNamePoint">
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text"> <property name="text">
<string>Name new point</string> <string>Name new point</string>
</property> </property>
@ -101,6 +185,9 @@
</item> </item>
<item> <item>
<widget class="QToolButton" name="toolButtonPutHere"> <widget class="QToolButton" name="toolButtonPutHere">
<property name="toolTip">
<string>Put variable into formula</string>
</property>
<property name="text"> <property name="text">
<string>...</string> <string>...</string>
</property> </property>
@ -128,7 +215,11 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="comboBoxFirstPoint"/> <widget class="QComboBox" name="comboBoxFirstPoint">
<property name="toolTip">
<string>First point of line</string>
</property>
</widget>
</item> </item>
</layout> </layout>
</item> </item>
@ -142,7 +233,11 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="comboBoxSecondPoint"/> <widget class="QComboBox" name="comboBoxSecondPoint">
<property name="toolTip">
<string>Second point of line</string>
</property>
</widget>
</item> </item>
</layout> </layout>
</item> </item>
@ -156,7 +251,11 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="comboBoxLineType"/> <widget class="QComboBox" name="comboBoxLineType">
<property name="toolTip">
<string>Show line from first point to our point</string>
</property>
</widget>
</item> </item>
</layout> </layout>
</item> </item>
@ -203,7 +302,7 @@
<item> <item>
<widget class="QRadioButton" name="radioButtonLengthArc"> <widget class="QRadioButton" name="radioButtonLengthArc">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>true</bool>
</property> </property>
<property name="text"> <property name="text">
<string>Length of arcs</string> <string>Length of arcs</string>
@ -213,7 +312,7 @@
<item> <item>
<widget class="QRadioButton" name="radioButtonLengthSpline"> <widget class="QRadioButton" name="radioButtonLengthSpline">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>true</bool>
</property> </property>
<property name="text"> <property name="text">
<string>Length of curves</string> <string>Length of curves</string>
@ -225,7 +324,11 @@
</layout> </layout>
</item> </item>
<item> <item>
<widget class="QListWidget" name="listWidget"/> <widget class="QListWidget" name="listWidget">
<property name="toolTip">
<string>Variables. Click twice to select.</string>
</property>
</widget>
</item> </item>
</layout> </layout>
</item> </item>
@ -248,6 +351,23 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<tabstops>
<tabstop>lineEditFormula</tabstop>
<tabstop>toolButtonEqual</tabstop>
<tabstop>lineEditNamePoint</tabstop>
<tabstop>comboBoxFirstPoint</tabstop>
<tabstop>comboBoxSecondPoint</tabstop>
<tabstop>comboBoxLineType</tabstop>
<tabstop>radioButtonSizeGrowth</tabstop>
<tabstop>radioButtonStandartTable</tabstop>
<tabstop>radioButtonIncrements</tabstop>
<tabstop>radioButtonLengthLine</tabstop>
<tabstop>radioButtonLengthArc</tabstop>
<tabstop>radioButtonLengthSpline</tabstop>
<tabstop>listWidget</tabstop>
<tabstop>toolButtonPutHere</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources> <resources>
<include location="../icon.qrc"/> <include location="../icon.qrc"/>
</resources> </resources>

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -21,7 +21,6 @@
#include "dialogarc.h" #include "dialogarc.h"
#include "ui_dialogarc.h" #include "ui_dialogarc.h"
#include "../container/calculator.h"
DialogArc::DialogArc(const VContainer *data, Draw::Draws mode, QWidget *parent) : DialogArc::DialogArc(const VContainer *data, Draw::Draws mode, QWidget *parent) :
DialogTool(data, mode, parent), ui(new Ui::DialogArc), flagRadius(false), flagF1(false), flagF2(false), DialogTool(data, mode, parent), ui(new Ui::DialogArc), flagRadius(false), flagF1(false), flagF2(false),
@ -52,6 +51,8 @@ DialogArc::DialogArc(const VContainer *data, Draw::Draws mode, QWidget *parent)
radioButtonStandartTable = ui->radioButtonStandartTable; radioButtonStandartTable = ui->radioButtonStandartTable;
radioButtonIncrements = ui->radioButtonIncrements; radioButtonIncrements = ui->radioButtonIncrements;
radioButtonLengthLine = ui->radioButtonLengthLine; radioButtonLengthLine = ui->radioButtonLengthLine;
radioButtonLengthArc = ui->radioButtonLengthArc;
radioButtonLengthCurve = ui->radioButtonLengthSpline;
connect(ui->toolButtonPutHereRadius, &QPushButton::clicked, this, &DialogArc::PutRadius); connect(ui->toolButtonPutHereRadius, &QPushButton::clicked, this, &DialogArc::PutRadius);
connect(ui->toolButtonPutHereF1, &QPushButton::clicked, this, &DialogArc::PutF1); connect(ui->toolButtonPutHereF1, &QPushButton::clicked, this, &DialogArc::PutF1);
@ -63,7 +64,9 @@ DialogArc::DialogArc(const VContainer *data, Draw::Draws mode, QWidget *parent)
connect(ui->radioButtonStandartTable, &QRadioButton::clicked, this, &DialogArc::StandartTable); connect(ui->radioButtonStandartTable, &QRadioButton::clicked, this, &DialogArc::StandartTable);
connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogArc::Increments); connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogArc::Increments);
connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogArc::LengthLines); connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogArc::LengthLines);
connect(ui->radioButtonLineAngles, &QRadioButton::clicked, this, &DialogArc::LineArcs); connect(ui->radioButtonLineAngles, &QRadioButton::clicked, this, &DialogArc::LineAngles);
connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogArc::LengthArcs);
connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogArc::LengthCurves);
connect(ui->toolButtonEqualRadius, &QPushButton::clicked, this, &DialogArc::EvalRadius); connect(ui->toolButtonEqualRadius, &QPushButton::clicked, this, &DialogArc::EvalRadius);
connect(ui->toolButtonEqualF1, &QPushButton::clicked, this, &DialogArc::EvalF1); connect(ui->toolButtonEqualF1, &QPushButton::clicked, this, &DialogArc::EvalF1);
@ -74,8 +77,8 @@ DialogArc::DialogArc(const VContainer *data, Draw::Draws mode, QWidget *parent)
connect(ui->lineEditF2, &QLineEdit::textChanged, this, &DialogArc::F2Changed); connect(ui->lineEditF2, &QLineEdit::textChanged, this, &DialogArc::F2Changed);
} }
qint64 DialogArc::GetCenter() const{ DialogArc::~DialogArc(){
return center; delete ui;
} }
void DialogArc::SetCenter(const qint64 &value){ void DialogArc::SetCenter(const qint64 &value){
@ -83,37 +86,21 @@ void DialogArc::SetCenter(const qint64 &value){
ChangeCurrentData(ui->comboBoxBasePoint, center); ChangeCurrentData(ui->comboBoxBasePoint, center);
} }
QString DialogArc::GetF2() const{
return f2;
}
void DialogArc::SetF2(const QString &value){ void DialogArc::SetF2(const QString &value){
f2 = value; f2 = value;
ui->lineEditF2->setText(f2); ui->lineEditF2->setText(f2);
} }
QString DialogArc::GetF1() const{
return f1;
}
void DialogArc::SetF1(const QString &value){ void DialogArc::SetF1(const QString &value){
f1 = value; f1 = value;
ui->lineEditF1->setText(f1); ui->lineEditF1->setText(f1);
} }
QString DialogArc::GetRadius() const{
return radius;
}
void DialogArc::SetRadius(const QString &value){ void DialogArc::SetRadius(const QString &value){
radius = value; radius = value;
ui->lineEditRadius->setText(radius); ui->lineEditRadius->setText(radius);
} }
DialogArc::~DialogArc(){
delete ui;
}
void DialogArc::ChoosedObject(qint64 id, Scene::Scenes type){ void DialogArc::ChoosedObject(qint64 id, Scene::Scenes type){
if(idDetail == 0 && mode == Draw::Modeling){ if(idDetail == 0 && mode == Draw::Modeling){
if(type == Scene::Detail){ if(type == Scene::Detail){
@ -134,6 +121,7 @@ void DialogArc::ChoosedObject(qint64 id, Scene::Scenes type){
point = data->GetModelingPoint(id); point = data->GetModelingPoint(id);
} }
ChangeCurrentText(ui->comboBoxBasePoint, point.name()); ChangeCurrentText(ui->comboBoxBasePoint, point.name());
emit ToolTip("");
this->show(); this->show();
} }
} }
@ -152,8 +140,8 @@ void DialogArc::ValChenged(int row){
} }
QListWidgetItem *item = ui->listWidget->item( row ); QListWidgetItem *item = ui->listWidget->item( row );
if(ui->radioButtonLineAngles->isChecked()){ if(ui->radioButtonLineAngles->isChecked()){
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetLineArc(item->text())) QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetLineAngle(item->text()))
.arg("Значення кута лінії."); .arg(tr("Value angle of line."));
ui->labelDescription->setText(desc); ui->labelDescription->setText(desc);
return; return;
} }
@ -172,45 +160,52 @@ void DialogArc::PutF2(){
PutValHere(ui->lineEditF2, ui->listWidget); PutValHere(ui->lineEditF2, ui->listWidget);
} }
void DialogArc::LineArcs(){ void DialogArc::LineAngles(){
ShowLineArcs(); ShowLineAngles();
} }
void DialogArc::RadiusChanged(){ void DialogArc::RadiusChanged(){
labelEditFormula = ui->labelEditRadius;
ValFormulaChanged(flagRadius, ui->lineEditRadius, timerRadius); ValFormulaChanged(flagRadius, ui->lineEditRadius, timerRadius);
} }
void DialogArc::F1Changed(){ void DialogArc::F1Changed(){
labelEditFormula = ui->labelEditF1;
ValFormulaChanged(flagF1, ui->lineEditF1, timerF1); ValFormulaChanged(flagF1, ui->lineEditF1, timerF1);
} }
void DialogArc::F2Changed(){ void DialogArc::F2Changed(){
labelEditFormula = ui->labelEditF2;
ValFormulaChanged(flagF2, ui->lineEditF2, timerF2); ValFormulaChanged(flagF2, ui->lineEditF2, timerF2);
} }
void DialogArc::CheckState(){ void DialogArc::CheckState(){
Q_CHECK_PTR(bOk); Q_ASSERT(bOk != 0);
bOk->setEnabled(flagRadius && flagF1 && flagF2); bOk->setEnabled(flagRadius && flagF1 && flagF2);
} }
void DialogArc::EvalRadius(){ void DialogArc::EvalRadius(){
labelEditFormula = ui->labelEditRadius;
Eval(ui->lineEditRadius, flagRadius, timerRadius, ui->labelResultRadius); Eval(ui->lineEditRadius, flagRadius, timerRadius, ui->labelResultRadius);
} }
void DialogArc::EvalF1(){ void DialogArc::EvalF1(){
labelEditFormula = ui->labelEditF1;
Eval(ui->lineEditF1, flagF1, timerF1, ui->labelResultF1); Eval(ui->lineEditF1, flagF1, timerF1, ui->labelResultF1);
} }
void DialogArc::EvalF2(){ void DialogArc::EvalF2(){
labelEditFormula = ui->labelEditF2;
Eval(ui->lineEditF2, flagF2, timerF2, ui->labelResultF2); Eval(ui->lineEditF2, flagF2, timerF2, ui->labelResultF2);
} }
void DialogArc::ShowLineArcs(){ void DialogArc::ShowLineAngles(){
disconnect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged); disconnect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged);
ui->listWidget->clear(); ui->listWidget->clear();
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged); connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged);
const QMap<QString, qreal> *lineArcsTable = data->DataLineAngles(); const QHash<QString, qreal> *lineAnglesTable = data->DataLineAngles();
QMapIterator<QString, qreal> i(*lineArcsTable); Q_ASSERT(lineAnglesTable != 0);
QHashIterator<QString, qreal> i(*lineAnglesTable);
while (i.hasNext()) { while (i.hasNext()) {
i.next(); i.next();
QListWidgetItem *item = new QListWidgetItem(i.key()); QListWidgetItem *item = new QListWidgetItem(i.key());

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -28,24 +28,19 @@ namespace Ui {
class DialogArc; class DialogArc;
} }
class DialogArc : public DialogTool class DialogArc : public DialogTool{
{
Q_OBJECT Q_OBJECT
public: public:
explicit DialogArc(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0); DialogArc(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0);
~DialogArc(); ~DialogArc();
qint64 GetCenter() const; inline qint64 GetCenter() const {return center;}
void SetCenter(const qint64 &value); void SetCenter(const qint64 &value);
inline QString GetRadius() const {return radius;}
QString GetRadius() const;
void SetRadius(const QString &value); void SetRadius(const QString &value);
inline QString GetF1() const {return f1;}
QString GetF1() const;
void SetF1(const QString &value); void SetF1(const QString &value);
inline QString GetF2() const {return f2;}
QString GetF2() const;
void SetF2(const QString &value); void SetF2(const QString &value);
public slots: public slots:
virtual void ChoosedObject(qint64 id, Scene::Scenes type); virtual void ChoosedObject(qint64 id, Scene::Scenes type);
virtual void DialogAccepted(); virtual void DialogAccepted();
@ -53,7 +48,7 @@ public slots:
void PutRadius(); void PutRadius();
void PutF1(); void PutF1();
void PutF2(); void PutF2();
void LineArcs(); void LineAngles();
void RadiusChanged(); void RadiusChanged();
void F1Changed(); void F1Changed();
void F2Changed(); void F2Changed();
@ -75,7 +70,7 @@ private:
void EvalRadius(); void EvalRadius();
void EvalF1(); void EvalF1();
void EvalF2(); void EvalF2();
void ShowLineArcs(); void ShowLineAngles();
}; };
#endif // DIALOGARC_H #endif // DIALOGARC_H

View File

@ -24,13 +24,50 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="labelEditRadius">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred"> <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text"> <property name="text">
<string>Radius</string> <string>Radius</string>
</property> </property>
@ -44,10 +81,16 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="toolTip">
<string>Formula calculation of radius of arc</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QToolButton" name="toolButtonPutHereRadius"> <widget class="QToolButton" name="toolButtonPutHereRadius">
<property name="toolTip">
<string>Put variable into formula</string>
</property>
<property name="text"> <property name="text">
<string>...</string> <string>...</string>
</property> </property>
@ -65,6 +108,9 @@
</item> </item>
<item> <item>
<widget class="QToolButton" name="toolButtonEqualRadius"> <widget class="QToolButton" name="toolButtonEqualRadius">
<property name="toolTip">
<string>Calculate formula</string>
</property>
<property name="text"> <property name="text">
<string>...</string> <string>...</string>
</property> </property>
@ -94,6 +140,9 @@
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="toolTip">
<string>Value of radius</string>
</property>
<property name="text"> <property name="text">
<string>_</string> <string>_</string>
</property> </property>
@ -104,13 +153,50 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item> <item>
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="labelEditF1">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred"> <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text"> <property name="text">
<string>First angle degree</string> <string>First angle degree</string>
</property> </property>
@ -124,10 +210,16 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="toolTip">
<string>First angle of arc counterclockwise</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QToolButton" name="toolButtonPutHereF1"> <widget class="QToolButton" name="toolButtonPutHereF1">
<property name="toolTip">
<string>Put variable into formula</string>
</property>
<property name="text"> <property name="text">
<string>...</string> <string>...</string>
</property> </property>
@ -145,6 +237,9 @@
</item> </item>
<item> <item>
<widget class="QToolButton" name="toolButtonEqualF1"> <widget class="QToolButton" name="toolButtonEqualF1">
<property name="toolTip">
<string>Calculate formula</string>
</property>
<property name="text"> <property name="text">
<string>...</string> <string>...</string>
</property> </property>
@ -174,6 +269,9 @@
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="toolTip">
<string>Value of first angle</string>
</property>
<property name="text"> <property name="text">
<string>_</string> <string>_</string>
</property> </property>
@ -184,13 +282,50 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<item> <item>
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="labelEditF2">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred"> <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text"> <property name="text">
<string>Second angle degree</string> <string>Second angle degree</string>
</property> </property>
@ -204,10 +339,16 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="toolTip">
<string>Second angle of arc counterclockwise</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QToolButton" name="toolButtonPutHereF2"> <widget class="QToolButton" name="toolButtonPutHereF2">
<property name="toolTip">
<string>Put variable into formula</string>
</property>
<property name="text"> <property name="text">
<string>...</string> <string>...</string>
</property> </property>
@ -225,6 +366,9 @@
</item> </item>
<item> <item>
<widget class="QToolButton" name="toolButtonEqualF2"> <widget class="QToolButton" name="toolButtonEqualF2">
<property name="toolTip">
<string>Calculate formula</string>
</property>
<property name="text"> <property name="text">
<string>...</string> <string>...</string>
</property> </property>
@ -254,6 +398,9 @@
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="toolTip">
<string>Value of second angle</string>
</property>
<property name="text"> <property name="text">
<string>_</string> <string>_</string>
</property> </property>
@ -281,7 +428,11 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="comboBoxBasePoint"/> <widget class="QComboBox" name="comboBoxBasePoint">
<property name="toolTip">
<string>Select point of center of arc</string>
</property>
</widget>
</item> </item>
</layout> </layout>
</item> </item>
@ -344,7 +495,7 @@
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="text"> <property name="text">
<string>Length of arcs</string> <string>Length of curves</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -363,7 +514,11 @@
</layout> </layout>
</item> </item>
<item> <item>
<widget class="QListWidget" name="listWidget"/> <widget class="QListWidget" name="listWidget">
<property name="toolTip">
<string>Variables</string>
</property>
</widget>
</item> </item>
</layout> </layout>
</item> </item>
@ -386,6 +541,27 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<tabstops>
<tabstop>lineEditRadius</tabstop>
<tabstop>lineEditF1</tabstop>
<tabstop>lineEditF2</tabstop>
<tabstop>comboBoxBasePoint</tabstop>
<tabstop>radioButtonSizeGrowth</tabstop>
<tabstop>radioButtonStandartTable</tabstop>
<tabstop>radioButtonIncrements</tabstop>
<tabstop>radioButtonLengthLine</tabstop>
<tabstop>radioButtonLengthArc</tabstop>
<tabstop>radioButtonLengthSpline</tabstop>
<tabstop>radioButtonLineAngles</tabstop>
<tabstop>listWidget</tabstop>
<tabstop>toolButtonPutHereRadius</tabstop>
<tabstop>toolButtonPutHereF1</tabstop>
<tabstop>toolButtonPutHereF2</tabstop>
<tabstop>toolButtonEqualRadius</tabstop>
<tabstop>toolButtonEqualF1</tabstop>
<tabstop>toolButtonEqualF2</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources> <resources>
<include location="../icon.qrc"/> <include location="../icon.qrc"/>
</resources> </resources>

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -33,7 +33,11 @@ DialogBisector::DialogBisector(const VContainer *data, Draw::Draws mode, QWidget
radioButtonStandartTable = ui->radioButtonStandartTable; radioButtonStandartTable = ui->radioButtonStandartTable;
radioButtonIncrements = ui->radioButtonIncrements; radioButtonIncrements = ui->radioButtonIncrements;
radioButtonLengthLine = ui->radioButtonLengthLine; radioButtonLengthLine = ui->radioButtonLengthLine;
radioButtonLengthArc = ui->radioButtonLengthArc;
radioButtonLengthCurve = ui->radioButtonLengthSpline;
lineEditFormula = ui->lineEditFormula; lineEditFormula = ui->lineEditFormula;
labelEditFormula = ui->labelEditFormula;
labelEditNamePoint = ui->labelEditNamePoint;
flagFormula = false; flagFormula = false;
bOk = ui->buttonBox->button(QDialogButtonBox::Ok); bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogBisector::DialogAccepted); connect(bOk, &QPushButton::clicked, this, &DialogBisector::DialogAccepted);
@ -55,6 +59,8 @@ DialogBisector::DialogBisector(const VContainer *data, Draw::Draws mode, QWidget
connect(ui->radioButtonStandartTable, &QRadioButton::clicked, this, &DialogBisector::StandartTable); connect(ui->radioButtonStandartTable, &QRadioButton::clicked, this, &DialogBisector::StandartTable);
connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogBisector::Increments); connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogBisector::Increments);
connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogBisector::LengthLines); connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogBisector::LengthLines);
connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogBisector::LengthArcs);
connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogBisector::LengthCurves);
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogBisector::EvalFormula); connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogBisector::EvalFormula);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogBisector::NamePointChanged); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogBisector::NamePointChanged);
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogBisector::FormulaChanged); connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogBisector::FormulaChanged);
@ -88,6 +94,7 @@ void DialogBisector::ChoosedObject(qint64 id, Scene::Scenes type){
if ( index != -1 ) { // -1 for not found if ( index != -1 ) { // -1 for not found
ui->comboBoxFirstPoint->setCurrentIndex(index); ui->comboBoxFirstPoint->setCurrentIndex(index);
number++; number++;
emit ToolTip(tr("Select second point of angle"));
return; return;
} }
} }
@ -96,6 +103,7 @@ void DialogBisector::ChoosedObject(qint64 id, Scene::Scenes type){
if ( index != -1 ) { // -1 for not found if ( index != -1 ) { // -1 for not found
ui->comboBoxSecondPoint->setCurrentIndex(index); ui->comboBoxSecondPoint->setCurrentIndex(index);
number++; number++;
emit ToolTip(tr("Select third point of angle"));
return; return;
} }
} }
@ -104,6 +112,7 @@ void DialogBisector::ChoosedObject(qint64 id, Scene::Scenes type){
if ( index != -1 ) { // -1 for not found if ( index != -1 ) { // -1 for not found
ui->comboBoxThirdPoint->setCurrentIndex(index); ui->comboBoxThirdPoint->setCurrentIndex(index);
number = 0; number = 0;
emit ToolTip("");
} }
if(!isInitialized){ if(!isInitialized){
this->show(); this->show();
@ -112,53 +121,29 @@ void DialogBisector::ChoosedObject(qint64 id, Scene::Scenes type){
} }
} }
QString DialogBisector::getPointName() const{
return pointName;
}
void DialogBisector::setPointName(const QString &value){ void DialogBisector::setPointName(const QString &value){
pointName = value; pointName = value;
ui->lineEditNamePoint->setText(pointName); ui->lineEditNamePoint->setText(pointName);
} }
QString DialogBisector::getTypeLine() const{
return typeLine;
}
void DialogBisector::setTypeLine(const QString &value){ void DialogBisector::setTypeLine(const QString &value){
typeLine = value; typeLine = value;
SetupTypeLine(ui->comboBoxLineType, value); SetupTypeLine(ui->comboBoxLineType, value);
} }
QString DialogBisector::getFormula() const{
return formula;
}
void DialogBisector::setFormula(const QString &value){ void DialogBisector::setFormula(const QString &value){
formula = value; formula = value;
ui->lineEditFormula->setText(formula); ui->lineEditFormula->setText(formula);
} }
qint64 DialogBisector::getFirstPointId() const{
return firstPointId;
}
void DialogBisector::setFirstPointId(const qint64 &value, const qint64 &id){ void DialogBisector::setFirstPointId(const qint64 &value, const qint64 &id){
setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id); setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id);
} }
qint64 DialogBisector::getSecondPointId() const{
return secondPointId;
}
void DialogBisector::setSecondPointId(const qint64 &value, const qint64 &id){ void DialogBisector::setSecondPointId(const qint64 &value, const qint64 &id){
setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id); setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id);
} }
qint64 DialogBisector::getThirdPointId() const{
return thirdPointId;
}
void DialogBisector::setThirdPointId(const qint64 &value, const qint64 &id){ void DialogBisector::setThirdPointId(const qint64 &value, const qint64 &id){
setCurrentPointId(ui->comboBoxThirdPoint, thirdPointId, value, id); setCurrentPointId(ui->comboBoxThirdPoint, thirdPointId, value, id);
} }

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -23,32 +23,29 @@
#define DIALOGBISECTOR_H #define DIALOGBISECTOR_H
#include "dialogtool.h" #include "dialogtool.h"
#include <QListWidgetItem>
#include "container/calculator.h"
namespace Ui { namespace Ui {
class DialogBisector; class DialogBisector;
} }
class DialogBisector : public DialogTool class DialogBisector : public DialogTool{
{
Q_OBJECT Q_OBJECT
public: public:
explicit DialogBisector(const VContainer *data, Draw::Draws mode = Draw::Calculation, explicit DialogBisector(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0); QWidget *parent = 0);
~DialogBisector(); ~DialogBisector();
QString getPointName() const; QString getPointName() const {return pointName;}
void setPointName(const QString &value); void setPointName(const QString &value);
QString getTypeLine() const; inline QString getTypeLine() const {return typeLine;}
void setTypeLine(const QString &value); void setTypeLine(const QString &value);
QString getFormula() const; inline QString getFormula() const {return formula;}
void setFormula(const QString &value); void setFormula(const QString &value);
qint64 getFirstPointId() const; inline qint64 getFirstPointId() const {return firstPointId;}
void setFirstPointId(const qint64 &value, const qint64 &id); void setFirstPointId(const qint64 &value, const qint64 &id);
qint64 getSecondPointId() const; inline qint64 getSecondPointId() const {return secondPointId;}
void setSecondPointId(const qint64 &value, const qint64 &id); void setSecondPointId(const qint64 &value, const qint64 &id);
qint64 getThirdPointId() const; inline qint64 getThirdPointId() const {return thirdPointId;}
void setThirdPointId(const qint64 &value, const qint64 &id); void setThirdPointId(const qint64 &value, const qint64 &id);
public slots: public slots:
virtual void ChoosedObject(qint64 id, Scene::Scenes type); virtual void ChoosedObject(qint64 id, Scene::Scenes type);

View File

@ -21,13 +21,50 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="labelEditFormula">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred"> <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text"> <property name="text">
<string>Length</string> <string>Length</string>
</property> </property>
@ -41,10 +78,16 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="toolTip">
<string>Formula calculation of length of bisector</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QToolButton" name="toolButtonEqual"> <widget class="QToolButton" name="toolButtonEqual">
<property name="toolTip">
<string>Calculate formula</string>
</property>
<property name="text"> <property name="text">
<string>...</string> <string>...</string>
</property> </property>
@ -74,6 +117,9 @@
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="toolTip">
<string>Value of length</string>
</property>
<property name="text"> <property name="text">
<string>_</string> <string>_</string>
</property> </property>
@ -88,13 +134,50 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="horizontalLayout_4">
<item> <item>
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="labelEditNamePoint">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text"> <property name="text">
<string>Name new point</string> <string>Name new point</string>
</property> </property>
@ -105,6 +188,9 @@
</item> </item>
<item> <item>
<widget class="QToolButton" name="toolButtonPutHere"> <widget class="QToolButton" name="toolButtonPutHere">
<property name="toolTip">
<string>Put variable into formula</string>
</property>
<property name="text"> <property name="text">
<string>...</string> <string>...</string>
</property> </property>
@ -138,7 +224,11 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="comboBoxFirstPoint"/> <widget class="QComboBox" name="comboBoxFirstPoint">
<property name="toolTip">
<string>First point of angle</string>
</property>
</widget>
</item> </item>
</layout> </layout>
</item> </item>
@ -158,7 +248,11 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="comboBoxSecondPoint"/> <widget class="QComboBox" name="comboBoxSecondPoint">
<property name="toolTip">
<string>Second point of angle</string>
</property>
</widget>
</item> </item>
</layout> </layout>
</item> </item>
@ -178,7 +272,11 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="comboBoxThirdPoint"/> <widget class="QComboBox" name="comboBoxThirdPoint">
<property name="toolTip">
<string>Third point of angle</string>
</property>
</widget>
</item> </item>
</layout> </layout>
</item> </item>
@ -192,7 +290,11 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="comboBoxLineType"/> <widget class="QComboBox" name="comboBoxLineType">
<property name="toolTip">
<string>Show line from second point to our point</string>
</property>
</widget>
</item> </item>
</layout> </layout>
</item> </item>
@ -242,7 +344,7 @@
<item> <item>
<widget class="QRadioButton" name="radioButtonLengthArc"> <widget class="QRadioButton" name="radioButtonLengthArc">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>true</bool>
</property> </property>
<property name="text"> <property name="text">
<string>Length of arcs</string> <string>Length of arcs</string>
@ -252,7 +354,7 @@
<item> <item>
<widget class="QRadioButton" name="radioButtonLengthSpline"> <widget class="QRadioButton" name="radioButtonLengthSpline">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>true</bool>
</property> </property>
<property name="text"> <property name="text">
<string>Length of curves</string> <string>Length of curves</string>
@ -264,7 +366,11 @@
</layout> </layout>
</item> </item>
<item> <item>
<widget class="QListWidget" name="listWidget"/> <widget class="QListWidget" name="listWidget">
<property name="toolTip">
<string>Variables. Click twice to select.</string>
</property>
</widget>
</item> </item>
</layout> </layout>
</item> </item>
@ -290,6 +396,24 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<tabstops>
<tabstop>lineEditFormula</tabstop>
<tabstop>lineEditNamePoint</tabstop>
<tabstop>comboBoxFirstPoint</tabstop>
<tabstop>comboBoxSecondPoint</tabstop>
<tabstop>comboBoxThirdPoint</tabstop>
<tabstop>comboBoxLineType</tabstop>
<tabstop>radioButtonSizeGrowth</tabstop>
<tabstop>radioButtonStandartTable</tabstop>
<tabstop>radioButtonIncrements</tabstop>
<tabstop>radioButtonLengthLine</tabstop>
<tabstop>radioButtonLengthArc</tabstop>
<tabstop>radioButtonLengthSpline</tabstop>
<tabstop>listWidget</tabstop>
<tabstop>toolButtonPutHere</tabstop>
<tabstop>toolButtonEqual</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources> <resources>
<include location="../icon.qrc"/> <include location="../icon.qrc"/>
</resources> </resources>

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -20,16 +20,26 @@
****************************************************************************/ ****************************************************************************/
#include "dialogdetail.h" #include "dialogdetail.h"
#include <QDebug>
DialogDetail::DialogDetail(const VContainer *data, Draw::Draws mode, QWidget *parent) : DialogDetail::DialogDetail(const VContainer *data, Draw::Draws mode, QWidget *parent) :
DialogTool(data, mode, parent), ui(), details(VDetail()){ DialogTool(data, mode, parent), ui(), details(VDetail()), supplement(true), closed(true){
ui.setupUi(this); ui.setupUi(this);
labelEditNamePoint = ui.labelEditNameDetail;
bOk = ui.buttonBox->button(QDialogButtonBox::Ok); bOk = ui.buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogDetail::DialogAccepted); connect(bOk, &QPushButton::clicked, this, &DialogDetail::DialogAccepted);
flagName = false;
CheckState();
QPushButton *bCansel = ui.buttonBox->button(QDialogButtonBox::Cancel); QPushButton *bCansel = ui.buttonBox->button(QDialogButtonBox::Cancel);
connect(bCansel, &QPushButton::clicked, this, &DialogDetail::DialogRejected); connect(bCansel, &QPushButton::clicked, this, &DialogDetail::DialogRejected);
connect(ui.listWidget, &QListWidget::currentRowChanged, this, &DialogDetail::ObjectChanged);
connect(ui.doubleSpinBoxBiasX, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
this, &DialogDetail::BiasXChanged);
connect(ui.doubleSpinBoxBiasY, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
this, &DialogDetail::BiasYChanged);
connect(ui.checkBoxSeams, &QCheckBox::clicked, this, &DialogDetail::ClickedSeams);
connect(ui.checkBoxClosed, &QCheckBox::clicked, this, &DialogDetail::ClickedClosed);
connect(ui.lineEditNameDetail, &QLineEdit::textChanged, this, &DialogDetail::NamePointChanged);
} }
void DialogDetail::ChoosedObject(qint64 id, Scene::Scenes type){ void DialogDetail::ChoosedObject(qint64 id, Scene::Scenes type){
@ -59,7 +69,7 @@ void DialogDetail::ChoosedObject(qint64 id, Scene::Scenes type){
NewItem(id, Tool::NodeSplinePath, mode, NodeDetail::Contour); NewItem(id, Tool::NodeSplinePath, mode, NodeDetail::Contour);
break; break;
default: default:
qWarning()<<"Get wrong scene object. Ignore."; qWarning()<<tr("Get wrong scene object. Ignore.");
break; break;
} }
this->show(); this->show();
@ -72,11 +82,16 @@ void DialogDetail::DialogAccepted(){
QListWidgetItem *item = ui.listWidget->item(i); QListWidgetItem *item = ui.listWidget->item(i);
details.append( qvariant_cast<VNodeDetail>(item->data(Qt::UserRole))); details.append( qvariant_cast<VNodeDetail>(item->data(Qt::UserRole)));
} }
details.setWidth(ui.doubleSpinBoxSeams->value());
details.setName(ui.lineEditNameDetail->text()); details.setName(ui.lineEditNameDetail->text());
details.setSupplement(supplement);
details.setClosed(closed);
emit ToolTip("");
emit DialogClosed(QDialog::Accepted); emit DialogClosed(QDialog::Accepted);
} }
void DialogDetail::NewItem(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode){ void DialogDetail::NewItem(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode, qreal mx,
qreal my){
QString name; QString name;
switch(typeTool){ switch(typeTool){
case(Tool::NodePoint):{ case(Tool::NodePoint):{
@ -120,28 +135,74 @@ void DialogDetail::NewItem(qint64 id, Tool::Tools typeTool, Draw::Draws mode, No
break; break;
} }
default: default:
qWarning()<<"Get wrong tools. Ignore."; qWarning()<<tr("Get wrong tools. Ignore.");
break; break;
} }
QListWidgetItem *item = new QListWidgetItem(name); QListWidgetItem *item = new QListWidgetItem(name);
item->setFont(QFont("Times", 12, QFont::Bold)); item->setFont(QFont("Times", 12, QFont::Bold));
VNodeDetail node(id, typeTool, mode, typeNode); VNodeDetail node(id, typeTool, mode, typeNode, mx, my);
item->setData(Qt::UserRole, QVariant::fromValue(node)); item->setData(Qt::UserRole, QVariant::fromValue(node));
ui.listWidget->addItem(item); ui.listWidget->addItem(item);
} disconnect(ui.doubleSpinBoxBiasX, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
this, &DialogDetail::BiasXChanged);
VDetail DialogDetail::getDetails() const{ disconnect(ui.doubleSpinBoxBiasY, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
return details; this, &DialogDetail::BiasYChanged);
ui.doubleSpinBoxBiasX->setValue(toMM(node.getMx()));
ui.doubleSpinBoxBiasY->setValue(toMM(node.getMy()));
connect(ui.doubleSpinBoxBiasX, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
this, &DialogDetail::BiasXChanged);
connect(ui.doubleSpinBoxBiasY, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
this, &DialogDetail::BiasYChanged);
} }
void DialogDetail::setDetails(const VDetail &value){ void DialogDetail::setDetails(const VDetail &value){
details = value; details = value;
ui.listWidget->clear(); ui.listWidget->clear();
for(qint32 i = 0; i < details.CountNode(); ++i){ for(qint32 i = 0; i < details.CountNode(); ++i){
NewItem(details[i].getId(), details[i].getTypeTool(),details[i].getMode(), details[i].getTypeNode()); NewItem(details[i].getId(), details[i].getTypeTool(), details[i].getMode(), details[i].getTypeNode(), details[i].getMx(),
details[i].getMy());
} }
details.setName(ui.lineEditNameDetail->text()); ui.lineEditNameDetail->setText(details.getName());
ui.checkBoxSeams->setChecked(details.getSupplement());
ui.checkBoxClosed->setChecked(details.getClosed());
ui.doubleSpinBoxSeams->setValue(details.getWidth());
ui.listWidget->setCurrentRow(0);
ui.listWidget->setFocus(Qt::OtherFocusReason); ui.listWidget->setFocus(Qt::OtherFocusReason);
} }
void DialogDetail::BiasXChanged(qreal d){
qint32 row = ui.listWidget->currentRow();
QListWidgetItem *item = ui.listWidget->item( row );
VNodeDetail node = qvariant_cast<VNodeDetail>(item->data(Qt::UserRole));
node.setMx(toPixel(d));
item->setData(Qt::UserRole, QVariant::fromValue(node));
}
void DialogDetail::BiasYChanged(qreal d){
qint32 row = ui.listWidget->currentRow();
QListWidgetItem *item = ui.listWidget->item( row );
VNodeDetail node = qvariant_cast<VNodeDetail>(item->data(Qt::UserRole));
node.setMy(toPixel(d));
item->setData(Qt::UserRole, QVariant::fromValue(node));
}
void DialogDetail::ClickedSeams(bool checked){
supplement = checked;
ui.checkBoxClosed->setEnabled(checked);
ui.doubleSpinBoxSeams->setEnabled(checked);
}
void DialogDetail::ClickedClosed(bool checked){
closed = checked;
}
void DialogDetail::ObjectChanged(int row){
if(ui.listWidget->count() == 0){
return;
}
QListWidgetItem *item = ui.listWidget->item( row );
VNodeDetail node = qvariant_cast<VNodeDetail>(item->data(Qt::UserRole));
ui.doubleSpinBoxBiasX->setValue(toMM(node.getMx()));
ui.doubleSpinBoxBiasY->setValue(toMM(node.getMy()));
}

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -24,22 +24,28 @@
#include "ui_dialogdetail.h" #include "ui_dialogdetail.h"
#include "dialogtool.h" #include "dialogtool.h"
#include "geometry/vdetail.h"
class DialogDetail : public DialogTool{ class DialogDetail : public DialogTool{
Q_OBJECT Q_OBJECT
public: public:
explicit DialogDetail(const VContainer *data, Draw::Draws mode, QWidget *parent = 0); DialogDetail(const VContainer *data, Draw::Draws mode, QWidget *parent = 0);
VDetail getDetails() const; inline VDetail getDetails() const {return details;}
void setDetails(const VDetail &value); void setDetails(const VDetail &value);
public slots: public slots:
virtual void ChoosedObject(qint64 id, Scene::Scenes type); virtual void ChoosedObject(qint64 id, Scene::Scenes type);
virtual void DialogAccepted(); virtual void DialogAccepted();
void BiasXChanged(qreal d);
void BiasYChanged(qreal d);
void ClickedSeams(bool checked);
void ClickedClosed(bool checked);
void ObjectChanged(int row);
private: private:
Ui::DialogDetail ui; Ui::DialogDetail ui;
VDetail details; VDetail details;
void NewItem(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode); bool supplement;
bool closed;
void NewItem(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode, qreal mx = 0,
qreal my = 0);
}; };
#endif // DIALOGDETAIL_H #endif // DIALOGDETAIL_H

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>340</width> <width>544</width>
<height>298</height> <height>327</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -20,15 +20,158 @@
<property name="locale"> <property name="locale">
<locale language="English" country="UnitedStates"/> <locale language="English" country="UnitedStates"/>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>6</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Bias X</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="doubleSpinBoxBiasX">
<property name="minimum">
<double>-10000.000000000000000</double>
</property>
<property name="maximum">
<double>10000.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Bias Y</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="doubleSpinBoxBiasY">
<property name="minimum">
<double>-10000.000000000000000</double>
</property>
<property name="maximum">
<double>10000.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Option</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout"> <widget class="QLabel" name="labelEditNameDetail">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
<property name="text">
<string>Name of detail</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditNameDetail">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkBoxSeams">
<property name="text">
<string>Supplement for seams</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="labelEditWidth">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -39,17 +182,22 @@
<locale language="English" country="UnitedStates"/> <locale language="English" country="UnitedStates"/>
</property> </property>
<property name="text"> <property name="text">
<string>Name detail</string> <string>Width</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLineEdit" name="lineEditNameDetail"/> <widget class="QDoubleSpinBox" name="doubleSpinBoxSeams">
<property name="minimum">
<double>-10000.000000000000000</double>
</property>
<property name="value">
<double>10.000000000000000</double>
</property>
</widget>
</item> </item>
</layout> </layout>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item> <item>
<widget class="QCheckBox" name="checkBoxClosed"> <widget class="QCheckBox" name="checkBoxClosed">
<property name="text"> <property name="text">
@ -61,6 +209,7 @@
</widget> </widget>
</item> </item>
</layout> </layout>
</widget>
</item> </item>
</layout> </layout>
</item> </item>
@ -81,6 +230,11 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<tabstops>
<tabstop>lineEditNameDetail</tabstop>
<tabstop>listWidget</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources> <resources>
<include location="../icon.qrc"/> <include location="../icon.qrc"/>
</resources> </resources>

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -21,10 +21,6 @@
#include "dialogendline.h" #include "dialogendline.h"
#include "ui_dialogendline.h" #include "ui_dialogendline.h"
#include <QCloseEvent>
#include <QString>
#include "container/vpointf.h"
#include "container/calculator.h"
DialogEndLine::DialogEndLine(const VContainer *data, Draw::Draws mode, QWidget *parent) : DialogEndLine::DialogEndLine(const VContainer *data, Draw::Draws mode, QWidget *parent) :
DialogTool(data, mode, parent), ui(new Ui::DialogEndLine), pointName(QString()), typeLine(QString()), DialogTool(data, mode, parent), ui(new Ui::DialogEndLine), pointName(QString()), typeLine(QString()),
@ -38,7 +34,11 @@ DialogEndLine::DialogEndLine(const VContainer *data, Draw::Draws mode, QWidget *
radioButtonStandartTable = ui->radioButtonStandartTable; radioButtonStandartTable = ui->radioButtonStandartTable;
radioButtonIncrements = ui->radioButtonIncrements; radioButtonIncrements = ui->radioButtonIncrements;
radioButtonLengthLine = ui->radioButtonLengthLine; radioButtonLengthLine = ui->radioButtonLengthLine;
radioButtonLengthArc = ui->radioButtonLengthArc;
radioButtonLengthCurve = ui->radioButtonLengthSpline;
lineEditFormula = ui->lineEditFormula; lineEditFormula = ui->lineEditFormula;
labelEditFormula = ui->labelEditFormula;
labelEditNamePoint = ui->labelEditNamePoint;
flagFormula = false; flagFormula = false;
bOk = ui->buttonBox->button(QDialogButtonBox::Ok); bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogEndLine::DialogAccepted); connect(bOk, &QPushButton::clicked, this, &DialogEndLine::DialogAccepted);
@ -74,6 +74,8 @@ DialogEndLine::DialogEndLine(const VContainer *data, Draw::Draws mode, QWidget *
connect(ui->radioButtonStandartTable, &QRadioButton::clicked, this, &DialogEndLine::StandartTable); connect(ui->radioButtonStandartTable, &QRadioButton::clicked, this, &DialogEndLine::StandartTable);
connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogEndLine::Increments); connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogEndLine::Increments);
connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogEndLine::LengthLines); connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogEndLine::LengthLines);
connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogEndLine::LengthArcs);
connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogEndLine::LengthCurves);
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogEndLine::EvalFormula); connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogEndLine::EvalFormula);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogEndLine::NamePointChanged); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogEndLine::NamePointChanged);
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogEndLine::FormulaChanged); connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogEndLine::FormulaChanged);
@ -99,50 +101,31 @@ void DialogEndLine::ChoosedObject(qint64 id, Scene::Scenes type){
point = data->GetModelingPoint(id); point = data->GetModelingPoint(id);
} }
ChangeCurrentText(ui->comboBoxBasePoint, point.name()); ChangeCurrentText(ui->comboBoxBasePoint, point.name());
emit ToolTip("");
this->show(); this->show();
} }
} }
QString DialogEndLine::getPointName() const{
return pointName;
}
void DialogEndLine::setPointName(const QString &value){ void DialogEndLine::setPointName(const QString &value){
pointName = value; pointName = value;
ui->lineEditNamePoint->setText(pointName); ui->lineEditNamePoint->setText(pointName);
} }
QString DialogEndLine::getTypeLine() const{
return typeLine;
}
void DialogEndLine::setTypeLine(const QString &value){ void DialogEndLine::setTypeLine(const QString &value){
typeLine = value; typeLine = value;
SetupTypeLine(ui->comboBoxLineType, value); SetupTypeLine(ui->comboBoxLineType, value);
} }
QString DialogEndLine::getFormula() const{
return formula;
}
void DialogEndLine::setFormula(const QString &value){ void DialogEndLine::setFormula(const QString &value){
formula = value; formula = value;
ui->lineEditFormula->setText(formula); ui->lineEditFormula->setText(formula);
} }
qreal DialogEndLine::getAngle() const{
return angle;
}
void DialogEndLine::setAngle(const qreal &value){ void DialogEndLine::setAngle(const qreal &value){
angle = value; angle = value;
ui->doubleSpinBoxAngle->setValue(angle); ui->doubleSpinBoxAngle->setValue(angle);
} }
qint64 DialogEndLine::getBasePointId() const{
return basePointId;
}
void DialogEndLine::setBasePointId(const qint64 &value, const qint64 &id){ void DialogEndLine::setBasePointId(const qint64 &value, const qint64 &id){
setCurrentPointId(ui->comboBoxBasePoint, basePointId, value, id); setCurrentPointId(ui->comboBoxBasePoint, basePointId, value, id);
} }
@ -156,7 +139,6 @@ void DialogEndLine::DialogAccepted(){
emit DialogClosed(QDialog::Accepted); emit DialogClosed(QDialog::Accepted);
} }
DialogEndLine::~DialogEndLine() DialogEndLine::~DialogEndLine(){
{
delete ui; delete ui;
} }

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -23,29 +23,26 @@
#define DIALOGENDLINE_H #define DIALOGENDLINE_H
#include "dialogtool.h" #include "dialogtool.h"
#include <QListWidgetItem>
#include "container/calculator.h"
namespace Ui { namespace Ui {
class DialogEndLine; class DialogEndLine;
} }
class DialogEndLine : public DialogTool class DialogEndLine : public DialogTool{
{
Q_OBJECT Q_OBJECT
public: public:
explicit DialogEndLine(const VContainer *data, Draw::Draws mode = Draw::Calculation, explicit DialogEndLine(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0); QWidget *parent = 0);
~DialogEndLine(); ~DialogEndLine();
QString getPointName() const; inline QString getPointName() const {return pointName;}
void setPointName(const QString &value); void setPointName(const QString &value);
QString getTypeLine() const; inline QString getTypeLine() const {return typeLine;}
void setTypeLine(const QString &value); void setTypeLine(const QString &value);
QString getFormula() const; inline QString getFormula() const {return formula;}
void setFormula(const QString &value); void setFormula(const QString &value);
qreal getAngle() const; inline qreal getAngle() const {return angle;}
void setAngle(const qreal &value); void setAngle(const qreal &value);
qint64 getBasePointId() const; inline qint64 getBasePointId() const {return basePointId;}
void setBasePointId(const qint64 &value, const qint64 &id); void setBasePointId(const qint64 &value, const qint64 &id);
public slots: public slots:
virtual void ChoosedObject(qint64 id, Scene::Scenes type); virtual void ChoosedObject(qint64 id, Scene::Scenes type);

View File

@ -24,13 +24,50 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="labelEditFormula">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred"> <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text"> <property name="text">
<string>Length</string> <string>Length</string>
</property> </property>
@ -44,10 +81,16 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="toolTip">
<string>Formula calculation of length of line</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QToolButton" name="toolButtonEqual"> <widget class="QToolButton" name="toolButtonEqual">
<property name="toolTip">
<string>Calculate formula</string>
</property>
<property name="text"> <property name="text">
<string>...</string> <string>...</string>
</property> </property>
@ -77,6 +120,9 @@
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="toolTip">
<string>Value of length</string>
</property>
<property name="text"> <property name="text">
<string>_</string> <string>_</string>
</property> </property>
@ -104,7 +150,11 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="comboBoxBasePoint"/> <widget class="QComboBox" name="comboBoxBasePoint">
<property name="toolTip">
<string>First point of line</string>
</property>
</widget>
</item> </item>
<item> <item>
<widget class="QToolButton" name="toolButtonPutHere"> <widget class="QToolButton" name="toolButtonPutHere">
@ -128,13 +178,50 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="horizontalLayout_4">
<item> <item>
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="labelEditNamePoint">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text"> <property name="text">
<string>Name new point</string> <string>Name new point</string>
</property> </property>
@ -335,6 +422,9 @@
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="toolTip">
<string>Angle of line</string>
</property>
<property name="maximum"> <property name="maximum">
<double>360.000000000000000</double> <double>360.000000000000000</double>
</property> </property>
@ -356,7 +446,11 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="comboBoxLineType"/> <widget class="QComboBox" name="comboBoxLineType">
<property name="toolTip">
<string>Show line from first point to our point</string>
</property>
</widget>
</item> </item>
</layout> </layout>
</item> </item>
@ -406,7 +500,7 @@
<item> <item>
<widget class="QRadioButton" name="radioButtonLengthArc"> <widget class="QRadioButton" name="radioButtonLengthArc">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>true</bool>
</property> </property>
<property name="text"> <property name="text">
<string>Length of arcs</string> <string>Length of arcs</string>
@ -416,7 +510,7 @@
<item> <item>
<widget class="QRadioButton" name="radioButtonLengthSpline"> <widget class="QRadioButton" name="radioButtonLengthSpline">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>true</bool>
</property> </property>
<property name="text"> <property name="text">
<string>Length of curves</string> <string>Length of curves</string>
@ -428,7 +522,11 @@
</layout> </layout>
</item> </item>
<item> <item>
<widget class="QListWidget" name="listWidget"/> <widget class="QListWidget" name="listWidget">
<property name="toolTip">
<string>Variables. Click twice to select.</string>
</property>
</widget>
</item> </item>
</layout> </layout>
</item> </item>
@ -451,6 +549,31 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<tabstops>
<tabstop>lineEditFormula</tabstop>
<tabstop>comboBoxBasePoint</tabstop>
<tabstop>lineEditNamePoint</tabstop>
<tabstop>doubleSpinBoxAngle</tabstop>
<tabstop>toolButtonArrowRight</tabstop>
<tabstop>toolButtonArrowRightUp</tabstop>
<tabstop>toolButtonArrowUp</tabstop>
<tabstop>toolButtonArrowLeftUp</tabstop>
<tabstop>toolButtonArrowLeft</tabstop>
<tabstop>toolButtonArrowLeftDown</tabstop>
<tabstop>toolButtonArrowDown</tabstop>
<tabstop>toolButtonArrowRightDown</tabstop>
<tabstop>comboBoxLineType</tabstop>
<tabstop>radioButtonSizeGrowth</tabstop>
<tabstop>radioButtonStandartTable</tabstop>
<tabstop>radioButtonIncrements</tabstop>
<tabstop>radioButtonLengthLine</tabstop>
<tabstop>radioButtonLengthArc</tabstop>
<tabstop>radioButtonLengthSpline</tabstop>
<tabstop>listWidget</tabstop>
<tabstop>toolButtonPutHere</tabstop>
<tabstop>toolButtonEqual</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources> <resources>
<include location="../icon.qrc"/> <include location="../icon.qrc"/>
</resources> </resources>

101
dialogs/dialogheight.cpp Normal file
View File

@ -0,0 +1,101 @@
#include "dialogheight.h"
#include "ui_dialogheight.h"
DialogHeight::DialogHeight(const VContainer *data, Draw::Draws mode, QWidget *parent) :
DialogTool(data, mode, parent), ui(new Ui::DialogHeight), number(0), pointName(QString()),
typeLine(QString()), basePointId(0), p1LineId(0), p2LineId(0){
ui->setupUi(this);
labelEditNamePoint = ui->labelEditNamePoint;
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogHeight::DialogAccepted);
flagName = false;
CheckState();
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
connect(bCansel, &QPushButton::clicked, this, &DialogHeight::DialogRejected);
FillComboBoxPoints(ui->comboBoxBasePoint);
FillComboBoxPoints(ui->comboBoxP1Line);
FillComboBoxPoints(ui->comboBoxP2Line);
FillComboBoxTypeLine(ui->comboBoxLineType);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogHeight::NamePointChanged);
}
DialogHeight::~DialogHeight(){
delete ui;
}
void DialogHeight::setPointName(const QString &value){
pointName = value;
ui->lineEditNamePoint->setText(pointName);
}
void DialogHeight::setTypeLine(const QString &value){
typeLine = value;
SetupTypeLine(ui->comboBoxLineType, value);
}
void DialogHeight::setBasePointId(const qint64 &value, const qint64 &id){
basePointId = value;
setCurrentPointId(ui->comboBoxBasePoint, basePointId, value, id);
}
void DialogHeight::setP1LineId(const qint64 &value, const qint64 &id){
p1LineId = value;
setCurrentPointId(ui->comboBoxP1Line, p1LineId, value, id);
}
void DialogHeight::setP2LineId(const qint64 &value, const qint64 &id){
p2LineId = value;
setCurrentPointId(ui->comboBoxP2Line, p2LineId, value, id);
}
void DialogHeight::ChoosedObject(qint64 id, Scene::Scenes type){
if(idDetail == 0 && mode == Draw::Modeling){
if(type == Scene::Detail){
idDetail = id;
return;
}
}
if(mode == Draw::Modeling){
if(!CheckObject(id)){
return;
}
}
if(type == Scene::Point){
VPointF point;
if(mode == Draw::Calculation){
point = data->GetPoint(id);
} else {
point = data->GetModelingPoint(id);
}
switch(number){
case(0):
ChangeCurrentText(ui->comboBoxBasePoint, point.name());
number++;
emit ToolTip(tr("Select first point of line"));
break;
case(1):
ChangeCurrentText(ui->comboBoxP1Line, point.name());
number++;
emit ToolTip(tr("Select second point of line"));
break;
case(2):
ChangeCurrentText(ui->comboBoxP2Line, point.name());
number = 0;
emit ToolTip(tr(""));
if(!isInitialized){
this->show();
}
break;
}
}
}
void DialogHeight::DialogAccepted(){
pointName = ui->lineEditNamePoint->text();
typeLine = GetTypeLine(ui->comboBoxLineType);
basePointId = getCurrentPointId(ui->comboBoxBasePoint);
p1LineId = getCurrentPointId(ui->comboBoxP1Line);
p2LineId = getCurrentPointId(ui->comboBoxP2Line);
emit DialogClosed(QDialog::Accepted);
}

61
dialogs/dialogheight.h Normal file
View File

@ -0,0 +1,61 @@
/****************************************************************************
**
** Copyright (C) 2013 Valentina project All Rights Reserved.
**
** This file is part of Valentina.
**
** Tox 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 <http://www.gnu.org/licenses/>.
**
****************************************************************************/
#ifndef DIALOGHEIGHT_H
#define DIALOGHEIGHT_H
#include "dialogtool.h"
namespace Ui {
class DialogHeight;
}
class DialogHeight : public DialogTool{
Q_OBJECT
public:
explicit DialogHeight(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0);
~DialogHeight();
inline QString getPointName() const {return pointName;}
void setPointName(const QString &value);
inline QString getTypeLine() const {return typeLine;}
void setTypeLine(const QString &value);
inline qint64 getBasePointId() const {return basePointId;}
void setBasePointId(const qint64 &value, const qint64 &id);
inline qint64 getP1LineId() const {return p1LineId;}
void setP1LineId(const qint64 &value, const qint64 &id);
inline qint64 getP2LineId() const{return p2LineId;}
void setP2LineId(const qint64 &value, const qint64 &id);
public slots:
virtual void ChoosedObject(qint64 id, Scene::Scenes type);
virtual void DialogAccepted();
private:
Q_DISABLE_COPY(DialogHeight)
Ui::DialogHeight *ui;
qint32 number;
QString pointName;
QString typeLine;
qint64 basePointId;
qint64 p1LineId;
qint64 p2LineId;
};
#endif // DIALOGHEIGHT_H

214
dialogs/dialogheight.ui Normal file
View File

@ -0,0 +1,214 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DialogHeight</class>
<widget class="QDialog" name="DialogHeight">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>247</width>
<height>220</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="labelEditNamePoint">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>Name new point</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditNamePoint"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Base point</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxBasePoint">
<property name="toolTip">
<string>First point of line</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>First point of line</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxP1Line">
<property name="toolTip">
<string>First point of line</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Second point of line</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxP2Line">
<property name="toolTip">
<string>First point of line</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>Type line</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxLineType">
<property name="toolTip">
<string>Show line from first point to our point</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>DialogHeight</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>DialogHeight</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -147,14 +147,14 @@ QString DialogHistory::Record(const VToolRecord &tool){
case Tool::ArrowTool: case Tool::ArrowTool:
break; break;
case Tool::SinglePointTool: case Tool::SinglePointTool:
record = QString("%1 - Базова точка").arg(data->GetPoint(tool.getId()).name()); record = QString(tr("%1 - Base point")).arg(data->GetPoint(tool.getId()).name());
break; break;
case Tool::EndLineTool: case Tool::EndLineTool:
domElement = doc->elementById(QString().setNum(tool.getId())); domElement = doc->elementById(QString().setNum(tool.getId()));
if(domElement.isElement()){ if(domElement.isElement()){
basePointId = domElement.attribute("basePoint", "").toLongLong(); basePointId = domElement.attribute("basePoint", "").toLongLong();
} }
record = QString("%1_%2 - Відрізок з точки %1 до точки %2").arg(data->GetPoint(basePointId).name(), record = QString(tr("%1_%2 - Line from point %1 to point %2")).arg(data->GetPoint(basePointId).name(),
data->GetPoint(tool.getId()).name()); data->GetPoint(tool.getId()).name());
break; break;
case Tool::LineTool: case Tool::LineTool:
@ -163,7 +163,7 @@ QString DialogHistory::Record(const VToolRecord &tool){
firstPointId = domElement.attribute("firstPoint", "").toLongLong(); firstPointId = domElement.attribute("firstPoint", "").toLongLong();
secondPointId = domElement.attribute("secondPoint", "").toLongLong(); secondPointId = domElement.attribute("secondPoint", "").toLongLong();
} }
record = QString("%1_%2 - Лінія з точки %1 до точки %2").arg(data->GetPoint(firstPointId).name(), record = QString(tr("%1_%2 - Line from point %1 to point %2")).arg(data->GetPoint(firstPointId).name(),
data->GetPoint(secondPointId).name()); data->GetPoint(secondPointId).name());
break; break;
case Tool::AlongLineTool: case Tool::AlongLineTool:
@ -172,12 +172,12 @@ QString DialogHistory::Record(const VToolRecord &tool){
basePointId = domElement.attribute("firstPoint", "").toLongLong(); basePointId = domElement.attribute("firstPoint", "").toLongLong();
secondPointId = domElement.attribute("secondPoint", "").toLongLong(); secondPointId = domElement.attribute("secondPoint", "").toLongLong();
} }
record = QString("%3 - Точка на відрізку %1_%2").arg(data->GetPoint(basePointId).name(), record = QString(tr("%3 - Point along line %1_%2")).arg(data->GetPoint(basePointId).name(),
data->GetPoint(secondPointId).name(), data->GetPoint(secondPointId).name(),
data->GetPoint(tool.getId()).name()); data->GetPoint(tool.getId()).name());
break; break;
case Tool::ShoulderPointTool: case Tool::ShoulderPointTool:
record = QString("%1 - Плечева точка").arg(data->GetPoint(tool.getId()).name()); record = QString(tr("%1 - Point of soulder")).arg(data->GetPoint(tool.getId()).name());
break; break;
case Tool::NormalTool: case Tool::NormalTool:
domElement = doc->elementById(QString().setNum(tool.getId())); domElement = doc->elementById(QString().setNum(tool.getId()));
@ -185,7 +185,7 @@ QString DialogHistory::Record(const VToolRecord &tool){
basePointId = domElement.attribute("firstPoint", "").toLongLong(); basePointId = domElement.attribute("firstPoint", "").toLongLong();
secondPointId = domElement.attribute("secondPoint", "").toLongLong(); secondPointId = domElement.attribute("secondPoint", "").toLongLong();
} }
record = QString("%3 - Перпендикуляр до відрузку %1_%2").arg(data->GetPoint(basePointId).name(), record = QString(tr("%3 - Normal to line %1_%2")).arg(data->GetPoint(basePointId).name(),
data->GetPoint(secondPointId).name(), data->GetPoint(secondPointId).name(),
data->GetPoint(tool.getId()).name()); data->GetPoint(tool.getId()).name());
break; break;
@ -196,7 +196,7 @@ QString DialogHistory::Record(const VToolRecord &tool){
basePointId = domElement.attribute("secondPoint", "").toLongLong(); basePointId = domElement.attribute("secondPoint", "").toLongLong();
thirdPointId = domElement.attribute("thirdPoint", "").toLongLong(); thirdPointId = domElement.attribute("thirdPoint", "").toLongLong();
} }
record = QString("%4 - Бісектриса кута %1_%2_%3").arg(data->GetPoint(firstPointId).name(), record = QString(tr("%4 - Bisector of angle %1_%2_%3")).arg(data->GetPoint(firstPointId).name(),
data->GetPoint(basePointId).name(), data->GetPoint(basePointId).name(),
data->GetPoint(thirdPointId).name(), data->GetPoint(thirdPointId).name(),
data->GetPoint(tool.getId()).name()); data->GetPoint(tool.getId()).name());
@ -209,7 +209,7 @@ QString DialogHistory::Record(const VToolRecord &tool){
p1Line2 = domElement.attribute("p1Line2", "").toLongLong(); p1Line2 = domElement.attribute("p1Line2", "").toLongLong();
p2Line2 = domElement.attribute("p2Line2", "").toLongLong(); p2Line2 = domElement.attribute("p2Line2", "").toLongLong();
} }
record = QString("%5 - Точка перетину відрузку %1_%2 і %3_%4").arg(data->GetPoint(p1Line1).name(), record = QString(tr("%5 - Point of intersection lines %1_%2 and %3_%4")).arg(data->GetPoint(p1Line1).name(),
data->GetPoint(p2Line1).name(), data->GetPoint(p2Line1).name(),
data->GetPoint(p1Line2).name(), data->GetPoint(p1Line2).name(),
data->GetPoint(p2Line2).name(), data->GetPoint(p2Line2).name(),
@ -217,20 +217,20 @@ QString DialogHistory::Record(const VToolRecord &tool){
break; break;
case Tool::SplineTool:{ case Tool::SplineTool:{
VSpline spl = data->GetSpline(tool.getId()); VSpline spl = data->GetSpline(tool.getId());
record = QString("Сплайн %1_%2").arg(data->GetPoint(spl.GetP1()).name(), record = QString(tr("Curve %1_%2")).arg(data->GetPoint(spl.GetP1()).name(),
data->GetPoint(spl.GetP4()).name()); data->GetPoint(spl.GetP4()).name());
} }
break; break;
case Tool::ArcTool:{ case Tool::ArcTool:{
VArc arc = data->GetArc(tool.getId()); VArc arc = data->GetArc(tool.getId());
record = QString("Дуга з центром в точці %1").arg(data->GetPoint(arc.GetCenter()).name()); record = QString(tr("Arc with center in point %1")).arg(data->GetPoint(arc.GetCenter()).name());
} }
break; break;
case Tool::SplinePathTool:{ case Tool::SplinePathTool:{
VSplinePath splPath = data->GetSplinePath(tool.getId()); VSplinePath splPath = data->GetSplinePath(tool.getId());
QVector<VSplinePoint> points = splPath.GetSplinePath(); QVector<VSplinePoint> points = splPath.GetSplinePath();
if(points.size() != 0 ){ if(points.size() != 0 ){
record = QString("Шлях сплайну %1").arg(data->GetPoint(points[0].P()).name()); record = QString(tr("Curve point %1")).arg(data->GetPoint(points[0].P()).name());
for(qint32 i = 1; i< points.size(); ++i){ for(qint32 i = 1; i< points.size(); ++i){
QString name = QString("_%1").arg(data->GetPoint(points[i].P()).name()); QString name = QString("_%1").arg(data->GetPoint(points[i].P()).name());
record.append(name); record.append(name);
@ -245,13 +245,42 @@ QString DialogHistory::Record(const VToolRecord &tool){
firstPointId = domElement.attribute("firstPoint", "").toLongLong(); firstPointId = domElement.attribute("firstPoint", "").toLongLong();
secondPointId = domElement.attribute("secondPoint", "").toLongLong(); secondPointId = domElement.attribute("secondPoint", "").toLongLong();
} }
record = QString("%4 - Точка дотику дуги з центром в точці %1 і відрізку %2_%3").arg(data->GetPoint(center).name(), record = QString(tr("%4 - Point of contact arc with center in point %1 and line %2_%3")).arg(data->GetPoint(center).name(),
data->GetPoint(firstPointId).name(), data->GetPoint(firstPointId).name(),
data->GetPoint(secondPointId).name(), data->GetPoint(secondPointId).name(),
data->GetPoint(tool.getId()).name()); data->GetPoint(tool.getId()).name());
break; break;
case Tool::Height:{
qint64 p1LineId = 0;
qint64 p2LineId = 0;
domElement = doc->elementById(QString().setNum(tool.getId()));
if(domElement.isElement()){
basePointId = domElement.attribute("basePoint", "").toLongLong();
p1LineId = domElement.attribute("p1Line", "").toLongLong();
p2LineId = domElement.attribute("p2Line", "").toLongLong();
}
record = QString(tr("Point of perpendical from point %1 to line %2_%3")).arg(data->GetPoint(basePointId).name(),
data->GetPoint(p1LineId).name(),
data->GetPoint(p2LineId).name());
break;
}
case Tool::Triangle:{
qint64 axisP1Id = 0;
qint64 axisP2Id = 0;
domElement = doc->elementById(QString().setNum(tool.getId()));
if(domElement.isElement()){
axisP1Id = domElement.attribute("axisP1", "").toLongLong();
axisP2Id = domElement.attribute("axisP2", "").toLongLong();
firstPointId = domElement.attribute("firstPoint", "").toLongLong();
secondPointId = domElement.attribute("secondPoint", "").toLongLong();
}
record = QString(tr("Triangle: axis %1_%2, points %3 and %4")).arg(
data->GetPoint(axisP1Id).name(),data->GetPoint(axisP2Id).name(),
data->GetPoint(firstPointId).name(), data->GetPoint(secondPointId).name());
break;
}
default: default:
qWarning()<<"Get wrong tool type. Ignore."; qWarning()<<tr("Get wrong tool type. Ignore.");
break; break;
} }
return record; return record;
@ -260,7 +289,7 @@ QString DialogHistory::Record(const VToolRecord &tool){
void DialogHistory::InitialTable(){ void DialogHistory::InitialTable(){
ui->tableWidget->setSortingEnabled(false); ui->tableWidget->setSortingEnabled(false);
ui->tableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem(" ")); ui->tableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem(" "));
ui->tableWidget->setHorizontalHeaderItem(1, new QTableWidgetItem("Інструмент")); ui->tableWidget->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Tool")));
} }
void DialogHistory::ShowPoint(){ void DialogHistory::ShowPoint(){
@ -275,7 +304,6 @@ void DialogHistory::ShowPoint(){
} }
} }
void DialogHistory::closeEvent(QCloseEvent *event){ void DialogHistory::closeEvent(QCloseEvent *event){
QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0); QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0);
qint64 id = qvariant_cast<qint64>(item->data(Qt::UserRole)); qint64 id = qvariant_cast<qint64>(item->data(Qt::UserRole));

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -29,12 +29,10 @@ namespace Ui {
class DialogHistory; class DialogHistory;
} }
class DialogHistory : public DialogTool class DialogHistory : public DialogTool{
{
Q_OBJECT Q_OBJECT
public: public:
explicit DialogHistory(VContainer *data, VDomDocument *doc, QWidget *parent = 0); DialogHistory(VContainer *data, VDomDocument *doc, QWidget *parent = 0);
virtual ~DialogHistory(); virtual ~DialogHistory();
public slots: public slots:
virtual void DialogAccepted(); virtual void DialogAccepted();

View File

@ -68,6 +68,10 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<tabstops>
<tabstop>tableWidget</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources> <resources>
<include location="../icon.qrc"/> <include location="../icon.qrc"/>
</resources> </resources>

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -21,17 +21,18 @@
#include "dialogincrements.h" #include "dialogincrements.h"
#include "ui_dialogincrements.h" #include "ui_dialogincrements.h"
#include <QHeaderView> #include <widgets/doubledelegate.h>
#include <QCloseEvent> #include <exception/vexception.h>
#include "widgets/doubledelegate.h"
#include "container/vincrementtablerow.h"
DialogIncrements::DialogIncrements(VContainer *data, VDomDocument *doc, QWidget *parent) : DialogIncrements::DialogIncrements(VContainer *data, VDomDocument *doc, QWidget *parent) :
DialogTool(data, Draw::Calculation, parent), ui(new Ui::DialogIncrements), data(data), doc(doc){ DialogTool(data, Draw::Calculation, parent), ui(new Ui::DialogIncrements), data(data), doc(doc),
row(0), column(0){
ui->setupUi(this); ui->setupUi(this);
InitialStandartTable(); InitialStandartTable();
InitialIncrementTable(); InitialIncrementTable();
InitialLinesTable(); InitialLinesTable();
InitialSplinesTable();
InitialArcsTable();
DoubleSpinBoxDelegate *doubleDelegate = new DoubleSpinBoxDelegate(ui->tableWidgetIncrement); DoubleSpinBoxDelegate *doubleDelegate = new DoubleSpinBoxDelegate(ui->tableWidgetIncrement);
ui->tableWidgetIncrement->setItemDelegateForColumn(2, doubleDelegate); ui->tableWidgetIncrement->setItemDelegateForColumn(2, doubleDelegate);
ui->tableWidgetIncrement->setItemDelegateForColumn(3, doubleDelegate); ui->tableWidgetIncrement->setItemDelegateForColumn(3, doubleDelegate);
@ -39,7 +40,10 @@ DialogIncrements::DialogIncrements(VContainer *data, VDomDocument *doc, QWidget
FillStandartTable(); FillStandartTable();
FillIncrementTable(); FillIncrementTable();
FillLengthLines(); FillLengthLines();
FillLengthSplines();
FillLengthArcs();
connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, &DialogIncrements::cellChanged);
connect(ui->toolButtonAdd, &QPushButton::clicked, this, &DialogIncrements::clickedToolButtonAdd); connect(ui->toolButtonAdd, &QPushButton::clicked, this, &DialogIncrements::clickedToolButtonAdd);
connect(ui->toolButtonRemove, &QPushButton::clicked, this, connect(ui->toolButtonRemove, &QPushButton::clicked, this,
&DialogIncrements::clickedToolButtonRemove); &DialogIncrements::clickedToolButtonRemove);
@ -51,12 +55,13 @@ DialogIncrements::DialogIncrements(VContainer *data, VDomDocument *doc, QWidget
bOk = ui->buttonBox->button(QDialogButtonBox::Ok); bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogIncrements::DialogAccepted); connect(bOk, &QPushButton::clicked, this, &DialogIncrements::DialogAccepted);
ui->tabWidget->setCurrentIndex(0);
} }
void DialogIncrements::FillStandartTable(){ void DialogIncrements::FillStandartTable(){
const QMap<QString, VStandartTableCell> *standartTable = data->DataStandartTable(); const QHash<QString, VStandartTableCell> *standartTable = data->DataStandartTable();
qint32 currentRow = -1; qint32 currentRow = -1;
QMapIterator<QString, VStandartTableCell> i(*standartTable); QHashIterator<QString, VStandartTableCell> i(*standartTable);
ui->tableWidgetStandart->setRowCount ( standartTable->size() ); ui->tableWidgetStandart->setRowCount ( standartTable->size() );
while (i.hasNext()) { while (i.hasNext()) {
i.next(); i.next();
@ -94,22 +99,31 @@ void DialogIncrements::FillStandartTable(){
} }
void DialogIncrements::FillIncrementTable(){ void DialogIncrements::FillIncrementTable(){
const QMap<QString, VIncrementTableRow> *incrementTable = data->DataIncrementTable(); const QHash<QString, VIncrementTableRow> *incrementTable = data->DataIncrementTable();
qint32 currentRow = -1; QHashIterator<QString, VIncrementTableRow> i(*incrementTable);
QMapIterator<QString, VIncrementTableRow> i(*incrementTable); QMap<qint64, QString> map;
//Sorting QHash by id
while (i.hasNext()) { while (i.hasNext()) {
i.next(); i.next();
VIncrementTableRow cell = i.value(); VIncrementTableRow cell = i.value();
map.insert(cell.getId(), i.key());
}
qint32 currentRow = -1;
QMapIterator<qint64, QString> iMap(map);
while (iMap.hasNext()) {
iMap.next();
VIncrementTableRow cell = incrementTable->value(iMap.value());
currentRow++; currentRow++;
ui->tableWidgetIncrement->setRowCount ( incrementTable->size() ); ui->tableWidgetIncrement->setRowCount ( incrementTable->size() );
QTableWidgetItem *item = new QTableWidgetItem(QString(i.key())); QTableWidgetItem *item = new QTableWidgetItem(iMap.value());
item->setTextAlignment(Qt::AlignHCenter); item->setTextAlignment(Qt::AlignHCenter);
item->setFont(QFont("Times", 12, QFont::Bold)); item->setFont(QFont("Times", 12, QFont::Bold));
item->setData(Qt::UserRole, cell.getId()); item->setData(Qt::UserRole, cell.getId());
ui->tableWidgetIncrement->setItem(currentRow, 0, item); ui->tableWidgetIncrement->setItem(currentRow, 0, item);
item = new QTableWidgetItem(QString().setNum(data->GetValueIncrementTableRow(i.key()))); item = new QTableWidgetItem(QString().setNum(data->GetValueIncrementTableRow(iMap.value())));
item->setTextAlignment(Qt::AlignHCenter); item->setTextAlignment(Qt::AlignHCenter);
// set the item non-editable (view only), and non-selectable // set the item non-editable (view only), and non-selectable
Qt::ItemFlags flags = item->flags(); Qt::ItemFlags flags = item->flags();
@ -130,7 +144,7 @@ void DialogIncrements::FillIncrementTable(){
ui->tableWidgetIncrement->setItem(currentRow, 4, item); ui->tableWidgetIncrement->setItem(currentRow, 4, item);
item = new QTableWidgetItem(cell.getDescription()); item = new QTableWidgetItem(cell.getDescription());
item->setTextAlignment(Qt::AlignHCenter); item->setTextAlignment(Qt::AlignLeft);
ui->tableWidgetIncrement->setItem(currentRow, 5, item); ui->tableWidgetIncrement->setItem(currentRow, 5, item);
} }
if(ui->tableWidgetIncrement->rowCount()>0){ if(ui->tableWidgetIncrement->rowCount()>0){
@ -138,13 +152,21 @@ void DialogIncrements::FillIncrementTable(){
} }
ui->tableWidgetIncrement->resizeColumnsToContents(); ui->tableWidgetIncrement->resizeColumnsToContents();
ui->tableWidgetIncrement->resizeRowsToContents(); ui->tableWidgetIncrement->resizeRowsToContents();
ui->tableWidgetIncrement->verticalHeader()->setDefaultSectionSize(20); ui->tableWidgetIncrement->setCurrentCell( row, column );
} }
void DialogIncrements::FillLengthLines(){ void DialogIncrements::FillLengthLines(){
const QMap<QString, qreal> *linesTable = data->DataLengthLines(); const QHash<QString, qreal> *linesTable = data->DataLengthLines();
QHashIterator<QString, qreal> iHash(*linesTable);
QMap<QString, qreal> map;
//Sorting QHash by name
while (iHash.hasNext()) {
iHash.next();
map.insert(iHash.key(), iHash.value());
}
qint32 currentRow = -1; qint32 currentRow = -1;
QMapIterator<QString, qreal> i(*linesTable); QMapIterator<QString, qreal> i(map);
while (i.hasNext()) { while (i.hasNext()) {
i.next(); i.next();
qreal length = i.value(); qreal length = i.value();
@ -166,9 +188,17 @@ void DialogIncrements::FillLengthLines(){
} }
void DialogIncrements::FillLengthSplines(){ void DialogIncrements::FillLengthSplines(){
const QMap<QString, qreal> *splinesTable = data->DataLengthSplines(); const QHash<QString, qreal> *splinesTable = data->DataLengthSplines();
QHashIterator<QString, qreal> iHash(*splinesTable);
QMap<QString, qreal> map;
//Sorting QHash by name
while (iHash.hasNext()) {
iHash.next();
map.insert(iHash.key(), iHash.value());
}
qint32 currentRow = -1; qint32 currentRow = -1;
QMapIterator<QString, qreal> i(*splinesTable); QMapIterator<QString, qreal> i(map);
while (i.hasNext()) { while (i.hasNext()) {
i.next(); i.next();
qreal length = i.value(); qreal length = i.value();
@ -176,7 +206,7 @@ void DialogIncrements::FillLengthSplines(){
ui->tableWidgetSplines->setRowCount ( splinesTable->size() ); ui->tableWidgetSplines->setRowCount ( splinesTable->size() );
QTableWidgetItem *item = new QTableWidgetItem(QString(i.key())); QTableWidgetItem *item = new QTableWidgetItem(QString(i.key()));
item->setTextAlignment(Qt::AlignHCenter); item->setTextAlignment(Qt::AlignLeft);
item->setFont(QFont("Times", 12, QFont::Bold)); item->setFont(QFont("Times", 12, QFont::Bold));
ui->tableWidgetSplines->setItem(currentRow, 0, item); ui->tableWidgetSplines->setItem(currentRow, 0, item);
@ -190,9 +220,17 @@ void DialogIncrements::FillLengthSplines(){
} }
void DialogIncrements::FillLengthArcs(){ void DialogIncrements::FillLengthArcs(){
const QMap<QString, qreal> *arcsTable = data->DataLengthArcs(); const QHash<QString, qreal> *arcsTable = data->DataLengthArcs();
QHashIterator<QString, qreal> iHash(*arcsTable);
QMap<QString, qreal> map;
//Sorting QHash by name
while (iHash.hasNext()) {
iHash.next();
map.insert(iHash.key(), iHash.value());
}
qint32 currentRow = -1; qint32 currentRow = -1;
QMapIterator<QString, qreal> i(*arcsTable); QMapIterator<QString, qreal> i(map);
while (i.hasNext()) { while (i.hasNext()) {
i.next(); i.next();
qreal length = i.value(); qreal length = i.value();
@ -251,15 +289,15 @@ void DialogIncrements::clickedToolButtonAdd(){
qint32 num = 1; qint32 num = 1;
QString name; QString name;
do{ do{
name = QString("Позначення %1").arg(num); name = QString(tr("Denotation %1")).arg(num);
num++; num++;
}while(data->IncrementTableContains(name)); }while(data->IncrementTableContains(name));
qint64 id = data->getNextId(); qint64 id = data->getNextId();
qint32 base = 0; qreal base = 0;
qreal ksize = 0; qreal ksize = 0;
qreal kgrowth = 0; qreal kgrowth = 0;
QString description = QString("Опис"); QString description = QString(tr("Description"));
VIncrementTableRow incrementRow = VIncrementTableRow(id, base, ksize, kgrowth, description); VIncrementTableRow incrementRow = VIncrementTableRow(id, base, ksize, kgrowth, description);
data->AddIncrementTableRow(name, incrementRow); data->AddIncrementTableRow(name, incrementRow);
@ -292,13 +330,14 @@ void DialogIncrements::clickedToolButtonAdd(){
item->setTextAlignment(Qt::AlignHCenter); item->setTextAlignment(Qt::AlignHCenter);
ui->tableWidgetIncrement->setItem(currentRow, 4, item); ui->tableWidgetIncrement->setItem(currentRow, 4, item);
item = new QTableWidgetItem("Опис"); item = new QTableWidgetItem(tr("Description"));
item->setTextAlignment(Qt::AlignHCenter); item->setTextAlignment(Qt::AlignHCenter);
ui->tableWidgetIncrement->setItem(currentRow, 5, item); ui->tableWidgetIncrement->setItem(currentRow, 5, item);
ui->toolButtonRemove->setEnabled(true); ui->toolButtonRemove->setEnabled(true);
connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this,
&DialogIncrements::cellChanged); &DialogIncrements::cellChanged);
emit haveLiteChange();
} }
void DialogIncrements::clickedToolButtonRemove(){ void DialogIncrements::clickedToolButtonRemove(){
@ -320,9 +359,10 @@ void DialogIncrements::clickedToolButtonRemove(){
} }
connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this,
&DialogIncrements::cellChanged); &DialogIncrements::cellChanged);
emit haveLiteChange();
} }
void DialogIncrements::AddIncrementToFile(qint64 id, QString name, qint32 base, qreal ksize, void DialogIncrements::AddIncrementToFile(qint64 id, QString name, qreal base, qreal ksize,
qreal kgrowth, QString description){ qreal kgrowth, QString description){
QDomNodeList list = doc->elementsByTagName("increments"); QDomNodeList list = doc->elementsByTagName("increments");
QDomElement element = doc->createElement("increment"); QDomElement element = doc->createElement("increment");
@ -355,10 +395,11 @@ void DialogIncrements::AddIncrementToFile(qint64 id, QString name, qint32 base,
} }
void DialogIncrements::cellChanged ( qint32 row, qint32 column ){ void DialogIncrements::cellChanged ( qint32 row, qint32 column ){
QTableWidgetItem *item; QTableWidgetItem *item = 0;
QTableWidgetItem *itemName; QTableWidgetItem *itemName = 0;
qint64 id; qint64 id;
QDomElement domElement; QDomElement domElement;
this->row = row;
switch(column) { switch(column) {
case 0: case 0:
item = ui->tableWidgetIncrement->item(row, 0); item = ui->tableWidgetIncrement->item(row, 0);
@ -367,6 +408,7 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ){
if(domElement.isElement()){ if(domElement.isElement()){
domElement.setAttribute("name", item->text()); domElement.setAttribute("name", item->text());
data->ClearIncrementTable(); data->ClearIncrementTable();
this->column = 2;
emit FullUpdateTree(); emit FullUpdateTree();
} }
break; break;
@ -376,8 +418,15 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ){
id = qvariant_cast<qint64>(itemName->data(Qt::UserRole)); id = qvariant_cast<qint64>(itemName->data(Qt::UserRole));
domElement = doc->elementById(QString().setNum(id)); domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){ if(domElement.isElement()){
domElement.setAttribute("base", item->text().toDouble()); bool ok = false;
qreal value = item->text().toDouble(&ok);
if(ok){
domElement.setAttribute("base", value);
this->column = 3;
emit FullUpdateTree(); emit FullUpdateTree();
} else {
throw VException(tr("Can't convert toDouble value."));
}
} }
break; break;
case 3: case 3:
@ -387,6 +436,7 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ){
domElement = doc->elementById(QString().setNum(id)); domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){ if(domElement.isElement()){
domElement.setAttribute("ksize", item->text().toDouble()); domElement.setAttribute("ksize", item->text().toDouble());
this->column = 4;
emit FullUpdateTree(); emit FullUpdateTree();
} }
break; break;
@ -397,6 +447,7 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ){
domElement = doc->elementById(QString().setNum(id)); domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){ if(domElement.isElement()){
domElement.setAttribute("kgrowth", item->text().toDouble()); domElement.setAttribute("kgrowth", item->text().toDouble());
this->column = 5;
emit FullUpdateTree(); emit FullUpdateTree();
} }
break; break;
@ -410,6 +461,9 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ){
VIncrementTableRow incr = data->GetIncrementTableRow(itemName->text()); VIncrementTableRow incr = data->GetIncrementTableRow(itemName->text());
incr.setDescription(item->text()); incr.setDescription(item->text());
data->UpdateIncrementTableRow(itemName->text(), incr); data->UpdateIncrementTableRow(itemName->text(), incr);
ui->tableWidgetIncrement->resizeColumnsToContents();
ui->tableWidgetIncrement->resizeRowsToContents();
ui->tableWidgetIncrement->setCurrentCell( row, 0 );
emit haveLiteChange(); emit haveLiteChange();
} }
break; break;
@ -418,37 +472,38 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ){
void DialogIncrements::InitialStandartTable(){ void DialogIncrements::InitialStandartTable(){
ui->tableWidgetStandart->setSortingEnabled(false); ui->tableWidgetStandart->setSortingEnabled(false);
ui->tableWidgetStandart->setHorizontalHeaderItem(0, new QTableWidgetItem("Позначення")); ui->tableWidgetStandart->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Denotation")));
ui->tableWidgetStandart->setHorizontalHeaderItem(1, new QTableWidgetItem("Розрах. знач.")); ui->tableWidgetStandart->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Calculated value")));
ui->tableWidgetStandart->setHorizontalHeaderItem(2, new QTableWidgetItem("Базове знач.")); ui->tableWidgetStandart->setHorizontalHeaderItem(2, new QTableWidgetItem(tr("Base value")));
ui->tableWidgetStandart->setHorizontalHeaderItem(3, new QTableWidgetItem("В розмірі")); ui->tableWidgetStandart->setHorizontalHeaderItem(3, new QTableWidgetItem(tr("In size")));
ui->tableWidgetStandart->setHorizontalHeaderItem(4, new QTableWidgetItem("В рості")); ui->tableWidgetStandart->setHorizontalHeaderItem(4, new QTableWidgetItem(tr("In growth")));
ui->tableWidgetStandart->setHorizontalHeaderItem(5, new QTableWidgetItem("Опис")); ui->tableWidgetStandart->setHorizontalHeaderItem(5, new QTableWidgetItem(tr("Description")));
} }
void DialogIncrements::InitialIncrementTable(){ void DialogIncrements::InitialIncrementTable(){
ui->tableWidgetIncrement->setSortingEnabled(false); ui->tableWidgetIncrement->setSortingEnabled(false);
ui->tableWidgetIncrement->setHorizontalHeaderItem(0, new QTableWidgetItem("Позначення")); ui->tableWidgetIncrement->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Denotation")));
ui->tableWidgetIncrement->setHorizontalHeaderItem(1, new QTableWidgetItem("Розрах. знач.")); ui->tableWidgetIncrement->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Calculated value")));
ui->tableWidgetIncrement->setHorizontalHeaderItem(2, new QTableWidgetItem("Базове знач.")); ui->tableWidgetIncrement->setHorizontalHeaderItem(2, new QTableWidgetItem(tr("Base value")));
ui->tableWidgetIncrement->setHorizontalHeaderItem(3, new QTableWidgetItem("В розмірі")); ui->tableWidgetIncrement->setHorizontalHeaderItem(3, new QTableWidgetItem(tr("In size")));
ui->tableWidgetIncrement->setHorizontalHeaderItem(4, new QTableWidgetItem("В рості")); ui->tableWidgetIncrement->setHorizontalHeaderItem(4, new QTableWidgetItem(tr("In growth")));
ui->tableWidgetIncrement->setHorizontalHeaderItem(5, new QTableWidgetItem("Опис")); ui->tableWidgetIncrement->setHorizontalHeaderItem(5, new QTableWidgetItem(tr("Description")));
ui->tableWidgetIncrement->verticalHeader()->setDefaultSectionSize(20);
} }
void DialogIncrements::InitialLinesTable(){ void DialogIncrements::InitialLinesTable(){
ui->tableWidgetLines->setHorizontalHeaderItem(0, new QTableWidgetItem("Лінія")); ui->tableWidgetLines->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Line")));
ui->tableWidgetLines->setHorizontalHeaderItem(1, new QTableWidgetItem("Довжина")); ui->tableWidgetLines->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Length")));
} }
void DialogIncrements::InitialSplinesTable(){ void DialogIncrements::InitialSplinesTable(){
ui->tableWidgetSplines->setHorizontalHeaderItem(0, new QTableWidgetItem("Лінія")); ui->tableWidgetSplines->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Curve")));
ui->tableWidgetSplines->setHorizontalHeaderItem(1, new QTableWidgetItem("Довжина")); ui->tableWidgetSplines->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Length")));
} }
void DialogIncrements::InitialArcsTable(){ void DialogIncrements::InitialArcsTable(){
ui->tableWidgetArcs->setHorizontalHeaderItem(0, new QTableWidgetItem("Лінія")); ui->tableWidgetArcs->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Arc")));
ui->tableWidgetArcs->setHorizontalHeaderItem(1, new QTableWidgetItem("Довжина")); ui->tableWidgetArcs->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Length")));
} }
void DialogIncrements::DialogAccepted(){ void DialogIncrements::DialogAccepted(){

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -29,11 +29,10 @@ namespace Ui {
class DialogIncrements; class DialogIncrements;
} }
class DialogIncrements : public DialogTool class DialogIncrements : public DialogTool{
{
Q_OBJECT Q_OBJECT
public: public:
explicit DialogIncrements(VContainer *data, VDomDocument *doc, QWidget *parent = 0); DialogIncrements(VContainer *data, VDomDocument *doc, QWidget *parent = 0);
~DialogIncrements(); ~DialogIncrements();
public slots: public slots:
void clickedToolButtonAdd(); void clickedToolButtonAdd();
@ -49,6 +48,8 @@ private:
Ui::DialogIncrements *ui; Ui::DialogIncrements *ui;
VContainer *data; // need because we must change data VContainer *data; // need because we must change data
VDomDocument *doc; VDomDocument *doc;
qint32 row;
qint32 column;
void InitialStandartTable(); void InitialStandartTable();
void InitialIncrementTable(); void InitialIncrementTable();
void InitialLinesTable(); void InitialLinesTable();
@ -59,7 +60,7 @@ private:
void FillLengthLines(); void FillLengthLines();
void FillLengthSplines(); void FillLengthSplines();
void FillLengthArcs(); void FillLengthArcs();
void AddIncrementToFile(qint64 id, QString name, qint32 base, qreal ksize, qreal kgrowth, void AddIncrementToFile(qint64 id, QString name, qreal base, qreal ksize, qreal kgrowth,
QString description); QString description);
}; };

View File

@ -27,7 +27,7 @@
<enum>QTabWidget::North</enum> <enum>QTabWidget::North</enum>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>4</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="tabStandart"> <widget class="QWidget" name="tabStandart">
<attribute name="title"> <attribute name="title">
@ -149,9 +149,15 @@
<attribute name="verticalHeaderVisible"> <attribute name="verticalHeaderVisible">
<bool>false</bool> <bool>false</bool>
</attribute> </attribute>
<attribute name="verticalHeaderCascadingSectionResizes">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderDefaultSectionSize"> <attribute name="verticalHeaderDefaultSectionSize">
<number>45</number> <number>45</number>
</attribute> </attribute>
<attribute name="verticalHeaderStretchLastSection">
<bool>false</bool>
</attribute>
<column> <column>
<property name="text"> <property name="text">
<string>Denotation</string> <string>Denotation</string>
@ -338,6 +344,17 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<tabstops>
<tabstop>tabWidget</tabstop>
<tabstop>tableWidgetStandart</tabstop>
<tabstop>tableWidgetIncrement</tabstop>
<tabstop>toolButtonAdd</tabstop>
<tabstop>toolButtonRemove</tabstop>
<tabstop>tableWidgetLines</tabstop>
<tabstop>tableWidgetSplines</tabstop>
<tabstop>tableWidgetArcs</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources> <resources>
<include location="../icon.qrc"/> <include location="../icon.qrc"/>
</resources> </resources>

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -21,8 +21,6 @@
#include "dialogline.h" #include "dialogline.h"
#include "ui_dialogline.h" #include "ui_dialogline.h"
#include <QPushButton>
#include <QCloseEvent>
DialogLine::DialogLine(const VContainer *data, Draw::Draws mode, QWidget *parent) : DialogLine::DialogLine(const VContainer *data, Draw::Draws mode, QWidget *parent) :
DialogTool(data, mode, parent), ui(new Ui::DialogLine), number(0), firstPoint(0), secondPoint(0){ DialogTool(data, mode, parent), ui(new Ui::DialogLine), number(0), firstPoint(0), secondPoint(0){
@ -40,10 +38,6 @@ DialogLine::~DialogLine(){
delete ui; delete ui;
} }
qint64 DialogLine::getSecondPoint() const{
return secondPoint;
}
void DialogLine::setSecondPoint(const qint64 &value){ void DialogLine::setSecondPoint(const qint64 &value){
secondPoint = value; secondPoint = value;
VPointF point = data->GetPoint(value); VPointF point = data->GetPoint(value);
@ -53,10 +47,6 @@ void DialogLine::setSecondPoint(const qint64 &value){
} }
} }
qint64 DialogLine::getFirstPoint() const{
return firstPoint;
}
void DialogLine::setFirstPoint(const qint64 &value){ void DialogLine::setFirstPoint(const qint64 &value){
firstPoint = value; firstPoint = value;
VPointF point = data->GetPoint(value); VPointF point = data->GetPoint(value);
@ -99,6 +89,7 @@ void DialogLine::ChoosedObject(qint64 id, Scene::Scenes type){
if ( index != -1 ) { // -1 for not found if ( index != -1 ) { // -1 for not found
ui->comboBoxFirstPoint->setCurrentIndex(index); ui->comboBoxFirstPoint->setCurrentIndex(index);
number++; number++;
emit ToolTip(tr("Select second point"));
return; return;
} }
} }
@ -107,6 +98,7 @@ void DialogLine::ChoosedObject(qint64 id, Scene::Scenes type){
if ( index != -1 ) { // -1 for not found if ( index != -1 ) { // -1 for not found
ui->comboBoxSecondPoint->setCurrentIndex(index); ui->comboBoxSecondPoint->setCurrentIndex(index);
number = 0; number = 0;
emit ToolTip("");
} }
if(!isInitialized){ if(!isInitialized){
this->show(); this->show();

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -28,16 +28,15 @@ namespace Ui {
class DialogLine; class DialogLine;
} }
class DialogLine : public DialogTool class DialogLine : public DialogTool{
{
Q_OBJECT Q_OBJECT
public: public:
explicit DialogLine(const VContainer *data, Draw::Draws mode = Draw::Calculation, explicit DialogLine(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0); QWidget *parent = 0);
~DialogLine(); ~DialogLine();
qint64 getFirstPoint() const; inline qint64 getFirstPoint() const {return firstPoint;}
void setFirstPoint(const qint64 &value); void setFirstPoint(const qint64 &value);
qint64 getSecondPoint() const; inline qint64 getSecondPoint() const {return secondPoint;}
void setSecondPoint(const qint64 &value); void setSecondPoint(const qint64 &value);
public slots: public slots:
void ChoosedObject(qint64 id, Scene::Scenes type); void ChoosedObject(qint64 id, Scene::Scenes type);

View File

@ -61,6 +61,11 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<tabstops>
<tabstop>comboBoxFirstPoint</tabstop>
<tabstop>comboBoxSecondPoint</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources> <resources>
<include location="../icon.qrc"/> <include location="../icon.qrc"/>
</resources> </resources>

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -29,6 +29,7 @@ DialogLineIntersect::DialogLineIntersect(const VContainer *data, Draw::Draws mod
number = 0; number = 0;
bOk = ui->buttonBox->button(QDialogButtonBox::Ok); bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogLineIntersect::DialogAccepted); connect(bOk, &QPushButton::clicked, this, &DialogLineIntersect::DialogAccepted);
labelEditNamePoint = ui->labelEditNamePoint;
flagName = false; flagName = false;
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
connect(bCansel, &QPushButton::clicked, this, &DialogLineIntersect::DialogRejected); connect(bCansel, &QPushButton::clicked, this, &DialogLineIntersect::DialogRejected);
@ -40,8 +41,7 @@ DialogLineIntersect::DialogLineIntersect(const VContainer *data, Draw::Draws mod
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogLineIntersect::NamePointChanged); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogLineIntersect::NamePointChanged);
} }
DialogLineIntersect::~DialogLineIntersect() DialogLineIntersect::~DialogLineIntersect(){
{
delete ui; delete ui;
} }
@ -70,6 +70,7 @@ void DialogLineIntersect::ChoosedObject(qint64 id, Scene::Scenes type){
ui->comboBoxP1Line1->setCurrentIndex(index); ui->comboBoxP1Line1->setCurrentIndex(index);
p1Line1 = id; p1Line1 = id;
number++; number++;
emit ToolTip(tr("Select second point of first line"));
return; return;
} }
} }
@ -79,6 +80,7 @@ void DialogLineIntersect::ChoosedObject(qint64 id, Scene::Scenes type){
ui->comboBoxP2Line1->setCurrentIndex(index); ui->comboBoxP2Line1->setCurrentIndex(index);
p2Line1 = id; p2Line1 = id;
number++; number++;
emit ToolTip(tr("Select first point of second line"));
return; return;
} }
} }
@ -88,6 +90,7 @@ void DialogLineIntersect::ChoosedObject(qint64 id, Scene::Scenes type){
ui->comboBoxP1Line2->setCurrentIndex(index); ui->comboBoxP1Line2->setCurrentIndex(index);
p1Line2 = id; p1Line2 = id;
number++; number++;
emit ToolTip(tr("Select second point of second line"));
return; return;
} }
} }
@ -97,6 +100,7 @@ void DialogLineIntersect::ChoosedObject(qint64 id, Scene::Scenes type){
ui->comboBoxP2Line2->setCurrentIndex(index); ui->comboBoxP2Line2->setCurrentIndex(index);
p2Line2 = id; p2Line2 = id;
number = 0; number = 0;
emit ToolTip("");
} }
if(!isInitialized){ if(!isInitialized){
flagPoint = CheckIntersecion(); flagPoint = CheckIntersecion();
@ -153,7 +157,7 @@ void DialogLineIntersect::P2Line2Changed(int index){
} }
void DialogLineIntersect::CheckState(){ void DialogLineIntersect::CheckState(){
Q_CHECK_PTR(bOk); Q_ASSERT(bOk != 0);
bOk->setEnabled(flagName && flagPoint); bOk->setEnabled(flagName && flagPoint);
} }
@ -174,46 +178,26 @@ bool DialogLineIntersect::CheckIntersecion(){
} }
} }
qint64 DialogLineIntersect::getP2Line2() const{
return p2Line2;
}
void DialogLineIntersect::setP2Line2(const qint64 &value){ void DialogLineIntersect::setP2Line2(const qint64 &value){
p2Line2 = value; p2Line2 = value;
ChangeCurrentData(ui->comboBoxP2Line2, value); ChangeCurrentData(ui->comboBoxP2Line2, value);
} }
qint64 DialogLineIntersect::getP1Line2() const{
return p1Line2;
}
void DialogLineIntersect::setP1Line2(const qint64 &value){ void DialogLineIntersect::setP1Line2(const qint64 &value){
p1Line2 = value; p1Line2 = value;
ChangeCurrentData(ui->comboBoxP1Line2, value); ChangeCurrentData(ui->comboBoxP1Line2, value);
} }
qint64 DialogLineIntersect::getP2Line1() const{
return p2Line1;
}
void DialogLineIntersect::setP2Line1(const qint64 &value){ void DialogLineIntersect::setP2Line1(const qint64 &value){
p2Line1 = value; p2Line1 = value;
ChangeCurrentData(ui->comboBoxP2Line1, value); ChangeCurrentData(ui->comboBoxP2Line1, value);
} }
qint64 DialogLineIntersect::getP1Line1() const{
return p1Line1;
}
void DialogLineIntersect::setP1Line1(const qint64 &value){ void DialogLineIntersect::setP1Line1(const qint64 &value){
p1Line1 = value; p1Line1 = value;
ChangeCurrentData(ui->comboBoxP1Line1, value); ChangeCurrentData(ui->comboBoxP1Line1, value);
} }
QString DialogLineIntersect::getPointName() const{
return pointName;
}
void DialogLineIntersect::setPointName(const QString &value){ void DialogLineIntersect::setPointName(const QString &value){
pointName = value; pointName = value;
ui->lineEditNamePoint->setText(pointName); ui->lineEditNamePoint->setText(pointName);

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -28,22 +28,21 @@ namespace Ui {
class DialogLineIntersect; class DialogLineIntersect;
} }
class DialogLineIntersect : public DialogTool class DialogLineIntersect : public DialogTool{
{
Q_OBJECT Q_OBJECT
public: public:
explicit DialogLineIntersect(const VContainer *data, Draw::Draws mode = Draw::Calculation, explicit DialogLineIntersect(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0); QWidget *parent = 0);
~DialogLineIntersect(); ~DialogLineIntersect();
qint64 getP1Line1() const; inline qint64 getP1Line1() const {return p1Line1;}
void setP1Line1(const qint64 &value); void setP1Line1(const qint64 &value);
qint64 getP2Line1() const; inline qint64 getP2Line1() const {return p2Line1;}
void setP2Line1(const qint64 &value); void setP2Line1(const qint64 &value);
qint64 getP1Line2() const; inline qint64 getP1Line2() const {return p1Line2;}
void setP1Line2(const qint64 &value); void setP1Line2(const qint64 &value);
qint64 getP2Line2() const; inline qint64 getP2Line2() const {return p2Line2;}
void setP2Line2(const qint64 &value); void setP2Line2(const qint64 &value);
QString getPointName() const; inline QString getPointName() const {return pointName;}
void setPointName(const QString &value); void setPointName(const QString &value);
public slots: public slots:
virtual void ChoosedObject(qint64 id, Scene::Scenes type); virtual void ChoosedObject(qint64 id, Scene::Scenes type);

View File

@ -24,13 +24,50 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="horizontalLayout_4">
<item> <item>
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="labelEditNamePoint">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text"> <property name="text">
<string>Name new point</string> <string>Name new point</string>
</property> </property>
@ -127,6 +164,14 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<tabstops>
<tabstop>lineEditNamePoint</tabstop>
<tabstop>comboBoxP1Line1</tabstop>
<tabstop>comboBoxP2Line1</tabstop>
<tabstop>comboBoxP1Line2</tabstop>
<tabstop>comboBoxP2Line2</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources> <resources>
<include location="../icon.qrc"/> <include location="../icon.qrc"/>
</resources> </resources>

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -21,7 +21,6 @@
#include "dialognormal.h" #include "dialognormal.h"
#include "ui_dialognormal.h" #include "ui_dialognormal.h"
#include <QMenu>
DialogNormal::DialogNormal(const VContainer *data, Draw::Draws mode, QWidget *parent) : DialogNormal::DialogNormal(const VContainer *data, Draw::Draws mode, QWidget *parent) :
DialogTool(data, mode, parent), ui(new Ui::DialogNormal), number(0), pointName(QString()), DialogTool(data, mode, parent), ui(new Ui::DialogNormal), number(0), pointName(QString()),
@ -35,7 +34,11 @@ DialogNormal::DialogNormal(const VContainer *data, Draw::Draws mode, QWidget *pa
radioButtonStandartTable = ui->radioButtonStandartTable; radioButtonStandartTable = ui->radioButtonStandartTable;
radioButtonIncrements = ui->radioButtonIncrements; radioButtonIncrements = ui->radioButtonIncrements;
radioButtonLengthLine = ui->radioButtonLengthLine; radioButtonLengthLine = ui->radioButtonLengthLine;
radioButtonLengthArc = ui->radioButtonLengthArc;
radioButtonLengthCurve = ui->radioButtonLengthSpline;
lineEditFormula = ui->lineEditFormula; lineEditFormula = ui->lineEditFormula;
labelEditFormula = ui->labelEditFormula;
labelEditNamePoint = ui->labelEditNamePoint;
flagFormula = false; flagFormula = false;
bOk = ui->buttonBox->button(QDialogButtonBox::Ok); bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogNormal::DialogAccepted); connect(bOk, &QPushButton::clicked, this, &DialogNormal::DialogAccepted);
@ -72,13 +75,14 @@ DialogNormal::DialogNormal(const VContainer *data, Draw::Draws mode, QWidget *pa
connect(ui->radioButtonStandartTable, &QRadioButton::clicked, this, &DialogNormal::StandartTable); connect(ui->radioButtonStandartTable, &QRadioButton::clicked, this, &DialogNormal::StandartTable);
connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogNormal::Increments); connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogNormal::Increments);
connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogNormal::LengthLines); connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogNormal::LengthLines);
connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogNormal::LengthArcs);
connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogNormal::LengthCurves);
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogNormal::EvalFormula); connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogNormal::EvalFormula);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogNormal::NamePointChanged); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogNormal::NamePointChanged);
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogNormal::FormulaChanged); connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogNormal::FormulaChanged);
} }
DialogNormal::~DialogNormal() DialogNormal::~DialogNormal(){
{
delete ui; delete ui;
} }
@ -106,6 +110,7 @@ void DialogNormal::ChoosedObject(qint64 id, Scene::Scenes type){
if ( index != -1 ) { // -1 for not found if ( index != -1 ) { // -1 for not found
ui->comboBoxFirstPoint->setCurrentIndex(index); ui->comboBoxFirstPoint->setCurrentIndex(index);
number++; number++;
emit ToolTip(tr("Select second point of line"));
return; return;
} }
} }
@ -114,6 +119,7 @@ void DialogNormal::ChoosedObject(qint64 id, Scene::Scenes type){
if ( index != -1 ) { // -1 for not found if ( index != -1 ) { // -1 for not found
ui->comboBoxSecondPoint->setCurrentIndex(index); ui->comboBoxSecondPoint->setCurrentIndex(index);
number = 0; number = 0;
emit ToolTip("");
} }
if(!isInitialized){ if(!isInitialized){
this->show(); this->show();
@ -132,53 +138,29 @@ void DialogNormal::DialogAccepted(){
emit DialogClosed(QDialog::Accepted); emit DialogClosed(QDialog::Accepted);
} }
qint64 DialogNormal::getSecondPointId() const{
return secondPointId;
}
void DialogNormal::setSecondPointId(const qint64 &value, const qint64 &id){ void DialogNormal::setSecondPointId(const qint64 &value, const qint64 &id){
setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id); setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id);
} }
qint64 DialogNormal::getFirstPointId() const{
return firstPointId;
}
void DialogNormal::setFirstPointId(const qint64 &value, const qint64 &id){ void DialogNormal::setFirstPointId(const qint64 &value, const qint64 &id){
setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id); setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id);
} }
qreal DialogNormal::getAngle() const{
return angle;
}
void DialogNormal::setAngle(const qreal &value){ void DialogNormal::setAngle(const qreal &value){
angle = value; angle = value;
ui->doubleSpinBoxAngle->setValue(angle); ui->doubleSpinBoxAngle->setValue(angle);
} }
QString DialogNormal::getFormula() const{
return formula;
}
void DialogNormal::setFormula(const QString &value){ void DialogNormal::setFormula(const QString &value){
formula = value; formula = value;
ui->lineEditFormula->setText(formula); ui->lineEditFormula->setText(formula);
} }
QString DialogNormal::getTypeLine() const{
return typeLine;
}
void DialogNormal::setTypeLine(const QString &value){ void DialogNormal::setTypeLine(const QString &value){
typeLine = value; typeLine = value;
SetupTypeLine(ui->comboBoxLineType, value); SetupTypeLine(ui->comboBoxLineType, value);
} }
QString DialogNormal::getPointName() const{
return pointName;
}
void DialogNormal::setPointName(const QString &value){ void DialogNormal::setPointName(const QString &value){
pointName = value; pointName = value;
ui->lineEditNamePoint->setText(pointName); ui->lineEditNamePoint->setText(pointName);

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -23,31 +23,28 @@
#define DIALOGNORMAL_H #define DIALOGNORMAL_H
#include "dialogtool.h" #include "dialogtool.h"
#include <QListWidgetItem>
#include "container/calculator.h"
namespace Ui { namespace Ui {
class DialogNormal; class DialogNormal;
} }
class DialogNormal : public DialogTool class DialogNormal : public DialogTool{
{
Q_OBJECT Q_OBJECT
public: public:
explicit DialogNormal(const VContainer *data, Draw::Draws mode = Draw::Calculation, explicit DialogNormal(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0); QWidget *parent = 0);
~DialogNormal(); ~DialogNormal();
QString getPointName() const; inline QString getPointName() const{return pointName;}
void setPointName(const QString &value); void setPointName(const QString &value);
QString getTypeLine() const; inline QString getTypeLine() const {return typeLine;}
void setTypeLine(const QString &value); void setTypeLine(const QString &value);
QString getFormula() const; inline QString getFormula() const {return formula;}
void setFormula(const QString &value); void setFormula(const QString &value);
qreal getAngle() const; inline qreal getAngle() const {return angle;}
void setAngle(const qreal &value); void setAngle(const qreal &value);
qint64 getFirstPointId() const; inline qint64 getFirstPointId() const {return firstPointId;}
void setFirstPointId(const qint64 &value, const qint64 &id); void setFirstPointId(const qint64 &value, const qint64 &id);
qint64 getSecondPointId() const; inline qint64 getSecondPointId() const {return secondPointId;}
void setSecondPointId(const qint64 &value, const qint64 &id); void setSecondPointId(const qint64 &value, const qint64 &id);
public slots: public slots:
virtual void ChoosedObject(qint64 id, Scene::Scenes type); virtual void ChoosedObject(qint64 id, Scene::Scenes type);

View File

@ -24,13 +24,50 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="labelEditFormula">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred"> <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text"> <property name="text">
<string>Length</string> <string>Length</string>
</property> </property>
@ -44,10 +81,16 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="toolTip">
<string>Formula calculation of length of normal</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QToolButton" name="toolButtonEqual"> <widget class="QToolButton" name="toolButtonEqual">
<property name="toolTip">
<string>Calculate formula</string>
</property>
<property name="text"> <property name="text">
<string>...</string> <string>...</string>
</property> </property>
@ -77,6 +120,9 @@
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="toolTip">
<string>Value of length</string>
</property>
<property name="text"> <property name="text">
<string>_</string> <string>_</string>
</property> </property>
@ -91,13 +137,50 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="horizontalLayout_4">
<item> <item>
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="labelEditNamePoint">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text"> <property name="text">
<string>Name new point</string> <string>Name new point</string>
</property> </property>
@ -108,6 +191,9 @@
</item> </item>
<item> <item>
<widget class="QToolButton" name="toolButtonPutHere"> <widget class="QToolButton" name="toolButtonPutHere">
<property name="toolTip">
<string>Put variable into formula</string>
</property>
<property name="text"> <property name="text">
<string>...</string> <string>...</string>
</property> </property>
@ -379,7 +465,11 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="comboBoxLineType"/> <widget class="QComboBox" name="comboBoxLineType">
<property name="toolTip">
<string>Show line from first point to our point</string>
</property>
</widget>
</item> </item>
</layout> </layout>
</item> </item>
@ -429,7 +519,7 @@
<item> <item>
<widget class="QRadioButton" name="radioButtonLengthArc"> <widget class="QRadioButton" name="radioButtonLengthArc">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>true</bool>
</property> </property>
<property name="text"> <property name="text">
<string>Length of arcs</string> <string>Length of arcs</string>
@ -439,7 +529,7 @@
<item> <item>
<widget class="QRadioButton" name="radioButtonLengthSpline"> <widget class="QRadioButton" name="radioButtonLengthSpline">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>true</bool>
</property> </property>
<property name="text"> <property name="text">
<string>Length of curves</string> <string>Length of curves</string>
@ -451,7 +541,11 @@
</layout> </layout>
</item> </item>
<item> <item>
<widget class="QListWidget" name="listWidget"/> <widget class="QListWidget" name="listWidget">
<property name="toolTip">
<string>Variables. Click twice to select.</string>
</property>
</widget>
</item> </item>
</layout> </layout>
</item> </item>
@ -474,6 +568,32 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<tabstops>
<tabstop>lineEditFormula</tabstop>
<tabstop>lineEditNamePoint</tabstop>
<tabstop>comboBoxFirstPoint</tabstop>
<tabstop>comboBoxSecondPoint</tabstop>
<tabstop>doubleSpinBoxAngle</tabstop>
<tabstop>toolButtonArrowRight</tabstop>
<tabstop>toolButtonArrowRightUp</tabstop>
<tabstop>toolButtonArrowUp</tabstop>
<tabstop>toolButtonArrowLeftUp</tabstop>
<tabstop>toolButtonArrowLeft</tabstop>
<tabstop>toolButtonArrowLeftDown</tabstop>
<tabstop>toolButtonArrowDown</tabstop>
<tabstop>toolButtonArrowRightDown</tabstop>
<tabstop>comboBoxLineType</tabstop>
<tabstop>radioButtonSizeGrowth</tabstop>
<tabstop>radioButtonStandartTable</tabstop>
<tabstop>radioButtonIncrements</tabstop>
<tabstop>radioButtonLengthLine</tabstop>
<tabstop>radioButtonLengthArc</tabstop>
<tabstop>radioButtonLengthSpline</tabstop>
<tabstop>listWidget</tabstop>
<tabstop>toolButtonPutHere</tabstop>
<tabstop>toolButtonEqual</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources> <resources>
<include location="../icon.qrc"/> <include location="../icon.qrc"/>
</resources> </resources>

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -32,7 +32,11 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, Draw::Draws m
radioButtonStandartTable = ui.radioButtonStandartTable; radioButtonStandartTable = ui.radioButtonStandartTable;
radioButtonIncrements = ui.radioButtonIncrements; radioButtonIncrements = ui.radioButtonIncrements;
radioButtonLengthLine = ui.radioButtonLengthLine; radioButtonLengthLine = ui.radioButtonLengthLine;
radioButtonLengthArc = ui.radioButtonLengthArc;
radioButtonLengthCurve = ui.radioButtonLengthSpline;
lineEditFormula = ui.lineEditFormula; lineEditFormula = ui.lineEditFormula;
labelEditFormula = ui.labelEditFormula;
labelEditNamePoint = ui.labelEditNamePoint;
flagFormula = false; flagFormula = false;
bOk = ui.buttonBox->button(QDialogButtonBox::Ok); bOk = ui.buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogPointOfContact::DialogAccepted); connect(bOk, &QPushButton::clicked, this, &DialogPointOfContact::DialogAccepted);
@ -53,6 +57,8 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, Draw::Draws m
connect(ui.radioButtonStandartTable, &QRadioButton::clicked, this, &DialogPointOfContact::StandartTable); connect(ui.radioButtonStandartTable, &QRadioButton::clicked, this, &DialogPointOfContact::StandartTable);
connect(ui.radioButtonIncrements, &QRadioButton::clicked, this, &DialogPointOfContact::Increments); connect(ui.radioButtonIncrements, &QRadioButton::clicked, this, &DialogPointOfContact::Increments);
connect(ui.radioButtonLengthLine, &QRadioButton::clicked, this, &DialogPointOfContact::LengthLines); connect(ui.radioButtonLengthLine, &QRadioButton::clicked, this, &DialogPointOfContact::LengthLines);
connect(ui.radioButtonLengthArc, &QRadioButton::clicked, this, &DialogPointOfContact::LengthArcs);
connect(ui.radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogPointOfContact::LengthCurves);
connect(ui.toolButtonEqual, &QPushButton::clicked, this, &DialogPointOfContact::EvalFormula); connect(ui.toolButtonEqual, &QPushButton::clicked, this, &DialogPointOfContact::EvalFormula);
connect(ui.lineEditNamePoint, &QLineEdit::textChanged, this, &DialogPointOfContact::NamePointChanged); connect(ui.lineEditNamePoint, &QLineEdit::textChanged, this, &DialogPointOfContact::NamePointChanged);
connect(ui.lineEditFormula, &QLineEdit::textChanged, this, &DialogPointOfContact::FormulaChanged); connect(ui.lineEditFormula, &QLineEdit::textChanged, this, &DialogPointOfContact::FormulaChanged);
@ -82,6 +88,7 @@ void DialogPointOfContact::ChoosedObject(qint64 id, Scene::Scenes type){
if ( index != -1 ) { // -1 for not found if ( index != -1 ) { // -1 for not found
ui.comboBoxFirstPoint->setCurrentIndex(index); ui.comboBoxFirstPoint->setCurrentIndex(index);
number++; number++;
emit ToolTip(tr("Select second point of line"));
return; return;
} }
} }
@ -90,6 +97,7 @@ void DialogPointOfContact::ChoosedObject(qint64 id, Scene::Scenes type){
if ( index != -1 ) { // -1 for not found if ( index != -1 ) { // -1 for not found
ui.comboBoxSecondPoint->setCurrentIndex(index); ui.comboBoxSecondPoint->setCurrentIndex(index);
number++; number++;
emit ToolTip(tr("Select point of center of arc"));
return; return;
} }
} }
@ -98,6 +106,7 @@ void DialogPointOfContact::ChoosedObject(qint64 id, Scene::Scenes type){
if ( index != -1 ) { // -1 for not found if ( index != -1 ) { // -1 for not found
ui.comboBoxCenter->setCurrentIndex(index); ui.comboBoxCenter->setCurrentIndex(index);
number = 0; number = 0;
emit ToolTip("");
} }
if(!isInitialized){ if(!isInitialized){
this->show(); this->show();
@ -106,7 +115,6 @@ void DialogPointOfContact::ChoosedObject(qint64 id, Scene::Scenes type){
} }
} }
void DialogPointOfContact::DialogAccepted(){ void DialogPointOfContact::DialogAccepted(){
pointName = ui.lineEditNamePoint->text(); pointName = ui.lineEditNamePoint->text();
radius = ui.lineEditFormula->text(); radius = ui.lineEditFormula->text();
@ -116,44 +124,24 @@ void DialogPointOfContact::DialogAccepted(){
emit DialogClosed(QDialog::Accepted); emit DialogClosed(QDialog::Accepted);
} }
qint64 DialogPointOfContact::getSecondPoint() const{
return secondPoint;
}
void DialogPointOfContact::setSecondPoint(const qint64 &value, const qint64 &id){ void DialogPointOfContact::setSecondPoint(const qint64 &value, const qint64 &id){
setCurrentPointId(ui.comboBoxSecondPoint, secondPoint, value, id); setCurrentPointId(ui.comboBoxSecondPoint, secondPoint, value, id);
} }
qint64 DialogPointOfContact::getFirstPoint() const{
return firstPoint;
}
void DialogPointOfContact::setFirstPoint(const qint64 &value, const qint64 &id){ void DialogPointOfContact::setFirstPoint(const qint64 &value, const qint64 &id){
setCurrentPointId(ui.comboBoxFirstPoint, firstPoint, value, id); setCurrentPointId(ui.comboBoxFirstPoint, firstPoint, value, id);
} }
qint64 DialogPointOfContact::getCenter() const{
return center;
}
void DialogPointOfContact::setCenter(const qint64 &value, const qint64 &id){ void DialogPointOfContact::setCenter(const qint64 &value, const qint64 &id){
setCurrentPointId(ui.comboBoxCenter, center, value, id); setCurrentPointId(ui.comboBoxCenter, center, value, id);
center = value; center = value;
} }
QString DialogPointOfContact::getRadius() const{
return radius;
}
void DialogPointOfContact::setRadius(const QString &value){ void DialogPointOfContact::setRadius(const QString &value){
radius = value; radius = value;
ui.lineEditFormula->setText(radius); ui.lineEditFormula->setText(radius);
} }
QString DialogPointOfContact::getPointName() const{
return pointName;
}
void DialogPointOfContact::setPointName(const QString &value){ void DialogPointOfContact::setPointName(const QString &value){
pointName = value; pointName = value;
ui.lineEditNamePoint->setText(pointName); ui.lineEditNamePoint->setText(pointName);

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -24,30 +24,23 @@
#include "ui_dialogpointofcontact.h" #include "ui_dialogpointofcontact.h"
#include "dialogtool.h" #include "dialogtool.h"
#include "container/calculator.h"
class DialogPointOfContact : public DialogTool class DialogPointOfContact : public DialogTool{
{
Q_OBJECT Q_OBJECT
public: public:
explicit DialogPointOfContact(const VContainer *data, Draw::Draws mode = Draw::Calculation, DialogPointOfContact(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0); QWidget *parent = 0);
QString getPointName() const; inline QString getPointName() const {return pointName;}
void setPointName(const QString &value); void setPointName(const QString &value);
inline QString getRadius() const {return radius;}
QString getRadius() const;
void setRadius(const QString &value); void setRadius(const QString &value);
inline qint64 getCenter() const {return center;}
qint64 getCenter() const;
void setCenter(const qint64 &value, const qint64 &id); void setCenter(const qint64 &value, const qint64 &id);
inline qint64 getFirstPoint() const {return firstPoint;}
qint64 getFirstPoint() const;
void setFirstPoint(const qint64 &value, const qint64 &id); void setFirstPoint(const qint64 &value, const qint64 &id);
inline qint64 getSecondPoint() const {return secondPoint;}
qint64 getSecondPoint() const;
void setSecondPoint(const qint64 &value, const qint64 &id); void setSecondPoint(const qint64 &value, const qint64 &id);
public slots: public slots:
virtual void ChoosedObject(qint64 id, Scene::Scenes type); virtual void ChoosedObject(qint64 id, Scene::Scenes type);
virtual void DialogAccepted(); virtual void DialogAccepted();

View File

@ -24,13 +24,50 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="labelEditFormula">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred"> <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text"> <property name="text">
<string>Radius</string> <string>Radius</string>
</property> </property>
@ -44,10 +81,16 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="toolTip">
<string>Formula calculation of radius of arc</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QToolButton" name="toolButtonEqual"> <widget class="QToolButton" name="toolButtonEqual">
<property name="toolTip">
<string>Calculate formula</string>
</property>
<property name="text"> <property name="text">
<string>...</string> <string>...</string>
</property> </property>
@ -77,6 +120,9 @@
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="toolTip">
<string>Value of radius</string>
</property>
<property name="text"> <property name="text">
<string>_</string> <string>_</string>
</property> </property>
@ -91,13 +137,50 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_5"> <layout class="QHBoxLayout" name="horizontalLayout_5">
<item> <item>
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="labelEditNamePoint">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text"> <property name="text">
<string>Name new point</string> <string>Name new point</string>
</property> </property>
@ -108,6 +191,9 @@
</item> </item>
<item> <item>
<widget class="QToolButton" name="toolButtonPutHere"> <widget class="QToolButton" name="toolButtonPutHere">
<property name="toolTip">
<string>Put variable into formula</string>
</property>
<property name="text"> <property name="text">
<string>...</string> <string>...</string>
</property> </property>
@ -154,6 +240,9 @@
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="toolTip">
<string>Slect point of center of arc</string>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>
@ -270,7 +359,7 @@
<item> <item>
<widget class="QRadioButton" name="radioButtonLengthArc"> <widget class="QRadioButton" name="radioButtonLengthArc">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>true</bool>
</property> </property>
<property name="text"> <property name="text">
<string>Length of arcs</string> <string>Length of arcs</string>
@ -280,7 +369,7 @@
<item> <item>
<widget class="QRadioButton" name="radioButtonLengthSpline"> <widget class="QRadioButton" name="radioButtonLengthSpline">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>true</bool>
</property> </property>
<property name="text"> <property name="text">
<string>Length of curves</string> <string>Length of curves</string>
@ -292,7 +381,11 @@
</layout> </layout>
</item> </item>
<item> <item>
<widget class="QListWidget" name="listWidget"/> <widget class="QListWidget" name="listWidget">
<property name="toolTip">
<string>Variables. Click twice to select.</string>
</property>
</widget>
</item> </item>
</layout> </layout>
</item> </item>
@ -315,6 +408,23 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<tabstops>
<tabstop>lineEditFormula</tabstop>
<tabstop>lineEditNamePoint</tabstop>
<tabstop>comboBoxCenter</tabstop>
<tabstop>comboBoxFirstPoint</tabstop>
<tabstop>comboBoxSecondPoint</tabstop>
<tabstop>radioButtonSizeGrowth</tabstop>
<tabstop>radioButtonStandartTable</tabstop>
<tabstop>radioButtonIncrements</tabstop>
<tabstop>radioButtonLengthLine</tabstop>
<tabstop>radioButtonLengthArc</tabstop>
<tabstop>radioButtonLengthSpline</tabstop>
<tabstop>listWidget</tabstop>
<tabstop>toolButtonPutHere</tabstop>
<tabstop>toolButtonEqual</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources> <resources>
<include location="../icon.qrc"/> <include location="../icon.qrc"/>
</resources> </resources>

View File

@ -0,0 +1,86 @@
#include "dialogpointofintersection.h"
#include "ui_dialogpointofintersection.h"
DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, Draw::Draws mode, QWidget *parent) :
DialogTool(data, mode, parent), ui(new Ui::DialogPointOfIntersection), number(0), pointName(QString()),
firstPointId(0), secondPointId(0){
ui->setupUi(this);
labelEditNamePoint = ui->labelEditNamePoint;
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogPointOfIntersection::DialogAccepted);
flagName = false;
CheckState();
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
connect(bCansel, &QPushButton::clicked, this, &DialogPointOfIntersection::DialogRejected);
FillComboBoxPoints(ui->comboBoxFirstPoint);
FillComboBoxPoints(ui->comboBoxSecondPoint);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogPointOfIntersection::NamePointChanged);
}
DialogPointOfIntersection::~DialogPointOfIntersection(){
delete ui;
}
void DialogPointOfIntersection::setSecondPointId(const qint64 &value, const qint64 &id){
secondPointId = value;
setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id);
}
void DialogPointOfIntersection::ChoosedObject(qint64 id, Scene::Scenes type){
if(idDetail == 0 && mode == Draw::Modeling){
if(type == Scene::Detail){
idDetail = id;
return;
}
}
if(mode == Draw::Modeling){
if(!CheckObject(id)){
return;
}
}
if(type == Scene::Point){
VPointF point;
if(mode == Draw::Calculation){
point = data->GetPoint(id);
} else {
point = data->GetModelingPoint(id);
}
if(number == 0){
qint32 index = ui->comboBoxFirstPoint->findText(point.name());
if ( index != -1 ) { // -1 for not found
ui->comboBoxFirstPoint->setCurrentIndex(index);
number++;
emit ToolTip(tr("Select point horizontally"));
return;
}
}
if(number == 1){
qint32 index = ui->comboBoxSecondPoint->findText(point.name());
if ( index != -1 ) { // -1 for not found
ui->comboBoxSecondPoint->setCurrentIndex(index);
number = 0;
emit ToolTip("");
}
if(!isInitialized){
this->show();
}
}
}
}
void DialogPointOfIntersection::DialogAccepted(){
pointName = ui->lineEditNamePoint->text();
firstPointId = getCurrentPointId(ui->comboBoxFirstPoint);
secondPointId = getCurrentPointId(ui->comboBoxSecondPoint);
emit DialogClosed(QDialog::Accepted);
}
void DialogPointOfIntersection::setFirstPointId(const qint64 &value, const qint64 &id){
firstPointId = value;
setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id);
}
void DialogPointOfIntersection::setPointName(const QString &value){
pointName = value;
ui->lineEditNamePoint->setText(pointName);
}

View File

@ -0,0 +1,34 @@
#ifndef DIALOGPOINTOFINTERSECTION_H
#define DIALOGPOINTOFINTERSECTION_H
#include "dialogtool.h"
namespace Ui {
class DialogPointOfIntersection;
}
class DialogPointOfIntersection : public DialogTool{
Q_OBJECT
public:
DialogPointOfIntersection(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0);
~DialogPointOfIntersection();
inline QString getPointName() const {return pointName;}
void setPointName(const QString &value);
inline qint64 getFirstPointId() const {return firstPointId;}
void setFirstPointId(const qint64 &value, const qint64 &id);
inline qint64 getSecondPointId() const {return secondPointId;}
void setSecondPointId(const qint64 &value, const qint64 &id);
public slots:
virtual void ChoosedObject(qint64 id, Scene::Scenes type);
virtual void DialogAccepted();
private:
Q_DISABLE_COPY(DialogPointOfIntersection)
Ui::DialogPointOfIntersection *ui;
qint32 number;
QString pointName;
qint64 firstPointId;
qint64 secondPointId;
};
#endif // DIALOGPOINTOFINTERSECTION_H

View File

@ -0,0 +1,169 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DialogPointOfIntersection</class>
<widget class="QDialog" name="DialogPointOfIntersection">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>293</width>
<height>180</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="labelEditNamePoint">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>Name new point</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditNamePoint"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Point vertically</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxFirstPoint">
<property name="toolTip">
<string>First point of angle</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Point horizontally</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxSecondPoint">
<property name="toolTip">
<string>Second point of angle</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>DialogPointOfIntersection</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>DialogPointOfIntersection</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -37,5 +37,6 @@
#include "dialogsinglepoint.h" #include "dialogsinglepoint.h"
#include "dialogspline.h" #include "dialogspline.h"
#include "dialogsplinepath.h" #include "dialogsplinepath.h"
#include "dialogheight.h"
#endif // DIALOGS_H #endif // DIALOGS_H

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -34,7 +34,11 @@ DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, Draw::Draws mod
radioButtonStandartTable = ui->radioButtonStandartTable; radioButtonStandartTable = ui->radioButtonStandartTable;
radioButtonIncrements = ui->radioButtonIncrements; radioButtonIncrements = ui->radioButtonIncrements;
radioButtonLengthLine = ui->radioButtonLengthLine; radioButtonLengthLine = ui->radioButtonLengthLine;
radioButtonLengthArc = ui->radioButtonLengthArc;
radioButtonLengthCurve = ui->radioButtonLengthSpline;
lineEditFormula = ui->lineEditFormula; lineEditFormula = ui->lineEditFormula;
labelEditFormula = ui->labelEditFormula;
labelEditNamePoint = ui->labelEditNamePoint;
flagFormula = false; flagFormula = false;
bOk = ui->buttonBox->button(QDialogButtonBox::Ok); bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogShoulderPoint::DialogAccepted); connect(bOk, &QPushButton::clicked, this, &DialogShoulderPoint::DialogAccepted);
@ -56,13 +60,14 @@ DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, Draw::Draws mod
connect(ui->radioButtonStandartTable, &QRadioButton::clicked, this, &DialogShoulderPoint::StandartTable); connect(ui->radioButtonStandartTable, &QRadioButton::clicked, this, &DialogShoulderPoint::StandartTable);
connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogShoulderPoint::Increments); connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogShoulderPoint::Increments);
connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogShoulderPoint::LengthLines); connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogShoulderPoint::LengthLines);
connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogShoulderPoint::LengthArcs);
connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogShoulderPoint::LengthCurves);
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogShoulderPoint::EvalFormula); connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogShoulderPoint::EvalFormula);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogShoulderPoint::NamePointChanged); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogShoulderPoint::NamePointChanged);
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogShoulderPoint::FormulaChanged); connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogShoulderPoint::FormulaChanged);
} }
DialogShoulderPoint::~DialogShoulderPoint() DialogShoulderPoint::~DialogShoulderPoint(){
{
delete ui; delete ui;
} }
@ -90,6 +95,7 @@ void DialogShoulderPoint::ChoosedObject(qint64 id, Scene::Scenes type){
if ( index != -1 ) { // -1 for not found if ( index != -1 ) { // -1 for not found
ui->comboBoxP1Line->setCurrentIndex(index); ui->comboBoxP1Line->setCurrentIndex(index);
number++; number++;
emit ToolTip(tr("Select second point of line"));
return; return;
} }
} }
@ -98,6 +104,7 @@ void DialogShoulderPoint::ChoosedObject(qint64 id, Scene::Scenes type){
if ( index != -1 ) { // -1 for not found if ( index != -1 ) { // -1 for not found
ui->comboBoxP2Line->setCurrentIndex(index); ui->comboBoxP2Line->setCurrentIndex(index);
number++; number++;
emit ToolTip(tr("Select point of shoulder"));
return; return;
} }
} }
@ -106,6 +113,7 @@ void DialogShoulderPoint::ChoosedObject(qint64 id, Scene::Scenes type){
if ( index != -1 ) { // -1 for not found if ( index != -1 ) { // -1 for not found
ui->comboBoxPShoulder->setCurrentIndex(index); ui->comboBoxPShoulder->setCurrentIndex(index);
number = 0; number = 0;
emit ToolTip("");
} }
if(!isInitialized){ if(!isInitialized){
this->show(); this->show();
@ -124,52 +132,28 @@ void DialogShoulderPoint::DialogAccepted(){
emit DialogClosed(QDialog::Accepted); emit DialogClosed(QDialog::Accepted);
} }
qint64 DialogShoulderPoint::getPShoulder() const{
return pShoulder;
}
void DialogShoulderPoint::setPShoulder(const qint64 &value, const qint64 &id){ void DialogShoulderPoint::setPShoulder(const qint64 &value, const qint64 &id){
setCurrentPointId(ui->comboBoxPShoulder, pShoulder, value, id); setCurrentPointId(ui->comboBoxPShoulder, pShoulder, value, id);
} }
qint64 DialogShoulderPoint::getP2Line() const{
return p2Line;
}
void DialogShoulderPoint::setP2Line(const qint64 &value, const qint64 &id){ void DialogShoulderPoint::setP2Line(const qint64 &value, const qint64 &id){
setCurrentPointId(ui->comboBoxP2Line, p2Line, value, id); setCurrentPointId(ui->comboBoxP2Line, p2Line, value, id);
} }
qint64 DialogShoulderPoint::getP1Line() const{
return p1Line;
}
void DialogShoulderPoint::setP1Line(const qint64 &value, const qint64 &id){ void DialogShoulderPoint::setP1Line(const qint64 &value, const qint64 &id){
setCurrentPointId(ui->comboBoxP1Line, p1Line, value, id); setCurrentPointId(ui->comboBoxP1Line, p1Line, value, id);
} }
QString DialogShoulderPoint::getFormula() const{
return formula;
}
void DialogShoulderPoint::setFormula(const QString &value){ void DialogShoulderPoint::setFormula(const QString &value){
formula = value; formula = value;
ui->lineEditFormula->setText(formula); ui->lineEditFormula->setText(formula);
} }
QString DialogShoulderPoint::getTypeLine() const{
return typeLine;
}
void DialogShoulderPoint::setTypeLine(const QString &value){ void DialogShoulderPoint::setTypeLine(const QString &value){
typeLine = value; typeLine = value;
SetupTypeLine(ui->comboBoxLineType, value); SetupTypeLine(ui->comboBoxLineType, value);
} }
QString DialogShoulderPoint::getPointName() const{
return pointName;
}
void DialogShoulderPoint::setPointName(const QString &value){ void DialogShoulderPoint::setPointName(const QString &value){
pointName = value; pointName = value;
ui->lineEditNamePoint->setText(pointName); ui->lineEditNamePoint->setText(pointName);

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -23,30 +23,28 @@
#define DIALOGSHOULDERPOINT_H #define DIALOGSHOULDERPOINT_H
#include "dialogtool.h" #include "dialogtool.h"
#include "container/calculator.h"
namespace Ui { namespace Ui {
class DialogShoulderPoint; class DialogShoulderPoint;
} }
class DialogShoulderPoint : public DialogTool class DialogShoulderPoint : public DialogTool{
{
Q_OBJECT Q_OBJECT
public: public:
explicit DialogShoulderPoint(const VContainer *data, Draw::Draws mode = Draw::Calculation, DialogShoulderPoint(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0); QWidget *parent = 0);
~DialogShoulderPoint(); ~DialogShoulderPoint();
QString getPointName() const; inline QString getPointName() const {return pointName;}
void setPointName(const QString &value); void setPointName(const QString &value);
QString getTypeLine() const; inline QString getTypeLine() const {return typeLine;}
void setTypeLine(const QString &value); void setTypeLine(const QString &value);
QString getFormula() const; inline QString getFormula() const {return formula;}
void setFormula(const QString &value); void setFormula(const QString &value);
qint64 getP1Line() const; inline qint64 getP1Line() const {return p1Line;}
void setP1Line(const qint64 &value, const qint64 &id); void setP1Line(const qint64 &value, const qint64 &id);
qint64 getP2Line() const; inline qint64 getP2Line() const {return p2Line;}
void setP2Line(const qint64 &value, const qint64 &id); void setP2Line(const qint64 &value, const qint64 &id);
qint64 getPShoulder() const; inline qint64 getPShoulder() const {return pShoulder;}
void setPShoulder(const qint64 &value, const qint64 &id); void setPShoulder(const qint64 &value, const qint64 &id);
public slots: public slots:
virtual void ChoosedObject(qint64 id, Scene::Scenes type); virtual void ChoosedObject(qint64 id, Scene::Scenes type);

View File

@ -24,13 +24,50 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="labelEditFormula">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred"> <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text"> <property name="text">
<string>Length</string> <string>Length</string>
</property> </property>
@ -44,10 +81,16 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="toolTip">
<string>Formula calculation of length of line</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QToolButton" name="toolButtonEqual"> <widget class="QToolButton" name="toolButtonEqual">
<property name="toolTip">
<string>Calculate formula</string>
</property>
<property name="text"> <property name="text">
<string>...</string> <string>...</string>
</property> </property>
@ -77,6 +120,9 @@
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="toolTip">
<string>Value of length</string>
</property>
<property name="text"> <property name="text">
<string>_</string> <string>_</string>
</property> </property>
@ -91,13 +137,50 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_5"> <layout class="QHBoxLayout" name="horizontalLayout_5">
<item> <item>
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="labelEditNamePoint">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text"> <property name="text">
<string>Name new point</string> <string>Name new point</string>
</property> </property>
@ -108,6 +191,9 @@
</item> </item>
<item> <item>
<widget class="QToolButton" name="toolButtonPutHere"> <widget class="QToolButton" name="toolButtonPutHere">
<property name="toolTip">
<string>Put variable into formula</string>
</property>
<property name="text"> <property name="text">
<string>...</string> <string>...</string>
</property> </property>
@ -240,7 +326,11 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="comboBoxLineType"/> <widget class="QComboBox" name="comboBoxLineType">
<property name="toolTip">
<string>Show line from first point to our point</string>
</property>
</widget>
</item> </item>
</layout> </layout>
</item> </item>
@ -290,7 +380,7 @@
<item> <item>
<widget class="QRadioButton" name="radioButtonLengthArc"> <widget class="QRadioButton" name="radioButtonLengthArc">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>true</bool>
</property> </property>
<property name="text"> <property name="text">
<string>Length of lines</string> <string>Length of lines</string>
@ -300,7 +390,7 @@
<item> <item>
<widget class="QRadioButton" name="radioButtonLengthSpline"> <widget class="QRadioButton" name="radioButtonLengthSpline">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>true</bool>
</property> </property>
<property name="text"> <property name="text">
<string>Length of curves</string> <string>Length of curves</string>
@ -312,7 +402,11 @@
</layout> </layout>
</item> </item>
<item> <item>
<widget class="QListWidget" name="listWidget"/> <widget class="QListWidget" name="listWidget">
<property name="toolTip">
<string>Variables. Click twice to select.</string>
</property>
</widget>
</item> </item>
</layout> </layout>
</item> </item>
@ -335,6 +429,24 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<tabstops>
<tabstop>lineEditFormula</tabstop>
<tabstop>lineEditNamePoint</tabstop>
<tabstop>comboBoxP1Line</tabstop>
<tabstop>comboBoxP2Line</tabstop>
<tabstop>comboBoxPShoulder</tabstop>
<tabstop>comboBoxLineType</tabstop>
<tabstop>radioButtonSizeGrowth</tabstop>
<tabstop>radioButtonStandartTable</tabstop>
<tabstop>radioButtonIncrements</tabstop>
<tabstop>radioButtonLengthLine</tabstop>
<tabstop>radioButtonLengthArc</tabstop>
<tabstop>radioButtonLengthSpline</tabstop>
<tabstop>listWidget</tabstop>
<tabstop>toolButtonPutHere</tabstop>
<tabstop>toolButtonEqual</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources> <resources>
<include location="../icon.qrc"/> <include location="../icon.qrc"/>
</resources> </resources>

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -21,18 +21,15 @@
#include "dialogsinglepoint.h" #include "dialogsinglepoint.h"
#include "ui_dialogsinglepoint.h" #include "ui_dialogsinglepoint.h"
#include <QShowEvent>
#include <QPushButton>
#include <QDebug>
#include "options.h"
DialogSinglePoint::DialogSinglePoint(const VContainer *data, QWidget *parent) : DialogSinglePoint::DialogSinglePoint(const VContainer *data, QWidget *parent) :
DialogTool(data, Draw::Calculation, parent), ui(new Ui::DialogSinglePoint), name(QString()), DialogTool(data, Draw::Calculation, parent), ui(new Ui::DialogSinglePoint), name(QString()),
point(QPointF()){ point(QPointF()){
ui->setupUi(this); ui->setupUi(this);
ui->doubleSpinBoxX->setRange(0,PaperSize/PrintDPI*25.4); ui->doubleSpinBoxX->setRange(0,toMM(PaperSize));
ui->doubleSpinBoxY->setRange(0,PaperSize/PrintDPI*25.4); ui->doubleSpinBoxY->setRange(0,toMM(PaperSize));
bOk = ui->buttonBox->button(QDialogButtonBox::Ok); bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
labelEditNamePoint = ui->labelEditName;
flagName = false; flagName = false;
CheckState(); CheckState();
connect(bOk, &QPushButton::clicked, this, &DialogSinglePoint::DialogAccepted); connect(bOk, &QPushButton::clicked, this, &DialogSinglePoint::DialogAccepted);
@ -43,18 +40,17 @@ DialogSinglePoint::DialogSinglePoint(const VContainer *data, QWidget *parent) :
void DialogSinglePoint::mousePress(QPointF scenePos){ void DialogSinglePoint::mousePress(QPointF scenePos){
if(isInitialized == false){ if(isInitialized == false){
ui->doubleSpinBoxX->setValue(scenePos.x()/PrintDPI*25.4); ui->doubleSpinBoxX->setValue(toMM(scenePos.x()));
ui->doubleSpinBoxY->setValue(scenePos.y()/PrintDPI*25.4); ui->doubleSpinBoxY->setValue(toMM(scenePos.y()));
this->show(); this->show();
} else { } else {
ui->doubleSpinBoxX->setValue(scenePos.x()/PrintDPI*25.4); ui->doubleSpinBoxX->setValue(toMM(scenePos.x()));
ui->doubleSpinBoxY->setValue(scenePos.y()/PrintDPI*25.4); ui->doubleSpinBoxY->setValue(toMM(scenePos.y()));
} }
} }
void DialogSinglePoint::DialogAccepted(){ void DialogSinglePoint::DialogAccepted(){
point = QPointF(ui->doubleSpinBoxX->value()*PrintDPI/25.4, point = QPointF(toPixel(ui->doubleSpinBoxX->value()), toPixel(ui->doubleSpinBoxY->value()));
ui->doubleSpinBoxY->value()*PrintDPI/25.4);
name = ui->lineEditName->text(); name = ui->lineEditName->text();
emit DialogClosed(QDialog::Accepted); emit DialogClosed(QDialog::Accepted);
} }
@ -64,16 +60,8 @@ void DialogSinglePoint::setData(const QString name, const QPointF point){
this->point = point; this->point = point;
isInitialized = true; isInitialized = true;
ui->lineEditName->setText(name); ui->lineEditName->setText(name);
ui->doubleSpinBoxX->setValue(point.x()/PrintDPI*25.4); ui->doubleSpinBoxX->setValue(toMM(point.x()));
ui->doubleSpinBoxY->setValue(point.y()/PrintDPI*25.4); ui->doubleSpinBoxY->setValue(toMM(point.y()));
}
QString DialogSinglePoint::getName()const{
return name;
}
QPointF DialogSinglePoint::getPoint()const{
return point;
} }
DialogSinglePoint::~DialogSinglePoint(){ DialogSinglePoint::~DialogSinglePoint(){

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -28,14 +28,13 @@ namespace Ui {
class DialogSinglePoint; class DialogSinglePoint;
} }
class DialogSinglePoint : public DialogTool class DialogSinglePoint : public DialogTool{
{
Q_OBJECT Q_OBJECT
public: public:
explicit DialogSinglePoint(const VContainer *data, QWidget *parent = 0); DialogSinglePoint(const VContainer *data, QWidget *parent = 0);
void setData(const QString name, const QPointF point); void setData(const QString name, const QPointF point);
QString getName()const; inline QString getName()const {return name;}
QPointF getPoint()const; inline QPointF getPoint()const {return point;}
~DialogSinglePoint(); ~DialogSinglePoint();
public slots: public slots:
void mousePress(QPointF scenePos); void mousePress(QPointF scenePos);

View File

@ -9,7 +9,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>249</width> <width>250</width>
<height>202</height> <height>202</height>
</rect> </rect>
</property> </property>
@ -35,8 +35,11 @@
<height>129</height> <height>129</height>
</rect> </rect>
</property> </property>
<property name="toolTip">
<string>Coordinates on the sheet</string>
</property>
<property name="title"> <property name="title">
<string>Координати</string> <string>Coordinates</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="1" column="1"> <item row="1" column="1">
@ -61,15 +64,52 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QLabel" name="labelName"> <widget class="QLabel" name="labelEditName">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>170</x> <x>170</x>
<y>10</y> <y>10</y>
<width>72</width> <width>81</width>
<height>17</height> <height>17</height>
</rect> </rect>
</property> </property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text"> <property name="text">
<string>Point name</string> <string>Point name</string>
</property> </property>

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -67,6 +67,7 @@ void DialogSpline::ChoosedObject(qint64 id, Scene::Scenes type){
if ( index != -1 ) { // -1 for not found if ( index != -1 ) { // -1 for not found
ui->comboBoxP1->setCurrentIndex(index); ui->comboBoxP1->setCurrentIndex(index);
number++; number++;
emit ToolTip(tr("Select last point of curve"));
return; return;
} }
} }
@ -75,6 +76,7 @@ void DialogSpline::ChoosedObject(qint64 id, Scene::Scenes type){
if ( index != -1 ) { // -1 for not found if ( index != -1 ) { // -1 for not found
ui->comboBoxP4->setCurrentIndex(index); ui->comboBoxP4->setCurrentIndex(index);
number = 0; number = 0;
emit ToolTip("");
index = ui->comboBoxP1->currentIndex(); index = ui->comboBoxP1->currentIndex();
qint64 p1Id = qvariant_cast<qint64>(ui->comboBoxP1->itemData(index)); qint64 p1Id = qvariant_cast<qint64>(ui->comboBoxP1->itemData(index));
QPointF p1; QPointF p1;
@ -107,64 +109,36 @@ void DialogSpline::DialogAccepted(){
emit DialogClosed(QDialog::Accepted); emit DialogClosed(QDialog::Accepted);
} }
qreal DialogSpline::getKCurve() const{
return kCurve;
}
void DialogSpline::setKCurve(const qreal &value){ void DialogSpline::setKCurve(const qreal &value){
kCurve = value; kCurve = value;
ui->doubleSpinBoxKcurve->setValue(value); ui->doubleSpinBoxKcurve->setValue(value);
} }
qreal DialogSpline::getKAsm2() const{
return kAsm2;
}
void DialogSpline::setKAsm2(const qreal &value){ void DialogSpline::setKAsm2(const qreal &value){
kAsm2 = value; kAsm2 = value;
ui->doubleSpinBoxKasm2->setValue(value); ui->doubleSpinBoxKasm2->setValue(value);
} }
qreal DialogSpline::getKAsm1() const{
return kAsm1;
}
void DialogSpline::setKAsm1(const qreal &value){ void DialogSpline::setKAsm1(const qreal &value){
kAsm1 = value; kAsm1 = value;
ui->doubleSpinBoxKasm1->setValue(value); ui->doubleSpinBoxKasm1->setValue(value);
} }
qreal DialogSpline::getAngle2() const{
return angle2;
}
void DialogSpline::setAngle2(const qreal &value){ void DialogSpline::setAngle2(const qreal &value){
angle2 = value; angle2 = value;
ui->spinBoxAngle2->setValue(static_cast<qint32>(value)); ui->spinBoxAngle2->setValue(static_cast<qint32>(value));
} }
qreal DialogSpline::getAngle1() const{
return angle1;
}
void DialogSpline::setAngle1(const qreal &value){ void DialogSpline::setAngle1(const qreal &value){
angle1 = value; angle1 = value;
ui->spinBoxAngle1->setValue(static_cast<qint32>(value)); ui->spinBoxAngle1->setValue(static_cast<qint32>(value));
} }
qint64 DialogSpline::getP4() const{
return p4;
}
void DialogSpline::setP4(const qint64 &value){ void DialogSpline::setP4(const qint64 &value){
p4 = value; p4 = value;
ChangeCurrentData(ui->comboBoxP4, value); ChangeCurrentData(ui->comboBoxP4, value);
} }
qint64 DialogSpline::getP1() const{
return p1;
}
void DialogSpline::setP1(const qint64 &value){ void DialogSpline::setP1(const qint64 &value){
p1 = value; p1 = value;
ChangeCurrentData(ui->comboBoxP1, value); ChangeCurrentData(ui->comboBoxP1, value);

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -28,26 +28,25 @@ namespace Ui {
class DialogSpline; class DialogSpline;
} }
class DialogSpline : public DialogTool class DialogSpline : public DialogTool{
{
Q_OBJECT Q_OBJECT
public: public:
explicit DialogSpline(const VContainer *data, Draw::Draws mode = Draw::Calculation, explicit DialogSpline(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0); QWidget *parent = 0);
~DialogSpline(); ~DialogSpline();
qint64 getP1() const; inline qint64 getP1() const {return p1;}
void setP1(const qint64 &value); void setP1(const qint64 &value);
qint64 getP4() const; inline qint64 getP4() const {return p4;}
void setP4(const qint64 &value); void setP4(const qint64 &value);
qreal getAngle1() const; inline qreal getAngle1() const {return angle1;}
void setAngle1(const qreal &value); void setAngle1(const qreal &value);
qreal getAngle2() const; inline qreal getAngle2() const {return angle2;}
void setAngle2(const qreal &value); void setAngle2(const qreal &value);
qreal getKAsm1() const; inline qreal getKAsm1() const {return kAsm1;}
void setKAsm1(const qreal &value); void setKAsm1(const qreal &value);
qreal getKAsm2() const; inline qreal getKAsm2() const {return kAsm2;}
void setKAsm2(const qreal &value); void setKAsm2(const qreal &value);
qreal getKCurve() const; inline qreal getKCurve() const {return kCurve;}
void setKCurve(const qreal &value); void setKCurve(const qreal &value);
public slots: public slots:
virtual void ChoosedObject(qint64 id, Scene::Scenes type); virtual void ChoosedObject(qint64 id, Scene::Scenes type);

View File

@ -199,6 +199,16 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<tabstops>
<tabstop>comboBoxP1</tabstop>
<tabstop>comboBoxP4</tabstop>
<tabstop>doubleSpinBoxKasm1</tabstop>
<tabstop>doubleSpinBoxKasm2</tabstop>
<tabstop>spinBoxAngle1</tabstop>
<tabstop>spinBoxAngle2</tabstop>
<tabstop>doubleSpinBoxKcurve</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources> <resources>
<include location="../icon.qrc"/> <include location="../icon.qrc"/>
</resources> </resources>

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -48,15 +48,10 @@ DialogSplinePath::DialogSplinePath(const VContainer *data, Draw::Draws mode, QWi
this, &DialogSplinePath::KAsm2Changed); this, &DialogSplinePath::KAsm2Changed);
} }
DialogSplinePath::~DialogSplinePath() DialogSplinePath::~DialogSplinePath(){
{
delete ui; delete ui;
} }
VSplinePath DialogSplinePath::GetPath() const{
return path;
}
void DialogSplinePath::SetPath(const VSplinePath &value){ void DialogSplinePath::SetPath(const VSplinePath &value){
this->path = value; this->path = value;
ui->listWidget->clear(); ui->listWidget->clear();
@ -82,6 +77,7 @@ void DialogSplinePath::ChoosedObject(qint64 id, Scene::Scenes type){
} }
if(type == Scene::Point){ if(type == Scene::Point){
NewItem(id, 1, 0, 1); NewItem(id, 1, 0, 1);
emit ToolTip(tr("Select point of curve path"));
this->show(); this->show();
} }
} }
@ -93,6 +89,7 @@ void DialogSplinePath::DialogAccepted(){
path.append( qvariant_cast<VSplinePoint>(item->data(Qt::UserRole))); path.append( qvariant_cast<VSplinePoint>(item->data(Qt::UserRole)));
} }
path.setKCurve(ui->doubleSpinBoxKcurve->value()); path.setKCurve(ui->doubleSpinBoxKcurve->value());
emit ToolTip("");
emit DialogClosed(QDialog::Accepted); emit DialogClosed(QDialog::Accepted);
} }

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -29,14 +29,13 @@ namespace Ui {
class DialogSplinePath; class DialogSplinePath;
} }
class DialogSplinePath : public DialogTool class DialogSplinePath : public DialogTool{
{
Q_OBJECT Q_OBJECT
public: public:
explicit DialogSplinePath(const VContainer *data, Draw::Draws mode = Draw::Calculation, DialogSplinePath(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0); QWidget *parent = 0);
~DialogSplinePath(); ~DialogSplinePath();
VSplinePath GetPath() const; inline VSplinePath GetPath() const {return path;}
void SetPath(const VSplinePath &value); void SetPath(const VSplinePath &value);
public slots: public slots:
virtual void ChoosedObject(qint64 id, Scene::Scenes type); virtual void ChoosedObject(qint64 id, Scene::Scenes type);

View File

@ -126,7 +126,11 @@
</layout> </layout>
</item> </item>
<item> <item>
<widget class="QListWidget" name="listWidget"/> <widget class="QListWidget" name="listWidget">
<property name="toolTip">
<string>List of points</string>
</property>
</widget>
</item> </item>
</layout> </layout>
</item> </item>
@ -184,6 +188,16 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<tabstops>
<tabstop>comboBoxPoint</tabstop>
<tabstop>doubleSpinBoxKasm1</tabstop>
<tabstop>spinBoxAngle1</tabstop>
<tabstop>doubleSpinBoxKasm2</tabstop>
<tabstop>spinBoxAngle2</tabstop>
<tabstop>doubleSpinBoxKcurve</tabstop>
<tabstop>listWidget</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources> <resources>
<include location="../icon.qrc"/> <include location="../icon.qrc"/>
</resources> </resources>

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -20,25 +20,18 @@
****************************************************************************/ ****************************************************************************/
#include "dialogtool.h" #include "dialogtool.h"
#include <QListWidgetItem> #include <container/calculator.h>
#include <QCloseEvent>
#include "container/calculator.h"
#include "geometry/vdetail.h"
#include <QDebug>
DialogTool::DialogTool(const VContainer *data, Draw::Draws mode, QWidget *parent):QDialog(parent), data(data), DialogTool::DialogTool(const VContainer *data, Draw::Draws mode, QWidget *parent):QDialog(parent), data(data),
isInitialized(false), flagName(true), flagFormula(true), timerFormula(0), bOk(0), spinBoxAngle(0), isInitialized(false), flagName(true), flagFormula(true), timerFormula(0), bOk(0), spinBoxAngle(0),
lineEditFormula(0), listWidget(0), labelResultCalculation(0), labelDescription(0), lineEditFormula(0), listWidget(0), labelResultCalculation(0), labelDescription(0), labelEditNamePoint(0),
radioButtonSizeGrowth(0), radioButtonStandartTable(0), radioButtonIncrements(0), labelEditFormula(0), radioButtonSizeGrowth(0), radioButtonStandartTable(0), radioButtonIncrements(0),
radioButtonLengthLine(0), idDetail(0), mode(mode){ radioButtonLengthLine(0), radioButtonLengthArc(0), radioButtonLengthCurve(0), idDetail(0), mode(mode){
Q_CHECK_PTR(data); Q_ASSERT(data != 0);
timerFormula = new QTimer(this); timerFormula = new QTimer(this);
connect(timerFormula, &QTimer::timeout, this, &DialogTool::EvalFormula); connect(timerFormula, &QTimer::timeout, this, &DialogTool::EvalFormula);
} }
DialogTool::~DialogTool(){
}
void DialogTool::closeEvent(QCloseEvent *event){ void DialogTool::closeEvent(QCloseEvent *event){
DialogClosed(QDialog::Rejected); DialogClosed(QDialog::Rejected);
event->accept(); event->accept();
@ -52,14 +45,14 @@ void DialogTool::showEvent(QShowEvent *event){
if(isInitialized){ if(isInitialized){
return; return;
} }
isInitialized = true;//перший показ вікна вже відбувся isInitialized = true;//first show windows are held
} }
void DialogTool::FillComboBoxPoints(QComboBox *box, const qint64 &id) const{ void DialogTool::FillComboBoxPoints(QComboBox *box, const qint64 &id) const{
box->clear(); box->clear();
if(mode == Draw::Calculation){ if(mode == Draw::Calculation){
const QMap<qint64, VPointF> *points = data->DataPoints(); const QHash<qint64, VPointF> *points = data->DataPoints();
QMapIterator<qint64, VPointF> i(*points); QHashIterator<qint64, VPointF> i(*points);
while (i.hasNext()) { while (i.hasNext()) {
i.next(); i.next();
if(i.key() != id){ if(i.key() != id){
@ -69,7 +62,7 @@ void DialogTool::FillComboBoxPoints(QComboBox *box, const qint64 &id) const{
} }
} else { } else {
if(idDetail <= 0){ if(idDetail <= 0){
qWarning()<<"Wrong details id."<<Q_FUNC_INFO; qWarning()<<tr("Wrong details id.")<<Q_FUNC_INFO;
return; return;
} }
VDetail det = data->GetDetail(idDetail); VDetail det = data->GetDetail(idDetail);
@ -92,13 +85,14 @@ void DialogTool::FillComboBoxPoints(QComboBox *box, const qint64 &id) const{
} }
void DialogTool::FillComboBoxTypeLine(QComboBox *box) const{ void DialogTool::FillComboBoxTypeLine(QComboBox *box) const{
Q_ASSERT(box != 0);
QStringList list; QStringList list;
list<<"Лінія"<<"Без лінії"; list<<tr("Line")<<tr("No line");
box->addItems(list); box->addItems(list);
} }
QString DialogTool::GetTypeLine(const QComboBox *box) const{ QString DialogTool::GetTypeLine(const QComboBox *box) const{
if(box->currentText()=="Лінія"){ if(box->currentText()==tr("Line")){
return QString("hair"); return QString("hair");
} else { } else {
return QString("none"); return QString("none");
@ -107,13 +101,13 @@ QString DialogTool::GetTypeLine(const QComboBox *box) const{
void DialogTool::SetupTypeLine(QComboBox *box, const QString &value){ void DialogTool::SetupTypeLine(QComboBox *box, const QString &value){
if(value == "hair"){ if(value == "hair"){
qint32 index = box->findText("Лінія"); qint32 index = box->findText(tr("Line"));
if(index != -1){ if(index != -1){
box->setCurrentIndex(index); box->setCurrentIndex(index);
} }
} }
if(value == "none"){ if(value == "none"){
qint32 index = box->findText("Без лінії"); qint32 index = box->findText(tr("No line"));
if(index != -1){ if(index != -1){
box->setCurrentIndex(index); box->setCurrentIndex(index);
} }
@ -124,6 +118,8 @@ void DialogTool::ChangeCurrentText(QComboBox *box, const QString &value){
qint32 index = box->findText(value); qint32 index = box->findText(value);
if(index != -1){ if(index != -1){
box->setCurrentIndex(index); box->setCurrentIndex(index);
} else {
qWarning()<<tr("Can't find point by name")<<value;
} }
} }
@ -135,56 +131,68 @@ void DialogTool::ChangeCurrentData(QComboBox *box, const qint64 &value) const{
} }
void DialogTool::PutValHere(QLineEdit *lineEdit, QListWidget *listWidget){ void DialogTool::PutValHere(QLineEdit *lineEdit, QListWidget *listWidget){
Q_CHECK_PTR(lineEdit); Q_ASSERT(lineEdit != 0);
Q_CHECK_PTR(listWidget); Q_ASSERT(listWidget != 0);
QListWidgetItem *item = listWidget->currentItem(); QListWidgetItem *item = listWidget->currentItem();
QString val = item->text(); int pos = lineEdit->cursorPosition();
lineEdit->setText(lineEdit->text().append(val)); lineEdit->setText(lineEdit->text().insert(lineEdit->cursorPosition(), item->text()));
lineEdit->setFocus();
lineEdit->setCursorPosition(pos + item->text().size());
} }
void DialogTool::ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer *timer){ void DialogTool::ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer *timer){
Q_CHECK_PTR(edit); Q_ASSERT(edit != 0);
Q_CHECK_PTR(timer); Q_ASSERT(timer != 0);
Q_ASSERT(labelEditFormula != 0);
if(edit->text().isEmpty()){ if(edit->text().isEmpty()){
flag = false; flag = false;
CheckState(); CheckState();
QPalette palette = labelEditFormula->palette();
palette.setColor(labelEditFormula->foregroundRole(), Qt::red);
labelEditFormula->setPalette(palette);
return; return;
} }
timer->start(1000); timer->start(1000);
} }
void DialogTool::Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label){ void DialogTool::Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label){
Q_CHECK_PTR(edit); Q_ASSERT(edit != 0);
Q_CHECK_PTR(timer); Q_ASSERT(timer != 0);
Q_CHECK_PTR(label); Q_ASSERT(label != 0);
Q_ASSERT(labelEditFormula != 0);
QPalette palette = labelEditFormula->palette();
if(edit->text().isEmpty()){ if(edit->text().isEmpty()){
flag = false; flag = false;
palette.setColor(labelEditFormula->foregroundRole(), Qt::red);
} else { } else {
Calculator cal(data); Calculator cal(data);
QString errorMsg; QString errorMsg;
qreal result = cal.eval(edit->text(),&errorMsg); qreal result = cal.eval(edit->text(),&errorMsg);
if(!errorMsg.isEmpty()){ if(!errorMsg.isEmpty()){
label->setText("Помилка."); label->setText(tr("Error"));
flag = false; flag = false;
palette.setColor(labelEditFormula->foregroundRole(), Qt::red);
} else { } else {
label->setText(QString().setNum(result)); label->setText(QString().setNum(result));
flag = true; flag = true;
palette.setColor(labelEditFormula->foregroundRole(), QColor(76,76,76));
} }
} }
CheckState(); CheckState();
timer->stop(); timer->stop();
labelEditFormula->setPalette(palette);
} }
void DialogTool::setCurrentPointId(QComboBox *box, qint64 &pointId, const qint64 &value, void DialogTool::setCurrentPointId(QComboBox *box, qint64 &pointId, const qint64 &value,
const qint64 &id) const{ const qint64 &id) const{
Q_CHECK_PTR(box); Q_ASSERT(box != 0);
FillComboBoxPoints(box, id); FillComboBoxPoints(box, id);
pointId = value; pointId = value;
ChangeCurrentData(box, value); ChangeCurrentData(box, value);
} }
qint64 DialogTool::getCurrentPointId(QComboBox *box) const{ qint64 DialogTool::getCurrentPointId(QComboBox *box) const{
Q_CHECK_PTR(box); Q_ASSERT(box != 0);
qint32 index = box->currentIndex(); qint32 index = box->currentIndex();
Q_ASSERT(index != -1); Q_ASSERT(index != -1);
if(index != -1){ if(index != -1){
@ -195,24 +203,30 @@ qint64 DialogTool::getCurrentPointId(QComboBox *box) const{
} }
void DialogTool::CheckState(){ void DialogTool::CheckState(){
Q_CHECK_PTR(bOk); Q_ASSERT(bOk != 0);
bOk->setEnabled(flagFormula && flagName); bOk->setEnabled(flagFormula && flagName);
} }
void DialogTool::ChoosedObject(qint64 id, Scene::Scenes type){ void DialogTool::ChoosedObject(qint64 id, Scene::Scenes type){
Q_UNUSED(id); Q_UNUSED(id);
Q_UNUSED(type); Q_UNUSED(type);
} }
void DialogTool::NamePointChanged(){ void DialogTool::NamePointChanged(){
Q_ASSERT(labelEditNamePoint != 0);
QLineEdit* edit = qobject_cast<QLineEdit*>(sender()); QLineEdit* edit = qobject_cast<QLineEdit*>(sender());
if (edit){ if (edit){
QString name = edit->text(); QString name = edit->text();
if(name.isEmpty() || name.contains(" ")){ if(name.isEmpty() || name.contains(" ")){
flagName = false; flagName = false;
QPalette palette = labelEditNamePoint->palette();
palette.setColor(labelEditNamePoint->foregroundRole(), Qt::red);
labelEditNamePoint->setPalette(palette);
} else { } else {
flagName = true; flagName = true;
QPalette palette = labelEditNamePoint->palette();
palette.setColor(labelEditNamePoint->foregroundRole(), QColor(76,76,76));
labelEditNamePoint->setPalette(palette);
} }
} }
CheckState(); CheckState();
@ -234,48 +248,48 @@ void DialogTool::FormulaChanged(){
} }
void DialogTool::ArrowUp(){ void DialogTool::ArrowUp(){
Q_CHECK_PTR(spinBoxAngle); Q_ASSERT(spinBoxAngle != 0);
spinBoxAngle->setValue(90); spinBoxAngle->setValue(90);
} }
void DialogTool::ArrowDown(){ void DialogTool::ArrowDown(){
Q_CHECK_PTR(spinBoxAngle); Q_ASSERT(spinBoxAngle != 0);
spinBoxAngle->setValue(270); spinBoxAngle->setValue(270);
} }
void DialogTool::ArrowLeft(){ void DialogTool::ArrowLeft(){
Q_CHECK_PTR(spinBoxAngle); Q_ASSERT(spinBoxAngle != 0);
spinBoxAngle->setValue(180); spinBoxAngle->setValue(180);
} }
void DialogTool::ArrowRight(){ void DialogTool::ArrowRight(){
Q_CHECK_PTR(spinBoxAngle); Q_ASSERT(spinBoxAngle != 0);
spinBoxAngle->setValue(0); spinBoxAngle->setValue(0);
} }
void DialogTool::ArrowLeftUp(){ void DialogTool::ArrowLeftUp(){
Q_CHECK_PTR(spinBoxAngle); Q_ASSERT(spinBoxAngle != 0);
spinBoxAngle->setValue(135); spinBoxAngle->setValue(135);
} }
void DialogTool::ArrowLeftDown(){ void DialogTool::ArrowLeftDown(){
Q_CHECK_PTR(spinBoxAngle); Q_ASSERT(spinBoxAngle != 0);
spinBoxAngle->setValue(225); spinBoxAngle->setValue(225);
} }
void DialogTool::ArrowRightUp(){ void DialogTool::ArrowRightUp(){
Q_CHECK_PTR(spinBoxAngle); Q_ASSERT(spinBoxAngle != 0);
spinBoxAngle->setValue(45); spinBoxAngle->setValue(45);
} }
void DialogTool::ArrowRightDown(){ void DialogTool::ArrowRightDown(){
Q_CHECK_PTR(spinBoxAngle); Q_ASSERT(spinBoxAngle != 0);
spinBoxAngle->setValue(315); spinBoxAngle->setValue(315);
} }
void DialogTool::EvalFormula(){ void DialogTool::EvalFormula(){
Q_CHECK_PTR(lineEditFormula); Q_ASSERT(lineEditFormula != 0);
Q_CHECK_PTR(labelResultCalculation); Q_ASSERT(labelResultCalculation != 0);
Eval(lineEditFormula, flagFormula, timerFormula, labelResultCalculation); Eval(lineEditFormula, flagFormula, timerFormula, labelResultCalculation);
} }
@ -291,6 +305,14 @@ void DialogTool::LengthLines(){
ShowVariable(data->DataLengthLines()); ShowVariable(data->DataLengthLines());
} }
void DialogTool::LengthArcs(){
ShowVariable(data->DataLengthArcs());
}
void DialogTool::LengthCurves(){
ShowVariable(data->DataLengthSplines());
}
void DialogTool::Increments(){ void DialogTool::Increments(){
ShowVariable(data->DataIncrementTable()); ShowVariable(data->DataIncrementTable());
} }
@ -300,29 +322,35 @@ void DialogTool::PutHere(){
} }
void DialogTool::PutVal(QListWidgetItem *item){ void DialogTool::PutVal(QListWidgetItem *item){
Q_CHECK_PTR(lineEditFormula); Q_ASSERT(lineEditFormula != 0);
QString val = item->text(); Q_ASSERT(item != 0);
lineEditFormula->setText(lineEditFormula->text().append(val)); int pos = lineEditFormula->cursorPosition();
lineEditFormula->setText(lineEditFormula->text().insert(lineEditFormula->cursorPosition(),
item->text()));
lineEditFormula->setFocus();
lineEditFormula->setCursorPosition(pos + item->text().size());
} }
void DialogTool::ValChenged(int row){ void DialogTool::ValChenged(int row){
Q_CHECK_PTR(listWidget); Q_ASSERT(listWidget != 0);
Q_CHECK_PTR(labelDescription); Q_ASSERT(labelDescription != 0);
Q_CHECK_PTR(radioButtonSizeGrowth); Q_ASSERT(radioButtonSizeGrowth != 0);
Q_CHECK_PTR(radioButtonStandartTable); Q_ASSERT(radioButtonStandartTable != 0);
Q_CHECK_PTR(radioButtonIncrements); Q_ASSERT(radioButtonIncrements != 0);
Q_CHECK_PTR(radioButtonLengthLine); Q_ASSERT(radioButtonLengthLine != 0);
Q_ASSERT(radioButtonLengthArc != 0);
Q_ASSERT(radioButtonLengthCurve != 0);
if(listWidget->count() == 0){ if(listWidget->count() == 0){
return; return;
} }
QListWidgetItem *item = listWidget->item( row ); QListWidgetItem *item = listWidget->item( row );
if(radioButtonSizeGrowth->isChecked()){ if(radioButtonSizeGrowth->isChecked()){
if(item->text()=="Р"){ if(item->text()=="Р"){
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->growth()).arg("Зріст"); QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->growth()).arg(tr("Growth"));
labelDescription->setText(desc); labelDescription->setText(desc);
} }
if(item->text()=="Сг"){ if(item->text()=="Сг"){
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->size()).arg("Розмір"); QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->size()).arg(tr("Size"));
labelDescription->setText(desc); labelDescription->setText(desc);
} }
return; return;
@ -343,16 +371,32 @@ void DialogTool::ValChenged(int row){
} }
if(radioButtonLengthLine->isChecked()){ if(radioButtonLengthLine->isChecked()){
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetLine(item->text())) QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetLine(item->text()))
.arg("Довжина лінії"); .arg(tr("Line length"));
labelDescription->setText(desc);
return;
}
if(radioButtonLengthArc->isChecked()){
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetLengthArc(item->text()))
.arg(tr("Arc length"));
labelDescription->setText(desc);
return;
}
if(radioButtonLengthCurve->isChecked()){
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetLengthSpline(item->text()))
.arg(tr("Curve length"));
labelDescription->setText(desc); labelDescription->setText(desc);
return; return;
} }
} }
void DialogTool::UpdateList(){ void DialogTool::UpdateList(){
if(radioButtonSizeGrowth == 0 || radioButtonStandartTable == 0 || radioButtonIncrements == 0){ Q_ASSERT(radioButtonSizeGrowth != 0);
return; Q_ASSERT(radioButtonStandartTable != 0);
} Q_ASSERT(radioButtonIncrements != 0);
Q_ASSERT(radioButtonLengthLine != 0);
Q_ASSERT(radioButtonLengthArc != 0);
Q_ASSERT(radioButtonLengthCurve != 0);
if(radioButtonSizeGrowth->isChecked()){ if(radioButtonSizeGrowth->isChecked()){
ShowVariable(data->DataBase()); ShowVariable(data->DataBase());
} }
@ -362,6 +406,15 @@ void DialogTool::UpdateList(){
if(radioButtonIncrements->isChecked()){ if(radioButtonIncrements->isChecked()){
ShowVariable(data->DataIncrementTable()); ShowVariable(data->DataIncrementTable());
} }
if(radioButtonLengthLine->isChecked()){
ShowVariable(data->DataLengthLines());
}
if(radioButtonLengthArc->isChecked()){
ShowVariable(data->DataLengthArcs());
}
if(radioButtonLengthCurve->isChecked()){
ShowVariable(data->DataLengthSplines());
}
} }
bool DialogTool::CheckObject(const qint64 &id){ bool DialogTool::CheckObject(const qint64 &id){
@ -373,25 +426,25 @@ bool DialogTool::CheckObject(const qint64 &id){
} }
template <class key, class val> template <class key, class val>
void DialogTool::ShowVariable(const QMap<key, val> *var){ void DialogTool::ShowVariable(const QHash<key, val> *var){
Q_CHECK_PTR(listWidget); Q_ASSERT(listWidget != 0);
disconnect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged); disconnect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged);
listWidget->clear(); listWidget->clear();
connect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged);
QMapIterator<key, val> i(*var); QHashIterator<key, val> i(*var);
QMap<key, val> map;
while (i.hasNext()) { while (i.hasNext()) {
i.next(); i.next();
QListWidgetItem *item = new QListWidgetItem(i.key()); map.insert(i.key(), i.value());
}
QMapIterator<key, val> iMap(map);
while (iMap.hasNext()) {
iMap.next();
QListWidgetItem *item = new QListWidgetItem(iMap.key());
item->setFont(QFont("Times", 12, QFont::Bold)); item->setFont(QFont("Times", 12, QFont::Bold));
listWidget->addItem(item); listWidget->addItem(item);
} }
connect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged);
listWidget->setCurrentRow (0); listWidget->setCurrentRow (0);
} }
qint64 DialogTool::getIdDetail() const{
return idDetail;
}
void DialogTool::setIdDetail(const qint64 &value){
idDetail = value;
}

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -23,26 +23,19 @@
#define DIALOGTOOL_H #define DIALOGTOOL_H
#include <QDialog> #include <QDialog>
#include <QComboBox> #include <container/vcontainer.h>
#include <QDoubleSpinBox>
#include <QPushButton>
#include <QLineEdit>
#include <QListWidget>
#include <QLabel>
#include <QRadioButton>
#include <QTimer>
#include "container/vcontainer.h"
class DialogTool : public QDialog{ class DialogTool : public QDialog{
Q_OBJECT Q_OBJECT
public: public:
DialogTool(const VContainer *data, Draw::Draws mode = Draw::Calculation, DialogTool(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0); QWidget *parent = 0);
virtual ~DialogTool(); virtual ~DialogTool() {}
qint64 getIdDetail() const; inline qint64 getIdDetail() const {return idDetail;}
void setIdDetail(const qint64 &value); inline void setIdDetail(const qint64 &value) {idDetail = value;}
signals: signals:
void DialogClosed(int result); void DialogClosed(int result);
void ToolTip(const QString &toolTip);
public slots: public slots:
virtual void ChoosedObject(qint64 id, Scene::Scenes type); virtual void ChoosedObject(qint64 id, Scene::Scenes type);
void NamePointChanged(); void NamePointChanged();
@ -61,6 +54,8 @@ public slots:
void SizeGrowth(); void SizeGrowth();
void StandartTable(); void StandartTable();
void LengthLines(); void LengthLines();
void LengthArcs();
void LengthCurves();
void Increments(); void Increments();
void PutHere(); void PutHere();
void PutVal(QListWidgetItem * item); void PutVal(QListWidgetItem * item);
@ -79,10 +74,14 @@ protected:
QListWidget *listWidget; QListWidget *listWidget;
QLabel *labelResultCalculation; QLabel *labelResultCalculation;
QLabel *labelDescription; QLabel *labelDescription;
QLabel *labelEditNamePoint;
QLabel *labelEditFormula;
QRadioButton *radioButtonSizeGrowth; QRadioButton *radioButtonSizeGrowth;
QRadioButton *radioButtonStandartTable; QRadioButton *radioButtonStandartTable;
QRadioButton *radioButtonIncrements; QRadioButton *radioButtonIncrements;
QRadioButton *radioButtonLengthLine; QRadioButton *radioButtonLengthLine;
QRadioButton *radioButtonLengthArc;
QRadioButton *radioButtonLengthCurve;
qint64 idDetail; qint64 idDetail;
Draw::Draws mode; Draw::Draws mode;
bool CheckObject(const qint64 &id); bool CheckObject(const qint64 &id);
@ -92,7 +91,7 @@ protected:
void FillComboBoxTypeLine(QComboBox *box) const; void FillComboBoxTypeLine(QComboBox *box) const;
virtual void CheckState(); virtual void CheckState();
QString GetTypeLine(const QComboBox *box)const; QString GetTypeLine(const QComboBox *box)const;
template <class key, class val> void ShowVariable(const QMap<key, val> *var); template <class key, class val> void ShowVariable(const QHash<key, val> *var);
void SetupTypeLine(QComboBox *box, const QString &value); void SetupTypeLine(QComboBox *box, const QString &value);
void ChangeCurrentText(QComboBox *box, const QString &value); void ChangeCurrentText(QComboBox *box, const QString &value);
void ChangeCurrentData(QComboBox *box, const qint64 &value) const; void ChangeCurrentData(QComboBox *box, const qint64 &value) const;

106
dialogs/dialogtriangle.cpp Normal file
View File

@ -0,0 +1,106 @@
#include "dialogtriangle.h"
#include "ui_dialogtriangle.h"
DialogTriangle::DialogTriangle(const VContainer *data, Draw::Draws mode, QWidget *parent) :
DialogTool(data, mode, parent), ui(new Ui::DialogTriangle), number(0), pointName(QString()), axisP1Id(0),
axisP2Id(0), firstPointId(0), secondPointId(0){
ui->setupUi(this);
labelEditNamePoint = ui->labelEditNamePoint;
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogTriangle::DialogAccepted);
flagName = false;
CheckState();
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
connect(bCansel, &QPushButton::clicked, this, &DialogTriangle::DialogRejected);
FillComboBoxPoints(ui->comboBoxAxisP1);
FillComboBoxPoints(ui->comboBoxAxisP2);
FillComboBoxPoints(ui->comboBoxFirstPoint);
FillComboBoxPoints(ui->comboBoxSecondPoint);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogTriangle::NamePointChanged);
}
DialogTriangle::~DialogTriangle(){
delete ui;
}
void DialogTriangle::ChoosedObject(qint64 id, Scene::Scenes type){
if(idDetail == 0 && mode == Draw::Modeling){
if(type == Scene::Detail){
idDetail = id;
return;
}
}
if(mode == Draw::Modeling){
if(!CheckObject(id)){
return;
}
}
if(type == Scene::Point){
VPointF point;
if(mode == Draw::Calculation){
point = data->GetPoint(id);
} else {
point = data->GetModelingPoint(id);
}
switch(number){
case(0):
ChangeCurrentText(ui->comboBoxAxisP1, point.name());
number++;
emit ToolTip(tr("Select second point of axis"));
break;
case(1):
ChangeCurrentText(ui->comboBoxAxisP2, point.name());
number++;
emit ToolTip(tr("Select first point"));
break;
case(2):
ChangeCurrentText(ui->comboBoxFirstPoint, point.name());
number++;
emit ToolTip(tr("Select second point"));
break;
case(3):
ChangeCurrentText(ui->comboBoxSecondPoint, point.name());
number = 0;
emit ToolTip(tr(""));
if(!isInitialized){
this->show();
}
break;
}
}
}
void DialogTriangle::DialogAccepted(){
pointName = ui->lineEditNamePoint->text();
firstPointId = getCurrentPointId(ui->comboBoxFirstPoint);
secondPointId = getCurrentPointId(ui->comboBoxSecondPoint);
axisP1Id = getCurrentPointId(ui->comboBoxAxisP1);
axisP2Id = getCurrentPointId(ui->comboBoxAxisP2);
emit DialogClosed(QDialog::Accepted);
}
void DialogTriangle::setPointName(const QString &value){
pointName = value;
ui->lineEditNamePoint->setText(pointName);
}
void DialogTriangle::setSecondPointId(const qint64 &value, const qint64 &id){
secondPointId = value;
setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id);
}
void DialogTriangle::setFirstPointId(const qint64 &value, const qint64 &id){
firstPointId = value;
setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id);
}
void DialogTriangle::setAxisP2Id(const qint64 &value, const qint64 &id){
axisP2Id = value;
setCurrentPointId(ui->comboBoxAxisP2, axisP2Id, value, id);
}
void DialogTriangle::setAxisP1Id(const qint64 &value, const qint64 &id){
axisP1Id = value;
setCurrentPointId(ui->comboBoxAxisP1, axisP1Id, value, id);
}

61
dialogs/dialogtriangle.h Normal file
View File

@ -0,0 +1,61 @@
/****************************************************************************
**
** Copyright (C) 2013 Valentina project All Rights Reserved.
**
** This file is part of Valentina.
**
** Tox 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 <http://www.gnu.org/licenses/>.
**
****************************************************************************/
#ifndef DIALOGTRIANGLE_H
#define DIALOGTRIANGLE_H
#include "dialogtool.h"
namespace Ui {
class DialogTriangle;
}
class DialogTriangle : public DialogTool{
Q_OBJECT
public:
DialogTriangle(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0);
~DialogTriangle();
inline qint64 getAxisP1Id() const {return axisP1Id;}
void setAxisP1Id(const qint64 &value, const qint64 &id);
inline qint64 getAxisP2Id() const {return axisP2Id;}
void setAxisP2Id(const qint64 &value, const qint64 &id);
inline qint64 getFirstPointId() const {return firstPointId;}
void setFirstPointId(const qint64 &value, const qint64 &id);
inline qint64 getSecondPointId() const {return secondPointId;}
void setSecondPointId(const qint64 &value, const qint64 &id);
inline QString getPointName() const {return pointName;}
void setPointName(const QString &value);
public slots:
virtual void ChoosedObject(qint64 id, Scene::Scenes type);
virtual void DialogAccepted();
private:
Q_DISABLE_COPY(DialogTriangle)
Ui::DialogTriangle *ui;
qint32 number;
QString pointName;
qint64 axisP1Id;
qint64 axisP2Id;
qint64 firstPointId;
qint64 secondPointId;
};
#endif // DIALOGTRIANGLE_H

196
dialogs/dialogtriangle.ui Normal file
View File

@ -0,0 +1,196 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DialogTriangle</class>
<widget class="QDialog" name="DialogTriangle">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>267</width>
<height>220</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="labelEditNamePoint">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>Name new point</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditNamePoint"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>First point of axis</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxAxisP1">
<property name="toolTip">
<string>First point of line</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Second point of axis</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxAxisP2">
<property name="toolTip">
<string>First point of line</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>First point</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxFirstPoint">
<property name="toolTip">
<string>First point of line</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>Second point</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxSecondPoint">
<property name="toolTip">
<string>First point of line</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>DialogTriangle</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>DialogTriangle</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -25,9 +25,6 @@ VException::VException(const QString &what):QException(), what(what){
Q_ASSERT_X(!what.isEmpty(), Q_FUNC_INFO, "Error message is empty"); Q_ASSERT_X(!what.isEmpty(), Q_FUNC_INFO, "Error message is empty");
} }
VException::VException(const VException &e):what(e.What()){
}
QString VException::ErrorMessage() const{ QString VException::ErrorMessage() const{
QString error = QString("Exception: %1").arg(what); QString error = QString("Exception: %1").arg(what);
return error; return error;

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -24,19 +24,17 @@
#define VEXCEPTION_H #define VEXCEPTION_H
#include <QException> #include <QException>
#include <QString>
class VException : public QException class VException : public QException{
{
public: public:
VException(const QString &what); VException(const QString &what);
VException(const VException &e); VException(const VException &e):what(e.What()){}
virtual ~VException() noexcept(true){} virtual ~VException() noexcept(true){}
void raise() const { throw *this; } inline void raise() const { throw *this; }
VException *clone() const { return new VException(*this); } inline VException *clone() const { return new VException(*this); }
virtual QString ErrorMessage() const; virtual QString ErrorMessage() const;
virtual QString DetailedInformation() const { return QString(); } virtual QString DetailedInformation() const { return QString(); }
QString What() const {return what;} inline QString What() const {return what;}
protected: protected:
QString what; QString what;
}; };

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -21,17 +21,6 @@
#include "vexceptionbadid.h" #include "vexceptionbadid.h"
VExceptionBadId::VExceptionBadId(const QString &what, const qint64 &id):VException(what), id(id),
key(QString()){
}
VExceptionBadId::VExceptionBadId(const QString &what, const QString &key):VException(what), id(0), key(key)
{
}
VExceptionBadId::VExceptionBadId(const VExceptionBadId &e):VException(e), id(e.BadId()), key(e.BadKey()){
}
QString VExceptionBadId::ErrorMessage() const{ QString VExceptionBadId::ErrorMessage() const{
QString error; QString error;
if(key.isEmpty()){ if(key.isEmpty()){

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -24,16 +24,16 @@
#include "vexception.h" #include "vexception.h"
class VExceptionBadId : public VException class VExceptionBadId : public VException{
{
public: public:
VExceptionBadId(const QString &what, const qint64 &id); VExceptionBadId(const QString &what, const qint64 &id):VException(what), id(id),
VExceptionBadId(const QString &what, const QString &key); key(QString()){}
VExceptionBadId(const VExceptionBadId &e); VExceptionBadId(const QString &what, const QString &key):VException(what), id(0), key(key){}
VExceptionBadId(const VExceptionBadId &e):VException(e), id(e.BadId()), key(e.BadKey()){}
virtual ~VExceptionBadId() noexcept(true){} virtual ~VExceptionBadId() noexcept(true){}
virtual QString ErrorMessage() const; virtual QString ErrorMessage() const;
qint64 BadId() const {return id; } inline qint64 BadId() const {return id; }
QString BadKey() const {return key; } inline QString BadKey() const {return key; }
protected: protected:
qint64 id; qint64 id;
QString key; QString key;

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -26,10 +26,6 @@ VExceptionConversionError::VExceptionConversionError(const QString &what, const
Q_ASSERT_X(!str.isEmpty(), Q_FUNC_INFO, "Error converting string is empty"); Q_ASSERT_X(!str.isEmpty(), Q_FUNC_INFO, "Error converting string is empty");
} }
VExceptionConversionError::VExceptionConversionError(const VExceptionConversionError &e):
VException(e), str(e.String()){
}
QString VExceptionConversionError::ErrorMessage() const{ QString VExceptionConversionError::ErrorMessage() const{
QString error = QString("ExceptionConversionError: %1 %2").arg(what, str); QString error = QString("ExceptionConversionError: %1 %2").arg(what, str);
return error; return error;

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -24,14 +24,13 @@
#include "vexception.h" #include "vexception.h"
class VExceptionConversionError : public VException class VExceptionConversionError : public VException{
{
public: public:
VExceptionConversionError(const QString &what, const QString &str); VExceptionConversionError(const QString &what, const QString &str);
VExceptionConversionError(const VExceptionConversionError &e); VExceptionConversionError(const VExceptionConversionError &e):VException(e), str(e.String()){}
virtual ~VExceptionConversionError() noexcept(true) {} virtual ~VExceptionConversionError() noexcept(true) {}
virtual QString ErrorMessage() const; virtual QString ErrorMessage() const;
QString String() const {return str;} inline QString String() const {return str;}
protected: protected:
QString str; QString str;
}; };

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -20,25 +20,18 @@
****************************************************************************/ ****************************************************************************/
#include "vexceptionemptyparameter.h" #include "vexceptionemptyparameter.h"
#include <QDebug>
VExceptionEmptyParameter::VExceptionEmptyParameter(const QString &what, const QString &name, VExceptionEmptyParameter::VExceptionEmptyParameter(const QString &what, const QString &name,
const QDomElement &domElement): VException(what), const QDomElement &domElement): VException(what),
name(name), tagText(QString()), tagName(QString()), lineNumber(-1){ name(name), tagText(QString()), tagName(QString()), lineNumber(-1){
Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null");
Q_ASSERT_X(!name.isEmpty(), Q_FUNC_INFO, "Parameter name is empty"); Q_ASSERT_X(!name.isEmpty(), Q_FUNC_INFO, "Parameter name is empty");
if(domElement.isText()){ QTextStream stream(&tagText);
QDomText text = domElement.toText(); domElement.save(stream, 4);
tagText = text.data();
}
tagName = domElement.tagName(); tagName = domElement.tagName();
lineNumber = domElement.lineNumber(); lineNumber = domElement.lineNumber();
} }
VExceptionEmptyParameter::VExceptionEmptyParameter(const VExceptionEmptyParameter &e):VException(e),
name(e.Name()), tagText(e.TagText()), tagName(e.TagName()), lineNumber(e.LineNumber()){
}
QString VExceptionEmptyParameter::ErrorMessage() const{ QString VExceptionEmptyParameter::ErrorMessage() const{
QString error = QString("ExceptionEmptyParameter: %1 %2").arg(what, name); QString error = QString("ExceptionEmptyParameter: %1 %2").arg(what, name);
return error; return error;

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -23,20 +23,20 @@
#define VEXCEPTIONEMPTYPARAMETER_H #define VEXCEPTIONEMPTYPARAMETER_H
#include "vexception.h" #include "vexception.h"
#include <QDomElement>
class VExceptionEmptyParameter : public VException class VExceptionEmptyParameter : public VException{
{
public: public:
VExceptionEmptyParameter(const QString &what, const QString &name, const QDomElement &domElement); VExceptionEmptyParameter(const QString &what, const QString &name,
VExceptionEmptyParameter(const VExceptionEmptyParameter &e); const QDomElement &domElement);
VExceptionEmptyParameter(const VExceptionEmptyParameter &e):VException(e), name(e.Name()),
tagText(e.TagText()), tagName(e.TagName()), lineNumber(e.LineNumber()){}
virtual ~VExceptionEmptyParameter() noexcept(true) {} virtual ~VExceptionEmptyParameter() noexcept(true) {}
virtual QString ErrorMessage() const; virtual QString ErrorMessage() const;
virtual QString DetailedInformation() const; virtual QString DetailedInformation() const;
QString Name() const {return name;} inline QString Name() const {return name;}
QString TagText() const {return tagText;} inline QString TagText() const {return tagText;}
QString TagName() const {return tagName;} inline QString TagName() const {return tagName;}
qint32 LineNumber() const {return lineNumber;} inline qint32 LineNumber() const {return lineNumber;}
protected: protected:
QString name; QString name;
QString tagText; QString tagText;

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -25,18 +25,12 @@
VExceptionObjectError::VExceptionObjectError(const QString &what, const QDomElement &domElement): VExceptionObjectError::VExceptionObjectError(const QString &what, const QDomElement &domElement):
VException(what), tagText(QString()), tagName(QString()), lineNumber(-1), moreInfo(QString()){ VException(what), tagText(QString()), tagName(QString()), lineNumber(-1), moreInfo(QString()){
Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null");
if(domElement.isText()){ QTextStream stream(&tagText);
QDomText text = domElement.toText(); domElement.save(stream, 4);
tagText = text.data();
}
tagName = domElement.tagName(); tagName = domElement.tagName();
lineNumber = domElement.lineNumber(); lineNumber = domElement.lineNumber();
} }
VExceptionObjectError::VExceptionObjectError(const VExceptionObjectError &e):VException(e),
tagText(e.TagText()), tagName(e.TagName()), lineNumber(e.LineNumber()), moreInfo(e.MoreInformation()){
}
QString VExceptionObjectError::ErrorMessage() const{ QString VExceptionObjectError::ErrorMessage() const{
QString error = QString("ExceptionObjectError: %1").arg(what); QString error = QString("ExceptionObjectError: %1").arg(what);
return error; return error;

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -23,21 +23,20 @@
#define VEXCEPTIONOBJECTERROR_H #define VEXCEPTIONOBJECTERROR_H
#include "vexception.h" #include "vexception.h"
#include <QDomElement>
class VExceptionObjectError : public VException class VExceptionObjectError : public VException{
{
public: public:
VExceptionObjectError(const QString &what, const QDomElement &domElement); VExceptionObjectError(const QString &what, const QDomElement &domElement);
VExceptionObjectError(const VExceptionObjectError &e); VExceptionObjectError(const VExceptionObjectError &e):VException(e), tagText(e.TagText()),
tagName(e.TagName()), lineNumber(e.LineNumber()), moreInfo(e.MoreInformation()){}
virtual ~VExceptionObjectError() noexcept(true) {} virtual ~VExceptionObjectError() noexcept(true) {}
virtual QString ErrorMessage() const; virtual QString ErrorMessage() const;
virtual QString DetailedInformation() const; virtual QString DetailedInformation() const;
QString TagText() const {return tagText;} inline QString TagText() const {return tagText;}
QString TagName() const {return tagName;} inline QString TagName() const {return tagName;}
qint32 LineNumber() const {return lineNumber;} inline qint32 LineNumber() const {return lineNumber;}
void AddMoreInformation(const QString &info); void AddMoreInformation(const QString &info);
QString MoreInformation() const {return moreInfo;} inline QString MoreInformation() const {return moreInfo;}
protected: protected:
QString tagText; QString tagText;
QString tagName; QString tagName;

View File

@ -0,0 +1,20 @@
#include "vexceptionuniqueid.h"
VExceptionUniqueId::VExceptionUniqueId(const QString &what, const QDomElement &domElement)
:VException(what), tagText(QString()), tagName(QString()), lineNumber(-1){
Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null");
QTextStream stream(&tagText);
domElement.save(stream, 4);
tagName = domElement.tagName();
lineNumber = domElement.lineNumber();
}
QString VExceptionUniqueId::ErrorMessage() const{
QString error = QString("ExceptionUniqueId: %1").arg(what);
return error;
}
QString VExceptionUniqueId::DetailedInformation() const{
QString detail = QString("tag: %1 in line %2\nFull tag:\n%3").arg(tagName).arg(lineNumber).arg(tagText);
return detail;
}

View File

@ -0,0 +1,23 @@
#ifndef VEXCEPTIONUNIQUEID_H
#define VEXCEPTIONUNIQUEID_H
#include "vexception.h"
class VExceptionUniqueId : public VException{
public:
VExceptionUniqueId(const QString &what, const QDomElement &domElement);
VExceptionUniqueId(const VExceptionUniqueId &e):VException(e), tagText(e.TagText()),
tagName(e.TagName()), lineNumber(e.LineNumber()){}
virtual ~VExceptionUniqueId() noexcept(true){}
virtual QString ErrorMessage() const;
virtual QString DetailedInformation() const;
inline QString TagText() const {return tagText;}
inline QString TagName() const {return tagName;}
inline qint32 LineNumber() const {return lineNumber;}
protected:
QString tagText;
QString tagName;
qint32 lineNumber;
};
#endif // VEXCEPTIONUNIQUEID_H

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -25,18 +25,12 @@
VExceptionWrongParameterId::VExceptionWrongParameterId(const QString &what, const QDomElement &domElement): VExceptionWrongParameterId::VExceptionWrongParameterId(const QString &what, const QDomElement &domElement):
VException(what), tagText(QString()), tagName(QString()), lineNumber(-1){ VException(what), tagText(QString()), tagName(QString()), lineNumber(-1){
Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null");
if(domElement.isText()){ QTextStream stream(&tagText);
QDomText text = domElement.toText(); domElement.save(stream, 4);
tagText = text.data();
}
tagName = domElement.tagName(); tagName = domElement.tagName();
lineNumber = domElement.lineNumber(); lineNumber = domElement.lineNumber();
} }
VExceptionWrongParameterId::VExceptionWrongParameterId(const VExceptionWrongParameterId &e):VException(e),
tagText(e.TagText()), tagName(e.TagName()), lineNumber(e.LineNumber()){
}
QString VExceptionWrongParameterId::ErrorMessage() const{ QString VExceptionWrongParameterId::ErrorMessage() const{
QString error = QString("ExceptionWrongParameterId: %1").arg(what); QString error = QString("ExceptionWrongParameterId: %1").arg(what);
return error; return error;

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -23,19 +23,18 @@
#define VEXCEPTIONWRONGPARAMETERID_H #define VEXCEPTIONWRONGPARAMETERID_H
#include "vexception.h" #include "vexception.h"
#include <QDomElement>
class VExceptionWrongParameterId : public VException class VExceptionWrongParameterId : public VException{
{
public: public:
VExceptionWrongParameterId(const QString &what, const QDomElement &domElement); VExceptionWrongParameterId(const QString &what, const QDomElement &domElement);
VExceptionWrongParameterId(const VExceptionWrongParameterId &e); VExceptionWrongParameterId(const VExceptionWrongParameterId &e):VException(e),tagText(e.TagText()),
tagName(e.TagName()), lineNumber(e.LineNumber()){}
virtual ~VExceptionWrongParameterId() noexcept(true){} virtual ~VExceptionWrongParameterId() noexcept(true){}
virtual QString ErrorMessage() const; virtual QString ErrorMessage() const;
virtual QString DetailedInformation() const; virtual QString DetailedInformation() const;
QString TagText() const {return tagText;} inline QString TagText() const {return tagText;}
QString TagName() const {return tagName;} inline QString TagName() const {return tagName;}
qint32 LineNumber() const {return lineNumber;} inline qint32 LineNumber() const {return lineNumber;}
protected: protected:
QString tagText; QString tagText;
QString tagName; QString tagName;

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -20,16 +20,16 @@
****************************************************************************/ ****************************************************************************/
#include "varc.h" #include "varc.h"
#include <QDebug> #include <exception/vexception.h>
VArc::VArc () : f1(0), formulaF1(QString()), f2(0), formulaF2(QString()), radius(0), formulaRadius(QString()), VArc::VArc () : f1(0), formulaF1(QString()), f2(0), formulaF2(QString()), radius(0), formulaRadius(QString()),
center(0), points(0), mode(Draw::Calculation), idObject(0){ center(0), points(QHash<qint64, VPointF>()), mode(Draw::Calculation), idObject(0){
} }
VArc::VArc (const QMap<qint64, VPointF> *points, qint64 center, qreal radius, QString formulaRadius, VArc::VArc (const QHash<qint64, VPointF> *points, qint64 center, qreal radius, QString formulaRadius,
qreal f1, QString formulaF1, qreal f2, QString formulaF2, Draw::Draws mode, qint64 idObject) qreal f1, QString formulaF1, qreal f2, QString formulaF2, Draw::Draws mode, qint64 idObject)
: f1(f1), formulaF1(formulaF1), f2(f2), formulaF2(formulaF2), radius(radius), formulaRadius(formulaRadius), : f1(f1), formulaF1(formulaF1), f2(f2), formulaF2(formulaF2), radius(radius), formulaRadius(formulaRadius),
center(center), points(points), mode(mode), idObject(idObject){ center(center), points(*points), mode(mode), idObject(idObject){
} }
VArc::VArc(const VArc &arc): f1(arc.GetF1()), formulaF1(arc.GetFormulaF1()), f2(arc.GetF2()), VArc::VArc(const VArc &arc): f1(arc.GetF1()), formulaF1(arc.GetFormulaF1()), f2(arc.GetF2()),
@ -52,44 +52,12 @@ VArc &VArc::operator =(const VArc &arc){
return *this; return *this;
} }
qreal VArc::GetF1() const{
return f1;
}
QString VArc::GetFormulaF1() const{
return formulaF1;
}
qreal VArc::GetF2() const{
return f2;
}
QString VArc::GetFormulaF2() const{
return formulaF2;
}
qreal VArc::GetLength () const{
return M_PI * radius/180 * (f2-f1);
}
qreal VArc::GetRadius() const{
return radius;
}
QString VArc::GetFormulaRadius() const{
return formulaRadius;
}
qint64 VArc::GetCenter() const{
return center;
}
QPointF VArc::GetCenterPoint() const{ QPointF VArc::GetCenterPoint() const{
if(points->contains(center)){ if(points.contains(center)){
return points->value(center).toQPointF(); return points.value(center).toQPointF();
} else { } else {
qCritical()<<"Не можу знайти id = "<<center<<" в таблиці."; QString error = QString(tr("Can't find id = %1 in table.")).arg(center);
throw"Не можу знайти точку за id."; throw VException(error);
} }
return QPointF(); return QPointF();
} }
@ -108,7 +76,7 @@ QPointF VArc::GetP2 () const{
return centerP2.p2(); return centerP2.p2();
} }
const QMap<qint64, VPointF> *VArc::GetDataPoints() const{ const QHash<qint64, VPointF> VArc::GetDataPoints() const{
return points; return points;
} }
@ -133,9 +101,10 @@ qreal VArc::AngleArc() const{
qint32 VArc::NumberSplOfArc() const{ qint32 VArc::NumberSplOfArc() const{
qint32 angArc = static_cast<qint32> (AngleArc ()); qint32 angArc = static_cast<qint32> (AngleArc ());
switch( angArc ){ switch( angArc ){
case 0: case 0:{
throw "Кут дуги не може бути 0 градусів."; QString error = QString(tr("Angle of arc can't be 0 degree."));
break; throw VException(error);
}
case 90: case 90:
return 1; return 1;
case 180: case 180:
@ -161,7 +130,8 @@ QVector<QPointF> VArc::GetPoints() const{
QVector<QPointF> VArc::SplOfArc(qint32 number) const{ QVector<QPointF> VArc::SplOfArc(qint32 number) const{
qint32 n = NumberSplOfArc (); qint32 n = NumberSplOfArc ();
if( number > n ){ if( number > n ){
throw "Дуга не складається з такої кількості сплайнів."; QString error = QString(tr("Arc have not this number of part."));
throw VException(error);
} }
qreal f1 = GetF1 (); qreal f1 = GetF1 ();
qreal f2 = GetF2 (); qreal f2 = GetF2 ();
@ -194,19 +164,3 @@ QVector<QPointF> VArc::SplOfArc(qint32 number) const{
} }
return QVector<QPointF>(); return QVector<QPointF>();
} }
Draw::Draws VArc::getMode() const{
return mode;
}
void VArc::setMode(const Draw::Draws &value){
mode = value;
}
qint64 VArc::getIdObject() const{
return idObject;
}
void VArc::setIdObject(const qint64 &value){
idObject = value;
}

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -28,6 +28,7 @@
* @brief VArc клас, що реалізує дугу. Дуга розраховується за годиниковою стрілкою. * @brief VArc клас, що реалізує дугу. Дуга розраховується за годиниковою стрілкою.
*/ */
class VArc{ class VArc{
Q_DECLARE_TR_FUNCTIONS(VArc)
public: public:
/** /**
* @brief VArc конструктор по замовчуванню. * @brief VArc конструктор по замовчуванню.
@ -40,7 +41,7 @@ public:
* @param f1 початковий кут в градусах. * @param f1 початковий кут в градусах.
* @param f2 кінцевий кут в градусах. * @param f2 кінцевий кут в градусах.
*/ */
VArc (const QMap<qint64, VPointF> *points, qint64 center, qreal radius, QString formulaRadius, VArc (const QHash<qint64, VPointF> *points, qint64 center, qreal radius, QString formulaRadius,
qreal f1, QString formulaF1, qreal f2 , QString formulaF2, qreal f1, QString formulaF1, qreal f2 , QString formulaF2,
Draw::Draws mode = Draw::Calculation, qint64 idObject = 0); Draw::Draws mode = Draw::Calculation, qint64 idObject = 0);
VArc(const VArc &arc); VArc(const VArc &arc);
@ -49,30 +50,30 @@ public:
* @brief GetF1 повертає початковий кут дуги. * @brief GetF1 повертає початковий кут дуги.
* @return повертає кут в градусах. * @return повертає кут в градусах.
*/ */
QString GetFormulaF1 () const; inline QString GetFormulaF1 () const {return formulaF1;}
qreal GetF1 () const; inline qreal GetF1 () const {return f1;}
/** /**
* @brief GetF2 повертає кінцевий кут дуги. * @brief GetF2 повертає кінцевий кут дуги.
* @return повертає кут в градусах. * @return повертає кут в градусах.
*/ */
QString GetFormulaF2 () const;\ inline QString GetFormulaF2 () const {return formulaF2;}
qreal GetF2 () const; inline qreal GetF2 () const {return f2;}
/** /**
* @brief GetLength повертає довжину дуги. * @brief GetLength повертає довжину дуги.
* @return повертає довжину дуги. * @return повертає довжину дуги.
*/ */
qreal GetLength () const; inline qreal GetLength () const {return M_PI * radius/180 * (f2-f1);}
/** /**
* @brief GetRadius повертає радіус дуги. * @brief GetRadius повертає радіус дуги.
* @return повертає радіус дуги. * @return повертає радіус дуги.
*/ */
QString GetFormulaRadius () const; inline QString GetFormulaRadius () const {return formulaRadius;}
qreal GetRadius () const; inline qreal GetRadius () const {return radius;}
/** /**
* @brief GetCenter повертає точку центра дуги. * @brief GetCenter повертає точку центра дуги.
* @return повертає точку центра дуги. * @return повертає точку центра дуги.
*/ */
qint64 GetCenter () const; inline qint64 GetCenter () const {return center;}
QPointF GetCenterPoint() const; QPointF GetCenterPoint() const;
/** /**
* @brief GetP1 повертає першу точку з якої починається дуга. * @brief GetP1 повертає першу точку з якої починається дуга.
@ -84,21 +85,20 @@ public:
* @return точку кінця дуги. * @return точку кінця дуги.
*/ */
QPointF GetP2 () const; QPointF GetP2 () const;
const QMap<qint64, VPointF> *GetDataPoints() const; const QHash<qint64, VPointF> GetDataPoints() const;
/** /**
* @brief GetPath будує шлях по даній дузі. * @brief GetPath будує шлях по даній дузі.
* @return повертає шлях. * @return повертає шлях.
*/ */
QPainterPath GetPath() const; QPainterPath GetPath() const;
qreal AngleArc()const; qreal AngleArc() const;
qint32 NumberSplOfArc () const; qint32 NumberSplOfArc () const;
QVector<QPointF> GetPoints () const; QVector<QPointF> GetPoints () const;
QVector<QPointF> SplOfArc( qint32 number ) const; QVector<QPointF> SplOfArc( qint32 number ) const;
Draw::Draws getMode() const; inline Draw::Draws getMode() const {return mode;}
void setMode(const Draw::Draws &value); inline void setMode(const Draw::Draws &value) {mode = value;}
qint64 getIdObject() const; inline qint64 getIdObject() const {return idObject;}
void setIdObject(const qint64 &value); inline void setIdObject(const qint64 &value) {idObject = value;}
private: private:
/** /**
* @brief f1 початковий кут в градусах * @brief f1 початковий кут в градусах
@ -119,7 +119,7 @@ private:
* @brief center центральна точка дуги. * @brief center центральна точка дуги.
*/ */
qint64 center; qint64 center;
const QMap<qint64, VPointF> *points; QHash<qint64, VPointF> points;
Draw::Draws mode; Draw::Draws mode;
qint64 idObject; qint64 idObject;
}; };

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -21,16 +21,28 @@
#include "vdetail.h" #include "vdetail.h"
VDetail::VDetail():nodes(QVector<VNodeDetail>()),name(QString()), mx(0), my(0){ VDetail::VDetail():nodes(QVector<VNodeDetail>()),name(QString()), mx(0), my(0), supplement(true), closed(true),
width(10){
} }
VDetail::VDetail(const QString &name, const QVector<VNodeDetail> &nodes):nodes(QVector<VNodeDetail>()), VDetail::VDetail(const QString &name, const QVector<VNodeDetail> &nodes):nodes(QVector<VNodeDetail>()),
name(name), mx(0), my(0){ name(name), mx(0), my(0), supplement(true), closed(true), width(10){
this->nodes = nodes; this->nodes = nodes;
} }
void VDetail::append(const VNodeDetail &node){ VDetail::VDetail(const VDetail &detail):nodes(detail.getNodes()), name(detail.getName()), mx(detail.getMx()),
nodes.append(node); my(detail.getMy()), supplement(detail.getSupplement()), closed(detail.getClosed()), width(detail.getWidth()){
}
VDetail &VDetail::operator =(const VDetail &detail){
nodes = detail.getNodes();
name = detail.getName();
mx = detail.getMx();
my = detail.getMy();
supplement = detail.getSupplement();
closed = detail.getClosed();
width = detail.getWidth();
return *this;
} }
void VDetail::Clear(){ void VDetail::Clear(){
@ -38,10 +50,9 @@ void VDetail::Clear(){
name.clear(); name.clear();
mx = 0; mx = 0;
my = 0; my = 0;
} supplement = true;
closed = true;
qint32 VDetail::CountNode() const{ width = 10;
return nodes.size();
} }
bool VDetail::Containes(const qint64 &id) const{ bool VDetail::Containes(const qint64 &id) const{
@ -58,26 +69,3 @@ VNodeDetail &VDetail::operator [](int indx){
return nodes[indx]; return nodes[indx];
} }
qreal VDetail::getMy() const{
return my;
}
void VDetail::setMy(const qreal &value){
my = value;
}
qreal VDetail::getMx() const{
return mx;
}
void VDetail::setMx(const qreal &value){
mx = value;
}
QString VDetail::getName() const{
return name;
}
void VDetail::setName(const QString &value){
name = value;
}

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -23,9 +23,6 @@
#define VDETAIL_H #define VDETAIL_H
#include "vnodedetail.h" #include "vnodedetail.h"
#include <QVector>
#include <QString>
#include <QPainterPath>
namespace Detail { namespace Detail {
enum Contour { OpenContour, CloseContour }; enum Contour { OpenContour, CloseContour };
@ -41,22 +38,35 @@ class VDetail{
public: public:
VDetail(); VDetail();
VDetail(const QString &name, const QVector<VNodeDetail> &nodes); VDetail(const QString &name, const QVector<VNodeDetail> &nodes);
void append(const VNodeDetail &node); VDetail(const VDetail &detail);
VDetail &operator=(const VDetail &detail);
inline void append(const VNodeDetail &node) {nodes.append(node);}
void Clear(); void Clear();
qint32 CountNode() const; inline qint32 CountNode() const {return nodes.size();}
bool Containes(const qint64 &id)const; bool Containes(const qint64 &id)const;
VNodeDetail & operator[](int indx); VNodeDetail & operator[](int indx);
QString getName() const; inline QString getName() const {return name;}
void setName(const QString &value); inline void setName(const QString &value) {name = value;}
qreal getMx() const; inline qreal getMx() const {return mx;}
void setMx(const qreal &value); inline void setMx(const qreal &value) {mx = value;}
qreal getMy() const; inline qreal getMy() const {return my;}
void setMy(const qreal &value); inline void setMy(const qreal &value) {my = value;}
inline bool getSupplement() const {return supplement;}
inline void setSupplement(bool value) {supplement = value;}
inline bool getClosed() const {return closed;}
inline void setClosed(bool value) {closed = value;}
inline qreal getWidth() const {return width;}
inline void setWidth(const qreal &value) {width = value;}
inline QVector<VNodeDetail> getNodes() const {return nodes;}
inline void setNodes(const QVector<VNodeDetail> &value) {nodes = value;}
private: private:
QVector<VNodeDetail> nodes; QVector<VNodeDetail> nodes;
QString name; QString name;
qreal mx; qreal mx;
qreal my; qreal my;
bool supplement;
bool closed;
qreal width;
}; };
#endif // VDETAIL_H #endif // VDETAIL_H

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -21,46 +21,25 @@
#include "vnodedetail.h" #include "vnodedetail.h"
VNodeDetail::VNodeDetail():id(0), typeTool(Tool::NodePoint), mode(Draw::Calculation), VNodeDetail::VNodeDetail():id(0), typeTool(Tool::NodePoint), mode(Draw::Modeling),
typeNode(NodeDetail::Contour){ typeNode(NodeDetail::Contour), mx(0), my(0){
} }
VNodeDetail::VNodeDetail(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode):id(id), VNodeDetail::VNodeDetail(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode,
typeTool(typeTool), mode(mode), typeNode(typeNode){ qreal mx, qreal my):id(id), typeTool(typeTool), mode(mode), typeNode(typeNode),
mx(mx), my(my){
} }
VNodeDetail::VNodeDetail(const VNodeDetail &node):id(node.getId()), typeTool(node.getTypeTool()), VNodeDetail::VNodeDetail(const VNodeDetail &node):id(node.getId()), typeTool(node.getTypeTool()),
mode(node.getMode()), typeNode(node.getTypeNode()){ mode(node.getMode()), typeNode(node.getTypeNode()), mx(node.getMx()), my(node.getMy()){
} }
Tool::Tools VNodeDetail::getTypeTool() const{ VNodeDetail &VNodeDetail::operator =(const VNodeDetail &node){
return typeTool; id = node.getId();
} typeTool = node.getTypeTool();
mode = node.getMode();
void VNodeDetail::setTypeTool(const Tool::Tools &value){ typeNode = node.getTypeNode();
typeTool = value; mx = node.getMx();
} my = node.getMy();
return *this;
qint64 VNodeDetail::getId() const{
return id;
}
void VNodeDetail::setId(const qint64 &value){
id = value;
}
Draw::Draws VNodeDetail::getMode() const{
return mode;
}
void VNodeDetail::setMode(const Draw::Draws &value){
mode = value;
}
NodeDetail::NodeDetails VNodeDetail::getTypeNode() const{
return typeNode;
}
void VNodeDetail::setTypeNode(const NodeDetail::NodeDetails &value){
typeNode = value;
} }

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -31,26 +31,32 @@ namespace NodeDetail {
} }
Q_DECLARE_OPERATORS_FOR_FLAGS(NodeDetail::NodeDetails) Q_DECLARE_OPERATORS_FOR_FLAGS(NodeDetail::NodeDetails)
class VNodeDetail class VNodeDetail{
{
public: public:
VNodeDetail(); VNodeDetail();
VNodeDetail(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode); VNodeDetail(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode,
qreal mx = 0, qreal my = 0);
VNodeDetail(const VNodeDetail &node); VNodeDetail(const VNodeDetail &node);
qint64 getId() const; VNodeDetail &operator=(const VNodeDetail &node);
void setId(const qint64 &value); inline qint64 getId() const {return id;}
Tool::Tools getTypeTool() const; inline void setId(const qint64 &value) {id = value;}
void setTypeTool(const Tool::Tools &value); inline Tool::Tools getTypeTool() const {return typeTool;}
Draw::Draws getMode() const; inline void setTypeTool(const Tool::Tools &value) {typeTool = value;}
void setMode(const Draw::Draws &value); inline Draw::Draws getMode() const {return mode;}
NodeDetail::NodeDetails getTypeNode() const; inline void setMode(const Draw::Draws &value) {mode = value;}
void setTypeNode(const NodeDetail::NodeDetails &value); inline NodeDetail::NodeDetails getTypeNode() const {return typeNode;}
inline void setTypeNode(const NodeDetail::NodeDetails &value) {typeNode = value;}
inline qreal getMx() const {return mx;}
inline void setMx(const qreal &value) {mx = value;}
inline qreal getMy() const {return my;}
inline void setMy(const qreal &value) {my = value;}
private: private:
qint64 id; qint64 id;
Tool::Tools typeTool; Tool::Tools typeTool;
Draw::Draws mode; Draw::Draws mode;
NodeDetail::NodeDetails typeNode; NodeDetail::NodeDetails typeNode;
qreal mx;
qreal my;
}; };
Q_DECLARE_METATYPE(VNodeDetail) Q_DECLARE_METATYPE(VNodeDetail)

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -20,10 +20,9 @@
****************************************************************************/ ****************************************************************************/
#include "vspline.h" #include "vspline.h"
#include <QDebug>
VSpline::VSpline():p1(0), p2(QPointF()), p3(QPointF()), p4(0), angle1(0), angle2(0), kAsm1(1), kAsm2(1), VSpline::VSpline():p1(0), p2(QPointF()), p3(QPointF()), p4(0), angle1(0), angle2(0), kAsm1(1), kAsm2(1),
kCurve(1), points(0), mode(Draw::Calculation), idObject(0){ kCurve(1), points(QHash<qint64, VPointF>()), mode(Draw::Calculation), idObject(0){
} }
VSpline::VSpline ( const VSpline & spline ):p1(spline.GetP1 ()), p2(spline.GetP2 ()), p3(spline.GetP3 ()), VSpline::VSpline ( const VSpline & spline ):p1(spline.GetP1 ()), p2(spline.GetP2 ()), p3(spline.GetP3 ()),
@ -32,16 +31,16 @@ VSpline::VSpline ( const VSpline & spline ):p1(spline.GetP1 ()), p2(spline.GetP2
mode(spline.getMode()), idObject(spline.getIdObject()){ mode(spline.getMode()), idObject(spline.getIdObject()){
} }
VSpline::VSpline (const QMap<qint64, VPointF> *points, qint64 p1, qint64 p4, qreal angle1, qreal angle2, VSpline::VSpline (const QHash<qint64, VPointF> *points, qint64 p1, qint64 p4, qreal angle1, qreal angle2,
qreal kAsm1, qreal kAsm2 , qreal kCurve, Draw::Draws mode, qint64 idObject):p1(p1), p2(QPointF()), p3(QPointF()), qreal kAsm1, qreal kAsm2 , qreal kCurve, Draw::Draws mode, qint64 idObject):p1(p1), p2(QPointF()),
p4(p4), angle1(angle1), angle2(angle2), kAsm1(kAsm1), kAsm2(kAsm2), kCurve(kCurve), points(points), p3(QPointF()), p4(p4), angle1(angle1), angle2(angle2), kAsm1(kAsm1), kAsm2(kAsm2), kCurve(kCurve), points(*points),
mode(mode), idObject(idObject){ mode(mode), idObject(idObject){
ModifiSpl ( p1, p4, angle1, angle2, kAsm1, kAsm2, kCurve ); ModifiSpl ( p1, p4, angle1, angle2, kAsm1, kAsm2, kCurve );
} }
VSpline::VSpline (const QMap<qint64, VPointF> *points, qint64 p1, QPointF p2, QPointF p3, qint64 p4, VSpline::VSpline (const QHash<qint64, VPointF> *points, qint64 p1, QPointF p2, QPointF p3, qint64 p4,
qreal kCurve, Draw::Draws mode, qint64 idObject):p1(p1), p2(p2), p3(p3), p4(p4), angle1(0), qreal kCurve, Draw::Draws mode, qint64 idObject):p1(p1), p2(p2), p3(p3), p4(p4), angle1(0),
angle2(0), kAsm1(1), kAsm2(1), kCurve(1), points(points), mode(mode), idObject(idObject){ angle2(0), kAsm1(1), kAsm2(1), kCurve(1), points(*points), mode(mode), idObject(idObject){
ModifiSpl ( p1, p2, p3, p4, kCurve); ModifiSpl ( p1, p2, p3, p4, kCurve);
} }
@ -124,13 +123,9 @@ void VSpline::ModifiSpl (qint64 p1, QPointF p2, QPointF p3, qint64 p4, qreal kCu
// p4 = QPointF(p4.x()+mx, p4.y()+my); // p4 = QPointF(p4.x()+mx, p4.y()+my);
//} //}
qint64 VSpline::GetP1 () const{
return p1;
}
VPointF VSpline::GetPointP1() const{ VPointF VSpline::GetPointP1() const{
if(points->contains(p1)){ if(points.contains(p1)){
return points->value(p1); return points.value(p1);
} else { } else {
qCritical()<<"Не можу знайти id = "<<p1<<" в таблиці."; qCritical()<<"Не можу знайти id = "<<p1<<" в таблиці.";
throw"Не можу знайти точку за id."; throw"Не можу знайти точку за id.";
@ -138,21 +133,9 @@ VPointF VSpline::GetPointP1() const{
return VPointF(); return VPointF();
} }
QPointF VSpline::GetP2 () const{
return p2;
}
QPointF VSpline::GetP3 () const{
return p3;
}
qint64 VSpline::GetP4() const{
return p4;
}
VPointF VSpline::GetPointP4() const{ VPointF VSpline::GetPointP4() const{
if(points->contains(p4)){ if(points.contains(p4)){
return points->value(p4); return points.value(p4);
} else { } else {
qCritical()<<"Не можу знайти id = "<<p4<<" в таблиці."; qCritical()<<"Не можу знайти id = "<<p4<<" в таблиці.";
throw"Не можу знайти точку за id."; throw"Не можу знайти точку за id.";
@ -160,14 +143,6 @@ VPointF VSpline::GetPointP4() const{
return VPointF(); return VPointF();
} }
qreal VSpline::GetAngle1() const{
return angle1;
}
qreal VSpline::GetAngle2 () const{
return angle2;
}
qreal VSpline::GetLength () const{ qreal VSpline::GetLength () const{
return LengthBezier ( GetPointP1().toQPointF(), this->p2, this->p3, GetPointP4().toQPointF()); return LengthBezier ( GetPointP1().toQPointF(), this->p2, this->p3, GetPointP4().toQPointF());
} }
@ -178,22 +153,6 @@ QString VSpline::GetName() const{
return QString("Spl_%1_%2").arg(first.name(), second.name()); return QString("Spl_%1_%2").arg(first.name(), second.name());
} }
qreal VSpline::GetKasm1() const{
return kAsm1;
}
qreal VSpline::GetKasm2() const{
return kAsm2;
}
qreal VSpline::GetKcurve() const{
return kCurve;
}
const QMap<qint64, VPointF> *VSpline::GetDataPoints() const{
return points;
}
QLineF::IntersectType VSpline::CrossingSplLine ( const QLineF &line, QPointF *intersectionPoint ) const{ QLineF::IntersectType VSpline::CrossingSplLine ( const QLineF &line, QPointF *intersectionPoint ) const{
QVector<qreal> px; QVector<qreal> px;
QVector<qreal> py; QVector<qreal> py;
@ -320,25 +279,6 @@ QVector<QPointF> VSpline::GetPoints (QPointF p1, QPointF p2, QPointF p3, QPointF
} }
qreal VSpline::LengthBezier ( QPointF p1, QPointF p2, QPointF p3, QPointF p4 ) const{ qreal VSpline::LengthBezier ( QPointF p1, QPointF p2, QPointF p3, QPointF p4 ) const{
/*QVector<qreal> px;
QVector<qreal> py;
QVector<qreal>& wpx = px;
QVector<qreal>& wpy = py;
px.append ( p1.x () );
py.append ( p1.y () );
PointBezier_r ( p1.x (), p1.y (), p2.x (), p2.y (),
p3.x (), p3.y (), p4.x (), p4.y (), 0, wpx, wpy);
px.append ( p4.x () );
py.append ( p4.y () );
qint32 i = 0;
qreal length = 0.0;
*
* Наприклад маємо 10 точок. Від 0 до 9 і останню точку не опрацьовуємо.
* Тому від 0 до 8(<10-1).
*
for ( i = 0; i < px.count() - 1; ++i ){
length += QLineF ( QPointF ( px[i], py[i] ), QPointF ( px[i+1], py[i+1] ) ).length ();
}*/
QPainterPath splinePath; QPainterPath splinePath;
QVector<QPointF> points = GetPoints (p1, p2, p3, p4); QVector<QPointF> points = GetPoints (p1, p2, p3, p4);
splinePath.moveTo(points[0]); splinePath.moveTo(points[0]);
@ -620,9 +560,13 @@ qreal VSpline::CalcSqDistance (qreal x1, qreal y1, qreal x2, qreal y2){
QPainterPath VSpline::GetPath() const{ QPainterPath VSpline::GetPath() const{
QPainterPath splinePath; QPainterPath splinePath;
QVector<QPointF> points = GetPoints (); QVector<QPointF> points = GetPoints ();
splinePath.moveTo(points[0]); if(points.count() >= 2){
for (qint32 i = 1; i < points.count(); ++i){ for (qint32 i = 0; i < points.count()-1; ++i){
splinePath.lineTo(points[i]); splinePath.moveTo(points[i]);
splinePath.lineTo(points[i+1]);
}
} else {
qWarning()<<"points.count() < 2"<<Q_FUNC_INFO;
} }
return splinePath; return splinePath;
} }
@ -642,44 +586,44 @@ QPainterPath VSpline::GetPath() const{
2 - 1 real root + complex roots imaginary part is zero 2 - 1 real root + complex roots imaginary part is zero
(i.e. 2 real roots). (i.e. 2 real roots).
*/ */
qint32 VSpline::Cubic(qreal *x, qreal a, qreal b, qreal c){ //qint32 VSpline::Cubic(qreal *x, qreal a, qreal b, qreal c){
qreal q,r,r2,q3; // qreal q,r,r2,q3;
q = (a*a - 3.*b)/9.; // q = (a*a - 3.*b)/9.;
r = (a*(2.*a*a - 9.*b) + 27.*c)/54.; // r = (a*(2.*a*a - 9.*b) + 27.*c)/54.;
r2 = r*r; // r2 = r*r;
q3 = pow(q,3); // q3 = pow(q,3);
if(r2<q3) { // if(r2<q3) {
qreal t = acos(r/sqrt(q3)); // qreal t = acos(r/sqrt(q3));
a/=3.; // a/=3.;
q = -2.*sqrt(q); // q = -2.*sqrt(q);
x[0] = q*cos(t/3.)-a; // x[0] = q*cos(t/3.)-a;
x[1] = q*cos((t + M_2PI)/3.) - a; // x[1] = q*cos((t + M_2PI)/3.) - a;
x[2] = q*cos((t - M_2PI)/3.) - a; // x[2] = q*cos((t - M_2PI)/3.) - a;
return(3); // return(3);
} else { // } else {
qreal aa,bb; // qreal aa,bb;
if(r<=0.){ // if(r<=0.){
r=-r; // r=-r;
} // }
aa = -pow(r + sqrt(r2-q3),1./3.); // aa = -pow(r + sqrt(r2-q3),1./3.);
if(aa!=0.){ // if(aa!=0.){
bb=q/aa; // bb=q/aa;
} else { // } else {
bb=0.; // bb=0.;
} // }
a/=3.; // a/=3.;
q = aa+bb; // q = aa+bb;
r = aa-bb; // r = aa-bb;
x[0] = q-a; // x[0] = q-a;
x[1] = (-0.5)*q-a; // x[1] = (-0.5)*q-a;
x[2] = (sqrt(3.)*0.5)*fabs(r); // x[2] = (sqrt(3.)*0.5)*fabs(r);
if(x[2]==0.){ // if(x[2]==0.){
return(2); // return(2);
} // }
return(1); // return(1);
} // }
} //}
//qreal VSpline::calc_t (qreal curve_coord1, qreal curve_coord2, qreal curve_coord3, //qreal VSpline::calc_t (qreal curve_coord1, qreal curve_coord2, qreal curve_coord3,
// qreal curve_coord4, qreal point_coord) const{ // qreal curve_coord4, qreal point_coord) const{
@ -752,14 +696,6 @@ qint32 VSpline::Cubic(qreal *x, qreal a, qreal b, qreal c){
// this->ModifiSpl(P1, P2, P3, P4); // this->ModifiSpl(P1, P2, P3, P4);
//} //}
Draw::Draws VSpline::getMode() const{
return mode;
}
void VSpline::setMode(const Draw::Draws &value){
mode = value;
}
QVector<QPointF> VSpline::SplinePoints(QPointF p1, QPointF p4, qreal angle1, qreal angle2, qreal kAsm1, QVector<QPointF> VSpline::SplinePoints(QPointF p1, QPointF p4, qreal angle1, qreal angle2, qreal kAsm1,
qreal kAsm2, qreal kCurve){ qreal kAsm2, qreal kCurve){
QLineF p1pX(p1.x(), p1.y(), p1.x() + 100, p1.y()); QLineF p1pX(p1.x(), p1.y(), p1.x() + 100, p1.y());
@ -776,14 +712,6 @@ QVector<QPointF> VSpline::SplinePoints(QPointF p1, QPointF p4, qreal angle1, qre
return GetPoints(p1, p2, p3, p4); return GetPoints(p1, p2, p3, p4);
} }
qint64 VSpline::getIdObject() const{
return idObject;
}
void VSpline::setIdObject(const qint64 &value){
idObject = value;
}
VSpline &VSpline::operator =(const VSpline &spline){ VSpline &VSpline::operator =(const VSpline &spline){
this->p1 = spline.GetP1 (); this->p1 = spline.GetP1 ();
this->p2 = spline.GetP2 (); this->p2 = spline.GetP2 ();

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -22,12 +22,9 @@
#ifndef VSPLINE_H #ifndef VSPLINE_H
#define VSPLINE_H #define VSPLINE_H
#define M_2PI 6.28318530717958647692528676655900576 #include <container/vpointf.h>
#include <QPainterPath> #define M_2PI 6.28318530717958647692528676655900576
#include <QVector>
#include <QMap>
#include "container/vpointf.h"
/** /**
* @brief VSpline клас, що реалізує сплайн. * @brief VSpline клас, що реалізує сплайн.
@ -50,9 +47,9 @@ public:
* @param kAsm1 коефіцієнт довжини першої напрямної. * @param kAsm1 коефіцієнт довжини першої напрямної.
* @param kAsm2 коефіцієнт довжини другої напрямної. * @param kAsm2 коефіцієнт довжини другої напрямної.
*/ */
VSpline (const QMap<qint64, VPointF> *points, qint64 p1, qint64 p4, qreal angle1, VSpline (const QHash<qint64, VPointF> *points, qint64 p1, qint64 p4, qreal angle1, qreal angle2,
qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve, qreal kAsm1, qreal kAsm2, qreal kCurve, Draw::Draws mode = Draw::Calculation,
Draw::Draws mode = Draw::Calculation, qint64 idObject = 0); qint64 idObject = 0);
/** /**
* @brief VSpline конструктор. * @brief VSpline конструктор.
* @param p1 початкова точка сплайну. * @param p1 початкова точка сплайну.
@ -60,9 +57,8 @@ public:
* @param p3 друга контролююча точка сплайну. * @param p3 друга контролююча точка сплайну.
* @param p4 кінцева точка сплайну. * @param p4 кінцева точка сплайну.
*/ */
VSpline (const QMap<qint64, VPointF> *points, qint64 p1, QPointF p2, QPointF p3, VSpline (const QHash<qint64, VPointF> *points, qint64 p1, QPointF p2, QPointF p3, qint64 p4,
qint64 p4, qreal kCurve, Draw::Draws mode = Draw::Calculation, qreal kCurve, Draw::Draws mode = Draw::Calculation, qint64 idObject = 0);
qint64 idObject = 0);
/** /**
* @brief ModifiSpl модифікує сплайн. * @brief ModifiSpl модифікує сплайн.
* @param p1 початкова точка сплайну. * @param p1 початкова точка сплайну.
@ -99,44 +95,44 @@ public:
* @brief GetP1 повертає першу точку сплайну. * @brief GetP1 повертає першу точку сплайну.
* @return перша точка сплайну. * @return перша точка сплайну.
*/ */
qint64 GetP1 () const; qint64 GetP1 () const {return p1;}
VPointF GetPointP1() const; VPointF GetPointP1() const;
/** /**
* @brief GetP2 повертує першу контрольну точку сплайну. * @brief GetP2 повертує першу контрольну точку сплайну.
* @return перша контрольна точка сплайну. * @return перша контрольна точка сплайну.
*/ */
QPointF GetP2 () const; inline QPointF GetP2 () const {return p2;}
/** /**
* @brief GetP3 повертає другу контрольну точку сплайну. * @brief GetP3 повертає другу контрольну точку сплайну.
* @return друга контрольна точка сплайну. * @return друга контрольна точка сплайну.
*/ */
QPointF GetP3 () const; inline QPointF GetP3 () const {return p3;}
/** /**
* @brief GetP4 повертає останню точку сплайну. * @brief GetP4 повертає останню точку сплайну.
* @return остання точка сплайну. * @return остання точка сплайну.
*/ */
qint64 GetP4 () const; inline qint64 GetP4 () const {return p4;}
VPointF GetPointP4 () const; VPointF GetPointP4 () const;
/** /**
* @brief GetAngle1 повертає кут першої напрямної. * @brief GetAngle1 повертає кут першої напрямної.
* @return кут в градусах. * @return кут в градусах.
*/ */
qreal GetAngle1 () const; inline qreal GetAngle1 () const {return angle1;}
/** /**
* @brief GetAngle2 повертає кут другої напрямної. * @brief GetAngle2 повертає кут другої напрямної.
* @return кут в градусах. * @return кут в градусах.
*/ */
qreal GetAngle2() const; inline qreal GetAngle2() const {return angle2;}
/** /**
* @brief GetLength повертає довжину сплайну. * @brief GetLength повертає довжину сплайну.
* @return довжина сплайну. * @return довжина сплайну.
*/ */
qreal GetLength () const; qreal GetLength () const;
QString GetName () const; QString GetName () const;
qreal GetKasm1() const; inline qreal GetKasm1() const {return kAsm1;}
qreal GetKasm2() const; inline qreal GetKasm2() const {return kAsm2;}
qreal GetKcurve() const; inline qreal GetKcurve() const {return kCurve;}
const QMap<qint64, VPointF> *GetDataPoints() const; inline const QHash<qint64, VPointF> GetDataPoints() const {return points;}
/** /**
* @brief CrossingSplLine перевіряє перетин сплайну з лінією. * @brief CrossingSplLine перевіряє перетин сплайну з лінією.
* @param line лінія з якою перевіряється перетин. * @param line лінія з якою перевіряється перетин.
@ -179,12 +175,12 @@ public:
* @param Pmirror точка відносно якої відбувається вертикальне дзеркалення сплайну. * @param Pmirror точка відносно якої відбувається вертикальне дзеркалення сплайну.
*/ */
// void Mirror(const QPointF Pmirror); // void Mirror(const QPointF Pmirror);
Draw::Draws getMode() const; inline Draw::Draws getMode() const {return mode;}
void setMode(const Draw::Draws &value); inline void setMode(const Draw::Draws &value) {mode = value;}
static QVector<QPointF> SplinePoints(QPointF p1, QPointF p4, qreal angle1, static QVector<QPointF> SplinePoints(QPointF p1, QPointF p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2,
qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve); qreal kCurve);
qint64 getIdObject() const; inline qint64 getIdObject() const {return idObject;}
void setIdObject(const qint64 &value); inline void setIdObject(const qint64 &value) {idObject = value;}
VSpline &operator=(const VSpline &spl); VSpline &operator=(const VSpline &spl);
protected: protected:
/** /**
@ -224,7 +220,7 @@ private:
qreal kAsm1; qreal kAsm1;
qreal kAsm2; qreal kAsm2;
qreal kCurve; qreal kCurve;
const QMap<qint64, VPointF> *points; QHash<qint64, VPointF> points;
Draw::Draws mode; Draw::Draws mode;
qint64 idObject; qint64 idObject;
/** /**
@ -250,8 +246,7 @@ private:
* @param px список х координат точок сплайну. * @param px список х координат точок сплайну.
* @param py список у коодринат сплайну. * @param py список у коодринат сплайну.
*/ */
static void PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2, static void PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, qreal x4, qreal y4,
qreal x3, qreal y3, qreal x4, qreal y4,
qint16 level, QVector<qreal> &px, QVector<qreal> &py); qint16 level, QVector<qreal> &px, QVector<qreal> &py);
/** /**
* @brief CalcSqDistance розраховує довжину між точками. * @brief CalcSqDistance розраховує довжину між точками.
@ -262,15 +257,15 @@ private:
* @return довжину. * @return довжину.
*/ */
static qreal CalcSqDistance ( qreal x1, qreal y1, qreal x2, qreal y2); static qreal CalcSqDistance ( qreal x1, qreal y1, qreal x2, qreal y2);
/** // /**
* @brief Cubic знаходить розв'язок кубічного рівняння. // * @brief Cubic знаходить розв'язок кубічного рівняння.
* @param x коефіцієнт. // * @param x коефіцієнт.
* @param a коефіцієнт. // * @param a коефіцієнт.
* @param b коефіцієнт. // * @param b коефіцієнт.
* @param c коефіцієнт. // * @param c коефіцієнт.
* @return повертає корені рівняння. // * @return повертає корені рівняння.
*/ // */
static qint32 Cubic(qreal *x, qreal a, qreal b, qreal c); // static qint32 Cubic(qreal *x, qreal a, qreal b, qreal c);
/** /**
* @brief calc_t знаходить параметр t якому відповідає точка на сплайні. * @brief calc_t знаходить параметр t якому відповідає точка на сплайні.
* @param curve_coord1 координата Х або У кривої. * @param curve_coord1 координата Х або У кривої.
@ -280,8 +275,8 @@ private:
* @param point_coord координата Х або У точки на кривій. * @param point_coord координата Х або У точки на кривій.
* @return * @return
*/ */
// static qreal calc_t (qreal curve_coord1, qreal curve_coord2, qreal curve_coord3, // static qreal calc_t (qreal curve_coord1, qreal curve_coord2, qreal curve_coord3, qreal curve_coord4,
// qreal curve_coord4, qreal point_coord)const; // qreal point_coord)const;
/** /**
* @brief param_t знаходить підходяще значення параметра t якому відповідає точка на сплайні * @brief param_t знаходить підходяще значення параметра t якому відповідає точка на сплайні
* @param pBt точка для якої шукається значення параметра t. * @param pBt точка для якої шукається значення параметра t.

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -20,29 +20,21 @@
****************************************************************************/ ****************************************************************************/
#include "vsplinepath.h" #include "vsplinepath.h"
#include "exception/vexception.h" #include <exception/vexception.h>
VSplinePath::VSplinePath(): path(QVector<VSplinePoint>()), kCurve(1), mode(Draw::Calculation), points(0), VSplinePath::VSplinePath(): path(QVector<VSplinePoint>()), kCurve(1), mode(Draw::Calculation),
idObject(0){ points(QHash<qint64, VPointF>()), idObject(0){
} }
VSplinePath::VSplinePath(const QMap<qint64, VPointF> *points, qreal kCurve, Draw::Draws mode, qint64 idObject): path(QVector<VSplinePoint>()), VSplinePath::VSplinePath(const QHash<qint64, VPointF> *points, qreal kCurve, Draw::Draws mode, qint64 idObject): path(QVector<VSplinePoint>()),
kCurve(kCurve), mode(mode), points(points), idObject(idObject){ kCurve(kCurve), mode(mode), points(*points), idObject(idObject){
} }
VSplinePath::VSplinePath(const VSplinePath &splPath): path(*splPath.GetPoint()), VSplinePath::VSplinePath(const VSplinePath &splPath): path(*splPath.GetPoint()),
kCurve(splPath.getKCurve()), mode(splPath.getMode()), points( splPath.GetDataPoints()), kCurve(splPath.getKCurve()), mode(splPath.getMode()), points(splPath.GetDataPoints()),
idObject(splPath.getIdObject()){ idObject(splPath.getIdObject()){
} }
Draw::Draws VSplinePath::getMode() const{
return mode;
}
void VSplinePath::setMode(const Draw::Draws &value){
mode = value;
}
void VSplinePath::append(VSplinePoint point){ void VSplinePath::append(VSplinePoint point){
path.append(point); path.append(point);
} }
@ -55,10 +47,6 @@ qint32 VSplinePath::Count() const{
} }
} }
qint32 VSplinePath::CountPoint() const{
return path.size();
}
VSpline VSplinePath::GetSpline(qint32 index) const{ VSpline VSplinePath::GetSpline(qint32 index) const{
if(Count()<1){ if(Count()<1){
throw VException(tr("Not enough points to create the spline.")); throw VException(tr("Not enough points to create the spline."));
@ -66,7 +54,7 @@ VSpline VSplinePath::GetSpline(qint32 index) const{
if(index < 1 || index > Count()){ if(index < 1 || index > Count()){
throw VException(tr("This spline is not exist.")); throw VException(tr("This spline is not exist."));
} }
VSpline spl(points, path[index-1].P(), path[index].P(), path[index-1].Angle2(), path[index].Angle1(), VSpline spl(&points, path[index-1].P(), path[index].P(), path[index-1].Angle2(), path[index].Angle1(),
path[index-1].KAsm2(), path[index].KAsm1(), this->kCurve); path[index-1].KAsm2(), path[index].KAsm1(), this->kCurve);
return spl; return spl;
} }
@ -74,8 +62,8 @@ VSpline VSplinePath::GetSpline(qint32 index) const{
QPainterPath VSplinePath::GetPath() const{ QPainterPath VSplinePath::GetPath() const{
QPainterPath painterPath; QPainterPath painterPath;
for(qint32 i = 1; i <= Count(); ++i){ for(qint32 i = 1; i <= Count(); ++i){
VSpline spl(points, path[i-1].P(), path[i].P(), path[i-1].Angle2(), path[i].Angle1(), path[i-1].KAsm2(), VSpline spl(&points, path[i-1].P(), path[i].P(), path[i-1].Angle2(), path[i].Angle1(),
path[i].KAsm1(), this->kCurve); path[i-1].KAsm2(), path[i].KAsm1(), this->kCurve);
painterPath.addPath(spl.GetPath()); painterPath.addPath(spl.GetPath());
} }
return painterPath; return painterPath;
@ -84,34 +72,26 @@ QPainterPath VSplinePath::GetPath() const{
QVector<QPointF> VSplinePath::GetPathPoints() const{ QVector<QPointF> VSplinePath::GetPathPoints() const{
QVector<QPointF> pathPoints; QVector<QPointF> pathPoints;
for(qint32 i = 1; i <= Count(); ++i){ for(qint32 i = 1; i <= Count(); ++i){
VSpline spl(points, path[i-1].P(), path[i].P(), path[i-1].Angle2(), path[i].Angle1(), path[i-1].KAsm2(), VSpline spl(&points, path[i-1].P(), path[i].P(), path[i-1].Angle2(), path[i].Angle1(),
path[i].KAsm1(), this->kCurve); path[i-1].KAsm2(), path[i].KAsm1(), this->kCurve);
QVector<QPointF> splP = spl.GetPoints(); QVector<QPointF> splP = spl.GetPoints();
for(qint32 j = 0; i < splP.size(); ++j){ for(qint32 j = 0; j < splP.size(); ++j){
pathPoints.append(splP[j]); pathPoints.append(splP[j]);
} }
} }
return pathPoints; return pathPoints;
} }
QVector<VSplinePoint> VSplinePath::GetSplinePath() const{
return path;
}
qreal VSplinePath::GetLength() const{ qreal VSplinePath::GetLength() const{
qreal length = 0; qreal length = 0;
for(qint32 i = 1; i <= Count(); ++i){ for(qint32 i = 1; i <= Count(); ++i){
VSpline spl(points, path[i-1].P(), path[i].P(), path[i-1].Angle2(), path[i].Angle1(), path[i-1].KAsm2(), VSpline spl(&points, path[i-1].P(), path[i].P(), path[i-1].Angle2(), path[i].Angle1(), path[i-1].KAsm2(),
path[i].KAsm1(), kCurve); path[i].KAsm1(), kCurve);
length += spl.GetLength(); length += spl.GetLength();
} }
return length; return length;
} }
const QMap<qint64, VPointF> *VSplinePath::GetDataPoints() const{
return points;
}
void VSplinePath::UpdatePoint(qint32 indexSpline, SplinePoint::Position pos, VSplinePoint point){ void VSplinePath::UpdatePoint(qint32 indexSpline, SplinePoint::Position pos, VSplinePoint point){
if(indexSpline < 1 || indexSpline > Count()){ if(indexSpline < 1 || indexSpline > Count()){
throw VException(tr("This spline is not exist.")); throw VException(tr("This spline is not exist."));
@ -134,22 +114,6 @@ VSplinePoint VSplinePath::GetSplinePoint(qint32 indexSpline, SplinePoint::Positi
} }
} }
void VSplinePath::Clear(){
path.clear();
}
qreal VSplinePath::getKCurve() const{
return kCurve;
}
void VSplinePath::setKCurve(const qreal &value){
kCurve = value;
}
const QVector<VSplinePoint> *VSplinePath::GetPoint() const{
return &path;
}
VSplinePath &VSplinePath::operator =(const VSplinePath &path){ VSplinePath &VSplinePath::operator =(const VSplinePath &path){
this->path = path.GetSplinePath(); this->path = path.GetSplinePath();
this->kCurve = path.getKCurve(); this->kCurve = path.getKCurve();
@ -162,11 +126,3 @@ VSplinePath &VSplinePath::operator =(const VSplinePath &path){
VSplinePoint & VSplinePath::operator[](int indx){ VSplinePoint & VSplinePath::operator[](int indx){
return path[indx]; return path[indx];
} }
qint64 VSplinePath::getIdObject() const{
return idObject;
}
void VSplinePath::setIdObject(const qint64 &value){
idObject = value;
}

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -23,8 +23,9 @@
#define VSPLINEPATH_H #define VSPLINEPATH_H
#include "vsplinepoint.h" #include "vsplinepoint.h"
#include <container/vpointf.h>
#include "vspline.h" #include "vspline.h"
#include <QCoreApplication> #include <QApplication>
namespace SplinePoint{ namespace SplinePoint{
enum Position { FirstPoint, LastPoint }; enum Position { FirstPoint, LastPoint };
@ -45,7 +46,7 @@ public:
/** /**
* @brief VSplinePath конструктор по замовчуванню. * @brief VSplinePath конструктор по замовчуванню.
*/ */
VSplinePath(const QMap<qint64, VPointF> *points, qreal kCurve = 1, VSplinePath(const QHash<qint64, VPointF> *points, qreal kCurve = 1,
Draw::Draws mode = Draw::Calculation, qint64 idObject = 0); Draw::Draws mode = Draw::Calculation, qint64 idObject = 0);
VSplinePath(const VSplinePath& splPath); VSplinePath(const VSplinePath& splPath);
/** /**
@ -54,29 +55,29 @@ public:
*/ */
void append(VSplinePoint point); void append(VSplinePoint point);
qint32 Count() const; qint32 Count() const;
qint32 CountPoint() const; inline qint32 CountPoint() const {return path.size();}
VSpline GetSpline(qint32 index) const; VSpline GetSpline(qint32 index) const;
QPainterPath GetPath() const; QPainterPath GetPath() const;
QVector<QPointF> GetPathPoints() const; QVector<QPointF> GetPathPoints() const;
QVector<VSplinePoint> GetSplinePath() const; inline QVector<VSplinePoint> GetSplinePath() const {return path;}
qreal GetLength() const; qreal GetLength() const;
const QMap<qint64, VPointF> *GetDataPoints() const; inline QHash<qint64, VPointF> GetDataPoints() const {return points;}
void UpdatePoint(qint32 indexSpline, SplinePoint::Position pos, VSplinePoint point); void UpdatePoint(qint32 indexSpline, SplinePoint::Position pos, VSplinePoint point);
VSplinePoint GetSplinePoint(qint32 indexSpline, SplinePoint::Position pos) const; VSplinePoint GetSplinePoint(qint32 indexSpline, SplinePoint::Position pos) const;
/** /**
* @brief Clear очищає шлях сплайнів. * @brief Clear очищає шлях сплайнів.
*/ */
void Clear(); inline void Clear() {path.clear();}
qreal getKCurve() const; inline qreal getKCurve() const {return kCurve;}
void setKCurve(const qreal &value); inline void setKCurve(const qreal &value) {kCurve = value;}
const QVector<VSplinePoint> *GetPoint() const; inline const QVector<VSplinePoint> *GetPoint() const {return &path;}
VSplinePath& operator=(const VSplinePath &path); VSplinePath &operator=(const VSplinePath &path);
VSplinePoint & operator[](int indx); VSplinePoint &operator[](int indx);
Draw::Draws getMode() const; inline Draw::Draws getMode() const {return mode;}
void setMode(const Draw::Draws &value); inline void setMode(const Draw::Draws &value) {mode = value;}
qint64 getIdObject() const; inline qint64 getIdObject() const {return idObject;}
void setIdObject(const qint64 &value); inline void setIdObject(const qint64 &value) {idObject = value;}
protected: protected:
/** /**
@ -85,7 +86,7 @@ protected:
QVector<VSplinePoint> path; QVector<VSplinePoint> path;
qreal kCurve; qreal kCurve;
Draw::Draws mode; Draw::Draws mode;
const QMap<qint64, VPointF> *points; QHash<qint64, VPointF> points;
qint64 idObject; qint64 idObject;
}; };

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -32,41 +32,8 @@ VSplinePoint::VSplinePoint(const VSplinePoint &point):pSpline(point.P()), angle(
kAsm1(point.KAsm1()), kAsm2(point.KAsm2()){ kAsm1(point.KAsm1()), kAsm2(point.KAsm2()){
} }
VSplinePoint::~VSplinePoint(){
}
qint64 VSplinePoint::P() const{
return pSpline;
}
void VSplinePoint::SetP(const qint64 &value){
pSpline = value;
}
qreal VSplinePoint::Angle1() const{
return angle+180;
}
void VSplinePoint::SetAngle(const qreal &value){
angle = value;
}
qreal VSplinePoint::Angle2() const{
return angle;
}
qreal VSplinePoint::KAsm1() const{
return kAsm1;
}
void VSplinePoint::SetKAsm1(const qreal &value){
kAsm1 = value;
}
qreal VSplinePoint::KAsm2() const{
return kAsm2;
}
void VSplinePoint::SetKAsm2(const qreal &value){
kAsm2 = value;
}

View File

@ -9,7 +9,7 @@
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Tox is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
@ -41,36 +41,36 @@ public:
*/ */
VSplinePoint(qint64 pSpline, qreal kAsm1, qreal angle, qreal kAsm2); VSplinePoint(qint64 pSpline, qreal kAsm1, qreal angle, qreal kAsm2);
VSplinePoint(const VSplinePoint &point); VSplinePoint(const VSplinePoint &point);
~VSplinePoint(); ~VSplinePoint() {}
/** /**
* @brief P повертає точку. * @brief P повертає точку.
* @return точка. * @return точка.
*/ */
qint64 P() const; inline qint64 P() const {return pSpline;}
void SetP(const qint64 &value); inline void SetP(const qint64 &value) {pSpline = value;}
/** /**
* @brief Angle1 повертає кут дотичної сплайна. * @brief Angle1 повертає кут дотичної сплайна.
* @return кут в градусах. * @return кут в градусах.
*/ */
qreal Angle1() const; inline qreal Angle1() const {return angle+180;}
void SetAngle(const qreal &value); inline void SetAngle(const qreal &value) {angle = value;}
/** /**
* @brief Angle2 повертає кут дотичної сплайна. * @brief Angle2 повертає кут дотичної сплайна.
* @return кут в градусах. * @return кут в градусах.
*/ */
qreal Angle2() const; inline qreal Angle2() const {return angle;}
/** /**
* @brief KAsm1 повертає коефіцієнт довжини дотичної. * @brief KAsm1 повертає коефіцієнт довжини дотичної.
* @return коефіцієнт. * @return коефіцієнт.
*/ */
qreal KAsm1() const; inline qreal KAsm1() const {return kAsm1;}
void SetKAsm1(const qreal &value); inline void SetKAsm1(const qreal &value) {kAsm1 = value;}
/** /**
* @brief KAsm2 повертає коефіцієнт довжини дотичної. * @brief KAsm2 повертає коефіцієнт довжини дотичної.
* @return коефіцієнт. * @return коефіцієнт.
*/ */
qreal KAsm2() const; inline qreal KAsm2() const {return kAsm2;}
void SetKAsm2(const qreal &value); inline void SetKAsm2(const qreal &value) {kAsm2 = value;}
protected: protected:
/** /**
* @brief pSpline точка сплайну. * @brief pSpline точка сплайну.

View File

@ -34,5 +34,8 @@
<file>icon/32x32/new_detail.png</file> <file>icon/32x32/new_detail.png</file>
<file>icon/32x32/layout.png</file> <file>icon/32x32/layout.png</file>
<file>icon/16x16/mirror.png</file> <file>icon/16x16/mirror.png</file>
<file>icon/32x32/height.png</file>
<file>icon/32x32/triangle.png</file>
<file>icon/32x32/point_of_intersection.png</file>
</qresource> </qresource>
</RCC> </RCC>

Some files were not shown because too many files have changed in this diff Show More