Merged in BojanKverh/valentina-develop-bojan/feature (pull request #121)

Fixed Issue #479. Improve feature: The Preferences dialog box should be expandable.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-06-10 23:45:24 +03:00
commit 67c174951b
7 changed files with 62 additions and 4 deletions

View File

@ -1,4 +1,6 @@
# Version 0.5.0 # 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. - [#508] Settings saved to INI files in different folders.
- [#193] Undeletable zombie arc objects. - [#193] Undeletable zombie arc objects.
- New feature. Groups. - New feature. Groups.

View File

@ -89,11 +89,12 @@ TapeConfigDialog::TapeConfigDialog(QWidget *parent)
QVBoxLayout *mainLayout = new QVBoxLayout; QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addLayout(horizontalLayout); mainLayout->addLayout(horizontalLayout);
mainLayout->addStretch(1);
mainLayout->addSpacing(12); mainLayout->addSpacing(12);
mainLayout->addLayout(buttonsLayout); mainLayout->addLayout(buttonsLayout);
setLayout(mainLayout); setLayout(mainLayout);
mainLayout->setStretch(0, 1);
setWindowTitle(tr("Config Dialog")); setWindowTitle(tr("Config Dialog"));
qApp->TapeSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C)); qApp->TapeSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
@ -147,12 +148,30 @@ void TapeConfigDialog::showEvent(QShowEvent *event)
} }
// do your init stuff here // do your init stuff here
setMaximumSize(size());
setMinimumSize(size()); setMinimumSize(size());
QSize sz = qApp->Settings()->GetPreferenceDialogSize();
if (sz.isEmpty() == false)
{
resize(sz);
}
isInitialized = true;//first show windows are held 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() void TapeConfigDialog::createIcons()
{ {

View File

@ -50,6 +50,7 @@ protected:
virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE; virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE; virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE; virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
virtual void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
private: private:
Q_DISABLE_COPY(TapeConfigDialog) Q_DISABLE_COPY(TapeConfigDialog)
QListWidget *contentsWidget; QListWidget *contentsWidget;

View File

@ -87,9 +87,9 @@ ConfigDialog::ConfigDialog(QWidget *parent) :
QVBoxLayout *mainLayout = new QVBoxLayout; QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addLayout(horizontalLayout); mainLayout->addLayout(horizontalLayout);
mainLayout->addStretch(1);
mainLayout->addSpacing(12); mainLayout->addSpacing(12);
mainLayout->addLayout(buttonsLayout); mainLayout->addLayout(buttonsLayout);
mainLayout->setStretch(0, 1);
setLayout(mainLayout); setLayout(mainLayout);
setWindowTitle(tr("Config Dialog")); setWindowTitle(tr("Config Dialog"));
@ -145,12 +145,30 @@ void ConfigDialog::showEvent(QShowEvent *event)
} }
// do your init stuff here // do your init stuff here
setMaximumSize(size());
setMinimumSize(size()); setMinimumSize(size());
QSize sz = qApp->Settings()->GetPreferenceDialogSize();
if (sz.isEmpty() == false)
{
resize(sz);
}
isInitialized = true;//first show windows are held isInitialized = true;//first show windows are held
} }
//---------------------------------------------------------------------------------------------------------------------
void ConfigDialog::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 ConfigDialog::createIcons() void ConfigDialog::createIcons()
{ {

View File

@ -49,6 +49,7 @@ protected:
virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE; virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE; virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE; virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
virtual void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
private: private:
Q_DISABLE_COPY(ConfigDialog) Q_DISABLE_COPY(ConfigDialog)
QListWidget *contentsWidget; QListWidget *contentsWidget;

View File

@ -64,6 +64,7 @@ const QString VCommonSettings::SettingGeneralRestoreFileList = QString
const QString VCommonSettings::SettingGeneralGeometry = QStringLiteral("geometry"); const QString VCommonSettings::SettingGeneralGeometry = QStringLiteral("geometry");
const QString VCommonSettings::SettingGeneralWindowState = QStringLiteral("windowState"); const QString VCommonSettings::SettingGeneralWindowState = QStringLiteral("windowState");
const QString VCommonSettings::SettingGeneralToolbarsState = QStringLiteral("toolbarsState"); const QString VCommonSettings::SettingGeneralToolbarsState = QStringLiteral("toolbarsState");
const QString VCommonSettings::SettingPreferenceDialogSize = QStringLiteral("preferenceDialogSize");
static const QString commonIniFilename = QStringLiteral("common"); static const QString commonIniFilename = QStringLiteral("common");
@ -416,3 +417,15 @@ void VCommonSettings::SetToolbarsState(const QByteArray &value)
{ {
setValue(SettingGeneralToolbarsState, value); setValue(SettingGeneralToolbarsState, value);
} }
//---------------------------------------------------------------------------------------------------------------------
QSize VCommonSettings::GetPreferenceDialogSize() const
{
return value(SettingPreferenceDialogSize, QSize(0, 0)).toSize();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetPreferenceDialogSize(const QSize& sz)
{
setValue(SettingPreferenceDialogSize, sz);
}

View File

@ -99,6 +99,9 @@ public:
QByteArray GetToolbarsState() const; QByteArray GetToolbarsState() const;
void SetToolbarsState(const QByteArray &value); void SetToolbarsState(const QByteArray &value);
QSize GetPreferenceDialogSize() const;
void SetPreferenceDialogSize(const QSize& sz);
private: private:
Q_DISABLE_COPY(VCommonSettings) Q_DISABLE_COPY(VCommonSettings)
@ -124,6 +127,7 @@ private:
static const QString SettingGeneralGeometry; static const QString SettingGeneralGeometry;
static const QString SettingGeneralWindowState; static const QString SettingGeneralWindowState;
static const QString SettingGeneralToolbarsState; static const QString SettingGeneralToolbarsState;
static const QString SettingPreferenceDialogSize;
}; };
#endif // VCOMMONSETTINGS_H #endif // VCOMMONSETTINGS_H