diff --git a/gui/project.cpp b/gui/project.cpp index 963fcfeee..3467da289 100644 --- a/gui/project.cpp +++ b/gui/project.cpp @@ -85,6 +85,9 @@ void Project::Edit() dlg.SetDefines(defines); QStringList paths = mPFile->GetCheckPaths(); dlg.SetPaths(paths); + QStringList ignorepaths = mPFile->GetIgnoredPaths(); + dlg.SetIgnorePaths(ignorepaths); + int rv = dlg.exec(); if (rv == QDialog::Accepted) { @@ -96,6 +99,9 @@ void Project::Edit() mPFile->SetDefines(defines); QStringList paths = dlg.GetPaths(); mPFile->SetCheckPaths(paths); + QStringList ignorepaths = dlg.GetIgnorePaths(); + mPFile->SetIgnoredPaths(ignorepaths); + bool writeSuccess = mPFile->Write(); if (!writeSuccess) { diff --git a/gui/projectfile.ui b/gui/projectfile.ui index 7a978159a..9afb0f83e 100644 --- a/gui/projectfile.ui +++ b/gui/projectfile.ui @@ -17,7 +17,7 @@ - 1 + 2 @@ -196,6 +196,65 @@ + + + Ignore + + + + + + Paths: + + + + + + + + + + + + + + Add... + + + + + + + Edit + + + + + + + Remove + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + diff --git a/gui/projectfiledialog.cpp b/gui/projectfiledialog.cpp index f8a0d1241..11fdf8334 100644 --- a/gui/projectfiledialog.cpp +++ b/gui/projectfiledialog.cpp @@ -43,6 +43,9 @@ ProjectFileDialog::ProjectFileDialog(const QString &path, QWidget *parent) connect(mUI.mBtnRemoveInclude, SIGNAL(clicked()), this, SLOT(RemoveIncludeDir())); connect(mUI.mBtnEditPath, SIGNAL(clicked()), this, SLOT(EditPath())); connect(mUI.mBtnRemovePath, SIGNAL(clicked()), this, SLOT(RemovePath())); + connect(mUI.mBtnAddIgnorePath, SIGNAL(clicked()), this, SLOT(AddIgnorePath())); + connect(mUI.mBtnEditIgnorePath, SIGNAL(clicked()), this, SLOT(EditIgnorePath())); + connect(mUI.mBtnRemoveIgnorePath, SIGNAL(clicked()), this, SLOT(RemoveIgnorePath())); } void ProjectFileDialog::AddIncludeDir(const QString &dir) @@ -65,6 +68,16 @@ void ProjectFileDialog::AddPath(const QString &path) mUI.mListPaths->addItem(item); } +void ProjectFileDialog::AddIgnorePath(const QString &path) +{ + if (path.isNull() || path.isEmpty()) + return; + + QListWidgetItem *item = new QListWidgetItem(path); + item->setFlags(item->flags() | Qt::ItemIsEditable); + mUI.mListIgnoredPaths->addItem(item); +} + QString ProjectFileDialog::GetRootPath() const { QString root = mUI.mEditProjectRoot->text(); @@ -111,6 +124,18 @@ QStringList ProjectFileDialog::GetPaths() const return paths; } +QStringList ProjectFileDialog::GetIgnorePaths() const +{ + const int count = mUI.mListIncludeDirs->count(); + QStringList paths; + for (int i = 0; i < count; i++) + { + QListWidgetItem *item = mUI.mListIncludeDirs->item(i); + paths << item->text(); + } + return paths; +} + void ProjectFileDialog::SetRootPath(const QString &root) { mUI.mEditProjectRoot->setText(root); @@ -147,6 +172,14 @@ void ProjectFileDialog::SetPaths(const QStringList &paths) } } +void ProjectFileDialog::SetIgnorePaths(const QStringList &paths) +{ + foreach(QString path, paths) + { + AddIgnorePath(path); + } +} + void ProjectFileDialog::AddIncludeDir() { QString selectedDir = QFileDialog::getExistingDirectory(this, @@ -196,3 +229,28 @@ void ProjectFileDialog::RemovePath() QListWidgetItem *item = mUI.mListPaths->takeItem(row); delete item; } + +void ProjectFileDialog::AddIgnorePath() +{ + QString selectedDir = QFileDialog::getExistingDirectory(this, + tr("Select directory to ignore"), + QString()); + + if (!selectedDir.isEmpty()) + { + AddIgnorePath(selectedDir); + } +} + +void ProjectFileDialog::EditIgnorePath() +{ + QListWidgetItem *item = mUI.mListIgnoredPaths->currentItem(); + mUI.mListIgnoredPaths->editItem(item); +} + +void ProjectFileDialog::RemoveIgnorePath() +{ + const int row = mUI.mListIgnoredPaths->currentRow(); + QListWidgetItem *item = mUI.mListIgnoredPaths->takeItem(row); + delete item; +} diff --git a/gui/projectfiledialog.h b/gui/projectfiledialog.h index 9256d31c0..0d904ab38 100644 --- a/gui/projectfiledialog.h +++ b/gui/projectfiledialog.h @@ -66,6 +66,12 @@ public: */ QStringList GetPaths() const; + /** + * @brief Return ignored paths from the dialog control. + * @return List of ignored paths. + */ + QStringList GetIgnorePaths() const; + /** * @brief Set project root path to dialog control. * @param root Project root path to set to dialog control. @@ -90,6 +96,12 @@ public: */ void SetPaths(const QStringList &paths); + /** + * @brief Set ignored paths to dialog control. + * @param paths List of path names to set to dialog control. + */ + void SetIgnorePaths(const QStringList &paths); + protected slots: /** * @brief Browse for include directory. @@ -122,6 +134,21 @@ protected slots: */ void RemovePath(); + /** + * @brief Add new path to ignore. + */ + void AddIgnorePath(); + + /** + * @brief Edit ignored path in the list. + */ + void EditIgnorePath(); + + /** + * @brief Remove ignored path from the list. + */ + void RemoveIgnorePath(); + protected: /** @@ -136,6 +163,12 @@ protected: */ void AddPath(const QString &path); + /** + * @brief Add new path to ignore list. + * @param path Path to add. + */ + void AddIgnorePath(const QString &path); + private: Ui::ProjectFile mUI; };