Fixed #1861 (GUI: Allow hiding error)
This commit is contained in:
parent
bb745da5f9
commit
a16c0dbd5e
|
@ -66,7 +66,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>640</width>
|
<width>640</width>
|
||||||
<height>21</height>
|
<height>25</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="mMenuFile">
|
<widget class="QMenu" name="mMenuFile">
|
||||||
|
@ -106,6 +106,8 @@
|
||||||
<addaction name="mActionCollapseAll"/>
|
<addaction name="mActionCollapseAll"/>
|
||||||
<addaction name="mActionExpandAll"/>
|
<addaction name="mActionExpandAll"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
|
<addaction name="mActionShowHidden"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
<addaction name="mActionViewLog"/>
|
<addaction name="mActionViewLog"/>
|
||||||
<addaction name="mActionViewStats"/>
|
<addaction name="mActionViewStats"/>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -461,6 +463,11 @@
|
||||||
<string>Show performance warnings</string>
|
<string>Show performance warnings</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="mActionShowHidden">
|
||||||
|
<property name="text">
|
||||||
|
<string>Show &hidden</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
|
|
|
@ -69,6 +69,7 @@ MainWindow::MainWindow() :
|
||||||
connect(mUI.mActionUncheckAll, SIGNAL(triggered()), this, SLOT(UncheckAll()));
|
connect(mUI.mActionUncheckAll, SIGNAL(triggered()), this, SLOT(UncheckAll()));
|
||||||
connect(mUI.mActionCollapseAll, SIGNAL(triggered()), mUI.mResults, SLOT(CollapseAllResults()));
|
connect(mUI.mActionCollapseAll, SIGNAL(triggered()), mUI.mResults, SLOT(CollapseAllResults()));
|
||||||
connect(mUI.mActionExpandAll, SIGNAL(triggered()), mUI.mResults, SLOT(ExpandAllResults()));
|
connect(mUI.mActionExpandAll, SIGNAL(triggered()), mUI.mResults, SLOT(ExpandAllResults()));
|
||||||
|
connect(mUI.mActionShowHidden, SIGNAL(triggered()), mUI.mResults, SLOT(ShowHiddenResults()));
|
||||||
connect(mUI.mActionViewLog, SIGNAL(triggered()), this, SLOT(ShowLogView()));
|
connect(mUI.mActionViewLog, SIGNAL(triggered()), this, SLOT(ShowLogView()));
|
||||||
connect(mUI.mActionViewStats, SIGNAL(triggered()), this, SLOT(ShowStatistics()));
|
connect(mUI.mActionViewStats, SIGNAL(triggered()), this, SLOT(ShowStatistics()));
|
||||||
|
|
||||||
|
|
|
@ -132,6 +132,7 @@ void ResultsTree::AddErrorItem(const ErrorItem &item)
|
||||||
|
|
||||||
//Add user data to that item
|
//Add user data to that item
|
||||||
QMap<QString, QVariant> data;
|
QMap<QString, QVariant> data;
|
||||||
|
data["hide"] = false;
|
||||||
data["severity"] = SeverityToShowType(item.severity);
|
data["severity"] = SeverityToShowType(item.severity);
|
||||||
data["summary"] = item.summary;
|
data["summary"] = item.summary;
|
||||||
data["message"] = item.message;
|
data["message"] = item.message;
|
||||||
|
@ -313,6 +314,35 @@ void ResultsTree::ShowResults(ShowTypes type, bool show)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ResultsTree::ShowHiddenResults()
|
||||||
|
{
|
||||||
|
//Clear the "hide" flag for each item
|
||||||
|
int filecount = mModel.rowCount();
|
||||||
|
for (int i = 0; i < filecount; i++)
|
||||||
|
{
|
||||||
|
QStandardItem *file = mModel.item(i, 0);
|
||||||
|
if (!file)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
QVariantMap data = file->data().toMap();
|
||||||
|
data["hide"] = false;
|
||||||
|
file->setData(QVariant(data));
|
||||||
|
|
||||||
|
int errorcount = file->rowCount();
|
||||||
|
for (int j = 0; j < errorcount; j++)
|
||||||
|
{
|
||||||
|
QStandardItem *child = file->child(j, 0);
|
||||||
|
if (child)
|
||||||
|
{
|
||||||
|
data = child->data().toMap();
|
||||||
|
data["hide"] = false;
|
||||||
|
child->setData(QVariant(data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RefreshTree();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void ResultsTree::RefreshTree()
|
void ResultsTree::RefreshTree()
|
||||||
{
|
{
|
||||||
|
@ -350,7 +380,7 @@ void ResultsTree::RefreshTree()
|
||||||
QVariantMap data = userdata.toMap();
|
QVariantMap data = userdata.toMap();
|
||||||
|
|
||||||
//Check if this error should be hidden
|
//Check if this error should be hidden
|
||||||
bool hide = !mShowTypes[VariantToShowType(data["severity"])];
|
bool hide = (data["hide"].toBool() || !mShowTypes[VariantToShowType(data["severity"])]);
|
||||||
|
|
||||||
if (!hide)
|
if (!hide)
|
||||||
{
|
{
|
||||||
|
@ -367,6 +397,12 @@ void ResultsTree::RefreshTree()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Hide the file if its "hide" attribute is set
|
||||||
|
if (file->data().toMap()["hide"].toBool())
|
||||||
|
{
|
||||||
|
show = false;
|
||||||
|
}
|
||||||
|
|
||||||
//Show the file if any of it's errors are visible
|
//Show the file if any of it's errors are visible
|
||||||
setRowHidden(i, QModelIndex(), !show);
|
setRowHidden(i, QModelIndex(), !show);
|
||||||
}
|
}
|
||||||
|
@ -463,14 +499,17 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e)
|
||||||
QAction *copyfilename = new QAction(tr("Copy filename"), &menu);
|
QAction *copyfilename = new QAction(tr("Copy filename"), &menu);
|
||||||
QAction *copypath = new QAction(tr("Copy full path"), &menu);
|
QAction *copypath = new QAction(tr("Copy full path"), &menu);
|
||||||
QAction *copymessage = new QAction(tr("Copy message"), &menu);
|
QAction *copymessage = new QAction(tr("Copy message"), &menu);
|
||||||
|
QAction *hide = new QAction(tr("Hide"), &menu);
|
||||||
|
|
||||||
menu.addAction(copyfilename);
|
menu.addAction(copyfilename);
|
||||||
menu.addAction(copypath);
|
menu.addAction(copypath);
|
||||||
menu.addAction(copymessage);
|
menu.addAction(copymessage);
|
||||||
|
menu.addAction(hide);
|
||||||
|
|
||||||
connect(copyfilename, SIGNAL(triggered()), this, SLOT(CopyFilename()));
|
connect(copyfilename, SIGNAL(triggered()), this, SLOT(CopyFilename()));
|
||||||
connect(copypath, SIGNAL(triggered()), this, SLOT(CopyFullPath()));
|
connect(copypath, SIGNAL(triggered()), this, SLOT(CopyFullPath()));
|
||||||
connect(copymessage, SIGNAL(triggered()), this, SLOT(CopyMessage()));
|
connect(copymessage, SIGNAL(triggered()), this, SLOT(CopyMessage()));
|
||||||
|
connect(hide, SIGNAL(triggered()), this, SLOT(HideResult()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Start the menu
|
//Start the menu
|
||||||
|
@ -621,6 +660,19 @@ void ResultsTree::CopyMessage()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ResultsTree::HideResult()
|
||||||
|
{
|
||||||
|
if (mContextItem)
|
||||||
|
{
|
||||||
|
//Set the "hide" flag for this item
|
||||||
|
QVariantMap data = mContextItem->data().toMap();
|
||||||
|
data["hide"] = true;
|
||||||
|
mContextItem->setData(QVariant(data));
|
||||||
|
|
||||||
|
RefreshTree();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ResultsTree::Context(int application)
|
void ResultsTree::Context(int application)
|
||||||
{
|
{
|
||||||
StartApplication(mContextItem, application);
|
StartApplication(mContextItem, application);
|
||||||
|
|
|
@ -71,6 +71,11 @@ public:
|
||||||
*/
|
*/
|
||||||
void ShowResults(ShowTypes type, bool show);
|
void ShowResults(ShowTypes type, bool show);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Function to show results that were previous hidden with HideResult()
|
||||||
|
*/
|
||||||
|
void ShowHiddenResults();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Save results to a text stream
|
* @brief Save results to a text stream
|
||||||
*
|
*
|
||||||
|
@ -150,6 +155,12 @@ protected slots:
|
||||||
*/
|
*/
|
||||||
void CopyMessage();
|
void CopyMessage();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Slot for context menu item to hide the current error message
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void HideResult();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -89,6 +89,11 @@ void ResultsView::ExpandAllResults()
|
||||||
mUI.mTree->expandAll();
|
mUI.mTree->expandAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ResultsView::ShowHiddenResults()
|
||||||
|
{
|
||||||
|
mUI.mTree->ShowHiddenResults();
|
||||||
|
}
|
||||||
|
|
||||||
void ResultsView::Save(const QString &filename, Report::Type type)
|
void ResultsView::Save(const QString &filename, Report::Type type)
|
||||||
{
|
{
|
||||||
if (!mErrorsFound)
|
if (!mErrorsFound)
|
||||||
|
|
|
@ -173,6 +173,11 @@ public slots:
|
||||||
*/
|
*/
|
||||||
void ExpandAllResults();
|
void ExpandAllResults();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Show hidden results in the result list.
|
||||||
|
*/
|
||||||
|
void ShowHiddenResults();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* @brief Have any errors been found
|
* @brief Have any errors been found
|
||||||
|
|
Loading…
Reference in New Issue