Improve D-Bus notifications handling

Make notifications clickable on Linux by assigning "default" action.
Don't react to unrelated notifications clicked by keeping track of qBittorrent notifications IDs and filter out unrelated ones.
Make D-Bus Notifications interface proxy class to be maintained manually and fix coding style in it.
Closes #9084.
PR #17282.
This commit is contained in:
Vladimir Golovnev
2022-06-30 08:01:17 +03:00
committed by GitHub
parent cc0a0b56ed
commit ac8a6887b6
11 changed files with 339 additions and 172 deletions

View File

@@ -72,6 +72,11 @@ namespace Ui
class MainWindow;
}
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)) && defined(QT_DBUS_LIB)
#define QBT_USES_CUSTOMDBUSNOTIFICATIONS
class DBusNotifier;
#endif
class MainWindow final : public QMainWindow, public GUIApplicationComponent
{
Q_OBJECT
@@ -266,8 +271,9 @@ private:
SettingValue<bool> m_storeNotificationTorrentAdded;
CachedSettingValue<Log::MsgTypes> m_storeExecutionLogTypes;
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)) && defined(QT_DBUS_LIB)
#ifdef QBT_USES_CUSTOMDBUSNOTIFICATIONS
SettingValue<int> m_storeNotificationTimeOut;
DBusNotifier *m_notifier = nullptr;
#endif
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)