GUI: Add buttons to add new paths to ProjectFile dialog.
This commit is contained in:
parent
ba7a3b376e
commit
abf0a2ea52
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>131</height>
|
||||
<height>159</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -46,6 +46,13 @@
|
|||
<item>
|
||||
<widget class="QLineEdit" name="mEditPaths"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="mBtnBrowsePaths">
|
||||
<property name="text">
|
||||
<string>Browse...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -63,6 +70,13 @@
|
|||
<item>
|
||||
<widget class="QLineEdit" name="mEditIncludePaths"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="mBtnBrowseIncludes">
|
||||
<property name="text">
|
||||
<string>Browse...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -110,7 +124,9 @@
|
|||
<tabstops>
|
||||
<tabstop>mEditProjectRoot</tabstop>
|
||||
<tabstop>mEditPaths</tabstop>
|
||||
<tabstop>mBtnBrowsePaths</tabstop>
|
||||
<tabstop>mEditIncludePaths</tabstop>
|
||||
<tabstop>mBtnBrowseIncludes</tabstop>
|
||||
<tabstop>mEditDefines</tabstop>
|
||||
<tabstop>mButtons</tabstop>
|
||||
</tabstops>
|
||||
|
@ -123,12 +139,12 @@
|
|||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
<x>257</x>
|
||||
<y>148</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
<y>158</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
|
@ -139,12 +155,12 @@
|
|||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
<x>325</x>
|
||||
<y>148</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
<y>158</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QFileInfo>
|
||||
#include <QFileDialog>
|
||||
#include <QLineEdit>
|
||||
#include "projectfiledialog.h"
|
||||
|
||||
ProjectFileDialog::ProjectFileDialog(const QString &path, QWidget *parent)
|
||||
|
@ -34,6 +36,8 @@ ProjectFileDialog::ProjectFileDialog(const QString &path, QWidget *parent)
|
|||
setWindowTitle(title);
|
||||
|
||||
connect(mUI.mButtons, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
connect(mUI.mBtnBrowseIncludes, SIGNAL(clicked()), this, SLOT(BrowseIncludes()));
|
||||
connect(mUI.mBtnBrowsePaths, SIGNAL(clicked()), this, SLOT(BrowsePaths()));
|
||||
}
|
||||
|
||||
QString ProjectFileDialog::GetRootPath() const
|
||||
|
@ -137,3 +141,35 @@ void ProjectFileDialog::SetPaths(const QStringList &paths)
|
|||
pathstr = pathstr.left(pathstr.length() - 1);
|
||||
mUI.mEditPaths->setText(pathstr);
|
||||
}
|
||||
|
||||
void ProjectFileDialog::BrowseIncludes()
|
||||
{
|
||||
QString selectedDir = QFileDialog::getExistingDirectory(this,
|
||||
tr("Select include directory"),
|
||||
QString());
|
||||
|
||||
if (!selectedDir.isEmpty())
|
||||
{
|
||||
AppendDirname(mUI.mEditIncludePaths, selectedDir);
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectFileDialog::BrowsePaths()
|
||||
{
|
||||
QString selectedDir = QFileDialog::getExistingDirectory(this,
|
||||
tr("Select directory to check"),
|
||||
QString());
|
||||
|
||||
if (!selectedDir.isEmpty())
|
||||
{
|
||||
AppendDirname(mUI.mEditPaths, selectedDir);
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectFileDialog::AppendDirname(QLineEdit *edit, const QString &dir)
|
||||
{
|
||||
QString wholeText = edit->text();
|
||||
wholeText += ";";
|
||||
wholeText += dir;
|
||||
edit->setText(wholeText);
|
||||
}
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
#include "ui_projectfile.h"
|
||||
|
||||
class ProjectFile;
|
||||
class QWidget;
|
||||
class QLineEdit;
|
||||
|
||||
/// @addtogroup GUI
|
||||
/// @{
|
||||
|
@ -88,6 +90,26 @@ public:
|
|||
*/
|
||||
void SetPaths(const QStringList &paths);
|
||||
|
||||
protected slots:
|
||||
/**
|
||||
* @brief Browse for include directory.
|
||||
* Allow user to choose new include directory.
|
||||
*/
|
||||
void BrowseIncludes();
|
||||
/**
|
||||
* @brief Browse for checked directory.
|
||||
* Allow user to choose new checked directory.
|
||||
*/
|
||||
void BrowsePaths();
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @brief Append new path to the edit control.
|
||||
* @param edit Edit control to modify.
|
||||
* @param dir Path to add.
|
||||
*/
|
||||
void AppendDirname(QLineEdit *edit, const QString &dir);
|
||||
|
||||
private:
|
||||
Ui::ProjectFile mUI;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue