Skip to content

Commit

Permalink
more cleaning and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
DSCaskey authored and slspencer committed Dec 17, 2024
1 parent 7d12964 commit df7f689
Show file tree
Hide file tree
Showing 17 changed files with 1,263 additions and 906 deletions.
2 changes: 1 addition & 1 deletion src/app/seamly2d/core/vcmdexport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ VLayoutGeneratorPtr VCommandLine::DefaultGenerator() const

if (parser.isSet(*optionsUsed.value(optionsIndex.value(LONG_OPTION_GAPWIDTH))))
{
diag.SetLayoutWidth(Lo2Px(parser.value(*optionsUsed.value(optionsIndex.value(LONG_OPTION_GAPWIDTH))), diag));
diag.setLayoutGap(Lo2Px(parser.value(*optionsUsed.value(optionsIndex.value(LONG_OPTION_GAPWIDTH))), diag));
}

diag.SetAutoCrop(parser.isSet(*optionsUsed.value(optionsIndex.value(LONG_OPTION_CROP))));
Expand Down
28 changes: 14 additions & 14 deletions src/app/seamly2d/dialogs/layoutsettings_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,13 @@ void LayoutSettingsDialog::SetShift(qreal value)
}

//---------------------------------------------------------------------------------------------------------------------
qreal LayoutSettingsDialog::GetLayoutWidth() const
qreal LayoutSettingsDialog::getLayoutGap() const
{
return UnitConvertor(ui->doubleSpinBoxLayoutWidth->value(), oldLayoutUnit, Unit::Px);
}

//---------------------------------------------------------------------------------------------------------------------
void LayoutSettingsDialog::SetLayoutWidth(qreal value)
void LayoutSettingsDialog::setLayoutGap(qreal value)
{
ui->doubleSpinBoxLayoutWidth->setValue(UnitConvertor(value, Unit::Px, LayoutUnit()));
}
Expand Down Expand Up @@ -310,13 +310,13 @@ void LayoutSettingsDialog::SetUnitePages(bool save)
}

//---------------------------------------------------------------------------------------------------------------------
bool LayoutSettingsDialog::IsStripOptimization() const
bool LayoutSettingsDialog::useStripOptimization() const
{
return ui->groupBoxStrips->isChecked();
}

//---------------------------------------------------------------------------------------------------------------------
void LayoutSettingsDialog::SetStripOptimization(bool save)
void LayoutSettingsDialog::setStripOptimization(bool save)
{
ui->groupBoxStrips->setChecked(save);
}
Expand Down Expand Up @@ -578,8 +578,8 @@ void LayoutSettingsDialog::Swap(bool checked)
void LayoutSettingsDialog::DialogAccepted()
{
SCASSERT(generator != nullptr)
generator->SetLayoutWidth(GetLayoutWidth());
generator->SetCaseType(GetGroup());
generator->setLayoutGap(getLayoutGap());
generator->setCaseType(GetGroup());
generator->SetPaperHeight(GetPaperHeight());
generator->SetPaperWidth(GetPaperWidth());
generator->SetShift(static_cast<quint32>(qFloor(GetShift())));
Expand All @@ -588,9 +588,9 @@ void LayoutSettingsDialog::DialogAccepted()
generator->SetAutoCrop(GetAutoCrop());
generator->SetSaveLength(IsSaveLength());
generator->SetUnitePages(IsUnitePages());
generator->SetStripOptimization(IsStripOptimization());
generator->setStripOptimization(useStripOptimization());
generator->SetMultiplier(GetMultiplier());
generator->SetTestAsPaths(isTextAsPaths());
generator->setTextAsPaths(isTextAsPaths());

if (IsIgnoreAllFields())
{
Expand Down Expand Up @@ -671,7 +671,7 @@ void LayoutSettingsDialog::RestoreDefaults()
InitPrinter();
ui->comboBoxPrinter->blockSignals(false);

SetLayoutWidth(VSettings::GetDefLayoutWidth());
setLayoutGap(VSettings::getDefLayoutGap());
SetShift(VSettings::GetDefLayoutShift());
SetGroup(VSettings::GetDefLayoutGroup());
SetRotate(VSettings::GetDefLayoutRotate());
Expand Down Expand Up @@ -955,7 +955,7 @@ void LayoutSettingsDialog::MinimumLayoutSize()
void LayoutSettingsDialog::ReadSettings()
{
const VSettings *settings = qApp->Seamly2DSettings();
SetLayoutWidth(settings->GetLayoutWidth());
setLayoutGap(settings->getLayoutGap());
SetShift(settings->GetLayoutShift());

const qreal width = UnitConvertor(settings->GetLayoutPaperWidth(), Unit::Px, LayoutUnit());
Expand All @@ -969,7 +969,7 @@ void LayoutSettingsDialog::ReadSettings()
SetUnitePages(settings->GetLayoutUnitePages());
SetFields(settings->GetFields(GetDefPrinterFields()));
SetIgnoreAllFields(settings->GetIgnoreAllFields());
SetStripOptimization(settings->GetStripOptimization());
setStripOptimization(settings->useStripOptimization());
SetMultiplier(settings->GetMultiplier());
setTextAsPaths(settings->GetTextAsPaths());

Expand All @@ -983,7 +983,7 @@ void LayoutSettingsDialog::ReadSettings()
void LayoutSettingsDialog::WriteSettings() const
{
VSettings *settings = qApp->Seamly2DSettings();
settings->SetLayoutWidth(GetLayoutWidth());
settings->setLayoutGap(getLayoutGap());
settings->SetLayoutGroup(GetGroup());
settings->SetLayoutPaperHeight(GetPaperHeight());
settings->SetLayoutPaperWidth(GetPaperWidth());
Expand All @@ -995,7 +995,7 @@ void LayoutSettingsDialog::WriteSettings() const
settings->SetLayoutUnitePages(IsUnitePages());
settings->SetFields(GetFields());
settings->SetIgnoreAllFields(IsIgnoreAllFields());
settings->SetStripOptimization(IsStripOptimization());
settings->setStripOptimization(useStripOptimization());
settings->SetMultiplier(GetMultiplier());
settings->setTextAsPaths(isTextAsPaths());
}
Expand All @@ -1020,5 +1020,5 @@ void LayoutSettingsDialog::SetAdditionalOptions(bool value)
SetAutoCrop(value);
SetSaveLength(value);
SetUnitePages(value);
SetStripOptimization(value);
setStripOptimization(value);
}
8 changes: 4 additions & 4 deletions src/app/seamly2d/dialogs/layoutsettings_dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ class LayoutSettingsDialog : public AbstractLayoutDialog
qreal GetShift() const;
void SetShift(qreal value);

qreal GetLayoutWidth() const;
void SetLayoutWidth(qreal value);
qreal getLayoutGap() const;
void setLayoutGap(qreal value);

QMarginsF GetFields() const;
void SetFields(const QMarginsF &value);
Expand All @@ -104,8 +104,8 @@ class LayoutSettingsDialog : public AbstractLayoutDialog
bool IsUnitePages() const;
void SetUnitePages(bool save);

bool IsStripOptimization() const;
void SetStripOptimization(bool save);
bool useStripOptimization() const;
void setStripOptimization(bool save);

quint8 GetMultiplier() const;
void SetMultiplier(const quint8 &value);
Expand Down
2 changes: 1 addition & 1 deletion src/app/seamly2d/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7243,7 +7243,7 @@ void MainWindow::DoExport(const VCommandLinePtr &expParams)
else
{
auto settings = expParams->DefaultGenerator();
settings->SetTestAsPaths(expParams->isTextAsPaths());
settings->setTextAsPaths(expParams->isTextAsPaths());

if (LayoutSettings(*settings.get()))
{
Expand Down
11 changes: 6 additions & 5 deletions src/libs/vlayout/vbank.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,18 @@ VBank::VBank()
, small(QHash<int, qint64>())
, layoutWidth(0)
, caseType(Cases::CaseDesc)
, prepare(false), diagonal(0)
, prepare(false)
, diagonal(0)
{}

//---------------------------------------------------------------------------------------------------------------------
qreal VBank::GetLayoutWidth() const
qreal VBank::getLayoutGap() const
{
return layoutWidth;
}

//---------------------------------------------------------------------------------------------------------------------
void VBank::SetLayoutWidth(const qreal &value)
void VBank::setLayoutGap(const qreal &value)
{
layoutWidth = value;
Reset();
Expand Down Expand Up @@ -217,7 +218,7 @@ bool VBank::Prepare()
diagonal = 0;
for (int i=0; i < pieces.size(); ++i)
{
pieces[i].SetLayoutWidth(layoutWidth);
pieces[i].setLayoutGap(layoutWidth);
pieces[i].SetLayoutAllowancePoints();

const qreal d = pieces.at(i).Diagonal();
Expand Down Expand Up @@ -254,7 +255,7 @@ void VBank::Reset()
}

//---------------------------------------------------------------------------------------------------------------------
void VBank::SetCaseType(Cases caseType)
void VBank::setCaseType(Cases caseType)
{
this->caseType = caseType;
}
Expand Down
69 changes: 33 additions & 36 deletions src/libs/vlayout/vbank.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,52 +75,49 @@ class VBank
public:
VBank();

qreal GetLayoutWidth() const;
void SetLayoutWidth(const qreal &value);
qreal getLayoutGap() const;
void setLayoutGap(const qreal &value);

void setPieces(const QVector<VLayoutPiece> &pieces);
int GetTiket();
void setPieces(const QVector<VLayoutPiece> &pieces);
int GetTiket();
VLayoutPiece getPiece(int i) const;

void Arranged(int i);
void NotArranged(int i);
void Arranged(int i);
void NotArranged(int i);

bool Prepare();
void Reset();
void SetCaseType(Cases caseType);
bool Prepare();
void Reset();
void setCaseType(Cases caseType);

int allPieceCount() const;
int LeftArrange() const;
int ArrangedCount() const;
int allPieceCount() const;
int LeftArrange() const;
int ArrangedCount() const;

qreal GetBiggestDiagonal() const;
qreal GetBiggestDiagonal() const;

private:
Q_DISABLE_COPY(VBank)
QVector<VLayoutPiece> pieces;
QHash<int, qint64> unsorted;

QHash<int, qint64> big;
QHash<int, qint64> middle;
QHash<int, qint64> small;

qreal layoutWidth;

Cases caseType;
bool prepare;
qreal diagonal;

void PrepareGroup();

void PrepareThreeGroups();
void PrepareTwoGroups();
void PrepareDescGroup();

int GetNextThreeGroups() const;
int GetNextTwoGroups() const;
int GetNextDescGroup() const;

void SqMaxMin(qint64 &sMax, qint64 &sMin) const;
QHash<int, qint64> unsorted;
QHash<int, qint64> big;
QHash<int, qint64> middle;
QHash<int, qint64> small;
qreal layoutWidth;
Cases caseType;
bool prepare;
qreal diagonal;

void PrepareGroup();

void PrepareThreeGroups();
void PrepareTwoGroups();
void PrepareDescGroup();

int GetNextThreeGroups() const;
int GetNextTwoGroups() const;
int GetNextDescGroup() const;

void SqMaxMin(qint64 &sMax, qint64 &sMin) const;
};

#if defined (Q_OS_WIN) && defined (Q_CC_MSVC)
Expand Down
Loading

0 comments on commit df7f689

Please sign in to comment.