diff options
author | Nathan Reiner <nathan@nathanreiner.xyz> | 2024-03-03 22:56:04 +0100 |
---|---|---|
committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2024-03-03 22:56:04 +0100 |
commit | eb629f8fa6f7edd3ba9f3e76146d71f62dafff57 (patch) | |
tree | a7d5264c5e4931d1ff6d6b9d456488b90f3f8553 /src/webwindow.hpp | |
parent | 1101c88ac7f5c4fbfbabf7d4206d40736562ed29 (diff) |
refractor and add permission manager without save
Diffstat (limited to 'src/webwindow.hpp')
-rw-r--r-- | src/webwindow.hpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/webwindow.hpp b/src/webwindow.hpp new file mode 100644 index 0000000..49b2394 --- /dev/null +++ b/src/webwindow.hpp @@ -0,0 +1,37 @@ +#ifndef MAINWINDOW_HPP +#define MAINWINDOW_HPP + +#include "permissionmanager.hpp" +#include <QtCore/QUrl> +#include <QtWebEngineCore/QWebEngineNotification> +#include <QtWebEngineCore/QWebEnginePage> +#include <QtWebEngineCore/QWebEngineProfile> +#include <QtWebEngineCore/QWebEngineSettings> +#include <QtWebEngineWidgets/QWebEngineView> +#include <QtWidgets/QMainWindow> +#include <functional> + +class WebWindow : public QMainWindow +{ +private: + QWebEngineProfile _profile; + QWebEnginePage _page; + QWebEngineView _view; + PermissionManager _permissions; + + void web_configure(); + void permission_requested(const QUrl origin, QWebEnginePage::Feature feature); + void closeEvent(QCloseEvent *event); + +public: + WebWindow(const QString &url); + void connect_icon_changed(std::function<void(const QIcon)> fn); + void connect_title_changed(std::function<void(const QString)> fn); + void connect_notification(std::function<void(std::unique_ptr<QWebEngineNotification>)> fn); + void set_feature(QWebEnginePage::Feature feature, bool value); + void reset_cookies(); + void toggle_visibility(); + void quit(); +}; + +#endif |