From 346c16b4e2ea26f47e0e370a490b7794492a9ebb Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sun, 23 Mar 2025 19:48:53 +0530 Subject: Apply clang-tidy suggestions --- src/widgets/WebViewStack.hpp | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'src/widgets/WebViewStack.hpp') 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 #include +#include #include #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; @@ -17,39 +23,36 @@ struct Tab { 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 urls(); - QList getTabList(); - u_int32_t currentWebViewIndex(); - u_int32_t count(); - QUrl currentUrl(); + QList 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 webViewList; + QList web_view_list; }; -- cgit v1.3.1