make KF5Notifications optional

This commit is contained in:
Malte Jürgens
2022-07-29 16:31:04 +02:00
parent ef221d4574
commit d68797cebb
2 changed files with 16 additions and 3 deletions

View File

@@ -1,7 +1,10 @@
#include "mainwindow.h"
#include "virtmic.h"
#ifdef KF5NOTIFICATIONS
#include <KNotification>
#endif
#include <QApplication>
#include <QColor>
#include <QComboBox>
@@ -33,6 +36,7 @@ void MainWindow::setupWebView() {
m_webView = new QWebEngineView(this);
m_webView->setPage(page);
#ifdef KF5NOTIFICATIONS
QWebEngineProfile::defaultProfile()->setNotificationPresenter(
[&](std::unique_ptr<QWebEngineNotification> notificationInfo) {
KNotification *notification = new KNotification("discordNotification");
@@ -47,6 +51,7 @@ void MainWindow::setupWebView() {
});
notification->sendEvent();
});
#endif
setCentralWidget(m_webView);
}