Skip to content
This repository was archived by the owner on Jun 21, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ else()

find_package(KF6XmlGui QUIET)
if(KF6XmlGui_FOUND)
find_package(KF6CoreAddons QUIET REQUIRED)
add_definitions( -DKXMLGUI )
else()
message(WARNING "KF6XmlGui not found, some UI elements and global shortcuts will not work")
Expand Down Expand Up @@ -115,17 +116,29 @@ add_executable(discord-screenaudio ${discord-screenaudio_SRC})

target_link_libraries(discord-screenaudio Qt::Widgets Qt::WebEngineWidgets rohrkabel)

if(KF5Notifications_FOUND OR KF6Notifications_FOUND)
if(KF5Notifications_FOUND)
target_link_libraries(discord-screenaudio KF5::Notifications)
install(FILES assets/discord-screenaudio.notifyrc DESTINATION ${CMAKE_INSTALL_PREFIX}/share/knotifications5)
endif()
if(KF5XmlGui_FOUND OR KF6XmlGui_FOUND)
if(KF5XmlGui_FOUND)
target_link_libraries(discord-screenaudio KF5::XmlGui)
endif()
if(KF5GlobalAccel_FOUND OR KF6GlobalAccel_FOUND)
if(KF5GlobalAccel_FOUND)
target_link_libraries(discord-screenaudio KF5::GlobalAccel)
endif()

if(KF6Notifications_FOUND)
target_link_libraries(discord-screenaudio KF6::Notifications)
install(FILES assets/discord-screenaudio.notifyrc DESTINATION ${CMAKE_INSTALL_PREFIX}/share/knotifications6)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use KDEInstallDirs?

endif()
if(KF6XmlGui_FOUND)
target_link_libraries(discord-screenaudio KF6::CoreAddons)
target_link_libraries(discord-screenaudio KF6::XmlGui)
endif()
if(KF6GlobalAccel_FOUND)
target_link_libraries(discord-screenaudio KF6::GlobalAccel)
endif()

install(TARGETS discord-screenaudio DESTINATION bin)
install(FILES assets/de.shorsh.discord-screenaudio.png DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/256x256/apps)
install(PROGRAMS assets/de.shorsh.discord-screenaudio.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)
Expand Down
4 changes: 2 additions & 2 deletions src/centralwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ void CentralWidget::setupWebView() {
notification->setText(notificationInfo->message());
notification->setPixmap(
QPixmap::fromImage(notificationInfo->icon()));
notification->setDefaultAction("View");
connect(notification, &KNotification::defaultActivated,
notification->addDefaultAction("View");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This gives a warning since it's nodiscard, is there a way I can use the result of this method instead of &KNotification::defaultActivated? I don't know how to cpp 😛

connect(notification, &KNotification::defaultAction,
[&, notificationInfo = std::move(notificationInfo)]() {
notificationInfo->click();
show();
Expand Down
2 changes: 1 addition & 1 deletion src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ MainWindow::MainWindow(bool useNotifySend, QWidget *parent)
setCentralWidget(m_centralWidget);
setupTrayIcon();
setMinimumSize(800, 300);
connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this),
connect(new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this),
&QShortcut::activated, this, &MainWindow::toggleOrCloseWindow);
if (m_settings->contains("geometry")) {
restoreGeometry(m_settings->value("geometry").toByteArray());
Expand Down