aboutsummaryrefslogtreecommitdiff
path: root/src/tray.hpp
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2024-03-03 22:56:04 +0100
committerNathan Reiner <nathan@nathanreiner.xyz>2024-03-03 22:56:04 +0100
commiteb629f8fa6f7edd3ba9f3e76146d71f62dafff57 (patch)
treea7d5264c5e4931d1ff6d6b9d456488b90f3f8553 /src/tray.hpp
parent1101c88ac7f5c4fbfbabf7d4206d40736562ed29 (diff)
refractor and add permission manager without save
Diffstat (limited to 'src/tray.hpp')
-rw-r--r--src/tray.hpp46
1 files changed, 46 insertions, 0 deletions
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 <QtWidgets/QMenu>
+#include <QtWidgets/QSystemTrayIcon>
+
+#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<void()> toggle_signal;
+ std::function<void()> quit_signal;
+ std::function<void()> reset_cookies_signal;
+ std::function<void(QWebEnginePage::Feature, bool)> permission_changed_signal;
+
+public:
+ Tray();
+ void connect_toggle(std::function<void()> fn);
+ void connect_quit(std::function<void()> fn);
+ void connect_reset_cookies(std::function<void()> fn);
+ void connect_permission_changed(
+ std::function<void(QWebEnginePage::Feature, bool)> fn);
+ void set_title(const QString &title);
+ void send_notification(std::unique_ptr<QWebEngineNotification> notification);
+ void set_permission(QWebEnginePage::Feature feature, bool value);
+};
+
+#endif