GUI: Make Project-dialog to remember its size.
This commit is contained in:
parent
010403699a
commit
214a94e1b7
|
@ -52,6 +52,8 @@ ShowTypes;
|
|||
#define SETTINGS_MAINWND_SPLITTER_STATE "Mainwindow/Vertical splitter state"
|
||||
#define SETTINGS_CHECK_DIALOG_WIDTH "Check dialog width"
|
||||
#define SETTINGS_CHECK_DIALOG_HEIGHT "Check dialog height"
|
||||
#define SETTINGS_PROJECT_DIALOG_WIDTH "Project dialog width"
|
||||
#define SETTINGS_PROJECT_DIALOG_HEIGHT "Project dialog height"
|
||||
|
||||
// Main window settings
|
||||
#define SETTINGS_RESULT_COLUMN_WIDTH "Result column %1 width"
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include <QFileDialog>
|
||||
#include <QLineEdit>
|
||||
#include <QDir>
|
||||
#include <QSettings>
|
||||
#include "common.h"
|
||||
#include "projectfiledialog.h"
|
||||
|
||||
ProjectFileDialog::ProjectFileDialog(const QString &path, QWidget *parent)
|
||||
|
@ -36,6 +38,7 @@ ProjectFileDialog::ProjectFileDialog(const QString &path, QWidget *parent)
|
|||
QString filename = inf.fileName();
|
||||
QString title = tr("Project file: %1").arg(filename);
|
||||
setWindowTitle(title);
|
||||
LoadSettings();
|
||||
|
||||
connect(mUI.mButtons, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
connect(mUI.mBtnAddInclude, SIGNAL(clicked()), this, SLOT(AddIncludeDir()));
|
||||
|
@ -49,6 +52,25 @@ ProjectFileDialog::ProjectFileDialog(const QString &path, QWidget *parent)
|
|||
connect(mUI.mBtnRemoveIgnorePath, SIGNAL(clicked()), this, SLOT(RemoveIgnorePath()));
|
||||
}
|
||||
|
||||
ProjectFileDialog::~ProjectFileDialog()
|
||||
{
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
void ProjectFileDialog::LoadSettings()
|
||||
{
|
||||
QSettings settings;
|
||||
resize(settings.value(SETTINGS_PROJECT_DIALOG_WIDTH, 470).toInt(),
|
||||
settings.value(SETTINGS_PROJECT_DIALOG_HEIGHT, 330).toInt());
|
||||
}
|
||||
|
||||
void ProjectFileDialog::SaveSettings()
|
||||
{
|
||||
QSettings settings;
|
||||
settings.setValue(SETTINGS_PROJECT_DIALOG_WIDTH, size().width());
|
||||
settings.setValue(SETTINGS_PROJECT_DIALOG_HEIGHT, size().height());
|
||||
}
|
||||
|
||||
void ProjectFileDialog::AddIncludeDir(const QString &dir)
|
||||
{
|
||||
if (dir.isNull() || dir.isEmpty())
|
||||
|
|
|
@ -41,6 +41,7 @@ class ProjectFileDialog : public QDialog
|
|||
Q_OBJECT
|
||||
public:
|
||||
ProjectFileDialog(const QString &path, QWidget *parent = 0);
|
||||
virtual ~ProjectFileDialog();
|
||||
|
||||
/**
|
||||
* @brief Return project root path from the dialog control.
|
||||
|
@ -151,6 +152,16 @@ protected slots:
|
|||
|
||||
protected:
|
||||
|
||||
/**
|
||||
* @brief Save dialog settings.
|
||||
*/
|
||||
void LoadSettings();
|
||||
|
||||
/**
|
||||
* @brief Load dialog settings.
|
||||
*/
|
||||
void SaveSettings();
|
||||
|
||||
/**
|
||||
* @brief Add new indlude directory.
|
||||
* @param dir Directory to add.
|
||||
|
|
Loading…
Reference in New Issue