Merge with feature
--HG-- branch : develop
This commit is contained in:
commit
e3a55e58d6
|
@ -41,6 +41,7 @@ include(geometry/geometry.pri)
|
|||
include(tools/tools.pri)
|
||||
include(widgets/widgets.pri)
|
||||
include(xml/xml.pri)
|
||||
include(undocommands/undocommands.pri)
|
||||
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <QDebug>
|
||||
#include <QSettings>
|
||||
#include "../widgets/vapplication.h"
|
||||
#include "vcontainer.h"
|
||||
|
||||
using namespace qmu;
|
||||
|
||||
|
@ -150,7 +151,7 @@ qreal Calculator::EvalFormula(const QString &formula)
|
|||
void Calculator::InitVariables(const VContainer *data)
|
||||
{
|
||||
int num = 0;
|
||||
if (qApp->patternType() == Pattern::Standard)
|
||||
if (qApp->patternType() == MeasurementsType::Standard)
|
||||
{
|
||||
num +=2;
|
||||
}
|
||||
|
@ -176,7 +177,7 @@ void Calculator::InitVariables(const VContainer *data)
|
|||
vVarVal = new qreal[num];
|
||||
int j = 0;
|
||||
|
||||
if (qApp->patternType() == Pattern::Standard)
|
||||
if (qApp->patternType() == MeasurementsType::Standard)
|
||||
{
|
||||
vVarVal[j] = data->size();
|
||||
DefineVar(data->SizeName(), &vVarVal[j]);
|
||||
|
@ -235,7 +236,7 @@ void Calculator::InitVariables(const VContainer *data)
|
|||
QHash<QString, VMeasurement>::const_iterator i = measurements->constBegin();
|
||||
while (i != measurements->constEnd())
|
||||
{
|
||||
if (qApp->patternType() == Pattern::Standard)
|
||||
if (qApp->patternType() == MeasurementsType::Standard)
|
||||
{
|
||||
vVarVal[j] = i.value().GetValue(data->size(), data->height());
|
||||
}
|
||||
|
@ -253,7 +254,7 @@ void Calculator::InitVariables(const VContainer *data)
|
|||
QHash<QString, VIncrement>::const_iterator i = increments->constBegin();
|
||||
while (i != increments->constEnd())
|
||||
{
|
||||
if (qApp->patternType() == Pattern::Standard)
|
||||
if (qApp->patternType() == MeasurementsType::Standard)
|
||||
{
|
||||
vVarVal[j] = i.value().GetValue(data->size(), data->height());
|
||||
}
|
||||
|
@ -293,12 +294,12 @@ qreal Calculator::CmUnit(qreal val)
|
|||
qreal unit = val;
|
||||
switch(qApp->patternUnit())
|
||||
{
|
||||
case Valentina::Mm:
|
||||
case Unit::Mm:
|
||||
unit = val * 10.0;
|
||||
break;
|
||||
case Valentina::Cm:
|
||||
case Unit::Cm:
|
||||
break;
|
||||
case Valentina::Inch:
|
||||
case Unit::Inch:
|
||||
unit = val / 2.54;
|
||||
break;
|
||||
default:
|
||||
|
@ -314,12 +315,12 @@ qreal Calculator::MmUnit(qreal val)
|
|||
qreal unit = val;
|
||||
switch(qApp->patternUnit())
|
||||
{
|
||||
case Valentina::Mm:
|
||||
case Unit::Mm:
|
||||
break;
|
||||
case Valentina::Cm:
|
||||
case Unit::Cm:
|
||||
unit = val / 10.0;
|
||||
break;
|
||||
case Valentina::Inch:
|
||||
case Unit::Inch:
|
||||
unit = val / 25.4;
|
||||
break;
|
||||
default:
|
||||
|
@ -335,13 +336,13 @@ qreal Calculator::InchUnit(qreal val)
|
|||
qreal unit = val;
|
||||
switch(qApp->patternUnit())
|
||||
{
|
||||
case Valentina::Mm:
|
||||
case Unit::Mm:
|
||||
unit = val * 25.4;
|
||||
break;
|
||||
case Valentina::Cm:
|
||||
case Unit::Cm:
|
||||
unit = val * 2.54;
|
||||
break;
|
||||
case Valentina::Inch:
|
||||
case Unit::Inch:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -29,10 +29,10 @@
|
|||
#ifndef CALCULATOR_H
|
||||
#define CALCULATOR_H
|
||||
|
||||
#include "vcontainer.h"
|
||||
|
||||
#include "../../libs/qmuparser/qmuparser.h"
|
||||
|
||||
class VContainer;
|
||||
|
||||
/**
|
||||
* @brief The Calculator class for calculation formula.
|
||||
*
|
||||
|
|
|
@ -27,10 +27,10 @@
|
|||
*************************************************************************/
|
||||
|
||||
#include "vcontainer.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QtAlgorithms>
|
||||
#include "../widgets/vapplication.h"
|
||||
#include "../geometry/varc.h"
|
||||
#include "../geometry/vsplinepath.h"
|
||||
|
||||
quint32 VContainer::_id = 0;
|
||||
|
||||
|
@ -100,16 +100,16 @@ void VContainer::setData(const VContainer &data)
|
|||
i.next();
|
||||
switch (i.value()->getType())
|
||||
{
|
||||
case (GObject::Arc):
|
||||
case (GOType::Arc):
|
||||
CopyGObject<VArc>(data, i.key());
|
||||
break;
|
||||
case (GObject::Point):
|
||||
case (GOType::Point):
|
||||
CopyGObject<VPointF>(data, i.key());
|
||||
break;
|
||||
case (GObject::Spline):
|
||||
case (GOType::Spline):
|
||||
CopyGObject<VSpline>(data, i.key());
|
||||
break;
|
||||
case (GObject::SplinePath):
|
||||
case (GOType::SplinePath):
|
||||
CopyGObject<VSplinePath>(data, i.key());
|
||||
break;
|
||||
default:
|
||||
|
@ -386,7 +386,7 @@ void VContainer::AddLineAngle(const QString &name, const qreal &value)
|
|||
qreal VContainer::GetValueStandardTableRow(const QString& name) const
|
||||
{
|
||||
const VMeasurement m = GetMeasurement(name);
|
||||
if (qApp->patternType() == Pattern::Individual)
|
||||
if (qApp->patternType() == MeasurementsType::Individual)
|
||||
{
|
||||
return m.GetValue();
|
||||
}
|
||||
|
@ -405,7 +405,7 @@ qreal VContainer::GetValueStandardTableRow(const QString& name) const
|
|||
qreal VContainer::GetValueIncrementTableRow(const QString& name) const
|
||||
{
|
||||
const VIncrement icr = GetIncrement(name);
|
||||
if (qApp->patternType() == Pattern::Individual)
|
||||
if (qApp->patternType() == MeasurementsType::Individual)
|
||||
{
|
||||
return icr.GetValue();
|
||||
}
|
||||
|
@ -454,7 +454,7 @@ void VContainer::ClearCalculationGObjects()
|
|||
while (i.hasNext())
|
||||
{
|
||||
i.next();
|
||||
if (i.value()->getMode() == Valentina::Calculation)
|
||||
if (i.value()->getMode() == Draw::Calculation)
|
||||
{
|
||||
delete i.value();
|
||||
gObjects.remove(i.key());
|
||||
|
|
|
@ -31,10 +31,7 @@
|
|||
|
||||
#include "vmeasurement.h"
|
||||
#include "vincrement.h"
|
||||
#include "../geometry/varc.h"
|
||||
#include "../geometry/vsplinepath.h"
|
||||
#include "../geometry/vdetail.h"
|
||||
#include "../widgets/vitem.h"
|
||||
#include "../geometry/vgobject.h"
|
||||
#include "../exception/vexceptionbadid.h"
|
||||
|
||||
|
|
|
@ -49,6 +49,23 @@ VIncrement::VIncrement(quint32 id, qreal base, qreal ksize, qreal kheight, QStri
|
|||
:id(id), base(base), ksize(ksize), kheight(kheight), description(description)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VIncrement::VIncrement(const VIncrement &incr)
|
||||
:id(incr.getId()), base(incr.getBase()), ksize(incr.getKsize()), kheight(incr.getKheight()),
|
||||
description(incr.getDescription())
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VIncrement &VIncrement::operator=(const VIncrement &incr)
|
||||
{
|
||||
this->id = incr.getId();
|
||||
this->base = incr.getBase();
|
||||
this->ksize = incr.getKsize();
|
||||
this->kheight = incr.getKheight();
|
||||
this->description = incr.getDescription();
|
||||
return *this;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VIncrement::GetValue() const
|
||||
{
|
||||
|
|
|
@ -39,6 +39,8 @@ class VIncrement
|
|||
public:
|
||||
VIncrement();
|
||||
VIncrement(quint32 id, qreal base, qreal ksize, qreal kheight, QString description = QString());
|
||||
VIncrement(const VIncrement &incr);
|
||||
VIncrement &operator=(const VIncrement &incr);
|
||||
quint32 getId() const;
|
||||
void setId(const quint32 &value);
|
||||
qreal getBase() const;
|
||||
|
|
|
@ -30,11 +30,11 @@
|
|||
#define CONFIGDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QListWidget>
|
||||
#include "pages.h"
|
||||
|
||||
class QListWidgetItem;
|
||||
class QStackedWidget;
|
||||
class QListWidget;
|
||||
|
||||
class ConfigDialog : public QDialog
|
||||
{
|
||||
|
|
|
@ -29,14 +29,13 @@
|
|||
#include "dialoghistory.h"
|
||||
#include "ui_dialoghistory.h"
|
||||
#include "../../geometry/varc.h"
|
||||
#include "../../geometry/vspline.h"
|
||||
#include "../../geometry/vsplinepath.h"
|
||||
#include "../../geometry/vpointf.h"
|
||||
#include "../../tools/vabstracttool.h"
|
||||
#include "../../tools/drawTools/vtoolcutspline.h"
|
||||
#include "../../tools/drawTools/vtoolcutsplinepath.h"
|
||||
#include "../../tools/drawTools/vtoolcutarc.h"
|
||||
#include <QDebug>
|
||||
#include <QPushButton>
|
||||
#include "../../xml/vpattern.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
@ -58,7 +57,7 @@ DialogHistory::DialogHistory(VContainer *data, VPattern *doc, QWidget *parent)
|
|||
connect(this, &DialogHistory::ShowHistoryTool, doc, &VPattern::ShowHistoryTool);
|
||||
connect(doc, &VPattern::ChangedCursor, this, &DialogHistory::ChangedCursor);
|
||||
connect(doc, &VPattern::patternChanged, this, &DialogHistory::UpdateHistory);
|
||||
connect(doc, &VPattern::ChangedActivDraw, this, &DialogHistory::UpdateHistory);
|
||||
connect(doc, &VPattern::ChangedActivPP, this, &DialogHistory::UpdateHistory);
|
||||
ShowPoint();
|
||||
}
|
||||
|
||||
|
@ -214,22 +213,22 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
|||
{
|
||||
switch ( tool.getTypeTool() )
|
||||
{
|
||||
case Valentina::ArrowTool:
|
||||
case Tool::ArrowTool:
|
||||
Q_UNREACHABLE();
|
||||
break;
|
||||
case Valentina::SinglePointTool:
|
||||
case Tool::SinglePointTool:
|
||||
{
|
||||
const QString name = data->GeometricObject<const VPointF *>(tool.getId())->name();
|
||||
return QString(tr("%1 - Base point")).arg(name);
|
||||
}
|
||||
case Valentina::EndLineTool:
|
||||
case Tool::EndLineTool:
|
||||
{
|
||||
const quint32 basePointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrBasePoint, "0");
|
||||
const QString basePointIdName = data->GeometricObject<const VPointF *>(basePointId)->name();
|
||||
const QString toolIdName = data->GeometricObject<const VPointF *>(tool.getId())->name();
|
||||
return QString(tr("%1_%2 - Line from point %1 to point %2")).arg(basePointIdName, toolIdName);
|
||||
}
|
||||
case Valentina::LineTool:
|
||||
case Tool::LineTool:
|
||||
{
|
||||
const quint32 firstPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0");
|
||||
const quint32 secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0");
|
||||
|
@ -237,7 +236,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
|||
const QString secondPointIdName = data->GeometricObject<const VPointF *>(secondPointId)->name();
|
||||
return QString(tr("%1_%2 - Line from point %1 to point %2")).arg(firstPointIdName, secondPointIdName);
|
||||
}
|
||||
case Valentina::AlongLineTool:
|
||||
case Tool::AlongLineTool:
|
||||
{
|
||||
const quint32 basePointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0");
|
||||
const quint32 secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0");
|
||||
|
@ -246,12 +245,12 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
|||
const QString toolIdName = data->GeometricObject<const VPointF *>(tool.getId())->name();
|
||||
return QString(tr("%3 - Point along line %1_%2")).arg(basePointIdName, secondPointIdName, toolIdName);
|
||||
}
|
||||
case Valentina::ShoulderPointTool:
|
||||
case Tool::ShoulderPointTool:
|
||||
{
|
||||
const QString name = data->GeometricObject<const VPointF *>(tool.getId())->name();
|
||||
return QString(tr("%1 - Point of shoulder")).arg(name);
|
||||
}
|
||||
case Valentina::NormalTool:
|
||||
case Tool::NormalTool:
|
||||
{
|
||||
const quint32 basePointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0");
|
||||
const quint32 secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0");
|
||||
|
@ -260,7 +259,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
|||
const QString toolIdName = data->GeometricObject<const VPointF *>(tool.getId())->name();
|
||||
return QString(tr("%3 - normal to line %1_%2")).arg(basePointIdName, secondPointIdName, toolIdName);
|
||||
}
|
||||
case Valentina::BisectorTool:
|
||||
case Tool::BisectorTool:
|
||||
{
|
||||
const quint32 firstPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0");
|
||||
const quint32 secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0");
|
||||
|
@ -272,7 +271,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
|||
return QString(tr("%4 - bisector of angle %1_%2_%3")).arg(firstPointIdName, secondPointIdName,
|
||||
thirdPointIdName, toolIdName);
|
||||
}
|
||||
case Valentina::LineIntersectTool:
|
||||
case Tool::LineIntersectTool:
|
||||
{
|
||||
const quint32 p1Line1 = doc->GetParametrUInt(domElement, VAbstractTool::AttrP1Line1, "0");
|
||||
const quint32 p2Line1 = doc->GetParametrUInt(domElement, VAbstractTool::AttrP2Line1, "0");
|
||||
|
@ -287,7 +286,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
|||
p1Line2Name, p2Line2Name,
|
||||
toolIdName);
|
||||
}
|
||||
case Valentina::SplineTool:
|
||||
case Tool::SplineTool:
|
||||
{
|
||||
const VSpline *spl = data->GeometricObject<const VSpline *>(tool.getId());
|
||||
SCASSERT(spl != nullptr);
|
||||
|
@ -295,14 +294,14 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
|||
const QString splP4Name = data->GeometricObject<const VPointF *>(spl->GetP4().id())->name();
|
||||
return QString(tr("Curve %1_%2")).arg(splP1Name, splP4Name);
|
||||
}
|
||||
case Valentina::ArcTool:
|
||||
case Tool::ArcTool:
|
||||
{
|
||||
const VArc *arc = data->GeometricObject<const VArc *>(tool.getId());
|
||||
SCASSERT(arc != nullptr);
|
||||
const QString arcCenterName = data->GeometricObject<const VArc *>(arc->GetCenter().id())->name();
|
||||
return QString(tr("Arc with center in point %1")).arg(arcCenterName);
|
||||
}
|
||||
case Valentina::SplinePathTool:
|
||||
case Tool::SplinePathTool:
|
||||
{
|
||||
const VSplinePath *splPath = data->GeometricObject<const VSplinePath *>(tool.getId());
|
||||
SCASSERT(splPath != nullptr);
|
||||
|
@ -325,7 +324,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
|||
}
|
||||
return record;
|
||||
}
|
||||
case Valentina::PointOfContact:
|
||||
case Tool::PointOfContact:
|
||||
{
|
||||
const quint32 center = doc->GetParametrUInt(domElement, VAbstractTool::AttrCenter, "0");
|
||||
const quint32 firstPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0");
|
||||
|
@ -337,7 +336,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
|||
return QString(tr("%4 - point of contact of arc with the center in point %1 and line %2_%3")).arg(
|
||||
centerName, firstPointIdName, secondPointIdName, toolIdName);
|
||||
}
|
||||
case Valentina::Height:
|
||||
case Tool::Height:
|
||||
{
|
||||
const quint32 basePointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrBasePoint, "0");
|
||||
const quint32 p1LineId = doc->GetParametrUInt(domElement, VAbstractTool::AttrP1Line, "0");
|
||||
|
@ -349,7 +348,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
|||
p1LineIdName,
|
||||
p2LineIdName);
|
||||
}
|
||||
case Valentina::Triangle:
|
||||
case Tool::Triangle:
|
||||
{
|
||||
const quint32 axisP1Id = doc->GetParametrUInt(domElement, VAbstractTool::AttrAxisP1, "0");
|
||||
const quint32 axisP2Id = doc->GetParametrUInt(domElement, VAbstractTool::AttrAxisP2, "0");
|
||||
|
@ -362,7 +361,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
|||
return QString(tr("Triangle: axis %1_%2, points %3 and %4")).arg(axisP1IdName, axisP2IdName,
|
||||
firstPointIdName, secondPointIdName);
|
||||
}
|
||||
case Valentina::PointOfIntersection:
|
||||
case Tool::PointOfIntersection:
|
||||
{
|
||||
const quint32 firstPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0");
|
||||
const quint32 secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0");
|
||||
|
@ -372,7 +371,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
|||
return QString(tr("%1 - point of intersection %2 and %3")).arg(toolIdName, firstPointIdName,
|
||||
secondPointIdName);
|
||||
}
|
||||
case Valentina::CutArcTool:
|
||||
case Tool::CutArcTool:
|
||||
{
|
||||
const quint32 arcId = doc->GetParametrUInt(domElement, VToolCutArc::AttrArc, "0");
|
||||
const VArc *arc = data->GeometricObject<const VArc *>(arcId);
|
||||
|
@ -381,7 +380,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
|||
const QString toolIdName = data->GeometricObject<const VPointF *>(tool.getId())->name();
|
||||
return QString(tr("%1 - cut arc with center %2")).arg(toolIdName, arcCenterName);
|
||||
}
|
||||
case Valentina::CutSplineTool:
|
||||
case Tool::CutSplineTool:
|
||||
{
|
||||
const quint32 splineId = doc->GetParametrUInt(domElement, VToolCutSpline::AttrSpline, "0");
|
||||
const VSpline *spl = data->GeometricObject<const VSpline *>(splineId);
|
||||
|
@ -391,7 +390,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
|||
const QString splP4Name = data->GeometricObject<const VPointF *>(spl->GetP4().id())->name();
|
||||
return QString(tr("%1 - cut curve %2_%3")).arg(toolIdName, splP1Name, splP4Name);
|
||||
}
|
||||
case Valentina::CutSplinePathTool:
|
||||
case Tool::CutSplinePathTool:
|
||||
{
|
||||
const quint32 splinePathId = doc->GetParametrUInt(domElement, VToolCutSplinePath::AttrSplinePath, "0");
|
||||
const VSplinePath *splPath = data->GeometricObject<const VSplinePath *>(splinePathId);
|
||||
|
@ -419,17 +418,17 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
|||
}
|
||||
//Because "history" not only show history of pattern, but help restore current data for each pattern's
|
||||
//piece, we need add record about details and nodes, but don't show them.
|
||||
case Valentina::DetailTool:
|
||||
case Tool::DetailTool:
|
||||
break;
|
||||
case Valentina::UnionDetails:
|
||||
case Tool::UnionDetails:
|
||||
break;
|
||||
case Valentina::NodeArc:
|
||||
case Tool::NodeArc:
|
||||
break;
|
||||
case Valentina::NodePoint:
|
||||
case Tool::NodePoint:
|
||||
break;
|
||||
case Valentina::NodeSpline:
|
||||
case Tool::NodeSpline:
|
||||
break;
|
||||
case Valentina::NodeSplinePath:
|
||||
case Tool::NodeSplinePath:
|
||||
break;
|
||||
default:
|
||||
qDebug()<<"Got wrong tool type. Ignore.";
|
||||
|
|
|
@ -30,7 +30,9 @@
|
|||
#define DIALOGHISTORY_H
|
||||
|
||||
#include "../tools/dialogtool.h"
|
||||
#include "../../xml/vpattern.h"
|
||||
|
||||
class VPattern;
|
||||
class VToolRecord;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
|
|
|
@ -30,15 +30,13 @@
|
|||
#include "ui_dialogincrements.h"
|
||||
#include "../../widgets/doubledelegate.h"
|
||||
#include "../../widgets/textdelegate.h"
|
||||
#include "../../exception/vexception.h"
|
||||
#include "../../xml/vstandardmeasurements.h"
|
||||
#include "../../xml/vpattern.h"
|
||||
#include "../../xml/vindividualmeasurements.h"
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QFile>
|
||||
#include <QFileDialog>
|
||||
#include <QDir>
|
||||
#include <QMessageBox>
|
||||
#include <QCloseEvent>
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
@ -52,7 +50,7 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
|
|||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
if (qApp->patternType() == Pattern::Individual)
|
||||
if (qApp->patternType() == MeasurementsType::Individual)
|
||||
{
|
||||
const QString filePath = doc->MPath();
|
||||
try
|
||||
|
@ -84,7 +82,7 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
|
|||
FillLengthSplines();
|
||||
FillLengthArcs();
|
||||
|
||||
if (qApp->patternType() == Pattern::Standard)
|
||||
if (qApp->patternType() == MeasurementsType::Standard)
|
||||
{
|
||||
ui->pagePersonalInformation->setVisible(false);
|
||||
}
|
||||
|
@ -108,8 +106,8 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
|
|||
ui->lineEditGivenName->setText(m->GivenName());
|
||||
ui->lineEditFamilyName->setText(m->FamilyName());
|
||||
|
||||
ui->comboBoxSex->addItem(tr("male"), QVariant(m->GenderToStr(VIndividualMeasurements::Male)));
|
||||
ui->comboBoxSex->addItem(tr("female"), QVariant(m->GenderToStr(VIndividualMeasurements::Female)));
|
||||
ui->comboBoxSex->addItem(tr("male"), QVariant(m->GenderToStr(SexType::Male)));
|
||||
ui->comboBoxSex->addItem(tr("female"), QVariant(m->GenderToStr(SexType::Female)));
|
||||
qint32 index = ui->comboBoxSex->findData(m->GenderToStr(m->Sex()));
|
||||
if (index != -1)
|
||||
{
|
||||
|
@ -133,7 +131,7 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
|
|||
connect(ui->toolButtonAdd, &QPushButton::clicked, this, &DialogIncrements::clickedToolButtonAdd);
|
||||
connect(ui->toolButtonRemove, &QPushButton::clicked, this, &DialogIncrements::clickedToolButtonRemove);
|
||||
|
||||
connect(this, &DialogIncrements::FullUpdateTree, this->doc, &VPattern::FullUpdateTree);
|
||||
connect(this, &DialogIncrements::FullUpdateTree, this->doc, &VPattern::LiteParseTree);
|
||||
connect(this, &DialogIncrements::haveLiteChange, this->doc, &VPattern::haveLiteChange);
|
||||
connect(this->doc, &VPattern::FullUpdateFromFile, this, &DialogIncrements::FullUpdateFromFile);
|
||||
|
||||
|
@ -177,7 +175,7 @@ void DialogIncrements::FillMeasurements()
|
|||
item->setTextAlignment(Qt::AlignLeft);
|
||||
ui->tableWidgetMeasurements->setItem(currentRow, 0, item);
|
||||
|
||||
if (qApp->patternType() == Pattern::Standard)
|
||||
if (qApp->patternType() == MeasurementsType::Standard)
|
||||
{
|
||||
QTableWidgetItem *item = new QTableWidgetItem(QString().setNum(data->GetValueStandardTableRow(iMap.key())));
|
||||
item->setTextAlignment(Qt::AlignHCenter);
|
||||
|
@ -192,7 +190,7 @@ void DialogIncrements::FillMeasurements()
|
|||
item->setTextAlignment(Qt::AlignHCenter);
|
||||
ui->tableWidgetMeasurements->setItem(currentRow, 2, item);
|
||||
|
||||
if (qApp->patternType() == Pattern::Standard)
|
||||
if (qApp->patternType() == MeasurementsType::Standard)
|
||||
{
|
||||
QTableWidgetItem *item = new QTableWidgetItem(QString().setNum(m.GetKsize()));
|
||||
item->setTextAlignment(Qt::AlignHCenter);
|
||||
|
@ -257,7 +255,7 @@ void DialogIncrements::FillIncrements()
|
|||
item->setData(Qt::UserRole, incr.getId());
|
||||
ui->tableWidgetIncrement->setItem(currentRow, 0, item);
|
||||
|
||||
if (qApp->patternType() == Pattern::Standard)
|
||||
if (qApp->patternType() == MeasurementsType::Standard)
|
||||
{
|
||||
item = new QTableWidgetItem(QString().setNum(data->GetValueIncrementTableRow(iMap.value())));
|
||||
item->setTextAlignment(Qt::AlignHCenter);
|
||||
|
@ -272,7 +270,7 @@ void DialogIncrements::FillIncrements()
|
|||
item->setTextAlignment(Qt::AlignHCenter);
|
||||
ui->tableWidgetIncrement->setItem(currentRow, 2, item);
|
||||
|
||||
if (qApp->patternType() == Pattern::Standard)
|
||||
if (qApp->patternType() == MeasurementsType::Standard)
|
||||
{
|
||||
item = new QTableWidgetItem(QString().setNum(incr.getKsize()));
|
||||
item->setTextAlignment(Qt::AlignHCenter);
|
||||
|
@ -495,7 +493,7 @@ void DialogIncrements::OpenTable()
|
|||
{
|
||||
QString text = tr("Measurements use different units than pattern. This pattern required measurements in %1")
|
||||
.arg(doc->UnitsToStr(qApp->patternUnit()));
|
||||
if (qApp->patternType() == Pattern::Individual)
|
||||
if (qApp->patternType() == MeasurementsType::Individual)
|
||||
{
|
||||
const QString filter(tr("Individual measurements (*.vit)"));
|
||||
const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), QDir::homePath(), filter);
|
||||
|
@ -519,7 +517,7 @@ void DialogIncrements::OpenTable()
|
|||
emit DialogClosed(QDialog::Rejected);
|
||||
return;
|
||||
}
|
||||
Valentina::Units mUnit = m1->Unit();
|
||||
Unit mUnit = m1->MUnit();
|
||||
if (qApp->patternUnit() != mUnit)
|
||||
{
|
||||
QMessageBox::critical(this, tr("Wrong units."), text);
|
||||
|
@ -551,7 +549,7 @@ void DialogIncrements::OpenTable()
|
|||
|
||||
m1 = new VStandardMeasurements(data);
|
||||
m1->setContent(filePath);
|
||||
Valentina::Units mUnit = m1->Unit();
|
||||
Unit mUnit = m1->MUnit();
|
||||
if (qApp->patternUnit() != mUnit)
|
||||
{
|
||||
QMessageBox::critical(this, tr("Wrong units."), text);
|
||||
|
|
|
@ -30,8 +30,9 @@
|
|||
#define DIALOGINCREMENTS_H
|
||||
|
||||
#include "../tools/dialogtool.h"
|
||||
#include "../../xml/vpattern.h"
|
||||
#include "../../xml/vindividualmeasurements.h"
|
||||
|
||||
class VPattern;
|
||||
class VIndividualMeasurements;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
|
|
|
@ -28,13 +28,11 @@
|
|||
|
||||
#include "dialogindividualmeasurements.h"
|
||||
#include "ui_dialogindividualmeasurements.h"
|
||||
#include <QButtonGroup>
|
||||
#include "../../xml/vindividualmeasurements.h"
|
||||
#include <QSettings>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include "../../widgets/vapplication.h"
|
||||
#include <QPushButton>
|
||||
#include "../../container/vcontainer.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogIndividualMeasurements::DialogIndividualMeasurements(VContainer *data, const QString &patternPieceName,
|
||||
|
@ -105,9 +103,9 @@ void DialogIndividualMeasurements::DialogAccepted()
|
|||
VIndividualMeasurements m(data);
|
||||
m.setContent(_tablePath);
|
||||
const qint32 index = ui->comboBoxUnits->currentIndex();
|
||||
Valentina::Units unit = VDomDocument::StrToUnits(ui->comboBoxUnits->itemData(index).toString());
|
||||
Unit unit = VDomDocument::StrToUnits(ui->comboBoxUnits->itemData(index).toString());
|
||||
m.setUnit(unit);
|
||||
qApp->setPatternUnit( m.Unit());
|
||||
qApp->setPatternUnit( m.MUnit());
|
||||
QFile iMeasur(_tablePath);
|
||||
if (iMeasur.open(QIODevice::WriteOnly| QIODevice::Truncate))
|
||||
{
|
||||
|
@ -238,6 +236,6 @@ void DialogIndividualMeasurements::NewTable()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogIndividualMeasurements::InitUnits()
|
||||
{
|
||||
ui->comboBoxUnits->addItem(tr("centimeter"), QVariant(VDomDocument::UnitsToStr(Valentina::Cm)));
|
||||
ui->comboBoxUnits->addItem(tr("inch"), QVariant(VDomDocument::UnitsToStr(Valentina::Inch)));
|
||||
ui->comboBoxUnits->addItem(tr("centimeter"), QVariant(VDomDocument::UnitsToStr(Unit::Cm)));
|
||||
ui->comboBoxUnits->addItem(tr("inch"), QVariant(VDomDocument::UnitsToStr(Unit::Inch)));
|
||||
}
|
||||
|
|
|
@ -30,7 +30,8 @@
|
|||
#define DIALOGINDIVIDUALMEASUREMENTS_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "../../container/vcontainer.h"
|
||||
|
||||
class VContainer;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogMeasurements::DialogMeasurements(QWidget *parent) :
|
||||
QDialog(parent), ui(new Ui::DialogMeasurements), result(Measurements::Individual)
|
||||
QDialog(parent), ui(new Ui::DialogMeasurements), result(MeasurementsType::Individual)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
connect(ui->toolButtonStandard, &QToolButton::clicked, this, &DialogMeasurements::StandardMeasurements);
|
||||
|
@ -45,7 +45,7 @@ DialogMeasurements::~DialogMeasurements()
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
Measurements::Type DialogMeasurements::type() const
|
||||
MeasurementsType DialogMeasurements::type() const
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
@ -53,13 +53,13 @@ Measurements::Type DialogMeasurements::type() const
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogMeasurements::StandardMeasurements()
|
||||
{
|
||||
result = Measurements::Standard;
|
||||
result = MeasurementsType::Standard;
|
||||
accept();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogMeasurements::IndividualMeasurements()
|
||||
{
|
||||
result = Measurements::Individual;
|
||||
result = MeasurementsType::Individual;
|
||||
accept();
|
||||
}
|
||||
|
|
|
@ -30,33 +30,24 @@
|
|||
#define DIALOGMEASUREMENTS_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "../../options.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class DialogMeasurements;
|
||||
}
|
||||
|
||||
namespace Measurements
|
||||
{
|
||||
/**
|
||||
* @brief The Type enum pattern measurements.
|
||||
*/
|
||||
enum Type { Standard, Individual };
|
||||
Q_DECLARE_FLAGS(Types, Type)
|
||||
}
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS( Measurements::Types )
|
||||
|
||||
class DialogMeasurements : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DialogMeasurements(QWidget *parent = nullptr);
|
||||
~DialogMeasurements();
|
||||
Measurements::Type type() const;
|
||||
MeasurementsType type() const;
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogMeasurements)
|
||||
Ui::DialogMeasurements *ui;
|
||||
Measurements::Type result;
|
||||
MeasurementsType result;
|
||||
void StandardMeasurements();
|
||||
void IndividualMeasurements();
|
||||
};
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "dialogpatternproperties.h"
|
||||
#include "ui_dialogpatternproperties.h"
|
||||
#include <QSettings>
|
||||
#include <QPushButton>
|
||||
#include "../../xml/vpattern.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogPatternProperties::DialogPatternProperties(VPattern *doc, QWidget *parent) :
|
||||
|
|
|
@ -30,7 +30,8 @@
|
|||
#define DIALOGPATTERNPROPERTIES_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "../../xml/vpattern.h"
|
||||
|
||||
class VPattern;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
|
|
|
@ -563,7 +563,7 @@ void DialogPatternXmlEdit::ButtonApplyChangesClicked()
|
|||
QMessageBox::warning(this, "Error in changes", message);
|
||||
return;
|
||||
}
|
||||
this->doc->FullUpdateTree();
|
||||
this->doc->LiteParseTree();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include <QDir>
|
||||
#include "../../xml/vstandardmeasurements.h"
|
||||
#include "../../widgets/vapplication.h"
|
||||
#include <QPushButton>
|
||||
#include "../../container/vcontainer.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogStandardMeasurements::DialogStandardMeasurements(VContainer *data, const QString &patternPieceName,
|
||||
|
@ -89,7 +89,7 @@ void DialogStandardMeasurements::DialogAccepted()
|
|||
VDomDocument::ValidateXML("://schema/standard_measurements.xsd", _tablePath);
|
||||
VStandardMeasurements m(data);
|
||||
m.setContent(_tablePath);
|
||||
qApp->setPatternUnit(m.Unit());
|
||||
qApp->setPatternUnit(m.MUnit());
|
||||
}
|
||||
catch (VException &e)
|
||||
{
|
||||
|
|
|
@ -30,7 +30,8 @@
|
|||
#define DIALOGSTANDARDMEASUREMENTS_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "../../container/vcontainer.h"
|
||||
|
||||
class VContainer;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "pages.h"
|
||||
#include "../../options.h"
|
||||
#include "../../widgets/vapplication.h"
|
||||
#include "../../widgets/vmaingraphicsview.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
ConfigurationPage::ConfigurationPage(QWidget *parent):
|
||||
|
@ -51,7 +52,21 @@ void ConfigurationPage::Apply()
|
|||
QApplication::applicationName());
|
||||
settings.setValue("configuration/autosave/state", autoSaveCheck->isChecked());
|
||||
settings.setValue("configuration/autosave/time", autoTime->value());
|
||||
|
||||
QTimer *autoSaveTimer = qApp->getAutoSaveTimer();
|
||||
SCASSERT(autoSaveTimer);
|
||||
|
||||
if (autoSaveCheck->isChecked())
|
||||
{
|
||||
autoSaveTimer->start(autoTime->value()*60000);
|
||||
}
|
||||
else
|
||||
{
|
||||
autoSaveTimer->stop();
|
||||
}
|
||||
|
||||
settings.setValue("configuration/osSeparator", osOptionCheck->isChecked());
|
||||
|
||||
if (langChanged)
|
||||
{
|
||||
QString locale = qvariant_cast<QString>(langCombo->itemData(langCombo->currentIndex()));
|
||||
|
@ -128,7 +143,7 @@ QGroupBox *ConfigurationPage::LangGroup()
|
|||
{
|
||||
// get locale extracted by filename
|
||||
QString locale;
|
||||
locale = fileNames[i]; // "valentina_de.qm"
|
||||
locale = fileNames.at(i); // "valentina_de.qm"
|
||||
locale.truncate(locale.lastIndexOf('.')); // "valentina_de"
|
||||
locale.remove(0, locale.indexOf('_') + 1); // "de"
|
||||
|
||||
|
@ -174,16 +189,16 @@ QGroupBox *ConfigurationPage::LangGroup()
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
PatternPage::PatternPage(QWidget *parent):
|
||||
QWidget(parent), userName(0), graphOutputCheck(0), undoneCount(0)
|
||||
QWidget(parent), userName(0), graphOutputCheck(0), undoCount(0)
|
||||
{
|
||||
QGroupBox *userGroup = UserGroup();
|
||||
QGroupBox *graphOutputGroup = GraphOutputGroup();
|
||||
QGroupBox *undoneGroup = UndoneGroup();
|
||||
QGroupBox *undoGroup = UndoGroup();
|
||||
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||
mainLayout->addWidget(userGroup);
|
||||
mainLayout->addWidget(graphOutputGroup);
|
||||
mainLayout->addWidget(undoneGroup);
|
||||
mainLayout->addWidget(undoGroup);
|
||||
mainLayout->addStretch(1);
|
||||
setLayout(mainLayout);
|
||||
}
|
||||
|
@ -194,8 +209,16 @@ void PatternPage::Apply()
|
|||
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
||||
QApplication::applicationName());
|
||||
settings.setValue("pattern/user", userName->text());
|
||||
//settings.setValue("pattern/graphicalOutput", graphOutputCheck->isChecked());
|
||||
settings.setValue("pattern/undone", undoneCount->value());
|
||||
|
||||
// Scene antialiasing
|
||||
settings.setValue("pattern/graphicalOutput", graphOutputCheck->isChecked());
|
||||
qApp->getSceneView()->setRenderHint(QPainter::Antialiasing, graphOutputCheck->isChecked());
|
||||
qApp->getSceneView()->setRenderHint(QPainter::SmoothPixmapTransform, graphOutputCheck->isChecked());
|
||||
|
||||
/* Maximum number of commands in undo stack may only be set when the undo stack is empty, since setting it on a
|
||||
* non-empty stack might delete the command at the current index. Calling setUndoLimit() on a non-empty stack
|
||||
* prints a warning and does nothing.*/
|
||||
settings.setValue("pattern/undo", undoCount->value());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -228,15 +251,14 @@ QGroupBox *PatternPage::UserGroup()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QGroupBox *PatternPage::GraphOutputGroup()
|
||||
{
|
||||
// QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
||||
// QApplication::applicationName());
|
||||
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
||||
QApplication::applicationName());
|
||||
|
||||
QGroupBox *graphOutputGroup = new QGroupBox(tr("Graphical output"));
|
||||
|
||||
graphOutputCheck = new QCheckBox(tr("Use antialiasing"));
|
||||
//bool graphOutputValue = settings.value("pattern/graphicalOutput", 1).toBool();
|
||||
//graphOutputCheck->setChecked(graphOutputValue);
|
||||
graphOutputCheck->setEnabled(false);
|
||||
bool graphOutputValue = settings.value("pattern/graphicalOutput", 1).toBool();
|
||||
graphOutputCheck->setChecked(graphOutputValue);
|
||||
|
||||
QHBoxLayout *graphLayout = new QHBoxLayout;
|
||||
graphLayout->addWidget(graphOutputCheck);
|
||||
|
@ -248,29 +270,29 @@ QGroupBox *PatternPage::GraphOutputGroup()
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QGroupBox *PatternPage::UndoneGroup()
|
||||
QGroupBox *PatternPage::UndoGroup()
|
||||
{
|
||||
// QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
||||
// QApplication::applicationName());
|
||||
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
||||
QApplication::applicationName());
|
||||
|
||||
QGroupBox *undoneGroup = new QGroupBox(tr("Undone"));
|
||||
QLabel *undoneLabel = new QLabel(tr("Count steps"));
|
||||
undoneCount = new QSpinBox;
|
||||
// bool ok = true;
|
||||
// qint32 count = settings.value("pattern/undone", 100).toInt(&ok);
|
||||
// if (ok == false)
|
||||
// {
|
||||
// count = 100;
|
||||
// }
|
||||
// undoneCount->setValue(count);
|
||||
undoneCount->setEnabled(false);
|
||||
QGroupBox *undoGroup = new QGroupBox(tr("Undo"));
|
||||
QLabel *undoLabel = new QLabel(tr("Count steps (0 - no limit)"));
|
||||
undoCount = new QSpinBox;
|
||||
undoCount->setMinimum(0);
|
||||
bool ok = true;
|
||||
qint32 count = settings.value("pattern/undo", 0).toInt(&ok);
|
||||
if (ok == false)
|
||||
{
|
||||
count = 0;
|
||||
}
|
||||
undoCount->setValue(count);
|
||||
|
||||
QHBoxLayout *countLayout = new QHBoxLayout;
|
||||
countLayout->addWidget(undoneLabel);
|
||||
countLayout->addWidget(undoneCount);
|
||||
countLayout->addWidget(undoLabel);
|
||||
countLayout->addWidget(undoCount);
|
||||
|
||||
QVBoxLayout *undoneLayout = new QVBoxLayout;
|
||||
undoneLayout->addLayout(countLayout);
|
||||
undoneGroup->setLayout(undoneLayout);
|
||||
return undoneGroup;
|
||||
QVBoxLayout *undoLayout = new QVBoxLayout;
|
||||
undoLayout->addLayout(countLayout);
|
||||
undoGroup->setLayout(undoLayout);
|
||||
return undoGroup;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,13 @@
|
|||
#ifndef PAGES_H
|
||||
#define PAGES_H
|
||||
|
||||
#include <QtWidgets>
|
||||
#include <QObject>
|
||||
|
||||
class QCheckBox;
|
||||
class QSpinBox;
|
||||
class QComboBox;
|
||||
class QGroupBox;
|
||||
class QLineEdit;
|
||||
|
||||
class ConfigurationPage : public QWidget
|
||||
{
|
||||
|
@ -60,10 +66,10 @@ private:
|
|||
Q_DISABLE_COPY(PatternPage)
|
||||
QLineEdit *userName;
|
||||
QCheckBox *graphOutputCheck;
|
||||
QSpinBox *undoneCount;
|
||||
QSpinBox *undoCount;
|
||||
QGroupBox *UserGroup();
|
||||
QGroupBox *GraphOutputGroup();
|
||||
QGroupBox *UndoneGroup();
|
||||
QGroupBox *UndoGroup();
|
||||
};
|
||||
|
||||
#endif // PAGES_H
|
||||
|
|
|
@ -108,9 +108,9 @@ DialogAlongLine::~DialogAlongLine()
|
|||
* @param id id of point or detail
|
||||
* @param type type of object
|
||||
*/
|
||||
void DialogAlongLine::ChoosedObject(quint32 id, const Valentina::Scenes &type)
|
||||
void DialogAlongLine::ChoosedObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (type == Valentina::Point)
|
||||
if (type == SceneObject::Point)
|
||||
{
|
||||
if (number == 0)
|
||||
{
|
||||
|
|
|
@ -61,7 +61,7 @@ public:
|
|||
quint32 getSecondPointId() const;
|
||||
void setSecondPointId(const quint32 &value, const quint32 &id);
|
||||
public slots:
|
||||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void ChoosedObject(quint32 id, const SceneObject &type);
|
||||
virtual void DialogAccepted();
|
||||
/**
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
|
|
|
@ -30,7 +30,9 @@
|
|||
#include "ui_dialogarc.h"
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QtWidgets>
|
||||
|
||||
#include "../../geometry/vpointf.h"
|
||||
#include "../../container/vcontainer.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
@ -161,9 +163,9 @@ void DialogArc::SetRadius(const QString &value)
|
|||
* @param id id of point or detail
|
||||
* @param type type of object
|
||||
*/
|
||||
void DialogArc::ChoosedObject(quint32 id, const Valentina::Scenes &type)
|
||||
void DialogArc::ChoosedObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (type == Valentina::Point)
|
||||
if (type == SceneObject::Point)
|
||||
{
|
||||
const VPointF *point = data->GeometricObject<const VPointF *>(id);
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ public:
|
|||
QString GetF2() const;
|
||||
void SetF2(const QString &value);
|
||||
public slots:
|
||||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void ChoosedObject(quint32 id, const SceneObject &type);
|
||||
virtual void DialogAccepted();
|
||||
/** TODO ISSUE 79 : create real function
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
|
|
|
@ -29,7 +29,8 @@
|
|||
#include "dialogbisector.h"
|
||||
#include "ui_dialogbisector.h"
|
||||
|
||||
#include <QPushButton>
|
||||
#include "../../geometry/vpointf.h"
|
||||
#include "../../container/vcontainer.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
@ -109,9 +110,9 @@ DialogBisector::~DialogBisector()
|
|||
* @param id id of point or detail
|
||||
* @param type type of object
|
||||
*/
|
||||
void DialogBisector::ChoosedObject(quint32 id, const Valentina::Scenes &type)
|
||||
void DialogBisector::ChoosedObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (type == Valentina::Point)
|
||||
if (type == SceneObject::Point)
|
||||
{
|
||||
const VPointF *point = data->GeometricObject<const VPointF *>(id);
|
||||
if (number == 0)
|
||||
|
|
|
@ -66,7 +66,7 @@ public:
|
|||
quint32 getThirdPointId() const;
|
||||
void setThirdPointId(const quint32 &value, const quint32 &id);
|
||||
public slots:
|
||||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void ChoosedObject(quint32 id, const SceneObject &type);
|
||||
virtual void DialogAccepted();
|
||||
/**
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
#include "dialogcutarc.h"
|
||||
#include "ui_dialogcutarc.h"
|
||||
|
||||
#include "../../geometry/varc.h"
|
||||
#include "../../container/vcontainer.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief DialogCutArc create dialog.
|
||||
|
@ -103,9 +106,9 @@ DialogCutArc::~DialogCutArc()
|
|||
* @param id id of point or detail
|
||||
* @param type type of object
|
||||
*/
|
||||
void DialogCutArc::ChoosedObject(quint32 id, const Valentina::Scenes &type)
|
||||
void DialogCutArc::ChoosedObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (type == Valentina::Arc)
|
||||
if (type == SceneObject::Arc)
|
||||
{
|
||||
const VArc *arc = data->GeometricObject<const VArc *>(id);
|
||||
ChangeCurrentText(ui->comboBoxArc, arc->name());
|
||||
|
@ -147,7 +150,7 @@ void DialogCutArc::SaveData()
|
|||
*/
|
||||
void DialogCutArc::setArcId(const quint32 &value, const quint32 &id)
|
||||
{
|
||||
setCurrentArcId(ui->comboBoxArc, arcId, value, id, ComboMode::CutArc);
|
||||
setCurrentArcId(ui->comboBoxArc, arcId, value, id, ComboBoxCutArc::CutArc);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
quint32 getArcId() const;
|
||||
void setArcId(const quint32 &value, const quint32 &id);
|
||||
public slots:
|
||||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void ChoosedObject(quint32 id, const SceneObject &type);
|
||||
virtual void DialogAccepted();
|
||||
/**
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
#include "dialogcutspline.h"
|
||||
#include "ui_dialogcutspline.h"
|
||||
|
||||
#include "../../geometry/vspline.h"
|
||||
#include "../../container/vcontainer.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief DialogCutSpline create dialog.
|
||||
|
@ -95,7 +98,7 @@ void DialogCutSpline::setFormula(const QString &value)
|
|||
*/
|
||||
void DialogCutSpline::setSplineId(const quint32 &value, const quint32 &id)
|
||||
{
|
||||
setCurrentSplineId(ui->comboBoxSpline, splineId, value, id, ComboMode::CutSpline);
|
||||
setCurrentSplineId(ui->comboBoxSpline, splineId, value, id, ComboBoxCutSpline::CutSpline);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -104,9 +107,9 @@ void DialogCutSpline::setSplineId(const quint32 &value, const quint32 &id)
|
|||
* @param id id of point or detail
|
||||
* @param type type of object
|
||||
*/
|
||||
void DialogCutSpline::ChoosedObject(quint32 id, const Valentina::Scenes &type)
|
||||
void DialogCutSpline::ChoosedObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (type == Valentina::Spline)
|
||||
if (type == SceneObject::Spline)
|
||||
{
|
||||
const VSpline *spl = data->GeometricObject<const VSpline *>(id);
|
||||
ChangeCurrentText(ui->comboBoxSpline, spl->name());
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
quint32 getSplineId() const;
|
||||
void setSplineId(const quint32 &value, const quint32 &id);
|
||||
public slots:
|
||||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void ChoosedObject(quint32 id, const SceneObject &type);
|
||||
virtual void DialogAccepted();
|
||||
/** TODO ISSUE 79 : create real function
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
#include "dialogcutsplinepath.h"
|
||||
#include "ui_dialogcutsplinepath.h"
|
||||
|
||||
#include "../../geometry/vsplinepath.h"
|
||||
#include "../../container/vcontainer.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief DialogCutSplinePath create dialog.
|
||||
|
@ -96,7 +99,7 @@ void DialogCutSplinePath::setFormula(const QString &value)
|
|||
*/
|
||||
void DialogCutSplinePath::setSplinePathId(const quint32 &value, const quint32 &id)
|
||||
{
|
||||
setCurrentSplinePathId(ui->comboBoxSplinePath, splinePathId, value, id, ComboMode::CutSpline);
|
||||
setCurrentSplinePathId(ui->comboBoxSplinePath, splinePathId, value, id, ComboBoxCutSpline::CutSpline);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -105,9 +108,9 @@ void DialogCutSplinePath::setSplinePathId(const quint32 &value, const quint32 &i
|
|||
* @param id id of point or detail
|
||||
* @param type type of object
|
||||
*/
|
||||
void DialogCutSplinePath::ChoosedObject(quint32 id, const Valentina::Scenes &type)
|
||||
void DialogCutSplinePath::ChoosedObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (type == Valentina::SplinePath)
|
||||
if (type == SceneObject::SplinePath)
|
||||
{
|
||||
const VSplinePath *splPath = data->GeometricObject<const VSplinePath *>(id);
|
||||
ChangeCurrentText(ui->comboBoxSplinePath, splPath->name());
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
quint32 getSplinePathId() const;
|
||||
void setSplinePathId(const quint32 &value, const quint32 &id);
|
||||
public slots:
|
||||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void ChoosedObject(quint32 id, const SceneObject &type);
|
||||
virtual void DialogAccepted();
|
||||
/** TODO ISSUE 79 : create real function
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
|
|
|
@ -28,9 +28,14 @@
|
|||
|
||||
#include "dialogdetail.h"
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QDebug>
|
||||
|
||||
#include "../../geometry/varc.h"
|
||||
#include "../../geometry/vpointf.h"
|
||||
#include "../../geometry/vsplinepath.h"
|
||||
#include "../../container/vcontainer.h"
|
||||
#include "../../xml/vdomdocument.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief DialogDetail create dialog
|
||||
|
@ -42,6 +47,9 @@ DialogDetail::DialogDetail(const VContainer *data, QWidget *parent)
|
|||
{
|
||||
ui.setupUi(this);
|
||||
labelEditNamePoint = ui.labelEditNameDetail;
|
||||
ui.labelUnit->setText( VDomDocument::UnitsToStr(qApp->patternUnit(), true));
|
||||
ui.labelUnitX->setText(VDomDocument::UnitsToStr(qApp->patternUnit(), true));
|
||||
ui.labelUnitY->setText(VDomDocument::UnitsToStr(qApp->patternUnit(), true));
|
||||
|
||||
bOk = ui.buttonBox->button(QDialogButtonBox::Ok);
|
||||
SCASSERT(bOk != nullptr);
|
||||
|
@ -57,9 +65,9 @@ DialogDetail::DialogDetail(const VContainer *data, QWidget *parent)
|
|||
CheckState();
|
||||
|
||||
connect(ui.listWidget, &QListWidget::currentRowChanged, this, &DialogDetail::ObjectChanged);
|
||||
connect(ui.spinBoxBiasX, static_cast<void (QSpinBox::*)(qint32)>(&QSpinBox::valueChanged),
|
||||
connect(ui.doubleSpinBoxBiasX, static_cast<void (QDoubleSpinBox::*)(qreal)>(&QDoubleSpinBox::valueChanged),
|
||||
this, &DialogDetail::BiasXChanged);
|
||||
connect(ui.spinBoxBiasY, static_cast<void (QSpinBox::*)(qint32)>(&QSpinBox::valueChanged),
|
||||
connect(ui.doubleSpinBoxBiasY, static_cast<void (QDoubleSpinBox::*)(qreal)>(&QDoubleSpinBox::valueChanged),
|
||||
this, &DialogDetail::BiasYChanged);
|
||||
connect(ui.checkBoxSeams, &QCheckBox::clicked, this, &DialogDetail::ClickedSeams);
|
||||
connect(ui.checkBoxClosed, &QCheckBox::clicked, this, &DialogDetail::ClickedClosed);
|
||||
|
@ -74,24 +82,26 @@ DialogDetail::DialogDetail(const VContainer *data, QWidget *parent)
|
|||
* @param id id of objects (points, arcs, splines, spline paths)
|
||||
* @param type type of object
|
||||
*/
|
||||
void DialogDetail::ChoosedObject(quint32 id, const Valentina::Scenes &type)
|
||||
void DialogDetail::ChoosedObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (type != Valentina::Line && type != Valentina::Detail)
|
||||
if (type != SceneObject::Line && type != SceneObject::Detail)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case (Valentina::Arc):
|
||||
NewItem(id, Valentina::NodeArc, NodeDetail::Contour);
|
||||
case (SceneObject::Arc):
|
||||
NewItem(id, Tool::NodeArc, NodeDetail::Contour);
|
||||
break;
|
||||
case (Valentina::Point):
|
||||
NewItem(id, Valentina::NodePoint, NodeDetail::Contour);
|
||||
case (SceneObject::Point):
|
||||
NewItem(id, Tool::NodePoint, NodeDetail::Contour);
|
||||
break;
|
||||
case (Valentina::Spline):
|
||||
NewItem(id, Valentina::NodeSpline, NodeDetail::Contour);
|
||||
case (SceneObject::Spline):
|
||||
NewItem(id, Tool::NodeSpline, NodeDetail::Contour);
|
||||
break;
|
||||
case (Valentina::SplinePath):
|
||||
NewItem(id, Valentina::NodeSplinePath, NodeDetail::Contour);
|
||||
case (SceneObject::SplinePath):
|
||||
NewItem(id, Tool::NodeSplinePath, NodeDetail::Contour);
|
||||
break;
|
||||
case (SceneObject::Line):
|
||||
case (SceneObject::Detail):
|
||||
default:
|
||||
qDebug()<<tr("Got wrong scene object. Ignore.");
|
||||
break;
|
||||
|
@ -113,7 +123,7 @@ void DialogDetail::DialogAccepted()
|
|||
QListWidgetItem *item = ui.listWidget->item(i);
|
||||
details.append( qvariant_cast<VNodeDetail>(item->data(Qt::UserRole)));
|
||||
}
|
||||
details.setWidth(ui.spinBoxSeams->value());
|
||||
details.setWidth(ui.doubleSpinBoxSeams->value());
|
||||
details.setName(ui.lineEditNameDetail->text());
|
||||
details.setSeamAllowance(supplement);
|
||||
details.setClosed(closed);
|
||||
|
@ -130,36 +140,57 @@ void DialogDetail::DialogAccepted()
|
|||
* @param mx offset respect to x
|
||||
* @param my offset respect to y
|
||||
*/
|
||||
void DialogDetail::NewItem(quint32 id, const Valentina::Tools &typeTool, const NodeDetail::NodeDetails &typeNode,
|
||||
void DialogDetail::NewItem(quint32 id, const Tool &typeTool, const NodeDetail &typeNode,
|
||||
qreal mx, qreal my)
|
||||
{
|
||||
QString name;
|
||||
switch (typeTool)
|
||||
{
|
||||
case (Valentina::NodePoint):
|
||||
case (Tool::NodePoint):
|
||||
{
|
||||
const VPointF *point = data->GeometricObject<const VPointF *>(id);
|
||||
name = point->name();
|
||||
break;
|
||||
}
|
||||
case (Valentina::NodeArc):
|
||||
case (Tool::NodeArc):
|
||||
{
|
||||
const VArc *arc = data->GeometricObject<const VArc *>(id);
|
||||
name = arc->name();
|
||||
break;
|
||||
}
|
||||
case (Valentina::NodeSpline):
|
||||
case (Tool::NodeSpline):
|
||||
{
|
||||
const VSpline *spl = data->GeometricObject<const VSpline *>(id);
|
||||
name = spl->name();
|
||||
break;
|
||||
}
|
||||
case (Valentina::NodeSplinePath):
|
||||
case (Tool::NodeSplinePath):
|
||||
{
|
||||
const VSplinePath *splPath = data->GeometricObject<const VSplinePath *>(id);
|
||||
name = splPath->name();
|
||||
break;
|
||||
}
|
||||
case (Tool::ArrowTool):
|
||||
case (Tool::SinglePointTool):
|
||||
case (Tool::EndLineTool):
|
||||
case (Tool::LineTool):
|
||||
case (Tool::AlongLineTool):
|
||||
case (Tool::ShoulderPointTool):
|
||||
case (Tool::NormalTool):
|
||||
case (Tool::BisectorTool):
|
||||
case (Tool::LineIntersectTool):
|
||||
case (Tool::SplineTool):
|
||||
case (Tool::CutSplineTool):
|
||||
case (Tool::CutArcTool):
|
||||
case (Tool::ArcTool):
|
||||
case (Tool::SplinePathTool):
|
||||
case (Tool::CutSplinePathTool):
|
||||
case (Tool::PointOfContact):
|
||||
case (Tool::DetailTool):
|
||||
case (Tool::Height):
|
||||
case (Tool::Triangle):
|
||||
case (Tool::PointOfIntersection):
|
||||
case (Tool::UnionDetails):
|
||||
default:
|
||||
qDebug()<<"Got wrong tools. Ignore.";
|
||||
break;
|
||||
|
@ -171,15 +202,15 @@ void DialogDetail::NewItem(quint32 id, const Valentina::Tools &typeTool, const N
|
|||
item->setData(Qt::UserRole, QVariant::fromValue(node));
|
||||
ui.listWidget->addItem(item);
|
||||
ui.listWidget->setCurrentRow(ui.listWidget->count()-1);
|
||||
disconnect(ui.spinBoxBiasX, static_cast<void (QSpinBox::*)(qint32)>(&QSpinBox::valueChanged),
|
||||
disconnect(ui.doubleSpinBoxBiasX, static_cast<void (QDoubleSpinBox::*)(qreal)>(&QDoubleSpinBox::valueChanged),
|
||||
this, &DialogDetail::BiasXChanged);
|
||||
disconnect(ui.spinBoxBiasY, static_cast<void (QSpinBox::*)(qint32)>(&QSpinBox::valueChanged),
|
||||
disconnect(ui.doubleSpinBoxBiasY, static_cast<void (QDoubleSpinBox::*)(qreal)>(&QDoubleSpinBox::valueChanged),
|
||||
this, &DialogDetail::BiasYChanged);
|
||||
ui.spinBoxBiasX->setValue(static_cast<qint32>(qApp->fromPixel(node.getMx())));
|
||||
ui.spinBoxBiasY->setValue(static_cast<qint32>(qApp->fromPixel(node.getMy())));
|
||||
connect(ui.spinBoxBiasX, static_cast<void (QSpinBox::*)(qint32)>(&QSpinBox::valueChanged),
|
||||
ui.doubleSpinBoxBiasX->setValue(qApp->fromPixel(node.getMx()));
|
||||
ui.doubleSpinBoxBiasY->setValue(qApp->fromPixel(node.getMy()));
|
||||
connect(ui.doubleSpinBoxBiasX, static_cast<void (QDoubleSpinBox::*)(qreal)>(&QDoubleSpinBox::valueChanged),
|
||||
this, &DialogDetail::BiasXChanged);
|
||||
connect(ui.spinBoxBiasY, static_cast<void (QSpinBox::*)(qint32)>(&QSpinBox::valueChanged),
|
||||
connect(ui.doubleSpinBoxBiasY, static_cast<void (QDoubleSpinBox::*)(qreal)>(&QDoubleSpinBox::valueChanged),
|
||||
this, &DialogDetail::BiasYChanged);
|
||||
}
|
||||
|
||||
|
@ -194,15 +225,15 @@ void DialogDetail::setDetails(const VDetail &value)
|
|||
ui.listWidget->clear();
|
||||
for (ptrdiff_t i = 0; i < details.CountNode(); ++i)
|
||||
{
|
||||
NewItem(details[i].getId(), details[i].getTypeTool(), details[i].getTypeNode(), details[i].getMx(),
|
||||
details[i].getMy());
|
||||
NewItem(details.at(i).getId(), details.at(i).getTypeTool(), details.at(i).getTypeNode(), details.at(i).getMx(),
|
||||
details.at(i).getMy());
|
||||
}
|
||||
ui.lineEditNameDetail->setText(details.getName());
|
||||
ui.checkBoxSeams->setChecked(details.getSeamAllowance());
|
||||
ui.checkBoxClosed->setChecked(details.getClosed());
|
||||
ClickedClosed(details.getClosed());
|
||||
ClickedSeams(details.getSeamAllowance());
|
||||
ui.spinBoxSeams->setValue(static_cast<qint32>(details.getWidth()));
|
||||
ui.doubleSpinBoxSeams->setValue(details.getWidth());
|
||||
ui.listWidget->setCurrentRow(0);
|
||||
ui.listWidget->setFocus(Qt::OtherFocusReason);
|
||||
ui.toolButtonDelete->setEnabled(true);
|
||||
|
@ -247,7 +278,7 @@ void DialogDetail::ClickedSeams(bool checked)
|
|||
{
|
||||
supplement = checked;
|
||||
ui.checkBoxClosed->setEnabled(checked);
|
||||
ui.spinBoxSeams->setEnabled(checked);
|
||||
ui.doubleSpinBoxSeams->setEnabled(checked);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -273,8 +304,8 @@ void DialogDetail::ObjectChanged(int row)
|
|||
}
|
||||
QListWidgetItem *item = ui.listWidget->item( row );
|
||||
VNodeDetail node = qvariant_cast<VNodeDetail>(item->data(Qt::UserRole));
|
||||
ui.spinBoxBiasX->setValue(static_cast<qint32>(qApp->fromPixel(node.getMx())));
|
||||
ui.spinBoxBiasY->setValue(static_cast<qint32>(qApp->fromPixel(node.getMy())));
|
||||
ui.doubleSpinBoxBiasX->setValue(qApp->fromPixel(node.getMx()));
|
||||
ui.doubleSpinBoxBiasY->setValue(qApp->fromPixel(node.getMy()));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include "ui_dialogdetail.h"
|
||||
#include "dialogtool.h"
|
||||
#include "../../geometry/vdetail.h"
|
||||
|
||||
/**
|
||||
* @brief The DialogDetail class dialog for ToolDetai. Help create detail and edit option.
|
||||
|
@ -44,7 +45,7 @@ public:
|
|||
VDetail getDetails() const;
|
||||
void setDetails(const VDetail &value);
|
||||
public slots:
|
||||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void ChoosedObject(quint32 id, const SceneObject &type);
|
||||
virtual void DialogAccepted();
|
||||
/** TODO ISSUE 79 : create real function
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
|
@ -70,7 +71,7 @@ private:
|
|||
/** @brief closed keep option about equdistant (closed or not) */
|
||||
bool closed;
|
||||
|
||||
void NewItem(quint32 id, const Valentina::Tools &typeTool, const NodeDetail::NodeDetails &typeNode,
|
||||
void NewItem(quint32 id, const Tool &typeTool, const NodeDetail &typeNode,
|
||||
qreal mx = 0, qreal my = 0);
|
||||
};
|
||||
|
||||
|
|
|
@ -41,18 +41,37 @@
|
|||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Bias X</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBoxBiasX">
|
||||
<property name="minimum">
|
||||
<number>-3000</number>
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBoxBiasX">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>3000</number>
|
||||
<double>900.990000000000009</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelUnitX">
|
||||
<property name="text">
|
||||
<string>cm</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -64,7 +83,7 @@
|
|||
<widget class="QLabel" name="label_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
|
@ -74,12 +93,25 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBoxBiasY">
|
||||
<property name="minimum">
|
||||
<number>-3000</number>
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBoxBiasY">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>3000</number>
|
||||
<double>900.990000000000009</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelUnitY">
|
||||
<property name="text">
|
||||
<string>cm</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -177,7 +209,7 @@
|
|||
<widget class="QLabel" name="labelEditWidth">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
|
@ -190,9 +222,31 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBoxSeams">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBoxSeams">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>3000</number>
|
||||
<double>900.990000000000009</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelUnit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>cm</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -29,8 +29,6 @@
|
|||
#include "dialogeditwrongformula.h"
|
||||
#include "ui_dialogeditwrongformula.h"
|
||||
|
||||
#include <container/calculator.h>
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogEditWrongFormula::DialogEditWrongFormula(const VContainer *data, QWidget *parent)
|
||||
:DialogTool(data, parent), ui(new Ui::DialogEditWrongFormula), formula(QString())
|
||||
|
|
|
@ -29,7 +29,8 @@
|
|||
#include "dialogendline.h"
|
||||
#include "ui_dialogendline.h"
|
||||
|
||||
#include <QPushButton>
|
||||
#include "../../geometry/vpointf.h"
|
||||
#include "../../container/vcontainer.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
@ -103,9 +104,9 @@ void DialogEndLine::DeployFormulaTextEdit()
|
|||
* @param id id of point or detail
|
||||
* @param type type of object
|
||||
*/
|
||||
void DialogEndLine::ChoosedObject(quint32 id, const Valentina::Scenes &type)
|
||||
void DialogEndLine::ChoosedObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (type == Valentina::Point)
|
||||
if (type == SceneObject::Point)
|
||||
{
|
||||
const VPointF *point = data->GeometricObject<const VPointF *>(id);
|
||||
ChangeCurrentText(ui->comboBoxBasePoint, point->name());
|
||||
|
|
|
@ -63,7 +63,7 @@ public:
|
|||
quint32 getBasePointId() const;
|
||||
void setBasePointId(const quint32 &value, const quint32 &id);
|
||||
public slots:
|
||||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void ChoosedObject(quint32 id, const SceneObject &type);
|
||||
virtual void DialogAccepted();
|
||||
/**
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
|
|
|
@ -29,7 +29,8 @@
|
|||
#include "dialogheight.h"
|
||||
#include "ui_dialogheight.h"
|
||||
|
||||
#include <QPushButton>
|
||||
#include "../../geometry/vpointf.h"
|
||||
#include "../../container/vcontainer.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
@ -124,9 +125,9 @@ void DialogHeight::setP2LineId(const quint32 &value, const quint32 &id)
|
|||
* @param id id of point or detail
|
||||
* @param type type of object
|
||||
*/
|
||||
void DialogHeight::ChoosedObject(quint32 id, const Valentina::Scenes &type)
|
||||
void DialogHeight::ChoosedObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (type == Valentina::Point)
|
||||
if (type == SceneObject::Point)
|
||||
{
|
||||
const VPointF *point = data->GeometricObject<const VPointF *>(id);
|
||||
switch (number)
|
||||
|
|
|
@ -61,7 +61,7 @@ public:
|
|||
quint32 getP2LineId() const;
|
||||
void setP2LineId(const quint32 &value, const quint32 &id);
|
||||
public slots:
|
||||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void ChoosedObject(quint32 id, const SceneObject &type);
|
||||
virtual void DialogAccepted();
|
||||
/** TODO ISSUE 79 : create real function
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
|
|
|
@ -29,7 +29,8 @@
|
|||
#include "dialogline.h"
|
||||
#include "ui_dialogline.h"
|
||||
|
||||
#include <QPushButton>
|
||||
#include "../../geometry/vpointf.h"
|
||||
#include "../../container/vcontainer.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
@ -119,9 +120,9 @@ void DialogLine::DialogAccepted()
|
|||
* @param id id of point or detail
|
||||
* @param type type of object
|
||||
*/
|
||||
void DialogLine::ChoosedObject(quint32 id, const Valentina::Scenes &type)
|
||||
void DialogLine::ChoosedObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (type == Valentina::Point)
|
||||
if (type == SceneObject::Point)
|
||||
{
|
||||
const VPointF *point = data->GeometricObject<const VPointF *>(id);
|
||||
if (number == 0)
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
QString getTypeLine() const;
|
||||
void setTypeLine(const QString &value);
|
||||
public slots:
|
||||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void ChoosedObject(quint32 id, const SceneObject &type);
|
||||
virtual void DialogAccepted();
|
||||
/** TODO ISSUE 79 : create real function
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
|
|
|
@ -29,7 +29,8 @@
|
|||
#include "dialoglineintersect.h"
|
||||
#include "ui_dialoglineintersect.h"
|
||||
|
||||
#include <QPushButton>
|
||||
#include "../../geometry/vpointf.h"
|
||||
#include "../../container/vcontainer.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
@ -67,9 +68,9 @@ DialogLineIntersect::~DialogLineIntersect()
|
|||
* @param id id of point or detail
|
||||
* @param type type of object
|
||||
*/
|
||||
void DialogLineIntersect::ChoosedObject(quint32 id, const Valentina::Scenes &type)
|
||||
void DialogLineIntersect::ChoosedObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (type == Valentina::Point)
|
||||
if (type == SceneObject::Point)
|
||||
{
|
||||
const VPointF *point = data->GeometricObject<const VPointF *>(id);
|
||||
if (number == 0)
|
||||
|
|
|
@ -61,7 +61,7 @@ public:
|
|||
QString getPointName() const;
|
||||
void setPointName(const QString &value);
|
||||
public slots:
|
||||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void ChoosedObject(quint32 id, const SceneObject &type);
|
||||
virtual void DialogAccepted();
|
||||
/** TODO ISSUE 79 : create real function
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
|
|
|
@ -29,8 +29,6 @@
|
|||
#include "dialognormal.h"
|
||||
#include "ui_dialognormal.h"
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief DialogNormal create dialog
|
||||
|
@ -107,9 +105,9 @@ DialogNormal::~DialogNormal()
|
|||
* @param id id of point or detail
|
||||
* @param type type of object
|
||||
*/
|
||||
void DialogNormal::ChoosedObject(quint32 id, const Valentina::Scenes &type)
|
||||
void DialogNormal::ChoosedObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (type == Valentina::Point)
|
||||
if (type == SceneObject::Point)
|
||||
{
|
||||
if (number == 0)
|
||||
{
|
||||
|
|
|
@ -65,7 +65,7 @@ public:
|
|||
quint32 getSecondPointId() const;
|
||||
void setSecondPointId(const quint32 &value, const quint32 &id);
|
||||
public slots:
|
||||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void ChoosedObject(quint32 id, const SceneObject &type);
|
||||
virtual void DialogAccepted();
|
||||
/**
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
|
|
|
@ -28,7 +28,8 @@
|
|||
|
||||
#include "dialogpointofcontact.h"
|
||||
|
||||
#include <QPushButton>
|
||||
#include "../../geometry/vpointf.h"
|
||||
#include "../../container/vcontainer.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
@ -77,7 +78,7 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, QWidget *pare
|
|||
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogPointOfContact::PutVal);
|
||||
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogPointOfContact::ValChenged);
|
||||
|
||||
if (qApp->patternType() == Pattern::Standard)
|
||||
if (qApp->patternType() == MeasurementsType::Standard)
|
||||
{
|
||||
SizeHeight();
|
||||
connect(ui->radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogTool::SizeHeight);
|
||||
|
@ -132,9 +133,9 @@ void DialogPointOfContact::DeployFormulaTextEdit()
|
|||
* @param id id of point or detail
|
||||
* @param type type of object
|
||||
*/
|
||||
void DialogPointOfContact::ChoosedObject(quint32 id, const Valentina::Scenes &type)
|
||||
void DialogPointOfContact::ChoosedObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (type == Valentina::Point)
|
||||
if (type == SceneObject::Point)
|
||||
{
|
||||
const VPointF *point = data->GeometricObject<const VPointF *>(id);
|
||||
if (number == 0)
|
||||
|
|
|
@ -61,7 +61,7 @@ public:
|
|||
quint32 getSecondPoint() const;
|
||||
void setSecondPoint(const quint32 &value, const quint32 &id);
|
||||
public slots:
|
||||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void ChoosedObject(quint32 id, const SceneObject &type);
|
||||
virtual void DialogAccepted();
|
||||
/**
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
|
|
|
@ -29,7 +29,8 @@
|
|||
#include "dialogpointofintersection.h"
|
||||
#include "ui_dialogpointofintersection.h"
|
||||
|
||||
#include <QPushButton>
|
||||
#include "../../geometry/vpointf.h"
|
||||
#include "../../container/vcontainer.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
@ -77,9 +78,9 @@ void DialogPointOfIntersection::setSecondPointId(const quint32 &value, const qui
|
|||
* @param id id of point or detail
|
||||
* @param type type of object
|
||||
*/
|
||||
void DialogPointOfIntersection::ChoosedObject(quint32 id, const Valentina::Scenes &type)
|
||||
void DialogPointOfIntersection::ChoosedObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (type == Valentina::Point)
|
||||
if (type == SceneObject::Point)
|
||||
{
|
||||
const VPointF *point = data->GeometricObject<const VPointF *>(id);
|
||||
if (number == 0)
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
quint32 getSecondPointId() const;
|
||||
void setSecondPointId(const quint32 &value, const quint32 &id);
|
||||
public slots:
|
||||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void ChoosedObject(quint32 id, const SceneObject &type);
|
||||
virtual void DialogAccepted();
|
||||
/** TODO ISSUE 79 : create real function
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
|
|
|
@ -29,7 +29,8 @@
|
|||
#include "dialogshoulderpoint.h"
|
||||
#include "ui_dialogshoulderpoint.h"
|
||||
|
||||
#include <QPushButton>
|
||||
#include "../../geometry/vpointf.h"
|
||||
#include "../../container/vcontainer.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
@ -109,9 +110,9 @@ DialogShoulderPoint::~DialogShoulderPoint()
|
|||
* @param id id of point or detail
|
||||
* @param type type of object
|
||||
*/
|
||||
void DialogShoulderPoint::ChoosedObject(quint32 id, const Valentina::Scenes &type)
|
||||
void DialogShoulderPoint::ChoosedObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (type == Valentina::Point)
|
||||
if (type == SceneObject::Point)
|
||||
{
|
||||
const VPointF *point = data->GeometricObject<const VPointF *>(id);
|
||||
if (number == 0)
|
||||
|
|
|
@ -65,7 +65,7 @@ public:
|
|||
quint32 getPShoulder() const;
|
||||
void setPShoulder(const quint32 &value, const quint32 &id);
|
||||
public slots:
|
||||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void ChoosedObject(quint32 id, const SceneObject &type);
|
||||
virtual void DialogAccepted();
|
||||
/**
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
|
|
|
@ -29,8 +29,6 @@
|
|||
#include "dialogsinglepoint.h"
|
||||
#include "ui_dialogsinglepoint.h"
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief DialogSinglePoint create dialog
|
||||
|
|
|
@ -29,7 +29,8 @@
|
|||
#include "dialogspline.h"
|
||||
#include "ui_dialogspline.h"
|
||||
|
||||
#include <QPushButton>
|
||||
#include "../../geometry/vpointf.h"
|
||||
#include "../../container/vcontainer.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
@ -70,9 +71,9 @@ quint32 DialogSpline::getP1() const
|
|||
* @param id id of point or detail
|
||||
* @param type type of object
|
||||
*/
|
||||
void DialogSpline::ChoosedObject(quint32 id, const Valentina::Scenes &type)
|
||||
void DialogSpline::ChoosedObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (type == Valentina::Point)
|
||||
if (type == SceneObject::Point)
|
||||
{
|
||||
const VPointF *point = data->GeometricObject<const VPointF *>(id);
|
||||
if (number == 0)
|
||||
|
|
|
@ -67,7 +67,7 @@ public:
|
|||
qreal getKCurve() const;
|
||||
void setKCurve(const qreal &value);
|
||||
public slots:
|
||||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void ChoosedObject(quint32 id, const SceneObject &type);
|
||||
virtual void DialogAccepted();
|
||||
/** TODO ISSUE 79 : create real function
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
|
|
|
@ -29,8 +29,7 @@
|
|||
#include "dialogsplinepath.h"
|
||||
#include "ui_dialogsplinepath.h"
|
||||
#include "../../geometry/vsplinepoint.h"
|
||||
|
||||
#include <QPushButton>
|
||||
#include "../../container/vcontainer.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
@ -77,7 +76,7 @@ void DialogSplinePath::SetPath(const VSplinePath &value)
|
|||
ui->listWidget->clear();
|
||||
for (qint32 i = 0; i < path.CountPoint(); ++i)
|
||||
{
|
||||
NewItem(path[i].P().id(), path[i].KAsm1(), path[i].Angle1(), path[i].KAsm2(), path[i].Angle2());
|
||||
NewItem(path.at(i).P().id(), path.at(i).KAsm1(), path.at(i).Angle1(), path.at(i).KAsm2(), path.at(i).Angle2());
|
||||
}
|
||||
ui->listWidget->setFocus(Qt::OtherFocusReason);
|
||||
ui->doubleSpinBoxKcurve->setValue(path.getKCurve());
|
||||
|
@ -89,9 +88,9 @@ void DialogSplinePath::SetPath(const VSplinePath &value)
|
|||
* @param id id of point or detail
|
||||
* @param type don't show this id in list
|
||||
*/
|
||||
void DialogSplinePath::ChoosedObject(quint32 id, const Valentina::Scenes &type)
|
||||
void DialogSplinePath::ChoosedObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (type == Valentina::Point)
|
||||
if (type == SceneObject::Point)
|
||||
{
|
||||
NewItem(id, 1, 0, 1, 180);
|
||||
emit ToolTip(tr("Select point of curve path"));
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
VSplinePath GetPath() const;
|
||||
void SetPath(const VSplinePath &value);
|
||||
public slots:
|
||||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void ChoosedObject(quint32 id, const SceneObject &type);
|
||||
virtual void DialogAccepted();
|
||||
/** TODO ISSUE 79 : create real function
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
|
|
|
@ -28,11 +28,14 @@
|
|||
|
||||
#include "dialogtool.h"
|
||||
#include "../../container/calculator.h"
|
||||
#include "../../geometry/vgobject.h"
|
||||
#include "../../container/vcontainer.h"
|
||||
#include "../../geometry/varc.h"
|
||||
#include "../../geometry/vpointf.h"
|
||||
#include "../../geometry/vsplinepath.h"
|
||||
#include "../../tools/vabstracttool.h"
|
||||
|
||||
#include <QtWidgets>
|
||||
#include "../../../libs/qmuparser/qmuparsererror.h"
|
||||
#include "../../widgets/vapplication.h"
|
||||
#include "../../xml/vdomdocument.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
@ -106,7 +109,7 @@ void DialogTool::FillComboBoxPoints(QComboBox *box, const quint32 &id) const
|
|||
if (i.key() != id)
|
||||
{
|
||||
VGObject *obj = i.value();
|
||||
if (obj->getType() == GObject::Point && obj->getMode() == Valentina::Calculation)
|
||||
if (obj->getType() == GOType::Point && obj->getMode() == Draw::Calculation)
|
||||
{
|
||||
const VPointF *point = data->GeometricObject<const VPointF *>(i.key());
|
||||
list[point->name()] = i.key();
|
||||
|
@ -117,7 +120,7 @@ void DialogTool::FillComboBoxPoints(QComboBox *box, const quint32 &id) const
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogTool::FillComboBoxArcs(QComboBox *box, const quint32 &id, ComboMode::ComboBoxCutArc cut) const
|
||||
void DialogTool::FillComboBoxArcs(QComboBox *box, const quint32 &id, ComboBoxCutArc cut) const
|
||||
{
|
||||
SCASSERT(box != nullptr);
|
||||
const QHash<quint32, VGObject *> *objs = data->DataGObjects();
|
||||
|
@ -126,12 +129,12 @@ void DialogTool::FillComboBoxArcs(QComboBox *box, const quint32 &id, ComboMode::
|
|||
while (i.hasNext())
|
||||
{
|
||||
i.next();
|
||||
if (cut == ComboMode::CutArc)
|
||||
if (cut == ComboBoxCutArc::CutArc)
|
||||
{
|
||||
if (i.key() != id + 1 && i.key() != id + 2)
|
||||
{
|
||||
VGObject *obj = i.value();
|
||||
if (obj->getType() == GObject::Arc && obj->getMode() == Valentina::Calculation)
|
||||
if (obj->getType() == GOType::Arc && obj->getMode() == Draw::Calculation)
|
||||
{
|
||||
const VArc *arc = data->GeometricObject<const VArc *>(i.key());
|
||||
list[arc->name()] = i.key();
|
||||
|
@ -143,7 +146,7 @@ void DialogTool::FillComboBoxArcs(QComboBox *box, const quint32 &id, ComboMode::
|
|||
if (i.key() != id)
|
||||
{
|
||||
VGObject *obj = i.value();
|
||||
if (obj->getType() == GObject::Arc && obj->getMode() == Valentina::Calculation)
|
||||
if (obj->getType() == GOType::Arc && obj->getMode() == Draw::Calculation)
|
||||
{
|
||||
const VArc *arc = data->GeometricObject<const VArc *>(i.key());
|
||||
list[arc->name()] = i.key();
|
||||
|
@ -161,7 +164,7 @@ void DialogTool::FillComboBoxArcs(QComboBox *box, const quint32 &id, ComboMode::
|
|||
* @param id don't show id in list
|
||||
* @param cut if set to ComboMode::CutSpline don't show id+1 and id+2
|
||||
*/
|
||||
void DialogTool::FillComboBoxSplines(QComboBox *box, const quint32 &id, ComboMode::ComboBoxCutSpline cut) const
|
||||
void DialogTool::FillComboBoxSplines(QComboBox *box, const quint32 &id, ComboBoxCutSpline cut) const
|
||||
{
|
||||
SCASSERT(box != nullptr);
|
||||
const QHash<quint32, VGObject *> *objs = data->DataGObjects();
|
||||
|
@ -170,12 +173,12 @@ void DialogTool::FillComboBoxSplines(QComboBox *box, const quint32 &id, ComboMod
|
|||
while (i.hasNext())
|
||||
{
|
||||
i.next();
|
||||
if (cut == ComboMode::CutSpline)
|
||||
if (cut == ComboBoxCutSpline::CutSpline)
|
||||
{
|
||||
if (i.key() != id + 1 && i.key() != id + 2)
|
||||
{
|
||||
VGObject *obj = i.value();
|
||||
if (obj->getType() == GObject::Spline && obj->getMode() == Valentina::Calculation)
|
||||
if (obj->getType() == GOType::Spline && obj->getMode() == Draw::Calculation)
|
||||
{
|
||||
const VSpline *spl = data->GeometricObject<const VSpline *>(i.key());
|
||||
list[spl->name()] = i.key();
|
||||
|
@ -187,7 +190,7 @@ void DialogTool::FillComboBoxSplines(QComboBox *box, const quint32 &id, ComboMod
|
|||
if (i.key() != id)
|
||||
{
|
||||
VGObject *obj = i.value();
|
||||
if (obj->getType() == GObject::Spline && obj->getMode() == Valentina::Calculation)
|
||||
if (obj->getType() == GOType::Spline && obj->getMode() == Draw::Calculation)
|
||||
{
|
||||
const VSpline *spl = data->GeometricObject<const VSpline *>(i.key());
|
||||
list[spl->name()] = i.key();
|
||||
|
@ -205,7 +208,7 @@ void DialogTool::FillComboBoxSplines(QComboBox *box, const quint32 &id, ComboMod
|
|||
* @param id don't show id in list
|
||||
* @param cut if set to ComboMode::CutSpline don't show id+1 and id+2
|
||||
*/
|
||||
void DialogTool::FillComboBoxSplinesPath(QComboBox *box, const quint32 &id, ComboMode::ComboBoxCutSpline cut) const
|
||||
void DialogTool::FillComboBoxSplinesPath(QComboBox *box, const quint32 &id, ComboBoxCutSpline cut) const
|
||||
{
|
||||
SCASSERT(box != nullptr);
|
||||
const QHash<quint32, VGObject *> *objs = data->DataGObjects();
|
||||
|
@ -214,12 +217,12 @@ void DialogTool::FillComboBoxSplinesPath(QComboBox *box, const quint32 &id, Comb
|
|||
while (i.hasNext())
|
||||
{
|
||||
i.next();
|
||||
if (cut == ComboMode::CutSpline)
|
||||
if (cut == ComboBoxCutSpline::CutSpline)
|
||||
{
|
||||
if (i.key() != id + 1 && i.key() != id + 2)
|
||||
{
|
||||
VGObject *obj = i.value();
|
||||
if (obj->getType() == GObject::SplinePath && obj->getMode() == Valentina::Calculation)
|
||||
if (obj->getType() == GOType::SplinePath && obj->getMode() == Draw::Calculation)
|
||||
{
|
||||
const VSplinePath *splPath = data->GeometricObject<const VSplinePath *>(i.key());
|
||||
list[splPath->name()] = i.key();
|
||||
|
@ -231,7 +234,7 @@ void DialogTool::FillComboBoxSplinesPath(QComboBox *box, const quint32 &id, Comb
|
|||
if (i.key() != id)
|
||||
{
|
||||
VGObject *obj = i.value();
|
||||
if (obj->getType() == GObject::SplinePath && obj->getMode() == Valentina::Calculation)
|
||||
if (obj->getType() == GOType::SplinePath && obj->getMode() == Draw::Calculation)
|
||||
{
|
||||
const VSplinePath *splPath = data->GeometricObject<const VSplinePath *>(i.key());
|
||||
list[splPath->name()] = i.key();
|
||||
|
@ -453,12 +456,12 @@ void DialogTool::Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label)
|
|||
if (osSeparatorValue)
|
||||
{
|
||||
QLocale loc = QLocale::system();
|
||||
label->setText(loc.toString(result));
|
||||
label->setText(loc.toString(result) + VDomDocument::UnitsToStr(qApp->patternUnit(), true));
|
||||
}
|
||||
else
|
||||
{
|
||||
QLocale loc = QLocale(QLocale::C);
|
||||
label->setText(loc.toString(result));
|
||||
label->setText(loc.toString(result) + VDomDocument::UnitsToStr(qApp->patternUnit(), true));
|
||||
}
|
||||
flag = true;
|
||||
palette.setColor(labelEditFormula->foregroundRole(), QColor(76, 76, 76));
|
||||
|
@ -514,12 +517,12 @@ void DialogTool::Eval(QPlainTextEdit *edit, bool &flag, QTimer *timer, QLabel *l
|
|||
if (osSeparatorValue)
|
||||
{
|
||||
QLocale loc = QLocale::system();
|
||||
label->setText(loc.toString(result));
|
||||
label->setText(loc.toString(result) + VDomDocument::UnitsToStr(qApp->patternUnit(), true));
|
||||
}
|
||||
else
|
||||
{
|
||||
QLocale loc = QLocale(QLocale::C);
|
||||
label->setText(loc.toString(result));
|
||||
label->setText(loc.toString(result) + VDomDocument::UnitsToStr(qApp->patternUnit(), true));
|
||||
}
|
||||
flag = true;
|
||||
palette.setColor(labelEditFormula->foregroundRole(), QColor(76, 76, 76));
|
||||
|
@ -562,7 +565,7 @@ void DialogTool::setCurrentPointId(QComboBox *box, quint32 &pointId, const quint
|
|||
* @param cut if set to ComboMode::CutSpline don't show id+1 and id+2
|
||||
*/
|
||||
void DialogTool::setCurrentSplineId(QComboBox *box, quint32 &splineId, const quint32 &value, const quint32 &id,
|
||||
ComboMode::ComboBoxCutSpline cut) const
|
||||
ComboBoxCutSpline cut) const
|
||||
{
|
||||
SCASSERT(box != nullptr);
|
||||
FillComboBoxSplines(box, id, cut);
|
||||
|
@ -580,7 +583,7 @@ void DialogTool::setCurrentSplineId(QComboBox *box, quint32 &splineId, const qui
|
|||
* @param cut if set to ComboMode::CutArc don't show id+1 and id+2
|
||||
*/
|
||||
void DialogTool::setCurrentArcId(QComboBox *box, quint32 &arcId, const quint32 &value, const quint32 &id,
|
||||
ComboMode::ComboBoxCutArc cut) const
|
||||
ComboBoxCutArc cut) const
|
||||
{
|
||||
SCASSERT(box != nullptr);
|
||||
FillComboBoxArcs(box, id, cut);
|
||||
|
@ -598,7 +601,7 @@ void DialogTool::setCurrentArcId(QComboBox *box, quint32 &arcId, const quint32 &
|
|||
* @param cut if set to ComboMode::CutSpline don't show id+1 and id+2
|
||||
*/
|
||||
void DialogTool::setCurrentSplinePathId(QComboBox *box, quint32 &splinePathId, const quint32 &value,
|
||||
const quint32 &id, ComboMode::ComboBoxCutSpline cut) const
|
||||
const quint32 &id, ComboBoxCutSpline cut) const
|
||||
{
|
||||
SCASSERT(box != nullptr);
|
||||
FillComboBoxSplinesPath(box, id, cut);
|
||||
|
@ -683,7 +686,7 @@ void DialogTool::CheckState()
|
|||
* @param id id of point or detail
|
||||
* @param type type of object
|
||||
*/
|
||||
void DialogTool::ChoosedObject(quint32 id, const Valentina::Scenes &type)
|
||||
void DialogTool::ChoosedObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
Q_UNUSED(id);
|
||||
Q_UNUSED(type);
|
||||
|
|
|
@ -29,32 +29,23 @@
|
|||
#ifndef DIALOGTOOL_H
|
||||
#define DIALOGTOOL_H
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QDialog>
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QLabel>
|
||||
#include <QListWidgetItem>
|
||||
#include <QRadioButton>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QPushButton>
|
||||
#include <QPlainTextEdit>
|
||||
#include "../../container/vcontainer.h"
|
||||
#include "../../widgets/vapplication.h"
|
||||
#include "../../tools/vabstracttool.h"
|
||||
|
||||
namespace ComboMode
|
||||
{
|
||||
/**
|
||||
* @brief The ComboBoxCutSpline enum
|
||||
*/
|
||||
enum ComboBoxCutSpline { CutSpline, NoCutSpline };
|
||||
Q_DECLARE_FLAGS(ComboBoxCutSplines, ComboBoxCutSpline)
|
||||
class QDoubleSpinBox;
|
||||
class QLabel;
|
||||
class QRadioButton;
|
||||
class QComboBox;
|
||||
class QListWidgetItem;
|
||||
class QLineEdit;
|
||||
class QListWidget;
|
||||
class VContainer;
|
||||
class QPlainTextEdit;
|
||||
class VAbstractTool;
|
||||
|
||||
enum ComboBoxCutArc { CutArc, NoCutArc};
|
||||
Q_DECLARE_FLAGS(ComboBoxCutArcs, ComboBoxCutArc)
|
||||
}
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS( ComboMode::ComboBoxCutSplines )
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS( ComboMode::ComboBoxCutArcs )
|
||||
enum class ComboBoxCutSpline : char { CutSpline, NoCutSpline };
|
||||
enum class ComboBoxCutArc : char { CutArc, NoCutArc};
|
||||
|
||||
/**
|
||||
* @brief The DialogTool class parent for all dialog of tools.
|
||||
|
@ -65,14 +56,8 @@ class DialogTool : public QDialog
|
|||
public:
|
||||
DialogTool(const VContainer *data, QWidget *parent = nullptr);
|
||||
virtual ~DialogTool() {}
|
||||
inline VAbstractTool* GetAssociatedTool()
|
||||
{
|
||||
return this->associatedTool;
|
||||
}
|
||||
inline void SetAssociatedTool(VAbstractTool* tool)
|
||||
{
|
||||
this->associatedTool=tool;
|
||||
}
|
||||
VAbstractTool* GetAssociatedTool();
|
||||
void SetAssociatedTool(VAbstractTool* tool);
|
||||
signals:
|
||||
/**
|
||||
* @brief DialogClosed signal dialog closed
|
||||
|
@ -89,7 +74,7 @@ signals:
|
|||
*/
|
||||
void ToolTip(const QString &toolTip);
|
||||
public slots:
|
||||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void ChoosedObject(quint32 id, const SceneObject &type);
|
||||
void NamePointChanged();
|
||||
virtual void DialogAccepted();
|
||||
/**
|
||||
|
@ -191,11 +176,11 @@ protected:
|
|||
virtual void showEvent( QShowEvent *event );
|
||||
void FillComboBoxPoints(QComboBox *box, const quint32 &id = 0)const;
|
||||
void FillComboBoxArcs(QComboBox *box, const quint32 &id = 0,
|
||||
ComboMode::ComboBoxCutArc cut = ComboMode::NoCutArc)const;
|
||||
ComboBoxCutArc cut = ComboBoxCutArc::NoCutArc)const;
|
||||
void FillComboBoxSplines(QComboBox *box, const quint32 &id = 0,
|
||||
ComboMode::ComboBoxCutSpline cut = ComboMode::NoCutSpline)const;
|
||||
ComboBoxCutSpline cut = ComboBoxCutSpline::NoCutSpline)const;
|
||||
void FillComboBoxSplinesPath(QComboBox *box, const quint32 &id = 0,
|
||||
ComboMode::ComboBoxCutSpline cut = ComboMode::NoCutSpline)const;
|
||||
ComboBoxCutSpline cut = ComboBoxCutSpline::NoCutSpline)const;
|
||||
void FillComboBoxTypeLine(QComboBox *box) const;
|
||||
virtual void CheckState();
|
||||
QString GetTypeLine(const QComboBox *box)const;
|
||||
|
@ -212,12 +197,12 @@ protected:
|
|||
void Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label);
|
||||
void setCurrentPointId(QComboBox *box, quint32 &pointId, const quint32 &value, const quint32 &id) const;
|
||||
void setCurrentSplineId(QComboBox *box, quint32 &splineId, const quint32 &value, const quint32 &id,
|
||||
ComboMode::ComboBoxCutSpline cut = ComboMode::NoCutSpline) const;
|
||||
ComboBoxCutSpline cut = ComboBoxCutSpline::NoCutSpline) const;
|
||||
void setCurrentArcId(QComboBox *box, quint32 &arcId, const quint32 &value, const quint32 &id,
|
||||
ComboMode::ComboBoxCutArc cut = ComboMode::NoCutArc) const;
|
||||
ComboBoxCutArc cut = ComboBoxCutArc::NoCutArc) const;
|
||||
void setCurrentSplinePathId(QComboBox *box, quint32 &splinePathId, const quint32 &value,
|
||||
const quint32 &id,
|
||||
ComboMode::ComboBoxCutSpline cut = ComboMode::NoCutSpline) const;
|
||||
ComboBoxCutSpline cut = ComboBoxCutSpline::NoCutSpline) const;
|
||||
quint32 getCurrentObjectId(QComboBox *box) const;
|
||||
bool ChoosedPoint(const quint32 &id, QComboBox *box, const QString &toolTip);
|
||||
template <typename T>
|
||||
|
@ -248,7 +233,7 @@ protected:
|
|||
|
||||
connect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged);
|
||||
|
||||
if (qApp->patternType() == Pattern::Standard)
|
||||
if (qApp->patternType() == MeasurementsType::Standard)
|
||||
{
|
||||
SizeHeight();
|
||||
connect(radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogTool::SizeHeight);
|
||||
|
@ -300,4 +285,16 @@ private:
|
|||
void FillList(QComboBox *box, const QMap<QString, quint32> &list)const;
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline VAbstractTool *DialogTool::GetAssociatedTool()
|
||||
{
|
||||
return this->associatedTool;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void DialogTool::SetAssociatedTool(VAbstractTool *tool)
|
||||
{
|
||||
this->associatedTool=tool;
|
||||
}
|
||||
|
||||
#endif // DIALOGTOOL_H
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
|
||||
#include "dialogtriangle.h"
|
||||
#include "ui_dialogtriangle.h"
|
||||
|
||||
#include <QPushButton>
|
||||
#include "../../geometry/vpointf.h"
|
||||
#include "../../container/vcontainer.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
@ -67,9 +67,9 @@ DialogTriangle::~DialogTriangle()
|
|||
* @param id id of point or detail
|
||||
* @param type type of object
|
||||
*/
|
||||
void DialogTriangle::ChoosedObject(quint32 id, const Valentina::Scenes &type)
|
||||
void DialogTriangle::ChoosedObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (type == Valentina::Point)
|
||||
if (type == SceneObject::Point)
|
||||
{
|
||||
const VPointF *point = data->GeometricObject<const VPointF *>(id);
|
||||
switch (number)
|
||||
|
|
|
@ -61,7 +61,7 @@ public:
|
|||
QString getPointName() const;
|
||||
void setPointName(const QString &value);
|
||||
public slots:
|
||||
virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
virtual void ChoosedObject(quint32 id, const SceneObject &type);
|
||||
virtual void DialogAccepted();
|
||||
/** TODO ISSUE 79 : create real function
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
|
||||
#include "dialoguniondetails.h"
|
||||
#include "ui_dialoguniondetails.h"
|
||||
#include "../../geometry/vdetail.h"
|
||||
#include "../../container/vcontainer.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
@ -55,7 +57,7 @@ DialogUnionDetails::~DialogUnionDetails()
|
|||
* @param id id of point or detail
|
||||
* @param type type of object
|
||||
*/
|
||||
void DialogUnionDetails::ChoosedObject(quint32 id, const Valentina::Scenes &type)
|
||||
void DialogUnionDetails::ChoosedObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (numberD == 0)
|
||||
{
|
||||
|
@ -101,12 +103,12 @@ bool DialogUnionDetails::CheckObject(const quint32 &id, const quint32 &idDetail)
|
|||
* @param idDetail id detail
|
||||
* @param index index of edge
|
||||
*/
|
||||
void DialogUnionDetails::ChoosedDetail(const quint32 &id, const Valentina::Scenes &type, quint32 &idDetail,
|
||||
void DialogUnionDetails::ChoosedDetail(const quint32 &id, const SceneObject &type, quint32 &idDetail,
|
||||
ptrdiff_t &index)
|
||||
{
|
||||
if (idDetail == 0)
|
||||
{
|
||||
if (type == Valentina::Detail)
|
||||
if (type == SceneObject::Detail)
|
||||
{
|
||||
idDetail = id;
|
||||
emit ToolTip(tr("Select first point"));
|
||||
|
@ -117,7 +119,7 @@ void DialogUnionDetails::ChoosedDetail(const quint32 &id, const Valentina::Scene
|
|||
{
|
||||
return;
|
||||
}
|
||||
if (type == Valentina::Point)
|
||||
if (type == SceneObject::Point)
|
||||
{
|
||||
if (numberP == 0)
|
||||
{
|
||||
|
|
|
@ -51,7 +51,7 @@ public:
|
|||
ptrdiff_t getIndexD1() const;
|
||||
ptrdiff_t getIndexD2() const;
|
||||
public slots:
|
||||
void ChoosedObject(quint32 id, const Valentina::Scenes &type);
|
||||
void ChoosedObject(quint32 id, const SceneObject &type);
|
||||
virtual void DialogAccepted();
|
||||
/** TODO ISSUE 79 : create real function
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
|
@ -88,7 +88,7 @@ private:
|
|||
quint32 p2;
|
||||
|
||||
bool CheckObject(const quint32 &id, const quint32 &idDetail) const;
|
||||
void ChoosedDetail(const quint32 &id, const Valentina::Scenes &type, quint32 &idDetail,
|
||||
void ChoosedDetail(const quint32 &id, const SceneObject &type, quint32 &idDetail,
|
||||
ptrdiff_t &index);
|
||||
};
|
||||
|
||||
|
|
|
@ -6,42 +6,32 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>473</width>
|
||||
<width>244</width>
|
||||
<height>78</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Union details</string>
|
||||
</property>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>120</x>
|
||||
<y>40</y>
|
||||
<width>341</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>20</y>
|
||||
<width>451</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Do you really want union details? This operation can't be undone.</string>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Do you really want union details?</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
|
|
|
@ -28,10 +28,10 @@
|
|||
|
||||
#include "vexception.h"
|
||||
#include <QMessageBox>
|
||||
#include <QSpacerItem>
|
||||
#include <QGridLayout>
|
||||
#include "../options.h"
|
||||
#include <QApplication>
|
||||
|
||||
class QSpacerItem;
|
||||
class QGridLayout;
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
|
||||
#include <QException>
|
||||
#include <QString>
|
||||
#include <QWidget>
|
||||
#include <QCoreApplication>
|
||||
|
||||
class QWidget;
|
||||
|
||||
/**
|
||||
* @brief The VException class parent for all exception. Could be use for abstract exception
|
||||
|
|
|
@ -27,8 +27,7 @@
|
|||
*************************************************************************/
|
||||
|
||||
#include "vexceptionemptyparameter.h"
|
||||
|
||||
#include <QtWidgets>
|
||||
#include <QDomElement>
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
#include "vexception.h"
|
||||
|
||||
#include <QDomElement>
|
||||
class QDomElement;
|
||||
|
||||
/**
|
||||
* @brief The VExceptionEmptyParameter class for exception empty parameter
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include "vexceptionobjecterror.h"
|
||||
#include <QDebug>
|
||||
#include <QDomElement>
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
#include "vexception.h"
|
||||
|
||||
#include <QDomElement>
|
||||
class QDomElement;
|
||||
|
||||
/**
|
||||
* @brief The VExceptionObjectError class for exception object error
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include "vexceptionwrongid.h"
|
||||
#include <QDebug>
|
||||
#include <QDomElement>
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
#include "vexception.h"
|
||||
|
||||
#include <QDomElement>
|
||||
class QDomElement;
|
||||
|
||||
/**
|
||||
* @brief The VExceptionWrongId class for exception wrong id
|
||||
|
|
|
@ -27,19 +27,19 @@
|
|||
*************************************************************************/
|
||||
|
||||
#include "varc.h"
|
||||
#include "vspline.h"
|
||||
#include "../exception/vexception.h"
|
||||
#include <QDebug>
|
||||
#include <QtMath>
|
||||
|
||||
class QRectF;
|
||||
#ifdef Q_OS_WIN32
|
||||
# include <QtMath> // for M_PI on Windows
|
||||
#endif /*Q_OS_WIN32*/
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief VArc default constructor.
|
||||
*/
|
||||
VArc::VArc ()
|
||||
:VGObject(GObject::Arc), f1(0), formulaF1(QString()), f2(0), formulaF2(QString()), radius(0),
|
||||
:VGObject(GOType::Arc), f1(0), formulaF1(QString()), f2(0), formulaF2(QString()), radius(0),
|
||||
formulaRadius(QString()), center(VPointF())
|
||||
{}
|
||||
|
||||
|
@ -52,8 +52,8 @@ VArc::VArc ()
|
|||
* @param f2 end angle (degree).
|
||||
*/
|
||||
VArc::VArc (VPointF center, qreal radius, QString formulaRadius, qreal f1, QString formulaF1, qreal f2,
|
||||
QString formulaF2, quint32 idObject, Valentina::Draws mode)
|
||||
: VGObject(GObject::Arc, idObject, mode), f1(f1), formulaF1(formulaF1), f2(f2), formulaF2(formulaF2),
|
||||
QString formulaF2, quint32 idObject, Draw mode)
|
||||
: VGObject(GOType::Arc, idObject, mode), f1(f1), formulaF1(formulaF1), f2(f2), formulaF2(formulaF2),
|
||||
radius(radius), formulaRadius(formulaRadius), center(center)
|
||||
{
|
||||
_name = QString (arc_+"%1").arg(this->GetCenter().name());
|
||||
|
@ -139,8 +139,8 @@ QPainterPath VArc::GetPath() const
|
|||
{
|
||||
for (qint32 i = 0; i < points.count()-1; ++i)
|
||||
{
|
||||
path.moveTo(points[i]);
|
||||
path.lineTo(points[i+1]);
|
||||
path.moveTo(points.at(i));
|
||||
path.lineTo(points.at(i+1));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -30,11 +30,8 @@
|
|||
#define VARC_H
|
||||
|
||||
#include "vgobject.h"
|
||||
#include <QCoreApplication>
|
||||
#include "../options.h"
|
||||
#include "vpointf.h"
|
||||
class QString;
|
||||
class QLineF;
|
||||
|
||||
class QPainterPath;
|
||||
|
||||
/**
|
||||
|
@ -46,7 +43,7 @@ class VArc: public VGObject
|
|||
public:
|
||||
VArc ();
|
||||
VArc (VPointF center, qreal radius, QString formulaRadius, qreal f1, QString formulaF1, qreal f2,
|
||||
QString formulaF2, quint32 idObject = 0, Valentina::Draws mode = Valentina::Calculation);
|
||||
QString formulaF2, quint32 idObject = 0, Draw mode = Draw::Calculation);
|
||||
VArc(const VArc &arc);
|
||||
VArc& operator= (const VArc &arc);
|
||||
QString GetFormulaF1 () const;
|
||||
|
|
|
@ -28,17 +28,18 @@
|
|||
|
||||
#include "vdetail.h"
|
||||
#include <QDebug>
|
||||
#include <QString>
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VDetail::VDetail()
|
||||
:_id(0), nodes(QVector<VNodeDetail>()), name(QString()), mx(0), my(0), seamAllowance(true), closed(true),
|
||||
width(10)
|
||||
width(0)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VDetail::VDetail(const QString &name, const QVector<VNodeDetail> &nodes)
|
||||
:_id(0), nodes(QVector<VNodeDetail>()), name(name), mx(0), my(0), seamAllowance(true), closed(true),
|
||||
width(10)
|
||||
width(0)
|
||||
{
|
||||
this->nodes = nodes;
|
||||
}
|
||||
|
@ -72,7 +73,7 @@ void VDetail::Clear()
|
|||
my = 0;
|
||||
seamAllowance = true;
|
||||
closed = true;
|
||||
width = 10;
|
||||
width = 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -86,7 +87,7 @@ bool VDetail::Containes(const quint32 &id) const
|
|||
{
|
||||
for (ptrdiff_t i = 0; i < nodes.size(); ++i)
|
||||
{
|
||||
VNodeDetail node = nodes[i];
|
||||
VNodeDetail node = nodes.at(i);
|
||||
if (node.getId() == id)
|
||||
{
|
||||
return true;
|
||||
|
@ -104,7 +105,7 @@ VNodeDetail &VDetail::operator [](ptrdiff_t indx)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
const VNodeDetail &VDetail::at(ptrdiff_t indx) const
|
||||
{
|
||||
return nodes[indx];
|
||||
return nodes.at(indx);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -254,25 +255,26 @@ VDetail VDetail::RemoveEdge(const quint32 &index) const
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QList<quint32> VDetail::Missing(const VDetail &det) const
|
||||
{
|
||||
QList<quint32> list;
|
||||
if (nodes.size() == det.CountNode())
|
||||
{
|
||||
return list;
|
||||
return QList<quint32>();
|
||||
}
|
||||
|
||||
qint32 j = 0;
|
||||
QSet<quint32> set1;
|
||||
for (qint32 i = 0; i < nodes.size(); ++i)
|
||||
{
|
||||
if (nodes[i].getId() == det.at(j).getId())
|
||||
{
|
||||
++j;
|
||||
}
|
||||
else
|
||||
{
|
||||
list.append(nodes[i].getId());
|
||||
}
|
||||
set1.insert(nodes.at(i).getId());
|
||||
}
|
||||
return list;
|
||||
|
||||
QSet<quint32> set2;
|
||||
for (qint32 j = 0; j < det.CountNode(); ++j)
|
||||
{
|
||||
set2.insert(det.at(j).getId());
|
||||
}
|
||||
|
||||
QSet<quint32> set3 = set1.subtract(set2);
|
||||
|
||||
return set3.toList();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -281,9 +283,9 @@ QVector<VNodeDetail> VDetail::listNodePoint() const
|
|||
QVector<VNodeDetail> list;
|
||||
for (ptrdiff_t i = 0; i < nodes.size(); ++i)
|
||||
{
|
||||
if (nodes[i].getTypeTool() == Valentina::NodePoint)
|
||||
if (nodes.at(i).getTypeTool() == Tool::NodePoint)
|
||||
{
|
||||
list.append(nodes[i]);
|
||||
list.append(nodes.at(i));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
|
@ -294,7 +296,7 @@ ptrdiff_t VDetail::indexOfNode(const QVector<VNodeDetail> &list, const quint32 &
|
|||
{
|
||||
for (ptrdiff_t i = 0; i < list.size(); ++i)
|
||||
{
|
||||
if (list[i].getId() == id)
|
||||
if (list.at(i).getId() == id)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
|
|
@ -30,28 +30,12 @@
|
|||
#define VDETAIL_H
|
||||
|
||||
#include "vnodedetail.h"
|
||||
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
|
||||
namespace Detail
|
||||
{
|
||||
/**
|
||||
* @brief The Contour enum OpenContour - first and last points contour don't match,
|
||||
* CloseContour - first and last points contour match.
|
||||
*/
|
||||
enum Contour { OpenContour, CloseContour };
|
||||
Q_DECLARE_FLAGS(Contours, Contour)
|
||||
class QString;
|
||||
|
||||
/**
|
||||
* @brief The Equidistant enum OpenEquidistant - first and last points equidistant don't match,
|
||||
* CloseEquidistant - first and last points equidistant match.
|
||||
*/
|
||||
enum Equidistant { OpenEquidistant, CloseEquidistant };
|
||||
Q_DECLARE_FLAGS(Equidistants, Equidistant)
|
||||
}
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(Detail::Contours)
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(Detail::Equidistants)
|
||||
enum class Contour : char { OpenContour, CloseContour };
|
||||
enum class EquidistantType : char { OpenEquidistant, CloseEquidistant };
|
||||
|
||||
/**
|
||||
* @brief The VDetail class for path of object (points, arcs, splines).
|
||||
|
|
|
@ -26,9 +26,15 @@
|
|||
**
|
||||
*************************************************************************/
|
||||
|
||||
#include "varc.h"
|
||||
#include "vequidistant.h"
|
||||
#include "vpointf.h"
|
||||
#include "vspline.h"
|
||||
#include "vsplinepath.h"
|
||||
#include "../widgets/vapplication.h"
|
||||
#include <QDebug>
|
||||
#include <QPainterPath>
|
||||
#include "../container/vcontainer.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QPainterPath VEquidistant::ContourPath(const quint32 &idDetail, const VContainer *data) const
|
||||
|
@ -41,7 +47,7 @@ QPainterPath VEquidistant::ContourPath(const quint32 &idDetail, const VContainer
|
|||
{
|
||||
switch (detail.at(i).getTypeTool())
|
||||
{
|
||||
case (Valentina::NodePoint):
|
||||
case (Tool::NodePoint):
|
||||
{
|
||||
const VPointF *point = data->GeometricObject<const VPointF*>(detail.at(i).getId());
|
||||
points.append(point->toQPointF());
|
||||
|
@ -54,7 +60,7 @@ QPainterPath VEquidistant::ContourPath(const quint32 &idDetail, const VContainer
|
|||
}
|
||||
}
|
||||
break;
|
||||
case (Valentina::NodeArc):
|
||||
case (Tool::NodeArc):
|
||||
{
|
||||
const VArc *arc = data->GeometricObject<const VArc *>(detail.at(i).getId());
|
||||
qreal len1 = GetLengthContour(points, arc->GetPoints());
|
||||
|
@ -78,7 +84,7 @@ QPainterPath VEquidistant::ContourPath(const quint32 &idDetail, const VContainer
|
|||
}
|
||||
}
|
||||
break;
|
||||
case (Valentina::NodeSpline):
|
||||
case (Tool::NodeSpline):
|
||||
{
|
||||
const VSpline *spline = data->GeometricObject<const VSpline *>(detail.at(i).getId());
|
||||
qreal len1 = GetLengthContour(points, spline->GetPoints());
|
||||
|
@ -102,7 +108,7 @@ QPainterPath VEquidistant::ContourPath(const quint32 &idDetail, const VContainer
|
|||
}
|
||||
}
|
||||
break;
|
||||
case (Valentina::NodeSplinePath):
|
||||
case (Tool::NodeSplinePath):
|
||||
{
|
||||
const VSplinePath *splinePath = data->GeometricObject<const VSplinePath *>(detail.at(i).getId());
|
||||
qreal len1 = GetLengthContour(points, splinePath->GetPathPoints());
|
||||
|
@ -126,8 +132,29 @@ QPainterPath VEquidistant::ContourPath(const quint32 &idDetail, const VContainer
|
|||
}
|
||||
}
|
||||
break;
|
||||
case (Tool::ArrowTool):
|
||||
case (Tool::SinglePointTool):
|
||||
case (Tool::EndLineTool):
|
||||
case (Tool::LineTool):
|
||||
case (Tool::AlongLineTool):
|
||||
case (Tool::ShoulderPointTool):
|
||||
case (Tool::NormalTool):
|
||||
case (Tool::BisectorTool):
|
||||
case (Tool::LineIntersectTool):
|
||||
case (Tool::SplineTool):
|
||||
case (Tool::CutSplineTool):
|
||||
case (Tool::CutArcTool):
|
||||
case (Tool::ArcTool):
|
||||
case (Tool::SplinePathTool):
|
||||
case (Tool::CutSplinePathTool):
|
||||
case (Tool::PointOfContact):
|
||||
case (Tool::DetailTool):
|
||||
case (Tool::Height):
|
||||
case (Tool::Triangle):
|
||||
case (Tool::PointOfIntersection):
|
||||
case (Tool::UnionDetails):
|
||||
default:
|
||||
qDebug()<<"Get wrong tool type. Ignore."<<detail.at(i).getTypeTool();
|
||||
qDebug()<<"Get wrong tool type. Ignore."<< static_cast<char>(detail.at(i).getTypeTool());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -136,9 +163,9 @@ QPainterPath VEquidistant::ContourPath(const quint32 &idDetail, const VContainer
|
|||
path.moveTo(points[0]);
|
||||
for (qint32 i = 1; i < points.count(); ++i)
|
||||
{
|
||||
path.lineTo(points[i]);
|
||||
path.lineTo(points.at(i));
|
||||
}
|
||||
path.lineTo(points[0]);
|
||||
path.lineTo(points.at(0));
|
||||
|
||||
pointsEkv = CorrectEquidistantPoints(pointsEkv);
|
||||
pointsEkv = CheckLoops(pointsEkv);
|
||||
|
@ -148,11 +175,11 @@ QPainterPath VEquidistant::ContourPath(const quint32 &idDetail, const VContainer
|
|||
QPainterPath ekv;
|
||||
if (detail.getClosed() == true)
|
||||
{
|
||||
ekv = Equidistant(pointsEkv, Detail::CloseEquidistant, qApp->toPixel(detail.getWidth()));
|
||||
ekv = Equidistant(pointsEkv, EquidistantType::CloseEquidistant, qApp->toPixel(detail.getWidth()));
|
||||
}
|
||||
else
|
||||
{
|
||||
ekv = Equidistant(pointsEkv, Detail::OpenEquidistant, qApp->toPixel(detail.getWidth()));
|
||||
ekv = Equidistant(pointsEkv, EquidistantType::OpenEquidistant, qApp->toPixel(detail.getWidth()));
|
||||
}
|
||||
path.addPath(ekv);
|
||||
path.setFillRule(Qt::WindingFill);
|
||||
|
@ -223,8 +250,8 @@ QVector<QPointF> VEquidistant::CorrectEquidistantPoints(const QVector<QPointF> &
|
|||
QPointF point;
|
||||
for (qint32 i = 1; i <correctPoints.size()-1; ++i)
|
||||
{
|
||||
QLineF l1(correctPoints[i-1], correctPoints[i]);
|
||||
QLineF l2(correctPoints[i], correctPoints[i+1]);
|
||||
QLineF l1(correctPoints.at(i-1), correctPoints.at(i));
|
||||
QLineF l2(correctPoints.at(i), correctPoints.at(i+1));
|
||||
QLineF::IntersectType intersect = l1.intersect(l2, &point);
|
||||
if (intersect == QLineF::NoIntersection)
|
||||
{
|
||||
|
@ -235,8 +262,7 @@ QVector<QPointF> VEquidistant::CorrectEquidistantPoints(const QVector<QPointF> &
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QPainterPath VEquidistant::Equidistant(QVector<QPointF> points, const Detail::Equidistant &eqv,
|
||||
const qreal &width)
|
||||
QPainterPath VEquidistant::Equidistant(QVector<QPointF> points, const EquidistantType &eqv, const qreal &width)
|
||||
{
|
||||
QPainterPath ekv;
|
||||
QVector<QPointF> ekvPoints;
|
||||
|
@ -245,59 +271,64 @@ QPainterPath VEquidistant::Equidistant(QVector<QPointF> points, const Detail::Eq
|
|||
qDebug()<<"Not enough points for building the equidistant.\n";
|
||||
return ekv;
|
||||
}
|
||||
if (width <= 0)
|
||||
{
|
||||
qDebug()<<"Width <= 0.\n";
|
||||
return ekv;
|
||||
}
|
||||
for (qint32 i = 0; i < points.size(); ++i )
|
||||
{
|
||||
if (i != points.size()-1)
|
||||
{
|
||||
if (points[i] == points[i+1])
|
||||
if (points.at(i) == points.at(i+1))
|
||||
{
|
||||
points.remove(i+1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (points[i] == points[0])
|
||||
if (points.at(i) == points.at(0))
|
||||
{
|
||||
points.remove(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (eqv == Detail::CloseEquidistant)
|
||||
if (eqv == EquidistantType::CloseEquidistant)
|
||||
{
|
||||
points.append(points.at(0));
|
||||
}
|
||||
for (qint32 i = 0; i < points.size(); ++i )
|
||||
{
|
||||
if ( i == 0 && eqv == Detail::CloseEquidistant)
|
||||
if ( i == 0 && eqv == EquidistantType::CloseEquidistant)
|
||||
{//first point, polyline closed
|
||||
ekvPoints<<EkvPoint(QLineF(points[points.size()-2], points[points.size()-1]), QLineF(points[1], points[0]),
|
||||
width);
|
||||
ekvPoints<<EkvPoint(QLineF(points.at(points.size()-2), points.at(points.size()-1)),
|
||||
QLineF(points.at(1), points.at(0)), width);
|
||||
continue;
|
||||
}
|
||||
else if (i == 0 && eqv == Detail::OpenEquidistant)
|
||||
else if (i == 0 && eqv == EquidistantType::OpenEquidistant)
|
||||
{//first point, polyline doesn't closed
|
||||
ekvPoints.append(SingleParallelPoint(QLineF(points[0], points[1]), 90, width));
|
||||
ekvPoints.append(SingleParallelPoint(QLineF(points.at(0), points.at(1)), 90, width));
|
||||
continue;
|
||||
}
|
||||
if (i == points.size()-1 && eqv == Detail::CloseEquidistant)
|
||||
if (i == points.size()-1 && eqv == EquidistantType::CloseEquidistant)
|
||||
{//last point, polyline closed
|
||||
ekvPoints.append(ekvPoints.at(0));
|
||||
continue;
|
||||
}
|
||||
else if (i == points.size()-1 && eqv == Detail::OpenEquidistant)
|
||||
else if (i == points.size()-1 && eqv == EquidistantType::OpenEquidistant)
|
||||
{//last point, polyline doesn't closed
|
||||
ekvPoints.append(SingleParallelPoint(QLineF(points[points.size()-1], points[points.size()-2]), -90,
|
||||
width));
|
||||
ekvPoints.append(SingleParallelPoint(QLineF(points.at(points.size()-1), points.at(points.size()-2)),
|
||||
-90, width));
|
||||
continue;
|
||||
}
|
||||
//points in the middle of polyline
|
||||
ekvPoints<<EkvPoint(QLineF(points[i-1], points[i]), QLineF(points[i+1], points[i]), width);
|
||||
ekvPoints<<EkvPoint(QLineF(points.at(i-1), points.at(i)), QLineF(points.at(i+1), points.at(i)), width);
|
||||
}
|
||||
ekvPoints = CheckLoops(ekvPoints);
|
||||
ekv.moveTo(ekvPoints[0]);
|
||||
ekv.moveTo(ekvPoints.at(0));
|
||||
for (qint32 i = 1; i < ekvPoints.count(); ++i)
|
||||
{
|
||||
ekv.lineTo(ekvPoints[i]);
|
||||
ekv.lineTo(ekvPoints.at(i));
|
||||
}
|
||||
return ekv;
|
||||
}
|
||||
|
|
|
@ -29,8 +29,12 @@
|
|||
#ifndef VEQUIDISTANT_H
|
||||
#define VEQUIDISTANT_H
|
||||
|
||||
#include <QPainterPath>
|
||||
#include "../container/vcontainer.h"
|
||||
#include "vdetail.h"
|
||||
|
||||
class QPainterPath;
|
||||
class VContainer;
|
||||
class QPointF;
|
||||
class QLineF;
|
||||
|
||||
/**
|
||||
* @brief The VEquidistant class calculate equidistant for detail.
|
||||
|
@ -74,7 +78,7 @@ private:
|
|||
* @param width width of equidistant.
|
||||
* @return return painter path of equidistant.
|
||||
*/
|
||||
static QPainterPath Equidistant(QVector<QPointF> points, const Detail::Equidistant &eqv, const qreal &width);
|
||||
static QPainterPath Equidistant(QVector<QPointF> points, const EquidistantType &eqv, const qreal &width);
|
||||
/**
|
||||
* @brief CheckLoops seek and delete loops in equidistant.
|
||||
* @param points vector of points of equidistant.
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
* @brief VGObject default constructor.
|
||||
*/
|
||||
VGObject::VGObject()
|
||||
:_id(0), type(GObject::Point), idObject(0), _name(QString()), mode(Valentina::Calculation)
|
||||
:_id(0), type(GOType::Point), idObject(0), _name(QString()), mode(Draw::Calculation)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -43,7 +43,7 @@ VGObject::VGObject()
|
|||
* @param idObject id parent object.
|
||||
* @param mode mode creation. Used in modeling mode.
|
||||
*/
|
||||
VGObject::VGObject(const GObject::Type &type, const quint32 &idObject, const Valentina::Draws &mode)
|
||||
VGObject::VGObject(const GOType &type, const quint32 &idObject, const Draw &mode)
|
||||
:_id(0), type(type), idObject(idObject), _name(QString()), mode(mode)
|
||||
{}
|
||||
|
||||
|
@ -117,7 +117,7 @@ void VGObject::setName(const QString &name)
|
|||
* @brief getMode return mode creation.
|
||||
* @return mode.
|
||||
*/
|
||||
Valentina::Draws VGObject::getMode() const
|
||||
Draw VGObject::getMode() const
|
||||
{
|
||||
return mode;
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ Valentina::Draws VGObject::getMode() const
|
|||
* @brief setMode set mode creation.
|
||||
* @param value mode.
|
||||
*/
|
||||
void VGObject::setMode(const Valentina::Draws &value)
|
||||
void VGObject::setMode(const Draw &value)
|
||||
{
|
||||
mode = value;
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ void VGObject::setMode(const Valentina::Draws &value)
|
|||
* @brief getType return object type.
|
||||
* @return type.
|
||||
*/
|
||||
GObject::Type VGObject::getType() const
|
||||
GOType VGObject::getType() const
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
|
|
@ -30,20 +30,8 @@
|
|||
#define VGOBJECT_H
|
||||
|
||||
#include "../options.h"
|
||||
#include "../exception/vexception.h"
|
||||
#include <QCoreApplication>
|
||||
#include <QHash>
|
||||
|
||||
|
||||
namespace GObject
|
||||
{
|
||||
/**
|
||||
* @brief The NodeDetail enum type of graphical objects.
|
||||
*/
|
||||
enum Type { Point, Arc, Spline, SplinePath };
|
||||
Q_DECLARE_FLAGS(Types, Type)
|
||||
}
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(GObject::Types)
|
||||
enum class GOType : char { Point, Arc, Spline, SplinePath };
|
||||
|
||||
/**
|
||||
* @brief The VGObject class keep information graphical objects.
|
||||
|
@ -52,8 +40,7 @@ class VGObject
|
|||
{
|
||||
public:
|
||||
VGObject();
|
||||
VGObject(const GObject::Type &type, const quint32 &idObject = 0,
|
||||
const Valentina::Draws &mode = Valentina::Calculation);
|
||||
VGObject(const GOType &type, const quint32 &idObject = 0, const Draw &mode = Draw::Calculation);
|
||||
VGObject(const VGObject &obj);
|
||||
VGObject& operator= (const VGObject &obj);
|
||||
virtual ~VGObject(){}
|
||||
|
@ -61,9 +48,9 @@ public:
|
|||
void setIdObject(const quint32 &value);
|
||||
virtual QString name() const;
|
||||
void setName(const QString &name);
|
||||
Valentina::Draws getMode() const;
|
||||
void setMode(const Valentina::Draws &value);
|
||||
GObject::Type getType() const;
|
||||
Draw getMode() const;
|
||||
void setMode(const Draw &value);
|
||||
GOType getType() const;
|
||||
quint32 id() const;
|
||||
virtual void setId(const quint32 &id);
|
||||
protected:
|
||||
|
@ -71,7 +58,7 @@ protected:
|
|||
quint32 _id;
|
||||
|
||||
/** @brief type type of graphical object */
|
||||
GObject::Type type;
|
||||
GOType type;
|
||||
|
||||
/** @brief idObject id of parent object. Only for modeling. All another return 0. */
|
||||
quint32 idObject;
|
||||
|
@ -80,7 +67,7 @@ protected:
|
|||
QString _name;
|
||||
|
||||
/** @brief mode object created in calculation or drawing mode */
|
||||
Valentina::Draws mode;
|
||||
Draw mode;
|
||||
};
|
||||
|
||||
#endif // VGOBJECT_H
|
||||
|
|
|
@ -30,11 +30,11 @@
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VNodeDetail::VNodeDetail()
|
||||
:id(0), typeTool(Valentina::NodePoint), typeNode(NodeDetail::Contour), mx(0), my(0)
|
||||
:id(0), typeTool(Tool::NodePoint), typeNode(NodeDetail::Contour), mx(0), my(0)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VNodeDetail::VNodeDetail(quint32 id, Valentina::Tools typeTool, NodeDetail::NodeDetails typeNode, qreal mx, qreal my)
|
||||
VNodeDetail::VNodeDetail(quint32 id, Tool typeTool, NodeDetail typeNode, qreal mx, qreal my)
|
||||
:id(id), typeTool(typeTool), typeNode(typeNode), mx(mx), my(my)
|
||||
{}
|
||||
|
||||
|
|
|
@ -29,18 +29,9 @@
|
|||
#ifndef VNODEDETAIL_H
|
||||
#define VNODEDETAIL_H
|
||||
|
||||
#include <QMetaType>
|
||||
#include "../options.h"
|
||||
|
||||
namespace NodeDetail
|
||||
{
|
||||
/**
|
||||
* @brief The NodeDetail enum node can be node of contour or node modeling.
|
||||
*/
|
||||
enum NodeDetail { Contour, Modeling };
|
||||
Q_DECLARE_FLAGS(NodeDetails, NodeDetail)
|
||||
}
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(NodeDetail::NodeDetails)
|
||||
enum class NodeDetail : char { Contour, Modeling };
|
||||
|
||||
/**
|
||||
* @brief The VNodeDetail class keep information about detail node.
|
||||
|
@ -60,8 +51,7 @@ public:
|
|||
* @param mx object bias x axis
|
||||
* @param my object bias y axis
|
||||
*/
|
||||
VNodeDetail(quint32 id, Valentina::Tools typeTool, NodeDetail::NodeDetails typeNode, qreal mx = 0,
|
||||
qreal my = 0);
|
||||
VNodeDetail(quint32 id, Tool typeTool, NodeDetail typeNode, qreal mx = 0, qreal my = 0);
|
||||
/**
|
||||
* @brief VNodeDetail copy constructor
|
||||
* @param node node
|
||||
|
@ -87,22 +77,22 @@ public:
|
|||
* @brief getTypeTool return tool type.
|
||||
* @return tool type.
|
||||
*/
|
||||
Valentina::Tools getTypeTool() const;
|
||||
Tool getTypeTool() const;
|
||||
/**
|
||||
* @brief setTypeTool set tool type.
|
||||
* @param value tool type.
|
||||
*/
|
||||
void setTypeTool(const Valentina::Tools &value);
|
||||
void setTypeTool(const Tool &value);
|
||||
/**
|
||||
* @brief getTypeNode return node type.
|
||||
* @return node type.
|
||||
*/
|
||||
NodeDetail::NodeDetails getTypeNode() const;
|
||||
NodeDetail getTypeNode() const;
|
||||
/**
|
||||
* @brief setTypeNode set node type.
|
||||
* @param value node type.
|
||||
*/
|
||||
void setTypeNode(const NodeDetail::NodeDetails &value);
|
||||
void setTypeNode(const NodeDetail &value);
|
||||
/**
|
||||
* @brief getMx return object bias x axis.
|
||||
* @return bias x axis.
|
||||
|
@ -131,11 +121,11 @@ private:
|
|||
/**
|
||||
* @brief typeTool type of tool
|
||||
*/
|
||||
Valentina::Tools typeTool;
|
||||
Tool typeTool;
|
||||
/**
|
||||
* @brief typeNode node type.
|
||||
*/
|
||||
NodeDetail::NodeDetails typeNode;
|
||||
NodeDetail typeNode;
|
||||
/**
|
||||
* @brief mx bias x axis.
|
||||
*/
|
||||
|
@ -156,22 +146,22 @@ inline void VNodeDetail::setId(const quint32 &value)
|
|||
id = value;
|
||||
}
|
||||
|
||||
inline Valentina::Tools VNodeDetail::getTypeTool() const
|
||||
inline Tool VNodeDetail::getTypeTool() const
|
||||
{
|
||||
return typeTool;
|
||||
}
|
||||
|
||||
inline void VNodeDetail::setTypeTool(const Valentina::Tools &value)
|
||||
inline void VNodeDetail::setTypeTool(const Tool &value)
|
||||
{
|
||||
typeTool = value;
|
||||
}
|
||||
|
||||
inline NodeDetail::NodeDetails VNodeDetail::getTypeNode() const
|
||||
inline NodeDetail VNodeDetail::getTypeNode() const
|
||||
{
|
||||
return typeNode;
|
||||
}
|
||||
|
||||
inline void VNodeDetail::setTypeNode(const NodeDetail::NodeDetails &value)
|
||||
inline void VNodeDetail::setTypeNode(const NodeDetail &value)
|
||||
{
|
||||
typeNode = value;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
*************************************************************************/
|
||||
|
||||
#include "vpointf.h"
|
||||
#include <QPointF>
|
||||
#include <QString>
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
@ -36,8 +38,8 @@
|
|||
* @param mx offset name respect to x
|
||||
* @param my offset name respect to y
|
||||
*/
|
||||
VPointF::VPointF(qreal x, qreal y, QString name, qreal mx, qreal my, quint32 idObject, Valentina::Draws mode)
|
||||
:VGObject(GObject::Point, idObject, mode), _mx(mx), _my(my), _x(x), _y(y)
|
||||
VPointF::VPointF(qreal x, qreal y, QString name, qreal mx, qreal my, quint32 idObject, Draw mode)
|
||||
:VGObject(GOType::Point, idObject, mode), _mx(mx), _my(my), _x(x), _y(y)
|
||||
{
|
||||
this->_name = name;
|
||||
}
|
||||
|
@ -46,7 +48,7 @@ VPointF::VPointF(qreal x, qreal y, QString name, qreal mx, qreal my, quint32 idO
|
|||
/**
|
||||
* @brief VPointF creat empty point
|
||||
*/
|
||||
VPointF::VPointF() :VGObject(GObject::Point, 0, Valentina::Calculation), _mx(0), _my(0), _x(0), _y(0)
|
||||
VPointF::VPointF() :VGObject(GOType::Point, 0, Draw::Calculation), _mx(0), _my(0), _x(0), _y(0)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -78,3 +80,13 @@ QString VPointF::name() const
|
|||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief toQPointF convert to QPointF
|
||||
* @return QPointF point
|
||||
*/
|
||||
QPointF VPointF::toQPointF() const
|
||||
{
|
||||
return QPointF(_x, _y);
|
||||
}
|
||||
|
|
|
@ -29,11 +29,11 @@
|
|||
#ifndef VPOINTF_H
|
||||
#define VPOINTF_H
|
||||
|
||||
#include <QPointF>
|
||||
#include <QString>
|
||||
#include "../options.h"
|
||||
#include "vgobject.h"
|
||||
|
||||
class QPointF;
|
||||
class QString;
|
||||
|
||||
/**
|
||||
* @brief The VPointF class keep data of point.
|
||||
*/
|
||||
|
@ -44,7 +44,7 @@ public:
|
|||
VPointF (const VPointF &point );
|
||||
VPointF (const QPointF &point );
|
||||
VPointF ( qreal x, qreal y, QString name, qreal mx, qreal my, quint32 idObject = 0,
|
||||
Valentina::Draws mode = Valentina::Calculation);
|
||||
Draw mode = Draw::Calculation);
|
||||
virtual ~VPointF(){}
|
||||
VPointF &operator=(const VPointF &point);
|
||||
qreal mx() const;
|
||||
|
@ -111,16 +111,6 @@ inline void VPointF::setMy(qreal my)
|
|||
_my = my;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief toQPointF convert to QPointF
|
||||
* @return QPointF point
|
||||
*/
|
||||
inline QPointF VPointF::toQPointF() const
|
||||
{
|
||||
return QPointF(_x, _y);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief x return x coordinate
|
||||
|
|
|
@ -27,16 +27,18 @@
|
|||
*************************************************************************/
|
||||
|
||||
#include "vspline.h"
|
||||
#include <cmath>
|
||||
#include <QDebug>
|
||||
#include <QtMath>
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
# include <QtMath> // for M_PI on Windows
|
||||
#endif /*Q_OS_WIN32*/
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief VSpline default constructor
|
||||
*/
|
||||
VSpline::VSpline()
|
||||
:VGObject(GObject::Spline), p1(VPointF()), p2(QPointF()), p3(QPointF()), p4(VPointF()), angle1(0), angle2(0),
|
||||
:VGObject(GOType::Spline), p1(VPointF()), p2(QPointF()), p3(QPointF()), p4(VPointF()), angle1(0), angle2(0),
|
||||
kAsm1(1), kAsm2(1), kCurve(1)
|
||||
{}
|
||||
|
||||
|
@ -63,8 +65,8 @@ VSpline::VSpline ( const VSpline & spline )
|
|||
* @param kAsm2 coefficient of length second control line.
|
||||
*/
|
||||
VSpline::VSpline (VPointF p1, VPointF p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve,
|
||||
quint32 idObject, Valentina::Draws mode)
|
||||
:VGObject(GObject::Spline, idObject, mode), p1(p1), p2(QPointF()), p3(QPointF()), p4(p4), angle1(angle1),
|
||||
quint32 idObject, Draw mode)
|
||||
:VGObject(GOType::Spline, idObject, mode), p1(p1), p2(QPointF()), p3(QPointF()), p4(p4), angle1(angle1),
|
||||
angle2(angle2), kAsm1(kAsm1), kAsm2(kAsm2), kCurve(kCurve)
|
||||
{
|
||||
CreateName();
|
||||
|
@ -98,8 +100,8 @@ VSpline::VSpline (VPointF p1, VPointF p4, qreal angle1, qreal angle2, qreal kAsm
|
|||
* @param p3 second control point.
|
||||
* @param p4 second point spline.
|
||||
*/
|
||||
VSpline::VSpline (VPointF p1, QPointF p2, QPointF p3, VPointF p4, qreal kCurve, quint32 idObject, Valentina::Draws mode)
|
||||
:VGObject(GObject::Spline, idObject, mode), p1(p1), p2(p2), p3(p3), p4(p4), angle1(0), angle2(0), kAsm1(1),
|
||||
VSpline::VSpline (VPointF p1, QPointF p2, QPointF p3, VPointF p4, qreal kCurve, quint32 idObject, Draw mode)
|
||||
:VGObject(GOType::Spline, idObject, mode), p1(p1), p2(p2), p3(p3), p4(p4), angle1(0), angle2(0), kAsm1(1),
|
||||
kAsm2(1), kCurve(1)
|
||||
{
|
||||
CreateName();
|
||||
|
@ -168,8 +170,8 @@ QLineF::IntersectType VSpline::CrossingSplLine ( const QLineF &line, QPointF *in
|
|||
QLineF::IntersectType type = QLineF::NoIntersection;
|
||||
for ( i = 0; i < px.count()-1; ++i )
|
||||
{
|
||||
type = line.intersect(QLineF ( QPointF ( px[i], py[i] ),
|
||||
QPointF ( px[i+1], py[i+1] )), &crosPoint);
|
||||
type = line.intersect(QLineF ( QPointF ( px.at(i), py.at(i) ),
|
||||
QPointF ( px.at(i+1), py.at(i+1) )), &crosPoint);
|
||||
if ( type == QLineF::BoundedIntersection )
|
||||
{
|
||||
*intersectionPoint = crosPoint;
|
||||
|
@ -318,7 +320,7 @@ QVector<QPointF> VSpline::GetPoints (const QPointF &p1, const QPointF &p2, const
|
|||
y.append ( p4.y () );
|
||||
for ( qint32 i = 0; i < x.count(); ++i )
|
||||
{
|
||||
pvector.append( QPointF ( x[i], y[i] ) );
|
||||
pvector.append( QPointF ( x.at(i), y.at(i)) );
|
||||
}
|
||||
return pvector;
|
||||
}
|
||||
|
@ -336,10 +338,10 @@ qreal VSpline::LengthBezier ( const QPointF &p1, const QPointF &p2, const QPoint
|
|||
{
|
||||
QPainterPath splinePath;
|
||||
QVector<QPointF> points = GetPoints (p1, p2, p3, p4);
|
||||
splinePath.moveTo(points[0]);
|
||||
splinePath.moveTo(points.at(0));
|
||||
for (qint32 i = 1; i < points.count(); ++i)
|
||||
{
|
||||
splinePath.lineTo(points[i]);
|
||||
splinePath.lineTo(points.at(i));
|
||||
}
|
||||
return splinePath.length();
|
||||
}
|
||||
|
@ -675,8 +677,8 @@ QPainterPath VSpline::GetPath() const
|
|||
{
|
||||
for (qint32 i = 0; i < points.count()-1; ++i)
|
||||
{
|
||||
splinePath.moveTo(points[i]);
|
||||
splinePath.lineTo(points[i+1]);
|
||||
splinePath.moveTo(points.at(i));
|
||||
splinePath.lineTo(points.at(i+1));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -32,11 +32,8 @@
|
|||
#include "vpointf.h"
|
||||
#include "vgobject.h"
|
||||
|
||||
#include <QHash>
|
||||
#include <QLineF>
|
||||
#include <QPainterPath>
|
||||
|
||||
class QString;
|
||||
class QLineF;
|
||||
class QPainterPath;
|
||||
|
||||
#define M_2PI 6.28318530717958647692528676655900576
|
||||
|
||||
|
@ -49,9 +46,10 @@ public:
|
|||
VSpline();
|
||||
VSpline (const VSpline &spline );
|
||||
VSpline (VPointF p1, VPointF p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve,
|
||||
quint32 idObject = 0, Valentina::Draws mode = Valentina::Calculation);
|
||||
quint32 idObject = 0, Draw mode = Draw::Calculation);
|
||||
VSpline (VPointF p1, QPointF p2, QPointF p3, VPointF p4, qreal kCurve, quint32 idObject = 0,
|
||||
Valentina::Draws mode = Valentina::Calculation);
|
||||
Draw mode = Draw::Calculation);
|
||||
VSpline &operator=(const VSpline &spl);
|
||||
VPointF GetP1 () const;
|
||||
QPointF GetP2 () const;
|
||||
QPointF GetP3 () const;
|
||||
|
@ -72,7 +70,6 @@ public:
|
|||
// cppcheck-suppress unusedFunction
|
||||
static QVector<QPointF> SplinePoints(const QPointF &p1, const QPointF &p4, qreal angle1, qreal angle2, qreal kAsm1,
|
||||
qreal kAsm2, qreal kCurve);
|
||||
VSpline &operator=(const VSpline &spl);
|
||||
protected:
|
||||
static QVector<QPointF> GetPoints (const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4 );
|
||||
private:
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
#include "../exception/vexception.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VSplinePath::VSplinePath(qreal kCurve, quint32 idObject, Valentina::Draws mode)
|
||||
: VGObject(GObject::SplinePath, idObject, mode), path(QVector<VSplinePoint>()), kCurve(kCurve), maxCountPoints(0)
|
||||
VSplinePath::VSplinePath(qreal kCurve, quint32 idObject, Draw mode)
|
||||
: VGObject(GOType::SplinePath, idObject, mode), path(QVector<VSplinePoint>()), kCurve(kCurve), maxCountPoints(0)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -76,8 +76,8 @@ VSpline VSplinePath::GetSpline(qint32 index) const
|
|||
{
|
||||
throw VException(tr("This spline does not exist."));
|
||||
}
|
||||
VSpline spl(path[index-1].P(), path[index].P(), path[index-1].Angle2(), path[index].Angle1(),
|
||||
path[index-1].KAsm2(), path[index].KAsm1(), this->kCurve);
|
||||
VSpline spl(path.at(index-1).P(), path.at(index).P(), path.at(index-1).Angle2(), path.at(index).Angle1(),
|
||||
path.at(index-1).KAsm2(), path.at(index).KAsm1(), this->kCurve);
|
||||
return spl;
|
||||
}
|
||||
|
||||
|
@ -87,8 +87,8 @@ QPainterPath VSplinePath::GetPath() const
|
|||
QPainterPath painterPath;
|
||||
for (qint32 i = 1; i <= Count(); ++i)
|
||||
{
|
||||
VSpline spl(path[i-1].P(), path[i].P(), path[i-1].Angle2(), path[i].Angle1(),
|
||||
path[i-1].KAsm2(), path[i].KAsm1(), this->kCurve);
|
||||
VSpline spl(path.at(i-1).P(), path.at(i).P(), path.at(i-1).Angle2(), path.at(i).Angle1(),
|
||||
path.at(i-1).KAsm2(), path.at(i).KAsm1(), this->kCurve);
|
||||
painterPath.addPath(spl.GetPath());
|
||||
}
|
||||
return painterPath;
|
||||
|
@ -100,8 +100,8 @@ QVector<QPointF> VSplinePath::GetPathPoints() const
|
|||
QVector<QPointF> pathPoints;
|
||||
for (qint32 i = 1; i <= Count(); ++i)
|
||||
{
|
||||
VSpline spl(path[i-1].P(), path[i].P(), path[i-1].Angle2(), path[i].Angle1(),
|
||||
path[i-1].KAsm2(), path[i].KAsm1(), this->kCurve);
|
||||
VSpline spl(path.at(i-1).P(), path.at(i).P(), path.at(i-1).Angle2(), path.at(i).Angle1(),
|
||||
path.at(i-1).KAsm2(), path.at(i).KAsm1(), this->kCurve);
|
||||
pathPoints += spl.GetPoints();
|
||||
}
|
||||
return pathPoints;
|
||||
|
@ -113,21 +113,21 @@ qreal VSplinePath::GetLength() const
|
|||
qreal length = 0;
|
||||
for (qint32 i = 1; i <= Count(); ++i)
|
||||
{
|
||||
VSpline spl(path[i-1].P(), path[i].P(), path[i-1].Angle2(), path[i].Angle1(), path[i-1].KAsm2(),
|
||||
path[i].KAsm1(), kCurve);
|
||||
VSpline spl(path.at(i-1).P(), path.at(i).P(), path.at(i-1).Angle2(), path.at(i).Angle1(), path.at(i-1).KAsm2(),
|
||||
path.at(i).KAsm1(), kCurve);
|
||||
length += spl.GetLength();
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VSplinePath::UpdatePoint(qint32 indexSpline, const SplinePoint::Position &pos, const VSplinePoint &point)
|
||||
void VSplinePath::UpdatePoint(qint32 indexSpline, const SplinePointPosition &pos, const VSplinePoint &point)
|
||||
{
|
||||
if (indexSpline < 1 || indexSpline > Count())
|
||||
{
|
||||
throw VException(tr("This spline does not exist."));
|
||||
}
|
||||
if (pos == SplinePoint::FirstPoint)
|
||||
if (pos == SplinePointPosition::FirstPoint)
|
||||
{
|
||||
path[indexSpline-1] = point;
|
||||
}
|
||||
|
@ -138,13 +138,13 @@ void VSplinePath::UpdatePoint(qint32 indexSpline, const SplinePoint::Position &p
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VSplinePoint VSplinePath::GetSplinePoint(qint32 indexSpline, SplinePoint::Position pos) const
|
||||
VSplinePoint VSplinePath::GetSplinePoint(qint32 indexSpline, SplinePointPosition pos) const
|
||||
{
|
||||
if (indexSpline < 1 || indexSpline > Count())
|
||||
{
|
||||
throw VException(tr("This spline does not exist."));
|
||||
}
|
||||
if (pos == SplinePoint::FirstPoint)
|
||||
if (pos == SplinePointPosition::FirstPoint)
|
||||
{
|
||||
return path.at(indexSpline-1);
|
||||
}
|
||||
|
@ -199,8 +199,8 @@ QPointF VSplinePath::CutSplinePath(qreal length, qint32 &p1, qint32 &p2, QPointF
|
|||
fullLength = 0;
|
||||
for (qint32 i = 1; i <= Count(); ++i)
|
||||
{
|
||||
VSpline spl = VSpline(path[i-1].P(), path[i].P(), path[i-1].Angle2(), path[i].Angle1(), path[i-1].KAsm2(),
|
||||
path[i].KAsm1(), kCurve);
|
||||
VSpline spl = VSpline(path.at(i-1).P(), path.at(i).P(), path.at(i-1).Angle2(), path.at(i).Angle1(),
|
||||
path.at(i-1).KAsm2(), path.at(i).KAsm1(), kCurve);
|
||||
fullLength += spl.GetLength();
|
||||
if (fullLength > length)
|
||||
{
|
||||
|
|
|
@ -29,22 +29,11 @@
|
|||
#ifndef VSPLINEPATH_H
|
||||
#define VSPLINEPATH_H
|
||||
|
||||
#include "vsplinepoint.h"
|
||||
#include "vpointf.h"
|
||||
#include "vspline.h"
|
||||
#include "vgobject.h"
|
||||
#include <QApplication>
|
||||
#include "../container/vcontainer.h"
|
||||
#include "vspline.h"
|
||||
#include "vsplinepoint.h"
|
||||
|
||||
namespace SplinePoint
|
||||
{
|
||||
/**
|
||||
* @brief The Position enum position in spline.
|
||||
*/
|
||||
enum Position { FirstPoint, LastPoint };
|
||||
Q_DECLARE_FLAGS(Positions, Position)
|
||||
}
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS( SplinePoint::Positions )
|
||||
enum class SplinePointPosition : char { FirstPoint, LastPoint };
|
||||
|
||||
/**
|
||||
* @brief The VSplinePath class keep information about splinePath.
|
||||
|
@ -59,7 +48,7 @@ public:
|
|||
* @param idObject parent id.
|
||||
* @param mode mode creation spline path.
|
||||
*/
|
||||
VSplinePath(qreal kCurve = 1, quint32 idObject = 0, Valentina::Draws mode = Valentina::Calculation);
|
||||
VSplinePath(qreal kCurve = 1, quint32 idObject = 0, Draw mode = Draw::Calculation);
|
||||
/**
|
||||
* @brief VSplinePath copy constructor.
|
||||
* @param splPath spline path.
|
||||
|
@ -112,14 +101,14 @@ public:
|
|||
* @param pos position point in spline.
|
||||
* @param point point.
|
||||
*/
|
||||
void UpdatePoint(qint32 indexSpline, const SplinePoint::Position &pos, const VSplinePoint &point);
|
||||
void UpdatePoint(qint32 indexSpline, const SplinePointPosition &pos, const VSplinePoint &point);
|
||||
/**
|
||||
* @brief GetSplinePoint return spline point from list.
|
||||
* @param indexSpline spline index in list.
|
||||
* @param pos position point in spline.
|
||||
* @return spline point.
|
||||
*/
|
||||
VSplinePoint GetSplinePoint(qint32 indexSpline, SplinePoint::Position pos) const;
|
||||
VSplinePoint GetSplinePoint(qint32 indexSpline, SplinePointPosition pos) const;
|
||||
/**
|
||||
* @brief Clear clear list of points.
|
||||
*/
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#ifndef VSPLINEPOINT_H
|
||||
#define VSPLINEPOINT_H
|
||||
|
||||
#include <QMetaType>
|
||||
#include "vpointf.h"
|
||||
|
||||
/**
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
#include "exception/vexceptionwrongid.h"
|
||||
#include "version.h"
|
||||
#include "xml/vstandardmeasurements.h"
|
||||
#include "xml/vindividualmeasurements.h"
|
||||
#include "widgets/vapplication.h"
|
||||
|
||||
#include <QInputDialog>
|
||||
#include <QtCore>
|
||||
|
@ -52,10 +54,10 @@
|
|||
* @param parent parent widget.
|
||||
*/
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
:QMainWindow(parent), ui(new Ui::MainWindow), pattern(nullptr), doc(nullptr), tool(Valentina::ArrowTool),
|
||||
:QMainWindow(parent), ui(new Ui::MainWindow), pattern(nullptr), doc(nullptr), tool(Tool::ArrowTool),
|
||||
currentScene(nullptr), sceneDraw(nullptr), sceneDetails(nullptr), mouseCoordinate(nullptr), helpLabel(nullptr),
|
||||
view(nullptr), isInitialized(false), dialogTable(0), dialogTool(nullptr), dialogHistory(nullptr),
|
||||
comboBoxDraws(nullptr), curFile(QString()), mode(Valentina::Calculation), currentDrawIndex(0),
|
||||
comboBoxDraws(nullptr), curFile(QString()), mode(Draw::Calculation), currentDrawIndex(0),
|
||||
currentToolBoxIndex(0), drawMode(true), recentFileActs{0, 0, 0, 0, 0}, separatorAct(nullptr),
|
||||
autoSaveTimer(nullptr)
|
||||
{
|
||||
|
@ -82,6 +84,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
policy.setHorizontalStretch(12);
|
||||
view->setSizePolicy(policy);
|
||||
qApp->setSceneView(view);
|
||||
helpLabel = new QLabel(QObject::tr("Create new pattern piece to start working."));
|
||||
ui->statusBar->addWidget(helpLabel);
|
||||
|
||||
|
@ -89,9 +92,11 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
|
||||
pattern = new VContainer();
|
||||
|
||||
doc = new VPattern(pattern, comboBoxDraws, &mode);
|
||||
connect(doc, &VPattern::patternChanged, this, &MainWindow::PatternWasModified);
|
||||
doc = new VPattern(pattern, &mode, sceneDraw, sceneDetails);
|
||||
connect(doc, &VPattern::ClearMainWindow, this, &MainWindow::Clear);
|
||||
connect(doc, &VPattern::UndoCommand, this, &MainWindow::FullParseFile);
|
||||
|
||||
connect(qApp->getUndoStack(), &QUndoStack::cleanChanged, this, &MainWindow::PatternWasModified);
|
||||
|
||||
InitAutoSave();
|
||||
|
||||
|
@ -104,19 +109,22 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief ActionNewDraw add to scene new pattern peace.
|
||||
* @brief ActionNewPP add to scene new pattern piece.
|
||||
*/
|
||||
void MainWindow::ActionNewDraw()
|
||||
void MainWindow::ActionNewPP()
|
||||
{
|
||||
QString patternPieceName = QString(tr("Pattern piece %1")).arg(comboBoxDraws->count()+1);
|
||||
QString path;
|
||||
if (comboBoxDraws->count() == 0)
|
||||
{
|
||||
QString path;
|
||||
DialogMeasurements measurements(this);
|
||||
measurements.exec();
|
||||
if (measurements.type() == Measurements::Standard)
|
||||
if (measurements.exec() == QDialog::Rejected)
|
||||
{
|
||||
qApp->setPatternType(Pattern::Standard);
|
||||
return;
|
||||
}
|
||||
if (measurements.type() == MeasurementsType::Standard)
|
||||
{
|
||||
qApp->setPatternType(MeasurementsType::Standard);
|
||||
DialogStandardMeasurements stMeasurements(pattern, patternPieceName, this);
|
||||
if (stMeasurements.exec() == QDialog::Accepted)
|
||||
{
|
||||
|
@ -135,7 +143,7 @@ void MainWindow::ActionNewDraw()
|
|||
}
|
||||
else
|
||||
{
|
||||
qApp->setPatternType(Pattern::Individual);
|
||||
qApp->setPatternType(MeasurementsType::Individual);
|
||||
DialogIndividualMeasurements indMeasurements(pattern, patternPieceName, this);
|
||||
if (indMeasurements.exec() == QDialog::Accepted)
|
||||
{
|
||||
|
@ -150,7 +158,6 @@ void MainWindow::ActionNewDraw()
|
|||
return;
|
||||
}
|
||||
}
|
||||
doc->CreateEmptyFile(path);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -159,10 +166,11 @@ void MainWindow::ActionNewDraw()
|
|||
{
|
||||
return;
|
||||
}
|
||||
path = doc->MPath();
|
||||
}
|
||||
if (doc->appendDraw(patternPieceName) == false)
|
||||
if (doc->appendPP(patternPieceName) == false)
|
||||
{
|
||||
qDebug()<<"Error creating pattern with the name "<<patternPieceName<<".";
|
||||
qDebug()<<"Error creating pattern piece with the name "<<patternPieceName<<".";
|
||||
return;
|
||||
}
|
||||
disconnect(comboBoxDraws, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
|
@ -173,14 +181,14 @@ void MainWindow::ActionNewDraw()
|
|||
//Create single point
|
||||
const quint32 id = pattern->AddGObject(new VPointF(qApp->toPixel((10+comboBoxDraws->count()*5)), qApp->toPixel(10),
|
||||
"А", 5, 10));
|
||||
VToolSinglePoint *spoint = new VToolSinglePoint(doc, pattern, id, Valentina::FromGui);
|
||||
VToolSinglePoint *spoint = new VToolSinglePoint(doc, pattern, id, Source::FromGui, patternPieceName, path);
|
||||
sceneDraw->addItem(spoint);
|
||||
connect(spoint, &VToolPoint::ChoosedTool, sceneDraw, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(sceneDraw, &VMainGraphicsScene::NewFactor, spoint, &VToolSinglePoint::SetFactor);
|
||||
QHash<quint32, VDataTool*>* tools = doc->getTools();
|
||||
SCASSERT(tools != nullptr);
|
||||
tools->insert(id, spoint);
|
||||
VDrawTool::AddRecord(id, Valentina::SinglePointTool, doc);
|
||||
VDrawTool::AddRecord(id, Tool::SinglePointTool, doc);
|
||||
SetEnableTool(true);
|
||||
SetEnableWidgets(true);
|
||||
|
||||
|
@ -188,7 +196,10 @@ void MainWindow::ActionNewDraw()
|
|||
if ( index != -1 )
|
||||
{ // -1 for not found
|
||||
comboBoxDraws->setCurrentIndex(index);
|
||||
currentDrawChanged( index );
|
||||
}
|
||||
else
|
||||
{
|
||||
comboBoxDraws->setCurrentIndex(0);
|
||||
}
|
||||
connect(comboBoxDraws, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||
&MainWindow::currentDrawChanged);
|
||||
|
@ -226,7 +237,7 @@ void MainWindow::OptionDraw()
|
|||
* @param closeDialogSlot function what handle after close dialog.
|
||||
*/
|
||||
template <typename Dialog, typename Func>
|
||||
void MainWindow::SetToolButton(bool checked, Valentina::Tools t, const QString &cursor, const QString &toolTip,
|
||||
void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, const QString &toolTip,
|
||||
Func closeDialogSlot)
|
||||
{
|
||||
if (checked)
|
||||
|
@ -264,7 +275,7 @@ template <typename Dialog, typename Func, typename Func2>
|
|||
* @param closeDialogSlot function to handle close of dialog.
|
||||
* @param applyDialogSlot function to handle apply in dialog.
|
||||
*/
|
||||
void MainWindow::SetToolButtonWithApply(bool checked, Valentina::Tools t, const QString &cursor, const QString &toolTip,
|
||||
void MainWindow::SetToolButtonWithApply(bool checked, Tool t, const QString &cursor, const QString &toolTip,
|
||||
Func closeDialogSlot, Func2 applyDialogSlot)
|
||||
{
|
||||
if (checked)
|
||||
|
@ -367,7 +378,7 @@ void MainWindow::ApplyDialog()
|
|||
*/
|
||||
void MainWindow::ToolEndLine(bool checked)
|
||||
{
|
||||
SetToolButtonWithApply<DialogEndLine>(checked, Valentina::EndLineTool, ":/cursor/endline_cursor.png", tr("Select point"),
|
||||
SetToolButtonWithApply<DialogEndLine>(checked, Tool::EndLineTool, ":/cursor/endline_cursor.png", tr("Select point"),
|
||||
&MainWindow::ClosedDialogEndLine,&MainWindow::ApplyDialogEndLine);
|
||||
}
|
||||
|
||||
|
@ -397,7 +408,7 @@ void MainWindow::ClosedDialogEndLine(int result)
|
|||
*/
|
||||
void MainWindow::ToolLine(bool checked)
|
||||
{
|
||||
SetToolButton<DialogLine>(checked, Valentina::LineTool, ":/cursor/line_cursor.png", tr("Select first point"),
|
||||
SetToolButton<DialogLine>(checked, Tool::LineTool, ":/cursor/line_cursor.png", tr("Select first point"),
|
||||
&MainWindow::ClosedDialogLine);
|
||||
}
|
||||
|
||||
|
@ -418,7 +429,7 @@ void MainWindow::ClosedDialogLine(int result)
|
|||
*/
|
||||
void MainWindow::ToolAlongLine(bool checked)
|
||||
{
|
||||
SetToolButtonWithApply<DialogAlongLine>(checked, Valentina::AlongLineTool, ":/cursor/alongline_cursor.png",
|
||||
SetToolButtonWithApply<DialogAlongLine>(checked, Tool::AlongLineTool, ":/cursor/alongline_cursor.png",
|
||||
tr("Select point"), &MainWindow::ClosedDialogAlongLine, &MainWindow::ApplyDialogAlongLine);
|
||||
}
|
||||
|
||||
|
@ -448,7 +459,7 @@ void MainWindow::ClosedDialogAlongLine(int result)
|
|||
*/
|
||||
void MainWindow::ToolShoulderPoint(bool checked)
|
||||
{
|
||||
SetToolButtonWithApply<DialogShoulderPoint>(checked, Valentina::ShoulderPointTool, ":/cursor/shoulder_cursor.png",
|
||||
SetToolButtonWithApply<DialogShoulderPoint>(checked, Tool::ShoulderPointTool, ":/cursor/shoulder_cursor.png",
|
||||
tr("Select first point of line"), &MainWindow::ClosedDialogShoulderPoint,
|
||||
&MainWindow::ApplyDialogShoulderPoint);
|
||||
}
|
||||
|
@ -479,7 +490,7 @@ void MainWindow::ClosedDialogShoulderPoint(int result)
|
|||
*/
|
||||
void MainWindow::ToolNormal(bool checked)
|
||||
{
|
||||
SetToolButtonWithApply<DialogNormal>(checked, Valentina::NormalTool, ":/cursor/normal_cursor.png",
|
||||
SetToolButtonWithApply<DialogNormal>(checked, Tool::NormalTool, ":/cursor/normal_cursor.png",
|
||||
tr("Select first point of line"), &MainWindow::ClosedDialogNormal,
|
||||
&MainWindow::ApplyDialogNormal);
|
||||
}
|
||||
|
@ -510,7 +521,7 @@ void MainWindow::ClosedDialogNormal(int result)
|
|||
*/
|
||||
void MainWindow::ToolBisector(bool checked)
|
||||
{
|
||||
SetToolButtonWithApply<DialogBisector>(checked, Valentina::BisectorTool, ":/cursor/bisector_cursor.png",
|
||||
SetToolButtonWithApply<DialogBisector>(checked, Tool::BisectorTool, ":/cursor/bisector_cursor.png",
|
||||
tr("Select first point of angle"), &MainWindow::ClosedDialogBisector,
|
||||
&MainWindow::ApplyDialogBisector);
|
||||
}
|
||||
|
@ -541,7 +552,7 @@ void MainWindow::ClosedDialogBisector(int result)
|
|||
*/
|
||||
void MainWindow::ToolLineIntersect(bool checked)
|
||||
{
|
||||
SetToolButton<DialogLineIntersect>(checked, Valentina::LineIntersectTool, ":/cursor/intersect_cursor.png",
|
||||
SetToolButton<DialogLineIntersect>(checked, Tool::LineIntersectTool, ":/cursor/intersect_cursor.png",
|
||||
tr("Select first point of first line"), &MainWindow::ClosedDialogLineIntersect);
|
||||
}
|
||||
|
||||
|
@ -562,7 +573,7 @@ void MainWindow::ClosedDialogLineIntersect(int result)
|
|||
*/
|
||||
void MainWindow::ToolSpline(bool checked)
|
||||
{
|
||||
SetToolButton<DialogSpline>(checked, Valentina::SplineTool, ":/cursor/spline_cursor.png",
|
||||
SetToolButton<DialogSpline>(checked, Tool::SplineTool, ":/cursor/spline_cursor.png",
|
||||
tr("Select first point curve"), &MainWindow::ClosedDialogSpline);
|
||||
}
|
||||
|
||||
|
@ -583,7 +594,7 @@ void MainWindow::ClosedDialogSpline(int result)
|
|||
*/
|
||||
void MainWindow::ToolCutSpline(bool checked)
|
||||
{
|
||||
SetToolButton<DialogCutSpline>(checked, Valentina::CutSplineTool, ":/cursor/spline_cut_point_cursor.png",
|
||||
SetToolButton<DialogCutSpline>(checked, Tool::CutSplineTool, ":/cursor/spline_cut_point_cursor.png",
|
||||
tr("Select simple curve"), &MainWindow::ClosedDialogCutSpline);
|
||||
}
|
||||
|
||||
|
@ -604,7 +615,7 @@ void MainWindow::ClosedDialogCutSpline(int result)
|
|||
*/
|
||||
void MainWindow::ToolArc(bool checked)
|
||||
{
|
||||
SetToolButtonWithApply<DialogArc>(checked, Valentina::ArcTool, ":/cursor/arc_cursor.png",
|
||||
SetToolButtonWithApply<DialogArc>(checked, Tool::ArcTool, ":/cursor/arc_cursor.png",
|
||||
tr("Select point of center of arc"), &MainWindow::ClosedDialogArc,
|
||||
&MainWindow::ApplyDialogArc);
|
||||
}
|
||||
|
@ -635,7 +646,7 @@ void MainWindow::ClosedDialogArc(int result)
|
|||
*/
|
||||
void MainWindow::ToolSplinePath(bool checked)
|
||||
{
|
||||
SetToolButton<DialogSplinePath>(checked, Valentina::SplinePathTool, ":/cursor/splinepath_cursor.png",
|
||||
SetToolButton<DialogSplinePath>(checked, Tool::SplinePathTool, ":/cursor/splinepath_cursor.png",
|
||||
tr("Select point of curve path"), &MainWindow::ClosedDialogSplinePath);
|
||||
}
|
||||
|
||||
|
@ -656,7 +667,7 @@ void MainWindow::ClosedDialogSplinePath(int result)
|
|||
*/
|
||||
void MainWindow::ToolCutSplinePath(bool checked)
|
||||
{
|
||||
SetToolButton<DialogCutSplinePath>(checked, Valentina::CutSplinePathTool,
|
||||
SetToolButton<DialogCutSplinePath>(checked, Tool::CutSplinePathTool,
|
||||
":/cursor/splinepath_cut_point_cursor.png", tr("Select curve path"),
|
||||
&MainWindow::ClosedDialogCutSplinePath);
|
||||
}
|
||||
|
@ -678,7 +689,7 @@ void MainWindow::ClosedDialogCutSplinePath(int result)
|
|||
*/
|
||||
void MainWindow::ToolPointOfContact(bool checked)
|
||||
{
|
||||
SetToolButtonWithApply<DialogPointOfContact>(checked, Valentina::PointOfContact, ":/cursor/pointcontact_cursor.png",
|
||||
SetToolButtonWithApply<DialogPointOfContact>(checked, Tool::PointOfContact, ":/cursor/pointcontact_cursor.png",
|
||||
tr("Select first point of line"), &MainWindow::ClosedDialogPointOfContact,
|
||||
&MainWindow::ApplyDialogPointOfContact);
|
||||
}
|
||||
|
@ -709,7 +720,7 @@ void MainWindow::ClosedDialogPointOfContact(int result)
|
|||
*/
|
||||
void MainWindow::ToolDetail(bool checked)
|
||||
{
|
||||
SetToolButton<DialogDetail>(checked, Valentina::DetailTool, "://cursor/new_detail_cursor.png",
|
||||
SetToolButton<DialogDetail>(checked, Tool::DetailTool, "://cursor/new_detail_cursor.png",
|
||||
tr("Select points, arcs, curves clockwise."), &MainWindow::ClosedDialogDetail);
|
||||
}
|
||||
|
||||
|
@ -725,7 +736,7 @@ void MainWindow::ClosedDialogDetail(int result)
|
|||
VToolDetail::Create(dialogTool, sceneDetails, doc, pattern);
|
||||
}
|
||||
ArrowTool();
|
||||
doc->FullUpdateTree();
|
||||
doc->LiteParseTree();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -735,7 +746,7 @@ void MainWindow::ClosedDialogDetail(int result)
|
|||
*/
|
||||
void MainWindow::ToolHeight(bool checked)
|
||||
{
|
||||
SetToolButton<DialogHeight>(checked, Valentina::Height, ":/cursor/height_cursor.png", tr("Select base point"),
|
||||
SetToolButton<DialogHeight>(checked, Tool::Height, ":/cursor/height_cursor.png", tr("Select base point"),
|
||||
&MainWindow::ClosedDialogHeight);
|
||||
}
|
||||
|
||||
|
@ -756,7 +767,7 @@ void MainWindow::ClosedDialogHeight(int result)
|
|||
*/
|
||||
void MainWindow::ToolTriangle(bool checked)
|
||||
{
|
||||
SetToolButton<DialogTriangle>(checked, Valentina::Triangle, ":/cursor/triangle_cursor.png",
|
||||
SetToolButton<DialogTriangle>(checked, Tool::Triangle, ":/cursor/triangle_cursor.png",
|
||||
tr("Select first point of axis"), &MainWindow::ClosedDialogTriangle);
|
||||
}
|
||||
|
||||
|
@ -777,7 +788,7 @@ void MainWindow::ClosedDialogTriangle(int result)
|
|||
*/
|
||||
void MainWindow::ToolPointOfIntersection(bool checked)
|
||||
{
|
||||
SetToolButton<DialogPointOfIntersection>(checked, Valentina::PointOfIntersection,
|
||||
SetToolButton<DialogPointOfIntersection>(checked, Tool::PointOfIntersection,
|
||||
":/cursor/pointofintersect_cursor.png", tr("Select point vertically"),
|
||||
&MainWindow::ClosedDialogPointOfIntersection);
|
||||
}
|
||||
|
@ -799,7 +810,7 @@ void MainWindow::ClosedDialogPointOfIntersection(int result)
|
|||
*/
|
||||
void MainWindow::ToolUnionDetails(bool checked)
|
||||
{
|
||||
SetToolButton<DialogUnionDetails>(checked, Valentina::UnionDetails, ":/cursor/union_cursor.png",
|
||||
SetToolButton<DialogUnionDetails>(checked, Tool::UnionDetails, ":/cursor/union_cursor.png",
|
||||
tr("Select detail"), &MainWindow::ClosedDialogUnionDetails);
|
||||
//Must disconnect this signal here.
|
||||
disconnect(doc, &VPattern::FullUpdateFromFile, dialogTool, &DialogTool::UpdateList);
|
||||
|
@ -813,7 +824,7 @@ void MainWindow::ToolUnionDetails(bool checked)
|
|||
void MainWindow::ClosedDialogUnionDetails(int result)
|
||||
{
|
||||
ClosedDialog<VToolUnionDetails>(result);
|
||||
doc->FullUpdateTree();
|
||||
doc->LiteParseTree();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -823,7 +834,7 @@ void MainWindow::ClosedDialogUnionDetails(int result)
|
|||
*/
|
||||
void MainWindow::ToolCutArc(bool checked)
|
||||
{
|
||||
SetToolButtonWithApply<DialogCutArc>(checked, Valentina::CutArcTool, ":/cursor/arc_cut_cursor.png",
|
||||
SetToolButtonWithApply<DialogCutArc>(checked, Tool::CutArcTool, ":/cursor/arc_cut_cursor.png",
|
||||
tr("Select arc"), &MainWindow::ClosedDialogCutArc, &MainWindow::ApplyDialogCutArc);
|
||||
}
|
||||
|
||||
|
@ -946,6 +957,7 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
|||
{
|
||||
WriteSettings();
|
||||
event->accept();
|
||||
qApp->closeAllWindows();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -959,7 +971,7 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
|||
*/
|
||||
void MainWindow::ToolBarOption()
|
||||
{
|
||||
if (qApp->patternType() == Pattern::Standard)
|
||||
if (qApp->patternType() == MeasurementsType::Standard)
|
||||
{
|
||||
ui->toolBarOption->addWidget(new QLabel(tr("Height: ")));
|
||||
|
||||
|
@ -1072,8 +1084,8 @@ void MainWindow::currentDrawChanged( int index )
|
|||
{
|
||||
if (index != -1)
|
||||
{
|
||||
doc->ChangeActivPP(comboBoxDraws->itemText(index));
|
||||
doc->setCurrentData();
|
||||
doc->ChangeActivDraw(comboBoxDraws->itemText(index));
|
||||
if (drawMode)
|
||||
{
|
||||
ArrowTool();
|
||||
|
@ -1112,107 +1124,111 @@ void MainWindow::CancelTool()
|
|||
dialogTool = nullptr;
|
||||
switch ( tool )
|
||||
{
|
||||
case Valentina::ArrowTool:
|
||||
case Tool::ArrowTool:
|
||||
ui->actionArrowTool->setChecked(false);
|
||||
helpLabel->setText("");
|
||||
break;
|
||||
case Valentina::SinglePointTool:
|
||||
case Tool::SinglePointTool:
|
||||
Q_UNREACHABLE();
|
||||
//Nothing to do here because we can't create this tool from main window.
|
||||
break;
|
||||
case Valentina::EndLineTool:
|
||||
case Tool::EndLineTool:
|
||||
ui->toolButtonEndLine->setChecked(false);
|
||||
currentScene->setFocus(Qt::OtherFocusReason);
|
||||
currentScene->clearSelection();
|
||||
break;
|
||||
case Valentina::LineTool:
|
||||
case Tool::LineTool:
|
||||
ui->toolButtonLine->setChecked(false);
|
||||
currentScene->setFocus(Qt::OtherFocusReason);
|
||||
currentScene->clearFocus();
|
||||
break;
|
||||
case Valentina::AlongLineTool:
|
||||
case Tool::AlongLineTool:
|
||||
ui->toolButtonAlongLine->setChecked(false);
|
||||
currentScene->setFocus(Qt::OtherFocusReason);
|
||||
currentScene->clearSelection();
|
||||
break;
|
||||
case Valentina::ShoulderPointTool:
|
||||
case Tool::ShoulderPointTool:
|
||||
ui->toolButtonShoulderPoint->setChecked(false);
|
||||
currentScene->setFocus(Qt::OtherFocusReason);
|
||||
currentScene->clearSelection();
|
||||
break;
|
||||
case Valentina::NormalTool:
|
||||
case Tool::NormalTool:
|
||||
ui->toolButtonNormal->setChecked(false);
|
||||
currentScene->setFocus(Qt::OtherFocusReason);
|
||||
currentScene->clearSelection();
|
||||
break;
|
||||
case Valentina::BisectorTool:
|
||||
case Tool::BisectorTool:
|
||||
ui->toolButtonBisector->setChecked(false);
|
||||
currentScene->setFocus(Qt::OtherFocusReason);
|
||||
currentScene->clearSelection();
|
||||
break;
|
||||
case Valentina::LineIntersectTool:
|
||||
case Tool::LineIntersectTool:
|
||||
ui->toolButtonLineIntersect->setChecked(false);
|
||||
currentScene->setFocus(Qt::OtherFocusReason);
|
||||
currentScene->clearSelection();
|
||||
break;
|
||||
case Valentina::SplineTool:
|
||||
case Tool::SplineTool:
|
||||
ui->toolButtonSpline->setChecked(false);
|
||||
currentScene->setFocus(Qt::OtherFocusReason);
|
||||
currentScene->clearSelection();
|
||||
break;
|
||||
case Valentina::ArcTool:
|
||||
case Tool::ArcTool:
|
||||
ui->toolButtonArc->setChecked(false);
|
||||
currentScene->setFocus(Qt::OtherFocusReason);
|
||||
currentScene->clearSelection();
|
||||
break;
|
||||
case Valentina::SplinePathTool:
|
||||
case Tool::SplinePathTool:
|
||||
ui->toolButtonSplinePath->setChecked(false);
|
||||
currentScene->setFocus(Qt::OtherFocusReason);
|
||||
currentScene->clearSelection();
|
||||
break;
|
||||
case Valentina::PointOfContact:
|
||||
case Tool::PointOfContact:
|
||||
ui->toolButtonPointOfContact->setChecked(false);
|
||||
currentScene->setFocus(Qt::OtherFocusReason);
|
||||
currentScene->clearSelection();
|
||||
break;
|
||||
case Valentina::DetailTool:
|
||||
case Tool::DetailTool:
|
||||
ui->toolButtonNewDetail->setChecked(false);
|
||||
break;
|
||||
case Valentina::Height:
|
||||
case Tool::Height:
|
||||
ui->toolButtonHeight->setChecked(false);
|
||||
currentScene->setFocus(Qt::OtherFocusReason);
|
||||
currentScene->clearSelection();
|
||||
break;
|
||||
case Valentina::Triangle:
|
||||
case Tool::Triangle:
|
||||
ui->toolButtonTriangle->setChecked(false);
|
||||
currentScene->setFocus(Qt::OtherFocusReason);
|
||||
currentScene->clearSelection();
|
||||
break;
|
||||
case Valentina::PointOfIntersection:
|
||||
case Tool::PointOfIntersection:
|
||||
ui->toolButtonPointOfIntersection->setChecked(false);
|
||||
currentScene->setFocus(Qt::OtherFocusReason);
|
||||
currentScene->clearSelection();
|
||||
break;
|
||||
case Valentina::CutSplineTool:
|
||||
case Tool::CutSplineTool:
|
||||
ui->toolButtonSplineCutPoint->setChecked(false);
|
||||
currentScene->setFocus(Qt::OtherFocusReason);
|
||||
currentScene->clearSelection();
|
||||
break;
|
||||
case Valentina::CutSplinePathTool:
|
||||
case Tool::CutSplinePathTool:
|
||||
ui->toolButtonSplinePathCutPoint->setChecked(false);
|
||||
currentScene->setFocus(Qt::OtherFocusReason);
|
||||
currentScene->clearSelection();
|
||||
break;
|
||||
case Valentina::UnionDetails:
|
||||
case Tool::UnionDetails:
|
||||
ui->toolButtonUnionDetails->setChecked(false);
|
||||
currentScene->setFocus(Qt::OtherFocusReason);
|
||||
currentScene->clearSelection();
|
||||
break;
|
||||
case Valentina::CutArcTool:
|
||||
case Tool::CutArcTool:
|
||||
ui->toolButtonArcCutPoint->setChecked(false);
|
||||
currentScene->setFocus(Qt::OtherFocusReason);
|
||||
currentScene->clearSelection();
|
||||
break;
|
||||
case Tool::NodePoint:
|
||||
case Tool::NodeArc:
|
||||
case Tool::NodeSpline:
|
||||
case Tool::NodeSplinePath:
|
||||
default:
|
||||
qDebug()<<"Got wrong tool type. Ignored.";
|
||||
break;
|
||||
|
@ -1227,7 +1243,7 @@ void MainWindow::ArrowTool()
|
|||
{
|
||||
CancelTool();
|
||||
ui->actionArrowTool->setChecked(true);
|
||||
tool = Valentina::ArrowTool;
|
||||
tool = Tool::ArrowTool;
|
||||
QCursor cur(Qt::ArrowCursor);
|
||||
view->setCursor(cur);
|
||||
helpLabel->setText("");
|
||||
|
@ -1307,7 +1323,7 @@ void MainWindow::ActionDraw(bool checked)
|
|||
connect(view, &VMainGraphicsView::NewFactor, sceneDraw, &VMainGraphicsScene::SetFactor);
|
||||
RestoreCurrentScene();
|
||||
|
||||
mode = Valentina::Calculation;
|
||||
mode = Draw::Calculation;
|
||||
comboBoxDraws->setEnabled(true);
|
||||
comboBoxDraws->setCurrentIndex(currentDrawIndex);//restore current pattern peace
|
||||
drawMode = true;
|
||||
|
@ -1350,7 +1366,7 @@ void MainWindow::ActionDetails(bool checked)
|
|||
comboBoxDraws->setEnabled(false);
|
||||
|
||||
|
||||
mode = Valentina::Modeling;
|
||||
mode = Draw::Modeling;
|
||||
SetEnableTool(true);
|
||||
currentToolBoxIndex = ui->toolBox->currentIndex();
|
||||
ui->toolBox->setCurrentIndex(4);
|
||||
|
@ -1488,7 +1504,6 @@ void MainWindow::Clear()
|
|||
setCurrentFile("");
|
||||
pattern->Clear();
|
||||
doc->clear();
|
||||
doc->setPatternModified(false);
|
||||
sceneDraw->clear();
|
||||
sceneDetails->clear();
|
||||
CancelTool();
|
||||
|
@ -1499,21 +1514,111 @@ void MainWindow::Clear()
|
|||
ui->actionZoomIn->setEnabled(false);
|
||||
ui->actionZoomOut->setEnabled(false);
|
||||
SetEnableTool(false);
|
||||
qApp->setPatternUnit(Valentina::Cm);
|
||||
qApp->setPatternType(Pattern::Individual);
|
||||
qApp->setPatternUnit(Unit::Cm);
|
||||
qApp->setPatternType(MeasurementsType::Individual);
|
||||
ui->toolBarOption->clear();
|
||||
#ifndef QT_NO_CURSOR
|
||||
QApplication::restoreOverrideCursor();
|
||||
#endif
|
||||
}
|
||||
|
||||
void MainWindow::FullParseFile()
|
||||
{
|
||||
try
|
||||
{
|
||||
doc->Parse(Document::FullParse);
|
||||
}
|
||||
catch (const VExceptionObjectError &e)
|
||||
{
|
||||
e.CriticalMessageBox(tr("Error parsing file."), this);
|
||||
Clear();
|
||||
return;
|
||||
}
|
||||
catch (const VExceptionConversionError &e)
|
||||
{
|
||||
e.CriticalMessageBox(tr("Error can't convert value."), this);
|
||||
Clear();
|
||||
return;
|
||||
}
|
||||
catch (const VExceptionEmptyParameter &e)
|
||||
{
|
||||
e.CriticalMessageBox(tr("Error empty parameter."), this);
|
||||
Clear();
|
||||
return;
|
||||
}
|
||||
catch (const VExceptionWrongId &e)
|
||||
{
|
||||
e.CriticalMessageBox(tr("Error wrong id."), this);
|
||||
Clear();
|
||||
return;
|
||||
}
|
||||
catch (VException &e)
|
||||
{
|
||||
e.CriticalMessageBox(tr("Error parsing file."), this);
|
||||
Clear();
|
||||
return;
|
||||
}
|
||||
catch (const std::bad_alloc &)
|
||||
{
|
||||
#ifndef QT_NO_CURSOR
|
||||
QApplication::restoreOverrideCursor();
|
||||
#endif
|
||||
QMessageBox msgBox;
|
||||
msgBox.setWindowTitle(tr("Error!"));
|
||||
msgBox.setText(tr("Error parsing file."));
|
||||
msgBox.setInformativeText("std::bad_alloc");
|
||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||
msgBox.setDefaultButton(QMessageBox::Ok);
|
||||
msgBox.setIcon(QMessageBox::Warning);
|
||||
msgBox.exec();
|
||||
#ifndef QT_NO_CURSOR
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
#endif
|
||||
Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
QString patternPiece = QString();
|
||||
if (comboBoxDraws->currentIndex() != -1)
|
||||
{
|
||||
patternPiece = comboBoxDraws->itemText(comboBoxDraws->currentIndex());
|
||||
}
|
||||
disconnect(comboBoxDraws, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
this, &MainWindow::currentDrawChanged);
|
||||
comboBoxDraws->clear();
|
||||
comboBoxDraws->addItems(doc->getPatternPieces());
|
||||
connect(comboBoxDraws, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
this, &MainWindow::currentDrawChanged);
|
||||
ui->actionPattern_properties->setEnabled(true);
|
||||
|
||||
qint32 index = comboBoxDraws->findText(patternPiece);
|
||||
if ( index != -1 )
|
||||
{ // -1 for not found
|
||||
currentDrawChanged(index);
|
||||
}
|
||||
else
|
||||
{
|
||||
currentDrawChanged(0);
|
||||
}
|
||||
|
||||
if (comboBoxDraws->count() > 0)
|
||||
{
|
||||
SetEnableTool(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetEnableTool(false);
|
||||
}
|
||||
SetEnableWidgets(true);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief NewPattern create new empty pattern.
|
||||
*/
|
||||
void MainWindow::NewPattern()
|
||||
{
|
||||
if (doc->isPatternModified() || curFile.isEmpty() == false)
|
||||
if (this->isWindowModified() || curFile.isEmpty() == false)
|
||||
{
|
||||
QProcess *v = new QProcess(this);
|
||||
v->startDetached(QCoreApplication::applicationFilePath ());
|
||||
|
@ -1525,10 +1630,10 @@ void MainWindow::NewPattern()
|
|||
/**
|
||||
* @brief haveChange enable action save if we have unsaved change.
|
||||
*/
|
||||
void MainWindow::PatternWasModified()
|
||||
void MainWindow::PatternWasModified(bool saved)
|
||||
{
|
||||
setWindowModified(doc->isPatternModified());
|
||||
ui->actionSave->setEnabled(true);
|
||||
setWindowModified(!saved);
|
||||
ui->actionSave->setEnabled(!saved);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -1540,7 +1645,7 @@ void MainWindow::ChangedSize(const QString & text)
|
|||
{
|
||||
qint32 size = text.toInt();
|
||||
pattern->SetSize(size);
|
||||
doc->FullUpdateTree();
|
||||
doc->LiteParseTree();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -1552,7 +1657,7 @@ void MainWindow::ChangedHeight(const QString &text)
|
|||
{
|
||||
qint32 growth = text.toInt();
|
||||
pattern->SetHeight(growth);
|
||||
doc->FullUpdateTree();
|
||||
doc->LiteParseTree();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -1574,7 +1679,7 @@ void MainWindow::SetEnableWidgets(bool enable)
|
|||
ui->actionHistory->setEnabled(enable);
|
||||
ui->actionPattern_properties->setEnabled(enable);
|
||||
ui->actionEdit_pattern_code->setEnabled(enable);
|
||||
ui->actionZoomIn->setEnabled(enable);
|
||||
ui->actionZoomIn->setEnabled(enable);
|
||||
ui->actionZoomOut->setEnabled(enable);
|
||||
}
|
||||
|
||||
|
@ -1671,7 +1776,7 @@ void MainWindow::SetEnableTool(bool enable)
|
|||
{
|
||||
bool drawTools = false;
|
||||
bool modelingTools = false;
|
||||
if (mode == Valentina::Calculation)
|
||||
if (mode == Draw::Calculation)
|
||||
{
|
||||
drawTools = enable;
|
||||
}
|
||||
|
@ -1731,6 +1836,7 @@ bool MainWindow::SavePattern(const QString &fileName)
|
|||
{
|
||||
setCurrentFile(fileName);
|
||||
helpLabel->setText(tr("File saved"));
|
||||
qApp->getUndoStack()->clear();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
@ -1742,7 +1848,7 @@ bool MainWindow::SavePattern(const QString &fileName)
|
|||
*/
|
||||
void MainWindow::AutoSavePattern()
|
||||
{
|
||||
if (curFile.isEmpty() == false && doc->isPatternModified() == true)
|
||||
if (curFile.isEmpty() == false && this->isWindowModified() == true)
|
||||
{
|
||||
QString autofile = curFile +".autosave";
|
||||
if (SavePattern(autofile) == false)
|
||||
|
@ -1761,7 +1867,6 @@ void MainWindow::AutoSavePattern()
|
|||
void MainWindow::setCurrentFile(const QString &fileName)
|
||||
{
|
||||
curFile = fileName;
|
||||
doc->setPatternModified(false);
|
||||
setWindowModified(false);
|
||||
|
||||
QString shownName = strippedName(curFile);
|
||||
|
@ -1811,6 +1916,20 @@ void MainWindow::ReadSettings()
|
|||
QSize size = settings.value("size", QSize(1000, 800)).toSize();
|
||||
resize(size);
|
||||
move(pos);
|
||||
|
||||
// Scene antialiasing
|
||||
bool graphOutputValue = settings.value("pattern/graphicalOutput", 1).toBool();
|
||||
view->setRenderHint(QPainter::Antialiasing, graphOutputValue);
|
||||
view->setRenderHint(QPainter::SmoothPixmapTransform, graphOutputValue);
|
||||
|
||||
// Stack limit
|
||||
bool ok = true;
|
||||
qint32 count = settings.value("pattern/undo", 0).toInt(&ok);
|
||||
if (ok == false)
|
||||
{
|
||||
count = 0;
|
||||
}
|
||||
qApp->getUndoStack()->setUndoLimit(count);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -1832,7 +1951,7 @@ void MainWindow::WriteSettings()
|
|||
*/
|
||||
bool MainWindow::MaybeSave()
|
||||
{
|
||||
if (doc->isPatternModified())
|
||||
if (this->isWindowModified())
|
||||
{
|
||||
QMessageBox::StandardButton ret;
|
||||
ret = QMessageBox::warning(this, tr("Unsaved change"), tr("The pattern has been modified.\n"
|
||||
|
@ -1861,9 +1980,9 @@ void MainWindow::UpdateRecentFileActions()
|
|||
|
||||
for (int i = 0; i < numRecentFiles; ++i)
|
||||
{
|
||||
QString text = QString("&%1 %2").arg(i + 1).arg(strippedName(files[i]));
|
||||
QString text = QString("&%1 %2").arg(i + 1).arg(strippedName(files.at(i)));
|
||||
recentFileActs[i]->setText(text);
|
||||
recentFileActs[i]->setData(files[i]);
|
||||
recentFileActs[i]->setData(files.at(i));
|
||||
recentFileActs[i]->setVisible(true);
|
||||
}
|
||||
for (int j = numRecentFiles; j < MaxRecentFiles; ++j)
|
||||
|
@ -1885,6 +2004,21 @@ void MainWindow::CreateMenus()
|
|||
separatorAct->setSeparator(true);
|
||||
ui->menuFile->insertAction(ui->actionPreferences, separatorAct);
|
||||
UpdateRecentFileActions();
|
||||
|
||||
//Add Undo/Redo actions.
|
||||
QAction *undoAction = qApp->getUndoStack()->createUndoAction(this, tr("&Undo"));
|
||||
undoAction->setShortcuts(QKeySequence::Undo);
|
||||
undoAction->setIcon(QIcon::fromTheme("edit-undo"));
|
||||
ui->menuDrawing->insertAction(ui->actionPattern_properties, undoAction);
|
||||
|
||||
QAction *redoAction = qApp->getUndoStack()->createRedoAction(this, tr("&Redo"));
|
||||
redoAction->setShortcuts(QKeySequence::Redo);
|
||||
redoAction->setIcon(QIcon::fromTheme("edit-redo"));
|
||||
ui->menuDrawing->insertAction(ui->actionPattern_properties, redoAction);
|
||||
|
||||
separatorAct = new QAction(this);
|
||||
separatorAct->setSeparator(true);
|
||||
ui->menuDrawing->insertAction(ui->actionPattern_properties, separatorAct);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -1895,7 +2029,7 @@ void MainWindow::CreateActions()
|
|||
connect(ui->actionArrowTool, &QAction::triggered, this, &MainWindow::ActionAroowTool);
|
||||
connect(ui->actionDraw, &QAction::triggered, this, &MainWindow::ActionDraw);
|
||||
connect(ui->actionDetails, &QAction::triggered, this, &MainWindow::ActionDetails);
|
||||
connect(ui->actionNewDraw, &QAction::triggered, this, &MainWindow::ActionNewDraw);
|
||||
connect(ui->actionNewDraw, &QAction::triggered, this, &MainWindow::ActionNewPP);
|
||||
connect(ui->actionOptionDraw, &QAction::triggered, this, &MainWindow::OptionDraw);
|
||||
connect(ui->actionSaveAs, &QAction::triggered, this, &MainWindow::SaveAs);
|
||||
connect(ui->actionSave, &QAction::triggered, this, &MainWindow::Save);
|
||||
|
@ -1927,6 +2061,11 @@ void MainWindow::InitAutoSave()
|
|||
delete autoSaveTimer;
|
||||
autoSaveTimer = nullptr;
|
||||
|
||||
autoSaveTimer = new QTimer(this);
|
||||
autoSaveTimer->setTimerType(Qt::VeryCoarseTimer);
|
||||
connect(autoSaveTimer, &QTimer::timeout, this, &MainWindow::AutoSavePattern);
|
||||
autoSaveTimer->stop();
|
||||
|
||||
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
||||
QApplication::applicationName());
|
||||
bool autoSave = settings.value("configuration/autosave/state", 1).toBool();
|
||||
|
@ -1938,12 +2077,10 @@ void MainWindow::InitAutoSave()
|
|||
{
|
||||
autoTime = 5;
|
||||
}
|
||||
|
||||
autoSaveTimer = new QTimer(this);
|
||||
autoSaveTimer->setTimerType(Qt::VeryCoarseTimer);
|
||||
connect(autoSaveTimer, &QTimer::timeout, this, &MainWindow::AutoSavePattern);
|
||||
autoSaveTimer->start(autoTime*60000);
|
||||
|
||||
}
|
||||
qApp->setAutoSaveTimer(autoSaveTimer);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -2012,11 +2149,11 @@ void MainWindow::LoadPattern(const QString &fileName)
|
|||
|
||||
QString text = tr("Measurements use different units than pattern. This pattern required measurements in %1")
|
||||
.arg(doc->UnitsToStr(qApp->patternUnit()));
|
||||
if (qApp->patternType() == Pattern::Standard)
|
||||
if (qApp->patternType() == MeasurementsType::Standard)
|
||||
{
|
||||
VStandardMeasurements m(pattern);
|
||||
m.setContent(path);
|
||||
Valentina::Units mUnit = m.Unit();
|
||||
Unit mUnit = m.MUnit();
|
||||
if (qApp->patternUnit() != mUnit)
|
||||
{
|
||||
QMessageBox::critical(this, tr("Wrong units."), text);
|
||||
|
@ -2031,7 +2168,7 @@ void MainWindow::LoadPattern(const QString &fileName)
|
|||
{
|
||||
VIndividualMeasurements m(pattern);
|
||||
m.setContent(path);
|
||||
Valentina::Units mUnit = m.Unit();
|
||||
Unit mUnit = m.MUnit();
|
||||
if (qApp->patternUnit() != mUnit)
|
||||
{
|
||||
QMessageBox::critical(this, tr("Wrong units."), text);
|
||||
|
@ -2047,101 +2184,20 @@ void MainWindow::LoadPattern(const QString &fileName)
|
|||
return;
|
||||
}
|
||||
|
||||
disconnect(comboBoxDraws, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
this, &MainWindow::currentDrawChanged);
|
||||
try
|
||||
{
|
||||
#ifndef QT_NO_CURSOR
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
#endif
|
||||
FullParseFile();
|
||||
|
||||
doc->Parse(Document::FullParse, sceneDraw, sceneDetails);
|
||||
|
||||
#ifndef QT_NO_CURSOR
|
||||
QApplication::restoreOverrideCursor();
|
||||
#endif
|
||||
ui->actionPattern_properties->setEnabled(true);
|
||||
}
|
||||
catch (const VExceptionObjectError &e)
|
||||
{
|
||||
e.CriticalMessageBox(tr("Error parsing file."), this);
|
||||
Clear();
|
||||
return;
|
||||
}
|
||||
catch (const VExceptionConversionError &e)
|
||||
{
|
||||
e.CriticalMessageBox(tr("Error can't convert value."), this);
|
||||
Clear();
|
||||
return;
|
||||
}
|
||||
catch (const VExceptionEmptyParameter &e)
|
||||
{
|
||||
e.CriticalMessageBox(tr("Error empty parameter."), this);
|
||||
Clear();
|
||||
return;
|
||||
}
|
||||
catch (const VExceptionWrongId &e)
|
||||
{
|
||||
e.CriticalMessageBox(tr("Error wrong id."), this);
|
||||
Clear();
|
||||
return;
|
||||
}
|
||||
catch (VException &e)
|
||||
{
|
||||
e.CriticalMessageBox(tr("Error parsing file."), this);
|
||||
Clear();
|
||||
return;
|
||||
}
|
||||
catch (const std::bad_alloc &)
|
||||
{
|
||||
#ifndef QT_NO_CURSOR
|
||||
QApplication::restoreOverrideCursor();
|
||||
#endif
|
||||
QMessageBox msgBox;
|
||||
msgBox.setWindowTitle(tr("Error!"));
|
||||
msgBox.setText(tr("Error parsing file."));
|
||||
msgBox.setInformativeText("std::bad_alloc");
|
||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||
msgBox.setDefaultButton(QMessageBox::Ok);
|
||||
msgBox.setIcon(QMessageBox::Warning);
|
||||
msgBox.exec();
|
||||
#ifndef QT_NO_CURSOR
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
#endif
|
||||
Clear();
|
||||
return;
|
||||
}
|
||||
connect(comboBoxDraws, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
this, &MainWindow::currentDrawChanged);
|
||||
QString nameDraw = doc->GetNameActivDraw();
|
||||
qint32 index = comboBoxDraws->findText(nameDraw);
|
||||
if ( index != -1 )
|
||||
{ // -1 for not found
|
||||
comboBoxDraws->setCurrentIndex(index);
|
||||
}
|
||||
if (comboBoxDraws->count() > 0)
|
||||
{
|
||||
SetEnableTool(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetEnableTool(false);
|
||||
}
|
||||
SetEnableWidgets(true);
|
||||
|
||||
bool patternModified = doc->isPatternModified();
|
||||
bool patternModified = this->isWindowModified();
|
||||
setCurrentFile(fileName);
|
||||
if (patternModified)
|
||||
{
|
||||
//For situation where was fixed wrong formula need return for document status was modified.
|
||||
doc->setPatternModified(patternModified);
|
||||
PatternWasModified();
|
||||
PatternWasModified(patternModified);
|
||||
}
|
||||
helpLabel->setText(tr("File loaded"));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString MainWindow::CheckPathToMeasurements(const QString &path, const Pattern::Measurements &patternType)
|
||||
QString MainWindow::CheckPathToMeasurements(const QString &path, const MeasurementsType &patternType)
|
||||
{
|
||||
QFile table(path);
|
||||
if (table.exists() == false)
|
||||
|
@ -2158,7 +2214,7 @@ QString MainWindow::CheckPathToMeasurements(const QString &path, const Pattern::
|
|||
else
|
||||
{
|
||||
QString filter;
|
||||
if (patternType == Pattern::Standard)
|
||||
if (patternType == MeasurementsType::Standard)
|
||||
{
|
||||
filter = tr("Standard measurements (*.vst)");
|
||||
}
|
||||
|
@ -2174,7 +2230,7 @@ QString MainWindow::CheckPathToMeasurements(const QString &path, const Pattern::
|
|||
}
|
||||
else
|
||||
{
|
||||
if (patternType == Pattern::Standard)
|
||||
if (patternType == MeasurementsType::Standard)
|
||||
{
|
||||
VDomDocument::ValidateXML("://schema/standard_measurements.xsd", mPath);
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ public slots:
|
|||
void ActionAroowTool();
|
||||
void ActionDraw(bool checked);
|
||||
void ActionDetails(bool checked);
|
||||
void ActionNewDraw();
|
||||
void ActionNewPP();
|
||||
void ActionLayout(bool checked);
|
||||
void ActionTable(bool checked);
|
||||
void ActionHistory(bool checked);
|
||||
|
@ -80,7 +80,7 @@ public slots:
|
|||
void ChangedSize(const QString &text);
|
||||
void ChangedHeight(const QString & text);
|
||||
|
||||
void PatternWasModified();
|
||||
void PatternWasModified(bool saved);
|
||||
|
||||
void ToolEndLine(bool checked);
|
||||
void ToolLine(bool checked);
|
||||
|
@ -137,10 +137,11 @@ public slots:
|
|||
void ShowToolTip(const QString &toolTip);
|
||||
void OpenRecentFile();
|
||||
void Clear();
|
||||
/**
|
||||
/**
|
||||
* @brief Edit XML code of pattern
|
||||
*/
|
||||
void EditPatternCode();
|
||||
void FullParseFile();
|
||||
signals:
|
||||
/**
|
||||
* @brief ModelChosen emit after calculation all details.
|
||||
|
@ -164,7 +165,7 @@ private:
|
|||
VPattern *doc;
|
||||
|
||||
/** @brief tool current tool */
|
||||
Valentina::Tools tool;
|
||||
Tool tool;
|
||||
|
||||
/** @brief currentScene pointer to current scene. */
|
||||
VMainGraphicsScene *currentScene;
|
||||
|
@ -198,7 +199,7 @@ private:
|
|||
QString curFile;
|
||||
|
||||
/** @brief mode keep current draw mode. */
|
||||
Valentina::Draws mode;
|
||||
Draw mode;
|
||||
|
||||
/** @brief currentDrawIndex save current selected pattern peace. */
|
||||
qint32 currentDrawIndex;
|
||||
|
@ -226,10 +227,10 @@ private:
|
|||
void MinimumScrollBar();
|
||||
|
||||
template <typename Dialog, typename Func>
|
||||
void SetToolButton(bool checked, Valentina::Tools t, const QString &cursor, const QString &toolTip,
|
||||
void SetToolButton(bool checked, Tool t, const QString &cursor, const QString &toolTip,
|
||||
Func closeDialogSlot);
|
||||
template <typename Dialog, typename Func, typename Func2>
|
||||
void SetToolButtonWithApply(bool checked, Valentina::Tools t, const QString &cursor, const QString &toolTip,
|
||||
void SetToolButtonWithApply(bool checked, Tool t, const QString &cursor, const QString &toolTip,
|
||||
Func closeDialogSlot, Func2 applyDialogSlot);
|
||||
template <typename DrawTool>
|
||||
void ClosedDialog(int result);
|
||||
|
@ -249,7 +250,7 @@ private:
|
|||
void CreateActions();
|
||||
void InitAutoSave();
|
||||
QString PatternPieceName(const QString &text);
|
||||
QString CheckPathToMeasurements(const QString &path, const Pattern::Measurements &patternType);
|
||||
QString CheckPathToMeasurements(const QString &path, const MeasurementsType &patternType);
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*************************************************************************/
|
||||
|
||||
#include "options.h"
|
||||
#include <QString>
|
||||
|
||||
// Keep synchronize all names with initialization in VApllication class.
|
||||
//measurements
|
||||
|
|
|
@ -29,93 +29,50 @@
|
|||
#ifndef OPTIONS_H
|
||||
#define OPTIONS_H
|
||||
|
||||
#include <QFlags>
|
||||
#include <QString>
|
||||
#include <QMetaType>
|
||||
#include <QtGlobal>
|
||||
#include <csignal>
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
#include <Windows.h>
|
||||
# include <Windows.h>
|
||||
#endif /*Q_OS_WIN32*/
|
||||
|
||||
class QString;
|
||||
|
||||
#define SceneSize 50000
|
||||
|
||||
namespace Valentina
|
||||
enum class SceneObject : char { Point, Line, Spline, Arc, SplinePath, Detail };
|
||||
enum class Tool : char
|
||||
{
|
||||
/**
|
||||
* @brief The Scene enum
|
||||
*/
|
||||
enum Scene { Point, Line, Spline, Arc, SplinePath, Detail };
|
||||
Q_DECLARE_FLAGS(Scenes, Scene)
|
||||
ArrowTool,
|
||||
SinglePointTool,
|
||||
EndLineTool,
|
||||
LineTool,
|
||||
AlongLineTool,
|
||||
ShoulderPointTool,
|
||||
NormalTool,
|
||||
BisectorTool,
|
||||
LineIntersectTool,
|
||||
SplineTool,
|
||||
CutSplineTool,
|
||||
CutArcTool,
|
||||
ArcTool,
|
||||
SplinePathTool,
|
||||
CutSplinePathTool,
|
||||
PointOfContact,
|
||||
DetailTool,
|
||||
NodePoint,
|
||||
NodeArc,
|
||||
NodeSpline,
|
||||
NodeSplinePath,
|
||||
Height,
|
||||
Triangle,
|
||||
PointOfIntersection,
|
||||
UnionDetails
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The Tool enum
|
||||
*/
|
||||
enum Tool
|
||||
{
|
||||
ArrowTool,
|
||||
SinglePointTool,
|
||||
EndLineTool,
|
||||
LineTool,
|
||||
AlongLineTool,
|
||||
ShoulderPointTool,
|
||||
NormalTool,
|
||||
BisectorTool,
|
||||
LineIntersectTool,
|
||||
SplineTool,
|
||||
CutSplineTool,
|
||||
CutArcTool,
|
||||
ArcTool,
|
||||
SplinePathTool,
|
||||
CutSplinePathTool,
|
||||
PointOfContact,
|
||||
DetailTool,
|
||||
NodePoint,
|
||||
NodeArc,
|
||||
NodeSpline,
|
||||
NodeSplinePath,
|
||||
Height,
|
||||
Triangle,
|
||||
PointOfIntersection,
|
||||
UnionDetails
|
||||
};
|
||||
Q_DECLARE_FLAGS(Tools, Tool)
|
||||
|
||||
/**
|
||||
* @brief The Source enum
|
||||
*/
|
||||
enum Source { FromGui, FromFile, FromTool };
|
||||
Q_DECLARE_FLAGS(Sources, Source)
|
||||
|
||||
/**
|
||||
* @brief The Draw enum
|
||||
*/
|
||||
enum Draw { Calculation, Modeling };
|
||||
Q_DECLARE_FLAGS(Draws, Draw)
|
||||
|
||||
/**
|
||||
* @brief The Unit enum
|
||||
*/
|
||||
enum Unit { Mm, Cm, Inch };
|
||||
Q_DECLARE_FLAGS(Units, Unit)
|
||||
}
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS( Valentina::Scenes )
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS( Valentina::Tools )
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS( Valentina::Sources )
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS( Valentina::Draws )
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS( Valentina::Units )
|
||||
Q_DECLARE_METATYPE(Valentina::Unit)
|
||||
|
||||
namespace Pattern
|
||||
{
|
||||
/**
|
||||
* @brief The Scene enum
|
||||
*/
|
||||
enum Measurement { Standard, Individual };
|
||||
Q_DECLARE_FLAGS(Measurements, Measurement)
|
||||
}
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS( Pattern::Measurements )
|
||||
enum class Source : char { FromGui, FromFile, FromTool };
|
||||
enum class Draw : char { Calculation, Modeling };
|
||||
enum class Unit : char { Mm, Cm, Inch };
|
||||
enum class MeasurementsType : char { Standard, Individual };
|
||||
|
||||
// measurements
|
||||
extern const QString headGirth_M;
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
src/app/share/resources/icons/win.icon.theme/24x24/actions/edit-redo.png
Executable file
BIN
src/app/share/resources/icons/win.icon.theme/24x24/actions/edit-redo.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
BIN
src/app/share/resources/icons/win.icon.theme/24x24/actions/edit-undo.png
Executable file
BIN
src/app/share/resources/icons/win.icon.theme/24x24/actions/edit-undo.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user