GUI: Add clear log context menu entry (#1012)
* GUI: Add clear log context menu entry Add custom context menu to analysis log with an entry to clear the log. * Fix: Made string translatable
This commit is contained in:
parent
026d8f6859
commit
36ebf165c8
|
@ -28,6 +28,7 @@
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QDate>
|
#include <QDate>
|
||||||
|
#include <QMenu>
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "erroritem.h"
|
#include "erroritem.h"
|
||||||
#include "resultsview.h"
|
#include "resultsview.h"
|
||||||
|
@ -59,6 +60,8 @@ ResultsView::ResultsView(QWidget * parent) :
|
||||||
connect(this, &ResultsView::collapseAllResults, mUI.mTree, &ResultsTree::collapseAll);
|
connect(this, &ResultsView::collapseAllResults, mUI.mTree, &ResultsTree::collapseAll);
|
||||||
connect(this, &ResultsView::expandAllResults, mUI.mTree, &ResultsTree::expandAll);
|
connect(this, &ResultsView::expandAllResults, mUI.mTree, &ResultsTree::expandAll);
|
||||||
connect(this, &ResultsView::showHiddenResults, mUI.mTree, &ResultsTree::showHiddenResults);
|
connect(this, &ResultsView::showHiddenResults, mUI.mTree, &ResultsTree::showHiddenResults);
|
||||||
|
|
||||||
|
mUI.mListLog->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResultsView::initialize(QSettings *settings, ApplicationList *list, ThreadHandler *checkThreadHandler)
|
void ResultsView::initialize(QSettings *settings, ApplicationList *list, ThreadHandler *checkThreadHandler)
|
||||||
|
@ -402,3 +405,18 @@ void ResultsView::debugError(const ErrorItem &item)
|
||||||
{
|
{
|
||||||
mUI.mListLog->addItem(item.ToString());
|
mUI.mListLog->addItem(item.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ResultsView::log_clear()
|
||||||
|
{
|
||||||
|
mUI.mListLog->clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ResultsView::on_mListLog_customContextMenuRequested(const QPoint &pos)
|
||||||
|
{
|
||||||
|
QPoint globalPos = mUI.mListLog->mapToGlobal(pos);
|
||||||
|
|
||||||
|
QMenu contextMenu;
|
||||||
|
contextMenu.addAction(tr("Clear Log"), this, SLOT(log_clear()));
|
||||||
|
|
||||||
|
contextMenu.exec(globalPos);
|
||||||
|
}
|
||||||
|
|
|
@ -311,6 +311,11 @@ public slots:
|
||||||
*/
|
*/
|
||||||
void debugError(const ErrorItem &item);
|
void debugError(const ErrorItem &item);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Clear log messages
|
||||||
|
*/
|
||||||
|
void log_clear();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* @brief Should we show a "No errors found dialog" every time no errors were found?
|
* @brief Should we show a "No errors found dialog" every time no errors were found?
|
||||||
|
@ -320,6 +325,12 @@ protected:
|
||||||
Ui::ResultsView mUI;
|
Ui::ResultsView mUI;
|
||||||
|
|
||||||
CheckStatistics *mStatistics;
|
CheckStatistics *mStatistics;
|
||||||
|
private slots:
|
||||||
|
/**
|
||||||
|
* @brief Custom context menu for Analysis Log
|
||||||
|
* @param pos Mouse click position
|
||||||
|
*/
|
||||||
|
void on_mListLog_customContextMenuRequested(const QPoint &pos);
|
||||||
};
|
};
|
||||||
/// @}
|
/// @}
|
||||||
#endif // RESULTSVIEW_H
|
#endif // RESULTSVIEW_H
|
||||||
|
|
Loading…
Reference in New Issue