2013-11-15 13:41:26 +01:00
|
|
|
/************************************************************************
|
2013-09-18 21:16:19 +02:00
|
|
|
**
|
2013-11-15 13:50:05 +01:00
|
|
|
** @file dialogtool.h
|
2013-11-15 13:41:26 +01:00
|
|
|
** @author Roman Telezhinsky <dismine@gmail.com>
|
2013-11-15 13:50:05 +01:00
|
|
|
** @date November 15, 2013
|
2013-09-18 21:16:19 +02: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-09-18 21:16:19 +02:00
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
** Valentina is free software: you can redistribute it and/or modify
|
2013-09-18 21:16:19 +02: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.
|
|
|
|
**
|
2013-10-27 13:36:29 +01:00
|
|
|
** Valentina is distributed in the hope that it will be useful,
|
2013-09-18 21:16:19 +02:00
|
|
|
** 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-09-18 21:16:19 +02:00
|
|
|
|
2013-07-28 00:18:06 +02:00
|
|
|
#ifndef DIALOGTOOL_H
|
|
|
|
#define DIALOGTOOL_H
|
|
|
|
|
|
|
|
#include <QDialog>
|
2013-11-06 16:49:07 +01:00
|
|
|
#include "../container/vcontainer.h"
|
2013-07-28 00:18:06 +02:00
|
|
|
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief The DialogTool class parent for all dialog of tools.
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
class DialogTool : public QDialog
|
|
|
|
{
|
2013-07-28 00:18:06 +02:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief DialogTool create dialog
|
|
|
|
* @param data container with data
|
|
|
|
* @param mode mode of creation tool
|
|
|
|
* @param parent parent widget
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
DialogTool(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0);
|
2013-10-26 19:55:06 +02:00
|
|
|
virtual ~DialogTool() {}
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief getIdDetail return id detail
|
|
|
|
* @return id
|
|
|
|
*/
|
2013-10-26 19:55:06 +02:00
|
|
|
inline qint64 getIdDetail() const {return idDetail;}
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief setIdDetail set id detail
|
|
|
|
* @param value id
|
|
|
|
*/
|
2013-10-26 19:55:06 +02:00
|
|
|
inline void setIdDetail(const qint64 &value) {idDetail = value;}
|
2013-07-28 00:18:06 +02:00
|
|
|
signals:
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief DialogClosed signal dialog closed
|
|
|
|
* @param result keep result
|
|
|
|
*/
|
2013-07-28 00:18:06 +02:00
|
|
|
void DialogClosed(int result);
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief ToolTip emit tooltipe for tool
|
|
|
|
* @param toolTip text tooltipe
|
|
|
|
*/
|
2013-10-07 13:11:56 +02:00
|
|
|
void ToolTip(const QString &toolTip);
|
2013-07-28 00:18:06 +02:00
|
|
|
public slots:
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong.
|
|
|
|
* @param id id of point or detail
|
|
|
|
* @param type type of object
|
|
|
|
*/
|
2013-11-06 20:46:07 +01:00
|
|
|
virtual void ChoosedObject(qint64 id, const Scene::Scenes &type);
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief NamePointChanged check name of point
|
|
|
|
*/
|
2013-07-28 00:18:06 +02:00
|
|
|
void NamePointChanged();
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief DialogAccepted save data and emit signal about closed dialog.
|
|
|
|
*/
|
2013-07-28 00:18:06 +02:00
|
|
|
virtual void DialogAccepted();
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief DialogRejected emit signal dialog rejected
|
|
|
|
*/
|
2013-07-28 00:18:06 +02:00
|
|
|
virtual void DialogRejected();
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief formula check formula
|
|
|
|
*/
|
2013-07-28 00:18:06 +02:00
|
|
|
void FormulaChanged();
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief ArrowUp set angle value 90 degree
|
|
|
|
*/
|
2013-07-28 00:18:06 +02:00
|
|
|
void ArrowUp();
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief ArrowDown set angle value 270 degree
|
|
|
|
*/
|
2013-07-28 00:18:06 +02:00
|
|
|
void ArrowDown();
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief ArrowLeft set angle value 180 degree
|
|
|
|
*/
|
2013-07-28 00:18:06 +02:00
|
|
|
void ArrowLeft();
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief ArrowRight set angle value 0 degree
|
|
|
|
*/
|
2013-07-28 00:18:06 +02:00
|
|
|
void ArrowRight();
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief ArrowLeftUp set angle value 135 degree
|
|
|
|
*/
|
2013-07-28 00:18:06 +02:00
|
|
|
void ArrowLeftUp();
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief ArrowLeftDown set angle value 225 degree
|
|
|
|
*/
|
2013-07-28 00:18:06 +02:00
|
|
|
void ArrowLeftDown();
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief ArrowRightUp set angle value 45 degree
|
|
|
|
*/
|
2013-07-28 00:18:06 +02:00
|
|
|
void ArrowRightUp();
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief ArrowRightDown set angle value 315 degree
|
|
|
|
*/
|
2013-07-28 00:18:06 +02:00
|
|
|
void ArrowRightDown();
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief EvalFormula evaluate formula
|
|
|
|
*/
|
2013-07-28 00:18:06 +02:00
|
|
|
void EvalFormula();
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief SizeGrowth show in list base variables
|
|
|
|
*/
|
2013-07-28 00:18:06 +02:00
|
|
|
void SizeGrowth();
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief StandartTable show in list standart table variables
|
|
|
|
*/
|
2013-07-28 00:18:06 +02:00
|
|
|
void StandartTable();
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief LengthLines show in list lengths of lines variables
|
|
|
|
*/
|
2013-07-28 00:18:06 +02:00
|
|
|
void LengthLines();
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief LengthArcs show in list lengths of arcs variables
|
|
|
|
*/
|
2013-10-13 17:31:42 +02:00
|
|
|
void LengthArcs();
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief LengthCurves show in list lengths of curves variables
|
|
|
|
*/
|
2013-10-13 17:31:42 +02:00
|
|
|
void LengthCurves();
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief Increments show in list increment variables
|
|
|
|
*/
|
2013-07-28 00:18:06 +02:00
|
|
|
void Increments();
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief PutHere put variable into edit
|
|
|
|
*/
|
2013-07-28 00:18:06 +02:00
|
|
|
void PutHere();
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief PutVal put variable into edit
|
|
|
|
* @param item chosen item of list widget
|
|
|
|
*/
|
2013-07-28 00:18:06 +02:00
|
|
|
void PutVal(QListWidgetItem * item);
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief ValChenged show description when current variable changed
|
|
|
|
* @param row number of row
|
|
|
|
*/
|
2013-08-06 09:56:09 +02:00
|
|
|
virtual void ValChenged(int row);
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief UpdateList update lists of variables
|
|
|
|
*/
|
2013-07-28 00:18:06 +02:00
|
|
|
void UpdateList();
|
|
|
|
protected:
|
2013-09-26 20:50:52 +02:00
|
|
|
Q_DISABLE_COPY(DialogTool)
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief data container with data
|
|
|
|
*/
|
2013-07-28 00:18:06 +02:00
|
|
|
const VContainer *data;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief isInitialized true if window is initialized
|
|
|
|
*/
|
2013-07-28 00:18:06 +02:00
|
|
|
bool isInitialized;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief flagName true if name is correct
|
|
|
|
*/
|
2013-07-28 00:18:06 +02:00
|
|
|
bool flagName;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief flagFormula true if formula correct
|
|
|
|
*/
|
2013-07-28 00:18:06 +02:00
|
|
|
bool flagFormula;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief timerFormula timer for check formula
|
|
|
|
*/
|
2013-07-28 00:18:06 +02:00
|
|
|
QTimer *timerFormula;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief bOk button ok
|
|
|
|
*/
|
2013-07-28 00:18:06 +02:00
|
|
|
QPushButton *bOk;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief spinBoxAngle spinbox for angle
|
|
|
|
*/
|
2013-09-12 16:18:31 +02:00
|
|
|
QDoubleSpinBox *spinBoxAngle;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief lineEditFormula linEdit for formula
|
|
|
|
*/
|
2013-07-28 00:18:06 +02:00
|
|
|
QLineEdit *lineEditFormula;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief listWidget listWidget with variables
|
|
|
|
*/
|
2013-07-28 00:18:06 +02:00
|
|
|
QListWidget *listWidget;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief labelResultCalculation label with result of calculation
|
|
|
|
*/
|
2013-07-28 00:18:06 +02:00
|
|
|
QLabel *labelResultCalculation;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief labelDescription description of variable
|
|
|
|
*/
|
2013-07-28 00:18:06 +02:00
|
|
|
QLabel *labelDescription;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief labelEditNamePoint label used when need show wrong name of point
|
|
|
|
*/
|
2013-10-06 18:22:21 +02:00
|
|
|
QLabel *labelEditNamePoint;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief labelEditFormula label used when need show wrong formula
|
|
|
|
*/
|
2013-10-06 18:22:21 +02:00
|
|
|
QLabel *labelEditFormula;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief radioButtonSizeGrowth radio button for base variables
|
|
|
|
*/
|
2013-07-28 00:18:06 +02:00
|
|
|
QRadioButton *radioButtonSizeGrowth;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief radioButtonStandartTable radio button for standart table variables
|
|
|
|
*/
|
2013-07-28 00:18:06 +02:00
|
|
|
QRadioButton *radioButtonStandartTable;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief radioButtonIncrements radio button for increments variables
|
|
|
|
*/
|
2013-07-28 00:18:06 +02:00
|
|
|
QRadioButton *radioButtonIncrements;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief radioButtonLengthLine radio button for lengths od lines variables
|
|
|
|
*/
|
2013-07-28 00:18:06 +02:00
|
|
|
QRadioButton *radioButtonLengthLine;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief radioButtonLengthArc radio button for lengths of arcs variables
|
|
|
|
*/
|
2013-10-13 17:31:42 +02:00
|
|
|
QRadioButton *radioButtonLengthArc;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief radioButtonLengthCurve radio button for lengths of curves variables
|
|
|
|
*/
|
2013-10-13 17:31:42 +02:00
|
|
|
QRadioButton *radioButtonLengthCurve;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief idDetail id detail
|
|
|
|
*/
|
2013-09-10 14:29:06 +02:00
|
|
|
qint64 idDetail;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief mode mode
|
|
|
|
*/
|
2013-10-26 19:55:06 +02:00
|
|
|
Draw::Draws mode;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief CheckObject check if object belongs to detail
|
|
|
|
* @param id id of object (point, arc, spline, spline path)
|
|
|
|
* @return true - belons, false - don't
|
|
|
|
*/
|
2013-09-10 14:29:06 +02:00
|
|
|
bool CheckObject(const qint64 &id);
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief closeEvent handle when dialog cloded
|
|
|
|
* @param event event
|
|
|
|
*/
|
2013-08-15 22:39:00 +02:00
|
|
|
virtual void closeEvent ( QCloseEvent * event );
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief showEvent handle when window show
|
|
|
|
* @param event event
|
|
|
|
*/
|
2013-08-15 22:39:00 +02:00
|
|
|
virtual void showEvent( QShowEvent *event );
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief FillComboBoxPoints fill comboBox list of points
|
|
|
|
* @param box comboBox
|
|
|
|
* @param id don't show this id in list
|
|
|
|
*/
|
2013-08-13 18:48:36 +02:00
|
|
|
void FillComboBoxPoints(QComboBox *box, const qint64 &id = 0)const;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief FillComboBoxTypeLine fill comboBox list of type lines
|
|
|
|
* @param box comboBox
|
|
|
|
*/
|
2013-07-28 00:18:06 +02:00
|
|
|
void FillComboBoxTypeLine(QComboBox *box) const;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief CheckState enable, when all is correct, or disable, when something wrong, button ok
|
|
|
|
*/
|
2013-07-31 13:34:39 +02:00
|
|
|
virtual void CheckState();
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief getTypeLine return type of line
|
|
|
|
* @param box combobox
|
|
|
|
* @return type
|
|
|
|
*/
|
2013-07-28 00:18:06 +02:00
|
|
|
QString GetTypeLine(const QComboBox *box)const;
|
2013-11-19 21:56:49 +01:00
|
|
|
template <class key, class val>
|
|
|
|
/**
|
|
|
|
* @brief ShowVariable show variables in list
|
|
|
|
* @param var container with variables
|
|
|
|
*/
|
|
|
|
void ShowVariable(const QHash<key, val> *var);
|
|
|
|
/**
|
|
|
|
* @brief SetupTypeLine setupe type of line
|
|
|
|
* @param box combobox
|
|
|
|
* @param value string from pattern file
|
|
|
|
*/
|
2013-07-29 14:55:40 +02:00
|
|
|
void SetupTypeLine(QComboBox *box, const QString &value);
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief ChangeCurrentText select item in combobox by name
|
|
|
|
* @param box combobox
|
|
|
|
* @param value name of item
|
|
|
|
*/
|
2013-07-29 14:55:40 +02:00
|
|
|
void ChangeCurrentText(QComboBox *box, const QString &value);
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief ChangeCurrentData select item in combobox by id
|
|
|
|
* @param box combobox
|
|
|
|
* @param value id of item
|
|
|
|
*/
|
2013-08-13 18:48:36 +02:00
|
|
|
void ChangeCurrentData(QComboBox *box, const qint64 &value) const;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief PutValHere put variable into line edit from list
|
|
|
|
* @param lineEdit lineEdit
|
|
|
|
* @param listWidget listWidget
|
|
|
|
*/
|
2013-08-06 09:56:09 +02:00
|
|
|
void PutValHere(QLineEdit *lineEdit, QListWidget *listWidget);
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief ValFormulaChanged handle change formula
|
|
|
|
* @param flag flag state of formula
|
|
|
|
* @param edit LineEdit
|
|
|
|
* @param timer timer of formula
|
|
|
|
*/
|
2013-08-06 09:56:09 +02:00
|
|
|
void ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer * timer);
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief Eval evaluate formula and show result
|
|
|
|
* @param edit lineEdit of formula
|
|
|
|
* @param flag flag state of formula
|
|
|
|
* @param timer timer of formula
|
|
|
|
* @param label label for signal error
|
|
|
|
*/
|
2013-08-06 09:56:09 +02:00
|
|
|
void Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label);
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief setCurrentPointId set current point id in combobox
|
|
|
|
* @param box combobox
|
|
|
|
* @param pointId save current point id
|
|
|
|
* @param value point id
|
|
|
|
* @param id don't show this id in list
|
|
|
|
*/
|
2013-08-13 18:48:36 +02:00
|
|
|
void setCurrentPointId(QComboBox *box, qint64 &pointId, const qint64 &value, const qint64 &id) const;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief getCurrentPointId return current point id in combobox
|
|
|
|
* @param box combobox
|
|
|
|
* @return id or -1 if combobox is empty
|
|
|
|
*/
|
2013-08-13 18:48:36 +02:00
|
|
|
qint64 getCurrentPointId(QComboBox *box) const;
|
2013-07-28 00:18:06 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // DIALOGTOOL_H
|