Refactoring.
Fix code style.
This commit is contained in:
parent
3ce8e6e5a7
commit
7320c1c5df
|
@ -27,11 +27,12 @@
|
|||
*************************************************************************/
|
||||
|
||||
#include "preferencesconfigurationpage.h"
|
||||
#include "ui_preferencesconfigurationpage.h"
|
||||
#include "../../core/vapplication.h"
|
||||
#include "../vpatterndb/pmsystems.h"
|
||||
#include "../vmisc/vvalentinasettings.h"
|
||||
#include "../vmisc/literals.h"
|
||||
#include "../vmisc/vvalentinasettings.h"
|
||||
#include "../vpatterndb/pmsystems.h"
|
||||
#include "def.h"
|
||||
#include "ui_preferencesconfigurationpage.h"
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
#include "../vmisc/backport/qoverload.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
|
@ -55,10 +56,8 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent)
|
|||
ui->autoSaveCheck->setChecked(VAbstractValApplication::VApp()->ValentinaSettings()->GetAutosaveState());
|
||||
|
||||
InitLanguages(ui->langCombo);
|
||||
connect(ui->langCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this]()
|
||||
{
|
||||
m_langChanged = true;
|
||||
});
|
||||
connect(ui->langCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
[this]() { m_langChanged = true; });
|
||||
|
||||
//-------------------- Decimal separator setup
|
||||
ui->osOptionCheck->setChecked(VAbstractValApplication::VApp()->ValentinaSettings()->GetOsSeparator());
|
||||
|
@ -71,10 +70,8 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent)
|
|||
ui->unitCombo->setCurrentIndex(indexUnit);
|
||||
}
|
||||
|
||||
connect(ui->unitCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this]()
|
||||
{
|
||||
m_unitChanged = true;
|
||||
});
|
||||
connect(ui->unitCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
[this]() { m_unitChanged = true; });
|
||||
|
||||
//----------------------- Label language
|
||||
SetLabelComboBox(VApplication::LabelLanguages());
|
||||
|
@ -84,18 +81,17 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent)
|
|||
{
|
||||
ui->labelCombo->setCurrentIndex(index);
|
||||
}
|
||||
connect(ui->labelCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this]()
|
||||
{
|
||||
m_labelLangChanged = true;
|
||||
});
|
||||
connect(ui->labelCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
[this]() { m_labelLangChanged = true; });
|
||||
|
||||
//---------------------- Pattern making system
|
||||
ui->systemBookValueLabel->setFixedHeight(4 * QFontMetrics(ui->systemBookValueLabel->font()).lineSpacing());
|
||||
connect(ui->systemCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this]()
|
||||
connect(ui->systemCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
[this]()
|
||||
{
|
||||
m_systemChanged = true;
|
||||
QString text = VAbstractApplication::VApp()->TrVars()
|
||||
->PMSystemAuthor(ui->systemCombo->currentData().toString());
|
||||
QString text =
|
||||
VAbstractApplication::VApp()->TrVars()->PMSystemAuthor(ui->systemCombo->currentData().toString());
|
||||
ui->systemAuthorValueLabel->setText(text);
|
||||
ui->systemAuthorValueLabel->setToolTip(text);
|
||||
|
||||
|
@ -111,7 +107,8 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent)
|
|||
}
|
||||
|
||||
//----------------------------- Pattern Editing
|
||||
connect(ui->resetWarningsButton, &QPushButton::released, this, []()
|
||||
connect(ui->resetWarningsButton, &QPushButton::released, this,
|
||||
[]()
|
||||
{
|
||||
VValentinaSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
|
||||
|
||||
|
|
|
@ -31,8 +31,6 @@
|
|||
|
||||
#include <QWidget>
|
||||
|
||||
#include "../vmisc/defglobal.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class PreferencesConfigurationPage;
|
||||
|
@ -42,13 +40,14 @@ class PreferencesConfigurationPage : public QWidget
|
|||
{
|
||||
Q_OBJECT // NOLINT
|
||||
|
||||
public:
|
||||
explicit PreferencesConfigurationPage(QWidget *parent = nullptr);
|
||||
public : explicit PreferencesConfigurationPage(QWidget *parent = nullptr);
|
||||
~PreferencesConfigurationPage() override;
|
||||
|
||||
auto Apply() -> QStringList;
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *event) override;
|
||||
|
||||
private:
|
||||
// cppcheck-suppress unknownMacro
|
||||
Q_DISABLE_COPY_MOVE(PreferencesConfigurationPage) // NOLINT
|
||||
|
|
|
@ -26,28 +26,29 @@
|
|||
**
|
||||
*************************************************************************/
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDate>
|
||||
#include <QDebug>
|
||||
#include <QFileInfo>
|
||||
#include <QFlags> // QFlags<Qt::Alignment>
|
||||
#include <QFontMetrics>
|
||||
#include <QGlobalStatic>
|
||||
#include <QLatin1String>
|
||||
#include <QRegularExpression>
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
#include <QFlags> // QFlags<Qt::Alignment>
|
||||
#include <QtMath>
|
||||
#include <QGlobalStatic>
|
||||
|
||||
#include "../ifc/xml/vabstractpattern.h"
|
||||
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
|
||||
#include "../vmisc/vabstractvalapplication.h"
|
||||
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 9, 0)
|
||||
#include "../vmisc/vdatastreamenum.h"
|
||||
#endif
|
||||
|
||||
#include "../vpatterndb/vcontainer.h"
|
||||
#include "../vpatterndb/calculator.h"
|
||||
#include "../vpatterndb/variables/vmeasurement.h"
|
||||
#include "../vpatterndb/vcontainer.h"
|
||||
#include "vtextmanager.h"
|
||||
|
||||
const quint32 TextLine::streamHeader = 0xA3881E49; // CRC-32Q string "TextLine"
|
||||
|
@ -93,7 +94,8 @@ auto operator>>(QDataStream &dataStream, TextLine &data) -> QDataStream&
|
|||
{
|
||||
QString message = QCoreApplication::tr("TextLine compatibility error: actualClassVersion = %1 and "
|
||||
"classVersion = %2")
|
||||
.arg(actualClassVersion).arg(TextLine::classVersion);
|
||||
.arg(actualClassVersion)
|
||||
.arg(TextLine::classVersion);
|
||||
throw VException(message);
|
||||
}
|
||||
|
||||
|
@ -156,7 +158,8 @@ auto operator>>(QDataStream &dataStream, VTextManager &data) -> QDataStream&
|
|||
{
|
||||
QString message = QCoreApplication::tr("VTextManager compatibility error: actualClassVersion = %1 and "
|
||||
"classVersion = %2")
|
||||
.arg(actualClassVersion).arg(VTextManager::classVersion);
|
||||
.arg(actualClassVersion)
|
||||
.arg(VTextManager::classVersion);
|
||||
throw VException(message);
|
||||
}
|
||||
|
||||
|
@ -205,8 +208,8 @@ auto PreparePlaceholders(const VAbstractPattern *doc, const VContainer *data) ->
|
|||
{
|
||||
placeholders.insert(pl_customer, VAbstractValApplication::VApp()->GetCustomerName());
|
||||
|
||||
const QString birthDate = locale.toString(VAbstractValApplication::VApp()->GetCustomerBirthDate(),
|
||||
doc->GetLabelDateFormat());
|
||||
const QString birthDate =
|
||||
locale.toString(VAbstractValApplication::VApp()->GetCustomerBirthDate(), doc->GetLabelDateFormat());
|
||||
placeholders.insert(pl_birthDate, birthDate);
|
||||
|
||||
placeholders.insert(pl_email, VAbstractValApplication::VApp()->CustomerEmail());
|
||||
|
@ -256,7 +259,8 @@ auto PreparePlaceholders(const VAbstractPattern *doc, const VContainer *data) ->
|
|||
}
|
||||
|
||||
placeholders.insert(pl_mExt, VAbstractValApplication::VApp()->GetMeasurementsType() == MeasurementsType::Multisize
|
||||
? QStringLiteral("vst") : QStringLiteral("vit"));
|
||||
? QStringLiteral("vst")
|
||||
: QStringLiteral("vit"));
|
||||
|
||||
const QMap<int, QString> materials = doc->GetPatternMaterials();
|
||||
for (int i = 0; i < userMaterialPlaceholdersQuantity; ++i)
|
||||
|
@ -304,9 +308,12 @@ auto PreparePlaceholders(const VAbstractPattern *doc, const VContainer *data) ->
|
|||
catch (qmu::QmuParserError &e)
|
||||
{
|
||||
const QString errorMsg = QObject::tr("Failed to prepare final measurement placeholder. Parser error at "
|
||||
"line %1: %2.").arg(i+1).arg(e.GetMsg());
|
||||
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||
"line %1: %2.")
|
||||
.arg(i + 1)
|
||||
.arg(e.GetMsg());
|
||||
VAbstractApplication::VApp()->IsPedantic()
|
||||
? throw VException(errorMsg)
|
||||
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -362,8 +369,9 @@ void InitPiecePlaceholders(QMap<QString, QString> &placeholders, const QString &
|
|||
catch (qmu::QmuParserError &e)
|
||||
{
|
||||
const QString errorMsg = QObject::tr("Failed to prepare full piece area placeholder. %2.").arg(e.GetMsg());
|
||||
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||
VAbstractApplication::VApp()->IsPedantic()
|
||||
? throw VException(errorMsg)
|
||||
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -375,8 +383,9 @@ void InitPiecePlaceholders(QMap<QString, QString> &placeholders, const QString &
|
|||
catch (qmu::QmuParserError &e)
|
||||
{
|
||||
const QString errorMsg = QObject::tr("Failed to prepare piece seam line area placeholder. %2.").arg(e.GetMsg());
|
||||
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||
VAbstractApplication::VApp()->IsPedantic()
|
||||
? throw VException(errorMsg)
|
||||
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -389,8 +398,9 @@ auto ReplacePlaceholders(const QMap<QString, QString> &placeholders, QString lin
|
|||
{
|
||||
if (line.contains(per + placeholder + per) && placeholders.value(placeholder) == QChar('0'))
|
||||
{
|
||||
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||
VAbstractApplication::VApp()->IsPedantic()
|
||||
? throw VException(errorMsg)
|
||||
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -593,8 +603,7 @@ void VTextManager::FitFontSize(qreal fW, qreal fH)
|
|||
fnt.setPixelSize(iFS + maxLine.m_iFontSize);
|
||||
QFontMetrics fm(fnt);
|
||||
lineLength = TextWidth(fm, maxLine.m_qsText);
|
||||
}
|
||||
while (lineLength > fW && iFS > MIN_FONT_SIZE);
|
||||
} while (lineLength > fW && iFS > MIN_FONT_SIZE);
|
||||
}
|
||||
SetFontSize(iFS);
|
||||
}
|
||||
|
|
|
@ -33,9 +33,12 @@
|
|||
#include <QColor>
|
||||
#include <QComboBox>
|
||||
#include <QCursor>
|
||||
#include <QDesktopServices>
|
||||
#include <QDir>
|
||||
#include <QDirIterator>
|
||||
#include <QFileInfo>
|
||||
#include <QGlobalStatic>
|
||||
#include <QGraphicsItem>
|
||||
#include <QGuiApplication>
|
||||
#include <QImage>
|
||||
#include <QLatin1Char>
|
||||
|
@ -44,15 +47,12 @@
|
|||
#include <QMessageLogger>
|
||||
#include <QObject>
|
||||
#include <QPixmap>
|
||||
#include <QPixmapCache>
|
||||
#include <QPrinterInfo>
|
||||
#include <QProcess>
|
||||
#include <QRgb>
|
||||
#include <QtDebug>
|
||||
#include <QPixmapCache>
|
||||
#include <QGraphicsItem>
|
||||
#include <QGlobalStatic>
|
||||
#include <QDesktopServices>
|
||||
#include <QUrl>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "vabstractapplication.h"
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
||||
|
@ -95,27 +95,8 @@ void SetItemOverrideCursor(QGraphicsItem *item, const QString &pixmapPath, int h
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto SupportedLocales() -> QStringList
|
||||
{
|
||||
return QStringList
|
||||
{
|
||||
"uk_UA",
|
||||
"de_DE",
|
||||
"cs_CZ",
|
||||
"he_IL",
|
||||
"fr_FR",
|
||||
"it_IT",
|
||||
"nl_NL",
|
||||
"id_ID",
|
||||
"es_ES",
|
||||
"fi_FI",
|
||||
"en_US",
|
||||
"en_CA",
|
||||
"en_IN",
|
||||
"ro_RO",
|
||||
"zh_CN",
|
||||
"pt_BR",
|
||||
"el_GR",
|
||||
"pl_PL"
|
||||
};
|
||||
return QStringList{"uk_UA", "de_DE", "cs_CZ", "he_IL", "fr_FR", "it_IT", "nl_NL", "id_ID", "es_ES",
|
||||
"fi_FI", "en_US", "en_CA", "en_IN", "ro_RO", "zh_CN", "pt_BR", "el_GR", "pl_PL"};
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -224,12 +205,10 @@ auto darkenPixmap(const QPixmap &pixmap) -> QPixmap
|
|||
void ShowInGraphicalShell(const QString &filePath)
|
||||
{
|
||||
#ifdef Q_OS_MAC
|
||||
QStringList args{
|
||||
"-e", "tell application \"Finder\"",
|
||||
QStringList args{"-e", "tell application \"Finder\"",
|
||||
"-e", "activate",
|
||||
"-e", "select POSIX file \"" + filePath + "\"",
|
||||
"-e", "end tell"
|
||||
};
|
||||
"-e", "end tell"};
|
||||
QProcess::startDetached(QStringLiteral("osascript"), args);
|
||||
#elif defined(Q_OS_WIN)
|
||||
QProcess::startDetached(QStringLiteral("explorer"), QStringList{"/select", QDir::toNativeSeparators(filePath)});
|
||||
|
@ -238,7 +217,8 @@ void ShowInGraphicalShell(const QString &filePath)
|
|||
QString command = QStringLiteral("dbus-send --reply-timeout=%1 --session --dest=org.freedesktop.FileManager1 "
|
||||
"--type=method_call /org/freedesktop/FileManager1 "
|
||||
"org.freedesktop.FileManager1.ShowItems array:string:\"%2\" string:\"\"")
|
||||
.arg(timeout).arg(QUrl::fromLocalFile(filePath).toString());
|
||||
.arg(timeout)
|
||||
.arg(QUrl::fromLocalFile(filePath).toString());
|
||||
|
||||
// Sending message through dbus will highlighting file
|
||||
QProcess dbus;
|
||||
|
@ -449,7 +429,6 @@ auto StringToPassmarkAngleType(const QString &value) -> PassmarkAngleType
|
|||
return PassmarkAngleType::Straightforward;
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto StrToUnits(const QString &unit) -> Unit
|
||||
{
|
||||
|
@ -603,7 +582,8 @@ auto operator>>(QDataStream &in, CustomSARecord &record) -> QDataStream &
|
|||
{
|
||||
QString message = QCoreApplication::tr("CustomSARecord compatibility error: actualClassVersion = %1 and "
|
||||
"classVersion = %2")
|
||||
.arg(actualClassVersion).arg(CustomSARecord::classVersion);
|
||||
.arg(actualClassVersion)
|
||||
.arg(CustomSARecord::classVersion);
|
||||
throw VException(message);
|
||||
}
|
||||
|
||||
|
@ -703,8 +683,7 @@ auto SplitFilePaths(const QString &path) -> QStringList
|
|||
result.prepend(lastFileName);
|
||||
subPath = fileInfo.path();
|
||||
}
|
||||
}
|
||||
while(not lastFileName.isEmpty());
|
||||
} while (not lastFileName.isEmpty());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -34,14 +34,14 @@
|
|||
#include <qt_windows.h>
|
||||
#endif /*Q_OS_WIN*/
|
||||
|
||||
#include <qcompilerdetection.h>
|
||||
#include <QLineF>
|
||||
#include <QMargins>
|
||||
#include <QPrinter>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <Qt>
|
||||
#include <csignal>
|
||||
#include <QMargins>
|
||||
#include <QLineF>
|
||||
#include <qcompilerdetection.h>
|
||||
|
||||
#include "debugbreak.h"
|
||||
#include "defglobal.h"
|
||||
|
@ -83,15 +83,63 @@ constexpr qreal maxCurveApproximationScale = 10.0;
|
|||
constexpr int minLabelFontSize = 5;
|
||||
constexpr int maxLabelFontSize = 100;
|
||||
|
||||
enum class NodeDetail : qint8 { Contour, Modeling };
|
||||
enum class SceneObject : qint8 { Point, Line, Spline, Arc, ElArc, SplinePath, Detail, Unknown };
|
||||
enum class MeasurementsType : qint8 { Multisize, Individual, Unknown};
|
||||
enum class Unit : qint8 { Mm = 0, Cm, Inch, Px, LAST_UNIT_DO_NOT_USE};
|
||||
enum class Source : qint8 { FromGui, FromFile, FromTool };
|
||||
enum class NodeUsage : bool {NotInUse = false, InUse = true};
|
||||
enum class SelectionType : bool {ByMousePress, ByMouseRelease};
|
||||
enum class PageOrientation : bool {Portrait = true, Landscape = false};
|
||||
enum class Draw : qint8 { Calculation, Modeling, Layout };
|
||||
enum class NodeDetail : qint8
|
||||
{
|
||||
Contour,
|
||||
Modeling
|
||||
};
|
||||
enum class SceneObject : qint8
|
||||
{
|
||||
Point,
|
||||
Line,
|
||||
Spline,
|
||||
Arc,
|
||||
ElArc,
|
||||
SplinePath,
|
||||
Detail,
|
||||
Unknown
|
||||
};
|
||||
enum class MeasurementsType : qint8
|
||||
{
|
||||
Multisize,
|
||||
Individual,
|
||||
Unknown
|
||||
};
|
||||
enum class Unit : qint8
|
||||
{
|
||||
Mm = 0,
|
||||
Cm,
|
||||
Inch,
|
||||
Px,
|
||||
LAST_UNIT_DO_NOT_USE
|
||||
};
|
||||
enum class Source : qint8
|
||||
{
|
||||
FromGui,
|
||||
FromFile,
|
||||
FromTool
|
||||
};
|
||||
enum class NodeUsage : bool
|
||||
{
|
||||
NotInUse = false,
|
||||
InUse = true
|
||||
};
|
||||
enum class SelectionType : bool
|
||||
{
|
||||
ByMousePress,
|
||||
ByMouseRelease
|
||||
};
|
||||
enum class PageOrientation : bool
|
||||
{
|
||||
Portrait = true,
|
||||
Landscape = false
|
||||
};
|
||||
enum class Draw : qint8
|
||||
{
|
||||
Calculation,
|
||||
Modeling,
|
||||
Layout
|
||||
};
|
||||
|
||||
enum class PieceNodeAngle : quint8
|
||||
{
|
||||
|
@ -147,7 +195,13 @@ enum class PiecePathIncludeType : quint8
|
|||
AsCustomSA = 1
|
||||
};
|
||||
|
||||
enum class PiecePathType : quint8 {PiecePath = 0, CustomSeamAllowance = 1, InternalPath = 2, Unknown = 3};
|
||||
enum class PiecePathType : quint8
|
||||
{
|
||||
PiecePath = 0,
|
||||
CustomSeamAllowance = 1,
|
||||
InternalPath = 2,
|
||||
Unknown = 3
|
||||
};
|
||||
|
||||
typedef int ToolVisHolderType;
|
||||
enum class Tool : ToolVisHolderType
|
||||
|
@ -279,16 +333,37 @@ enum class Layout : ToolVisHolderType
|
|||
LAST_ONE_DO_NOT_USE // add new stuffs above this, this constant must be last and never used
|
||||
};
|
||||
|
||||
enum class VarType : qint8 { Measurement, MeasurementSeparator, Increment, IncrementSeparator, LineLength, CurveLength,
|
||||
CurveCLength, LineAngle, CurveAngle, ArcRadius, PieceExternalArea, PieceSeamLineArea,
|
||||
Unknown };
|
||||
enum class VarType : qint8
|
||||
{
|
||||
Measurement,
|
||||
MeasurementSeparator,
|
||||
Increment,
|
||||
IncrementSeparator,
|
||||
LineLength,
|
||||
CurveLength,
|
||||
CurveCLength,
|
||||
LineAngle,
|
||||
CurveAngle,
|
||||
ArcRadius,
|
||||
PieceExternalArea,
|
||||
PieceSeamLineArea,
|
||||
Unknown
|
||||
};
|
||||
|
||||
enum class IncrementType : qint8 { Increment, Separator };
|
||||
enum class IncrementType : qint8
|
||||
{
|
||||
Increment,
|
||||
Separator
|
||||
};
|
||||
|
||||
auto IncrementTypeToString(IncrementType type) -> QString;
|
||||
auto StringToIncrementType(const QString &value) -> IncrementType;
|
||||
|
||||
enum class MeasurementType : qint8 { Measurement, Separator };
|
||||
enum class MeasurementType : qint8
|
||||
{
|
||||
Measurement,
|
||||
Separator
|
||||
};
|
||||
|
||||
auto MeasurementTypeToString(MeasurementType type) -> QString;
|
||||
auto StringToMeasurementType(const QString &value) -> MeasurementType;
|
||||
|
@ -330,8 +405,7 @@ enum class IMD: qint8 // Individual measurement dimension
|
|||
#define SCASSERT(cond) \
|
||||
if (!(cond)) \
|
||||
{ \
|
||||
qCritical("ASSERT: %s in %s (%s:%u)", \
|
||||
#cond, Q_FUNC_INFO , __FILE__, __LINE__); \
|
||||
qCritical("ASSERT: %s in %s (%s:%u)", #cond, Q_FUNC_INFO, __FILE__, __LINE__); \
|
||||
debug_break(); \
|
||||
abort(); \
|
||||
}
|
||||
|
@ -393,10 +467,9 @@ void InitHighDpiScaling(int argc, char *argv[]);
|
|||
// We'll assume that it will be fixed in 5.12.11, 5.15.3, and 6.0.1.
|
||||
// Feel free to add other versions if needed.
|
||||
#define MACOS_LAYER_BACKING_AFFECTED \
|
||||
(QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) && QT_VERSION < QT_VERSION_CHECK(5, 12, 11) \
|
||||
|| (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) && QT_VERSION < QT_VERSION_CHECK(5, 15, 3)) \
|
||||
|| (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) && QT_VERSION < QT_VERSION_CHECK(6, 0, 1)) \
|
||||
)
|
||||
(QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) && QT_VERSION < QT_VERSION_CHECK(5, 12, 11) || \
|
||||
(QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) && QT_VERSION < QT_VERSION_CHECK(5, 15, 3)) || \
|
||||
(QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) && QT_VERSION < QT_VERSION_CHECK(6, 0, 1)))
|
||||
|
||||
#if MACOS_LAYER_BACKING_AFFECTED
|
||||
#include <QOperatingSystemVersion>
|
||||
|
@ -442,9 +515,18 @@ Q_DECL_RELAXED_CONSTEXPR inline auto ToPixel(double val, const Unit &unit) -> do
|
|||
return 0;
|
||||
}
|
||||
|
||||
template<typename T> constexpr inline auto PixelToInch(T pix) -> T {return pix / PrintDPI;}
|
||||
template<typename T> constexpr inline auto PixelToMm(T pix) -> T {return PixelToInch(pix) * 25.4;}
|
||||
template<typename T> constexpr inline auto PixelToCm(T pix) -> T {return PixelToInch(pix) * 2.54;}
|
||||
template <typename T> constexpr inline auto PixelToInch(T pix) -> T
|
||||
{
|
||||
return pix / PrintDPI;
|
||||
}
|
||||
template <typename T> constexpr inline auto PixelToMm(T pix) -> T
|
||||
{
|
||||
return PixelToInch(pix) * 25.4;
|
||||
}
|
||||
template <typename T> constexpr inline auto PixelToCm(T pix) -> T
|
||||
{
|
||||
return PixelToInch(pix) * 2.54;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
Q_DECL_RELAXED_CONSTEXPR inline auto FromPixel(double pix, const Unit &unit) -> double
|
||||
|
@ -465,9 +547,18 @@ Q_DECL_RELAXED_CONSTEXPR inline auto FromPixel(double pix, const Unit &unit) ->
|
|||
return 0;
|
||||
}
|
||||
|
||||
template<typename T> constexpr inline auto Inch2ToPixel2(T val) -> T {return val * (PrintDPI * PrintDPI);}
|
||||
template<typename T> constexpr inline auto Mm2ToPixel2(T val) -> T {return Inch2ToPixel2(val * 0.001550031);}
|
||||
template<typename T> constexpr inline auto Cm2ToPixel2(T val) -> T {return Inch2ToPixel2(val * 0.15500031);}
|
||||
template <typename T> constexpr inline auto Inch2ToPixel2(T val) -> T
|
||||
{
|
||||
return val * (PrintDPI * PrintDPI);
|
||||
}
|
||||
template <typename T> constexpr inline auto Mm2ToPixel2(T val) -> T
|
||||
{
|
||||
return Inch2ToPixel2(val * 0.001550031);
|
||||
}
|
||||
template <typename T> constexpr inline auto Cm2ToPixel2(T val) -> T
|
||||
{
|
||||
return Inch2ToPixel2(val * 0.15500031);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
Q_DECL_RELAXED_CONSTEXPR inline auto ToPixel2(double val, const Unit &unit) -> double
|
||||
|
@ -488,9 +579,18 @@ Q_DECL_RELAXED_CONSTEXPR inline auto ToPixel2(double val, const Unit &unit) -> d
|
|||
return 0;
|
||||
}
|
||||
|
||||
template<typename T> constexpr inline auto Pixel2ToInch2(T pix) -> T { return pix / (PrintDPI * PrintDPI);}
|
||||
template<typename T> constexpr inline auto Pixel2ToMm2(T pix) -> T { return Pixel2ToInch2(pix) / 0.001550031;}
|
||||
template<typename T> constexpr inline auto Pixel2ToCm2(T pix) -> T { return Pixel2ToInch2(pix) / 0.15500031;}
|
||||
template <typename T> constexpr inline auto Pixel2ToInch2(T pix) -> T
|
||||
{
|
||||
return pix / (PrintDPI * PrintDPI);
|
||||
}
|
||||
template <typename T> constexpr inline auto Pixel2ToMm2(T pix) -> T
|
||||
{
|
||||
return Pixel2ToInch2(pix) / 0.001550031;
|
||||
}
|
||||
template <typename T> constexpr inline auto Pixel2ToCm2(T pix) -> T
|
||||
{
|
||||
return Pixel2ToInch2(pix) / 0.15500031;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
Q_DECL_RELAXED_CONSTEXPR inline auto FromPixel2(double pix, const Unit &unit) -> double
|
||||
|
@ -587,8 +687,8 @@ Q_DECL_RELAXED_CONSTEXPR inline auto UnitConvertor(qreal value, const Unit &from
|
|||
* @brief UnitConvertor Converts the values of the given margin from given unit to the new unit.
|
||||
* returns a new instand of QMarginsF.
|
||||
*/
|
||||
Q_DECL_RELAXED_CONSTEXPR inline auto UnitConvertor(const QMarginsF &margins, const Unit &from,
|
||||
const Unit &to) -> QMarginsF
|
||||
Q_DECL_RELAXED_CONSTEXPR inline auto UnitConvertor(const QMarginsF &margins, const Unit &from, const Unit &to)
|
||||
-> QMarginsF
|
||||
{
|
||||
const qreal left = UnitConvertor(margins.left(), from, to);
|
||||
const qreal top = UnitConvertor(margins.top(), from, to);
|
||||
|
@ -642,7 +742,8 @@ struct CustomSARecord
|
|||
endPoint(0),
|
||||
reverse(false),
|
||||
includeType(PiecePathIncludeType::AsCustomSA)
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
friend auto operator<<(QDataStream &out, const CustomSARecord &record) -> QDataStream &;
|
||||
friend auto operator>>(QDataStream &in, CustomSARecord &record) -> QDataStream &;
|
||||
|
@ -672,7 +773,9 @@ Q_DECLARE_TYPEINFO(CustomSARecord, Q_MOVABLE_TYPE); // NOLINT
|
|||
** this file shall be copyright (C) 2006-2008 by Adam Higerd.
|
||||
****************************************************************************/
|
||||
|
||||
#define QXT_DECLARE_PRIVATE(PUB) friend class PUB##Private; QxtPrivateInterface<PUB, PUB##Private> qxt_d;
|
||||
#define QXT_DECLARE_PRIVATE(PUB) \
|
||||
friend class PUB##Private; \
|
||||
QxtPrivateInterface<PUB, PUB##Private> qxt_d;
|
||||
#define QXT_DECLARE_PUBLIC(PUB) friend class PUB;
|
||||
#define QXT_INIT_PRIVATE(PUB) qxt_d.setPublic(this);
|
||||
#define QXT_D(PUB) PUB##Private &d = qxt_d()
|
||||
|
@ -682,18 +785,15 @@ QT_WARNING_PUSH
|
|||
QT_WARNING_DISABLE_GCC("-Wsuggest-final-types")
|
||||
QT_WARNING_DISABLE_GCC("-Wsuggest-final-methods")
|
||||
|
||||
template <typename PUB>
|
||||
class QxtPrivate
|
||||
template <typename PUB> class QxtPrivate
|
||||
{
|
||||
public:
|
||||
QxtPrivate(): qxt_p_ptr(nullptr)
|
||||
{}
|
||||
virtual ~QxtPrivate()
|
||||
{}
|
||||
inline void QXT_setPublic(PUB* pub)
|
||||
QxtPrivate()
|
||||
: qxt_p_ptr(nullptr)
|
||||
{
|
||||
qxt_p_ptr = pub;
|
||||
}
|
||||
virtual ~QxtPrivate() {}
|
||||
inline void QXT_setPublic(PUB *pub) { qxt_p_ptr = pub; }
|
||||
|
||||
protected:
|
||||
inline auto qxt_p() -> PUB & { return *qxt_p_ptr; }
|
||||
|
@ -709,22 +809,18 @@ private:
|
|||
// cppcheck-suppress unknownMacro
|
||||
QT_WARNING_POP
|
||||
|
||||
template <typename PUB, typename PVT>
|
||||
class QxtPrivateInterface
|
||||
template <typename PUB, typename PVT> class QxtPrivateInterface
|
||||
{
|
||||
friend class QxtPrivate<PUB>;
|
||||
public:
|
||||
QxtPrivateInterface() : pvt(new PVT)
|
||||
{}
|
||||
~QxtPrivateInterface()
|
||||
{
|
||||
delete pvt;
|
||||
}
|
||||
|
||||
inline void setPublic(PUB* pub)
|
||||
public:
|
||||
QxtPrivateInterface()
|
||||
: pvt(new PVT)
|
||||
{
|
||||
pvt->QXT_setPublic(pub);
|
||||
}
|
||||
~QxtPrivateInterface() { delete pvt; }
|
||||
|
||||
inline void setPublic(PUB *pub) { pvt->QXT_setPublic(pub); }
|
||||
inline auto operator()() -> PVT & { return *static_cast<PVT *>(pvt); }
|
||||
inline auto operator()() const -> const PVT & { return *static_cast<PVT *>(pvt); }
|
||||
inline auto operator->() -> PVT * { return static_cast<PVT *>(pvt); }
|
||||
|
|
|
@ -29,12 +29,14 @@
|
|||
#include "customevents.h"
|
||||
#include "vvalentinasettings.h"
|
||||
|
||||
#include <QTranslator>
|
||||
#include <QWidget>
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VAbstractValApplication::VAbstractValApplication(int &argc, char **argv)
|
||||
: VAbstractApplication(argc, argv)
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VAbstractValApplication::toPixel(double val) const -> double
|
||||
|
@ -71,6 +73,7 @@ void VAbstractValApplication::OpenSettings()
|
|||
auto VAbstractValApplication::ValentinaSettings() -> VValentinaSettings *
|
||||
{
|
||||
SCASSERT(settings != nullptr)
|
||||
|
||||
return qobject_cast<VValentinaSettings *>(settings);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,12 +37,13 @@ class VAbstractPattern;
|
|||
class VMainGraphicsView;
|
||||
class QGraphicsScene;
|
||||
class VValentinaSettings;
|
||||
class QTranslator;
|
||||
|
||||
class VAbstractValApplication : public VAbstractApplication
|
||||
{
|
||||
Q_OBJECT // NOLINT
|
||||
public:
|
||||
VAbstractValApplication(int &argc, char **argv);
|
||||
|
||||
public : VAbstractValApplication(int &argc, char **argv);
|
||||
virtual ~VAbstractValApplication() = default;
|
||||
|
||||
auto GetCustomerName() const -> QString;
|
||||
|
|
|
@ -29,16 +29,16 @@
|
|||
#include "vcommonsettings.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QColor>
|
||||
#include <QDate>
|
||||
#include <QDir>
|
||||
#include <QFont>
|
||||
#include <QGlobalStatic>
|
||||
#include <QLocale>
|
||||
#include <QMarginsF>
|
||||
#include <QMessageLogger>
|
||||
#include <QVariant>
|
||||
#include <QtDebug>
|
||||
#include <QFont>
|
||||
#include <QGlobalStatic>
|
||||
#include <QMarginsF>
|
||||
#include <QColor>
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
#include "vtextcodec.h"
|
||||
|
@ -46,9 +46,9 @@
|
|||
#include <QTextCodec>
|
||||
#endif
|
||||
|
||||
#include "compatibility.h"
|
||||
#include "def.h"
|
||||
#include "defglobal.h"
|
||||
#include "compatibility.h"
|
||||
#include "literals.h"
|
||||
|
||||
const int VCommonSettings::defaultScrollingDuration = 300;
|
||||
|
@ -77,60 +77,92 @@ Q_DECLARE_METATYPE(QMarginsF) // NOLINT
|
|||
|
||||
namespace
|
||||
{
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsIndividualMeasurements, (QLatin1String("paths/individual_measurements"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsMultisizeMeasurements, (QLatin1String("paths/standard_measurements"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsIndividualMeasurements,
|
||||
(QLatin1String("paths/individual_measurements"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsMultisizeMeasurements,
|
||||
(QLatin1String("paths/standard_measurements"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsPattern, (QLatin1String("paths/pattern"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsTemplates, (QLatin1String("paths/templates"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsLabelTemplate, (QLatin1String("paths/labels"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsManualLayouts, (QLatin1String("paths/manualLayouts"))) // NOLINT
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationOsSeparator, (QLatin1String("configuration/osSeparator"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationAutosaveState, (QLatin1String("configuration/autosave/state"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationAutosaveTime , (QLatin1String("configuration/autosave/time"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationOsSeparator,
|
||||
(QLatin1String("configuration/osSeparator"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationAutosaveState,
|
||||
(QLatin1String("configuration/autosave/state"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationAutosaveTime,
|
||||
(QLatin1String("configuration/autosave/time"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationLocale, (QLatin1String("configuration/locale"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPMSystemCode, (QLatin1String("configuration/pmscode"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationUnit, (QLatin1String("configuration/unit"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationConfirmItemDeletion, (QLatin1String("configuration/confirm_item_deletion"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationConfirmFormatRewriting, (QLatin1String("configuration/confirm_format_rewriting"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationAskContinueIfLayoutStale, (QLatin1String("configuration/askContinueIfLayoutStale"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationToolBarStyle, (QLatin1String("configuration/tool_bar_style"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationFreeCurveMode, (QLatin1String("configuration/freeCurveMode"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationDoubleClickZoomFitBestCurrentPP, (QLatin1String("configuration/doubleClickZoomFitBestCurrentPP"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationInteractiveTools, (QLatin1String("configuration/interactiveTools"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationDontUseNativeDialog, (QLatin1String("configuration/dontUseNativeDialog"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationConfirmItemDeletion,
|
||||
(QLatin1String("configuration/confirm_item_deletion"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationConfirmFormatRewriting,
|
||||
(QLatin1String("configuration/confirm_format_rewriting"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationAskContinueIfLayoutStale,
|
||||
(QLatin1String("configuration/askContinueIfLayoutStale"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationToolBarStyle,
|
||||
(QLatin1String("configuration/tool_bar_style"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationFreeCurveMode,
|
||||
(QLatin1String("configuration/freeCurveMode"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationDoubleClickZoomFitBestCurrentPP,
|
||||
(QLatin1String("configuration/doubleClickZoomFitBestCurrentPP"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationInteractiveTools,
|
||||
(QLatin1String("configuration/interactiveTools"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationDontUseNativeDialog,
|
||||
(QLatin1String("configuration/dontUseNativeDialog"))) // NOLINT
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternUndo, (QLatin1String("pattern/undo"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternForbidFlipping, (QLatin1String("pattern/forbidFlipping"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternForceFlipping, (QLatin1String("pattern/forceFlipping"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternSewLineOnDrawing, (QLatin1String("pattern/sewLineOnDrawing"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternForbidFlipping,
|
||||
(QLatin1String("pattern/forbidFlipping"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternForceFlipping,
|
||||
(QLatin1String("pattern/forceFlipping"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternSewLineOnDrawing,
|
||||
(QLatin1String("pattern/sewLineOnDrawing"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternHideMainPath, (QLatin1String("pattern/hideMainPath"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDoublePassmark, (QLatin1String("pattern/doublePassmark"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternDefaultSeamAllowance, (QLatin1String("pattern/defaultSeamAllowance"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternDefaultSeamAllowance,
|
||||
(QLatin1String("pattern/defaultSeamAllowance"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternLabelFont, (QLatin1String("pattern/labelFont"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternLineWidth, (QLatin1String("pattern/lineWidth"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternCurveApproximationScale, (QLatin1String("pattern/curveApproximationScale"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternShowCurveDetails, (QLatin1String("pattern/showCurveDetails"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternPieceShowMainPath, (QLatin1String("pattern/pieceShowMainPath"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternLabelFontSize, (QLatin1String("pattern/labelFontSize"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternCurveApproximationScale,
|
||||
(QLatin1String("pattern/curveApproximationScale"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternShowCurveDetails,
|
||||
(QLatin1String("pattern/showCurveDetails"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternPieceShowMainPath,
|
||||
(QLatin1String("pattern/pieceShowMainPath"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternLabelFontSize,
|
||||
(QLatin1String("pattern/labelFontSize"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternHideLabels, (QLatin1String("pattern/hideLabels"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternShowAccuracyRadius, (QLatin1String("pattern/showAccuracyRadius"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternUseOpenGLRender, (QLatin1String("pattern/useOpenGLRender"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternGraphicalOutput, (QLatin1String("pattern/graphicalOutput"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternShowAccuracyRadius,
|
||||
(QLatin1String("pattern/showAccuracyRadius"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternUseOpenGLRender,
|
||||
(QLatin1String("pattern/useOpenGLRender"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternGraphicalOutput,
|
||||
(QLatin1String("pattern/graphicalOutput"))) // NOLINT
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralRecentFileList, (QLatin1String("recentFileList"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralRestoreFileList, (QLatin1String("restoreFileList"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralGeometry, (QLatin1String("geometry"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralToolbarsState, (QLatin1String("toolbarsState"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationDarkMode, (QLatin1String("configuration/dark_mode"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationDarkMode,
|
||||
(QLatin1String("configuration/dark_mode"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPreferenceDialogSize, (QLatin1String("preferenceDialogSize"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingToolSeamAllowanceDialogSize, (QLatin1String("toolSeamAllowanceDialogSize"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingIncrementsDialogSize, (QLatin1String("toolIncrementsDialogSize"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingFormulaWizardDialogSize, (QLatin1String("formulaWizardDialogSize"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingFinalMeasurementsDialogSize, (QLatin1String("finalMeasurementsDialogSize"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSettingsDialogSize, (QLatin1String("layoutSettingsDialogSize"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingToolSeamAllowanceDialogSize,
|
||||
(QLatin1String("toolSeamAllowanceDialogSize"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingIncrementsDialogSize,
|
||||
(QLatin1String("toolIncrementsDialogSize"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingFormulaWizardDialogSize,
|
||||
(QLatin1String("formulaWizardDialogSize"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingFinalMeasurementsDialogSize,
|
||||
(QLatin1String("finalMeasurementsDialogSize"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSettingsDialogSize,
|
||||
(QLatin1String("layoutSettingsDialogSize"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDialogSplinePathSize, (QLatin1String("splinePathDialogSize"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingAutomaticallyCheckUpdates, (QLatin1String("automaticallyCheckUpdates"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLatestSkippedVersion, (QLatin1String("lastestSkippedVersion"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingAutomaticallyCheckUpdates,
|
||||
(QLatin1String("automaticallyCheckUpdates"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLatestSkippedVersion,
|
||||
(QLatin1String("lastestSkippedVersion"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDateOfLastRemind, (QLatin1String("dateOfLastRemind"))) // NOLINT
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingCSVWithHeader, (QLatin1String("csv/withHeader"))) // NOLINT
|
||||
|
@ -138,21 +170,28 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingCSVCodec, (QLatin1String("csv/wi
|
|||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingCSVSeparator, (QLatin1String("csv/withSeparator"))) // NOLINT
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLabelDateFormat, (QLatin1String("label/dateFormat"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLabelUserDateFormats, (QLatin1String("label/userDateFormats"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLabelUserDateFormats,
|
||||
(QLatin1String("label/userDateFormats"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLabelTimeFormat, (QLatin1String("label/timeFormat"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLabelUserTimeFormats, (QLatin1String("label/userTimeFormats"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLabelUserTimeFormats,
|
||||
(QLatin1String("label/userTimeFormats"))) // NOLINT
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingDuration, (QLatin1String("scrolling/duration"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingUpdateInterval, (QLatin1String("scrolling/updateInterval"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingSensorMouseScale, (QLatin1String("scrolling/sensorMouseScale"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingWheelMouseScale, (QLatin1String("scrolling/wheelMouseScale"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingAcceleration, (QLatin1String("scrolling/acceleration"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingUpdateInterval,
|
||||
(QLatin1String("scrolling/updateInterval"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingSensorMouseScale,
|
||||
(QLatin1String("scrolling/sensorMouseScale"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingWheelMouseScale,
|
||||
(QLatin1String("scrolling/wheelMouseScale"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingAcceleration,
|
||||
(QLatin1String("scrolling/acceleration"))) // NOLINT
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFMargins, (QLatin1String("tiledPDF/margins"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFOrientation, (QLatin1String("tiledPDF/orientation"))) // NOLINT
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingWatermarkEditorSize, (QLatin1String("watermarkEditorSize"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingWatermarkCustomColors, (QLatin1String("watermarkCustomColors"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingWatermarkCustomColors,
|
||||
(QLatin1String("watermarkCustomColors"))) // NOLINT
|
||||
|
||||
// Reading settings file is very expensive, cache curve approximation to speed up getting value
|
||||
qreal curveApproximationCached = -1; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
|
@ -284,15 +323,17 @@ auto PrepareStandardFiles(const QString ¤tPath, const QString &standardPat
|
|||
} // namespace
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VCommonSettings::VCommonSettings(Format format, Scope scope, const QString &organization,
|
||||
const QString &application, QObject *parent)
|
||||
VCommonSettings::VCommonSettings(Format format, Scope scope, const QString &organization, const QString &application,
|
||||
QObject *parent)
|
||||
: QSettings(format, scope, organization, application, parent)
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VCommonSettings::VCommonSettings(const QString &fileName, QSettings::Format format, QObject *parent)
|
||||
: QSettings(fileName, format, parent)
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VCommonSettings::SharePath(const QString &shareItem) -> QString
|
||||
|
@ -596,8 +637,8 @@ void VCommonSettings::SetPMSystemCode(const QString &value)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VCommonSettings::GetUnit() const -> QString
|
||||
{
|
||||
return value(*settingConfigurationUnit,
|
||||
QLocale().measurementSystem() == QLocale::MetricSystem ? unitCM : unitINCH).toString();
|
||||
return value(*settingConfigurationUnit, QLocale().measurementSystem() == QLocale::MetricSystem ? unitCM : unitINCH)
|
||||
.toString();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -666,7 +707,6 @@ void VCommonSettings::SetDarkMode(const bool &value)
|
|||
setValue(*settingConfigurationDarkMode, value);
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VCommonSettings::IsFreeCurveMode() const -> bool
|
||||
{
|
||||
|
@ -1102,8 +1142,7 @@ auto VCommonSettings::GetDefaultSeamAllowance() -> double
|
|||
if (not ok)
|
||||
{
|
||||
qDebug() << "Could not convert value" << value(*settingPatternDefaultSeamAllowance, 0)
|
||||
<< "to real. Return default value for default seam allowance is "
|
||||
<< defaultValue << QChar('.');
|
||||
<< "to real. Return default value for default seam allowance is " << defaultValue << QChar('.');
|
||||
val = defaultValue;
|
||||
}
|
||||
|
||||
|
@ -1188,8 +1227,8 @@ void VCommonSettings::SetShowAccuracyRadius(bool value)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VCommonSettings::GetLabelDateFormat() const -> QString
|
||||
{
|
||||
const QString format = value(*settingLabelDateFormat,
|
||||
ConstFirst<QString> (VCommonSettings::PredefinedDateFormats())).toString();
|
||||
const QString format =
|
||||
value(*settingLabelDateFormat, ConstFirst<QString>(VCommonSettings::PredefinedDateFormats())).toString();
|
||||
const QStringList allFormats = VCommonSettings::PredefinedDateFormats() + GetUserDefinedDateFormats();
|
||||
|
||||
return allFormats.contains(format) ? format : ConstFirst<QString>(VCommonSettings::PredefinedDateFormats());
|
||||
|
@ -1204,9 +1243,7 @@ void VCommonSettings::SetLabelDateFormat(const QString &format)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VCommonSettings::PredefinedDateFormats() -> QStringList
|
||||
{
|
||||
return QStringList
|
||||
{
|
||||
"MM-dd-yyyy",
|
||||
return QStringList{"MM-dd-yyyy",
|
||||
"d/M/yy",
|
||||
"ddddMMMM dd, yyyy",
|
||||
"dd/MM/yy",
|
||||
|
@ -1225,8 +1262,7 @@ auto VCommonSettings::PredefinedDateFormats() -> QStringList
|
|||
"yyyy-MM-dd",
|
||||
"MM/yy",
|
||||
"MMM dd",
|
||||
"MMMM"
|
||||
};
|
||||
"MMMM"};
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -1244,8 +1280,8 @@ void VCommonSettings::SetUserDefinedDateFormats(const QStringList &formats)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VCommonSettings::GetLabelTimeFormat() const -> QString
|
||||
{
|
||||
const QString format = value(*settingLabelTimeFormat,
|
||||
ConstFirst<QString> (VCommonSettings::PredefinedTimeFormats())).toString();
|
||||
const QString format =
|
||||
value(*settingLabelTimeFormat, ConstFirst<QString>(VCommonSettings::PredefinedTimeFormats())).toString();
|
||||
const QStringList allFormats = VCommonSettings::PredefinedTimeFormats() + GetUserDefinedTimeFormats();
|
||||
|
||||
return allFormats.contains(format) ? format : ConstFirst<QString>(VCommonSettings::PredefinedTimeFormats());
|
||||
|
@ -1260,13 +1296,7 @@ void VCommonSettings::SetLabelTimeFormat(const QString &format)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VCommonSettings::PredefinedTimeFormats() -> QStringList
|
||||
{
|
||||
return QStringList
|
||||
{
|
||||
"hh:mm:ss",
|
||||
"hh:mm:ss AP",
|
||||
"hh:mm",
|
||||
"hh:mm AP"
|
||||
};
|
||||
return QStringList{"hh:mm:ss", "hh:mm:ss AP", "hh:mm", "hh:mm AP"};
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -1512,8 +1542,8 @@ void VCommonSettings::SetGraphicalOutput(const bool &value)
|
|||
auto VCommonSettings::GetTiledPDFMargins(const Unit &unit) const -> QMarginsF
|
||||
{
|
||||
// default value is 10mm. We save the margins in mm in the setting.
|
||||
return UnitConvertor(
|
||||
ValueOrDef<QMarginsF>(*this, *settingTiledPDFMargins, QMarginsF(10, 10, 10, 10)), Unit::Mm, unit);
|
||||
return UnitConvertor(ValueOrDef<QMarginsF>(*this, *settingTiledPDFMargins, QMarginsF(10, 10, 10, 10)), Unit::Mm,
|
||||
unit);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -38,17 +38,16 @@
|
|||
#include <QStringList>
|
||||
#include <QtGlobal>
|
||||
|
||||
#include "../vmisc/def.h"
|
||||
#include "../vlayout/vlayoutdef.h"
|
||||
#include "../vmisc/def.h"
|
||||
|
||||
class QMarginsF;
|
||||
|
||||
class VCommonSettings : public QSettings
|
||||
{
|
||||
Q_OBJECT // NOLINT
|
||||
public:
|
||||
VCommonSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(),
|
||||
QObject *parent = nullptr);
|
||||
public : VCommonSettings(Format format, Scope scope, const QString &organization,
|
||||
const QString &application = QString(), QObject *parent = nullptr);
|
||||
VCommonSettings(const QString &fileName, Format format, QObject *parent = nullptr);
|
||||
~VCommonSettings() override = default;
|
||||
|
||||
|
@ -306,7 +305,6 @@ public:
|
|||
void SetWatermarkCustomColors(QVector<QColor> colors);
|
||||
|
||||
protected:
|
||||
|
||||
template <typename T>
|
||||
static auto GetCachedValue(const QSettings &settings, T &cache, const QString &setting, T defValue, T valueMin,
|
||||
T valueMax) -> T;
|
||||
|
@ -359,8 +357,8 @@ inline auto VCommonSettings::ValueOrDef(const QSettings &settings, const QString
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template <>
|
||||
inline auto VCommonSettings::ValueOrDef<Cases>(const QSettings &settings, const QString &setting,
|
||||
const Cases &defValue) -> Cases
|
||||
inline auto VCommonSettings::ValueOrDef<Cases>(const QSettings &settings, const QString &setting, const Cases &defValue)
|
||||
-> Cases
|
||||
{
|
||||
const QVariant val = settings.value(setting, QVariant::fromValue(static_cast<int>(defValue)));
|
||||
const int g = val.canConvert<int>() ? val.toInt() : static_cast<int>(defValue);
|
||||
|
|
|
@ -28,26 +28,26 @@
|
|||
|
||||
#include "vcontainer.h"
|
||||
|
||||
#include <climits>
|
||||
#include <QLoggingCategory>
|
||||
#include <QUuid>
|
||||
#include <QVector>
|
||||
#include <QtDebug>
|
||||
#include <QUuid>
|
||||
#include <QLoggingCategory>
|
||||
#include <climits>
|
||||
|
||||
#include "../ifc/exception/vexception.h"
|
||||
#include "../vgeometry/vabstractcubicbezierpath.h"
|
||||
#include "../vgeometry/vabstractcurve.h"
|
||||
#include "../vgeometry/varc.h"
|
||||
#include "../vgeometry/vellipticalarc.h"
|
||||
#include "../vgeometry/vgeometrydef.h"
|
||||
#include "../vgeometry/vgobject.h"
|
||||
#include "../vgeometry/vpointf.h"
|
||||
#include "../vgeometry/vspline.h"
|
||||
#include "../vgeometry/varc.h"
|
||||
#include "../vgeometry/vellipticalarc.h"
|
||||
#include "../vmisc/literals.h"
|
||||
#include "variables/varcradius.h"
|
||||
#include "variables/vcurveangle.h"
|
||||
#include "variables/vcurvelength.h"
|
||||
#include "variables/vcurveclength.h"
|
||||
#include "variables/vcurvelength.h"
|
||||
#include "variables/vincrement.h"
|
||||
#include "variables/vlineangle.h"
|
||||
#include "variables/vlinelength.h"
|
||||
|
@ -119,9 +119,9 @@ auto VContainer::operator=(const VContainer &data) -> VContainer &
|
|||
|
||||
#ifdef Q_COMPILER_RVALUE_REFS
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VContainer::VContainer(VContainer &&data) Q_DECL_NOTHROW
|
||||
:d(std::move(data.d))
|
||||
{}
|
||||
VContainer::VContainer(VContainer &&data) Q_DECL_NOTHROW : d(std::move(data.d))
|
||||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VContainer::operator=(VContainer &&data) Q_DECL_NOTHROW->VContainer &
|
||||
|
@ -144,7 +144,8 @@ VContainer::VContainer(const VContainer &data)
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VContainer::~VContainer()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VContainer::UniqueNamespace() -> QString
|
||||
|
@ -153,8 +154,7 @@ auto VContainer::UniqueNamespace() -> QString
|
|||
do
|
||||
{
|
||||
candidate = QUuid::createUuid().toString();
|
||||
}
|
||||
while(_id.contains(candidate));
|
||||
} while (_id.contains(candidate));
|
||||
|
||||
return candidate;
|
||||
}
|
||||
|
@ -204,11 +204,9 @@ auto VContainer::GetPiece(quint32 id) const -> VPiece
|
|||
{
|
||||
return d->pieces->value(id);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
throw VExceptionBadId(tr("Can't find object"), id);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VContainer::GetPiecePath(quint32 id) const -> VPiecePath
|
||||
|
@ -392,15 +390,9 @@ void VContainer::ClearForFullParse()
|
|||
d->pieces->clear();
|
||||
d->piecePaths->clear();
|
||||
Q_STATIC_ASSERT_X(static_cast<int>(VarType::Unknown) == 12, "Check that you used all types");
|
||||
ClearVariables(QVector<VarType>{VarType::Increment,
|
||||
VarType::IncrementSeparator,
|
||||
VarType::LineAngle,
|
||||
VarType::LineLength,
|
||||
VarType::CurveLength,
|
||||
VarType::CurveCLength,
|
||||
VarType::ArcRadius,
|
||||
VarType::CurveAngle,
|
||||
VarType::PieceExternalArea,
|
||||
ClearVariables(QVector<VarType>{VarType::Increment, VarType::IncrementSeparator, VarType::LineAngle,
|
||||
VarType::LineLength, VarType::CurveLength, VarType::CurveCLength,
|
||||
VarType::ArcRadius, VarType::CurveAngle, VarType::PieceExternalArea,
|
||||
VarType::PieceSeamLineArea});
|
||||
ClearGObjects();
|
||||
ClearUniqueNames();
|
||||
|
@ -495,9 +487,8 @@ void VContainer::AddArc(const QSharedPointer<VAbstractCurve> &arc, const quint32
|
|||
void VContainer::AddCurve(const QSharedPointer<VAbstractCurve> &curve, const quint32 &id, quint32 parentId)
|
||||
{
|
||||
const GOType curveType = curve->getType();
|
||||
if (curveType != GOType::Spline && curveType != GOType::SplinePath &&
|
||||
curveType != GOType::CubicBezier && curveType != GOType::CubicBezierPath &&
|
||||
curveType != GOType::Arc && curveType != GOType::EllipticalArc)
|
||||
if (curveType != GOType::Spline && curveType != GOType::SplinePath && curveType != GOType::CubicBezier &&
|
||||
curveType != GOType::CubicBezierPath && curveType != GOType::Arc && curveType != GOType::EllipticalArc)
|
||||
{
|
||||
throw VException(tr("Can't create a curve with type '%1'").arg(static_cast<int>(curveType)));
|
||||
}
|
||||
|
|
|
@ -27,28 +27,28 @@
|
|||
*************************************************************************/
|
||||
|
||||
#include "dialogeditlabel.h"
|
||||
#include "ui_dialogeditlabel.h"
|
||||
#include "../vmisc/vabstractapplication.h"
|
||||
#include "ui_dialogeditlabel.h"
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
#include "../vmisc/backport/qoverload.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
#include "../vformat/vlabeltemplate.h"
|
||||
#include "../ifc/xml/vlabeltemplateconverter.h"
|
||||
#include "../ifc/xml/vabstractpattern.h"
|
||||
#include "../ifc/exception/vexception.h"
|
||||
#include "../vpatterndb/vcontainer.h"
|
||||
#include "../vpatterndb/vpiece.h"
|
||||
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
|
||||
#include "../ifc/xml/vabstractpattern.h"
|
||||
#include "../ifc/xml/vlabeltemplateconverter.h"
|
||||
#include "../tools/dialogtool.h"
|
||||
#include "../vformat/vlabeltemplate.h"
|
||||
#include "../vpatterndb/calculator.h"
|
||||
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
|
||||
#include "../vpatterndb/variables/vmeasurement.h"
|
||||
#include "../vpatterndb/variables/vpiecearea.h"
|
||||
#include "../tools/dialogtool.h"
|
||||
#include "../vpatterndb/vcontainer.h"
|
||||
#include "../vpatterndb/vpiece.h"
|
||||
|
||||
#include <QDate>
|
||||
#include <QDir>
|
||||
#include <QMessageBox>
|
||||
#include <QFileDialog>
|
||||
#include <QMenu>
|
||||
#include <QDate>
|
||||
#include <QMessageBox>
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogEditLabel::DialogEditLabel(const VAbstractPattern *doc, const VContainer *data, QWidget *parent)
|
||||
|
@ -77,7 +77,8 @@ DialogEditLabel::DialogEditLabel(const VAbstractPattern *doc, const VContainer *
|
|||
connect(ui->toolButtonImportLabel, &QToolButton::clicked, this, &DialogEditLabel::ImportTemplate);
|
||||
connect(ui->spinBoxFontSize, QOverload<int>::of(&QSpinBox::valueChanged), this,
|
||||
&DialogEditLabel::SaveAdditionalFontSize);
|
||||
connect(ui->toolButtonTop, &QToolButton::clicked, this, [this](){DialogTool::MoveListRowTop(ui->listWidgetEdit);});
|
||||
connect(ui->toolButtonTop, &QToolButton::clicked, this,
|
||||
[this]() { DialogTool::MoveListRowTop(ui->listWidgetEdit); });
|
||||
connect(ui->toolButtonUp, &QToolButton::clicked, this, [this]() { DialogTool::MoveListRowUp(ui->listWidgetEdit); });
|
||||
connect(ui->toolButtonDown, &QToolButton::clicked, this,
|
||||
[this]() { DialogTool::MoveListRowDown(ui->listWidgetEdit); });
|
||||
|
@ -279,7 +280,8 @@ void DialogEditLabel::NewTemplate()
|
|||
{
|
||||
if (ui->listWidgetEdit->count() > 0)
|
||||
{
|
||||
const QMessageBox::StandardButton answer = QMessageBox::question(this, tr("Create new template"),
|
||||
const QMessageBox::StandardButton answer =
|
||||
QMessageBox::question(this, tr("Create new template"),
|
||||
tr("Creating new template will overwrite the current, do "
|
||||
"you want to continue?"),
|
||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
||||
|
@ -340,7 +342,8 @@ void DialogEditLabel::ImportTemplate()
|
|||
{
|
||||
if (ui->listWidgetEdit->count() > 0)
|
||||
{
|
||||
const QMessageBox::StandardButton answer = QMessageBox::question(this, tr("Import template"),
|
||||
const QMessageBox::StandardButton answer =
|
||||
QMessageBox::question(this, tr("Import template"),
|
||||
tr("Import template will overwrite the current, do "
|
||||
"you want to continue?"),
|
||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
||||
|
@ -518,22 +521,22 @@ void DialogEditLabel::InitPlaceholders()
|
|||
|
||||
const QString pUnits = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||
m_placeholders.insert(pl_pUnits, qMakePair(tr("Pattern units"), pUnits));
|
||||
m_placeholders.insert(pl_mSizeUnits, qMakePair(tr("Size units"),
|
||||
UnitsToStr(VAbstractValApplication::VApp()->DimensionSizeUnits(),
|
||||
true)));
|
||||
m_placeholders.insert(
|
||||
pl_mSizeUnits,
|
||||
qMakePair(tr("Size units"), UnitsToStr(VAbstractValApplication::VApp()->DimensionSizeUnits(), true)));
|
||||
m_placeholders.insert(pl_areaUnits, qMakePair(tr("Area units"), pUnits + QStringLiteral("²")));
|
||||
|
||||
if (VAbstractValApplication::VApp()->GetMeasurementsType() == MeasurementsType::Individual)
|
||||
{
|
||||
m_placeholders.insert(pl_customer, qMakePair(tr("Customer name"),
|
||||
VAbstractValApplication::VApp()->GetCustomerName()));
|
||||
m_placeholders.insert(pl_customer,
|
||||
qMakePair(tr("Customer name"), VAbstractValApplication::VApp()->GetCustomerName()));
|
||||
|
||||
const QString birthDate = locale.toString(VAbstractValApplication::VApp()->GetCustomerBirthDate(),
|
||||
m_doc->GetLabelDateFormat());
|
||||
const QString birthDate =
|
||||
locale.toString(VAbstractValApplication::VApp()->GetCustomerBirthDate(), m_doc->GetLabelDateFormat());
|
||||
m_placeholders.insert(pl_birthDate, qMakePair(tr("Customer birth date"), birthDate));
|
||||
|
||||
m_placeholders.insert(pl_email, qMakePair(tr("Customer email"),
|
||||
VAbstractValApplication::VApp()->CustomerEmail()));
|
||||
m_placeholders.insert(pl_email,
|
||||
qMakePair(tr("Customer email"), VAbstractValApplication::VApp()->CustomerEmail()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -571,35 +574,35 @@ void DialogEditLabel::InitPlaceholders()
|
|||
|
||||
{
|
||||
QString label = VAbstractValApplication::VApp()->GetDimensionHeightLabel();
|
||||
m_placeholders.insert(pl_heightLabel, qMakePair(tr("Height label", "dimension"),
|
||||
not label.isEmpty() ? label : heightValue));
|
||||
m_placeholders.insert(pl_dimensionX, qMakePair(tr("Dimension X label", "dimension"),
|
||||
not label.isEmpty() ? label : heightValue));
|
||||
m_placeholders.insert(pl_heightLabel,
|
||||
qMakePair(tr("Height label", "dimension"), not label.isEmpty() ? label : heightValue));
|
||||
m_placeholders.insert(
|
||||
pl_dimensionX, qMakePair(tr("Dimension X label", "dimension"), not label.isEmpty() ? label : heightValue));
|
||||
|
||||
label = VAbstractValApplication::VApp()->GetDimensionSizeLabel();
|
||||
m_placeholders.insert(pl_sizeLabel, qMakePair(tr("Size label", "dimension"),
|
||||
not label.isEmpty() ? label : sizeValue));
|
||||
m_placeholders.insert(pl_dimensionY, qMakePair(tr("Dimension Y label", "dimension"),
|
||||
not label.isEmpty() ? label : sizeValue));
|
||||
m_placeholders.insert(pl_sizeLabel,
|
||||
qMakePair(tr("Size label", "dimension"), not label.isEmpty() ? label : sizeValue));
|
||||
m_placeholders.insert(pl_dimensionY,
|
||||
qMakePair(tr("Dimension Y label", "dimension"), not label.isEmpty() ? label : sizeValue));
|
||||
|
||||
label = VAbstractValApplication::VApp()->GetDimensionHipLabel();
|
||||
m_placeholders.insert(pl_hipLabel, qMakePair(tr("Hip label", "dimension"),
|
||||
not label.isEmpty() ? label : hipValue));
|
||||
m_placeholders.insert(pl_dimensionZ, qMakePair(tr("Dimension Z label", "dimension"),
|
||||
not label.isEmpty() ? label : hipValue));
|
||||
m_placeholders.insert(pl_hipLabel,
|
||||
qMakePair(tr("Hip label", "dimension"), not label.isEmpty() ? label : hipValue));
|
||||
m_placeholders.insert(pl_dimensionZ,
|
||||
qMakePair(tr("Dimension Z label", "dimension"), not label.isEmpty() ? label : hipValue));
|
||||
|
||||
label = VAbstractValApplication::VApp()->GetDimensionWaistLabel();
|
||||
m_placeholders.insert(pl_waistLabel, qMakePair(tr("Waist label", "dimension"),
|
||||
not label.isEmpty() ? label : waistValue));
|
||||
m_placeholders.insert(pl_dimensionW, qMakePair(tr("Dimension W label", "dimension"),
|
||||
not label.isEmpty() ? label : waistValue));
|
||||
m_placeholders.insert(pl_waistLabel,
|
||||
qMakePair(tr("Waist label", "dimension"), not label.isEmpty() ? label : waistValue));
|
||||
m_placeholders.insert(
|
||||
pl_dimensionW, qMakePair(tr("Dimension W label", "dimension"), not label.isEmpty() ? label : waistValue));
|
||||
}
|
||||
|
||||
|
||||
m_placeholders.insert(pl_mExt,
|
||||
qMakePair(tr("Measurments extension"),
|
||||
m_placeholders.insert(
|
||||
pl_mExt, qMakePair(tr("Measurments extension"),
|
||||
VAbstractValApplication::VApp()->GetMeasurementsType() == MeasurementsType::Multisize
|
||||
? QStringLiteral("vst") : QStringLiteral("vit")));
|
||||
? QStringLiteral("vst")
|
||||
: QStringLiteral("vit")));
|
||||
|
||||
const QString userMaterialStr = tr("User material");
|
||||
const QMap<int, QString> materials = m_doc->GetPatternMaterials();
|
||||
|
@ -651,15 +654,18 @@ void DialogEditLabel::InitPlaceholders()
|
|||
QScopedPointer<Calculator> cal(new Calculator());
|
||||
const qreal result = cal->EvalFormula(completeData.DataVariables(), m.formula);
|
||||
|
||||
m_placeholders.insert(pl_finalMeasurement + m.name, qMakePair(tr("Final measurement: %1").arg(m.name),
|
||||
QString::number(result)));
|
||||
m_placeholders.insert(pl_finalMeasurement + m.name,
|
||||
qMakePair(tr("Final measurement: %1").arg(m.name), QString::number(result)));
|
||||
}
|
||||
catch (qmu::QmuParserError &e)
|
||||
{
|
||||
const QString errorMsg = QObject::tr("Failed to prepare final measurement placeholder. Parser error at "
|
||||
"line %1: %2.").arg(i+1).arg(e.GetMsg());
|
||||
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||
"line %1: %2.")
|
||||
.arg(i + 1)
|
||||
.arg(e.GetMsg());
|
||||
VAbstractApplication::VApp()->IsPedantic()
|
||||
? throw VException(errorMsg)
|
||||
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -690,8 +696,9 @@ auto DialogEditLabel::ReplacePlaceholders(QString line) const -> QString
|
|||
{
|
||||
if (line.contains(per + placeholder + per) && m_placeholders.value(placeholder).second == QChar('0'))
|
||||
{
|
||||
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||
VAbstractApplication::VApp()->IsPedantic()
|
||||
? throw VException(errorMsg)
|
||||
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -803,8 +810,9 @@ void DialogEditLabel::SetPiece(const VPiece &piece)
|
|||
catch (qmu::QmuParserError &e)
|
||||
{
|
||||
const QString errorMsg = QObject::tr("Failed to prepare full piece area placeholder. %2.").arg(e.GetMsg());
|
||||
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||
VAbstractApplication::VApp()->IsPedantic()
|
||||
? throw VException(errorMsg)
|
||||
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -816,8 +824,9 @@ void DialogEditLabel::SetPiece(const VPiece &piece)
|
|||
catch (qmu::QmuParserError &e)
|
||||
{
|
||||
const QString errorMsg = QObject::tr("Failed to prepare piece seam line area placeholder. %2.").arg(e.GetMsg());
|
||||
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||
VAbstractApplication::VApp()->IsPedantic()
|
||||
? throw VException(errorMsg)
|
||||
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,6 @@
|
|||
#include "nodeDetails/vtoolplacelabel.h"
|
||||
|
||||
#include <QFuture>
|
||||
#include <QtConcurrent/QtConcurrentRun>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
#include <QGraphicsView>
|
||||
#include <QKeyEvent>
|
||||
|
@ -78,6 +77,7 @@
|
|||
#include <QMessageBox>
|
||||
#include <QTimer>
|
||||
#include <QUuid>
|
||||
#include <QtConcurrent/QtConcurrentRun>
|
||||
#include <QtMath>
|
||||
#include <chrono>
|
||||
#include <memory>
|
||||
|
@ -118,8 +118,7 @@ const QString VToolSeamAllowance::AttrPiecePriority = QStringLiteral("priority")
|
|||
namespace
|
||||
{
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template <typename T>
|
||||
auto FixLabelPins(T itemData, const QMap<quint32, quint32> &mappedPins) -> T
|
||||
template <typename T> auto FixLabelPins(T itemData, const QMap<quint32, quint32> &mappedPins) -> T
|
||||
{
|
||||
itemData.SetCenterPin(mappedPins.value(itemData.CenterPin(), NULL_ID));
|
||||
itemData.SetTopLeftPin(mappedPins.value(itemData.TopLeftPin(), NULL_ID));
|
||||
|
@ -128,8 +127,7 @@ auto FixLabelPins(T itemData, const QMap<quint32, quint32> &mappedPins) -> T
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template <typename T>
|
||||
auto FixGrainlinePins(T itemData, const QMap<quint32, quint32> &mappedPins) -> T
|
||||
template <typename T> auto FixGrainlinePins(T itemData, const QMap<quint32, quint32> &mappedPins) -> T
|
||||
{
|
||||
itemData.SetCenterPin(mappedPins.value(itemData.CenterPin(), NULL_ID));
|
||||
itemData.SetTopPin(mappedPins.value(itemData.TopPin(), NULL_ID));
|
||||
|
@ -190,9 +188,7 @@ void UpdateLabelItem(VTextGraphicsItem *labelItem, QPointF pos, qreal labelAngle
|
|||
} // namespace
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VToolSeamAllowance::Create(const QPointer<DialogTool> &dialog,
|
||||
VMainGraphicsScene *scene,
|
||||
VAbstractPattern *doc,
|
||||
auto VToolSeamAllowance::Create(const QPointer<DialogTool> &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
|
||||
VContainer *data) -> VToolSeamAllowance *
|
||||
{
|
||||
SCASSERT(not dialog.isNull());
|
||||
|
@ -222,8 +218,9 @@ auto VToolSeamAllowance::Create(const QPointer<DialogTool> &dialog,
|
|||
{
|
||||
const QString errorMsg = QObject::tr("Piece '%1'. Unable to load default piece label template.\n%2\n%3")
|
||||
.arg(initData.detail.GetName(), e.ErrorMessage(), e.DetailedInformation());
|
||||
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||
VAbstractApplication::VApp()->IsPedantic()
|
||||
? throw VException(errorMsg)
|
||||
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -288,9 +285,8 @@ auto VToolSeamAllowance::Create(VToolSeamAllowanceInitData &initData) -> VToolSe
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VToolSeamAllowance::Duplicate(const QPointer<DialogTool> &dialog,
|
||||
VMainGraphicsScene *scene,
|
||||
VAbstractPattern *doc) -> VToolSeamAllowance *
|
||||
auto VToolSeamAllowance::Duplicate(const QPointer<DialogTool> &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc)
|
||||
-> VToolSeamAllowance *
|
||||
{
|
||||
SCASSERT(not dialog.isNull());
|
||||
const QPointer<DialogDuplicateDetail> dialogTool = qobject_cast<DialogDuplicateDetail *>(dialog);
|
||||
|
@ -327,8 +323,8 @@ auto VToolSeamAllowance::Duplicate(VToolSeamAllowanceInitData &initData) -> VToo
|
|||
|
||||
QMap<quint32, quint32> replacements;
|
||||
dupDetail.GetPath().SetNodes(DuplicateNodes(initData.detail.GetPath(), initData, replacements));
|
||||
dupDetail.SetCustomSARecords(DuplicateCustomSARecords(initData.detail.GetCustomSARecords(), initData,
|
||||
replacements));
|
||||
dupDetail.SetCustomSARecords(
|
||||
DuplicateCustomSARecords(initData.detail.GetCustomSARecords(), initData, replacements));
|
||||
dupDetail.SetInternalPaths(DuplicateInternalPaths(initData.detail.GetInternalPaths(), initData));
|
||||
dupDetail.SetPlaceLabels(DuplicatePlaceLabels(initData.detail.GetPlaceLabels(), initData));
|
||||
dupDetail.SetUUID(QUuid::createUuid());
|
||||
|
@ -649,7 +645,10 @@ void VToolSeamAllowance::ReinitInternals(const VPiece &detail, VMainGraphicsScen
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VToolSeamAllowance::getTagName() const -> QString { return VAbstractPattern::TagDetail; }
|
||||
auto VToolSeamAllowance::getTagName() const -> QString
|
||||
{
|
||||
return VAbstractPattern::TagDetail;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolSeamAllowance::ShowVisualization(bool show)
|
||||
|
@ -841,10 +840,10 @@ void VToolSeamAllowance::UpdateGrainline()
|
|||
|
||||
if (m_geometryIsReady && not IsGrainlinePositionValid())
|
||||
{
|
||||
const QString errorMsg = QObject::tr("Piece '%1'. Grainline is not valid.")
|
||||
.arg(detail.GetName());
|
||||
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||
const QString errorMsg = QObject::tr("Piece '%1'. Grainline is not valid.").arg(detail.GetName());
|
||||
VAbstractApplication::VApp()->IsPedantic()
|
||||
? throw VException(errorMsg)
|
||||
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -909,7 +908,6 @@ void VToolSeamAllowance::SaveRotationDetail(qreal dRot)
|
|||
VAbstractApplication::VApp()->getUndoStack()->push(rotateCommand);
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief SaveMovePattern saves the pattern label position
|
||||
|
@ -964,7 +962,6 @@ void VToolSeamAllowance::SaveRotationPattern(qreal dRot)
|
|||
VAbstractApplication::VApp()->getUndoStack()->push(rotateCommand);
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolSeamAllowance::SaveMoveGrainline(const QPointF &ptPos)
|
||||
{
|
||||
|
@ -1082,8 +1079,8 @@ void VToolSeamAllowance::AddToFile()
|
|||
AddPins(doc, domElement, piece.GetPins());
|
||||
AddPlaceLabels(doc, domElement, piece.GetPlaceLabels());
|
||||
|
||||
VAbstractApplication::VApp()->getUndoStack()->push(new AddPiece(domElement, doc, VAbstractTool::data,
|
||||
m_sceneDetails, m_drawName));
|
||||
VAbstractApplication::VApp()->getUndoStack()->push(
|
||||
new AddPiece(domElement, doc, VAbstractTool::data, m_sceneDetails, m_drawName));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -1095,8 +1092,7 @@ void VToolSeamAllowance::RefreshDataInFile()
|
|||
// Refresh only parts that we possibly need to update
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.4.0
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 4, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 4, 0), "Time to refactor the code.");
|
||||
|
||||
const uint version = VAbstractPattern::GetParametrUInt(domElement, AttrVersion, QChar('1'));
|
||||
if (version == 1)
|
||||
|
@ -1133,8 +1129,8 @@ auto VToolSeamAllowance::itemChange(QGraphicsItem::GraphicsItemChange change, co
|
|||
// value - this is new position.
|
||||
const QPointF newPos = value.toPointF();
|
||||
|
||||
VAbstractApplication::VApp()->getUndoStack()->push(new MovePiece(doc, newPos.x(), newPos.y(), m_id,
|
||||
scene()));
|
||||
VAbstractApplication::VApp()->getUndoStack()->push(
|
||||
new MovePiece(doc, newPos.x(), newPos.y(), m_id, scene()));
|
||||
|
||||
const QList<QGraphicsView *> viewList = scene()->views();
|
||||
if (not viewList.isEmpty())
|
||||
|
@ -1187,7 +1183,8 @@ void VToolSeamAllowance::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
|||
|
||||
if (selectionType == SelectionType::ByMouseRelease)
|
||||
{
|
||||
event->accept();// Special for not selectable item first need to call standard mousePressEvent then accept event
|
||||
event
|
||||
->accept(); // Special for not selectable item first need to call standard mousePressEvent then accept event
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1458,15 +1455,16 @@ void VToolSeamAllowance::RefreshGeometry(bool updateChildren)
|
|||
if (detail.IsSeamAllowance())
|
||||
{
|
||||
futureSeamAllowance = QtConcurrent::run([this, detail]() { return detail.SeamAllowancePoints(getData()); });
|
||||
futureSeamAllowanceValid = QtConcurrent::run([this, detail](){return detail.IsSeamAllowanceValid(getData());});
|
||||
futureSeamAllowanceValid =
|
||||
QtConcurrent::run([this, detail]() { return detail.IsSeamAllowanceValid(getData()); });
|
||||
}
|
||||
|
||||
this->setPos(detail.GetMx(), detail.GetMy());
|
||||
|
||||
QPainterPath path;
|
||||
|
||||
if (VAbstractApplication::VApp()->Settings()->IsPieceShowMainPath() || not detail.IsHideMainPath()
|
||||
|| not detail.IsSeamAllowance() || detail.IsSeamAllowanceBuiltIn())
|
||||
if (VAbstractApplication::VApp()->Settings()->IsPieceShowMainPath() || not detail.IsHideMainPath() ||
|
||||
not detail.IsSeamAllowance() || detail.IsSeamAllowanceBuiltIn())
|
||||
{
|
||||
m_mainPath = QPainterPath();
|
||||
m_seamAllowance->setBrush(QBrush(Qt::Dense7Pattern));
|
||||
|
@ -1488,10 +1486,10 @@ void VToolSeamAllowance::RefreshGeometry(bool updateChildren)
|
|||
{
|
||||
if (not futureSeamAllowanceValid.result())
|
||||
{
|
||||
const QString errorMsg = QObject::tr("Piece '%1'. Seam allowance is not valid.")
|
||||
.arg(detail.GetName());
|
||||
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||
const QString errorMsg = QObject::tr("Piece '%1'. Seam allowance is not valid.").arg(detail.GetName());
|
||||
VAbstractApplication::VApp()->IsPedantic()
|
||||
? throw VException(errorMsg)
|
||||
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||
}
|
||||
path.addPath(detail.SeamAllowancePath(futureSeamAllowance.result()));
|
||||
path.setFillRule(Qt::OddEvenFill);
|
||||
|
@ -1508,7 +1506,8 @@ void VToolSeamAllowance::RefreshGeometry(bool updateChildren)
|
|||
|
||||
if (VAbstractApplication::VApp()->IsAppInGUIMode())
|
||||
{
|
||||
QTimer::singleShot(V_MSECONDS(100), Qt::CoarseTimer, this, [this, updateChildren]()
|
||||
QTimer::singleShot(V_MSECONDS(100), Qt::CoarseTimer, this,
|
||||
[this, updateChildren]()
|
||||
{
|
||||
this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, false);
|
||||
UpdateDetailLabel();
|
||||
|
@ -1583,8 +1582,8 @@ void VToolSeamAllowance::SaveDialogChange(const QString &undoText)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolSeamAllowance::ShowOptions()
|
||||
{
|
||||
QPointer<DialogSeamAllowance> dialog = new DialogSeamAllowance(getData(), doc, m_id,
|
||||
VAbstractValApplication::VApp()->getMainWindow());
|
||||
QPointer<DialogSeamAllowance> dialog =
|
||||
new DialogSeamAllowance(getData(), doc, m_id, VAbstractValApplication::VApp()->getMainWindow());
|
||||
dialog->EnableApply(true);
|
||||
m_dialog = dialog;
|
||||
m_dialog->setModal(true);
|
||||
|
@ -1605,17 +1604,15 @@ void VToolSeamAllowance::ToggleInLayout(bool checked)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolSeamAllowance::ToggleForbidFlipping(bool checked)
|
||||
{
|
||||
VAbstractApplication::VApp()->getUndoStack()->push(
|
||||
new TogglePieceForceForbidFlipping(m_id, checked, ForceForbidFlippingType::ForbidFlipping,
|
||||
&(VAbstractTool::data), doc));
|
||||
VAbstractApplication::VApp()->getUndoStack()->push(new TogglePieceForceForbidFlipping(
|
||||
m_id, checked, ForceForbidFlippingType::ForbidFlipping, &(VAbstractTool::data), doc));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolSeamAllowance::ToggleForceFlipping(bool checked)
|
||||
{
|
||||
VAbstractApplication::VApp()->getUndoStack()->push(
|
||||
new TogglePieceForceForbidFlipping(m_id, checked, ForceForbidFlippingType::ForceFlipping,
|
||||
&(VAbstractTool::data), doc));
|
||||
VAbstractApplication::VApp()->getUndoStack()->push(new TogglePieceForceForbidFlipping(
|
||||
m_id, checked, ForceForbidFlippingType::ForceFlipping, &(VAbstractTool::data), doc));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -1766,19 +1763,17 @@ void VToolSeamAllowance::ResetPieceLabelTemplate()
|
|||
{
|
||||
const QString errorMsg = QObject::tr("Piece '%1'. Unable to load default piece label template.\n%2\n%3")
|
||||
.arg(newDet.GetName(), e.ErrorMessage(), e.DetailedInformation());
|
||||
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||
VAbstractApplication::VApp()->IsPedantic()
|
||||
? throw VException(errorMsg)
|
||||
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VToolSeamAllowance::FindLabelGeometry(const VPatternLabelData &labelData,
|
||||
const QVector<quint32> &pins,
|
||||
qreal &rotationAngle,
|
||||
qreal &labelWidth,
|
||||
qreal &labelHeight,
|
||||
QPointF &pos) -> VPieceItem::MoveTypes
|
||||
auto VToolSeamAllowance::FindLabelGeometry(const VPatternLabelData &labelData, const QVector<quint32> &pins,
|
||||
qreal &rotationAngle, qreal &labelWidth, qreal &labelHeight, QPointF &pos)
|
||||
-> VPieceItem::MoveTypes
|
||||
{
|
||||
|
||||
VPieceItem::MoveTypes restrictions = VPieceItem::AllModifications;
|
||||
|
@ -1801,16 +1796,16 @@ auto VToolSeamAllowance::FindLabelGeometry(const VPatternLabelData &labelData,
|
|||
const quint32 topLeftPin = labelData.TopLeftPin();
|
||||
const quint32 bottomRightPin = labelData.BottomRightPin();
|
||||
|
||||
if (topLeftPin != NULL_ID && pins.contains(topLeftPin) && bottomRightPin != NULL_ID
|
||||
&& pins.contains(bottomRightPin))
|
||||
if (topLeftPin != NULL_ID && pins.contains(topLeftPin) && bottomRightPin != NULL_ID &&
|
||||
pins.contains(bottomRightPin))
|
||||
{
|
||||
try
|
||||
{
|
||||
const auto topLeftPinPoint = VAbstractTool::data.GeometricObject<VPointF>(topLeftPin);
|
||||
const auto bottomRightPinPoint = VAbstractTool::data.GeometricObject<VPointF>(bottomRightPin);
|
||||
|
||||
const QRectF labelRect = QRectF(static_cast<QPointF>(*topLeftPinPoint),
|
||||
static_cast<QPointF>(*bottomRightPinPoint));
|
||||
const QRectF labelRect =
|
||||
QRectF(static_cast<QPointF>(*topLeftPinPoint), static_cast<QPointF>(*bottomRightPinPoint));
|
||||
labelWidth = FromPixel(qAbs(labelRect.width()), *VDataTool::data.GetPatternUnit());
|
||||
labelHeight = FromPixel(qAbs(labelRect.height()), *VDataTool::data.GetPatternUnit());
|
||||
|
||||
|
@ -1877,11 +1872,8 @@ auto VToolSeamAllowance::FindLabelGeometry(const VPatternLabelData &labelData,
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VToolSeamAllowance::FindGrainlineGeometry(const VGrainlineData &geom,
|
||||
const QVector<quint32> &pins,
|
||||
qreal &length,
|
||||
qreal &rotationAngle,
|
||||
QPointF &pos) -> VPieceItem::MoveTypes
|
||||
auto VToolSeamAllowance::FindGrainlineGeometry(const VGrainlineData &geom, const QVector<quint32> &pins, qreal &length,
|
||||
qreal &rotationAngle, QPointF &pos) -> VPieceItem::MoveTypes
|
||||
{
|
||||
const quint32 topPin = geom.TopPin();
|
||||
const quint32 bottomPin = geom.BottomPin();
|
||||
|
@ -1945,8 +1937,8 @@ auto VToolSeamAllowance::FindGrainlineGeometry(const VGrainlineData &geom,
|
|||
const auto centerPinPoint = VAbstractTool::data.GeometricObject<VPointF>(centerPin);
|
||||
|
||||
const qreal cLength = ToPixel(length, *VDataTool::data.GetPatternUnit());
|
||||
QLineF grainline(centerPinPoint->x(), centerPinPoint->y(),
|
||||
centerPinPoint->x() + cLength / 2.0, centerPinPoint->y());
|
||||
QLineF grainline(centerPinPoint->x(), centerPinPoint->y(), centerPinPoint->x() + cLength / 2.0,
|
||||
centerPinPoint->y());
|
||||
|
||||
grainline.setAngle(rotationAngle);
|
||||
grainline = QLineF(grainline.p2(), grainline.p1());
|
||||
|
@ -2014,8 +2006,8 @@ void VToolSeamAllowance::InitNode(const VPieceNode &node, VMainGraphicsScene *sc
|
|||
connect(tool, &VNodePoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem, Qt::UniqueConnection);
|
||||
connect(tool, &VNodePoint::TogglePassmarkAngleType, parent,
|
||||
&VToolSeamAllowance::TogglePassmarkAngleType, Qt::UniqueConnection);
|
||||
connect(tool, &VNodePoint::TogglePassmarkLineType, parent,
|
||||
&VToolSeamAllowance::TogglePassmarkLineType, Qt::UniqueConnection);
|
||||
connect(tool, &VNodePoint::TogglePassmarkLineType, parent, &VToolSeamAllowance::TogglePassmarkLineType,
|
||||
Qt::UniqueConnection);
|
||||
connect(tool, &VNodePoint::ResetPieceLabelTemplate, parent,
|
||||
&VToolSeamAllowance::ResetPieceLabelTemplate, Qt::UniqueConnection);
|
||||
tool->setParentItem(parent);
|
||||
|
@ -2114,8 +2106,8 @@ auto VToolSeamAllowance::PrepareLabelData(const VPatternLabelData &labelData, co
|
|||
|
||||
qreal labelWidth = 0;
|
||||
qreal labelHeight = 0;
|
||||
const VTextGraphicsItem::MoveTypes type = FindLabelGeometry(labelData, pins, labelAngle, labelWidth, labelHeight,
|
||||
pos);
|
||||
const VTextGraphicsItem::MoveTypes type =
|
||||
FindLabelGeometry(labelData, pins, labelAngle, labelWidth, labelHeight, pos);
|
||||
if (type & VGrainlineItem::Error)
|
||||
{
|
||||
labelItem->hide();
|
||||
|
@ -2182,8 +2174,8 @@ void VToolSeamAllowance::AddPointRecords(VAbstractPattern *doc, QDomElement &dom
|
|||
QDomElement pinsElement = doc->createElement(tag);
|
||||
for (auto record : records)
|
||||
{
|
||||
pinsElement.appendChild(doc->CreateElementWithText(VToolSeamAllowance::TagRecord,
|
||||
QString().setNum(record)));
|
||||
pinsElement.appendChild(
|
||||
doc->CreateElementWithText(VToolSeamAllowance::TagRecord, QString().setNum(record)));
|
||||
}
|
||||
domElement.appendChild(pinsElement);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user