Refactoring.
--HG-- branch : develop
This commit is contained in:
parent
30aa0402fe
commit
4bba3df4af
|
@ -42,8 +42,7 @@
|
|||
*/
|
||||
DialogAlongLine::DialogAlongLine(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogAlongLine), number(0), pointName(QString()),
|
||||
typeLine(QString()), formula(QString()), firstPointId(0), secondPointId(0), formulaBaseHeight(0), line(nullptr),
|
||||
prepare(false)
|
||||
typeLine(QString()), formula(QString()), firstPointId(0), secondPointId(0), formulaBaseHeight(0), line(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
InitVariables(ui);
|
||||
|
@ -142,12 +141,7 @@ void DialogAlongLine::ChosenObject(quint32 id, const SceneObject &type)
|
|||
if (ChoosedPoint(id, ui->comboBoxFirstPoint, tr("Select second point of line")))
|
||||
{
|
||||
number++;
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
SCASSERT(scene != nullptr);
|
||||
line->VisualMode(id, scene->getScenePos());
|
||||
scene->addItem(line);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisToolAlongLine::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::mouseMove, line, &VisToolAlongLine::MousePos);
|
||||
line->VisualMode(id);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,8 +106,6 @@ private:
|
|||
/** @brief formulaBaseHeight base height defined by dialogui */
|
||||
int formulaBaseHeight;
|
||||
VisToolAlongLine *line;
|
||||
/** @brief prepare show if we prepare show dialog after finish working with visual part of tool*/
|
||||
bool prepare;
|
||||
|
||||
/**
|
||||
* @brief SaveData Put dialog data in local variables
|
||||
|
|
|
@ -155,12 +155,7 @@ void DialogBisector::ChosenObject(quint32 id, const SceneObject &type)
|
|||
{ // -1 for not found
|
||||
ui->comboBoxFirstPoint->setCurrentIndex(index);
|
||||
number++;
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
SCASSERT(scene != nullptr);
|
||||
line->VisualMode(id, scene->getScenePos());
|
||||
scene->addItem(line);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisToolBisector::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::mouseMove, line, &VisToolBisector::MousePos);
|
||||
line->VisualMode(id);
|
||||
emit ToolTip(tr("Select second point of angle"));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
DialogEndLine::DialogEndLine(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogEndLine), pointName(QString()), typeLine(QString()),
|
||||
formulaLength(QString()), formulaAngle(QString()), basePointId(0), formulaBaseHeight(0),
|
||||
formulaBaseHeightAngle(0), line(nullptr), prepare(false)
|
||||
formulaBaseHeightAngle(0), line(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
InitVariables(ui);
|
||||
|
@ -144,12 +144,7 @@ void DialogEndLine::ChosenObject(quint32 id, const SceneObject &type)
|
|||
basePointId = id;
|
||||
ChangeCurrentText(ui->comboBoxBasePoint, point->name());
|
||||
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
SCASSERT(scene != nullptr);
|
||||
scene->addItem(line);
|
||||
line->VisualMode(id, scene->getScenePos());
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisToolEndLine::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::mouseMove, line, &VisToolEndLine::MousePos);
|
||||
line->VisualMode(id);
|
||||
connect(line, &VisToolEndLine::ToolTip, this, &DialogTool::ShowVisToolTip);
|
||||
|
||||
emit ToolTip("");
|
||||
|
|
|
@ -111,9 +111,6 @@ private:
|
|||
|
||||
VisToolEndLine *line;
|
||||
|
||||
/** @brief prepare show if we prepare show dialog after finish working with visual part of tool*/
|
||||
bool prepare;
|
||||
|
||||
/**
|
||||
* @brief SaveData Put dialog data in local variables
|
||||
*/
|
||||
|
|
|
@ -152,10 +152,13 @@ void DialogLine::UpdateList()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogLine::ShowVisualization()
|
||||
{
|
||||
if (prepare == false)
|
||||
{
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisToolLine::SetFactor);
|
||||
scene->addItem(line);
|
||||
line->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -189,13 +192,7 @@ void DialogLine::ChosenObject(quint32 id, const SceneObject &type)
|
|||
qint32 index = ui->comboBoxFirstPoint->findText(point->name());
|
||||
if ( index != -1 )
|
||||
{ // -1 for not found
|
||||
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
line->VisualMode(id, scene->getScenePos());
|
||||
scene->addItem(line);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisToolLine::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::mouseMove, line, &VisToolLine::MousePos);
|
||||
|
||||
line->VisualMode(id);
|
||||
ui->comboBoxFirstPoint->setCurrentIndex(index);
|
||||
number++;
|
||||
emit ToolTip(tr("Select second point"));
|
||||
|
@ -211,6 +208,7 @@ void DialogLine::ChosenObject(quint32 id, const SceneObject &type)
|
|||
if (flagError)
|
||||
{
|
||||
number = 0;
|
||||
prepare = true;
|
||||
emit ToolTip("");
|
||||
DialogAccepted();
|
||||
}
|
||||
|
|
|
@ -40,8 +40,7 @@
|
|||
*/
|
||||
DialogNormal::DialogNormal(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogNormal), number(0), pointName(QString()), typeLine(QString()),
|
||||
formula(QString()), angle(0), firstPointId(0), secondPointId(0), formulaBaseHeight(0), line(nullptr),
|
||||
prepare(false)
|
||||
formula(QString()), angle(0), firstPointId(0), secondPointId(0), formulaBaseHeight(0), line(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
InitVariables(ui);
|
||||
|
@ -141,12 +140,7 @@ void DialogNormal::ChosenObject(quint32 id, const SceneObject &type)
|
|||
if (ChoosedPoint(id, ui->comboBoxFirstPoint, tr("Select second point of line")))
|
||||
{
|
||||
number++;
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
SCASSERT(scene != nullptr);
|
||||
line->VisualMode(id, scene->getScenePos());
|
||||
scene->addItem(line);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisToolNormal::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::mouseMove, line, &VisToolNormal::MousePos);
|
||||
line->VisualMode(id);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -115,9 +115,6 @@ private:
|
|||
|
||||
VisToolNormal *line;
|
||||
|
||||
/** @brief prepare show if we prepare show dialog after finish working with visual part of tool*/
|
||||
bool prepare;
|
||||
|
||||
/**
|
||||
* @brief SaveData Put dialog data in local variables
|
||||
*/
|
||||
|
|
|
@ -43,8 +43,7 @@
|
|||
*/
|
||||
DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogShoulderPoint), number(0), pointName(QString()),
|
||||
typeLine(QString()), formula(QString()), p1Line(0), p2Line(0), pShoulder(0), formulaBaseHeight(0), line (nullptr),
|
||||
prepare(false)
|
||||
typeLine(QString()), formula(QString()), p1Line(0), p2Line(0), pShoulder(0), formulaBaseHeight(0), line (nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
InitVariables(ui);
|
||||
|
@ -155,12 +154,7 @@ void DialogShoulderPoint::ChosenObject(quint32 id, const SceneObject &type)
|
|||
{ // -1 for not found
|
||||
ui->comboBoxPShoulder->setCurrentIndex(index);
|
||||
number++;
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
SCASSERT(scene != nullptr);
|
||||
line->VisualMode(id, scene->getScenePos());
|
||||
scene->addItem(line);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisToolShoulderPoint::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::mouseMove, line, &VisToolShoulderPoint::MousePos);
|
||||
line->VisualMode(id);
|
||||
emit ToolTip(tr("Select first point of line"));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -113,7 +113,6 @@ private:
|
|||
/** @brief formulaBaseHeight base height defined by dialogui */
|
||||
int formulaBaseHeight;
|
||||
VisToolShoulderPoint *line;
|
||||
bool prepare;
|
||||
|
||||
/**
|
||||
* @brief SaveData Put dialog data in local variables
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
#include <QPushButton>
|
||||
#include <QDoubleSpinBox>
|
||||
|
||||
#define DIALOGARC_MAX_FORMULA_HEIGHT 64
|
||||
#define DIALOG_MAX_FORMULA_HEIGHT 64
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
@ -63,7 +63,7 @@ DialogTool::DialogTool(const VContainer *data, const quint32 &toolId, QWidget *p
|
|||
labelEditFormula(nullptr), radioButtonSizeGrowth(nullptr), radioButtonStandardTable(nullptr),
|
||||
radioButtonIncrements(nullptr), radioButtonLengthLine(nullptr), radioButtonLengthArc(nullptr),
|
||||
radioButtonLengthCurve(nullptr), radioButtonAngleLine(nullptr), lineStyles(VAbstractTool::Styles()),
|
||||
okColor(QColor(76, 76, 76)), errorColor(Qt::red), associatedTool(nullptr), toolId(toolId)
|
||||
okColor(QColor(76, 76, 76)), errorColor(Qt::red), associatedTool(nullptr), toolId(toolId), prepare(false)
|
||||
{
|
||||
SCASSERT(data != nullptr);
|
||||
timerFormula = new QTimer(this);
|
||||
|
@ -592,9 +592,9 @@ void DialogTool::DeployFormula(QPlainTextEdit *formula, QPushButton *buttonGrowL
|
|||
{
|
||||
SCASSERT(formula != nullptr);
|
||||
SCASSERT(buttonGrowLength != nullptr)
|
||||
if (formula->height() < DIALOGARC_MAX_FORMULA_HEIGHT)
|
||||
if (formula->height() < DIALOG_MAX_FORMULA_HEIGHT)
|
||||
{
|
||||
formula->setFixedHeight(DIALOGARC_MAX_FORMULA_HEIGHT);
|
||||
formula->setFixedHeight(DIALOG_MAX_FORMULA_HEIGHT);
|
||||
//Set icon from theme (internal for Windows system)
|
||||
buttonGrowLength->setIcon(QIcon::fromTheme("go-next",
|
||||
QIcon(":/icons/win.icon.theme/16x16/actions/go-next.png")));
|
||||
|
|
|
@ -197,6 +197,9 @@ protected:
|
|||
VAbstractTool *associatedTool;
|
||||
quint32 toolId;
|
||||
|
||||
/** @brief prepare show if we prepare. Show dialog after finish working with visual part of tool*/
|
||||
bool prepare;
|
||||
|
||||
virtual void closeEvent ( QCloseEvent * event );
|
||||
virtual void showEvent( QShowEvent *event );
|
||||
void FillComboBoxPoints(QComboBox *box)const;
|
||||
|
|
|
@ -270,11 +270,18 @@ void VisLine::setScenePos(const QPointF &value)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisLine::VisualMode(const quint32 &pointId, const QPointF &scenePos)
|
||||
void VisLine::VisualMode(const quint32 &pointId)
|
||||
{
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
SCASSERT(scene != nullptr);
|
||||
|
||||
this->point1Id = pointId;
|
||||
this->scenePos = scenePos;
|
||||
this->scenePos = scene->getScenePos();
|
||||
RefreshGeometry();
|
||||
|
||||
scene->addItem(this);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, this, &VisLine::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::mouseMove, this, &VisLine::MousePos);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -46,7 +46,7 @@ public:
|
|||
void setLineStyle(const Qt::PenStyle &value);
|
||||
virtual void RefreshGeometry()=0;
|
||||
void setScenePos(const QPointF &value);
|
||||
void VisualMode(const quint32 &pointId, const QPointF &scenePos);
|
||||
void VisualMode(const quint32 &pointId);
|
||||
void setMainColor(const QColor &value);
|
||||
signals:
|
||||
void ToolTip(const QString &toolTip);
|
||||
|
|
Loading…
Reference in New Issue
Block a user