automatically detect if kf5notifications is installed
This commit is contained in:
parent
5f37ab314f
commit
753da8b1d3
|
@ -18,10 +18,9 @@ find_package(Qt5 CONFIG REQUIRED COMPONENTS
|
|||
WebEngineWidgets
|
||||
)
|
||||
|
||||
option(KF5NOTIFICATIONS "Use KF5Notifications for enhanced system notifications" ON)
|
||||
if(KF5NOTIFICATIONS)
|
||||
add_definitions( -DKF5NOTIFICATIONS )
|
||||
find_package(KF5Notifications)
|
||||
if(KF5Notifications_FOUND)
|
||||
add_definitions( -DKNOTIFICATIONS )
|
||||
endif()
|
||||
|
||||
set(discord-screenaudio_SRC
|
||||
|
@ -59,7 +58,7 @@ add_executable(discord-screenaudio ${discord-screenaudio_SRC})
|
|||
|
||||
target_link_libraries(discord-screenaudio Qt5::Widgets Qt5::WebEngineWidgets rohrkabel)
|
||||
|
||||
if(KF5NOTIFICATIONS)
|
||||
if(KF5Notifications_FOUND)
|
||||
target_link_libraries(discord-screenaudio KF5::Notifications)
|
||||
install(FILES assets/discord-screenaudio.notifyrc DESTINATION ${CMAKE_INSTALL_PREFIX}/share/knotifications5)
|
||||
endif()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "mainwindow.h"
|
||||
#include "virtmic.h"
|
||||
|
||||
#ifdef KF5NOTIFICATIONS
|
||||
#ifdef KNOTIFICATIONS
|
||||
#include <KNotification>
|
||||
#endif
|
||||
|
||||
|
@ -36,7 +36,7 @@ void MainWindow::setupWebView() {
|
|||
m_webView = new QWebEngineView(this);
|
||||
m_webView->setPage(page);
|
||||
|
||||
#ifdef KF5NOTIFICATIONS
|
||||
#ifdef KNOTIFICATIONS
|
||||
QWebEngineProfile::defaultProfile()->setNotificationPresenter(
|
||||
[&](std::unique_ptr<QWebEngineNotification> notificationInfo) {
|
||||
KNotification *notification = new KNotification("discordNotification");
|
||||
|
|
Loading…
Reference in New Issue