2013-11-15 13:41:26 +01:00
|
|
|
/************************************************************************
|
2013-11-04 21:38:54 +01:00
|
|
|
**
|
2013-11-15 13:50:05 +01:00
|
|
|
** @file dialogtriangle.cpp
|
2014-04-30 07:38:52 +02:00
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
2013-11-15 13:50:05 +01:00
|
|
|
** @date November 15, 2013
|
2013-11-04 21:38:54 +01:00
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
** @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
|
|
|
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
2013-11-04 21:38:54 +01:00
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
** Valentina is free software: you can redistribute it and/or modify
|
2013-11-04 21:38:54 +01:00
|
|
|
** 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 <http://www.gnu.org/licenses/>.
|
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
*************************************************************************/
|
2013-11-04 21:38:54 +01:00
|
|
|
|
2013-10-18 20:20:54 +02:00
|
|
|
#include "dialogtriangle.h"
|
|
|
|
#include "ui_dialogtriangle.h"
|
|
|
|
|
2013-11-21 13:05:26 +01:00
|
|
|
#include <QPushButton>
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2013-12-21 12:36:51 +01:00
|
|
|
DialogTriangle::DialogTriangle(const VContainer *data, QWidget *parent)
|
|
|
|
:DialogTool(data, parent), ui(new Ui::DialogTriangle), number(0), pointName(QString()), axisP1Id(0),
|
2013-11-04 21:35:15 +01:00
|
|
|
axisP2Id(0), firstPointId(0), secondPointId(0)
|
|
|
|
{
|
2013-10-18 20:20:54 +02:00
|
|
|
ui->setupUi(this);
|
|
|
|
labelEditNamePoint = ui->labelEditNamePoint;
|
2014-05-25 21:54:17 +02:00
|
|
|
InitOkCancel(ui);
|
2013-10-18 20:20:54 +02:00
|
|
|
flagName = false;
|
|
|
|
CheckState();
|
2013-12-21 12:36:51 +01:00
|
|
|
|
|
|
|
FillComboBoxPoints(ui->comboBoxAxisP1);
|
|
|
|
FillComboBoxPoints(ui->comboBoxAxisP2);
|
|
|
|
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
|
|
|
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
|
|
|
|
2013-10-18 20:20:54 +02:00
|
|
|
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogTriangle::NamePointChanged);
|
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2013-11-04 21:35:15 +01:00
|
|
|
DialogTriangle::~DialogTriangle()
|
|
|
|
{
|
2013-10-18 20:20:54 +02:00
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-03-11 12:43:24 +01:00
|
|
|
void DialogTriangle::ChoosedObject(quint32 id, const Valentina::Scenes &type)
|
2013-11-04 21:35:15 +01:00
|
|
|
{
|
2014-03-11 12:43:24 +01:00
|
|
|
if (type == Valentina::Point)
|
2013-11-04 21:35:15 +01:00
|
|
|
{
|
2013-12-29 17:48:57 +01:00
|
|
|
const VPointF *point = data->GeometricObject<const VPointF *>(id);
|
2013-11-04 21:35:15 +01:00
|
|
|
switch (number)
|
|
|
|
{
|
|
|
|
case (0):
|
2013-12-29 17:48:57 +01:00
|
|
|
ChangeCurrentText(ui->comboBoxAxisP1, point->name());
|
2013-11-04 21:35:15 +01:00
|
|
|
number++;
|
|
|
|
emit ToolTip(tr("Select second point of axis"));
|
|
|
|
break;
|
|
|
|
case (1):
|
2013-12-29 17:48:57 +01:00
|
|
|
ChangeCurrentText(ui->comboBoxAxisP2, point->name());
|
2013-11-04 21:35:15 +01:00
|
|
|
number++;
|
|
|
|
emit ToolTip(tr("Select first point"));
|
|
|
|
break;
|
|
|
|
case (2):
|
2013-12-29 17:48:57 +01:00
|
|
|
ChangeCurrentText(ui->comboBoxFirstPoint, point->name());
|
2013-11-04 21:35:15 +01:00
|
|
|
number++;
|
|
|
|
emit ToolTip(tr("Select second point"));
|
|
|
|
break;
|
|
|
|
case (3):
|
2013-12-29 17:48:57 +01:00
|
|
|
ChangeCurrentText(ui->comboBoxSecondPoint, point->name());
|
2013-11-04 21:35:15 +01:00
|
|
|
number = 0;
|
|
|
|
emit ToolTip(tr(""));
|
|
|
|
if (isInitialized == false)
|
|
|
|
{
|
|
|
|
this->show();
|
|
|
|
}
|
|
|
|
break;
|
2013-11-12 19:29:03 +01:00
|
|
|
default:
|
|
|
|
break;
|
2013-10-18 20:20:54 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2013-11-04 21:35:15 +01:00
|
|
|
void DialogTriangle::DialogAccepted()
|
|
|
|
{
|
2013-10-18 20:20:54 +02:00
|
|
|
pointName = ui->lineEditNamePoint->text();
|
2013-12-18 12:13:32 +01:00
|
|
|
firstPointId = getCurrentObjectId(ui->comboBoxFirstPoint);
|
|
|
|
secondPointId = getCurrentObjectId(ui->comboBoxSecondPoint);
|
|
|
|
axisP1Id = getCurrentObjectId(ui->comboBoxAxisP1);
|
|
|
|
axisP2Id = getCurrentObjectId(ui->comboBoxAxisP2);
|
2013-10-18 20:20:54 +02:00
|
|
|
emit DialogClosed(QDialog::Accepted);
|
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2013-11-04 21:35:15 +01:00
|
|
|
void DialogTriangle::setPointName(const QString &value)
|
|
|
|
{
|
2013-10-18 20:20:54 +02:00
|
|
|
pointName = value;
|
|
|
|
ui->lineEditNamePoint->setText(pointName);
|
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-02-25 15:40:24 +01:00
|
|
|
void DialogTriangle::setSecondPointId(const quint32 &value, const quint32 &id)
|
2013-11-04 21:35:15 +01:00
|
|
|
{
|
2013-10-18 20:20:54 +02:00
|
|
|
secondPointId = value;
|
|
|
|
setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id);
|
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-02-25 15:40:24 +01:00
|
|
|
void DialogTriangle::setFirstPointId(const quint32 &value, const quint32 &id)
|
2013-11-04 21:35:15 +01:00
|
|
|
{
|
2013-10-18 20:20:54 +02:00
|
|
|
firstPointId = value;
|
|
|
|
setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id);
|
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-02-25 15:40:24 +01:00
|
|
|
void DialogTriangle::setAxisP2Id(const quint32 &value, const quint32 &id)
|
2013-11-04 21:35:15 +01:00
|
|
|
{
|
2013-10-18 20:20:54 +02:00
|
|
|
axisP2Id = value;
|
|
|
|
setCurrentPointId(ui->comboBoxAxisP2, axisP2Id, value, id);
|
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-02-25 15:40:24 +01:00
|
|
|
void DialogTriangle::setAxisP1Id(const quint32 &value, const quint32 &id)
|
2013-11-04 21:35:15 +01:00
|
|
|
{
|
2013-10-18 20:20:54 +02:00
|
|
|
axisP1Id = value;
|
|
|
|
setCurrentPointId(ui->comboBoxAxisP1, axisP1Id, value, id);
|
|
|
|
}
|