2121#include < QString>
2222#include < QStringList>
2323#include < QFileInfo>
24+ #include < QFileDialog>
25+ #include < QLineEdit>
2426#include " projectfiledialog.h"
2527
2628ProjectFileDialog::ProjectFileDialog (const QString &path, QWidget *parent)
@@ -34,6 +36,8 @@ ProjectFileDialog::ProjectFileDialog(const QString &path, QWidget *parent)
3436 setWindowTitle (title);
3537
3638 connect (mUI .mButtons , SIGNAL (accepted ()), this , SLOT (accept ()));
39+ connect (mUI .mBtnBrowseIncludes , SIGNAL (clicked ()), this , SLOT (BrowseIncludes ()));
40+ connect (mUI .mBtnBrowsePaths , SIGNAL (clicked ()), this , SLOT (BrowsePaths ()));
3741}
3842
3943QString ProjectFileDialog::GetRootPath () const
@@ -137,3 +141,35 @@ void ProjectFileDialog::SetPaths(const QStringList &paths)
137141 pathstr = pathstr.left (pathstr.length () - 1 );
138142 mUI .mEditPaths ->setText (pathstr);
139143}
144+
145+ void ProjectFileDialog::BrowseIncludes ()
146+ {
147+ QString selectedDir = QFileDialog::getExistingDirectory (this ,
148+ tr (" Select include directory" ),
149+ QString ());
150+
151+ if (!selectedDir.isEmpty ())
152+ {
153+ AppendDirname (mUI .mEditIncludePaths , selectedDir);
154+ }
155+ }
156+
157+ void ProjectFileDialog::BrowsePaths ()
158+ {
159+ QString selectedDir = QFileDialog::getExistingDirectory (this ,
160+ tr (" Select directory to check" ),
161+ QString ());
162+
163+ if (!selectedDir.isEmpty ())
164+ {
165+ AppendDirname (mUI .mEditPaths , selectedDir);
166+ }
167+ }
168+
169+ void ProjectFileDialog::AppendDirname (QLineEdit *edit, const QString &dir)
170+ {
171+ QString wholeText = edit->text ();
172+ wholeText += " ;" ;
173+ wholeText += dir;
174+ edit->setText (wholeText);
175+ }
0 commit comments