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) formula(QString()), angle(0), basePointId(0)
{ {
ui->setupUi(this); ui->setupUi(this);
spinBoxAngle = ui->doubleSpinBoxAngle;
listWidget = ui->listWidget; listWidget = ui->listWidget;
labelResultCalculation = ui->labelResultCalculation; labelResultCalculation = ui->labelResultCalculation;
labelDescription = ui->labelDescription; labelDescription = ui->labelDescription;
@ -61,22 +60,8 @@ DialogEndLine::DialogEndLine(const VContainer *data, QWidget *parent)
FillComboBoxTypeLine(ui->comboBoxLineType); FillComboBoxTypeLine(ui->comboBoxLineType);
connect(ui->toolButtonArrowDown, &QPushButton::clicked, this, InitArrow(ui);
&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);
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogEndLine::PutHere); connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogEndLine::PutHere);
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogEndLine::PutVal); connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogEndLine::PutVal);
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogEndLine::ValChenged); 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) typeLine(QString()), formula(QString()), angle(0), firstPointId(0), secondPointId(0)
{ {
ui->setupUi(this); ui->setupUi(this);
spinBoxAngle = ui->doubleSpinBoxAngle;
listWidget = ui->listWidget; listWidget = ui->listWidget;
labelResultCalculation = ui->labelResultCalculation; labelResultCalculation = ui->labelResultCalculation;
labelDescription = ui->labelDescription; labelDescription = ui->labelDescription;
@ -61,22 +60,8 @@ DialogNormal::DialogNormal(const VContainer *data, QWidget *parent)
FillComboBoxPoints(ui->comboBoxSecondPoint); FillComboBoxPoints(ui->comboBoxSecondPoint);
FillComboBoxTypeLine(ui->comboBoxLineType); FillComboBoxTypeLine(ui->comboBoxLineType);
connect(ui->toolButtonArrowDown, &QPushButton::clicked, this, InitArrow(ui);
&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);
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogNormal::PutHere); connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogNormal::PutHere);
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogNormal::PutVal); connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogNormal::PutVal);
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogNormal::ValChenged); connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogNormal::ValChenged);

View File

@ -399,6 +399,20 @@ protected:
*/ */
quint32 getCurrentObjectId(QComboBox *box) const; 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: private:
/** /**
* @brief FillList fill combobox list * @brief FillList fill combobox list