Core: Allow to globally unsuppress an info

Change-Id: Ie7af913e28a323e4ad391a35cfd65abd084cfd99
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Nikolai Kosjar
2016-10-11 13:08:24 +02:00
parent b5023bda5a
commit cb24872f43
2 changed files with 19 additions and 4 deletions

View File

@@ -139,10 +139,13 @@ void InfoBar::clear()
void InfoBar::globallySuppressInfo(Id id) void InfoBar::globallySuppressInfo(Id id)
{ {
globallySuppressed.insert(id); globallySuppressed.insert(id);
QStringList list; writeGloballySuppressedToSettings();
foreach (Id i, globallySuppressed) }
list << QLatin1String(i.name());
ICore::settings()->setValue(QLatin1String(C_SUPPRESSED_WARNINGS), list); void InfoBar::globallyUnsuppressInfo(Id id)
{
globallySuppressed.remove(id);
writeGloballySuppressedToSettings();
} }
void InfoBar::initializeGloballySuppressed() void InfoBar::initializeGloballySuppressed()
@@ -163,6 +166,14 @@ bool InfoBar::anyGloballySuppressed()
return !globallySuppressed.isEmpty(); return !globallySuppressed.isEmpty();
} }
void InfoBar::writeGloballySuppressedToSettings()
{
QStringList list;
foreach (Id i, globallySuppressed)
list << QLatin1String(i.name());
ICore::settings()->setValue(QLatin1String(C_SUPPRESSED_WARNINGS), list);
}
InfoBarDisplay::InfoBarDisplay(QObject *parent) InfoBarDisplay::InfoBarDisplay(QObject *parent)
: QObject(parent) : QObject(parent)

View File

@@ -92,6 +92,7 @@ public:
void enableInfo(Id id); void enableInfo(Id id);
void clear(); void clear();
static void globallySuppressInfo(Id id); static void globallySuppressInfo(Id id);
static void globallyUnsuppressInfo(Id id);
static void initializeGloballySuppressed(); static void initializeGloballySuppressed();
static void clearGloballySuppressed(); static void clearGloballySuppressed();
static bool anyGloballySuppressed(); static bool anyGloballySuppressed();
@@ -99,6 +100,9 @@ public:
signals: signals:
void changed(); void changed();
private:
static void writeGloballySuppressedToSettings();
private: private:
QList<InfoBarEntry> m_infoBarEntries; QList<InfoBarEntry> m_infoBarEntries;
QSet<Id> m_suppressed; QSet<Id> m_suppressed;