Remove class destructor so that classes follows the rule of Zero.
This commit is contained in:
parent
304ff66b06
commit
3027ddb49c
|
@ -56,7 +56,6 @@ QT_WARNING_POP
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPCarrousel::VPCarrousel(const VPLayoutPtr &layout, QWidget *parent)
|
VPCarrousel::VPCarrousel(const VPLayoutPtr &layout, QWidget *parent)
|
||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
ui(new Ui::VPCarrousel),
|
|
||||||
m_layout(layout)
|
m_layout(layout)
|
||||||
{
|
{
|
||||||
SCASSERT(not layout.isNull())
|
SCASSERT(not layout.isNull())
|
||||||
|
@ -74,11 +73,7 @@ VPCarrousel::VPCarrousel(const VPLayoutPtr &layout, QWidget *parent)
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
VPCarrousel::~VPCarrousel() = default;
|
||||||
VPCarrousel::~VPCarrousel()
|
|
||||||
{
|
|
||||||
delete ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPCarrousel::Refresh()
|
void VPCarrousel::Refresh()
|
||||||
|
@ -94,7 +89,7 @@ void VPCarrousel::Refresh()
|
||||||
// Do not rely on m_layout because we do not control it.
|
// Do not rely on m_layout because we do not control it.
|
||||||
m_pieceLists = QList<VPCarrouselSheet>();
|
m_pieceLists = QList<VPCarrouselSheet>();
|
||||||
|
|
||||||
VPLayoutPtr layout = m_layout.toStrongRef();
|
VPLayoutPtr const layout = m_layout.toStrongRef();
|
||||||
if (not layout.isNull())
|
if (not layout.isNull())
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
|
@ -107,7 +102,7 @@ void VPCarrousel::Refresh()
|
||||||
m_pieceLists.append(carrouselSheet);
|
m_pieceLists.append(carrouselSheet);
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<VPSheetPtr> sheets = layout->GetSheets();
|
QList<VPSheetPtr> const sheets = layout->GetSheets();
|
||||||
for (const auto &sheet : sheets)
|
for (const auto &sheet : sheets)
|
||||||
{
|
{
|
||||||
if (not sheet.isNull())
|
if (not sheet.isNull())
|
||||||
|
@ -137,7 +132,7 @@ void VPCarrousel::Refresh()
|
||||||
ui->comboBoxPieceList->setCurrentIndex(-1);
|
ui->comboBoxPieceList->setCurrentIndex(-1);
|
||||||
ui->comboBoxPieceList->blockSignals(false);
|
ui->comboBoxPieceList->blockSignals(false);
|
||||||
|
|
||||||
int index = ui->comboBoxPieceList->findData(sheetUuid);
|
int const index = ui->comboBoxPieceList->findData(sheetUuid);
|
||||||
ui->comboBoxPieceList->setCurrentIndex(index != -1 ? index : 0);
|
ui->comboBoxPieceList->setCurrentIndex(index != -1 ? index : 0);
|
||||||
|
|
||||||
RefreshOrientation();
|
RefreshOrientation();
|
||||||
|
@ -148,7 +143,7 @@ void VPCarrousel::on_ActiveSheetChanged(const VPSheetPtr &sheet)
|
||||||
{
|
{
|
||||||
if (not sheet.isNull())
|
if (not sheet.isNull())
|
||||||
{
|
{
|
||||||
int index = ui->comboBoxPieceList->findData(sheet->Uuid());
|
int const index = ui->comboBoxPieceList->findData(sheet->Uuid());
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
ui->comboBoxPieceList->setCurrentIndex(index);
|
ui->comboBoxPieceList->setCurrentIndex(index);
|
||||||
|
@ -163,7 +158,7 @@ void VPCarrousel::on_ActiveSheetChanged(const VPSheetPtr &sheet)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPCarrousel::RefreshSheetNames()
|
void VPCarrousel::RefreshSheetNames()
|
||||||
{
|
{
|
||||||
VPLayoutPtr layout = m_layout.toStrongRef();
|
VPLayoutPtr const layout = m_layout.toStrongRef();
|
||||||
if (layout.isNull())
|
if (layout.isNull())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -173,7 +168,7 @@ void VPCarrousel::RefreshSheetNames()
|
||||||
{
|
{
|
||||||
if (not m_pieceLists.at(i).unplaced)
|
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())
|
if (not sheet.isNull())
|
||||||
{
|
{
|
||||||
m_pieceLists[i].name = sheet->GetName();
|
m_pieceLists[i].name = sheet->GetName();
|
||||||
|
@ -203,7 +198,7 @@ void VPCarrousel::on_ActivePieceListChanged(int index)
|
||||||
{
|
{
|
||||||
qCDebug(pCarrousel, "index changed %i", index);
|
qCDebug(pCarrousel, "index changed %i", index);
|
||||||
|
|
||||||
VPLayoutPtr layout = m_layout.toStrongRef();
|
VPLayoutPtr const layout = m_layout.toStrongRef();
|
||||||
if (layout.isNull())
|
if (layout.isNull())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -215,12 +210,12 @@ void VPCarrousel::on_ActivePieceListChanged(int index)
|
||||||
|
|
||||||
if (index > 0)
|
if (index > 0)
|
||||||
{
|
{
|
||||||
QUuid sheetUuid = ui->comboBoxPieceList->currentData().toUuid();
|
QUuid const sheetUuid = ui->comboBoxPieceList->currentData().toUuid();
|
||||||
VPSheetPtr sheet = layout->GetSheet(sheetUuid);
|
VPSheetPtr const sheet = layout->GetSheet(sheetUuid);
|
||||||
|
|
||||||
if (not sheet.isNull())
|
if (not sheet.isNull())
|
||||||
{
|
{
|
||||||
VPSheetPtr activeSheet = layout->GetFocusedSheet();
|
VPSheetPtr const activeSheet = layout->GetFocusedSheet();
|
||||||
if (not activeSheet.isNull())
|
if (not activeSheet.isNull())
|
||||||
{
|
{
|
||||||
activeSheet->ClearSelection();
|
activeSheet->ClearSelection();
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include <QScrollArea>
|
#include <QScrollArea>
|
||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "../layout/layoutdef.h"
|
#include "../layout/layoutdef.h"
|
||||||
|
|
||||||
|
@ -102,7 +103,7 @@ private slots:
|
||||||
private:
|
private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(VPCarrousel) // NOLINT
|
Q_DISABLE_COPY_MOVE(VPCarrousel) // NOLINT
|
||||||
Ui::VPCarrousel *ui;
|
std::unique_ptr<Ui::VPCarrousel> ui{};
|
||||||
|
|
||||||
VPLayoutWeakPtr m_layout{};
|
VPLayoutWeakPtr m_layout{};
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,7 @@
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
PuzzlePreferencesConfigurationPage::PuzzlePreferencesConfigurationPage(QWidget *parent)
|
PuzzlePreferencesConfigurationPage::PuzzlePreferencesConfigurationPage(QWidget *parent)
|
||||||
: QWidget(parent),
|
: QWidget(parent)
|
||||||
ui(new Ui::PuzzlePreferencesConfigurationPage)
|
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
@ -62,7 +61,7 @@ PuzzlePreferencesConfigurationPage::PuzzlePreferencesConfigurationPage(QWidget *
|
||||||
|
|
||||||
// Theme
|
// Theme
|
||||||
SetThemeModeComboBox();
|
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)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
ui->comboBoxThemeMode->setCurrentIndex(index);
|
ui->comboBoxThemeMode->setCurrentIndex(index);
|
||||||
|
@ -120,10 +119,7 @@ PuzzlePreferencesConfigurationPage::PuzzlePreferencesConfigurationPage(QWidget *
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
PuzzlePreferencesConfigurationPage::~PuzzlePreferencesConfigurationPage()
|
PuzzlePreferencesConfigurationPage::~PuzzlePreferencesConfigurationPage() = default;
|
||||||
{
|
|
||||||
delete ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto PuzzlePreferencesConfigurationPage::Apply() -> QStringList
|
auto PuzzlePreferencesConfigurationPage::Apply() -> QStringList
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#define PUZZLEPREFERENCESCONFIGURATIONPAGE_H
|
#define PUZZLEPREFERENCESCONFIGURATIONPAGE_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
|
@ -54,7 +55,7 @@ private slots:
|
||||||
private:
|
private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(PuzzlePreferencesConfigurationPage) // NOLINT
|
Q_DISABLE_COPY_MOVE(PuzzlePreferencesConfigurationPage) // NOLINT
|
||||||
Ui::PuzzlePreferencesConfigurationPage *ui;
|
std::unique_ptr<Ui::PuzzlePreferencesConfigurationPage> ui{};
|
||||||
bool m_langChanged{false};
|
bool m_langChanged{false};
|
||||||
QList<QStringList> m_transientShortcuts{};
|
QList<QStringList> m_transientShortcuts{};
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,7 @@
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
PuzzlePreferencesLayoutPage::PuzzlePreferencesLayoutPage(QWidget *parent)
|
PuzzlePreferencesLayoutPage::PuzzlePreferencesLayoutPage(QWidget *parent)
|
||||||
: QWidget(parent),
|
: QWidget(parent)
|
||||||
ui(new Ui::PuzzlePreferencesLayoutPage)
|
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
@ -131,10 +130,7 @@ PuzzlePreferencesLayoutPage::PuzzlePreferencesLayoutPage(QWidget *parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
PuzzlePreferencesLayoutPage::~PuzzlePreferencesLayoutPage()
|
PuzzlePreferencesLayoutPage::~PuzzlePreferencesLayoutPage() = default;
|
||||||
{
|
|
||||||
delete ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto PuzzlePreferencesLayoutPage::Apply() -> QStringList
|
auto PuzzlePreferencesLayoutPage::Apply() -> QStringList
|
||||||
|
|
|
@ -29,13 +29,14 @@
|
||||||
#define PUZZLEPREFERENCESLAYOUTPAGE_H
|
#define PUZZLEPREFERENCESLAYOUTPAGE_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "../vmisc/def.h"
|
|
||||||
#include "../vlayout/dialogs/vabstractlayoutdialog.h"
|
#include "../vlayout/dialogs/vabstractlayoutdialog.h"
|
||||||
|
#include "../vmisc/def.h"
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
class PuzzlePreferencesLayoutPage;
|
class PuzzlePreferencesLayoutPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
class PuzzlePreferencesLayoutPage : public QWidget
|
class PuzzlePreferencesLayoutPage : public QWidget
|
||||||
|
@ -49,7 +50,7 @@ public:
|
||||||
auto Apply() -> QStringList;
|
auto Apply() -> QStringList;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void changeEvent(QEvent* event) override;
|
void changeEvent(QEvent *event) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void ConvertPaperSize();
|
void ConvertPaperSize();
|
||||||
|
@ -64,7 +65,7 @@ private slots:
|
||||||
private:
|
private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(PuzzlePreferencesLayoutPage) // NOLINT
|
Q_DISABLE_COPY_MOVE(PuzzlePreferencesLayoutPage) // NOLINT
|
||||||
Ui::PuzzlePreferencesLayoutPage *ui;
|
std::unique_ptr<Ui::PuzzlePreferencesLayoutPage> ui{};
|
||||||
Unit m_oldLayoutUnit{Unit::Mm};
|
Unit m_oldLayoutUnit{Unit::Mm};
|
||||||
bool m_settingsChanged{false};
|
bool m_settingsChanged{false};
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,7 @@
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
PuzzlePreferencesPathPage::PuzzlePreferencesPathPage(QWidget *parent)
|
PuzzlePreferencesPathPage::PuzzlePreferencesPathPage(QWidget *parent)
|
||||||
: QWidget(parent),
|
: QWidget(parent)
|
||||||
ui(new Ui::PuzzlePreferencesPathPage)
|
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
@ -53,10 +52,7 @@ PuzzlePreferencesPathPage::PuzzlePreferencesPathPage(QWidget *parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
PuzzlePreferencesPathPage::~PuzzlePreferencesPathPage()
|
PuzzlePreferencesPathPage::~PuzzlePreferencesPathPage() = default;
|
||||||
{
|
|
||||||
delete ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void PuzzlePreferencesPathPage::Apply()
|
void PuzzlePreferencesPathPage::Apply()
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#define PUZZLEPREFERENCESPATHPAGE_H
|
#define PUZZLEPREFERENCESPATHPAGE_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
|
@ -55,7 +56,7 @@ private slots:
|
||||||
private:
|
private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(PuzzlePreferencesPathPage) // NOLINT
|
Q_DISABLE_COPY_MOVE(PuzzlePreferencesPathPage) // NOLINT
|
||||||
Ui::PuzzlePreferencesPathPage *ui;
|
std::unique_ptr<Ui::PuzzlePreferencesPathPage> ui{};
|
||||||
|
|
||||||
void InitTable();
|
void InitTable();
|
||||||
};
|
};
|
||||||
|
|
|
@ -46,7 +46,6 @@ using namespace Qt::Literals::StringLiterals;
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogPuzzlePreferences::DialogPuzzlePreferences(QWidget *parent)
|
DialogPuzzlePreferences::DialogPuzzlePreferences(QWidget *parent)
|
||||||
: QDialog(parent),
|
: QDialog(parent),
|
||||||
ui(new Ui::DialogPuzzlePreferences),
|
|
||||||
m_configurationPage(new PuzzlePreferencesConfigurationPage),
|
m_configurationPage(new PuzzlePreferencesConfigurationPage),
|
||||||
m_layoutPage(new PuzzlePreferencesLayoutPage),
|
m_layoutPage(new PuzzlePreferencesLayoutPage),
|
||||||
m_pathPage(new PuzzlePreferencesPathPage)
|
m_pathPage(new PuzzlePreferencesPathPage)
|
||||||
|
@ -76,10 +75,7 @@ DialogPuzzlePreferences::DialogPuzzlePreferences(QWidget *parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogPuzzlePreferences::~DialogPuzzlePreferences()
|
DialogPuzzlePreferences::~DialogPuzzlePreferences() = default;
|
||||||
{
|
|
||||||
delete ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPuzzlePreferences::showEvent(QShowEvent *event)
|
void DialogPuzzlePreferences::showEvent(QShowEvent *event)
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#define DIALOGPUZZLEPREFERENCES_H
|
#define DIALOGPUZZLEPREFERENCES_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
|
@ -64,7 +65,7 @@ private slots:
|
||||||
private:
|
private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(DialogPuzzlePreferences) // NOLINT
|
Q_DISABLE_COPY_MOVE(DialogPuzzlePreferences) // NOLINT
|
||||||
Ui::DialogPuzzlePreferences *ui;
|
std::unique_ptr<Ui::DialogPuzzlePreferences> ui{};
|
||||||
bool m_isInitialized{false};
|
bool m_isInitialized{false};
|
||||||
PuzzlePreferencesConfigurationPage *m_configurationPage;
|
PuzzlePreferencesConfigurationPage *m_configurationPage;
|
||||||
PuzzlePreferencesLayoutPage *m_layoutPage;
|
PuzzlePreferencesLayoutPage *m_layoutPage;
|
||||||
|
|
|
@ -59,7 +59,6 @@ QT_WARNING_POP
|
||||||
DialogSaveManualLayout::DialogSaveManualLayout(vsizetype count, bool consoleExport, const QString &fileName,
|
DialogSaveManualLayout::DialogSaveManualLayout(vsizetype count, bool consoleExport, const QString &fileName,
|
||||||
QWidget *parent)
|
QWidget *parent)
|
||||||
: VAbstractLayoutDialog(parent),
|
: VAbstractLayoutDialog(parent),
|
||||||
ui(new Ui::DialogSaveManualLayout),
|
|
||||||
m_count(count),
|
m_count(count),
|
||||||
m_consoleExport(consoleExport)
|
m_consoleExport(consoleExport)
|
||||||
{
|
{
|
||||||
|
@ -142,10 +141,7 @@ DialogSaveManualLayout::DialogSaveManualLayout(vsizetype count, bool consoleExpo
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogSaveManualLayout::~DialogSaveManualLayout()
|
DialogSaveManualLayout::~DialogSaveManualLayout() = default;
|
||||||
{
|
|
||||||
delete ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto DialogSaveManualLayout::Path() const -> QString
|
auto DialogSaveManualLayout::Path() const -> QString
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
#ifndef DIALOGSAVEMANUALLAYOUT_H
|
#ifndef DIALOGSAVEMANUALLAYOUT_H
|
||||||
#define DIALOGSAVEMANUALLAYOUT_H
|
#define DIALOGSAVEMANUALLAYOUT_H
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "../vlayout/dialogs/vabstractlayoutdialog.h"
|
#include "../vlayout/dialogs/vabstractlayoutdialog.h"
|
||||||
#include "../vlayout/vlayoutdef.h"
|
#include "../vlayout/vlayoutdef.h"
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
@ -80,7 +82,7 @@ private slots:
|
||||||
private:
|
private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(DialogSaveManualLayout) // NOLINT
|
Q_DISABLE_COPY_MOVE(DialogSaveManualLayout) // NOLINT
|
||||||
Ui::DialogSaveManualLayout *ui;
|
std::unique_ptr<Ui::DialogSaveManualLayout> ui{};
|
||||||
vsizetype m_count;
|
vsizetype m_count;
|
||||||
bool m_isInitialized{false};
|
bool m_isInitialized{false};
|
||||||
bool m_scaleConnected{true};
|
bool m_scaleConnected{true};
|
||||||
|
|
|
@ -53,7 +53,6 @@ using namespace Qt::Literals::StringLiterals;
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPDialogAbout::VPDialogAbout(QWidget *parent)
|
VPDialogAbout::VPDialogAbout(QWidget *parent)
|
||||||
: QDialog(parent),
|
: QDialog(parent),
|
||||||
ui(new Ui::VPDialogAbout),
|
|
||||||
m_isInitialized(false)
|
m_isInitialized(false)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
@ -85,10 +84,7 @@ VPDialogAbout::VPDialogAbout(QWidget *parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPDialogAbout::~VPDialogAbout()
|
VPDialogAbout::~VPDialogAbout() = default;
|
||||||
{
|
|
||||||
delete ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPDialogAbout::changeEvent(QEvent *event)
|
void VPDialogAbout::changeEvent(QEvent *event)
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#define VPDIALOGABOUT_H
|
#define VPDIALOGABOUT_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
|
@ -51,7 +52,7 @@ protected:
|
||||||
private:
|
private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(VPDialogAbout) // NOLINT
|
Q_DISABLE_COPY_MOVE(VPDialogAbout) // NOLINT
|
||||||
Ui::VPDialogAbout *ui;
|
std::unique_ptr<Ui::VPDialogAbout> ui{};
|
||||||
bool m_isInitialized;
|
bool m_isInitialized;
|
||||||
|
|
||||||
static void FontPointSize(QWidget *w, int pointSize);
|
static void FontPointSize(QWidget *w, int pointSize);
|
||||||
|
|
|
@ -61,10 +61,7 @@ VPLayout::VPLayout(QUndoStack *undoStack)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPLayout::~VPLayout()
|
VPLayout::~VPLayout() = default;
|
||||||
{
|
|
||||||
delete m_tileFactory;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VPLayout::CreateLayout(QUndoStack *undoStack) -> VPLayoutPtr
|
auto VPLayout::CreateLayout(QUndoStack *undoStack) -> VPLayoutPtr
|
||||||
|
@ -75,7 +72,7 @@ auto VPLayout::CreateLayout(QUndoStack *undoStack) -> VPLayoutPtr
|
||||||
layout->AddTrashSheet(VPSheetPtr(new VPSheet(layout)));
|
layout->AddTrashSheet(VPSheetPtr(new VPSheet(layout)));
|
||||||
|
|
||||||
// create a standard sheet
|
// 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));
|
sheet->SetName(tr("Sheet %1").arg(layout->GetAllSheets().size() + 1));
|
||||||
layout->AddSheet(sheet);
|
layout->AddSheet(sheet);
|
||||||
layout->SetFocusedSheet(sheet);
|
layout->SetFocusedSheet(sheet);
|
||||||
|
@ -100,7 +97,7 @@ auto VPLayout::CreateLayout(QUndoStack *undoStack) -> VPLayoutPtr
|
||||||
// --------------------------------------------------------
|
// --------------------------------------------------------
|
||||||
|
|
||||||
// init the tile factory
|
// init the tile factory
|
||||||
auto *tileFactory = new VPTileFactory(layout, settings);
|
auto tileFactory = QSharedPointer<VPTileFactory>(new VPTileFactory(layout, settings));
|
||||||
tileFactory->RefreshTileInfos();
|
tileFactory->RefreshTileInfos();
|
||||||
tileFactory->RefreshWatermarkData();
|
tileFactory->RefreshWatermarkData();
|
||||||
layout->SetTileFactory(tileFactory);
|
layout->SetTileFactory(tileFactory);
|
||||||
|
@ -131,7 +128,7 @@ void VPLayout::AddPiece(const VPPiecePtr &piece)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VPPiecePtr oldPiece = m_pieces.value(piece->GetUniqueID());
|
VPPiecePtr const oldPiece = m_pieces.value(piece->GetUniqueID());
|
||||||
if (not oldPiece.isNull())
|
if (not oldPiece.isNull())
|
||||||
{
|
{
|
||||||
oldPiece->Update(piece);
|
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;
|
return m_tileFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPLayout::SetTileFactory(VPTileFactory *newTileFactory)
|
void VPLayout::SetTileFactory(const QSharedPointer<VPTileFactory> &newTileFactory)
|
||||||
{
|
{
|
||||||
delete m_tileFactory;
|
m_tileFactory.clear();
|
||||||
m_tileFactory = newTileFactory;
|
m_tileFactory = newTileFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,7 +214,7 @@ auto VPLayout::IsSheetsUniform() const -> bool
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSizeF sheetSize = sheet->GetSheetSize().toSize();
|
QSizeF const sheetSize = sheet->GetSheetSize().toSize();
|
||||||
|
|
||||||
return std::all_of(sheets.begin(), sheets.end(),
|
return std::all_of(sheets.begin(), sheets.end(),
|
||||||
[sheetSize](const VPSheetPtr &sheet)
|
[sheetSize](const VPSheetPtr &sheet)
|
||||||
|
@ -226,7 +223,7 @@ auto VPLayout::IsSheetsUniform() const -> bool
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
QSize size = sheet->GetSheetSize().toSize();
|
QSize const size = sheet->GetSheetSize().toSize();
|
||||||
return size == sheetSize || size.transposed() == sheetSize;
|
return size == sheetSize || size.transposed() == sheetSize;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -377,7 +374,7 @@ auto VPLayout::PiecesForSheet(const QUuid &uuid) const -> QList<VPPiecePtr>
|
||||||
{
|
{
|
||||||
if (not piece.isNull())
|
if (not piece.isNull())
|
||||||
{
|
{
|
||||||
VPSheetPtr sheet = piece->Sheet();
|
VPSheetPtr const sheet = piece->Sheet();
|
||||||
if (not sheet.isNull() && sheet->Uuid() == uuid)
|
if (not sheet.isNull() && sheet->Uuid() == uuid)
|
||||||
{
|
{
|
||||||
list.append(piece);
|
list.append(piece);
|
||||||
|
|
|
@ -91,8 +91,8 @@ public:
|
||||||
|
|
||||||
void CheckPiecesPositionValidity() const;
|
void CheckPiecesPositionValidity() const;
|
||||||
|
|
||||||
auto TileFactory() const -> VPTileFactory *;
|
auto TileFactory() const -> QSharedPointer<VPTileFactory>;
|
||||||
void SetTileFactory(VPTileFactory *newTileFactory);
|
void SetTileFactory(const QSharedPointer<VPTileFactory> &newTileFactory);
|
||||||
|
|
||||||
void RefreshScenePieces() const;
|
void RefreshScenePieces() const;
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ private:
|
||||||
|
|
||||||
QUndoStack *m_undoStack;
|
QUndoStack *m_undoStack;
|
||||||
|
|
||||||
VPTileFactory *m_tileFactory{nullptr};
|
QSharedPointer<VPTileFactory> m_tileFactory{nullptr};
|
||||||
|
|
||||||
QUuid m_uuid{QUuid::createUuid()};
|
QUuid m_uuid{QUuid::createUuid()};
|
||||||
};
|
};
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPSheetSceneData::VPSheetSceneData(const VPLayoutPtr &layout, const QUuid &sheetUuid)
|
VPSheetSceneData::VPSheetSceneData(const VPLayoutPtr &layout, const QUuid &sheetUuid)
|
||||||
: m_layout(layout),
|
: m_layout(layout),
|
||||||
m_scene(new VMainGraphicsScene()),
|
m_scene(QSharedPointer<VMainGraphicsScene>::create()),
|
||||||
m_sheetUuid(sheetUuid)
|
m_sheetUuid(sheetUuid)
|
||||||
{
|
{
|
||||||
SCASSERT(not layout.isNull())
|
SCASSERT(not layout.isNull())
|
||||||
|
@ -68,13 +68,10 @@ VPSheetSceneData::VPSheetSceneData(const VPLayoutPtr &layout, const QUuid &sheet
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPSheetSceneData::~VPSheetSceneData()
|
VPSheetSceneData::~VPSheetSceneData() = default;
|
||||||
{
|
|
||||||
delete m_scene;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VPSheetSceneData::Scene() const -> VMainGraphicsScene *
|
auto VPSheetSceneData::Scene() const -> QSharedPointer<VMainGraphicsScene>
|
||||||
{
|
{
|
||||||
return m_scene;
|
return m_scene;
|
||||||
}
|
}
|
||||||
|
@ -95,19 +92,19 @@ void VPSheetSceneData::RefreshPieces()
|
||||||
qDeleteAll(m_graphicsPieces);
|
qDeleteAll(m_graphicsPieces);
|
||||||
m_graphicsPieces.clear();
|
m_graphicsPieces.clear();
|
||||||
|
|
||||||
VPLayoutPtr layout = m_layout.toStrongRef();
|
VPLayoutPtr const layout = m_layout.toStrongRef();
|
||||||
if (layout.isNull())
|
if (layout.isNull())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
VPSheetPtr sheet = layout->GetSheet(m_sheetUuid);
|
VPSheetPtr const sheet = layout->GetSheet(m_sheetUuid);
|
||||||
if (sheet.isNull())
|
if (sheet.isNull())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<VPPiecePtr> pieces = sheet->GetPieces();
|
QList<VPPiecePtr> const pieces = sheet->GetPieces();
|
||||||
m_graphicsPieces.reserve(pieces.size());
|
m_graphicsPieces.reserve(pieces.size());
|
||||||
|
|
||||||
for (const auto &piece : pieces)
|
for (const auto &piece : pieces)
|
||||||
|
@ -277,7 +274,7 @@ void VPSheetSceneData::SetTextAsPaths(bool textAsPaths) const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPSheetSceneData::PrepareTilesScheme()
|
void VPSheetSceneData::PrepareTilesScheme()
|
||||||
{
|
{
|
||||||
VPLayoutPtr layout = m_layout.toStrongRef();
|
VPLayoutPtr const layout = m_layout.toStrongRef();
|
||||||
if (not layout.isNull())
|
if (not layout.isNull())
|
||||||
{
|
{
|
||||||
m_showTilesSchemeTmp = layout->LayoutSettings().GetShowTiles();
|
m_showTilesSchemeTmp = layout->LayoutSettings().GetShowTiles();
|
||||||
|
@ -293,7 +290,7 @@ void VPSheetSceneData::PrepareTilesScheme()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPSheetSceneData::ClearTilesScheme()
|
void VPSheetSceneData::ClearTilesScheme()
|
||||||
{
|
{
|
||||||
VPLayoutPtr layout = m_layout.toStrongRef();
|
VPLayoutPtr const layout = m_layout.toStrongRef();
|
||||||
if (not layout.isNull())
|
if (not layout.isNull())
|
||||||
{
|
{
|
||||||
layout->LayoutSettings().SetShowTiles(m_showTilesSchemeTmp);
|
layout->LayoutSettings().SetShowTiles(m_showTilesSchemeTmp);
|
||||||
|
@ -317,7 +314,7 @@ void VPSheetSceneData::ConnectPiece(VPGraphicsPiece *piece)
|
||||||
{
|
{
|
||||||
SCASSERT(piece != nullptr)
|
SCASSERT(piece != nullptr)
|
||||||
|
|
||||||
VPLayoutPtr layout = m_layout.toStrongRef();
|
VPLayoutPtr const layout = m_layout.toStrongRef();
|
||||||
if (layout.isNull())
|
if (layout.isNull())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -343,7 +340,7 @@ void VPSheetSceneData::ConnectPiece(VPGraphicsPiece *piece)
|
||||||
VPSheet::VPSheet(const VPLayoutPtr &layout, QObject *parent)
|
VPSheet::VPSheet(const VPLayoutPtr &layout, QObject *parent)
|
||||||
: QObject(parent),
|
: QObject(parent),
|
||||||
m_layout(layout),
|
m_layout(layout),
|
||||||
m_sceneData(new VPSheetSceneData(layout, Uuid()))
|
m_sceneData(QSharedPointer<VPSheetSceneData>::create(layout, Uuid()))
|
||||||
{
|
{
|
||||||
SCASSERT(not layout.isNull())
|
SCASSERT(not layout.isNull())
|
||||||
|
|
||||||
|
@ -354,10 +351,7 @@ VPSheet::VPSheet(const VPLayoutPtr &layout, QObject *parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPSheet::~VPSheet()
|
VPSheet::~VPSheet() = default;
|
||||||
{
|
|
||||||
delete m_sceneData;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VPSheet::GetLayout() const -> VPLayoutPtr
|
auto VPSheet::GetLayout() const -> VPLayoutPtr
|
||||||
|
@ -368,7 +362,7 @@ auto VPSheet::GetLayout() const -> VPLayoutPtr
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VPSheet::GetPieces() const -> QList<VPPiecePtr>
|
auto VPSheet::GetPieces() const -> QList<VPPiecePtr>
|
||||||
{
|
{
|
||||||
VPLayoutPtr layout = GetLayout();
|
VPLayoutPtr const layout = GetLayout();
|
||||||
if (not layout.isNull())
|
if (not layout.isNull())
|
||||||
{
|
{
|
||||||
return layout->PiecesForSheet(m_uuid);
|
return layout->PiecesForSheet(m_uuid);
|
||||||
|
@ -380,10 +374,10 @@ auto VPSheet::GetPieces() const -> QList<VPPiecePtr>
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VPSheet::GetSelectedPieces() const -> QList<VPPiecePtr>
|
auto VPSheet::GetSelectedPieces() const -> QList<VPPiecePtr>
|
||||||
{
|
{
|
||||||
VPLayoutPtr layout = GetLayout();
|
VPLayoutPtr const layout = GetLayout();
|
||||||
if (not layout.isNull())
|
if (not layout.isNull())
|
||||||
{
|
{
|
||||||
QList<VPPiecePtr> list = layout->PiecesForSheet(m_uuid);
|
QList<VPPiecePtr> const list = layout->PiecesForSheet(m_uuid);
|
||||||
|
|
||||||
QList<VPPiecePtr> selected;
|
QList<VPPiecePtr> selected;
|
||||||
selected.reserve(list.size());
|
selected.reserve(list.size());
|
||||||
|
@ -405,7 +399,7 @@ auto VPSheet::GetSelectedPieces() const -> QList<VPPiecePtr>
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VPSheet::GetAsLayoutPieces() const -> QVector<VLayoutPiece>
|
auto VPSheet::GetAsLayoutPieces() const -> QVector<VLayoutPiece>
|
||||||
{
|
{
|
||||||
QList<VPPiecePtr> pieces = GetPieces();
|
QList<VPPiecePtr> const pieces = GetPieces();
|
||||||
|
|
||||||
QVector<VLayoutPiece> details;
|
QVector<VLayoutPiece> details;
|
||||||
details.reserve(pieces.size());
|
details.reserve(pieces.size());
|
||||||
|
@ -520,7 +514,7 @@ void VPSheet::SetTrashSheet(bool newTrashSheet)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPSheet::ValidateSuperpositionOfPieces() const
|
void VPSheet::ValidateSuperpositionOfPieces() const
|
||||||
{
|
{
|
||||||
QList<VPPiecePtr> pieces = GetPieces();
|
QList<VPPiecePtr> const pieces = GetPieces();
|
||||||
|
|
||||||
for (const auto &piece : pieces)
|
for (const auto &piece : pieces)
|
||||||
{
|
{
|
||||||
|
@ -633,13 +627,13 @@ auto VPSheet::GetMarginsRect() const -> QRectF
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPSheet::RemoveUnusedLength()
|
void VPSheet::RemoveUnusedLength()
|
||||||
{
|
{
|
||||||
VPLayoutPtr layout = GetLayout();
|
VPLayoutPtr const layout = GetLayout();
|
||||||
if (layout.isNull())
|
if (layout.isNull())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<VPPiecePtr> pieces = GetPieces();
|
QList<VPPiecePtr> const pieces = GetPieces();
|
||||||
if (pieces.isEmpty())
|
if (pieces.isEmpty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -658,8 +652,8 @@ void VPSheet::RemoveUnusedLength()
|
||||||
}
|
}
|
||||||
|
|
||||||
const qreal extra = 2;
|
const qreal extra = 2;
|
||||||
QRectF sheetRect = GetSheetRect();
|
QRectF const sheetRect = GetSheetRect();
|
||||||
GrainlineType type = GrainlineOrientation();
|
GrainlineType const type = GrainlineOrientation();
|
||||||
|
|
||||||
if (type == GrainlineType::Vertical)
|
if (type == GrainlineType::Vertical)
|
||||||
{
|
{
|
||||||
|
@ -692,13 +686,13 @@ void VPSheet::RemoveUnusedLength()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPSheet::CheckPiecePositionValidity(const VPPiecePtr &piece) const
|
void VPSheet::CheckPiecePositionValidity(const VPPiecePtr &piece) const
|
||||||
{
|
{
|
||||||
VPLayoutPtr layout = GetLayout();
|
VPLayoutPtr const layout = GetLayout();
|
||||||
if (layout.isNull())
|
if (layout.isNull())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<VPPiecePtr> pieces = GetPieces();
|
QList<VPPiecePtr> const pieces = GetPieces();
|
||||||
if (piece.isNull() || not pieces.contains(piece))
|
if (piece.isNull() || not pieces.contains(piece))
|
||||||
{
|
{
|
||||||
return;
|
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;
|
return m_sceneData;
|
||||||
}
|
}
|
||||||
|
@ -724,7 +718,7 @@ auto VPSheet::SceneData() const -> VPSheetSceneData *
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPSheet::ClearSelection() const
|
void VPSheet::ClearSelection() const
|
||||||
{
|
{
|
||||||
QList<VPPiecePtr> selectedPieces = GetSelectedPieces();
|
QList<VPPiecePtr> const selectedPieces = GetSelectedPieces();
|
||||||
for (const auto &piece : selectedPieces)
|
for (const auto &piece : selectedPieces)
|
||||||
{
|
{
|
||||||
if (piece->IsSelected())
|
if (piece->IsSelected())
|
||||||
|
@ -735,7 +729,7 @@ void VPSheet::ClearSelection() const
|
||||||
|
|
||||||
if (not selectedPieces.isEmpty())
|
if (not selectedPieces.isEmpty())
|
||||||
{
|
{
|
||||||
VPLayoutPtr layout = GetLayout();
|
VPLayoutPtr const layout = GetLayout();
|
||||||
if (not layout.isNull())
|
if (not layout.isNull())
|
||||||
{
|
{
|
||||||
emit layout->PieceSelectionChanged(VPPiecePtr());
|
emit layout->PieceSelectionChanged(VPPiecePtr());
|
||||||
|
@ -752,7 +746,7 @@ auto VPSheet::GetSheetOrientation() const -> QPageLayout::Orientation
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VPSheet::SheetUnits() const -> Unit
|
auto VPSheet::SheetUnits() const -> Unit
|
||||||
{
|
{
|
||||||
VPLayoutPtr layout = GetLayout();
|
VPLayoutPtr const layout = GetLayout();
|
||||||
if (not layout.isNull())
|
if (not layout.isNull())
|
||||||
{
|
{
|
||||||
return layout->LayoutSettings().GetUnit();
|
return layout->LayoutSettings().GetUnit();
|
||||||
|
@ -776,7 +770,7 @@ void VPSheet::SetSheetSize(qreal width, qreal height)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPSheet::SetSheetSizeConverted(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.setWidth(UnitConvertor(width, unit, Unit::Px));
|
||||||
m_size.setHeight(UnitConvertor(height, 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)
|
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));
|
m_size = QSizeF(UnitConvertor(size.width(), unit, Unit::Px), UnitConvertor(size.height(), unit, Unit::Px));
|
||||||
|
|
||||||
if (m_sceneData != nullptr)
|
if (m_sceneData != nullptr)
|
||||||
|
@ -818,7 +812,7 @@ auto VPSheet::GetSheetSize() const -> QSizeF
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VPSheet::GetSheetSizeConverted() const -> QSizeF
|
auto VPSheet::GetSheetSizeConverted() const -> QSizeF
|
||||||
{
|
{
|
||||||
Unit unit = SheetUnits();
|
Unit const unit = SheetUnits();
|
||||||
QSizeF convertedSize =
|
QSizeF convertedSize =
|
||||||
QSizeF(UnitConvertor(m_size.width(), Unit::Px, unit), UnitConvertor(m_size.height(), Unit::Px, unit));
|
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)
|
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.setLeft(UnitConvertor(left, unit, Unit::Px));
|
||||||
m_margins.setTop(UnitConvertor(top, unit, Unit::Px));
|
m_margins.setTop(UnitConvertor(top, unit, Unit::Px));
|
||||||
m_margins.setRight(UnitConvertor(right, 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)
|
void VPSheet::SetSheetMarginsConverted(const QMarginsF &margins)
|
||||||
{
|
{
|
||||||
Unit unit = SheetUnits();
|
Unit const unit = SheetUnits();
|
||||||
m_margins = UnitConvertor(margins, unit, Unit::Px);
|
m_margins = UnitConvertor(margins, unit, Unit::Px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -865,7 +859,7 @@ auto VPSheet::GetSheetMargins() const -> QMarginsF
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VPSheet::GetSheetMarginsConverted() const -> QMarginsF
|
auto VPSheet::GetSheetMarginsConverted() const -> QMarginsF
|
||||||
{
|
{
|
||||||
Unit unit = SheetUnits();
|
Unit const unit = SheetUnits();
|
||||||
return UnitConvertor(m_margins, Unit::Px, unit);
|
return UnitConvertor(m_margins, Unit::Px, unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ public:
|
||||||
explicit VPSheetSceneData(const VPLayoutPtr &layout, const QUuid &sheetUuid);
|
explicit VPSheetSceneData(const VPLayoutPtr &layout, const QUuid &sheetUuid);
|
||||||
~VPSheetSceneData();
|
~VPSheetSceneData();
|
||||||
|
|
||||||
auto Scene() const -> VMainGraphicsScene *;
|
auto Scene() const -> QSharedPointer<VMainGraphicsScene>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief RefreshLayout Refreshes the rectangles for the layout border and the margin
|
* @brief RefreshLayout Refreshes the rectangles for the layout border and the margin
|
||||||
|
@ -98,7 +98,7 @@ private:
|
||||||
|
|
||||||
VPLayoutWeakPtr m_layout{};
|
VPLayoutWeakPtr m_layout{};
|
||||||
|
|
||||||
VMainGraphicsScene *m_scene;
|
QSharedPointer<VMainGraphicsScene> m_scene{nullptr};
|
||||||
|
|
||||||
VPGraphicsSheet *m_graphicsSheet{nullptr};
|
VPGraphicsSheet *m_graphicsSheet{nullptr};
|
||||||
|
|
||||||
|
@ -273,7 +273,7 @@ public:
|
||||||
auto IgnoreMargins() const -> bool;
|
auto IgnoreMargins() const -> bool;
|
||||||
void SetIgnoreMargins(bool newIgnoreMargins);
|
void SetIgnoreMargins(bool newIgnoreMargins);
|
||||||
|
|
||||||
auto SceneData() const -> VPSheetSceneData *;
|
auto SceneData() const -> QSharedPointer<VPSheetSceneData>;
|
||||||
|
|
||||||
void ClearSelection() const;
|
void ClearSelection() const;
|
||||||
|
|
||||||
|
@ -311,7 +311,7 @@ private:
|
||||||
|
|
||||||
GrainlineType m_grainlineType{GrainlineType::NotFixed};
|
GrainlineType m_grainlineType{GrainlineType::NotFixed};
|
||||||
|
|
||||||
VPSheetSceneData *m_sceneData{nullptr};
|
QSharedPointer<VPSheetSceneData> m_sceneData{nullptr};
|
||||||
|
|
||||||
auto SheetUnits() const -> Unit;
|
auto SheetUnits() const -> Unit;
|
||||||
};
|
};
|
||||||
|
|
|
@ -562,9 +562,9 @@ void VPMainGraphicsView::SwitchScene(const VPSheetPtr &sheet)
|
||||||
{
|
{
|
||||||
if (not sheet.isNull())
|
if (not sheet.isNull())
|
||||||
{
|
{
|
||||||
VMainGraphicsScene *scene = sheet->SceneData()->Scene();
|
QSharedPointer<VMainGraphicsScene> scene = sheet->SceneData()->Scene();
|
||||||
setScene(scene);
|
setScene(scene.data());
|
||||||
connect(scene, &VMainGraphicsScene::mouseMove, this, &VPMainGraphicsView::on_SceneMouseMove,
|
connect(scene.data(), &VMainGraphicsScene::mouseMove, this, &VPMainGraphicsView::on_SceneMouseMove,
|
||||||
Qt::UniqueConnection);
|
Qt::UniqueConnection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -323,7 +323,6 @@ struct VPExportData
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPMainWindow::VPMainWindow(const VPCommandLinePtr &cmd, QWidget *parent)
|
VPMainWindow::VPMainWindow(const VPCommandLinePtr &cmd, QWidget *parent)
|
||||||
: VAbstractMainWindow(parent),
|
: VAbstractMainWindow(parent),
|
||||||
ui(new Ui::VPMainWindow),
|
|
||||||
m_cmd(cmd),
|
m_cmd(cmd),
|
||||||
m_undoStack(new QUndoStack(this)),
|
m_undoStack(new QUndoStack(this)),
|
||||||
m_layout{VPLayout::CreateLayout(m_undoStack)},
|
m_layout{VPLayout::CreateLayout(m_undoStack)},
|
||||||
|
@ -450,12 +449,7 @@ VPMainWindow::VPMainWindow(const VPCommandLinePtr &cmd, QWidget *parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPMainWindow::~VPMainWindow()
|
VPMainWindow::~VPMainWindow() = default;
|
||||||
{
|
|
||||||
delete m_undoStack;
|
|
||||||
delete ui;
|
|
||||||
delete m_carrousel;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VPMainWindow::CurrentFile() const -> QString
|
auto VPMainWindow::CurrentFile() const -> QString
|
||||||
|
@ -1286,8 +1280,8 @@ void VPMainWindow::InitPropertyTabLayout()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPMainWindow::InitCarrousel()
|
void VPMainWindow::InitCarrousel()
|
||||||
{
|
{
|
||||||
m_carrousel = new VPCarrousel(m_layout, ui->dockWidgetCarrousel);
|
m_carrousel = std::make_unique<VPCarrousel>(m_layout, ui->dockWidgetCarrousel);
|
||||||
ui->dockWidgetCarrousel->setWidget(m_carrousel);
|
ui->dockWidgetCarrousel->setWidget(m_carrousel.get());
|
||||||
|
|
||||||
connect(ui->dockWidgetCarrousel, QOverload<Qt::DockWidgetArea>::of(&QDockWidget::dockLocationChanged), this,
|
connect(ui->dockWidgetCarrousel, QOverload<Qt::DockWidgetArea>::of(&QDockWidget::dockLocationChanged), this,
|
||||||
&VPMainWindow::on_CarrouselLocationChanged);
|
&VPMainWindow::on_CarrouselLocationChanged);
|
||||||
|
@ -1638,7 +1632,7 @@ void VPMainWindow::InitMainGraphics()
|
||||||
|
|
||||||
connect(m_graphicsView, &VPMainGraphicsView::ScaleChanged, this, &VPMainWindow::on_ScaleChanged);
|
connect(m_graphicsView, &VPMainGraphicsView::ScaleChanged, this, &VPMainWindow::on_ScaleChanged);
|
||||||
connect(m_graphicsView, &VPMainGraphicsView::mouseMove, this, &VPMainWindow::on_MouseMoved);
|
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:
|
case LayoutExportFormats::SVG:
|
||||||
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
|
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
|
||||||
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
exporter.ExportToSVG(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
|
exporter.ExportToSVG(sheet->SceneData()->Scene().data(), sheet->SceneData()->GraphicsPiecesAsItems());
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::PDF:
|
case LayoutExportFormats::PDF:
|
||||||
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
|
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
|
||||||
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
exporter.ExportToPDF(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
|
exporter.ExportToPDF(sheet->SceneData()->Scene().data(), sheet->SceneData()->GraphicsPiecesAsItems());
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::PNG:
|
case LayoutExportFormats::PNG:
|
||||||
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
|
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
|
||||||
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
exporter.ExportToPNG(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
|
exporter.ExportToPNG(sheet->SceneData()->Scene().data(), sheet->SceneData()->GraphicsPiecesAsItems());
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::OBJ:
|
case LayoutExportFormats::OBJ:
|
||||||
exporter.ExportToOBJ(sheet->SceneData()->Scene());
|
exporter.ExportToOBJ(sheet->SceneData()->Scene().data());
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::PS:
|
case LayoutExportFormats::PS:
|
||||||
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
|
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
|
||||||
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
exporter.ExportToPS(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
|
exporter.ExportToPS(sheet->SceneData()->Scene().data(), sheet->SceneData()->GraphicsPiecesAsItems());
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::EPS:
|
case LayoutExportFormats::EPS:
|
||||||
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
|
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
|
||||||
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
exporter.ExportToEPS(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
|
exporter.ExportToEPS(sheet->SceneData()->Scene().data(), sheet->SceneData()->GraphicsPiecesAsItems());
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1006_Flat:
|
case LayoutExportFormats::DXF_AC1006_Flat:
|
||||||
exporter.SetDxfVersion(DRW::AC1006);
|
exporter.SetDxfVersion(DRW::AC1006);
|
||||||
exporter.ExportToFlatDXF(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
|
exporter.ExportToFlatDXF(sheet->SceneData()->Scene().data(),
|
||||||
|
sheet->SceneData()->GraphicsPiecesAsItems());
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1009_Flat:
|
case LayoutExportFormats::DXF_AC1009_Flat:
|
||||||
exporter.SetDxfVersion(DRW::AC1009);
|
exporter.SetDxfVersion(DRW::AC1009);
|
||||||
exporter.ExportToFlatDXF(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
|
exporter.ExportToFlatDXF(sheet->SceneData()->Scene().data(),
|
||||||
|
sheet->SceneData()->GraphicsPiecesAsItems());
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1012_Flat:
|
case LayoutExportFormats::DXF_AC1012_Flat:
|
||||||
exporter.SetDxfVersion(DRW::AC1012);
|
exporter.SetDxfVersion(DRW::AC1012);
|
||||||
exporter.ExportToFlatDXF(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
|
exporter.ExportToFlatDXF(sheet->SceneData()->Scene().data(),
|
||||||
|
sheet->SceneData()->GraphicsPiecesAsItems());
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1014_Flat:
|
case LayoutExportFormats::DXF_AC1014_Flat:
|
||||||
exporter.SetDxfVersion(DRW::AC1014);
|
exporter.SetDxfVersion(DRW::AC1014);
|
||||||
exporter.ExportToFlatDXF(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
|
exporter.ExportToFlatDXF(sheet->SceneData()->Scene().data(),
|
||||||
|
sheet->SceneData()->GraphicsPiecesAsItems());
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1015_Flat:
|
case LayoutExportFormats::DXF_AC1015_Flat:
|
||||||
exporter.SetDxfVersion(DRW::AC1015);
|
exporter.SetDxfVersion(DRW::AC1015);
|
||||||
exporter.ExportToFlatDXF(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
|
exporter.ExportToFlatDXF(sheet->SceneData()->Scene().data(),
|
||||||
|
sheet->SceneData()->GraphicsPiecesAsItems());
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1018_Flat:
|
case LayoutExportFormats::DXF_AC1018_Flat:
|
||||||
exporter.SetDxfVersion(DRW::AC1018);
|
exporter.SetDxfVersion(DRW::AC1018);
|
||||||
exporter.ExportToFlatDXF(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
|
exporter.ExportToFlatDXF(sheet->SceneData()->Scene().data(),
|
||||||
|
sheet->SceneData()->GraphicsPiecesAsItems());
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1021_Flat:
|
case LayoutExportFormats::DXF_AC1021_Flat:
|
||||||
exporter.SetDxfVersion(DRW::AC1021);
|
exporter.SetDxfVersion(DRW::AC1021);
|
||||||
exporter.ExportToFlatDXF(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
|
exporter.ExportToFlatDXF(sheet->SceneData()->Scene().data(),
|
||||||
|
sheet->SceneData()->GraphicsPiecesAsItems());
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1024_Flat:
|
case LayoutExportFormats::DXF_AC1024_Flat:
|
||||||
exporter.SetDxfVersion(DRW::AC1024);
|
exporter.SetDxfVersion(DRW::AC1024);
|
||||||
exporter.ExportToFlatDXF(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
|
exporter.ExportToFlatDXF(sheet->SceneData()->Scene().data(),
|
||||||
|
sheet->SceneData()->GraphicsPiecesAsItems());
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1027_Flat:
|
case LayoutExportFormats::DXF_AC1027_Flat:
|
||||||
exporter.SetDxfVersion(DRW::AC1027);
|
exporter.SetDxfVersion(DRW::AC1027);
|
||||||
exporter.ExportToFlatDXF(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
|
exporter.ExportToFlatDXF(sheet->SceneData()->Scene().data(),
|
||||||
|
sheet->SceneData()->GraphicsPiecesAsItems());
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::TIF:
|
case LayoutExportFormats::TIF:
|
||||||
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
|
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
|
||||||
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
exporter.ExportToTIF(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
|
exporter.ExportToTIF(sheet->SceneData()->Scene().data(), sheet->SceneData()->GraphicsPiecesAsItems());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qDebug() << "Can't recognize file type." << Q_FUNC_INFO;
|
qDebug() << "Can't recognize file type." << Q_FUNC_INFO;
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "../vlayout/dialogs/vabstractlayoutdialog.h"
|
#include "../vlayout/dialogs/vabstractlayoutdialog.h"
|
||||||
#include "../vlayout/vlayoutpiece.h"
|
#include "../vlayout/vlayoutpiece.h"
|
||||||
|
@ -302,9 +303,9 @@ private slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY_MOVE(VPMainWindow) // NOLINT
|
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};
|
VPMainGraphicsView *m_graphicsView{nullptr};
|
||||||
|
|
||||||
VPCommandLinePtr m_cmd;
|
VPCommandLinePtr m_cmd;
|
||||||
|
|
|
@ -44,7 +44,6 @@
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
TapePreferencesConfigurationPage::TapePreferencesConfigurationPage(QWidget *parent)
|
TapePreferencesConfigurationPage::TapePreferencesConfigurationPage(QWidget *parent)
|
||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
ui(new Ui::TapePreferencesConfigurationPage),
|
|
||||||
m_langChanged(false),
|
m_langChanged(false),
|
||||||
m_systemChanged(false)
|
m_systemChanged(false)
|
||||||
{
|
{
|
||||||
|
@ -118,10 +117,7 @@ TapePreferencesConfigurationPage::TapePreferencesConfigurationPage(QWidget *pare
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
TapePreferencesConfigurationPage::~TapePreferencesConfigurationPage()
|
TapePreferencesConfigurationPage::~TapePreferencesConfigurationPage() = default;
|
||||||
{
|
|
||||||
delete ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto TapePreferencesConfigurationPage::Apply() -> QStringList
|
auto TapePreferencesConfigurationPage::Apply() -> QStringList
|
||||||
|
@ -338,7 +334,7 @@ void TapePreferencesConfigurationPage::RetranslateShortcutsTable()
|
||||||
void TapePreferencesConfigurationPage::InitKnownMeasurements(QComboBox *combo)
|
void TapePreferencesConfigurationPage::InitKnownMeasurements(QComboBox *combo)
|
||||||
{
|
{
|
||||||
VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase();
|
VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase();
|
||||||
QHash<QUuid, VKnownMeasurementsHeader> known = db->AllKnownMeasurements();
|
QHash<QUuid, VKnownMeasurementsHeader> const known = db->AllKnownMeasurements();
|
||||||
|
|
||||||
combo->blockSignals(true);
|
combo->blockSignals(true);
|
||||||
combo->clear();
|
combo->clear();
|
||||||
|
@ -369,10 +365,10 @@ void TapePreferencesConfigurationPage::InitKnownMeasurements(QComboBox *combo)
|
||||||
void TapePreferencesConfigurationPage::InitKnownMeasurementsDescription()
|
void TapePreferencesConfigurationPage::InitKnownMeasurementsDescription()
|
||||||
{
|
{
|
||||||
VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase();
|
VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase();
|
||||||
QHash<QUuid, VKnownMeasurementsHeader> known = db->AllKnownMeasurements();
|
QHash<QUuid, VKnownMeasurementsHeader> const known = db->AllKnownMeasurements();
|
||||||
|
|
||||||
ui->knownMeasurementsDescription->clear();
|
ui->knownMeasurementsDescription->clear();
|
||||||
QUuid id = ui->comboBoxKnownMeasurements->currentData().toUuid();
|
QUuid const id = ui->comboBoxKnownMeasurements->currentData().toUuid();
|
||||||
if (!id.isNull() && known.contains(id))
|
if (!id.isNull() && known.contains(id))
|
||||||
{
|
{
|
||||||
ui->knownMeasurementsDescription->setPlainText(known.value(id).description);
|
ui->knownMeasurementsDescription->setPlainText(known.value(id).description);
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#define TAPEPREFERENCESCONFIGURATIONPAGE_H
|
#define TAPEPREFERENCESCONFIGURATIONPAGE_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
class QComboBox;
|
class QComboBox;
|
||||||
|
|
||||||
|
@ -57,7 +58,7 @@ private slots:
|
||||||
private:
|
private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(TapePreferencesConfigurationPage) // NOLINT
|
Q_DISABLE_COPY_MOVE(TapePreferencesConfigurationPage) // NOLINT
|
||||||
Ui::TapePreferencesConfigurationPage *ui;
|
std::unique_ptr<Ui::TapePreferencesConfigurationPage> ui{};
|
||||||
bool m_langChanged;
|
bool m_langChanged;
|
||||||
bool m_systemChanged;
|
bool m_systemChanged;
|
||||||
QList<QStringList> m_transientShortcuts{};
|
QList<QStringList> m_transientShortcuts{};
|
||||||
|
|
|
@ -32,8 +32,7 @@
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
TapePreferencesPathPage::TapePreferencesPathPage(QWidget *parent)
|
TapePreferencesPathPage::TapePreferencesPathPage(QWidget *parent)
|
||||||
: QWidget(parent),
|
: QWidget(parent)
|
||||||
ui(new Ui::TapePreferencesPathPage)
|
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
@ -54,10 +53,7 @@ TapePreferencesPathPage::TapePreferencesPathPage(QWidget *parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
TapePreferencesPathPage::~TapePreferencesPathPage()
|
TapePreferencesPathPage::~TapePreferencesPathPage() = default;
|
||||||
{
|
|
||||||
delete ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto TapePreferencesPathPage::Apply() -> QStringList
|
auto TapePreferencesPathPage::Apply() -> QStringList
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#define TAPEPREFERENCESPATHPAGE_H
|
#define TAPEPREFERENCESPATHPAGE_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
|
@ -55,7 +56,7 @@ private slots:
|
||||||
private:
|
private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(TapePreferencesPathPage) // NOLINT
|
Q_DISABLE_COPY_MOVE(TapePreferencesPathPage) // NOLINT
|
||||||
Ui::TapePreferencesPathPage *ui;
|
std::unique_ptr<Ui::TapePreferencesPathPage> ui{};
|
||||||
|
|
||||||
void InitTable();
|
void InitTable();
|
||||||
};
|
};
|
||||||
|
|
|
@ -47,7 +47,6 @@
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogAboutTape::DialogAboutTape(QWidget *parent)
|
DialogAboutTape::DialogAboutTape(QWidget *parent)
|
||||||
: QDialog(parent),
|
: QDialog(parent),
|
||||||
ui(new Ui::DialogAboutTape),
|
|
||||||
m_isInitialized(false)
|
m_isInitialized(false)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
@ -80,10 +79,7 @@ DialogAboutTape::DialogAboutTape(QWidget *parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogAboutTape::~DialogAboutTape()
|
DialogAboutTape::~DialogAboutTape() = default;
|
||||||
{
|
|
||||||
delete ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogAboutTape::changeEvent(QEvent *event)
|
void DialogAboutTape::changeEvent(QEvent *event)
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#define DIALOGABOUTTAPE_H
|
#define DIALOGABOUTTAPE_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
|
@ -51,7 +52,7 @@ protected:
|
||||||
private:
|
private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(DialogAboutTape) // NOLINT
|
Q_DISABLE_COPY_MOVE(DialogAboutTape) // NOLINT
|
||||||
Ui::DialogAboutTape *ui;
|
std::unique_ptr<Ui::DialogAboutTape> ui{};
|
||||||
bool m_isInitialized;
|
bool m_isInitialized;
|
||||||
|
|
||||||
static void FontPointSize(QWidget *w, int pointSize);
|
static void FontPointSize(QWidget *w, int pointSize);
|
||||||
|
|
|
@ -30,9 +30,8 @@
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogDimensionCustomNames::DialogDimensionCustomNames(
|
DialogDimensionCustomNames::DialogDimensionCustomNames(
|
||||||
const QMap<MeasurementDimension, MeasurementDimension_p> &dimensions, QWidget *parent) :
|
const QMap<MeasurementDimension, MeasurementDimension_p> &dimensions, QWidget *parent)
|
||||||
QDialog(parent),
|
: QDialog(parent)
|
||||||
ui(new Ui::DialogDimensionCustomNames)
|
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
@ -40,10 +39,7 @@ DialogDimensionCustomNames::DialogDimensionCustomNames(
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogDimensionCustomNames::~DialogDimensionCustomNames()
|
DialogDimensionCustomNames::~DialogDimensionCustomNames() = default;
|
||||||
{
|
|
||||||
delete ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto DialogDimensionCustomNames::CustomNames() const -> QMap<MeasurementDimension, QString>
|
auto DialogDimensionCustomNames::CustomNames() const -> QMap<MeasurementDimension, QString>
|
||||||
|
@ -76,8 +72,8 @@ void DialogDimensionCustomNames::InitTable(const QMap<MeasurementDimension, Meas
|
||||||
while (i != dimensions.constEnd())
|
while (i != dimensions.constEnd())
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
QString name = QStringLiteral("%1 (%2)")
|
QString name = QStringLiteral("%1 (%2)").arg(VAbstartMeasurementDimension::DimensionName(i.value()->Type()),
|
||||||
.arg(VAbstartMeasurementDimension::DimensionName(i.value()->Type()), i.value()->Axis());
|
i.value()->Axis());
|
||||||
auto *itemValue = new QTableWidgetItem(name);
|
auto *itemValue = new QTableWidgetItem(name);
|
||||||
itemValue->setTextAlignment(Qt::AlignHCenter | Qt::AlignCenter);
|
itemValue->setTextAlignment(Qt::AlignHCenter | Qt::AlignCenter);
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#define DIALOGDIMENSIONCUSTOMNAMES_H
|
#define DIALOGDIMENSIONCUSTOMNAMES_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "../vformat/vdimensions.h"
|
#include "../vformat/vdimensions.h"
|
||||||
|
|
||||||
|
@ -51,7 +52,7 @@ public:
|
||||||
private:
|
private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(DialogDimensionCustomNames) // NOLINT
|
Q_DISABLE_COPY_MOVE(DialogDimensionCustomNames) // NOLINT
|
||||||
Ui::DialogDimensionCustomNames *ui;
|
std::unique_ptr<Ui::DialogDimensionCustomNames> ui{};
|
||||||
|
|
||||||
void InitTable(const QMap<MeasurementDimension, MeasurementDimension_p> &dimensions);
|
void InitTable(const QMap<MeasurementDimension, MeasurementDimension_p> &dimensions);
|
||||||
};
|
};
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
DialogDimensionLabels::DialogDimensionLabels(const QMap<MeasurementDimension, MeasurementDimension_p> &dimensions,
|
DialogDimensionLabels::DialogDimensionLabels(const QMap<MeasurementDimension, MeasurementDimension_p> &dimensions,
|
||||||
bool fullCircumference, QWidget *parent)
|
bool fullCircumference, QWidget *parent)
|
||||||
: QDialog(parent),
|
: QDialog(parent),
|
||||||
ui(new Ui::DialogDimensionLabels),
|
|
||||||
m_dimensions(dimensions),
|
m_dimensions(dimensions),
|
||||||
m_fullCircumference(fullCircumference)
|
m_fullCircumference(fullCircumference)
|
||||||
{
|
{
|
||||||
|
@ -49,10 +48,7 @@ DialogDimensionLabels::DialogDimensionLabels(const QMap<MeasurementDimension, Me
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogDimensionLabels::~DialogDimensionLabels()
|
DialogDimensionLabels::~DialogDimensionLabels() = default;
|
||||||
{
|
|
||||||
delete ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogDimensionLabels::changeEvent(QEvent *event)
|
void DialogDimensionLabels::changeEvent(QEvent *event)
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "../vformat/vdimensions.h"
|
#include "../vformat/vdimensions.h"
|
||||||
|
|
||||||
|
@ -45,14 +46,14 @@ class DialogDimensionLabels : public QDialog
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DialogDimensionLabels(const QMap<MeasurementDimension, MeasurementDimension_p > &dimensions,
|
explicit DialogDimensionLabels(const QMap<MeasurementDimension, MeasurementDimension_p> &dimensions,
|
||||||
bool fullCircumference, QWidget *parent = nullptr);
|
bool fullCircumference, QWidget *parent = nullptr);
|
||||||
~DialogDimensionLabels() override;
|
~DialogDimensionLabels() override;
|
||||||
|
|
||||||
auto Labels() const -> QMap<MeasurementDimension, DimesionLabels>;
|
auto Labels() const -> QMap<MeasurementDimension, DimesionLabels>;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void changeEvent(QEvent* event) override;
|
void changeEvent(QEvent *event) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void DimensionChanged();
|
void DimensionChanged();
|
||||||
|
@ -61,9 +62,9 @@ private slots:
|
||||||
private:
|
private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(DialogDimensionLabels) // NOLINT
|
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{};
|
QMap<MeasurementDimension, DimesionLabels> m_labels{};
|
||||||
bool m_fullCircumference;
|
bool m_fullCircumference;
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@ using VTextCodec = QTextCodec;
|
||||||
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QShowEvent>
|
#include <QShowEvent>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
|
||||||
#include "../vmisc/compatibility.h"
|
#include "../vmisc/compatibility.h"
|
||||||
|
@ -48,19 +49,15 @@ using VTextCodec = QTextCodec;
|
||||||
using namespace Qt::Literals::StringLiterals;
|
using namespace Qt::Literals::StringLiterals;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogKnownMeasurementsCSVColumns::DialogKnownMeasurementsCSVColumns(const QString &filename, QWidget *parent)
|
DialogKnownMeasurementsCSVColumns::DialogKnownMeasurementsCSVColumns(QString filename, QWidget *parent)
|
||||||
: QDialog(parent),
|
: QDialog(parent),
|
||||||
ui(new Ui::DialogKnownMeasurementsCSVColumns),
|
m_fileName{std::move(filename)}
|
||||||
m_fileName{filename}
|
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogKnownMeasurementsCSVColumns::~DialogKnownMeasurementsCSVColumns()
|
DialogKnownMeasurementsCSVColumns::~DialogKnownMeasurementsCSVColumns() = default;
|
||||||
{
|
|
||||||
delete ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogKnownMeasurementsCSVColumns::changeEvent(QEvent *event)
|
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);
|
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);
|
const auto individualColumn = static_cast<KnownMeasurementsColumns>(column);
|
||||||
switch (individualColumn)
|
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);
|
return static_cast<int>(KnownMeasurementsColumns::LAST_DO_NOT_USE);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
int DialogKnownMeasurementsCSVColumns::MinimumColumns() const
|
auto DialogKnownMeasurementsCSVColumns::MinimumColumns() const -> int
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool DialogKnownMeasurementsCSVColumns::ColumnsValid()
|
auto DialogKnownMeasurementsCSVColumns::ColumnsValid() -> bool
|
||||||
{
|
{
|
||||||
ClearColumnCollor();
|
ClearColumnCollor();
|
||||||
|
|
||||||
|
@ -234,7 +231,7 @@ void DialogKnownMeasurementsCSVColumns::ClearColumnCollor()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogKnownMeasurementsCSVColumns::InitColumnsMap()
|
void DialogKnownMeasurementsCSVColumns::InitColumnsMap()
|
||||||
{
|
{
|
||||||
QSharedPointer<QxtCsvModel> csv = DialogKnownMeasurementsCSVColumns::CSVModel();
|
QSharedPointer<QxtCsvModel> const csv = DialogKnownMeasurementsCSVColumns::CSVModel();
|
||||||
m_columnsMap.clear();
|
m_columnsMap.clear();
|
||||||
|
|
||||||
auto InitColumn = [this, csv](int column, int &index)
|
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);
|
return QSharedPointer<QxtCsvModel>::create(m_fileName, nullptr, m_withHeader, m_separator, m_codec);
|
||||||
}
|
}
|
||||||
|
@ -359,7 +356,7 @@ void DialogKnownMeasurementsCSVColumns::ShowInputPreview()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSharedPointer<QxtCsvModel> csv = DialogKnownMeasurementsCSVColumns::CSVModel();
|
QSharedPointer<QxtCsvModel> const csv = DialogKnownMeasurementsCSVColumns::CSVModel();
|
||||||
|
|
||||||
const int columns = csv->columnCount();
|
const int columns = csv->columnCount();
|
||||||
const int rows = csv->rowCount();
|
const int rows = csv->rowCount();
|
||||||
|
@ -408,7 +405,7 @@ void DialogKnownMeasurementsCSVColumns::ShowImportPreview()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSharedPointer<QxtCsvModel> csv = DialogKnownMeasurementsCSVColumns::CSVModel();
|
QSharedPointer<QxtCsvModel> const csv = DialogKnownMeasurementsCSVColumns::CSVModel();
|
||||||
|
|
||||||
const int importColumns = ImportColumnCount();
|
const int importColumns = ImportColumnCount();
|
||||||
const int columns = csv->columnCount();
|
const int columns = csv->columnCount();
|
||||||
|
@ -455,7 +452,7 @@ void DialogKnownMeasurementsCSVColumns::SetDefaultColumns()
|
||||||
{
|
{
|
||||||
SCASSERT(control != nullptr)
|
SCASSERT(control != nullptr)
|
||||||
|
|
||||||
int index = control->findData(m_columnsMap.at(column));
|
int const index = control->findData(m_columnsMap.at(column));
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
control->setCurrentIndex(index);
|
control->setCurrentIndex(index);
|
||||||
|
@ -488,7 +485,7 @@ void DialogKnownMeasurementsCSVColumns::CheckStatus()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSharedPointer<QxtCsvModel> csv = DialogKnownMeasurementsCSVColumns::CSVModel();
|
QSharedPointer<QxtCsvModel> const csv = DialogKnownMeasurementsCSVColumns::CSVModel();
|
||||||
|
|
||||||
const int columns = csv->columnCount();
|
const int columns = csv->columnCount();
|
||||||
if (columns < MinimumColumns())
|
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);
|
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))
|
if (value == -1 && not ColumnMandatory(columnNumber))
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#define DIALOGKNOWNMEASUREMENTSCSVCOLUMNS_H
|
#define DIALOGKNOWNMEASUREMENTSCSVCOLUMNS_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
class QxtCsvModel;
|
class QxtCsvModel;
|
||||||
class QComboBox;
|
class QComboBox;
|
||||||
|
@ -60,7 +61,7 @@ class DialogKnownMeasurementsCSVColumns : public QDialog
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DialogKnownMeasurementsCSVColumns(const QString &filename, QWidget *parent = nullptr);
|
explicit DialogKnownMeasurementsCSVColumns(QString filename, QWidget *parent = nullptr);
|
||||||
~DialogKnownMeasurementsCSVColumns() override;
|
~DialogKnownMeasurementsCSVColumns() override;
|
||||||
|
|
||||||
auto ColumnsMap() const -> QVector<int>;
|
auto ColumnsMap() const -> QVector<int>;
|
||||||
|
@ -79,7 +80,7 @@ private slots:
|
||||||
private:
|
private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(DialogKnownMeasurementsCSVColumns) // NOLINT
|
Q_DISABLE_COPY_MOVE(DialogKnownMeasurementsCSVColumns) // NOLINT
|
||||||
Ui::DialogKnownMeasurementsCSVColumns *ui;
|
std::unique_ptr<Ui::DialogKnownMeasurementsCSVColumns> ui{};
|
||||||
bool m_isInitialized{false};
|
bool m_isInitialized{false};
|
||||||
QString m_fileName;
|
QString m_fileName;
|
||||||
bool m_withHeader{false};
|
bool m_withHeader{false};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user