Refactoring.
This commit is contained in:
parent
a4e2e1f1bf
commit
54ee9e0629
|
@ -43,6 +43,7 @@
|
||||||
#include <QtMath>
|
#include <QtMath>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "../ifc/exception/vexception.h"
|
#include "../ifc/exception/vexception.h"
|
||||||
#include "../ifc/xml/vlayoutconverter.h"
|
#include "../ifc/xml/vlayoutconverter.h"
|
||||||
|
@ -323,10 +324,10 @@ struct VPExportData
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPMainWindow::VPMainWindow(const VPCommandLinePtr &cmd, QWidget *parent)
|
VPMainWindow::VPMainWindow(VPCommandLinePtr cmd, QWidget *parent)
|
||||||
: VAbstractMainWindow(parent),
|
: VAbstractMainWindow(parent),
|
||||||
ui(std::make_unique<Ui::VPMainWindow>()),
|
ui(std::make_unique<Ui::VPMainWindow>()),
|
||||||
m_cmd(cmd),
|
m_cmd(std::move(cmd)),
|
||||||
m_undoStack(new QUndoStack(this)),
|
m_undoStack(new QUndoStack(this)),
|
||||||
m_layout{VPLayout::CreateLayout(m_undoStack)},
|
m_layout{VPLayout::CreateLayout(m_undoStack)},
|
||||||
m_statusLabel(new QLabel(this)),
|
m_statusLabel(new QLabel(this)),
|
||||||
|
@ -770,10 +771,7 @@ void VPMainWindow::InitProperties()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPMainWindow::InitPropertyTabCurrentPiece()
|
void VPMainWindow::CurrentPieceShowSeamLineToggled(bool checked)
|
||||||
{
|
|
||||||
connect(ui->checkBoxCurrentPieceShowSeamline, &QCheckBox::toggled, this,
|
|
||||||
[this](bool checked)
|
|
||||||
{
|
{
|
||||||
QList<VPPiecePtr> const selectedPieces = SelectedPieces();
|
QList<VPPiecePtr> const selectedPieces = SelectedPieces();
|
||||||
if (selectedPieces.size() == 1)
|
if (selectedPieces.size() == 1)
|
||||||
|
@ -787,11 +785,12 @@ void VPMainWindow::InitPropertyTabCurrentPiece()
|
||||||
emit m_layout->PieceTransformationChanged(selectedPiece);
|
emit m_layout->PieceTransformationChanged(selectedPiece);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
connect(ui->checkBoxShowFullPiece, &QCheckBox::toggled, this,
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
[this](bool checked)
|
void VPMainWindow::ShowFullPieceToggled(bool checked)
|
||||||
{
|
{
|
||||||
|
|
||||||
QList<VPPiecePtr> const selectedPieces = SelectedPieces();
|
QList<VPPiecePtr> const selectedPieces = SelectedPieces();
|
||||||
if (selectedPieces.size() == 1)
|
if (selectedPieces.size() == 1)
|
||||||
{
|
{
|
||||||
|
@ -806,10 +805,10 @@ void VPMainWindow::InitPropertyTabCurrentPiece()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
connect(ui->checkBoxShowMirrorLine, &QCheckBox::toggled, this,
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
[this](bool checked)
|
void VPMainWindow::ShowMirrorLineToggled(bool checked)
|
||||||
{
|
{
|
||||||
QList<VPPiecePtr> const selectedPieces = SelectedPieces();
|
QList<VPPiecePtr> const selectedPieces = SelectedPieces();
|
||||||
if (selectedPieces.size() == 1)
|
if (selectedPieces.size() == 1)
|
||||||
|
@ -825,10 +824,10 @@ void VPMainWindow::InitPropertyTabCurrentPiece()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
connect(ui->checkBoxCurrentPieceVerticallyFlipped, &QCheckBox::toggled, this,
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
[this](bool checked)
|
void VPMainWindow::CurrentPieceVerticallyFlippedToggled(bool checked)
|
||||||
{
|
{
|
||||||
QList<VPPiecePtr> const selectedPieces = SelectedPieces();
|
QList<VPPiecePtr> const selectedPieces = SelectedPieces();
|
||||||
if (selectedPieces.size() == 1)
|
if (selectedPieces.size() == 1)
|
||||||
|
@ -844,10 +843,10 @@ void VPMainWindow::InitPropertyTabCurrentPiece()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
connect(ui->checkBoxCurrentPieceHorizontallyFlipped, &QCheckBox::toggled, this,
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
[this](bool checked)
|
void VPMainWindow::CurrentPieceHorizontallyFlippedToggled(bool checked)
|
||||||
{
|
{
|
||||||
QList<VPPiecePtr> const selectedPieces = SelectedPieces();
|
QList<VPPiecePtr> const selectedPieces = SelectedPieces();
|
||||||
if (selectedPieces.size() == 1)
|
if (selectedPieces.size() == 1)
|
||||||
|
@ -863,7 +862,19 @@ void VPMainWindow::InitPropertyTabCurrentPiece()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPMainWindow::InitPropertyTabCurrentPiece()
|
||||||
|
{
|
||||||
|
connect(ui->checkBoxCurrentPieceShowSeamline, &QCheckBox::toggled, this,
|
||||||
|
&VPMainWindow::CurrentPieceShowSeamLineToggled);
|
||||||
|
connect(ui->checkBoxShowFullPiece, &QCheckBox::toggled, this, &VPMainWindow::ShowFullPieceToggled);
|
||||||
|
connect(ui->checkBoxShowMirrorLine, &QCheckBox::toggled, this, &VPMainWindow::ShowMirrorLineToggled);
|
||||||
|
connect(ui->checkBoxCurrentPieceVerticallyFlipped, &QCheckBox::toggled, this,
|
||||||
|
&VPMainWindow::CurrentPieceVerticallyFlippedToggled);
|
||||||
|
connect(ui->checkBoxCurrentPieceHorizontallyFlipped, &QCheckBox::toggled, this,
|
||||||
|
&VPMainWindow::CurrentPieceHorizontallyFlippedToggled);
|
||||||
|
|
||||||
// Translate
|
// Translate
|
||||||
ui->comboBoxTranslateUnit->addItem(tr("Millimiters"), QVariant(UnitsToStr(Unit::Mm)));
|
ui->comboBoxTranslateUnit->addItem(tr("Millimiters"), QVariant(UnitsToStr(Unit::Mm)));
|
||||||
|
@ -2174,6 +2185,7 @@ void VPMainWindow::FindTemplate(QComboBox *box, qreal width, qreal height)
|
||||||
const QSizeF tmplSize =
|
const QSizeF tmplSize =
|
||||||
VAbstractLayoutDialog::GetTemplateSize(static_cast<VAbstractLayoutDialog::PaperSizeTemplate>(i), paperUnit);
|
VAbstractLayoutDialog::GetTemplateSize(static_cast<VAbstractLayoutDialog::PaperSizeTemplate>(i), paperUnit);
|
||||||
if (VAbstractLayoutDialog::RoundTemplateSize(width, height, paperUnit) == tmplSize ||
|
if (VAbstractLayoutDialog::RoundTemplateSize(width, height, paperUnit) == tmplSize ||
|
||||||
|
// NOLINTNEXTLINE(readability-suspicious-call-argument)
|
||||||
VAbstractLayoutDialog::RoundTemplateSize(height, width, paperUnit) == tmplSize)
|
VAbstractLayoutDialog::RoundTemplateSize(height, width, paperUnit) == tmplSize)
|
||||||
{
|
{
|
||||||
box->blockSignals(true);
|
box->blockSignals(true);
|
||||||
|
|
|
@ -61,7 +61,7 @@ class VPMainWindow : public VAbstractMainWindow
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit VPMainWindow(const VPCommandLinePtr &cmd, QWidget *parent = nullptr);
|
explicit VPMainWindow(VPCommandLinePtr cmd, QWidget *parent = nullptr);
|
||||||
~VPMainWindow() override;
|
~VPMainWindow() override;
|
||||||
|
|
||||||
auto CurrentFile() const -> QString;
|
auto CurrentFile() const -> QString;
|
||||||
|
@ -300,6 +300,11 @@ private slots:
|
||||||
void UpdateShortcuts();
|
void UpdateShortcuts();
|
||||||
|
|
||||||
void TogetherWithNotchesChanged(bool checked);
|
void TogetherWithNotchesChanged(bool checked);
|
||||||
|
void CurrentPieceShowSeamLineToggled(bool checked);
|
||||||
|
void ShowFullPieceToggled(bool checked);
|
||||||
|
void ShowMirrorLineToggled(bool checked);
|
||||||
|
void CurrentPieceVerticallyFlippedToggled(bool checked);
|
||||||
|
void CurrentPieceHorizontallyFlippedToggled(bool checked);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY_MOVE(VPMainWindow) // NOLINT
|
Q_DISABLE_COPY_MOVE(VPMainWindow) // NOLINT
|
||||||
|
|
Loading…
Reference in New Issue
Block a user