Refactoring.

--HG--
branch : feature
This commit is contained in:
dismine 2014-03-04 20:14:11 +02:00
parent 2610487fe5
commit 9b78d1a0ab
3 changed files with 19 additions and 35 deletions

View File

@ -36,7 +36,6 @@ DialogEndLine::DialogEndLine(const VContainer *data, QWidget *parent)
formula(QString()), angle(0), basePointId(0)
{
ui->setupUi(this);
spinBoxAngle = ui->doubleSpinBoxAngle;
listWidget = ui->listWidget;
labelResultCalculation = ui->labelResultCalculation;
labelDescription = ui->labelDescription;
@ -61,22 +60,8 @@ DialogEndLine::DialogEndLine(const VContainer *data, QWidget *parent)
FillComboBoxTypeLine(ui->comboBoxLineType);
connect(ui->toolButtonArrowDown, &QPushButton::clicked, this,
&DialogEndLine::ArrowDown);
connect(ui->toolButtonArrowUp, &QPushButton::clicked, this,
&DialogEndLine::ArrowUp);
connect(ui->toolButtonArrowLeft, &QPushButton::clicked, this,
&DialogEndLine::ArrowLeft);
connect(ui->toolButtonArrowRight, &QPushButton::clicked, this,
&DialogEndLine::ArrowRight);
connect(ui->toolButtonArrowLeftUp, &QPushButton::clicked, this,
&DialogEndLine::ArrowLeftUp);
connect(ui->toolButtonArrowLeftDown, &QPushButton::clicked, this,
&DialogEndLine::ArrowLeftDown);
connect(ui->toolButtonArrowRightUp, &QPushButton::clicked, this,
&DialogEndLine::ArrowRightUp);
connect(ui->toolButtonArrowRightDown, &QPushButton::clicked, this,
&DialogEndLine::ArrowRightDown);
InitArrow(ui);
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogEndLine::PutHere);
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogEndLine::PutVal);
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogEndLine::ValChenged);

View File

@ -36,7 +36,6 @@ DialogNormal::DialogNormal(const VContainer *data, QWidget *parent)
typeLine(QString()), formula(QString()), angle(0), firstPointId(0), secondPointId(0)
{
ui->setupUi(this);
spinBoxAngle = ui->doubleSpinBoxAngle;
listWidget = ui->listWidget;
labelResultCalculation = ui->labelResultCalculation;
labelDescription = ui->labelDescription;
@ -61,22 +60,8 @@ DialogNormal::DialogNormal(const VContainer *data, QWidget *parent)
FillComboBoxPoints(ui->comboBoxSecondPoint);
FillComboBoxTypeLine(ui->comboBoxLineType);
connect(ui->toolButtonArrowDown, &QPushButton::clicked, this,
&DialogNormal::ArrowDown);
connect(ui->toolButtonArrowUp, &QPushButton::clicked, this,
&DialogNormal::ArrowUp);
connect(ui->toolButtonArrowLeft, &QPushButton::clicked, this,
&DialogNormal::ArrowLeft);
connect(ui->toolButtonArrowRight, &QPushButton::clicked, this,
&DialogNormal::ArrowRight);
connect(ui->toolButtonArrowLeftUp, &QPushButton::clicked, this,
&DialogNormal::ArrowLeftUp);
connect(ui->toolButtonArrowLeftDown, &QPushButton::clicked, this,
&DialogNormal::ArrowLeftDown);
connect(ui->toolButtonArrowRightUp, &QPushButton::clicked, this,
&DialogNormal::ArrowRightUp);
connect(ui->toolButtonArrowRightDown, &QPushButton::clicked, this,
&DialogNormal::ArrowRightDown);
InitArrow(ui);
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogNormal::PutHere);
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogNormal::PutVal);
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogNormal::ValChenged);

View File

@ -398,7 +398,21 @@ protected:
* @return id or -1 if combobox is empty
*/
quint32 getCurrentObjectId(QComboBox *box) const;
bool ChoosedPoint(const quint32 &id, QComboBox *box, const QString &toolTip);
bool ChoosedPoint(const quint32 &id, QComboBox *box, const QString &toolTip);
template <typename T>
void InitArrow(T *ui)
{
Q_CHECK_PTR(ui);
spinBoxAngle = ui->doubleSpinBoxAngle;
connect(ui->toolButtonArrowDown, &QPushButton::clicked, this, &DialogTool::ArrowDown);
connect(ui->toolButtonArrowUp, &QPushButton::clicked, this, &DialogTool::ArrowUp);
connect(ui->toolButtonArrowLeft, &QPushButton::clicked, this, &DialogTool::ArrowLeft);
connect(ui->toolButtonArrowRight, &QPushButton::clicked, this, &DialogTool::ArrowRight);
connect(ui->toolButtonArrowLeftUp, &QPushButton::clicked, this, &DialogTool::ArrowLeftUp);
connect(ui->toolButtonArrowLeftDown, &QPushButton::clicked, this, &DialogTool::ArrowLeftDown);
connect(ui->toolButtonArrowRightUp, &QPushButton::clicked, this, &DialogTool::ArrowRightUp);
connect(ui->toolButtonArrowRightDown, &QPushButton::clicked, this, &DialogTool::ArrowRightDown);
}
private:
/**
* @brief FillList fill combobox list