From 4f452d5815e14043f3c0977673bf338491032520 Mon Sep 17 00:00:00 2001 From: Jan Dalheimer Date: Sat, 15 Mar 2014 14:18:29 +0100 Subject: Add a timer for clicking away the notification dialog --- gui/MainWindow.cpp | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) (limited to 'gui/MainWindow.cpp') diff --git a/gui/MainWindow.cpp b/gui/MainWindow.cpp index 17d4630b..65db066b 100644 --- a/gui/MainWindow.cpp +++ b/gui/MainWindow.cpp @@ -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); } -- cgit v1.2.3