Remove class destructor so that classes follows the rule of Zero.

This commit is contained in:
Roman Telezhynskyi 2024-02-20 08:57:48 +02:00
parent 304ff66b06
commit 3027ddb49c
33 changed files with 169 additions and 212 deletions

View File

@ -56,7 +56,6 @@ QT_WARNING_POP
//---------------------------------------------------------------------------------------------------------------------
VPCarrousel::VPCarrousel(const VPLayoutPtr &layout, QWidget *parent)
: QWidget(parent),
ui(new Ui::VPCarrousel),
m_layout(layout)
{
SCASSERT(not layout.isNull())
@ -74,11 +73,7 @@ VPCarrousel::VPCarrousel(const VPLayoutPtr &layout, QWidget *parent)
Refresh();
}
//---------------------------------------------------------------------------------------------------------------------
VPCarrousel::~VPCarrousel()
{
delete ui;
}
VPCarrousel::~VPCarrousel() = default;
//---------------------------------------------------------------------------------------------------------------------
void VPCarrousel::Refresh()
@ -94,7 +89,7 @@ void VPCarrousel::Refresh()
// Do not rely on m_layout because we do not control it.
m_pieceLists = QList<VPCarrouselSheet>();
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (not layout.isNull())
{
{
@ -107,7 +102,7 @@ void VPCarrousel::Refresh()
m_pieceLists.append(carrouselSheet);
}
QList<VPSheetPtr> sheets = layout->GetSheets();
QList<VPSheetPtr> const sheets = layout->GetSheets();
for (const auto &sheet : sheets)
{
if (not sheet.isNull())
@ -137,7 +132,7 @@ void VPCarrousel::Refresh()
ui->comboBoxPieceList->setCurrentIndex(-1);
ui->comboBoxPieceList->blockSignals(false);
int index = ui->comboBoxPieceList->findData(sheetUuid);
int const index = ui->comboBoxPieceList->findData(sheetUuid);
ui->comboBoxPieceList->setCurrentIndex(index != -1 ? index : 0);
RefreshOrientation();
@ -148,7 +143,7 @@ void VPCarrousel::on_ActiveSheetChanged(const VPSheetPtr &sheet)
{
if (not sheet.isNull())
{
int index = ui->comboBoxPieceList->findData(sheet->Uuid());
int const index = ui->comboBoxPieceList->findData(sheet->Uuid());
if (index != -1)
{
ui->comboBoxPieceList->setCurrentIndex(index);
@ -163,7 +158,7 @@ void VPCarrousel::on_ActiveSheetChanged(const VPSheetPtr &sheet)
//---------------------------------------------------------------------------------------------------------------------
void VPCarrousel::RefreshSheetNames()
{
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (layout.isNull())
{
return;
@ -173,7 +168,7 @@ void VPCarrousel::RefreshSheetNames()
{
if (not m_pieceLists.at(i).unplaced)
{
VPSheetPtr sheet = layout->GetSheet(m_pieceLists.at(i).sheetUuid);
VPSheetPtr const sheet = layout->GetSheet(m_pieceLists.at(i).sheetUuid);
if (not sheet.isNull())
{
m_pieceLists[i].name = sheet->GetName();
@ -203,7 +198,7 @@ void VPCarrousel::on_ActivePieceListChanged(int index)
{
qCDebug(pCarrousel, "index changed %i", index);
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (layout.isNull())
{
return;
@ -215,12 +210,12 @@ void VPCarrousel::on_ActivePieceListChanged(int index)
if (index > 0)
{
QUuid sheetUuid = ui->comboBoxPieceList->currentData().toUuid();
VPSheetPtr sheet = layout->GetSheet(sheetUuid);
QUuid const sheetUuid = ui->comboBoxPieceList->currentData().toUuid();
VPSheetPtr const sheet = layout->GetSheet(sheetUuid);
if (not sheet.isNull())
{
VPSheetPtr activeSheet = layout->GetFocusedSheet();
VPSheetPtr const activeSheet = layout->GetFocusedSheet();
if (not activeSheet.isNull())
{
activeSheet->ClearSelection();

View File

@ -33,6 +33,7 @@
#include <QScrollArea>
#include <QUuid>
#include <QWidget>
#include <memory>
#include "../layout/layoutdef.h"
@ -102,7 +103,7 @@ private slots:
private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(VPCarrousel) // NOLINT
Ui::VPCarrousel *ui;
std::unique_ptr<Ui::VPCarrousel> ui{};
VPLayoutWeakPtr m_layout{};

View File

@ -39,8 +39,7 @@
//---------------------------------------------------------------------------------------------------------------------
PuzzlePreferencesConfigurationPage::PuzzlePreferencesConfigurationPage(QWidget *parent)
: QWidget(parent),
ui(new Ui::PuzzlePreferencesConfigurationPage)
: QWidget(parent)
{
ui->setupUi(this);
@ -62,7 +61,7 @@ PuzzlePreferencesConfigurationPage::PuzzlePreferencesConfigurationPage(QWidget *
// Theme
SetThemeModeComboBox();
int index = ui->comboBoxThemeMode->findData(static_cast<int>(settings->GetThemeMode()));
int const index = ui->comboBoxThemeMode->findData(static_cast<int>(settings->GetThemeMode()));
if (index != -1)
{
ui->comboBoxThemeMode->setCurrentIndex(index);
@ -120,10 +119,7 @@ PuzzlePreferencesConfigurationPage::PuzzlePreferencesConfigurationPage(QWidget *
}
//---------------------------------------------------------------------------------------------------------------------
PuzzlePreferencesConfigurationPage::~PuzzlePreferencesConfigurationPage()
{
delete ui;
}
PuzzlePreferencesConfigurationPage::~PuzzlePreferencesConfigurationPage() = default;
//---------------------------------------------------------------------------------------------------------------------
auto PuzzlePreferencesConfigurationPage::Apply() -> QStringList

View File

@ -29,6 +29,7 @@
#define PUZZLEPREFERENCESCONFIGURATIONPAGE_H
#include <QWidget>
#include <memory>
namespace Ui
{
@ -54,7 +55,7 @@ private slots:
private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(PuzzlePreferencesConfigurationPage) // NOLINT
Ui::PuzzlePreferencesConfigurationPage *ui;
std::unique_ptr<Ui::PuzzlePreferencesConfigurationPage> ui{};
bool m_langChanged{false};
QList<QStringList> m_transientShortcuts{};

View File

@ -31,8 +31,7 @@
//---------------------------------------------------------------------------------------------------------------------
PuzzlePreferencesLayoutPage::PuzzlePreferencesLayoutPage(QWidget *parent)
: QWidget(parent),
ui(new Ui::PuzzlePreferencesLayoutPage)
: QWidget(parent)
{
ui->setupUi(this);
@ -131,10 +130,7 @@ PuzzlePreferencesLayoutPage::PuzzlePreferencesLayoutPage(QWidget *parent)
}
//---------------------------------------------------------------------------------------------------------------------
PuzzlePreferencesLayoutPage::~PuzzlePreferencesLayoutPage()
{
delete ui;
}
PuzzlePreferencesLayoutPage::~PuzzlePreferencesLayoutPage() = default;
//---------------------------------------------------------------------------------------------------------------------
auto PuzzlePreferencesLayoutPage::Apply() -> QStringList

View File

@ -29,13 +29,14 @@
#define PUZZLEPREFERENCESLAYOUTPAGE_H
#include <QWidget>
#include <memory>
#include "../vmisc/def.h"
#include "../vlayout/dialogs/vabstractlayoutdialog.h"
#include "../vmisc/def.h"
namespace Ui
{
class PuzzlePreferencesLayoutPage;
class PuzzlePreferencesLayoutPage;
}
class PuzzlePreferencesLayoutPage : public QWidget
@ -49,7 +50,7 @@ public:
auto Apply() -> QStringList;
protected:
void changeEvent(QEvent* event) override;
void changeEvent(QEvent *event) override;
private slots:
void ConvertPaperSize();
@ -64,7 +65,7 @@ private slots:
private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(PuzzlePreferencesLayoutPage) // NOLINT
Ui::PuzzlePreferencesLayoutPage *ui;
std::unique_ptr<Ui::PuzzlePreferencesLayoutPage> ui{};
Unit m_oldLayoutUnit{Unit::Mm};
bool m_settingsChanged{false};

View File

@ -31,8 +31,7 @@
//---------------------------------------------------------------------------------------------------------------------
PuzzlePreferencesPathPage::PuzzlePreferencesPathPage(QWidget *parent)
: QWidget(parent),
ui(new Ui::PuzzlePreferencesPathPage)
: QWidget(parent)
{
ui->setupUi(this);
@ -53,10 +52,7 @@ PuzzlePreferencesPathPage::PuzzlePreferencesPathPage(QWidget *parent)
}
//---------------------------------------------------------------------------------------------------------------------
PuzzlePreferencesPathPage::~PuzzlePreferencesPathPage()
{
delete ui;
}
PuzzlePreferencesPathPage::~PuzzlePreferencesPathPage() = default;
//---------------------------------------------------------------------------------------------------------------------
void PuzzlePreferencesPathPage::Apply()

View File

@ -29,6 +29,7 @@
#define PUZZLEPREFERENCESPATHPAGE_H
#include <QWidget>
#include <memory>
namespace Ui
{
@ -55,7 +56,7 @@ private slots:
private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(PuzzlePreferencesPathPage) // NOLINT
Ui::PuzzlePreferencesPathPage *ui;
std::unique_ptr<Ui::PuzzlePreferencesPathPage> ui{};
void InitTable();
};

View File

@ -46,7 +46,6 @@ using namespace Qt::Literals::StringLiterals;
//---------------------------------------------------------------------------------------------------------------------
DialogPuzzlePreferences::DialogPuzzlePreferences(QWidget *parent)
: QDialog(parent),
ui(new Ui::DialogPuzzlePreferences),
m_configurationPage(new PuzzlePreferencesConfigurationPage),
m_layoutPage(new PuzzlePreferencesLayoutPage),
m_pathPage(new PuzzlePreferencesPathPage)
@ -76,10 +75,7 @@ DialogPuzzlePreferences::DialogPuzzlePreferences(QWidget *parent)
}
//---------------------------------------------------------------------------------------------------------------------
DialogPuzzlePreferences::~DialogPuzzlePreferences()
{
delete ui;
}
DialogPuzzlePreferences::~DialogPuzzlePreferences() = default;
//---------------------------------------------------------------------------------------------------------------------
void DialogPuzzlePreferences::showEvent(QShowEvent *event)

View File

@ -29,6 +29,7 @@
#define DIALOGPUZZLEPREFERENCES_H
#include <QDialog>
#include <memory>
namespace Ui
{
@ -64,7 +65,7 @@ private slots:
private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(DialogPuzzlePreferences) // NOLINT
Ui::DialogPuzzlePreferences *ui;
std::unique_ptr<Ui::DialogPuzzlePreferences> ui{};
bool m_isInitialized{false};
PuzzlePreferencesConfigurationPage *m_configurationPage;
PuzzlePreferencesLayoutPage *m_layoutPage;

View File

@ -59,7 +59,6 @@ QT_WARNING_POP
DialogSaveManualLayout::DialogSaveManualLayout(vsizetype count, bool consoleExport, const QString &fileName,
QWidget *parent)
: VAbstractLayoutDialog(parent),
ui(new Ui::DialogSaveManualLayout),
m_count(count),
m_consoleExport(consoleExport)
{
@ -142,10 +141,7 @@ DialogSaveManualLayout::DialogSaveManualLayout(vsizetype count, bool consoleExpo
}
//---------------------------------------------------------------------------------------------------------------------
DialogSaveManualLayout::~DialogSaveManualLayout()
{
delete ui;
}
DialogSaveManualLayout::~DialogSaveManualLayout() = default;
//---------------------------------------------------------------------------------------------------------------------
auto DialogSaveManualLayout::Path() const -> QString

View File

@ -28,6 +28,8 @@
#ifndef DIALOGSAVEMANUALLAYOUT_H
#define DIALOGSAVEMANUALLAYOUT_H
#include <memory>
#include "../vlayout/dialogs/vabstractlayoutdialog.h"
#include "../vlayout/vlayoutdef.h"
#include "../vmisc/defglobal.h"
@ -80,7 +82,7 @@ private slots:
private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(DialogSaveManualLayout) // NOLINT
Ui::DialogSaveManualLayout *ui;
std::unique_ptr<Ui::DialogSaveManualLayout> ui{};
vsizetype m_count;
bool m_isInitialized{false};
bool m_scaleConnected{true};

View File

@ -53,7 +53,6 @@ using namespace Qt::Literals::StringLiterals;
//---------------------------------------------------------------------------------------------------------------------
VPDialogAbout::VPDialogAbout(QWidget *parent)
: QDialog(parent),
ui(new Ui::VPDialogAbout),
m_isInitialized(false)
{
ui->setupUi(this);
@ -85,10 +84,7 @@ VPDialogAbout::VPDialogAbout(QWidget *parent)
}
//---------------------------------------------------------------------------------------------------------------------
VPDialogAbout::~VPDialogAbout()
{
delete ui;
}
VPDialogAbout::~VPDialogAbout() = default;
//---------------------------------------------------------------------------------------------------------------------
void VPDialogAbout::changeEvent(QEvent *event)

View File

@ -30,6 +30,7 @@
#define VPDIALOGABOUT_H
#include <QDialog>
#include <memory>
namespace Ui
{
@ -51,7 +52,7 @@ protected:
private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(VPDialogAbout) // NOLINT
Ui::VPDialogAbout *ui;
std::unique_ptr<Ui::VPDialogAbout> ui{};
bool m_isInitialized;
static void FontPointSize(QWidget *w, int pointSize);

View File

@ -61,10 +61,7 @@ VPLayout::VPLayout(QUndoStack *undoStack)
}
//---------------------------------------------------------------------------------------------------------------------
VPLayout::~VPLayout()
{
delete m_tileFactory;
}
VPLayout::~VPLayout() = default;
//---------------------------------------------------------------------------------------------------------------------
auto VPLayout::CreateLayout(QUndoStack *undoStack) -> VPLayoutPtr
@ -75,7 +72,7 @@ auto VPLayout::CreateLayout(QUndoStack *undoStack) -> VPLayoutPtr
layout->AddTrashSheet(VPSheetPtr(new VPSheet(layout)));
// create a standard sheet
VPSheetPtr sheet(new VPSheet(layout));
VPSheetPtr const sheet(new VPSheet(layout));
sheet->SetName(tr("Sheet %1").arg(layout->GetAllSheets().size() + 1));
layout->AddSheet(sheet);
layout->SetFocusedSheet(sheet);
@ -100,7 +97,7 @@ auto VPLayout::CreateLayout(QUndoStack *undoStack) -> VPLayoutPtr
// --------------------------------------------------------
// init the tile factory
auto *tileFactory = new VPTileFactory(layout, settings);
auto tileFactory = QSharedPointer<VPTileFactory>(new VPTileFactory(layout, settings));
tileFactory->RefreshTileInfos();
tileFactory->RefreshWatermarkData();
layout->SetTileFactory(tileFactory);
@ -131,7 +128,7 @@ void VPLayout::AddPiece(const VPPiecePtr &piece)
}
else
{
VPPiecePtr oldPiece = m_pieces.value(piece->GetUniqueID());
VPPiecePtr const oldPiece = m_pieces.value(piece->GetUniqueID());
if (not oldPiece.isNull())
{
oldPiece->Update(piece);
@ -150,15 +147,15 @@ auto VPLayout::Uuid() const -> const QUuid &
}
//---------------------------------------------------------------------------------------------------------------------
auto VPLayout::TileFactory() const -> VPTileFactory *
auto VPLayout::TileFactory() const -> QSharedPointer<VPTileFactory>
{
return m_tileFactory;
}
//---------------------------------------------------------------------------------------------------------------------
void VPLayout::SetTileFactory(VPTileFactory *newTileFactory)
void VPLayout::SetTileFactory(const QSharedPointer<VPTileFactory> &newTileFactory)
{
delete m_tileFactory;
m_tileFactory.clear();
m_tileFactory = newTileFactory;
}
@ -217,7 +214,7 @@ auto VPLayout::IsSheetsUniform() const -> bool
return false;
}
QSizeF sheetSize = sheet->GetSheetSize().toSize();
QSizeF const sheetSize = sheet->GetSheetSize().toSize();
return std::all_of(sheets.begin(), sheets.end(),
[sheetSize](const VPSheetPtr &sheet)
@ -226,7 +223,7 @@ auto VPLayout::IsSheetsUniform() const -> bool
{
return false;
}
QSize size = sheet->GetSheetSize().toSize();
QSize const size = sheet->GetSheetSize().toSize();
return size == sheetSize || size.transposed() == sheetSize;
});
}
@ -377,7 +374,7 @@ auto VPLayout::PiecesForSheet(const QUuid &uuid) const -> QList<VPPiecePtr>
{
if (not piece.isNull())
{
VPSheetPtr sheet = piece->Sheet();
VPSheetPtr const sheet = piece->Sheet();
if (not sheet.isNull() && sheet->Uuid() == uuid)
{
list.append(piece);

View File

@ -91,8 +91,8 @@ public:
void CheckPiecesPositionValidity() const;
auto TileFactory() const -> VPTileFactory *;
void SetTileFactory(VPTileFactory *newTileFactory);
auto TileFactory() const -> QSharedPointer<VPTileFactory>;
void SetTileFactory(const QSharedPointer<VPTileFactory> &newTileFactory);
void RefreshScenePieces() const;
@ -134,7 +134,7 @@ private:
QUndoStack *m_undoStack;
VPTileFactory *m_tileFactory{nullptr};
QSharedPointer<VPTileFactory> m_tileFactory{nullptr};
QUuid m_uuid{QUuid::createUuid()};
};

View File

@ -42,7 +42,7 @@
//---------------------------------------------------------------------------------------------------------------------
VPSheetSceneData::VPSheetSceneData(const VPLayoutPtr &layout, const QUuid &sheetUuid)
: m_layout(layout),
m_scene(new VMainGraphicsScene()),
m_scene(QSharedPointer<VMainGraphicsScene>::create()),
m_sheetUuid(sheetUuid)
{
SCASSERT(not layout.isNull())
@ -68,13 +68,10 @@ VPSheetSceneData::VPSheetSceneData(const VPLayoutPtr &layout, const QUuid &sheet
}
//---------------------------------------------------------------------------------------------------------------------
VPSheetSceneData::~VPSheetSceneData()
{
delete m_scene;
}
VPSheetSceneData::~VPSheetSceneData() = default;
//---------------------------------------------------------------------------------------------------------------------
auto VPSheetSceneData::Scene() const -> VMainGraphicsScene *
auto VPSheetSceneData::Scene() const -> QSharedPointer<VMainGraphicsScene>
{
return m_scene;
}
@ -95,19 +92,19 @@ void VPSheetSceneData::RefreshPieces()
qDeleteAll(m_graphicsPieces);
m_graphicsPieces.clear();
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (layout.isNull())
{
return;
}
VPSheetPtr sheet = layout->GetSheet(m_sheetUuid);
VPSheetPtr const sheet = layout->GetSheet(m_sheetUuid);
if (sheet.isNull())
{
return;
}
QList<VPPiecePtr> pieces = sheet->GetPieces();
QList<VPPiecePtr> const pieces = sheet->GetPieces();
m_graphicsPieces.reserve(pieces.size());
for (const auto &piece : pieces)
@ -277,7 +274,7 @@ void VPSheetSceneData::SetTextAsPaths(bool textAsPaths) const
//---------------------------------------------------------------------------------------------------------------------
void VPSheetSceneData::PrepareTilesScheme()
{
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (not layout.isNull())
{
m_showTilesSchemeTmp = layout->LayoutSettings().GetShowTiles();
@ -293,7 +290,7 @@ void VPSheetSceneData::PrepareTilesScheme()
//---------------------------------------------------------------------------------------------------------------------
void VPSheetSceneData::ClearTilesScheme()
{
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (not layout.isNull())
{
layout->LayoutSettings().SetShowTiles(m_showTilesSchemeTmp);
@ -317,7 +314,7 @@ void VPSheetSceneData::ConnectPiece(VPGraphicsPiece *piece)
{
SCASSERT(piece != nullptr)
VPLayoutPtr layout = m_layout.toStrongRef();
VPLayoutPtr const layout = m_layout.toStrongRef();
if (layout.isNull())
{
return;
@ -343,7 +340,7 @@ void VPSheetSceneData::ConnectPiece(VPGraphicsPiece *piece)
VPSheet::VPSheet(const VPLayoutPtr &layout, QObject *parent)
: QObject(parent),
m_layout(layout),
m_sceneData(new VPSheetSceneData(layout, Uuid()))
m_sceneData(QSharedPointer<VPSheetSceneData>::create(layout, Uuid()))
{
SCASSERT(not layout.isNull())
@ -354,10 +351,7 @@ VPSheet::VPSheet(const VPLayoutPtr &layout, QObject *parent)
}
//---------------------------------------------------------------------------------------------------------------------
VPSheet::~VPSheet()
{
delete m_sceneData;
}
VPSheet::~VPSheet() = default;
//---------------------------------------------------------------------------------------------------------------------
auto VPSheet::GetLayout() const -> VPLayoutPtr
@ -368,7 +362,7 @@ auto VPSheet::GetLayout() const -> VPLayoutPtr
//---------------------------------------------------------------------------------------------------------------------
auto VPSheet::GetPieces() const -> QList<VPPiecePtr>
{
VPLayoutPtr layout = GetLayout();
VPLayoutPtr const layout = GetLayout();
if (not layout.isNull())
{
return layout->PiecesForSheet(m_uuid);
@ -380,10 +374,10 @@ auto VPSheet::GetPieces() const -> QList<VPPiecePtr>
//---------------------------------------------------------------------------------------------------------------------
auto VPSheet::GetSelectedPieces() const -> QList<VPPiecePtr>
{
VPLayoutPtr layout = GetLayout();
VPLayoutPtr const layout = GetLayout();
if (not layout.isNull())
{
QList<VPPiecePtr> list = layout->PiecesForSheet(m_uuid);
QList<VPPiecePtr> const list = layout->PiecesForSheet(m_uuid);
QList<VPPiecePtr> selected;
selected.reserve(list.size());
@ -405,7 +399,7 @@ auto VPSheet::GetSelectedPieces() const -> QList<VPPiecePtr>
//---------------------------------------------------------------------------------------------------------------------
auto VPSheet::GetAsLayoutPieces() const -> QVector<VLayoutPiece>
{
QList<VPPiecePtr> pieces = GetPieces();
QList<VPPiecePtr> const pieces = GetPieces();
QVector<VLayoutPiece> details;
details.reserve(pieces.size());
@ -520,7 +514,7 @@ void VPSheet::SetTrashSheet(bool newTrashSheet)
//---------------------------------------------------------------------------------------------------------------------
void VPSheet::ValidateSuperpositionOfPieces() const
{
QList<VPPiecePtr> pieces = GetPieces();
QList<VPPiecePtr> const pieces = GetPieces();
for (const auto &piece : pieces)
{
@ -633,13 +627,13 @@ auto VPSheet::GetMarginsRect() const -> QRectF
//---------------------------------------------------------------------------------------------------------------------
void VPSheet::RemoveUnusedLength()
{
VPLayoutPtr layout = GetLayout();
VPLayoutPtr const layout = GetLayout();
if (layout.isNull())
{
return;
}
QList<VPPiecePtr> pieces = GetPieces();
QList<VPPiecePtr> const pieces = GetPieces();
if (pieces.isEmpty())
{
return;
@ -658,8 +652,8 @@ void VPSheet::RemoveUnusedLength()
}
const qreal extra = 2;
QRectF sheetRect = GetSheetRect();
GrainlineType type = GrainlineOrientation();
QRectF const sheetRect = GetSheetRect();
GrainlineType const type = GrainlineOrientation();
if (type == GrainlineType::Vertical)
{
@ -692,13 +686,13 @@ void VPSheet::RemoveUnusedLength()
//---------------------------------------------------------------------------------------------------------------------
void VPSheet::CheckPiecePositionValidity(const VPPiecePtr &piece) const
{
VPLayoutPtr layout = GetLayout();
VPLayoutPtr const layout = GetLayout();
if (layout.isNull())
{
return;
}
QList<VPPiecePtr> pieces = GetPieces();
QList<VPPiecePtr> const pieces = GetPieces();
if (piece.isNull() || not pieces.contains(piece))
{
return;
@ -716,7 +710,7 @@ void VPSheet::CheckPiecePositionValidity(const VPPiecePtr &piece) const
}
//---------------------------------------------------------------------------------------------------------------------
auto VPSheet::SceneData() const -> VPSheetSceneData *
auto VPSheet::SceneData() const -> QSharedPointer<VPSheetSceneData>
{
return m_sceneData;
}
@ -724,7 +718,7 @@ auto VPSheet::SceneData() const -> VPSheetSceneData *
//---------------------------------------------------------------------------------------------------------------------
void VPSheet::ClearSelection() const
{
QList<VPPiecePtr> selectedPieces = GetSelectedPieces();
QList<VPPiecePtr> const selectedPieces = GetSelectedPieces();
for (const auto &piece : selectedPieces)
{
if (piece->IsSelected())
@ -735,7 +729,7 @@ void VPSheet::ClearSelection() const
if (not selectedPieces.isEmpty())
{
VPLayoutPtr layout = GetLayout();
VPLayoutPtr const layout = GetLayout();
if (not layout.isNull())
{
emit layout->PieceSelectionChanged(VPPiecePtr());
@ -752,7 +746,7 @@ auto VPSheet::GetSheetOrientation() const -> QPageLayout::Orientation
//---------------------------------------------------------------------------------------------------------------------
auto VPSheet::SheetUnits() const -> Unit
{
VPLayoutPtr layout = GetLayout();
VPLayoutPtr const layout = GetLayout();
if (not layout.isNull())
{
return layout->LayoutSettings().GetUnit();
@ -776,7 +770,7 @@ void VPSheet::SetSheetSize(qreal width, qreal height)
//---------------------------------------------------------------------------------------------------------------------
void VPSheet::SetSheetSizeConverted(qreal width, qreal height)
{
Unit unit = SheetUnits();
Unit const unit = SheetUnits();
m_size.setWidth(UnitConvertor(width, unit, Unit::Px));
m_size.setHeight(UnitConvertor(height, unit, Unit::Px));
@ -800,7 +794,7 @@ void VPSheet::SetSheetSize(const QSizeF &size)
//---------------------------------------------------------------------------------------------------------------------
void VPSheet::SetSheetSizeConverted(const QSizeF &size)
{
Unit unit = SheetUnits();
Unit const unit = SheetUnits();
m_size = QSizeF(UnitConvertor(size.width(), unit, Unit::Px), UnitConvertor(size.height(), unit, Unit::Px));
if (m_sceneData != nullptr)
@ -818,7 +812,7 @@ auto VPSheet::GetSheetSize() const -> QSizeF
//---------------------------------------------------------------------------------------------------------------------
auto VPSheet::GetSheetSizeConverted() const -> QSizeF
{
Unit unit = SheetUnits();
Unit const unit = SheetUnits();
QSizeF convertedSize =
QSizeF(UnitConvertor(m_size.width(), Unit::Px, unit), UnitConvertor(m_size.height(), Unit::Px, unit));
@ -836,7 +830,7 @@ void VPSheet::SetSheetMargins(qreal left, qreal top, qreal right, qreal bottom)
//---------------------------------------------------------------------------------------------------------------------
void VPSheet::SetSheetMarginsConverted(qreal left, qreal top, qreal right, qreal bottom)
{
Unit unit = SheetUnits();
Unit const unit = SheetUnits();
m_margins.setLeft(UnitConvertor(left, unit, Unit::Px));
m_margins.setTop(UnitConvertor(top, unit, Unit::Px));
m_margins.setRight(UnitConvertor(right, unit, Unit::Px));
@ -852,7 +846,7 @@ void VPSheet::SetSheetMargins(const QMarginsF &margins)
//---------------------------------------------------------------------------------------------------------------------
void VPSheet::SetSheetMarginsConverted(const QMarginsF &margins)
{
Unit unit = SheetUnits();
Unit const unit = SheetUnits();
m_margins = UnitConvertor(margins, unit, Unit::Px);
}
@ -865,7 +859,7 @@ auto VPSheet::GetSheetMargins() const -> QMarginsF
//---------------------------------------------------------------------------------------------------------------------
auto VPSheet::GetSheetMarginsConverted() const -> QMarginsF
{
Unit unit = SheetUnits();
Unit const unit = SheetUnits();
return UnitConvertor(m_margins, Unit::Px, unit);
}

View File

@ -56,7 +56,7 @@ public:
explicit VPSheetSceneData(const VPLayoutPtr &layout, const QUuid &sheetUuid);
~VPSheetSceneData();
auto Scene() const -> VMainGraphicsScene *;
auto Scene() const -> QSharedPointer<VMainGraphicsScene>;
/**
* @brief RefreshLayout Refreshes the rectangles for the layout border and the margin
@ -98,7 +98,7 @@ private:
VPLayoutWeakPtr m_layout{};
VMainGraphicsScene *m_scene;
QSharedPointer<VMainGraphicsScene> m_scene{nullptr};
VPGraphicsSheet *m_graphicsSheet{nullptr};
@ -273,7 +273,7 @@ public:
auto IgnoreMargins() const -> bool;
void SetIgnoreMargins(bool newIgnoreMargins);
auto SceneData() const -> VPSheetSceneData *;
auto SceneData() const -> QSharedPointer<VPSheetSceneData>;
void ClearSelection() const;
@ -311,7 +311,7 @@ private:
GrainlineType m_grainlineType{GrainlineType::NotFixed};
VPSheetSceneData *m_sceneData{nullptr};
QSharedPointer<VPSheetSceneData> m_sceneData{nullptr};
auto SheetUnits() const -> Unit;
};

View File

@ -562,9 +562,9 @@ void VPMainGraphicsView::SwitchScene(const VPSheetPtr &sheet)
{
if (not sheet.isNull())
{
VMainGraphicsScene *scene = sheet->SceneData()->Scene();
setScene(scene);
connect(scene, &VMainGraphicsScene::mouseMove, this, &VPMainGraphicsView::on_SceneMouseMove,
QSharedPointer<VMainGraphicsScene> scene = sheet->SceneData()->Scene();
setScene(scene.data());
connect(scene.data(), &VMainGraphicsScene::mouseMove, this, &VPMainGraphicsView::on_SceneMouseMove,
Qt::UniqueConnection);
}
}

View File

@ -323,7 +323,6 @@ struct VPExportData
//---------------------------------------------------------------------------------------------------------------------
VPMainWindow::VPMainWindow(const VPCommandLinePtr &cmd, QWidget *parent)
: VAbstractMainWindow(parent),
ui(new Ui::VPMainWindow),
m_cmd(cmd),
m_undoStack(new QUndoStack(this)),
m_layout{VPLayout::CreateLayout(m_undoStack)},
@ -450,12 +449,7 @@ VPMainWindow::VPMainWindow(const VPCommandLinePtr &cmd, QWidget *parent)
}
//---------------------------------------------------------------------------------------------------------------------
VPMainWindow::~VPMainWindow()
{
delete m_undoStack;
delete ui;
delete m_carrousel;
}
VPMainWindow::~VPMainWindow() = default;
//---------------------------------------------------------------------------------------------------------------------
auto VPMainWindow::CurrentFile() const -> QString
@ -1286,8 +1280,8 @@ void VPMainWindow::InitPropertyTabLayout()
//---------------------------------------------------------------------------------------------------------------------
void VPMainWindow::InitCarrousel()
{
m_carrousel = new VPCarrousel(m_layout, ui->dockWidgetCarrousel);
ui->dockWidgetCarrousel->setWidget(m_carrousel);
m_carrousel = std::make_unique<VPCarrousel>(m_layout, ui->dockWidgetCarrousel);
ui->dockWidgetCarrousel->setWidget(m_carrousel.get());
connect(ui->dockWidgetCarrousel, QOverload<Qt::DockWidgetArea>::of(&QDockWidget::dockLocationChanged), this,
&VPMainWindow::on_CarrouselLocationChanged);
@ -1638,7 +1632,7 @@ void VPMainWindow::InitMainGraphics()
connect(m_graphicsView, &VPMainGraphicsView::ScaleChanged, this, &VPMainWindow::on_ScaleChanged);
connect(m_graphicsView, &VPMainGraphicsView::mouseMove, this, &VPMainWindow::on_MouseMoved);
connect(m_layout.data(), &VPLayout::PieceSheetChanged, m_carrousel, &VPCarrousel::Refresh);
connect(m_layout.data(), &VPLayout::PieceSheetChanged, m_carrousel.get(), &VPCarrousel::Refresh);
}
//---------------------------------------------------------------------------------------------------------------------
@ -2438,71 +2432,80 @@ void VPMainWindow::ExportScene(const VPExportData &data)
case LayoutExportFormats::SVG:
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
exporter.ExportToSVG(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
exporter.ExportToSVG(sheet->SceneData()->Scene().data(), sheet->SceneData()->GraphicsPiecesAsItems());
break;
case LayoutExportFormats::PDF:
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
exporter.ExportToPDF(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
exporter.ExportToPDF(sheet->SceneData()->Scene().data(), sheet->SceneData()->GraphicsPiecesAsItems());
break;
case LayoutExportFormats::PNG:
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
exporter.ExportToPNG(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
exporter.ExportToPNG(sheet->SceneData()->Scene().data(), sheet->SceneData()->GraphicsPiecesAsItems());
break;
case LayoutExportFormats::OBJ:
exporter.ExportToOBJ(sheet->SceneData()->Scene());
exporter.ExportToOBJ(sheet->SceneData()->Scene().data());
break;
case LayoutExportFormats::PS:
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
exporter.ExportToPS(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
exporter.ExportToPS(sheet->SceneData()->Scene().data(), sheet->SceneData()->GraphicsPiecesAsItems());
break;
case LayoutExportFormats::EPS:
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
exporter.ExportToEPS(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
exporter.ExportToEPS(sheet->SceneData()->Scene().data(), sheet->SceneData()->GraphicsPiecesAsItems());
break;
case LayoutExportFormats::DXF_AC1006_Flat:
exporter.SetDxfVersion(DRW::AC1006);
exporter.ExportToFlatDXF(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
exporter.ExportToFlatDXF(sheet->SceneData()->Scene().data(),
sheet->SceneData()->GraphicsPiecesAsItems());
break;
case LayoutExportFormats::DXF_AC1009_Flat:
exporter.SetDxfVersion(DRW::AC1009);
exporter.ExportToFlatDXF(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
exporter.ExportToFlatDXF(sheet->SceneData()->Scene().data(),
sheet->SceneData()->GraphicsPiecesAsItems());
break;
case LayoutExportFormats::DXF_AC1012_Flat:
exporter.SetDxfVersion(DRW::AC1012);
exporter.ExportToFlatDXF(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
exporter.ExportToFlatDXF(sheet->SceneData()->Scene().data(),
sheet->SceneData()->GraphicsPiecesAsItems());
break;
case LayoutExportFormats::DXF_AC1014_Flat:
exporter.SetDxfVersion(DRW::AC1014);
exporter.ExportToFlatDXF(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
exporter.ExportToFlatDXF(sheet->SceneData()->Scene().data(),
sheet->SceneData()->GraphicsPiecesAsItems());
break;
case LayoutExportFormats::DXF_AC1015_Flat:
exporter.SetDxfVersion(DRW::AC1015);
exporter.ExportToFlatDXF(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
exporter.ExportToFlatDXF(sheet->SceneData()->Scene().data(),
sheet->SceneData()->GraphicsPiecesAsItems());
break;
case LayoutExportFormats::DXF_AC1018_Flat:
exporter.SetDxfVersion(DRW::AC1018);
exporter.ExportToFlatDXF(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
exporter.ExportToFlatDXF(sheet->SceneData()->Scene().data(),
sheet->SceneData()->GraphicsPiecesAsItems());
break;
case LayoutExportFormats::DXF_AC1021_Flat:
exporter.SetDxfVersion(DRW::AC1021);
exporter.ExportToFlatDXF(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
exporter.ExportToFlatDXF(sheet->SceneData()->Scene().data(),
sheet->SceneData()->GraphicsPiecesAsItems());
break;
case LayoutExportFormats::DXF_AC1024_Flat:
exporter.SetDxfVersion(DRW::AC1024);
exporter.ExportToFlatDXF(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
exporter.ExportToFlatDXF(sheet->SceneData()->Scene().data(),
sheet->SceneData()->GraphicsPiecesAsItems());
break;
case LayoutExportFormats::DXF_AC1027_Flat:
exporter.SetDxfVersion(DRW::AC1027);
exporter.ExportToFlatDXF(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
exporter.ExportToFlatDXF(sheet->SceneData()->Scene().data(),
sheet->SceneData()->GraphicsPiecesAsItems());
break;
case LayoutExportFormats::TIF:
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
exporter.ExportToTIF(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
exporter.ExportToTIF(sheet->SceneData()->Scene().data(), sheet->SceneData()->GraphicsPiecesAsItems());
break;
default:
qDebug() << "Can't recognize file type." << Q_FUNC_INFO;

View File

@ -32,6 +32,7 @@
#include <QMainWindow>
#include <QMessageBox>
#include <QPointer>
#include <memory>
#include "../vlayout/dialogs/vabstractlayoutdialog.h"
#include "../vlayout/vlayoutpiece.h"
@ -302,9 +303,9 @@ private slots:
private:
Q_DISABLE_COPY_MOVE(VPMainWindow) // NOLINT
Ui::VPMainWindow *ui;
std::unique_ptr<Ui::VPMainWindow> ui{};
VPCarrousel *m_carrousel{nullptr};
std::unique_ptr<VPCarrousel> m_carrousel{nullptr};
VPMainGraphicsView *m_graphicsView{nullptr};
VPCommandLinePtr m_cmd;

View File

@ -44,7 +44,6 @@
//---------------------------------------------------------------------------------------------------------------------
TapePreferencesConfigurationPage::TapePreferencesConfigurationPage(QWidget *parent)
: QWidget(parent),
ui(new Ui::TapePreferencesConfigurationPage),
m_langChanged(false),
m_systemChanged(false)
{
@ -118,10 +117,7 @@ TapePreferencesConfigurationPage::TapePreferencesConfigurationPage(QWidget *pare
}
//---------------------------------------------------------------------------------------------------------------------
TapePreferencesConfigurationPage::~TapePreferencesConfigurationPage()
{
delete ui;
}
TapePreferencesConfigurationPage::~TapePreferencesConfigurationPage() = default;
//---------------------------------------------------------------------------------------------------------------------
auto TapePreferencesConfigurationPage::Apply() -> QStringList
@ -338,7 +334,7 @@ void TapePreferencesConfigurationPage::RetranslateShortcutsTable()
void TapePreferencesConfigurationPage::InitKnownMeasurements(QComboBox *combo)
{
VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase();
QHash<QUuid, VKnownMeasurementsHeader> known = db->AllKnownMeasurements();
QHash<QUuid, VKnownMeasurementsHeader> const known = db->AllKnownMeasurements();
combo->blockSignals(true);
combo->clear();
@ -369,10 +365,10 @@ void TapePreferencesConfigurationPage::InitKnownMeasurements(QComboBox *combo)
void TapePreferencesConfigurationPage::InitKnownMeasurementsDescription()
{
VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase();
QHash<QUuid, VKnownMeasurementsHeader> known = db->AllKnownMeasurements();
QHash<QUuid, VKnownMeasurementsHeader> const known = db->AllKnownMeasurements();
ui->knownMeasurementsDescription->clear();
QUuid id = ui->comboBoxKnownMeasurements->currentData().toUuid();
QUuid const id = ui->comboBoxKnownMeasurements->currentData().toUuid();
if (!id.isNull() && known.contains(id))
{
ui->knownMeasurementsDescription->setPlainText(known.value(id).description);

View File

@ -30,6 +30,7 @@
#define TAPEPREFERENCESCONFIGURATIONPAGE_H
#include <QWidget>
#include <memory>
class QComboBox;
@ -57,7 +58,7 @@ private slots:
private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(TapePreferencesConfigurationPage) // NOLINT
Ui::TapePreferencesConfigurationPage *ui;
std::unique_ptr<Ui::TapePreferencesConfigurationPage> ui{};
bool m_langChanged;
bool m_systemChanged;
QList<QStringList> m_transientShortcuts{};

View File

@ -32,8 +32,7 @@
//---------------------------------------------------------------------------------------------------------------------
TapePreferencesPathPage::TapePreferencesPathPage(QWidget *parent)
: QWidget(parent),
ui(new Ui::TapePreferencesPathPage)
: QWidget(parent)
{
ui->setupUi(this);
@ -54,10 +53,7 @@ TapePreferencesPathPage::TapePreferencesPathPage(QWidget *parent)
}
//---------------------------------------------------------------------------------------------------------------------
TapePreferencesPathPage::~TapePreferencesPathPage()
{
delete ui;
}
TapePreferencesPathPage::~TapePreferencesPathPage() = default;
//---------------------------------------------------------------------------------------------------------------------
auto TapePreferencesPathPage::Apply() -> QStringList

View File

@ -29,6 +29,7 @@
#define TAPEPREFERENCESPATHPAGE_H
#include <QWidget>
#include <memory>
namespace Ui
{
@ -55,7 +56,7 @@ private slots:
private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(TapePreferencesPathPage) // NOLINT
Ui::TapePreferencesPathPage *ui;
std::unique_ptr<Ui::TapePreferencesPathPage> ui{};
void InitTable();
};

View File

@ -47,7 +47,6 @@
//---------------------------------------------------------------------------------------------------------------------
DialogAboutTape::DialogAboutTape(QWidget *parent)
: QDialog(parent),
ui(new Ui::DialogAboutTape),
m_isInitialized(false)
{
ui->setupUi(this);
@ -80,10 +79,7 @@ DialogAboutTape::DialogAboutTape(QWidget *parent)
}
//---------------------------------------------------------------------------------------------------------------------
DialogAboutTape::~DialogAboutTape()
{
delete ui;
}
DialogAboutTape::~DialogAboutTape() = default;
//---------------------------------------------------------------------------------------------------------------------
void DialogAboutTape::changeEvent(QEvent *event)

View File

@ -30,6 +30,7 @@
#define DIALOGABOUTTAPE_H
#include <QDialog>
#include <memory>
namespace Ui
{
@ -51,7 +52,7 @@ protected:
private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(DialogAboutTape) // NOLINT
Ui::DialogAboutTape *ui;
std::unique_ptr<Ui::DialogAboutTape> ui{};
bool m_isInitialized;
static void FontPointSize(QWidget *w, int pointSize);

View File

@ -30,9 +30,8 @@
//---------------------------------------------------------------------------------------------------------------------
DialogDimensionCustomNames::DialogDimensionCustomNames(
const QMap<MeasurementDimension, MeasurementDimension_p> &dimensions, QWidget *parent) :
QDialog(parent),
ui(new Ui::DialogDimensionCustomNames)
const QMap<MeasurementDimension, MeasurementDimension_p> &dimensions, QWidget *parent)
: QDialog(parent)
{
ui->setupUi(this);
@ -40,10 +39,7 @@ DialogDimensionCustomNames::DialogDimensionCustomNames(
}
//---------------------------------------------------------------------------------------------------------------------
DialogDimensionCustomNames::~DialogDimensionCustomNames()
{
delete ui;
}
DialogDimensionCustomNames::~DialogDimensionCustomNames() = default;
//---------------------------------------------------------------------------------------------------------------------
auto DialogDimensionCustomNames::CustomNames() const -> QMap<MeasurementDimension, QString>
@ -76,8 +72,8 @@ void DialogDimensionCustomNames::InitTable(const QMap<MeasurementDimension, Meas
while (i != dimensions.constEnd())
{
{
QString name = QStringLiteral("%1 (%2)")
.arg(VAbstartMeasurementDimension::DimensionName(i.value()->Type()), i.value()->Axis());
QString name = QStringLiteral("%1 (%2)").arg(VAbstartMeasurementDimension::DimensionName(i.value()->Type()),
i.value()->Axis());
auto *itemValue = new QTableWidgetItem(name);
itemValue->setTextAlignment(Qt::AlignHCenter | Qt::AlignCenter);

View File

@ -29,6 +29,7 @@
#define DIALOGDIMENSIONCUSTOMNAMES_H
#include <QDialog>
#include <memory>
#include "../vformat/vdimensions.h"
@ -51,7 +52,7 @@ public:
private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(DialogDimensionCustomNames) // NOLINT
Ui::DialogDimensionCustomNames *ui;
std::unique_ptr<Ui::DialogDimensionCustomNames> ui{};
void InitTable(const QMap<MeasurementDimension, MeasurementDimension_p> &dimensions);
};

View File

@ -32,7 +32,6 @@
DialogDimensionLabels::DialogDimensionLabels(const QMap<MeasurementDimension, MeasurementDimension_p> &dimensions,
bool fullCircumference, QWidget *parent)
: QDialog(parent),
ui(new Ui::DialogDimensionLabels),
m_dimensions(dimensions),
m_fullCircumference(fullCircumference)
{
@ -49,10 +48,7 @@ DialogDimensionLabels::DialogDimensionLabels(const QMap<MeasurementDimension, Me
}
//---------------------------------------------------------------------------------------------------------------------
DialogDimensionLabels::~DialogDimensionLabels()
{
delete ui;
}
DialogDimensionLabels::~DialogDimensionLabels() = default;
//---------------------------------------------------------------------------------------------------------------------
void DialogDimensionLabels::changeEvent(QEvent *event)

View File

@ -30,6 +30,7 @@
#include <QDialog>
#include <QMap>
#include <memory>
#include "../vformat/vdimensions.h"
@ -45,14 +46,14 @@ class DialogDimensionLabels : public QDialog
Q_OBJECT // NOLINT
public:
explicit DialogDimensionLabels(const QMap<MeasurementDimension, MeasurementDimension_p > &dimensions,
explicit DialogDimensionLabels(const QMap<MeasurementDimension, MeasurementDimension_p> &dimensions,
bool fullCircumference, QWidget *parent = nullptr);
~DialogDimensionLabels() override;
auto Labels() const -> QMap<MeasurementDimension, DimesionLabels>;
protected:
void changeEvent(QEvent* event) override;
void changeEvent(QEvent *event) override;
private slots:
void DimensionChanged();
@ -61,9 +62,9 @@ private slots:
private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(DialogDimensionLabels) // NOLINT
Ui::DialogDimensionLabels *ui;
std::unique_ptr<Ui::DialogDimensionLabels> ui{};
QMap<MeasurementDimension, MeasurementDimension_p > m_dimensions;
QMap<MeasurementDimension, MeasurementDimension_p> m_dimensions;
QMap<MeasurementDimension, DimesionLabels> m_labels{};
bool m_fullCircumference;

View File

@ -40,6 +40,7 @@ using VTextCodec = QTextCodec;
#include <QPushButton>
#include <QShowEvent>
#include <utility>
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
@ -48,19 +49,15 @@ using VTextCodec = QTextCodec;
using namespace Qt::Literals::StringLiterals;
//---------------------------------------------------------------------------------------------------------------------
DialogKnownMeasurementsCSVColumns::DialogKnownMeasurementsCSVColumns(const QString &filename, QWidget *parent)
DialogKnownMeasurementsCSVColumns::DialogKnownMeasurementsCSVColumns(QString filename, QWidget *parent)
: QDialog(parent),
ui(new Ui::DialogKnownMeasurementsCSVColumns),
m_fileName{filename}
m_fileName{std::move(filename)}
{
ui->setupUi(this);
}
//---------------------------------------------------------------------------------------------------------------------
DialogKnownMeasurementsCSVColumns::~DialogKnownMeasurementsCSVColumns()
{
delete ui;
}
DialogKnownMeasurementsCSVColumns::~DialogKnownMeasurementsCSVColumns() = default;
//---------------------------------------------------------------------------------------------------------------------
void DialogKnownMeasurementsCSVColumns::changeEvent(QEvent *event)
@ -151,13 +148,13 @@ void DialogKnownMeasurementsCSVColumns::ColumnChanged()
}
//---------------------------------------------------------------------------------------------------------------------
bool DialogKnownMeasurementsCSVColumns::ColumnMandatory(int column) const
auto DialogKnownMeasurementsCSVColumns::ColumnMandatory(int column) const -> bool
{
return column < static_cast<int>(KnownMeasurementsColumns::Group);
}
//---------------------------------------------------------------------------------------------------------------------
QString DialogKnownMeasurementsCSVColumns::ColumnHeader(int column) const
auto DialogKnownMeasurementsCSVColumns::ColumnHeader(int column) const -> QString
{
const auto individualColumn = static_cast<KnownMeasurementsColumns>(column);
switch (individualColumn)
@ -179,19 +176,19 @@ QString DialogKnownMeasurementsCSVColumns::ColumnHeader(int column) const
}
//---------------------------------------------------------------------------------------------------------------------
int DialogKnownMeasurementsCSVColumns::ImportColumnCount() const
auto DialogKnownMeasurementsCSVColumns::ImportColumnCount() const -> int
{
return static_cast<int>(KnownMeasurementsColumns::LAST_DO_NOT_USE);
}
//---------------------------------------------------------------------------------------------------------------------
int DialogKnownMeasurementsCSVColumns::MinimumColumns() const
auto DialogKnownMeasurementsCSVColumns::MinimumColumns() const -> int
{
return 1;
}
//---------------------------------------------------------------------------------------------------------------------
bool DialogKnownMeasurementsCSVColumns::ColumnsValid()
auto DialogKnownMeasurementsCSVColumns::ColumnsValid() -> bool
{
ClearColumnCollor();
@ -234,7 +231,7 @@ void DialogKnownMeasurementsCSVColumns::ClearColumnCollor()
//---------------------------------------------------------------------------------------------------------------------
void DialogKnownMeasurementsCSVColumns::InitColumnsMap()
{
QSharedPointer<QxtCsvModel> csv = DialogKnownMeasurementsCSVColumns::CSVModel();
QSharedPointer<QxtCsvModel> const csv = DialogKnownMeasurementsCSVColumns::CSVModel();
m_columnsMap.clear();
auto InitColumn = [this, csv](int column, int &index)
@ -346,7 +343,7 @@ void DialogKnownMeasurementsCSVColumns::InitImportHeaders()
}
//---------------------------------------------------------------------------------------------------------------------
QSharedPointer<QxtCsvModel> DialogKnownMeasurementsCSVColumns::CSVModel() const
auto DialogKnownMeasurementsCSVColumns::CSVModel() const -> QSharedPointer<QxtCsvModel>
{
return QSharedPointer<QxtCsvModel>::create(m_fileName, nullptr, m_withHeader, m_separator, m_codec);
}
@ -359,7 +356,7 @@ void DialogKnownMeasurementsCSVColumns::ShowInputPreview()
return;
}
QSharedPointer<QxtCsvModel> csv = DialogKnownMeasurementsCSVColumns::CSVModel();
QSharedPointer<QxtCsvModel> const csv = DialogKnownMeasurementsCSVColumns::CSVModel();
const int columns = csv->columnCount();
const int rows = csv->rowCount();
@ -408,7 +405,7 @@ void DialogKnownMeasurementsCSVColumns::ShowImportPreview()
return;
}
QSharedPointer<QxtCsvModel> csv = DialogKnownMeasurementsCSVColumns::CSVModel();
QSharedPointer<QxtCsvModel> const csv = DialogKnownMeasurementsCSVColumns::CSVModel();
const int importColumns = ImportColumnCount();
const int columns = csv->columnCount();
@ -455,7 +452,7 @@ void DialogKnownMeasurementsCSVColumns::SetDefaultColumns()
{
SCASSERT(control != nullptr)
int index = control->findData(m_columnsMap.at(column));
int const index = control->findData(m_columnsMap.at(column));
if (index != -1)
{
control->setCurrentIndex(index);
@ -488,7 +485,7 @@ void DialogKnownMeasurementsCSVColumns::CheckStatus()
return;
}
QSharedPointer<QxtCsvModel> csv = DialogKnownMeasurementsCSVColumns::CSVModel();
QSharedPointer<QxtCsvModel> const csv = DialogKnownMeasurementsCSVColumns::CSVModel();
const int columns = csv->columnCount();
if (columns < MinimumColumns())
@ -521,10 +518,10 @@ void DialogKnownMeasurementsCSVColumns::CheckStatus()
}
//---------------------------------------------------------------------------------------------------------------------
template <class T> bool DialogKnownMeasurementsCSVColumns::ColumnValid(T column) const
template <class T> auto DialogKnownMeasurementsCSVColumns::ColumnValid(T column) const -> bool
{
const int columnNumber = static_cast<int>(column);
int value = m_columnsMap.at(columnNumber);
int const value = m_columnsMap.at(columnNumber);
if (value == -1 && not ColumnMandatory(columnNumber))
{

View File

@ -29,6 +29,7 @@
#define DIALOGKNOWNMEASUREMENTSCSVCOLUMNS_H
#include <QDialog>
#include <memory>
class QxtCsvModel;
class QComboBox;
@ -60,7 +61,7 @@ class DialogKnownMeasurementsCSVColumns : public QDialog
Q_OBJECT // NOLINT
public:
explicit DialogKnownMeasurementsCSVColumns(const QString &filename, QWidget *parent = nullptr);
explicit DialogKnownMeasurementsCSVColumns(QString filename, QWidget *parent = nullptr);
~DialogKnownMeasurementsCSVColumns() override;
auto ColumnsMap() const -> QVector<int>;
@ -79,7 +80,7 @@ private slots:
private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(DialogKnownMeasurementsCSVColumns) // NOLINT
Ui::DialogKnownMeasurementsCSVColumns *ui;
std::unique_ptr<Ui::DialogKnownMeasurementsCSVColumns> ui{};
bool m_isInitialized{false};
QString m_fileName;
bool m_withHeader{false};