GUI: Set initial path for adding paths to project.

Use project file's location as base path when adding new paths
(checked, included or ignored) to the project. In most cases user
wants to add paths in the same project so this reduces browsing
paths considerably when adding them.
This commit is contained in:
Kimmo Varis 2011-05-13 09:23:43 +03:00
parent 0b0d890bd2
commit 3dc87be0af
2 changed files with 17 additions and 4 deletions

View File

@ -28,6 +28,7 @@
ProjectFileDialog::ProjectFileDialog(const QString &path, QWidget *parent)
: QDialog(parent)
, mFilePath(path)
{
mUI.setupUi(this);
@ -187,9 +188,11 @@ void ProjectFileDialog::SetIgnorePaths(const QStringList &paths)
void ProjectFileDialog::AddIncludeDir()
{
QFileInfo inf(mFilePath);
const QString rootpath = inf.absolutePath();
QString selectedDir = QFileDialog::getExistingDirectory(this,
tr("Select include directory"),
QString());
rootpath);
if (!selectedDir.isEmpty())
{
@ -199,9 +202,11 @@ void ProjectFileDialog::AddIncludeDir()
void ProjectFileDialog::AddPath()
{
QFileInfo inf(mFilePath);
const QString rootpath = inf.absolutePath();
QString selectedDir = QFileDialog::getExistingDirectory(this,
tr("Select directory to check"),
QString());
tr("Select a directory to check"),
rootpath);
if (!selectedDir.isEmpty())
{
@ -237,9 +242,12 @@ void ProjectFileDialog::RemovePath()
void ProjectFileDialog::AddIgnorePath()
{
QFileInfo inf(mFilePath);
const QString rootpath = inf.absolutePath();
QString selectedDir = QFileDialog::getExistingDirectory(this,
tr("Select directory to ignore"),
QString());
rootpath);
if (!selectedDir.isEmpty())
{

View File

@ -171,6 +171,11 @@ protected:
private:
Ui::ProjectFile mUI;
/**
* @brief Projectfile path.
*/
QString mFilePath;
};
/// @}