From 62ff405cc0dea36fafa8ebe46986edf1dc2af600 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 3 Feb 2022 17:05:52 +0200 Subject: [PATCH] Added scroll area to layout settings dialog. --- ChangeLog.txt | 1 + .../dialogs/dialoglayoutsettings.cpp | 22 +- .../valentina/dialogs/dialoglayoutsettings.h | 3 +- .../valentina/dialogs/dialoglayoutsettings.ui | 1040 +++++++++-------- src/libs/vmisc/vcommonsettings.cpp | 13 + src/libs/vmisc/vcommonsettings.h | 3 + 6 files changed, 570 insertions(+), 512 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 869b36166..7ed74c780 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -30,6 +30,7 @@ - [smart-pattern/valentina#43] Background image. - Fix alias for tool Cut Arc. - Fix infinite loop in tool cut spline. +- Added scroll area to layout settings dialog. # Valentina 0.7.49 July 1, 2021 - Fix crash. diff --git a/src/app/valentina/dialogs/dialoglayoutsettings.cpp b/src/app/valentina/dialogs/dialoglayoutsettings.cpp index 9155d0201..5431368b7 100644 --- a/src/app/valentina/dialogs/dialoglayoutsettings.cpp +++ b/src/app/valentina/dialogs/dialoglayoutsettings.cpp @@ -516,7 +516,7 @@ QString DialogLayoutSettings::MakeGroupsHelp() //--------------------------------------------------------------------------------------------------------------------- void DialogLayoutSettings::showEvent(QShowEvent *event) { - QDialog::showEvent( event ); + VAbstractLayoutDialog::showEvent( event ); if ( event->spontaneous() ) { return; @@ -528,12 +528,28 @@ void DialogLayoutSettings::showEvent(QShowEvent *event) } // do your init stuff here - setMaximumSize(size()); - setMinimumSize(size()); + const QSize sz = VAbstractApplication::VApp()->Settings()->GetLayoutSettingsDialogSize(); + if (not sz.isEmpty()) + { + resize(sz); + } isInitialized = true;//first show windows are held } +//--------------------------------------------------------------------------------------------------------------------- +void DialogLayoutSettings::resizeEvent(QResizeEvent *event) +{ + // remember the size for the next time this dialog is opened, but only + // if widget was already initialized, which rules out the resize at + // dialog creating, which would + if (isInitialized) + { + VAbstractApplication::VApp()->Settings()->SetLayoutSettingsDialogSize(size()); + } + VAbstractLayoutDialog::resizeEvent(event); +} + //--------------------------------------------------------------------------------------------------------------------- void DialogLayoutSettings::ConvertLayoutSize() { diff --git a/src/app/valentina/dialogs/dialoglayoutsettings.h b/src/app/valentina/dialogs/dialoglayoutsettings.h index 69bfc50f1..ede8a90fd 100644 --- a/src/app/valentina/dialogs/dialoglayoutsettings.h +++ b/src/app/valentina/dialogs/dialoglayoutsettings.h @@ -120,7 +120,8 @@ public: qreal PageToPixels(qreal value) const; static QString MakeGroupsHelp(); protected: - virtual void showEvent(QShowEvent *event) override; + void showEvent(QShowEvent *event) override; + void resizeEvent(QResizeEvent *event) override; QSizeF GetTemplateSize(const PaperSizeTemplate &tmpl, const Unit &unit) const; public slots: diff --git a/src/app/valentina/dialogs/dialoglayoutsettings.ui b/src/app/valentina/dialogs/dialoglayoutsettings.ui index 652383c73..2585c33b4 100644 --- a/src/app/valentina/dialogs/dialoglayoutsettings.ui +++ b/src/app/valentina/dialogs/dialoglayoutsettings.ui @@ -6,8 +6,8 @@ 0 0 - 601 - 664 + 772 + 701 @@ -17,194 +17,299 @@ :/icon/64x64/icon64x64.png:/icon/64x64/icon64x64.png - + - - - + + + true + + + + + 0 + 0 + 752 + 650 + + + - - - false - - - Paper format - - - false - - - false - - - false - - - - - - 6 - + + + + + false + + + Paper format + + + false + + + false + + + false + + - - - - 0 - 0 - + + + 6 - - Templates: + + + + + 0 + 0 + + + + Templates: + + + + + + + + + + + + Qt::Horizontal - - - - - - - - Qt::Horizontal - - - - - - - - - + + + + + + + ... + + + + :/icon/16x16/portrait.png:/icon/16x16/portrait.png + + + true + + + true + + + true + + + buttonGroup + + + + + + + ... + + + + :/icon/16x16/landscape.png:/icon/16x16/landscape.png + + + true + + + false + + + true + + + buttonGroup + + + + + + + + + + 0 + 0 + + - ... + Width: - - - :/icon/16x16/portrait.png:/icon/16x16/portrait.png - - - true - - - true - - - true - - - buttonGroup - - - + + + + + 0 + 0 + + - ... + Height: - - - :/icon/16x16/landscape.png:/icon/16x16/landscape.png + + + + + + + 0 + 0 + - - true + + + 124 + 0 + - - false + + + + + + + 94 + 0 + - - true + + 2 + + + 99999.000000000000000 + + + + + + + + 94 + 0 + + + + 2 + + + 99999.990000000005239 - - buttonGroup - - - - - - 0 - 0 - - - - Width: - - - + + + + + + + + + + 0 + 0 + + + + Printer: + + + + + + + + + + + + + 0 + 0 + + + + Margins + + + + QFormLayout::ExpandingFieldsGrow + - - - - 0 - 0 - - + - Height: - - - - - - - - 0 - 0 - - - - - 124 - 0 - + Left: - - - - 94 - 0 - - + - 2 - - - 99999.000000000000000 + 5 - - - - - 94 - 0 - + + + + Right: + + + + - 2 + 5 - - 99999.990000000005239 + + + + + + Top: + + + + + + + 5 + + + + + + + Bottom: + + + + + + + 5 - - - - - - + + - + 0 @@ -212,104 +317,10 @@ - Printer: + Ignore margins - - - - - - - - - - 0 - 0 - - - - Margins - - - - QFormLayout::ExpandingFieldsGrow - - - - - Left: - - - - - - - 5 - - - - - - - Right: - - - - - - - 5 - - - - - - - Top: - - - - - - - 5 - - - - - - - Bottom: - - - - - - - 5 - - - - - - - - - - - 0 - 0 - - - - Ignore margins - - - - - @@ -329,302 +340,315 @@ + + + + Qt::Vertical + + + + 20 + 40 + + + + - + Qt::Vertical - - - 20 - 40 - - - + - - - - - - Qt::Vertical - - - - - - - Layout options - - - - - - + + + + Layout options + + + + + + + + Time: + + + + + + + + + + Gap width: + + + + + + + Time given for the algorithm to find best layout. + + + min + + + 1 + + + 60 + + + + + + + + 94 + 0 + + + + ×2 + + + 0.000000000000000 + + + 99999.990000000005239 + + + 1.000000000000000 + + + + + + + Efficiency: + + + + + + + Set layout efficiency coefficient. Layout efficiency coefficientt is the ratio of the area occupied by the pieces to the bounding rect of all pieces. If nesting reaches required level the process stops. If value is 0 no check will be made. + + + % + + + 1 + + + 0.100000000000000 + + + + + + + - Time: + Save length of the sheet - - - - - - - Gap width: - - - - - + + - Time given for the algorithm to find best layout. + Enable this option to prefer getting one sheet solutions. - - min - - - 1 - - - 60 - - - - - - - - 94 - 0 - - - - ×2 - - - 0.000000000000000 - - - 99999.990000000005239 - - - 1.000000000000000 - - - - - - Efficiency: + Prefer one sheet solution - - - - Set layout efficiency coefficient. Layout efficiency coefficientt is the ratio of the area occupied by the pieces to the bounding rect of all pieces. If nesting reaches required level the process stops. If value is 0 no check will be made. - - - % - - - 1 - - - 0.100000000000000 + + + + Qt::Horizontal - - - - - - Save length of the sheet - - - - - - - Enable this option to prefer getting one sheet solutions. - - - Prefer one sheet solution - - - - - - - Qt::Horizontal - - - - - - - Follow grainline - - - - - - - Manual priority - - - - - - - Qt::Horizontal - - - - - - - Rule for choosing the next workpiece - - - - + + + + Follow grainline + + + + + + + Manual priority + + + + + + + Qt::Horizontal + + + + + + + Rule for choosing the next workpiece + + - + + + + + Three groups: big, middle, small + + + buttonGroupPrinciple + + + + + + + Two groups: big, small + + + false + + + buttonGroupPrinciple + + + + + + + Descending area + + + true + + + buttonGroupPrinciple + + + + + + + + + + + + Nest quantity of copies according to piece settings. + + + Nest quantity + + + + + + + Qt::Horizontal + + + + + + + Auto crop unused length + + + + + + + Auto crop unused width + + + + + + + Unite pages (if possible) + + + + + + + Qt::Horizontal + + + + + + + Enabling for sheets that have big height will speed up creating. + + + Divide into strips + + + true + + + false + + + + - Three groups: big, middle, small + Multiplier - - buttonGroupPrinciple - - - - Two groups: big, small + + + Set multiplier for length of the biggest workpiece in layout. - - false + + x - - buttonGroupPrinciple - - - - - - - Descending area + + 1 - - true + + 10 - - buttonGroupPrinciple - - - - - - - - - Nest quantity of copies according to piece settings. - - - Nest quantity - - - - - - - Qt::Horizontal - - - - - - - Auto crop unused length - - - - - - - Auto crop unused width - - - - - - - Unite pages (if possible) - - - - - - - Qt::Horizontal - - - - - - - Enabling for sheets that have big height will speed up creating. - - - Divide into strips - - - true - - - false - - - - - - Multiplier - - - - - - - Set multiplier for length of the biggest workpiece in layout. - - - x - - - 1 - - - 10 - - - - - - - - - - + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + diff --git a/src/libs/vmisc/vcommonsettings.cpp b/src/libs/vmisc/vcommonsettings.cpp index f7298a756..5c1b53ad9 100644 --- a/src/libs/vmisc/vcommonsettings.cpp +++ b/src/libs/vmisc/vcommonsettings.cpp @@ -121,6 +121,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingToolSeamAllowanceDialogSize, (QL Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingIncrementsDialogSize, (QLatin1String("toolIncrementsDialogSize"))) Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingFormulaWizardDialogSize, (QLatin1String("formulaWizardDialogSize"))) Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingFinalMeasurementsDialogSize, (QLatin1String("finalMeasurementsDialogSize"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSettingsDialogSize, (QLatin1String("layoutSettingsDialogSize"))) Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingAutomaticallyCheckUpdates, (QLatin1String("automaticallyCheckUpdates"))) Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLatestSkippedVersion, (QLatin1String("lastestSkippedVersion"))) Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDateOfLastRemind, (QLatin1String("dateOfLastRemind"))) @@ -822,6 +823,18 @@ void VCommonSettings::SetFinalMeasurementsDialogSize(const QSize &sz) setValue(*settingFinalMeasurementsDialogSize, sz); } +//--------------------------------------------------------------------------------------------------------------------- +auto VCommonSettings::GetLayoutSettingsDialogSize() const -> QSize +{ + return value(*settingLayoutSettingsDialogSize, QSize(0, 0)).toSize(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VCommonSettings::SetLayoutSettingsDialogSize(const QSize &sz) +{ + setValue(*settingLayoutSettingsDialogSize, sz); +} + //--------------------------------------------------------------------------------------------------------------------- bool VCommonSettings::IsAutomaticallyCheckUpdates() const { diff --git a/src/libs/vmisc/vcommonsettings.h b/src/libs/vmisc/vcommonsettings.h index d9853e589..4198c7435 100644 --- a/src/libs/vmisc/vcommonsettings.h +++ b/src/libs/vmisc/vcommonsettings.h @@ -157,6 +157,9 @@ public: QSize GetFinalMeasurementsDialogSize() const; void SetFinalMeasurementsDialogSize(const QSize& sz); + QSize GetLayoutSettingsDialogSize() const; + void SetLayoutSettingsDialogSize(const QSize& sz); + bool IsAutomaticallyCheckUpdates() const; void SetAutomaticallyCheckUpdates(bool value);