GUI: Add project root path to Project file -dialog.
This commit is contained in:
parent
1e7694d56b
commit
d967151c32
|
@ -77,7 +77,8 @@ bool Project::Open()
|
|||
void Project::Edit()
|
||||
{
|
||||
ProjectFileDialog dlg(mFilename, mParentWidget);
|
||||
|
||||
QString root = mPFile->GetRootPath();
|
||||
dlg.SetRootPath(root);
|
||||
QStringList includes = mPFile->GetIncludeDirs();
|
||||
dlg.SetIncludepaths(includes);
|
||||
QStringList defines = mPFile->GetDefines();
|
||||
|
@ -87,6 +88,8 @@ void Project::Edit()
|
|||
int rv = dlg.exec();
|
||||
if (rv == QDialog::Accepted)
|
||||
{
|
||||
QString root = dlg.GetRootPath();
|
||||
mPFile->SetRootPath(root);
|
||||
QStringList includes = dlg.GetIncludePaths();
|
||||
mPFile->SetIncludes(includes);
|
||||
QStringList defines = dlg.GetDefines();
|
||||
|
|
|
@ -7,13 +7,30 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>112</height>
|
||||
<height>131</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Project File</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Project:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>mEditProjectRoot</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="mEditProjectRoot"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
|
@ -91,6 +108,7 @@
|
|||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>mEditProjectRoot</tabstop>
|
||||
<tabstop>mEditPaths</tabstop>
|
||||
<tabstop>mEditIncludePaths</tabstop>
|
||||
<tabstop>mEditDefines</tabstop>
|
||||
|
|
|
@ -33,6 +33,13 @@ ProjectFileDialog::ProjectFileDialog(const QString &path, QWidget *parent)
|
|||
connect(mUI.mButtons, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
}
|
||||
|
||||
QString ProjectFileDialog::GetRootPath() const
|
||||
{
|
||||
QString root = mUI.mEditProjectRoot->text();
|
||||
root = root.trimmed();
|
||||
return root;
|
||||
}
|
||||
|
||||
QStringList ProjectFileDialog::GetIncludePaths() const
|
||||
{
|
||||
QString include = mUI.mEditIncludePaths->text();
|
||||
|
@ -78,6 +85,11 @@ QStringList ProjectFileDialog::GetPaths() const
|
|||
return paths;
|
||||
}
|
||||
|
||||
void ProjectFileDialog::SetRootPath(const QString &root)
|
||||
{
|
||||
mUI.mEditProjectRoot->setText(root);
|
||||
}
|
||||
|
||||
void ProjectFileDialog::SetIncludepaths(const QStringList &includes)
|
||||
{
|
||||
QString includestr;
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include <QDialog>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
#include "ui_projectfile.h"
|
||||
|
||||
|
@ -39,6 +40,12 @@ class ProjectFileDialog : public QDialog
|
|||
public:
|
||||
ProjectFileDialog(const QString &path, QWidget *parent = 0);
|
||||
|
||||
/**
|
||||
* @brief Return project root path from the dialog control.
|
||||
* @return Project root path.
|
||||
*/
|
||||
QString GetRootPath() const;
|
||||
|
||||
/**
|
||||
* @brief Return include paths from the dialog control.
|
||||
* @return List of include paths.
|
||||
|
@ -57,6 +64,12 @@ public:
|
|||
*/
|
||||
QStringList GetPaths() const;
|
||||
|
||||
/**
|
||||
* @brief Set project root path to dialog control.
|
||||
* @param root Project root path to set to dialog control.
|
||||
*/
|
||||
void SetRootPath(const QString &root);
|
||||
|
||||
/**
|
||||
* @brief Set include paths to dialog control.
|
||||
* @param includes List of include paths to set to dialog control.
|
||||
|
|
Loading…
Reference in New Issue