Refactoring.

This commit is contained in:
Roman Telezhynskyi 2022-11-08 16:58:13 +02:00
parent 52c8e47e60
commit 99fad389b0
4 changed files with 20 additions and 52 deletions

View File

@ -294,7 +294,7 @@ QString NameRegExp()
QString decimalPoints;
QString groupSeparators;
for(auto &locale : allLocales)
for(const auto &locale : allLocales)
{
if (not positiveSigns.contains(locale.positiveSign()))
{

View File

@ -36,7 +36,6 @@
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/def.h"
#include "vpiecenode.h"
#include "vpiecepath.h"
#include "floatItemData/vpiecelabeldata.h"
#include "floatItemData/vpatternlabeldata.h"
@ -50,68 +49,41 @@ class VPieceData : public QSharedData
{
public:
explicit VPieceData(PiecePathType type)
: m_path(type),
m_inLayout(true),
m_united(false),
m_customSARecords(),
m_internalPaths(),
m_pins(),
m_placeLabels(),
m_ppData(),
m_piPatternInfo(),
m_glGrainline(),
m_formulaWidth('0')
: m_path(type)
{}
VPieceData(const VPieceData &detail)
: QSharedData(detail),
m_path(detail.m_path),
m_inLayout(detail.m_inLayout),
m_united(detail.m_united),
m_customSARecords(detail.m_customSARecords),
m_internalPaths(detail.m_internalPaths),
m_pins(detail.m_pins),
m_placeLabels(detail.m_placeLabels),
m_ppData(detail.m_ppData),
m_piPatternInfo(detail.m_piPatternInfo),
m_glGrainline(detail.m_glGrainline),
m_formulaWidth(detail.m_formulaWidth),
m_gradationLabel(detail.m_gradationLabel)
{}
VPieceData(const VPieceData &detail) = default;
~VPieceData();
~VPieceData() = default;
/** @brief nodes list detail nodes. */
VPiecePath m_path;
VPiecePath m_path; // NOLINT(misc-non-private-member-variables-in-classes)
bool m_inLayout;
bool m_united;
bool m_inLayout{true}; // NOLINT(misc-non-private-member-variables-in-classes)
bool m_united{false}; // NOLINT(misc-non-private-member-variables-in-classes)
QVector<CustomSARecord> m_customSARecords;
QVector<quint32> m_internalPaths;
QVector<quint32> m_pins;
QVector<quint32> m_placeLabels;
QVector<CustomSARecord> m_customSARecords{}; // NOLINT(misc-non-private-member-variables-in-classes)
QVector<quint32> m_internalPaths{}; // NOLINT(misc-non-private-member-variables-in-classes)
QVector<quint32> m_pins{}; // NOLINT(misc-non-private-member-variables-in-classes)
QVector<quint32> m_placeLabels{}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief Pattern piece data */
VPieceLabelData m_ppData;
VPieceLabelData m_ppData{}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief Pattern info coordinates */
VPatternLabelData m_piPatternInfo;
VPatternLabelData m_piPatternInfo{}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief m_glGrainline grainline geometry object*/
VGrainlineData m_glGrainline;
VGrainlineData m_glGrainline{}; // NOLINT(misc-non-private-member-variables-in-classes)
QString m_formulaWidth;
QString m_formulaWidth{'0'}; // NOLINT(misc-non-private-member-variables-in-classes)
QString m_gradationLabel{};
QString m_gradationLabel{}; // NOLINT(misc-non-private-member-variables-in-classes)
private:
Q_DISABLE_ASSIGN(VPieceData)
Q_DISABLE_ASSIGN_MOVE(VPieceData) // NOLINT
};
VPieceData::~VPieceData()
{}
QT_WARNING_POP
#endif // VPIECE_P_H

View File

@ -2774,11 +2774,7 @@ bool DialogSeamAllowance::MainPathIsClockwise() const
}
const qreal res = VPiece::SumTrapezoids(points);
if (res < 0)
{
return true;
}
return false;
return res < 0;
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -1352,7 +1352,7 @@ void VToolSeamAllowance::UpdateExcludeState()
const VPieceNode &node = detail.GetPath().at(i);
if (node.GetTypeTool() == Tool::NodePoint)
{
VNodePoint *tool = qobject_cast<VNodePoint*>(VAbstractPattern::getTool(node.GetId()));
auto *tool = qobject_cast<VNodePoint*>(VAbstractPattern::getTool(node.GetId()));
SCASSERT(tool != nullptr);
tool->SetExluded(node.IsExcluded());
@ -1486,7 +1486,7 @@ void VToolSeamAllowance::RefreshGeometry(bool updateChildren)
void VToolSeamAllowance::SaveDialogChange(const QString &undoText)
{
SCASSERT(not m_dialog.isNull());
DialogSeamAllowance *dialogTool = qobject_cast<DialogSeamAllowance*>(m_dialog.data());
auto *dialogTool = qobject_cast<DialogSeamAllowance*>(m_dialog.data());
SCASSERT(dialogTool != nullptr);
const VPiece newDet = dialogTool->GetPiece();
const VPiece oldDet = VAbstractTool::data.GetPiece(m_id);