GUI: Refactor tags
This commit is contained in:
parent
0632f86449
commit
b249d9be31
|
@ -1524,8 +1524,6 @@ QString MainWindow::getLastResults() const
|
||||||
|
|
||||||
bool MainWindow::loadLastResults()
|
bool MainWindow::loadLastResults()
|
||||||
{
|
{
|
||||||
if (mProjectFile)
|
|
||||||
mUI.mResults->setTags(mProjectFile->getTags());
|
|
||||||
const QString &lastResults = getLastResults();
|
const QString &lastResults = getLastResults();
|
||||||
if (lastResults.isEmpty())
|
if (lastResults.isEmpty())
|
||||||
return false;
|
return false;
|
||||||
|
@ -1548,7 +1546,6 @@ void MainWindow::analyzeProject(const ProjectFile *projectFile, const bool check
|
||||||
QDir::setCurrent(inf.absolutePath());
|
QDir::setCurrent(inf.absolutePath());
|
||||||
|
|
||||||
mThread->setAddonsAndTools(projectFile->getAddonsAndTools());
|
mThread->setAddonsAndTools(projectFile->getAddonsAndTools());
|
||||||
mUI.mResults->setTags(projectFile->getTags());
|
|
||||||
|
|
||||||
// If the root path is not given or is not "current dir", use project
|
// If the root path is not given or is not "current dir", use project
|
||||||
// file's location directory as root path
|
// file's location directory as root path
|
||||||
|
@ -1652,7 +1649,6 @@ void MainWindow::closeProjectFile()
|
||||||
delete mProjectFile;
|
delete mProjectFile;
|
||||||
mProjectFile = nullptr;
|
mProjectFile = nullptr;
|
||||||
mUI.mResults->clear(true);
|
mUI.mResults->clear(true);
|
||||||
mUI.mResults->setTags(QStringList());
|
|
||||||
enableProjectActions(false);
|
enableProjectActions(false);
|
||||||
enableProjectOpenActions(true);
|
enableProjectOpenActions(true);
|
||||||
formatAndSetTitle();
|
formatAndSetTitle();
|
||||||
|
|
|
@ -50,8 +50,8 @@
|
||||||
#include "xmlreportv2.h"
|
#include "xmlreportv2.h"
|
||||||
|
|
||||||
// These must match column headers given in ResultsTree::translate()
|
// These must match column headers given in ResultsTree::translate()
|
||||||
static const unsigned int COLUMN_SINCE_DATE = 6;
|
static const int COLUMN_SINCE_DATE = 6;
|
||||||
static const unsigned int COLUMN_TAGS = 7;
|
static const int COLUMN_TAGS = 7;
|
||||||
|
|
||||||
static QString getFunction(QStandardItem *item)
|
static QString getFunction(QStandardItem *item)
|
||||||
{
|
{
|
||||||
|
@ -673,7 +673,8 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e)
|
||||||
connect(suppressCppcheckID, &QAction::triggered, this, &ResultsTree::suppressCppcheckID);
|
connect(suppressCppcheckID, &QAction::triggered, this, &ResultsTree::suppressCppcheckID);
|
||||||
connect(opencontainingfolder, SIGNAL(triggered()), this, SLOT(openContainingFolder()));
|
connect(opencontainingfolder, SIGNAL(triggered()), this, SLOT(openContainingFolder()));
|
||||||
|
|
||||||
if (!mTags.isEmpty()) {
|
const ProjectFile *currentProject = ProjectFile::getActiveProject();
|
||||||
|
if (currentProject && !currentProject->getTags().isEmpty()) {
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
QMenu *tagMenu = menu.addMenu(tr("Tag"));
|
QMenu *tagMenu = menu.addMenu(tr("Tag"));
|
||||||
{
|
{
|
||||||
|
@ -684,7 +685,7 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (const QString tagstr, mTags) {
|
foreach (const QString tagstr, currentProject->getTags()) {
|
||||||
QAction *action = new QAction(tagstr, tagMenu);
|
QAction *action = new QAction(tagstr, tagMenu);
|
||||||
tagMenu->addAction(action);
|
tagMenu->addAction(action);
|
||||||
connect(action, &QAction::triggered, [=]() {
|
connect(action, &QAction::triggered, [=]() {
|
||||||
|
|
|
@ -52,10 +52,6 @@ public:
|
||||||
virtual ~ResultsTree();
|
virtual ~ResultsTree();
|
||||||
void initialize(QSettings *settings, ApplicationList *list, ThreadHandler *checkThreadHandler);
|
void initialize(QSettings *settings, ApplicationList *list, ThreadHandler *checkThreadHandler);
|
||||||
|
|
||||||
void setTags(const QStringList &tags) {
|
|
||||||
mTags = tags;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Add a new item to the tree
|
* @brief Add a new item to the tree
|
||||||
*
|
*
|
||||||
|
@ -532,8 +528,6 @@ private:
|
||||||
/** @brief Convert GUI error item into data error item */
|
/** @brief Convert GUI error item into data error item */
|
||||||
void readErrorItem(const QStandardItem *error, ErrorItem *item) const;
|
void readErrorItem(const QStandardItem *error, ErrorItem *item) const;
|
||||||
|
|
||||||
QStringList mTags;
|
|
||||||
|
|
||||||
QStringList mHiddenMessageId;
|
QStringList mHiddenMessageId;
|
||||||
|
|
||||||
QItemSelectionModel *mSelectionModel;
|
QItemSelectionModel *mSelectionModel;
|
||||||
|
|
|
@ -50,10 +50,6 @@ public:
|
||||||
virtual ~ResultsView();
|
virtual ~ResultsView();
|
||||||
ResultsView &operator=(const ResultsView &) = delete;
|
ResultsView &operator=(const ResultsView &) = delete;
|
||||||
|
|
||||||
void setTags(const QStringList &tags) {
|
|
||||||
mUI.mTree->setTags(tags);
|
|
||||||
}
|
|
||||||
|
|
||||||
void setAddedContracts(const QStringList &addedContracts);
|
void setAddedContracts(const QStringList &addedContracts);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue