alert function from application on critical messages

This commit is contained in:
Niklas 2019-05-13 19:28:44 +02:00
parent d64e710c54
commit 8c1bf5bc04

View File

@ -3,6 +3,7 @@
#include "mainwindow.hpp" #include "mainwindow.hpp"
#include "ui_mainwindow.h" #include "ui_mainwindow.h"
#include <QStatusBar> #include <QStatusBar>
#include <QApplication>
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
#undef signals #undef signals
@ -26,6 +27,11 @@ void notifications::notify(QString title, QString body, QSystemTrayIcon::Message
} }
void notifications::notifyNolog(QString title, QString body, QSystemTrayIcon::MessageIcon icon) { void notifications::notifyNolog(QString title, QString body, QSystemTrayIcon::MessageIcon icon) {
if(icon == QSystemTrayIcon::Critical) {
QApplication::alert(MainWindow::inst());
}
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
NotifyNotification *n = notify_notification_new(title.toLocal8Bit(), body.toLocal8Bit(), 0); NotifyNotification *n = notify_notification_new(title.toLocal8Bit(), body.toLocal8Bit(), 0);
notify_notification_set_timeout(n, 5000); notify_notification_set_timeout(n, 5000);