2019-02-11 12:25:27 +01:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file dialogtoolbox.h
|
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
|
|
** @date 25 1, 2019
|
|
|
|
**
|
|
|
|
** @brief
|
|
|
|
** @copyright
|
|
|
|
** This source code is part of the Valentina project, a pattern making
|
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
|
|
|
** Copyright (C) 2019 Valentina project
|
2020-01-31 07:00:05 +01:00
|
|
|
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
|
2019-02-11 12:25:27 +01:00
|
|
|
**
|
|
|
|
** 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 <http://www.gnu.org/licenses/>.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
|
|
|
#ifndef DIALOGTOOLBOX_H
|
|
|
|
#define DIALOGTOOLBOX_H
|
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
#include <QtGlobal>
|
|
|
|
#include <QSharedPointer>
|
|
|
|
|
|
|
|
#include "../vpatterndb/variables/vinternalvariable.h"
|
2019-11-07 17:07:07 +01:00
|
|
|
#include "../vmisc/typedef.h"
|
2019-02-11 12:25:27 +01:00
|
|
|
|
|
|
|
class QPlainTextEdit;
|
|
|
|
class QPushButton;
|
|
|
|
class QDialog;
|
|
|
|
class QObject;
|
|
|
|
class QEvent;
|
|
|
|
class QLabel;
|
|
|
|
class QWidget;
|
|
|
|
class QColor;
|
|
|
|
class QLineEdit;
|
2019-11-24 11:49:40 +01:00
|
|
|
class VContainer;
|
2019-04-20 18:30:35 +02:00
|
|
|
class QListWidget;
|
|
|
|
class VPieceNode;
|
2019-02-11 12:25:27 +01:00
|
|
|
|
|
|
|
constexpr int formulaTimerTimeout = 300;
|
|
|
|
|
|
|
|
extern const QColor errorColor;
|
|
|
|
|
|
|
|
QT_WARNING_PUSH
|
|
|
|
QT_WARNING_DISABLE_GCC("-Weffc++")
|
|
|
|
|
|
|
|
struct FormulaData
|
|
|
|
{
|
|
|
|
QString formula;
|
|
|
|
const QHash<QString, QSharedPointer<VInternalVariable> > *variables{nullptr};
|
|
|
|
QLabel *labelEditFormula{nullptr};
|
|
|
|
QLabel *labelResult{nullptr};
|
|
|
|
QString postfix;
|
|
|
|
bool checkZero{true};
|
|
|
|
bool checkLessThanZero{false};
|
|
|
|
};
|
|
|
|
|
|
|
|
QT_WARNING_POP
|
|
|
|
|
2019-04-20 18:30:35 +02:00
|
|
|
VPieceNode RowNode(QListWidget *listWidget, int i);
|
2019-02-11 12:25:27 +01:00
|
|
|
void MoveCursorToEnd(QPlainTextEdit *plainTextEdit);
|
|
|
|
void DeployFormula(QDialog *dialog, QPlainTextEdit *formula, QPushButton *buttonGrowLength, int formulaBaseHeight);
|
|
|
|
bool FilterObject(QObject *object, QEvent *event);
|
|
|
|
qreal EvalToolFormula(QDialog *dialog, const FormulaData &data, bool &flag);
|
|
|
|
void ChangeColor(QWidget *widget, const QColor &color);
|
|
|
|
QColor OkColor(QWidget *widget);
|
|
|
|
void CheckPointLabel(QDialog *dialog, QLineEdit* edit, QLabel *labelEditNamePoint, const QString &pointName,
|
|
|
|
const VContainer *data, bool &flag);
|
2019-04-20 18:30:35 +02:00
|
|
|
int FindNotExcludedNodeDown(QListWidget *listWidget, int candidate);
|
|
|
|
int FindNotExcludedNodeUp(QListWidget *listWidget, int candidate);
|
|
|
|
bool FirstPointEqualLast(QListWidget *listWidget, const VContainer *data);
|
|
|
|
bool DoublePoints(QListWidget *listWidget, const VContainer *data);
|
|
|
|
bool DoubleCurves(QListWidget *listWidget);
|
|
|
|
bool EachPointLabelIsUnique(QListWidget *listWidget);
|
|
|
|
QString DialogWarningIcon();
|
|
|
|
QFont NodeFont(QFont font, bool nodeExcluded = false);
|
2019-11-07 17:07:07 +01:00
|
|
|
void CurrentCurveLength(vidtype curveId, VContainer *data);
|
|
|
|
|
2019-02-11 12:25:27 +01:00
|
|
|
#endif // DIALOGTOOLBOX_H
|