Refactoring. Reduce modules dependency.
--HG-- branch : develop
This commit is contained in:
parent
d21da1944e
commit
5c84c80039
|
@ -41,6 +41,7 @@
|
||||||
class VCommandLine;
|
class VCommandLine;
|
||||||
using VCommandLinePtr = std::shared_ptr<VCommandLine>;
|
using VCommandLinePtr = std::shared_ptr<VCommandLine>;
|
||||||
using VLayoutGeneratorPtr = std::shared_ptr<VLayoutGenerator>;
|
using VLayoutGeneratorPtr = std::shared_ptr<VLayoutGenerator>;
|
||||||
|
enum class PageOrientation : bool;
|
||||||
|
|
||||||
//@brief: class used to install export command line options and parse their values
|
//@brief: class used to install export command line options and parse their values
|
||||||
//QCommandLineParser* object must exists until this object alive
|
//QCommandLineParser* object must exists until this object alive
|
||||||
|
|
|
@ -33,8 +33,6 @@
|
||||||
#include <QMargins>
|
#include <QMargins>
|
||||||
|
|
||||||
#include "vabstractlayoutdialog.h"
|
#include "vabstractlayoutdialog.h"
|
||||||
#include "../vlayout/vbank.h"
|
|
||||||
#include "../ifc/ifcdef.h"
|
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
|
@ -42,6 +40,7 @@ namespace Ui
|
||||||
}
|
}
|
||||||
|
|
||||||
class VLayoutGenerator;
|
class VLayoutGenerator;
|
||||||
|
enum class Cases : char;
|
||||||
|
|
||||||
class DialogLayoutSettings : public VAbstractLayoutDialog
|
class DialogLayoutSettings : public VAbstractLayoutDialog
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,11 +29,11 @@
|
||||||
#ifndef VABSTRACTLAYOUTDIALOG_H
|
#ifndef VABSTRACTLAYOUTDIALOG_H
|
||||||
#define VABSTRACTLAYOUTDIALOG_H
|
#define VABSTRACTLAYOUTDIALOG_H
|
||||||
|
|
||||||
#include "../ifc/ifcdef.h"
|
|
||||||
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
|
enum class Unit : char;
|
||||||
|
|
||||||
class VAbstractLayoutDialog : public QDialog
|
class VAbstractLayoutDialog : public QDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -323,8 +323,8 @@ bool MainWindowsNoGUI::GenerateLayout(VLayoutGenerator& lGenerator)
|
||||||
isLayoutPortrait = lGenerator.IsPortrait();
|
isLayoutPortrait = lGenerator.IsPortrait();
|
||||||
scenes = CreateScenes(papers, shadows, details);
|
scenes = CreateScenes(papers, shadows, details);
|
||||||
//Uncomment to debug, shows global contour
|
//Uncomment to debug, shows global contour
|
||||||
// gcontours = lGenerator.GetGlobalContours(); // uncomment for debugging
|
gcontours = lGenerator.GetGlobalContours(); // uncomment for debugging
|
||||||
// InsertGlobalContours(scenes, gcontours); // uncomment for debugging
|
InsertGlobalContours(scenes, gcontours); // uncomment for debugging
|
||||||
if (VApplication::IsGUIMode())
|
if (VApplication::IsGUIMode())
|
||||||
{
|
{
|
||||||
PrepareSceneList(PreviewQuatilty::Fast);
|
PrepareSceneList(PreviewQuatilty::Fast);
|
||||||
|
|
|
@ -51,6 +51,7 @@
|
||||||
#include "../vmisc/vmath.h"
|
#include "../vmisc/vmath.h"
|
||||||
#include "dxiface.h"
|
#include "dxiface.h"
|
||||||
#include "../vlayout/vlayoutpiece.h"
|
#include "../vlayout/vlayoutpiece.h"
|
||||||
|
#include "../vgeometry/vgeometrydef.h"
|
||||||
|
|
||||||
static const qreal AAMATextHeight = 2.5;
|
static const qreal AAMATextHeight = 2.5;
|
||||||
|
|
||||||
|
|
|
@ -768,6 +768,44 @@ QT_WARNING_POP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
template<class T>
|
||||||
|
QVector<T> CorrectPathDistortion(QVector<T> path)
|
||||||
|
{
|
||||||
|
if (path.size() < 3)
|
||||||
|
{
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
int prev = -1;
|
||||||
|
for (qint32 i = 0; i < path.size(); ++i)
|
||||||
|
{
|
||||||
|
if (prev == -1)
|
||||||
|
{
|
||||||
|
i == 0 ? prev = path.size() - 1 : prev = i-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int next = i+1;
|
||||||
|
if (i == path.size() - 1)
|
||||||
|
{
|
||||||
|
next = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QPointF &iPoint = path.at(i);
|
||||||
|
const QPointF &prevPoint = path.at(prev);
|
||||||
|
const QPointF &nextPoint = path.at(next);
|
||||||
|
|
||||||
|
if (VGObject::IsPointOnLineSegment(iPoint, prevPoint, nextPoint))
|
||||||
|
{
|
||||||
|
const QPointF p = VGObject::CorrectDistortion(iPoint, prevPoint, nextPoint);
|
||||||
|
path[i].setX(p.x());
|
||||||
|
path[i].setY(p.y());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return path;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Friend functions
|
// Friend functions
|
||||||
|
|
|
@ -44,6 +44,8 @@ class VAbstractPieceData;
|
||||||
class QPainterPath;
|
class QPainterPath;
|
||||||
class VGrainlineData;
|
class VGrainlineData;
|
||||||
class VContainer;
|
class VContainer;
|
||||||
|
enum class LayoutGravity : qint8;
|
||||||
|
enum class CuttingTime : unsigned char;
|
||||||
|
|
||||||
QT_WARNING_PUSH
|
QT_WARNING_PUSH
|
||||||
QT_WARNING_DISABLE_GCC("-Weffc++")
|
QT_WARNING_DISABLE_GCC("-Weffc++")
|
||||||
|
@ -223,9 +225,6 @@ public:
|
||||||
static QLineF ParallelLine(const VSAPoint &p1, const VSAPoint &p2, qreal width);
|
static QLineF ParallelLine(const VSAPoint &p1, const VSAPoint &p2, qreal width);
|
||||||
static bool IsAllowanceValid(const QVector<QPointF> &base, const QVector<QPointF> &allowance);
|
static bool IsAllowanceValid(const QVector<QPointF> &base, const QVector<QPointF> &allowance);
|
||||||
|
|
||||||
template <class T>
|
|
||||||
static QVector<T> CorrectPathDistortion(QVector<T> path);
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
static QVector<T> CorrectEquidistantPoints(const QVector<T> &points, bool removeFirstAndLast = true);
|
static QVector<T> CorrectEquidistantPoints(const QVector<T> &points, bool removeFirstAndLast = true);
|
||||||
|
|
||||||
|
@ -254,44 +253,6 @@ private:
|
||||||
|
|
||||||
Q_DECLARE_TYPEINFO(VAbstractPiece, Q_MOVABLE_TYPE);
|
Q_DECLARE_TYPEINFO(VAbstractPiece, Q_MOVABLE_TYPE);
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
template<class T>
|
|
||||||
QVector<T> VAbstractPiece::CorrectPathDistortion(QVector<T> path)
|
|
||||||
{
|
|
||||||
if (path.size() < 3)
|
|
||||||
{
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
int prev = -1;
|
|
||||||
for (qint32 i = 0; i < path.size(); ++i)
|
|
||||||
{
|
|
||||||
if (prev == -1)
|
|
||||||
{
|
|
||||||
i == 0 ? prev = path.size() - 1 : prev = i-1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int next = i+1;
|
|
||||||
if (i == path.size() - 1)
|
|
||||||
{
|
|
||||||
next = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const QPointF &iPoint = path.at(i);
|
|
||||||
const QPointF &prevPoint = path.at(prev);
|
|
||||||
const QPointF &nextPoint = path.at(next);
|
|
||||||
|
|
||||||
if (VGObject::IsPointOnLineSegment(iPoint, prevPoint, nextPoint))
|
|
||||||
{
|
|
||||||
const QPointF p = VGObject::CorrectDistortion(iPoint, prevPoint, nextPoint);
|
|
||||||
path[i].setX(p.x());
|
|
||||||
path[i].setY(p.y());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief CorrectEquidistantPoints clear equivalent points and remove point on line from equdistant.
|
* @brief CorrectEquidistantPoints clear equivalent points and remove point on line from equdistant.
|
||||||
|
|
|
@ -34,6 +34,8 @@
|
||||||
#include "../vmisc/vabstractapplication.h"
|
#include "../vmisc/vabstractapplication.h"
|
||||||
#include "vlayoutpiece.h"
|
#include "vlayoutpiece.h"
|
||||||
#include "vlayoutdef.h"
|
#include "vlayoutdef.h"
|
||||||
|
#include "../ifc/exception/vexception.h"
|
||||||
|
#include "../vpatterndb/floatItemData/floatitemdef.h"
|
||||||
|
|
||||||
QT_WARNING_PUSH
|
QT_WARNING_PUSH
|
||||||
QT_WARNING_DISABLE_CLANG("-Wmissing-prototypes")
|
QT_WARNING_DISABLE_CLANG("-Wmissing-prototypes")
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include <QRectF>
|
#include <QRectF>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
#include <QLoggingCategory>
|
||||||
|
|
||||||
#include "../vmisc/typedef.h"
|
#include "../vmisc/typedef.h"
|
||||||
|
|
||||||
|
@ -45,6 +46,8 @@
|
||||||
#undef small
|
#undef small
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Q_DECLARE_LOGGING_CATEGORY(lBank)
|
||||||
|
|
||||||
class VLayoutPiece;
|
class VLayoutPiece;
|
||||||
|
|
||||||
enum class Cases : char { CaseThreeGroup = 0, CaseTwoGroup, CaseDesc, UnknownCase};
|
enum class Cases : char { CaseThreeGroup = 0, CaseTwoGroup, CaseDesc, UnknownCase};
|
||||||
|
|
|
@ -39,6 +39,8 @@
|
||||||
#include "vcontour_p.h"
|
#include "vcontour_p.h"
|
||||||
#include "vlayoutpiece.h"
|
#include "vlayoutpiece.h"
|
||||||
#include "../vmisc/vmath.h"
|
#include "../vmisc/vmath.h"
|
||||||
|
#include "../vgeometry/vgeometrydef.h"
|
||||||
|
#include "../vgeometry/vgobject.h"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
|
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
|
||||||
#include "../vmisc/vmath.h"
|
#include "../vmisc/vmath.h"
|
||||||
#include "../vmisc/vabstractapplication.h"
|
#include "../vmisc/vabstractapplication.h"
|
||||||
|
#include "../vpatterndb/vcontainer.h"
|
||||||
#include "../vpatterndb/calculator.h"
|
#include "../vpatterndb/calculator.h"
|
||||||
#include "../vpatterndb/vpassmark.h"
|
#include "../vpatterndb/vpassmark.h"
|
||||||
#include "../vpatterndb/vpiecenode.h"
|
#include "../vpatterndb/vpiecenode.h"
|
||||||
|
|
|
@ -40,19 +40,21 @@
|
||||||
#include <QTypeInfo>
|
#include <QTypeInfo>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
#include <QCoreApplication>
|
||||||
|
|
||||||
#include "../ifc/xml/vabstractpattern.h"
|
|
||||||
#include "../vpatterndb/floatItemData/vpatternlabeldata.h"
|
|
||||||
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
|
|
||||||
#include "../vpatterndb/vcontainer.h"
|
|
||||||
#include "vabstractpiece.h"
|
#include "vabstractpiece.h"
|
||||||
#include "../vgeometry/vgeometrydef.h"
|
#include "../vmisc/typedef.h"
|
||||||
|
|
||||||
class VLayoutPieceData;
|
class VLayoutPieceData;
|
||||||
class VLayoutPiecePath;
|
class VLayoutPiecePath;
|
||||||
class QGraphicsItem;
|
class QGraphicsItem;
|
||||||
class QGraphicsPathItem;
|
class QGraphicsPathItem;
|
||||||
class VTextManager;
|
class VTextManager;
|
||||||
|
class VPiece;
|
||||||
|
class VPieceLabelData;
|
||||||
|
class VAbstractPattern;
|
||||||
|
class VPatternLabelData;
|
||||||
|
enum class ArrowType : char;
|
||||||
|
|
||||||
class VLayoutPiece :public VAbstractPiece
|
class VLayoutPiece :public VAbstractPiece
|
||||||
{
|
{
|
||||||
|
|
|
@ -49,6 +49,8 @@
|
||||||
|
|
||||||
#include "../vmisc/def.h"
|
#include "../vmisc/def.h"
|
||||||
#include "../vmisc/vmath.h"
|
#include "../vmisc/vmath.h"
|
||||||
|
#include "../ifc/exception/vexception.h"
|
||||||
|
#include "../vpatterndb/floatItemData/floatitemdef.h"
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
|
||||||
#include "../vmisc/backport/qscopeguard.h"
|
#include "../vmisc/backport/qscopeguard.h"
|
||||||
|
|
|
@ -38,8 +38,6 @@
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
#include "../vlayout/vbank.h"
|
|
||||||
|
|
||||||
class VCommonSettings : public QSettings
|
class VCommonSettings : public QSettings
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
|
|
||||||
#include "../vmisc/def.h"
|
#include "../vmisc/def.h"
|
||||||
#include "../vmisc/vmath.h"
|
#include "../vmisc/vmath.h"
|
||||||
|
#include "../vlayout/vbank.h"
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(QMarginsF)
|
Q_DECLARE_METATYPE(QMarginsF)
|
||||||
|
|
||||||
|
@ -123,6 +124,30 @@ VSettings::VSettings(Format format, Scope scope, const QString &organization, co
|
||||||
qRegisterMetaTypeStreamOperators<QMarginsF>("QMarginsF");
|
qRegisterMetaTypeStreamOperators<QMarginsF>("QMarginsF");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
template <class T>
|
||||||
|
inline T VSettings::ValueOrDef(const QString &setting, const T &defValue) const
|
||||||
|
{
|
||||||
|
const QVariant val = value(setting, QVariant::fromValue(defValue));
|
||||||
|
return val.canConvert<T>() ? val.value<T>() : defValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
template <>
|
||||||
|
inline Cases VSettings::ValueOrDef<Cases>(const QString &setting, const Cases &defValue) const
|
||||||
|
{
|
||||||
|
const QVariant val = value(setting, QVariant::fromValue(static_cast<int>(defValue)));
|
||||||
|
const int g = val.canConvert<int>() ? val.value<int>() : static_cast<int>(defValue);
|
||||||
|
if (g < static_cast<int>(Cases::CaseThreeGroup) || g >= static_cast<int>(Cases::UnknownCase))
|
||||||
|
{
|
||||||
|
return defValue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return static_cast<Cases>(g);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VSettings::GetLabelLanguage() const
|
QString VSettings::GetLabelLanguage() const
|
||||||
{
|
{
|
||||||
|
@ -138,7 +163,7 @@ void VSettings::SetLabelLanguage(const QString &value)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VSettings::GetDefPathLayout()
|
QString VSettings::GetDefPathLayout()
|
||||||
{
|
{
|
||||||
return QDir::homePath() + QLatin1String("/valentina/") + tr("layouts");
|
return QDir::homePath() + QStringLiteral("/valentina/") + tr("layouts");
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -36,11 +36,12 @@
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <QMargins>
|
#include <QMargins>
|
||||||
|
|
||||||
#include "../vmisc/def.h"
|
|
||||||
#include "../vlayout/vbank.h"
|
|
||||||
#include "vcommonsettings.h"
|
#include "vcommonsettings.h"
|
||||||
|
|
||||||
template <class T> class QSharedPointer;
|
template <class T> class QSharedPointer;
|
||||||
|
enum class Cases : char;
|
||||||
|
enum class Unit : char;
|
||||||
|
enum class PageOrientation : bool;
|
||||||
|
|
||||||
class VSettings : public VCommonSettings
|
class VSettings : public VCommonSettings
|
||||||
{
|
{
|
||||||
|
@ -187,28 +188,4 @@ private:
|
||||||
T ValueOrDef(const QString &setting, const T &defValue) const;
|
T ValueOrDef(const QString &setting, const T &defValue) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
template <class T>
|
|
||||||
inline T VSettings::ValueOrDef(const QString &setting, const T &defValue) const
|
|
||||||
{
|
|
||||||
const QVariant val = value(setting, QVariant::fromValue(defValue));
|
|
||||||
return val.canConvert<T>() ? val.value<T>() : defValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
template <>
|
|
||||||
inline Cases VSettings::ValueOrDef<Cases>(const QString &setting, const Cases &defValue) const
|
|
||||||
{
|
|
||||||
const QVariant val = value(setting, QVariant::fromValue(static_cast<int>(defValue)));
|
|
||||||
const int g = val.canConvert<int>() ? val.value<int>() : static_cast<int>(defValue);
|
|
||||||
if (g < static_cast<int>(Cases::CaseThreeGroup) || g >= static_cast<int>(Cases::UnknownCase))
|
|
||||||
{
|
|
||||||
return defValue;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return static_cast<Cases>(g);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // VSETTINGS_H
|
#endif // VSETTINGS_H
|
||||||
|
|
|
@ -54,6 +54,7 @@
|
||||||
#include "../vwidgets/vnobrushscalepathitem.h"
|
#include "../vwidgets/vnobrushscalepathitem.h"
|
||||||
#include "../vwidgets/vabstractmainwindow.h"
|
#include "../vwidgets/vabstractmainwindow.h"
|
||||||
#include "../qmuparser/qmutokenparser.h"
|
#include "../qmuparser/qmutokenparser.h"
|
||||||
|
#include "../vlayout/vlayoutdef.h"
|
||||||
|
|
||||||
#include <QFuture>
|
#include <QFuture>
|
||||||
#include <QtConcurrent/QtConcurrentRun>
|
#include <QtConcurrent/QtConcurrentRun>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user