Refactoring.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2015-02-03 10:45:27 +02:00
parent f141edad27
commit c52d0a045d
18 changed files with 42 additions and 85 deletions

View File

@ -42,7 +42,7 @@
*/
DialogAlongLine::DialogAlongLine(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogAlongLine),
typeLine(QString()), formula(QString()), formulaBaseHeight(0), line(nullptr), lineColor(VAbstractTool::ColorBlack)
formula(QString()), formulaBaseHeight(0), line(nullptr), lineColor(VAbstractTool::ColorBlack)
{
ui->setupUi(this);
InitVariables(ui);
@ -180,14 +180,14 @@ void DialogAlongLine::ChosenObject(quint32 id, const SceneObject &type)
void DialogAlongLine::SaveData()
{
pointName = ui->lineEditNamePoint->text();
typeLine = GetTypeLine(ui->comboBoxLineType);
formula = ui->plainTextEditFormula->toPlainText();
formula.replace("\n", " ");
line->setPoint1Id(getFirstPointId());
line->setPoint2Id(getSecondPointId());
line->setLength(formula);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(getTypeLine()));
line->RefreshGeometry();
}
@ -245,9 +245,8 @@ void DialogAlongLine::setFormula(const QString &value)
*/
void DialogAlongLine::setTypeLine(const QString &value)
{
typeLine = value;
ChangeCurrentData(ui->comboBoxLineType, value);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(value));
}
//---------------------------------------------------------------------------------------------------------------------
@ -281,7 +280,7 @@ void DialogAlongLine::setPointName(const QString &value)
*/
QString DialogAlongLine::getTypeLine() const
{
return typeLine;
return GetTypeLine(ui->comboBoxLineType);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -88,9 +88,6 @@ private:
/** @brief ui keeps information about user interface */
Ui::DialogAlongLine *ui;
/** @brief typeLine type of line */
QString typeLine;
/** @brief formula formula */
QString formula;

View File

@ -42,8 +42,8 @@
* @param parent parent widget
*/
DialogBisector::DialogBisector(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogBisector), typeLine(QString()),
formula(QString()), formulaBaseHeight(0), line(nullptr)
:DialogTool(data, toolId, parent), ui(new Ui::DialogBisector), formula(QString()), formulaBaseHeight(0),
line(nullptr)
{
ui->setupUi(this);
InitVariables(ui);
@ -216,9 +216,8 @@ void DialogBisector::setPointName(const QString &value)
*/
void DialogBisector::setTypeLine(const QString &value)
{
typeLine = value;
ChangeCurrentData(ui->comboBoxLineType, value);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(value));
}
//---------------------------------------------------------------------------------------------------------------------
@ -276,7 +275,7 @@ void DialogBisector::setThirdPointId(const quint32 &value)
void DialogBisector::SaveData()
{
pointName = ui->lineEditNamePoint->text();
typeLine = GetTypeLine(ui->comboBoxLineType);
formula = ui->plainTextEditFormula->toPlainText();
formula.replace("\n", " ");
@ -284,7 +283,7 @@ void DialogBisector::SaveData()
line->setPoint2Id(getSecondPointId());
line->setPoint3Id(getThirdPointId());
line->setLength(formula);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(getTypeLine()));
line->RefreshGeometry();
}
@ -302,7 +301,7 @@ void DialogBisector::closeEvent(QCloseEvent *event)
*/
QString DialogBisector::getTypeLine() const
{
return typeLine;
return GetTypeLine(ui->comboBoxLineType);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -89,9 +89,6 @@ private:
/** @brief ui keeps information about user interface */
Ui::DialogBisector *ui;
/** @brief typeLine type of line */
QString typeLine;
/** @brief formula formula */
QString formula;

View File

@ -38,7 +38,7 @@
//---------------------------------------------------------------------------------------------------------------------
DialogCurveIntersectAxis::DialogCurveIntersectAxis(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogCurveIntersectAxis), typeLine(QString()),
:DialogTool(data, toolId, parent), ui(new Ui::DialogCurveIntersectAxis),
formulaAngle(QString()), formulaBaseHeightAngle(0), line(nullptr)
{
ui->setupUi(this);
@ -90,15 +90,14 @@ void DialogCurveIntersectAxis::setPointName(const QString &value)
//---------------------------------------------------------------------------------------------------------------------
QString DialogCurveIntersectAxis::getTypeLine() const
{
return typeLine;
return GetTypeLine(ui->comboBoxLineType);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogCurveIntersectAxis::setTypeLine(const QString &value)
{
typeLine = value;
ChangeCurrentData(ui->comboBoxLineType, value);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(value));
}
//---------------------------------------------------------------------------------------------------------------------
@ -252,7 +251,6 @@ void DialogCurveIntersectAxis::ShowVisualization()
void DialogCurveIntersectAxis::SaveData()
{
pointName = ui->lineEditNamePoint->text();
typeLine = GetTypeLine(ui->comboBoxLineType);
formulaAngle = ui->plainTextEditFormula->toPlainText();
formulaAngle.replace("\n", " ");
@ -260,7 +258,7 @@ void DialogCurveIntersectAxis::SaveData()
line->setPoint1Id(getCurveId());
line->setAxisPointId(getBasePointId());
line->setAngle(formulaAngle);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(getTypeLine()));
line->RefreshGeometry();
}

View File

@ -77,9 +77,6 @@ private:
Q_DISABLE_COPY(DialogCurveIntersectAxis)
Ui::DialogCurveIntersectAxis *ui;
/** @brief typeLine type of line */
QString typeLine;
QString formulaAngle;
int formulaBaseHeightAngle;

View File

@ -43,7 +43,7 @@
* @param parent parent widget
*/
DialogEndLine::DialogEndLine(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogEndLine), typeLine(QString()),
:DialogTool(data, toolId, parent), ui(new Ui::DialogEndLine),
formulaLength(QString()), formulaAngle(QString()), formulaBaseHeight(0), formulaBaseHeightAngle(0), line(nullptr)
{
ui->setupUi(this);
@ -170,9 +170,8 @@ void DialogEndLine::setPointName(const QString &value)
*/
void DialogEndLine::setTypeLine(const QString &value)
{
typeLine = value;
ChangeCurrentData(ui->comboBoxLineType, value);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(value));
}
//---------------------------------------------------------------------------------------------------------------------
@ -273,7 +272,6 @@ void DialogEndLine::ShowVisualization()
void DialogEndLine::SaveData()
{
pointName = ui->lineEditNamePoint->text();
typeLine = GetTypeLine(ui->comboBoxLineType);
formulaLength = ui->plainTextEditFormula->toPlainText();
formulaLength.replace("\n", " ");
@ -284,7 +282,7 @@ void DialogEndLine::SaveData()
line->setPoint1Id(getBasePointId());
line->setLength(formulaLength);
line->setAngle(formulaAngle);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(getTypeLine()));
line->RefreshGeometry();
}
@ -313,7 +311,7 @@ DialogEndLine::~DialogEndLine()
*/
QString DialogEndLine::getTypeLine() const
{
return typeLine;
return GetTypeLine(ui->comboBoxLineType);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -90,9 +90,6 @@ private:
/** @brief ui keeps information about user interface */
Ui::DialogEndLine *ui;
/** @brief typeLine type of line */
QString typeLine;
/** @brief formula formula */
QString formulaLength;

View File

@ -42,7 +42,7 @@
* @param parent parent widget
*/
DialogHeight::DialogHeight(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogHeight), typeLine(QString()), line(nullptr)
:DialogTool(data, toolId, parent), ui(new Ui::DialogHeight), line(nullptr)
{
ui->setupUi(this);
ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
@ -95,9 +95,8 @@ void DialogHeight::setPointName(const QString &value)
*/
void DialogHeight::setTypeLine(const QString &value)
{
typeLine = value;
ChangeCurrentData(ui->comboBoxLineType, value);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(value));
}
//---------------------------------------------------------------------------------------------------------------------
@ -196,12 +195,11 @@ void DialogHeight::ChosenObject(quint32 id, const SceneObject &type)
void DialogHeight::SaveData()
{
pointName = ui->lineEditNamePoint->text();
typeLine = GetTypeLine(ui->comboBoxLineType);
line->setPoint1Id(getBasePointId());
line->setLineP1Id(getP1LineId());
line->setLineP2Id(getP2LineId());
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(getTypeLine()));
line->RefreshGeometry();
}
@ -267,7 +265,7 @@ void DialogHeight::ShowVisualization()
*/
QString DialogHeight::getTypeLine() const
{
return typeLine;
return GetTypeLine(ui->comboBoxLineType);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -77,9 +77,6 @@ private:
/** @brief ui keeps information about user interface */
Ui::DialogHeight *ui;
/** @brief typeLine type of line */
QString typeLine;
VisToolHeight *line;
};

View File

@ -43,7 +43,7 @@
* @param parent parent widget
*/
DialogLine::DialogLine(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogLine), typeLine(QString()), line(nullptr)
:DialogTool(data, toolId, parent), ui(new Ui::DialogLine), line(nullptr)
{
ui->setupUi(this);
InitOkCancelApply(ui);
@ -94,9 +94,8 @@ void DialogLine::setSecondPoint(const quint32 &value)
*/
void DialogLine::setTypeLine(const QString &value)
{
typeLine = value;
ChangeCurrentData(ui->comboBoxLineType, value);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(value));
}
//---------------------------------------------------------------------------------------------------------------------
@ -153,11 +152,9 @@ void DialogLine::ShowVisualization()
//---------------------------------------------------------------------------------------------------------------------
void DialogLine::SaveData()
{
typeLine = GetTypeLine(ui->comboBoxLineType);
line->setPoint1Id(getFirstPoint());
line->setPoint2Id(getSecondPoint());
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(getTypeLine()));
line->RefreshGeometry();
}
@ -227,5 +224,5 @@ quint32 DialogLine::getSecondPoint() const
*/
QString DialogLine::getTypeLine() const
{
return typeLine;
return GetTypeLine(ui->comboBoxLineType);
}

View File

@ -72,8 +72,6 @@ private:
/** @brief ui keeps information about user interface */
Ui::DialogLine *ui;
/** @brief typeLine type of line */
QString typeLine;
VisToolLine *line;
};

View File

@ -38,8 +38,8 @@
//---------------------------------------------------------------------------------------------------------------------
DialogLineIntersectAxis::DialogLineIntersectAxis(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogLineIntersectAxis), typeLine(QString()),
formulaAngle(QString()), formulaBaseHeightAngle(0), line(nullptr)
:DialogTool(data, toolId, parent), ui(new Ui::DialogLineIntersectAxis), formulaAngle(QString()),
formulaBaseHeightAngle(0), line(nullptr)
{
ui->setupUi(this);
InitVariables(ui);
@ -98,15 +98,14 @@ void DialogLineIntersectAxis::setPointName(const QString &value)
//---------------------------------------------------------------------------------------------------------------------
QString DialogLineIntersectAxis::getTypeLine() const
{
return typeLine;
return GetTypeLine(ui->comboBoxLineType);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLineIntersectAxis::setTypeLine(const QString &value)
{
typeLine = value;
ChangeCurrentData(ui->comboBoxLineType, value);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(value));
}
//---------------------------------------------------------------------------------------------------------------------
@ -316,7 +315,6 @@ void DialogLineIntersectAxis::ShowVisualization()
void DialogLineIntersectAxis::SaveData()
{
pointName = ui->lineEditNamePoint->text();
typeLine = GetTypeLine(ui->comboBoxLineType);
formulaAngle = ui->plainTextEditFormula->toPlainText();
formulaAngle.replace("\n", " ");
@ -325,7 +323,7 @@ void DialogLineIntersectAxis::SaveData()
line->setPoint2Id(getSecondPointId());
line->setAxisPointId(getBasePointId());
line->setAngle(formulaAngle);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(getTypeLine()));
line->RefreshGeometry();
}

View File

@ -81,9 +81,6 @@ private:
Q_DISABLE_COPY(DialogLineIntersectAxis)
Ui::DialogLineIntersectAxis *ui;
/** @brief typeLine type of line */
QString typeLine;
QString formulaAngle;
int formulaBaseHeightAngle;

View File

@ -39,8 +39,8 @@
* @param parent parent widget
*/
DialogNormal::DialogNormal(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogNormal), typeLine(QString()),
formula(QString()), angle(0), formulaBaseHeight(0), line(nullptr)
:DialogTool(data, toolId, parent), ui(new Ui::DialogNormal), formula(QString()), angle(0), formulaBaseHeight(0),
line(nullptr)
{
ui->setupUi(this);
InitVariables(ui);
@ -173,7 +173,6 @@ void DialogNormal::ChosenObject(quint32 id, const SceneObject &type)
void DialogNormal::SaveData()
{
pointName = ui->lineEditNamePoint->text();
typeLine = GetTypeLine(ui->comboBoxLineType);
formula = ui->plainTextEditFormula->toPlainText();
formula.replace("\n", " ");
angle = ui->doubleSpinBoxAngle->value();
@ -182,7 +181,7 @@ void DialogNormal::SaveData()
line->setPoint2Id(getSecondPointId());
line->setLength(formula);
line->setAngle(angle);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(getTypeLine()));
line->RefreshGeometry();
}
@ -252,9 +251,8 @@ void DialogNormal::setFormula(const QString &value)
*/
void DialogNormal::setTypeLine(const QString &value)
{
typeLine = value;
ChangeCurrentData(ui->comboBoxLineType, value);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(value));
}
//---------------------------------------------------------------------------------------------------------------------
@ -275,7 +273,7 @@ void DialogNormal::setPointName(const QString &value)
*/
QString DialogNormal::getTypeLine() const
{
return typeLine;
return GetTypeLine(ui->comboBoxLineType);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -88,9 +88,6 @@ private:
/** @brief ui keeps information about user interface */
Ui::DialogNormal *ui;
/** @brief typeLine type of line */
QString typeLine;
/** @brief formula formula */
QString formula;

View File

@ -42,8 +42,8 @@
* @param parent parent widget
*/
DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogShoulderPoint), typeLine(QString()),
formula(QString()), formulaBaseHeight(0), line (nullptr)
:DialogTool(data, toolId, parent), ui(new Ui::DialogShoulderPoint), formula(QString()),
formulaBaseHeight(0), line (nullptr)
{
ui->setupUi(this);
InitVariables(ui);
@ -201,7 +201,6 @@ void DialogShoulderPoint::ChosenObject(quint32 id, const SceneObject &type)
void DialogShoulderPoint::SaveData()
{
pointName = ui->lineEditNamePoint->text();
typeLine = GetTypeLine(ui->comboBoxLineType);
formula = ui->plainTextEditFormula->toPlainText();
formula.replace("\n", " ");
@ -209,7 +208,7 @@ void DialogShoulderPoint::SaveData()
line->setLineP1Id(getP1Line());
line->setLineP2Id(getP2Line());
line->setLength(formula);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(getTypeLine()));
line->RefreshGeometry();
}
@ -278,9 +277,8 @@ void DialogShoulderPoint::setFormula(const QString &value)
*/
void DialogShoulderPoint::setTypeLine(const QString &value)
{
typeLine = value;
ChangeCurrentData(ui->comboBoxLineType, value);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(value));
}
//---------------------------------------------------------------------------------------------------------------------
@ -301,7 +299,7 @@ void DialogShoulderPoint::setPointName(const QString &value)
*/
QString DialogShoulderPoint::getTypeLine() const
{
return typeLine;
return GetTypeLine(ui->comboBoxLineType);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -88,9 +88,6 @@ private:
/** @brief ui keeps information about user interface */
Ui::DialogShoulderPoint *ui;
/** @brief typeLine type of line */
QString typeLine;
/** @brief formula formula */
QString formula;