aboutsummaryrefslogtreecommitdiff
path: root/src/widgets
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2025-08-02 22:19:24 +0530
committerAkshay Nair <phenax5@gmail.com>2025-08-02 22:19:24 +0530
commit0d1258aee3f39c8d5348588a87e804ec8cd27bd5 (patch)
tree60b0c15a9f61ab825a1e1d9c6f8388b0aaf03d7c /src/widgets
parentd37020870600d6c842f9a75ebd3986df6010c25c (diff)
downloadnull-browser-0d1258aee3f39c8d5348588a87e804ec8cd27bd5.tar.gz
null-browser-0d1258aee3f39c8d5348588a87e804ec8cd27bd5.zip
Add web.view.reload
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/BrowserWindow.cpp5
-rw-r--r--src/widgets/BrowserWindow.hpp1
-rw-r--r--src/widgets/Decorations.cpp2
-rw-r--r--src/widgets/Decorations.hpp1
-rw-r--r--src/widgets/IWebViewMediator.hpp1
-rw-r--r--src/widgets/WebViewStack.cpp10
-rw-r--r--src/widgets/WebViewStack.hpp1
7 files changed, 20 insertions, 1 deletions
diff --git a/src/widgets/BrowserWindow.cpp b/src/widgets/BrowserWindow.cpp
index 7852a66..87e315c 100644
--- a/src/widgets/BrowserWindow.cpp
+++ b/src/widgets/BrowserWindow.cpp
@@ -10,7 +10,6 @@
#include "WindowActionRouter.hpp"
#include "events/KeyPressedEvent.hpp"
#include "keymap/KeymapEvaluator.hpp"
-#include "widgets/BrowserApp.hpp"
#include "widgets/Decorations.hpp"
#include "widgets/WebViewStack.hpp"
@@ -111,3 +110,7 @@ void BrowserWindow::expose_rpc_function(const QString &name, const RpcFunc &acti
WebViewId webview_id) {
get_webview_mediator(webview_id)->expose_rpc_function(name, action, webview_id);
}
+
+void BrowserWindow::reload(WebViewId webview_id) {
+ get_webview_mediator(webview_id)->reload(webview_id);
+}
diff --git a/src/widgets/BrowserWindow.hpp b/src/widgets/BrowserWindow.hpp
index bc6cea1..de48c6e 100644
--- a/src/widgets/BrowserWindow.hpp
+++ b/src/widgets/BrowserWindow.hpp
@@ -40,6 +40,7 @@ public:
void set_html(const QString &html, WebViewId webview_id);
void run_javascript(const QString &js_code, WebViewId webview_id);
void expose_rpc_function(const QString &name, const RpcFunc &action, WebViewId webview_id);
+ void reload(WebViewId webview_id);
bool on_window_key_event(QObject *target, QKeyEvent *event);
diff --git a/src/widgets/Decorations.cpp b/src/widgets/Decorations.cpp
index dc644d5..1cff3d4 100644
--- a/src/widgets/Decorations.cpp
+++ b/src/widgets/Decorations.cpp
@@ -101,3 +101,5 @@ void Decorations::expose_rpc_function(const QString &name, const RpcFunc &action
if (decoration.has_value())
decoration.value()->expose_rpc_function(name, action);
}
+
+void Decorations::reload(WebViewId /* unused */) { qDebug() << "TODO: Impl"; }
diff --git a/src/widgets/Decorations.hpp b/src/widgets/Decorations.hpp
index 97e0415..108b13e 100644
--- a/src/widgets/Decorations.hpp
+++ b/src/widgets/Decorations.hpp
@@ -32,6 +32,7 @@ public:
void run_javascript(const QString &js_code, WebViewId webview_id) override;
void expose_rpc_function(const QString &name, const RpcFunc &action,
WebViewId webview_id) override;
+ void reload(WebViewId webview_id) override;
private:
EdgeDecoration *decoration_top;
diff --git a/src/widgets/IWebViewMediator.hpp b/src/widgets/IWebViewMediator.hpp
index 9c64e53..a7007f2 100644
--- a/src/widgets/IWebViewMediator.hpp
+++ b/src/widgets/IWebViewMediator.hpp
@@ -13,4 +13,5 @@ public:
virtual void expose_rpc_function(const QString &name, const RpcFunc &action,
WebViewId webview_id) = 0;
virtual void run_javascript(const QString &js_code, WebViewId webview_id) = 0;
+ virtual void reload(WebViewId webview_id) = 0;
};
diff --git a/src/widgets/WebViewStack.cpp b/src/widgets/WebViewStack.cpp
index 37532ff..ab5808f 100644
--- a/src/widgets/WebViewStack.cpp
+++ b/src/widgets/WebViewStack.cpp
@@ -356,3 +356,13 @@ void WebViewStack::expose_rpc_function(const QString &name, const RpcFunc & /* u
WebViewId /* unused */) {
qDebug() << "expose_rpc_function: NOT IMPLEMENTED" << name;
}
+
+void WebViewStack::reload(WebViewId webview_id) {
+ auto *webview = get_webview(webview_id);
+ if (webview == nullptr) {
+ qDebug() << "Webview does not exist";
+ return;
+ }
+
+ webview->reload();
+}
diff --git a/src/widgets/WebViewStack.hpp b/src/widgets/WebViewStack.hpp
index 5a88266..bbee44c 100644
--- a/src/widgets/WebViewStack.hpp
+++ b/src/widgets/WebViewStack.hpp
@@ -65,6 +65,7 @@ public slots:
void run_javascript(const QString &js_code, WebViewId webview_id) override;
void expose_rpc_function(const QString &name, const RpcFunc &action,
WebViewId webview_id) override;
+ void reload(WebViewId webview_id) override;
protected slots:
void on_new_webview_request(QWebEngineNewWindowRequest &request);