Merged develop into feature

--HG--
branch : feature
This commit is contained in:
Bojan Kverh 2016-07-07 20:47:16 +02:00
commit 5aa75f2aff
55 changed files with 4960 additions and 3263 deletions

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 980 KiB

After

Width:  |  Height:  |  Size: 988 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 82 KiB

View File

@ -99,9 +99,9 @@ void DialogHistory::cellClicked(int row, int column)
item = ui->tableWidget->item(row, 0);
cursorRow = row;
item->setIcon(QIcon("://icon/32x32/put_after.png"));
quint32 id = qvariant_cast<quint32>(item->data(Qt::UserRole));
const quint32 id = qvariant_cast<quint32>(item->data(Qt::UserRole));
doc->blockSignals(true);
doc->setCursor(id);
row == ui->tableWidget->rowCount()-1 ? doc->setCursor(0) : doc->setCursor(id);
doc->blockSignals(false);
}
else
@ -185,7 +185,7 @@ void DialogHistory::FillTable()
ui->tableWidget->setRowCount(count);//Real row count
if (count>0)
{
cursorRow = currentRow;
cursorRow = CursorRow();
QTableWidgetItem *item = ui->tableWidget->item(cursorRow, 0);
SCASSERT(item != nullptr);
item->setIcon(QIcon("://icon/32x32/put_after.png"));
@ -492,3 +492,24 @@ void DialogHistory::RetranslateUi()
cursorRow = currentRow;
cellClicked(cursorRow, 0);
}
//---------------------------------------------------------------------------------------------------------------------
int DialogHistory::CursorRow() const
{
const quint32 cursor = doc->getCursor();
if (cursor == 0)
{
return ui->tableWidget->rowCount()-1;
}
for (int i = 0; i < ui->tableWidget->rowCount(); ++i)
{
QTableWidgetItem *item = ui->tableWidget->item(i, 0);
const quint32 id = qvariant_cast<quint32>(item->data(Qt::UserRole));
if (cursor == id)
{
return i;
}
}
return ui->tableWidget->rowCount()-1;
}

View File

@ -91,6 +91,7 @@ private:
QString PointName(quint32 pointId);
quint32 AttrUInt(const QDomElement &domElement, const QString &name);
void RetranslateUi();
int CursorRow() const;
};
#endif // DIALOGHISTORY_H

View File

@ -182,7 +182,6 @@ MainWindow::MainWindow(QWidget *parent)
#if defined(Q_OS_MAC)
// On Mac deafault icon size is 32x32.
ui->toolBarArrows->setIconSize(QSize(24, 24));
ui->toolBarDraws->setIconSize(QSize(24, 24));
ui->toolBarOption->setIconSize(QSize(24, 24));
ui->toolBarStages->setIconSize(QSize(24, 24));
@ -570,10 +569,10 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(currentScene);
SCASSERT(scene != nullptr);
connect(scene, &VMainGraphicsScene::ChoosedObject, dialogTool, &DialogTool::ChosenObject);
connect(scene, &VMainGraphicsScene::SelectedObject, dialogTool, &DialogTool::SelectedObject);
connect(dialogTool, &DialogTool::DialogClosed, this, closeDialogSlot);
connect(dialogTool, &DialogTool::ToolTip, this, &MainWindow::ShowToolTip);
connect(scene, &VMainGraphicsScene::ChoosedObject, dialogTool.data(), &DialogTool::ChosenObject);
connect(scene, &VMainGraphicsScene::SelectedObject, dialogTool.data(), &DialogTool::SelectedObject);
connect(dialogTool.data(), &DialogTool::DialogClosed, this, closeDialogSlot);
connect(dialogTool.data(), &DialogTool::ToolTip, this, &MainWindow::ShowToolTip);
ui->view->itemClicked(nullptr);
}
else
@ -629,11 +628,11 @@ void MainWindow::SetToolButtonWithApply(bool checked, Tool t, const QString &cur
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(currentScene);
SCASSERT(scene != nullptr);
connect(scene, &VMainGraphicsScene::ChoosedObject, dialogTool, &DialogTool::ChosenObject);
connect(scene, &VMainGraphicsScene::SelectedObject, dialogTool, &DialogTool::SelectedObject);
connect(dialogTool, &DialogTool::DialogClosed, this, closeDialogSlot);
connect(dialogTool, &DialogTool::DialogApplied, this, applyDialogSlot);
connect(dialogTool, &DialogTool::ToolTip, this, &MainWindow::ShowToolTip);
connect(scene, &VMainGraphicsScene::ChoosedObject, dialogTool.data(), &DialogTool::ChosenObject);
connect(scene, &VMainGraphicsScene::SelectedObject, dialogTool.data(), &DialogTool::SelectedObject);
connect(dialogTool.data(), &DialogTool::DialogClosed, this, closeDialogSlot);
connect(dialogTool.data(), &DialogTool::DialogApplied, this, applyDialogSlot);
connect(dialogTool.data(), &DialogTool::ToolTip, this, &MainWindow::ShowToolTip);
connect(ui->view, &VMainGraphicsView::MouseRelease, this, &MainWindow::ClickEndVisualization);
ui->view->itemClicked(nullptr);
}
@ -653,7 +652,7 @@ void MainWindow::SetToolButtonWithApply(bool checked, Tool t, const QString &cur
template <typename DrawTool>
void MainWindow::ClosedDialog(int result)
{
SCASSERT(dialogTool != nullptr);
SCASSERT(not dialogTool.isNull());
if (result == QDialog::Accepted)
{
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(currentScene);
@ -673,7 +672,7 @@ void MainWindow::ClosedDialog(int result)
template <typename DrawTool>
void MainWindow::ClosedDialogWithApply(int result)
{
SCASSERT(dialogTool != nullptr);
SCASSERT(not dialogTool.isNull());
if (result == QDialog::Accepted)
{
// Only create tool if not already created with apply
@ -691,7 +690,7 @@ void MainWindow::ClosedDialogWithApply(int result)
vtool->FullUpdateFromGuiApply();
}
}
SCASSERT(dialogTool != nullptr);
SCASSERT(not dialogTool.isNull());
QGraphicsItem *tool = dynamic_cast<QGraphicsItem *>(dialogTool->GetAssociatedTool());
ui->view->itemClicked(tool);
if (dialogTool->GetAssociatedTool() != nullptr)
@ -700,6 +699,15 @@ void MainWindow::ClosedDialogWithApply(int result)
vtool->DialogLinkDestroy();
}
ArrowTool();
// If insert not to the end of file call lite parse
if (doc->getCursor() > 0)
{
doc->LiteParseTree(Document::LiteParse);
if (dialogHistory)
{
dialogHistory->UpdateHistory();
}
}
}
//---------------------------------------------------------------------------------------------------------------------
@ -709,7 +717,7 @@ void MainWindow::ClosedDialogWithApply(int result)
template <typename DrawTool>
void MainWindow::ApplyDialog()
{
SCASSERT(dialogTool != nullptr);
SCASSERT(not dialogTool.isNull());
// Only create tool if not already created with apply
if (dialogTool->GetAssociatedTool() == nullptr)
@ -1834,7 +1842,6 @@ void MainWindow::CancelTool()
qCDebug(vMainWindow, "Canceling tool.");
delete dialogTool;
dialogTool = nullptr;
qCDebug(vMainWindow, "Dialog closed.");
currentScene->setFocus(Qt::OtherFocusReason);
@ -3090,8 +3097,8 @@ void MainWindow::ActionHistory(bool checked)
{
dialogHistory = new DialogHistory(pattern, doc, this);
dialogHistory->setWindowFlags(Qt::Window);
connect(this, &MainWindow::RefreshHistory, dialogHistory, &DialogHistory::UpdateHistory);
connect(dialogHistory, &DialogHistory::DialogClosed, this, &MainWindow::ClosedActionHistory);
connect(this, &MainWindow::RefreshHistory, dialogHistory.data(), &DialogHistory::UpdateHistory);
connect(dialogHistory.data(), &DialogHistory::DialogClosed, this, &MainWindow::ClosedActionHistory);
dialogHistory->show();
}
else
@ -4254,7 +4261,7 @@ void MainWindow::ChangePP(int index, bool zoomBestFit)
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::EndVisualization(bool click)
{
if (dialogTool != nullptr)
if (not dialogTool.isNull())
{
dialogTool->ShowDialog(click);
}

View File

@ -243,8 +243,8 @@ private:
bool patternReadOnly;
DialogIncrements *dialogTable;
DialogTool *dialogTool;
DialogHistory *dialogHistory;
QPointer<DialogTool> dialogTool;
QPointer<DialogHistory> dialogHistory;
/** @brief comboBoxDraws comboc who show name of pattern peaces. */
QComboBox *comboBoxDraws;

View File

@ -1558,7 +1558,6 @@
</attribute>
<addaction name="actionZoomIn"/>
<addaction name="actionZoomOut"/>
<addaction name="actionZoomOriginal"/>
<addaction name="actionZoomFitBest"/>
</widget>
<widget class="QDockWidget" name="dockWidgetToolOptions">

View File

@ -32,6 +32,7 @@
#include "../ifc/xml/vabstractpattern.h"
#include "../ifc/xml/vtoolrecord.h"
#include "../vpatterndb/vcontainer.h"
#include "../ifc/xml/vpatternconverter.h"
class VDataTool;
class VMainGraphicsScene;
@ -171,12 +172,16 @@ private:
void ParseToolTrueDarts(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse);
// TODO. Delete if minimal supported version is 0.2.7
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 2, 7),
"Time to refactor the code.");
void ParseOldToolSpline(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse);
void ParseToolSpline(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
void ParseToolCubicBezier(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse);
// TODO. Delete if minimal supported version is 0.2.7
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 2, 7),
"Time to refactor the code.");
void ParseOldToolSplinePath(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse);
void ParseToolSplinePath(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse);

View File

@ -31,6 +31,8 @@
#include "vdomdocument.h"
#define CONVERTER_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch))
class VAbstractConverter :public VDomDocument
{
Q_DECLARE_TR_FUNCTIONS(VAbstractConverter)

View File

@ -46,6 +46,9 @@ const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0");
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.3.3");
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.3.3.xsd");
constexpr int VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
constexpr int VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
//---------------------------------------------------------------------------------------------------------------------
VPatternConverter::VPatternConverter(const QString &fileName)
:VAbstractConverter(fileName)
@ -57,30 +60,6 @@ VPatternConverter::VPatternConverter(const QString &fileName)
VPatternConverter::~VPatternConverter()
{}
//---------------------------------------------------------------------------------------------------------------------
int VPatternConverter::MinVer() const
{
return GetVersion(PatternMinVerStr);
}
//---------------------------------------------------------------------------------------------------------------------
int VPatternConverter::MaxVer() const
{
return GetVersion(PatternMaxVerStr);
}
//---------------------------------------------------------------------------------------------------------------------
QString VPatternConverter::MinVerStr() const
{
return PatternMinVerStr;
}
//---------------------------------------------------------------------------------------------------------------------
QString VPatternConverter::MaxVerStr() const
{
return PatternMaxVerStr;
}
//---------------------------------------------------------------------------------------------------------------------
QString VPatternConverter::XSDSchema(int ver) const
{

View File

@ -40,6 +40,8 @@ public:
static const QString PatternMaxVerStr;
static const QString CurrentSchema;
static constexpr int PatternMinVer = CONVERTER_VERSION_CHECK(0, 1, 0);
static constexpr int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 3, 2);
protected:
virtual int MinVer() const Q_DECL_OVERRIDE;
@ -105,4 +107,28 @@ private:
static QMap<QString, QString> OldNamesToNewNames_InV0_2_1();
};
//---------------------------------------------------------------------------------------------------------------------
inline int VPatternConverter::MinVer() const
{
return PatternMinVer;
}
//---------------------------------------------------------------------------------------------------------------------
inline int VPatternConverter::MaxVer() const
{
return PatternMaxVer;
}
//---------------------------------------------------------------------------------------------------------------------
inline QString VPatternConverter::MinVerStr() const
{
return PatternMinVerStr;
}
//---------------------------------------------------------------------------------------------------------------------
inline QString VPatternConverter::MaxVerStr() const
{
return PatternMaxVerStr;
}
#endif // VPATTERNCONVERTER_H

View File

@ -43,6 +43,9 @@ const QString VVITConverter::MeasurementMinVerStr = QStringLiteral("0.2.0");
const QString VVITConverter::MeasurementMaxVerStr = QStringLiteral("0.3.3");
const QString VVITConverter::CurrentSchema = QStringLiteral("://schema/individual_measurements/v0.3.3.xsd");
constexpr int VVITConverter::MeasurementMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
constexpr int VVITConverter::MeasurementMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
//---------------------------------------------------------------------------------------------------------------------
VVITConverter::VVITConverter(const QString &fileName)
:VAbstractMConverter(fileName)
@ -54,30 +57,6 @@ VVITConverter::VVITConverter(const QString &fileName)
VVITConverter::~VVITConverter()
{}
//---------------------------------------------------------------------------------------------------------------------
int VVITConverter::MinVer() const
{
return GetVersion(MeasurementMinVerStr);
}
//---------------------------------------------------------------------------------------------------------------------
int VVITConverter::MaxVer() const
{
return GetVersion(MeasurementMaxVerStr);
}
//---------------------------------------------------------------------------------------------------------------------
QString VVITConverter::MinVerStr() const
{
return MeasurementMinVerStr;
}
//---------------------------------------------------------------------------------------------------------------------
QString VVITConverter::MaxVerStr() const
{
return MeasurementMaxVerStr;
}
//---------------------------------------------------------------------------------------------------------------------
QString VVITConverter::XSDSchema(int ver) const
{

View File

@ -40,6 +40,8 @@ public:
static const QString MeasurementMaxVerStr;
static const QString CurrentSchema;
static constexpr int MeasurementMinVer = CONVERTER_VERSION_CHECK(0, 2, 0);
static constexpr int MeasurementMaxVer = CONVERTER_VERSION_CHECK(0, 3, 3);
protected:
virtual int MinVer() const Q_DECL_OVERRIDE;
@ -70,4 +72,28 @@ private:
void ToV0_3_3();
};
//---------------------------------------------------------------------------------------------------------------------
inline int VVITConverter::MinVer() const
{
return MeasurementMinVer;
}
//---------------------------------------------------------------------------------------------------------------------
inline int VVITConverter::MaxVer() const
{
return MeasurementMaxVer;
}
//---------------------------------------------------------------------------------------------------------------------
inline QString VVITConverter::MinVerStr() const
{
return MeasurementMinVerStr;
}
//---------------------------------------------------------------------------------------------------------------------
inline QString VVITConverter::MaxVerStr() const
{
return MeasurementMaxVerStr;
}
#endif // VVITCONVERTER_H

View File

@ -43,6 +43,9 @@ const QString VVSTConverter::MeasurementMinVerStr = QStringLiteral("0.3.0");
const QString VVSTConverter::MeasurementMaxVerStr = QStringLiteral("0.4.2");
const QString VVSTConverter::CurrentSchema = QStringLiteral("://schema/standard_measurements/v0.4.2.xsd");
constexpr int VVSTConverter::MeasurementMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
constexpr int VVSTConverter::MeasurementMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
//---------------------------------------------------------------------------------------------------------------------
VVSTConverter::VVSTConverter(const QString &fileName)
:VAbstractMConverter(fileName)
@ -54,30 +57,6 @@ VVSTConverter::VVSTConverter(const QString &fileName)
VVSTConverter::~VVSTConverter()
{}
//---------------------------------------------------------------------------------------------------------------------
int VVSTConverter::MinVer() const
{
return GetVersion(MeasurementMinVerStr);
}
//---------------------------------------------------------------------------------------------------------------------
int VVSTConverter::MaxVer() const
{
return GetVersion(MeasurementMaxVerStr);
}
//---------------------------------------------------------------------------------------------------------------------
QString VVSTConverter::MinVerStr() const
{
return MeasurementMinVerStr;
}
//---------------------------------------------------------------------------------------------------------------------
QString VVSTConverter::MaxVerStr() const
{
return MeasurementMaxVerStr;
}
//---------------------------------------------------------------------------------------------------------------------
QString VVSTConverter::XSDSchema(int ver) const
{

View File

@ -40,6 +40,8 @@ public:
static const QString MeasurementMaxVerStr;
static const QString CurrentSchema;
static constexpr int MeasurementMinVer = CONVERTER_VERSION_CHECK(0, 3, 0);
static constexpr int MeasurementMaxVer = CONVERTER_VERSION_CHECK(0, 4, 2);
protected:
virtual int MinVer() const Q_DECL_OVERRIDE;
@ -68,4 +70,28 @@ private:
void ToV0_4_2();
};
//---------------------------------------------------------------------------------------------------------------------
inline int VVSTConverter::MinVer() const
{
return MeasurementMinVer;
}
//---------------------------------------------------------------------------------------------------------------------
inline int VVSTConverter::MaxVer() const
{
return MeasurementMaxVer;
}
//---------------------------------------------------------------------------------------------------------------------
inline QString VVSTConverter::MinVerStr() const
{
return MeasurementMinVerStr;
}
//---------------------------------------------------------------------------------------------------------------------
inline QString VVSTConverter::MaxVerStr() const
{
return MeasurementMaxVerStr;
}
#endif // VMEASUREMENTCONVERTER_H

View File

@ -142,7 +142,6 @@ DialogAlongLine::~DialogAlongLine()
VContainer *locData = const_cast<VContainer *> (data);
locData->RemoveVariable(currentLength);
DeleteVisualization<VisToolAlongLine>();
delete ui;
}

View File

@ -113,7 +113,6 @@ void DialogArc::DeployF2TextEdit()
//---------------------------------------------------------------------------------------------------------------------
DialogArc::~DialogArc()
{
DeleteVisualization<VisToolArc>();
delete ui;
}

View File

@ -90,7 +90,6 @@ DialogArcWithLength::DialogArcWithLength(const VContainer *data, const quint32 &
//---------------------------------------------------------------------------------------------------------------------
DialogArcWithLength::~DialogArcWithLength()
{
DeleteVisualization<VisToolArcWithLength>();
delete ui;
}

View File

@ -142,7 +142,6 @@ void DialogBisector::DeployFormulaTextEdit()
//---------------------------------------------------------------------------------------------------------------------
DialogBisector::~DialogBisector()
{
DeleteVisualization<VisToolBisector>();
delete ui;
}

View File

@ -63,7 +63,6 @@ DialogCubicBezier::DialogCubicBezier(const VContainer *data, const quint32 &tool
//---------------------------------------------------------------------------------------------------------------------
DialogCubicBezier::~DialogCubicBezier()
{
DeleteVisualization<VisToolCubicBezier>();
delete ui;
}

View File

@ -61,7 +61,6 @@ DialogCubicBezierPath::DialogCubicBezierPath(const VContainer *data, const quint
//---------------------------------------------------------------------------------------------------------------------
DialogCubicBezierPath::~DialogCubicBezierPath()
{
DeleteVisualization<VisToolCubicBezierPath>();
delete ui;
}

View File

@ -77,7 +77,6 @@ DialogCurveIntersectAxis::DialogCurveIntersectAxis(const VContainer *data, const
//---------------------------------------------------------------------------------------------------------------------
DialogCurveIntersectAxis::~DialogCurveIntersectAxis()
{
DeleteVisualization<VisToolCurveIntersectAxis>();
delete ui;
}

View File

@ -106,7 +106,6 @@ void DialogCutArc::DeployFormulaTextEdit()
//---------------------------------------------------------------------------------------------------------------------
DialogCutArc::~DialogCutArc()
{
DeleteVisualization<VisToolCutArc>();
delete ui;
}

View File

@ -73,7 +73,6 @@ DialogCutSpline::DialogCutSpline(const VContainer *data, const quint32 &toolId,
//---------------------------------------------------------------------------------------------------------------------
DialogCutSpline::~DialogCutSpline()
{
DeleteVisualization<VisToolCutSpline>();
delete ui;
}

View File

@ -73,7 +73,6 @@ DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, const quint32 &
//---------------------------------------------------------------------------------------------------------------------
DialogCutSplinePath::~DialogCutSplinePath()
{
DeleteVisualization<VisToolCutSplinePath>();
delete ui;
}

View File

@ -167,7 +167,7 @@ void DialogEndLine::ChosenObject(quint32 id, const SceneObject &type)
if (SetObject(id, ui->comboBoxBasePoint, ""))
{
vis->VisualMode(id);
connect(vis, &Visualization::ToolTip, this, &DialogTool::ShowVisToolTip);
connect(vis.data(), &Visualization::ToolTip, this, &DialogTool::ShowVisToolTip);
prepare = true;
}
}
@ -343,7 +343,6 @@ void DialogEndLine::closeEvent(QCloseEvent *event)
//---------------------------------------------------------------------------------------------------------------------
DialogEndLine::~DialogEndLine()
{
DeleteVisualization<VisToolEndLine>();
delete ui;
}

View File

@ -75,7 +75,6 @@ DialogHeight::DialogHeight(const VContainer *data, const quint32 &toolId, QWidge
//---------------------------------------------------------------------------------------------------------------------
DialogHeight::~DialogHeight()
{
DeleteVisualization<VisToolHeight>();
delete ui;
}

View File

@ -68,7 +68,6 @@ DialogLine::DialogLine(const VContainer *data, const quint32 &toolId, QWidget *p
//---------------------------------------------------------------------------------------------------------------------
DialogLine::~DialogLine()
{
DeleteVisualization<VisToolLine>();
delete ui;
}

View File

@ -75,7 +75,6 @@ DialogLineIntersect::DialogLineIntersect(const VContainer *data, const quint32 &
//---------------------------------------------------------------------------------------------------------------------
DialogLineIntersect::~DialogLineIntersect()
{
DeleteVisualization<VisToolLineIntersect>();
delete ui;
}

View File

@ -86,7 +86,6 @@ DialogLineIntersectAxis::DialogLineIntersectAxis(const VContainer *data, const q
//---------------------------------------------------------------------------------------------------------------------
DialogLineIntersectAxis::~DialogLineIntersectAxis()
{
DeleteVisualization<VisToolLineIntersectAxis>();
delete ui;
}

View File

@ -132,7 +132,6 @@ void DialogNormal::DeployFormulaTextEdit()
//---------------------------------------------------------------------------------------------------------------------
DialogNormal::~DialogNormal()
{
DeleteVisualization<VisToolNormal>();
delete ui;
}

View File

@ -63,7 +63,6 @@ DialogPointFromArcAndTangent::DialogPointFromArcAndTangent(const VContainer *dat
//---------------------------------------------------------------------------------------------------------------------
DialogPointFromArcAndTangent::~DialogPointFromArcAndTangent()
{
DeleteVisualization<VisToolPointFromArcAndTangent>();
delete ui;
}

View File

@ -88,7 +88,6 @@ DialogPointFromCircleAndTangent::DialogPointFromCircleAndTangent(const VContaine
//---------------------------------------------------------------------------------------------------------------------
DialogPointFromCircleAndTangent::~DialogPointFromCircleAndTangent()
{
DeleteVisualization<VisToolPointFromCircleAndTangent>();
delete ui;
}

View File

@ -81,7 +81,6 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, const quint32
//---------------------------------------------------------------------------------------------------------------------
DialogPointOfContact::~DialogPointOfContact()
{
DeleteVisualization<VisToolPointOfContact>();
delete ui;
}

View File

@ -71,7 +71,6 @@ DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, con
//---------------------------------------------------------------------------------------------------------------------
DialogPointOfIntersection::~DialogPointOfIntersection()
{
DeleteVisualization<VisToolPointOfIntersection>();
delete ui;
}

View File

@ -67,7 +67,6 @@ DialogPointOfIntersectionArcs::DialogPointOfIntersectionArcs(const VContainer *d
//---------------------------------------------------------------------------------------------------------------------
DialogPointOfIntersectionArcs::~DialogPointOfIntersectionArcs()
{
DeleteVisualization<VisToolPointOfIntersectionArcs>();
delete ui;
}

View File

@ -104,7 +104,6 @@ DialogPointOfIntersectionCircles::DialogPointOfIntersectionCircles(const VContai
//---------------------------------------------------------------------------------------------------------------------
DialogPointOfIntersectionCircles::~DialogPointOfIntersectionCircles()
{
DeleteVisualization<VisToolPointOfIntersectionCircles>();
delete ui;
}

View File

@ -65,7 +65,6 @@ DialogPointOfIntersectionCurves::DialogPointOfIntersectionCurves(const VContaine
//---------------------------------------------------------------------------------------------------------------------
DialogPointOfIntersectionCurves::~DialogPointOfIntersectionCurves()
{
DeleteVisualization<VisToolPointOfIntersectionCurves>();
delete ui;
}

View File

@ -81,7 +81,6 @@ DialogRotation::DialogRotation(const VContainer *data, const quint32 &toolId, QW
//---------------------------------------------------------------------------------------------------------------------
DialogRotation::~DialogRotation()
{
DeleteVisualization<VisToolRotation>();
delete ui;
}

View File

@ -143,7 +143,6 @@ void DialogShoulderPoint::DeployFormulaTextEdit()
//---------------------------------------------------------------------------------------------------------------------
DialogShoulderPoint::~DialogShoulderPoint()
{
DeleteVisualization<VisToolShoulderPoint>();
delete ui;
}

View File

@ -122,7 +122,6 @@ DialogSpline::DialogSpline(const VContainer *data, const quint32 &toolId, QWidge
//---------------------------------------------------------------------------------------------------------------------
DialogSpline::~DialogSpline()
{
DeleteVisualization<VisToolSpline>();
delete ui;
}

View File

@ -108,7 +108,6 @@ DialogSplinePath::DialogSplinePath(const VContainer *data, const quint32 &toolId
//---------------------------------------------------------------------------------------------------------------------
DialogSplinePath::~DialogSplinePath()
{
DeleteVisualization<VisToolSplinePath>();
delete ui;
}

View File

@ -78,6 +78,11 @@ DialogTool::DialogTool(const VContainer *data, const quint32 &toolId, QWidget *p
DialogTool::~DialogTool()
{
emit ToolTip("");
if (not vis.isNull())
{
delete vis;
}
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -181,7 +181,7 @@ protected:
/** @brief number number of handled objects */
qint32 number;
Visualization *vis;
QPointer<Visualization> vis;
virtual void closeEvent ( QCloseEvent * event ) Q_DECL_OVERRIDE;
virtual void showEvent( QShowEvent *event ) Q_DECL_OVERRIDE;
@ -241,9 +241,6 @@ protected:
template <typename T>
void AddVisualization();
template <typename T>
void DeleteVisualization();
void ChangeColor(QWidget *widget, const QColor &color);
virtual void ShowVisualization() {}
/**
@ -360,19 +357,6 @@ inline void DialogTool::AddVisualization()
}
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T>
inline void DialogTool::DeleteVisualization()
{
T *toolVis = qobject_cast<T *>(vis);
SCASSERT(toolVis != nullptr);
if (qApp->getCurrentScene()->items().contains(toolVis))
{ // In some cases scene delete object yourself. If not make check program will crash.
delete vis;
}
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T>
inline T DialogTool::getCurrentCrossPoint(QComboBox *box) const

View File

@ -75,7 +75,6 @@ DialogTriangle::DialogTriangle(const VContainer *data, const quint32 &toolId, QW
//---------------------------------------------------------------------------------------------------------------------
DialogTriangle::~DialogTriangle()
{
DeleteVisualization<VisToolTriangle>();
delete ui;
}

View File

@ -80,7 +80,6 @@ DialogTrueDarts::DialogTrueDarts(const VContainer *data, const quint32 &toolId,
//---------------------------------------------------------------------------------------------------------------------
DialogTrueDarts::~DialogTrueDarts()
{
DeleteVisualization<VisToolTrueDarts>();
delete ui;
}

View File

@ -89,7 +89,7 @@ void VToolDoublePoint::setNameP2(const QString &name)
//---------------------------------------------------------------------------------------------------------------------
void VToolDoublePoint::SetEnabled(bool enabled)
{
SetToolEnabled(this, enabled);
SetToolEnabled(this, baseColor, enabled);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -379,8 +379,7 @@ void VToolBasePoint::contextMenuEvent ( QGraphicsSceneContextMenuEvent * event )
*/
void VToolBasePoint::FullUpdateFromFile()
{
VPointF point = *VAbstractTool::data.GeometricObject<VPointF>(id);
RefreshPointGeometry(point);
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(id));
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -94,8 +94,8 @@ void VToolSinglePoint::setName(const QString &name)
//---------------------------------------------------------------------------------------------------------------------
void VToolSinglePoint::SetEnabled(bool enabled)
{
SetToolEnabled(this, enabled);
SetToolEnabled(lineName, enabled);
SetToolEnabled(this, baseColor, enabled);
SetToolEnabled(lineName, Qt::black, enabled);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -60,7 +60,7 @@ protected:
virtual void RefreshLine(quint32 id)=0;
template <typename T>
void SetToolEnabled(T *item, bool enabled);
void SetToolEnabled(T *item, const QColor &color, bool enabled);
template <typename T>
static void InitToolConnections(VMainGraphicsScene *scene, T *tool);
@ -97,12 +97,12 @@ void VAbstractPoint::ShowToolVisualization(bool show)
//---------------------------------------------------------------------------------------------------------------------
template <typename T>
void VAbstractPoint::SetToolEnabled(T *item, bool enabled)
void VAbstractPoint::SetToolEnabled(T *item, const QColor &color, bool enabled)
{
item->setEnabled(enabled);
if (enabled)
{
item->setPen(QPen(QColor(baseColor),
item->setPen(QPen(color,
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
}
else

View File

@ -470,7 +470,7 @@ QVariant VToolDetail::itemChange(QGraphicsItem::GraphicsItemChange change, const
// value - this is new position.
const QPointF newPos = value.toPointF();
MoveDetail *moveDet = new MoveDetail(doc, newPos.x(), newPos.y(), id);
MoveDetail *moveDet = new MoveDetail(doc, newPos.x(), newPos.y(), id, scene());
connect(moveDet, &MoveDetail::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
qApp->getUndoStack()->push(moveDet);

View File

@ -33,6 +33,7 @@
#include "../../vgeometry/varc.h"
#include "../../vgeometry/vsplinepath.h"
#include "../dialogs/tools/dialoguniondetails.h"
#include "../ifc/xml/vpatternconverter.h"
#include <QUndoStack>
@ -649,6 +650,8 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d
// Remove it if min version is 0.3.2
// Instead:
// UpdatePoints(data, d1.RemoveEdge(indexD1), i, children);
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 3, 2),
"Time to refactor the code.");
if (children.size() != countNodeD2)
{
UpdatePoints(data, d1.RemoveEdge(indexD1), i, children);
@ -671,6 +674,8 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d
} while (pointsD2 < countNodeD2-1);
// This check need for backward compatibility
// Remove it if min version is 0.3.2
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 3, 2),
"Time to refactor the code.");
if (children.size() == countNodeD2)
{
break;

View File

@ -49,7 +49,6 @@ void AddToCalc::undo()
qCDebug(vUndo, "Undo.");
doc->ChangeActivPP(nameActivDraw);//Without this user will not see this change
doc->setCursor(cursor);
QDomElement calcElement;
if (doc->GetActivNodeElement(VAbstractPattern::TagCalculation, calcElement))
@ -74,10 +73,6 @@ void AddToCalc::undo()
qCDebug(vUndo, "Can't find tag Calculation.");
return;
}
if (cursor > 0)
{
doc->setCursor(0);
}
emit NeedFullParsing();
VMainGraphicsView::NewSceneRect(qApp->getCurrentScene(), qApp->getSceneView());
doc->SetCurrentPP(nameActivDraw);//Return current pattern piece after undo
@ -104,7 +99,6 @@ void AddToCalc::redo()
if (refElement.isElement())
{
calcElement.insertAfter(xml, refElement);
doc->setCursor(0);
}
else
{

View File

@ -35,8 +35,8 @@
//---------------------------------------------------------------------------------------------------------------------
MoveDetail::MoveDetail(VAbstractPattern *doc, const double &x, const double &y, const quint32 &id,
QUndoCommand *parent)
: VUndoCommand(QDomElement(), doc, parent), oldX(0.0), oldY(0.0), newX(x), newY(y), scene(qApp->getCurrentScene())
QGraphicsScene *scene, QUndoCommand *parent)
: VUndoCommand(QDomElement(), doc, parent), oldX(0.0), oldY(0.0), newX(x), newY(y), scene(scene)
{
setText(QObject::tr("move detail"));
nodeId = id;

View File

@ -37,7 +37,7 @@ class MoveDetail : public VUndoCommand
{
Q_OBJECT
public:
MoveDetail(VAbstractPattern *doc, const double &x, const double &y, const quint32 &id,
MoveDetail(VAbstractPattern *doc, const double &x, const double &y, const quint32 &id, QGraphicsScene *scene,
QUndoCommand *parent = 0);
virtual ~MoveDetail() Q_DECL_OVERRIDE;
virtual void undo() Q_DECL_OVERRIDE;