Refactoring.
Code style.
This commit is contained in:
parent
031d6e7a07
commit
1847115627
|
@ -3,7 +3,6 @@ import qbs.File
|
|||
|
||||
VApp {
|
||||
Depends { name: "freedesktop2" }
|
||||
Depends { name: "tenv" }
|
||||
Depends { name: "windeployqt"; condition: qbs.targetOS.contains("windows") }
|
||||
Depends { name: "i18nconfig"; }
|
||||
Depends { name: "i18n"; }
|
||||
|
|
|
@ -27,24 +27,22 @@
|
|||
*************************************************************************/
|
||||
|
||||
#include "puzzlepreferencesconfigurationpage.h"
|
||||
#include "ui_puzzlepreferencesconfigurationpage.h"
|
||||
#include "../../vpapplication.h"
|
||||
#include "ui_puzzlepreferencesconfigurationpage.h"
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
#include "../vmisc/backport/qoverload.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
PuzzlePreferencesConfigurationPage::PuzzlePreferencesConfigurationPage(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
PuzzlePreferencesConfigurationPage::PuzzlePreferencesConfigurationPage(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
ui(new Ui::PuzzlePreferencesConfigurationPage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
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; });
|
||||
|
||||
VPSettings *settings = VPApplication::VApp()->PuzzleSettings();
|
||||
|
||||
|
|
|
@ -26,10 +26,10 @@
|
|||
**
|
||||
*************************************************************************/
|
||||
#include "dialogsavemanuallayout.h"
|
||||
#include "ui_dialogsavemanuallayout.h"
|
||||
#include "../vpapplication.h"
|
||||
#include "../ifc/exception/vexception.h"
|
||||
#include "../vlayout/vlayoutexporter.h"
|
||||
#include "../vpapplication.h"
|
||||
#include "ui_dialogsavemanuallayout.h"
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
#include "../vmisc/backport/qoverload.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
|
@ -38,12 +38,24 @@
|
|||
#include <QShowEvent>
|
||||
#include <QtDebug>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
#include "diagnostic.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
|
||||
namespace
|
||||
{
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
|
||||
|
||||
#ifndef Q_OS_WIN
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, baseFilenameRegExp, (QLatin1String("^[^\\/]+$"))) // NOLINT
|
||||
#else
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, baseFilenameRegExp, (QLatin1String("^[^\\:?\"*|\\/<>]+$"))) // NOLINT
|
||||
#endif
|
||||
|
||||
QT_WARNING_POP
|
||||
} // namespace
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogSaveManualLayout::DialogSaveManualLayout(vsizetype count, bool consoleExport, const QString &fileName,
|
||||
QWidget *parent)
|
||||
|
@ -95,10 +107,11 @@ DialogSaveManualLayout::DialogSaveManualLayout(vsizetype count, bool consoleExpo
|
|||
|
||||
connect(bOk, &QPushButton::clicked, this, &DialogSaveManualLayout::Save);
|
||||
connect(ui->lineEditFileName, &QLineEdit::textChanged, this, &DialogSaveManualLayout::ShowExample);
|
||||
connect(ui->comboBoxFormat, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &DialogSaveManualLayout::ShowExample);
|
||||
connect(ui->comboBoxFormat, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
&DialogSaveManualLayout::ShowExample);
|
||||
|
||||
connect(ui->pushButtonBrowse, &QPushButton::clicked, this, [this]()
|
||||
connect(ui->pushButtonBrowse, &QPushButton::clicked, this,
|
||||
[this]()
|
||||
{
|
||||
const QString dirPath = VPApplication::VApp()->PuzzleSettings()->GetPathManualLayouts();
|
||||
bool usedNotExistedDir = false;
|
||||
|
@ -409,9 +422,10 @@ void DialogSaveManualLayout::Save()
|
|||
|
||||
if (QFile::exists(name))
|
||||
{
|
||||
QMessageBox::StandardButton res = QMessageBox::question(this, tr("Name conflict"),
|
||||
tr("Folder already contain file with name %1. Rewrite all conflict file names?")
|
||||
.arg(name), QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes);
|
||||
QMessageBox::StandardButton res = QMessageBox::question(
|
||||
this, tr("Name conflict"),
|
||||
tr("Folder already contain file with name %1. Rewrite all conflict file names?").arg(name),
|
||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
||||
if (res == QMessageBox::No)
|
||||
{
|
||||
reject();
|
||||
|
@ -530,9 +544,7 @@ auto DialogSaveManualLayout::InitFormats() -> QVector<std::pair<QString, LayoutE
|
|||
QVector<std::pair<QString, LayoutExportFormats>> list;
|
||||
|
||||
auto InitFormat = [&list](LayoutExportFormats format)
|
||||
{
|
||||
list.append(std::make_pair(VLayoutExporter::ExportFormatDescription(format), format));
|
||||
};
|
||||
{ list.append(std::make_pair(VLayoutExporter::ExportFormatDescription(format), format)); };
|
||||
|
||||
InitFormat(LayoutExportFormats::SVG);
|
||||
InitFormat(LayoutExportFormats::PDF);
|
||||
|
|
|
@ -42,20 +42,24 @@
|
|||
#include "../layout/vplayout.h"
|
||||
#include "../layout/vppiece.h"
|
||||
#include "../layout/vpsheet.h"
|
||||
#include "../vlayout/vgraphicsfillitem.h"
|
||||
#include "../vlayout/vtextmanager.h"
|
||||
|
||||
#include "../vpapplication.h"
|
||||
|
||||
#include "../vlayout/vlayoutpiecepath.h"
|
||||
#include "compatibility.h"
|
||||
|
||||
#include "../vformat/vsinglelineoutlinechar.h"
|
||||
#include "../vgeometry/vlayoutplacelabel.h"
|
||||
|
||||
#include "../vlayout/vgraphicsfillitem.h"
|
||||
#include "../vlayout/vlayoutpiecepath.h"
|
||||
#include "../vlayout/vtextmanager.h"
|
||||
#include "../vmisc/svgfont/vsvgfont.h"
|
||||
#include "../vmisc/svgfont/vsvgfontdatabase.h"
|
||||
#include "../vmisc/svgfont/vsvgfontengine.h"
|
||||
#include "../vpapplication.h"
|
||||
#include "compatibility.h"
|
||||
#include "undocommands/vpundomovepieceonsheet.h"
|
||||
#include "undocommands/vpundopiecemove.h"
|
||||
#include "vpiecegrainline.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
#include "../vmisc/diagnostic.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
|
||||
#include <QLoggingCategory>
|
||||
|
||||
QT_WARNING_PUSH
|
||||
|
@ -68,9 +72,14 @@ QT_WARNING_POP
|
|||
|
||||
namespace
|
||||
{
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(QColor, mainColor, (Qt::black)) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(QColor, errorColor, (Qt::red)) // NOLINT
|
||||
|
||||
QT_WARNING_POP
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline auto LineMatrix(const VPPiecePtr &piece, const QPointF &topLeft, qreal angle, const QPointF &linePos,
|
||||
int maxLineWidth) -> QTransform
|
||||
|
|
|
@ -29,11 +29,11 @@
|
|||
#ifndef VPGRAPHICSPIECE_H
|
||||
#define VPGRAPHICSPIECE_H
|
||||
|
||||
#include <QGraphicsItem>
|
||||
#include <QCursor>
|
||||
#include <QGraphicsItem>
|
||||
|
||||
#include "scenedef.h"
|
||||
#include "../layout/layoutdef.h"
|
||||
#include "scenedef.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
|
@ -45,6 +45,7 @@ class VGraphicsFillItem;
|
|||
class VPGraphicsPiece : public QGraphicsObject
|
||||
{
|
||||
Q_OBJECT // NOLINT
|
||||
|
||||
public:
|
||||
explicit VPGraphicsPiece(const VPPiecePtr &piece, QGraphicsItem *parent = nullptr);
|
||||
~VPGraphicsPiece() override = default;
|
||||
|
@ -56,7 +57,10 @@ public:
|
|||
auto GetPiece() -> VPPiecePtr;
|
||||
|
||||
auto type() const -> int override { return Type; }
|
||||
enum { Type = UserType + static_cast<int>(PGraphicsItem::Piece)};
|
||||
enum
|
||||
{
|
||||
Type = UserType + static_cast<int>(PGraphicsItem::Piece)
|
||||
};
|
||||
|
||||
void SetStickyPoints(const QVector<QPointF> &newStickyPoint);
|
||||
|
||||
|
|
|
@ -28,26 +28,30 @@
|
|||
#include "vpgraphicspiececontrols.h"
|
||||
|
||||
#include <QCursor>
|
||||
#include <QFileInfo>
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
#include <QGuiApplication>
|
||||
#include <QIcon>
|
||||
#include <QPainter>
|
||||
#include <QtDebug>
|
||||
#include <QGuiApplication>
|
||||
#include <QScreen>
|
||||
#include <QFileInfo>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "../vmisc/compatibility.h"
|
||||
#include "../vwidgets/global.h"
|
||||
#include "../layout/vplayout.h"
|
||||
#include "../layout/vppiece.h"
|
||||
#include "../layout/vpsheet.h"
|
||||
#include "../undocommands/vpundopiecerotate.h"
|
||||
#include "../undocommands/vpundooriginmove.h"
|
||||
#include "../undocommands/vpundopiecerotate.h"
|
||||
#include "../vmisc/compatibility.h"
|
||||
#include "../vwidgets/global.h"
|
||||
#include "qgraphicsscene.h"
|
||||
#include "qgraphicsview.h"
|
||||
#include "qnamespace.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
#include "../vmisc/diagnostic.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
|
||||
namespace
|
||||
{
|
||||
constexpr qreal penWidth = 2;
|
||||
|
@ -55,9 +59,14 @@ constexpr qreal penWidth = 2;
|
|||
const qreal centerRadius1 = 5;
|
||||
const qreal centerRadius2 = 10;
|
||||
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QColor, defaultColor, (Qt::black)) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QColor, hoverColor, (Qt::green)) // NOLINT
|
||||
|
||||
QT_WARNING_POP
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto TransformationOrigin(const VPLayoutPtr &layout, const QRectF &boundingRect) -> VPTransformationOrigon
|
||||
{
|
||||
|
@ -231,7 +240,8 @@ auto VPGraphicsTransformationOrigin::RotationCenter(QPainter *painter) const ->
|
|||
const qreal scale = SceneScale(scene());
|
||||
qreal radius = centerRadius1 / scale;
|
||||
VPTransformationOrigon transformationOrigin = TransformationOrigin(m_layout, QRectF());
|
||||
QRectF rect(transformationOrigin.origin.x()-radius, transformationOrigin.origin.y()-radius, radius*2., radius*2.);
|
||||
QRectF rect(transformationOrigin.origin.x() - radius, transformationOrigin.origin.y() - radius, radius * 2.,
|
||||
radius * 2.);
|
||||
|
||||
QPainterPath center1;
|
||||
center1.addEllipse(rect);
|
||||
|
@ -246,7 +256,8 @@ auto VPGraphicsTransformationOrigin::RotationCenter(QPainter *painter) const ->
|
|||
path.addPath(center1);
|
||||
|
||||
radius = centerRadius2 / scale;
|
||||
rect = QRectF(transformationOrigin.origin.x()-radius, transformationOrigin.origin.y()-radius, radius*2., radius*2.);
|
||||
rect = QRectF(transformationOrigin.origin.x() - radius, transformationOrigin.origin.y() - radius, radius * 2.,
|
||||
radius * 2.);
|
||||
|
||||
QPainterPath center2;
|
||||
center2.addEllipse(rect);
|
||||
|
@ -269,7 +280,8 @@ auto VPGraphicsTransformationOrigin::Center1() const -> QPainterPath
|
|||
const qreal scale = SceneScale(scene());
|
||||
qreal radius = centerRadius1 / scale;
|
||||
VPTransformationOrigon transformationOrigin = TransformationOrigin(m_layout, QRectF());
|
||||
QRectF rect(transformationOrigin.origin.x()-radius, transformationOrigin.origin.y()-radius, radius*2., radius*2.);
|
||||
QRectF rect(transformationOrigin.origin.x() - radius, transformationOrigin.origin.y() - radius, radius * 2.,
|
||||
radius * 2.);
|
||||
|
||||
QPainterPath center1;
|
||||
center1.addEllipse(rect);
|
||||
|
@ -283,8 +295,8 @@ auto VPGraphicsTransformationOrigin::Center2() const -> QPainterPath
|
|||
const qreal scale = SceneScale(scene());
|
||||
qreal radius = centerRadius2 / scale;
|
||||
VPTransformationOrigon transformationOrigin = TransformationOrigin(m_layout, QRectF());
|
||||
QRectF rect = QRectF(transformationOrigin.origin.x()-radius, transformationOrigin.origin.y()-radius, radius*2.,
|
||||
radius*2.);
|
||||
QRectF rect = QRectF(transformationOrigin.origin.x() - radius, transformationOrigin.origin.y() - radius,
|
||||
radius * 2., radius * 2.);
|
||||
|
||||
QPainterPath center2;
|
||||
center2.addEllipse(rect);
|
||||
|
@ -383,19 +395,15 @@ void VPGraphicsPieceControls::paint(QPainter *painter, const QStyleOptionGraphic
|
|||
if (m_controlsVisible)
|
||||
{
|
||||
painter->drawPixmap(TopLeftHandlerPosition(),
|
||||
HandlerPixmap(m_handleCorner == VPHandleCorner::TopLeft,
|
||||
VPHandleCornerType::TopLeft));
|
||||
HandlerPixmap(m_handleCorner == VPHandleCorner::TopLeft, VPHandleCornerType::TopLeft));
|
||||
|
||||
painter->drawPixmap(TopRightHandlerPosition(),
|
||||
HandlerPixmap(m_handleCorner == VPHandleCorner::TopRight,
|
||||
VPHandleCornerType::TopRight));
|
||||
HandlerPixmap(m_handleCorner == VPHandleCorner::TopRight, VPHandleCornerType::TopRight));
|
||||
|
||||
painter->drawPixmap(BottomRightHandlerPosition(),
|
||||
HandlerPixmap(m_handleCorner == VPHandleCorner::BottomRight,
|
||||
painter->drawPixmap(BottomRightHandlerPosition(), HandlerPixmap(m_handleCorner == VPHandleCorner::BottomRight,
|
||||
VPHandleCornerType::BottomRight));
|
||||
|
||||
painter->drawPixmap(BottomLeftHandlerPosition(),
|
||||
HandlerPixmap(m_handleCorner == VPHandleCorner::BottomLeft,
|
||||
painter->drawPixmap(BottomLeftHandlerPosition(), HandlerPixmap(m_handleCorner == VPHandleCorner::BottomLeft,
|
||||
VPHandleCornerType::BottomLeft));
|
||||
}
|
||||
}
|
||||
|
@ -469,8 +477,8 @@ void VPGraphicsPieceControls::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
|||
}
|
||||
else if (pieces.size() > 1)
|
||||
{
|
||||
auto *command = new VPUndoPiecesRotate(pieces, rotationOrigin, rotateOn, m_rotationSum,
|
||||
allowChangeMerge);
|
||||
auto *command =
|
||||
new VPUndoPiecesRotate(pieces, rotationOrigin, rotateOn, m_rotationSum, allowChangeMerge);
|
||||
layout->UndoStack()->push(command);
|
||||
}
|
||||
}
|
||||
|
@ -568,17 +576,17 @@ void VPGraphicsPieceControls::InitPixmaps()
|
|||
const QFileInfo fileInfo(fileName);
|
||||
const QString imageName = fileInfo.baseName();
|
||||
|
||||
const QString fileNameHover = QStringLiteral("%1/%2-hover.%3")
|
||||
.arg(fileInfo.absolutePath(), imageName, fileInfo.suffix());
|
||||
const QString fileNameHover =
|
||||
QStringLiteral("%1/%2-hover.%3").arg(fileInfo.absolutePath(), imageName, fileInfo.suffix());
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
|
||||
if (QGuiApplication::primaryScreen()->devicePixelRatio() >= 2)
|
||||
{
|
||||
const QString fileName2x = QStringLiteral("%1/%2@2x.%3")
|
||||
.arg(fileInfo.absolutePath(), imageName, fileInfo.suffix());
|
||||
const QString fileName2x =
|
||||
QStringLiteral("%1/%2@2x.%3").arg(fileInfo.absolutePath(), imageName, fileInfo.suffix());
|
||||
|
||||
const QString fileName2xHover = QStringLiteral("%1/%2-hover@2x.%3")
|
||||
.arg(fileInfo.absolutePath(), imageName, fileInfo.suffix());
|
||||
const QString fileName2xHover =
|
||||
QStringLiteral("%1/%2-hover@2x.%3").arg(fileInfo.absolutePath(), imageName, fileInfo.suffix());
|
||||
|
||||
m_handlePixmaps.insert(type, QPixmap(fileName2x));
|
||||
m_handleHoverPixmaps.insert(type, QPixmap(fileName2xHover));
|
||||
|
@ -625,8 +633,7 @@ auto VPGraphicsPieceControls::BottomRightHandlerPosition() const -> QPointF
|
|||
QRectF rect = ControllersRect();
|
||||
QPixmap handler = m_handlePixmaps.value(VPHandleCornerType::BottomRight);
|
||||
QSize size = handler.size() / handler.devicePixelRatio();
|
||||
return {rect.topLeft().x() + (rect.width() - size.width()),
|
||||
rect.topLeft().y() + (rect.height() - size.height())};
|
||||
return {rect.topLeft().x() + (rect.width() - size.width()), rect.topLeft().y() + (rect.height() - size.height())};
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -900,8 +907,7 @@ void VPGraphicsPieceControls::CorrectRotationSum(const VPLayoutPtr &layout,
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VPGraphicsPieceControls::SelectedHandleCorner(const QPointF &pos) const -> VPHandleCorner
|
||||
{
|
||||
QMap<VPHandleCorner, QPainterPath> corners
|
||||
{
|
||||
QMap<VPHandleCorner, QPainterPath> corners{
|
||||
{VPHandleCorner::TopLeft, TopLeftControl()},
|
||||
{VPHandleCorner::TopRight, TopRightControl()},
|
||||
{VPHandleCorner::BottomRight, BottomRightControl()},
|
||||
|
@ -912,9 +918,7 @@ auto VPGraphicsPieceControls::SelectedHandleCorner(const QPointF &pos) const ->
|
|||
circle.addEllipse(pos.x() - 4, pos.y() - 4, 8, 8);
|
||||
|
||||
auto CheckCorner = [circle](const QPainterPath &handler)
|
||||
{
|
||||
return handler.intersects(circle) || handler.contains(circle);
|
||||
};
|
||||
{ return handler.intersects(circle) || handler.contains(circle); };
|
||||
|
||||
auto i = corners.constBegin();
|
||||
while (i != corners.constEnd())
|
||||
|
|
|
@ -29,26 +29,30 @@
|
|||
#include "vpmaingraphicsview.h"
|
||||
|
||||
#include <QDragEnterEvent>
|
||||
#include <QMimeData>
|
||||
#include <QKeyEvent>
|
||||
#include <QMenu>
|
||||
#include <QMimeData>
|
||||
#include <QUndoStack>
|
||||
|
||||
#include "../carousel/vpmimedatapiece.h"
|
||||
#include "../layout/vplayout.h"
|
||||
#include "../layout/vpsheet.h"
|
||||
#include "../layout/vppiece.h"
|
||||
#include "../layout/vpsheet.h"
|
||||
#include "../vwidgets/vmaingraphicsscene.h"
|
||||
#include "undocommands/vpundopiecezvaluemove.h"
|
||||
#include "vpgraphicspiece.h"
|
||||
#include "vpgraphicspiececontrols.h"
|
||||
|
||||
#include "../undocommands/vpundomovepieceonsheet.h"
|
||||
#include "../undocommands/vpundooriginmove.h"
|
||||
#include "../undocommands/vpundopiecemove.h"
|
||||
#include "../undocommands/vpundopiecerotate.h"
|
||||
#include "../undocommands/vpundooriginmove.h"
|
||||
#include "../undocommands/vpundomovepieceonsheet.h"
|
||||
#include "../undocommands/vpundoremovesheet.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
#include "../vmisc/diagnostic.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
|
||||
#include <QLoggingCategory>
|
||||
|
||||
QT_WARNING_PUSH
|
||||
|
@ -66,11 +70,15 @@ QT_WARNING_PUSH
|
|||
QT_WARNING_DISABLE_CLANG("-Wenum-enum-conversion")
|
||||
#endif
|
||||
|
||||
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QKeySequence, restoreOriginShortcut, // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QKeySequence, restoreOriginShortcut,
|
||||
(QKeySequence(Qt::ControlModifier | Qt::Key_Asterisk)))
|
||||
#else
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QKeySequence, restoreOriginShortcut, // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QKeySequence, restoreOriginShortcut,
|
||||
(QKeySequence(Qt::ControlModifier + Qt::Key_Asterisk)))
|
||||
#endif
|
||||
|
||||
|
@ -78,8 +86,8 @@ QT_WARNING_POP
|
|||
} // namespace
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPMainGraphicsView::VPMainGraphicsView(const VPLayoutPtr &layout, QWidget *parent) :
|
||||
VMainGraphicsView(parent),
|
||||
VPMainGraphicsView::VPMainGraphicsView(const VPLayoutPtr &layout, QWidget *parent)
|
||||
: VMainGraphicsView(parent),
|
||||
m_layout(layout)
|
||||
{
|
||||
SCASSERT(not layout.isNull())
|
||||
|
@ -360,7 +368,6 @@ void VPMainGraphicsView::contextMenuEvent(QContextMenuEvent *event)
|
|||
{
|
||||
RestoreOrigin();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -703,8 +710,7 @@ void VPMainGraphicsView::MovePiece(QKeyEvent *event)
|
|||
{
|
||||
const VPPiecePtr &p = ConstFirst(pieces);
|
||||
|
||||
auto *command = new VPUndoPieceMove(p, m_stickyTranslateX, m_stickyTranslateY,
|
||||
m_allowChangeMerge);
|
||||
auto *command = new VPUndoPieceMove(p, m_stickyTranslateX, m_stickyTranslateY, m_allowChangeMerge);
|
||||
layout->UndoStack()->push(command);
|
||||
|
||||
VPGraphicsPiece *gPiece = sheet->SceneData()->ScenePiece(p);
|
||||
|
|
|
@ -27,48 +27,48 @@
|
|||
*************************************************************************/
|
||||
#include "vpmainwindow.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QCloseEvent>
|
||||
#include <QtMath>
|
||||
#include <QSvgGenerator>
|
||||
#include <QFileDialog>
|
||||
#include <QFileSystemWatcher>
|
||||
#include <QSaveFile>
|
||||
#include <QUndoStack>
|
||||
#include <QPrinterInfo>
|
||||
#include <QPrintDialog>
|
||||
#include <QPrintPreviewDialog>
|
||||
#include <QPrinterInfo>
|
||||
#include <QSaveFile>
|
||||
#include <QSvgGenerator>
|
||||
#include <QTimer>
|
||||
#include <QUndoStack>
|
||||
#include <QtMath>
|
||||
#include <chrono>
|
||||
|
||||
#include "ui_vpmainwindow.h"
|
||||
#include "dialogs/vpdialogabout.h"
|
||||
#include "xml/vplayoutfilewriter.h"
|
||||
#include "xml/vplayoutfilereader.h"
|
||||
#include "vpapplication.h"
|
||||
#include "../vlayout/vrawlayout.h"
|
||||
#include "../ifc/exception/vexception.h"
|
||||
#include "../ifc/xml/vlayoutconverter.h"
|
||||
#include "../vdxf/libdxfrw/drw_base.h"
|
||||
#include "../vlayout/dialogs/watermarkwindow.h"
|
||||
#include "../vlayout/vlayoutexporter.h"
|
||||
#include "../vlayout/vprintlayout.h"
|
||||
#include "../vlayout/dialogs/watermarkwindow.h"
|
||||
#include "../vmisc/vsysexits.h"
|
||||
#include "../vmisc/projectversion.h"
|
||||
#include "../ifc/xml/vlayoutconverter.h"
|
||||
#include "../ifc/exception/vexception.h"
|
||||
#include "../vwidgets/vmaingraphicsscene.h"
|
||||
#include "layout/vpsheet.h"
|
||||
#include "dialogs/dialogpuzzlepreferences.h"
|
||||
#include "undocommands/vpundoaddsheet.h"
|
||||
#include "undocommands/vpundopiecerotate.h"
|
||||
#include "undocommands/vpundopiecemove.h"
|
||||
#include "undocommands/vpundopiecezvaluemove.h"
|
||||
#include "dialogs/dialogsavemanuallayout.h"
|
||||
#include "../vdxf/libdxfrw/drw_base.h"
|
||||
#include "../vlayout/vrawlayout.h"
|
||||
#include "../vmisc/dialogs/dialogselectlanguage.h"
|
||||
#include "../vmisc/lambdaconstants.h"
|
||||
#include "../vmisc/projectversion.h"
|
||||
#include "../vmisc/vsysexits.h"
|
||||
#include "../vwidgets/vmaingraphicsscene.h"
|
||||
#include "dialogs/dialogpuzzlepreferences.h"
|
||||
#include "dialogs/dialogsavemanuallayout.h"
|
||||
#include "dialogs/vpdialogabout.h"
|
||||
#include "layout/vpsheet.h"
|
||||
#include "ui_vpmainwindow.h"
|
||||
#include "undocommands/vpundoaddsheet.h"
|
||||
#include "undocommands/vpundopiecemove.h"
|
||||
#include "undocommands/vpundopiecerotate.h"
|
||||
#include "undocommands/vpundopiecezvaluemove.h"
|
||||
#include "vpapplication.h"
|
||||
#include "xml/vplayoutfilereader.h"
|
||||
#include "xml/vplayoutfilewriter.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 "vptilefactory.h"
|
||||
#include "layout/vppiece.h"
|
||||
#include "vptilefactory.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
|
||||
#include "../vmisc/backport/qscopeguard.h"
|
||||
|
@ -172,8 +172,8 @@ auto PiecesBoundingRect(const QList<VPPiecePtr> &selectedPieces) -> QRectF
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
Q_REQUIRED_RESULT auto PreparePrinter(
|
||||
const QPrinterInfo &info, QPrinter::PrinterMode mode = QPrinter::ScreenResolution) -> QSharedPointer<QPrinter>;
|
||||
Q_REQUIRED_RESULT auto PreparePrinter(const QPrinterInfo &info, QPrinter::PrinterMode mode = QPrinter::ScreenResolution)
|
||||
-> QSharedPointer<QPrinter>;
|
||||
auto PreparePrinter(const QPrinterInfo &info, QPrinter::PrinterMode mode) -> QSharedPointer<QPrinter>
|
||||
{
|
||||
QPrinterInfo tmpInfo = info;
|
||||
|
@ -272,8 +272,7 @@ void SetPrinterTiledPageSettings(const QSharedPointer<QPrinter> &printer, const
|
|||
|
||||
if (not layout->LayoutSettings().IgnoreTilesMargins())
|
||||
{
|
||||
if (not printer->setPageMargins(layout->LayoutSettings().GetTilesMargins(Unit::Mm),
|
||||
QPageLayout::Millimeter))
|
||||
if (not printer->setPageMargins(layout->LayoutSettings().GetTilesMargins(Unit::Mm), QPageLayout::Millimeter))
|
||||
{
|
||||
qWarning() << QObject::tr("Cannot set printer margins");
|
||||
}
|
||||
|
@ -297,8 +296,8 @@ struct VPExportData
|
|||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPMainWindow::VPMainWindow(const VPCommandLinePtr &cmd, QWidget *parent) :
|
||||
VAbstractMainWindow(parent),
|
||||
VPMainWindow::VPMainWindow(const VPCommandLinePtr &cmd, QWidget *parent)
|
||||
: VAbstractMainWindow(parent),
|
||||
ui(new Ui::VPMainWindow),
|
||||
m_cmd(cmd),
|
||||
m_undoStack(new QUndoStack(this)),
|
||||
|
@ -310,25 +309,18 @@ VPMainWindow::VPMainWindow(const VPCommandLinePtr &cmd, QWidget *parent) :
|
|||
ui->setupUi(this);
|
||||
|
||||
connect(m_layout.data(), &VPLayout::PieceSelectionChanged, this, &VPMainWindow::on_PieceSelectionChanged);
|
||||
connect(m_layout.data(), &VPLayout::LayoutChanged, this, [this]()
|
||||
{
|
||||
LayoutWasSaved(false);
|
||||
});
|
||||
connect(m_layout.data(), &VPLayout::PieceTransformationChanged, this, [this]()
|
||||
{
|
||||
SetPropertyTabCurrentPieceData();
|
||||
});
|
||||
connect(m_layout.data(), &VPLayout::ActiveSheetChanged, this, [this]()
|
||||
connect(m_layout.data(), &VPLayout::LayoutChanged, this, [this]() { LayoutWasSaved(false); });
|
||||
connect(m_layout.data(), &VPLayout::PieceTransformationChanged, this,
|
||||
[this]() { SetPropertyTabCurrentPieceData(); });
|
||||
connect(m_layout.data(), &VPLayout::ActiveSheetChanged, this,
|
||||
[this]()
|
||||
{
|
||||
m_layout->TileFactory()->RefreshTileInfos();
|
||||
m_graphicsView->RefreshLayout();
|
||||
SetPropertyTabSheetData();
|
||||
});
|
||||
|
||||
connect(m_undoStack, &QUndoStack::cleanChanged, this, [this](bool clean)
|
||||
{
|
||||
LayoutWasSaved(clean);
|
||||
});
|
||||
connect(m_undoStack, &QUndoStack::cleanChanged, this, [this](bool clean) { LayoutWasSaved(clean); });
|
||||
|
||||
// init status bar
|
||||
statusBar()->addPermanentWidget(m_statusLabel, 1);
|
||||
|
@ -354,7 +346,8 @@ VPMainWindow::VPMainWindow(const VPCommandLinePtr &cmd, QWidget *parent) :
|
|||
menu->setAsDockMenu();
|
||||
#endif // defined(Q_OS_MAC)
|
||||
|
||||
connect(m_layoutWatcher, &QFileSystemWatcher::fileChanged, this, [this](const QString &path)
|
||||
connect(m_layoutWatcher, &QFileSystemWatcher::fileChanged, this,
|
||||
[this](const QString &path)
|
||||
{
|
||||
QFileInfo checkFile(path);
|
||||
if (not checkFile.exists())
|
||||
|
@ -425,8 +418,8 @@ auto VPMainWindow::LoadFile(const QString& path) -> bool
|
|||
|
||||
// Check if file already opened
|
||||
QList<VPMainWindow *> list = VPApplication::VApp()->MainWindows();
|
||||
auto w = std::find_if(list.begin(), list.end(),
|
||||
[path](VPMainWindow *window) { return window->CurrentFile() == path; });
|
||||
auto w =
|
||||
std::find_if(list.begin(), list.end(), [path](VPMainWindow *window) { return window->CurrentFile() == path; });
|
||||
if (w != list.end())
|
||||
{
|
||||
(*w)->activateWindow();
|
||||
|
@ -472,8 +465,8 @@ auto VPMainWindow::LoadFile(const QString& path) -> bool
|
|||
}
|
||||
catch (VException &e)
|
||||
{
|
||||
qCCritical(pWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("File error.")),
|
||||
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
|
||||
qCCritical(pWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("File error.")), qUtf8Printable(e.ErrorMessage()),
|
||||
qUtf8Printable(e.DetailedInformation()));
|
||||
lock.reset();
|
||||
return false;
|
||||
}
|
||||
|
@ -611,7 +604,8 @@ void VPMainWindow::SetupMenu()
|
|||
{
|
||||
auto *action = new QAction(this);
|
||||
recentFileAct = action;
|
||||
connect(action, &QAction::triggered, this, [this]()
|
||||
connect(action, &QAction::triggered, this,
|
||||
[this]()
|
||||
{
|
||||
if (auto *senderAction = qobject_cast<QAction *>(sender()))
|
||||
{
|
||||
|
@ -679,7 +673,8 @@ void VPMainWindow::SetupMenu()
|
|||
connect(ui->actionRemoveWatermark, &QAction::triggered, this, &VPMainWindow::RemoveWatermark);
|
||||
|
||||
// Window
|
||||
connect(ui->menuWindow, &QMenu::aboutToShow, this, [this]()
|
||||
connect(ui->menuWindow, &QMenu::aboutToShow, this,
|
||||
[this]()
|
||||
{
|
||||
ui->menuWindow->clear();
|
||||
CreateWindowMenu(ui->menuWindow);
|
||||
|
@ -703,7 +698,8 @@ void VPMainWindow::InitProperties()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPMainWindow::InitPropertyTabCurrentPiece()
|
||||
{
|
||||
connect(ui->checkBoxCurrentPieceShowSeamline, &QCheckBox::toggled, this, [this](bool checked)
|
||||
connect(ui->checkBoxCurrentPieceShowSeamline, &QCheckBox::toggled, this,
|
||||
[this](bool checked)
|
||||
{
|
||||
QList<VPPiecePtr> selectedPieces = SelectedPieces();
|
||||
if (selectedPieces.size() == 1)
|
||||
|
@ -719,7 +715,8 @@ void VPMainWindow::InitPropertyTabCurrentPiece()
|
|||
}
|
||||
});
|
||||
|
||||
connect(ui->checkBoxCurrentPieceMirrorPiece, &QCheckBox::toggled, this, [this](bool checked)
|
||||
connect(ui->checkBoxCurrentPieceMirrorPiece, &QCheckBox::toggled, this,
|
||||
[this](bool checked)
|
||||
{
|
||||
QList<VPPiecePtr> selectedPieces = SelectedPieces();
|
||||
if (selectedPieces.size() == 1)
|
||||
|
@ -805,7 +802,8 @@ void VPMainWindow::InitPropertyTabCurrentPiece()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPMainWindow::InitPropertyTabCurrentSheet()
|
||||
{
|
||||
connect(ui->lineEditSheetName, &QLineEdit::textEdited, this, [this](const QString &text)
|
||||
connect(ui->lineEditSheetName, &QLineEdit::textEdited, this,
|
||||
[this](const QString &text)
|
||||
{
|
||||
if (not m_layout.isNull())
|
||||
{
|
||||
|
@ -836,14 +834,14 @@ void VPMainWindow::InitPropertyTabCurrentSheet()
|
|||
ui->comboBoxLayoutUnit->setCurrentIndex(indexUnit);
|
||||
}
|
||||
|
||||
connect(ui->comboBoxLayoutUnit, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &VPMainWindow::on_ConvertPaperSize);
|
||||
connect(ui->comboBoxLayoutUnit, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
&VPMainWindow::on_ConvertPaperSize);
|
||||
|
||||
// -------------------- sheet template ---------------------------
|
||||
VAbstractLayoutDialog::InitTemplates(ui->comboBoxSheetTemplates);
|
||||
|
||||
connect(ui->comboBoxSheetTemplates, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, [this]{SheetSize(SheetTemplate());});
|
||||
connect(ui->comboBoxSheetTemplates, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
[this] { SheetSize(SheetTemplate()); });
|
||||
|
||||
const QString suffix = " " + UnitsToStr(LayoutUnit(), true);
|
||||
// -------------------- paper size ---------------------------
|
||||
|
@ -874,7 +872,8 @@ void VPMainWindow::InitPaperSizeData(const QString &suffix)
|
|||
connect(ui->toolButtonSheetLandscapeOrientation, &QToolButton::toggled, this,
|
||||
&VPMainWindow::on_SheetOrientationChanged);
|
||||
|
||||
connect(ui->toolButtonGrainlineHorizontalOrientation, &QToolButton::clicked, this, [this](bool checked)
|
||||
connect(ui->toolButtonGrainlineHorizontalOrientation, &QToolButton::clicked, this,
|
||||
[this](bool checked)
|
||||
{
|
||||
VPSheetPtr sheet = m_layout->GetFocusedSheet();
|
||||
if (sheet.isNull())
|
||||
|
@ -896,7 +895,8 @@ void VPMainWindow::InitPaperSizeData(const QString &suffix)
|
|||
LayoutWasSaved(false);
|
||||
});
|
||||
|
||||
connect(ui->toolButtonGrainlineVerticalOrientation, &QToolButton::clicked, this, [this](bool checked)
|
||||
connect(ui->toolButtonGrainlineVerticalOrientation, &QToolButton::clicked, this,
|
||||
[this](bool checked)
|
||||
{
|
||||
VPSheetPtr sheet = m_layout->GetFocusedSheet();
|
||||
if (sheet.isNull())
|
||||
|
@ -918,7 +918,8 @@ void VPMainWindow::InitPaperSizeData(const QString &suffix)
|
|||
LayoutWasSaved(false);
|
||||
});
|
||||
|
||||
connect(ui->pushButtonSheetRemoveUnusedLength, &QPushButton::clicked, this, [this]()
|
||||
connect(ui->pushButtonSheetRemoveUnusedLength, &QPushButton::clicked, this,
|
||||
[this]()
|
||||
{
|
||||
if (not m_layout.isNull())
|
||||
{
|
||||
|
@ -953,7 +954,8 @@ void VPMainWindow::InitMarginsData(const QString &suffix)
|
|||
connect(ui->doubleSpinBoxSheetMarginLeft, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
&VPMainWindow::on_SheetMarginChanged);
|
||||
|
||||
connect(ui->checkBoxLayoutIgnoreFileds, &QCheckBox::stateChanged, this, [this](int state)
|
||||
connect(ui->checkBoxLayoutIgnoreFileds, &QCheckBox::stateChanged, this,
|
||||
[this](int state)
|
||||
{
|
||||
if (not m_layout.isNull())
|
||||
{
|
||||
|
@ -982,8 +984,8 @@ void VPMainWindow::InitPropertyTabTiles()
|
|||
// -------------------- tiles template
|
||||
VAbstractLayoutDialog::InitTileTemplates(ui->comboBoxTileTemplates, true);
|
||||
|
||||
connect(ui->comboBoxTileTemplates, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, [this]{TileSize(TileTemplate());});
|
||||
connect(ui->comboBoxTileTemplates, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
[this] { TileSize(TileTemplate()); });
|
||||
|
||||
// -------------------- paper size ---------------------------
|
||||
MinimumTilePaperSize();
|
||||
|
@ -1017,7 +1019,8 @@ void VPMainWindow::InitPropertyTabTiles()
|
|||
connect(ui->doubleSpinBoxTileMarginLeft, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
&VPMainWindow::on_TilesMarginChanged);
|
||||
|
||||
connect(ui->checkBoxTileIgnoreFileds, &QCheckBox::stateChanged, this, [this](int state)
|
||||
connect(ui->checkBoxTileIgnoreFileds, &QCheckBox::stateChanged, this,
|
||||
[this](int state)
|
||||
{
|
||||
if (not m_layout.isNull())
|
||||
{
|
||||
|
@ -1035,7 +1038,8 @@ void VPMainWindow::InitPropertyTabTiles()
|
|||
});
|
||||
|
||||
// -------------------- control ------------------------
|
||||
connect(ui->checkBoxTilesShowTiles, &QCheckBox::toggled, this, [this](bool checked)
|
||||
connect(ui->checkBoxTilesShowTiles, &QCheckBox::toggled, this,
|
||||
[this](bool checked)
|
||||
{
|
||||
if (not m_layout.isNull())
|
||||
{
|
||||
|
@ -1046,7 +1050,8 @@ void VPMainWindow::InitPropertyTabTiles()
|
|||
}
|
||||
});
|
||||
|
||||
connect(ui->checkBoxTilesShowWatermark, &QCheckBox::toggled, this, [this](bool checked)
|
||||
connect(ui->checkBoxTilesShowWatermark, &QCheckBox::toggled, this,
|
||||
[this](bool checked)
|
||||
{
|
||||
if (not m_layout.isNull())
|
||||
{
|
||||
|
@ -1057,7 +1062,8 @@ void VPMainWindow::InitPropertyTabTiles()
|
|||
}
|
||||
});
|
||||
|
||||
connect(ui->checkBoxPrintTilesScheme, &QCheckBox::toggled, this, [this](bool checked)
|
||||
connect(ui->checkBoxPrintTilesScheme, &QCheckBox::toggled, this,
|
||||
[this](bool checked)
|
||||
{
|
||||
if (not m_layout.isNull())
|
||||
{
|
||||
|
@ -1066,7 +1072,8 @@ void VPMainWindow::InitPropertyTabTiles()
|
|||
}
|
||||
});
|
||||
|
||||
connect(ui->checkBoxShowTileNumber, &QCheckBox::toggled, this, [this](bool checked)
|
||||
connect(ui->checkBoxShowTileNumber, &QCheckBox::toggled, this,
|
||||
[this](bool checked)
|
||||
{
|
||||
if (not m_layout.isNull())
|
||||
{
|
||||
|
@ -1080,7 +1087,8 @@ void VPMainWindow::InitPropertyTabTiles()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPMainWindow::InitPropertyTabLayout()
|
||||
{
|
||||
connect(ui->lineEditLayoutName, &QLineEdit::textEdited, this, [this](const QString &text)
|
||||
connect(ui->lineEditLayoutName, &QLineEdit::textEdited, this,
|
||||
[this](const QString &text)
|
||||
{
|
||||
if (not m_layout.isNull())
|
||||
{
|
||||
|
@ -1089,7 +1097,8 @@ void VPMainWindow::InitPropertyTabLayout()
|
|||
}
|
||||
});
|
||||
|
||||
connect(ui->plainTextEditLayoutDescription, &QPlainTextEdit::textChanged, this, [this]()
|
||||
connect(ui->plainTextEditLayoutDescription, &QPlainTextEdit::textChanged, this,
|
||||
[this]()
|
||||
{
|
||||
if (not m_layout.isNull())
|
||||
{
|
||||
|
@ -1103,7 +1112,8 @@ void VPMainWindow::InitPropertyTabLayout()
|
|||
connect(ui->checkBoxLayoutWarningPiecesOutOfBound, &QCheckBox::toggled, this,
|
||||
&VPMainWindow::LayoutWarningPiecesOutOfBound_toggled);
|
||||
|
||||
connect(ui->checkBoxSheetStickyEdges, &QCheckBox::toggled, this, [this](bool checked)
|
||||
connect(ui->checkBoxSheetStickyEdges, &QCheckBox::toggled, this,
|
||||
[this](bool checked)
|
||||
{
|
||||
if (not m_layout.isNull())
|
||||
{
|
||||
|
@ -1112,7 +1122,8 @@ void VPMainWindow::InitPropertyTabLayout()
|
|||
}
|
||||
});
|
||||
|
||||
connect(ui->checkBoxFollowGainline, &QCheckBox::toggled, this, [this](bool checked)
|
||||
connect(ui->checkBoxFollowGainline, &QCheckBox::toggled, this,
|
||||
[this](bool checked)
|
||||
{
|
||||
if (not m_layout.isNull())
|
||||
{
|
||||
|
@ -1141,17 +1152,18 @@ void VPMainWindow::InitPropertyTabLayout()
|
|||
}
|
||||
});
|
||||
|
||||
connect(ui->toolButtonScaleConnected, &QToolButton::clicked, this, [this]()
|
||||
connect(ui->toolButtonScaleConnected, &QToolButton::clicked, this,
|
||||
[this]()
|
||||
{
|
||||
m_scaleConnected = not m_scaleConnected;
|
||||
|
||||
UpdateScaleConnection();
|
||||
});
|
||||
|
||||
connect(ui->doubleSpinBoxHorizontalScale, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, &VPMainWindow::HorizontalScaleChanged);
|
||||
connect(ui->doubleSpinBoxVerticalScale, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, &VPMainWindow::VerticalScaleChanged);
|
||||
connect(ui->doubleSpinBoxHorizontalScale, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
&VPMainWindow::HorizontalScaleChanged);
|
||||
connect(ui->doubleSpinBoxVerticalScale, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
&VPMainWindow::VerticalScaleChanged);
|
||||
connect(ui->pushButtonLayoutExport, &QPushButton::clicked, this, &VPMainWindow::on_ExportLayout);
|
||||
}
|
||||
|
||||
|
@ -1442,10 +1454,8 @@ void VPMainWindow::SetPropertyTabLayoutData()
|
|||
m_layout->LayoutSettings().GetWarningPiecesOutOfBound());
|
||||
SetCheckBoxValue(ui->checkBoxLayoutWarningPiecesSuperposition,
|
||||
m_layout->LayoutSettings().GetWarningSuperpositionOfPieces());
|
||||
SetCheckBoxValue(ui->checkBoxSheetStickyEdges,
|
||||
m_layout->LayoutSettings().GetStickyEdges());
|
||||
SetCheckBoxValue(ui->checkBoxFollowGainline,
|
||||
m_layout->LayoutSettings().GetFollowGrainline());
|
||||
SetCheckBoxValue(ui->checkBoxSheetStickyEdges, m_layout->LayoutSettings().GetStickyEdges());
|
||||
SetCheckBoxValue(ui->checkBoxFollowGainline, m_layout->LayoutSettings().GetFollowGrainline());
|
||||
|
||||
// set pieces gap
|
||||
SetDoubleSpinBoxValue(ui->doubleSpinBoxSheetPiecesGap, m_layout->LayoutSettings().GetPiecesGapConverted());
|
||||
|
@ -1491,8 +1501,6 @@ void VPMainWindow::SetPropertyTabLayoutData()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPMainWindow::InitMainGraphics()
|
||||
{
|
||||
|
@ -1585,16 +1593,15 @@ void VPMainWindow::InitScaleToolBar()
|
|||
m_doubleSpinBoxScale->setDecimals(1);
|
||||
m_doubleSpinBoxScale->setSuffix(QChar('%'));
|
||||
on_ScaleChanged(m_graphicsView->transform().m11());
|
||||
connect(m_doubleSpinBoxScale.data(), QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, [this](double d){m_graphicsView->Zoom(d/100.0);});
|
||||
connect(m_doubleSpinBoxScale.data(), QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
[this](double d) { m_graphicsView->Zoom(d / 100.0); });
|
||||
ui->toolBarScale->addWidget(m_doubleSpinBoxScale);
|
||||
|
||||
|
||||
// define the mouse position
|
||||
ui->toolBarScale->addSeparator();
|
||||
|
||||
m_mouseCoordinate = new QLabel(QStringLiteral("0, 0 (%1)")
|
||||
.arg(UnitsToStr(m_layout->LayoutSettings().GetUnit(), true)));
|
||||
m_mouseCoordinate =
|
||||
new QLabel(QStringLiteral("0, 0 (%1)").arg(UnitsToStr(m_layout->LayoutSettings().GetUnit(), true)));
|
||||
ui->toolBarScale->addWidget(m_mouseCoordinate);
|
||||
ui->toolBarScale->addSeparator();
|
||||
}
|
||||
|
@ -1631,8 +1638,7 @@ void VPMainWindow::UpdateWindowTitle()
|
|||
setWindowFilePath(curFile);
|
||||
|
||||
#if defined(Q_OS_MAC)
|
||||
static QIcon fileIcon = QIcon(QCoreApplication::applicationDirPath() +
|
||||
QLatin1String("/../Resources/layout.icns"));
|
||||
static QIcon fileIcon = QIcon(QCoreApplication::applicationDirPath() + QLatin1String("/../Resources/layout.icns"));
|
||||
QIcon icon;
|
||||
if (not curFile.isEmpty())
|
||||
{
|
||||
|
@ -1747,10 +1753,7 @@ void VPMainWindow::CreateWindowMenu(QMenu *menu)
|
|||
SCASSERT(menu != nullptr)
|
||||
|
||||
QAction *action = menu->addAction(tr("&New Window"));
|
||||
connect(action, &QAction::triggered, this, []()
|
||||
{
|
||||
VPApplication::VApp()->NewMainWindow()->activateWindow();
|
||||
});
|
||||
connect(action, &QAction::triggered, this, []() { VPApplication::VApp()->NewMainWindow()->activateWindow(); });
|
||||
action->setMenuRole(QAction::NoRole);
|
||||
menu->addSeparator();
|
||||
|
||||
|
@ -1815,7 +1818,8 @@ void VPMainWindow::ConnectToPreferences(const QSharedPointer<DialogPuzzlePrefere
|
|||
// Must be first
|
||||
connect(preferences.data(), &DialogPuzzlePreferences::UpdateProperties, this, &VPMainWindow::WindowsLocale);
|
||||
connect(preferences.data(), &DialogPuzzlePreferences::UpdateProperties, this, &VPMainWindow::ToolBarStyles);
|
||||
connect(preferences.data(), &DialogPuzzlePreferences::UpdateProperties, this, [this]()
|
||||
connect(preferences.data(), &DialogPuzzlePreferences::UpdateProperties, this,
|
||||
[this]()
|
||||
{
|
||||
if (not m_layout.isNull())
|
||||
{
|
||||
|
@ -2050,8 +2054,8 @@ void VPMainWindow::FindTemplate(QComboBox *box, qreal width, qreal height)
|
|||
const int max = static_cast<int>(VAbstractLayoutDialog::PaperSizeTemplate::Custom);
|
||||
for (int i = 0; i < max; ++i)
|
||||
{
|
||||
const QSizeF tmplSize = VAbstractLayoutDialog::GetTemplateSize(
|
||||
static_cast<VAbstractLayoutDialog::PaperSizeTemplate>(i), paperUnit);
|
||||
const QSizeF tmplSize =
|
||||
VAbstractLayoutDialog::GetTemplateSize(static_cast<VAbstractLayoutDialog::PaperSizeTemplate>(i), paperUnit);
|
||||
if (QSizeF(width, height) == tmplSize || QSizeF(height, width) == tmplSize)
|
||||
{
|
||||
box->blockSignals(true);
|
||||
|
@ -2175,8 +2179,8 @@ void VPMainWindow::ExportData(const VPExportData &data)
|
|||
|
||||
if (data.sheets.size() > 1)
|
||||
{
|
||||
name = data.path + '/' + data.fileName +
|
||||
QString::number(i+1) + VLayoutExporter::ExportFormatSuffix(data.format);
|
||||
name = data.path + '/' + data.fileName + QString::number(i + 1) +
|
||||
VLayoutExporter::ExportFormatSuffix(data.format);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2261,7 +2265,8 @@ void VPMainWindow::ExportFlatLayout(const VPExportData &data)
|
|||
ExportPdfTiledFile(data);
|
||||
}
|
||||
else if ((data.format == LayoutExportFormats::PDF || data.format == LayoutExportFormats::PS ||
|
||||
data.format == LayoutExportFormats::EPS) && data.exportUnified)
|
||||
data.format == LayoutExportFormats::EPS) &&
|
||||
data.exportUnified)
|
||||
{
|
||||
ExportUnifiedPdfFile(data);
|
||||
}
|
||||
|
@ -2463,8 +2468,8 @@ void VPMainWindow::GenerateUnifiedPdfFile(const VPExportData &data, const QStrin
|
|||
}
|
||||
|
||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||
painter.setPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
|
||||
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||
painter.setPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(), Qt::SolidLine,
|
||||
Qt::RoundCap, Qt::RoundJoin));
|
||||
painter.setBrush(QBrush(Qt::NoBrush));
|
||||
painter.scale(data.xScale, data.yScale);
|
||||
}
|
||||
|
@ -2600,8 +2605,8 @@ auto VPMainWindow::GeneratePdfTiledFile(const VPSheetPtr &sheet, bool showTilesS
|
|||
{
|
||||
if (not firstPage)
|
||||
{
|
||||
SetPrinterTiledPageSettings(printer, m_layout, sheet,
|
||||
m_layout->LayoutSettings().GetTilesOrientation(), false);
|
||||
SetPrinterTiledPageSettings(printer, m_layout, sheet, m_layout->LayoutSettings().GetTilesOrientation(),
|
||||
false);
|
||||
|
||||
if (not printer->newPage())
|
||||
{
|
||||
|
@ -2633,8 +2638,8 @@ void VPMainWindow::OpenWatermark(const QString &path)
|
|||
{
|
||||
for (const auto &m_watermarkEditor : qAsConst(m_watermarkEditors))
|
||||
{
|
||||
if (not m_watermarkEditor.isNull() && not m_watermarkEditor->CurrentFile().isEmpty()
|
||||
&& m_watermarkEditor->CurrentFile() == AbsoluteMPath(curFile, path))
|
||||
if (not m_watermarkEditor.isNull() && not m_watermarkEditor->CurrentFile().isEmpty() &&
|
||||
m_watermarkEditor->CurrentFile() == AbsoluteMPath(curFile, path))
|
||||
{
|
||||
m_watermarkEditor->show();
|
||||
return;
|
||||
|
@ -2664,8 +2669,8 @@ void VPMainWindow::CleanWaterkmarkEditors()
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VPMainWindow::DrawTilesScheme(QPrinter *printer, QPainter *painter, const VPSheetPtr &sheet,
|
||||
bool firstPage) -> bool
|
||||
auto VPMainWindow::DrawTilesScheme(QPrinter *printer, QPainter *painter, const VPSheetPtr &sheet, bool firstPage)
|
||||
-> bool
|
||||
{
|
||||
SCASSERT(printer != nullptr)
|
||||
SCASSERT(painter != nullptr)
|
||||
|
@ -2702,8 +2707,7 @@ auto VPMainWindow::DrawTilesScheme(QPrinter *printer, QPainter *painter, const V
|
|||
const int nbCol = m_layout->TileFactory()->ColNb(sheet);
|
||||
const int nbRow = m_layout->TileFactory()->RowNb(sheet);
|
||||
|
||||
QRectF source = QRectF(sheetRect.topLeft(),
|
||||
QSizeF(nbCol * ((width - VPTileFactory::tileStripeWidth) / xScale),
|
||||
QRectF source = QRectF(sheetRect.topLeft(), QSizeF(nbCol * ((width - VPTileFactory::tileStripeWidth) / xScale),
|
||||
nbRow * ((height - VPTileFactory::tileStripeWidth) / yScale)));
|
||||
QRectF target;
|
||||
|
||||
|
@ -2716,8 +2720,7 @@ auto VPMainWindow::DrawTilesScheme(QPrinter *printer, QPainter *painter, const V
|
|||
}
|
||||
|
||||
QSizeF tilesSize = m_layout->LayoutSettings().GetTilesSize();
|
||||
target = QRectF(0, 0,
|
||||
tilesSize.height() - margins.left() - margins.right(),
|
||||
target = QRectF(0, 0, tilesSize.height() - margins.left() - margins.right(),
|
||||
tilesSize.width() - margins.top() - margins.bottom());
|
||||
}
|
||||
else
|
||||
|
@ -2879,8 +2882,8 @@ void VPMainWindow::PrintLayoutSheets(QPrinter *printer, const QList<VPSheetPtr>
|
|||
}
|
||||
|
||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||
painter.setPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
|
||||
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||
painter.setPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(), Qt::SolidLine,
|
||||
Qt::RoundCap, Qt::RoundJoin));
|
||||
painter.setBrush(QBrush(Qt::NoBrush));
|
||||
painter.scale(m_layout->LayoutSettings().HorizontalScale(), m_layout->LayoutSettings().VerticalScale());
|
||||
|
||||
|
@ -2888,8 +2891,8 @@ void VPMainWindow::PrintLayoutSheets(QPrinter *printer, const QList<VPSheetPtr>
|
|||
{
|
||||
for (int j = 0; j < numPages; ++j)
|
||||
{
|
||||
vsizetype index = printer->pageOrder() == QPrinter::FirstPageFirst ? firstPageNumber + j
|
||||
: lastPageNumber - j;
|
||||
vsizetype index =
|
||||
printer->pageOrder() == QPrinter::FirstPageFirst ? firstPageNumber + j : lastPageNumber - j;
|
||||
|
||||
const VPSheetPtr &sheet = sheets.at(index);
|
||||
if (sheet.isNull())
|
||||
|
@ -2916,8 +2919,7 @@ auto VPMainWindow::PrintLayoutSheetPage(QPrinter *printer, QPainter &painter, co
|
|||
if (not sheet->IgnoreMargins())
|
||||
{
|
||||
QMarginsF margins = sheet->GetSheetMargins();
|
||||
if (not printer->setPageMargins(UnitConvertor(margins, Unit::Px, Unit::Mm),
|
||||
QPageLayout::Millimeter))
|
||||
if (not printer->setPageMargins(UnitConvertor(margins, Unit::Px, Unit::Mm), QPageLayout::Millimeter))
|
||||
{
|
||||
qWarning() << QObject::tr("Cannot set printer margins");
|
||||
}
|
||||
|
@ -2931,8 +2933,8 @@ auto VPMainWindow::PrintLayoutSheetPage(QPrinter *printer, QPainter &painter, co
|
|||
|
||||
sheet->SceneData()->PrepareForExport();
|
||||
QRectF imageRect = sheet->GetMarginsRect();
|
||||
sheet->SceneData()->Scene()->render(&painter, VPrintLayout::SceneTargetRect(printer, imageRect),
|
||||
imageRect, Qt::IgnoreAspectRatio);
|
||||
sheet->SceneData()->Scene()->render(&painter, VPrintLayout::SceneTargetRect(printer, imageRect), imageRect,
|
||||
Qt::IgnoreAspectRatio);
|
||||
sheet->SceneData()->CleanAfterExport();
|
||||
|
||||
return true;
|
||||
|
@ -2979,8 +2981,8 @@ void VPMainWindow::PrintLayoutTiledSheets(QPrinter *printer, const QList<VPSheet
|
|||
{
|
||||
for (int j = 0; j < numPages; ++j)
|
||||
{
|
||||
vsizetype index = printer->pageOrder() == QPrinter::FirstPageFirst ? firstPageNumber + j
|
||||
: lastPageNumber - j;
|
||||
vsizetype index =
|
||||
printer->pageOrder() == QPrinter::FirstPageFirst ? firstPageNumber + j : lastPageNumber - j;
|
||||
const VPLayoutPrinterPage &page = pages.at(index);
|
||||
|
||||
if (not PrintLayoutTiledSheetPage(printer, painter, page, firstPage))
|
||||
|
@ -3128,8 +3130,9 @@ auto VPMainWindow::ImportRawLayout(const QString &rawLayout) -> bool
|
|||
return AddLayoutPieces(data.pieces);
|
||||
}
|
||||
|
||||
qCCritical(pWindow, "%s\n", qPrintable(tr("Could not extract data from file '%1'. %2")
|
||||
.arg(rawLayout, rawLayoutReader.ErrorString())));
|
||||
qCCritical(
|
||||
pWindow, "%s\n",
|
||||
qPrintable(tr("Could not extract data from file '%1'. %2").arg(rawLayout, rawLayoutReader.ErrorString())));
|
||||
if (m_cmd != nullptr && not m_cmd->IsGuiEnabled())
|
||||
{
|
||||
m_cmd->ShowHelp(V_EX_DATAERR);
|
||||
|
@ -3414,8 +3417,8 @@ auto VPMainWindow::on_actionSave_triggered() -> bool
|
|||
return on_actionSaveAs_triggered();
|
||||
}
|
||||
|
||||
if (m_curFileFormatVersion < VLayoutConverter::LayoutMaxVer
|
||||
&& not ContinueFormatRewrite(m_curFileFormatVersionStr, VLayoutConverter::LayoutMaxVerStr))
|
||||
if (m_curFileFormatVersion < VLayoutConverter::LayoutMaxVer &&
|
||||
not ContinueFormatRewrite(m_curFileFormatVersionStr, VLayoutConverter::LayoutMaxVerStr))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -3471,7 +3474,8 @@ auto VPMainWindow::on_actionSaveAs_triggered() -> bool
|
|||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), dir + QChar('/') + fName, filters, nullptr,
|
||||
VAbstractApplication::VApp()->NativeFileDialog());
|
||||
|
||||
auto RemoveTempDir = qScopeGuard([usedNotExistedDir, dir]()
|
||||
auto RemoveTempDir = qScopeGuard(
|
||||
[usedNotExistedDir, dir]()
|
||||
{
|
||||
if (usedNotExistedDir)
|
||||
{
|
||||
|
@ -3533,7 +3537,8 @@ auto VPMainWindow::on_actionSaveAs_triggered() -> bool
|
|||
VlpCreateLock(lock, fileName);
|
||||
if (not lock->IsLocked())
|
||||
{
|
||||
qCCritical(pWindow, "%s", qUtf8Printable(tr("Failed to lock. This file already opened in another window. "
|
||||
qCCritical(pWindow, "%s",
|
||||
qUtf8Printable(tr("Failed to lock. This file already opened in another window. "
|
||||
"Expect collissions when run 2 copies of the program.")));
|
||||
return false;
|
||||
}
|
||||
|
@ -3635,10 +3640,9 @@ void VPMainWindow::on_SheetMarginChanged()
|
|||
VPSheetPtr sheet = m_layout->GetFocusedSheet();
|
||||
if (not sheet.isNull())
|
||||
{
|
||||
sheet->SetSheetMarginsConverted(ui->doubleSpinBoxSheetMarginLeft->value(),
|
||||
ui->doubleSpinBoxSheetMarginTop->value(),
|
||||
ui->doubleSpinBoxSheetMarginRight->value(),
|
||||
ui->doubleSpinBoxSheetMarginBottom->value());
|
||||
sheet->SetSheetMarginsConverted(
|
||||
ui->doubleSpinBoxSheetMarginLeft->value(), ui->doubleSpinBoxSheetMarginTop->value(),
|
||||
ui->doubleSpinBoxSheetMarginRight->value(), ui->doubleSpinBoxSheetMarginBottom->value());
|
||||
|
||||
LayoutWasSaved(false);
|
||||
|
||||
|
@ -3675,8 +3679,7 @@ void VPMainWindow::on_TilesSizeChanged()
|
|||
{
|
||||
if (not m_layout.isNull())
|
||||
{
|
||||
m_layout->LayoutSettings().SetTilesSizeConverted(
|
||||
ui->doubleSpinBoxTilePaperWidth->value(),
|
||||
m_layout->LayoutSettings().SetTilesSizeConverted(ui->doubleSpinBoxTilePaperWidth->value(),
|
||||
ui->doubleSpinBoxTilePaperHeight->value());
|
||||
FindTileTemplate();
|
||||
TilePaperSizeChanged();
|
||||
|
@ -3715,10 +3718,8 @@ void VPMainWindow::on_TilesMarginChanged()
|
|||
if (not m_layout.isNull())
|
||||
{
|
||||
m_layout->LayoutSettings().SetTilesMarginsConverted(
|
||||
ui->doubleSpinBoxTileMarginLeft->value(),
|
||||
ui->doubleSpinBoxTileMarginTop->value(),
|
||||
ui->doubleSpinBoxTileMarginRight->value(),
|
||||
ui->doubleSpinBoxTileMarginBottom->value());
|
||||
ui->doubleSpinBoxTileMarginLeft->value(), ui->doubleSpinBoxTileMarginTop->value(),
|
||||
ui->doubleSpinBoxTileMarginRight->value(), ui->doubleSpinBoxTileMarginBottom->value());
|
||||
LayoutWasSaved(false);
|
||||
m_layout->TileFactory()->RefreshTileInfos();
|
||||
m_graphicsView->RefreshLayout();
|
||||
|
@ -3766,11 +3767,10 @@ void VPMainWindow::on_MouseMoved(const QPointF &scenePos)
|
|||
{
|
||||
if (m_mouseCoordinate != nullptr)
|
||||
{
|
||||
m_mouseCoordinate->setText(QStringLiteral("%1, %2 (%3)")
|
||||
.arg(static_cast<qint32>(FromPixel(scenePos.x(),
|
||||
m_layout->LayoutSettings().GetUnit())))
|
||||
.arg(static_cast<qint32>(FromPixel(scenePos.y(),
|
||||
m_layout->LayoutSettings().GetUnit())))
|
||||
m_mouseCoordinate->setText(
|
||||
QStringLiteral("%1, %2 (%3)")
|
||||
.arg(static_cast<qint32>(FromPixel(scenePos.x(), m_layout->LayoutSettings().GetUnit())))
|
||||
.arg(static_cast<qint32>(FromPixel(scenePos.y(), m_layout->LayoutSettings().GetUnit())))
|
||||
.arg(UnitsToStr(m_layout->LayoutSettings().GetUnit(), true)));
|
||||
}
|
||||
}
|
||||
|
@ -3798,10 +3798,7 @@ void VPMainWindow::on_actionPreferences_triggered() // NOLINT(readability-conver
|
|||
QSharedPointer<DialogPuzzlePreferences> preferences = VPApplication::VApp()->PreferencesDialog();
|
||||
if (preferences.isNull())
|
||||
{
|
||||
auto CleanAfterDialog = qScopeGuard([&preferences]()
|
||||
{
|
||||
preferences.clear();
|
||||
});
|
||||
auto CleanAfterDialog = qScopeGuard([&preferences]() { preferences.clear(); });
|
||||
|
||||
QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||
|
||||
|
@ -4268,7 +4265,6 @@ void VPMainWindow::on_actionPrintPreviewTiledLayout_triggered()
|
|||
printer->setCreator(QGuiApplication::applicationDisplayName() + QChar(QChar::Space) +
|
||||
QCoreApplication::applicationVersion());
|
||||
|
||||
|
||||
QList<VPSheetPtr> sheets = m_layout->GetSheets();
|
||||
const VPSheetPtr &firstSheet = ConstFirst(sheets);
|
||||
if (firstSheet.isNull())
|
||||
|
|
|
@ -28,34 +28,55 @@
|
|||
#include "vpsettings.h"
|
||||
#include "../vmisc/compatibility.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
#include "../vmisc/diagnostic.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
|
||||
#include <QMarginsF>
|
||||
|
||||
namespace
|
||||
{
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDockWidgetPropertiesActive, (QLatin1String("dockWidget/properties"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDockPropertiesContentsActive, (QLatin1String("dockWidget/contents"))) // NOLINT
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
|
||||
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDockWidgetPropertiesActive, (QLatin1String("dockWidget/properties")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDockPropertiesContentsActive, (QLatin1String("dockWidget/contents")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutUnit, (QLatin1String("layout/unit"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSheetPaperWidth, (QLatin1String("layout/sheetPaperWidth"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSheetPaperHeight, (QLatin1String("layout/sheetPaperHeight"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutTilePaperWidth, (QLatin1String("layout/tilePaperWidth"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutTilePaperHeight, (QLatin1String("layout/tilePaperHeight"))) // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSheetPaperWidth, (QLatin1String("layout/sheetPaperWidth")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSheetPaperHeight, (QLatin1String("layout/sheetPaperHeight")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutTilePaperWidth, (QLatin1String("layout/tilePaperWidth")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutTilePaperHeight, (QLatin1String("layout/tilePaperHeight")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSheetMargins, (QLatin1String("layout/sheetMargins"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutTileMargins, (QLatin1String("layout/tileMargins"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSheetIgnoreMargins, (QLatin1String("layout/sheetIgnoreMargins"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutTileIgnoreMargins, (QLatin1String("layout/tileIgnoreMargins"))) // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSheetIgnoreMargins, (QLatin1String("layout/sheetIgnoreMargins")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutTileIgnoreMargins, (QLatin1String("layout/tileIgnoreMargins")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutTileShowTiles, (QLatin1String("layout/tileShowTiles"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutTileShowWatermark, (QLatin1String("layout/tileShowWatermark"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutWarningPiecesSuperposition, // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutTileShowWatermark, (QLatin1String("layout/tileShowWatermark")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutWarningPiecesSuperposition,
|
||||
(QLatin1String("layout/warningPiecesSuperposition")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutStickyEdges, (QLatin1String("layout/stickyEdges"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutWarningPiecesOutOfBound, // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutWarningPiecesOutOfBound,
|
||||
(QLatin1String("layout/warningPiecesOutOfBound")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutFollowGrainline, (QLatin1String("layout/followGrainline"))) // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutFollowGrainline, (QLatin1String("layout/followGrainline")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutPieceGap, (QLatin1String("layout/pieceGap"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutExportFormat, (QLatin1String("layout/exportFormat"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutLineWidth, (QLatin1String("layout/lineWidth"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutShowGrainline, (QLatin1String("layout/showGrainline"))) // NOLINT
|
||||
|
||||
QT_WARNING_POP
|
||||
|
||||
int cachedLineWidth = -1; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
} // namespace
|
||||
|
||||
|
@ -66,10 +87,7 @@ Q_DECLARE_METATYPE(QMarginsF) // NOLINT
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPSettings::VPSettings(Format format, Scope scope, const QString &organization, const QString &application,
|
||||
QObject *parent)
|
||||
: VCommonSettings(format, scope, organization, application, parent)
|
||||
{
|
||||
REGISTER_META_TYPE_STREAM_OPERATORS(QMarginsF)
|
||||
}
|
||||
: VCommonSettings(format, scope, organization, application, parent){REGISTER_META_TYPE_STREAM_OPERATORS(QMarginsF)}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPSettings::VPSettings(const QString &fileName, QSettings::Format format, QObject *parent)
|
||||
|
|
|
@ -2,21 +2,29 @@
|
|||
|
||||
#include <QtSvg>
|
||||
|
||||
#include "../vwidgets/vmaingraphicsscene.h"
|
||||
#include "layout/vpsheet.h"
|
||||
#include "qobject.h"
|
||||
#include "scene/vpmaingraphicsview.h"
|
||||
#include "../vlayout/vprintlayout.h"
|
||||
#include "../vmisc/compatibility.h"
|
||||
#include "../vmisc/def.h"
|
||||
#include "../vmisc/literals.h"
|
||||
#include "../vmisc/vcommonsettings.h"
|
||||
#include "../vmisc/compatibility.h"
|
||||
#include "../vlayout/vprintlayout.h"
|
||||
#include "../vwidgets/vmaingraphicsscene.h"
|
||||
#include "layout/vpsheet.h"
|
||||
#include "qobject.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
#include "../vmisc/diagnostic.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
|
||||
namespace
|
||||
{
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(QColor, tileColor, (180, 180, 180)) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(QBrush, triangleBush, (QColor(200, 200, 200))) // NOLINT
|
||||
|
||||
QT_WARNING_POP
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto Grayscale(QImage image) -> QImage
|
||||
{
|
||||
|
@ -41,9 +49,11 @@ auto WatermarkImageFromCache(const VWatermarkData &watermarkData, const QString
|
|||
{
|
||||
QPixmap pixmap;
|
||||
QString imagePath = AbsoluteMPath(watermarkPath, watermarkData.path);
|
||||
QString imageCacheKey = QStringLiteral("puzzle=path%1+rotation%3+grayscale%4+xscale%5+yxcale%6")
|
||||
.arg(imagePath, QString::number(watermarkData.imageRotation),
|
||||
watermarkData.grayscale ? trueStr : falseStr ).arg(xScale).arg(yScale);
|
||||
QString imageCacheKey =
|
||||
QStringLiteral("puzzle=path%1+rotation%3+grayscale%4+xscale%5+yxcale%6")
|
||||
.arg(imagePath, QString::number(watermarkData.imageRotation), watermarkData.grayscale ? trueStr : falseStr)
|
||||
.arg(xScale)
|
||||
.arg(yScale);
|
||||
|
||||
if (not QPixmapCache::find(imageCacheKey, &pixmap))
|
||||
{
|
||||
|
@ -82,9 +92,7 @@ auto WatermarkImageFromCache(const VWatermarkData &watermarkData, const QString
|
|||
auto TriangleBasic() -> QPainterPath
|
||||
{
|
||||
// ------------- prepare triangles for position marks
|
||||
QRectF rectBasic = QRectF(-UnitConvertor(0.5, Unit::Cm, Unit::Px),
|
||||
0,
|
||||
UnitConvertor(1, Unit::Cm, Unit::Px),
|
||||
QRectF rectBasic = QRectF(-UnitConvertor(0.5, Unit::Cm, Unit::Px), 0, UnitConvertor(1, Unit::Cm, Unit::Px),
|
||||
UnitConvertor(0.5, Unit::Cm, Unit::Px));
|
||||
QPainterPath triangleBasic;
|
||||
triangleBasic.moveTo(rectBasic.topLeft());
|
||||
|
@ -101,8 +109,8 @@ constexpr qreal VPTileFactory::tileStripeWidth; // NOLINT(readability-redundant
|
|||
#endif
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPTileFactory::VPTileFactory(const VPLayoutPtr &layout, VCommonSettings *commonSettings, QObject *parent):
|
||||
QObject(parent),
|
||||
VPTileFactory::VPTileFactory(const VPLayoutPtr &layout, VCommonSettings *commonSettings, QObject *parent)
|
||||
: QObject(parent),
|
||||
m_layout(layout),
|
||||
m_commonSettings(commonSettings)
|
||||
{
|
||||
|
@ -354,7 +362,8 @@ void VPTileFactory::DrawRuler(QPainter *painter, qreal scale) const
|
|||
QString units = rulerUnits != Unit::Inch ? tr("cm", "unit") : tr("in", "unit");
|
||||
unitsWidth = TextWidth(fm, units);
|
||||
painter->drawText(QPointF(step * 0.5 - unitsWidth * 0.6,
|
||||
m_drawingAreaHeight - tileStripeWidth + notchHeight+shortNotchHeight), units);
|
||||
m_drawingAreaHeight - tileStripeWidth + notchHeight + shortNotchHeight),
|
||||
units);
|
||||
|
||||
painter->restore();
|
||||
}
|
||||
|
@ -377,14 +386,11 @@ void VPTileFactory::DrawWatermark(QPainter *painter) const
|
|||
|
||||
if (m_watermarkData.opacity > 0)
|
||||
{
|
||||
QRectF img(0, 0,
|
||||
m_drawingAreaWidth - tileStripeWidth,
|
||||
m_drawingAreaHeight - tileStripeWidth);
|
||||
QRectF img(0, 0, m_drawingAreaWidth - tileStripeWidth, m_drawingAreaHeight - tileStripeWidth);
|
||||
|
||||
if (m_watermarkData.showImage && not m_watermarkData.path.isEmpty())
|
||||
{
|
||||
PaintWatermarkImage(painter, img, m_watermarkData,
|
||||
layout->LayoutSettings().WatermarkPath());
|
||||
PaintWatermarkImage(painter, img, m_watermarkData, layout->LayoutSettings().WatermarkPath());
|
||||
}
|
||||
|
||||
if (m_watermarkData.showText && not m_watermarkData.text.isEmpty())
|
||||
|
@ -416,8 +422,8 @@ void VPTileFactory::DrawTilePageContent(QPainter *painter, const VPSheetPtr &she
|
|||
sheetMargins = sheet->GetSheetMargins();
|
||||
}
|
||||
|
||||
QPen penTileDrawing = QPen(Qt::black, m_commonSettings->WidthMainLine(), Qt::SolidLine, Qt::RoundCap,
|
||||
Qt::RoundJoin);
|
||||
QPen penTileDrawing =
|
||||
QPen(Qt::black, m_commonSettings->WidthMainLine(), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
|
||||
painter->setPen(penTileDrawing);
|
||||
|
||||
|
@ -426,13 +432,9 @@ void VPTileFactory::DrawTilePageContent(QPainter *painter, const VPSheetPtr &she
|
|||
const qreal yScale = layout->LayoutSettings().VerticalScale();
|
||||
QRectF source = QRectF(sheetMargins.left() + col * (m_drawingAreaWidth - tileStripeWidth) / xScale,
|
||||
sheetMargins.top() + row * (m_drawingAreaHeight - tileStripeWidth) / yScale,
|
||||
m_drawingAreaWidth / xScale,
|
||||
m_drawingAreaHeight / yScale);
|
||||
m_drawingAreaWidth / xScale, m_drawingAreaHeight / yScale);
|
||||
|
||||
QRectF target = QRectF(0,
|
||||
0,
|
||||
m_drawingAreaWidth,
|
||||
m_drawingAreaHeight);
|
||||
QRectF target = QRectF(0, 0, m_drawingAreaWidth, m_drawingAreaHeight);
|
||||
sheet->SceneData()->Scene()->render(painter, VPrintLayout::SceneTargetRect(printer, target), source,
|
||||
Qt::IgnoreAspectRatio);
|
||||
}
|
||||
|
@ -440,29 +442,21 @@ void VPTileFactory::DrawTilePageContent(QPainter *painter, const VPSheetPtr &she
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPTileFactory::DrawTopTriangle(QPainter *painter) const
|
||||
{
|
||||
QPainterPath triangleTop =
|
||||
QTransform()
|
||||
.translate(m_drawingAreaWidth/2, 0)
|
||||
.map(TriangleBasic());
|
||||
QPainterPath triangleTop = QTransform().translate(m_drawingAreaWidth / 2, 0).map(TriangleBasic());
|
||||
painter->fillPath(triangleTop, *triangleBush);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPTileFactory::DrawLeftTriangle(QPainter *painter) const
|
||||
{
|
||||
QPainterPath triangleLeft =
|
||||
QTransform()
|
||||
.translate(0, m_drawingAreaHeight/2)
|
||||
.rotate(-90)
|
||||
.map(TriangleBasic());
|
||||
QPainterPath triangleLeft = QTransform().translate(0, m_drawingAreaHeight / 2).rotate(-90).map(TriangleBasic());
|
||||
painter->fillPath(triangleLeft, *triangleBush);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPTileFactory::DrawBottomTriangle(QPainter *painter) const
|
||||
{
|
||||
QPainterPath triangleBottom =
|
||||
QTransform()
|
||||
QPainterPath triangleBottom = QTransform()
|
||||
.translate(m_drawingAreaWidth / 2, m_drawingAreaHeight - tileStripeWidth)
|
||||
.rotate(180)
|
||||
.map(TriangleBasic());
|
||||
|
@ -472,8 +466,7 @@ void VPTileFactory::DrawBottomTriangle(QPainter *painter) const
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPTileFactory::DrawRightTriangle(QPainter *painter) const
|
||||
{
|
||||
QPainterPath triangleRight =
|
||||
QTransform()
|
||||
QPainterPath triangleRight = QTransform()
|
||||
.translate(m_drawingAreaWidth - tileStripeWidth, m_drawingAreaHeight / 2)
|
||||
.rotate(90)
|
||||
.map(TriangleBasic());
|
||||
|
@ -484,8 +477,7 @@ void VPTileFactory::DrawRightTriangle(QPainter *painter) const
|
|||
void VPTileFactory::DrawTopLineScissors(QPainter *painter) const
|
||||
{
|
||||
QSvgRenderer svgRenderer(QStringLiteral("://puzzleicon/svg/icon_scissors_horizontal.svg"));
|
||||
svgRenderer.render(painter, QRectF(m_drawingAreaWidth - tileStripeWidth, 0,
|
||||
UnitConvertor(0.95, Unit::Cm, Unit::Px),
|
||||
svgRenderer.render(painter, QRectF(m_drawingAreaWidth - tileStripeWidth, 0, UnitConvertor(0.95, Unit::Cm, Unit::Px),
|
||||
UnitConvertor(0.56, Unit::Cm, Unit::Px)));
|
||||
}
|
||||
|
||||
|
@ -493,8 +485,8 @@ void VPTileFactory::DrawTopLineScissors(QPainter *painter) const
|
|||
void VPTileFactory::DrawLeftLineScissors(QPainter *painter) const
|
||||
{
|
||||
QSvgRenderer svgRenderer(QStringLiteral("://puzzleicon/svg/icon_scissors_vertical.svg"));
|
||||
svgRenderer.render(painter, QRectF(0, m_drawingAreaHeight - tileStripeWidth,
|
||||
UnitConvertor(0.56, Unit::Cm, Unit::Px),
|
||||
svgRenderer.render(painter,
|
||||
QRectF(0, m_drawingAreaHeight - tileStripeWidth, UnitConvertor(0.56, Unit::Cm, Unit::Px),
|
||||
UnitConvertor(0.95, Unit::Cm, Unit::Px)));
|
||||
}
|
||||
|
||||
|
@ -585,7 +577,8 @@ void VPTileFactory::DrawSolidBottomLine(QPainter *painter, int col, int nbCol) c
|
|||
else
|
||||
{
|
||||
painter->drawLine(QPointF(0, m_drawingAreaHeight - tileStripeWidth),
|
||||
QPointF(m_drawingAreaWidth - tileStripeWidth, m_drawingAreaHeight - tileStripeWidth));;
|
||||
QPointF(m_drawingAreaWidth - tileStripeWidth, m_drawingAreaHeight - tileStripeWidth));
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -617,8 +610,8 @@ void VPTileFactory::DrawTextInformation(QPainter *painter, int row, int col, int
|
|||
|
||||
// paint the grid information
|
||||
const QString grid = tr("Grid ( %1 , %2 )").arg(row + 1).arg(col + 1);
|
||||
const QString tileColorStr = QStringLiteral("%1,%2,%3")
|
||||
.arg(tileColor->red()).arg(tileColor->green()).arg(tileColor->blue());
|
||||
const QString tileColorStr =
|
||||
QStringLiteral("%1,%2,%3").arg(tileColor->red()).arg(tileColor->green()).arg(tileColor->blue());
|
||||
|
||||
td.setHtml(QString("<table width='100%' style='color:rgb(%1);'>"
|
||||
"<tr>"
|
||||
|
@ -645,11 +638,12 @@ void VPTileFactory::DrawTextInformation(QPainter *painter, int row, int col, int
|
|||
"<tr>"
|
||||
"<td align='center'>%2 - %3</td>"
|
||||
"</tr>"
|
||||
"</table>").arg(tileColorStr, page, clippedSheetName));
|
||||
"</table>")
|
||||
.arg(tileColorStr, page, clippedSheetName));
|
||||
painter->save();
|
||||
painter->rotate(-90);
|
||||
painter->translate(QPointF(-(m_drawingAreaHeight) + UnitConvertor(1, Unit::Cm, Unit::Px),
|
||||
m_drawingAreaWidth - tileStripeWidth));
|
||||
painter->translate(
|
||||
QPointF(-(m_drawingAreaHeight) + UnitConvertor(1, Unit::Cm, Unit::Px), m_drawingAreaWidth - tileStripeWidth));
|
||||
td.drawContents(painter);
|
||||
painter->restore();
|
||||
}
|
||||
|
|
|
@ -27,21 +27,20 @@
|
|||
*************************************************************************/
|
||||
|
||||
#include "vplayoutfilewriter.h"
|
||||
#include "../layout/vplayout.h"
|
||||
#include "../layout/vpsheet.h"
|
||||
#include "../layout/vppiece.h"
|
||||
#include "vplayoutliterals.h"
|
||||
#include "../ifc/xml/vlayoutconverter.h"
|
||||
#include "../vmisc/projectversion.h"
|
||||
#include "../layout/vplayout.h"
|
||||
#include "../layout/vppiece.h"
|
||||
#include "../layout/vpsheet.h"
|
||||
#include "../vgeometry/vlayoutplacelabel.h"
|
||||
#include "../vlayout/vlayoutpiecepath.h"
|
||||
#include "../vlayout/vtextmanager.h"
|
||||
#include "../vgeometry/vlayoutplacelabel.h"
|
||||
#include "../vmisc/projectversion.h"
|
||||
#include "vplayoutliterals.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template <class T>
|
||||
auto NumberToString(T number) -> QString
|
||||
template <class T> auto NumberToString(T number) -> QString
|
||||
{
|
||||
const QLocale locale = QLocale::c();
|
||||
return locale.toString(number, 'g', 12).remove(LocaleGroupSeparator(locale));
|
||||
|
@ -50,18 +49,9 @@ auto NumberToString(T number) -> QString
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto TransformToString(const QTransform &m) -> QString
|
||||
{
|
||||
QStringList matrix
|
||||
{
|
||||
NumberToString(m.m11()),
|
||||
NumberToString(m.m12()),
|
||||
NumberToString(m.m13()),
|
||||
NumberToString(m.m21()),
|
||||
NumberToString(m.m22()),
|
||||
NumberToString(m.m23()),
|
||||
NumberToString(m.m31()),
|
||||
NumberToString(m.m32()),
|
||||
NumberToString(m.m33())
|
||||
};
|
||||
QStringList matrix{NumberToString(m.m11()), NumberToString(m.m12()), NumberToString(m.m13()),
|
||||
NumberToString(m.m21()), NumberToString(m.m22()), NumberToString(m.m23()),
|
||||
NumberToString(m.m31()), NumberToString(m.m32()), NumberToString(m.m33())};
|
||||
return matrix.join(ML::groupSep);
|
||||
}
|
||||
|
||||
|
@ -88,10 +78,8 @@ auto PathToString(const QVector<QPointF> &pathPoints) -> QString
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto RectToString(const QRectF &r) -> QString
|
||||
{
|
||||
return NumberToString(r.x()) + ML::groupSep +
|
||||
NumberToString(r.y()) + ML::groupSep +
|
||||
NumberToString(r.width()) + ML::groupSep +
|
||||
NumberToString(r.height());
|
||||
return NumberToString(r.x()) + ML::groupSep + NumberToString(r.y()) + ML::groupSep + NumberToString(r.width()) +
|
||||
ML::groupSep + NumberToString(r.height());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -153,8 +141,8 @@ void VPLayoutFileWriter::WriteFile(const VPLayoutPtr &layout, QIODevice *file)
|
|||
setAutoFormatting(true);
|
||||
|
||||
writeStartDocument();
|
||||
writeComment(QStringLiteral("Layout created with Valentina v%1 (https://smart-pattern.com.ua/).")
|
||||
.arg(APP_VERSION_STR));
|
||||
writeComment(
|
||||
QStringLiteral("Layout created with Valentina v%1 (https://smart-pattern.com.ua/).").arg(APP_VERSION_STR));
|
||||
WriteLayout(layout);
|
||||
writeEndDocument();
|
||||
}
|
||||
|
@ -429,7 +417,8 @@ void VPLayoutFileWriter::WriteMargins(const QMarginsF &margins, bool ignore)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPLayoutFileWriter::WriteSize(QSizeF size)
|
||||
{
|
||||
// maybe not necessary to test this, the writer should "stupidly write", the application should take care of these tests
|
||||
// maybe not necessary to test this, the writer should "stupidly write", the application should take care of these
|
||||
// tests
|
||||
qreal width = size.width();
|
||||
if (width < 0)
|
||||
{
|
||||
|
|
|
@ -139,5 +139,4 @@ extern const QChar pointsSep;
|
|||
extern const QChar itemsSep;
|
||||
} // namespace ML
|
||||
|
||||
|
||||
#endif // VPLAYOUTLITERALS_H
|
||||
|
|
|
@ -31,8 +31,6 @@
|
|||
|
||||
#include <QWidget>
|
||||
|
||||
#include "../vmisc/defglobal.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class TapePreferencesConfigurationPage;
|
||||
|
@ -47,8 +45,10 @@ public:
|
|||
~TapePreferencesConfigurationPage() override;
|
||||
|
||||
auto Apply() -> QStringList;
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *event) override;
|
||||
|
||||
private:
|
||||
// cppcheck-suppress unknownMacro
|
||||
Q_DISABLE_COPY_MOVE(TapePreferencesConfigurationPage) // NOLINT
|
||||
|
|
|
@ -80,6 +80,9 @@ QT_WARNING_POP
|
|||
|
||||
namespace
|
||||
{
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, LONG_OPTION_DIMENSION_A, (QLatin1String("dimensionA"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, SINGLE_OPTION_DIMENSION_A, (QChar('a'))) // NOLINT
|
||||
|
||||
|
@ -93,6 +96,8 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, LONG_OPTION_UNITS, (QLatin1String("unit
|
|||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, SINGLE_OPTION_UNITS, (QChar('u'))) // NOLINT
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, LONG_OPTION_TEST, (QLatin1String("test"))) // NOLINT
|
||||
|
||||
QT_WARNING_POP
|
||||
} // namespace
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -51,14 +51,15 @@
|
|||
#include "dialogs/dialogsetupmultisize.h"
|
||||
#include "dialogs/dialogtapepreferences.h"
|
||||
#include "ui_tmainwindow.h"
|
||||
#include "vtapesettings.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 "vlitepattern.h"
|
||||
#include "../qmuparser/qmudef.h"
|
||||
#include "../vtools/dialogs/support/dialogeditwrongformula.h"
|
||||
#include "../vmisc/dialogs/dialogselectlanguage.h"
|
||||
#include "../vtools/dialogs/support/dialogeditwrongformula.h"
|
||||
#include "mapplication.h" // Should be last because of definning qApp
|
||||
#include "vlitepattern.h"
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
#include "../vmisc/vtextcodec.h"
|
||||
|
@ -72,13 +73,13 @@
|
|||
#include <QScopeGuard>
|
||||
#endif
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QFileDialog>
|
||||
#include <QFileInfo>
|
||||
#include <QMessageBox>
|
||||
#include <QComboBox>
|
||||
#include <QProcess>
|
||||
#include <QtNumeric>
|
||||
#include <QTimer>
|
||||
#include <QtNumeric>
|
||||
#include <chrono>
|
||||
|
||||
#if (defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
|
||||
|
@ -93,8 +94,8 @@ using namespace bpstd::literals::chrono_literals;
|
|||
#endif //(defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
|
||||
|
||||
#if defined(Q_OS_MAC)
|
||||
#include <QMimeData>
|
||||
#include <QDrag>
|
||||
#include <QMimeData>
|
||||
#endif // defined(Q_OS_MAC)
|
||||
|
||||
constexpr int DIALOG_MAX_FORMULA_HEIGHT = 64;
|
||||
|
@ -109,7 +110,11 @@ QT_WARNING_POP
|
|||
|
||||
namespace
|
||||
{
|
||||
enum class MUnits : qint8 { Table, Degrees};
|
||||
enum class MUnits : qint8
|
||||
{
|
||||
Table,
|
||||
Degrees
|
||||
};
|
||||
|
||||
struct IndividualMeasurement
|
||||
{
|
||||
|
@ -237,7 +242,8 @@ void SetIndividualMeasurementDescription(int i, const QString &name, const QxtCs
|
|||
} // namespace
|
||||
|
||||
// We need this enum in case we will add or delete a column. And also make code more readable.
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
ColumnName = 0,
|
||||
ColumnFullName = 1,
|
||||
ColumnCalcValue = 2,
|
||||
|
@ -434,8 +440,8 @@ auto TMainWindow::LoadFile(const QString &path) -> bool
|
|||
|
||||
// Check if file already opened
|
||||
const QList<TMainWindow *> list = MApplication::VApp()->MainWindows();
|
||||
auto w = std::find_if(list.begin(), list.end(),
|
||||
[path](TMainWindow *window) { return window->CurrentFile() == path; });
|
||||
auto w =
|
||||
std::find_if(list.begin(), list.end(), [path](TMainWindow *window) { return window->CurrentFile() == path; });
|
||||
if (w != list.end())
|
||||
{
|
||||
(*w)->activateWindow();
|
||||
|
@ -518,8 +524,8 @@ auto TMainWindow::LoadFile(const QString &path) -> bool
|
|||
}
|
||||
catch (VException &e)
|
||||
{
|
||||
qCCritical(tMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("File error.")),
|
||||
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
|
||||
qCCritical(tMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("File error.")), qUtf8Printable(e.ErrorMessage()),
|
||||
qUtf8Printable(e.DetailedInformation()));
|
||||
ui->labelToolTip->setVisible(true);
|
||||
ui->tabWidget->setVisible(false);
|
||||
delete m_m;
|
||||
|
@ -638,8 +644,8 @@ void TMainWindow::OpenMultisize()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void TMainWindow::OpenTemplate()
|
||||
{
|
||||
const QString filter = tr("Measurements") + QStringLiteral(" (*.vst *.vit);;") + tr("All files") +
|
||||
QStringLiteral(" (*.*)");
|
||||
const QString filter =
|
||||
tr("Measurements") + QStringLiteral(" (*.vst *.vit);;") + tr("All files") + QStringLiteral(" (*.*)");
|
||||
// Use standard path to template files
|
||||
QString pathTo = MApplication::VApp()->TapeSettings()->GetPathTemplate();
|
||||
pathTo = VCommonSettings::PrepareStandardTemplates(pathTo);
|
||||
|
@ -655,8 +661,8 @@ void TMainWindow::OpenTemplate()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void TMainWindow::CreateFromExisting()
|
||||
{
|
||||
const QString filter = tr("Measurements") + QStringLiteral(" (*.vst *.vit);;") + tr("All files") +
|
||||
QStringLiteral(" (*.*)");
|
||||
const QString filter =
|
||||
tr("Measurements") + QStringLiteral(" (*.vst *.vit);;") + tr("All files") + QStringLiteral(" (*.*)");
|
||||
|
||||
const QString mPath = QFileDialog::getOpenFileName(this, tr("Select file"), QDir::homePath(), filter, nullptr,
|
||||
VAbstractApplication::VApp()->NativeFileDialog());
|
||||
|
@ -914,16 +920,14 @@ auto TMainWindow::FileSave() -> bool
|
|||
return FileSaveAs();
|
||||
}
|
||||
|
||||
if (m_mType == MeasurementsType::Multisize
|
||||
&& m_curFileFormatVersion < VVSTConverter::MeasurementMaxVer
|
||||
&& not ContinueFormatRewrite(m_curFileFormatVersionStr, VVSTConverter::MeasurementMaxVerStr))
|
||||
if (m_mType == MeasurementsType::Multisize && m_curFileFormatVersion < VVSTConverter::MeasurementMaxVer &&
|
||||
not ContinueFormatRewrite(m_curFileFormatVersionStr, VVSTConverter::MeasurementMaxVerStr))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_mType == MeasurementsType::Individual
|
||||
&& m_curFileFormatVersion < VVITConverter::MeasurementMaxVer
|
||||
&& not ContinueFormatRewrite(m_curFileFormatVersionStr, VVITConverter::MeasurementMaxVerStr))
|
||||
if (m_mType == MeasurementsType::Individual && m_curFileFormatVersion < VVITConverter::MeasurementMaxVer &&
|
||||
not ContinueFormatRewrite(m_curFileFormatVersionStr, VVITConverter::MeasurementMaxVerStr))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -995,7 +999,8 @@ auto TMainWindow::FileSaveAs() -> bool
|
|||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), dir + QChar('/') + fName, filters, nullptr,
|
||||
VAbstractApplication::VApp()->NativeFileDialog());
|
||||
|
||||
auto RemoveTempDir = qScopeGuard([usedNotExistedDir, dir]()
|
||||
auto RemoveTempDir = qScopeGuard(
|
||||
[usedNotExistedDir, dir]()
|
||||
{
|
||||
if (usedNotExistedDir)
|
||||
{
|
||||
|
@ -1071,7 +1076,8 @@ auto TMainWindow::FileSaveAs() -> bool
|
|||
VlpCreateLock(m_lock, fileName);
|
||||
if (not m_lock->IsLocked())
|
||||
{
|
||||
qCCritical(tMainWindow, "%s", qUtf8Printable(tr("Failed to lock. This file already opened in another window. "
|
||||
qCCritical(tMainWindow, "%s",
|
||||
qUtf8Printable(tr("Failed to lock. This file already opened in another window. "
|
||||
"Expect collissions when run 2 copies of the program.")));
|
||||
return false;
|
||||
}
|
||||
|
@ -1637,8 +1643,8 @@ void TMainWindow::ImportFromPattern()
|
|||
}
|
||||
catch (VException &e)
|
||||
{
|
||||
qCCritical(tMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("File error.")),
|
||||
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
|
||||
qCCritical(tMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("File error.")), qUtf8Printable(e.ErrorMessage()),
|
||||
qUtf8Printable(e.DetailedInformation()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1842,14 +1848,13 @@ void TMainWindow::ShowNewMData(bool fresh)
|
|||
if (meash->IsSpecialUnits())
|
||||
{
|
||||
const qreal value = *m_data->DataVariables()->value(meash->GetName())->GetValue();
|
||||
calculatedValue = VAbstractApplication::VApp()->LocaleToString(value) + QChar(QChar::Space) +
|
||||
degreeSymbol;
|
||||
calculatedValue = VAbstractApplication::VApp()->LocaleToString(value) + QChar(QChar::Space) + degreeSymbol;
|
||||
}
|
||||
else
|
||||
{
|
||||
const QString postfix = UnitsToStr(m_pUnit); // Show unit in dialog lable (cm, mm or inch)
|
||||
const qreal value = UnitConvertor(*m_data->DataVariables()->value(meash->GetName())->GetValue(),
|
||||
m_mUnit, m_pUnit);
|
||||
const qreal value =
|
||||
UnitConvertor(*m_data->DataVariables()->value(meash->GetName())->GetValue(), m_mUnit, m_pUnit);
|
||||
calculatedValue = VAbstractApplication::VApp()->LocaleToString(value) + QChar(QChar::Space) + postfix;
|
||||
}
|
||||
ui->labelCalculatedValue->setText(calculatedValue);
|
||||
|
@ -1884,13 +1889,11 @@ void TMainWindow::ShowNewMData(bool fresh)
|
|||
ui->labelDimension->setVisible(meash->GetType() == VarType::Measurement);
|
||||
ui->comboBoxDimension->setVisible(meash->GetType() == VarType::Measurement);
|
||||
|
||||
EvalFormula(meash->GetFormula(), false, meash->GetData(), ui->labelCalculatedValue,
|
||||
meash->IsSpecialUnits());
|
||||
EvalFormula(meash->GetFormula(), false, meash->GetData(), ui->labelCalculatedValue, meash->IsSpecialUnits());
|
||||
|
||||
ui->plainTextEditFormula->blockSignals(true);
|
||||
|
||||
QString formula =
|
||||
VTranslateVars::TryFormulaToUser(meash->GetFormula(),
|
||||
QString formula = VTranslateVars::TryFormulaToUser(meash->GetFormula(),
|
||||
VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||
|
||||
ui->plainTextEditFormula->setPlainText(formula);
|
||||
|
@ -1941,15 +1944,15 @@ void TMainWindow::DeployFormula()
|
|||
{
|
||||
ui->plainTextEditFormula->setFixedHeight(DIALOG_MAX_FORMULA_HEIGHT);
|
||||
// Set icon from theme (internal for Windows system)
|
||||
ui->pushButtonGrow->setIcon(QIcon::fromTheme(QStringLiteral("go-next"),
|
||||
QIcon(":/icons/win.icon.theme/16x16/actions/go-next.png")));
|
||||
ui->pushButtonGrow->setIcon(
|
||||
QIcon::fromTheme(QStringLiteral("go-next"), QIcon(":/icons/win.icon.theme/16x16/actions/go-next.png")));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->plainTextEditFormula->setFixedHeight(m_formulaBaseHeight);
|
||||
// Set icon from theme (internal for Windows system)
|
||||
ui->pushButtonGrow->setIcon(QIcon::fromTheme(QStringLiteral("go-down"),
|
||||
QIcon(":/icons/win.icon.theme/16x16/actions/go-down.png")));
|
||||
ui->pushButtonGrow->setIcon(
|
||||
QIcon::fromTheme(QStringLiteral("go-down"), QIcon(":/icons/win.icon.theme/16x16/actions/go-down.png")));
|
||||
}
|
||||
|
||||
// I found that after change size of formula field, it was filed for angle formula, field for formula became black.
|
||||
|
@ -2073,8 +2076,8 @@ void TMainWindow::SaveMValue()
|
|||
|
||||
try
|
||||
{
|
||||
const QString formula = VAbstractApplication::VApp()->TrVars()
|
||||
->FormulaFromUser(text, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||
const QString formula = VAbstractApplication::VApp()->TrVars()->FormulaFromUser(
|
||||
text, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||
m_m->SetMValue(nameField->data(Qt::UserRole).toString(), formula);
|
||||
}
|
||||
catch (qmu::QmuParserError &e) // Just in case something bad will happen
|
||||
|
@ -2208,8 +2211,8 @@ void TMainWindow::SaveMCorrectionValue(double value)
|
|||
}
|
||||
|
||||
const QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName);
|
||||
m_m->SetMCorrectionValue(nameField->data(Qt::UserRole).toString(),
|
||||
m_currentDimensionA, m_currentDimensionB, m_currentDimensionC, value);
|
||||
m_m->SetMCorrectionValue(nameField->data(Qt::UserRole).toString(), m_currentDimensionA, m_currentDimensionB,
|
||||
m_currentDimensionC, value);
|
||||
|
||||
MeasurementsWereSaved(false);
|
||||
|
||||
|
@ -2249,7 +2252,6 @@ void TMainWindow::SaveMDescription()
|
|||
ui->plainTextEditDescription->setTextCursor(cursor);
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void TMainWindow::SaveMFullName()
|
||||
{
|
||||
|
@ -2378,10 +2380,11 @@ void TMainWindow::ExportToIndividual()
|
|||
|
||||
QString filters = tr("Individual measurements") + QStringLiteral(" (*.vit)");
|
||||
QString fName = tr("measurements.vit");
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Export to individual"), dir + QChar('/') + fName,
|
||||
filters, nullptr, VAbstractApplication::VApp()->NativeFileDialog());
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Export to individual"), dir + QChar('/') + fName, filters,
|
||||
nullptr, VAbstractApplication::VApp()->NativeFileDialog());
|
||||
|
||||
auto RemoveTempDir = qScopeGuard([usedNotExistedDir, dir]()
|
||||
auto RemoveTempDir = qScopeGuard(
|
||||
[usedNotExistedDir, dir]()
|
||||
{
|
||||
if (usedNotExistedDir)
|
||||
{
|
||||
|
@ -2572,7 +2575,8 @@ void TMainWindow::SetupMenu()
|
|||
|
||||
connect(ui->actionExportToCSV, &QAction::triggered, this, &TMainWindow::ExportDataToCSV);
|
||||
connect(ui->actionImportFromCSV, &QAction::triggered, this, &TMainWindow::ImportDataFromCSV);
|
||||
connect(ui->actionReadOnly, &QAction::triggered, this, [this](bool ro)
|
||||
connect(ui->actionReadOnly, &QAction::triggered, this,
|
||||
[this](bool ro)
|
||||
{
|
||||
if (not m_mIsReadOnly)
|
||||
{
|
||||
|
@ -2595,7 +2599,8 @@ void TMainWindow::SetupMenu()
|
|||
{
|
||||
auto *action = new QAction(this);
|
||||
recentFileAct = action;
|
||||
connect(action, &QAction::triggered, this, [this]()
|
||||
connect(action, &QAction::triggered, this,
|
||||
[this]()
|
||||
{
|
||||
if (auto *senderAction = qobject_cast<QAction *>(sender()))
|
||||
{
|
||||
|
@ -2630,11 +2635,9 @@ void TMainWindow::SetupMenu()
|
|||
AboutToShowWindowMenu();
|
||||
|
||||
// Help
|
||||
connect(ui->actionAboutQt, &QAction::triggered, this, [this]()
|
||||
{
|
||||
QMessageBox::aboutQt(this, tr("About Qt"));
|
||||
});
|
||||
connect(ui->actionAboutTape, &QAction::triggered, this, [this]()
|
||||
connect(ui->actionAboutQt, &QAction::triggered, this, [this]() { QMessageBox::aboutQt(this, tr("About Qt")); });
|
||||
connect(ui->actionAboutTape, &QAction::triggered, this,
|
||||
[this]()
|
||||
{
|
||||
auto *aboutDialog = new DialogAboutTape(this);
|
||||
aboutDialog->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
|
@ -2643,7 +2646,6 @@ void TMainWindow::SetupMenu()
|
|||
|
||||
// Actions for recent files loaded by a tape window application.
|
||||
UpdateRecentFileActions();
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -2692,17 +2694,17 @@ void TMainWindow::InitWindow()
|
|||
|
||||
InitDimesionShifts();
|
||||
|
||||
connect(ui->doubleSpinBoxBaseValue, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, &TMainWindow::SaveMBaseValue);
|
||||
connect(ui->doubleSpinBoxCorrection, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, &TMainWindow::SaveMCorrectionValue);
|
||||
connect(ui->doubleSpinBoxBaseValue, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
&TMainWindow::SaveMBaseValue);
|
||||
connect(ui->doubleSpinBoxCorrection, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
&TMainWindow::SaveMCorrectionValue);
|
||||
|
||||
connect(ui->doubleSpinBoxShiftA, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, &TMainWindow::SaveMShiftA);
|
||||
connect(ui->doubleSpinBoxShiftB, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, &TMainWindow::SaveMShiftB);
|
||||
connect(ui->doubleSpinBoxShiftC, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, &TMainWindow::SaveMShiftC);
|
||||
connect(ui->doubleSpinBoxShiftA, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
&TMainWindow::SaveMShiftA);
|
||||
connect(ui->doubleSpinBoxShiftB, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
&TMainWindow::SaveMShiftB);
|
||||
connect(ui->doubleSpinBoxShiftC, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
&TMainWindow::SaveMShiftC);
|
||||
|
||||
HackDimensionShifts();
|
||||
|
||||
|
@ -2782,9 +2784,8 @@ void TMainWindow::InitWindow()
|
|||
ui->actionImportFromPattern->setEnabled(true);
|
||||
ui->actionSaveAs->setEnabled(true);
|
||||
|
||||
ui->lineEditName->setValidator(new QRegularExpressionValidator(QRegularExpression(
|
||||
QStringLiteral("^$|")+NameRegExp()),
|
||||
this));
|
||||
ui->lineEditName->setValidator(
|
||||
new QRegularExpressionValidator(QRegularExpression(QStringLiteral("^$|") + NameRegExp()), this));
|
||||
|
||||
connect(ui->toolButtonRemove, &QToolButton::clicked, this, &TMainWindow::Remove);
|
||||
connect(ui->toolButtonTop, &QToolButton::clicked, this, &TMainWindow::MoveTop);
|
||||
|
@ -2796,10 +2797,7 @@ void TMainWindow::InitWindow()
|
|||
connect(ui->plainTextEditDescription, &QPlainTextEdit::textChanged, this, &TMainWindow::SaveMDescription);
|
||||
connect(ui->lineEditFullName, &QLineEdit::textEdited, this, &TMainWindow::SaveMFullName);
|
||||
|
||||
connect(ui->pushButtonShowInExplorer, &QPushButton::clicked, this, [this]()
|
||||
{
|
||||
ShowInGraphicalShell(m_curFile);
|
||||
});
|
||||
connect(ui->pushButtonShowInExplorer, &QPushButton::clicked, this, [this]() { ShowInGraphicalShell(m_curFile); });
|
||||
|
||||
InitPatternUnits();
|
||||
InitMeasurementUnits();
|
||||
|
@ -2887,8 +2885,8 @@ void TMainWindow::InitDimensionsBaseValue()
|
|||
|
||||
DimesionLabels labels = dimension->Labels();
|
||||
|
||||
if (VFuzzyContains(labels, dimension->BaseValue())
|
||||
&& not VFuzzyValue(labels, dimension->BaseValue()).isEmpty())
|
||||
if (VFuzzyContains(labels, dimension->BaseValue()) &&
|
||||
not VFuzzyValue(labels, dimension->BaseValue()).isEmpty())
|
||||
{
|
||||
base->setText(VFuzzyValue(labels, dimension->BaseValue()));
|
||||
}
|
||||
|
@ -3216,8 +3214,8 @@ auto TMainWindow::AddCell(const QString &text, int row, int column, int aligment
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto TMainWindow::AddSeparatorCell(const QString &text, int row, int column, int aligment,
|
||||
bool ok) -> QTableWidgetItem *
|
||||
auto TMainWindow::AddSeparatorCell(const QString &text, int row, int column, int aligment, bool ok)
|
||||
-> QTableWidgetItem *
|
||||
{
|
||||
QTableWidgetItem *item = AddCell(text, row, column, aligment, ok);
|
||||
|
||||
|
@ -3263,8 +3261,8 @@ void TMainWindow::RefreshTable(bool freshCall)
|
|||
}
|
||||
else if (meash->GetType() == VarType::MeasurementSeparator)
|
||||
{
|
||||
QTableWidgetItem *item = AddSeparatorCell(
|
||||
VAbstractApplication::VApp()->TrVars()->MToUser(meash->GetName()), currentRow, ColumnName,
|
||||
QTableWidgetItem *item = AddSeparatorCell(VAbstractApplication::VApp()->TrVars()->MToUser(meash->GetName()),
|
||||
currentRow, ColumnName,
|
||||
Qt::AlignVCenter); // name
|
||||
item->setData(Qt::UserRole, meash->GetName());
|
||||
AddCell(meash->GetDescription(), currentRow, ColumnFullName, Qt::AlignVCenter); // description
|
||||
|
@ -3296,8 +3294,8 @@ void TMainWindow::RefreshMeasurementData(const QSharedPointer<VMeasurement> &mea
|
|||
{
|
||||
if (m_mType == MeasurementsType::Individual)
|
||||
{
|
||||
QTableWidgetItem *item = AddCell(VAbstractApplication::VApp()->TrVars()->MToUser(meash->GetName()),
|
||||
currentRow, ColumnName, Qt::AlignVCenter); // name
|
||||
QTableWidgetItem *item = AddCell(VAbstractApplication::VApp()->TrVars()->MToUser(meash->GetName()), currentRow,
|
||||
ColumnName, Qt::AlignVCenter); // name
|
||||
item->setData(Qt::UserRole, meash->GetName());
|
||||
|
||||
if (meash->IsCustom())
|
||||
|
@ -3306,8 +3304,8 @@ void TMainWindow::RefreshMeasurementData(const QSharedPointer<VMeasurement> &mea
|
|||
}
|
||||
else
|
||||
{
|
||||
AddCell(VAbstractApplication::VApp()->TrVars()->GuiText(meash->GetName()), currentRow,
|
||||
ColumnFullName, Qt::AlignVCenter);
|
||||
AddCell(VAbstractApplication::VApp()->TrVars()->GuiText(meash->GetName()), currentRow, ColumnFullName,
|
||||
Qt::AlignVCenter);
|
||||
}
|
||||
|
||||
QString calculatedValue;
|
||||
|
@ -3323,16 +3321,15 @@ void TMainWindow::RefreshMeasurementData(const QSharedPointer<VMeasurement> &mea
|
|||
AddCell(calculatedValue, currentRow, ColumnCalcValue, Qt::AlignHCenter | Qt::AlignVCenter,
|
||||
meash->IsFormulaOk()); // calculated value
|
||||
|
||||
QString formula =
|
||||
VTranslateVars::TryFormulaToUser(meash->GetFormula(),
|
||||
QString formula = VTranslateVars::TryFormulaToUser(meash->GetFormula(),
|
||||
VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||
|
||||
AddCell(formula, currentRow, ColumnFormula, Qt::AlignVCenter); // formula
|
||||
}
|
||||
else
|
||||
{
|
||||
QTableWidgetItem *item = AddCell(VAbstractApplication::VApp()->TrVars()->MToUser(meash->GetName()),
|
||||
currentRow, 0, Qt::AlignVCenter); // name
|
||||
QTableWidgetItem *item = AddCell(VAbstractApplication::VApp()->TrVars()->MToUser(meash->GetName()), currentRow,
|
||||
0, Qt::AlignVCenter); // name
|
||||
item->setData(Qt::UserRole, meash->GetName());
|
||||
|
||||
if (meash->IsCustom())
|
||||
|
@ -3341,8 +3338,8 @@ void TMainWindow::RefreshMeasurementData(const QSharedPointer<VMeasurement> &mea
|
|||
}
|
||||
else
|
||||
{
|
||||
AddCell(VAbstractApplication::VApp()->TrVars()->GuiText(meash->GetName()), currentRow,
|
||||
ColumnFullName, Qt::AlignVCenter);
|
||||
AddCell(VAbstractApplication::VApp()->TrVars()->GuiText(meash->GetName()), currentRow, ColumnFullName,
|
||||
Qt::AlignVCenter);
|
||||
}
|
||||
|
||||
QString calculatedValue;
|
||||
|
@ -3353,28 +3350,24 @@ void TMainWindow::RefreshMeasurementData(const QSharedPointer<VMeasurement> &mea
|
|||
}
|
||||
else
|
||||
{
|
||||
const qreal value = UnitConvertor(*m_data->DataVariables()->value(meash->GetName())->GetValue(),
|
||||
m_mUnit, m_pUnit);
|
||||
const qreal value =
|
||||
UnitConvertor(*m_data->DataVariables()->value(meash->GetName())->GetValue(), m_mUnit, m_pUnit);
|
||||
calculatedValue = locale().toString(value);
|
||||
}
|
||||
|
||||
AddCell(calculatedValue, currentRow, ColumnCalcValue,
|
||||
Qt::AlignHCenter | Qt::AlignVCenter, meash->IsFormulaOk()); // calculated value
|
||||
AddCell(calculatedValue, currentRow, ColumnCalcValue, Qt::AlignHCenter | Qt::AlignVCenter,
|
||||
meash->IsFormulaOk()); // calculated value
|
||||
|
||||
AddCell(locale().toString(meash->GetBase()), currentRow, ColumnBaseValue,
|
||||
Qt::AlignHCenter | Qt::AlignVCenter); // base value
|
||||
|
||||
AddCell(locale().toString(meash->GetShiftA()), currentRow, ColumnShiftA,
|
||||
Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
AddCell(locale().toString(meash->GetShiftA()), currentRow, ColumnShiftA, Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
|
||||
AddCell(locale().toString(meash->GetShiftB()), currentRow, ColumnShiftB,
|
||||
Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
AddCell(locale().toString(meash->GetShiftB()), currentRow, ColumnShiftB, Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
|
||||
AddCell(locale().toString(meash->GetShiftC()), currentRow, ColumnShiftC,
|
||||
Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
AddCell(locale().toString(meash->GetShiftC()), currentRow, ColumnShiftC, Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
|
||||
AddCell(locale()
|
||||
.toString(meash->GetCorrection(m_currentDimensionA, m_currentDimensionB, m_currentDimensionC)),
|
||||
AddCell(locale().toString(meash->GetCorrection(m_currentDimensionA, m_currentDimensionB, m_currentDimensionC)),
|
||||
currentRow, ColumnCorrection, Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
}
|
||||
}
|
||||
|
@ -3519,8 +3512,8 @@ void TMainWindow::UpdateWindowTitle()
|
|||
setWindowFilePath(m_curFile);
|
||||
|
||||
#if defined(Q_OS_MAC)
|
||||
static QIcon fileIcon = QIcon(QCoreApplication::applicationDirPath() +
|
||||
QLatin1String("/../Resources/measurements.icns"));
|
||||
static QIcon fileIcon =
|
||||
QIcon(QCoreApplication::applicationDirPath() + QLatin1String("/../Resources/measurements.icns"));
|
||||
QIcon icon;
|
||||
if (not m_curFile.isEmpty())
|
||||
{
|
||||
|
@ -3556,8 +3549,8 @@ auto TMainWindow::ClearCustomName(const QString &name) -> QString
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto TMainWindow::EvalFormula(const QString &formula, bool fromUser, VContainer *data, QLabel *label,
|
||||
bool specialUnits) -> bool
|
||||
auto TMainWindow::EvalFormula(const QString &formula, bool fromUser, VContainer *data, QLabel *label, bool specialUnits)
|
||||
-> bool
|
||||
{
|
||||
const QString postfix = specialUnits ? degreeSymbol : UnitsToStr(m_pUnit);
|
||||
|
||||
|
@ -3574,8 +3567,8 @@ auto TMainWindow::EvalFormula(const QString &formula, bool fromUser, VContainer
|
|||
QString f;
|
||||
if (fromUser)
|
||||
{
|
||||
f = VAbstractApplication::VApp()->TrVars()
|
||||
->FormulaFromUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||
f = VAbstractApplication::VApp()->TrVars()->FormulaFromUser(
|
||||
formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3746,8 +3739,8 @@ auto TMainWindow::LoadFromExistingFile(const QString &path) -> bool
|
|||
|
||||
// Check if file already opened
|
||||
const QList<TMainWindow *> list = MApplication::VApp()->MainWindows();
|
||||
auto w = std::find_if(list.begin(), list.end(),
|
||||
[path](TMainWindow *window) { return window->CurrentFile() == path; });
|
||||
auto w =
|
||||
std::find_if(list.begin(), list.end(), [path](TMainWindow *window) { return window->CurrentFile() == path; });
|
||||
if (w != list.end())
|
||||
{
|
||||
(*w)->activateWindow();
|
||||
|
@ -3821,8 +3814,8 @@ auto TMainWindow::LoadFromExistingFile(const QString &path) -> bool
|
|||
}
|
||||
catch (VException &e)
|
||||
{
|
||||
qCCritical(tMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("File error.")),
|
||||
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
|
||||
qCCritical(tMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("File error.")), qUtf8Printable(e.ErrorMessage()),
|
||||
qUtf8Printable(e.DetailedInformation()));
|
||||
ui->labelToolTip->setVisible(true);
|
||||
ui->tabWidget->setVisible(false);
|
||||
delete m_m;
|
||||
|
@ -3847,10 +3840,7 @@ void TMainWindow::CreateWindowMenu(QMenu *menu)
|
|||
SCASSERT(menu != nullptr)
|
||||
|
||||
QAction *action = menu->addAction(tr("&New Window"));
|
||||
connect(action, &QAction::triggered, this, []()
|
||||
{
|
||||
MApplication::VApp()->NewMainWindow()->activateWindow();
|
||||
});
|
||||
connect(action, &QAction::triggered, this, []() { MApplication::VApp()->NewMainWindow()->activateWindow(); });
|
||||
action->setMenuRole(QAction::NoRole);
|
||||
menu->addSeparator();
|
||||
|
||||
|
@ -4129,8 +4119,8 @@ void TMainWindow::ImportMultisizeMeasurements(const QxtCsvModel &csv, const QVec
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto TMainWindow::ImportMultisizeMeasurement(const QxtCsvModel &csv, int i, const QVector<int> &map,
|
||||
vsizetype dimensionsCount,
|
||||
QSet<QString> &importedNames) -> TMainWindow::MultisizeMeasurement
|
||||
vsizetype dimensionsCount, QSet<QString> &importedNames)
|
||||
-> TMainWindow::MultisizeMeasurement
|
||||
{
|
||||
const auto nameColumn = map.at(static_cast<int>(MultisizeMeasurementsColumns::Name));
|
||||
const QString name = csv.text(i, nameColumn).simplified();
|
||||
|
@ -4146,28 +4136,25 @@ auto TMainWindow::ImportMultisizeMeasurement(const QxtCsvModel &csv, int i, cons
|
|||
measurement.name = mName;
|
||||
|
||||
const auto baseValueColumn = map.at(static_cast<int>(MultisizeMeasurementsColumns::BaseValue));
|
||||
measurement.base = ConverToDouble(csv.text(i, baseValueColumn),
|
||||
tr("Cannot convert base value to double in column 2."));
|
||||
measurement.base =
|
||||
ConverToDouble(csv.text(i, baseValueColumn), tr("Cannot convert base value to double in column 2."));
|
||||
|
||||
const auto shiftAColumn = map.at(static_cast<int>(MultisizeMeasurementsColumns::ShiftA));
|
||||
measurement.shiftA = ConverToDouble(csv.text(i, shiftAColumn),
|
||||
tr("Cannot convert shift value to double in column %1.")
|
||||
.arg(shiftAColumn));
|
||||
tr("Cannot convert shift value to double in column %1.").arg(shiftAColumn));
|
||||
|
||||
if (dimensionsCount > 1)
|
||||
{
|
||||
const auto shiftBColumn = map.at(static_cast<int>(MultisizeMeasurementsColumns::ShiftB));
|
||||
measurement.shiftB = ConverToDouble(csv.text(i, shiftBColumn),
|
||||
tr("Cannot convert shift value to double in column %1.")
|
||||
.arg(shiftBColumn));
|
||||
tr("Cannot convert shift value to double in column %1.").arg(shiftBColumn));
|
||||
}
|
||||
|
||||
if (dimensionsCount > 2)
|
||||
{
|
||||
const auto shiftCColumn = map.at(static_cast<int>(MultisizeMeasurementsColumns::ShiftC));
|
||||
measurement.shiftC = ConverToDouble(csv.text(i, shiftCColumn),
|
||||
tr("Cannot convert shift value to double in column %1.")
|
||||
.arg(shiftCColumn));
|
||||
tr("Cannot convert shift value to double in column %1.").arg(shiftCColumn));
|
||||
}
|
||||
|
||||
const int columns = csv.columnCount();
|
||||
|
@ -4231,20 +4218,20 @@ void TMainWindow::ShowDimensionControls()
|
|||
|
||||
if (m_gradationDimensionA)
|
||||
{
|
||||
connect(m_gradationDimensionA, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &TMainWindow::DimensionABaseChanged);
|
||||
connect(m_gradationDimensionA, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
&TMainWindow::DimensionABaseChanged);
|
||||
}
|
||||
|
||||
if (m_gradationDimensionB)
|
||||
{
|
||||
connect(m_gradationDimensionB, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &TMainWindow::DimensionBBaseChanged);
|
||||
connect(m_gradationDimensionB, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
&TMainWindow::DimensionBBaseChanged);
|
||||
}
|
||||
|
||||
if (m_gradationDimensionC)
|
||||
{
|
||||
connect(m_gradationDimensionC, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &TMainWindow::DimensionCBaseChanged);
|
||||
connect(m_gradationDimensionC, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
&TMainWindow::DimensionCBaseChanged);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4427,7 +4414,8 @@ void TMainWindow::InitPatternUnits()
|
|||
InitComboBoxUnits();
|
||||
SetCurrentPatternUnit();
|
||||
|
||||
connect(m_comboBoxUnits, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this](int index)
|
||||
connect(m_comboBoxUnits, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
[this](int index)
|
||||
{
|
||||
m_pUnit = static_cast<Unit>(m_comboBoxUnits->itemData(index).toInt());
|
||||
|
||||
|
@ -4543,36 +4531,42 @@ void TMainWindow::InitSearch()
|
|||
UpdateSearchControlsTooltips();
|
||||
|
||||
connect(ui->lineEditFind, &QLineEdit::textChanged, this, [this](const QString &term) { m_search->Find(term); });
|
||||
connect(ui->lineEditFind, &QLineEdit::editingFinished, this, [this]()
|
||||
connect(ui->lineEditFind, &QLineEdit::editingFinished, this,
|
||||
[this]()
|
||||
{
|
||||
SaveSearchRequest();
|
||||
InitSearchHistory();
|
||||
m_search->Find(ui->lineEditFind->text());
|
||||
});
|
||||
connect(ui->toolButtonFindPrevious, &QToolButton::clicked, this, [this]()
|
||||
connect(ui->toolButtonFindPrevious, &QToolButton::clicked, this,
|
||||
[this]()
|
||||
{
|
||||
SaveSearchRequest();
|
||||
InitSearchHistory();
|
||||
m_search->FindPrevious();
|
||||
ui->labelResults->setText(QStringLiteral("%1/%2").arg(m_search->MatchIndex()+1).arg(m_search->MatchCount()));
|
||||
ui->labelResults->setText(
|
||||
QStringLiteral("%1/%2").arg(m_search->MatchIndex() + 1).arg(m_search->MatchCount()));
|
||||
});
|
||||
connect(ui->toolButtonFindNext, &QToolButton::clicked, this, [this]()
|
||||
connect(ui->toolButtonFindNext, &QToolButton::clicked, this,
|
||||
[this]()
|
||||
{
|
||||
SaveSearchRequest();
|
||||
InitSearchHistory();
|
||||
m_search->FindNext();
|
||||
ui->labelResults->setText(QStringLiteral("%1/%2").arg(m_search->MatchIndex()+1).arg(m_search->MatchCount()));
|
||||
ui->labelResults->setText(
|
||||
QStringLiteral("%1/%2").arg(m_search->MatchIndex() + 1).arg(m_search->MatchCount()));
|
||||
});
|
||||
|
||||
connect(m_search.data(), &VTableSearch::HasResult, this, [this] (bool state)
|
||||
connect(m_search.data(), &VTableSearch::HasResult, this,
|
||||
[this](bool state)
|
||||
{
|
||||
ui->toolButtonFindPrevious->setEnabled(state);
|
||||
ui->toolButtonFindNext->setEnabled(state);
|
||||
|
||||
if (state)
|
||||
{
|
||||
ui->labelResults->setText(QStringLiteral("%1/%2").arg(m_search->MatchIndex()+1)
|
||||
.arg(m_search->MatchCount()));
|
||||
ui->labelResults->setText(
|
||||
QStringLiteral("%1/%2").arg(m_search->MatchIndex() + 1).arg(m_search->MatchCount()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -4597,21 +4591,24 @@ void TMainWindow::InitSearch()
|
|||
}
|
||||
});
|
||||
|
||||
connect(ui->toolButtonCaseSensitive, &QToolButton::toggled, this, [this](bool checked)
|
||||
connect(ui->toolButtonCaseSensitive, &QToolButton::toggled, this,
|
||||
[this](bool checked)
|
||||
{
|
||||
m_search->SetMatchCase(checked);
|
||||
m_search->Find(ui->lineEditFind->text());
|
||||
ui->lineEditFind->setPlaceholderText(m_search->SearchPlaceholder());
|
||||
});
|
||||
|
||||
connect(ui->toolButtonWholeWord, &QToolButton::toggled, this, [this](bool checked)
|
||||
connect(ui->toolButtonWholeWord, &QToolButton::toggled, this,
|
||||
[this](bool checked)
|
||||
{
|
||||
m_search->SetMatchWord(checked);
|
||||
m_search->Find(ui->lineEditFind->text());
|
||||
ui->lineEditFind->setPlaceholderText(m_search->SearchPlaceholder());
|
||||
});
|
||||
|
||||
connect(ui->toolButtonRegexp, &QToolButton::toggled, this, [this](bool checked)
|
||||
connect(ui->toolButtonRegexp, &QToolButton::toggled, this,
|
||||
[this](bool checked)
|
||||
{
|
||||
m_search->SetMatchRegexp(checked);
|
||||
|
||||
|
@ -4636,7 +4633,8 @@ void TMainWindow::InitSearch()
|
|||
ui->lineEditFind->setPlaceholderText(m_search->SearchPlaceholder());
|
||||
});
|
||||
|
||||
connect(ui->toolButtonUseUnicodeProperties, &QToolButton::toggled, this, [this](bool checked)
|
||||
connect(ui->toolButtonUseUnicodeProperties, &QToolButton::toggled, this,
|
||||
[this](bool checked)
|
||||
{
|
||||
m_search->SetUseUnicodePreperties(checked);
|
||||
m_search->Find(ui->lineEditFind->text());
|
||||
|
@ -4656,7 +4654,8 @@ void TMainWindow::InitSearchHistory()
|
|||
{
|
||||
QAction *action = m_searchHistory->addAction(term);
|
||||
action->setData(term);
|
||||
connect(action, &QAction::triggered, this, [this]()
|
||||
connect(action, &QAction::triggered, this,
|
||||
[this]()
|
||||
{
|
||||
auto *action = qobject_cast<QAction *>(sender());
|
||||
if (action != nullptr)
|
||||
|
@ -4719,8 +4718,7 @@ void TMainWindow::RetranslateTableHeaders()
|
|||
if (not dimensions.isEmpty())
|
||||
{
|
||||
const MeasurementDimension_p &dimension = dimensions.at(0);
|
||||
ui->tableWidget->horizontalHeaderItem(ColumnShiftA)->setText(
|
||||
tr("%1 shift").arg(dimension->Name()));
|
||||
ui->tableWidget->horizontalHeaderItem(ColumnShiftA)->setText(tr("%1 shift").arg(dimension->Name()));
|
||||
}
|
||||
|
||||
if (dimensions.size() < 2)
|
||||
|
@ -4730,8 +4728,7 @@ void TMainWindow::RetranslateTableHeaders()
|
|||
else
|
||||
{
|
||||
const MeasurementDimension_p &dimension = dimensions.at(1);
|
||||
ui->tableWidget->horizontalHeaderItem(ColumnShiftB)->setText(
|
||||
tr("%1 shift").arg(dimension->Name()));
|
||||
ui->tableWidget->horizontalHeaderItem(ColumnShiftB)->setText(tr("%1 shift").arg(dimension->Name()));
|
||||
}
|
||||
|
||||
if (dimensions.size() < 3)
|
||||
|
@ -4741,15 +4738,13 @@ void TMainWindow::RetranslateTableHeaders()
|
|||
else
|
||||
{
|
||||
const MeasurementDimension_p &dimension = dimensions.at(2);
|
||||
ui->tableWidget->horizontalHeaderItem(ColumnShiftC)->setText(
|
||||
tr("%1 shift").arg(dimension->Name()));
|
||||
ui->tableWidget->horizontalHeaderItem(ColumnShiftC)->setText(tr("%1 shift").arg(dimension->Name()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template <class T>
|
||||
void TMainWindow::HackWidget(T **widget)
|
||||
template <class T> void TMainWindow::HackWidget(T **widget)
|
||||
{
|
||||
delete *widget;
|
||||
*widget = new T();
|
||||
|
|
|
@ -28,21 +28,34 @@
|
|||
|
||||
#include "vtapesettings.h"
|
||||
|
||||
#include <QVariant>
|
||||
#include <QDir>
|
||||
#include <QGlobalStatic>
|
||||
#include <QVariant>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
#include "diagnostic.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
|
||||
namespace
|
||||
{
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDataBaseGeometry, (QLatin1String("database/geometry"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchHistoryTape, (QLatin1String("searchHistory/tape"))) // NOLINT
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsTapeUseUnicodeProperties, // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsTapeUseUnicodeProperties,
|
||||
(QLatin1String("searchOptions/tapeUseUnicodeProperties")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsTapeWholeWord, // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsTapeWholeWord,
|
||||
(QLatin1String("searchOptions/tapeWholeWord")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsTapeRegexp, (QLatin1String("searchOptions/tapeRegexp"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsTapeMatchCase, // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsTapeRegexp, (QLatin1String("searchOptions/tapeRegexp")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsTapeMatchCase,
|
||||
(QLatin1String("searchOptions/tapeMatchCase")))
|
||||
QT_WARNING_POP
|
||||
} // namespace
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
class VTapeSettings : public VCommonSettings
|
||||
{
|
||||
Q_OBJECT // NOLINT
|
||||
|
||||
public:
|
||||
VTapeSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(),
|
||||
QObject *parent = nullptr);
|
||||
|
|
|
@ -27,75 +27,84 @@
|
|||
*************************************************************************/
|
||||
|
||||
#include "vtooloptionspropertybrowser.h"
|
||||
#include "../vtools/tools/backgroundimage/vbackgroundpixmapitem.h"
|
||||
#include "../vtools/tools/backgroundimage/vbackgroundsvgitem.h"
|
||||
#include "../vwidgets/vgraphicssimpletextitem.h"
|
||||
#include "../vwidgets/vcontrolpointspline.h"
|
||||
#include "../vwidgets/vsimplepoint.h"
|
||||
#include "../vwidgets/vsimplecurve.h"
|
||||
#include "../vmisc/def.h"
|
||||
#include "vformulaproperty.h"
|
||||
#include "../vpatterndb/vformula.h"
|
||||
#include "../qmuparser/qmudef.h"
|
||||
#include "../vgeometry/vcubicbezier.h"
|
||||
#include "../vgeometry/vcubicbezierpath.h"
|
||||
#include "../qmuparser/qmudef.h"
|
||||
#include "../vpropertyexplorer/plugins/vlabelproperty.h"
|
||||
#include "../vpropertyexplorer/plugins/vstringproperty.h"
|
||||
#include "../vpropertyexplorer/plugins/vtextproperty.h"
|
||||
#include "../vpropertyexplorer/plugins/vlinetypeproperty.h"
|
||||
#include "../vpropertyexplorer/plugins/vlinecolorproperty.h"
|
||||
#include "../vmisc/def.h"
|
||||
#include "../vpatterndb/vformula.h"
|
||||
#include "../vpropertyexplorer/plugins/vboolproperty.h"
|
||||
#include "../vpropertyexplorer/plugins/venumproperty.h"
|
||||
#include "../vpropertyexplorer/plugins/vlabelproperty.h"
|
||||
#include "../vpropertyexplorer/plugins/vlinecolorproperty.h"
|
||||
#include "../vpropertyexplorer/plugins/vlinetypeproperty.h"
|
||||
#include "../vpropertyexplorer/plugins/vnumberproperty.h"
|
||||
#include "../vpropertyexplorer/plugins/vpointfproperty.h"
|
||||
#include "../vpropertyexplorer/plugins/vstringproperty.h"
|
||||
#include "../vpropertyexplorer/plugins/vtextproperty.h"
|
||||
#include "../vtools/tools/backgroundimage/vbackgroundpixmapitem.h"
|
||||
#include "../vtools/tools/backgroundimage/vbackgroundsvgitem.h"
|
||||
#include "../vwidgets/vcontrolpointspline.h"
|
||||
#include "../vwidgets/vgraphicssimpletextitem.h"
|
||||
#include "../vwidgets/vsimplecurve.h"
|
||||
#include "../vwidgets/vsimplepoint.h"
|
||||
#include "vformulaproperty.h"
|
||||
|
||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.h"
|
||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.h"
|
||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.h"
|
||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.h"
|
||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.h"
|
||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.h"
|
||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.h"
|
||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.h"
|
||||
#include "../vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.h"
|
||||
#include "../vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.h"
|
||||
#include "../vtools/tools/drawTools/operation/vtoolmove.h"
|
||||
#include "../vtools/tools/drawTools/operation/vtoolrotation.h"
|
||||
#include "../vtools/tools/drawTools/toolcurve/vtoolarc.h"
|
||||
#include "../vtools/tools/drawTools/toolcurve/vtoolellipticalarc.h"
|
||||
#include "../vtools/tools/drawTools/toolcurve/vtoolarcwithlength.h"
|
||||
#include "../vtools/tools/drawTools/toolcurve/vtoolspline.h"
|
||||
#include "../vtools/tools/drawTools/toolcurve/vtoolcubicbezier.h"
|
||||
#include "../vtools/tools/drawTools/toolcurve/vtoolsplinepath.h"
|
||||
#include "../vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.h"
|
||||
#include "../vtools/tools/drawTools/vtoolline.h"
|
||||
#include "../vtools/tools/drawTools/toolcurve/vtoolellipticalarc.h"
|
||||
#include "../vtools/tools/drawTools/toolcurve/vtoolspline.h"
|
||||
#include "../vtools/tools/drawTools/toolcurve/vtoolsplinepath.h"
|
||||
#include "../vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.h"
|
||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.h"
|
||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.h"
|
||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.h"
|
||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.h"
|
||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.h"
|
||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.h"
|
||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.h"
|
||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.h"
|
||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.h"
|
||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.h"
|
||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.h"
|
||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.h"
|
||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.h"
|
||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.h"
|
||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.h"
|
||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.h"
|
||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.h"
|
||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.h"
|
||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.h"
|
||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.h"
|
||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.h"
|
||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.h"
|
||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.h"
|
||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.h"
|
||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.h"
|
||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.h"
|
||||
#include "../vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.h"
|
||||
#include "../vtools/tools/drawTools/operation/vtoolrotation.h"
|
||||
#include "../vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.h"
|
||||
#include "../vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.h"
|
||||
#include "../vtools/tools/drawTools/operation/vtoolmove.h"
|
||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.h"
|
||||
#include "../vtools/tools/drawTools/vtoolline.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
#include "../vmisc/diagnostic.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDockWidget>
|
||||
#include <QHBoxLayout>
|
||||
#include <QDebug>
|
||||
#include <QRegularExpression>
|
||||
#include <QScrollArea>
|
||||
|
||||
namespace
|
||||
{
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, AttrHold, (QLatin1String("hold"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, AttrVisible, (QLatin1String("visible"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, AttrOpacity, (QLatin1String("opacity"))) // NOLINT
|
||||
}
|
||||
|
||||
QT_WARNING_POP
|
||||
} // namespace
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VToolOptionsPropertyBrowser::VToolOptionsPropertyBrowser(QDockWidget *parent)
|
||||
|
@ -549,7 +558,6 @@ void VToolOptionsPropertyBrowser::itemClicked(QGraphicsItem *item)
|
|||
m_propertyToId.clear();
|
||||
m_idToProperty.clear();
|
||||
|
||||
|
||||
if (m_currentItem != nullptr)
|
||||
{
|
||||
auto *previousTool = dynamic_cast<VAbstractTool *>(m_currentItem);
|
||||
|
@ -596,12 +604,10 @@ void VToolOptionsPropertyBrowser::AddPropertyObjectName(Tool *i, const QString &
|
|||
itemName->setReadOnly(readOnly);
|
||||
AddProperty(itemName, AttrName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::AddPropertyAlias(Tool *i, const QString &propertyName)
|
||||
template <class Tool> void VToolOptionsPropertyBrowser::AddPropertyAlias(Tool *i, const QString &propertyName)
|
||||
{
|
||||
auto *itemName = new VPE::VStringProperty(propertyName);
|
||||
itemName->setClearButtonEnable(true);
|
||||
|
@ -610,8 +616,7 @@ void VToolOptionsPropertyBrowser::AddPropertyAlias(Tool *i, const QString &prope
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::AddPropertyAlias1(Tool *i, const QString &propertyName)
|
||||
template <class Tool> void VToolOptionsPropertyBrowser::AddPropertyAlias1(Tool *i, const QString &propertyName)
|
||||
{
|
||||
auto *itemName = new VPE::VStringProperty(propertyName);
|
||||
itemName->setClearButtonEnable(true);
|
||||
|
@ -620,8 +625,7 @@ void VToolOptionsPropertyBrowser::AddPropertyAlias1(Tool *i, const QString &prop
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::AddPropertyAlias2(Tool *i, const QString &propertyName)
|
||||
template <class Tool> void VToolOptionsPropertyBrowser::AddPropertyAlias2(Tool *i, const QString &propertyName)
|
||||
{
|
||||
auto *itemName = new VPE::VStringProperty(propertyName);
|
||||
itemName->setClearButtonEnable(true);
|
||||
|
@ -630,8 +634,7 @@ void VToolOptionsPropertyBrowser::AddPropertyAlias2(Tool *i, const QString &prop
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::AddPropertyPointName1(Tool *i, const QString &propertyName)
|
||||
template <class Tool> void VToolOptionsPropertyBrowser::AddPropertyPointName1(Tool *i, const QString &propertyName)
|
||||
{
|
||||
auto *itemName = new VPE::VStringProperty(propertyName);
|
||||
itemName->setClearButtonEnable(true);
|
||||
|
@ -640,8 +643,7 @@ void VToolOptionsPropertyBrowser::AddPropertyPointName1(Tool *i, const QString &
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::AddPropertyPointName2(Tool *i, const QString &propertyName)
|
||||
template <class Tool> void VToolOptionsPropertyBrowser::AddPropertyPointName2(Tool *i, const QString &propertyName)
|
||||
{
|
||||
auto *itemName = new VPE::VStringProperty(propertyName);
|
||||
itemName->setClearButtonEnable(true);
|
||||
|
@ -687,45 +689,41 @@ void VToolOptionsPropertyBrowser::AddPropertyBool(const QString &propertyName, b
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::AddPropertyCrossPoint(Tool *i, const QString &propertyName)
|
||||
template <class Tool> void VToolOptionsPropertyBrowser::AddPropertyCrossPoint(Tool *i, const QString &propertyName)
|
||||
{
|
||||
auto *itemProperty = new VPE::VEnumProperty(propertyName);
|
||||
itemProperty->setLiterals(QStringList({VToolOptionsPropertyBrowser::tr("First point"),
|
||||
VToolOptionsPropertyBrowser::tr("Second point")}));
|
||||
itemProperty->setLiterals(
|
||||
QStringList({VToolOptionsPropertyBrowser::tr("First point"), VToolOptionsPropertyBrowser::tr("Second point")}));
|
||||
itemProperty->setValue(static_cast<int>(i->GetCrossCirclesPoint()) - 1);
|
||||
AddProperty(itemProperty, AttrCrossPoint);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::AddPropertyVCrossPoint(Tool *i, const QString &propertyName)
|
||||
template <class Tool> void VToolOptionsPropertyBrowser::AddPropertyVCrossPoint(Tool *i, const QString &propertyName)
|
||||
{
|
||||
auto *itemProperty = new VPE::VEnumProperty(propertyName);
|
||||
itemProperty->setLiterals(QStringList({VToolOptionsPropertyBrowser::tr("Highest point"),
|
||||
VToolOptionsPropertyBrowser::tr("Lowest point")}));
|
||||
itemProperty->setLiterals(QStringList(
|
||||
{VToolOptionsPropertyBrowser::tr("Highest point"), VToolOptionsPropertyBrowser::tr("Lowest point")}));
|
||||
itemProperty->setValue(static_cast<int>(i->GetVCrossPoint()) - 1);
|
||||
AddProperty(itemProperty, AttrVCrossPoint);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::AddPropertyHCrossPoint(Tool *i, const QString &propertyName)
|
||||
template <class Tool> void VToolOptionsPropertyBrowser::AddPropertyHCrossPoint(Tool *i, const QString &propertyName)
|
||||
{
|
||||
auto *itemProperty = new VPE::VEnumProperty(propertyName);
|
||||
itemProperty->setLiterals(QStringList({VToolOptionsPropertyBrowser::tr("Leftmost point"),
|
||||
VToolOptionsPropertyBrowser::tr("Rightmost point")}));
|
||||
itemProperty->setLiterals(QStringList(
|
||||
{VToolOptionsPropertyBrowser::tr("Leftmost point"), VToolOptionsPropertyBrowser::tr("Rightmost point")}));
|
||||
itemProperty->setValue(static_cast<int>(i->GetHCrossPoint()) - 1);
|
||||
AddProperty(itemProperty, AttrHCrossPoint);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::AddPropertyAxisType(Tool *i, const QString &propertyName)
|
||||
template <class Tool> void VToolOptionsPropertyBrowser::AddPropertyAxisType(Tool *i, const QString &propertyName)
|
||||
{
|
||||
auto *itemProperty = new VPE::VEnumProperty(propertyName);
|
||||
itemProperty->setLiterals(QStringList({VToolOptionsPropertyBrowser::tr("Vertical axis"),
|
||||
VToolOptionsPropertyBrowser::tr("Horizontal axis")}));
|
||||
itemProperty->setLiterals(QStringList(
|
||||
{VToolOptionsPropertyBrowser::tr("Vertical axis"), VToolOptionsPropertyBrowser::tr("Horizontal axis")}));
|
||||
itemProperty->setValue(static_cast<int>(i->GetAxisType()) - 1);
|
||||
AddProperty(itemProperty, AttrAxisType);
|
||||
}
|
||||
|
@ -795,13 +793,10 @@ void VToolOptionsPropertyBrowser::AddPropertyApproximationScale(const QString &p
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolOptionsPropertyBrowser::AddPropertyOpacity(const QString &propertyName, int opacity)
|
||||
{
|
||||
QMap<QString, QVariant> settings
|
||||
{
|
||||
{QStringLiteral("Min"), 0},
|
||||
QMap<QString, QVariant> settings{{QStringLiteral("Min"), 0},
|
||||
{QStringLiteral("Max"), 100},
|
||||
{QStringLiteral("Step"), 1},
|
||||
{QStringLiteral("Suffix"), QChar('%')}
|
||||
};
|
||||
{QStringLiteral("Suffix"), QChar('%')}};
|
||||
|
||||
auto *opacityProperty = new VPE::VIntegerProperty(propertyName, settings);
|
||||
opacityProperty->setValue(opacity);
|
||||
|
@ -809,8 +804,7 @@ void VToolOptionsPropertyBrowser::AddPropertyOpacity(const QString &propertyName
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::SetName(VPE::VProperty *property)
|
||||
template <class Tool> void VToolOptionsPropertyBrowser::SetName(VPE::VProperty *property)
|
||||
{
|
||||
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
|
||||
{
|
||||
|
@ -829,8 +823,7 @@ void VToolOptionsPropertyBrowser::SetName(VPE::VProperty *property)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::SetHold(VPE::VProperty *property)
|
||||
template <class Tool> void VToolOptionsPropertyBrowser::SetHold(VPE::VProperty *property)
|
||||
{
|
||||
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
|
||||
{
|
||||
|
@ -849,8 +842,7 @@ void VToolOptionsPropertyBrowser::SetHold(VPE::VProperty *property)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::SetVisible(VPE::VProperty *property)
|
||||
template <class Tool> void VToolOptionsPropertyBrowser::SetVisible(VPE::VProperty *property)
|
||||
{
|
||||
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
|
||||
{
|
||||
|
@ -869,8 +861,7 @@ void VToolOptionsPropertyBrowser::SetVisible(VPE::VProperty *property)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::SetOpacity(VPE::VProperty *property)
|
||||
template <class Tool> void VToolOptionsPropertyBrowser::SetOpacity(VPE::VProperty *property)
|
||||
{
|
||||
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
|
||||
{
|
||||
|
@ -889,8 +880,7 @@ void VToolOptionsPropertyBrowser::SetOpacity(VPE::VProperty *property)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::SetPointName(VPE::VProperty *property)
|
||||
template <class Tool> void VToolOptionsPropertyBrowser::SetPointName(VPE::VProperty *property)
|
||||
{
|
||||
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
|
||||
{
|
||||
|
@ -917,8 +907,7 @@ void VToolOptionsPropertyBrowser::SetPointName(VPE::VProperty *property)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::SetPointName1(VPE::VProperty *property)
|
||||
template <class Tool> void VToolOptionsPropertyBrowser::SetPointName1(VPE::VProperty *property)
|
||||
{
|
||||
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
|
||||
{
|
||||
|
@ -945,8 +934,7 @@ void VToolOptionsPropertyBrowser::SetPointName1(VPE::VProperty *property)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::SetPointName2(VPE::VProperty *property)
|
||||
template <class Tool> void VToolOptionsPropertyBrowser::SetPointName2(VPE::VProperty *property)
|
||||
{
|
||||
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
|
||||
{
|
||||
|
@ -973,8 +961,7 @@ void VToolOptionsPropertyBrowser::SetPointName2(VPE::VProperty *property)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::SetOperationSuffix(VPE::VProperty *property)
|
||||
template <class Tool> void VToolOptionsPropertyBrowser::SetOperationSuffix(VPE::VProperty *property)
|
||||
{
|
||||
if (auto *item = qgraphicsitem_cast<Tool *>(m_currentItem))
|
||||
{
|
||||
|
@ -1012,8 +999,7 @@ void VToolOptionsPropertyBrowser::SetOperationSuffix(VPE::VProperty *property)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Type>
|
||||
auto VToolOptionsPropertyBrowser::GetCrossPoint(const QVariant &value) -> Type
|
||||
template <class Type> auto VToolOptionsPropertyBrowser::GetCrossPoint(const QVariant &value) -> Type
|
||||
{
|
||||
bool ok = false;
|
||||
const int val = value.toInt(&ok);
|
||||
|
@ -1036,8 +1022,7 @@ auto VToolOptionsPropertyBrowser::GetCrossPoint(const QVariant &value) -> Type
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::SetCrossCirclesPoint(VPE::VProperty *property)
|
||||
template <class Tool> void VToolOptionsPropertyBrowser::SetCrossCirclesPoint(VPE::VProperty *property)
|
||||
{
|
||||
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
|
||||
{
|
||||
|
@ -1051,8 +1036,7 @@ void VToolOptionsPropertyBrowser::SetCrossCirclesPoint(VPE::VProperty *property)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::SetVCrossCurvesPoint(VPE::VProperty *property)
|
||||
template <class Tool> void VToolOptionsPropertyBrowser::SetVCrossCurvesPoint(VPE::VProperty *property)
|
||||
{
|
||||
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
|
||||
{
|
||||
|
@ -1072,8 +1056,7 @@ void VToolOptionsPropertyBrowser::SetVCrossCurvesPoint(VPE::VProperty *property)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::SetHCrossCurvesPoint(VPE::VProperty *property)
|
||||
template <class Tool> void VToolOptionsPropertyBrowser::SetHCrossCurvesPoint(VPE::VProperty *property)
|
||||
{
|
||||
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
|
||||
{
|
||||
|
@ -1093,8 +1076,7 @@ void VToolOptionsPropertyBrowser::SetHCrossCurvesPoint(VPE::VProperty *property)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::SetAxisType(VPE::VProperty *property)
|
||||
template <class Tool> void VToolOptionsPropertyBrowser::SetAxisType(VPE::VProperty *property)
|
||||
{
|
||||
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
|
||||
{
|
||||
|
@ -1114,8 +1096,7 @@ void VToolOptionsPropertyBrowser::SetAxisType(VPE::VProperty *property)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::SetNotes(VPE::VProperty *property)
|
||||
template <class Tool> void VToolOptionsPropertyBrowser::SetNotes(VPE::VProperty *property)
|
||||
{
|
||||
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
|
||||
{
|
||||
|
@ -1134,8 +1115,7 @@ void VToolOptionsPropertyBrowser::SetNotes(VPE::VProperty *property)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::SetAlias(VPE::VProperty *property)
|
||||
template <class Tool> void VToolOptionsPropertyBrowser::SetAlias(VPE::VProperty *property)
|
||||
{
|
||||
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
|
||||
{
|
||||
|
@ -1154,8 +1134,7 @@ void VToolOptionsPropertyBrowser::SetAlias(VPE::VProperty *property)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::SetAlias1(VPE::VProperty *property)
|
||||
template <class Tool> void VToolOptionsPropertyBrowser::SetAlias1(VPE::VProperty *property)
|
||||
{
|
||||
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
|
||||
{
|
||||
|
@ -1174,8 +1153,7 @@ void VToolOptionsPropertyBrowser::SetAlias1(VPE::VProperty *property)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::SetAlias2(VPE::VProperty *property)
|
||||
template <class Tool> void VToolOptionsPropertyBrowser::SetAlias2(VPE::VProperty *property)
|
||||
{
|
||||
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
|
||||
{
|
||||
|
@ -1194,8 +1172,7 @@ void VToolOptionsPropertyBrowser::SetAlias2(VPE::VProperty *property)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::SetLineType(VPE::VProperty *property)
|
||||
template <class Tool> void VToolOptionsPropertyBrowser::SetLineType(VPE::VProperty *property)
|
||||
{
|
||||
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
|
||||
{
|
||||
|
@ -1214,8 +1191,7 @@ void VToolOptionsPropertyBrowser::SetLineType(VPE::VProperty *property)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::SetLineColor(VPE::VProperty *property)
|
||||
template <class Tool> void VToolOptionsPropertyBrowser::SetLineColor(VPE::VProperty *property)
|
||||
{
|
||||
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
|
||||
{
|
||||
|
@ -1234,8 +1210,7 @@ void VToolOptionsPropertyBrowser::SetLineColor(VPE::VProperty *property)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::SetFormulaLength(VPE::VProperty *property)
|
||||
template <class Tool> void VToolOptionsPropertyBrowser::SetFormulaLength(VPE::VProperty *property)
|
||||
{
|
||||
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
|
||||
{
|
||||
|
@ -1254,8 +1229,7 @@ void VToolOptionsPropertyBrowser::SetFormulaLength(VPE::VProperty *property)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::SetFormulaAngle(VPE::VProperty *property)
|
||||
template <class Tool> void VToolOptionsPropertyBrowser::SetFormulaAngle(VPE::VProperty *property)
|
||||
{
|
||||
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
|
||||
{
|
||||
|
@ -1274,8 +1248,7 @@ void VToolOptionsPropertyBrowser::SetFormulaAngle(VPE::VProperty *property)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::SetFormulaRadius(VPE::VProperty *property)
|
||||
template <class Tool> void VToolOptionsPropertyBrowser::SetFormulaRadius(VPE::VProperty *property)
|
||||
{
|
||||
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
|
||||
{
|
||||
|
@ -1294,8 +1267,7 @@ void VToolOptionsPropertyBrowser::SetFormulaRadius(VPE::VProperty *property)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::SetFormulaF1(VPE::VProperty *property)
|
||||
template <class Tool> void VToolOptionsPropertyBrowser::SetFormulaF1(VPE::VProperty *property)
|
||||
{
|
||||
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
|
||||
{
|
||||
|
@ -1314,8 +1286,7 @@ void VToolOptionsPropertyBrowser::SetFormulaF1(VPE::VProperty *property)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::SetFormulaF2(VPE::VProperty *property)
|
||||
template <class Tool> void VToolOptionsPropertyBrowser::SetFormulaF2(VPE::VProperty *property)
|
||||
{
|
||||
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
|
||||
{
|
||||
|
@ -1334,8 +1305,7 @@ void VToolOptionsPropertyBrowser::SetFormulaF2(VPE::VProperty *property)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::SetPenStyle(VPE::VProperty *property)
|
||||
template <class Tool> void VToolOptionsPropertyBrowser::SetPenStyle(VPE::VProperty *property)
|
||||
{
|
||||
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
|
||||
{
|
||||
|
@ -1354,8 +1324,7 @@ void VToolOptionsPropertyBrowser::SetPenStyle(VPE::VProperty *property)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::SetFormulaRotationAngle(VPE::VProperty *property)
|
||||
template <class Tool> void VToolOptionsPropertyBrowser::SetFormulaRotationAngle(VPE::VProperty *property)
|
||||
{
|
||||
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
|
||||
{
|
||||
|
@ -1374,8 +1343,7 @@ void VToolOptionsPropertyBrowser::SetFormulaRotationAngle(VPE::VProperty *proper
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::SetApproximationScale(VPE::VProperty *property)
|
||||
template <class Tool> void VToolOptionsPropertyBrowser::SetApproximationScale(VPE::VProperty *property)
|
||||
{
|
||||
if (auto *i = qgraphicsitem_cast<Tool *>(m_currentItem))
|
||||
{
|
||||
|
@ -3972,8 +3940,8 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSpline()
|
|||
m_idToProperty[AttrPenStyle]->setValue(index);
|
||||
}
|
||||
|
||||
m_idToProperty[AttrColor]->setValue(VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(),
|
||||
i->GetLineColor()));
|
||||
m_idToProperty[AttrColor]->setValue(
|
||||
VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor()));
|
||||
|
||||
QVariant valueApproximationScale;
|
||||
valueApproximationScale.setValue(spl.GetApproximationScale());
|
||||
|
@ -3996,8 +3964,8 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCubicBezier()
|
|||
m_idToProperty[AttrPenStyle]->setValue(index);
|
||||
}
|
||||
|
||||
m_idToProperty[AttrColor]->setValue(VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(),
|
||||
i->GetLineColor()));
|
||||
m_idToProperty[AttrColor]->setValue(
|
||||
VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor()));
|
||||
|
||||
QVariant valueFirstPoint;
|
||||
valueFirstPoint.setValue(i->FirstPointName());
|
||||
|
@ -4036,8 +4004,8 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSplinePath()
|
|||
m_idToProperty[AttrPenStyle]->setValue(index);
|
||||
}
|
||||
|
||||
m_idToProperty[AttrColor]->setValue(VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(),
|
||||
i->GetLineColor()));
|
||||
m_idToProperty[AttrColor]->setValue(
|
||||
VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor()));
|
||||
|
||||
QVariant valueApproximationScale;
|
||||
valueApproximationScale.setValue(i->getSplinePath().GetApproximationScale());
|
||||
|
@ -4060,8 +4028,8 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCubicBezierPath()
|
|||
m_idToProperty[AttrPenStyle]->setValue(index);
|
||||
}
|
||||
|
||||
m_idToProperty[AttrColor]->setValue(VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(),
|
||||
i->GetLineColor()));
|
||||
m_idToProperty[AttrColor]->setValue(
|
||||
VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor()));
|
||||
|
||||
QVariant valueApproximationScale;
|
||||
valueApproximationScale.setValue(i->getSplinePath().GetApproximationScale());
|
||||
|
@ -4331,7 +4299,8 @@ auto VToolOptionsPropertyBrowser::PropertiesList() -> QStringList
|
|||
AttrPShoulder, /* 22 */
|
||||
AttrAxisP1, /* 23 */
|
||||
AttrAxisP2, /* 24 */
|
||||
AttrKCurve, /*Not used*/ /* 25 */
|
||||
AttrKCurve,
|
||||
/*Not used*/ /* 25 */
|
||||
AttrLineColor, /* 26 */
|
||||
AttrColor, /* 27 */
|
||||
AttrCrossPoint, /* 28 */
|
||||
|
|
|
@ -29,17 +29,28 @@
|
|||
#include "preferencespatternpage.h"
|
||||
#include "../dialogdatetimeformats.h"
|
||||
#include "../dialogknownmaterials.h"
|
||||
#include "../vmisc/svgfont/vsvgfontdatabase.h"
|
||||
#include "../vmisc/vabstractvalapplication.h"
|
||||
#include "../vmisc/vvalentinasettings.h"
|
||||
#include "qnamespace.h"
|
||||
#include "qnumeric.h"
|
||||
#include "svgfont/svgdef.h"
|
||||
#include "svgfont/vsvgfont.h"
|
||||
#include "svgfont/vsvgfontengine.h"
|
||||
#include "ui_preferencespatternpage.h"
|
||||
#include "vabstractapplication.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 "../ifc/xml/vabstractpattern.h"
|
||||
#include "../vformat/vsinglelineoutlinechar.h"
|
||||
#include "../vwidgets/vmaingraphicsview.h"
|
||||
|
||||
#include <QCompleter>
|
||||
#include <QDate>
|
||||
#include <QMessageBox>
|
||||
#include <QScreen>
|
||||
#include <QStyledItemDelegate>
|
||||
#include <QTime>
|
||||
|
||||
namespace
|
||||
|
|
|
@ -27,39 +27,43 @@
|
|||
*************************************************************************/
|
||||
|
||||
#include "dialogincrements.h"
|
||||
#include "ui_dialogincrements.h"
|
||||
#include "../vmisc/vvalentinasettings.h"
|
||||
#include "ui_dialogincrements.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 "../qmuparser/qmudef.h"
|
||||
#include "../qmuparser/qmutokenparser.h"
|
||||
#include "../vpatterndb/vtranslatevars.h"
|
||||
#include "../vpatterndb/calculator.h"
|
||||
#include "../vpatterndb/variables/vincrement.h"
|
||||
#include "../vpatterndb/variables/vlinelength.h"
|
||||
#include "../vpatterndb/variables/vlineangle.h"
|
||||
#include "../vpatterndb/variables/vcurveangle.h"
|
||||
#include "../vpatterndb/variables/vcurvelength.h"
|
||||
#include "../vpatterndb/variables/vcurveclength.h"
|
||||
#include "../vpatterndb/variables/varcradius.h"
|
||||
#include "../vpatterndb/variables/vcurveangle.h"
|
||||
#include "../vpatterndb/variables/vcurveclength.h"
|
||||
#include "../vpatterndb/variables/vcurvelength.h"
|
||||
#include "../vpatterndb/variables/vincrement.h"
|
||||
#include "../vpatterndb/variables/vlineangle.h"
|
||||
#include "../vpatterndb/variables/vlinelength.h"
|
||||
#include "../vpatterndb/vtranslatevars.h"
|
||||
#include "../vtools/dialogs/support/dialogeditwrongformula.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QDir>
|
||||
#include <QMessageBox>
|
||||
#include <QCloseEvent>
|
||||
#include <QTableWidget>
|
||||
#include <QDir>
|
||||
#include <QFileDialog>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <QSettings>
|
||||
#include <QTableWidget>
|
||||
#include <QTableWidgetItem>
|
||||
#include <QtNumeric>
|
||||
#include <QMenu>
|
||||
|
||||
constexpr int DIALOG_MAX_FORMULA_HEIGHT = 64;
|
||||
|
||||
namespace
|
||||
{
|
||||
enum class IncrUnits : qint8 {Pattern, Degrees};
|
||||
enum class IncrUnits : qint8
|
||||
{
|
||||
Pattern,
|
||||
Degrees
|
||||
};
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -135,8 +139,7 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
|
|||
|
||||
connect(ui->tableWidgetIncrement, &QTableWidget::itemSelectionChanged, this,
|
||||
&DialogIncrements::ShowIncrementDetails);
|
||||
connect(ui->tableWidgetPC, &QTableWidget::itemSelectionChanged, this,
|
||||
&DialogIncrements::ShowIncrementDetails);
|
||||
connect(ui->tableWidgetPC, &QTableWidget::itemSelectionChanged, this, &DialogIncrements::ShowIncrementDetails);
|
||||
|
||||
ui->toolButtonAdd->setMenu(InitVarTypeMenu(ui->toolButtonAdd->menu(), true /*increments tab*/));
|
||||
ui->toolButtonAddPC->setMenu(InitVarTypeMenu(ui->toolButtonAddPC->menu(), false /*preview calculations tab*/));
|
||||
|
@ -191,8 +194,7 @@ void DialogIncrements::FillPreviewCalculations()
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template <typename T>
|
||||
void DialogIncrements::FillTable(const QMap<QString, T> &varTable, QTableWidget *table)
|
||||
template <typename T> void DialogIncrements::FillTable(const QMap<QString, T> &varTable, QTableWidget *table)
|
||||
{
|
||||
SCASSERT(table != nullptr)
|
||||
|
||||
|
@ -292,8 +294,8 @@ void DialogIncrements::ShowHeaderUnits(QTableWidget *table, int column, const QS
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto DialogIncrements::AddCell(QTableWidget *table, const QString &text, int row, int column, int aligment,
|
||||
bool ok) -> QTableWidgetItem *
|
||||
auto DialogIncrements::AddCell(QTableWidget *table, const QString &text, int row, int column, int aligment, bool ok)
|
||||
-> QTableWidgetItem *
|
||||
{
|
||||
SCASSERT(table != nullptr)
|
||||
|
||||
|
@ -368,7 +370,8 @@ auto DialogIncrements::EvalIncrementFormula(const QString &formula, bool fromUse
|
|||
}
|
||||
else
|
||||
{
|
||||
postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits());//Show unit in dialog lable (cm, mm or inch)
|
||||
postfix =
|
||||
UnitsToStr(VAbstractValApplication::VApp()->patternUnits()); // Show unit in dialog lable (cm, mm or inch)
|
||||
}
|
||||
if (formula.isEmpty())
|
||||
{
|
||||
|
@ -383,8 +386,8 @@ auto DialogIncrements::EvalIncrementFormula(const QString &formula, bool fromUse
|
|||
// Replace line return character with spaces for calc if exist
|
||||
if (fromUser)
|
||||
{
|
||||
f = VAbstractApplication::VApp()->TrVars()
|
||||
->FormulaFromUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||
f = VAbstractApplication::VApp()->TrVars()->FormulaFromUser(
|
||||
formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -762,8 +765,7 @@ void DialogIncrements::ShowTableIncrementDetails(QTableWidget *table)
|
|||
EvalIncrementFormula(incr->GetFormula(), false, incr->GetData(), labelCalculatedValue, incr->IsSpecialUnits());
|
||||
plainTextEditFormula->blockSignals(true);
|
||||
|
||||
QString formula =
|
||||
VTranslateVars::TryFormulaToUser(incr->GetFormula(),
|
||||
QString formula = VTranslateVars::TryFormulaToUser(incr->GetFormula(),
|
||||
VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||
|
||||
plainTextEditFormula->setPlainText(formula);
|
||||
|
@ -832,8 +834,8 @@ void DialogIncrements::AddNewIncrement(IncrementType type)
|
|||
currentRow = table->currentRow() + 1;
|
||||
const QTableWidgetItem *nameField = table->item(table->currentRow(), 0);
|
||||
|
||||
incrementMode ? m_doc->AddEmptyIncrementAfter(nameField->text(), name, type) :
|
||||
m_doc->AddEmptyPreviewCalculationAfter(nameField->text(), name, type);
|
||||
incrementMode ? m_doc->AddEmptyIncrementAfter(nameField->text(), name, type)
|
||||
: m_doc->AddEmptyPreviewCalculationAfter(nameField->text(), name, type);
|
||||
}
|
||||
|
||||
m_hasChanges = true;
|
||||
|
@ -864,28 +866,33 @@ void DialogIncrements::InitSearch()
|
|||
UpdateSearchControlsTooltips();
|
||||
|
||||
connect(ui->lineEditFind, &QLineEdit::textEdited, this, [this](const QString &term) { m_search->Find(term); });
|
||||
connect(ui->lineEditFind, &QLineEdit::editingFinished, this, [this]()
|
||||
connect(ui->lineEditFind, &QLineEdit::editingFinished, this,
|
||||
[this]()
|
||||
{
|
||||
SaveIncrementsSearchRequest();
|
||||
InitIncrementsSearchHistory();
|
||||
m_search->Find(ui->lineEditFind->text());
|
||||
});
|
||||
connect(ui->lineEditFindPC, &QLineEdit::textEdited, this, [this](const QString &term) { m_searchPC->Find(term); });
|
||||
connect(ui->lineEditFindPC, &QLineEdit::editingFinished, this, [this]()
|
||||
connect(ui->lineEditFindPC, &QLineEdit::editingFinished, this,
|
||||
[this]()
|
||||
{
|
||||
SavePreviewCalculationsSearchRequest();
|
||||
InitPreviewCalculationsSearchHistory();
|
||||
m_searchPC->Find(ui->lineEditFindPC->text());
|
||||
});
|
||||
|
||||
connect(ui->toolButtonFindPrevious, &QToolButton::clicked, this, [this]()
|
||||
connect(ui->toolButtonFindPrevious, &QToolButton::clicked, this,
|
||||
[this]()
|
||||
{
|
||||
SaveIncrementsSearchRequest();
|
||||
InitPreviewCalculationsSearchHistory();
|
||||
m_search->FindPrevious();
|
||||
ui->labelResults->setText(QStringLiteral("%1/%2").arg(m_search->MatchIndex()+1).arg(m_search->MatchCount()));
|
||||
ui->labelResults->setText(
|
||||
QStringLiteral("%1/%2").arg(m_search->MatchIndex() + 1).arg(m_search->MatchCount()));
|
||||
});
|
||||
connect(ui->toolButtonFindPreviousPC, &QToolButton::clicked, this, [this]()
|
||||
connect(ui->toolButtonFindPreviousPC, &QToolButton::clicked, this,
|
||||
[this]()
|
||||
{
|
||||
SavePreviewCalculationsSearchRequest();
|
||||
InitPreviewCalculationsSearchHistory();
|
||||
|
@ -893,14 +900,17 @@ void DialogIncrements::InitSearch()
|
|||
ui->labelResultsPC->setText(
|
||||
QStringLiteral("%1/%2").arg(m_searchPC->MatchIndex() + 1).arg(m_searchPC->MatchCount()));
|
||||
});
|
||||
connect(ui->toolButtonFindNext, &QToolButton::clicked, this, [this]()
|
||||
connect(ui->toolButtonFindNext, &QToolButton::clicked, this,
|
||||
[this]()
|
||||
{
|
||||
SaveIncrementsSearchRequest();
|
||||
InitIncrementsSearchHistory();
|
||||
m_search->FindNext();
|
||||
ui->labelResults->setText(QStringLiteral("%1/%2").arg(m_search->MatchIndex()+1).arg(m_search->MatchCount()));
|
||||
ui->labelResults->setText(
|
||||
QStringLiteral("%1/%2").arg(m_search->MatchIndex() + 1).arg(m_search->MatchCount()));
|
||||
});
|
||||
connect(ui->toolButtonFindNextPC, &QToolButton::clicked, this, [this]()
|
||||
connect(ui->toolButtonFindNextPC, &QToolButton::clicked, this,
|
||||
[this]()
|
||||
{
|
||||
SavePreviewCalculationsSearchRequest();
|
||||
InitPreviewCalculationsSearchHistory();
|
||||
|
@ -909,7 +919,8 @@ void DialogIncrements::InitSearch()
|
|||
QStringLiteral("%1/%2").arg(m_searchPC->MatchIndex() + 1).arg(m_searchPC->MatchCount()));
|
||||
});
|
||||
|
||||
connect(m_search.data(), &VTableSearch::HasResult, this, [this] (bool state)
|
||||
connect(m_search.data(), &VTableSearch::HasResult, this,
|
||||
[this](bool state)
|
||||
{
|
||||
ui->toolButtonFindPrevious->setEnabled(state);
|
||||
ui->toolButtonFindNext->setEnabled(state);
|
||||
|
@ -942,7 +953,8 @@ void DialogIncrements::InitSearch()
|
|||
}
|
||||
});
|
||||
|
||||
connect(m_searchPC.data(), &VTableSearch::HasResult, this, [this] (bool state)
|
||||
connect(m_searchPC.data(), &VTableSearch::HasResult, this,
|
||||
[this](bool state)
|
||||
{
|
||||
ui->toolButtonFindPreviousPC->setEnabled(state);
|
||||
ui->toolButtonFindNextPC->setEnabled(state);
|
||||
|
@ -975,35 +987,40 @@ void DialogIncrements::InitSearch()
|
|||
}
|
||||
});
|
||||
|
||||
connect(ui->toolButtonCaseSensitive, &QToolButton::toggled, this, [this](bool checked)
|
||||
connect(ui->toolButtonCaseSensitive, &QToolButton::toggled, this,
|
||||
[this](bool checked)
|
||||
{
|
||||
m_search->SetMatchCase(checked);
|
||||
m_search->Find(ui->lineEditFind->text());
|
||||
ui->lineEditFind->setPlaceholderText(m_search->SearchPlaceholder());
|
||||
});
|
||||
|
||||
connect(ui->toolButtonCaseSensitivePC, &QToolButton::toggled, this, [this](bool checked)
|
||||
connect(ui->toolButtonCaseSensitivePC, &QToolButton::toggled, this,
|
||||
[this](bool checked)
|
||||
{
|
||||
m_searchPC->SetMatchCase(checked);
|
||||
m_searchPC->Find(ui->lineEditFindPC->text());
|
||||
ui->lineEditFindPC->setPlaceholderText(m_searchPC->SearchPlaceholder());
|
||||
});
|
||||
|
||||
connect(ui->toolButtonWholeWord, &QToolButton::toggled, this, [this](bool checked)
|
||||
connect(ui->toolButtonWholeWord, &QToolButton::toggled, this,
|
||||
[this](bool checked)
|
||||
{
|
||||
m_search->SetMatchWord(checked);
|
||||
m_search->Find(ui->lineEditFind->text());
|
||||
ui->lineEditFind->setPlaceholderText(m_search->SearchPlaceholder());
|
||||
});
|
||||
|
||||
connect(ui->toolButtonWholeWordPC, &QToolButton::toggled, this, [this](bool checked)
|
||||
connect(ui->toolButtonWholeWordPC, &QToolButton::toggled, this,
|
||||
[this](bool checked)
|
||||
{
|
||||
m_searchPC->SetMatchWord(checked);
|
||||
m_searchPC->Find(ui->lineEditFindPC->text());
|
||||
ui->lineEditFindPC->setPlaceholderText(m_searchPC->SearchPlaceholder());
|
||||
});
|
||||
|
||||
connect(ui->toolButtonRegexp, &QToolButton::toggled, this, [this](bool checked)
|
||||
connect(ui->toolButtonRegexp, &QToolButton::toggled, this,
|
||||
[this](bool checked)
|
||||
{
|
||||
m_search->SetMatchRegexp(checked);
|
||||
|
||||
|
@ -1028,7 +1045,8 @@ void DialogIncrements::InitSearch()
|
|||
ui->lineEditFind->setPlaceholderText(m_search->SearchPlaceholder());
|
||||
});
|
||||
|
||||
connect(ui->toolButtonRegexpPC, &QToolButton::toggled, this, [this](bool checked)
|
||||
connect(ui->toolButtonRegexpPC, &QToolButton::toggled, this,
|
||||
[this](bool checked)
|
||||
{
|
||||
m_searchPC->SetMatchRegexp(checked);
|
||||
|
||||
|
@ -1053,13 +1071,15 @@ void DialogIncrements::InitSearch()
|
|||
ui->lineEditFindPC->setPlaceholderText(m_searchPC->SearchPlaceholder());
|
||||
});
|
||||
|
||||
connect(ui->toolButtonUseUnicodeProperties, &QToolButton::toggled, this, [this](bool checked)
|
||||
connect(ui->toolButtonUseUnicodeProperties, &QToolButton::toggled, this,
|
||||
[this](bool checked)
|
||||
{
|
||||
m_search->SetUseUnicodePreperties(checked);
|
||||
m_search->Find(ui->lineEditFind->text());
|
||||
});
|
||||
|
||||
connect(ui->toolButtonUseUnicodePropertiesPC, &QToolButton::toggled, this, [this](bool checked)
|
||||
connect(ui->toolButtonUseUnicodePropertiesPC, &QToolButton::toggled, this,
|
||||
[this](bool checked)
|
||||
{
|
||||
m_searchPC->SetUseUnicodePreperties(checked);
|
||||
m_searchPC->Find(ui->lineEditFindPC->text());
|
||||
|
@ -1084,7 +1104,8 @@ void DialogIncrements::InitIncrementsSearchHistory()
|
|||
{
|
||||
QAction *action = m_searchHistory->addAction(term);
|
||||
action->setData(term);
|
||||
connect(action, &QAction::triggered, this, [this]()
|
||||
connect(action, &QAction::triggered, this,
|
||||
[this]()
|
||||
{
|
||||
auto *action = qobject_cast<QAction *>(sender());
|
||||
if (action != nullptr)
|
||||
|
@ -1108,7 +1129,8 @@ void DialogIncrements::InitPreviewCalculationsSearchHistory()
|
|||
{
|
||||
QAction *action = m_searchHistoryPC->addAction(term);
|
||||
action->setData(term);
|
||||
connect(action, &QAction::triggered, this, [this]()
|
||||
connect(action, &QAction::triggered, this,
|
||||
[this]()
|
||||
{
|
||||
auto *action = qobject_cast<QAction *>(sender());
|
||||
if (action != nullptr)
|
||||
|
@ -1144,7 +1166,8 @@ void DialogIncrements::SaveIncrementsSearchRequest()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogIncrements::SavePreviewCalculationsSearchRequest()
|
||||
{
|
||||
QStringList searchHistory = VAbstractValApplication::VApp()->ValentinaSettings()->GetPreviewCalculationsSearchHistory();
|
||||
QStringList searchHistory =
|
||||
VAbstractValApplication::VApp()->ValentinaSettings()->GetPreviewCalculationsSearchHistory();
|
||||
QString term = ui->lineEditFindPC->text();
|
||||
if (term.isEmpty())
|
||||
{
|
||||
|
@ -1337,9 +1360,8 @@ void DialogIncrements::FillIncrementsTable(QTableWidget *table,
|
|||
}
|
||||
AddCell(table, calculatedValue, currentRow, 1, Qt::AlignCenter, incr->IsFormulaOk()); // calculated value
|
||||
|
||||
QString formula =
|
||||
VTranslateVars::TryFormulaToUser(incr->GetFormula(),
|
||||
VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||
QString formula = VTranslateVars::TryFormulaToUser(
|
||||
incr->GetFormula(), VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||
|
||||
AddCell(table, formula, currentRow, 2, Qt::AlignVCenter); // formula
|
||||
|
||||
|
@ -1738,8 +1760,8 @@ void DialogIncrements::SaveIncrFormula()
|
|||
|
||||
try
|
||||
{
|
||||
const QString formula = VAbstractApplication::VApp()->TrVars()
|
||||
->FormulaFromUser(text, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||
const QString formula = VAbstractApplication::VApp()->TrVars()->FormulaFromUser(
|
||||
text, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||
m_doc->SetIncrementFormula(nameField->text(), formula);
|
||||
}
|
||||
catch (qmu::QmuParserError &e) // Just in case something bad will happen
|
||||
|
@ -1796,15 +1818,15 @@ void DialogIncrements::DeployFormula()
|
|||
{
|
||||
plainTextEditFormula->setFixedHeight(DIALOG_MAX_FORMULA_HEIGHT);
|
||||
// Set icon from theme (internal for Windows system)
|
||||
pushButtonGrow->setIcon(QIcon::fromTheme(QStringLiteral("go-next"),
|
||||
QIcon(":/icons/win.icon.theme/16x16/actions/go-next.png")));
|
||||
pushButtonGrow->setIcon(
|
||||
QIcon::fromTheme(QStringLiteral("go-next"), QIcon(":/icons/win.icon.theme/16x16/actions/go-next.png")));
|
||||
}
|
||||
else
|
||||
{
|
||||
plainTextEditFormula->setFixedHeight(baseHeight);
|
||||
// Set icon from theme (internal for Windows system)
|
||||
pushButtonGrow->setIcon(QIcon::fromTheme(QStringLiteral("go-down"),
|
||||
QIcon(":/icons/win.icon.theme/16x16/actions/go-down.png")));
|
||||
pushButtonGrow->setIcon(
|
||||
QIcon::fromTheme(QStringLiteral("go-down"), QIcon(":/icons/win.icon.theme/16x16/actions/go-down.png")));
|
||||
}
|
||||
|
||||
// I found that after change size of formula field, it was filed for angle formula, field for formula became black.
|
||||
|
|
|
@ -29,29 +29,29 @@
|
|||
#include "dialogpatternproperties.h"
|
||||
#include "ui_dialogpatternproperties.h"
|
||||
#include <QBuffer>
|
||||
#include <QPushButton>
|
||||
#include <QFileDialog>
|
||||
#include <QMenu>
|
||||
#include <QDate>
|
||||
#include <QMessageBox>
|
||||
#include <QRadioButton>
|
||||
#include <QCompleter>
|
||||
#include <QSet>
|
||||
#include <QImageReader>
|
||||
#include <QMimeType>
|
||||
#include <QDate>
|
||||
#include <QDesktopServices>
|
||||
#include <QFileDialog>
|
||||
#include <QImageReader>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <QMimeType>
|
||||
#include <QPushButton>
|
||||
#include <QRadioButton>
|
||||
#include <QSet>
|
||||
#include <QUrl>
|
||||
|
||||
#include "../xml/vpattern.h"
|
||||
#include "../vpatterndb/vcontainer.h"
|
||||
#include "../core/vapplication.h"
|
||||
#include "../vmisc/vvalentinasettings.h"
|
||||
#include "../vpatterndb/vcontainer.h"
|
||||
#include "../xml/vpattern.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 "../qmuparser/qmudef.h"
|
||||
#include "../ifc/xml/vpatternimage.h"
|
||||
#include "../ifc/xml/utils.h"
|
||||
#include "../ifc/xml/vpatternimage.h"
|
||||
#include "../qmuparser/qmudef.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pattern, QWidget *parent)
|
||||
|
@ -85,10 +85,8 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pat
|
|||
}
|
||||
ui->lineEditPathToFile->setCursorPosition(0);
|
||||
|
||||
connect(ui->pushButtonShowInExplorer, &QPushButton::clicked, this, []()
|
||||
{
|
||||
ShowInGraphicalShell(VAbstractValApplication::VApp()->GetPatternPath());
|
||||
});
|
||||
connect(ui->pushButtonShowInExplorer, &QPushButton::clicked, this,
|
||||
[]() { ShowInGraphicalShell(VAbstractValApplication::VApp()->GetPatternPath()); });
|
||||
#if defined(Q_OS_MAC)
|
||||
ui->pushButtonShowInExplorer->setText(tr("Show in Finder"));
|
||||
#endif // defined(Q_OS_MAC)
|
||||
|
@ -99,8 +97,8 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pat
|
|||
ui->comboBoxLabelLanguage->addItem(QLocale(name).nativeLanguageName(), name);
|
||||
}
|
||||
|
||||
int index = ui->comboBoxLabelLanguage->findData(
|
||||
VAbstractValApplication::VApp()->ValentinaSettings()->GetLabelLanguage());
|
||||
int index =
|
||||
ui->comboBoxLabelLanguage->findData(VAbstractValApplication::VApp()->ValentinaSettings()->GetLabelLanguage());
|
||||
if (index != -1)
|
||||
{
|
||||
ui->comboBoxLabelLanguage->setCurrentIndex(index);
|
||||
|
@ -154,7 +152,8 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pat
|
|||
});
|
||||
|
||||
ui->lineEditPassmarkLength->setCompleter(m_completerLength);
|
||||
connect(ui->lineEditPassmarkLength, &QLineEdit::textEdited, this, [this]()
|
||||
connect(ui->lineEditPassmarkLength, &QLineEdit::textEdited, this,
|
||||
[this]()
|
||||
{
|
||||
ValidatePassmarkLength();
|
||||
DescEdited();
|
||||
|
@ -195,8 +194,7 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pat
|
|||
m_defaultChanged = false;
|
||||
m_securityChanged = false;
|
||||
|
||||
connect(ui->pushButtonBrowsePieceLabelPath, &QPushButton::clicked, this,
|
||||
&DialogPatternProperties::BrowseLabelPath);
|
||||
connect(ui->pushButtonBrowsePieceLabelPath, &QPushButton::clicked, this, &DialogPatternProperties::BrowseLabelPath);
|
||||
ui->lineEditPieceLabelPath->setText(m_doc->GetDefaultPieceLabelPath());
|
||||
connect(ui->lineEditPieceLabelPath, &QLineEdit::textChanged, this, &DialogPatternProperties::LabelPathChanged);
|
||||
}
|
||||
|
@ -330,8 +328,7 @@ void DialogPatternProperties::ValidatePassmarkLength() const
|
|||
QRegularExpression rx(NameRegExp());
|
||||
if (not text.isEmpty())
|
||||
{
|
||||
palette.setColor(foregroundRole,
|
||||
rx.match(text).hasMatch() && m_variables.contains(text) ? Qt::black : Qt::red);
|
||||
palette.setColor(foregroundRole, rx.match(text).hasMatch() && m_variables.contains(text) ? Qt::black : Qt::red);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -366,7 +363,8 @@ void DialogPatternProperties::InitImage()
|
|||
{
|
||||
ui->imageLabel->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
ui->imageLabel->setScaledContents(true);
|
||||
connect(ui->imageLabel, &QWidget::customContextMenuRequested, this, [this]()
|
||||
connect(ui->imageLabel, &QWidget::customContextMenuRequested, this,
|
||||
[this]()
|
||||
{
|
||||
QMenu menu(this);
|
||||
menu.addAction(m_deleteAction);
|
||||
|
@ -382,7 +380,8 @@ void DialogPatternProperties::InitImage()
|
|||
m_saveImageAction = new QAction(tr("Save image to file"), this);
|
||||
m_showImageAction = new QAction(tr("Show image"), this);
|
||||
|
||||
connect(m_deleteAction, &QAction::triggered, this, [this]()
|
||||
connect(m_deleteAction, &QAction::triggered, this,
|
||||
[this]()
|
||||
{
|
||||
m_doc->DeleteImage();
|
||||
ui->imageLabel->setText(tr("Change image"));
|
||||
|
@ -411,8 +410,8 @@ void DialogPatternProperties::InitImage()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPatternProperties::ChangeImage()
|
||||
{
|
||||
const QString fileName = QFileDialog::getOpenFileName(this, tr("Image for pattern"), QString(),
|
||||
PrepareImageFilters(), nullptr,
|
||||
const QString fileName =
|
||||
QFileDialog::getOpenFileName(this, tr("Image for pattern"), QString(), PrepareImageFilters(), nullptr,
|
||||
VAbstractApplication::VApp()->NativeFileDialog());
|
||||
if (not fileName.isEmpty())
|
||||
{
|
||||
|
|
|
@ -27,23 +27,31 @@
|
|||
*************************************************************************/
|
||||
|
||||
#include "dialogsavelayout.h"
|
||||
#include "ui_dialogsavelayout.h"
|
||||
#include "../core/vapplication.h"
|
||||
#include "../vmisc/vvalentinasettings.h"
|
||||
#include "ui_dialogsavelayout.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 "../ifc/exception/vexception.h"
|
||||
#include "../vlayout/vlayoutexporter.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
#include "../vmisc/diagnostic.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileDialog>
|
||||
#include <QGlobalStatic>
|
||||
#include <QMessageBox>
|
||||
#include <QProcess>
|
||||
#include <QtDebug>
|
||||
#include <QRegularExpression>
|
||||
#include <QtDebug>
|
||||
#include <QGlobalStatic>
|
||||
|
||||
namespace
|
||||
{
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
|
||||
|
||||
#ifndef Q_OS_WIN
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, baseFilenameRegExp, (QLatin1String("^[^\\/]+$"))) // NOLINT
|
||||
|
@ -51,6 +59,9 @@
|
|||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, baseFilenameRegExp, (QLatin1String("^[^\\:?\"*|\\/<>]+$"))) // NOLINT
|
||||
#endif
|
||||
|
||||
QT_WARNING_POP
|
||||
} // namespace
|
||||
|
||||
bool DialogSaveLayout::havePdf = false; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
bool DialogSaveLayout::tested = false; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
|
||||
|
@ -117,9 +128,10 @@ DialogSaveLayout::DialogSaveLayout(int count, Draw mode, const QString &fileName
|
|||
|
||||
connect(bOk, &QPushButton::clicked, this, &DialogSaveLayout::Save);
|
||||
connect(ui->lineEditFileName, &QLineEdit::textChanged, this, &DialogSaveLayout::ShowExample);
|
||||
connect(ui->comboBoxFormat, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &DialogSaveLayout::ShowExample);
|
||||
connect(ui->pushButtonBrowse, &QPushButton::clicked, this, [this]()
|
||||
connect(ui->comboBoxFormat, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
&DialogSaveLayout::ShowExample);
|
||||
connect(ui->pushButtonBrowse, &QPushButton::clicked, this,
|
||||
[this]()
|
||||
{
|
||||
const QString dirPath = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathLayout();
|
||||
bool usedNotExistedDir = false;
|
||||
|
@ -152,10 +164,10 @@ DialogSaveLayout::DialogSaveLayout(int count, Draw mode, const QString &fileName
|
|||
|
||||
connect(ui->toolButtonScaleConnected, &QToolButton::clicked, this, &DialogSaveLayout::ToggleScaleConnection);
|
||||
|
||||
connect(ui->doubleSpinBoxHorizontalScale, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, &DialogSaveLayout::HorizontalScaleChanged);
|
||||
connect(ui->doubleSpinBoxVerticalScale, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, &DialogSaveLayout::VerticalScaleChanged);
|
||||
connect(ui->doubleSpinBoxHorizontalScale, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
&DialogSaveLayout::HorizontalScaleChanged);
|
||||
connect(ui->doubleSpinBoxVerticalScale, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
&DialogSaveLayout::VerticalScaleChanged);
|
||||
|
||||
ReadSettings();
|
||||
|
||||
|
@ -318,8 +330,8 @@ auto DialogSaveLayout::MakeHelpFormatList() -> QString
|
|||
const auto formats = InitFormats();
|
||||
for (int i = 0; i < formats.size(); ++i)
|
||||
{
|
||||
out += QStringLiteral("\t* ") + formats.at(i).first + QStringLiteral(" = ")
|
||||
+ QString::number(static_cast<int>(formats.at(i).second));
|
||||
out += QStringLiteral("\t* ") + formats.at(i).first + QStringLiteral(" = ") +
|
||||
QString::number(static_cast<int>(formats.at(i).second));
|
||||
|
||||
if (i < formats.size() - 1)
|
||||
{
|
||||
|
@ -396,12 +408,14 @@ void DialogSaveLayout::Save()
|
|||
|
||||
for (int i = 0; i < m_count; ++i)
|
||||
{
|
||||
const QString name = Path()+'/'+FileName()+QString::number(i+1)+VLayoutExporter::ExportFormatSuffix(Format());
|
||||
const QString name =
|
||||
Path() + '/' + FileName() + QString::number(i + 1) + VLayoutExporter::ExportFormatSuffix(Format());
|
||||
if (QFile::exists(name))
|
||||
{
|
||||
QMessageBox::StandardButton res = QMessageBox::question(this, tr("Name conflict"),
|
||||
tr("Folder already contain file with name %1. Rewrite all conflict file names?")
|
||||
.arg(name), QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes);
|
||||
QMessageBox::StandardButton res = QMessageBox::question(
|
||||
this, tr("Name conflict"),
|
||||
tr("Folder already contain file with name %1. Rewrite all conflict file names?").arg(name),
|
||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
||||
if (res == QMessageBox::No)
|
||||
{
|
||||
reject();
|
||||
|
@ -442,7 +456,8 @@ void DialogSaveLayout::PathChanged(const QString &text)
|
|||
void DialogSaveLayout::ShowExample()
|
||||
{
|
||||
const LayoutExportFormats currentFormat = Format();
|
||||
ui->labelExample->setText(tr("Example:") + FileName() + QLatin1Char('1') + VLayoutExporter::ExportFormatSuffix(currentFormat));
|
||||
ui->labelExample->setText(tr("Example:") + FileName() + QLatin1Char('1') +
|
||||
VLayoutExporter::ExportFormatSuffix(currentFormat));
|
||||
|
||||
ui->checkBoxBinaryDXF->setEnabled(false);
|
||||
ui->groupBoxPaperFormat->setEnabled(false);
|
||||
|
@ -562,12 +577,8 @@ void DialogSaveLayout::SetTiledMargins(QMarginsF margins)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto DialogSaveLayout::GetTiledMargins() const -> QMarginsF
|
||||
{
|
||||
QMarginsF margins = QMarginsF(
|
||||
ui->doubleSpinBoxLeftField->value(),
|
||||
ui->doubleSpinBoxTopField->value(),
|
||||
ui->doubleSpinBoxRightField->value(),
|
||||
ui->doubleSpinBoxBottomField->value()
|
||||
);
|
||||
QMarginsF margins = QMarginsF(ui->doubleSpinBoxLeftField->value(), ui->doubleSpinBoxTopField->value(),
|
||||
ui->doubleSpinBoxRightField->value(), ui->doubleSpinBoxBottomField->value());
|
||||
|
||||
return UnitConvertor(margins, VAbstractValApplication::VApp()->patternUnits(), Unit::Mm);
|
||||
}
|
||||
|
@ -677,9 +688,7 @@ auto DialogSaveLayout::InitFormats() -> QVector<std::pair<QString, LayoutExportF
|
|||
QVector<std::pair<QString, LayoutExportFormats>> list;
|
||||
|
||||
auto InitFormat = [&list](LayoutExportFormats format)
|
||||
{
|
||||
list.append(std::make_pair(VLayoutExporter::ExportFormatDescription(format), format));
|
||||
};
|
||||
{ list.append(std::make_pair(VLayoutExporter::ExportFormatDescription(format), format)); };
|
||||
|
||||
InitFormat(LayoutExportFormats::SVG);
|
||||
InitFormat(LayoutExportFormats::PDF);
|
||||
|
@ -795,12 +804,8 @@ void DialogSaveLayout::WriteSettings() const
|
|||
const Unit unit = VAbstractValApplication::VApp()->patternUnits();
|
||||
|
||||
// write Margins top, right, bottom, left
|
||||
QMarginsF margins = QMarginsF(
|
||||
ui->doubleSpinBoxLeftField->value(),
|
||||
ui->doubleSpinBoxTopField->value(),
|
||||
ui->doubleSpinBoxRightField->value(),
|
||||
ui->doubleSpinBoxBottomField->value()
|
||||
);
|
||||
QMarginsF margins = QMarginsF(ui->doubleSpinBoxLeftField->value(), ui->doubleSpinBoxTopField->value(),
|
||||
ui->doubleSpinBoxRightField->value(), ui->doubleSpinBoxBottomField->value());
|
||||
settings->SetTiledPDFMargins(margins, unit);
|
||||
|
||||
// write Template
|
||||
|
@ -830,4 +835,3 @@ void DialogSaveLayout::WriteSettings() const
|
|||
settings->SetShowGrainline(IsShowGrainline());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,12 +27,16 @@
|
|||
*************************************************************************/
|
||||
|
||||
#include "vwidgetdetails.h"
|
||||
#include "ui_vwidgetdetails.h"
|
||||
#include "../ifc/xml/vabstractpattern.h"
|
||||
#include "../vpatterndb/vcontainer.h"
|
||||
#include "../vmisc/vabstractapplication.h"
|
||||
#include "../vtools/undocommands/togglepiecestate.h"
|
||||
#include "../vpatterndb/vcontainer.h"
|
||||
#include "../vtools/tools/vtoolseamallowance.h"
|
||||
#include "../vtools/undocommands/togglepiecestate.h"
|
||||
#include "ui_vwidgetdetails.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
#include "../vmisc/diagnostic.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
|
||||
#include <QMenu>
|
||||
#include <QTimer>
|
||||
|
@ -58,8 +62,13 @@ enum PieceColumn
|
|||
PieceName = 1
|
||||
};
|
||||
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, allowDetailIcon, (QLatin1String("://icon/16x16/allow_detail.png"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, forbidDetailIcon, (QLatin1String("://icon/16x16/forbid_detail.png"))) // NOLINT
|
||||
|
||||
QT_WARNING_POP
|
||||
} // namespace
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -82,10 +91,7 @@ VWidgetDetails::VWidgetDetails(VContainer *data, VAbstractPattern *doc, QWidget
|
|||
connect(ui->tableWidget, &QTableWidget::customContextMenuRequested, this, &VWidgetDetails::ShowContextMenu);
|
||||
|
||||
m_updateListTimer->setSingleShot(true);
|
||||
connect(m_updateListTimer, &QTimer::timeout, this, [this]()
|
||||
{
|
||||
FillTable(m_data->DataPieces());
|
||||
});
|
||||
connect(m_updateListTimer, &QTimer::timeout, this, [this]() { FillTable(m_data->DataPieces()); });
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -229,8 +235,7 @@ void VWidgetDetails::ToggledPieceItem(QTableWidgetItem *item)
|
|||
if (details->contains(id))
|
||||
{
|
||||
const bool inLayout = details->value(id).IsInLayout();
|
||||
inLayout ? item->setIcon(QIcon(*allowDetailIcon))
|
||||
: item->setIcon(QIcon(*forbidDetailIcon));
|
||||
inLayout ? item->setIcon(QIcon(*allowDetailIcon)) : item->setIcon(QIcon(*forbidDetailIcon));
|
||||
|
||||
VToolSeamAllowance *tool = nullptr;
|
||||
try
|
||||
|
@ -309,11 +314,11 @@ void VWidgetDetails::ShowContextMenu(const QPoint &pos)
|
|||
pieceMode = true;
|
||||
menu->addSeparator();
|
||||
|
||||
actionPieceOptions = menu->addAction(QIcon::fromTheme(QStringLiteral("preferences-other")),
|
||||
tr("Piece options"));
|
||||
actionPieceOptions =
|
||||
menu->addAction(QIcon::fromTheme(QStringLiteral("preferences-other")), tr("Piece options"));
|
||||
|
||||
actionDeletePiece = menu->addAction(QIcon::fromTheme(QStringLiteral("edit-delete")),
|
||||
tr("Delete piece"));
|
||||
actionDeletePiece =
|
||||
menu->addAction(QIcon::fromTheme(QStringLiteral("edit-delete")), tr("Delete piece"));
|
||||
actionDeletePiece->setDisabled(toolPiece->referens() > 0);
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -29,10 +29,10 @@
|
|||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include "mainwindowsnogui.h"
|
||||
#include "core/vcmdexport.h"
|
||||
#include "../vmisc/vlockguard.h"
|
||||
#include "../vformat/vdimensions.h"
|
||||
#include "../vmisc/vlockguard.h"
|
||||
#include "core/vcmdexport.h"
|
||||
#include "mainwindowsnogui.h"
|
||||
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QPointer>
|
||||
|
@ -66,6 +66,7 @@ class VWidgetBackgroundImages;
|
|||
class MainWindow : public MainWindowsNoGUI
|
||||
{
|
||||
Q_OBJECT // NOLINT
|
||||
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent = nullptr);
|
||||
~MainWindow() override;
|
||||
|
@ -109,6 +110,7 @@ signals:
|
|||
void EnableNodePointHover(bool enable);
|
||||
void EnableDetailHover(bool enable);
|
||||
void EnableImageBackgroundHover(bool enable);
|
||||
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent *event) override;
|
||||
void showEvent(QShowEvent *event) override;
|
||||
|
@ -366,21 +368,14 @@ private:
|
|||
template <typename Dialog, typename Func, typename Func2>
|
||||
void SetToolButtonWithApply(bool checked, Tool t, const QString &cursor, const QString &toolTip,
|
||||
Func closeDialogSlot, Func2 applyDialogSlot);
|
||||
template <typename DrawTool>
|
||||
void ClosedDialog(int result);
|
||||
template <typename DrawTool> void ClosedDialog(int result);
|
||||
|
||||
template <typename DrawTool>
|
||||
void ClosedDialogWithApply(int result, VMainGraphicsScene *scene);
|
||||
template <typename DrawTool>
|
||||
void ApplyDialog(VMainGraphicsScene *scene);
|
||||
template <typename DrawTool>
|
||||
void ClosedDrawDialogWithApply(int result);
|
||||
template <typename DrawTool>
|
||||
void ApplyDrawDialog();
|
||||
template <typename DrawTool>
|
||||
void ClosedDetailsDialogWithApply(int result);
|
||||
template <typename DrawTool>
|
||||
void ApplyDetailsDialog();
|
||||
template <typename DrawTool> void ClosedDialogWithApply(int result, VMainGraphicsScene *scene);
|
||||
template <typename DrawTool> void ApplyDialog(VMainGraphicsScene *scene);
|
||||
template <typename DrawTool> void ClosedDrawDialogWithApply(int result);
|
||||
template <typename DrawTool> void ApplyDrawDialog();
|
||||
template <typename DrawTool> void ClosedDetailsDialogWithApply(int result);
|
||||
template <typename DrawTool> void ApplyDetailsDialog();
|
||||
|
||||
auto SavePattern(const QString &fileName, QString &error) -> bool;
|
||||
void AutoSavePattern();
|
||||
|
|
|
@ -21,25 +21,25 @@
|
|||
|
||||
#include "fvupdater.h"
|
||||
|
||||
#include <qsystemdetection.h>
|
||||
#include <qxmlstream.h>
|
||||
#include <QApplication>
|
||||
#include <QByteArray>
|
||||
#include <QDate>
|
||||
#include <QDesktopServices>
|
||||
#include <QDir>
|
||||
#include <QGlobalStatic>
|
||||
#include <QLatin1String>
|
||||
#include <QMessageBox>
|
||||
#include <QMessageLogger>
|
||||
#include <QMutex>
|
||||
#include <QNetworkReply>
|
||||
#include <QNetworkRequest>
|
||||
#include <QSslConfiguration>
|
||||
#include <QStringList>
|
||||
#include <QVariant>
|
||||
#include <QXmlStreamAttributes>
|
||||
#include <QtDebug>
|
||||
#include <QSslConfiguration>
|
||||
#include <QDir>
|
||||
#include <QGlobalStatic>
|
||||
#include <qsystemdetection.h>
|
||||
#include <qxmlstream.h>
|
||||
|
||||
#include "../ifc/exception/vexception.h"
|
||||
#include "../ifc/xml/vabstractconverter.h"
|
||||
|
@ -49,13 +49,24 @@
|
|||
#include "fvavailableupdate.h"
|
||||
#include "fvupdatewindow.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
#include "../vmisc/diagnostic.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
|
||||
namespace
|
||||
{
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, defaultFeedURL, // NOLINT
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
|
||||
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, defaultFeedURL,
|
||||
(QLatin1String("https://valentinaproject.bitbucket.io/Appcast.xml")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, testFeedURL, // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, testFeedURL,
|
||||
(QLatin1String("https://valentinaproject.bitbucket.io/Appcast_testing.xml")))
|
||||
}
|
||||
|
||||
QT_WARNING_POP
|
||||
} // namespace
|
||||
|
||||
QPointer<FvUpdater> FvUpdater::m_Instance;
|
||||
|
||||
|
@ -325,7 +336,8 @@ void FvUpdater::startDownloadFeed(const QUrl &url)
|
|||
|
||||
m_reply = m_qnam.get(request);
|
||||
|
||||
connect(m_reply.data(), &QNetworkReply::readyRead, this, [this]()
|
||||
connect(m_reply.data(), &QNetworkReply::readyRead, this,
|
||||
[this]()
|
||||
{
|
||||
// this slot gets called every time the QNetworkReply has new data.
|
||||
// We read all of its new data and write it into the file.
|
||||
|
@ -333,7 +345,8 @@ void FvUpdater::startDownloadFeed(const QUrl &url)
|
|||
// signal of the QNetworkReply
|
||||
m_xml.addData(m_reply->readAll());
|
||||
});
|
||||
connect(m_reply.data(), &QNetworkReply::downloadProgress, this, [this](qint64 bytesRead, qint64 totalBytes)
|
||||
connect(m_reply.data(), &QNetworkReply::downloadProgress, this,
|
||||
[this](qint64 bytesRead, qint64 totalBytes)
|
||||
{
|
||||
Q_UNUSED(bytesRead)
|
||||
Q_UNUSED(totalBytes)
|
||||
|
@ -455,18 +468,15 @@ auto FvUpdater::xmlParseFeed() -> bool
|
|||
// here (because the topmost is the most recent one, and thus
|
||||
// the newest version.
|
||||
|
||||
return searchDownloadedFeedForUpdates(xmlEnclosureUrl,
|
||||
xmlEnclosureVersion,
|
||||
xmlEnclosurePlatform);
|
||||
return searchDownloadedFeedForUpdates(xmlEnclosureUrl, xmlEnclosureVersion, xmlEnclosurePlatform);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_xml.error() && m_xml.error() != QXmlStreamReader::PrematureEndOfDocumentError)
|
||||
{
|
||||
showErrorDialog(tr("Feed parsing failed: %1 %2.").arg(QString::number(m_xml.lineNumber()),
|
||||
m_xml.errorString()), false);
|
||||
showErrorDialog(
|
||||
tr("Feed parsing failed: %1 %2.").arg(QString::number(m_xml.lineNumber()), m_xml.errorString()), false);
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,35 +30,39 @@
|
|||
|
||||
#include <QDomNode>
|
||||
#include <QDomNodeList>
|
||||
#include <QFuture>
|
||||
#include <QLatin1String>
|
||||
#include <QList>
|
||||
#include <QMessageLogger>
|
||||
#include <QSet>
|
||||
#include <QtDebug>
|
||||
#include <QtConcurrentMap>
|
||||
#include <QFuture>
|
||||
#include <QtConcurrentRun>
|
||||
#include <QMimeDatabase>
|
||||
#include <QSet>
|
||||
#include <QtConcurrentMap>
|
||||
#include <QtConcurrentRun>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "../exception/vexceptionconversionerror.h"
|
||||
#include "../exception/vexceptionemptyparameter.h"
|
||||
#include "../exception/vexceptionobjecterror.h"
|
||||
#include "../exception/vexceptionconversionerror.h"
|
||||
#include "../qmuparser/qmutokenparser.h"
|
||||
#include "../ifc/exception/vexceptionbadid.h"
|
||||
#include "../ifc/ifcdef.h"
|
||||
#include "../qmuparser/qmutokenparser.h"
|
||||
#include "../vmisc/compatibility.h"
|
||||
#include "../vmisc/vabstractvalapplication.h"
|
||||
#include "../vpatterndb/vcontainer.h"
|
||||
#include "../vpatterndb/vpiecenode.h"
|
||||
#include "../vtools/tools/vdatatool.h"
|
||||
#include "def.h"
|
||||
#include "vpatternconverter.h"
|
||||
#include "vdomdocument.h"
|
||||
#include "vtoolrecord.h"
|
||||
#include "../vmisc/vabstractvalapplication.h"
|
||||
#include "../vmisc/compatibility.h"
|
||||
#include "vpatternimage.h"
|
||||
#include "vbackgroundpatternimage.h"
|
||||
#include "vdomdocument.h"
|
||||
#include "vpatternconverter.h"
|
||||
#include "vpatternimage.h"
|
||||
#include "vtoolrecord.h"
|
||||
#include "vvalentinasettings.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
#include "../vmisc/diagnostic.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
|
||||
class QDomElement;
|
||||
|
||||
const QString VAbstractPattern::TagPattern = QStringLiteral("pattern");
|
||||
|
@ -173,8 +177,13 @@ bool VAbstractPattern::patternLabelWasChanged = false;
|
|||
|
||||
namespace
|
||||
{
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, dimensionDefValue, (QLatin1String("-1"))) // NOLINT
|
||||
|
||||
QT_WARNING_POP
|
||||
|
||||
void ReadExpressionAttribute(QVector<VFormulaField> &expressions, const QDomElement &element, const QString &attribute)
|
||||
{
|
||||
VFormulaField formula;
|
||||
|
@ -276,8 +285,7 @@ auto StringToTransfrom(const QString &matrix) -> QTransform
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template <class T>
|
||||
auto NumberToString(T number) -> QString
|
||||
template <class T> auto NumberToString(T number) -> QString
|
||||
{
|
||||
const QLocale locale = QLocale::c();
|
||||
return locale.toString(number, 'g', 12).remove(LocaleGroupSeparator(locale));
|
||||
|
@ -286,18 +294,9 @@ auto NumberToString(T number) -> QString
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto TransformToString(const QTransform &m) -> QString
|
||||
{
|
||||
QStringList matrix
|
||||
{
|
||||
NumberToString(m.m11()),
|
||||
NumberToString(m.m12()),
|
||||
NumberToString(m.m13()),
|
||||
NumberToString(m.m21()),
|
||||
NumberToString(m.m22()),
|
||||
NumberToString(m.m23()),
|
||||
NumberToString(m.m31()),
|
||||
NumberToString(m.m32()),
|
||||
NumberToString(m.m33())
|
||||
};
|
||||
QStringList matrix{NumberToString(m.m11()), NumberToString(m.m12()), NumberToString(m.m13()),
|
||||
NumberToString(m.m21()), NumberToString(m.m22()), NumberToString(m.m23()),
|
||||
NumberToString(m.m31()), NumberToString(m.m32()), NumberToString(m.m33())};
|
||||
return matrix.join(QChar(';'));
|
||||
}
|
||||
} // namespace
|
||||
|
@ -311,7 +310,8 @@ VAbstractPattern::VAbstractPattern(QObject *parent)
|
|||
history(QVector<VToolRecord>()),
|
||||
patternPieces(),
|
||||
modified(false)
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VAbstractPattern::~VAbstractPattern()
|
||||
|
@ -330,8 +330,8 @@ auto VAbstractPattern::RequiresMeasurements() const -> bool
|
|||
auto VAbstractPattern::ListMeasurements() const -> QStringList
|
||||
{
|
||||
const QFuture<QStringList> futureIncrements = QtConcurrent::run([this]() { return ListIncrements(); });
|
||||
const QList<QString> tokens = ConvertToList(QtConcurrent::blockingMappedReduced(ListExpressions(), GetTokens,
|
||||
GatherTokens));
|
||||
const QList<QString> tokens =
|
||||
ConvertToList(QtConcurrent::blockingMappedReduced(ListExpressions(), GetTokens, GatherTokens));
|
||||
|
||||
QSet<QString> measurements;
|
||||
QSet<QString> others = ConvertToSet<QString>(futureIncrements.result());
|
||||
|
@ -735,9 +735,8 @@ auto VAbstractPattern::ParsePieceCSARecords(const QDomElement &domElement) -> QV
|
|||
record.path = GetParametrUInt(element, VAbstractPattern::AttrPath, NULL_ID_STR);
|
||||
record.endPoint = GetParametrUInt(element, VAbstractPattern::AttrEnd, NULL_ID_STR);
|
||||
record.reverse = GetParametrBool(element, VAbstractPattern::AttrNodeReverse, falseStr);
|
||||
record.includeType = static_cast<PiecePathIncludeType>(GetParametrUInt(element,
|
||||
VAbstractPattern::AttrIncludeAs,
|
||||
QChar('1')));
|
||||
record.includeType = static_cast<PiecePathIncludeType>(
|
||||
GetParametrUInt(element, VAbstractPattern::AttrIncludeAs, QChar('1')));
|
||||
records.append(record);
|
||||
}
|
||||
}
|
||||
|
@ -822,20 +821,13 @@ auto VAbstractPattern::ParseSANode(const QDomElement &domElement) -> VPieceNode
|
|||
VDomDocument::GetParametrBool(domElement, VAbstractPattern::AttrManualPassmarkAngle, falseStr);
|
||||
const QString passmarkAngle = VDomDocument::GetParametrEmptyString(domElement, VAbstractPattern::AttrPassmarkAngle);
|
||||
|
||||
const bool turnPoint =
|
||||
VDomDocument::GetParametrBool(domElement, VAbstractPattern::AttrNodeTurnPoint, trueStr);
|
||||
const bool turnPoint = VDomDocument::GetParametrBool(domElement, VAbstractPattern::AttrNodeTurnPoint, trueStr);
|
||||
|
||||
const QString t = VDomDocument::GetParametrString(domElement, AttrType, VAbstractPattern::NodePoint);
|
||||
Tool tool;
|
||||
|
||||
const QStringList types
|
||||
{
|
||||
VAbstractPattern::NodePoint,
|
||||
VAbstractPattern::NodeArc,
|
||||
VAbstractPattern::NodeSpline,
|
||||
VAbstractPattern::NodeSplinePath,
|
||||
VAbstractPattern::NodeElArc
|
||||
};
|
||||
const QStringList types{VAbstractPattern::NodePoint, VAbstractPattern::NodeArc, VAbstractPattern::NodeSpline,
|
||||
VAbstractPattern::NodeSplinePath, VAbstractPattern::NodeElArc};
|
||||
|
||||
switch (types.indexOf(t))
|
||||
{
|
||||
|
@ -1622,8 +1614,7 @@ auto VAbstractPattern::CheckTagExists(const QString &tag) -> QDomElement
|
|||
QDomElement element;
|
||||
if (list.isEmpty())
|
||||
{
|
||||
const QStringList tags
|
||||
{
|
||||
const QStringList tags{
|
||||
TagUnit, // 0
|
||||
TagImage, // 1
|
||||
TagDescription, // 2
|
||||
|
@ -1775,7 +1766,8 @@ auto VAbstractPattern::ListExpressions() const -> QVector<VFormulaField>
|
|||
auto futureOperationExpressions = QtConcurrent::run([this]() { return ListOperationExpressions(); });
|
||||
auto futurePathExpressions = QtConcurrent::run([this]() { return ListPathExpressions(); });
|
||||
auto futurePieceExpressions = QtConcurrent::run([this]() { return ListPieceExpressions(); });
|
||||
auto futureFinalMeasurementsExpressions = QtConcurrent::run([this](){return ListFinalMeasurementsExpressions();});
|
||||
auto futureFinalMeasurementsExpressions =
|
||||
QtConcurrent::run([this]() { return ListFinalMeasurementsExpressions(); });
|
||||
|
||||
QVector<VFormulaField> list;
|
||||
list << futurePointExpressions.result();
|
||||
|
@ -2241,8 +2233,8 @@ auto VAbstractPattern::GetBackgroundPatternImage(const QDomElement &element) con
|
|||
image.SetVisible(GetParametrBool(element, AttrVisible, trueStr));
|
||||
|
||||
VValentinaSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
|
||||
image.SetOpacity(GetParametrDouble(element, AttrOpacity,
|
||||
QString::number(settings->GetBackgroundImageDefOpacity()/100.)));
|
||||
image.SetOpacity(
|
||||
GetParametrDouble(element, AttrOpacity, QString::number(settings->GetBackgroundImageDefOpacity() / 100.)));
|
||||
|
||||
QString matrix = GetParametrEmptyString(element, AttrTransform);
|
||||
image.SetMatrix(StringToTransfrom(matrix));
|
||||
|
@ -2307,7 +2299,8 @@ void VAbstractPattern::WriteBackgroundImage(QDomElement &element, const VBackgro
|
|||
SetAttribute(element, AttrTransform, TransformToString(image.Matrix()));
|
||||
|
||||
SetAttributeOrRemoveIf<bool>(element, AttrHold, image.Hold(), [](bool hold) noexcept { return not hold; });
|
||||
SetAttributeOrRemoveIf<qreal>(element, AttrZValue, image.ZValue(), [](qreal z) noexcept {return qFuzzyIsNull(z);});
|
||||
SetAttributeOrRemoveIf<qreal>(element, AttrZValue, image.ZValue(),
|
||||
[](qreal z) noexcept { return qFuzzyIsNull(z); });
|
||||
SetAttributeOrRemoveIf<bool>(element, AttrVisible, image.Visible(), [](bool visible) noexcept { return visible; });
|
||||
SetAttributeOrRemoveIf<qreal>(element, AttrOpacity, image.Opacity(),
|
||||
[](qreal o) noexcept { return VFuzzyComparePossibleNulls(o, 1); });
|
||||
|
@ -2405,8 +2398,8 @@ auto VAbstractPattern::CreateGroup(quint32 id, const QString &name, const QStrin
|
|||
{
|
||||
QDomElement item = createElement(TagGroupItem);
|
||||
item.setAttribute(AttrTool, i.value());
|
||||
SetAttributeOrRemoveIf<vidtype>(item, AttrObject, i.key(), [i](vidtype object) noexcept
|
||||
{return object == i.value();});
|
||||
SetAttributeOrRemoveIf<vidtype>(item, AttrObject, i.key(),
|
||||
[i](vidtype object) noexcept { return object == i.value(); });
|
||||
group.appendChild(item);
|
||||
++i;
|
||||
}
|
||||
|
@ -2442,7 +2435,6 @@ auto VAbstractPattern::GetGroupName(quint32 id) -> QString
|
|||
if (group.isElement())
|
||||
{
|
||||
name = GetParametrString(group, AttrName, name);
|
||||
|
||||
}
|
||||
|
||||
return name;
|
||||
|
@ -2615,9 +2607,8 @@ auto VAbstractPattern::GetGroups(const QString &patternPieceName) -> QMap<quint3
|
|||
VGroupData groupData;
|
||||
const quint32 id = GetParametrUInt(group, AttrId, QChar('0'));
|
||||
groupData.visible = GetParametrBool(group, AttrVisible, trueStr);
|
||||
groupData.name =
|
||||
GetParametrString(group, AttrName,
|
||||
QCoreApplication::translate("VAbstractPattern", "New group"));
|
||||
groupData.name = GetParametrString(
|
||||
group, AttrName, QCoreApplication::translate("VAbstractPattern", "New group"));
|
||||
groupData.tags = FilterGroupTags(GetParametrEmptyString(group, AttrTags));
|
||||
groupData.tool = GetParametrUInt(group, AttrTool, NULL_ID_STR);
|
||||
|
||||
|
@ -2842,8 +2833,8 @@ auto VAbstractPattern::AddItemToGroup(quint32 toolId, quint32 objectId, quint32
|
|||
|
||||
QDomElement item = createElement(TagGroupItem);
|
||||
item.setAttribute(AttrTool, toolId);
|
||||
SetAttributeOrRemoveIf<vidtype>(item, AttrObject, objectId, [toolId](vidtype object) noexcept
|
||||
{return object == toolId;});
|
||||
SetAttributeOrRemoveIf<vidtype>(item, AttrObject, objectId,
|
||||
[toolId](vidtype object) noexcept { return object == toolId; });
|
||||
group.appendChild(item);
|
||||
|
||||
// to signalised that the pattern was changed and need to be saved
|
||||
|
|
|
@ -28,15 +28,15 @@
|
|||
|
||||
#include "vdomdocument.h"
|
||||
|
||||
#include <QSaveFile>
|
||||
#include <qcompilerdetection.h>
|
||||
#include <qdom.h>
|
||||
#include <QSaveFile>
|
||||
|
||||
#include "../exception/vexception.h"
|
||||
#include "../exception/vexceptionbadid.h"
|
||||
#include "../exception/vexceptionconversionerror.h"
|
||||
#include "../exception/vexceptionemptyparameter.h"
|
||||
#include "../exception/vexceptionwrongid.h"
|
||||
#include "../exception/vexception.h"
|
||||
#include "../ifcdef.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
|
@ -45,9 +45,12 @@
|
|||
#endif
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QDir>
|
||||
#include <QDomNodeList>
|
||||
#include <QDomText>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QFutureWatcher>
|
||||
#include <QIODevice>
|
||||
#include <QMessageLogger>
|
||||
#include <QObject>
|
||||
|
@ -55,14 +58,12 @@
|
|||
#include <QTemporaryFile>
|
||||
#include <QTextDocument>
|
||||
#include <QTextStream>
|
||||
#include <QTimer>
|
||||
#include <QUrl>
|
||||
#include <QVector>
|
||||
#include <QtDebug>
|
||||
#include <QXmlStreamWriter>
|
||||
#include <QTimer>
|
||||
#include <QtConcurrentRun>
|
||||
#include <QFutureWatcher>
|
||||
#include <QRegularExpression>
|
||||
#include <QtDebug>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -381,7 +382,6 @@ auto VDomDocument::find(QHash<quint32, QDomElement> &cache, const QDomElement &n
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VDomDocument::RefreshCache(const QDomElement &root) const -> QHash<quint32, QDomElement>
|
||||
{
|
||||
|
@ -736,8 +736,8 @@ void VDomDocument::setXMLContent(const QString &fileName)
|
|||
{
|
||||
file.close();
|
||||
VException e(errorMsg);
|
||||
e.AddMoreInformation(tr("Parsing error file %3 in line %1 column %2").arg(errorLine).arg(errorColumn)
|
||||
.arg(fileName));
|
||||
e.AddMoreInformation(
|
||||
tr("Parsing error file %3 in line %1 column %2").arg(errorLine).arg(errorColumn).arg(fileName));
|
||||
throw e;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,10 @@
|
|||
#include "../vlayout/vlayoutpoint.h"
|
||||
#include "compatibility.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
#include "../vmisc/diagnostic.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
|
||||
/*
|
||||
* Version rules:
|
||||
* 1. Version have three parts "major.minor.patch";
|
||||
|
@ -48,6 +52,9 @@ const QString VLayoutConverter::CurrentSchema = QStringLiteral("://schema/layout
|
|||
|
||||
namespace
|
||||
{
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
|
||||
|
||||
// The list of all string we use for conversion
|
||||
// Better to use global variables because repeating QStringLiteral blows up code size
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strSeamLineTag, (QLatin1String("seamLine"))) // NOLINT
|
||||
|
@ -66,6 +73,8 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAttrUId, (QLatin1String("uid"))) //
|
|||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAttrAngle, (QLatin1String("angle"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAttrArrowDirection, (QLatin1String("arrowDirection"))) // NOLINT
|
||||
|
||||
QT_WARNING_POP
|
||||
|
||||
const QChar groupSep = QLatin1Char(';');
|
||||
const QChar coordintatesSep = QLatin1Char(',');
|
||||
const QChar pointsSep = QLatin1Char(' ');
|
||||
|
@ -204,15 +213,9 @@ auto VLayoutConverter::Schemas() const -> QHash<unsigned int, QString>
|
|||
void VLayoutConverter::ConvertPiecesToV0_1_3()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.1.3
|
||||
Q_STATIC_ASSERT_X(VLayoutConverter::LayoutMinVer < FormatVersion(0, 1, 3),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VLayoutConverter::LayoutMinVer < FormatVersion(0, 1, 3), "Time to refactor the code.");
|
||||
|
||||
const QStringList types
|
||||
{
|
||||
*strSeamLineTag,
|
||||
*strSeamAllowanceTag,
|
||||
*strInternalPathTag
|
||||
};
|
||||
const QStringList types{*strSeamLineTag, *strSeamAllowanceTag, *strInternalPathTag};
|
||||
|
||||
for (const auto &tagType : types)
|
||||
{
|
||||
|
@ -374,8 +377,7 @@ void VLayoutConverter::ConvertPiecesToV0_1_5()
|
|||
void VLayoutConverter::ToV0_1_3()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.1.3
|
||||
Q_STATIC_ASSERT_X(VLayoutConverter::LayoutMinVer < FormatVersion(0, 1, 3),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VLayoutConverter::LayoutMinVer < FormatVersion(0, 1, 3), "Time to refactor the code.");
|
||||
|
||||
ConvertPiecesToV0_1_3();
|
||||
SetVersion(QStringLiteral("0.1.3"));
|
||||
|
|
|
@ -34,11 +34,11 @@
|
|||
#include <QDomText>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QGlobalStatic>
|
||||
#include <QLatin1String>
|
||||
#include <QList>
|
||||
#include <algorithm>
|
||||
#include <QGlobalStatic>
|
||||
#include <QUuid>
|
||||
#include <algorithm>
|
||||
|
||||
#include "../exception/vexception.h"
|
||||
#include "../exception/vexceptionemptyparameter.h"
|
||||
|
@ -46,6 +46,10 @@
|
|||
#include "../qmuparser/qmutokenparser.h"
|
||||
#include "../vmisc/def.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
#include "../vmisc/diagnostic.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
|
||||
class QDomElement;
|
||||
|
||||
/*
|
||||
|
@ -65,6 +69,9 @@ const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pa
|
|||
|
||||
namespace
|
||||
{
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
|
||||
|
||||
// The list of all string we use for conversion
|
||||
// Better to use global variables because repeating QStringLiteral blows up code size
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strUnit, (QLatin1String("unit"))) // NOLINT
|
||||
|
@ -106,7 +113,8 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, strIdTool, (QLatin1String("idTool"))) /
|
|||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strIdObject, (QLatin1String("idObject"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strChildren, (QLatin1String("children"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strChild, (QLatin1String("child"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPointOfIntersectionCurves, (QLatin1String("pointOfIntersectionCurves"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPointOfIntersectionCurves,
|
||||
(QLatin1String("pointOfIntersectionCurves"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCurveIntersectAxis, (QLatin1String("curveIntersectAxis"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCurve, (QLatin1String("curve"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCurve1, (QLatin1String("curve1"))) // NOLINT
|
||||
|
@ -114,7 +122,8 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCurve2, (QLatin1String("curve2"))) /
|
|||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strModelingPath, (QLatin1String("modelingPath"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strModelingSpline, (QLatin1String("modelingSpline"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPointFromArcAndTangent, (QLatin1String("pointFromArcAndTangent"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPointOfIntersectionArcs, (QLatin1String("pointOfIntersectionArcs"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPointOfIntersectionArcs,
|
||||
(QLatin1String("pointOfIntersectionArcs"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strFirstArc, (QLatin1String("firstArc"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strSecondArc, (QLatin1String("secondArc"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strDetail, (QLatin1String("detail"))) // NOLINT
|
||||
|
@ -170,6 +179,8 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, strFirstToCountour, (QLatin1String("fir
|
|||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strFirstToContour, (QLatin1String("firstToContour"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strLastToCountour, (QLatin1String("lastToCountour"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strLastToContour, (QLatin1String("lastToContour"))) // NOLINT
|
||||
|
||||
QT_WARNING_POP
|
||||
} // anonymous namespace
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -183,8 +194,7 @@ VPatternConverter::VPatternConverter(const QString &fileName)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VPatternConverter::XSDSchemas() -> QHash<unsigned int, QString>
|
||||
{
|
||||
static const auto schemas = QHash <unsigned, QString>
|
||||
{
|
||||
static const auto schemas = QHash<unsigned, QString>{
|
||||
std::make_pair(FormatVersion(0, 1, 4), QStringLiteral("://schema/pattern/v0.1.4.xsd")),
|
||||
std::make_pair(FormatVersion(0, 2, 0), QStringLiteral("://schema/pattern/v0.2.0.xsd")),
|
||||
std::make_pair(FormatVersion(0, 2, 1), QStringLiteral("://schema/pattern/v0.2.1.xsd")),
|
||||
|
@ -252,8 +262,7 @@ auto VPatternConverter::XSDSchemas() -> QHash<unsigned int, QString>
|
|||
std::make_pair(FormatVersion(0, 8, 13), QStringLiteral("://schema/pattern/v0.8.13.xsd")),
|
||||
std::make_pair(FormatVersion(0, 9, 0), QStringLiteral("://schema/pattern/v0.9.0.xsd")),
|
||||
std::make_pair(FormatVersion(0, 9, 1), QStringLiteral("://schema/pattern/v0.9.1.xsd")),
|
||||
std::make_pair(FormatVersion(0, 9, 2), CurrentSchema)
|
||||
};
|
||||
std::make_pair(FormatVersion(0, 9, 2), CurrentSchema)};
|
||||
|
||||
return schemas;
|
||||
}
|
||||
|
@ -391,8 +400,7 @@ void VPatternConverter::DowngradeToCurrentMaxVersion()
|
|||
auto VPatternConverter::IsReadOnly() const -> bool
|
||||
{
|
||||
// Check if attribute readOnly was not changed in file format
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == FormatVersion(0, 9, 2),
|
||||
"Check attribute readOnly.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == FormatVersion(0, 9, 2), "Check attribute readOnly.");
|
||||
|
||||
// Possibly in future attribute readOnly will change position etc.
|
||||
// For now position is the same for all supported format versions.
|
||||
|
@ -418,8 +426,7 @@ auto VPatternConverter::Schemas() const -> QHash<unsigned int, QString>
|
|||
void VPatternConverter::ToV0_2_0()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.2.0
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0), "Time to refactor the code.");
|
||||
|
||||
SetVersion(QStringLiteral("0.2.0"));
|
||||
TagUnitToV0_2_0();
|
||||
|
@ -433,8 +440,7 @@ void VPatternConverter::ToV0_2_0()
|
|||
void VPatternConverter::ToV0_2_1()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.2.1
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 1),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 1), "Time to refactor the code.");
|
||||
|
||||
SetVersion(QStringLiteral("0.2.1"));
|
||||
ConvertMeasurementsToV0_2_1();
|
||||
|
@ -445,8 +451,7 @@ void VPatternConverter::ToV0_2_1()
|
|||
void VPatternConverter::ToV0_2_4()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.2.4
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 4),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 4), "Time to refactor the code.");
|
||||
|
||||
FixToolUnionToV0_2_4();
|
||||
SetVersion(QStringLiteral("0.2.4"));
|
||||
|
@ -457,8 +462,7 @@ void VPatternConverter::ToV0_2_4()
|
|||
void VPatternConverter::ToV0_3_0()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.3.0
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 3, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 3, 0), "Time to refactor the code.");
|
||||
|
||||
// Cutting path do not create anymore subpaths
|
||||
FixCutPoint();
|
||||
|
@ -471,8 +475,7 @@ void VPatternConverter::ToV0_3_0()
|
|||
void VPatternConverter::ToV0_3_1()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.3.1
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 3, 1),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 3, 1), "Time to refactor the code.");
|
||||
|
||||
SetVersion(QStringLiteral("0.3.1"));
|
||||
RemoveColorToolCutV0_3_1();
|
||||
|
@ -483,8 +486,7 @@ void VPatternConverter::ToV0_3_1()
|
|||
void VPatternConverter::ToV0_4_0()
|
||||
{
|
||||
// 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.");
|
||||
|
||||
SetVersion(QStringLiteral("0.4.0"));
|
||||
TagRemoveAttributeTypeObjectInV0_4_0();
|
||||
|
@ -497,8 +499,7 @@ void VPatternConverter::ToV0_4_0()
|
|||
void VPatternConverter::ToV0_4_4()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.4.4
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 4, 4),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 4, 4), "Time to refactor the code.");
|
||||
|
||||
SetVersion(QStringLiteral("0.4.4"));
|
||||
LabelTagToV0_4_4(*strData);
|
||||
|
@ -510,8 +511,7 @@ void VPatternConverter::ToV0_4_4()
|
|||
void VPatternConverter::ToV0_6_0()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.6.0
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 6, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 6, 0), "Time to refactor the code.");
|
||||
SetVersion(QStringLiteral("0.6.0"));
|
||||
QDomElement label = AddTagPatternLabelV0_5_1();
|
||||
PortPatternLabeltoV0_6_0(label);
|
||||
|
@ -524,8 +524,7 @@ void VPatternConverter::ToV0_6_0()
|
|||
void VPatternConverter::ToV0_6_2()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.6.2
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 6, 2),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 6, 2), "Time to refactor the code.");
|
||||
SetVersion(QStringLiteral("0.6.2"));
|
||||
AddTagPreviewCalculationsV0_6_2();
|
||||
Save();
|
||||
|
@ -535,8 +534,7 @@ void VPatternConverter::ToV0_6_2()
|
|||
void VPatternConverter::ToV0_8_8()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.8.8
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 8, 8),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 8, 8), "Time to refactor the code.");
|
||||
SetVersion(QStringLiteral("0.8.8"));
|
||||
RemoveGradationV0_8_8();
|
||||
AddPieceUUIDV0_8_8();
|
||||
|
@ -547,8 +545,7 @@ void VPatternConverter::ToV0_8_8()
|
|||
void VPatternConverter::ToV0_9_0()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.9.0
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 9, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 9, 0), "Time to refactor the code.");
|
||||
|
||||
ConvertImageToV0_9_0();
|
||||
|
||||
|
@ -560,8 +557,7 @@ void VPatternConverter::ToV0_9_0()
|
|||
void VPatternConverter::ToV0_9_1()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.9.1
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 9, 1),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 9, 1), "Time to refactor the code.");
|
||||
|
||||
ConvertMeasurementsPathToV0_9_1();
|
||||
SetVersion(QStringLiteral("0.9.1"));
|
||||
|
@ -572,8 +568,7 @@ void VPatternConverter::ToV0_9_1()
|
|||
void VPatternConverter::ToV0_9_2()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.9.2
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 9, 2),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 9, 2), "Time to refactor the code.");
|
||||
|
||||
ConvertPathAttributesToV0_9_2();
|
||||
SetVersion(QStringLiteral("0.9.2"));
|
||||
|
@ -584,8 +579,7 @@ void VPatternConverter::ToV0_9_2()
|
|||
void VPatternConverter::TagUnitToV0_2_0()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.2.0
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0), "Time to refactor the code.");
|
||||
|
||||
QDomElement patternElement = documentElement();
|
||||
patternElement.insertAfter(CreateElementWithText(*strUnit, MUnitV0_1_4()),
|
||||
|
@ -596,8 +590,7 @@ void VPatternConverter::TagUnitToV0_2_0()
|
|||
void VPatternConverter::TagIncrementToV0_2_0()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.2.0
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0), "Time to refactor the code.");
|
||||
|
||||
const QSet<QString> names = FixIncrementsToV0_2_0();
|
||||
|
||||
|
@ -610,8 +603,7 @@ void VPatternConverter::TagIncrementToV0_2_0()
|
|||
void VPatternConverter::ConvertMeasurementsToV0_2_0()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.2.0
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0), "Time to refactor the code.");
|
||||
|
||||
const QMap<QString, QString> names = OldNamesToNewNames_InV0_2_0();
|
||||
ConvertPointExpressionsToV0_2_0(names);
|
||||
|
@ -623,8 +615,7 @@ void VPatternConverter::ConvertMeasurementsToV0_2_0()
|
|||
auto VPatternConverter::FixIncrementsToV0_2_0() -> QSet<QString>
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.2.0
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0), "Time to refactor the code.");
|
||||
|
||||
QSet<QString> names;
|
||||
const QDomElement incr = TagIncrementsV0_1_4();
|
||||
|
@ -669,8 +660,7 @@ auto VPatternConverter::FixIncrementsToV0_2_0() -> QSet<QString>
|
|||
void VPatternConverter::FixPointExpressionsToV0_2_0(const QSet<QString> &names)
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.2.0
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0), "Time to refactor the code.");
|
||||
|
||||
QString formula;
|
||||
const QDomNodeList list = elementsByTagName(*strPoint);
|
||||
|
@ -733,8 +723,7 @@ void VPatternConverter::FixPointExpressionsToV0_2_0(const QSet<QString> &names)
|
|||
void VPatternConverter::FixArcExpressionsToV0_2_0(const QSet<QString> &names)
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.2.0
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0), "Time to refactor the code.");
|
||||
|
||||
QString formula;
|
||||
const QDomNodeList list = elementsByTagName(*strArc);
|
||||
|
@ -788,8 +777,7 @@ void VPatternConverter::FixArcExpressionsToV0_2_0(const QSet<QString> &names)
|
|||
void VPatternConverter::FixPathPointExpressionsToV0_2_0(const QSet<QString> &names)
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.2.0
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0), "Time to refactor the code.");
|
||||
|
||||
QString formula;
|
||||
const QDomNodeList list = elementsByTagName(*strPathPoint);
|
||||
|
@ -833,8 +821,7 @@ void VPatternConverter::FixPathPointExpressionsToV0_2_0(const QSet<QString> &nam
|
|||
void VPatternConverter::ConvertPointExpressionsToV0_2_0(const QMap<QString, QString> &names)
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.2.0
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0), "Time to refactor the code.");
|
||||
|
||||
QString formula;
|
||||
const QDomNodeList list = elementsByTagName(*strPoint);
|
||||
|
@ -897,8 +884,7 @@ void VPatternConverter::ConvertPointExpressionsToV0_2_0(const QMap<QString, QStr
|
|||
void VPatternConverter::ConvertArcExpressionsToV0_2_0(const QMap<QString, QString> &names)
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.2.0
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0), "Time to refactor the code.");
|
||||
|
||||
QString formula;
|
||||
const QDomNodeList list = elementsByTagName(*strArc);
|
||||
|
@ -952,8 +938,7 @@ void VPatternConverter::ConvertArcExpressionsToV0_2_0(const QMap<QString, QStrin
|
|||
void VPatternConverter::ConvertPathPointExpressionsToV0_2_0(const QMap<QString, QString> &names)
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.2.0
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0), "Time to refactor the code.");
|
||||
|
||||
QString formula;
|
||||
const QDomNodeList list = elementsByTagName(*strPathPoint);
|
||||
|
@ -998,8 +983,7 @@ auto VPatternConverter::FixMeasurementInFormulaToV0_2_0(const QString &formula,
|
|||
-> QString
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.2.0
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0), "Time to refactor the code.");
|
||||
|
||||
QScopedPointer<qmu::QmuTokenParser> cal(new qmu::QmuTokenParser(formula, false, false)); // Eval formula
|
||||
QMap<vsizetype, QString> tokens = cal->GetTokens(); // Tokens (variables, measurements)
|
||||
|
@ -1032,8 +1016,7 @@ auto VPatternConverter::FixMeasurementInFormulaToV0_2_0(const QString &formula,
|
|||
auto VPatternConverter::FixIncrementInFormulaToV0_2_0(const QString &formula, const QSet<QString> &names) -> QString
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.2.0
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0), "Time to refactor the code.");
|
||||
|
||||
qmu::QmuTokenParser *cal = new qmu::QmuTokenParser(formula, false, false); // Eval formula
|
||||
QMap<vsizetype, QString> tokens = cal->GetTokens(); // Tokens (variables, measurements)
|
||||
|
@ -1066,8 +1049,7 @@ auto VPatternConverter::FixIncrementInFormulaToV0_2_0(const QString &formula, co
|
|||
void VPatternConverter::TagMeasurementsToV0_2_0()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.2.0
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0), "Time to refactor the code.");
|
||||
|
||||
QDomElement ms = TagMeasurementsV0_1_4();
|
||||
const QString path = GetParametrString(ms, *strPath);
|
||||
|
@ -1083,8 +1065,7 @@ void VPatternConverter::TagMeasurementsToV0_2_0()
|
|||
void VPatternConverter::ConvertMeasurementsToV0_2_1()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.2.1
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 1),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 1), "Time to refactor the code.");
|
||||
|
||||
const QMap<QString, QString> names = OldNamesToNewNames_InV0_2_1();
|
||||
|
||||
|
@ -1098,8 +1079,7 @@ void VPatternConverter::ConvertMeasurementsToV0_2_1()
|
|||
void VPatternConverter::RemoveColorToolCutV0_3_1()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.3.1
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 3, 1),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 3, 1), "Time to refactor the code.");
|
||||
|
||||
const QDomNodeList list = elementsByTagName(*strPoint);
|
||||
for (int i = 0; i < list.size(); ++i)
|
||||
|
@ -1120,8 +1100,7 @@ void VPatternConverter::RemoveColorToolCutV0_3_1()
|
|||
auto VPatternConverter::MUnitV0_1_4() const -> QString
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.2.0
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0), "Time to refactor the code.");
|
||||
|
||||
const QDomElement element = TagMeasurementsV0_1_4();
|
||||
try
|
||||
|
@ -1140,8 +1119,7 @@ auto VPatternConverter::MUnitV0_1_4() const -> QString
|
|||
auto VPatternConverter::TagMeasurementsV0_1_4() const -> QDomElement
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.2.0
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0), "Time to refactor the code.");
|
||||
|
||||
const QDomNodeList list = elementsByTagName(*strMeasurements);
|
||||
const QDomElement element = list.at(0).toElement();
|
||||
|
@ -1157,8 +1135,7 @@ auto VPatternConverter::TagMeasurementsV0_1_4() const -> QDomElement
|
|||
auto VPatternConverter::TagIncrementsV0_1_4() const -> QDomElement
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.2.0
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0), "Time to refactor the code.");
|
||||
|
||||
const QDomNodeList list = elementsByTagName(*strIncrements);
|
||||
const QDomElement element = list.at(0).toElement();
|
||||
|
@ -1174,8 +1151,7 @@ auto VPatternConverter::TagIncrementsV0_1_4() const -> QDomElement
|
|||
void VPatternConverter::FixToolUnionToV0_2_4()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.2.4
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 4),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 4), "Time to refactor the code.");
|
||||
|
||||
QDomElement root = documentElement();
|
||||
const QDomNodeList modelings = root.elementsByTagName(*strModeling);
|
||||
|
@ -1189,8 +1165,7 @@ void VPatternConverter::FixToolUnionToV0_2_4()
|
|||
void VPatternConverter::ParseModelingToV0_2_4(const QDomElement &modeling)
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.2.4
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 4),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 4), "Time to refactor the code.");
|
||||
|
||||
QDomElement node = modeling.firstChild().toElement();
|
||||
while (not node.isNull())
|
||||
|
@ -1228,8 +1203,7 @@ void VPatternConverter::ParseModelingToV0_2_4(const QDomElement &modeling)
|
|||
void VPatternConverter::SaveChildrenToolUnionToV0_2_4(quint32 id, const QVector<quint32> &children)
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.2.4
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 4),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 4), "Time to refactor the code.");
|
||||
|
||||
QDomElement toolUnion = elementById(id);
|
||||
if (toolUnion.isNull())
|
||||
|
@ -1251,8 +1225,7 @@ void VPatternConverter::SaveChildrenToolUnionToV0_2_4(quint32 id, const QVector<
|
|||
auto VPatternConverter::OldNamesToNewNames_InV0_2_0() -> QMap<QString, QString>
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.2.0
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0), "Time to refactor the code.");
|
||||
|
||||
// old name, new name
|
||||
QMap<QString, QString> names;
|
||||
|
@ -1431,8 +1404,7 @@ auto VPatternConverter::OldNamesToNewNames_InV0_2_0() -> QMap<QString, QString>
|
|||
auto VPatternConverter::OldNamesToNewNames_InV0_2_1() -> QMap<QString, QString>
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.2.1
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 1),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 1), "Time to refactor the code.");
|
||||
|
||||
// old name, new name
|
||||
QMap<QString, QString> names;
|
||||
|
@ -1446,9 +1418,7 @@ auto VPatternConverter::OldNamesToNewNames_InV0_2_1() -> QMap<QString, QString>
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternConverter::FixCutPoint()
|
||||
{
|
||||
const QStringList types = QStringList() << *strCutSplinePath
|
||||
<< *strCutSpline
|
||||
<< *strCutArc;
|
||||
const QStringList types = QStringList() << *strCutSplinePath << *strCutSpline << *strCutArc;
|
||||
|
||||
const QDomNodeList list = elementsByTagName(*strPoint);
|
||||
for (int i = 0; i < list.size(); ++i)
|
||||
|
@ -1490,11 +1460,8 @@ void VPatternConverter::FixCutPoint()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternConverter::FixSubPaths(int i, quint32 id, quint32 baseCurve)
|
||||
{
|
||||
const QStringList pointTypes = QStringList() << *strCutSplinePath
|
||||
<< *strCutSpline
|
||||
<< *strPointOfIntersectionCurves
|
||||
<< *strCurveIntersectAxis
|
||||
<< *strPointFromArcAndTangent
|
||||
const QStringList pointTypes = QStringList() << *strCutSplinePath << *strCutSpline << *strPointOfIntersectionCurves
|
||||
<< *strCurveIntersectAxis << *strPointFromArcAndTangent
|
||||
<< *strPointOfIntersectionArcs;
|
||||
|
||||
const QDomNodeList listPoints = elementsByTagName(*strPoint);
|
||||
|
@ -1578,8 +1545,7 @@ void VPatternConverter::FixSubPaths(int i, quint32 id, quint32 baseCurve)
|
|||
}
|
||||
}
|
||||
|
||||
const QStringList splTypes = QStringList() << *strModelingPath
|
||||
<< *strModelingSpline;
|
||||
const QStringList splTypes = QStringList() << *strModelingPath << *strModelingSpline;
|
||||
|
||||
const QDomNodeList listSplines = elementsByTagName(*strSpline);
|
||||
for (int j = 0; j < listSplines.size(); ++j)
|
||||
|
@ -1629,8 +1595,7 @@ void VPatternConverter::FixSubPaths(int i, quint32 id, quint32 baseCurve)
|
|||
void VPatternConverter::TagRemoveAttributeTypeObjectInV0_4_0()
|
||||
{
|
||||
// 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 QDomNodeList list = elementsByTagName(*strModeling);
|
||||
for (int i = 0; i < list.size(); ++i)
|
||||
|
@ -1659,8 +1624,7 @@ void VPatternConverter::TagRemoveAttributeTypeObjectInV0_4_0()
|
|||
void VPatternConverter::TagDetailToV0_4_0()
|
||||
{
|
||||
// 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 QDomNodeList list = elementsByTagName(*strDetail);
|
||||
for (int i = 0; i < list.size(); ++i)
|
||||
|
@ -1799,11 +1763,12 @@ auto VPatternConverter::GetUnionChildrenNodesV0_4_0(const QDomElement &detail) -
|
|||
void VPatternConverter::LabelTagToV0_4_4(const QString &tagName)
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.4.4
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 4, 4),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 4, 4), "Time to refactor the code.");
|
||||
|
||||
Unit unit = Unit::Cm;
|
||||
const QStringList units = QStringList() << "mm" << "cm" << "inch";
|
||||
const QStringList units = QStringList() << "mm"
|
||||
<< "cm"
|
||||
<< "inch";
|
||||
switch (units.indexOf(UniqueTagText(*strUnit)))
|
||||
{
|
||||
case 0: // mm
|
||||
|
@ -1851,23 +1816,14 @@ void VPatternConverter::LabelTagToV0_4_4(const QString &tagName)
|
|||
auto VPatternConverter::AddTagPatternLabelV0_5_1() -> QDomElement
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.6.0
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 6, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 6, 0), "Time to refactor the code.");
|
||||
|
||||
const QDomNodeList list = elementsByTagName(*strPatternLabel);
|
||||
if (list.isEmpty())
|
||||
{
|
||||
const QStringList tags = QStringList() << *strUnit
|
||||
<< *strImage
|
||||
<< *strAuthor
|
||||
<< *strDescription
|
||||
<< *strNotes
|
||||
<< *strGradation
|
||||
<< *strPatternName
|
||||
<< *strPatternNum
|
||||
<< *strCompanyName
|
||||
<< *strCustomerName
|
||||
<< *strPatternLabel;
|
||||
const QStringList tags = QStringList() << *strUnit << *strImage << *strAuthor << *strDescription << *strNotes
|
||||
<< *strGradation << *strPatternName << *strPatternNum << *strCompanyName
|
||||
<< *strCustomerName << *strPatternLabel;
|
||||
|
||||
QDomElement element = createElement(*strPatternLabel);
|
||||
QDomElement pattern = documentElement();
|
||||
|
@ -1889,8 +1845,7 @@ auto VPatternConverter::AddTagPatternLabelV0_5_1() -> QDomElement
|
|||
void VPatternConverter::PortPatternLabeltoV0_6_0(QDomElement &label)
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.6.0
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 6, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 6, 0), "Time to refactor the code.");
|
||||
|
||||
if (not UniqueTagText(*strCompanyName).isEmpty())
|
||||
{
|
||||
|
@ -1942,8 +1897,7 @@ void VPatternConverter::AddLabelTemplateLineV0_6_0(QDomElement &label, const QSt
|
|||
int alignment, int fontSizeIncrement)
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.6.0
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 6, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 6, 0), "Time to refactor the code.");
|
||||
|
||||
QDomElement tagLine = createElement(*strLine);
|
||||
|
||||
|
@ -1960,8 +1914,7 @@ void VPatternConverter::AddLabelTemplateLineV0_6_0(QDomElement &label, const QSt
|
|||
void VPatternConverter::PortPieceLabelstoV0_6_0()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.6.0
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 6, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 6, 0), "Time to refactor the code.");
|
||||
|
||||
const QDomNodeList nodeList = elementsByTagName(*strData);
|
||||
for (int i = 0; i < nodeList.size(); ++i)
|
||||
|
@ -1977,7 +1930,8 @@ void VPatternConverter::PortPieceLabelstoV0_6_0()
|
|||
}
|
||||
}
|
||||
catch (const VExceptionEmptyParameter &)
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
AddLabelTemplateLineV0_6_0(dataTag, "%pName%", true, false, Qt::AlignHCenter, 2);
|
||||
|
||||
|
@ -2048,8 +2002,7 @@ void VPatternConverter::PortPieceLabelstoV0_6_0()
|
|||
void VPatternConverter::RemoveUnusedTagsV0_6_0()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.6.0
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 6, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 6, 0), "Time to refactor the code.");
|
||||
|
||||
RemoveUniqueTagV0_6_0(*strAuthor);
|
||||
RemoveUniqueTagV0_6_0(*strSize);
|
||||
|
@ -2072,8 +2025,7 @@ void VPatternConverter::RemoveUnusedTagsV0_6_0()
|
|||
void VPatternConverter::RemoveUniqueTagV0_6_0(const QString &tag)
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.6.0
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 6, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 6, 0), "Time to refactor the code.");
|
||||
|
||||
const QDomNodeList nodeList = elementsByTagName(tag);
|
||||
if (nodeList.isEmpty())
|
||||
|
@ -2089,8 +2041,7 @@ void VPatternConverter::RemoveUniqueTagV0_6_0(const QString &tag)
|
|||
void VPatternConverter::AddTagPreviewCalculationsV0_6_2()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.6.2
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 6, 2),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 6, 2), "Time to refactor the code.");
|
||||
|
||||
const QDomNodeList list = elementsByTagName(*strIncrements);
|
||||
if (not list.isEmpty())
|
||||
|
@ -2118,8 +2069,7 @@ void VPatternConverter::RemoveGradationV0_8_8()
|
|||
void VPatternConverter::AddPieceUUIDV0_8_8()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.8.8
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 8, 8),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 8, 8), "Time to refactor the code.");
|
||||
|
||||
const QDomNodeList list = elementsByTagName(*strDetail);
|
||||
for (int i = 0; i < list.size(); ++i)
|
||||
|
@ -2137,8 +2087,7 @@ void VPatternConverter::AddPieceUUIDV0_8_8()
|
|||
void VPatternConverter::ConvertImageToV0_9_0()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.9.0
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 9, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 9, 0), "Time to refactor the code.");
|
||||
|
||||
const QDomNodeList list = elementsByTagName(*strImage);
|
||||
if (not list.isEmpty())
|
||||
|
@ -2151,11 +2100,7 @@ void VPatternConverter::ConvertImageToV0_9_0()
|
|||
|
||||
if (not extension.isEmpty())
|
||||
{
|
||||
QMap<QString, QString> mimeTypes{
|
||||
{"BMP", "image/bmp"},
|
||||
{"JPG", "image/jpeg"},
|
||||
{"PNG", "image/png"}
|
||||
};
|
||||
QMap<QString, QString> mimeTypes{{"BMP", "image/bmp"}, {"JPG", "image/jpeg"}, {"PNG", "image/png"}};
|
||||
|
||||
if (mimeTypes.contains(extension))
|
||||
{
|
||||
|
@ -2192,8 +2137,7 @@ void VPatternConverter::ConvertImageToV0_9_0()
|
|||
void VPatternConverter::ConvertMeasurementsPathToV0_9_1()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.9.1
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 9, 1),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 9, 1), "Time to refactor the code.");
|
||||
|
||||
const QDomNodeList nodeList = this->elementsByTagName(*strMeasurements);
|
||||
if (nodeList.isEmpty())
|
||||
|
@ -2225,8 +2169,7 @@ void VPatternConverter::ConvertMeasurementsPathToV0_9_1()
|
|||
void VPatternConverter::ConvertPathAttributesToV0_9_2()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.9.2
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 9, 2),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 9, 2), "Time to refactor the code.");
|
||||
|
||||
const QDomNodeList paths = this->elementsByTagName(*strPath);
|
||||
for (int i = 0; i < paths.size(); ++i)
|
||||
|
@ -2256,8 +2199,7 @@ void VPatternConverter::ConvertPathAttributesToV0_9_2()
|
|||
void VPatternConverter::TagUnionDetailsToV0_4_0()
|
||||
{
|
||||
// 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 QDomNodeList list = elementsByTagName(*strTools);
|
||||
for (int i = 0; i < list.size(); ++i)
|
||||
|
|
|
@ -32,16 +32,18 @@
|
|||
#include <QDomNodeList>
|
||||
#include <QDomText>
|
||||
#include <QFile>
|
||||
#include <QGlobalStatic>
|
||||
#include <QLatin1String>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QMultiMap>
|
||||
#include <QGlobalStatic>
|
||||
|
||||
#include "../exception/vexception.h"
|
||||
#include "../vmisc/def.h"
|
||||
#include "vabstractmconverter.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
#include "../vmisc/diagnostic.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
|
||||
/*
|
||||
* Version rules:
|
||||
* 1. Version have three parts "major.minor.patch";
|
||||
|
@ -59,6 +61,9 @@ const QString VVITConverter::CurrentSchema = QStringLiteral("://schema/in
|
|||
|
||||
namespace
|
||||
{
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
|
||||
|
||||
// The list of all string we use for conversion
|
||||
// Better to use global variables because repeating QStringLiteral blows up code size
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strTagRead_Only, (QLatin1String("read-only"))) // NOLINT
|
||||
|
@ -66,7 +71,9 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, strGivenName, (QLatin1String("given-nam
|
|||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strFamilyName, (QLatin1String("family-name"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCustomer, (QLatin1String("customer"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPersonal, (QLatin1String("personal"))) // NOLINT
|
||||
}
|
||||
|
||||
QT_WARNING_POP
|
||||
} // namespace
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VVITConverter::VVITConverter(const QString &fileName)
|
||||
|
@ -78,8 +85,7 @@ VVITConverter::VVITConverter(const QString &fileName)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VVITConverter::XSDSchemas() -> QHash<unsigned int, QString>
|
||||
{
|
||||
static auto schemas = QHash <unsigned, QString>
|
||||
{
|
||||
static auto schemas = QHash<unsigned, QString>{
|
||||
std::make_pair(FormatVersion(0, 2, 0), QStringLiteral("://schema/individual_measurements/v0.2.0.xsd")),
|
||||
std::make_pair(FormatVersion(0, 3, 0), QStringLiteral("://schema/individual_measurements/v0.3.0.xsd")),
|
||||
std::make_pair(FormatVersion(0, 3, 1), QStringLiteral("://schema/individual_measurements/v0.3.1.xsd")),
|
||||
|
@ -139,8 +145,7 @@ void VVITConverter::DowngradeToCurrentMaxVersion()
|
|||
auto VVITConverter::IsReadOnly() const -> bool
|
||||
{
|
||||
// Check if attribute read-only was not changed in file format
|
||||
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMaxVer == FormatVersion(0, 5, 2),
|
||||
"Check attribute read-only.");
|
||||
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMaxVer == FormatVersion(0, 5, 2), "Check attribute read-only.");
|
||||
|
||||
// Possibly in future attribute read-only will change position etc.
|
||||
// For now position is the same for all supported format versions.
|
||||
|
@ -159,8 +164,7 @@ auto VVITConverter::Schemas() const -> QHash<unsigned int, QString>
|
|||
void VVITConverter::AddNewTagsForV0_3_0()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.3.0
|
||||
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMinVer < FormatVersion(0, 3, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMinVer < FormatVersion(0, 3, 0), "Time to refactor the code.");
|
||||
|
||||
QDomElement rootElement = this->documentElement();
|
||||
QDomNode refChild = rootElement.firstChildElement(QStringLiteral("version"));
|
||||
|
@ -175,8 +179,7 @@ void VVITConverter::AddNewTagsForV0_3_0()
|
|||
auto VVITConverter::MUnitV0_2_0() -> QString
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.3.0
|
||||
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMinVer < FormatVersion(0, 3, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMinVer < FormatVersion(0, 3, 0), "Time to refactor the code.");
|
||||
|
||||
return UniqueTagText(QStringLiteral("unit"), QStringLiteral("cm"));
|
||||
}
|
||||
|
@ -185,8 +188,7 @@ auto VVITConverter::MUnitV0_2_0() -> QString
|
|||
void VVITConverter::ConvertMeasurementsToV0_3_0()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.3.0
|
||||
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMinVer < FormatVersion(0, 3, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMinVer < FormatVersion(0, 3, 0), "Time to refactor the code.");
|
||||
|
||||
const QString tagBM = QStringLiteral("body-measurements");
|
||||
|
||||
|
@ -228,8 +230,7 @@ void VVITConverter::ConvertMeasurementsToV0_3_0()
|
|||
auto VVITConverter::AddMV0_3_0(const QString &name, qreal value) -> QDomElement
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.3.0
|
||||
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMinVer < FormatVersion(0, 3, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMinVer < FormatVersion(0, 3, 0), "Time to refactor the code.");
|
||||
|
||||
QDomElement element = createElement(QStringLiteral("m"));
|
||||
|
||||
|
@ -245,8 +246,7 @@ auto VVITConverter::AddMV0_3_0(const QString &name, qreal value) -> QDomElement
|
|||
void VVITConverter::GenderV0_3_1()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.3.1
|
||||
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMinVer < FormatVersion(0, 3, 1),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMinVer < FormatVersion(0, 3, 1), "Time to refactor the code.");
|
||||
|
||||
const QDomNodeList nodeList = this->elementsByTagName(QStringLiteral("sex"));
|
||||
QDomElement sex = nodeList.at(0).toElement();
|
||||
|
@ -258,8 +258,7 @@ void VVITConverter::GenderV0_3_1()
|
|||
void VVITConverter::PM_SystemV0_3_2()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.3.2
|
||||
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMinVer < FormatVersion(0, 3, 2),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMinVer < FormatVersion(0, 3, 2), "Time to refactor the code.");
|
||||
|
||||
const QDomNodeList nodeList = this->elementsByTagName(QStringLiteral("personal"));
|
||||
QDomElement personal = nodeList.at(0).toElement();
|
||||
|
@ -272,8 +271,7 @@ void VVITConverter::PM_SystemV0_3_2()
|
|||
void VVITConverter::ConvertMeasurementsToV0_3_3()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.3.3
|
||||
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMinVer < FormatVersion(0, 3, 3),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMinVer < FormatVersion(0, 3, 3), "Time to refactor the code.");
|
||||
|
||||
const QMap<QString, QString> names = OldNamesToNewNames_InV0_3_3();
|
||||
auto i = names.constBegin();
|
||||
|
@ -355,8 +353,7 @@ void VVITConverter::ConverCustomerNameToV0_4_0()
|
|||
void VVITConverter::ToV0_3_0()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.3.0
|
||||
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMinVer < FormatVersion(0, 3, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMinVer < FormatVersion(0, 3, 0), "Time to refactor the code.");
|
||||
|
||||
AddRootComment();
|
||||
SetVersion(QStringLiteral("0.3.0"));
|
||||
|
@ -369,8 +366,7 @@ void VVITConverter::ToV0_3_0()
|
|||
void VVITConverter::ToV0_3_1()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.3.1
|
||||
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMinVer < FormatVersion(0, 3, 1),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMinVer < FormatVersion(0, 3, 1), "Time to refactor the code.");
|
||||
|
||||
SetVersion(QStringLiteral("0.3.1"));
|
||||
GenderV0_3_1();
|
||||
|
@ -381,8 +377,7 @@ void VVITConverter::ToV0_3_1()
|
|||
void VVITConverter::ToV0_3_2()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.3.2
|
||||
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMinVer < FormatVersion(0, 3, 2),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMinVer < FormatVersion(0, 3, 2), "Time to refactor the code.");
|
||||
|
||||
SetVersion(QStringLiteral("0.3.2"));
|
||||
PM_SystemV0_3_2();
|
||||
|
@ -393,8 +388,7 @@ void VVITConverter::ToV0_3_2()
|
|||
void VVITConverter::ToV0_3_3()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.3.3
|
||||
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMinVer < FormatVersion(0, 3, 3),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMinVer < FormatVersion(0, 3, 3), "Time to refactor the code.");
|
||||
|
||||
SetVersion(QStringLiteral("0.3.3"));
|
||||
ConvertMeasurementsToV0_3_3();
|
||||
|
@ -405,8 +399,7 @@ void VVITConverter::ToV0_3_3()
|
|||
void VVITConverter::ToV0_4_0()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.4.0
|
||||
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMinVer < FormatVersion(0, 4, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMinVer < FormatVersion(0, 4, 0), "Time to refactor the code.");
|
||||
|
||||
SetVersion(QStringLiteral("0.4.0"));
|
||||
ConverCustomerNameToV0_4_0();
|
||||
|
@ -417,8 +410,7 @@ void VVITConverter::ToV0_4_0()
|
|||
void VVITConverter::ToV0_5_2()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.5.2
|
||||
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMinVer < FormatVersion(0, 5, 2),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMinVer < FormatVersion(0, 5, 2), "Time to refactor the code.");
|
||||
|
||||
SetVersion(QStringLiteral("0.5.2"));
|
||||
Save();
|
||||
|
|
|
@ -32,16 +32,19 @@
|
|||
#include <QDomNodeList>
|
||||
#include <QDomText>
|
||||
#include <QFile>
|
||||
#include <QGlobalStatic>
|
||||
#include <QLatin1String>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QMultiMap>
|
||||
#include <QGlobalStatic>
|
||||
|
||||
#include "../exception/vexception.h"
|
||||
#include "../vmisc/def.h"
|
||||
#include "vabstractmconverter.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
#include "../vmisc/diagnostic.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
|
||||
/*
|
||||
* Version rules:
|
||||
* 1. Version have three parts "major.minor.patch";
|
||||
|
@ -59,11 +62,16 @@ const QString VVSTConverter::CurrentSchema = QStringLiteral("://schema/mu
|
|||
|
||||
namespace
|
||||
{
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strTagRead_Only, (QLatin1String("read-only"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAttrCircumference, (QLatin1String("circumference"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAttrMeasurement, (QLatin1String("measurement"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strTagDimension, (QLatin1String("dimension"))) // NOLINT
|
||||
}
|
||||
|
||||
QT_WARNING_POP
|
||||
} // namespace
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VVSTConverter::VVSTConverter(const QString &fileName)
|
||||
|
@ -75,8 +83,7 @@ VVSTConverter::VVSTConverter(const QString &fileName)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VVSTConverter::XSDSchemas() -> QHash<unsigned int, QString>
|
||||
{
|
||||
static auto schemas = QHash <unsigned, QString>
|
||||
{
|
||||
static auto schemas = QHash<unsigned, QString>{
|
||||
std::make_pair(FormatVersion(0, 3, 0), QStringLiteral("://schema/multisize_measurements/v0.3.0.xsd")),
|
||||
std::make_pair(FormatVersion(0, 4, 0), QStringLiteral("://schema/multisize_measurements/v0.4.0.xsd")),
|
||||
std::make_pair(FormatVersion(0, 4, 1), QStringLiteral("://schema/multisize_measurements/v0.4.1.xsd")),
|
||||
|
@ -138,8 +145,7 @@ void VVSTConverter::DowngradeToCurrentMaxVersion()
|
|||
auto VVSTConverter::IsReadOnly() const -> bool
|
||||
{
|
||||
// Check if attribute read-only was not changed in file format
|
||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMaxVer == FormatVersion(0, 5, 4),
|
||||
"Check attribute read-only.");
|
||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMaxVer == FormatVersion(0, 5, 4), "Check attribute read-only.");
|
||||
|
||||
// Possibly in future attribute read-only will change position etc.
|
||||
// For now position is the same for all supported format versions.
|
||||
|
@ -158,24 +164,22 @@ auto VVSTConverter::Schemas() const -> QHash<unsigned int, QString>
|
|||
void VVSTConverter::AddNewTagsForV0_4_0()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.4.0
|
||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FormatVersion(0, 4, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FormatVersion(0, 4, 0), "Time to refactor the code.");
|
||||
|
||||
QDomElement rootElement = this->documentElement();
|
||||
QDomNode refChild = rootElement.firstChildElement(QStringLiteral("version"));
|
||||
|
||||
refChild = rootElement.insertAfter(CreateElementWithText(QStringLiteral("read-only"), falseStr), refChild);
|
||||
|
||||
rootElement.insertAfter(CreateElementWithText(QStringLiteral("notes"),
|
||||
UniqueTagText(QStringLiteral("description"))), refChild);
|
||||
rootElement.insertAfter(
|
||||
CreateElementWithText(QStringLiteral("notes"), UniqueTagText(QStringLiteral("description"))), refChild);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VVSTConverter::RemoveTagsForV0_4_0()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.4.0
|
||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FormatVersion(0, 4, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FormatVersion(0, 4, 0), "Time to refactor the code.");
|
||||
|
||||
QDomElement rootElement = this->documentElement();
|
||||
|
||||
|
@ -200,8 +204,7 @@ void VVSTConverter::RemoveTagsForV0_4_0()
|
|||
void VVSTConverter::ConvertMeasurementsToV0_4_0()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.4.0
|
||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FormatVersion(0, 4, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FormatVersion(0, 4, 0), "Time to refactor the code.");
|
||||
|
||||
const QString tagBM = QStringLiteral("body-measurements");
|
||||
|
||||
|
@ -251,8 +254,7 @@ auto VVSTConverter::AddMV0_4_0(const QString &name, qreal value, qreal sizeIncre
|
|||
-> QDomElement
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.4.0
|
||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FormatVersion(0, 4, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FormatVersion(0, 4, 0), "Time to refactor the code.");
|
||||
|
||||
QDomElement element = createElement(QStringLiteral("m"));
|
||||
|
||||
|
@ -270,8 +272,7 @@ auto VVSTConverter::AddMV0_4_0(const QString &name, qreal value, qreal sizeIncre
|
|||
void VVSTConverter::PM_SystemV0_4_1()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.4.1
|
||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FormatVersion(0, 4, 1),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FormatVersion(0, 4, 1), "Time to refactor the code.");
|
||||
|
||||
const QDomNodeList nodeList = this->elementsByTagName(QStringLiteral("size"));
|
||||
QDomElement personal = nodeList.at(0).toElement();
|
||||
|
@ -284,8 +285,7 @@ void VVSTConverter::PM_SystemV0_4_1()
|
|||
void VVSTConverter::ConvertMeasurementsToV0_4_2()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.4.2
|
||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FormatVersion(0, 4, 2),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FormatVersion(0, 4, 2), "Time to refactor the code.");
|
||||
|
||||
const QMap<QString, QString> names = OldNamesToNewNames_InV0_3_3();
|
||||
auto i = names.constBegin();
|
||||
|
@ -317,8 +317,7 @@ void VVSTConverter::ConvertMeasurementsToV0_4_2()
|
|||
void VVSTConverter::AddNewTagsForV0_5_0()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.5.0
|
||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FormatVersion(0, 5, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FormatVersion(0, 5, 0), "Time to refactor the code.");
|
||||
|
||||
QDomElement root = documentElement();
|
||||
const QDomElement pmSystemTag = root.firstChildElement(QStringLiteral("pm_system"));
|
||||
|
@ -381,8 +380,7 @@ void VVSTConverter::AddNewTagsForV0_5_0()
|
|||
void VVSTConverter::RemoveTagsForV0_5_0()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.5.0
|
||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FormatVersion(0, 5, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FormatVersion(0, 5, 0), "Time to refactor the code.");
|
||||
|
||||
QDomElement root = documentElement();
|
||||
|
||||
|
@ -403,8 +401,7 @@ void VVSTConverter::RemoveTagsForV0_5_0()
|
|||
void VVSTConverter::ConvertMeasurementsToV0_5_0()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.5.0
|
||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FormatVersion(0, 5, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FormatVersion(0, 5, 0), "Time to refactor the code.");
|
||||
|
||||
const QDomNodeList measurements = elementsByTagName(QStringLiteral("m"));
|
||||
for (int i = 0; i < measurements.size(); ++i)
|
||||
|
@ -439,8 +436,7 @@ void VVSTConverter::ConvertCircumferenceAttreibuteToV0_5_4()
|
|||
void VVSTConverter::ToV0_4_0()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.4.0
|
||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FormatVersion(0, 4, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FormatVersion(0, 4, 0), "Time to refactor the code.");
|
||||
|
||||
AddRootComment();
|
||||
SetVersion(QStringLiteral("0.4.0"));
|
||||
|
@ -454,8 +450,7 @@ void VVSTConverter::ToV0_4_0()
|
|||
void VVSTConverter::ToV0_4_1()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.4.1
|
||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FormatVersion(0, 4, 1),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FormatVersion(0, 4, 1), "Time to refactor the code.");
|
||||
|
||||
SetVersion(QStringLiteral("0.4.1"));
|
||||
PM_SystemV0_4_1();
|
||||
|
@ -466,8 +461,7 @@ void VVSTConverter::ToV0_4_1()
|
|||
void VVSTConverter::ToV0_4_2()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.4.2
|
||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FormatVersion(0, 4, 2),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FormatVersion(0, 4, 2), "Time to refactor the code.");
|
||||
|
||||
SetVersion(QStringLiteral("0.4.2"));
|
||||
ConvertMeasurementsToV0_4_2();
|
||||
|
@ -478,8 +472,7 @@ void VVSTConverter::ToV0_4_2()
|
|||
void VVSTConverter::ToV0_5_0()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.5.0
|
||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FormatVersion(0, 5, 0),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FormatVersion(0, 5, 0), "Time to refactor the code.");
|
||||
|
||||
SetVersion(QStringLiteral("0.5.0"));
|
||||
AddNewTagsForV0_5_0();
|
||||
|
@ -492,8 +485,7 @@ void VVSTConverter::ToV0_5_0()
|
|||
void VVSTConverter::ToV0_5_4()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.5.4
|
||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FormatVersion(0, 5, 4),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FormatVersion(0, 5, 4), "Time to refactor the code.");
|
||||
|
||||
SetVersion(QStringLiteral("0.5.4"));
|
||||
ConvertCircumferenceAttreibuteToV0_5_4();
|
||||
|
|
|
@ -54,19 +54,23 @@
|
|||
#include <QTextCodec>
|
||||
#endif
|
||||
|
||||
#include "../vmisc/def.h"
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
#include "../vmisc/diagnostic.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
|
||||
#include "../vgeometry/vgeometrydef.h"
|
||||
#include "../vgeometry/vlayoutplacelabel.h"
|
||||
#include "../vlayout/vlayoutpiece.h"
|
||||
#include "../vlayout/vlayoutpoint.h"
|
||||
#include "../vmisc/def.h"
|
||||
#include "dxiface.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
static const qreal AAMATextHeight = 2.5;
|
||||
const qreal AAMATextHeight = 2.5;
|
||||
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer0, (UTF8STRING("0"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer1, (UTF8STRING("1"))) // NOLINT
|
||||
|
@ -95,6 +99,8 @@
|
|||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer86, (UTF8STRING("86"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer87, (UTF8STRING("87"))) // NOLINT
|
||||
|
||||
QT_WARNING_POP
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto PieceOutline(const VLayoutPiece &detail) -> QVector<VLayoutPoint>
|
||||
{
|
||||
|
@ -118,11 +124,8 @@ QT_WARNING_PUSH
|
|||
QT_WARNING_DISABLE_CLANG("-Wsign-conversion")
|
||||
QT_WARNING_DISABLE_INTEL(68)
|
||||
|
||||
return {QPaintEngine::AllFeatures
|
||||
& ~QPaintEngine::PatternBrush
|
||||
& ~QPaintEngine::PerspectiveTransform
|
||||
& ~QPaintEngine::ConicalGradientFill
|
||||
& ~QPaintEngine::PorterDuff};
|
||||
return {QPaintEngine::AllFeatures & ~QPaintEngine::PatternBrush & ~QPaintEngine::PerspectiveTransform &
|
||||
~QPaintEngine::ConicalGradientFill & ~QPaintEngine::PorterDuff};
|
||||
|
||||
QT_WARNING_POP
|
||||
}
|
||||
|
@ -157,8 +160,8 @@ auto VDxfEngine::begin(QPaintDevice *pdev) -> bool
|
|||
return false;
|
||||
}
|
||||
|
||||
m_input = QSharedPointer<dx_iface>(new dx_iface(GetFileNameForLocale(), m_version, m_varMeasurement,
|
||||
m_varInsunits));
|
||||
m_input =
|
||||
QSharedPointer<dx_iface>(new dx_iface(GetFileNameForLocale(), m_version, m_varMeasurement, m_varInsunits));
|
||||
m_input->AddDefHeaderData();
|
||||
m_input->AddQtLTypes();
|
||||
m_input->AddDefLayers();
|
||||
|
@ -180,7 +183,6 @@ void VDxfEngine::updateState(const QPaintEngineState &state)
|
|||
// always stream full gstate, which is not required, but...
|
||||
flags |= QPaintEngine::AllDirty;
|
||||
|
||||
|
||||
if (flags & QPaintEngine::DirtyTransform)
|
||||
{
|
||||
m_matrix = state.transform(); // Save new matrix for moving paths
|
||||
|
@ -256,10 +258,10 @@ void VDxfEngine::drawLines(const QLineF *lines, int lineCount)
|
|||
const QPointF p2 = m_matrix.map(lines[i].p2()); // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic)
|
||||
|
||||
auto *line = new DRW_Line();
|
||||
line->basePoint = DRW_Coord(FromPixel(p1.x(), m_varInsunits),
|
||||
FromPixel(GetSize().height() - p1.y(), m_varInsunits), 0);
|
||||
line->secPoint = DRW_Coord(FromPixel(p2.x(), m_varInsunits),
|
||||
FromPixel(GetSize().height() - p2.y(), m_varInsunits), 0);
|
||||
line->basePoint =
|
||||
DRW_Coord(FromPixel(p1.x(), m_varInsunits), FromPixel(GetSize().height() - p1.y(), m_varInsunits), 0);
|
||||
line->secPoint =
|
||||
DRW_Coord(FromPixel(p2.x(), m_varInsunits), FromPixel(GetSize().height() - p2.y(), m_varInsunits), 0);
|
||||
line->layer = *layer0;
|
||||
line->color = GetPenColor();
|
||||
line->lWeight = DRW_LW_Conv::widthByLayer;
|
||||
|
@ -293,7 +295,8 @@ void VDxfEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawM
|
|||
poly->lWeight = DRW_LW_Conv::widthByLayer;
|
||||
poly->lineType = GetPenStyle();
|
||||
|
||||
if (pointCount > 1 && points[0] == points[pointCount]) // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic)
|
||||
if (pointCount > 1 &&
|
||||
points[0] == points[pointCount]) // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic)
|
||||
{
|
||||
poly->flags |= 0x1; // closed NOLINT(hicpp-signed-bitwise)
|
||||
}
|
||||
|
@ -303,8 +306,8 @@ void VDxfEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawM
|
|||
for (int i = 0; i < pointCount; ++i)
|
||||
{
|
||||
const QPointF p = m_matrix.map(points[i]); // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic)
|
||||
poly->addVertex(DRW_Vertex2D(FromPixel(p.x(), m_varInsunits),
|
||||
FromPixel(GetSize().height() - p.y(), m_varInsunits), 0));
|
||||
poly->addVertex(
|
||||
DRW_Vertex2D(FromPixel(p.x(), m_varInsunits), FromPixel(GetSize().height() - p.y(), m_varInsunits), 0));
|
||||
}
|
||||
|
||||
m_input->AddEntity(poly);
|
||||
|
@ -317,7 +320,8 @@ void VDxfEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawM
|
|||
poly->lWeight = DRW_LW_Conv::widthByLayer;
|
||||
poly->lineType = GetPenStyle();
|
||||
|
||||
if (pointCount > 1 && points[0] == points[pointCount]) // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic)
|
||||
if (pointCount > 1 &&
|
||||
points[0] == points[pointCount]) // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic)
|
||||
{
|
||||
poly->flags |= 0x1; // closed NOLINT(hicpp-signed-bitwise)
|
||||
}
|
||||
|
@ -807,8 +811,8 @@ void VDxfEngine::ExportAAMADraw(const QSharedPointer<dx_ifaceBlock> &detailBlock
|
|||
const QVector<VLayoutPlaceLabel> labels = detail.GetPlaceLabels();
|
||||
for (const auto &label : labels)
|
||||
{
|
||||
if (label.Type() != PlaceLabelType::Doubletree && label.Type() != PlaceLabelType::Button
|
||||
&& label.Type() != PlaceLabelType::Circle)
|
||||
if (label.Type() != PlaceLabelType::Doubletree && label.Type() != PlaceLabelType::Button &&
|
||||
label.Type() != PlaceLabelType::Circle)
|
||||
{
|
||||
PlaceLabelImg shape = detail.MapPlaceLabelShape(VAbstractPiece::PlaceLabelShape(label));
|
||||
for (const auto &points : shape)
|
||||
|
@ -916,8 +920,8 @@ void VDxfEngine::ExportAAMADrill(const QSharedPointer<dx_ifaceBlock> &detailBloc
|
|||
|
||||
for (const auto &label : labels)
|
||||
{
|
||||
if (label.Type() == PlaceLabelType::Doubletree || label.Type() == PlaceLabelType::Button
|
||||
|| label.Type() == PlaceLabelType::Circle)
|
||||
if (label.Type() == PlaceLabelType::Doubletree || label.Type() == PlaceLabelType::Button ||
|
||||
label.Type() == PlaceLabelType::Circle)
|
||||
{
|
||||
const QPointF center = detail.GetMatrix().map(label.Center());
|
||||
detailBlock->ent.push_back(AAMAPoint(center, *layer13));
|
||||
|
@ -934,8 +938,8 @@ auto VDxfEngine::ExportToASTM(const QVector<VLayoutPiece> &details) -> bool
|
|||
return false;
|
||||
}
|
||||
|
||||
m_input = QSharedPointer<dx_iface>(new dx_iface(GetFileNameForLocale(), m_version, m_varMeasurement,
|
||||
m_varInsunits));
|
||||
m_input =
|
||||
QSharedPointer<dx_iface>(new dx_iface(GetFileNameForLocale(), m_version, m_varMeasurement, m_varInsunits));
|
||||
m_input->AddXSpaceBlock(false);
|
||||
m_input->AddAAMAHeaderData();
|
||||
if (m_version > DRW::AC1009)
|
||||
|
@ -1064,8 +1068,8 @@ void VDxfEngine::ExportASTMInternalLine(const QSharedPointer<dx_ifaceBlock> &det
|
|||
const QVector<VLayoutPlaceLabel> labels = detail.GetPlaceLabels();
|
||||
for (const auto &label : labels)
|
||||
{
|
||||
if (label.Type() != PlaceLabelType::Doubletree && label.Type() != PlaceLabelType::Button
|
||||
&& label.Type() != PlaceLabelType::Circle)
|
||||
if (label.Type() != PlaceLabelType::Doubletree && label.Type() != PlaceLabelType::Button &&
|
||||
label.Type() != PlaceLabelType::Circle)
|
||||
{
|
||||
PlaceLabelImg shape = detail.MapPlaceLabelShape(VAbstractPiece::PlaceLabelShape(label));
|
||||
for (const auto &p : shape)
|
||||
|
@ -1129,8 +1133,8 @@ void VDxfEngine::ExportASTMDrill(const QSharedPointer<dx_ifaceBlock> &detailBloc
|
|||
|
||||
for (const auto &label : labels)
|
||||
{
|
||||
if (label.Type() == PlaceLabelType::Doubletree || label.Type() == PlaceLabelType::Button
|
||||
|| label.Type() == PlaceLabelType::Circle)
|
||||
if (label.Type() == PlaceLabelType::Doubletree || label.Type() == PlaceLabelType::Button ||
|
||||
label.Type() == PlaceLabelType::Circle)
|
||||
{
|
||||
const QPointF center = detail.GetMatrix().map(label.Center());
|
||||
QLineF diameter = detail.GetMatrix().map(QLineF(label.Box().bottomLeft(), label.Box().topRight()));
|
||||
|
@ -1261,8 +1265,8 @@ void VDxfEngine::ExportCurvePoints(const QSharedPointer<dx_ifaceBlock> &detailBl
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VDxfEngine::AAMAPolygon(const QVector<VLayoutPoint> &polygon, const UTF8STRING &layer,
|
||||
bool forceClosed) -> DRW_Entity *
|
||||
auto VDxfEngine::AAMAPolygon(const QVector<VLayoutPoint> &polygon, const UTF8STRING &layer, bool forceClosed)
|
||||
-> DRW_Entity *
|
||||
{
|
||||
if (polygon.isEmpty())
|
||||
{
|
||||
|
@ -1296,10 +1300,10 @@ auto VDxfEngine::AAMAText(const QPointF &pos, const QString &text, const UTF8STR
|
|||
{
|
||||
auto *textLine = new DRW_Text();
|
||||
|
||||
textLine->basePoint = DRW_Coord(FromPixel(pos.x(), m_varInsunits),
|
||||
FromPixel(GetSize().height() - pos.y(), m_varInsunits), 0);
|
||||
textLine->secPoint = DRW_Coord(FromPixel(pos.x(), m_varInsunits),
|
||||
FromPixel(GetSize().height() - pos.y(), m_varInsunits), 0);
|
||||
textLine->basePoint =
|
||||
DRW_Coord(FromPixel(pos.x(), m_varInsunits), FromPixel(GetSize().height() - pos.y(), m_varInsunits), 0);
|
||||
textLine->secPoint =
|
||||
DRW_Coord(FromPixel(pos.x(), m_varInsunits), FromPixel(GetSize().height() - pos.y(), m_varInsunits), 0);
|
||||
textLine->height = AAMATextHeight;
|
||||
textLine->layer = layer;
|
||||
textLine->text = text.toStdString();
|
||||
|
@ -1311,8 +1315,8 @@ auto VDxfEngine::AAMAText(const QPointF &pos, const QString &text, const UTF8STR
|
|||
auto VDxfEngine::AAMAPoint(const QPointF &pos, const UTF8STRING &layer) const -> DRW_Point *
|
||||
{
|
||||
auto *point = new DRW_Point();
|
||||
point->basePoint = DRW_Coord(FromPixel(pos.x(), m_varInsunits),
|
||||
FromPixel(GetSize().height() - pos.y(), m_varInsunits), 0);
|
||||
point->basePoint =
|
||||
DRW_Coord(FromPixel(pos.x(), m_varInsunits), FromPixel(GetSize().height() - pos.y(), m_varInsunits), 0);
|
||||
point->layer = layer;
|
||||
return point;
|
||||
}
|
||||
|
@ -1335,8 +1339,7 @@ auto VDxfEngine::GetFileNameForLocale() const -> std::string
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template <class P, class V, class C>
|
||||
auto VDxfEngine::CreateAAMAPolygon(const QVector<C> &polygon, const UTF8STRING &layer,
|
||||
bool forceClosed) -> P *
|
||||
auto VDxfEngine::CreateAAMAPolygon(const QVector<C> &polygon, const UTF8STRING &layer, bool forceClosed) -> P *
|
||||
{
|
||||
auto *poly = new P();
|
||||
poly->layer = layer;
|
||||
|
@ -1355,8 +1358,7 @@ auto VDxfEngine::CreateAAMAPolygon(const QVector<C> &polygon, const UTF8STRING &
|
|||
|
||||
for (const auto &p : polygon)
|
||||
{
|
||||
poly->addVertex(V(FromPixel(p.x(), m_varInsunits),
|
||||
FromPixel(GetSize().height() - p.y(), m_varInsunits)));
|
||||
poly->addVertex(V(FromPixel(p.x(), m_varInsunits), FromPixel(GetSize().height() - p.y(), m_varInsunits)));
|
||||
}
|
||||
|
||||
return poly;
|
||||
|
|
|
@ -29,13 +29,13 @@
|
|||
#ifndef VDXFENGINE_H
|
||||
#define VDXFENGINE_H
|
||||
|
||||
#include <qcompilerdetection.h>
|
||||
#include <QPaintEngine>
|
||||
#include <QPointF>
|
||||
#include <QRectF>
|
||||
#include <QSize>
|
||||
#include <QString>
|
||||
#include <QtGlobal>
|
||||
#include <qcompilerdetection.h>
|
||||
#include <string>
|
||||
|
||||
#include "../vmisc/def.h"
|
||||
|
@ -59,6 +59,7 @@ class VTextCodec;
|
|||
class VDxfEngine final : public QPaintEngine
|
||||
{
|
||||
friend class VDxfPaintDevice;
|
||||
|
||||
public:
|
||||
VDxfEngine();
|
||||
~VDxfEngine() override;
|
||||
|
@ -147,20 +148,18 @@ private:
|
|||
void ExportASTMDrill(const QSharedPointer<dx_ifaceBlock> &detailBlock, const VLayoutPiece &detail);
|
||||
void ExportASTMNotch(const QSharedPointer<dx_ifaceBlock> &detailBlock, const VLayoutPiece &detail);
|
||||
|
||||
void ExportTurnPoints(const QSharedPointer<dx_ifaceBlock> &detailBlock,
|
||||
const QVector<VLayoutPoint> &points) const;
|
||||
void ExportCurvePoints(const QSharedPointer<dx_ifaceBlock> &detailBlock,
|
||||
const QVector<VLayoutPoint> &points) const;
|
||||
void ExportTurnPoints(const QSharedPointer<dx_ifaceBlock> &detailBlock, const QVector<VLayoutPoint> &points) const;
|
||||
void ExportCurvePoints(const QSharedPointer<dx_ifaceBlock> &detailBlock, const QVector<VLayoutPoint> &points) const;
|
||||
|
||||
Q_REQUIRED_RESULT auto AAMAPolygon(const QVector<VLayoutPoint> &polygon, const UTF8STRING &layer,
|
||||
bool forceClosed) -> DRW_Entity *;
|
||||
Q_REQUIRED_RESULT auto AAMAPolygon(const QVector<VLayoutPoint> &polygon, const UTF8STRING &layer, bool forceClosed)
|
||||
-> DRW_Entity *;
|
||||
Q_REQUIRED_RESULT auto AAMALine(const QLineF &line, const UTF8STRING &layer) -> DRW_Entity *;
|
||||
Q_REQUIRED_RESULT auto AAMAText(const QPointF &pos, const QString &text, const UTF8STRING &layer) -> DRW_Entity *;
|
||||
Q_REQUIRED_RESULT auto AAMAPoint(const QPointF &pos, const UTF8STRING &layer) const -> DRW_Point *;
|
||||
|
||||
template <class P, class V, class C>
|
||||
Q_REQUIRED_RESULT auto CreateAAMAPolygon(const QVector<C> &polygon, const UTF8STRING &layer,
|
||||
bool forceClosed) -> P *;
|
||||
Q_REQUIRED_RESULT auto CreateAAMAPolygon(const QVector<C> &polygon, const UTF8STRING &layer, bool forceClosed)
|
||||
-> P *;
|
||||
|
||||
static auto FromUnicodeToCodec(const QString &str, VTextCodec *codec) -> std::string;
|
||||
auto GetFileNameForLocale() const -> std::string;
|
||||
|
|
|
@ -36,7 +36,8 @@
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VDxfPaintDevice::VDxfPaintDevice()
|
||||
: m_engine(new VDxfEngine())
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VDxfPaintDevice::~VDxfPaintDevice()
|
||||
|
|
|
@ -29,11 +29,11 @@
|
|||
#ifndef VDXFPAINTDEVICE_H
|
||||
#define VDXFPAINTDEVICE_H
|
||||
|
||||
#include <qcompilerdetection.h>
|
||||
#include <QPaintDevice>
|
||||
#include <QSize>
|
||||
#include <QString>
|
||||
#include <QtGlobal>
|
||||
#include <qcompilerdetection.h>
|
||||
|
||||
#include "dxfdef.h"
|
||||
#include "libdxfrw/drw_base.h"
|
||||
|
@ -80,6 +80,7 @@ public:
|
|||
|
||||
protected:
|
||||
auto metric(PaintDeviceMetric metric) const -> int override;
|
||||
|
||||
private:
|
||||
// cppcheck-suppress unknownMacro
|
||||
Q_DISABLE_COPY_MOVE(VDxfPaintDevice) // NOLINT
|
||||
|
|
|
@ -28,33 +28,36 @@
|
|||
|
||||
#include "vmeasurements.h"
|
||||
|
||||
#include <qnumeric.h>
|
||||
#include <QDate>
|
||||
#include <QDomNode>
|
||||
#include <QDomNodeList>
|
||||
#include <QDomText>
|
||||
#include <QGlobalStatic>
|
||||
#include <QLatin1Char>
|
||||
#include <QMessageLogger>
|
||||
#include <QScopedPointer>
|
||||
#include <QSet>
|
||||
#include <QtDebug>
|
||||
#include <QGlobalStatic>
|
||||
#include <qnumeric.h>
|
||||
|
||||
#include "../ifc/exception/vexceptionemptyparameter.h"
|
||||
#include "../ifc/exception/vexceptionobjecterror.h"
|
||||
#include "../ifc/ifcdef.h"
|
||||
#include "../ifc/xml/vvitconverter.h"
|
||||
#include "../ifc/xml/vvstconverter.h"
|
||||
#include "../ifc/ifcdef.h"
|
||||
#include "../qmuparser/qmutokenparser.h"
|
||||
#include "../qmuparser/qmuparsererror.h"
|
||||
#include "../qmuparser/qmutokenparser.h"
|
||||
#include "../vmisc/projectversion.h"
|
||||
#include "../vpatterndb/calculator.h"
|
||||
#include "../vpatterndb/variables/vmeasurement.h"
|
||||
#include "../vpatterndb/vcontainer.h"
|
||||
#include "../vpatterndb/measurements.h"
|
||||
#include "../vpatterndb/pmsystems.h"
|
||||
#include "../vmisc/projectversion.h"
|
||||
#include "../vpatterndb/variables/vmeasurement.h"
|
||||
#include "../vpatterndb/vcontainer.h"
|
||||
#include "def.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
#include "../vmisc/diagnostic.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
|
||||
const QString VMeasurements::TagVST = QStringLiteral("vst");
|
||||
const QString VMeasurements::TagVIT = QStringLiteral("vit");
|
||||
const QString VMeasurements::TagBodyMeasurements = QStringLiteral("body-measurements");
|
||||
|
@ -109,23 +112,24 @@ const QString VMeasurements::DimensionZ = QStringLiteral("z");
|
|||
|
||||
namespace
|
||||
{
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, defBirthDate, (QLatin1String("1800-01-01"))) // NOLINT
|
||||
|
||||
QT_WARNING_POP
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto FileComment() -> QString
|
||||
{
|
||||
return QString("Measurements created with Valentina v%1 (https://smart-pattern.com.ua/).")
|
||||
.arg(APP_VERSION_STR);
|
||||
}
|
||||
return QString("Measurements created with Valentina v%1 (https://smart-pattern.com.ua/).").arg(APP_VERSION_STR);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VMeasurements::VMeasurements(VContainer *data)
|
||||
: data(data),
|
||||
type(MeasurementsType::Unknown)
|
||||
{
|
||||
SCASSERT(data != nullptr)
|
||||
}
|
||||
type(MeasurementsType::Unknown){SCASSERT(data != nullptr)}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VMeasurements::VMeasurements(Unit unit, VContainer * data)
|
||||
|
@ -138,8 +142,7 @@ VMeasurements::VMeasurements(Unit unit, VContainer *data)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VMeasurements::VMeasurements(Unit unit, const QVector<MeasurementDimension_p > &dimensions,
|
||||
VContainer *data)
|
||||
VMeasurements::VMeasurements(Unit unit, const QVector<MeasurementDimension_p> &dimensions, VContainer *data)
|
||||
: data(data),
|
||||
type(MeasurementsType::Multisize)
|
||||
{
|
||||
|
@ -387,8 +390,8 @@ void VMeasurements::ReadMeasurements(qreal baseA, qreal baseB, qreal baseC) cons
|
|||
convertedStepC = UnitConvertor(convertedStepC, Units(), *data->GetPatternUnit());
|
||||
}
|
||||
|
||||
meash = QSharedPointer<VMeasurement>::create(static_cast<quint32>(i), name,
|
||||
convertedBaseA, convertedBaseB, convertedBaseC, base);
|
||||
meash = QSharedPointer<VMeasurement>::create(static_cast<quint32>(i), name, convertedBaseA,
|
||||
convertedBaseB, convertedBaseC, base);
|
||||
meash->SetBaseA(baseA);
|
||||
meash->SetBaseB(baseB);
|
||||
meash->SetBaseC(baseC);
|
||||
|
@ -701,7 +704,8 @@ void VMeasurements::SetFullCircumference(bool fc)
|
|||
QDomElement dimenstionsTag = documentElement().firstChildElement(TagDimensions);
|
||||
if (not dimenstionsTag.isNull())
|
||||
{
|
||||
SetAttributeOrRemoveIf<bool>(dimenstionsTag, AttrFullCircumference, fc, [](bool fc) noexcept {return not fc;});
|
||||
SetAttributeOrRemoveIf<bool>(dimenstionsTag, AttrFullCircumference, fc,
|
||||
[](bool fc) noexcept { return not fc; });
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -799,7 +803,8 @@ void VMeasurements::SetMSpecialUnits(const QString &name, bool special)
|
|||
QDomElement node = FindM(name);
|
||||
if (not node.isNull())
|
||||
{
|
||||
SetAttributeOrRemoveIf<bool>(node, AttrSpecialUnits, special, [](bool special) noexcept {return not special;});
|
||||
SetAttributeOrRemoveIf<bool>(node, AttrSpecialUnits, special,
|
||||
[](bool special) noexcept { return not special; });
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1193,8 +1198,7 @@ auto VMeasurements::GetData() const -> VContainer *
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VMeasurements::CreateEmptyMultisizeFile(Unit unit,
|
||||
const QVector<MeasurementDimension_p > &dimensions)
|
||||
void VMeasurements::CreateEmptyMultisizeFile(Unit unit, const QVector<MeasurementDimension_p> &dimensions)
|
||||
{
|
||||
this->clear();
|
||||
QDomElement mElement = this->createElement(TagVST);
|
||||
|
@ -1210,8 +1214,9 @@ void VMeasurements::CreateEmptyMultisizeFile(Unit unit,
|
|||
mElement.appendChild(createElement(TagBodyMeasurements));
|
||||
|
||||
this->appendChild(mElement);
|
||||
insertBefore(createProcessingInstruction(QStringLiteral("xml"),
|
||||
QStringLiteral("version=\"1.0\" encoding=\"UTF-8\"")), this->firstChild());
|
||||
insertBefore(
|
||||
createProcessingInstruction(QStringLiteral("xml"), QStringLiteral("version=\"1.0\" encoding=\"UTF-8\"")),
|
||||
this->firstChild());
|
||||
|
||||
// Cache data
|
||||
m_units = unit;
|
||||
|
@ -1242,8 +1247,9 @@ void VMeasurements::CreateEmptyIndividualFile(Unit unit)
|
|||
mElement.appendChild(createElement(TagBodyMeasurements));
|
||||
|
||||
this->appendChild(mElement);
|
||||
insertBefore(createProcessingInstruction(QStringLiteral("xml"),
|
||||
QStringLiteral("version=\"1.0\" encoding=\"UTF-8\"")), this->firstChild());
|
||||
insertBefore(
|
||||
createProcessingInstruction(QStringLiteral("xml"), QStringLiteral("version=\"1.0\" encoding=\"UTF-8\"")),
|
||||
this->firstChild());
|
||||
|
||||
// Cache data
|
||||
m_units = unit;
|
||||
|
|
|
@ -51,14 +51,23 @@
|
|||
#include "vprintlayout.h"
|
||||
#include "vrawlayout.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
#include "../vmisc/diagnostic.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
|
||||
namespace
|
||||
{
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, PDFTOPS, (QLatin1String("pdftops.exe"))) // NOLINT
|
||||
#else
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, PDFTOPS, (QLatin1String("pdftops"))) // NOLINT
|
||||
#endif
|
||||
|
||||
QT_WARNING_POP
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief PrepareTextForDXF prepare QGraphicsSimpleTextItem items for export to flat dxf.
|
||||
|
@ -292,8 +301,7 @@ void VLayoutExporter::ExportToFlatDXF(QGraphicsScene *scene, const QList<QGraphi
|
|||
scene->render(&painter, m_imageRect, m_imageRect, Qt::IgnoreAspectRatio);
|
||||
if (not painter.end())
|
||||
{
|
||||
qCritical() << tr("Can't create a flat dxf file.")
|
||||
<< generator.ErrorString();
|
||||
qCritical() << tr("Can't create a flat dxf file.") << generator.ErrorString();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -315,8 +323,7 @@ void VLayoutExporter::ExportToAAMADXF(const QVector<VLayoutPiece> &details) cons
|
|||
generator.SetYScale(m_yScale);
|
||||
if (not generator.ExportToAAMA(details))
|
||||
{
|
||||
qCritical() << tr("Can't create an AAMA dxf file.")
|
||||
<< generator.ErrorString();
|
||||
qCritical() << tr("Can't create an AAMA dxf file.") << generator.ErrorString();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -334,8 +341,7 @@ void VLayoutExporter::ExportToASTMDXF(const QVector<VLayoutPiece> &details) cons
|
|||
generator.SetYScale(m_yScale);
|
||||
if (not generator.ExportToASTM(details))
|
||||
{
|
||||
qCritical() << tr("Can't create an ASTM dxf file.")
|
||||
<< generator.ErrorString();
|
||||
qCritical() << tr("Can't create an ASTM dxf file.") << generator.ErrorString();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -433,8 +439,8 @@ void VLayoutExporter::PdfToPs(const QStringList ¶ms)
|
|||
QFile f(ConstLast<QString>(params));
|
||||
if (not f.exists())
|
||||
{
|
||||
qCritical() << qUtf8Printable(tr("Creating file '%1' failed! %2")
|
||||
.arg(ConstLast<QString>(params), proc.errorString()));
|
||||
qCritical() << qUtf8Printable(
|
||||
tr("Creating file '%1' failed! %2").arg(ConstLast<QString>(params), proc.errorString()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -453,8 +459,8 @@ void VLayoutExporter::ExportToPDF(QGraphicsScene *scene, const QList<QGraphicsIt
|
|||
printer.setResolution(static_cast<int>(PrintDPI));
|
||||
printer.setFullPage(m_ignorePrinterMargins);
|
||||
|
||||
QPageLayout::Orientation imageOrientation = m_imageRect.height() >= m_imageRect.width() ? QPageLayout::Portrait
|
||||
: QPageLayout::Landscape;
|
||||
QPageLayout::Orientation imageOrientation =
|
||||
m_imageRect.height() >= m_imageRect.width() ? QPageLayout::Portrait : QPageLayout::Landscape;
|
||||
|
||||
qreal width = FromPixel(m_imageRect.width() * m_xScale + m_margins.left() + m_margins.right(), Unit::Mm);
|
||||
qreal height = FromPixel(m_imageRect.height() * m_yScale + m_margins.top() + m_margins.bottom(), Unit::Mm);
|
||||
|
|
|
@ -28,11 +28,11 @@
|
|||
#ifndef VLAYOUTEXPORTER_H
|
||||
#define VLAYOUTEXPORTER_H
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QMargins>
|
||||
#include <QPen>
|
||||
#include <QRectF>
|
||||
#include <QString>
|
||||
#include <QCoreApplication>
|
||||
|
||||
#include "../vlayout/vlayoutdef.h"
|
||||
|
||||
|
@ -43,6 +43,7 @@ class VLayoutPiece;
|
|||
class VLayoutExporter
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(VLayoutExporter) // NOLINT
|
||||
|
||||
public:
|
||||
VLayoutExporter() = default;
|
||||
|
||||
|
|
|
@ -333,7 +333,7 @@ auto VLayoutPaper::GetPaperItem(bool autoCropLength, bool autoCropWidth, bool te
|
|||
{
|
||||
QScopedPointer<QGraphicsScene> scene(new QGraphicsScene());
|
||||
QList<QGraphicsItem *> list = GetItemDetails(textAsPaths);
|
||||
for (auto item : list)
|
||||
for (auto *item : list)
|
||||
{
|
||||
scene->addItem(item);
|
||||
}
|
||||
|
@ -411,7 +411,7 @@ auto VLayoutPaper::GetGlobalContour() const -> QGraphicsPathItem *
|
|||
path.lineTo(side2.p2());
|
||||
}
|
||||
|
||||
QGraphicsPathItem *item = new QGraphicsPathItem(path);
|
||||
auto *item = new QGraphicsPathItem(path);
|
||||
QPen pen = item->pen();
|
||||
pen.setWidthF(0.25);
|
||||
item->setPen(pen);
|
||||
|
@ -424,7 +424,7 @@ auto VLayoutPaper::GetItemDetails(bool textAsPaths) const -> QList<QGraphicsItem
|
|||
{
|
||||
QList<QGraphicsItem *> list;
|
||||
list.reserve(d->details.count());
|
||||
for (auto &detail : d->details)
|
||||
for (const auto &detail : d->details)
|
||||
{
|
||||
list.append(detail.GetItem(textAsPaths));
|
||||
}
|
||||
|
|
|
@ -60,13 +60,13 @@
|
|||
#include "../vpatterndb/vcontainer.h"
|
||||
#include "../vpatterndb/vpassmark.h"
|
||||
#include "../vpatterndb/vpiecenode.h"
|
||||
#include "qline.h"
|
||||
#include "qpainterpath.h"
|
||||
#include "vgobject.h"
|
||||
#include "vgraphicsfillitem.h"
|
||||
#include "vlayoutpiece_p.h"
|
||||
#include "vpiecegrainline.h"
|
||||
#include "vtextmanager.h"
|
||||
#include <QLine>
|
||||
#include <QPainterPath>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -195,16 +195,19 @@ auto RotatePoint(const QPointF &ptCenter, const QPointF &pt, qreal dAng) -> QPoi
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto PieceLabelText(const QVector<QPointF> &labelShape, const VTextManager &tm) -> QStringList
|
||||
{
|
||||
QStringList text;
|
||||
if (labelShape.count() > 2)
|
||||
if (labelShape.count() <= 2)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
QStringList text;
|
||||
auto sourceCount = tm.GetSourceLinesCount();
|
||||
text.reserve(sourceCount);
|
||||
for (int i = 0; i < sourceCount; ++i)
|
||||
{
|
||||
text.append(tm.GetSourceLine(i).m_qsText);
|
||||
}
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
|
@ -616,7 +619,8 @@ VLayoutPiece::VLayoutPiece(VLayoutPiece &&detail) Q_DECL_NOTHROW : VAbstractPiec
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VLayoutPiece::operator=(VLayoutPiece &&detail) Q_DECL_NOTHROW->VLayoutPiece &
|
||||
auto VLayoutPiece::operator=(VLayoutPiece &&detail) Q_DECL_NOTHROW
|
||||
->VLayoutPiece &
|
||||
{
|
||||
VAbstractPiece::operator=(detail);
|
||||
std::swap(d, detail.d);
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#ifndef VLAYOUTDETAIL_H
|
||||
#define VLAYOUTDETAIL_H
|
||||
|
||||
#include <qcompilerdetection.h>
|
||||
#include <QCoreApplication>
|
||||
#include <QDate>
|
||||
#include <QLineF>
|
||||
#include <QPointF>
|
||||
|
@ -39,7 +39,6 @@
|
|||
#include <QTypeInfo>
|
||||
#include <QVector>
|
||||
#include <QtGlobal>
|
||||
#include <QCoreApplication>
|
||||
|
||||
#include "../vmisc/typedef.h"
|
||||
#include "../vpatterndb/floatItemData/floatitemdef.h"
|
||||
|
@ -73,6 +72,7 @@ QT_WARNING_DISABLE_GCC("-Wsuggest-final-methods")
|
|||
class VLayoutPiece : public VAbstractPiece
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(VLayoutPiece) // NOLINT
|
||||
|
||||
public:
|
||||
VLayoutPiece();
|
||||
VLayoutPiece(const VLayoutPiece &detail);
|
||||
|
@ -82,7 +82,8 @@ public:
|
|||
auto operator=(const VLayoutPiece &detail) -> VLayoutPiece &;
|
||||
#ifdef Q_COMPILER_RVALUE_REFS
|
||||
VLayoutPiece(VLayoutPiece &&detail) Q_DECL_NOTHROW;
|
||||
auto operator=(VLayoutPiece &&detail) Q_DECL_NOTHROW -> VLayoutPiece &;
|
||||
auto operator=(VLayoutPiece &&detail) Q_DECL_NOTHROW
|
||||
->VLayoutPiece &;
|
||||
#endif
|
||||
|
||||
static auto Create(const VPiece &piece, vidtype id, const VContainer *pattern) -> VLayoutPiece;
|
||||
|
@ -118,7 +119,8 @@ public:
|
|||
|
||||
auto GetPieceTextPosition() const -> QPointF;
|
||||
auto GetPieceText() const -> QStringList;
|
||||
void SetPieceText(const QString &qsName, const VPieceLabelData& data, const QFont& font, const VContainer *pattern);
|
||||
void SetPieceText(const QString &qsName, const VPieceLabelData &data, const QFont &font,
|
||||
const VContainer *pattern);
|
||||
|
||||
auto GetPatternTextPosition() const -> QPointF;
|
||||
auto GetPatternText() const -> QStringList;
|
||||
|
@ -226,8 +228,7 @@ private:
|
|||
bool textAsPaths) const;
|
||||
void CreateGrainlineItem(QGraphicsItem *parent) const;
|
||||
|
||||
template <class T>
|
||||
auto Map(QVector<T> points) const -> QVector<T>;
|
||||
template <class T> auto Map(QVector<T> points) const -> QVector<T>;
|
||||
auto Map(const GrainlineShape &shape) const -> GrainlineShape;
|
||||
|
||||
auto Edge(const QVector<QPointF> &path, int i) const -> QLineF;
|
||||
|
|
|
@ -52,8 +52,19 @@
|
|||
#include "../vpatterndb/vcontainer.h"
|
||||
#include "vtextmanager.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
#include "../vmisc/diagnostic.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
|
||||
namespace
|
||||
{
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
|
||||
|
||||
Q_GLOBAL_STATIC(QVector<TextLine>, m_patternLabelLinesCache) // NOLINT
|
||||
|
||||
QT_WARNING_POP
|
||||
|
||||
auto SplitTextByWidth(const QString &text, const QFont &font, int maxWidth) -> QStringList
|
||||
{
|
||||
QFontMetrics fontMetrics(font);
|
||||
|
@ -160,11 +171,6 @@ auto operator>>(QDataStream &dataStream, TextLine &data) -> QDataStream &
|
|||
const quint32 VTextManager::streamHeader = 0x47E6A9EE; // CRC-32Q string "VTextManager"
|
||||
const quint16 VTextManager::classVersion = 1;
|
||||
|
||||
namespace
|
||||
{
|
||||
Q_GLOBAL_STATIC(QVector<TextLine>, m_patternLabelLinesCache) // NOLINT
|
||||
}
|
||||
|
||||
// Friend functions
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto operator<<(QDataStream &dataStream, const VTextManager &data) -> QDataStream &
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
#include "literals.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
#include "../vmisc/diagnostic.h"
|
||||
#include "diagnostic.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
|
||||
namespace
|
||||
|
@ -374,6 +374,9 @@ void MacosEnableLayerBacking()
|
|||
#endif // MACOS_LAYER_BACKING_AFFECTED
|
||||
#endif // Q_OS_MAC
|
||||
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strTMark, (QLatin1String("tMark"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strVMark, (QLatin1String("vMark"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strVMark2, (QLatin1String("vMark2"))) // NOLINT
|
||||
|
@ -381,6 +384,8 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, strUMark, (QLatin1String("uMark")))
|
|||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strBoxMark, (QLatin1String("boxMark"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCheckMark, (QLatin1String("checkMark"))) // NOLINT
|
||||
|
||||
QT_WARNING_POP
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto PassmarkLineTypeToString(PassmarkLineType type) -> QString
|
||||
{
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*************************************************************************/
|
||||
|
||||
#include "vcommonsettings.h"
|
||||
#include <QVariant>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QColor>
|
||||
|
@ -52,6 +53,10 @@
|
|||
#include "defglobal.h"
|
||||
#include "literals.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
#include "diagnostic.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
|
||||
const int VCommonSettings::defaultScrollingDuration = 300;
|
||||
const int VCommonSettings::scrollingDurationMin = 100;
|
||||
const int VCommonSettings::scrollingDurationMax = 1000;
|
||||
|
@ -78,98 +83,119 @@ const QString VCommonSettings::defaultPieceLabelLocale = QStringLiteral("default
|
|||
Q_DECLARE_METATYPE(QMarginsF) // NOLINT
|
||||
#endif
|
||||
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
|
||||
|
||||
namespace
|
||||
{
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsIndividualMeasurements,
|
||||
(QLatin1String("paths/individual_measurements"))) // NOLINT
|
||||
(QLatin1String("paths/individual_measurements")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsMultisizeMeasurements,
|
||||
(QLatin1String("paths/standard_measurements"))) // NOLINT
|
||||
(QLatin1String("paths/standard_measurements")))
|
||||
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
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationOsSeparator, (QLatin1String("configuration/osSeparator")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationAutosaveState,
|
||||
(QLatin1String("configuration/autosave/state"))) // NOLINT
|
||||
(QLatin1String("configuration/autosave/state")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationAutosaveTime,
|
||||
(QLatin1String("configuration/autosave/time"))) // NOLINT
|
||||
(QLatin1String("configuration/autosave/time")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationLocale, (QLatin1String("configuration/locale"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationPieceLabelLocale, // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationPieceLabelLocale,
|
||||
(QLatin1String("configuration/pieceLabelLocale")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPMSystemCode, (QLatin1String("configuration/pmscode"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationUnit, (QLatin1String("configuration/unit"))) // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationConfirmItemDeletion,
|
||||
(QLatin1String("configuration/confirm_item_deletion"))) // NOLINT
|
||||
(QLatin1String("configuration/confirm_item_deletion")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationConfirmFormatRewriting,
|
||||
(QLatin1String("configuration/confirm_format_rewriting"))) // NOLINT
|
||||
(QLatin1String("configuration/confirm_format_rewriting")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationAskContinueIfLayoutStale,
|
||||
(QLatin1String("configuration/askContinueIfLayoutStale"))) // NOLINT
|
||||
(QLatin1String("configuration/askContinueIfLayoutStale")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationToolBarStyle,
|
||||
(QLatin1String("configuration/tool_bar_style"))) // NOLINT
|
||||
(QLatin1String("configuration/tool_bar_style")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationFreeCurveMode,
|
||||
(QLatin1String("configuration/freeCurveMode"))) // NOLINT
|
||||
(QLatin1String("configuration/freeCurveMode")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationDoubleClickZoomFitBestCurrentPP,
|
||||
(QLatin1String("configuration/doubleClickZoomFitBestCurrentPP"))) // NOLINT
|
||||
(QLatin1String("configuration/doubleClickZoomFitBestCurrentPP")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationInteractiveTools,
|
||||
(QLatin1String("configuration/interactiveTools"))) // NOLINT
|
||||
(QLatin1String("configuration/interactiveTools")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationDontUseNativeDialog,
|
||||
(QLatin1String("configuration/dontUseNativeDialog"))) // NOLINT
|
||||
(QLatin1String("configuration/dontUseNativeDialog")))
|
||||
|
||||
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
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternForbidFlipping, (QLatin1String("pattern/forbidFlipping")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternForceFlipping, (QLatin1String("pattern/forceFlipping")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternSewLineOnDrawing, (QLatin1String("pattern/sewLineOnDrawing")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternHideMainPath, (QLatin1String("pattern/hideMainPath"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDoublePassmark, (QLatin1String("pattern/doublePassmark"))) // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternDefaultSeamAllowance,
|
||||
(QLatin1String("pattern/defaultSeamAllowance"))) // NOLINT
|
||||
(QLatin1String("pattern/defaultSeamAllowance")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternLabelFont, (QLatin1String("pattern/labelFont"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPieceLabelFontPointSize, // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPieceLabelFontPointSize,
|
||||
(QLatin1String("pattern/pieceLabelFontPointSize")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternLineWidth, (QLatin1String("pattern/lineWidth"))) // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
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
|
||||
(QLatin1String("pattern/curveApproximationScale")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternShowCurveDetails, (QLatin1String("pattern/showCurveDetails")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternPieceShowMainPath, (QLatin1String("pattern/pieceShowMainPath")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternLabelFontSize, (QLatin1String("pattern/labelFontSize")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternHideLabels, (QLatin1String("pattern/hideLabels"))) // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
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
|
||||
|
||||
(QLatin1String("pattern/showAccuracyRadius")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternUseOpenGLRender, (QLatin1String("pattern/useOpenGLRender")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternGraphicalOutput, (QLatin1String("pattern/graphicalOutput")))
|
||||
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
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationDarkMode, (QLatin1String("configuration/dark_mode")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPreferenceDialogSize, (QLatin1String("preferenceDialogSize"))) // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
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
|
||||
(QLatin1String("toolSeamAllowanceDialogSize")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingIncrementsDialogSize, (QLatin1String("toolIncrementsDialogSize")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingFormulaWizardDialogSize, (QLatin1String("formulaWizardDialogSize")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingFinalMeasurementsDialogSize,
|
||||
(QLatin1String("finalMeasurementsDialogSize"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSettingsDialogSize,
|
||||
(QLatin1String("layoutSettingsDialogSize"))) // NOLINT
|
||||
(QLatin1String("finalMeasurementsDialogSize")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSettingsDialogSize, (QLatin1String("layoutSettingsDialogSize")))
|
||||
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
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingAutomaticallyCheckUpdates, (QLatin1String("automaticallyCheckUpdates")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLatestSkippedVersion, (QLatin1String("lastestSkippedVersion")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDateOfLastRemind, (QLatin1String("dateOfLastRemind"))) // NOLINT
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingCSVWithHeader, (QLatin1String("csv/withHeader"))) // NOLINT
|
||||
|
@ -177,28 +203,29 @@ 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
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLabelUserDateFormats, (QLatin1String("label/userDateFormats")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLabelTimeFormat, (QLatin1String("label/timeFormat"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLabelUserTimeFormats,
|
||||
(QLatin1String("label/userTimeFormats"))) // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLabelUserTimeFormats, (QLatin1String("label/userTimeFormats")))
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingDuration, (QLatin1String("scrolling/duration"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingUpdateInterval,
|
||||
(QLatin1String("scrolling/updateInterval"))) // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingUpdateInterval, (QLatin1String("scrolling/updateInterval")))
|
||||
// NOLINTNEXTLINE
|
||||
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
|
||||
(QLatin1String("scrolling/sensorMouseScale")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingWheelMouseScale, (QLatin1String("scrolling/wheelMouseScale")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingAcceleration, (QLatin1String("scrolling/acceleration")))
|
||||
|
||||
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
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingWatermarkCustomColors, (QLatin1String("watermarkCustomColors")))
|
||||
|
||||
// Reading settings file is very expensive, cache curve approximation to speed up getting value
|
||||
qreal curveApproximationCached = -1; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
|
@ -329,6 +356,8 @@ auto PrepareStandardFiles(const QString ¤tPath, const QString &standardPat
|
|||
}
|
||||
} // namespace
|
||||
|
||||
QT_WARNING_POP
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VCommonSettings::VCommonSettings(Format format, Scope scope, const QString &organization, const QString &application,
|
||||
QObject *parent)
|
||||
|
@ -353,8 +382,7 @@ auto VCommonSettings::SharePath(const QString &shareItem) -> QString
|
|||
{
|
||||
return dirBundle.absolutePath();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
QDir appDir = QDir(qApp->applicationDirPath());
|
||||
appDir.cdUp();
|
||||
appDir.cdUp();
|
||||
|
@ -364,25 +392,16 @@ auto VCommonSettings::SharePath(const QString &shareItem) -> QString
|
|||
{
|
||||
return dir.absolutePath();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return VCommonSettings::unixStandardSharePath + shareItem;
|
||||
}
|
||||
}
|
||||
#else // Unix
|
||||
#ifdef QT_DEBUG
|
||||
return QCoreApplication::applicationDirPath() + shareItem;
|
||||
#else
|
||||
QDir dir(QCoreApplication::applicationDirPath() + shareItem);
|
||||
if (dir.exists())
|
||||
{
|
||||
return dir.absolutePath();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return VCommonSettings::unixStandardSharePath + shareItem;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1109,20 +1128,20 @@ auto VCommonSettings::GetCSVSeparator() const -> QChar
|
|||
switch (separator)
|
||||
{
|
||||
case 0:
|
||||
return QChar('\t');
|
||||
return {'\t'};
|
||||
case 1:
|
||||
return QChar(';');
|
||||
return {';'};
|
||||
case 2:
|
||||
return QChar(' ');
|
||||
return {' '};
|
||||
default:
|
||||
return QChar(',');
|
||||
return {','};
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VCommonSettings::GetDefCSVSeparator() -> QChar
|
||||
{
|
||||
return QChar(',');
|
||||
return {','};
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -29,124 +29,167 @@
|
|||
#include "vvalentinasettings.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QLocale>
|
||||
#include <QMetaType>
|
||||
#include <QPrinter>
|
||||
#include <QSharedPointer>
|
||||
#include <QVariant>
|
||||
#include <QPrinterInfo>
|
||||
#include <QtDebug>
|
||||
#include <QGlobalStatic>
|
||||
#include <QLocale>
|
||||
#include <QMargins>
|
||||
#include <QMetaType>
|
||||
#include <QPrinter>
|
||||
#include <QPrinterInfo>
|
||||
#include <QSharedPointer>
|
||||
#include <QVariant>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "../vmisc/def.h"
|
||||
#include "../vmisc/compatibility.h"
|
||||
#include "compatibility.h"
|
||||
#include "def.h"
|
||||
#include "qglobal.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
#include "diagnostic.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
|
||||
#ifndef QPRINTENGINE_H
|
||||
Q_DECLARE_METATYPE(QMarginsF) // NOLINT
|
||||
#endif
|
||||
|
||||
namespace
|
||||
{
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationLabelLanguage, // NOLINT
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
|
||||
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationLabelLanguage,
|
||||
(QLatin1String("configuration/label_language")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingAutoRefreshPatternMessage, // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingAutoRefreshPatternMessage,
|
||||
(QLatin1String("configuration/autoRefreshPatternMessage")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingToolPanelScaling, // NOLINT
|
||||
(QLatin1String("configuration/toolPanelScaling")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingToolPanelScaling, (QLatin1String("configuration/toolPanelScaling")))
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsLayout, (QLatin1String("paths/layout"))) // NOLINT
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternKnownMaterials, (QLatin1String("pattern/knownMaterials"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternRememberMaterials, (QLatin1String("pattern/rememberMaterials"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternBackgroundImageDefOpacity, // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternKnownMaterials, (QLatin1String("pattern/knownMaterials")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternRememberMaterials, (QLatin1String("pattern/rememberMaterials")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternBackgroundImageDefOpacity,
|
||||
(QLatin1String("pattern/backgroundImageDefOpacity")))
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutWidth, (QLatin1String("layout/width"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSorting, (QLatin1String("layout/sorting"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutPaperHeight, (QLatin1String("layout/paperHeight"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutPaperWidth, (QLatin1String("layout/paperWidth"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutFollowGrainline, (QLatin1String("layout/followGrainline"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutManualPriority, (QLatin1String("layout/manualPriority"))) // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutFollowGrainline, (QLatin1String("layout/followGrainline")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutManualPriority, (QLatin1String("layout/manualPriority")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutNestQuantity, (QLatin1String("layout/nestQuantity"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutAutoCropLength, (QLatin1String("layout/autoCropLength"))) // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutAutoCropLength, (QLatin1String("layout/autoCropLength")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutAutoCropWidth, (QLatin1String("layout/autoCropWidth"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSaveLength, (QLatin1String("layout/saveLength"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutPreferOneSheetSolution, // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutPreferOneSheetSolution,
|
||||
(QLatin1String("layout/preferOneSheetSolution")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutUnitePages, (QLatin1String("layout/unitePages"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutShowGrainline, (QLatin1String("layout/showGrainline"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingFields, (QLatin1String("layout/fields"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingIgnoreFields, (QLatin1String("layout/ignoreFields"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingStripOptimization, (QLatin1String("layout/stripOptimization"))) // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingStripOptimization, (QLatin1String("layout/stripOptimization")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingMultiplier, (QLatin1String("layout/multiplier"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTextAsPaths, (QLatin1String("layout/textAsPaths"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingNestingTime, (QLatin1String("layout/time"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingEfficiencyCoefficient, (QLatin1String("layout/efficiencyCoefficient"))) // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingEfficiencyCoefficient, (QLatin1String("layout/efficiencyCoefficient")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutExportFormat, (QLatin1String("layout/exportFormat"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDetailExportFormat, (QLatin1String("detail/exportFormat"))) // NOLINT
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFPaperHeight, (QLatin1String("tiledPDF/paperHeight"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFPaperWidth, (QLatin1String("tiledPDF/paperWidth"))) // NOLINT
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingdockWidgetGroupsActive, (QLatin1String("dockWidget/groupsActive"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDockWidgetToolOptionsActive, // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingdockWidgetGroupsActive, (QLatin1String("dockWidget/groupsActive")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDockWidgetToolOptionsActive,
|
||||
(QLatin1String("dockWidget/toolOptionsActive")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDockWidgetPatternMessagesActive, // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDockWidgetPatternMessagesActive,
|
||||
(QLatin1String("dockWidget/patternMessagesActive")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDockWidgetBackgroundImagesActive, // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDockWidgetBackgroundImagesActive,
|
||||
(QLatin1String("dockWidget/backgroundImagesActive")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternMessagesFontSize, (QLatin1String("font/patternMessagesSize"))) // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternMessagesFontSize, (QLatin1String("font/patternMessagesSize")))
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchHistoryHistory, (QLatin1String("searchHistory/history"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchHistoryIncrements, (QLatin1String("searchHistory/increments"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchHistoryPreviewCalculations, // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchHistoryHistory, (QLatin1String("searchHistory/history")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchHistoryIncrements, (QLatin1String("searchHistory/increments")))
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchHistoryPreviewCalculations,
|
||||
(QLatin1String("searchHistory/previewCalculations")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchHistoryFinalMeasurements, // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchHistoryFinalMeasurements,
|
||||
(QLatin1String("searchHistory/finalMeasurements")))
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsHistoryUseUnicodeProperties, // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsHistoryUseUnicodeProperties,
|
||||
(QLatin1String("searchOptions/historyUseUnicodeProperties")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsHistoryWholeWord, // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsHistoryWholeWord,
|
||||
(QLatin1String("searchOptions/historyWholeWord")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsHistoryRegexp, // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsHistoryRegexp,
|
||||
(QLatin1String("searchOptions/historyRegexp")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsHistoryMatchCase, // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsHistoryMatchCase,
|
||||
(QLatin1String("searchOptions/historyMatchCase")))
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsIncrementsUseUnicodeProperties, // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsIncrementsUseUnicodeProperties,
|
||||
(QLatin1String("searchOptions/incrementsUseUnicodeProperties")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsIncrementsWholeWord, // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsIncrementsWholeWord,
|
||||
(QLatin1String("searchOptions/incrementsWholeWord")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsIncrementsRegexp, // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsIncrementsRegexp,
|
||||
(QLatin1String("searchOptions/incrementsRegexp")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsIncrementsMatchCase, // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsIncrementsMatchCase,
|
||||
(QLatin1String("searchOptions/incrementsMatchCase")))
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsPreviewCalculationsUseUnicodeProperties, // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsPreviewCalculationsUseUnicodeProperties,
|
||||
(QLatin1String("searchOptions/previewCalculationsUseUnicodeProperties")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsPreviewCalculationsWholeWord, // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsPreviewCalculationsWholeWord,
|
||||
(QLatin1String("searchOptions/previewCalculationsWholeWord")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsPreviewCalculationsRegexp, // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsPreviewCalculationsRegexp,
|
||||
(QLatin1String("searchOptions/previewCalculationsRegexp")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsPreviewCalculationsMatchCase, // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsPreviewCalculationsMatchCase,
|
||||
(QLatin1String("searchOptions/previewCalculationsMatchCase")))
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsFinalMeasurementsUseUnicodeProperties, // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsFinalMeasurementsUseUnicodeProperties,
|
||||
(QLatin1String("searchOptions/finalMeasurementsUseUnicodeProperties")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsFinalMeasurementsWholeWord, // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsFinalMeasurementsWholeWord,
|
||||
(QLatin1String("searchOptions/finalMeasurementsWholeWord")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsFinalMeasurementsRegexp, // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsFinalMeasurementsRegexp,
|
||||
(QLatin1String("searchOptions/finalMeasurementsRegexp")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsFinalMeasurementsMatchCase, // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsFinalMeasurementsMatchCase,
|
||||
(QLatin1String("searchOptions/finalMeasurementsMatchCase")))
|
||||
QT_WARNING_POP
|
||||
} // namespace
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VValentinaSettings::VValentinaSettings(Format format, Scope scope, const QString &organization, const QString &application,
|
||||
QObject *parent)
|
||||
VValentinaSettings::VValentinaSettings(Format format, Scope scope, const QString &organization,
|
||||
const QString &application, QObject *parent)
|
||||
: VCommonSettings(format, scope, organization, application, parent)
|
||||
{
|
||||
REGISTER_META_TYPE_STREAM_OPERATORS(QMarginsF);
|
||||
|
@ -572,7 +615,6 @@ void VValentinaSettings::SetTiledPDFPaperWidth(qreal value, const Unit &unit)
|
|||
setValue(*settingTiledPDFPaperWidth, UnitConvertor(value, unit, Unit::Mm));
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VValentinaSettings::IsDockWidgetGroupsActive() const -> bool
|
||||
{
|
||||
|
@ -668,8 +710,8 @@ auto VValentinaSettings::GetDefMaxPatternMessageFontSize() -> int
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VValentinaSettings::SetPatternMessageFontSize(int size)
|
||||
{
|
||||
setValue(*settingPatternMessagesFontSize, qBound(GetDefMinPatternMessageFontSize(), size,
|
||||
GetDefMaxPatternMessageFontSize()));
|
||||
setValue(*settingPatternMessagesFontSize,
|
||||
qBound(GetDefMinPatternMessageFontSize(), size, GetDefMaxPatternMessageFontSize()));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
class VValentinaSettings : public VCommonSettings
|
||||
{
|
||||
Q_OBJECT // NOLINT
|
||||
|
||||
public:
|
||||
VValentinaSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(),
|
||||
QObject *parent = nullptr);
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
|
||||
#include "abstracttest.h"
|
||||
|
||||
#include <qtestcase.h>
|
||||
#include <QApplication>
|
||||
#include <QByteArray>
|
||||
#include <QDir>
|
||||
|
@ -36,15 +35,16 @@
|
|||
#include <QFileInfo>
|
||||
#include <QFlags>
|
||||
#include <QIODevice>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonObject>
|
||||
#include <QLineF>
|
||||
#include <QPointF>
|
||||
#include <QProcess>
|
||||
#include <QScopedPointer>
|
||||
#include <QStringList>
|
||||
#include <QVector>
|
||||
#include <QtGlobal>
|
||||
#include <QLineF>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonArray>
|
||||
#include <qtestcase.h>
|
||||
|
||||
#include "../vgeometry/vgobject.h"
|
||||
#include "../vgeometry/vpointf.h"
|
||||
|
@ -52,9 +52,9 @@
|
|||
#include "../vgeometry/vsplinepath.h"
|
||||
#include "../vlayout/vabstractpiece.h"
|
||||
#include "../vpatterndb/vcontainer.h"
|
||||
#include "../vpatterndb/vpassmark.h"
|
||||
#include "../vpatterndb/vpiece.h"
|
||||
#include "../vpatterndb/vpiecenode.h"
|
||||
#include "../vpatterndb/vpassmark.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -77,8 +77,7 @@ auto FillPath(const QVector<QPointF> &path, qreal accuracy) -> QVector<QPointF>
|
|||
l.setLength(len);
|
||||
pathFilled.append(l.p2());
|
||||
len += accuracy;
|
||||
}
|
||||
while(line.length() > len);
|
||||
} while (line.length() > len);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,8 +88,8 @@ auto FillPath(const QVector<QPointF> &path, qreal accuracy) -> QVector<QPointF>
|
|||
} // namespace
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
AbstractTest::AbstractTest(QObject *parent) :
|
||||
QObject(parent)
|
||||
AbstractTest::AbstractTest(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -295,13 +294,15 @@ void AbstractTest::ComparePathsDistance(const QVector<QPointF> &ekv, const QVect
|
|||
void AbstractTest::ComparePointsDistance(const QPointF &result, const QPointF &expected, qreal testAccuracy) const
|
||||
{
|
||||
const QString msg = QStringLiteral("Actual '%2;%3', Expected '%4;%5'. Distance between points %6 mm.")
|
||||
.arg(result.x()).arg(result.y()).arg(expected.x()).arg(expected.y())
|
||||
.arg(result.x())
|
||||
.arg(result.y())
|
||||
.arg(expected.x())
|
||||
.arg(expected.y())
|
||||
.arg(UnitConvertor(QLineF(result, expected).length(), Unit::Px, Unit::Mm));
|
||||
// Check each point. Don't use comparison float values
|
||||
QVERIFY2(VFuzzyComparePoints(result, expected, testAccuracy), qUtf8Printable(msg));
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void AbstractTest::CompareLinesDistance(const QVector<QLineF> &result, const QVector<QLineF> &expected) const
|
||||
{
|
||||
|
@ -313,9 +314,9 @@ void AbstractTest::CompareLinesDistance(const QVector<QLineF> &result, const QVe
|
|||
const QLineF &line1 = result.at(i);
|
||||
const QLineF &line2 = expected.at(i);
|
||||
// Check each point. Don't use comparison float values
|
||||
QVERIFY2(VFuzzyComparePoints(line1.p1(), line2.p1()) && VFuzzyComparePoints(line1.p2(), line2.p2()),
|
||||
qUtf8Printable(
|
||||
QStringLiteral("Index: %1. Got line '(%2;%3):(%4;%5)', Expected line '(%6;%7):(%8;%9)'.")
|
||||
QVERIFY2(
|
||||
VFuzzyComparePoints(line1.p1(), line2.p1()) && VFuzzyComparePoints(line1.p2(), line2.p2()),
|
||||
qUtf8Printable(QStringLiteral("Index: %1. Got line '(%2;%3):(%4;%5)', Expected line '(%6;%7):(%8;%9)'.")
|
||||
.arg(i)
|
||||
.arg(line1.p1().x())
|
||||
.arg(line1.p1().y())
|
||||
|
@ -324,9 +325,7 @@ void AbstractTest::CompareLinesDistance(const QVector<QLineF> &result, const QVe
|
|||
.arg(line2.p1().x())
|
||||
.arg(line2.p1().y())
|
||||
.arg(line2.p2().x())
|
||||
.arg(line2.p2().y())
|
||||
)
|
||||
);
|
||||
.arg(line2.p2().y())));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -408,8 +407,8 @@ auto AbstractTest::Run(int exit, const QString &program, const QStringList &argu
|
|||
{
|
||||
msecs = AbstractTest::RunTimeout(msecs);
|
||||
|
||||
const QString parameters = QStringLiteral("Program: %1 \nArguments: %2.")
|
||||
.arg(program, arguments.join(QStringLiteral(", ")));
|
||||
const QString parameters =
|
||||
QStringLiteral("Program: %1 \nArguments: %2.").arg(program, arguments.join(QStringLiteral(", ")));
|
||||
|
||||
QFileInfo info(program);
|
||||
if (not info.exists())
|
||||
|
@ -446,7 +445,8 @@ auto AbstractTest::Run(int exit, const QString &program, const QStringList &argu
|
|||
|
||||
if (process->exitCode() != exit)
|
||||
{
|
||||
error = QStringLiteral("Unexpected finish. Exit code: %1\n%2").arg(process->exitCode())
|
||||
error = QStringLiteral("Unexpected finish. Exit code: %1\n%2")
|
||||
.arg(process->exitCode())
|
||||
.arg(QString(process->readAllStandardError()));
|
||||
return process->exitCode();
|
||||
}
|
||||
|
@ -470,8 +470,8 @@ auto AbstractTest::CopyRecursively(const QString &srcFilePath, const QString &tg
|
|||
return false;
|
||||
}
|
||||
QDir sourceDir(srcFilePath);
|
||||
const QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot |
|
||||
QDir::Hidden | QDir::System);
|
||||
const QStringList fileNames =
|
||||
sourceDir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System);
|
||||
for (auto &fileName : fileNames)
|
||||
{
|
||||
const QString newSrcFilePath = srcFilePath + QDir::separator() + fileName;
|
||||
|
@ -504,8 +504,8 @@ auto AbstractTest::CopyRecursively(const QString &srcFilePath, const QString &tg
|
|||
QFile srcFile(srcFilePath);
|
||||
if (not srcFile.open(QFile::ReadOnly))
|
||||
{
|
||||
const QString msg = QStringLiteral("Can't copy file '%1'. Error: %2")
|
||||
.arg(srcFilePath, srcFile.errorString());
|
||||
const QString msg =
|
||||
QStringLiteral("Can't copy file '%1'. Error: %2").arg(srcFilePath, srcFile.errorString());
|
||||
QWARN(qUtf8Printable(msg));
|
||||
return false;
|
||||
}
|
||||
|
@ -589,8 +589,8 @@ void AbstractTest::ReadBooleanValue(const QJsonObject &itemObject, const QString
|
|||
}
|
||||
else
|
||||
{
|
||||
const QString error = QStringLiteral("%1 is not boolean value '%2'.").arg(attribute,
|
||||
attributeValue.toString());
|
||||
const QString error =
|
||||
QStringLiteral("%1 is not boolean value '%2'.").arg(attribute, attributeValue.toString());
|
||||
QFAIL(qUtf8Printable(error));
|
||||
}
|
||||
}
|
||||
|
@ -703,7 +703,6 @@ void AbstractTest::ReadPieceNodeValue(const QJsonObject &itemObject, VPieceNode
|
|||
node = VPieceNode(id, typeTool, reverse);
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template <typename T, typename std::enable_if<std::is_floating_point<T>::value>::type *>
|
||||
void AbstractTest::ReadDoubleValue(const QJsonObject &itemObject, const QString &attribute, T &value,
|
||||
|
@ -930,8 +929,8 @@ void AbstractTest::DBFromJson(const QJsonObject &dbObject, QSharedPointer<VConta
|
|||
break;
|
||||
default:
|
||||
{
|
||||
const QString error = QStringLiteral("Not supported item type '%1'.")
|
||||
.arg(static_cast<int>(objectType));
|
||||
const QString error =
|
||||
QStringLiteral("Not supported item type '%1'.").arg(static_cast<int>(objectType));
|
||||
QFAIL(qUtf8Printable(error));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,9 @@
|
|||
|
||||
#include <QDialog>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
|
|
|
@ -27,9 +27,9 @@
|
|||
*************************************************************************/
|
||||
|
||||
#include "global.h"
|
||||
#include "../vmisc/compatibility.h"
|
||||
#include "../vmisc/def.h"
|
||||
#include "../vmisc/vabstractapplication.h"
|
||||
#include "../vmisc/compatibility.h"
|
||||
|
||||
#include <QBitmap>
|
||||
#include <QGraphicsItem>
|
||||
|
@ -178,9 +178,7 @@ void GraphicsItemHighlightSelected(const QRectF &boundingRect, qreal itemPenWidt
|
|||
|
||||
const QColor fgcolor = option->palette.windowText().color();
|
||||
const QColor bgcolor( // ensure good contrast against fgcolor
|
||||
fgcolor.red() > 127 ? 0 : 255,
|
||||
fgcolor.green() > 127 ? 0 : 255,
|
||||
fgcolor.blue() > 127 ? 0 : 255);
|
||||
fgcolor.red() > 127 ? 0 : 255, fgcolor.green() > 127 ? 0 : 255, fgcolor.blue() > 127 ? 0 : 255);
|
||||
|
||||
painter->setPen(QPen(bgcolor, penWidth, Qt::SolidLine));
|
||||
painter->setBrush(Qt::NoBrush);
|
||||
|
@ -195,6 +193,6 @@ void GraphicsItemHighlightSelected(const QRectF &boundingRect, qreal itemPenWidt
|
|||
auto IsSelectedByReleaseEvent(QGraphicsItem *item, QGraphicsSceneMouseEvent *event) -> bool
|
||||
{
|
||||
SCASSERT(item != nullptr)
|
||||
return event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick
|
||||
&& item->contains(event->pos());
|
||||
return event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick &&
|
||||
item->contains(event->pos());
|
||||
}
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
#ifndef GLOBAL_H
|
||||
#define GLOBAL_H
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QStyleOptionGraphicsItem>
|
||||
#include <QtGlobal>
|
||||
|
||||
extern const qreal minVisibleFontSize;
|
||||
|
||||
|
|
|
@ -30,22 +30,25 @@
|
|||
|
||||
#include <QItemDelegate>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif
|
||||
|
||||
class VComboBoxDelegate : public QItemDelegate
|
||||
{
|
||||
Q_OBJECT // NOLINT
|
||||
|
||||
public:
|
||||
explicit VComboBoxDelegate(const QStringList &items, QObject *parent = nullptr);
|
||||
|
||||
virtual auto createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
-> QWidget * override;
|
||||
virtual void setEditorData(QWidget *editor, const QModelIndex &index) const override;
|
||||
virtual void setModelData(QWidget *editor, QAbstractItemModel *model,
|
||||
const QModelIndex &index) const override;
|
||||
virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
|
||||
|
||||
virtual void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const override;
|
||||
|
||||
private:
|
||||
// cppcheck-suppress unknownMacro
|
||||
Q_DISABLE_COPY_MOVE(VComboBoxDelegate) // NOLINT
|
||||
|
|
|
@ -31,13 +31,16 @@
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VDecorationAligningDelegate::VDecorationAligningDelegate(Qt::Alignment alignment, QObject *parent)
|
||||
: QStyledItemDelegate(parent), m_alignment(alignment)
|
||||
{}
|
||||
: QStyledItemDelegate(parent),
|
||||
m_alignment(alignment)
|
||||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VDecorationAligningDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
void VDecorationAligningDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const
|
||||
{
|
||||
QIcon icon = QIcon(qvariant_cast<QIcon>(index.data(Qt::DecorationRole)));
|
||||
auto icon(qvariant_cast<QIcon>(index.data(Qt::DecorationRole)));
|
||||
|
||||
if ((option.state & QStyle::State_Selected) != 0U)
|
||||
{
|
||||
|
|
|
@ -30,7 +30,9 @@
|
|||
|
||||
#include <QStyledItemDelegate>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif
|
||||
|
||||
class VDecorationAligningDelegate : public QStyledItemDelegate
|
||||
{
|
||||
|
|
|
@ -29,13 +29,22 @@
|
|||
#include "tst_tapecommandline.h"
|
||||
#include "../vmisc/vsysexits.h"
|
||||
|
||||
#include <QtTest>
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
#include "../vmisc/diagnostic.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
|
||||
#include <QGlobalStatic>
|
||||
#include <QtTest>
|
||||
|
||||
namespace
|
||||
{
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, tmpTestFolder, (QLatin1String("tst_tape_tmp"))) // NOLINT
|
||||
}
|
||||
|
||||
QT_WARNING_POP
|
||||
} // namespace
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
TST_TapeCommandLine::TST_TapeCommandLine(QObject *parent)
|
||||
|
@ -66,50 +75,35 @@ void TST_TapeCommandLine::OpenMeasurements_data() const
|
|||
QTest::addColumn<int>("exitCode");
|
||||
|
||||
// The file doesn't exist!
|
||||
QTest::newRow("Send wrong path to a file") << "wrongPath.vit"
|
||||
<< V_EX_NOINPUT;
|
||||
QTest::newRow("Send wrong path to a file") << "wrongPath.vit" << V_EX_NOINPUT;
|
||||
|
||||
QTest::newRow("Old individual format to new version") << "keiko.vit"
|
||||
<< V_EX_OK;
|
||||
QTest::newRow("Old individual format to new version") << "keiko.vit" << V_EX_OK;
|
||||
|
||||
QTest::newRow("Open empty file") << "empty.vit"
|
||||
<< V_EX_OK;
|
||||
QTest::newRow("Open empty file") << "empty.vit" << V_EX_OK;
|
||||
|
||||
QTest::newRow("Open the VIT file with all know measurements (v0.3.0)") << "all_measurements_v0.3.0.vit"
|
||||
<< V_EX_OK;
|
||||
QTest::newRow("Open the VIT file with all know measurements (v0.3.0)") << "all_measurements_v0.3.0.vit" << V_EX_OK;
|
||||
|
||||
QTest::newRow("Open the VST file with all know measurements (v0.4.0)") << "all_measurements_v0.4.0.vst"
|
||||
<< V_EX_OK;
|
||||
QTest::newRow("Open the VST file with all know measurements (v0.4.0)") << "all_measurements_v0.4.0.vst" << V_EX_OK;
|
||||
|
||||
QTest::newRow("Open the VST file for man ru GOST (v0.3.0).") << "GOST_man_ru_v0.3.0.vst"
|
||||
<< V_EX_OK;
|
||||
QTest::newRow("Open the VST file for man ru GOST (v0.3.0).") << "GOST_man_ru_v0.3.0.vst" << V_EX_OK;
|
||||
|
||||
QTest::newRow("Open the VIT file with all know measurements (v0.3.3)") << "all_measurements_v0.3.3.vit"
|
||||
<< V_EX_OK;
|
||||
QTest::newRow("Open the VIT file with all know measurements (v0.3.3)") << "all_measurements_v0.3.3.vit" << V_EX_OK;
|
||||
|
||||
QTest::newRow("Open the VST file with all know measurements (v0.4.2)") << "all_measurements_v0.4.2.vst"
|
||||
<< V_EX_OK;
|
||||
QTest::newRow("Open the VST file with all know measurements (v0.4.2)") << "all_measurements_v0.4.2.vst" << V_EX_OK;
|
||||
|
||||
QTest::newRow("Open the VST file for man ru GOST (v0.4.2).") << "GOST_man_ru_v0.4.2.vst"
|
||||
<< V_EX_OK;
|
||||
QTest::newRow("Open the VST file for man ru GOST (v0.4.2).") << "GOST_man_ru_v0.4.2.vst" << V_EX_OK;
|
||||
|
||||
QTest::newRow("Broken file. Not unique name.") << "broken1.vit"
|
||||
<< V_EX_NOINPUT;
|
||||
QTest::newRow("Broken file. Not unique name.") << "broken1.vit" << V_EX_NOINPUT;
|
||||
|
||||
QTest::newRow("Broken file. Measurement name can't be empty.") << "broken1.vit"
|
||||
<< V_EX_NOINPUT;
|
||||
QTest::newRow("Broken file. Measurement name can't be empty.") << "broken1.vit" << V_EX_NOINPUT;
|
||||
|
||||
QTest::newRow("Broken file. An empty value shouldn't break a file.") << "broken3.vit"
|
||||
<< V_EX_OK;
|
||||
QTest::newRow("Broken file. An empty value shouldn't break a file.") << "broken3.vit" << V_EX_OK;
|
||||
|
||||
QTest::newRow("Broken file. Invalid measurement name.") << "broken4.vit"
|
||||
<< V_EX_NOINPUT;
|
||||
QTest::newRow("Broken file. Invalid measurement name.") << "broken4.vit" << V_EX_NOINPUT;
|
||||
|
||||
QTest::newRow("Empty text VIT file.") << "text.vit"
|
||||
<< V_EX_NOINPUT;
|
||||
QTest::newRow("Empty text VIT file.") << "text.vit" << V_EX_NOINPUT;
|
||||
|
||||
QTest::newRow("Empty text VST file.") << "text.vst"
|
||||
<< V_EX_NOINPUT;
|
||||
QTest::newRow("Empty text VST file.") << "text.vst" << V_EX_NOINPUT;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -119,9 +113,11 @@ void TST_TapeCommandLine::OpenMeasurements()
|
|||
QFETCH(int, exitCode);
|
||||
|
||||
QString error;
|
||||
const int exit = Run(exitCode, TapePath(), QStringList() << "--test"
|
||||
const int exit = Run(exitCode, TapePath(),
|
||||
QStringList() << "--test"
|
||||
<< QCoreApplication::applicationDirPath() + QDir::separator() + *tmpTestFolder +
|
||||
QDir::separator() + file, error);
|
||||
QDir::separator() + file,
|
||||
error);
|
||||
|
||||
QVERIFY2(exit == exitCode, qUtf8Printable(error.right(350)));
|
||||
}
|
||||
|
|
|
@ -29,14 +29,24 @@
|
|||
#include "tst_valentinacommandline.h"
|
||||
#include "../vmisc/vsysexits.h"
|
||||
|
||||
#include <QtTest>
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
#include "../vmisc/diagnostic.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
|
||||
#include <QGlobalStatic>
|
||||
#include <QtTest>
|
||||
|
||||
namespace
|
||||
{
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, tmpTestFolder, (QLatin1String("tst_valentina_tmp"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, tmpTestCollectionFolder, (QLatin1String("tst_valentina_collection_tmp"))) // NOLINT
|
||||
}
|
||||
// NOLINTNEXTLINE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, tmpTestCollectionFolder, (QLatin1String("tst_valentina_collection_tmp")))
|
||||
|
||||
QT_WARNING_POP
|
||||
} // namespace
|
||||
|
||||
TST_ValentinaCommandLine::TST_ValentinaCommandLine(QObject *parent)
|
||||
: AbstractTest(parent)
|
||||
|
@ -88,24 +98,19 @@ void TST_ValentinaCommandLine::OpenPatterns_data() const
|
|||
|
||||
// The file doesn't exist!
|
||||
QTest::newRow("Send wrong path to a file") << "wrongPath.val"
|
||||
<< "--test"
|
||||
<< V_EX_NOINPUT;
|
||||
<< "--test" << V_EX_NOINPUT;
|
||||
|
||||
QTest::newRow("Measurement independent empty file") << "empty.val"
|
||||
<< "--test"
|
||||
<< V_EX_OK;
|
||||
<< "--test" << V_EX_OK;
|
||||
|
||||
QTest::newRow("File with invalid object type") << "wrong_obj_type.val"
|
||||
<< "--test"
|
||||
<< V_EX_NOINPUT;
|
||||
<< "--test" << V_EX_NOINPUT;
|
||||
|
||||
QTest::newRow("Empty text VAL file") << "txt.val"
|
||||
<< "--test"
|
||||
<< V_EX_NOINPUT;
|
||||
<< "--test" << V_EX_NOINPUT;
|
||||
|
||||
QTest::newRow("Pattern with a warning") << "test_pedantic.val"
|
||||
<< "--test;;--pedantic"
|
||||
<< V_EX_DATAERR;
|
||||
<< "--test;;--pedantic" << V_EX_DATAERR;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -118,8 +123,8 @@ void TST_ValentinaCommandLine::OpenPatterns()
|
|||
|
||||
QString error;
|
||||
const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + *tmpTestFolder;
|
||||
const int exit = Run(exitCode, ValentinaPath(), QStringList() << arguments.split(";;")
|
||||
<< tmp + QDir::separator() + file, error);
|
||||
const int exit =
|
||||
Run(exitCode, ValentinaPath(), QStringList() << arguments.split(";;") << tmp + QDir::separator() + file, error);
|
||||
|
||||
QVERIFY2(exit == exitCode, qUtf8Printable(error.right(350)));
|
||||
}
|
||||
|
@ -134,8 +139,7 @@ void TST_ValentinaCommandLine::ExportMode_data() const
|
|||
|
||||
const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + *tmpTestFolder;
|
||||
|
||||
QTest::newRow("Issue #372")<< "issue_372.val"
|
||||
<< QString("-p;;0;;-d;;%1;;-b;;output;;--coefficient;;1").arg(tmp)
|
||||
QTest::newRow("Issue #372") << "issue_372.val" << QString("-p;;0;;-d;;%1;;-b;;output;;--coefficient;;1").arg(tmp)
|
||||
<< V_EX_OK;
|
||||
}
|
||||
|
||||
|
@ -149,8 +153,7 @@ void TST_ValentinaCommandLine::ExportMode()
|
|||
|
||||
QString error;
|
||||
const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + *tmpTestFolder;
|
||||
const QStringList arg = QStringList() << tmp + QDir::separator() + file
|
||||
<< arguments.split(";;");
|
||||
const QStringList arg = QStringList() << tmp + QDir::separator() + file << arguments.split(";;");
|
||||
const int exit = Run(exitCode, ValentinaPath(), arg, error);
|
||||
|
||||
QVERIFY2(exit == exitCode, qUtf8Printable(error.right(350)));
|
||||
|
@ -165,37 +168,29 @@ void TST_ValentinaCommandLine::TestMode_data() const
|
|||
|
||||
const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + *tmpTestFolder;
|
||||
|
||||
QTest::newRow("Issue #256. Correct path.")<< "issue_256.val"
|
||||
<< QString("--test")
|
||||
<< V_EX_OK;
|
||||
QTest::newRow("Issue #256. Correct path.") << "issue_256.val" << QString("--test") << V_EX_OK;
|
||||
|
||||
QTest::newRow("Issue #256. Wrong path.")<< "issue_256_wrong_path.vit"
|
||||
<< QString("--test")
|
||||
QTest::newRow("Issue #256. Wrong path.") << "issue_256_wrong_path.vit" << QString("--test") << V_EX_NOINPUT;
|
||||
|
||||
QTest::newRow("Issue #256. Correct individual measurements.")
|
||||
<< "issue_256.val"
|
||||
<< QString("--test;;-m;;%1").arg(tmp + QDir::separator() + QLatin1String("issue_256_correct.vit")) << V_EX_OK;
|
||||
|
||||
QTest::newRow("Issue #256. Wrong individual measurements.")
|
||||
<< "issue_256.val"
|
||||
<< QString("--test;;-m;;%1").arg(tmp + QDir::separator() + QLatin1String("issue_256_wrong.vit"))
|
||||
<< V_EX_NOINPUT;
|
||||
|
||||
QTest::newRow("Issue #256. Correct individual measurements.")<< "issue_256.val"
|
||||
<< QString("--test;;-m;;%1").arg(tmp + QDir::separator() +
|
||||
QLatin1String("issue_256_correct.vit"))
|
||||
<< V_EX_OK;
|
||||
QTest::newRow("Issue #256. Correct multisize measurements.")
|
||||
<< "issue_256.val"
|
||||
<< QString("--test;;-m;;%1").arg(tmp + QDir::separator() + QLatin1String("issue_256_correct.vst")) << V_EX_OK;
|
||||
|
||||
QTest::newRow("Issue #256. Wrong individual measurements.")<< "issue_256.val"
|
||||
<< QString("--test;;-m;;%1").arg(tmp + QDir::separator() +
|
||||
QLatin1String("issue_256_wrong.vit"))
|
||||
QTest::newRow("Issue #256. Wrong multisize measurements.")
|
||||
<< "issue_256.val"
|
||||
<< QString("--test;;-m;;%1").arg(tmp + QDir::separator() + QLatin1String("issue_256_wrong.vst"))
|
||||
<< V_EX_NOINPUT;
|
||||
|
||||
QTest::newRow("Issue #256. Correct multisize measurements.")<< "issue_256.val"
|
||||
<< QString("--test;;-m;;%1").arg(tmp + QDir::separator() +
|
||||
QLatin1String("issue_256_correct.vst"))
|
||||
<< V_EX_OK;
|
||||
|
||||
QTest::newRow("Issue #256. Wrong multisize measurements.")<< "issue_256.val"
|
||||
<< QString("--test;;-m;;%1").arg(tmp + QDir::separator() +
|
||||
QLatin1String("issue_256_wrong.vst"))
|
||||
<< V_EX_NOINPUT;
|
||||
|
||||
QTest::newRow("Wrong formula.")<< "wrong_formula.val"
|
||||
<< QString("--test")
|
||||
<< V_EX_DATAERR;
|
||||
QTest::newRow("Wrong formula.") << "wrong_formula.val" << QString("--test") << V_EX_DATAERR;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -207,8 +202,7 @@ void TST_ValentinaCommandLine::TestMode()
|
|||
|
||||
QString error;
|
||||
const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + *tmpTestFolder;
|
||||
const QStringList arg = QStringList() << tmp + QDir::separator() + file
|
||||
<< arguments.split(";;");
|
||||
const QStringList arg = QStringList() << tmp + QDir::separator() + file << arguments.split(";;");
|
||||
const int exit = Run(exitCode, ValentinaPath(), arg, error);
|
||||
|
||||
QVERIFY2(exit == exitCode, qUtf8Printable(error.right(350)));
|
||||
|
@ -268,8 +262,7 @@ void TST_ValentinaCommandLine::TestOpenCollection()
|
|||
|
||||
QString error;
|
||||
const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + *tmpTestCollectionFolder;
|
||||
const QStringList arg = QStringList() << tmp + QDir::separator() + file
|
||||
<< arguments.split(";;");
|
||||
const QStringList arg = QStringList() << tmp + QDir::separator() + file << arguments.split(";;");
|
||||
const int exit = Run(exitCode, ValentinaPath(), arg, error);
|
||||
|
||||
QVERIFY2(exit == exitCode, qUtf8Printable(error.right(350)));
|
||||
|
|
|
@ -32,34 +32,35 @@
|
|||
#include <xercesc/util/PlatformUtils.hpp>
|
||||
#endif
|
||||
|
||||
#include "tst_vposter.h"
|
||||
#include "tst_vabstractpiece.h"
|
||||
#include "tst_vspline.h"
|
||||
#include "tst_nameregexp.h"
|
||||
#include "tst_vlayoutdetail.h"
|
||||
#include "tst_varc.h"
|
||||
#include "tst_vellipticalarc.h"
|
||||
#include "tst_qmutokenparser.h"
|
||||
#include "tst_vmeasurements.h"
|
||||
#include "tst_vlockguard.h"
|
||||
#include "tst_misc.h"
|
||||
#include "tst_vcommandline.h"
|
||||
#include "tst_vpiece.h"
|
||||
#include "tst_findpoint.h"
|
||||
#include "tst_vabstractcurve.h"
|
||||
#include "tst_vcubicbezierpath.h"
|
||||
#include "tst_vgobject.h"
|
||||
#include "tst_vsplinepath.h"
|
||||
#include "tst_vpointf.h"
|
||||
#include "tst_readval.h"
|
||||
#include "tst_vtranslatevars.h"
|
||||
#include "tst_vtooluniondetails.h"
|
||||
#include "tst_vdomdocument.h"
|
||||
#include "tst_dxf.h"
|
||||
#include "tst_findpoint.h"
|
||||
#include "tst_misc.h"
|
||||
#include "tst_nameregexp.h"
|
||||
#include "tst_qmutokenparser.h"
|
||||
#include "tst_readval.h"
|
||||
#include "tst_vabstractcurve.h"
|
||||
#include "tst_vabstractpiece.h"
|
||||
#include "tst_varc.h"
|
||||
#include "tst_vcommandline.h"
|
||||
#include "tst_vcubicbezierpath.h"
|
||||
#include "tst_vdomdocument.h"
|
||||
#include "tst_vellipticalarc.h"
|
||||
#include "tst_vgobject.h"
|
||||
#include "tst_vlayoutdetail.h"
|
||||
#include "tst_vlockguard.h"
|
||||
#include "tst_vmeasurements.h"
|
||||
#include "tst_vpiece.h"
|
||||
#include "tst_vpointf.h"
|
||||
#include "tst_vposter.h"
|
||||
#include "tst_vspline.h"
|
||||
#include "tst_vsplinepath.h"
|
||||
#include "tst_vsvgpathtokenizer.h"
|
||||
#include "tst_vtooluniondetails.h"
|
||||
#include "tst_vtranslatevars.h"
|
||||
#include "tst_xsdschema.h"
|
||||
|
||||
#include "../vmisc/def.h"
|
||||
#include "../qmuparser/qmudef.h"
|
||||
#include "../vmisc/def.h"
|
||||
#include "../vmisc/testvapplication.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue
Block a user