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()
|
void Project::Edit()
|
||||||
{
|
{
|
||||||
ProjectFileDialog dlg(mFilename, mParentWidget);
|
ProjectFileDialog dlg(mFilename, mParentWidget);
|
||||||
|
QString root = mPFile->GetRootPath();
|
||||||
|
dlg.SetRootPath(root);
|
||||||
QStringList includes = mPFile->GetIncludeDirs();
|
QStringList includes = mPFile->GetIncludeDirs();
|
||||||
dlg.SetIncludepaths(includes);
|
dlg.SetIncludepaths(includes);
|
||||||
QStringList defines = mPFile->GetDefines();
|
QStringList defines = mPFile->GetDefines();
|
||||||
|
@ -87,6 +88,8 @@ void Project::Edit()
|
||||||
int rv = dlg.exec();
|
int rv = dlg.exec();
|
||||||
if (rv == QDialog::Accepted)
|
if (rv == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
|
QString root = dlg.GetRootPath();
|
||||||
|
mPFile->SetRootPath(root);
|
||||||
QStringList includes = dlg.GetIncludePaths();
|
QStringList includes = dlg.GetIncludePaths();
|
||||||
mPFile->SetIncludes(includes);
|
mPFile->SetIncludes(includes);
|
||||||
QStringList defines = dlg.GetDefines();
|
QStringList defines = dlg.GetDefines();
|
||||||
|
|
|
@ -7,13 +7,30 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>400</width>
|
||||||
<height>112</height>
|
<height>131</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<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_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>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
|
@ -91,6 +108,7 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
|
<tabstop>mEditProjectRoot</tabstop>
|
||||||
<tabstop>mEditPaths</tabstop>
|
<tabstop>mEditPaths</tabstop>
|
||||||
<tabstop>mEditIncludePaths</tabstop>
|
<tabstop>mEditIncludePaths</tabstop>
|
||||||
<tabstop>mEditDefines</tabstop>
|
<tabstop>mEditDefines</tabstop>
|
||||||
|
|
|
@ -33,6 +33,13 @@ ProjectFileDialog::ProjectFileDialog(const QString &path, QWidget *parent)
|
||||||
connect(mUI.mButtons, SIGNAL(accepted()), this, SLOT(accept()));
|
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
|
QStringList ProjectFileDialog::GetIncludePaths() const
|
||||||
{
|
{
|
||||||
QString include = mUI.mEditIncludePaths->text();
|
QString include = mUI.mEditIncludePaths->text();
|
||||||
|
@ -78,6 +85,11 @@ QStringList ProjectFileDialog::GetPaths() const
|
||||||
return paths;
|
return paths;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ProjectFileDialog::SetRootPath(const QString &root)
|
||||||
|
{
|
||||||
|
mUI.mEditProjectRoot->setText(root);
|
||||||
|
}
|
||||||
|
|
||||||
void ProjectFileDialog::SetIncludepaths(const QStringList &includes)
|
void ProjectFileDialog::SetIncludepaths(const QStringList &includes)
|
||||||
{
|
{
|
||||||
QString includestr;
|
QString includestr;
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <QStringList>
|
||||||
|
|
||||||
#include "ui_projectfile.h"
|
#include "ui_projectfile.h"
|
||||||
|
|
||||||
|
@ -39,6 +40,12 @@ class ProjectFileDialog : public QDialog
|
||||||
public:
|
public:
|
||||||
ProjectFileDialog(const QString &path, QWidget *parent = 0);
|
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.
|
* @brief Return include paths from the dialog control.
|
||||||
* @return List of include paths.
|
* @return List of include paths.
|
||||||
|
@ -57,6 +64,12 @@ public:
|
||||||
*/
|
*/
|
||||||
QStringList GetPaths() const;
|
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.
|
* @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.
|
||||||
|
|
Loading…
Reference in New Issue