Commit aa0dc33d authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh
Browse files

InfoBar: Introduce suppression support



This facilitates a consistent mechanism for not repeating messages

Change-Id: I5a766f104d7da8b3f5000c9814b5e4aff335a764
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent e763eec4
......@@ -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;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment