From 98b232930fdfe991b4be461d1569b5f38c94f4cf Mon Sep 17 00:00:00 2001 From: BojanKverh Date: Thu, 9 Jun 2016 13:16:04 +0200 Subject: [PATCH 1/6] Fixed issue #479. Improve feature: The Preferences dialog box should be expandable. --HG-- branch : feature --- src/app/valentina/dialogs/configdialog.cpp | 36 +++++++++++++++++++--- src/app/valentina/dialogs/configdialog.h | 8 +++++ 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/src/app/valentina/dialogs/configdialog.cpp b/src/app/valentina/dialogs/configdialog.cpp index bc88e25d0..8d41f0a59 100644 --- a/src/app/valentina/dialogs/configdialog.cpp +++ b/src/app/valentina/dialogs/configdialog.cpp @@ -87,14 +87,20 @@ ConfigDialog::ConfigDialog(QWidget *parent) : QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addLayout(horizontalLayout); - mainLayout->addStretch(1); - mainLayout->addSpacing(12); + //mainLayout->addStretch(1); + //mainLayout->addSpacing(12); mainLayout->addLayout(buttonsLayout); + mainLayout->setStretch(0, 1); setLayout(mainLayout); setWindowTitle(tr("Config Dialog")); qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C)); + + if (s_iLastWidth > 0 && s_iLastHeight > 0) + { + resize(s_iLastWidth, s_iLastHeight); + } } //--------------------------------------------------------------------------------------------------------------------- @@ -145,12 +151,29 @@ void ConfigDialog::showEvent(QShowEvent *event) } // do your init stuff here - setMaximumSize(size()); - setMinimumSize(size()); + //setMaximumSize(size()); + if (s_iMinWidth > 0 && s_iMinHeight > 0) + { + setMinimumSize(s_iMinWidth, s_iMinHeight); + } + else + { + setMinimumSize(size()); + s_iMinWidth = width(); + s_iMinHeight = height(); + } isInitialized = true;//first show windows are held } +//--------------------------------------------------------------------------------------------------------------------- +void ConfigDialog::resizeEvent(QResizeEvent *) +{ + // remember the size for the next time this dialog is opened + s_iLastWidth = width(); + s_iLastHeight = height(); +} + //--------------------------------------------------------------------------------------------------------------------- void ConfigDialog::createIcons() { @@ -217,3 +240,8 @@ void ConfigDialog::RetranslateUi() contentsWidget->item(3)->setText(tr("Paths")); } +//--------------------------------------------------------------------------------------------------------------------- +int ConfigDialog::s_iLastWidth = 0; +int ConfigDialog::s_iLastHeight = 0; +int ConfigDialog::s_iMinWidth = 0; +int ConfigDialog::s_iMinHeight = 0; diff --git a/src/app/valentina/dialogs/configdialog.h b/src/app/valentina/dialogs/configdialog.h index bb1932032..f7d8b5e1f 100644 --- a/src/app/valentina/dialogs/configdialog.h +++ b/src/app/valentina/dialogs/configdialog.h @@ -49,6 +49,7 @@ protected: virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE; virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE; virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE; + virtual void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(ConfigDialog) QListWidget *contentsWidget; @@ -61,6 +62,13 @@ private: QPushButton *cancelButton; QPushButton *okButton; bool isInitialized; + // the following static variables are used to preserve the dialog size when it + // is opened again and to hold the minimum size (which will be determined when + // the dialog is opened for the first time) + static int s_iLastWidth; + static int s_iLastHeight; + static int s_iMinWidth; + static int s_iMinHeight; void createIcons(); void createIcon(const QString &icon, const QString &text); void Apply(); From 1738972c8559af25418a0992f01ad6a614ab02a0 Mon Sep 17 00:00:00 2001 From: BojanKverh Date: Thu, 9 Jun 2016 13:22:11 +0200 Subject: [PATCH 2/6] Updated ChangeLog.txt --HG-- branch : feature --- ChangeLog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index 8c7aec59e..a2efe1e09 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,4 +1,5 @@ # Version 0.5.0 +- [#479] Preferences dialog is now extendable and when it is opened again, it will be resized to its previous size - [#193] Undeletable zombie arc objects. - New feature. Groups. - Tool "Curve intersect axis" store data about subpaths. From 96b2d28604cf55fb72eee808b2c51fdd8eec9c20 Mon Sep 17 00:00:00 2001 From: BojanKverh Date: Fri, 10 Jun 2016 21:34:21 +0200 Subject: [PATCH 3/6] Fixed issue #479. Improve feature: The Preferences dialog box in Valentina and Tape should be expandable. --HG-- branch : feature --- ChangeLog.txt | 2 +- src/app/tape/dialogs/tapeconfigdialog.cpp | 20 ++++++++++- src/app/tape/dialogs/tapeconfigdialog.h | 1 + src/app/valentina/dialogs/configdialog.cpp | 40 ++++++++-------------- src/app/valentina/dialogs/configdialog.h | 9 +---- src/libs/vmisc/vcommonsettings.cpp | 13 +++++++ src/libs/vmisc/vcommonsettings.h | 4 +++ 7 files changed, 54 insertions(+), 35 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index a2efe1e09..02bb6efef 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,5 +1,5 @@ # Version 0.5.0 -- [#479] Preferences dialog is now extendable and when it is opened again, it will be resized to its previous size +- [#479] Preferences dialog is now extendable and when it is opened again, it will be resized to its previous size. - [#193] Undeletable zombie arc objects. - New feature. Groups. - Tool "Curve intersect axis" store data about subpaths. diff --git a/src/app/tape/dialogs/tapeconfigdialog.cpp b/src/app/tape/dialogs/tapeconfigdialog.cpp index cb489ee24..7f9c27b42 100644 --- a/src/app/tape/dialogs/tapeconfigdialog.cpp +++ b/src/app/tape/dialogs/tapeconfigdialog.cpp @@ -147,12 +147,30 @@ void TapeConfigDialog::showEvent(QShowEvent *event) } // do your init stuff here - setMaximumSize(size()); setMinimumSize(size()); + QSize sz = qApp->Settings()->GetPreferenceDialogSize(); + if (sz.isEmpty() == false) + { + resize(sz); + } + isInitialized = true;//first show windows are held } +//--------------------------------------------------------------------------------------------------------------------- +void TapeConfigDialog::resizeEvent(QResizeEvent *event) +{ + Q_UNUSED(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 == true) + { + qApp->Settings()->SetPreferenceDialogSize(size()); + } +} + //--------------------------------------------------------------------------------------------------------------------- void TapeConfigDialog::createIcons() { diff --git a/src/app/tape/dialogs/tapeconfigdialog.h b/src/app/tape/dialogs/tapeconfigdialog.h index b88a8c83f..54e2f6ac8 100644 --- a/src/app/tape/dialogs/tapeconfigdialog.h +++ b/src/app/tape/dialogs/tapeconfigdialog.h @@ -50,6 +50,7 @@ protected: virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE; virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE; virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE; + virtual void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(TapeConfigDialog) QListWidget *contentsWidget; diff --git a/src/app/valentina/dialogs/configdialog.cpp b/src/app/valentina/dialogs/configdialog.cpp index 8d41f0a59..5ae67a90a 100644 --- a/src/app/valentina/dialogs/configdialog.cpp +++ b/src/app/valentina/dialogs/configdialog.cpp @@ -87,8 +87,7 @@ ConfigDialog::ConfigDialog(QWidget *parent) : QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addLayout(horizontalLayout); - //mainLayout->addStretch(1); - //mainLayout->addSpacing(12); + mainLayout->addSpacing(12); mainLayout->addLayout(buttonsLayout); mainLayout->setStretch(0, 1); setLayout(mainLayout); @@ -96,11 +95,6 @@ ConfigDialog::ConfigDialog(QWidget *parent) : setWindowTitle(tr("Config Dialog")); qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C)); - - if (s_iLastWidth > 0 && s_iLastHeight > 0) - { - resize(s_iLastWidth, s_iLastHeight); - } } //--------------------------------------------------------------------------------------------------------------------- @@ -151,27 +145,28 @@ void ConfigDialog::showEvent(QShowEvent *event) } // do your init stuff here - //setMaximumSize(size()); - if (s_iMinWidth > 0 && s_iMinHeight > 0) + setMinimumSize(size()); + + QSize sz = qApp->Settings()->GetPreferenceDialogSize(); + if (sz.isEmpty() == false) { - setMinimumSize(s_iMinWidth, s_iMinHeight); - } - else - { - setMinimumSize(size()); - s_iMinWidth = width(); - s_iMinHeight = height(); + resize(sz); } isInitialized = true;//first show windows are held } //--------------------------------------------------------------------------------------------------------------------- -void ConfigDialog::resizeEvent(QResizeEvent *) +void ConfigDialog::resizeEvent(QResizeEvent *event) { - // remember the size for the next time this dialog is opened - s_iLastWidth = width(); - s_iLastHeight = height(); + Q_UNUSED(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 == true) + { + qApp->Settings()->SetPreferenceDialogSize(size()); + } } //--------------------------------------------------------------------------------------------------------------------- @@ -240,8 +235,3 @@ void ConfigDialog::RetranslateUi() contentsWidget->item(3)->setText(tr("Paths")); } -//--------------------------------------------------------------------------------------------------------------------- -int ConfigDialog::s_iLastWidth = 0; -int ConfigDialog::s_iLastHeight = 0; -int ConfigDialog::s_iMinWidth = 0; -int ConfigDialog::s_iMinHeight = 0; diff --git a/src/app/valentina/dialogs/configdialog.h b/src/app/valentina/dialogs/configdialog.h index f7d8b5e1f..f64321588 100644 --- a/src/app/valentina/dialogs/configdialog.h +++ b/src/app/valentina/dialogs/configdialog.h @@ -49,7 +49,7 @@ protected: virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE; virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE; virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE; - virtual void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE; + virtual void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(ConfigDialog) QListWidget *contentsWidget; @@ -62,13 +62,6 @@ private: QPushButton *cancelButton; QPushButton *okButton; bool isInitialized; - // the following static variables are used to preserve the dialog size when it - // is opened again and to hold the minimum size (which will be determined when - // the dialog is opened for the first time) - static int s_iLastWidth; - static int s_iLastHeight; - static int s_iMinWidth; - static int s_iMinHeight; void createIcons(); void createIcon(const QString &icon, const QString &text); void Apply(); diff --git a/src/libs/vmisc/vcommonsettings.cpp b/src/libs/vmisc/vcommonsettings.cpp index 2093f1b50..41416fdd8 100644 --- a/src/libs/vmisc/vcommonsettings.cpp +++ b/src/libs/vmisc/vcommonsettings.cpp @@ -64,6 +64,7 @@ const QString VCommonSettings::SettingGeneralRestoreFileList = QString const QString VCommonSettings::SettingGeneralGeometry = QStringLiteral("geometry"); const QString VCommonSettings::SettingGeneralWindowState = QStringLiteral("windowState"); const QString VCommonSettings::SettingGeneralToolbarsState = QStringLiteral("toolbarsState"); +const QString VCommonSettings::SettingPreferenceDialogSize = QStringLiteral("preferenceDialogSize"); //--------------------------------------------------------------------------------------------------------------------- VCommonSettings::VCommonSettings(Format format, Scope scope, const QString &organization, @@ -414,3 +415,15 @@ void VCommonSettings::SetToolbarsState(const QByteArray &value) { setValue(SettingGeneralToolbarsState, value); } + +//--------------------------------------------------------------------------------------------------------------------- +QSize VCommonSettings::GetPreferenceDialogSize() const +{ + return value(SettingPreferenceDialogSize, QSize(0, 0)).toSize(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VCommonSettings::SetPreferenceDialogSize(const QSize& sz) +{ + setValue(SettingPreferenceDialogSize, sz); +} diff --git a/src/libs/vmisc/vcommonsettings.h b/src/libs/vmisc/vcommonsettings.h index 8cc2092de..d8e516282 100644 --- a/src/libs/vmisc/vcommonsettings.h +++ b/src/libs/vmisc/vcommonsettings.h @@ -99,6 +99,9 @@ public: QByteArray GetToolbarsState() const; void SetToolbarsState(const QByteArray &value); + QSize GetPreferenceDialogSize() const; + void SetPreferenceDialogSize(const QSize& sz); + private: Q_DISABLE_COPY(VCommonSettings) @@ -124,6 +127,7 @@ private: static const QString SettingGeneralGeometry; static const QString SettingGeneralWindowState; static const QString SettingGeneralToolbarsState; + static const QString SettingPreferenceDialogSize; }; #endif // VCOMMONSETTINGS_H From 24a7294a38d59d1b8eaed26bb9ed6c7ceb8f627d Mon Sep 17 00:00:00 2001 From: BojanKverh Date: Fri, 10 Jun 2016 21:57:47 +0200 Subject: [PATCH 4/6] Made the preferences dialog in Tape look a bit better with resizeable left column --HG-- branch : feature --- ChangeLog.txt | 1 + src/app/tape/dialogs/tapeconfigdialog.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 02bb6efef..c440305bb 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,4 +1,5 @@ # Version 0.5.0 +- [#479] Preferences dialog size is now saved between the sessions in Valentina and Tape app - [#479] Preferences dialog is now extendable and when it is opened again, it will be resized to its previous size. - [#193] Undeletable zombie arc objects. - New feature. Groups. diff --git a/src/app/tape/dialogs/tapeconfigdialog.cpp b/src/app/tape/dialogs/tapeconfigdialog.cpp index 7f9c27b42..cf60198e1 100644 --- a/src/app/tape/dialogs/tapeconfigdialog.cpp +++ b/src/app/tape/dialogs/tapeconfigdialog.cpp @@ -89,11 +89,12 @@ TapeConfigDialog::TapeConfigDialog(QWidget *parent) QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addLayout(horizontalLayout); - mainLayout->addStretch(1); mainLayout->addSpacing(12); mainLayout->addLayout(buttonsLayout); setLayout(mainLayout); + mainLayout->setStretch(0, 1); + setWindowTitle(tr("Config Dialog")); qApp->TapeSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C)); From 97a61f16c3e2585df9616863a4d366de9db7d369 Mon Sep 17 00:00:00 2001 From: BojanKverh Date: Fri, 10 Jun 2016 22:26:06 +0200 Subject: [PATCH 5/6] Trying to resolve conflict --HG-- branch : feature --- ChangeLog.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index c440305bb..987104fce 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,5 +1,5 @@ # Version 0.5.0 -- [#479] Preferences dialog size is now saved between the sessions in Valentina and Tape app +- Size of preferences dialog in both Valentina and Tape app is now preserved between sessions - [#479] Preferences dialog is now extendable and when it is opened again, it will be resized to its previous size. - [#193] Undeletable zombie arc objects. - New feature. Groups. From 1cb22b94a8725e1d53e7b3ce8cbdf7d0b59ec6f5 Mon Sep 17 00:00:00 2001 From: BojanKverh Date: Fri, 10 Jun 2016 22:38:39 +0200 Subject: [PATCH 6/6] Trying to resolve conflict --HG-- branch : feature --- ChangeLog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index 987104fce..7fffa005b 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,6 +1,7 @@ # Version 0.5.0 - Size of preferences dialog in both Valentina and Tape app is now preserved between sessions - [#479] Preferences dialog is now extendable and when it is opened again, it will be resized to its previous size. +- [#508] Settings saved to INI files in different folders. - [#193] Undeletable zombie arc objects. - New feature. Groups. - Tool "Curve intersect axis" store data about subpaths.