forked from qt-creator/qt-creator
InfoBar: Introduce suppression support
This facilitates a consistent mechanism for not repeating messages Change-Id: I5a766f104d7da8b3f5000c9814b5e4aff335a764 Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
e763eec4ad
commit
aa0dc33d32
@@ -98,6 +98,24 @@ bool InfoBar::containsInfo(Id id) const
|
||||
return false;
|
||||
}
|
||||
|
||||
// Remove and suppress id
|
||||
void InfoBar::suppressInfo(Id id)
|
||||
{
|
||||
removeInfo(id);
|
||||
m_suppressed << id;
|
||||
}
|
||||
|
||||
// Info can not be added more than once, or if it is suppressed
|
||||
bool InfoBar::canInfoBeAdded(Id id) const
|
||||
{
|
||||
return !containsInfo(id) && !m_suppressed.contains(id);
|
||||
}
|
||||
|
||||
void InfoBar::enableInfo(Id id)
|
||||
{
|
||||
m_suppressed.remove(id);
|
||||
}
|
||||
|
||||
void InfoBar::clear()
|
||||
{
|
||||
if (!m_infoBarEntries.isEmpty()) {
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <coreplugin/id.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QSet>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QBoxLayout;
|
||||
@@ -74,6 +75,9 @@ public:
|
||||
void addInfo(const InfoBarEntry &info);
|
||||
void removeInfo(Id id);
|
||||
bool containsInfo(Id id) const;
|
||||
void suppressInfo(Id id);
|
||||
bool canInfoBeAdded(Id id) const;
|
||||
void enableInfo(Id id);
|
||||
void clear();
|
||||
|
||||
signals:
|
||||
@@ -81,6 +85,7 @@ signals:
|
||||
|
||||
private:
|
||||
QList<InfoBarEntry> m_infoBarEntries;
|
||||
QSet<Id> m_suppressed;
|
||||
friend class InfoBarDisplay;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user