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_MAINWND_SPLITTER_STATE "Mainwindow/Vertical splitter state"
|
||||||
#define SETTINGS_CHECK_DIALOG_WIDTH "Check dialog width"
|
#define SETTINGS_CHECK_DIALOG_WIDTH "Check dialog width"
|
||||||
#define SETTINGS_CHECK_DIALOG_HEIGHT "Check dialog height"
|
#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
|
// Main window settings
|
||||||
#define SETTINGS_RESULT_COLUMN_WIDTH "Result column %1 width"
|
#define SETTINGS_RESULT_COLUMN_WIDTH "Result column %1 width"
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
#include <QSettings>
|
||||||
|
#include "common.h"
|
||||||
#include "projectfiledialog.h"
|
#include "projectfiledialog.h"
|
||||||
|
|
||||||
ProjectFileDialog::ProjectFileDialog(const QString &path, QWidget *parent)
|
ProjectFileDialog::ProjectFileDialog(const QString &path, QWidget *parent)
|
||||||
|
@ -36,6 +38,7 @@ ProjectFileDialog::ProjectFileDialog(const QString &path, QWidget *parent)
|
||||||
QString filename = inf.fileName();
|
QString filename = inf.fileName();
|
||||||
QString title = tr("Project file: %1").arg(filename);
|
QString title = tr("Project file: %1").arg(filename);
|
||||||
setWindowTitle(title);
|
setWindowTitle(title);
|
||||||
|
LoadSettings();
|
||||||
|
|
||||||
connect(mUI.mButtons, SIGNAL(accepted()), this, SLOT(accept()));
|
connect(mUI.mButtons, SIGNAL(accepted()), this, SLOT(accept()));
|
||||||
connect(mUI.mBtnAddInclude, SIGNAL(clicked()), this, SLOT(AddIncludeDir()));
|
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()));
|
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)
|
void ProjectFileDialog::AddIncludeDir(const QString &dir)
|
||||||
{
|
{
|
||||||
if (dir.isNull() || dir.isEmpty())
|
if (dir.isNull() || dir.isEmpty())
|
||||||
|
|
|
@ -41,6 +41,7 @@ class ProjectFileDialog : public QDialog
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ProjectFileDialog(const QString &path, QWidget *parent = 0);
|
ProjectFileDialog(const QString &path, QWidget *parent = 0);
|
||||||
|
virtual ~ProjectFileDialog();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Return project root path from the dialog control.
|
* @brief Return project root path from the dialog control.
|
||||||
|
@ -151,6 +152,16 @@ protected slots:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Save dialog settings.
|
||||||
|
*/
|
||||||
|
void LoadSettings();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Load dialog settings.
|
||||||
|
*/
|
||||||
|
void SaveSettings();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Add new indlude directory.
|
* @brief Add new indlude directory.
|
||||||
* @param dir Directory to add.
|
* @param dir Directory to add.
|
||||||
|
|
Loading…
Reference in New Issue