aboutsummaryrefslogtreecommitdiff
path: root/src/widgets/WebViewStack.hpp
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2025-03-23 19:48:53 +0530
committerAkshay Nair <phenax5@gmail.com>2025-03-23 21:47:03 +0530
commit346c16b4e2ea26f47e0e370a490b7794492a9ebb (patch)
tree277a30ac8b0c82a9c9736985385d0d150a55fcb5 /src/widgets/WebViewStack.hpp
parent9cc72e8ea9f59f9a9627d05528d54a559ebd412c (diff)
downloadnull-browser-346c16b4e2ea26f47e0e370a490b7794492a9ebb.tar.gz
null-browser-346c16b4e2ea26f47e0e370a490b7794492a9ebb.zip
Apply clang-tidy suggestions
Diffstat (limited to 'src/widgets/WebViewStack.hpp')
-rw-r--r--src/widgets/WebViewStack.hpp39
1 files changed, 21 insertions, 18 deletions
diff --git a/src/widgets/WebViewStack.hpp b/src/widgets/WebViewStack.hpp
index 473f699..aa463cc 100644
--- a/src/widgets/WebViewStack.hpp
+++ b/src/widgets/WebViewStack.hpp
@@ -2,12 +2,18 @@
#include <QStackedLayout>
#include <QWebEngineProfile>
+#include <cstdint>
#include <vector>
#include "Configuration.hpp"
#include "widgets/WebView.hpp"
-enum OpenType { OpenUrl, OpenUrlInTab, OpenUrlInBgTab, OpenUrlInWindow };
+enum OpenType : uint8_t {
+ OpenUrl,
+ OpenUrlInTab,
+ OpenUrlInBgTab,
+ OpenUrlInWindow
+};
struct Tab {
QString url;
@@ -18,38 +24,35 @@ class WebViewStack : public QWidget {
Q_OBJECT
public:
- inline static const QUrl NewtabURL = QUrl("about:blank");
-
-public:
WebViewStack(const Configuration *configuration,
QWebEngineProfile *profile = new QWebEngineProfile,
QWidget *parent = nullptr);
- void openUrl(QUrl url, OpenType openType = OpenType::OpenUrl);
+ void open_url(const QUrl &url, OpenType open_type = OpenType::OpenUrl);
std::vector<QUrl> urls();
- QList<Tab> getTabList();
- u_int32_t currentWebViewIndex();
- u_int32_t count();
- QUrl currentUrl();
+ QList<Tab> get_tab_list();
+ uint32_t current_web_view_index();
+ uint32_t count();
+ QUrl current_url();
- void focusWebView(int32_t index);
+ void focus_web_view(qsizetype index);
void next();
void previous();
- void close(int32_t index);
- void closeCurrent();
-
-private:
- void setCurrentUrl(QUrl url);
- WebView *createNewWebView(QUrl url, bool focus = false);
+ void close(qsizetype index);
+ void close_current();
private slots:
- void onNewWebViewRequest(const QWebEngineNewWindowRequest &request);
+ void on_new_web_view_request(const QWebEngineNewWindowRequest &request);
+
+protected:
+ void set_current_url(const QUrl &url);
+ WebView *create_new_web_view(const QUrl &url, bool focus = false);
private:
const Configuration *configuration;
QWebEngineProfile *profile;
QStackedLayout *layout;
- QList<WebView *> webViewList;
+ QList<WebView *> web_view_list;
};