Refactoring.
This commit is contained in:
parent
2fd78f68a5
commit
66e01d9994
|
@ -68,7 +68,9 @@ auto main(int argc, char *argv[]) -> int
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef Q_OS_MAC // supports natively
|
#ifndef Q_OS_MAC // supports natively
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
InitHighDpiScaling(argc, argv);
|
InitHighDpiScaling(argc, argv);
|
||||||
|
#endif
|
||||||
#endif //ndef Q_OS_MAC
|
#endif //ndef Q_OS_MAC
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
|
|
|
@ -72,7 +72,9 @@ auto main(int argc, char *argv[]) -> int
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef Q_OS_MAC // supports natively
|
#ifndef Q_OS_MAC // supports natively
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
InitHighDpiScaling(argc, argv);
|
InitHighDpiScaling(argc, argv);
|
||||||
|
#endif
|
||||||
#endif //Q_OS_MAC
|
#endif //Q_OS_MAC
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
|
|
|
@ -78,7 +78,9 @@ auto main(int argc, char *argv[]) -> int
|
||||||
REGISTER_META_TYPE_STREAM_OPERATORS(CustomSARecord);
|
REGISTER_META_TYPE_STREAM_OPERATORS(CustomSARecord);
|
||||||
|
|
||||||
#ifndef Q_OS_MAC // supports natively
|
#ifndef Q_OS_MAC // supports natively
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
InitHighDpiScaling(argc, argv);
|
InitHighDpiScaling(argc, argv);
|
||||||
|
#endif
|
||||||
#endif //Q_OS_MAC
|
#endif //Q_OS_MAC
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
|
|
|
@ -39,7 +39,6 @@
|
||||||
#include "../vlayout/vlayoutgenerator.h"
|
#include "../vlayout/vlayoutgenerator.h"
|
||||||
#include "dialogs/dialoglayoutprogress.h"
|
#include "dialogs/dialoglayoutprogress.h"
|
||||||
#include "dialogs/dialogsavelayout.h"
|
#include "dialogs/dialogsavelayout.h"
|
||||||
#include "../vlayout/vposter.h"
|
|
||||||
#include "../vlayout/vlayoutexporter.h"
|
#include "../vlayout/vlayoutexporter.h"
|
||||||
#include "../vpatterndb/calculator.h"
|
#include "../vpatterndb/calculator.h"
|
||||||
#include "../vtools/tools/vabstracttool.h"
|
#include "../vtools/tools/vabstracttool.h"
|
||||||
|
@ -1263,8 +1262,7 @@ auto MainWindowsNoGUI::OpenMeasurementFile(const QString &path) const -> QShared
|
||||||
|
|
||||||
if (m->Type() == MeasurementsType::Unknown)
|
if (m->Type() == MeasurementsType::Unknown)
|
||||||
{
|
{
|
||||||
VException e(tr("Measurement file has unknown format."));
|
throw VException(tr("Measurement file has unknown format."));
|
||||||
throw e;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m->Type() == MeasurementsType::Multisize)
|
if (m->Type() == MeasurementsType::Multisize)
|
||||||
|
@ -1280,8 +1278,7 @@ auto MainWindowsNoGUI::OpenMeasurementFile(const QString &path) const -> QShared
|
||||||
|
|
||||||
if (not m->IsDefinedKnownNamesValid())
|
if (not m->IsDefinedKnownNamesValid())
|
||||||
{
|
{
|
||||||
VException e(tr("Measurement file contains invalid known measurement(s)."));
|
throw VException(tr("Measurement file contains invalid known measurement(s)."));
|
||||||
throw e;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckRequiredMeasurements(m.data());
|
CheckRequiredMeasurements(m.data());
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#include "vdxfengine.h"
|
#include "vdxfengine.h"
|
||||||
|
#include "qassert.h"
|
||||||
#include <QLineF>
|
#include <QLineF>
|
||||||
|
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
|
@ -58,46 +59,46 @@
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||||
#include "../vmisc/diagnostic.h"
|
#include "../vmisc/diagnostic.h"
|
||||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||||
#include "dxiface.h"
|
|
||||||
#include "../vlayout/vlayoutpiece.h"
|
|
||||||
#include "../vlayout/vlayoutpoint.h"
|
|
||||||
#include "../vgeometry/vgeometrydef.h"
|
#include "../vgeometry/vgeometrydef.h"
|
||||||
#include "../vgeometry/vlayoutplacelabel.h"
|
#include "../vgeometry/vlayoutplacelabel.h"
|
||||||
|
#include "../vlayout/vlayoutpiece.h"
|
||||||
|
#include "../vlayout/vlayoutpoint.h"
|
||||||
|
#include "dxiface.h"
|
||||||
|
|
||||||
static const qreal AAMATextHeight = 2.5;
|
namespace
|
||||||
|
{
|
||||||
|
static const qreal AAMATextHeight = 2.5;
|
||||||
|
|
||||||
namespace
|
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer0, (UTF8STRING("0"))) // NOLINT
|
||||||
{
|
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer1, (UTF8STRING("1"))) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer0, (UTF8STRING("0"))) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer2, (UTF8STRING("2"))) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer1, (UTF8STRING("1"))) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer3, (UTF8STRING("3"))) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer2, (UTF8STRING("2"))) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer4, (UTF8STRING("4"))) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer3, (UTF8STRING("3"))) // NOLINT
|
// Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer5, (UTF8STRING("5"))) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer4, (UTF8STRING("4"))) // NOLINT
|
// Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer6, (UTF8STRING("6"))) // NOLINT
|
||||||
//Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer5, (UTF8STRING("5"))) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer7, (UTF8STRING("7"))) // NOLINT
|
||||||
//Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer6, (UTF8STRING("6"))) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer8, (UTF8STRING("8"))) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer7, (UTF8STRING("7"))) // NOLINT
|
// Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer9, (UTF8STRING("9"))) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer8, (UTF8STRING("8"))) // NOLINT
|
// Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer10, (UTF8STRING("10"))) // NOLINT
|
||||||
//Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer9, (UTF8STRING("9"))) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer11, (UTF8STRING("11"))) // NOLINT
|
||||||
//Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer10, (UTF8STRING("10"))) // NOLINT
|
// Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer12, (UTF8STRING("12"))) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer11, (UTF8STRING("11"))) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer13, (UTF8STRING("13"))) // NOLINT
|
||||||
//Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer12, (UTF8STRING("12"))) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer14, (UTF8STRING("14"))) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer13, (UTF8STRING("13"))) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer15, (UTF8STRING("15"))) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer14, (UTF8STRING("14"))) // NOLINT
|
// Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer19, (UTF8STRING("19"))) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer15, (UTF8STRING("15"))) // NOLINT
|
// Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer26, (UTF8STRING("26"))) // NOLINT
|
||||||
//Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer19, (UTF8STRING("19"))) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer80, (UTF8STRING("80"))) // NOLINT
|
||||||
//Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer26, (UTF8STRING("26"))) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer81, (UTF8STRING("81"))) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer80, (UTF8STRING("80"))) // NOLINT
|
// Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer82, (UTF8STRING("82"))) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer81, (UTF8STRING("81"))) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer83, (UTF8STRING("83"))) // NOLINT
|
||||||
//Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer82, (UTF8STRING("82"))) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer84, (UTF8STRING("84"))) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer83, (UTF8STRING("83"))) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer85, (UTF8STRING("85"))) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer84, (UTF8STRING("84"))) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer86, (UTF8STRING("86"))) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer85, (UTF8STRING("85"))) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer87, (UTF8STRING("87"))) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer86, (UTF8STRING("86"))) // NOLINT
|
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer87, (UTF8STRING("87"))) // NOLINT
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto PieceOutline(const VLayoutPiece &detail) -> QVector<VLayoutPoint>
|
auto PieceOutline(const VLayoutPiece &detail) -> QVector<VLayoutPoint>
|
||||||
{
|
{
|
||||||
QVector<VLayoutPoint> outline;
|
QVector<VLayoutPoint> outline;
|
||||||
if (detail.IsSeamAllowance() && not detail.IsSeamAllowanceBuiltIn())
|
if (detail.IsSeamAllowance() && not detail.IsSeamAllowanceBuiltIn())
|
||||||
{
|
{
|
||||||
|
@ -108,8 +109,8 @@ auto PieceOutline(const VLayoutPiece &detail) -> QVector<VLayoutPoint>
|
||||||
outline = detail.GetMappedContourPoints();
|
outline = detail.GetMappedContourPoints();
|
||||||
}
|
}
|
||||||
return outline;
|
return outline;
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
static inline auto svgEngineFeatures() -> QPaintEngine::PaintEngineFeatures
|
static inline auto svgEngineFeatures() -> QPaintEngine::PaintEngineFeatures
|
||||||
|
@ -1166,34 +1167,37 @@ void VDxfEngine::ExportASTMNotch(const QSharedPointer<dx_ifaceBlock> &detailBloc
|
||||||
|
|
||||||
notch->angle = passmark.baseLine.angle();
|
notch->angle = passmark.baseLine.angle();
|
||||||
|
|
||||||
if (passmark.type == PassmarkLineType::OneLine || passmark.type == PassmarkLineType::TwoLines
|
switch (passmark.type)
|
||||||
|| passmark.type == PassmarkLineType::ThreeLines)
|
{
|
||||||
{ // Slit notch
|
case PassmarkLineType::OneLine:
|
||||||
|
case PassmarkLineType::TwoLines:
|
||||||
|
case PassmarkLineType::ThreeLines:
|
||||||
|
// Slit notch
|
||||||
notch->layer = *layer4;
|
notch->layer = *layer4;
|
||||||
}
|
break;
|
||||||
else if (passmark.type == PassmarkLineType::VMark || passmark.type == PassmarkLineType::VMark2)
|
case PassmarkLineType::VMark:
|
||||||
|
case PassmarkLineType::VMark2:
|
||||||
{ // V-Notch
|
{ // V-Notch
|
||||||
QLineF boundaryLine(ConstFirst(passmark.lines).p2(), ConstLast(passmark.lines).p2());
|
QLineF boundaryLine(ConstFirst(passmark.lines).p2(), ConstLast(passmark.lines).p2());
|
||||||
notch->thickness = FromPixel(boundaryLine.length(), m_varInsunits); // width
|
notch->thickness = FromPixel(boundaryLine.length(), m_varInsunits); // width
|
||||||
|
|
||||||
notch->layer = *layer4;
|
notch->layer = *layer4;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if (passmark.type == PassmarkLineType::TMark)
|
case PassmarkLineType::TMark:
|
||||||
{ // T-Notch
|
// T-Notch
|
||||||
notch->thickness = FromPixel(ConstLast(passmark.lines).length(), m_varInsunits); // width
|
notch->thickness = FromPixel(ConstLast(passmark.lines).length(), m_varInsunits); // width
|
||||||
|
|
||||||
notch->layer = *layer80;
|
notch->layer = *layer80;
|
||||||
}
|
break;
|
||||||
else if (passmark.type == PassmarkLineType::BoxMark)
|
case PassmarkLineType::BoxMark:
|
||||||
{ // Castle Notch
|
{ // Castle Notch
|
||||||
QPointF start = ConstFirst(passmark.lines).p1();
|
QPointF start = ConstFirst(passmark.lines).p1();
|
||||||
QPointF end = ConstLast(passmark.lines).p2();
|
QPointF end = ConstLast(passmark.lines).p2();
|
||||||
|
|
||||||
notch->layer = *layer81;
|
notch->layer = *layer81;
|
||||||
|
|
||||||
notch->thickness = FromPixel(QLineF(start, end).length(), m_varInsunits); // width
|
notch->thickness = FromPixel(QLineF(start, end).length(), m_varInsunits); // width
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if (passmark.type == PassmarkLineType::UMark)
|
case PassmarkLineType::UMark:
|
||||||
{ // U-Notch
|
{ // U-Notch
|
||||||
QPointF start = ConstFirst(passmark.lines).p1();
|
QPointF start = ConstFirst(passmark.lines).p1();
|
||||||
QPointF end = ConstLast(passmark.lines).p2();
|
QPointF end = ConstLast(passmark.lines).p2();
|
||||||
|
@ -1201,7 +1205,12 @@ void VDxfEngine::ExportASTMNotch(const QSharedPointer<dx_ifaceBlock> &detailBloc
|
||||||
notch->thickness = FromPixel(QLineF(start, end).length(), m_varInsunits); // width
|
notch->thickness = FromPixel(QLineF(start, end).length(), m_varInsunits); // width
|
||||||
|
|
||||||
notch->layer = *layer83;
|
notch->layer = *layer83;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
case PassmarkLineType::LAST_ONE_DO_NOT_USE:
|
||||||
|
Q_UNREACHABLE();
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
|
||||||
detailBlock->ent.push_back(notch);
|
detailBlock->ent.push_back(notch);
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,9 @@ public:
|
||||||
|
|
||||||
Q_DECL_CONSTEXPR auto GetSABefore() const -> qreal;
|
Q_DECL_CONSTEXPR auto GetSABefore() const -> qreal;
|
||||||
Q_DECL_CONSTEXPR auto GetSAAfter() const -> qreal;
|
Q_DECL_CONSTEXPR auto GetSAAfter() const -> qreal;
|
||||||
|
|
||||||
Q_DECL_CONSTEXPR auto GetAngleType() const -> PieceNodeAngle;
|
Q_DECL_CONSTEXPR auto GetAngleType() const -> PieceNodeAngle;
|
||||||
|
|
||||||
Q_DECL_CONSTEXPR auto IsManualPasskmarkLength() const -> bool;
|
Q_DECL_CONSTEXPR auto IsManualPasskmarkLength() const -> bool;
|
||||||
Q_DECL_CONSTEXPR auto GetPasskmarkLength() const -> qreal;
|
Q_DECL_CONSTEXPR auto GetPasskmarkLength() const -> qreal;
|
||||||
|
|
||||||
|
@ -73,6 +75,7 @@ public:
|
||||||
Q_DECL_RELAXED_CONSTEXPR void SetSAAfter(qreal value);
|
Q_DECL_RELAXED_CONSTEXPR void SetSAAfter(qreal value);
|
||||||
|
|
||||||
Q_DECL_RELAXED_CONSTEXPR void SetAngleType(PieceNodeAngle value);
|
Q_DECL_RELAXED_CONSTEXPR void SetAngleType(PieceNodeAngle value);
|
||||||
|
|
||||||
Q_DECL_RELAXED_CONSTEXPR void SetManualPasskmarkLength(bool value);
|
Q_DECL_RELAXED_CONSTEXPR void SetManualPasskmarkLength(bool value);
|
||||||
Q_DECL_RELAXED_CONSTEXPR void SetPasskmarkLength(qreal value);
|
Q_DECL_RELAXED_CONSTEXPR void SetPasskmarkLength(qreal value);
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,8 @@
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
|
#include "qassert.h"
|
||||||
|
#include "qtpreprocessorsupport.h"
|
||||||
#include "vabstractapplication.h"
|
#include "vabstractapplication.h"
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
||||||
# include "vdatastreamenum.h"
|
# include "vdatastreamenum.h"
|
||||||
|
@ -279,15 +281,14 @@ auto IsOptionSet(int argc, char *argv[], const char *option) -> bool
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
// See issue #624. https://bitbucket.org/dismine/valentina/issues/624
|
// See issue #624. https://bitbucket.org/dismine/valentina/issues/624
|
||||||
void InitHighDpiScaling(int argc, char *argv[])
|
void InitHighDpiScaling(int argc, char *argv[]) // NOLINT(cppcoreguidelines-avoid-c-arrays)
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
/* For more info see: http://doc.qt.io/qt-5/highdpi.html */
|
/* For more info see: http://doc.qt.io/qt-5/highdpi.html */
|
||||||
if (IsOptionSet(argc, argv, qPrintable(QLatin1String("--") + LONG_OPTION_NO_HDPI_SCALING)))
|
if (IsOptionSet(argc, argv, qPrintable(QLatin1String("--") + LONG_OPTION_NO_HDPI_SCALING)))
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
|
QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
qputenv("QT_DEVICE_PIXEL_RATIO", QByteArray("1"));
|
qputenv("QT_DEVICE_PIXEL_RATIO", QByteArray("1"));
|
||||||
#endif
|
#endif
|
||||||
|
@ -295,13 +296,15 @@ void InitHighDpiScaling(int argc, char *argv[])
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // DPI support
|
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // DPI support
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
qputenv("QT_AUTO_SCREEN_SCALE_FACTOR", QByteArray("1"));
|
qputenv("QT_AUTO_SCREEN_SCALE_FACTOR", QByteArray("1"));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
Q_UNUSED(argc);
|
||||||
|
Q_UNUSED(argv);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -357,7 +360,8 @@ auto PassmarkLineTypeToString(PassmarkLineType type) -> QString
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto StringToPassmarkLineType(const QString &value) -> PassmarkLineType
|
auto StringToPassmarkLineType(const QString &value) -> PassmarkLineType
|
||||||
{
|
{
|
||||||
const QStringList values{strOne, strTwo, strThree, *strTMark, *strVMark, *strVMark2, *strUMark, *strBoxMark};
|
const QStringList values{strOne, strTwo, strThree, *strTMark, *strVMark,
|
||||||
|
*strVMark2, *strUMark, *strBoxMark};
|
||||||
|
|
||||||
switch(values.indexOf(value))
|
switch(values.indexOf(value))
|
||||||
{
|
{
|
||||||
|
@ -414,14 +418,9 @@ auto PassmarkAngleTypeToString(PassmarkAngleType type) -> QString
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto StringToPassmarkAngleType(const QString &value) -> PassmarkAngleType
|
auto StringToPassmarkAngleType(const QString &value) -> PassmarkAngleType
|
||||||
{
|
{
|
||||||
const QStringList values = QStringList() << strStraightforward
|
const QStringList values{
|
||||||
<< strBisector
|
strStraightforward, strBisector, strIntersection, strIntersectionOnlyLeft,
|
||||||
<< strIntersection
|
strIntersectionOnlyRight, strIntersection2, strIntersection2OnlyLeft, strIntersection2OnlyRight};
|
||||||
<< strIntersectionOnlyLeft
|
|
||||||
<< strIntersectionOnlyRight
|
|
||||||
<< strIntersection2
|
|
||||||
<< strIntersection2OnlyLeft
|
|
||||||
<< strIntersection2OnlyRight;
|
|
||||||
|
|
||||||
switch(values.indexOf(value))
|
switch(values.indexOf(value))
|
||||||
{
|
{
|
||||||
|
@ -451,25 +450,19 @@ auto StringToPassmarkAngleType(const QString &value) -> PassmarkAngleType
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto StrToUnits(const QString &unit) -> Unit
|
auto StrToUnits(const QString &unit) -> Unit
|
||||||
{
|
{
|
||||||
const QStringList units = QStringList() << unitMM << unitCM << unitINCH << unitPX;
|
const QStringList units{unitMM, unitCM, unitINCH, unitPX};
|
||||||
Unit result = Unit::Cm;
|
|
||||||
switch (units.indexOf(unit))
|
switch (units.indexOf(unit))
|
||||||
{
|
{
|
||||||
case 0:// mm
|
case 0:// mm
|
||||||
result = Unit::Mm;
|
return Unit::Mm;
|
||||||
break;
|
|
||||||
case 2:// inch
|
case 2:// inch
|
||||||
result = Unit::Inch;
|
return Unit::Inch;
|
||||||
break;
|
|
||||||
case 3:// px
|
case 3:// px
|
||||||
result = Unit::Px;
|
return Unit::Px;
|
||||||
break;
|
|
||||||
case 1:// cm
|
case 1:// cm
|
||||||
default:
|
default:
|
||||||
result = Unit::Cm;
|
return Unit::Cm;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -483,26 +476,21 @@ auto StrToUnits(const QString &unit) -> Unit
|
||||||
*/
|
*/
|
||||||
auto UnitsToStr(const Unit &unit, const bool translate) -> QString
|
auto UnitsToStr(const Unit &unit, const bool translate) -> QString
|
||||||
{
|
{
|
||||||
QString result;
|
|
||||||
switch (unit)
|
switch (unit)
|
||||||
{
|
{
|
||||||
case Unit::Mm:
|
case Unit::Mm:
|
||||||
translate ? result = QObject::tr("mm") : result = unitMM;
|
return translate ? QObject::tr("mm") : unitMM;
|
||||||
break;
|
|
||||||
case Unit::Inch:
|
case Unit::Inch:
|
||||||
translate ? result = QObject::tr("inch") : result = unitINCH;
|
return translate ? QObject::tr("inch") : unitINCH;
|
||||||
break;
|
|
||||||
case Unit::Px:
|
case Unit::Px:
|
||||||
translate ? result = QObject::tr("px") : result = unitPX;
|
return translate ? QObject::tr("px") : unitPX;
|
||||||
break;
|
|
||||||
case Unit::LAST_UNIT_DO_NOT_USE:
|
case Unit::LAST_UNIT_DO_NOT_USE:
|
||||||
|
Q_UNREACHABLE();
|
||||||
break;
|
break;
|
||||||
case Unit::Cm:
|
case Unit::Cm:
|
||||||
default:
|
default:
|
||||||
translate ? result = QObject::tr("cm") : result = unitCM;
|
return translate ? QObject::tr("cm") : unitCM;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -108,13 +108,13 @@ enum class PieceNodeAngle : quint8
|
||||||
enum class PassmarkLineType : quint8
|
enum class PassmarkLineType : quint8
|
||||||
{
|
{
|
||||||
OneLine = 0, // Default
|
OneLine = 0, // Default
|
||||||
TwoLines,
|
TwoLines = 1,
|
||||||
ThreeLines,
|
ThreeLines = 2,
|
||||||
TMark,
|
TMark = 3,
|
||||||
VMark,
|
VMark = 4,
|
||||||
VMark2,
|
VMark2 = 5,
|
||||||
UMark,
|
UMark = 6,
|
||||||
BoxMark,
|
BoxMark = 7,
|
||||||
LAST_ONE_DO_NOT_USE
|
LAST_ONE_DO_NOT_USE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -409,9 +409,18 @@ const int userMaterialPlaceholdersQuantity = 20;
|
||||||
auto QPixmapFromCache(const QString &pixmapPath) -> QPixmap;
|
auto QPixmapFromCache(const QString &pixmapPath) -> QPixmap;
|
||||||
void SetItemOverrideCursor(QGraphicsItem *item, const QString & pixmapPath, int hotX = -1, int hotY = -1);
|
void SetItemOverrideCursor(QGraphicsItem *item, const QString & pixmapPath, int hotX = -1, int hotY = -1);
|
||||||
|
|
||||||
template<typename T> constexpr inline auto MmToPixel(T val) -> T { return (val / 25.4) * PrintDPI; }
|
template <typename T> constexpr inline auto MmToPixel(T val) noexcept -> T
|
||||||
template<typename T> constexpr inline auto CmToPixel(T val) -> T { return ((val * 10.0) / 25.4) * PrintDPI; }
|
{
|
||||||
template<typename T> constexpr inline auto InchToPixel(T val) -> T { return val * PrintDPI; }
|
return (val / 25.4) * PrintDPI;
|
||||||
|
}
|
||||||
|
template <typename T> constexpr inline auto CmToPixel(T val) noexcept -> T
|
||||||
|
{
|
||||||
|
return ((val * 10.0) / 25.4) * PrintDPI;
|
||||||
|
}
|
||||||
|
template <typename T> constexpr inline auto InchToPixel(T val) noexcept -> T
|
||||||
|
{
|
||||||
|
return val * PrintDPI;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
Q_DECL_RELAXED_CONSTEXPR inline auto ToPixel(double val, const Unit &unit) -> double
|
Q_DECL_RELAXED_CONSTEXPR inline auto ToPixel(double val, const Unit &unit) -> double
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
#include "vpatternlabeldata.h"
|
#include "vpatternlabeldata.h"
|
||||||
#include "floatitemdef.h"
|
|
||||||
|
|
||||||
class VPieceLabelDataPrivate;
|
class VPieceLabelDataPrivate;
|
||||||
struct VLabelTemplateLine;
|
struct VLabelTemplateLine;
|
||||||
|
@ -47,7 +46,7 @@ public:
|
||||||
VPieceLabelData();
|
VPieceLabelData();
|
||||||
VPieceLabelData(const VPieceLabelData &data);
|
VPieceLabelData(const VPieceLabelData &data);
|
||||||
|
|
||||||
virtual ~VPieceLabelData();
|
~VPieceLabelData() override;
|
||||||
|
|
||||||
auto operator=(const VPieceLabelData &data) -> VPieceLabelData &;
|
auto operator=(const VPieceLabelData &data) -> VPieceLabelData &;
|
||||||
#ifdef Q_COMPILER_RVALUE_REFS
|
#ifdef Q_COMPILER_RVALUE_REFS
|
||||||
|
|
|
@ -179,14 +179,13 @@ auto VContainer::GetGObject(quint32 id) const -> const QSharedPointer<VGObject>
|
||||||
{
|
{
|
||||||
return d->calculationObjects.value(id);
|
return d->calculationObjects.value(id);
|
||||||
}
|
}
|
||||||
else if (d->modelingObjects->contains(id))
|
|
||||||
|
if (d->modelingObjects->contains(id))
|
||||||
{
|
{
|
||||||
return d->modelingObjects->value(id);
|
return d->modelingObjects->value(id);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
throw VExceptionBadId(tr("Can't find object"), id);
|
throw VExceptionBadId(tr("Can't find object"), id);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -41,6 +41,8 @@ const qreal VPassmark::passmarkRadiusFactor = 0.45;
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
const qreal passmarkGap = MmToPixel(1.5);
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto GetSeamPassmarkSAPoint(const VPiecePassmarkData &passmarkData, const QVector<QPointF> &seamAllowance,
|
auto GetSeamPassmarkSAPoint(const VPiecePassmarkData &passmarkData, const QVector<QPointF> &seamAllowance,
|
||||||
QPointF &point) -> PassmarkStatus
|
QPointF &point) -> PassmarkStatus
|
||||||
|
@ -62,7 +64,7 @@ auto GetSeamPassmarkSAPoint(const VPiecePassmarkData &passmarkData, const QVecto
|
||||||
return PassmarkStatus::Error; // Something wrong
|
return PassmarkStatus::Error; // Something wrong
|
||||||
}
|
}
|
||||||
|
|
||||||
point = ConstFirst(ekvPoints);
|
point = ConstFirst(ekvPoints); // NOLINT(cppcoreguidelines-slicing)
|
||||||
return needRollback ? PassmarkStatus::Rollback : PassmarkStatus::Common;
|
return needRollback ? PassmarkStatus::Rollback : PassmarkStatus::Common;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +79,7 @@ auto FixNotchPoint(const QVector<QPointF> &seamAllowance, const QPointF ¬chBa
|
||||||
axis.setLength(ToPixel(50, Unit::Cm));
|
axis.setLength(ToPixel(50, Unit::Cm));
|
||||||
const QVector<QPointF> points = VAbstractCurve::CurveIntersectLine(seamAllowance, axis);
|
const QVector<QPointF> points = VAbstractCurve::CurveIntersectLine(seamAllowance, axis);
|
||||||
|
|
||||||
if (points.size() > 0)
|
if (!points.empty())
|
||||||
{
|
{
|
||||||
if (points.size() == 1)
|
if (points.size() == 1)
|
||||||
{
|
{
|
||||||
|
@ -125,12 +127,11 @@ auto FixNotchPoint(const QVector<QPointF> &seamAllowance, const QPointF ¬chBa
|
||||||
|
|
||||||
return fixed;
|
return fixed;
|
||||||
}
|
}
|
||||||
const qreal passmarkGap = MmToPixel(1.5);
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto CreateOnePassmarkLines(const QLineF &line) -> QVector<QLineF>
|
auto CreateOnePassmarkLines(const QLineF &line) -> QVector<QLineF>
|
||||||
{
|
{
|
||||||
return QVector<QLineF>({line});
|
return {line};
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -284,6 +285,7 @@ auto PointsToSegments(const QVector<QPointF> &points) -> QVector<QLineF>
|
||||||
QVector<QLineF> lines;
|
QVector<QLineF> lines;
|
||||||
if (points.size() >= 2)
|
if (points.size() >= 2)
|
||||||
{
|
{
|
||||||
|
lines.reserve(points.size() - 1);
|
||||||
for (int i=0; i < points.size()-1; ++i)
|
for (int i=0; i < points.size()-1; ++i)
|
||||||
{
|
{
|
||||||
QLineF segment = QLineF(points.at(i), points.at(i+1));
|
QLineF segment = QLineF(points.at(i), points.at(i+1));
|
||||||
|
@ -414,7 +416,7 @@ auto CreatePassmarkLines(PassmarkLineType lineType, PassmarkAngleType angleType,
|
||||||
{
|
{
|
||||||
if (lines.isEmpty())
|
if (lines.isEmpty())
|
||||||
{
|
{
|
||||||
return QVector<QLineF>();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<QLineF> passmarksLines;
|
QVector<QLineF> passmarksLines;
|
||||||
|
@ -590,7 +592,7 @@ auto PassmarkBisectorBaseLine(PassmarkStatus seamPassmarkType, const VPiecePassm
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // Should never happen
|
{ // Should never happen
|
||||||
return QVector<QLineF>();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
|
@ -598,13 +600,13 @@ auto PassmarkBisectorBaseLine(PassmarkStatus seamPassmarkType, const VPiecePassm
|
||||||
ok);
|
ok);
|
||||||
if (not ok)
|
if (not ok)
|
||||||
{
|
{
|
||||||
return QVector<QLineF>();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
edge1.setAngle(edge1.angle() + edge1.angleTo(edge2)/2.);
|
edge1.setAngle(edge1.angle() + edge1.angleTo(edge2)/2.);
|
||||||
edge1.setLength(length);
|
edge1.setLength(length);
|
||||||
|
|
||||||
return QVector<QLineF>({edge1});
|
return {edge1};
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -623,7 +625,7 @@ auto PassmarkToPath(const QVector<QLineF> &passmark) -> QPainterPath
|
||||||
}
|
}
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
}
|
} // namespace
|
||||||
|
|
||||||
//------------------------------VPiecePassmarkData---------------------------------------------------------------------
|
//------------------------------VPiecePassmarkData---------------------------------------------------------------------
|
||||||
auto VPiecePassmarkData::toJson() const -> QJsonObject
|
auto VPiecePassmarkData::toJson() const -> QJsonObject
|
||||||
|
@ -648,10 +650,6 @@ auto VPiecePassmarkData::toJson() const -> QJsonObject
|
||||||
return dataObject;
|
return dataObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
VPassmark::VPassmark()
|
|
||||||
{}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPassmark::VPassmark(const VPiecePassmarkData &data)
|
VPassmark::VPassmark(const VPiecePassmarkData &data)
|
||||||
: m_data(data),
|
: m_data(data),
|
||||||
|
@ -766,7 +764,7 @@ auto VPassmark::FindIntersection(const QLineF &line, const QVector<QPointF> &sea
|
||||||
QVector<QPointF> intersections = VAbstractCurve::CurveIntersectLine(seamAllowance, testLine);
|
QVector<QPointF> intersections = VAbstractCurve::CurveIntersectLine(seamAllowance, testLine);
|
||||||
if (not intersections.isEmpty())
|
if (not intersections.isEmpty())
|
||||||
{
|
{
|
||||||
return QLineF(line.p1(), ConstLast(intersections));
|
return {line.p1(), ConstLast(intersections)};
|
||||||
}
|
}
|
||||||
|
|
||||||
return line;
|
return line;
|
||||||
|
@ -777,13 +775,13 @@ auto VPassmark::BuiltInSAPassmark(const VPiece &piece, const VContainer *data) c
|
||||||
{
|
{
|
||||||
if (m_null)
|
if (m_null)
|
||||||
{
|
{
|
||||||
return QVector<QLineF>();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
const QVector<QLineF> lines = BuiltInSAPassmarkBaseLine(piece);
|
const QVector<QLineF> lines = BuiltInSAPassmarkBaseLine(piece);
|
||||||
if (lines.isEmpty())
|
if (lines.isEmpty())
|
||||||
{
|
{
|
||||||
return QVector<QLineF>();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<QPointF> points;
|
QVector<QPointF> points;
|
||||||
|
@ -796,7 +794,7 @@ auto VPassmark::BuiltInSAPassmarkBaseLine(const VPiece &piece) const -> QVector<
|
||||||
{
|
{
|
||||||
if (m_null)
|
if (m_null)
|
||||||
{
|
{
|
||||||
return QVector<QLineF>();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal length = 0;
|
qreal length = 0;
|
||||||
|
@ -970,13 +968,15 @@ auto VPassmark::SAPassmarkBaseLine(const QVector<QPointF> &seamAllowance, const
|
||||||
line.setLength(length);
|
line.setLength(length);
|
||||||
return {line};
|
return {line};
|
||||||
}
|
}
|
||||||
else if (m_data.passmarkAngleType == PassmarkAngleType::Bisector)
|
|
||||||
|
if (m_data.passmarkAngleType == PassmarkAngleType::Bisector)
|
||||||
{
|
{
|
||||||
return PassmarkBisectorBaseLine(seamPassmarkType, m_data, seamPassmarkSAPoint, path);
|
return PassmarkBisectorBaseLine(seamPassmarkType, m_data, seamPassmarkSAPoint, path);
|
||||||
}
|
}
|
||||||
else if (m_data.passmarkAngleType == PassmarkAngleType::Intersection
|
|
||||||
|| m_data.passmarkAngleType == PassmarkAngleType::IntersectionOnlyLeft
|
if (m_data.passmarkAngleType == PassmarkAngleType::Intersection ||
|
||||||
|| m_data.passmarkAngleType == PassmarkAngleType::IntersectionOnlyRight)
|
m_data.passmarkAngleType == PassmarkAngleType::IntersectionOnlyLeft ||
|
||||||
|
m_data.passmarkAngleType == PassmarkAngleType::IntersectionOnlyRight)
|
||||||
{
|
{
|
||||||
QVector<QLineF> lines;
|
QVector<QLineF> lines;
|
||||||
if ((m_data.passmarkAngleType == PassmarkAngleType::Intersection
|
if ((m_data.passmarkAngleType == PassmarkAngleType::Intersection
|
||||||
|
@ -999,9 +999,10 @@ auto VPassmark::SAPassmarkBaseLine(const QVector<QPointF> &seamAllowance, const
|
||||||
|
|
||||||
return lines;
|
return lines;
|
||||||
}
|
}
|
||||||
else if (m_data.passmarkAngleType == PassmarkAngleType::Intersection2
|
|
||||||
|| m_data.passmarkAngleType == PassmarkAngleType::Intersection2OnlyLeft
|
if (m_data.passmarkAngleType == PassmarkAngleType::Intersection2 ||
|
||||||
|| m_data.passmarkAngleType == PassmarkAngleType::Intersection2OnlyRight)
|
m_data.passmarkAngleType == PassmarkAngleType::Intersection2OnlyLeft ||
|
||||||
|
m_data.passmarkAngleType == PassmarkAngleType::Intersection2OnlyRight)
|
||||||
{
|
{
|
||||||
QVector<QLineF> lines;
|
QVector<QLineF> lines;
|
||||||
if ((m_data.passmarkAngleType == PassmarkAngleType::Intersection2
|
if ((m_data.passmarkAngleType == PassmarkAngleType::Intersection2
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
#include <QMetaType>
|
#include <QMetaType>
|
||||||
|
|
||||||
#include "vpiece.h"
|
#include "vpiece.h"
|
||||||
#include "../vgeometry/vgeometrydef.h"
|
|
||||||
#include "../vmisc/typedef.h"
|
#include "../vmisc/typedef.h"
|
||||||
|
|
||||||
class QPainterPath;
|
class QPainterPath;
|
||||||
|
@ -49,24 +48,26 @@ QT_WARNING_DISABLE_GCC("-Weffc++")
|
||||||
|
|
||||||
struct VPiecePassmarkData
|
struct VPiecePassmarkData
|
||||||
{
|
{
|
||||||
VSAPoint previousSAPoint{};
|
VSAPoint previousSAPoint{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
VSAPoint passmarkSAPoint{};
|
VSAPoint passmarkSAPoint{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
VSAPoint nextSAPoint{};
|
VSAPoint nextSAPoint{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
qreal saWidth{0};
|
qreal saWidth{0}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
QString nodeName{};
|
QString nodeName{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
QString pieceName{};
|
QString pieceName{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
PassmarkLineType passmarkLineType{PassmarkLineType::OneLine};
|
PassmarkLineType passmarkLineType{// NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
PassmarkAngleType passmarkAngleType{PassmarkAngleType::Straightforward};
|
PassmarkLineType::OneLine};
|
||||||
bool isMainPathNode{true};
|
PassmarkAngleType passmarkAngleType{// NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
bool isShowSecondPassmark{true};
|
PassmarkAngleType::Straightforward};
|
||||||
vsizetype passmarkIndex{-1};
|
bool isMainPathNode{true}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
vidtype id{NULL_ID};
|
bool isShowSecondPassmark{true}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
qreal globalPassmarkLength{0};
|
vsizetype passmarkIndex{-1}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
vidtype id{NULL_ID}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
qreal globalPassmarkLength{0}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
|
||||||
auto toJson() const -> QJsonObject;
|
auto toJson() const -> QJsonObject;
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(VPiecePassmarkData)
|
Q_DECLARE_METATYPE(VPiecePassmarkData) // NOLINT
|
||||||
Q_DECLARE_TYPEINFO(VPiecePassmarkData, Q_MOVABLE_TYPE); // NOLINT
|
Q_DECLARE_TYPEINFO(VPiecePassmarkData, Q_MOVABLE_TYPE); // NOLINT
|
||||||
|
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
|
@ -76,7 +77,7 @@ enum class PassmarkSide : qint8 { All=0, Left=1, Right=2 };
|
||||||
class VPassmark
|
class VPassmark
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VPassmark();
|
VPassmark() = default;
|
||||||
explicit VPassmark(const VPiecePassmarkData &data);
|
explicit VPassmark(const VPiecePassmarkData &data);
|
||||||
|
|
||||||
auto FullPassmark(const VPiece &piece, const VContainer *data) const -> QVector<QLineF>;
|
auto FullPassmark(const VPiece &piece, const VContainer *data) const -> QVector<QLineF>;
|
||||||
|
|
|
@ -888,7 +888,7 @@ auto VPiece::GetNodeSAPoints(const QVector<VPieceNode> &path, vsizetype index, c
|
||||||
|
|
||||||
if (index < 0 || index >= path.size())
|
if (index < 0 || index >= path.size())
|
||||||
{
|
{
|
||||||
return QVector<VSAPoint>();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
const VPieceNode &node = path.at(index);
|
const VPieceNode &node = path.at(index);
|
||||||
|
@ -1053,7 +1053,7 @@ auto VPiece::CreatePassmark(const QVector<VPieceNode> &path, vsizetype previousI
|
||||||
|
|
||||||
if (not IsPassmarkVisible(path, passmarkIndex))
|
if (not IsPassmarkVisible(path, passmarkIndex))
|
||||||
{
|
{
|
||||||
return VPassmark();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
VSAPoint passmarkSAPoint;
|
VSAPoint passmarkSAPoint;
|
||||||
|
@ -1063,26 +1063,26 @@ auto VPiece::CreatePassmark(const QVector<VPieceNode> &path, vsizetype previousI
|
||||||
.arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName());
|
.arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName());
|
||||||
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
return VPassmark();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
VSAPoint previousSAPoint;
|
VSAPoint previousSAPoint;
|
||||||
if (not GetPassmarkPreviousSAPoints(path, previousIndex, passmarkSAPoint, data, previousSAPoint, passmarkIndex))
|
if (not GetPassmarkPreviousSAPoints(path, previousIndex, passmarkSAPoint, data, previousSAPoint, passmarkIndex))
|
||||||
{
|
{
|
||||||
// No check here because it will cover valid cases
|
// No check here because it will cover valid cases
|
||||||
return VPassmark(); // Something wrong
|
return {}; // Something wrong
|
||||||
}
|
}
|
||||||
|
|
||||||
VSAPoint nextSAPoint;
|
VSAPoint nextSAPoint;
|
||||||
if (not GetPassmarkNextSAPoints(path, nextIndex, passmarkSAPoint, data, nextSAPoint, passmarkIndex))
|
if (not GetPassmarkNextSAPoints(path, nextIndex, passmarkSAPoint, data, nextSAPoint, passmarkIndex))
|
||||||
{
|
{
|
||||||
// No check here because it will cover valid cases
|
// No check here because it will cover valid cases
|
||||||
return VPassmark(); // Something wrong
|
return {}; // Something wrong
|
||||||
}
|
}
|
||||||
|
|
||||||
if (passmarkSAPoint.IsManualPasskmarkLength() && passmarkSAPoint.GetPasskmarkLength() <= 0)
|
if (passmarkSAPoint.IsManualPasskmarkLength() && passmarkSAPoint.GetPasskmarkLength() <= 0)
|
||||||
{
|
{
|
||||||
return VPassmark();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (passmarkSAPoint.IsManualPasskmarkLength()
|
if (passmarkSAPoint.IsManualPasskmarkLength()
|
||||||
|
@ -1096,7 +1096,7 @@ auto VPiece::CreatePassmark(const QVector<VPieceNode> &path, vsizetype previousI
|
||||||
#else
|
#else
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + infoMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + infoMsg;
|
||||||
#endif
|
#endif
|
||||||
return VPassmark();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
QT_WARNING_PUSH
|
QT_WARNING_PUSH
|
||||||
|
@ -1171,13 +1171,14 @@ auto VPiece::Area(const QVector<QPointF> &shape, const VContainer *data) const -
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VPiece::GlobalPassmarkLength(const VContainer *data) const -> qreal
|
auto VPiece::GlobalPassmarkLength(const VContainer *data) const -> qreal
|
||||||
{
|
{
|
||||||
qreal length = 0;
|
|
||||||
QString passmarkLengthVariable = VAbstractValApplication::VApp()->getCurrentDocument()->GetPassmarkLengthVariable();
|
QString passmarkLengthVariable = VAbstractValApplication::VApp()->getCurrentDocument()->GetPassmarkLengthVariable();
|
||||||
if (passmarkLengthVariable.isEmpty())
|
if (passmarkLengthVariable.isEmpty())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qreal length = 0;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
QSharedPointer<VInternalVariable> var = data->GetVariable<VInternalVariable>(passmarkLengthVariable);
|
QSharedPointer<VInternalVariable> var = data->GetVariable<VInternalVariable>(passmarkLengthVariable);
|
||||||
|
|
|
@ -71,43 +71,45 @@ public:
|
||||||
friend auto operator>>(QDataStream &in, VPieceNodeData &p) -> QDataStream &;
|
friend auto operator>>(QDataStream &in, VPieceNodeData &p) -> QDataStream &;
|
||||||
|
|
||||||
/** @brief id object id. */
|
/** @brief id object id. */
|
||||||
quint32 m_id{NULL_ID};
|
quint32 m_id{NULL_ID}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
|
||||||
/** @brief typeTool type of tool */
|
/** @brief typeTool type of tool */
|
||||||
Tool m_typeTool{Tool::NodePoint};
|
Tool m_typeTool{Tool::NodePoint}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
|
||||||
/** @brief reverse true if need reverse points list for node. */
|
/** @brief reverse true if need reverse points list for node. */
|
||||||
bool m_reverse{false};
|
bool m_reverse{false}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
|
||||||
/** @brief m_excluded true if item excluded from main path. Excluded item is not visible and also will not has
|
/** @brief m_excluded true if item excluded from main path. Excluded item is not visible and also will not has
|
||||||
* affect on main path. Also include to exist path items automatically setted excluded. */
|
* affect on main path. Also include to exist path items automatically setted excluded. */
|
||||||
bool m_excluded{false};
|
bool m_excluded{false}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
|
||||||
/** @brief m_isPassmark has sense only for points. If true to seam allowance should be added a passmark. */
|
/** @brief m_isPassmark has sense only for points. If true to seam allowance should be added a passmark. */
|
||||||
bool m_isPassmark{false};
|
bool m_isPassmark{false}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
|
||||||
/** @brief m_isMainPathNode need fin know if allowed for this passmakr to be double. */
|
/** @brief m_isMainPathNode need fin know if allowed for this passmakr to be double. */
|
||||||
bool m_isMainPathNode{true};
|
bool m_isMainPathNode{true}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
|
||||||
QString m_formulaWidthBefore{currentSeamAllowance};
|
QString m_formulaWidthBefore{currentSeamAllowance}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
QString m_formulaWidthAfter{currentSeamAllowance};
|
QString m_formulaWidthAfter{currentSeamAllowance}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
QString m_formulaPassmarkLength{};
|
QString m_formulaPassmarkLength{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
|
||||||
PieceNodeAngle m_angleType{PieceNodeAngle::ByLength};
|
PieceNodeAngle m_angleType{PieceNodeAngle::ByLength}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
|
||||||
PassmarkLineType m_passmarkLineType{PassmarkLineType::OneLine};
|
PassmarkLineType m_passmarkLineType{// NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
PassmarkAngleType m_passmarkAngleType{PassmarkAngleType::Straightforward};
|
PassmarkLineType::OneLine};
|
||||||
|
PassmarkAngleType m_passmarkAngleType{// NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
PassmarkAngleType::Straightforward};
|
||||||
|
|
||||||
bool m_isShowSecondPassmark{true};
|
bool m_isShowSecondPassmark{true}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
|
||||||
/** @brief m_checkUniqueness need in cases where different points have the same coordinates, become one point.
|
/** @brief m_checkUniqueness need in cases where different points have the same coordinates, become one point.
|
||||||
* By default the check enabled. Disable it only if in a path cannot be used just one point. For example if
|
* By default the check enabled. Disable it only if in a path cannot be used just one point. For example if
|
||||||
* gradation change a piece shape and the seond point should be remaind.*/
|
* gradation change a piece shape and the seond point should be remaind.*/
|
||||||
bool m_checkUniqueness{true};
|
bool m_checkUniqueness{true}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
|
||||||
bool m_manualPassmarkLength{false};
|
bool m_manualPassmarkLength{false}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
|
||||||
bool m_turnPoint{true};
|
bool m_turnPoint{true}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_ASSIGN_MOVE(VPieceNodeData) // NOLINT
|
Q_DISABLE_ASSIGN_MOVE(VPieceNodeData) // NOLINT
|
||||||
|
@ -124,35 +126,20 @@ constexpr quint16 VPieceNodeData::classVersion; // NOLINT(readability-redundant
|
||||||
|
|
||||||
// Friend functions
|
// Friend functions
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto operator<<(QDataStream &out, const VPieceNodeData &p) -> QDataStream &
|
inline auto operator<<(QDataStream &out, const VPieceNodeData &p) -> QDataStream &
|
||||||
{
|
{
|
||||||
out << VPieceNodeData::streamHeader << VPieceNodeData::classVersion;
|
out << VPieceNodeData::streamHeader << VPieceNodeData::classVersion;
|
||||||
|
|
||||||
// Added in classVersion = 1
|
out << p.m_id << p.m_typeTool << p.m_reverse << p.m_excluded << p.m_isPassmark << p.m_formulaWidthBefore
|
||||||
out << p.m_id
|
<< p.m_formulaWidthAfter << p.m_formulaPassmarkLength << p.m_angleType << p.m_passmarkLineType
|
||||||
<< p.m_typeTool
|
<< p.m_passmarkAngleType << p.m_isShowSecondPassmark << p.m_checkUniqueness << p.m_manualPassmarkLength
|
||||||
<< p.m_reverse
|
<< p.m_turnPoint;
|
||||||
<< p.m_excluded
|
|
||||||
<< p.m_isPassmark
|
|
||||||
<< p.m_formulaWidthBefore
|
|
||||||
<< p.m_formulaWidthAfter
|
|
||||||
<< p.m_formulaPassmarkLength
|
|
||||||
<< p.m_angleType
|
|
||||||
<< p.m_passmarkLineType
|
|
||||||
<< p.m_passmarkAngleType
|
|
||||||
<< p.m_isShowSecondPassmark
|
|
||||||
<< p.m_checkUniqueness
|
|
||||||
<< p.m_manualPassmarkLength;
|
|
||||||
|
|
||||||
// Added in classVersion = 2
|
|
||||||
|
|
||||||
out << p.m_turnPoint;
|
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto operator>>(QDataStream &in, VPieceNodeData &p) -> QDataStream &
|
inline auto operator>>(QDataStream &in, VPieceNodeData &p) -> QDataStream &
|
||||||
{
|
{
|
||||||
quint32 actualStreamHeader = 0;
|
quint32 actualStreamHeader = 0;
|
||||||
in >> actualStreamHeader;
|
in >> actualStreamHeader;
|
||||||
|
|
|
@ -54,29 +54,17 @@ auto CuttingPath(quint32 id, const VContainer *data) -> QVector<QPointF>
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
}
|
} // namespace
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogPiecePath::DialogPiecePath(const VContainer *data, quint32 toolId, QWidget *parent)
|
DialogPiecePath::DialogPiecePath(const VContainer *data, quint32 toolId, QWidget *parent)
|
||||||
: DialogTool(data, toolId, parent),
|
: DialogTool(data, toolId, parent),
|
||||||
ui(new Ui::DialogPiecePath),
|
ui(new Ui::DialogPiecePath),
|
||||||
m_showMode(false),
|
|
||||||
m_saWidth(0),
|
|
||||||
m_timerWidth(new QTimer(this)),
|
m_timerWidth(new QTimer(this)),
|
||||||
m_timerWidthBefore(new QTimer(this)),
|
m_timerWidthBefore(new QTimer(this)),
|
||||||
m_timerWidthAfter(new QTimer(this)),
|
m_timerWidthAfter(new QTimer(this)),
|
||||||
m_timerVisible(new QTimer(this)),
|
m_timerVisible(new QTimer(this)),
|
||||||
m_timerPassmarkLength(new QTimer(this)),
|
m_timerPassmarkLength(new QTimer(this))
|
||||||
m_formulaBaseWidth(0),
|
|
||||||
m_formulaBaseWidthBefore(0),
|
|
||||||
m_formulaBaseWidthAfter(0),
|
|
||||||
m_formulaBaseVisible(0),
|
|
||||||
m_flagFormulaBefore(true),
|
|
||||||
m_flagFormulaAfter(true),
|
|
||||||
m_flagFormulaVisible(true),
|
|
||||||
m_flagName(true),//We have default name of piece.
|
|
||||||
m_flagError(false),
|
|
||||||
m_flagFormula(false)
|
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
InitOkCancel(ui);
|
InitOkCancel(ui);
|
||||||
|
@ -200,7 +188,7 @@ void DialogPiecePath::ChosenObject(quint32 id, const SceneObject &type)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPiecePath::ShowDialog(bool click)
|
void DialogPiecePath::ShowDialog(bool click)
|
||||||
{
|
{
|
||||||
if (click == false)
|
if (not click)
|
||||||
{
|
{
|
||||||
if (CreatePath().CountNodes() > 0)
|
if (CreatePath().CountNodes() > 0)
|
||||||
{
|
{
|
||||||
|
@ -252,7 +240,7 @@ void DialogPiecePath::CheckState()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const QIcon icon = QIcon::fromTheme("dialog-warning",
|
const QIcon icon = QIcon::fromTheme(QStringLiteral("dialog-warning"),
|
||||||
QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"));
|
QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"));
|
||||||
ui->tabWidget->setTabIcon(tabSeamAllowanceIndex, icon);
|
ui->tabWidget->setTabIcon(tabSeamAllowanceIndex, icon);
|
||||||
}
|
}
|
||||||
|
@ -266,7 +254,7 @@ void DialogPiecePath::CheckState()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const QIcon icon = QIcon::fromTheme("dialog-warning",
|
const QIcon icon = QIcon::fromTheme(QStringLiteral("dialog-warning"),
|
||||||
QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"));
|
QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"));
|
||||||
ui->tabWidget->setTabIcon(tabControlIndex, icon);
|
ui->tabWidget->setTabIcon(tabControlIndex, icon);
|
||||||
}
|
}
|
||||||
|
@ -283,7 +271,7 @@ void DialogPiecePath::CheckState()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const QIcon icon = QIcon::fromTheme("dialog-warning",
|
const QIcon icon = QIcon::fromTheme(QStringLiteral("dialog-warning"),
|
||||||
QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"));
|
QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"));
|
||||||
ui->tabWidget->setTabIcon(tabPassmarksIndex, icon);
|
ui->tabWidget->setTabIcon(tabPassmarksIndex, icon);
|
||||||
}
|
}
|
||||||
|
@ -298,7 +286,7 @@ void DialogPiecePath::ShowVisualization()
|
||||||
|
|
||||||
if (m_showMode)
|
if (m_showMode)
|
||||||
{
|
{
|
||||||
VToolSeamAllowance *tool = qobject_cast<VToolSeamAllowance*>(VAbstractPattern::getTool(GetPieceId()));
|
auto *tool = qobject_cast<VToolSeamAllowance *>(VAbstractPattern::getTool(GetPieceId()));
|
||||||
SCASSERT(tool != nullptr);
|
SCASSERT(tool != nullptr);
|
||||||
auto *visPath = qobject_cast<VisToolPiecePath *>(vis);
|
auto *visPath = qobject_cast<VisToolPiecePath *>(vis);
|
||||||
SCASSERT(visPath != nullptr);
|
SCASSERT(visPath != nullptr);
|
||||||
|
@ -366,7 +354,7 @@ void DialogPiecePath::ShowContextMenu(const QPoint &pos)
|
||||||
actionExcluded->setCheckable(true);
|
actionExcluded->setCheckable(true);
|
||||||
actionExcluded->setChecked(rowNode.IsExcluded());
|
actionExcluded->setChecked(rowNode.IsExcluded());
|
||||||
|
|
||||||
QAction *actionDelete = menu->addAction(QIcon::fromTheme("edit-delete"), tr("Delete"));
|
QAction *actionDelete = menu->addAction(QIcon::fromTheme(QStringLiteral("edit-delete")), tr("Delete"));
|
||||||
|
|
||||||
QAction *selectedAction = menu->exec(ui->listWidget->viewport()->mapToGlobal(pos));
|
QAction *selectedAction = menu->exec(ui->listWidget->viewport()->mapToGlobal(pos));
|
||||||
if (selectedAction == actionDelete)
|
if (selectedAction == actionDelete)
|
||||||
|
@ -664,7 +652,7 @@ void DialogPiecePath::ReturnDefBefore()
|
||||||
const QString def = VAbstractApplication::VApp()->TrVars()
|
const QString def = VAbstractApplication::VApp()->TrVars()
|
||||||
->FormulaToUser(currentSeamAllowance, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
->FormulaToUser(currentSeamAllowance, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
ui->plainTextEditFormulaWidthBefore->setPlainText(def);
|
ui->plainTextEditFormulaWidthBefore->setPlainText(def);
|
||||||
if (QPushButton* button = qobject_cast<QPushButton*>(sender()))
|
if (auto *button = qobject_cast<QPushButton *>(sender()))
|
||||||
{
|
{
|
||||||
button->setEnabled(false);
|
button->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
@ -676,7 +664,7 @@ void DialogPiecePath::ReturnDefAfter()
|
||||||
const QString def = VAbstractApplication::VApp()->TrVars()
|
const QString def = VAbstractApplication::VApp()->TrVars()
|
||||||
->FormulaToUser(currentSeamAllowance, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
->FormulaToUser(currentSeamAllowance, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
ui->plainTextEditFormulaWidthAfter->setPlainText(def);
|
ui->plainTextEditFormulaWidthAfter->setPlainText(def);
|
||||||
if (QPushButton* button = qobject_cast<QPushButton*>(sender()))
|
if (auto *button = qobject_cast<QPushButton *>(sender()))
|
||||||
{
|
{
|
||||||
button->setEnabled(false);
|
button->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
@ -691,7 +679,7 @@ void DialogPiecePath::PassmarkLineTypeChanged(int id)
|
||||||
QListWidgetItem *rowItem = GetItemById(ui->comboBoxPassmarks->currentData().toUInt());
|
QListWidgetItem *rowItem = GetItemById(ui->comboBoxPassmarks->currentData().toUInt());
|
||||||
if (rowItem)
|
if (rowItem)
|
||||||
{
|
{
|
||||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||||
|
|
||||||
PassmarkLineType lineType = PassmarkLineType::OneLine;
|
PassmarkLineType lineType = PassmarkLineType::OneLine;
|
||||||
if (id == ui->buttonGroupMarkType->id(ui->radioButtonOneLine))
|
if (id == ui->buttonGroupMarkType->id(ui->radioButtonOneLine))
|
||||||
|
@ -745,7 +733,7 @@ void DialogPiecePath::PassmarkAngleTypeChanged(int id)
|
||||||
QListWidgetItem *rowItem = GetItemById(ui->comboBoxPassmarks->currentData().toUInt());
|
QListWidgetItem *rowItem = GetItemById(ui->comboBoxPassmarks->currentData().toUInt());
|
||||||
if (rowItem)
|
if (rowItem)
|
||||||
{
|
{
|
||||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||||
|
|
||||||
PassmarkAngleType angleType = PassmarkAngleType::Straightforward;
|
PassmarkAngleType angleType = PassmarkAngleType::Straightforward;
|
||||||
if (id == ui->buttonGroupAngleType->id(ui->radioButtonStraightforward))
|
if (id == ui->buttonGroupAngleType->id(ui->radioButtonStraightforward))
|
||||||
|
@ -799,7 +787,7 @@ void DialogPiecePath::PassmarkShowSecondChanged(int state)
|
||||||
QListWidgetItem *rowItem = GetItemById(ui->comboBoxPassmarks->currentData().toUInt());
|
QListWidgetItem *rowItem = GetItemById(ui->comboBoxPassmarks->currentData().toUInt());
|
||||||
if (rowItem)
|
if (rowItem)
|
||||||
{
|
{
|
||||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||||
rowNode.SetShowSecondPassmark(state);
|
rowNode.SetShowSecondPassmark(state);
|
||||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||||
|
|
||||||
|
@ -824,7 +812,7 @@ void DialogPiecePath::EvalWidth()
|
||||||
|
|
||||||
if (m_saWidth >= 0)
|
if (m_saWidth >= 0)
|
||||||
{
|
{
|
||||||
VContainer *locData = const_cast<VContainer *> (data);
|
auto *locData = const_cast<VContainer *>(data);
|
||||||
|
|
||||||
auto *currentSA = new VIncrement(locData, currentSeamAllowance);
|
auto *currentSA = new VIncrement(locData, currentSeamAllowance);
|
||||||
currentSA->SetFormula(m_saWidth, QString().setNum(m_saWidth), true);
|
currentSA->SetFormula(m_saWidth, QString().setNum(m_saWidth), true);
|
||||||
|
@ -1258,7 +1246,7 @@ void DialogPiecePath::InitNodesList()
|
||||||
|
|
||||||
for (int i = 0; i < path.CountNodes(); ++i)
|
for (int i = 0; i < path.CountNodes(); ++i)
|
||||||
{
|
{
|
||||||
const VPieceNode node = path.at(i);
|
const VPieceNode &node = path.at(i);
|
||||||
if (node.GetTypeTool() == Tool::NodePoint)
|
if (node.GetTypeTool() == Tool::NodePoint)
|
||||||
{
|
{
|
||||||
const QString name = GetNodeName(data, node);
|
const QString name = GetNodeName(data, node);
|
||||||
|
@ -1323,7 +1311,7 @@ void DialogPiecePath::NodeAngleChanged(int index)
|
||||||
if (rowItem)
|
if (rowItem)
|
||||||
{
|
{
|
||||||
const PieceNodeAngle angle = static_cast<PieceNodeAngle>(ui->comboBoxAngle->currentData().toUInt());
|
const PieceNodeAngle angle = static_cast<PieceNodeAngle>(ui->comboBoxAngle->currentData().toUInt());
|
||||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||||
rowNode.SetAngleType(angle);
|
rowNode.SetAngleType(angle);
|
||||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||||
|
|
||||||
|
@ -1351,7 +1339,7 @@ void DialogPiecePath::SetPiecePath(const VPiecePath &path)
|
||||||
|
|
||||||
ui->lineEditName->setText(path.GetName());
|
ui->lineEditName->setText(path.GetName());
|
||||||
|
|
||||||
VisToolPiecePath *visPath = qobject_cast<VisToolPiecePath *>(vis);
|
auto *visPath = qobject_cast<VisToolPiecePath *>(vis);
|
||||||
SCASSERT(visPath != nullptr);
|
SCASSERT(visPath != nullptr);
|
||||||
visPath->SetPath(path);
|
visPath->SetPath(path);
|
||||||
visPath->SetCuttingPath(CuttingPath(toolId, data));
|
visPath->SetCuttingPath(CuttingPath(toolId, data));
|
||||||
|
@ -1427,7 +1415,7 @@ auto DialogPiecePath::GetItemById(quint32 id) -> QListWidgetItem *
|
||||||
for (qint32 i = ui->listWidget->count()-1; i >= 0; --i)
|
for (qint32 i = ui->listWidget->count()-1; i >= 0; --i)
|
||||||
{
|
{
|
||||||
QListWidgetItem *item = ui->listWidget->item(i);
|
QListWidgetItem *item = ui->listWidget->item(i);
|
||||||
const VPieceNode node = qvariant_cast<VPieceNode>(item->data(Qt::UserRole));
|
const auto node = qvariant_cast<VPieceNode>(item->data(Qt::UserRole));
|
||||||
|
|
||||||
if (node.GetId() == id)
|
if (node.GetId() == id)
|
||||||
{
|
{
|
||||||
|
@ -1444,7 +1432,7 @@ auto DialogPiecePath::GetLastId() const -> quint32
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
{
|
{
|
||||||
QListWidgetItem *item = ui->listWidget->item(count-1);
|
QListWidgetItem *item = ui->listWidget->item(count-1);
|
||||||
const VPieceNode node = qvariant_cast<VPieceNode>(item->data(Qt::UserRole));
|
const auto node = qvariant_cast<VPieceNode>(item->data(Qt::UserRole));
|
||||||
return node.GetId();
|
return node.GetId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1474,7 +1462,7 @@ void DialogPiecePath::UpdateNodeSABefore(const QString &formula)
|
||||||
QListWidgetItem *rowItem = GetItemById(ui->comboBoxNodes->currentData().toUInt());
|
QListWidgetItem *rowItem = GetItemById(ui->comboBoxNodes->currentData().toUInt());
|
||||||
if (rowItem)
|
if (rowItem)
|
||||||
{
|
{
|
||||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||||
rowNode.SetFormulaSABefore(formula);
|
rowNode.SetFormulaSABefore(formula);
|
||||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||||
}
|
}
|
||||||
|
@ -1490,7 +1478,7 @@ void DialogPiecePath::UpdateNodeSAAfter(const QString &formula)
|
||||||
QListWidgetItem *rowItem = GetItemById(ui->comboBoxNodes->currentData().toUInt());
|
QListWidgetItem *rowItem = GetItemById(ui->comboBoxNodes->currentData().toUInt());
|
||||||
if (rowItem)
|
if (rowItem)
|
||||||
{
|
{
|
||||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||||
rowNode.SetFormulaSAAfter(formula);
|
rowNode.SetFormulaSAAfter(formula);
|
||||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||||
}
|
}
|
||||||
|
@ -1506,7 +1494,7 @@ void DialogPiecePath::UpdateNodePassmarkLength(const QString &formula)
|
||||||
QListWidgetItem *rowItem = GetItemById(ui->comboBoxPassmarks->currentData().toUInt());
|
QListWidgetItem *rowItem = GetItemById(ui->comboBoxPassmarks->currentData().toUInt());
|
||||||
if (rowItem)
|
if (rowItem)
|
||||||
{
|
{
|
||||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||||
rowNode.SetFormulaPassmarkLength(formula);
|
rowNode.SetFormulaPassmarkLength(formula);
|
||||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||||
}
|
}
|
||||||
|
@ -1522,7 +1510,7 @@ void DialogPiecePath::EnabledManualPassmarkLength()
|
||||||
QListWidgetItem *rowItem = GetItemById(ui->comboBoxPassmarks->currentData().toUInt());
|
QListWidgetItem *rowItem = GetItemById(ui->comboBoxPassmarks->currentData().toUInt());
|
||||||
if (rowItem)
|
if (rowItem)
|
||||||
{
|
{
|
||||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||||
rowNode.SetManualPassmarkLength(ui->groupBoxManualLength->isChecked());
|
rowNode.SetManualPassmarkLength(ui->groupBoxManualLength->isChecked());
|
||||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||||
EvalPassmarkLength();
|
EvalPassmarkLength();
|
||||||
|
@ -1547,7 +1535,7 @@ void DialogPiecePath::SetFormulaSAWidth(const QString &formula)
|
||||||
}
|
}
|
||||||
ui->plainTextEditFormulaWidth->setPlainText(width);
|
ui->plainTextEditFormulaWidth->setPlainText(width);
|
||||||
|
|
||||||
VisToolPiecePath *path = qobject_cast<VisToolPiecePath *>(vis);
|
auto *path = qobject_cast<VisToolPiecePath *>(vis);
|
||||||
SCASSERT(path != nullptr)
|
SCASSERT(path != nullptr)
|
||||||
path->SetPath(CreatePath());
|
path->SetPath(CreatePath());
|
||||||
path->SetCuttingPath(CuttingPath(toolId, data));
|
path->SetCuttingPath(CuttingPath(toolId, data));
|
||||||
|
@ -1645,24 +1633,25 @@ auto DialogPiecePath::PathIsValid() const -> bool
|
||||||
QString error;
|
QString error;
|
||||||
if (GetType() == PiecePathType::CustomSeamAllowance && FirstPointEqualLast(ui->listWidget, data, error))
|
if (GetType() == PiecePathType::CustomSeamAllowance && FirstPointEqualLast(ui->listWidget, data, error))
|
||||||
{
|
{
|
||||||
ui->helpLabel->setText(
|
ui->helpLabel->setText(QStringLiteral("%1%2 %3").arg(
|
||||||
QString("%1%2 %3")
|
DialogWarningIcon(), tr("First point of <b>custom seam allowance</b> cannot be equal to the last point!"),
|
||||||
.arg(DialogWarningIcon(),
|
error));
|
||||||
tr("First point of <b>custom seam allowance</b> cannot be equal to the last point!"), error));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
error.clear();
|
error.clear();
|
||||||
if (DoublePoints(ui->listWidget, data, error))
|
if (DoublePoints(ui->listWidget, data, error))
|
||||||
{
|
{
|
||||||
ui->helpLabel->setText(QString("%1%2 %3").arg(DialogWarningIcon(), tr("You have double points!"), error));
|
ui->helpLabel->setText(
|
||||||
|
QStringLiteral("%1%2 %3").arg(DialogWarningIcon(), tr("You have double points!"), error));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
error.clear();
|
error.clear();
|
||||||
if (DoubleCurves(ui->listWidget, data, error))
|
if (DoubleCurves(ui->listWidget, data, error))
|
||||||
{
|
{
|
||||||
ui->helpLabel->setText(QString("%1%2 %3").arg(DialogWarningIcon(), tr("The same curve repeats twice!"), error));
|
ui->helpLabel->setText(
|
||||||
|
QStringLiteral("%1%2 %3").arg(DialogWarningIcon(), tr("The same curve repeats twice!"), error));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1688,7 +1677,7 @@ auto DialogPiecePath::PathIsValid() const -> bool
|
||||||
error.clear();
|
error.clear();
|
||||||
if (InvalidSegment(ui->listWidget, data, error))
|
if (InvalidSegment(ui->listWidget, data, error))
|
||||||
{
|
{
|
||||||
ui->helpLabel->setText(QString("%1%2 %3").arg(DialogWarningIcon(), tr("Invalid segment!"), error));
|
ui->helpLabel->setText(QStringLiteral("%1%2 %3").arg(DialogWarningIcon(), tr("Invalid segment!"), error));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ class DialogPiecePath : public DialogTool
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
public:
|
public:
|
||||||
explicit DialogPiecePath(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
|
explicit DialogPiecePath(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
|
||||||
virtual ~DialogPiecePath();
|
~DialogPiecePath() override;
|
||||||
|
|
||||||
void EnbleShowMode(bool disable);
|
void EnbleShowMode(bool disable);
|
||||||
void HideVisibilityTrigger();
|
void HideVisibilityTrigger();
|
||||||
|
@ -55,17 +55,17 @@ public:
|
||||||
auto GetFormulaSAWidth() const -> QString;
|
auto GetFormulaSAWidth() const -> QString;
|
||||||
void SetFormulaSAWidth(const QString &formula);
|
void SetFormulaSAWidth(const QString &formula);
|
||||||
|
|
||||||
virtual void SetPiecesList(const QVector<quint32> &list) override;
|
void SetPiecesList(const QVector<quint32> &list) override;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void ChosenObject(quint32 id, const SceneObject &type) override;
|
void ChosenObject(quint32 id, const SceneObject &type) override;
|
||||||
virtual void ShowDialog(bool click) override;
|
void ShowDialog(bool click) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void CheckState() final;
|
void CheckState() final;
|
||||||
virtual void ShowVisualization() override;
|
void ShowVisualization() override;
|
||||||
virtual void closeEvent(QCloseEvent *event) override;
|
void closeEvent(QCloseEvent *event) override;
|
||||||
virtual auto IsValid() const -> bool final;
|
auto IsValid() const -> bool final;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void ShowContextMenu(const QPoint &pos);
|
void ShowContextMenu(const QPoint &pos);
|
||||||
|
@ -102,8 +102,8 @@ private slots:
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY_MOVE(DialogPiecePath) // NOLINT
|
Q_DISABLE_COPY_MOVE(DialogPiecePath) // NOLINT
|
||||||
Ui::DialogPiecePath *ui;
|
Ui::DialogPiecePath *ui;
|
||||||
bool m_showMode;
|
bool m_showMode{false};
|
||||||
qreal m_saWidth;
|
qreal m_saWidth{0};
|
||||||
|
|
||||||
QTimer *m_timerWidth;
|
QTimer *m_timerWidth;
|
||||||
QTimer *m_timerWidthBefore;
|
QTimer *m_timerWidthBefore;
|
||||||
|
@ -111,19 +111,19 @@ private:
|
||||||
QTimer *m_timerVisible;
|
QTimer *m_timerVisible;
|
||||||
QTimer *m_timerPassmarkLength;
|
QTimer *m_timerPassmarkLength;
|
||||||
|
|
||||||
int m_formulaBaseWidth;
|
int m_formulaBaseWidth{0};
|
||||||
int m_formulaBaseWidthBefore;
|
int m_formulaBaseWidthBefore{0};
|
||||||
int m_formulaBaseWidthAfter;
|
int m_formulaBaseWidthAfter{0};
|
||||||
int m_formulaBaseVisible;
|
int m_formulaBaseVisible{0};
|
||||||
int m_formulaBasePassmarkLength{0};
|
int m_formulaBasePassmarkLength{0};
|
||||||
|
|
||||||
bool m_flagFormulaBefore;
|
bool m_flagFormulaBefore{true};
|
||||||
bool m_flagFormulaAfter;
|
bool m_flagFormulaAfter{true};
|
||||||
bool m_flagFormulaVisible;
|
bool m_flagFormulaVisible{true};
|
||||||
bool m_flagFormulaPassmarkLength{true};
|
bool m_flagFormulaPassmarkLength{true};
|
||||||
bool m_flagName;
|
bool m_flagName{true}; // We have default name of piece.
|
||||||
bool m_flagError;
|
bool m_flagError{false};
|
||||||
bool m_flagFormula;
|
bool m_flagFormula{false};
|
||||||
|
|
||||||
void InitPathTab();
|
void InitPathTab();
|
||||||
void InitSeamAllowanceTab();
|
void InitSeamAllowanceTab();
|
||||||
|
@ -179,8 +179,8 @@ private:
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline auto DialogPiecePath::IsValid() const -> bool
|
inline auto DialogPiecePath::IsValid() const -> bool
|
||||||
{
|
{
|
||||||
return m_flagName && m_flagError && m_flagFormula && m_flagFormulaBefore && m_flagFormulaAfter
|
return m_flagName && m_flagError && m_flagFormula && m_flagFormulaBefore && m_flagFormulaAfter &&
|
||||||
&& m_flagFormulaVisible && m_flagFormulaPassmarkLength;
|
m_flagFormulaVisible && m_flagFormulaPassmarkLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -27,34 +27,37 @@
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#include "dialogseamallowance.h"
|
#include "dialogseamallowance.h"
|
||||||
#include "ui_dialogseamallowance.h"
|
#include "../../../tools/vtoolseamallowance.h"
|
||||||
#include "ui_tabpaths.h"
|
|
||||||
#include "ui_tablabels.h"
|
|
||||||
#include "ui_tabgrainline.h"
|
|
||||||
#include "ui_tabpins.h"
|
|
||||||
#include "ui_tabpassmarks.h"
|
|
||||||
#include "ui_tabplacelabels.h"
|
|
||||||
#include "../vwidgets/fancytabbar/fancytabbar.h"
|
|
||||||
#include "../vpatterndb/vpiecenode.h"
|
|
||||||
#include "../vpatterndb/vpiecepath.h"
|
|
||||||
#include "../vpatterndb/calculator.h"
|
|
||||||
#include "../vpatterndb/variables/vincrement.h"
|
|
||||||
#include "../vpatterndb/variables/vmeasurement.h"
|
|
||||||
#include "../../../visualization/path/vistoolpiece.h"
|
|
||||||
#include "../../../visualization/path/vispiecespecialpoints.h"
|
|
||||||
#include "dialogpiecepath.h"
|
|
||||||
#include "dialogplacelabel.h"
|
|
||||||
#include "../../../undocommands/savepiecepathoptions.h"
|
#include "../../../undocommands/savepiecepathoptions.h"
|
||||||
#include "../../../undocommands/saveplacelabeloptions.h"
|
#include "../../../undocommands/saveplacelabeloptions.h"
|
||||||
#include "../../support/dialogeditwrongformula.h"
|
#include "../../../visualization/path/vispiecespecialpoints.h"
|
||||||
#include "../../support/dialogeditlabel.h"
|
#include "../../../visualization/path/vistoolpiece.h"
|
||||||
#include "../../../tools/vtoolseamallowance.h"
|
|
||||||
#include "../vgeometry/vplacelabelitem.h"
|
|
||||||
#include "../../dialogtoolbox.h"
|
#include "../../dialogtoolbox.h"
|
||||||
#include "../vmisc/vmodifierkey.h"
|
#include "../../support/dialogeditlabel.h"
|
||||||
#include "dialogpatternmaterials.h"
|
#include "../../support/dialogeditwrongformula.h"
|
||||||
|
#include "../vgeometry/vplacelabelitem.h"
|
||||||
#include "../vmisc/vabstractvalapplication.h"
|
#include "../vmisc/vabstractvalapplication.h"
|
||||||
|
#include "../vmisc/vmodifierkey.h"
|
||||||
#include "../vmisc/vvalentinasettings.h"
|
#include "../vmisc/vvalentinasettings.h"
|
||||||
|
#include "../vpatterndb/calculator.h"
|
||||||
|
#include "../vpatterndb/floatItemData/vgrainlinedata.h"
|
||||||
|
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
|
||||||
|
#include "../vpatterndb/variables/vincrement.h"
|
||||||
|
#include "../vpatterndb/variables/vmeasurement.h"
|
||||||
|
#include "../vpatterndb/vpiecenode.h"
|
||||||
|
#include "../vpatterndb/vpiecepath.h"
|
||||||
|
#include "../vwidgets/fancytabbar/fancytabbar.h"
|
||||||
|
#include "dialogpatternmaterials.h"
|
||||||
|
#include "dialogpiecepath.h"
|
||||||
|
#include "dialogplacelabel.h"
|
||||||
|
#include "qassert.h"
|
||||||
|
#include "ui_dialogseamallowance.h"
|
||||||
|
#include "ui_tabgrainline.h"
|
||||||
|
#include "ui_tablabels.h"
|
||||||
|
#include "ui_tabpassmarks.h"
|
||||||
|
#include "ui_tabpaths.h"
|
||||||
|
#include "ui_tabpins.h"
|
||||||
|
#include "ui_tabplacelabels.h"
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||||
#include "../vmisc/backport/qoverload.h"
|
#include "../vmisc/backport/qoverload.h"
|
||||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||||
|
@ -64,6 +67,8 @@
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
#include <QtNumeric>
|
#include <QtNumeric>
|
||||||
|
#include <array>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
enum TabOrder {Paths=0, Pins=1, Labels=2, Grainline=3, Passmarks=4, PlaceLabels=5, Count=6};
|
enum TabOrder {Paths=0, Pins=1, Labels=2, Grainline=3, Passmarks=4, PlaceLabels=5, Count=6};
|
||||||
|
|
||||||
|
@ -106,7 +111,7 @@ void InitComboBoxFormats(QComboBox *box, const QStringList &items, const QString
|
||||||
}
|
}
|
||||||
box->blockSignals(false);
|
box->blockSignals(false);
|
||||||
}
|
}
|
||||||
}
|
} // namespace
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, VAbstractPattern *doc, quint32 toolId,
|
DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, VAbstractPattern *doc, quint32 toolId,
|
||||||
|
@ -136,44 +141,10 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, quint32 toolId,
|
||||||
m_tabPassmarks(new QWidget),
|
m_tabPassmarks(new QWidget),
|
||||||
m_tabPlaceLabels(new QWidget),
|
m_tabPlaceLabels(new QWidget),
|
||||||
m_ftb(new FancyTabBar(FancyTabBar::Left, this)),
|
m_ftb(new FancyTabBar(FancyTabBar::Left, this)),
|
||||||
applyAllowed(false),// By default disabled
|
|
||||||
flagGPin(false),
|
|
||||||
flagDPin(false),
|
|
||||||
flagPPin(false),
|
|
||||||
flagGFormulas(true),
|
|
||||||
flagDLAngle(true),
|
|
||||||
flagDLFormulas(true),
|
|
||||||
flagPLAngle(true),
|
|
||||||
flagPLFormulas(true),
|
|
||||||
flagFormulaBefore(true),
|
|
||||||
flagFormulaAfter(true),
|
|
||||||
flagMainPathIsValid(true),
|
|
||||||
flagName(true), //We have default name of piece.
|
|
||||||
flagUUID(true),
|
|
||||||
flagFormula(true),
|
|
||||||
m_bAddMode(true),
|
|
||||||
m_dialog(),
|
|
||||||
m_visSpecialPoints(),
|
|
||||||
m_iRotBaseHeight(0),
|
|
||||||
m_iLenBaseHeight(0),
|
|
||||||
m_DLWidthBaseHeight(0),
|
|
||||||
m_DLHeightBaseHeight(0),
|
|
||||||
m_DLAngleBaseHeight(0),
|
|
||||||
m_PLWidthBaseHeight(0),
|
|
||||||
m_PLHeightBaseHeight(0),
|
|
||||||
m_PLAngleBaseHeight(0),
|
|
||||||
m_formulaBaseWidth(0),
|
|
||||||
m_formulaBaseWidthBefore(0),
|
|
||||||
m_formulaBaseWidthAfter(0),
|
|
||||||
m_timerWidth(new QTimer(this)),
|
m_timerWidth(new QTimer(this)),
|
||||||
m_timerWidthBefore(new QTimer(this)),
|
m_timerWidthBefore(new QTimer(this)),
|
||||||
m_timerWidthAfter(new QTimer(this)),
|
m_timerWidthAfter(new QTimer(this)),
|
||||||
m_timerPassmarkLength(new QTimer(this)),
|
m_timerPassmarkLength(new QTimer(this)),
|
||||||
m_saWidth(0),
|
|
||||||
m_templateLines(),
|
|
||||||
m_undoStack(),
|
|
||||||
m_newPlaceLabels(),
|
|
||||||
m_newPaths(),
|
|
||||||
m_placeholdersMenu(new QMenu(this))
|
m_placeholdersMenu(new QMenu(this))
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
@ -273,7 +244,7 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece)
|
||||||
{
|
{
|
||||||
const QString name = GetPathName(record.path, record.reverse);
|
const QString name = GetPathName(record.path, record.reverse);
|
||||||
|
|
||||||
QListWidgetItem *item = new QListWidgetItem(name);
|
auto *item = new QListWidgetItem(name);
|
||||||
item->setFont(NodeFont(item->font()));
|
item->setFont(NodeFont(item->font()));
|
||||||
item->setData(Qt::UserRole, QVariant::fromValue(record));
|
item->setData(Qt::UserRole, QVariant::fromValue(record));
|
||||||
uiTabPaths->listWidgetCustomSA->addItem(item);
|
uiTabPaths->listWidgetCustomSA->addItem(item);
|
||||||
|
@ -290,7 +261,7 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece)
|
||||||
{
|
{
|
||||||
const QString name = GetPathName(path);
|
const QString name = GetPathName(path);
|
||||||
|
|
||||||
QListWidgetItem *item = new QListWidgetItem(name);
|
auto *item = new QListWidgetItem(name);
|
||||||
item->setFont(NodeFont(item->font()));
|
item->setFont(NodeFont(item->font()));
|
||||||
item->setData(Qt::UserRole, QVariant::fromValue(path));
|
item->setData(Qt::UserRole, QVariant::fromValue(path));
|
||||||
uiTabPaths->listWidgetInternalPaths->addItem(item);
|
uiTabPaths->listWidgetInternalPaths->addItem(item);
|
||||||
|
@ -306,7 +277,7 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece)
|
||||||
{
|
{
|
||||||
const QSharedPointer<VGObject> p = data->GetGObject(point);
|
const QSharedPointer<VGObject> p = data->GetGObject(point);
|
||||||
|
|
||||||
QListWidgetItem *item = new QListWidgetItem(p->name());
|
auto *item = new QListWidgetItem(p->name());
|
||||||
item->setFont(NodeFont(item->font()));
|
item->setFont(NodeFont(item->font()));
|
||||||
item->setData(Qt::UserRole, QVariant::fromValue(point));
|
item->setData(Qt::UserRole, QVariant::fromValue(point));
|
||||||
listWidget->addItem(item);
|
listWidget->addItem(item);
|
||||||
|
@ -335,7 +306,7 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece)
|
||||||
NewSpecialPoint(uiTabPlaceLabels->listWidgetPlaceLabels, label);
|
NewSpecialPoint(uiTabPlaceLabels->listWidgetPlaceLabels, label);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (piece.GetPlaceLabels().size() > 0)
|
if (!piece.GetPlaceLabels().empty())
|
||||||
{
|
{
|
||||||
uiTabPlaceLabels->listWidgetPlaceLabels->setCurrentRow(0);
|
uiTabPlaceLabels->listWidgetPlaceLabels->setCurrentRow(0);
|
||||||
}
|
}
|
||||||
|
@ -428,13 +399,17 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece)
|
||||||
*/
|
*/
|
||||||
void DialogSeamAllowance::ChosenObject(quint32 id, const SceneObject &type)
|
void DialogSeamAllowance::ChosenObject(quint32 id, const SceneObject &type)
|
||||||
{
|
{
|
||||||
if (not prepare)
|
if (prepare)
|
||||||
{
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
bool reverse = false;
|
bool reverse = false;
|
||||||
if (QGuiApplication::keyboardModifiers() == Qt::ShiftModifier)
|
if (QGuiApplication::keyboardModifiers() == Qt::ShiftModifier)
|
||||||
{
|
{
|
||||||
reverse = true;
|
reverse = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id != GetLastId())
|
if (id != GetLastId())
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
|
@ -499,13 +474,12 @@ void DialogSeamAllowance::ChosenObject(quint32 id, const SceneObject &type)
|
||||||
visPath->RefreshGeometry();
|
visPath->RefreshGeometry();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSeamAllowance::ShowDialog(bool click)
|
void DialogSeamAllowance::ShowDialog(bool click)
|
||||||
{
|
{
|
||||||
if (click == false && uiTabPaths->listWidgetMainPath->count() > 0)
|
if (!click && uiTabPaths->listWidgetMainPath->count() > 0)
|
||||||
{
|
{
|
||||||
emit ToolTip(QString());
|
emit ToolTip(QString());
|
||||||
prepare = true;
|
prepare = true;
|
||||||
|
@ -560,7 +534,7 @@ void DialogSeamAllowance::CheckState()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_ftb->SetTabText(TabOrder::Paths, tr("Paths") + '*');
|
m_ftb->SetTabText(TabOrder::Paths, tr("Paths") + '*');
|
||||||
const QIcon icon = QIcon::fromTheme("dialog-warning",
|
const QIcon icon = QIcon::fromTheme(QStringLiteral("dialog-warning"),
|
||||||
QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"));
|
QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"));
|
||||||
uiTabPaths->tabWidget->setTabIcon(uiTabPaths->tabWidget->indexOf(uiTabPaths->tabSeamAllowance), icon);
|
uiTabPaths->tabWidget->setTabIcon(uiTabPaths->tabWidget->indexOf(uiTabPaths->tabSeamAllowance), icon);
|
||||||
}
|
}
|
||||||
|
@ -584,7 +558,7 @@ void DialogSeamAllowance::CheckState()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_ftb->SetTabText(TabOrder::Paths, tr("Paths") + '*');
|
m_ftb->SetTabText(TabOrder::Paths, tr("Paths") + '*');
|
||||||
const QIcon icon = QIcon::fromTheme("dialog-warning",
|
const QIcon icon = QIcon::fromTheme(QStringLiteral("dialog-warning"),
|
||||||
QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"));
|
QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"));
|
||||||
uiTabPaths->tabWidget->setTabIcon(uiTabPaths->tabWidget->indexOf(uiTabPaths->tabMainPath), icon);
|
uiTabPaths->tabWidget->setTabIcon(uiTabPaths->tabWidget->indexOf(uiTabPaths->tabMainPath), icon);
|
||||||
}
|
}
|
||||||
|
@ -600,18 +574,14 @@ void DialogSeamAllowance::CheckState()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_ftb->SetTabText(TabOrder::Paths, tr("Paths") + '*');
|
m_ftb->SetTabText(TabOrder::Paths, tr("Paths") + '*');
|
||||||
const QIcon icon = QIcon::fromTheme("dialog-warning",
|
const QIcon icon = QIcon::fromTheme(QStringLiteral("dialog-warning"),
|
||||||
QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"));
|
QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"));
|
||||||
uiTabPaths->tabWidget->setTabIcon(uiTabPaths->tabWidget->indexOf(uiTabPaths->tabPiece), icon);
|
uiTabPaths->tabWidget->setTabIcon(uiTabPaths->tabWidget->indexOf(uiTabPaths->tabPiece), icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
uiTabPaths->comboBoxNodes->setEnabled(flagFormulaBefore && flagFormulaAfter);
|
uiTabPaths->comboBoxNodes->setEnabled(flagFormulaBefore && flagFormulaAfter);
|
||||||
|
|
||||||
if (uiTabPassmarks->comboBoxPassmarks->count() == 0)
|
flagFormulaPassmarkLength = uiTabPassmarks->comboBoxPassmarks->count() == 0;
|
||||||
{
|
|
||||||
flagFormulaPassmarkLength = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flagFormulaPassmarkLength)
|
if (flagFormulaPassmarkLength)
|
||||||
{
|
{
|
||||||
m_ftb->SetTabText(TabOrder::Passmarks, tr("Passmarks"));
|
m_ftb->SetTabText(TabOrder::Passmarks, tr("Passmarks"));
|
||||||
|
@ -639,8 +609,8 @@ void DialogSeamAllowance::closeEvent(QCloseEvent *event)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSeamAllowance::showEvent(QShowEvent *event)
|
void DialogSeamAllowance::showEvent(QShowEvent *event)
|
||||||
{
|
{
|
||||||
QDialog::showEvent( event ); // clazy:exclude=skipped-base-method
|
QDialog::showEvent(event); // clazy:exclude=skipped-base-method NOLINT(bugprone-parent-virtual-call)
|
||||||
if ( event->spontaneous() )
|
if (event->spontaneous())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -700,7 +670,7 @@ void DialogSeamAllowance::SetPatternDoc(VAbstractPattern *doc)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSeamAllowance::NameDetailChanged()
|
void DialogSeamAllowance::NameDetailChanged()
|
||||||
{
|
{
|
||||||
QLineEdit* edit = qobject_cast<QLineEdit*>(sender());
|
auto *edit = qobject_cast<QLineEdit *>(sender());
|
||||||
if (edit)
|
if (edit)
|
||||||
{
|
{
|
||||||
if (edit->text().isEmpty())
|
if (edit->text().isEmpty())
|
||||||
|
@ -720,10 +690,10 @@ void DialogSeamAllowance::NameDetailChanged()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSeamAllowance::DetailUUIDChanged()
|
void DialogSeamAllowance::DetailUUIDChanged()
|
||||||
{
|
{
|
||||||
QLineEdit* edit = qobject_cast<QLineEdit*>(sender());
|
auto *edit = qobject_cast<QLineEdit *>(sender());
|
||||||
if (edit)
|
if (edit)
|
||||||
{
|
{
|
||||||
QRegularExpression re("^$|^{[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-"
|
static QRegularExpression re("^$|^{[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-"
|
||||||
"[0-9a-fA-F]{12}}$");
|
"[0-9a-fA-F]{12}}$");
|
||||||
QRegularExpressionMatch match = re.match(edit->text());
|
QRegularExpressionMatch match = re.match(edit->text());
|
||||||
|
|
||||||
|
@ -847,7 +817,7 @@ void DialogSeamAllowance::ShowCustomSAContextMenu(const QPoint &pos)
|
||||||
|
|
||||||
QListWidgetItem *rowItem = uiTabPaths->listWidgetCustomSA->item(row);
|
QListWidgetItem *rowItem = uiTabPaths->listWidgetCustomSA->item(row);
|
||||||
SCASSERT(rowItem != nullptr);
|
SCASSERT(rowItem != nullptr);
|
||||||
CustomSARecord record = qvariant_cast<CustomSARecord>(rowItem->data(Qt::UserRole));
|
auto record = qvariant_cast<CustomSARecord>(rowItem->data(Qt::UserRole));
|
||||||
|
|
||||||
QAction *actionReverse = menu->addAction(tr("Reverse"));
|
QAction *actionReverse = menu->addAction(tr("Reverse"));
|
||||||
actionReverse->setCheckable(true);
|
actionReverse->setCheckable(true);
|
||||||
|
@ -907,7 +877,7 @@ void DialogSeamAllowance::ShowInternalPathsContextMenu(const QPoint &pos)
|
||||||
{
|
{
|
||||||
QListWidgetItem *rowItem = uiTabPaths->listWidgetInternalPaths->item(row);
|
QListWidgetItem *rowItem = uiTabPaths->listWidgetInternalPaths->item(row);
|
||||||
SCASSERT(rowItem != nullptr);
|
SCASSERT(rowItem != nullptr);
|
||||||
const quint32 pathId = qvariant_cast<quint32>(rowItem->data(Qt::UserRole));
|
const auto pathId = qvariant_cast<quint32>(rowItem->data(Qt::UserRole));
|
||||||
|
|
||||||
auto *dialog = new DialogPiecePath(data, pathId, this);
|
auto *dialog = new DialogPiecePath(data, pathId, this);
|
||||||
dialog->SetPiecePath(CurrentPath(pathId));
|
dialog->SetPiecePath(CurrentPath(pathId));
|
||||||
|
@ -954,7 +924,7 @@ void DialogSeamAllowance::ShowPlaceLabelsContextMenu(const QPoint &pos)
|
||||||
|
|
||||||
QListWidgetItem *rowItem = uiTabPlaceLabels->listWidgetPlaceLabels->item(row);
|
QListWidgetItem *rowItem = uiTabPlaceLabels->listWidgetPlaceLabels->item(row);
|
||||||
SCASSERT(rowItem != nullptr);
|
SCASSERT(rowItem != nullptr);
|
||||||
const quint32 labelId = qvariant_cast<quint32>(rowItem->data(Qt::UserRole));
|
const auto labelId = qvariant_cast<quint32>(rowItem->data(Qt::UserRole));
|
||||||
VPlaceLabelItem currentLabel = CurrentPlaceLabel(labelId);
|
VPlaceLabelItem currentLabel = CurrentPlaceLabel(labelId);
|
||||||
|
|
||||||
QScopedPointer<QMenu> menu(new QMenu());
|
QScopedPointer<QMenu> menu(new QMenu());
|
||||||
|
@ -1297,7 +1267,7 @@ void DialogSeamAllowance::CSAStartPointChanged(int index)
|
||||||
|
|
||||||
QListWidgetItem *rowItem = uiTabPaths->listWidgetCustomSA->item(row);
|
QListWidgetItem *rowItem = uiTabPaths->listWidgetCustomSA->item(row);
|
||||||
SCASSERT(rowItem != nullptr);
|
SCASSERT(rowItem != nullptr);
|
||||||
CustomSARecord record = qvariant_cast<CustomSARecord>(rowItem->data(Qt::UserRole));
|
auto record = qvariant_cast<CustomSARecord>(rowItem->data(Qt::UserRole));
|
||||||
record.startPoint = uiTabPaths->comboBoxStartPoint->currentData().toUInt();
|
record.startPoint = uiTabPaths->comboBoxStartPoint->currentData().toUInt();
|
||||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(record));
|
rowItem->setData(Qt::UserRole, QVariant::fromValue(record));
|
||||||
}
|
}
|
||||||
|
@ -1315,7 +1285,7 @@ void DialogSeamAllowance::CSAEndPointChanged(int index)
|
||||||
|
|
||||||
QListWidgetItem *rowItem = uiTabPaths->listWidgetCustomSA->item(row);
|
QListWidgetItem *rowItem = uiTabPaths->listWidgetCustomSA->item(row);
|
||||||
SCASSERT(rowItem != nullptr);
|
SCASSERT(rowItem != nullptr);
|
||||||
CustomSARecord record = qvariant_cast<CustomSARecord>(rowItem->data(Qt::UserRole));
|
auto record = qvariant_cast<CustomSARecord>(rowItem->data(Qt::UserRole));
|
||||||
record.endPoint = uiTabPaths->comboBoxEndPoint->currentData().toUInt();
|
record.endPoint = uiTabPaths->comboBoxEndPoint->currentData().toUInt();
|
||||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(record));
|
rowItem->setData(Qt::UserRole, QVariant::fromValue(record));
|
||||||
}
|
}
|
||||||
|
@ -1333,7 +1303,7 @@ void DialogSeamAllowance::CSAIncludeTypeChanged(int index)
|
||||||
|
|
||||||
QListWidgetItem *rowItem = uiTabPaths->listWidgetCustomSA->item(row);
|
QListWidgetItem *rowItem = uiTabPaths->listWidgetCustomSA->item(row);
|
||||||
SCASSERT(rowItem != nullptr);
|
SCASSERT(rowItem != nullptr);
|
||||||
CustomSARecord record = qvariant_cast<CustomSARecord>(rowItem->data(Qt::UserRole));
|
auto record = qvariant_cast<CustomSARecord>(rowItem->data(Qt::UserRole));
|
||||||
record.includeType = static_cast<PiecePathIncludeType>(uiTabPaths->comboBoxIncludeType->currentData().toUInt());
|
record.includeType = static_cast<PiecePathIncludeType>(uiTabPaths->comboBoxIncludeType->currentData().toUInt());
|
||||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(record));
|
rowItem->setData(Qt::UserRole, QVariant::fromValue(record));
|
||||||
}
|
}
|
||||||
|
@ -1347,7 +1317,7 @@ void DialogSeamAllowance::NodeAngleChanged(int index)
|
||||||
QListWidgetItem *rowItem = GetItemById(uiTabPaths->comboBoxNodes->currentData().toUInt());
|
QListWidgetItem *rowItem = GetItemById(uiTabPaths->comboBoxNodes->currentData().toUInt());
|
||||||
if (rowItem)
|
if (rowItem)
|
||||||
{
|
{
|
||||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||||
rowNode.SetAngleType(static_cast<PieceNodeAngle>(uiTabPaths->comboBoxAngle->currentData().toUInt()));
|
rowNode.SetAngleType(static_cast<PieceNodeAngle>(uiTabPaths->comboBoxAngle->currentData().toUInt()));
|
||||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||||
|
|
||||||
|
@ -1362,7 +1332,7 @@ void DialogSeamAllowance::ReturnDefBefore()
|
||||||
const QString def = VAbstractApplication::VApp()->TrVars()
|
const QString def = VAbstractApplication::VApp()->TrVars()
|
||||||
->FormulaToUser(currentSeamAllowance, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
->FormulaToUser(currentSeamAllowance, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
uiTabPaths->plainTextEditFormulaWidthBefore->setPlainText(def);
|
uiTabPaths->plainTextEditFormulaWidthBefore->setPlainText(def);
|
||||||
if (QPushButton* button = qobject_cast<QPushButton*>(sender()))
|
if (auto *button = qobject_cast<QPushButton *>(sender()))
|
||||||
{
|
{
|
||||||
button->setEnabled(false);
|
button->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
@ -1374,7 +1344,7 @@ void DialogSeamAllowance::ReturnDefAfter()
|
||||||
const QString def = VAbstractApplication::VApp()->TrVars()
|
const QString def = VAbstractApplication::VApp()->TrVars()
|
||||||
->FormulaToUser(currentSeamAllowance, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
->FormulaToUser(currentSeamAllowance, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
uiTabPaths->plainTextEditFormulaWidthAfter->setPlainText(def);
|
uiTabPaths->plainTextEditFormulaWidthAfter->setPlainText(def);
|
||||||
if (QPushButton* button = qobject_cast<QPushButton*>(sender()))
|
if (auto *button = qobject_cast<QPushButton *>(sender()))
|
||||||
{
|
{
|
||||||
button->setEnabled(false);
|
button->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
@ -1401,7 +1371,7 @@ void DialogSeamAllowance::CustomSAChanged(int row)
|
||||||
|
|
||||||
const QListWidgetItem *item = uiTabPaths->listWidgetCustomSA->item( row );
|
const QListWidgetItem *item = uiTabPaths->listWidgetCustomSA->item( row );
|
||||||
SCASSERT(item != nullptr);
|
SCASSERT(item != nullptr);
|
||||||
const CustomSARecord record = qvariant_cast<CustomSARecord>(item->data(Qt::UserRole));
|
const auto record = qvariant_cast<CustomSARecord>(item->data(Qt::UserRole));
|
||||||
|
|
||||||
uiTabPaths->comboBoxStartPoint->blockSignals(true);
|
uiTabPaths->comboBoxStartPoint->blockSignals(true);
|
||||||
InitCSAPoint(uiTabPaths->comboBoxStartPoint);
|
InitCSAPoint(uiTabPaths->comboBoxStartPoint);
|
||||||
|
@ -1443,7 +1413,7 @@ void DialogSeamAllowance::PathDialogClosed(int result)
|
||||||
if (result == QDialog::Accepted)
|
if (result == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
SCASSERT(not m_dialog.isNull());
|
SCASSERT(not m_dialog.isNull());
|
||||||
DialogPiecePath *dialogTool = qobject_cast<DialogPiecePath*>(m_dialog.data());
|
auto *dialogTool = qobject_cast<DialogPiecePath *>(m_dialog.data());
|
||||||
SCASSERT(dialogTool != nullptr);
|
SCASSERT(dialogTool != nullptr);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1474,7 +1444,7 @@ void DialogSeamAllowance::PlaceLabelDialogClosed(int result)
|
||||||
if (result == QDialog::Accepted)
|
if (result == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
SCASSERT(not m_dialog.isNull());
|
SCASSERT(not m_dialog.isNull());
|
||||||
DialogPlaceLabel *dialogTool = qobject_cast<DialogPlaceLabel*>(m_dialog.data());
|
auto *dialogTool = qobject_cast<DialogPlaceLabel *>(m_dialog.data());
|
||||||
SCASSERT(dialogTool != nullptr);
|
SCASSERT(dialogTool != nullptr);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1535,8 +1505,8 @@ void DialogSeamAllowance::FancyTabChanged(int index)
|
||||||
m_tabPassmarks->hide();
|
m_tabPassmarks->hide();
|
||||||
m_tabPlaceLabels->hide();
|
m_tabPlaceLabels->hide();
|
||||||
|
|
||||||
QT_WARNING_PUSH
|
QT_WARNING_PUSH
|
||||||
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
switch(index)
|
switch(index)
|
||||||
{
|
{
|
||||||
case TabOrder::Paths:
|
case TabOrder::Paths:
|
||||||
|
@ -1557,12 +1527,14 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
case TabOrder::PlaceLabels:
|
case TabOrder::PlaceLabels:
|
||||||
m_tabPlaceLabels->show();
|
m_tabPlaceLabels->show();
|
||||||
break;
|
break;
|
||||||
|
case TabOrder::Count:
|
||||||
|
Q_UNREACHABLE();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
|
|
||||||
if (index == TabOrder::Pins
|
if (index == TabOrder::Pins || index == TabOrder::Grainline ||
|
||||||
|| index == TabOrder::Grainline
|
(index == TabOrder::Labels &&
|
||||||
|| (index == TabOrder::Labels &&
|
|
||||||
uiTabLabels->tabWidget->currentIndex() == uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels)))
|
uiTabLabels->tabWidget->currentIndex() == uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels)))
|
||||||
{
|
{
|
||||||
ShowPieceSpecialPointsWithRect(uiTabPins->listWidgetPins, false);
|
ShowPieceSpecialPointsWithRect(uiTabPins->listWidgetPins, false);
|
||||||
|
@ -1605,7 +1577,7 @@ void DialogSeamAllowance::PassmarkLineTypeChanged(int id)
|
||||||
QListWidgetItem *rowItem = GetItemById(uiTabPassmarks->comboBoxPassmarks->currentData().toUInt());
|
QListWidgetItem *rowItem = GetItemById(uiTabPassmarks->comboBoxPassmarks->currentData().toUInt());
|
||||||
if (rowItem)
|
if (rowItem)
|
||||||
{
|
{
|
||||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||||
|
|
||||||
PassmarkLineType lineType = PassmarkLineType::OneLine;
|
PassmarkLineType lineType = PassmarkLineType::OneLine;
|
||||||
if (id == uiTabPassmarks->buttonGroupLineType->id(uiTabPassmarks->radioButtonOneLine))
|
if (id == uiTabPassmarks->buttonGroupLineType->id(uiTabPassmarks->radioButtonOneLine))
|
||||||
|
@ -1659,7 +1631,7 @@ void DialogSeamAllowance::PassmarkAngleTypeChanged(int id)
|
||||||
QListWidgetItem *rowItem = GetItemById(uiTabPassmarks->comboBoxPassmarks->currentData().toUInt());
|
QListWidgetItem *rowItem = GetItemById(uiTabPassmarks->comboBoxPassmarks->currentData().toUInt());
|
||||||
if (rowItem)
|
if (rowItem)
|
||||||
{
|
{
|
||||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||||
|
|
||||||
PassmarkAngleType angleType = PassmarkAngleType::Straightforward;
|
PassmarkAngleType angleType = PassmarkAngleType::Straightforward;
|
||||||
if (id == uiTabPassmarks->buttonGroupAngleType->id(uiTabPassmarks->radioButtonStraightforward))
|
if (id == uiTabPassmarks->buttonGroupAngleType->id(uiTabPassmarks->radioButtonStraightforward))
|
||||||
|
@ -1712,7 +1684,7 @@ void DialogSeamAllowance::PassmarkShowSecondChanged(int state)
|
||||||
QListWidgetItem *rowItem = GetItemById(uiTabPassmarks->comboBoxPassmarks->currentData().toUInt());
|
QListWidgetItem *rowItem = GetItemById(uiTabPassmarks->comboBoxPassmarks->currentData().toUInt());
|
||||||
if (rowItem)
|
if (rowItem)
|
||||||
{
|
{
|
||||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||||
rowNode.SetShowSecondPassmark(state);
|
rowNode.SetShowSecondPassmark(state);
|
||||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||||
|
|
||||||
|
@ -1724,10 +1696,11 @@ void DialogSeamAllowance::PassmarkShowSecondChanged(int state)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSeamAllowance::UpdateGrainlineValues()
|
void DialogSeamAllowance::UpdateGrainlineValues()
|
||||||
{
|
{
|
||||||
QPlainTextEdit* apleSender[2] = {uiTabGrainline->lineEditRotFormula, uiTabGrainline->lineEditLenFormula};
|
std::array<const QPlainTextEdit *, 2> apleSender = {uiTabGrainline->lineEditRotFormula,
|
||||||
bool bFormulasOK[2] = {true, true};
|
uiTabGrainline->lineEditLenFormula};
|
||||||
|
std::array<bool, 2> bFormulasOK = {true, true};
|
||||||
|
|
||||||
for (int i = 0; i < 2; ++i)
|
for (std::size_t i = 0; i < 2; ++i)
|
||||||
{
|
{
|
||||||
QLabel* plbVal;
|
QLabel* plbVal;
|
||||||
QLabel* plbText;
|
QLabel* plbText;
|
||||||
|
@ -1747,7 +1720,7 @@ void DialogSeamAllowance::UpdateGrainlineValues()
|
||||||
|
|
||||||
plbVal->setToolTip(tr("Value"));
|
plbVal->setToolTip(tr("Value"));
|
||||||
|
|
||||||
QString qsFormula = apleSender[i]->toPlainText().simplified();
|
QString qsFormula = apleSender.at(i)->toPlainText().simplified();
|
||||||
QString qsVal;
|
QString qsVal;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1755,7 +1728,7 @@ void DialogSeamAllowance::UpdateGrainlineValues()
|
||||||
->FormulaFromUser(qsFormula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
->FormulaFromUser(qsFormula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
Calculator cal;
|
Calculator cal;
|
||||||
qreal dVal = cal.EvalFormula(data->DataVariables(), qsFormula);
|
qreal dVal = cal.EvalFormula(data->DataVariables(), qsFormula);
|
||||||
if (qIsInf(dVal) == true || qIsNaN(dVal) == true)
|
if (qIsInf(dVal) || qIsNaN(dVal))
|
||||||
{
|
{
|
||||||
throw qmu::QmuParserError(tr("Infinite/undefined result"));
|
throw qmu::QmuParserError(tr("Infinite/undefined result"));
|
||||||
}
|
}
|
||||||
|
@ -1763,21 +1736,19 @@ void DialogSeamAllowance::UpdateGrainlineValues()
|
||||||
{
|
{
|
||||||
throw qmu::QmuParserError(tr("Length should be positive"));
|
throw qmu::QmuParserError(tr("Length should be positive"));
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
qsVal.setNum(dVal, 'f', 2);
|
qsVal.setNum(dVal, 'f', 2);
|
||||||
ChangeColor(plbText, OkColor(this));
|
ChangeColor(plbText, OkColor(this));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (qmu::QmuParserError &e)
|
catch (qmu::QmuParserError &e)
|
||||||
{
|
{
|
||||||
qsVal = tr("Error");
|
qsVal = tr("Error");
|
||||||
not flagGPin ? ChangeColor(plbText, errorColor) : ChangeColor(plbText, OkColor(this));
|
not flagGPin ? ChangeColor(plbText, errorColor) : ChangeColor(plbText, OkColor(this));
|
||||||
bFormulasOK[i] = false;
|
bFormulasOK.at(i) = false;
|
||||||
plbVal->setToolTip(tr("Parser error: %1").arg(e.GetMsg()));
|
plbVal->setToolTip(tr("Parser error: %1").arg(e.GetMsg()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bFormulasOK[i] && qsVal.isEmpty() == false)
|
if (bFormulasOK.at(i) && not qsVal.isEmpty())
|
||||||
{
|
{
|
||||||
qsVal += qsUnit;
|
qsVal += qsUnit;
|
||||||
}
|
}
|
||||||
|
@ -1799,11 +1770,11 @@ void DialogSeamAllowance::UpdateGrainlineValues()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSeamAllowance::UpdateDetailLabelValues()
|
void DialogSeamAllowance::UpdateDetailLabelValues()
|
||||||
{
|
{
|
||||||
QPlainTextEdit* apleSender[3] = {uiTabLabels->lineEditDLWidthFormula, uiTabLabels->lineEditDLHeightFormula,
|
std::array<const QPlainTextEdit *, 3> apleSender = {
|
||||||
uiTabLabels->lineEditDLAngleFormula};
|
uiTabLabels->lineEditDLWidthFormula, uiTabLabels->lineEditDLHeightFormula, uiTabLabels->lineEditDLAngleFormula};
|
||||||
bool bFormulasOK[3] = {true, true, true};
|
std::array<bool, 3> bFormulasOK = {true, true, true};
|
||||||
|
|
||||||
for (int i = 0; i < 3; ++i)
|
for (std::size_t i = 0; i < 3; ++i)
|
||||||
{
|
{
|
||||||
QLabel* plbVal;
|
QLabel* plbVal;
|
||||||
QLabel* plbText;
|
QLabel* plbText;
|
||||||
|
@ -1829,7 +1800,7 @@ void DialogSeamAllowance::UpdateDetailLabelValues()
|
||||||
|
|
||||||
plbVal->setToolTip(tr("Value"));
|
plbVal->setToolTip(tr("Value"));
|
||||||
|
|
||||||
QString qsFormula = apleSender[i]->toPlainText().simplified();
|
QString qsFormula = apleSender.at(i)->toPlainText().simplified();
|
||||||
QString qsVal;
|
QString qsVal;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1838,7 +1809,7 @@ void DialogSeamAllowance::UpdateDetailLabelValues()
|
||||||
->FormulaFromUser(qsFormula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
->FormulaFromUser(qsFormula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
Calculator cal;
|
Calculator cal;
|
||||||
qreal dVal = cal.EvalFormula(data->DataVariables(), qsFormula);
|
qreal dVal = cal.EvalFormula(data->DataVariables(), qsFormula);
|
||||||
if (qIsInf(dVal) == true || qIsNaN(dVal) == true)
|
if (qIsInf(dVal) || qIsNaN(dVal))
|
||||||
{
|
{
|
||||||
throw qmu::QmuParserError(tr("Infinite/undefined result"));
|
throw qmu::QmuParserError(tr("Infinite/undefined result"));
|
||||||
}
|
}
|
||||||
|
@ -1846,21 +1817,19 @@ void DialogSeamAllowance::UpdateDetailLabelValues()
|
||||||
{
|
{
|
||||||
throw qmu::QmuParserError(tr("Length should be positive"));
|
throw qmu::QmuParserError(tr("Length should be positive"));
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
qsVal.setNum(dVal, 'f', 2);
|
qsVal.setNum(dVal, 'f', 2);
|
||||||
ChangeColor(plbText, OkColor(this));
|
ChangeColor(plbText, OkColor(this));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (qmu::QmuParserError &e)
|
catch (qmu::QmuParserError &e)
|
||||||
{
|
{
|
||||||
qsVal = tr("Error");
|
qsVal = tr("Error");
|
||||||
not flagDPin ? ChangeColor(plbText, errorColor) : ChangeColor(plbText, OkColor(this));
|
not flagDPin ? ChangeColor(plbText, errorColor) : ChangeColor(plbText, OkColor(this));
|
||||||
bFormulasOK[i] = false;
|
bFormulasOK.at(i) = false;
|
||||||
plbVal->setToolTip(tr("Parser error: %1").arg(e.GetMsg()));
|
plbVal->setToolTip(tr("Parser error: %1").arg(e.GetMsg()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bFormulasOK[i] && qsVal.isEmpty() == false)
|
if (bFormulasOK.at(i) && not qsVal.isEmpty())
|
||||||
{
|
{
|
||||||
qsVal += qsUnit;
|
qsVal += qsUnit;
|
||||||
}
|
}
|
||||||
|
@ -1872,7 +1841,7 @@ void DialogSeamAllowance::UpdateDetailLabelValues()
|
||||||
if (not flagDLAngle || not (flagDLFormulas || flagDPin) || not flagPLAngle || not (flagPLFormulas || flagPPin))
|
if (not flagDLAngle || not (flagDLFormulas || flagDPin) || not flagPLAngle || not (flagPLFormulas || flagPPin))
|
||||||
{
|
{
|
||||||
m_ftb->SetTabText(TabOrder::Labels, tr("Labels") + '*');
|
m_ftb->SetTabText(TabOrder::Labels, tr("Labels") + '*');
|
||||||
const QIcon icon = QIcon::fromTheme("dialog-warning",
|
const QIcon icon = QIcon::fromTheme(QStringLiteral("dialog-warning"),
|
||||||
QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"));
|
QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"));
|
||||||
uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), icon);
|
uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), icon);
|
||||||
}
|
}
|
||||||
|
@ -1886,11 +1855,11 @@ void DialogSeamAllowance::UpdateDetailLabelValues()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSeamAllowance::UpdatePatternLabelValues()
|
void DialogSeamAllowance::UpdatePatternLabelValues()
|
||||||
{
|
{
|
||||||
QPlainTextEdit* apleSender[3] = {uiTabLabels->lineEditPLWidthFormula, uiTabLabels->lineEditPLHeightFormula,
|
std::array<const QPlainTextEdit *, 3> apleSender = {
|
||||||
uiTabLabels->lineEditPLAngleFormula};
|
uiTabLabels->lineEditPLWidthFormula, uiTabLabels->lineEditPLHeightFormula, uiTabLabels->lineEditPLAngleFormula};
|
||||||
bool bFormulasOK[3] = {true, true, true};
|
std::array<bool, 3> bFormulasOK = {true, true, true};
|
||||||
|
|
||||||
for (int i = 0; i < 3; ++i)
|
for (std::size_t i = 0; i < 3; ++i)
|
||||||
{
|
{
|
||||||
QLabel* plbVal;
|
QLabel* plbVal;
|
||||||
QLabel* plbText;
|
QLabel* plbText;
|
||||||
|
@ -1916,7 +1885,7 @@ void DialogSeamAllowance::UpdatePatternLabelValues()
|
||||||
|
|
||||||
plbVal->setToolTip(tr("Value"));
|
plbVal->setToolTip(tr("Value"));
|
||||||
|
|
||||||
QString qsFormula = apleSender[i]->toPlainText().simplified();
|
QString qsFormula = apleSender.at(i)->toPlainText().simplified();
|
||||||
QString qsVal;
|
QString qsVal;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1924,7 +1893,7 @@ void DialogSeamAllowance::UpdatePatternLabelValues()
|
||||||
->FormulaFromUser(qsFormula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
->FormulaFromUser(qsFormula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
Calculator cal;
|
Calculator cal;
|
||||||
qreal dVal = cal.EvalFormula(data->DataVariables(), qsFormula);
|
qreal dVal = cal.EvalFormula(data->DataVariables(), qsFormula);
|
||||||
if (qIsInf(dVal) == true || qIsNaN(dVal) == true)
|
if (qIsInf(dVal) || qIsNaN(dVal))
|
||||||
{
|
{
|
||||||
throw qmu::QmuParserError(tr("Infinite/undefined result"));
|
throw qmu::QmuParserError(tr("Infinite/undefined result"));
|
||||||
}
|
}
|
||||||
|
@ -1932,21 +1901,19 @@ void DialogSeamAllowance::UpdatePatternLabelValues()
|
||||||
{
|
{
|
||||||
throw qmu::QmuParserError(tr("Length should be positive"));
|
throw qmu::QmuParserError(tr("Length should be positive"));
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
qsVal.setNum(dVal, 'f', 2);
|
qsVal.setNum(dVal, 'f', 2);
|
||||||
ChangeColor(plbText, OkColor(this));
|
ChangeColor(plbText, OkColor(this));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (qmu::QmuParserError &e)
|
catch (qmu::QmuParserError &e)
|
||||||
{
|
{
|
||||||
qsVal = tr("Error");
|
qsVal = tr("Error");
|
||||||
not flagPPin ? ChangeColor(plbText, errorColor) : ChangeColor(plbText, OkColor(this));
|
not flagPPin ? ChangeColor(plbText, errorColor) : ChangeColor(plbText, OkColor(this));
|
||||||
bFormulasOK[i] = false;
|
bFormulasOK.at(i) = false;
|
||||||
plbVal->setToolTip(tr("Parser error: %1").arg(e.GetMsg()));
|
plbVal->setToolTip(tr("Parser error: %1").arg(e.GetMsg()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bFormulasOK[i] && qsVal.isEmpty() == false)
|
if (bFormulasOK.at(i) && not qsVal.isEmpty())
|
||||||
{
|
{
|
||||||
qsVal += qsUnit;
|
qsVal += qsUnit;
|
||||||
}
|
}
|
||||||
|
@ -1958,7 +1925,7 @@ void DialogSeamAllowance::UpdatePatternLabelValues()
|
||||||
if (not flagDLAngle || not (flagDLFormulas || flagDPin) || not flagPLAngle || not (flagPLFormulas || flagPPin))
|
if (not flagDLAngle || not (flagDLFormulas || flagDPin) || not flagPLAngle || not (flagPLFormulas || flagPPin))
|
||||||
{
|
{
|
||||||
m_ftb->SetTabText(TabOrder::Labels, tr("Labels") + '*');
|
m_ftb->SetTabText(TabOrder::Labels, tr("Labels") + '*');
|
||||||
const QIcon icon = QIcon::fromTheme("dialog-warning",
|
const QIcon icon = QIcon::fromTheme(QStringLiteral("dialog-warning"),
|
||||||
QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"));
|
QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"));
|
||||||
uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), icon);
|
uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), icon);
|
||||||
}
|
}
|
||||||
|
@ -1972,7 +1939,7 @@ void DialogSeamAllowance::UpdatePatternLabelValues()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSeamAllowance::EnabledGrainline()
|
void DialogSeamAllowance::EnabledGrainline()
|
||||||
{
|
{
|
||||||
if (uiTabGrainline->groupBoxGrainline->isChecked() == true)
|
if (uiTabGrainline->groupBoxGrainline->isChecked())
|
||||||
{
|
{
|
||||||
GrainlinePinPointChanged();
|
GrainlinePinPointChanged();
|
||||||
}
|
}
|
||||||
|
@ -1987,7 +1954,7 @@ void DialogSeamAllowance::EnabledGrainline()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSeamAllowance::EnabledDetailLabel()
|
void DialogSeamAllowance::EnabledDetailLabel()
|
||||||
{
|
{
|
||||||
if (uiTabLabels->groupBoxDetailLabel->isChecked() == true)
|
if (uiTabLabels->groupBoxDetailLabel->isChecked())
|
||||||
{
|
{
|
||||||
UpdateDetailLabelValues();
|
UpdateDetailLabelValues();
|
||||||
DetailPinPointChanged();
|
DetailPinPointChanged();
|
||||||
|
@ -2004,7 +1971,7 @@ void DialogSeamAllowance::EnabledDetailLabel()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSeamAllowance::EnabledPatternLabel()
|
void DialogSeamAllowance::EnabledPatternLabel()
|
||||||
{
|
{
|
||||||
if (uiTabLabels->groupBoxPatternLabel->isChecked() == true)
|
if (uiTabLabels->groupBoxPatternLabel->isChecked())
|
||||||
{
|
{
|
||||||
UpdatePatternLabelValues();
|
UpdatePatternLabelValues();
|
||||||
PatternPinPointChanged();
|
PatternPinPointChanged();
|
||||||
|
@ -2027,7 +1994,7 @@ void DialogSeamAllowance::EnabledManualPassmarkLength()
|
||||||
QListWidgetItem *rowItem = GetItemById(uiTabPassmarks->comboBoxPassmarks->currentData().toUInt());
|
QListWidgetItem *rowItem = GetItemById(uiTabPassmarks->comboBoxPassmarks->currentData().toUInt());
|
||||||
if (rowItem)
|
if (rowItem)
|
||||||
{
|
{
|
||||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||||
rowNode.SetManualPassmarkLength(uiTabPassmarks->groupBoxManualLength->isChecked());
|
rowNode.SetManualPassmarkLength(uiTabPassmarks->groupBoxManualLength->isChecked());
|
||||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||||
EvalPassmarkLength();
|
EvalPassmarkLength();
|
||||||
|
@ -2291,7 +2258,7 @@ void DialogSeamAllowance::EvalWidth()
|
||||||
|
|
||||||
if (m_saWidth >= 0)
|
if (m_saWidth >= 0)
|
||||||
{
|
{
|
||||||
VContainer *locData = const_cast<VContainer *> (data);
|
auto *locData = const_cast<VContainer *>(data);
|
||||||
|
|
||||||
auto *currentSA = new VIncrement(locData, currentSeamAllowance);
|
auto *currentSA = new VIncrement(locData, currentSeamAllowance);
|
||||||
currentSA->SetFormula(m_saWidth, QString().setNum(m_saWidth), true);
|
currentSA->SetFormula(m_saWidth, QString().setNum(m_saWidth), true);
|
||||||
|
@ -2379,8 +2346,8 @@ void DialogSeamAllowance::EvalPassmarkLength()
|
||||||
formulaData.labelEditFormula = uiTabPassmarks->labelEditPassmarkLength;
|
formulaData.labelEditFormula = uiTabPassmarks->labelEditPassmarkLength;
|
||||||
formulaData.labelResult = uiTabPassmarks->labelResultPassmarkLength;
|
formulaData.labelResult = uiTabPassmarks->labelResultPassmarkLength;
|
||||||
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
formulaData.checkZero = false;
|
formulaData.checkZero = true;
|
||||||
formulaData.checkLessThanZero = false;
|
formulaData.checkLessThanZero = true;
|
||||||
|
|
||||||
Eval(formulaData, flagFormulaPassmarkLength);
|
Eval(formulaData, flagFormulaPassmarkLength);
|
||||||
|
|
||||||
|
@ -2530,7 +2497,7 @@ void DialogSeamAllowance::DetailPinPointChanged()
|
||||||
topPinId == NULL_ID && bottomPinId == NULL_ID ? color = OkColor(this) : color = errorColor;
|
topPinId == NULL_ID && bottomPinId == NULL_ID ? color = OkColor(this) : color = errorColor;
|
||||||
|
|
||||||
m_ftb->SetTabText(TabOrder::Labels, tr("Labels") + '*');
|
m_ftb->SetTabText(TabOrder::Labels, tr("Labels") + '*');
|
||||||
const QIcon icon = QIcon::fromTheme("dialog-warning",
|
const QIcon icon = QIcon::fromTheme(QStringLiteral("dialog-warning"),
|
||||||
QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"));
|
QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"));
|
||||||
uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), icon);
|
uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), icon);
|
||||||
}
|
}
|
||||||
|
@ -2564,7 +2531,7 @@ void DialogSeamAllowance::PatternPinPointChanged()
|
||||||
topPinId == NULL_ID && bottomPinId == NULL_ID ? color = OkColor(this) : color = errorColor;
|
topPinId == NULL_ID && bottomPinId == NULL_ID ? color = OkColor(this) : color = errorColor;
|
||||||
|
|
||||||
m_ftb->SetTabText(TabOrder::Labels, tr("Labels") + '*');
|
m_ftb->SetTabText(TabOrder::Labels, tr("Labels") + '*');
|
||||||
const QIcon icon = QIcon::fromTheme("dialog-warning",
|
const QIcon icon = QIcon::fromTheme(QStringLiteral("dialog-warning"),
|
||||||
QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"));
|
QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"));
|
||||||
uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), icon);
|
uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), icon);
|
||||||
}
|
}
|
||||||
|
@ -2725,25 +2692,24 @@ auto DialogSeamAllowance::MainPathIsValid() const -> bool
|
||||||
QString error;
|
QString error;
|
||||||
if (FirstPointEqualLast(uiTabPaths->listWidgetMainPath, data, error))
|
if (FirstPointEqualLast(uiTabPaths->listWidgetMainPath, data, error))
|
||||||
{
|
{
|
||||||
uiTabPaths->helpLabel->setText(
|
uiTabPaths->helpLabel->setText(QStringLiteral("%1%2 %3").arg(
|
||||||
QString("%1%2 %3").arg(DialogWarningIcon(),
|
DialogWarningIcon(), tr("First point cannot be equal to the last point!"), error));
|
||||||
tr("First point cannot be equal to the last point!"), error));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
error.clear();
|
error.clear();
|
||||||
if (DoublePoints(uiTabPaths->listWidgetMainPath, data, error))
|
if (DoublePoints(uiTabPaths->listWidgetMainPath, data, error))
|
||||||
{
|
{
|
||||||
uiTabPaths->helpLabel->setText(QString("%1%2 %3")
|
uiTabPaths->helpLabel->setText(
|
||||||
.arg(DialogWarningIcon(), tr("You have double points!"), error));
|
QStringLiteral("%1%2 %3").arg(DialogWarningIcon(), tr("You have double points!"), error));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
error.clear();
|
error.clear();
|
||||||
if (DoubleCurves(uiTabPaths->listWidgetMainPath, data, error))
|
if (DoubleCurves(uiTabPaths->listWidgetMainPath, data, error))
|
||||||
{
|
{
|
||||||
uiTabPaths->helpLabel->setText(QString("%1%2 %3")
|
uiTabPaths->helpLabel->setText(
|
||||||
.arg(DialogWarningIcon(), tr("The same curve repeats twice!"), error));
|
QStringLiteral("%1%2 %3").arg(DialogWarningIcon(), tr("The same curve repeats twice!"), error));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2756,8 +2722,8 @@ auto DialogSeamAllowance::MainPathIsValid() const -> bool
|
||||||
error.clear();
|
error.clear();
|
||||||
if (InvalidSegment(uiTabPaths->listWidgetMainPath, data, error))
|
if (InvalidSegment(uiTabPaths->listWidgetMainPath, data, error))
|
||||||
{
|
{
|
||||||
uiTabPaths->helpLabel->setText(QString("%1%2 %3")
|
uiTabPaths->helpLabel->setText(
|
||||||
.arg(DialogWarningIcon(), tr("Invalid segment!"), error));
|
QStringLiteral("%1%2 %3").arg(DialogWarningIcon(), tr("Invalid segment!"), error));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2858,7 +2824,7 @@ auto DialogSeamAllowance::GetItemById(quint32 id) -> QListWidgetItem *
|
||||||
for (qint32 i = 0; i < uiTabPaths->listWidgetMainPath->count(); ++i)
|
for (qint32 i = 0; i < uiTabPaths->listWidgetMainPath->count(); ++i)
|
||||||
{
|
{
|
||||||
QListWidgetItem *item = uiTabPaths->listWidgetMainPath->item(i);
|
QListWidgetItem *item = uiTabPaths->listWidgetMainPath->item(i);
|
||||||
const VPieceNode node = qvariant_cast<VPieceNode>(item->data(Qt::UserRole));
|
const auto node = qvariant_cast<VPieceNode>(item->data(Qt::UserRole));
|
||||||
|
|
||||||
if (node.GetId() == id)
|
if (node.GetId() == id)
|
||||||
{
|
{
|
||||||
|
@ -2875,7 +2841,7 @@ auto DialogSeamAllowance::GetLastId() const -> quint32
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
{
|
{
|
||||||
QListWidgetItem *item = uiTabPaths->listWidgetMainPath->item(count-1);
|
QListWidgetItem *item = uiTabPaths->listWidgetMainPath->item(count-1);
|
||||||
const VPieceNode node = qvariant_cast<VPieceNode>(item->data(Qt::UserRole));
|
const auto node = qvariant_cast<VPieceNode>(item->data(Qt::UserRole));
|
||||||
return node.GetId();
|
return node.GetId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2905,7 +2871,7 @@ void DialogSeamAllowance::UpdateNodeSABefore(const QString &formula)
|
||||||
QListWidgetItem *rowItem = GetItemById(uiTabPaths->comboBoxNodes->currentData().toUInt());
|
QListWidgetItem *rowItem = GetItemById(uiTabPaths->comboBoxNodes->currentData().toUInt());
|
||||||
if (rowItem)
|
if (rowItem)
|
||||||
{
|
{
|
||||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||||
rowNode.SetFormulaSABefore(formula);
|
rowNode.SetFormulaSABefore(formula);
|
||||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||||
}
|
}
|
||||||
|
@ -2921,7 +2887,7 @@ void DialogSeamAllowance::UpdateNodeSAAfter(const QString &formula)
|
||||||
QListWidgetItem *rowItem = GetItemById(uiTabPaths->comboBoxNodes->currentData().toUInt());
|
QListWidgetItem *rowItem = GetItemById(uiTabPaths->comboBoxNodes->currentData().toUInt());
|
||||||
if (rowItem)
|
if (rowItem)
|
||||||
{
|
{
|
||||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||||
rowNode.SetFormulaSAAfter(formula);
|
rowNode.SetFormulaSAAfter(formula);
|
||||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||||
}
|
}
|
||||||
|
@ -2937,7 +2903,7 @@ void DialogSeamAllowance::UpdateNodePassmarkLength(const QString &formula)
|
||||||
QListWidgetItem *rowItem = GetItemById(uiTabPassmarks->comboBoxPassmarks->currentData().toUInt());
|
QListWidgetItem *rowItem = GetItemById(uiTabPassmarks->comboBoxPassmarks->currentData().toUInt());
|
||||||
if (rowItem)
|
if (rowItem)
|
||||||
{
|
{
|
||||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||||
rowNode.SetFormulaPassmarkLength(formula);
|
rowNode.SetFormulaPassmarkLength(formula);
|
||||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||||
}
|
}
|
||||||
|
@ -3098,7 +3064,7 @@ void DialogSeamAllowance::InitSeamAllowanceTab()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uiTabPaths->checkBoxBuiltIn->toggled(uiTabPaths->checkBoxBuiltIn->isChecked());
|
emit uiTabPaths->checkBoxBuiltIn->toggled(uiTabPaths->checkBoxBuiltIn->isChecked());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -3432,15 +3398,21 @@ void DialogSeamAllowance::InitPinsTab()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSeamAllowance::InitPassmarksTab()
|
void DialogSeamAllowance::InitPassmarksTab()
|
||||||
{
|
{
|
||||||
|
// Length formula
|
||||||
this->m_formulaBasePassmarkLength = uiTabPassmarks->plainTextEditPassmarkLength->height();
|
this->m_formulaBasePassmarkLength = uiTabPassmarks->plainTextEditPassmarkLength->height();
|
||||||
uiTabPassmarks->plainTextEditPassmarkLength->installEventFilter(this);
|
uiTabPassmarks->plainTextEditPassmarkLength->installEventFilter(this);
|
||||||
|
|
||||||
m_timerPassmarkLength->setSingleShot(true);
|
m_timerPassmarkLength->setSingleShot(true);
|
||||||
connect(m_timerPassmarkLength, &QTimer::timeout, this, &DialogSeamAllowance::EvalPassmarkLength);
|
|
||||||
|
|
||||||
|
connect(m_timerPassmarkLength, &QTimer::timeout, this, &DialogSeamAllowance::EvalPassmarkLength);
|
||||||
connect(uiTabPassmarks->groupBoxManualLength, &QGroupBox::toggled, this,
|
connect(uiTabPassmarks->groupBoxManualLength, &QGroupBox::toggled, this,
|
||||||
&DialogSeamAllowance::EnabledManualPassmarkLength);
|
&DialogSeamAllowance::EnabledManualPassmarkLength);
|
||||||
|
connect(uiTabPassmarks->toolButtonExprLength, &QPushButton::clicked, this, &DialogSeamAllowance::FXPassmarkLength);
|
||||||
|
connect(uiTabPassmarks->plainTextEditPassmarkLength, &QPlainTextEdit::textChanged, this,
|
||||||
|
[this]() { m_timerPassmarkLength->start(formulaTimerTimeout); });
|
||||||
|
connect(uiTabPassmarks->pushButtonGrowPassmarkLength, &QPushButton::clicked, this,
|
||||||
|
&DialogSeamAllowance::DeployPassmarkLength);
|
||||||
|
|
||||||
|
// notch list
|
||||||
InitPassmarksList();
|
InitPassmarksList();
|
||||||
connect(uiTabPassmarks->comboBoxPassmarks, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
connect(uiTabPassmarks->comboBoxPassmarks, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||||
this, &DialogSeamAllowance::PassmarkChanged);
|
this, &DialogSeamAllowance::PassmarkChanged);
|
||||||
|
@ -3458,15 +3430,6 @@ void DialogSeamAllowance::InitPassmarksTab()
|
||||||
#endif
|
#endif
|
||||||
connect(uiTabPassmarks->checkBoxShowSecondPassmark, &QCheckBox::stateChanged, this,
|
connect(uiTabPassmarks->checkBoxShowSecondPassmark, &QCheckBox::stateChanged, this,
|
||||||
&DialogSeamAllowance::PassmarkShowSecondChanged);
|
&DialogSeamAllowance::PassmarkShowSecondChanged);
|
||||||
connect(uiTabPassmarks->toolButtonExprLength, &QPushButton::clicked, this, &DialogSeamAllowance::FXPassmarkLength);
|
|
||||||
|
|
||||||
connect(uiTabPassmarks->plainTextEditPassmarkLength, &QPlainTextEdit::textChanged, this, [this]()
|
|
||||||
{
|
|
||||||
m_timerPassmarkLength->start(formulaTimerTimeout);
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(uiTabPassmarks->pushButtonGrowPassmarkLength, &QPushButton::clicked, this,
|
|
||||||
&DialogSeamAllowance::DeployPassmarkLength);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -3529,7 +3492,7 @@ void DialogSeamAllowance::SetFormulaSAWidth(const QString &formula)
|
||||||
|
|
||||||
if (not applyAllowed)
|
if (not applyAllowed)
|
||||||
{
|
{
|
||||||
VisToolPiece *path = qobject_cast<VisToolPiece *>(vis);
|
auto *path = qobject_cast<VisToolPiece *>(vis);
|
||||||
SCASSERT(path != nullptr)
|
SCASSERT(path != nullptr)
|
||||||
const VPiece p = CreatePiece();
|
const VPiece p = CreatePiece();
|
||||||
path->SetPiece(p);
|
path->SetPiece(p);
|
||||||
|
@ -3564,7 +3527,7 @@ void DialogSeamAllowance::UpdateCurrentCustomSARecord()
|
||||||
|
|
||||||
QListWidgetItem *item = uiTabPaths->listWidgetCustomSA->item(row);
|
QListWidgetItem *item = uiTabPaths->listWidgetCustomSA->item(row);
|
||||||
SCASSERT(item != nullptr);
|
SCASSERT(item != nullptr);
|
||||||
const CustomSARecord record = qvariant_cast<CustomSARecord>(item->data(Qt::UserRole));
|
const auto record = qvariant_cast<CustomSARecord>(item->data(Qt::UserRole));
|
||||||
item->setText(GetPathName(record.path, record.reverse));
|
item->setText(GetPathName(record.path, record.reverse));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3579,7 +3542,7 @@ void DialogSeamAllowance::UpdateCurrentInternalPathRecord()
|
||||||
|
|
||||||
QListWidgetItem *item = uiTabPaths->listWidgetInternalPaths->item(row);
|
QListWidgetItem *item = uiTabPaths->listWidgetInternalPaths->item(row);
|
||||||
SCASSERT(item != nullptr);
|
SCASSERT(item != nullptr);
|
||||||
const quint32 path = qvariant_cast<quint32>(item->data(Qt::UserRole));
|
const auto path = qvariant_cast<quint32>(item->data(Qt::UserRole));
|
||||||
item->setText(GetPathName(path));
|
item->setText(GetPathName(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3594,7 +3557,7 @@ void DialogSeamAllowance::UpdateCurrentPlaceLabelRecords()
|
||||||
|
|
||||||
QListWidgetItem *item = uiTabPlaceLabels->listWidgetPlaceLabels->item(row);
|
QListWidgetItem *item = uiTabPlaceLabels->listWidgetPlaceLabels->item(row);
|
||||||
SCASSERT(item != nullptr);
|
SCASSERT(item != nullptr);
|
||||||
const quint32 labelId = qvariant_cast<quint32>(item->data(Qt::UserRole));
|
const auto labelId = qvariant_cast<quint32>(item->data(Qt::UserRole));
|
||||||
item->setText(CurrentPlaceLabel(labelId).name());
|
item->setText(CurrentPlaceLabel(labelId).name());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3795,7 +3758,7 @@ void DialogSeamAllowance::ShowPieceSpecialPointsWithRect(const QListWidget *list
|
||||||
{
|
{
|
||||||
m_visSpecialPoints->VisualMode();
|
m_visSpecialPoints->VisualMode();
|
||||||
m_visSpecialPoints->setZValue(10); // pins should be on top
|
m_visSpecialPoints->setZValue(10); // pins should be on top
|
||||||
VToolSeamAllowance *tool = qobject_cast<VToolSeamAllowance*>(VAbstractPattern::getTool(toolId));
|
auto *tool = qobject_cast<VToolSeamAllowance *>(VAbstractPattern::getTool(toolId));
|
||||||
SCASSERT(tool != nullptr);
|
SCASSERT(tool != nullptr);
|
||||||
m_visSpecialPoints->setParentItem(tool);
|
m_visSpecialPoints->setParentItem(tool);
|
||||||
}
|
}
|
||||||
|
@ -3942,8 +3905,6 @@ void DialogSeamAllowance::InitGradationPlaceholdersMenu()
|
||||||
void DialogSeamAllowance::InitGradationPlaceholders()
|
void DialogSeamAllowance::InitGradationPlaceholders()
|
||||||
{
|
{
|
||||||
// Pattern tags
|
// Pattern tags
|
||||||
QLocale locale(VAbstractApplication::VApp()->Settings()->GetLocale());
|
|
||||||
|
|
||||||
QString heightValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHeight());
|
QString heightValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHeight());
|
||||||
m_gradationPlaceholders.insert(pl_height, qMakePair(tr("Height", "dimension"), heightValue));
|
m_gradationPlaceholders.insert(pl_height, qMakePair(tr("Height", "dimension"), heightValue));
|
||||||
m_gradationPlaceholders.insert(pl_dimensionX, qMakePair(tr("Dimension X", "dimension"), heightValue));
|
m_gradationPlaceholders.insert(pl_dimensionX, qMakePair(tr("Dimension X", "dimension"), heightValue));
|
||||||
|
@ -4096,7 +4057,7 @@ void DialogSeamAllowance::ManagePatternMaterials()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSeamAllowance::InsertGradationPlaceholder()
|
void DialogSeamAllowance::InsertGradationPlaceholder()
|
||||||
{
|
{
|
||||||
QAction *action = qobject_cast<QAction *>(sender());
|
auto *action = qobject_cast<QAction *>(sender());
|
||||||
if (action)
|
if (action)
|
||||||
{
|
{
|
||||||
uiTabPaths->lineEditGradationLabel->insert(action->data().toString());
|
uiTabPaths->lineEditGradationLabel->insert(action->data().toString());
|
||||||
|
|
|
@ -31,9 +31,6 @@
|
||||||
|
|
||||||
#include "../dialogtool.h"
|
#include "../dialogtool.h"
|
||||||
#include "../vpatterndb/vpiece.h"
|
#include "../vpatterndb/vpiece.h"
|
||||||
#include "../vpatterndb/floatItemData/vpatternlabeldata.h"
|
|
||||||
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
|
|
||||||
#include "../vpatterndb/floatItemData/vgrainlinedata.h"
|
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
|
@ -59,7 +56,7 @@ public:
|
||||||
DialogSeamAllowance(const VContainer *data, VAbstractPattern *doc, quint32 toolId,
|
DialogSeamAllowance(const VContainer *data, VAbstractPattern *doc, quint32 toolId,
|
||||||
QWidget *parent = nullptr);
|
QWidget *parent = nullptr);
|
||||||
DialogSeamAllowance(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
|
DialogSeamAllowance(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
|
||||||
virtual ~DialogSeamAllowance();
|
~DialogSeamAllowance() override;
|
||||||
|
|
||||||
void EnableApply(bool enable);
|
void EnableApply(bool enable);
|
||||||
|
|
||||||
|
@ -71,18 +68,18 @@ public:
|
||||||
auto UndoStack() -> QVector<QPointer<VUndoCommand>> &;
|
auto UndoStack() -> QVector<QPointer<VUndoCommand>> &;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void ChosenObject(quint32 id, const SceneObject &type) override;
|
void ChosenObject(quint32 id, const SceneObject &type) override;
|
||||||
virtual void ShowDialog(bool click) override;
|
void ShowDialog(bool click) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** @brief SaveData Put dialog data in local variables */
|
/** @brief SaveData Put dialog data in local variables */
|
||||||
virtual void SaveData() override;
|
void SaveData() override;
|
||||||
virtual void CheckState() final;
|
void CheckState() final;
|
||||||
virtual void closeEvent(QCloseEvent *event) override;
|
void closeEvent(QCloseEvent *event) override;
|
||||||
virtual void showEvent( QShowEvent *event ) override;
|
void showEvent(QShowEvent *event) override;
|
||||||
virtual void resizeEvent(QResizeEvent *event) override;
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
virtual auto IsValid() const -> bool final;
|
auto IsValid() const -> bool final;
|
||||||
virtual void SetPatternDoc(VAbstractPattern *doc) final;
|
void SetPatternDoc(VAbstractPattern *doc) final;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void NameDetailChanged();
|
void NameDetailChanged();
|
||||||
|
@ -177,68 +174,68 @@ private:
|
||||||
Ui::TabPassmarks *uiTabPassmarks;
|
Ui::TabPassmarks *uiTabPassmarks;
|
||||||
Ui::TabPlaceLabels *uiTabPlaceLabels;
|
Ui::TabPlaceLabels *uiTabPlaceLabels;
|
||||||
|
|
||||||
QWidget *m_tabPaths;
|
QWidget *m_tabPaths{nullptr};
|
||||||
QWidget *m_tabLabels;
|
QWidget *m_tabLabels{nullptr};
|
||||||
QWidget *m_tabGrainline;
|
QWidget *m_tabGrainline{nullptr};
|
||||||
QWidget *m_tabPins;
|
QWidget *m_tabPins{nullptr};
|
||||||
QWidget *m_tabPassmarks;
|
QWidget *m_tabPassmarks{nullptr};
|
||||||
QWidget *m_tabPlaceLabels;
|
QWidget *m_tabPlaceLabels{nullptr};
|
||||||
|
|
||||||
FancyTabBar* m_ftb;
|
FancyTabBar *m_ftb{nullptr};
|
||||||
|
|
||||||
bool applyAllowed;
|
bool applyAllowed{false}; // By default disabled
|
||||||
bool flagGPin;
|
bool flagGPin{false};
|
||||||
bool flagDPin;
|
bool flagDPin{false};
|
||||||
bool flagPPin;
|
bool flagPPin{false};
|
||||||
bool flagGFormulas;
|
bool flagGFormulas{true};
|
||||||
bool flagDLAngle;
|
bool flagDLAngle{true};
|
||||||
bool flagDLFormulas;
|
bool flagDLFormulas{true};
|
||||||
bool flagPLAngle;
|
bool flagPLAngle{true};
|
||||||
bool flagPLFormulas;
|
bool flagPLFormulas{true};
|
||||||
bool flagFormulaBefore;
|
bool flagFormulaBefore{true};
|
||||||
bool flagFormulaAfter;
|
bool flagFormulaAfter{true};
|
||||||
bool flagFormulaPassmarkLength{true};
|
bool flagFormulaPassmarkLength{true};
|
||||||
bool flagMainPathIsValid;
|
bool flagMainPathIsValid{true};
|
||||||
bool flagName;
|
bool flagName{true}; // We have default name of piece.
|
||||||
bool flagUUID;
|
bool flagUUID{true};
|
||||||
bool flagFormula;
|
bool flagFormula{true};
|
||||||
bool m_bAddMode;
|
bool m_bAddMode{true};
|
||||||
bool m_patternLabelDataChanged{false};
|
bool m_patternLabelDataChanged{false};
|
||||||
bool m_askSavePatternLabelData{false};
|
bool m_askSavePatternLabelData{false};
|
||||||
bool m_patternTemplateDataChanged{false};
|
bool m_patternTemplateDataChanged{false};
|
||||||
bool m_patternMaterialsChanged{false};
|
bool m_patternMaterialsChanged{false};
|
||||||
|
|
||||||
QPointer<DialogTool> m_dialog;
|
QPointer<DialogTool> m_dialog{};
|
||||||
QPointer<VisPieceSpecialPoints> m_visSpecialPoints;
|
QPointer<VisPieceSpecialPoints> m_visSpecialPoints{};
|
||||||
|
|
||||||
QVector<VLabelTemplateLine> m_patternTemplateLines{};
|
QVector<VLabelTemplateLine> m_patternTemplateLines{};
|
||||||
|
|
||||||
QMap<int, QString> m_patternMaterials{};
|
QMap<int, QString> m_patternMaterials{};
|
||||||
|
|
||||||
int m_iRotBaseHeight;
|
int m_iRotBaseHeight{0};
|
||||||
int m_iLenBaseHeight;
|
int m_iLenBaseHeight{0};
|
||||||
int m_DLWidthBaseHeight;
|
int m_DLWidthBaseHeight{0};
|
||||||
int m_DLHeightBaseHeight;
|
int m_DLHeightBaseHeight{0};
|
||||||
int m_DLAngleBaseHeight;
|
int m_DLAngleBaseHeight{0};
|
||||||
int m_PLWidthBaseHeight;
|
int m_PLWidthBaseHeight{0};
|
||||||
int m_PLHeightBaseHeight;
|
int m_PLHeightBaseHeight{0};
|
||||||
int m_PLAngleBaseHeight;
|
int m_PLAngleBaseHeight{0};
|
||||||
int m_formulaBaseWidth;
|
int m_formulaBaseWidth{0};
|
||||||
int m_formulaBaseWidthBefore;
|
int m_formulaBaseWidthBefore{0};
|
||||||
int m_formulaBaseWidthAfter;
|
int m_formulaBaseWidthAfter{0};
|
||||||
int m_formulaBasePassmarkLength{0};
|
int m_formulaBasePassmarkLength{0};
|
||||||
|
|
||||||
QTimer *m_timerWidth;
|
QTimer *m_timerWidth{nullptr};
|
||||||
QTimer *m_timerWidthBefore;
|
QTimer *m_timerWidthBefore{nullptr};
|
||||||
QTimer *m_timerWidthAfter;
|
QTimer *m_timerWidthAfter{nullptr};
|
||||||
QTimer *m_timerPassmarkLength;
|
QTimer *m_timerPassmarkLength{nullptr};
|
||||||
qreal m_saWidth;
|
qreal m_saWidth{0};
|
||||||
|
|
||||||
QVector<VLabelTemplateLine> m_templateLines;
|
QVector<VLabelTemplateLine> m_templateLines{};
|
||||||
|
|
||||||
QVector<QPointer<VUndoCommand>> m_undoStack;
|
QVector<QPointer<VUndoCommand>> m_undoStack{};
|
||||||
QHash<quint32, VPlaceLabelItem> m_newPlaceLabels;
|
QHash<quint32, VPlaceLabelItem> m_newPlaceLabels{};
|
||||||
QHash<quint32, VPiecePath> m_newPaths;
|
QHash<quint32, VPiecePath> m_newPaths{};
|
||||||
|
|
||||||
VAbstractPattern *m_doc{nullptr};
|
VAbstractPattern *m_doc{nullptr};
|
||||||
|
|
||||||
|
@ -325,9 +322,9 @@ private:
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline auto DialogSeamAllowance::IsValid() const -> bool
|
inline auto DialogSeamAllowance::IsValid() const -> bool
|
||||||
{
|
{
|
||||||
return flagName && flagUUID && flagMainPathIsValid && flagFormula && flagFormulaBefore && flagFormulaAfter
|
return flagName && flagUUID && flagMainPathIsValid && flagFormula && flagFormulaBefore && flagFormulaAfter &&
|
||||||
&& (flagGFormulas || flagGPin) && flagDLAngle && (flagDLFormulas || flagDPin) && flagPLAngle
|
(flagGFormulas || flagGPin) && flagDLAngle && (flagDLFormulas || flagDPin) && flagPLAngle &&
|
||||||
&& (flagPLFormulas || flagPPin) && flagFormulaPassmarkLength;
|
(flagPLFormulas || flagPPin) && flagFormulaPassmarkLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // DIALOGSEAMALLOWANCE_H
|
#endif // DIALOGSEAMALLOWANCE_H
|
||||||
|
|
|
@ -585,8 +585,8 @@ void VNodePoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(ContextMenuOption::LAST_ONE_DO_NOT_USE) == 33,
|
Q_STATIC_ASSERT_X(static_cast<int>(ContextMenuOption::LAST_ONE_DO_NOT_USE) == 33,
|
||||||
"Not all options were handled.");
|
"Not all options were handled.");
|
||||||
|
|
||||||
QT_WARNING_PUSH
|
QT_WARNING_PUSH
|
||||||
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
switch(selectedOption)
|
switch(selectedOption)
|
||||||
{
|
{
|
||||||
case ContextMenuOption::LAST_ONE_DO_NOT_USE:
|
case ContextMenuOption::LAST_ONE_DO_NOT_USE:
|
||||||
|
@ -700,7 +700,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
SelectPassmarkLine(PassmarkLineType::BoxMark);
|
SelectPassmarkLine(PassmarkLineType::BoxMark);
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -540,7 +540,7 @@ auto VAbstractTool::AddSANode(VAbstractPattern *doc, const QString &tagName, con
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
const unsigned char angleType = static_cast<unsigned char>(node.GetAngleType());
|
const auto angleType = static_cast<unsigned char>(node.GetAngleType());
|
||||||
|
|
||||||
if (angleType > 0)
|
if (angleType > 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -57,15 +57,17 @@
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||||
#include "../vmisc/backport/qoverload.h"
|
#include "../vmisc/backport/qoverload.h"
|
||||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||||
#include "nodeDetails/vtoolpin.h"
|
#include "../vformat/vlabeltemplate.h"
|
||||||
#include "nodeDetails/vnodepoint.h"
|
#include "../vpatterndb/floatItemData/vgrainlinedata.h"
|
||||||
#include "nodeDetails/vtoolpiecepath.h"
|
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
|
||||||
#include "nodeDetails/vnodearc.h"
|
#include "nodeDetails/vnodearc.h"
|
||||||
#include "nodeDetails/vnodeellipticalarc.h"
|
#include "nodeDetails/vnodeellipticalarc.h"
|
||||||
|
#include "nodeDetails/vnodepoint.h"
|
||||||
#include "nodeDetails/vnodespline.h"
|
#include "nodeDetails/vnodespline.h"
|
||||||
#include "nodeDetails/vnodesplinepath.h"
|
#include "nodeDetails/vnodesplinepath.h"
|
||||||
|
#include "nodeDetails/vtoolpiecepath.h"
|
||||||
|
#include "nodeDetails/vtoolpin.h"
|
||||||
#include "nodeDetails/vtoolplacelabel.h"
|
#include "nodeDetails/vtoolplacelabel.h"
|
||||||
#include "../vformat/vlabeltemplate.h"
|
|
||||||
|
|
||||||
#include <QFuture>
|
#include <QFuture>
|
||||||
#include <QtConcurrent/QtConcurrentRun>
|
#include <QtConcurrent/QtConcurrentRun>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user