GUI: Add button in ProjectFileDialog to exclude a file
This commit is contained in:
parent
744b363186
commit
23008e7bc0
|
@ -199,6 +199,7 @@ ProjectFileDialog::ProjectFileDialog(ProjectFile *projectFile, QWidget *parent)
|
||||||
connect(mUI.mBtnEditInclude, &QPushButton::clicked, this, &ProjectFileDialog::editIncludeDir);
|
connect(mUI.mBtnEditInclude, &QPushButton::clicked, this, &ProjectFileDialog::editIncludeDir);
|
||||||
connect(mUI.mBtnRemoveInclude, &QPushButton::clicked, this, &ProjectFileDialog::removeIncludeDir);
|
connect(mUI.mBtnRemoveInclude, &QPushButton::clicked, this, &ProjectFileDialog::removeIncludeDir);
|
||||||
connect(mUI.mBtnAddIgnorePath, SIGNAL(clicked()), this, SLOT(addExcludePath()));
|
connect(mUI.mBtnAddIgnorePath, SIGNAL(clicked()), this, SLOT(addExcludePath()));
|
||||||
|
connect(mUI.mBtnAddIgnoreFile, SIGNAL(clicked()), this, SLOT(addExcludeFile()));
|
||||||
connect(mUI.mBtnEditIgnorePath, &QPushButton::clicked, this, &ProjectFileDialog::editExcludePath);
|
connect(mUI.mBtnEditIgnorePath, &QPushButton::clicked, this, &ProjectFileDialog::editExcludePath);
|
||||||
connect(mUI.mBtnRemoveIgnorePath, &QPushButton::clicked, this, &ProjectFileDialog::removeExcludePath);
|
connect(mUI.mBtnRemoveIgnorePath, &QPushButton::clicked, this, &ProjectFileDialog::removeExcludePath);
|
||||||
connect(mUI.mBtnIncludeUp, &QPushButton::clicked, this, &ProjectFileDialog::moveIncludePathUp);
|
connect(mUI.mBtnIncludeUp, &QPushButton::clicked, this, &ProjectFileDialog::moveIncludePathUp);
|
||||||
|
@ -718,9 +719,17 @@ void ProjectFileDialog::editIncludeDir()
|
||||||
|
|
||||||
void ProjectFileDialog::addExcludePath()
|
void ProjectFileDialog::addExcludePath()
|
||||||
{
|
{
|
||||||
QString dir = getExistingDirectory(tr("Select directory to ignore"), true);
|
addExcludePath(getExistingDirectory(tr("Select directory to ignore"), true));
|
||||||
if (!dir.isEmpty())
|
}
|
||||||
addExcludePath(dir);
|
|
||||||
|
void ProjectFileDialog::addExcludeFile()
|
||||||
|
{
|
||||||
|
const QFileInfo inf(mProjectFile->getFilename());
|
||||||
|
const QDir &dir = inf.absoluteDir();
|
||||||
|
QMap<QString,QString> filters;
|
||||||
|
filters[tr("Source files")] = "*.c *.cpp";
|
||||||
|
filters[tr("All files")] = "*.*";
|
||||||
|
addExcludePath(QFileDialog::getOpenFileName(this, tr("Exclude file"), dir.canonicalPath(), toFilterString(filters)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectFileDialog::editExcludePath()
|
void ProjectFileDialog::editExcludePath()
|
||||||
|
@ -803,7 +812,10 @@ int ProjectFileDialog::getSuppressionIndex(const QString &shortText) const
|
||||||
|
|
||||||
void ProjectFileDialog::browseMisraFile()
|
void ProjectFileDialog::browseMisraFile()
|
||||||
{
|
{
|
||||||
const QString fileName = QFileDialog::getOpenFileName(this, tr("Select MISRA rule texts file"), QDir::homePath(), tr("Misra rule texts file (%1)").arg("*.txt"));
|
const QString fileName = QFileDialog::getOpenFileName(this,
|
||||||
|
tr("Select MISRA rule texts file"),
|
||||||
|
QDir::homePath(),
|
||||||
|
tr("Misra rule texts file (%1)").arg("*.txt"));
|
||||||
if (!fileName.isEmpty()) {
|
if (!fileName.isEmpty()) {
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
mUI.mEditMisraFile->setText(fileName);
|
mUI.mEditMisraFile->setText(fileName);
|
||||||
|
|
|
@ -215,10 +215,15 @@ protected slots:
|
||||||
void editIncludeDir();
|
void editIncludeDir();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Add new path to exclude.
|
* @brief Add new path to exclude list.
|
||||||
*/
|
*/
|
||||||
void addExcludePath();
|
void addExcludePath();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Add new file to exclude list.
|
||||||
|
*/
|
||||||
|
void addExcludeFile();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Edit excluded path in the list.
|
* @brief Edit excluded path in the list.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -661,7 +661,14 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="mBtnAddIgnorePath">
|
<widget class="QPushButton" name="mBtnAddIgnorePath">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Add...</string>
|
<string>Add folder...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="mBtnAddIgnoreFile">
|
||||||
|
<property name="text">
|
||||||
|
<string>Add file...</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
Loading…
Reference in New Issue