GUI: Add check paths field to Project File -dialog.

This commit is contained in:
Kimmo Varis 2010-08-17 19:32:29 +03:00
parent aef0aeb974
commit 6a3bccae6f
4 changed files with 69 additions and 0 deletions

View File

@ -82,6 +82,8 @@ void Project::Edit()
dlg.SetIncludepaths(includes); dlg.SetIncludepaths(includes);
QStringList defines = mPFile->GetDefines(); QStringList defines = mPFile->GetDefines();
dlg.SetDefines(defines); dlg.SetDefines(defines);
QStringList paths = mPFile->GetCheckPaths();
dlg.SetPaths(paths);
int rv = dlg.exec(); int rv = dlg.exec();
if (rv == QDialog::Accepted) if (rv == QDialog::Accepted)
{ {
@ -89,6 +91,8 @@ void Project::Edit()
mPFile->SetIncludes(includes); mPFile->SetIncludes(includes);
QStringList defines = dlg.GetDefines(); QStringList defines = dlg.GetDefines();
mPFile->SetDefines(defines); mPFile->SetDefines(defines);
QStringList paths = dlg.GetPaths();
mPFile->SetCheckPaths(paths);
bool writeSuccess = mPFile->Write(); bool writeSuccess = mPFile->Write();
if (!writeSuccess) if (!writeSuccess)
{ {

View File

@ -14,6 +14,23 @@
<string>Project File</string> <string>Project File</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Paths:</string>
</property>
<property name="buddy">
<cstring>mEditPaths</cstring>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="mEditPaths"/>
</item>
</layout>
</item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
@ -73,6 +90,12 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<tabstops>
<tabstop>mEditPaths</tabstop>
<tabstop>mEditIncludePaths</tabstop>
<tabstop>mEditDefines</tabstop>
<tabstop>mButtons</tabstop>
</tabstops>
<resources/> <resources/>
<connections> <connections>
<connection> <connection>

View File

@ -63,6 +63,21 @@ QStringList ProjectFileDialog::GetDefines() const
return defines; 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) void ProjectFileDialog::SetIncludepaths(const QStringList &includes)
{ {
QString includestr; QString includestr;
@ -92,3 +107,18 @@ void ProjectFileDialog::SetDefines(const QStringList &defines)
definestr = definestr.left(definestr.length() - 1); definestr = definestr.left(definestr.length() - 1);
mUI.mEditDefines->setText(definestr); 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);
}

View File

@ -51,6 +51,12 @@ public:
*/ */
QStringList GetDefines() const; 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. * @brief Set include paths to dialog control.
* @param includes List of include paths to set to dialog control. * @param includes List of include paths to set to dialog control.
@ -63,6 +69,12 @@ public:
*/ */
void SetDefines(const QStringList &defines); 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: private:
Ui::ProjectFile mUI; Ui::ProjectFile mUI;
}; };