/************************************************************************ ** ** @file dialognormal.cpp ** @author Roman Telezhinsky ** @date November 15, 2013 ** ** @brief ** @copyright ** This source code is part of the Valentine project, a pattern making ** program, whose allow create and modeling patterns of clothing. ** Copyright (C) 2013 Valentina project ** All Rights Reserved. ** ** Valentina is free software: you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with Valentina. If not, see . ** *************************************************************************/ #include "dialognormal.h" #include "ui_dialognormal.h" #include DialogNormal::DialogNormal(const VContainer *data, QWidget *parent) :DialogTool(data, parent), ui(new Ui::DialogNormal), number(0), pointName(QString()), typeLine(QString()), formula(QString()), angle(0), firstPointId(0), secondPointId(0) { ui->setupUi(this); InitVariables(ui); labelResultCalculation = ui->labelResultCalculation; lineEditFormula = ui->lineEditFormula; labelEditFormula = ui->labelEditFormula; labelEditNamePoint = ui->labelEditNamePoint; InitOkCansel(ui); flagFormula = false; flagName = false; CheckState(); FillComboBoxPoints(ui->comboBoxFirstPoint); FillComboBoxPoints(ui->comboBoxSecondPoint); FillComboBoxTypeLine(ui->comboBoxLineType); InitArrow(ui); connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogNormal::PutHere); connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogNormal::PutVal); connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogNormal::EvalFormula); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogNormal::NamePointChanged); connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogNormal::FormulaChanged); } DialogNormal::~DialogNormal() { delete ui; } void DialogNormal::ChoosedObject(quint32 id, const Valentina::Scenes &type) { if (type == Valentina::Point) { if (number == 0) { if (ChoosedPoint(id, ui->comboBoxFirstPoint, tr("Select second point of line"))) { number++; return; } } if (number == 1) { if (ChoosedPoint(id, ui->comboBoxSecondPoint, "")) { number = 0; if (isInitialized == false) { this->show(); } } } } } void DialogNormal::DialogAccepted() { pointName = ui->lineEditNamePoint->text(); typeLine = GetTypeLine(ui->comboBoxLineType); formula = ui->lineEditFormula->text(); angle = ui->doubleSpinBoxAngle->value(); firstPointId = getCurrentObjectId(ui->comboBoxFirstPoint); secondPointId = getCurrentObjectId(ui->comboBoxSecondPoint); emit DialogClosed(QDialog::Accepted); } void DialogNormal::setSecondPointId(const quint32 &value, const quint32 &id) { setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id); } void DialogNormal::setFirstPointId(const quint32 &value, const quint32 &id) { setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id); } void DialogNormal::setAngle(const qreal &value) { angle = value; ui->doubleSpinBoxAngle->setValue(angle); } void DialogNormal::setFormula(const QString &value) { formula = value; ui->lineEditFormula->setText(formula); } void DialogNormal::setTypeLine(const QString &value) { typeLine = value; SetupTypeLine(ui->comboBoxLineType, value); } void DialogNormal::setPointName(const QString &value) { pointName = value; ui->lineEditNamePoint->setText(pointName); }