From 6a3bccae6f2e3ae466276403bb9f53feb139ccf9 Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Tue, 17 Aug 2010 19:32:29 +0300 Subject: [PATCH] GUI: Add check paths field to Project File -dialog. --- gui/project.cpp | 4 ++++ gui/projectfile.ui | 23 +++++++++++++++++++++++ gui/projectfiledialog.cpp | 30 ++++++++++++++++++++++++++++++ gui/projectfiledialog.h | 12 ++++++++++++ 4 files changed, 69 insertions(+) diff --git a/gui/project.cpp b/gui/project.cpp index 5d4f89661..a6c1b1e6f 100644 --- a/gui/project.cpp +++ b/gui/project.cpp @@ -82,6 +82,8 @@ void Project::Edit() dlg.SetIncludepaths(includes); QStringList defines = mPFile->GetDefines(); dlg.SetDefines(defines); + QStringList paths = mPFile->GetCheckPaths(); + dlg.SetPaths(paths); int rv = dlg.exec(); if (rv == QDialog::Accepted) { @@ -89,6 +91,8 @@ void Project::Edit() mPFile->SetIncludes(includes); QStringList defines = dlg.GetDefines(); mPFile->SetDefines(defines); + QStringList paths = dlg.GetPaths(); + mPFile->SetCheckPaths(paths); bool writeSuccess = mPFile->Write(); if (!writeSuccess) { diff --git a/gui/projectfile.ui b/gui/projectfile.ui index fd005658e..a39ce006d 100644 --- a/gui/projectfile.ui +++ b/gui/projectfile.ui @@ -14,6 +14,23 @@ Project File + + + + + + Paths: + + + mEditPaths + + + + + + + + @@ -73,6 +90,12 @@ + + mEditPaths + mEditIncludePaths + mEditDefines + mButtons + diff --git a/gui/projectfiledialog.cpp b/gui/projectfiledialog.cpp index 319505380..181617340 100644 --- a/gui/projectfiledialog.cpp +++ b/gui/projectfiledialog.cpp @@ -63,6 +63,21 @@ QStringList ProjectFileDialog::GetDefines() const return defines; } +QStringList ProjectFileDialog::GetPaths() const +{ + QString path = mUI.mEditPaths->text(); + QStringList paths; + if (!path.isEmpty()) + { + path = path.trimmed(); + if (path.indexOf(';') != -1) + paths = path.split(";"); + else + paths.append(path); + } + return paths; +} + void ProjectFileDialog::SetIncludepaths(const QStringList &includes) { QString includestr; @@ -92,3 +107,18 @@ void ProjectFileDialog::SetDefines(const QStringList &defines) definestr = definestr.left(definestr.length() - 1); mUI.mEditDefines->setText(definestr); } + +void ProjectFileDialog::SetPaths(const QStringList &paths) +{ + QString pathstr; + QString path; + foreach(path, paths) + { + pathstr += path; + pathstr += ";"; + } + // Remove ; from the end of the string + if (pathstr.endsWith(';')) + pathstr = pathstr.left(pathstr.length() - 1); + mUI.mEditPaths->setText(pathstr); +} diff --git a/gui/projectfiledialog.h b/gui/projectfiledialog.h index c3252fe35..aac13172a 100644 --- a/gui/projectfiledialog.h +++ b/gui/projectfiledialog.h @@ -51,6 +51,12 @@ public: */ QStringList GetDefines() const; + /** + * @brief Return check paths from the dialog control. + * @return List of check paths. + */ + QStringList GetPaths() const; + /** * @brief Set include paths to dialog control. * @param includes List of include paths to set to dialog control. @@ -63,6 +69,12 @@ public: */ void SetDefines(const QStringList &defines); + /** + * @brief Set check paths to dialog control. + * @param paths List of path names to set to dialog control. + */ + void SetPaths(const QStringList &paths); + private: Ui::ProjectFile mUI; };