From eb629f8fa6f7edd3ba9f3e76146d71f62dafff57 Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Sun, 3 Mar 2024 22:56:04 +0100 Subject: refractor and add permission manager without save --- src/tray.hpp | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/tray.hpp (limited to 'src/tray.hpp') diff --git a/src/tray.hpp b/src/tray.hpp new file mode 100644 index 0000000..427cdc8 --- /dev/null +++ b/src/tray.hpp @@ -0,0 +1,46 @@ +#ifndef TRAY_HPP +#define TRAY_HPP + +#include +#include + +#include "webwindow.hpp" + +class Tray : public QSystemTrayIcon +{ +private: + QMenu menu; + QMenu settings; + QAction *app_toggle; + QAction *quit; + + struct + { + QAction *camera; + QAction *microphone; + QAction *screenshare; + QAction *system_audio; + QAction *notifications; + QAction *location; + QAction *lock_mouse; + } permissions; + + QAction *reset_storage; + std::function toggle_signal; + std::function quit_signal; + std::function reset_cookies_signal; + std::function permission_changed_signal; + +public: + Tray(); + void connect_toggle(std::function fn); + void connect_quit(std::function fn); + void connect_reset_cookies(std::function fn); + void connect_permission_changed( + std::function fn); + void set_title(const QString &title); + void send_notification(std::unique_ptr notification); + void set_permission(QWebEnginePage::Feature feature, bool value); +}; + +#endif -- cgit v1.2.3-70-g09d2