Skip to content

Commit d967151

Browse files
committed
GUI: Add project root path to Project file -dialog.
1 parent 1e7694d commit d967151

4 files changed

Lines changed: 48 additions & 2 deletions

File tree

gui/project.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ bool Project::Open()
7777
void Project::Edit()
7878
{
7979
ProjectFileDialog dlg(mFilename, mParentWidget);
80-
80+
QString root = mPFile->GetRootPath();
81+
dlg.SetRootPath(root);
8182
QStringList includes = mPFile->GetIncludeDirs();
8283
dlg.SetIncludepaths(includes);
8384
QStringList defines = mPFile->GetDefines();
@@ -87,6 +88,8 @@ void Project::Edit()
8788
int rv = dlg.exec();
8889
if (rv == QDialog::Accepted)
8990
{
91+
QString root = dlg.GetRootPath();
92+
mPFile->SetRootPath(root);
9093
QStringList includes = dlg.GetIncludePaths();
9194
mPFile->SetIncludes(includes);
9295
QStringList defines = dlg.GetDefines();

gui/projectfile.ui

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,30 @@
77
<x>0</x>
88
<y>0</y>
99
<width>400</width>
10-
<height>112</height>
10+
<height>131</height>
1111
</rect>
1212
</property>
1313
<property name="windowTitle">
1414
<string>Project File</string>
1515
</property>
1616
<layout class="QVBoxLayout" name="verticalLayout">
17+
<item>
18+
<layout class="QHBoxLayout" name="horizontalLayout_4">
19+
<item>
20+
<widget class="QLabel" name="label_4">
21+
<property name="text">
22+
<string>Project:</string>
23+
</property>
24+
<property name="buddy">
25+
<cstring>mEditProjectRoot</cstring>
26+
</property>
27+
</widget>
28+
</item>
29+
<item>
30+
<widget class="QLineEdit" name="mEditProjectRoot"/>
31+
</item>
32+
</layout>
33+
</item>
1734
<item>
1835
<layout class="QHBoxLayout" name="horizontalLayout_3">
1936
<item>
@@ -91,6 +108,7 @@
91108
</layout>
92109
</widget>
93110
<tabstops>
111+
<tabstop>mEditProjectRoot</tabstop>
94112
<tabstop>mEditPaths</tabstop>
95113
<tabstop>mEditIncludePaths</tabstop>
96114
<tabstop>mEditDefines</tabstop>

gui/projectfiledialog.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ ProjectFileDialog::ProjectFileDialog(const QString &path, QWidget *parent)
3333
connect(mUI.mButtons, SIGNAL(accepted()), this, SLOT(accept()));
3434
}
3535

36+
QString ProjectFileDialog::GetRootPath() const
37+
{
38+
QString root = mUI.mEditProjectRoot->text();
39+
root = root.trimmed();
40+
return root;
41+
}
42+
3643
QStringList ProjectFileDialog::GetIncludePaths() const
3744
{
3845
QString include = mUI.mEditIncludePaths->text();
@@ -78,6 +85,11 @@ QStringList ProjectFileDialog::GetPaths() const
7885
return paths;
7986
}
8087

88+
void ProjectFileDialog::SetRootPath(const QString &root)
89+
{
90+
mUI.mEditProjectRoot->setText(root);
91+
}
92+
8193
void ProjectFileDialog::SetIncludepaths(const QStringList &includes)
8294
{
8395
QString includestr;

gui/projectfiledialog.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
#include <QDialog>
2323
#include <QString>
24+
#include <QStringList>
2425

2526
#include "ui_projectfile.h"
2627

@@ -39,6 +40,12 @@ class ProjectFileDialog : public QDialog
3940
public:
4041
ProjectFileDialog(const QString &path, QWidget *parent = 0);
4142

43+
/**
44+
* @brief Return project root path from the dialog control.
45+
* @return Project root path.
46+
*/
47+
QString GetRootPath() const;
48+
4249
/**
4350
* @brief Return include paths from the dialog control.
4451
* @return List of include paths.
@@ -57,6 +64,12 @@ class ProjectFileDialog : public QDialog
5764
*/
5865
QStringList GetPaths() const;
5966

67+
/**
68+
* @brief Set project root path to dialog control.
69+
* @param root Project root path to set to dialog control.
70+
*/
71+
void SetRootPath(const QString &root);
72+
6073
/**
6174
* @brief Set include paths to dialog control.
6275
* @param includes List of include paths to set to dialog control.

0 commit comments

Comments
 (0)