Add a timer for clicking away the notification dialog

This commit is contained in:
Jan Dalheimer
2014-03-15 14:18:29 +01:00
parent de2eb3fc54
commit 4f452d5815
5 changed files with 219 additions and 20 deletions

View File

@ -62,6 +62,7 @@
#include "gui/dialogs/UpdateDialog.h"
#include "gui/dialogs/EditAccountDialog.h"
#include "gui/dialogs/ScreenshotDialog.h"
#include "gui/dialogs/NotificationDialog.h"
#include "gui/ConsoleWindow.h"
@ -673,26 +674,8 @@ void MainWindow::notificationsChanged()
NotificationChecker::NotificationEntry entry = *it;
if (!shownNotifications.contains(entry.id) && entry.applies())
{
QMessageBox::Icon icon;
switch (entry.type)
{
case NotificationChecker::NotificationEntry::Critical:
icon = QMessageBox::Critical;
break;
case NotificationChecker::NotificationEntry::Warning:
icon = QMessageBox::Warning;
break;
case NotificationChecker::NotificationEntry::Information:
icon = QMessageBox::Information;
break;
}
QMessageBox box(icon, tr("Notification"), entry.message, QMessageBox::Close, this);
QPushButton *dontShowAgainButton =
box.addButton(tr("Don't show again"), QMessageBox::AcceptRole);
box.setDefaultButton(QMessageBox::Close);
box.exec();
if (box.clickedButton() == dontShowAgainButton)
NotificationDialog dialog(entry, this);
if (dialog.exec() == NotificationDialog::DontShowAgain)
{
shownNotifications.append(entry.id);
}