Fix visibility of information boxes in certain situations by introducing a blocking option

This commit is contained in:
Jan Käberich 2021-05-24 12:02:31 +02:00
parent 7d84e0fc68
commit 0efd31e8ce
5 changed files with 27 additions and 11 deletions

View file

@ -3,7 +3,7 @@
#include <QSettings>
#include <QDebug>
void InformationBox::ShowMessage(QString title, QString message, QString messageID)
void InformationBox::ShowMessage(QString title, QString message, QString messageID, bool block)
{
// check if the user still wants to see this message
unsigned int hash;
@ -16,10 +16,19 @@ void InformationBox::ShowMessage(QString title, QString message, QString message
QSettings s;
if(!s.contains(hashToSettingsKey(hash))) {
auto box = new InformationBox(title, message, QMessageBox::Information, hash, nullptr);
box->show();
if(block) {
box->exec();
} else {
box->show();
}
}
}
void InformationBox::ShowMessageBlocking(QString title, QString message, QString messageID)
{
ShowMessage(title, message, messageID, true);
}
void InformationBox::ShowError(QString title, QString message)
{
auto box = new InformationBox(title, message, QMessageBox::Information, 0, nullptr);