Refactoring.
This commit is contained in:
parent
2fd78f68a5
commit
66e01d9994
|
@ -68,7 +68,9 @@ auto main(int argc, char *argv[]) -> int
|
|||
#endif
|
||||
|
||||
#ifndef Q_OS_MAC // supports natively
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
InitHighDpiScaling(argc, argv);
|
||||
#endif
|
||||
#endif //ndef Q_OS_MAC
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
|
|
|
@ -72,7 +72,9 @@ auto main(int argc, char *argv[]) -> int
|
|||
#endif
|
||||
|
||||
#ifndef Q_OS_MAC // supports natively
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
InitHighDpiScaling(argc, argv);
|
||||
#endif
|
||||
#endif //Q_OS_MAC
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
|
|
|
@ -78,7 +78,9 @@ auto main(int argc, char *argv[]) -> int
|
|||
REGISTER_META_TYPE_STREAM_OPERATORS(CustomSARecord);
|
||||
|
||||
#ifndef Q_OS_MAC // supports natively
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
InitHighDpiScaling(argc, argv);
|
||||
#endif
|
||||
#endif //Q_OS_MAC
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
#include "../vlayout/vlayoutgenerator.h"
|
||||
#include "dialogs/dialoglayoutprogress.h"
|
||||
#include "dialogs/dialogsavelayout.h"
|
||||
#include "../vlayout/vposter.h"
|
||||
#include "../vlayout/vlayoutexporter.h"
|
||||
#include "../vpatterndb/calculator.h"
|
||||
#include "../vtools/tools/vabstracttool.h"
|
||||
|
@ -1263,8 +1262,7 @@ auto MainWindowsNoGUI::OpenMeasurementFile(const QString &path) const -> QShared
|
|||
|
||||
if (m->Type() == MeasurementsType::Unknown)
|
||||
{
|
||||
VException e(tr("Measurement file has unknown format."));
|
||||
throw e;
|
||||
throw VException(tr("Measurement file has unknown format."));
|
||||
}
|
||||
|
||||
if (m->Type() == MeasurementsType::Multisize)
|
||||
|
@ -1280,8 +1278,7 @@ auto MainWindowsNoGUI::OpenMeasurementFile(const QString &path) const -> QShared
|
|||
|
||||
if (not m->IsDefinedKnownNamesValid())
|
||||
{
|
||||
VException e(tr("Measurement file contains invalid known measurement(s)."));
|
||||
throw e;
|
||||
throw VException(tr("Measurement file contains invalid known measurement(s)."));
|
||||
}
|
||||
|
||||
CheckRequiredMeasurements(m.data());
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*************************************************************************/
|
||||
|
||||
#include "vdxfengine.h"
|
||||
#include "qassert.h"
|
||||
#include <QLineF>
|
||||
|
||||
#include <QByteArray>
|
||||
|
@ -58,58 +59,58 @@
|
|||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
#include "../vmisc/diagnostic.h"
|
||||
#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/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, layer2, (UTF8STRING("2"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer3, (UTF8STRING("3"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer4, (UTF8STRING("4"))) // NOLINT
|
||||
//Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer5, (UTF8STRING("5"))) // NOLINT
|
||||
//Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer6, (UTF8STRING("6"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer7, (UTF8STRING("7"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer8, (UTF8STRING("8"))) // NOLINT
|
||||
//Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer9, (UTF8STRING("9"))) // NOLINT
|
||||
//Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer10, (UTF8STRING("10"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer11, (UTF8STRING("11"))) // NOLINT
|
||||
//Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer12, (UTF8STRING("12"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer13, (UTF8STRING("13"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer14, (UTF8STRING("14"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer15, (UTF8STRING("15"))) // NOLINT
|
||||
//Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer19, (UTF8STRING("19"))) // NOLINT
|
||||
//Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer26, (UTF8STRING("26"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer80, (UTF8STRING("80"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer81, (UTF8STRING("81"))) // NOLINT
|
||||
//Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer82, (UTF8STRING("82"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer83, (UTF8STRING("83"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer84, (UTF8STRING("84"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer85, (UTF8STRING("85"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer86, (UTF8STRING("86"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer87, (UTF8STRING("87"))) // NOLINT
|
||||
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, layer2, (UTF8STRING("2"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer3, (UTF8STRING("3"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer4, (UTF8STRING("4"))) // NOLINT
|
||||
// Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer5, (UTF8STRING("5"))) // NOLINT
|
||||
// Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer6, (UTF8STRING("6"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer7, (UTF8STRING("7"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer8, (UTF8STRING("8"))) // NOLINT
|
||||
// Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer9, (UTF8STRING("9"))) // NOLINT
|
||||
// Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer10, (UTF8STRING("10"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer11, (UTF8STRING("11"))) // NOLINT
|
||||
// Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer12, (UTF8STRING("12"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer13, (UTF8STRING("13"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer14, (UTF8STRING("14"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer15, (UTF8STRING("15"))) // NOLINT
|
||||
// Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer19, (UTF8STRING("19"))) // NOLINT
|
||||
// Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer26, (UTF8STRING("26"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer80, (UTF8STRING("80"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer81, (UTF8STRING("81"))) // NOLINT
|
||||
// Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer82, (UTF8STRING("82"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer83, (UTF8STRING("83"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer84, (UTF8STRING("84"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer85, (UTF8STRING("85"))) // 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>
|
||||
{
|
||||
QVector<VLayoutPoint> outline;
|
||||
if (detail.IsSeamAllowance() && not detail.IsSeamAllowanceBuiltIn())
|
||||
{
|
||||
outline = detail.GetMappedSeamAllowancePoints();
|
||||
}
|
||||
else
|
||||
{
|
||||
outline = detail.GetMappedContourPoints();
|
||||
}
|
||||
return outline;
|
||||
}
|
||||
} // namespace
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto PieceOutline(const VLayoutPiece &detail) -> QVector<VLayoutPoint>
|
||||
{
|
||||
QVector<VLayoutPoint> outline;
|
||||
if (detail.IsSeamAllowance() && not detail.IsSeamAllowanceBuiltIn())
|
||||
{
|
||||
outline = detail.GetMappedSeamAllowancePoints();
|
||||
}
|
||||
else
|
||||
{
|
||||
outline = detail.GetMappedContourPoints();
|
||||
}
|
||||
return outline;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
static inline auto svgEngineFeatures() -> QPaintEngine::PaintEngineFeatures
|
||||
|
@ -1166,42 +1167,50 @@ void VDxfEngine::ExportASTMNotch(const QSharedPointer<dx_ifaceBlock> &detailBloc
|
|||
|
||||
notch->angle = passmark.baseLine.angle();
|
||||
|
||||
if (passmark.type == PassmarkLineType::OneLine || passmark.type == PassmarkLineType::TwoLines
|
||||
|| passmark.type == PassmarkLineType::ThreeLines)
|
||||
{ // Slit notch
|
||||
notch->layer = *layer4;
|
||||
}
|
||||
else if (passmark.type == PassmarkLineType::VMark || passmark.type == PassmarkLineType::VMark2)
|
||||
{ // V-Notch
|
||||
QLineF boundaryLine(ConstFirst(passmark.lines).p2(), ConstLast(passmark.lines).p2());
|
||||
notch->thickness = FromPixel(boundaryLine.length(), m_varInsunits); // width
|
||||
switch (passmark.type)
|
||||
{
|
||||
case PassmarkLineType::OneLine:
|
||||
case PassmarkLineType::TwoLines:
|
||||
case PassmarkLineType::ThreeLines:
|
||||
// Slit notch
|
||||
notch->layer = *layer4;
|
||||
break;
|
||||
case PassmarkLineType::VMark:
|
||||
case PassmarkLineType::VMark2:
|
||||
{ // V-Notch
|
||||
QLineF boundaryLine(ConstFirst(passmark.lines).p2(), ConstLast(passmark.lines).p2());
|
||||
notch->thickness = FromPixel(boundaryLine.length(), m_varInsunits); // width
|
||||
notch->layer = *layer4;
|
||||
break;
|
||||
}
|
||||
case PassmarkLineType::TMark:
|
||||
// T-Notch
|
||||
notch->thickness = FromPixel(ConstLast(passmark.lines).length(), m_varInsunits); // width
|
||||
notch->layer = *layer80;
|
||||
break;
|
||||
case PassmarkLineType::BoxMark:
|
||||
{ // Castle Notch
|
||||
QPointF start = ConstFirst(passmark.lines).p1();
|
||||
QPointF end = ConstLast(passmark.lines).p2();
|
||||
|
||||
notch->layer = *layer4;
|
||||
}
|
||||
else if (passmark.type == PassmarkLineType::TMark)
|
||||
{ // T-Notch
|
||||
notch->thickness = FromPixel(ConstLast(passmark.lines).length(), m_varInsunits); // width
|
||||
notch->layer = *layer81;
|
||||
notch->thickness = FromPixel(QLineF(start, end).length(), m_varInsunits); // width
|
||||
break;
|
||||
}
|
||||
case PassmarkLineType::UMark:
|
||||
{ // U-Notch
|
||||
QPointF start = ConstFirst(passmark.lines).p1();
|
||||
QPointF end = ConstLast(passmark.lines).p2();
|
||||
|
||||
notch->layer = *layer80;
|
||||
}
|
||||
else if (passmark.type == PassmarkLineType::BoxMark)
|
||||
{ // Castle Notch
|
||||
QPointF start = ConstFirst(passmark.lines).p1();
|
||||
QPointF end = ConstLast(passmark.lines).p2();
|
||||
notch->thickness = FromPixel(QLineF(start, end).length(), m_varInsunits); // width
|
||||
|
||||
notch->layer = *layer81;
|
||||
|
||||
notch->thickness = FromPixel(QLineF(start, end).length(), m_varInsunits); // width
|
||||
}
|
||||
else if (passmark.type == PassmarkLineType::UMark)
|
||||
{ // U-Notch
|
||||
QPointF start = ConstFirst(passmark.lines).p1();
|
||||
QPointF end = ConstLast(passmark.lines).p2();
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -62,7 +62,9 @@ public:
|
|||
|
||||
Q_DECL_CONSTEXPR auto GetSABefore() const -> qreal;
|
||||
Q_DECL_CONSTEXPR auto GetSAAfter() const -> qreal;
|
||||
|
||||
Q_DECL_CONSTEXPR auto GetAngleType() const -> PieceNodeAngle;
|
||||
|
||||
Q_DECL_CONSTEXPR auto IsManualPasskmarkLength() const -> bool;
|
||||
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 SetAngleType(PieceNodeAngle value);
|
||||
|
||||
Q_DECL_RELAXED_CONSTEXPR void SetManualPasskmarkLength(bool value);
|
||||
Q_DECL_RELAXED_CONSTEXPR void SetPasskmarkLength(qreal value);
|
||||
|
||||
|
|
|
@ -54,6 +54,8 @@
|
|||
#include <QDesktopServices>
|
||||
#include <QUrl>
|
||||
|
||||
#include "qassert.h"
|
||||
#include "qtpreprocessorsupport.h"
|
||||
#include "vabstractapplication.h"
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
||||
# 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
|
||||
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 */
|
||||
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(6, 0, 0)
|
||||
QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
|
||||
#endif
|
||||
#else
|
||||
qputenv("QT_DEVICE_PIXEL_RATIO", QByteArray("1"));
|
||||
#endif
|
||||
|
@ -295,13 +296,15 @@ void InitHighDpiScaling(int argc, char *argv[])
|
|||
else
|
||||
{
|
||||
#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
|
||||
#endif
|
||||
#else
|
||||
qputenv("QT_AUTO_SCREEN_SCALE_FACTOR", QByteArray("1"));
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
Q_UNUSED(argc);
|
||||
Q_UNUSED(argv);
|
||||
#endif
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -357,7 +360,8 @@ auto PassmarkLineTypeToString(PassmarkLineType type) -> QString
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
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))
|
||||
{
|
||||
|
@ -414,14 +418,9 @@ auto PassmarkAngleTypeToString(PassmarkAngleType type) -> QString
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto StringToPassmarkAngleType(const QString &value) -> PassmarkAngleType
|
||||
{
|
||||
const QStringList values = QStringList() << strStraightforward
|
||||
<< strBisector
|
||||
<< strIntersection
|
||||
<< strIntersectionOnlyLeft
|
||||
<< strIntersectionOnlyRight
|
||||
<< strIntersection2
|
||||
<< strIntersection2OnlyLeft
|
||||
<< strIntersection2OnlyRight;
|
||||
const QStringList values{
|
||||
strStraightforward, strBisector, strIntersection, strIntersectionOnlyLeft,
|
||||
strIntersectionOnlyRight, strIntersection2, strIntersection2OnlyLeft, strIntersection2OnlyRight};
|
||||
|
||||
switch(values.indexOf(value))
|
||||
{
|
||||
|
@ -451,25 +450,19 @@ auto StringToPassmarkAngleType(const QString &value) -> PassmarkAngleType
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto StrToUnits(const QString &unit) -> Unit
|
||||
{
|
||||
const QStringList units = QStringList() << unitMM << unitCM << unitINCH << unitPX;
|
||||
Unit result = Unit::Cm;
|
||||
const QStringList units{unitMM, unitCM, unitINCH, unitPX};
|
||||
switch (units.indexOf(unit))
|
||||
{
|
||||
case 0:// mm
|
||||
result = Unit::Mm;
|
||||
break;
|
||||
return Unit::Mm;
|
||||
case 2:// inch
|
||||
result = Unit::Inch;
|
||||
break;
|
||||
return Unit::Inch;
|
||||
case 3:// px
|
||||
result = Unit::Px;
|
||||
break;
|
||||
return Unit::Px;
|
||||
case 1:// cm
|
||||
default:
|
||||
result = Unit::Cm;
|
||||
break;
|
||||
return Unit::Cm;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -483,26 +476,21 @@ auto StrToUnits(const QString &unit) -> Unit
|
|||
*/
|
||||
auto UnitsToStr(const Unit &unit, const bool translate) -> QString
|
||||
{
|
||||
QString result;
|
||||
switch (unit)
|
||||
{
|
||||
case Unit::Mm:
|
||||
translate ? result = QObject::tr("mm") : result = unitMM;
|
||||
break;
|
||||
return translate ? QObject::tr("mm") : unitMM;
|
||||
case Unit::Inch:
|
||||
translate ? result = QObject::tr("inch") : result = unitINCH;
|
||||
break;
|
||||
return translate ? QObject::tr("inch") : unitINCH;
|
||||
case Unit::Px:
|
||||
translate ? result = QObject::tr("px") : result = unitPX;
|
||||
break;
|
||||
return translate ? QObject::tr("px") : unitPX;
|
||||
case Unit::LAST_UNIT_DO_NOT_USE:
|
||||
Q_UNREACHABLE();
|
||||
break;
|
||||
case Unit::Cm:
|
||||
default:
|
||||
translate ? result = QObject::tr("cm") : result = unitCM;
|
||||
break;
|
||||
return translate ? QObject::tr("cm") : unitCM;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -108,13 +108,13 @@ enum class PieceNodeAngle : quint8
|
|||
enum class PassmarkLineType : quint8
|
||||
{
|
||||
OneLine = 0, // Default
|
||||
TwoLines,
|
||||
ThreeLines,
|
||||
TMark,
|
||||
VMark,
|
||||
VMark2,
|
||||
UMark,
|
||||
BoxMark,
|
||||
TwoLines = 1,
|
||||
ThreeLines = 2,
|
||||
TMark = 3,
|
||||
VMark = 4,
|
||||
VMark2 = 5,
|
||||
UMark = 6,
|
||||
BoxMark = 7,
|
||||
LAST_ONE_DO_NOT_USE
|
||||
};
|
||||
|
||||
|
@ -409,9 +409,18 @@ const int userMaterialPlaceholdersQuantity = 20;
|
|||
auto QPixmapFromCache(const QString &pixmapPath) -> QPixmap;
|
||||
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 CmToPixel(T val) -> T { return ((val * 10.0) / 25.4) * PrintDPI; }
|
||||
template<typename T> constexpr inline auto InchToPixel(T val) -> T { return val * PrintDPI; }
|
||||
template <typename T> constexpr inline auto MmToPixel(T val) noexcept -> T
|
||||
{
|
||||
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
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include <QString>
|
||||
|
||||
#include "vpatternlabeldata.h"
|
||||
#include "floatitemdef.h"
|
||||
|
||||
class VPieceLabelDataPrivate;
|
||||
struct VLabelTemplateLine;
|
||||
|
@ -47,7 +46,7 @@ public:
|
|||
VPieceLabelData();
|
||||
VPieceLabelData(const VPieceLabelData &data);
|
||||
|
||||
virtual ~VPieceLabelData();
|
||||
~VPieceLabelData() override;
|
||||
|
||||
auto operator=(const VPieceLabelData &data) -> VPieceLabelData &;
|
||||
#ifdef Q_COMPILER_RVALUE_REFS
|
||||
|
@ -59,34 +58,34 @@ public:
|
|||
|
||||
// methods, which operate on other members
|
||||
auto GetLetter() const -> QString;
|
||||
void SetLetter(const QString &qsLetter);
|
||||
void SetLetter(const QString &qsLetter);
|
||||
|
||||
auto GetAnnotation() const -> QString;
|
||||
void SetAnnotation(const QString &val);
|
||||
void SetAnnotation(const QString &val);
|
||||
|
||||
auto GetOrientation() const -> QString;
|
||||
void SetOrientation(const QString &val);
|
||||
void SetOrientation(const QString &val);
|
||||
|
||||
auto GetRotationWay() const -> QString;
|
||||
void SetRotationWay(const QString &val);
|
||||
void SetRotationWay(const QString &val);
|
||||
|
||||
auto GetTilt() const -> QString;
|
||||
void SetTilt(const QString &val);
|
||||
void SetTilt(const QString &val);
|
||||
|
||||
auto GetFoldPosition() const -> QString;
|
||||
void SetFoldPosition(const QString &val);
|
||||
void SetFoldPosition(const QString &val);
|
||||
|
||||
auto GetQuantity() const -> quint16;
|
||||
void SetQuantity(quint16 val);
|
||||
void SetQuantity(quint16 val);
|
||||
|
||||
auto IsOnFold() const -> bool;
|
||||
void SetOnFold(bool onFold);
|
||||
|
||||
auto GetAreaShartName() const -> QString;
|
||||
void SetAreaShartName(const QString &val);
|
||||
void SetAreaShartName(const QString &val);
|
||||
|
||||
auto GetLabelTemplate() const -> QVector<VLabelTemplateLine>;
|
||||
void SetLabelTemplate(const QVector<VLabelTemplateLine> &lines);
|
||||
void SetLabelTemplate(const QVector<VLabelTemplateLine> &lines);
|
||||
|
||||
private:
|
||||
QSharedDataPointer<VPieceLabelDataPrivate> d;
|
||||
|
|
|
@ -179,14 +179,13 @@ auto VContainer::GetGObject(quint32 id) const -> const QSharedPointer<VGObject>
|
|||
{
|
||||
return d->calculationObjects.value(id);
|
||||
}
|
||||
else if (d->modelingObjects->contains(id))
|
||||
|
||||
if (d->modelingObjects->contains(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
|
||||
{
|
||||
const qreal passmarkGap = MmToPixel(1.5);
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto GetSeamPassmarkSAPoint(const VPiecePassmarkData &passmarkData, const QVector<QPointF> &seamAllowance,
|
||||
QPointF &point) -> PassmarkStatus
|
||||
|
@ -62,7 +64,7 @@ auto GetSeamPassmarkSAPoint(const VPiecePassmarkData &passmarkData, const QVecto
|
|||
return PassmarkStatus::Error; // Something wrong
|
||||
}
|
||||
|
||||
point = ConstFirst(ekvPoints);
|
||||
point = ConstFirst(ekvPoints); // NOLINT(cppcoreguidelines-slicing)
|
||||
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));
|
||||
const QVector<QPointF> points = VAbstractCurve::CurveIntersectLine(seamAllowance, axis);
|
||||
|
||||
if (points.size() > 0)
|
||||
if (!points.empty())
|
||||
{
|
||||
if (points.size() == 1)
|
||||
{
|
||||
|
@ -125,12 +127,11 @@ auto FixNotchPoint(const QVector<QPointF> &seamAllowance, const QPointF ¬chBa
|
|||
|
||||
return fixed;
|
||||
}
|
||||
const qreal passmarkGap = MmToPixel(1.5);
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
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;
|
||||
if (points.size() >= 2)
|
||||
{
|
||||
lines.reserve(points.size() - 1);
|
||||
for (int i=0; i < points.size()-1; ++i)
|
||||
{
|
||||
QLineF segment = QLineF(points.at(i), points.at(i+1));
|
||||
|
@ -414,7 +416,7 @@ auto CreatePassmarkLines(PassmarkLineType lineType, PassmarkAngleType angleType,
|
|||
{
|
||||
if (lines.isEmpty())
|
||||
{
|
||||
return QVector<QLineF>();
|
||||
return {};
|
||||
}
|
||||
|
||||
QVector<QLineF> passmarksLines;
|
||||
|
@ -590,7 +592,7 @@ auto PassmarkBisectorBaseLine(PassmarkStatus seamPassmarkType, const VPiecePassm
|
|||
}
|
||||
else
|
||||
{ // Should never happen
|
||||
return QVector<QLineF>();
|
||||
return {};
|
||||
}
|
||||
|
||||
bool ok = false;
|
||||
|
@ -598,13 +600,13 @@ auto PassmarkBisectorBaseLine(PassmarkStatus seamPassmarkType, const VPiecePassm
|
|||
ok);
|
||||
if (not ok)
|
||||
{
|
||||
return QVector<QLineF>();
|
||||
return {};
|
||||
}
|
||||
|
||||
edge1.setAngle(edge1.angle() + edge1.angleTo(edge2)/2.);
|
||||
edge1.setLength(length);
|
||||
|
||||
return QVector<QLineF>({edge1});
|
||||
return {edge1};
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -623,7 +625,7 @@ auto PassmarkToPath(const QVector<QLineF> &passmark) -> QPainterPath
|
|||
}
|
||||
return path;
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
//------------------------------VPiecePassmarkData---------------------------------------------------------------------
|
||||
auto VPiecePassmarkData::toJson() const -> QJsonObject
|
||||
|
@ -648,10 +650,6 @@ auto VPiecePassmarkData::toJson() const -> QJsonObject
|
|||
return dataObject;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPassmark::VPassmark()
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPassmark::VPassmark(const VPiecePassmarkData &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);
|
||||
if (not intersections.isEmpty())
|
||||
{
|
||||
return QLineF(line.p1(), ConstLast(intersections));
|
||||
return {line.p1(), ConstLast(intersections)};
|
||||
}
|
||||
|
||||
return line;
|
||||
|
@ -777,13 +775,13 @@ auto VPassmark::BuiltInSAPassmark(const VPiece &piece, const VContainer *data) c
|
|||
{
|
||||
if (m_null)
|
||||
{
|
||||
return QVector<QLineF>();
|
||||
return {};
|
||||
}
|
||||
|
||||
const QVector<QLineF> lines = BuiltInSAPassmarkBaseLine(piece);
|
||||
if (lines.isEmpty())
|
||||
{
|
||||
return QVector<QLineF>();
|
||||
return {};
|
||||
}
|
||||
|
||||
QVector<QPointF> points;
|
||||
|
@ -796,7 +794,7 @@ auto VPassmark::BuiltInSAPassmarkBaseLine(const VPiece &piece) const -> QVector<
|
|||
{
|
||||
if (m_null)
|
||||
{
|
||||
return QVector<QLineF>();
|
||||
return {};
|
||||
}
|
||||
|
||||
qreal length = 0;
|
||||
|
@ -970,13 +968,15 @@ auto VPassmark::SAPassmarkBaseLine(const QVector<QPointF> &seamAllowance, const
|
|||
line.setLength(length);
|
||||
return {line};
|
||||
}
|
||||
else if (m_data.passmarkAngleType == PassmarkAngleType::Bisector)
|
||||
|
||||
if (m_data.passmarkAngleType == PassmarkAngleType::Bisector)
|
||||
{
|
||||
return PassmarkBisectorBaseLine(seamPassmarkType, m_data, seamPassmarkSAPoint, path);
|
||||
}
|
||||
else if (m_data.passmarkAngleType == PassmarkAngleType::Intersection
|
||||
|| m_data.passmarkAngleType == PassmarkAngleType::IntersectionOnlyLeft
|
||||
|| m_data.passmarkAngleType == PassmarkAngleType::IntersectionOnlyRight)
|
||||
|
||||
if (m_data.passmarkAngleType == PassmarkAngleType::Intersection ||
|
||||
m_data.passmarkAngleType == PassmarkAngleType::IntersectionOnlyLeft ||
|
||||
m_data.passmarkAngleType == PassmarkAngleType::IntersectionOnlyRight)
|
||||
{
|
||||
QVector<QLineF> lines;
|
||||
if ((m_data.passmarkAngleType == PassmarkAngleType::Intersection
|
||||
|
@ -999,9 +999,10 @@ auto VPassmark::SAPassmarkBaseLine(const QVector<QPointF> &seamAllowance, const
|
|||
|
||||
return lines;
|
||||
}
|
||||
else if (m_data.passmarkAngleType == PassmarkAngleType::Intersection2
|
||||
|| m_data.passmarkAngleType == PassmarkAngleType::Intersection2OnlyLeft
|
||||
|| m_data.passmarkAngleType == PassmarkAngleType::Intersection2OnlyRight)
|
||||
|
||||
if (m_data.passmarkAngleType == PassmarkAngleType::Intersection2 ||
|
||||
m_data.passmarkAngleType == PassmarkAngleType::Intersection2OnlyLeft ||
|
||||
m_data.passmarkAngleType == PassmarkAngleType::Intersection2OnlyRight)
|
||||
{
|
||||
QVector<QLineF> lines;
|
||||
if ((m_data.passmarkAngleType == PassmarkAngleType::Intersection2
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include <QMetaType>
|
||||
|
||||
#include "vpiece.h"
|
||||
#include "../vgeometry/vgeometrydef.h"
|
||||
#include "../vmisc/typedef.h"
|
||||
|
||||
class QPainterPath;
|
||||
|
@ -49,24 +48,26 @@ QT_WARNING_DISABLE_GCC("-Weffc++")
|
|||
|
||||
struct VPiecePassmarkData
|
||||
{
|
||||
VSAPoint previousSAPoint{};
|
||||
VSAPoint passmarkSAPoint{};
|
||||
VSAPoint nextSAPoint{};
|
||||
qreal saWidth{0};
|
||||
QString nodeName{};
|
||||
QString pieceName{};
|
||||
PassmarkLineType passmarkLineType{PassmarkLineType::OneLine};
|
||||
PassmarkAngleType passmarkAngleType{PassmarkAngleType::Straightforward};
|
||||
bool isMainPathNode{true};
|
||||
bool isShowSecondPassmark{true};
|
||||
vsizetype passmarkIndex{-1};
|
||||
vidtype id{NULL_ID};
|
||||
qreal globalPassmarkLength{0};
|
||||
VSAPoint previousSAPoint{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||
VSAPoint passmarkSAPoint{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||
VSAPoint nextSAPoint{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||
qreal saWidth{0}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||
QString nodeName{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||
QString pieceName{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||
PassmarkLineType passmarkLineType{// NOLINT(misc-non-private-member-variables-in-classes)
|
||||
PassmarkLineType::OneLine};
|
||||
PassmarkAngleType passmarkAngleType{// NOLINT(misc-non-private-member-variables-in-classes)
|
||||
PassmarkAngleType::Straightforward};
|
||||
bool isMainPathNode{true}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||
bool isShowSecondPassmark{true}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||
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;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(VPiecePassmarkData)
|
||||
Q_DECLARE_METATYPE(VPiecePassmarkData) // NOLINT
|
||||
Q_DECLARE_TYPEINFO(VPiecePassmarkData, Q_MOVABLE_TYPE); // NOLINT
|
||||
|
||||
QT_WARNING_POP
|
||||
|
@ -76,7 +77,7 @@ enum class PassmarkSide : qint8 { All=0, Left=1, Right=2 };
|
|||
class VPassmark
|
||||
{
|
||||
public:
|
||||
VPassmark();
|
||||
VPassmark() = default;
|
||||
explicit VPassmark(const VPiecePassmarkData &data);
|
||||
|
||||
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())
|
||||
{
|
||||
return QVector<VSAPoint>();
|
||||
return {};
|
||||
}
|
||||
|
||||
const VPieceNode &node = path.at(index);
|
||||
|
@ -1053,7 +1053,7 @@ auto VPiece::CreatePassmark(const QVector<VPieceNode> &path, vsizetype previousI
|
|||
|
||||
if (not IsPassmarkVisible(path, passmarkIndex))
|
||||
{
|
||||
return VPassmark();
|
||||
return {};
|
||||
}
|
||||
|
||||
VSAPoint passmarkSAPoint;
|
||||
|
@ -1063,26 +1063,26 @@ auto VPiece::CreatePassmark(const QVector<VPieceNode> &path, vsizetype previousI
|
|||
.arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName());
|
||||
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||
return VPassmark();
|
||||
return {};
|
||||
}
|
||||
|
||||
VSAPoint previousSAPoint;
|
||||
if (not GetPassmarkPreviousSAPoints(path, previousIndex, passmarkSAPoint, data, previousSAPoint, passmarkIndex))
|
||||
{
|
||||
// No check here because it will cover valid cases
|
||||
return VPassmark(); // Something wrong
|
||||
return {}; // Something wrong
|
||||
}
|
||||
|
||||
VSAPoint nextSAPoint;
|
||||
if (not GetPassmarkNextSAPoints(path, nextIndex, passmarkSAPoint, data, nextSAPoint, passmarkIndex))
|
||||
{
|
||||
// No check here because it will cover valid cases
|
||||
return VPassmark(); // Something wrong
|
||||
return {}; // Something wrong
|
||||
}
|
||||
|
||||
if (passmarkSAPoint.IsManualPasskmarkLength() && passmarkSAPoint.GetPasskmarkLength() <= 0)
|
||||
{
|
||||
return VPassmark();
|
||||
return {};
|
||||
}
|
||||
|
||||
if (passmarkSAPoint.IsManualPasskmarkLength()
|
||||
|
@ -1096,7 +1096,7 @@ auto VPiece::CreatePassmark(const QVector<VPieceNode> &path, vsizetype previousI
|
|||
#else
|
||||
qWarning() << VAbstractValApplication::warningMessageSignature + infoMsg;
|
||||
#endif
|
||||
return VPassmark();
|
||||
return {};
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
qreal length = 0;
|
||||
QString passmarkLengthVariable = VAbstractValApplication::VApp()->getCurrentDocument()->GetPassmarkLengthVariable();
|
||||
if (passmarkLengthVariable.isEmpty())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
qreal length = 0;
|
||||
|
||||
try
|
||||
{
|
||||
QSharedPointer<VInternalVariable> var = data->GetVariable<VInternalVariable>(passmarkLengthVariable);
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
friend auto operator>>(QDataStream &in, VPieceNode &p) -> QDataStream &;
|
||||
|
||||
auto GetId() const -> quint32;
|
||||
void SetId(quint32 id);
|
||||
void SetId(quint32 id);
|
||||
|
||||
auto GetTypeTool() const -> Tool;
|
||||
void SetTypeTool(Tool value);
|
||||
|
@ -72,21 +72,21 @@ public:
|
|||
auto GetSABefore(const VContainer *data, Unit unit) const -> qreal;
|
||||
|
||||
auto GetFormulaSABefore() const -> QString;
|
||||
void SetFormulaSABefore(const QString &formula);
|
||||
void SetFormulaSABefore(const QString &formula);
|
||||
|
||||
auto GetSAAfter(const VContainer *data) const -> qreal;
|
||||
auto GetSAAfter(const VContainer *data, Unit unit) const -> qreal;
|
||||
|
||||
auto GetFormulaSAAfter() const -> QString;
|
||||
void SetFormulaSAAfter(const QString &formula);
|
||||
void SetFormulaSAAfter(const QString &formula);
|
||||
|
||||
auto GetFormulaPassmarkLength() const -> QString;
|
||||
void SetFormulaPassmarkLength(const QString &formula);
|
||||
void SetFormulaPassmarkLength(const QString &formula);
|
||||
|
||||
auto GetPassmarkLength(const VContainer *data, Unit unit) const -> qreal;
|
||||
|
||||
auto GetAngleType() const -> PieceNodeAngle;
|
||||
void SetAngleType(PieceNodeAngle type);
|
||||
void SetAngleType(PieceNodeAngle type);
|
||||
|
||||
auto IsPassmark() const -> bool;
|
||||
void SetPassmark(bool passmark);
|
||||
|
@ -95,10 +95,10 @@ public:
|
|||
void SetMainPathNode(bool value);
|
||||
|
||||
auto GetPassmarkLineType() const -> PassmarkLineType;
|
||||
void SetPassmarkLineType(PassmarkLineType lineType);
|
||||
void SetPassmarkLineType(PassmarkLineType lineType);
|
||||
|
||||
auto GetPassmarkAngleType() const -> PassmarkAngleType;
|
||||
void SetPassmarkAngleType(PassmarkAngleType angleType);
|
||||
void SetPassmarkAngleType(PassmarkAngleType angleType);
|
||||
|
||||
auto IsShowSecondPassmark() const -> bool;
|
||||
void SetShowSecondPassmark(bool value);
|
||||
|
|
|
@ -71,43 +71,45 @@ public:
|
|||
friend auto operator>>(QDataStream &in, VPieceNodeData &p) -> QDataStream &;
|
||||
|
||||
/** @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 */
|
||||
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. */
|
||||
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
|
||||
* 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. */
|
||||
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. */
|
||||
bool m_isMainPathNode{true};
|
||||
bool m_isMainPathNode{true}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||
|
||||
QString m_formulaWidthBefore{currentSeamAllowance};
|
||||
QString m_formulaWidthAfter{currentSeamAllowance};
|
||||
QString m_formulaPassmarkLength{};
|
||||
QString m_formulaWidthBefore{currentSeamAllowance}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||
QString m_formulaWidthAfter{currentSeamAllowance}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||
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};
|
||||
PassmarkAngleType m_passmarkAngleType{PassmarkAngleType::Straightforward};
|
||||
PassmarkLineType m_passmarkLineType{// NOLINT(misc-non-private-member-variables-in-classes)
|
||||
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.
|
||||
* 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.*/
|
||||
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:
|
||||
Q_DISABLE_ASSIGN_MOVE(VPieceNodeData) // NOLINT
|
||||
|
@ -124,35 +126,20 @@ constexpr quint16 VPieceNodeData::classVersion; // NOLINT(readability-redundant
|
|||
|
||||
// Friend functions
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto operator<<(QDataStream &out, const VPieceNodeData &p) -> QDataStream &
|
||||
inline auto operator<<(QDataStream &out, const VPieceNodeData &p) -> QDataStream &
|
||||
{
|
||||
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
|
||||
<< 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;
|
||||
out << p.m_id << p.m_typeTool << p.m_reverse << 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
|
||||
<< p.m_turnPoint;
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto operator>>(QDataStream &in, VPieceNodeData &p) -> QDataStream &
|
||||
inline auto operator>>(QDataStream &in, VPieceNodeData &p) -> QDataStream &
|
||||
{
|
||||
quint32 actualStreamHeader = 0;
|
||||
in >> actualStreamHeader;
|
||||
|
|
|
@ -54,29 +54,17 @@ auto CuttingPath(quint32 id, const VContainer *data) -> QVector<QPointF>
|
|||
|
||||
return path;
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogPiecePath::DialogPiecePath(const VContainer *data, quint32 toolId, QWidget *parent)
|
||||
: DialogTool(data, toolId, parent),
|
||||
ui(new Ui::DialogPiecePath),
|
||||
m_showMode(false),
|
||||
m_saWidth(0),
|
||||
m_timerWidth(new QTimer(this)),
|
||||
m_timerWidthBefore(new QTimer(this)),
|
||||
m_timerWidthAfter(new QTimer(this)),
|
||||
m_timerVisible(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)
|
||||
: DialogTool(data, toolId, parent),
|
||||
ui(new Ui::DialogPiecePath),
|
||||
m_timerWidth(new QTimer(this)),
|
||||
m_timerWidthBefore(new QTimer(this)),
|
||||
m_timerWidthAfter(new QTimer(this)),
|
||||
m_timerVisible(new QTimer(this)),
|
||||
m_timerPassmarkLength(new QTimer(this))
|
||||
{
|
||||
ui->setupUi(this);
|
||||
InitOkCancel(ui);
|
||||
|
@ -200,7 +188,7 @@ void DialogPiecePath::ChosenObject(quint32 id, const SceneObject &type)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPiecePath::ShowDialog(bool click)
|
||||
{
|
||||
if (click == false)
|
||||
if (not click)
|
||||
{
|
||||
if (CreatePath().CountNodes() > 0)
|
||||
{
|
||||
|
@ -252,7 +240,7 @@ void DialogPiecePath::CheckState()
|
|||
}
|
||||
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"));
|
||||
ui->tabWidget->setTabIcon(tabSeamAllowanceIndex, icon);
|
||||
}
|
||||
|
@ -266,7 +254,7 @@ void DialogPiecePath::CheckState()
|
|||
}
|
||||
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"));
|
||||
ui->tabWidget->setTabIcon(tabControlIndex, icon);
|
||||
}
|
||||
|
@ -283,7 +271,7 @@ void DialogPiecePath::CheckState()
|
|||
}
|
||||
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"));
|
||||
ui->tabWidget->setTabIcon(tabPassmarksIndex, icon);
|
||||
}
|
||||
|
@ -298,7 +286,7 @@ void DialogPiecePath::ShowVisualization()
|
|||
|
||||
if (m_showMode)
|
||||
{
|
||||
VToolSeamAllowance *tool = qobject_cast<VToolSeamAllowance*>(VAbstractPattern::getTool(GetPieceId()));
|
||||
auto *tool = qobject_cast<VToolSeamAllowance *>(VAbstractPattern::getTool(GetPieceId()));
|
||||
SCASSERT(tool != nullptr);
|
||||
auto *visPath = qobject_cast<VisToolPiecePath *>(vis);
|
||||
SCASSERT(visPath != nullptr);
|
||||
|
@ -366,7 +354,7 @@ void DialogPiecePath::ShowContextMenu(const QPoint &pos)
|
|||
actionExcluded->setCheckable(true);
|
||||
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));
|
||||
if (selectedAction == actionDelete)
|
||||
|
@ -664,7 +652,7 @@ void DialogPiecePath::ReturnDefBefore()
|
|||
const QString def = VAbstractApplication::VApp()->TrVars()
|
||||
->FormulaToUser(currentSeamAllowance, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||
ui->plainTextEditFormulaWidthBefore->setPlainText(def);
|
||||
if (QPushButton* button = qobject_cast<QPushButton*>(sender()))
|
||||
if (auto *button = qobject_cast<QPushButton *>(sender()))
|
||||
{
|
||||
button->setEnabled(false);
|
||||
}
|
||||
|
@ -676,7 +664,7 @@ void DialogPiecePath::ReturnDefAfter()
|
|||
const QString def = VAbstractApplication::VApp()->TrVars()
|
||||
->FormulaToUser(currentSeamAllowance, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||
ui->plainTextEditFormulaWidthAfter->setPlainText(def);
|
||||
if (QPushButton* button = qobject_cast<QPushButton*>(sender()))
|
||||
if (auto *button = qobject_cast<QPushButton *>(sender()))
|
||||
{
|
||||
button->setEnabled(false);
|
||||
}
|
||||
|
@ -691,7 +679,7 @@ void DialogPiecePath::PassmarkLineTypeChanged(int id)
|
|||
QListWidgetItem *rowItem = GetItemById(ui->comboBoxPassmarks->currentData().toUInt());
|
||||
if (rowItem)
|
||||
{
|
||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||
|
||||
PassmarkLineType lineType = PassmarkLineType::OneLine;
|
||||
if (id == ui->buttonGroupMarkType->id(ui->radioButtonOneLine))
|
||||
|
@ -745,7 +733,7 @@ void DialogPiecePath::PassmarkAngleTypeChanged(int id)
|
|||
QListWidgetItem *rowItem = GetItemById(ui->comboBoxPassmarks->currentData().toUInt());
|
||||
if (rowItem)
|
||||
{
|
||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||
|
||||
PassmarkAngleType angleType = PassmarkAngleType::Straightforward;
|
||||
if (id == ui->buttonGroupAngleType->id(ui->radioButtonStraightforward))
|
||||
|
@ -799,7 +787,7 @@ void DialogPiecePath::PassmarkShowSecondChanged(int state)
|
|||
QListWidgetItem *rowItem = GetItemById(ui->comboBoxPassmarks->currentData().toUInt());
|
||||
if (rowItem)
|
||||
{
|
||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||
rowNode.SetShowSecondPassmark(state);
|
||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||
|
||||
|
@ -824,7 +812,7 @@ void DialogPiecePath::EvalWidth()
|
|||
|
||||
if (m_saWidth >= 0)
|
||||
{
|
||||
VContainer *locData = const_cast<VContainer *> (data);
|
||||
auto *locData = const_cast<VContainer *>(data);
|
||||
|
||||
auto *currentSA = new VIncrement(locData, currentSeamAllowance);
|
||||
currentSA->SetFormula(m_saWidth, QString().setNum(m_saWidth), true);
|
||||
|
@ -1258,7 +1246,7 @@ void DialogPiecePath::InitNodesList()
|
|||
|
||||
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)
|
||||
{
|
||||
const QString name = GetNodeName(data, node);
|
||||
|
@ -1323,7 +1311,7 @@ void DialogPiecePath::NodeAngleChanged(int index)
|
|||
if (rowItem)
|
||||
{
|
||||
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);
|
||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||
|
||||
|
@ -1351,7 +1339,7 @@ void DialogPiecePath::SetPiecePath(const VPiecePath &path)
|
|||
|
||||
ui->lineEditName->setText(path.GetName());
|
||||
|
||||
VisToolPiecePath *visPath = qobject_cast<VisToolPiecePath *>(vis);
|
||||
auto *visPath = qobject_cast<VisToolPiecePath *>(vis);
|
||||
SCASSERT(visPath != nullptr);
|
||||
visPath->SetPath(path);
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
@ -1444,7 +1432,7 @@ auto DialogPiecePath::GetLastId() const -> quint32
|
|||
if (count > 0)
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -1474,7 +1462,7 @@ void DialogPiecePath::UpdateNodeSABefore(const QString &formula)
|
|||
QListWidgetItem *rowItem = GetItemById(ui->comboBoxNodes->currentData().toUInt());
|
||||
if (rowItem)
|
||||
{
|
||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||
rowNode.SetFormulaSABefore(formula);
|
||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||
}
|
||||
|
@ -1490,7 +1478,7 @@ void DialogPiecePath::UpdateNodeSAAfter(const QString &formula)
|
|||
QListWidgetItem *rowItem = GetItemById(ui->comboBoxNodes->currentData().toUInt());
|
||||
if (rowItem)
|
||||
{
|
||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||
rowNode.SetFormulaSAAfter(formula);
|
||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||
}
|
||||
|
@ -1506,7 +1494,7 @@ void DialogPiecePath::UpdateNodePassmarkLength(const QString &formula)
|
|||
QListWidgetItem *rowItem = GetItemById(ui->comboBoxPassmarks->currentData().toUInt());
|
||||
if (rowItem)
|
||||
{
|
||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||
rowNode.SetFormulaPassmarkLength(formula);
|
||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||
}
|
||||
|
@ -1522,7 +1510,7 @@ void DialogPiecePath::EnabledManualPassmarkLength()
|
|||
QListWidgetItem *rowItem = GetItemById(ui->comboBoxPassmarks->currentData().toUInt());
|
||||
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());
|
||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||
EvalPassmarkLength();
|
||||
|
@ -1547,7 +1535,7 @@ void DialogPiecePath::SetFormulaSAWidth(const QString &formula)
|
|||
}
|
||||
ui->plainTextEditFormulaWidth->setPlainText(width);
|
||||
|
||||
VisToolPiecePath *path = qobject_cast<VisToolPiecePath *>(vis);
|
||||
auto *path = qobject_cast<VisToolPiecePath *>(vis);
|
||||
SCASSERT(path != nullptr)
|
||||
path->SetPath(CreatePath());
|
||||
path->SetCuttingPath(CuttingPath(toolId, data));
|
||||
|
@ -1645,24 +1633,25 @@ auto DialogPiecePath::PathIsValid() const -> bool
|
|||
QString error;
|
||||
if (GetType() == PiecePathType::CustomSeamAllowance && FirstPointEqualLast(ui->listWidget, data, error))
|
||||
{
|
||||
ui->helpLabel->setText(
|
||||
QString("%1%2 %3")
|
||||
.arg(DialogWarningIcon(),
|
||||
tr("First point of <b>custom seam allowance</b> cannot be equal to the last point!"), error));
|
||||
ui->helpLabel->setText(QStringLiteral("%1%2 %3").arg(
|
||||
DialogWarningIcon(), tr("First point of <b>custom seam allowance</b> cannot be equal to the last point!"),
|
||||
error));
|
||||
return false;
|
||||
}
|
||||
|
||||
error.clear();
|
||||
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;
|
||||
}
|
||||
|
||||
error.clear();
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -1688,7 +1677,7 @@ auto DialogPiecePath::PathIsValid() const -> bool
|
|||
error.clear();
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,31 +41,31 @@ class DialogPiecePath : public DialogTool
|
|||
Q_OBJECT // NOLINT
|
||||
public:
|
||||
explicit DialogPiecePath(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
|
||||
virtual ~DialogPiecePath();
|
||||
~DialogPiecePath() override;
|
||||
|
||||
void EnbleShowMode(bool disable);
|
||||
void HideVisibilityTrigger();
|
||||
|
||||
auto GetPiecePath() const -> VPiecePath;
|
||||
void SetPiecePath(const VPiecePath &path);
|
||||
void SetPiecePath(const VPiecePath &path);
|
||||
|
||||
auto GetPieceId() const -> quint32;
|
||||
void SetPieceId(quint32 id);
|
||||
void SetPieceId(quint32 id);
|
||||
|
||||
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:
|
||||
virtual void ChosenObject(quint32 id, const SceneObject &type) override;
|
||||
virtual void ShowDialog(bool click) override;
|
||||
void ChosenObject(quint32 id, const SceneObject &type) override;
|
||||
void ShowDialog(bool click) override;
|
||||
|
||||
protected:
|
||||
virtual void CheckState() final;
|
||||
virtual void ShowVisualization() override;
|
||||
virtual void closeEvent(QCloseEvent *event) override;
|
||||
virtual auto IsValid() const -> bool final;
|
||||
void CheckState() final;
|
||||
void ShowVisualization() override;
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
auto IsValid() const -> bool final;
|
||||
|
||||
private slots:
|
||||
void ShowContextMenu(const QPoint &pos);
|
||||
|
@ -102,8 +102,8 @@ private slots:
|
|||
private:
|
||||
Q_DISABLE_COPY_MOVE(DialogPiecePath) // NOLINT
|
||||
Ui::DialogPiecePath *ui;
|
||||
bool m_showMode;
|
||||
qreal m_saWidth;
|
||||
bool m_showMode{false};
|
||||
qreal m_saWidth{0};
|
||||
|
||||
QTimer *m_timerWidth;
|
||||
QTimer *m_timerWidthBefore;
|
||||
|
@ -111,19 +111,19 @@ private:
|
|||
QTimer *m_timerVisible;
|
||||
QTimer *m_timerPassmarkLength;
|
||||
|
||||
int m_formulaBaseWidth;
|
||||
int m_formulaBaseWidthBefore;
|
||||
int m_formulaBaseWidthAfter;
|
||||
int m_formulaBaseVisible;
|
||||
int m_formulaBaseWidth{0};
|
||||
int m_formulaBaseWidthBefore{0};
|
||||
int m_formulaBaseWidthAfter{0};
|
||||
int m_formulaBaseVisible{0};
|
||||
int m_formulaBasePassmarkLength{0};
|
||||
|
||||
bool m_flagFormulaBefore;
|
||||
bool m_flagFormulaAfter;
|
||||
bool m_flagFormulaVisible;
|
||||
bool m_flagFormulaBefore{true};
|
||||
bool m_flagFormulaAfter{true};
|
||||
bool m_flagFormulaVisible{true};
|
||||
bool m_flagFormulaPassmarkLength{true};
|
||||
bool m_flagName;
|
||||
bool m_flagError;
|
||||
bool m_flagFormula;
|
||||
bool m_flagName{true}; // We have default name of piece.
|
||||
bool m_flagError{false};
|
||||
bool m_flagFormula{false};
|
||||
|
||||
void InitPathTab();
|
||||
void InitSeamAllowanceTab();
|
||||
|
@ -141,10 +141,10 @@ private:
|
|||
void NewItem(const VPieceNode &node);
|
||||
|
||||
auto GetType() const -> PiecePathType;
|
||||
void SetType(PiecePathType type);
|
||||
void SetType(PiecePathType type);
|
||||
|
||||
auto GetPenType() const -> Qt::PenStyle;
|
||||
void SetPenType(const Qt::PenStyle &type);
|
||||
void SetPenType(const Qt::PenStyle &type);
|
||||
|
||||
auto IsCutPath() const -> bool;
|
||||
void SetCutPath(bool value);
|
||||
|
@ -166,10 +166,10 @@ private:
|
|||
auto GetFormulaSAWidthAfter() const -> QString;
|
||||
|
||||
auto GetFormulaVisible() const -> QString;
|
||||
void SetFormulaVisible(const QString &formula);
|
||||
void SetFormulaVisible(const QString &formula);
|
||||
|
||||
auto GetFormulaPassmarkLength() const -> QString;
|
||||
void SetFormulaPassmarkLength(const QString &formula);
|
||||
void SetFormulaPassmarkLength(const QString &formula);
|
||||
|
||||
auto IsShowNotch() const -> bool;
|
||||
|
||||
|
@ -179,8 +179,8 @@ private:
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline auto DialogPiecePath::IsValid() const -> bool
|
||||
{
|
||||
return m_flagName && m_flagError && m_flagFormula && m_flagFormulaBefore && m_flagFormulaAfter
|
||||
&& m_flagFormulaVisible && m_flagFormulaPassmarkLength;
|
||||
return m_flagName && m_flagError && m_flagFormula && m_flagFormulaBefore && m_flagFormulaAfter &&
|
||||
m_flagFormulaVisible && m_flagFormulaPassmarkLength;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -27,34 +27,37 @@
|
|||
*************************************************************************/
|
||||
|
||||
#include "dialogseamallowance.h"
|
||||
#include "ui_dialogseamallowance.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 "../../../tools/vtoolseamallowance.h"
|
||||
#include "../../../undocommands/savepiecepathoptions.h"
|
||||
#include "../../../undocommands/saveplacelabeloptions.h"
|
||||
#include "../../support/dialogeditwrongformula.h"
|
||||
#include "../../support/dialogeditlabel.h"
|
||||
#include "../../../tools/vtoolseamallowance.h"
|
||||
#include "../vgeometry/vplacelabelitem.h"
|
||||
#include "../../../visualization/path/vispiecespecialpoints.h"
|
||||
#include "../../../visualization/path/vistoolpiece.h"
|
||||
#include "../../dialogtoolbox.h"
|
||||
#include "../vmisc/vmodifierkey.h"
|
||||
#include "dialogpatternmaterials.h"
|
||||
#include "../../support/dialogeditlabel.h"
|
||||
#include "../../support/dialogeditwrongformula.h"
|
||||
#include "../vgeometry/vplacelabelitem.h"
|
||||
#include "../vmisc/vabstractvalapplication.h"
|
||||
#include "../vmisc/vmodifierkey.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)
|
||||
#include "../vmisc/backport/qoverload.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
|
@ -64,6 +67,8 @@
|
|||
#include <QTimer>
|
||||
#include <QUuid>
|
||||
#include <QtNumeric>
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, VAbstractPattern *doc, quint32 toolId,
|
||||
|
@ -121,60 +126,26 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, VAbstractPatter
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, quint32 toolId, QWidget *parent)
|
||||
: DialogTool(data, toolId, parent),
|
||||
ui(new Ui::DialogSeamAllowance),
|
||||
uiTabPaths(new Ui::TabPaths),
|
||||
uiTabLabels(new Ui::TabLabels),
|
||||
uiTabGrainline(new Ui::TabGrainline),
|
||||
uiTabPins(new Ui::TabPins),
|
||||
uiTabPassmarks(new Ui::TabPassmarks),
|
||||
uiTabPlaceLabels(new Ui::TabPlaceLabels),
|
||||
m_tabPaths(new QWidget),
|
||||
m_tabLabels(new QWidget),
|
||||
m_tabGrainline(new QWidget),
|
||||
m_tabPins(new QWidget),
|
||||
m_tabPassmarks(new QWidget),
|
||||
m_tabPlaceLabels(new QWidget),
|
||||
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_timerWidthBefore(new QTimer(this)),
|
||||
m_timerWidthAfter(new QTimer(this)),
|
||||
m_timerPassmarkLength(new QTimer(this)),
|
||||
m_saWidth(0),
|
||||
m_templateLines(),
|
||||
m_undoStack(),
|
||||
m_newPlaceLabels(),
|
||||
m_newPaths(),
|
||||
m_placeholdersMenu(new QMenu(this))
|
||||
: DialogTool(data, toolId, parent),
|
||||
ui(new Ui::DialogSeamAllowance),
|
||||
uiTabPaths(new Ui::TabPaths),
|
||||
uiTabLabels(new Ui::TabLabels),
|
||||
uiTabGrainline(new Ui::TabGrainline),
|
||||
uiTabPins(new Ui::TabPins),
|
||||
uiTabPassmarks(new Ui::TabPassmarks),
|
||||
uiTabPlaceLabels(new Ui::TabPlaceLabels),
|
||||
m_tabPaths(new QWidget),
|
||||
m_tabLabels(new QWidget),
|
||||
m_tabGrainline(new QWidget),
|
||||
m_tabPins(new QWidget),
|
||||
m_tabPassmarks(new QWidget),
|
||||
m_tabPlaceLabels(new QWidget),
|
||||
m_ftb(new FancyTabBar(FancyTabBar::Left, this)),
|
||||
m_timerWidth(new QTimer(this)),
|
||||
m_timerWidthBefore(new QTimer(this)),
|
||||
m_timerWidthAfter(new QTimer(this)),
|
||||
m_timerPassmarkLength(new QTimer(this)),
|
||||
m_placeholdersMenu(new QMenu(this))
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
|
@ -273,7 +244,7 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece)
|
|||
{
|
||||
const QString name = GetPathName(record.path, record.reverse);
|
||||
|
||||
QListWidgetItem *item = new QListWidgetItem(name);
|
||||
auto *item = new QListWidgetItem(name);
|
||||
item->setFont(NodeFont(item->font()));
|
||||
item->setData(Qt::UserRole, QVariant::fromValue(record));
|
||||
uiTabPaths->listWidgetCustomSA->addItem(item);
|
||||
|
@ -290,7 +261,7 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece)
|
|||
{
|
||||
const QString name = GetPathName(path);
|
||||
|
||||
QListWidgetItem *item = new QListWidgetItem(name);
|
||||
auto *item = new QListWidgetItem(name);
|
||||
item->setFont(NodeFont(item->font()));
|
||||
item->setData(Qt::UserRole, QVariant::fromValue(path));
|
||||
uiTabPaths->listWidgetInternalPaths->addItem(item);
|
||||
|
@ -306,7 +277,7 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece)
|
|||
{
|
||||
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->setData(Qt::UserRole, QVariant::fromValue(point));
|
||||
listWidget->addItem(item);
|
||||
|
@ -335,7 +306,7 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece)
|
|||
NewSpecialPoint(uiTabPlaceLabels->listWidgetPlaceLabels, label);
|
||||
}
|
||||
|
||||
if (piece.GetPlaceLabels().size() > 0)
|
||||
if (!piece.GetPlaceLabels().empty())
|
||||
{
|
||||
uiTabPlaceLabels->listWidgetPlaceLabels->setCurrentRow(0);
|
||||
}
|
||||
|
@ -428,84 +399,87 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece)
|
|||
*/
|
||||
void DialogSeamAllowance::ChosenObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (not prepare)
|
||||
if (prepare)
|
||||
{
|
||||
bool reverse = false;
|
||||
if (QGuiApplication::keyboardModifiers() == Qt::ShiftModifier)
|
||||
{
|
||||
reverse = true;
|
||||
}
|
||||
if (id != GetLastId())
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case SceneObject::Arc:
|
||||
NewMainPathItem(VPieceNode(id, Tool::NodeArc, reverse));
|
||||
break;
|
||||
case SceneObject::ElArc:
|
||||
NewMainPathItem(VPieceNode(id, Tool::NodeElArc, reverse));
|
||||
break;
|
||||
case SceneObject::Point:
|
||||
NewMainPathItem(VPieceNode(id, Tool::NodePoint));
|
||||
break;
|
||||
case SceneObject::Spline:
|
||||
NewMainPathItem(VPieceNode(id, Tool::NodeSpline, reverse));
|
||||
break;
|
||||
case SceneObject::SplinePath:
|
||||
NewMainPathItem(VPieceNode(id, Tool::NodeSplinePath, reverse));
|
||||
break;
|
||||
case (SceneObject::Line):
|
||||
case (SceneObject::Detail):
|
||||
case (SceneObject::Unknown):
|
||||
default:
|
||||
qDebug() << "Got wrong scene object. Ignore.";
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (uiTabPaths->listWidgetMainPath->count() > 1)
|
||||
{
|
||||
delete GetItemById(id);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
ValidObjects(MainPathIsValid());
|
||||
bool reverse = false;
|
||||
if (QGuiApplication::keyboardModifiers() == Qt::ShiftModifier)
|
||||
{
|
||||
reverse = true;
|
||||
}
|
||||
|
||||
if (not applyAllowed)
|
||||
if (id != GetLastId())
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
auto *visPath = qobject_cast<VisToolPiece *>(vis);
|
||||
SCASSERT(visPath != nullptr);
|
||||
const VPiece p = CreatePiece();
|
||||
visPath->SetPiece(p);
|
||||
case SceneObject::Arc:
|
||||
NewMainPathItem(VPieceNode(id, Tool::NodeArc, reverse));
|
||||
break;
|
||||
case SceneObject::ElArc:
|
||||
NewMainPathItem(VPieceNode(id, Tool::NodeElArc, reverse));
|
||||
break;
|
||||
case SceneObject::Point:
|
||||
NewMainPathItem(VPieceNode(id, Tool::NodePoint));
|
||||
break;
|
||||
case SceneObject::Spline:
|
||||
NewMainPathItem(VPieceNode(id, Tool::NodeSpline, reverse));
|
||||
break;
|
||||
case SceneObject::SplinePath:
|
||||
NewMainPathItem(VPieceNode(id, Tool::NodeSplinePath, reverse));
|
||||
break;
|
||||
case (SceneObject::Line):
|
||||
case (SceneObject::Detail):
|
||||
case (SceneObject::Unknown):
|
||||
default:
|
||||
qDebug() << "Got wrong scene object. Ignore.";
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (uiTabPaths->listWidgetMainPath->count() > 1)
|
||||
{
|
||||
delete GetItemById(id);
|
||||
}
|
||||
}
|
||||
|
||||
if (p.GetPath().CountNodes() == 1)
|
||||
{
|
||||
emit ToolTip(tr("Select main path objects clockwise, <b>%1</b> - reverse direction curve, "
|
||||
"<b>%2</b> - finish creation")
|
||||
ValidObjects(MainPathIsValid());
|
||||
|
||||
if (not applyAllowed)
|
||||
{
|
||||
auto *visPath = qobject_cast<VisToolPiece *>(vis);
|
||||
SCASSERT(visPath != nullptr);
|
||||
const VPiece p = CreatePiece();
|
||||
visPath->SetPiece(p);
|
||||
|
||||
if (p.GetPath().CountNodes() == 1)
|
||||
{
|
||||
emit ToolTip(tr("Select main path objects clockwise, <b>%1</b> - reverse direction curve, "
|
||||
"<b>%2</b> - finish creation")
|
||||
.arg(VModifierKey::Shift(), VModifierKey::EnterKey()));
|
||||
|
||||
if (not VAbstractValApplication::VApp()->getCurrentScene()->items().contains(visPath))
|
||||
{
|
||||
visPath->VisualMode(NULL_ID);
|
||||
}
|
||||
else
|
||||
{
|
||||
visPath->RefreshGeometry();
|
||||
}
|
||||
if (not VAbstractValApplication::VApp()->getCurrentScene()->items().contains(visPath))
|
||||
{
|
||||
visPath->VisualMode(NULL_ID);
|
||||
}
|
||||
else
|
||||
{
|
||||
visPath->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
visPath->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::ShowDialog(bool click)
|
||||
{
|
||||
if (click == false && uiTabPaths->listWidgetMainPath->count() > 0)
|
||||
if (!click && uiTabPaths->listWidgetMainPath->count() > 0)
|
||||
{
|
||||
emit ToolTip(QString());
|
||||
prepare = true;
|
||||
|
@ -560,7 +534,7 @@ void DialogSeamAllowance::CheckState()
|
|||
else
|
||||
{
|
||||
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"));
|
||||
uiTabPaths->tabWidget->setTabIcon(uiTabPaths->tabWidget->indexOf(uiTabPaths->tabSeamAllowance), icon);
|
||||
}
|
||||
|
@ -584,7 +558,7 @@ void DialogSeamAllowance::CheckState()
|
|||
else
|
||||
{
|
||||
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"));
|
||||
uiTabPaths->tabWidget->setTabIcon(uiTabPaths->tabWidget->indexOf(uiTabPaths->tabMainPath), icon);
|
||||
}
|
||||
|
@ -600,18 +574,14 @@ void DialogSeamAllowance::CheckState()
|
|||
else
|
||||
{
|
||||
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"));
|
||||
uiTabPaths->tabWidget->setTabIcon(uiTabPaths->tabWidget->indexOf(uiTabPaths->tabPiece), icon);
|
||||
}
|
||||
|
||||
uiTabPaths->comboBoxNodes->setEnabled(flagFormulaBefore && flagFormulaAfter);
|
||||
|
||||
if (uiTabPassmarks->comboBoxPassmarks->count() == 0)
|
||||
{
|
||||
flagFormulaPassmarkLength = true;
|
||||
}
|
||||
|
||||
flagFormulaPassmarkLength = uiTabPassmarks->comboBoxPassmarks->count() == 0;
|
||||
if (flagFormulaPassmarkLength)
|
||||
{
|
||||
m_ftb->SetTabText(TabOrder::Passmarks, tr("Passmarks"));
|
||||
|
@ -639,8 +609,8 @@ void DialogSeamAllowance::closeEvent(QCloseEvent *event)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::showEvent(QShowEvent *event)
|
||||
{
|
||||
QDialog::showEvent( event ); // clazy:exclude=skipped-base-method
|
||||
if ( event->spontaneous() )
|
||||
QDialog::showEvent(event); // clazy:exclude=skipped-base-method NOLINT(bugprone-parent-virtual-call)
|
||||
if (event->spontaneous())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -700,7 +670,7 @@ void DialogSeamAllowance::SetPatternDoc(VAbstractPattern *doc)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::NameDetailChanged()
|
||||
{
|
||||
QLineEdit* edit = qobject_cast<QLineEdit*>(sender());
|
||||
auto *edit = qobject_cast<QLineEdit *>(sender());
|
||||
if (edit)
|
||||
{
|
||||
if (edit->text().isEmpty())
|
||||
|
@ -720,11 +690,11 @@ void DialogSeamAllowance::NameDetailChanged()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::DetailUUIDChanged()
|
||||
{
|
||||
QLineEdit* edit = qobject_cast<QLineEdit*>(sender());
|
||||
auto *edit = qobject_cast<QLineEdit *>(sender());
|
||||
if (edit)
|
||||
{
|
||||
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}}$");
|
||||
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}}$");
|
||||
QRegularExpressionMatch match = re.match(edit->text());
|
||||
|
||||
if (match.hasMatch())
|
||||
|
@ -847,7 +817,7 @@ void DialogSeamAllowance::ShowCustomSAContextMenu(const QPoint &pos)
|
|||
|
||||
QListWidgetItem *rowItem = uiTabPaths->listWidgetCustomSA->item(row);
|
||||
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"));
|
||||
actionReverse->setCheckable(true);
|
||||
|
@ -907,7 +877,7 @@ void DialogSeamAllowance::ShowInternalPathsContextMenu(const QPoint &pos)
|
|||
{
|
||||
QListWidgetItem *rowItem = uiTabPaths->listWidgetInternalPaths->item(row);
|
||||
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);
|
||||
dialog->SetPiecePath(CurrentPath(pathId));
|
||||
|
@ -954,7 +924,7 @@ void DialogSeamAllowance::ShowPlaceLabelsContextMenu(const QPoint &pos)
|
|||
|
||||
QListWidgetItem *rowItem = uiTabPlaceLabels->listWidgetPlaceLabels->item(row);
|
||||
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);
|
||||
|
||||
QScopedPointer<QMenu> menu(new QMenu());
|
||||
|
@ -1297,7 +1267,7 @@ void DialogSeamAllowance::CSAStartPointChanged(int index)
|
|||
|
||||
QListWidgetItem *rowItem = uiTabPaths->listWidgetCustomSA->item(row);
|
||||
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();
|
||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(record));
|
||||
}
|
||||
|
@ -1315,7 +1285,7 @@ void DialogSeamAllowance::CSAEndPointChanged(int index)
|
|||
|
||||
QListWidgetItem *rowItem = uiTabPaths->listWidgetCustomSA->item(row);
|
||||
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();
|
||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(record));
|
||||
}
|
||||
|
@ -1333,7 +1303,7 @@ void DialogSeamAllowance::CSAIncludeTypeChanged(int index)
|
|||
|
||||
QListWidgetItem *rowItem = uiTabPaths->listWidgetCustomSA->item(row);
|
||||
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());
|
||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(record));
|
||||
}
|
||||
|
@ -1347,7 +1317,7 @@ void DialogSeamAllowance::NodeAngleChanged(int index)
|
|||
QListWidgetItem *rowItem = GetItemById(uiTabPaths->comboBoxNodes->currentData().toUInt());
|
||||
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()));
|
||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||
|
||||
|
@ -1362,7 +1332,7 @@ void DialogSeamAllowance::ReturnDefBefore()
|
|||
const QString def = VAbstractApplication::VApp()->TrVars()
|
||||
->FormulaToUser(currentSeamAllowance, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||
uiTabPaths->plainTextEditFormulaWidthBefore->setPlainText(def);
|
||||
if (QPushButton* button = qobject_cast<QPushButton*>(sender()))
|
||||
if (auto *button = qobject_cast<QPushButton *>(sender()))
|
||||
{
|
||||
button->setEnabled(false);
|
||||
}
|
||||
|
@ -1374,7 +1344,7 @@ void DialogSeamAllowance::ReturnDefAfter()
|
|||
const QString def = VAbstractApplication::VApp()->TrVars()
|
||||
->FormulaToUser(currentSeamAllowance, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||
uiTabPaths->plainTextEditFormulaWidthAfter->setPlainText(def);
|
||||
if (QPushButton* button = qobject_cast<QPushButton*>(sender()))
|
||||
if (auto *button = qobject_cast<QPushButton *>(sender()))
|
||||
{
|
||||
button->setEnabled(false);
|
||||
}
|
||||
|
@ -1401,7 +1371,7 @@ void DialogSeamAllowance::CustomSAChanged(int row)
|
|||
|
||||
const QListWidgetItem *item = uiTabPaths->listWidgetCustomSA->item( row );
|
||||
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);
|
||||
InitCSAPoint(uiTabPaths->comboBoxStartPoint);
|
||||
|
@ -1443,7 +1413,7 @@ void DialogSeamAllowance::PathDialogClosed(int result)
|
|||
if (result == QDialog::Accepted)
|
||||
{
|
||||
SCASSERT(not m_dialog.isNull());
|
||||
DialogPiecePath *dialogTool = qobject_cast<DialogPiecePath*>(m_dialog.data());
|
||||
auto *dialogTool = qobject_cast<DialogPiecePath *>(m_dialog.data());
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
try
|
||||
{
|
||||
|
@ -1474,7 +1444,7 @@ void DialogSeamAllowance::PlaceLabelDialogClosed(int result)
|
|||
if (result == QDialog::Accepted)
|
||||
{
|
||||
SCASSERT(not m_dialog.isNull());
|
||||
DialogPlaceLabel *dialogTool = qobject_cast<DialogPlaceLabel*>(m_dialog.data());
|
||||
auto *dialogTool = qobject_cast<DialogPlaceLabel *>(m_dialog.data());
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
try
|
||||
{
|
||||
|
@ -1535,8 +1505,8 @@ void DialogSeamAllowance::FancyTabChanged(int index)
|
|||
m_tabPassmarks->hide();
|
||||
m_tabPlaceLabels->hide();
|
||||
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||
switch(index)
|
||||
{
|
||||
case TabOrder::Paths:
|
||||
|
@ -1557,13 +1527,15 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
|||
case TabOrder::PlaceLabels:
|
||||
m_tabPlaceLabels->show();
|
||||
break;
|
||||
case TabOrder::Count:
|
||||
Q_UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
QT_WARNING_POP
|
||||
QT_WARNING_POP
|
||||
|
||||
if (index == TabOrder::Pins
|
||||
|| index == TabOrder::Grainline
|
||||
|| (index == TabOrder::Labels &&
|
||||
uiTabLabels->tabWidget->currentIndex() == uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels)))
|
||||
if (index == TabOrder::Pins || index == TabOrder::Grainline ||
|
||||
(index == TabOrder::Labels &&
|
||||
uiTabLabels->tabWidget->currentIndex() == uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels)))
|
||||
{
|
||||
ShowPieceSpecialPointsWithRect(uiTabPins->listWidgetPins, false);
|
||||
}
|
||||
|
@ -1605,7 +1577,7 @@ void DialogSeamAllowance::PassmarkLineTypeChanged(int id)
|
|||
QListWidgetItem *rowItem = GetItemById(uiTabPassmarks->comboBoxPassmarks->currentData().toUInt());
|
||||
if (rowItem)
|
||||
{
|
||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||
|
||||
PassmarkLineType lineType = PassmarkLineType::OneLine;
|
||||
if (id == uiTabPassmarks->buttonGroupLineType->id(uiTabPassmarks->radioButtonOneLine))
|
||||
|
@ -1659,7 +1631,7 @@ void DialogSeamAllowance::PassmarkAngleTypeChanged(int id)
|
|||
QListWidgetItem *rowItem = GetItemById(uiTabPassmarks->comboBoxPassmarks->currentData().toUInt());
|
||||
if (rowItem)
|
||||
{
|
||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||
|
||||
PassmarkAngleType angleType = PassmarkAngleType::Straightforward;
|
||||
if (id == uiTabPassmarks->buttonGroupAngleType->id(uiTabPassmarks->radioButtonStraightforward))
|
||||
|
@ -1712,7 +1684,7 @@ void DialogSeamAllowance::PassmarkShowSecondChanged(int state)
|
|||
QListWidgetItem *rowItem = GetItemById(uiTabPassmarks->comboBoxPassmarks->currentData().toUInt());
|
||||
if (rowItem)
|
||||
{
|
||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||
rowNode.SetShowSecondPassmark(state);
|
||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||
|
||||
|
@ -1724,10 +1696,11 @@ void DialogSeamAllowance::PassmarkShowSecondChanged(int state)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::UpdateGrainlineValues()
|
||||
{
|
||||
QPlainTextEdit* apleSender[2] = {uiTabGrainline->lineEditRotFormula, uiTabGrainline->lineEditLenFormula};
|
||||
bool bFormulasOK[2] = {true, true};
|
||||
std::array<const QPlainTextEdit *, 2> apleSender = {uiTabGrainline->lineEditRotFormula,
|
||||
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* plbText;
|
||||
|
@ -1747,7 +1720,7 @@ void DialogSeamAllowance::UpdateGrainlineValues()
|
|||
|
||||
plbVal->setToolTip(tr("Value"));
|
||||
|
||||
QString qsFormula = apleSender[i]->toPlainText().simplified();
|
||||
QString qsFormula = apleSender.at(i)->toPlainText().simplified();
|
||||
QString qsVal;
|
||||
try
|
||||
{
|
||||
|
@ -1755,7 +1728,7 @@ void DialogSeamAllowance::UpdateGrainlineValues()
|
|||
->FormulaFromUser(qsFormula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||
Calculator cal;
|
||||
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"));
|
||||
}
|
||||
|
@ -1763,21 +1736,19 @@ void DialogSeamAllowance::UpdateGrainlineValues()
|
|||
{
|
||||
throw qmu::QmuParserError(tr("Length should be positive"));
|
||||
}
|
||||
else
|
||||
{
|
||||
qsVal.setNum(dVal, 'f', 2);
|
||||
ChangeColor(plbText, OkColor(this));
|
||||
}
|
||||
|
||||
qsVal.setNum(dVal, 'f', 2);
|
||||
ChangeColor(plbText, OkColor(this));
|
||||
}
|
||||
catch (qmu::QmuParserError &e)
|
||||
{
|
||||
qsVal = tr("Error");
|
||||
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()));
|
||||
}
|
||||
|
||||
if (bFormulasOK[i] && qsVal.isEmpty() == false)
|
||||
if (bFormulasOK.at(i) && not qsVal.isEmpty())
|
||||
{
|
||||
qsVal += qsUnit;
|
||||
}
|
||||
|
@ -1799,11 +1770,11 @@ void DialogSeamAllowance::UpdateGrainlineValues()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::UpdateDetailLabelValues()
|
||||
{
|
||||
QPlainTextEdit* apleSender[3] = {uiTabLabels->lineEditDLWidthFormula, uiTabLabels->lineEditDLHeightFormula,
|
||||
uiTabLabels->lineEditDLAngleFormula};
|
||||
bool bFormulasOK[3] = {true, true, true};
|
||||
std::array<const QPlainTextEdit *, 3> apleSender = {
|
||||
uiTabLabels->lineEditDLWidthFormula, uiTabLabels->lineEditDLHeightFormula, uiTabLabels->lineEditDLAngleFormula};
|
||||
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* plbText;
|
||||
|
@ -1829,7 +1800,7 @@ void DialogSeamAllowance::UpdateDetailLabelValues()
|
|||
|
||||
plbVal->setToolTip(tr("Value"));
|
||||
|
||||
QString qsFormula = apleSender[i]->toPlainText().simplified();
|
||||
QString qsFormula = apleSender.at(i)->toPlainText().simplified();
|
||||
QString qsVal;
|
||||
try
|
||||
{
|
||||
|
@ -1838,7 +1809,7 @@ void DialogSeamAllowance::UpdateDetailLabelValues()
|
|||
->FormulaFromUser(qsFormula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||
Calculator cal;
|
||||
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"));
|
||||
}
|
||||
|
@ -1846,21 +1817,19 @@ void DialogSeamAllowance::UpdateDetailLabelValues()
|
|||
{
|
||||
throw qmu::QmuParserError(tr("Length should be positive"));
|
||||
}
|
||||
else
|
||||
{
|
||||
qsVal.setNum(dVal, 'f', 2);
|
||||
ChangeColor(plbText, OkColor(this));
|
||||
}
|
||||
|
||||
qsVal.setNum(dVal, 'f', 2);
|
||||
ChangeColor(plbText, OkColor(this));
|
||||
}
|
||||
catch (qmu::QmuParserError &e)
|
||||
{
|
||||
qsVal = tr("Error");
|
||||
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()));
|
||||
}
|
||||
|
||||
if (bFormulasOK[i] && qsVal.isEmpty() == false)
|
||||
if (bFormulasOK.at(i) && not qsVal.isEmpty())
|
||||
{
|
||||
qsVal += qsUnit;
|
||||
}
|
||||
|
@ -1872,7 +1841,7 @@ void DialogSeamAllowance::UpdateDetailLabelValues()
|
|||
if (not flagDLAngle || not (flagDLFormulas || flagDPin) || not flagPLAngle || not (flagPLFormulas || flagPPin))
|
||||
{
|
||||
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"));
|
||||
uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), icon);
|
||||
}
|
||||
|
@ -1886,11 +1855,11 @@ void DialogSeamAllowance::UpdateDetailLabelValues()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::UpdatePatternLabelValues()
|
||||
{
|
||||
QPlainTextEdit* apleSender[3] = {uiTabLabels->lineEditPLWidthFormula, uiTabLabels->lineEditPLHeightFormula,
|
||||
uiTabLabels->lineEditPLAngleFormula};
|
||||
bool bFormulasOK[3] = {true, true, true};
|
||||
std::array<const QPlainTextEdit *, 3> apleSender = {
|
||||
uiTabLabels->lineEditPLWidthFormula, uiTabLabels->lineEditPLHeightFormula, uiTabLabels->lineEditPLAngleFormula};
|
||||
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* plbText;
|
||||
|
@ -1916,7 +1885,7 @@ void DialogSeamAllowance::UpdatePatternLabelValues()
|
|||
|
||||
plbVal->setToolTip(tr("Value"));
|
||||
|
||||
QString qsFormula = apleSender[i]->toPlainText().simplified();
|
||||
QString qsFormula = apleSender.at(i)->toPlainText().simplified();
|
||||
QString qsVal;
|
||||
try
|
||||
{
|
||||
|
@ -1924,7 +1893,7 @@ void DialogSeamAllowance::UpdatePatternLabelValues()
|
|||
->FormulaFromUser(qsFormula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||
Calculator cal;
|
||||
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"));
|
||||
}
|
||||
|
@ -1932,21 +1901,19 @@ void DialogSeamAllowance::UpdatePatternLabelValues()
|
|||
{
|
||||
throw qmu::QmuParserError(tr("Length should be positive"));
|
||||
}
|
||||
else
|
||||
{
|
||||
qsVal.setNum(dVal, 'f', 2);
|
||||
ChangeColor(plbText, OkColor(this));
|
||||
}
|
||||
|
||||
qsVal.setNum(dVal, 'f', 2);
|
||||
ChangeColor(plbText, OkColor(this));
|
||||
}
|
||||
catch (qmu::QmuParserError &e)
|
||||
{
|
||||
qsVal = tr("Error");
|
||||
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()));
|
||||
}
|
||||
|
||||
if (bFormulasOK[i] && qsVal.isEmpty() == false)
|
||||
if (bFormulasOK.at(i) && not qsVal.isEmpty())
|
||||
{
|
||||
qsVal += qsUnit;
|
||||
}
|
||||
|
@ -1958,7 +1925,7 @@ void DialogSeamAllowance::UpdatePatternLabelValues()
|
|||
if (not flagDLAngle || not (flagDLFormulas || flagDPin) || not flagPLAngle || not (flagPLFormulas || flagPPin))
|
||||
{
|
||||
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"));
|
||||
uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), icon);
|
||||
}
|
||||
|
@ -1972,7 +1939,7 @@ void DialogSeamAllowance::UpdatePatternLabelValues()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::EnabledGrainline()
|
||||
{
|
||||
if (uiTabGrainline->groupBoxGrainline->isChecked() == true)
|
||||
if (uiTabGrainline->groupBoxGrainline->isChecked())
|
||||
{
|
||||
GrainlinePinPointChanged();
|
||||
}
|
||||
|
@ -1987,7 +1954,7 @@ void DialogSeamAllowance::EnabledGrainline()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::EnabledDetailLabel()
|
||||
{
|
||||
if (uiTabLabels->groupBoxDetailLabel->isChecked() == true)
|
||||
if (uiTabLabels->groupBoxDetailLabel->isChecked())
|
||||
{
|
||||
UpdateDetailLabelValues();
|
||||
DetailPinPointChanged();
|
||||
|
@ -2004,7 +1971,7 @@ void DialogSeamAllowance::EnabledDetailLabel()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::EnabledPatternLabel()
|
||||
{
|
||||
if (uiTabLabels->groupBoxPatternLabel->isChecked() == true)
|
||||
if (uiTabLabels->groupBoxPatternLabel->isChecked())
|
||||
{
|
||||
UpdatePatternLabelValues();
|
||||
PatternPinPointChanged();
|
||||
|
@ -2027,7 +1994,7 @@ void DialogSeamAllowance::EnabledManualPassmarkLength()
|
|||
QListWidgetItem *rowItem = GetItemById(uiTabPassmarks->comboBoxPassmarks->currentData().toUInt());
|
||||
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());
|
||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||
EvalPassmarkLength();
|
||||
|
@ -2291,7 +2258,7 @@ void DialogSeamAllowance::EvalWidth()
|
|||
|
||||
if (m_saWidth >= 0)
|
||||
{
|
||||
VContainer *locData = const_cast<VContainer *> (data);
|
||||
auto *locData = const_cast<VContainer *>(data);
|
||||
|
||||
auto *currentSA = new VIncrement(locData, currentSeamAllowance);
|
||||
currentSA->SetFormula(m_saWidth, QString().setNum(m_saWidth), true);
|
||||
|
@ -2379,8 +2346,8 @@ void DialogSeamAllowance::EvalPassmarkLength()
|
|||
formulaData.labelEditFormula = uiTabPassmarks->labelEditPassmarkLength;
|
||||
formulaData.labelResult = uiTabPassmarks->labelResultPassmarkLength;
|
||||
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||
formulaData.checkZero = false;
|
||||
formulaData.checkLessThanZero = false;
|
||||
formulaData.checkZero = true;
|
||||
formulaData.checkLessThanZero = true;
|
||||
|
||||
Eval(formulaData, flagFormulaPassmarkLength);
|
||||
|
||||
|
@ -2530,7 +2497,7 @@ void DialogSeamAllowance::DetailPinPointChanged()
|
|||
topPinId == NULL_ID && bottomPinId == NULL_ID ? color = OkColor(this) : color = errorColor;
|
||||
|
||||
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"));
|
||||
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;
|
||||
|
||||
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"));
|
||||
uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), icon);
|
||||
}
|
||||
|
@ -2725,25 +2692,24 @@ auto DialogSeamAllowance::MainPathIsValid() const -> bool
|
|||
QString error;
|
||||
if (FirstPointEqualLast(uiTabPaths->listWidgetMainPath, data, error))
|
||||
{
|
||||
uiTabPaths->helpLabel->setText(
|
||||
QString("%1%2 %3").arg(DialogWarningIcon(),
|
||||
tr("First point cannot be equal to the last point!"), error));
|
||||
uiTabPaths->helpLabel->setText(QStringLiteral("%1%2 %3").arg(
|
||||
DialogWarningIcon(), tr("First point cannot be equal to the last point!"), error));
|
||||
return false;
|
||||
}
|
||||
|
||||
error.clear();
|
||||
if (DoublePoints(uiTabPaths->listWidgetMainPath, data, error))
|
||||
{
|
||||
uiTabPaths->helpLabel->setText(QString("%1%2 %3")
|
||||
.arg(DialogWarningIcon(), tr("You have double points!"), error));
|
||||
uiTabPaths->helpLabel->setText(
|
||||
QStringLiteral("%1%2 %3").arg(DialogWarningIcon(), tr("You have double points!"), error));
|
||||
return false;
|
||||
}
|
||||
|
||||
error.clear();
|
||||
if (DoubleCurves(uiTabPaths->listWidgetMainPath, data, error))
|
||||
{
|
||||
uiTabPaths->helpLabel->setText(QString("%1%2 %3")
|
||||
.arg(DialogWarningIcon(), tr("The same curve repeats twice!"), error));
|
||||
uiTabPaths->helpLabel->setText(
|
||||
QStringLiteral("%1%2 %3").arg(DialogWarningIcon(), tr("The same curve repeats twice!"), error));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2756,8 +2722,8 @@ auto DialogSeamAllowance::MainPathIsValid() const -> bool
|
|||
error.clear();
|
||||
if (InvalidSegment(uiTabPaths->listWidgetMainPath, data, error))
|
||||
{
|
||||
uiTabPaths->helpLabel->setText(QString("%1%2 %3")
|
||||
.arg(DialogWarningIcon(), tr("Invalid segment!"), error));
|
||||
uiTabPaths->helpLabel->setText(
|
||||
QStringLiteral("%1%2 %3").arg(DialogWarningIcon(), tr("Invalid segment!"), error));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2858,7 +2824,7 @@ auto DialogSeamAllowance::GetItemById(quint32 id) -> QListWidgetItem *
|
|||
for (qint32 i = 0; i < uiTabPaths->listWidgetMainPath->count(); ++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)
|
||||
{
|
||||
|
@ -2875,7 +2841,7 @@ auto DialogSeamAllowance::GetLastId() const -> quint32
|
|||
if (count > 0)
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -2905,7 +2871,7 @@ void DialogSeamAllowance::UpdateNodeSABefore(const QString &formula)
|
|||
QListWidgetItem *rowItem = GetItemById(uiTabPaths->comboBoxNodes->currentData().toUInt());
|
||||
if (rowItem)
|
||||
{
|
||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||
rowNode.SetFormulaSABefore(formula);
|
||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||
}
|
||||
|
@ -2921,7 +2887,7 @@ void DialogSeamAllowance::UpdateNodeSAAfter(const QString &formula)
|
|||
QListWidgetItem *rowItem = GetItemById(uiTabPaths->comboBoxNodes->currentData().toUInt());
|
||||
if (rowItem)
|
||||
{
|
||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||
rowNode.SetFormulaSAAfter(formula);
|
||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||
}
|
||||
|
@ -2937,7 +2903,7 @@ void DialogSeamAllowance::UpdateNodePassmarkLength(const QString &formula)
|
|||
QListWidgetItem *rowItem = GetItemById(uiTabPassmarks->comboBoxPassmarks->currentData().toUInt());
|
||||
if (rowItem)
|
||||
{
|
||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||
rowNode.SetFormulaPassmarkLength(formula);
|
||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||
}
|
||||
|
@ -3098,7 +3064,7 @@ void DialogSeamAllowance::InitSeamAllowanceTab()
|
|||
}
|
||||
else
|
||||
{
|
||||
uiTabPaths->checkBoxBuiltIn->toggled(uiTabPaths->checkBoxBuiltIn->isChecked());
|
||||
emit uiTabPaths->checkBoxBuiltIn->toggled(uiTabPaths->checkBoxBuiltIn->isChecked());
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -3432,15 +3398,21 @@ void DialogSeamAllowance::InitPinsTab()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::InitPassmarksTab()
|
||||
{
|
||||
// Length formula
|
||||
this->m_formulaBasePassmarkLength = uiTabPassmarks->plainTextEditPassmarkLength->height();
|
||||
uiTabPassmarks->plainTextEditPassmarkLength->installEventFilter(this);
|
||||
|
||||
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,
|
||||
&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();
|
||||
connect(uiTabPassmarks->comboBoxPassmarks, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &DialogSeamAllowance::PassmarkChanged);
|
||||
|
@ -3458,15 +3430,6 @@ void DialogSeamAllowance::InitPassmarksTab()
|
|||
#endif
|
||||
connect(uiTabPassmarks->checkBoxShowSecondPassmark, &QCheckBox::stateChanged, this,
|
||||
&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)
|
||||
{
|
||||
VisToolPiece *path = qobject_cast<VisToolPiece *>(vis);
|
||||
auto *path = qobject_cast<VisToolPiece *>(vis);
|
||||
SCASSERT(path != nullptr)
|
||||
const VPiece p = CreatePiece();
|
||||
path->SetPiece(p);
|
||||
|
@ -3564,7 +3527,7 @@ void DialogSeamAllowance::UpdateCurrentCustomSARecord()
|
|||
|
||||
QListWidgetItem *item = uiTabPaths->listWidgetCustomSA->item(row);
|
||||
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));
|
||||
}
|
||||
|
||||
|
@ -3579,7 +3542,7 @@ void DialogSeamAllowance::UpdateCurrentInternalPathRecord()
|
|||
|
||||
QListWidgetItem *item = uiTabPaths->listWidgetInternalPaths->item(row);
|
||||
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));
|
||||
}
|
||||
|
||||
|
@ -3594,7 +3557,7 @@ void DialogSeamAllowance::UpdateCurrentPlaceLabelRecords()
|
|||
|
||||
QListWidgetItem *item = uiTabPlaceLabels->listWidgetPlaceLabels->item(row);
|
||||
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());
|
||||
}
|
||||
|
||||
|
@ -3795,7 +3758,7 @@ void DialogSeamAllowance::ShowPieceSpecialPointsWithRect(const QListWidget *list
|
|||
{
|
||||
m_visSpecialPoints->VisualMode();
|
||||
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);
|
||||
m_visSpecialPoints->setParentItem(tool);
|
||||
}
|
||||
|
@ -3942,8 +3905,6 @@ void DialogSeamAllowance::InitGradationPlaceholdersMenu()
|
|||
void DialogSeamAllowance::InitGradationPlaceholders()
|
||||
{
|
||||
// Pattern tags
|
||||
QLocale locale(VAbstractApplication::VApp()->Settings()->GetLocale());
|
||||
|
||||
QString heightValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHeight());
|
||||
m_gradationPlaceholders.insert(pl_height, qMakePair(tr("Height", "dimension"), heightValue));
|
||||
m_gradationPlaceholders.insert(pl_dimensionX, qMakePair(tr("Dimension X", "dimension"), heightValue));
|
||||
|
@ -4096,7 +4057,7 @@ void DialogSeamAllowance::ManagePatternMaterials()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::InsertGradationPlaceholder()
|
||||
{
|
||||
QAction *action = qobject_cast<QAction *>(sender());
|
||||
auto *action = qobject_cast<QAction *>(sender());
|
||||
if (action)
|
||||
{
|
||||
uiTabPaths->lineEditGradationLabel->insert(action->data().toString());
|
||||
|
|
|
@ -31,9 +31,6 @@
|
|||
|
||||
#include "../dialogtool.h"
|
||||
#include "../vpatterndb/vpiece.h"
|
||||
#include "../vpatterndb/floatItemData/vpatternlabeldata.h"
|
||||
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
|
||||
#include "../vpatterndb/floatItemData/vgrainlinedata.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
|
@ -59,30 +56,30 @@ public:
|
|||
DialogSeamAllowance(const VContainer *data, VAbstractPattern *doc, quint32 toolId,
|
||||
QWidget *parent = nullptr);
|
||||
DialogSeamAllowance(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
|
||||
virtual ~DialogSeamAllowance();
|
||||
~DialogSeamAllowance() override;
|
||||
|
||||
void EnableApply(bool enable);
|
||||
|
||||
auto GetPiece() const -> VPiece;
|
||||
void SetPiece(const VPiece &piece);
|
||||
void SetPiece(const VPiece &piece);
|
||||
|
||||
auto GetFormulaSAWidth() const -> QString;
|
||||
|
||||
auto UndoStack() -> QVector<QPointer<VUndoCommand>> &;
|
||||
|
||||
public slots:
|
||||
virtual void ChosenObject(quint32 id, const SceneObject &type) override;
|
||||
virtual void ShowDialog(bool click) override;
|
||||
void ChosenObject(quint32 id, const SceneObject &type) override;
|
||||
void ShowDialog(bool click) override;
|
||||
|
||||
protected:
|
||||
/** @brief SaveData Put dialog data in local variables */
|
||||
virtual void SaveData() override;
|
||||
virtual void CheckState() final;
|
||||
virtual void closeEvent(QCloseEvent *event) override;
|
||||
virtual void showEvent( QShowEvent *event ) override;
|
||||
virtual void resizeEvent(QResizeEvent *event) override;
|
||||
virtual auto IsValid() const -> bool final;
|
||||
virtual void SetPatternDoc(VAbstractPattern *doc) final;
|
||||
void SaveData() override;
|
||||
void CheckState() final;
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
void showEvent(QShowEvent *event) override;
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
auto IsValid() const -> bool final;
|
||||
void SetPatternDoc(VAbstractPattern *doc) final;
|
||||
|
||||
private slots:
|
||||
void NameDetailChanged();
|
||||
|
@ -175,70 +172,70 @@ private:
|
|||
Ui::TabGrainline *uiTabGrainline;
|
||||
Ui::TabPins *uiTabPins;
|
||||
Ui::TabPassmarks *uiTabPassmarks;
|
||||
Ui::TabPlaceLabels *uiTabPlaceLabels;
|
||||
Ui::TabPlaceLabels *uiTabPlaceLabels;
|
||||
|
||||
QWidget *m_tabPaths;
|
||||
QWidget *m_tabLabels;
|
||||
QWidget *m_tabGrainline;
|
||||
QWidget *m_tabPins;
|
||||
QWidget *m_tabPassmarks;
|
||||
QWidget *m_tabPlaceLabels;
|
||||
QWidget *m_tabPaths{nullptr};
|
||||
QWidget *m_tabLabels{nullptr};
|
||||
QWidget *m_tabGrainline{nullptr};
|
||||
QWidget *m_tabPins{nullptr};
|
||||
QWidget *m_tabPassmarks{nullptr};
|
||||
QWidget *m_tabPlaceLabels{nullptr};
|
||||
|
||||
FancyTabBar* m_ftb;
|
||||
FancyTabBar *m_ftb{nullptr};
|
||||
|
||||
bool applyAllowed;
|
||||
bool flagGPin;
|
||||
bool flagDPin;
|
||||
bool flagPPin;
|
||||
bool flagGFormulas;
|
||||
bool flagDLAngle;
|
||||
bool flagDLFormulas;
|
||||
bool flagPLAngle;
|
||||
bool flagPLFormulas;
|
||||
bool flagFormulaBefore;
|
||||
bool flagFormulaAfter;
|
||||
bool flagFormulaPassmarkLength{true};
|
||||
bool flagMainPathIsValid;
|
||||
bool flagName;
|
||||
bool flagUUID;
|
||||
bool flagFormula;
|
||||
bool m_bAddMode;
|
||||
bool m_patternLabelDataChanged{false};
|
||||
bool m_askSavePatternLabelData{false};
|
||||
bool m_patternTemplateDataChanged{false};
|
||||
bool m_patternMaterialsChanged{false};
|
||||
bool applyAllowed{false}; // By default disabled
|
||||
bool flagGPin{false};
|
||||
bool flagDPin{false};
|
||||
bool flagPPin{false};
|
||||
bool flagGFormulas{true};
|
||||
bool flagDLAngle{true};
|
||||
bool flagDLFormulas{true};
|
||||
bool flagPLAngle{true};
|
||||
bool flagPLFormulas{true};
|
||||
bool flagFormulaBefore{true};
|
||||
bool flagFormulaAfter{true};
|
||||
bool flagFormulaPassmarkLength{true};
|
||||
bool flagMainPathIsValid{true};
|
||||
bool flagName{true}; // We have default name of piece.
|
||||
bool flagUUID{true};
|
||||
bool flagFormula{true};
|
||||
bool m_bAddMode{true};
|
||||
bool m_patternLabelDataChanged{false};
|
||||
bool m_askSavePatternLabelData{false};
|
||||
bool m_patternTemplateDataChanged{false};
|
||||
bool m_patternMaterialsChanged{false};
|
||||
|
||||
QPointer<DialogTool> m_dialog;
|
||||
QPointer<VisPieceSpecialPoints> m_visSpecialPoints;
|
||||
QPointer<DialogTool> m_dialog{};
|
||||
QPointer<VisPieceSpecialPoints> m_visSpecialPoints{};
|
||||
|
||||
QVector<VLabelTemplateLine> m_patternTemplateLines{};
|
||||
|
||||
QMap<int, QString> m_patternMaterials{};
|
||||
|
||||
int m_iRotBaseHeight;
|
||||
int m_iLenBaseHeight;
|
||||
int m_DLWidthBaseHeight;
|
||||
int m_DLHeightBaseHeight;
|
||||
int m_DLAngleBaseHeight;
|
||||
int m_PLWidthBaseHeight;
|
||||
int m_PLHeightBaseHeight;
|
||||
int m_PLAngleBaseHeight;
|
||||
int m_formulaBaseWidth;
|
||||
int m_formulaBaseWidthBefore;
|
||||
int m_formulaBaseWidthAfter;
|
||||
int m_formulaBasePassmarkLength{0};
|
||||
int m_iRotBaseHeight{0};
|
||||
int m_iLenBaseHeight{0};
|
||||
int m_DLWidthBaseHeight{0};
|
||||
int m_DLHeightBaseHeight{0};
|
||||
int m_DLAngleBaseHeight{0};
|
||||
int m_PLWidthBaseHeight{0};
|
||||
int m_PLHeightBaseHeight{0};
|
||||
int m_PLAngleBaseHeight{0};
|
||||
int m_formulaBaseWidth{0};
|
||||
int m_formulaBaseWidthBefore{0};
|
||||
int m_formulaBaseWidthAfter{0};
|
||||
int m_formulaBasePassmarkLength{0};
|
||||
|
||||
QTimer *m_timerWidth;
|
||||
QTimer *m_timerWidthBefore;
|
||||
QTimer *m_timerWidthAfter;
|
||||
QTimer *m_timerPassmarkLength;
|
||||
qreal m_saWidth;
|
||||
QTimer *m_timerWidth{nullptr};
|
||||
QTimer *m_timerWidthBefore{nullptr};
|
||||
QTimer *m_timerWidthAfter{nullptr};
|
||||
QTimer *m_timerPassmarkLength{nullptr};
|
||||
qreal m_saWidth{0};
|
||||
|
||||
QVector<VLabelTemplateLine> m_templateLines;
|
||||
QVector<VLabelTemplateLine> m_templateLines{};
|
||||
|
||||
QVector<QPointer<VUndoCommand>> m_undoStack;
|
||||
QHash<quint32, VPlaceLabelItem> m_newPlaceLabels;
|
||||
QHash<quint32, VPiecePath> m_newPaths;
|
||||
QVector<QPointer<VUndoCommand>> m_undoStack{};
|
||||
QHash<quint32, VPlaceLabelItem> m_newPlaceLabels{};
|
||||
QHash<quint32, VPiecePath> m_newPaths{};
|
||||
|
||||
VAbstractPattern *m_doc{nullptr};
|
||||
|
||||
|
@ -250,14 +247,14 @@ private:
|
|||
|
||||
auto CreatePiece() const -> VPiece;
|
||||
|
||||
void NewMainPathItem(const VPieceNode &node);
|
||||
void NewMainPathItem(const VPieceNode &node);
|
||||
auto GetPathName(quint32 path, bool reverse = false) const -> QString;
|
||||
auto MainPathIsValid() const -> bool;
|
||||
void ValidObjects(bool value);
|
||||
void ValidObjects(bool value);
|
||||
auto MainPathIsClockwise() const -> bool;
|
||||
void UpdateCurrentCustomSARecord();
|
||||
void UpdateCurrentInternalPathRecord();
|
||||
void UpdateCurrentPlaceLabelRecords();
|
||||
void UpdateCurrentCustomSARecord();
|
||||
void UpdateCurrentInternalPathRecord();
|
||||
void UpdateCurrentPlaceLabelRecords();
|
||||
|
||||
auto GetItemById(quint32 id) -> QListWidgetItem *;
|
||||
|
||||
|
@ -325,9 +322,9 @@ private:
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline auto DialogSeamAllowance::IsValid() const -> bool
|
||||
{
|
||||
return flagName && flagUUID && flagMainPathIsValid && flagFormula && flagFormulaBefore && flagFormulaAfter
|
||||
&& (flagGFormulas || flagGPin) && flagDLAngle && (flagDLFormulas || flagDPin) && flagPLAngle
|
||||
&& (flagPLFormulas || flagPPin) && flagFormulaPassmarkLength;
|
||||
return flagName && flagUUID && flagMainPathIsValid && flagFormula && flagFormulaBefore && flagFormulaAfter &&
|
||||
(flagGFormulas || flagGPin) && flagDLAngle && (flagDLFormulas || flagDPin) && flagPLAngle &&
|
||||
(flagPLFormulas || flagPPin) && flagFormulaPassmarkLength;
|
||||
}
|
||||
|
||||
#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,
|
||||
"Not all options were handled.");
|
||||
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||
switch(selectedOption)
|
||||
{
|
||||
case ContextMenuOption::LAST_ONE_DO_NOT_USE:
|
||||
|
@ -700,7 +700,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
|||
SelectPassmarkLine(PassmarkLineType::BoxMark);
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -57,15 +57,17 @@
|
|||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
#include "../vmisc/backport/qoverload.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
#include "nodeDetails/vtoolpin.h"
|
||||
#include "nodeDetails/vnodepoint.h"
|
||||
#include "nodeDetails/vtoolpiecepath.h"
|
||||
#include "../vformat/vlabeltemplate.h"
|
||||
#include "../vpatterndb/floatItemData/vgrainlinedata.h"
|
||||
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
|
||||
#include "nodeDetails/vnodearc.h"
|
||||
#include "nodeDetails/vnodeellipticalarc.h"
|
||||
#include "nodeDetails/vnodepoint.h"
|
||||
#include "nodeDetails/vnodespline.h"
|
||||
#include "nodeDetails/vnodesplinepath.h"
|
||||
#include "nodeDetails/vtoolpiecepath.h"
|
||||
#include "nodeDetails/vtoolpin.h"
|
||||
#include "nodeDetails/vtoolplacelabel.h"
|
||||
#include "../vformat/vlabeltemplate.h"
|
||||
|
||||
#include <QFuture>
|
||||
#include <QtConcurrent/QtConcurrentRun>
|
||||
|
|
Loading…
Reference in New Issue
Block a user