diff options
Diffstat (limited to '')
| -rw-r--r-- | include/widgets/WebViewStack.hpp (renamed from include/widgets/BrowserManager.hpp) | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/include/widgets/BrowserManager.hpp b/include/widgets/WebViewStack.hpp index 8cf265d..1d10715 100644 --- a/include/widgets/BrowserManager.hpp +++ b/include/widgets/WebViewStack.hpp @@ -7,34 +7,37 @@ enum OpenType { OpenUrl, OpenUrlInTab, OpenUrlInBgTab, OpenUrlInWindow }; -class BrowserManager : public QWidget { +class WebViewStack : public QWidget { Q_OBJECT public: inline static const QUrl NewtabURL = QUrl("about:blank"); public: - BrowserManager(QWebEngineProfile *profile = new QWebEngineProfile); + WebViewStack(QWebEngineProfile *profile = new QWebEngineProfile, + QWidget *parent = nullptr); - QUrl currentUrl(); - void setCurrentUrl(QUrl url); - - QWebEngineView *createNewWebView(QUrl url = BrowserManager::NewtabURL, - bool focus = false); - - void openUrl(QUrl url = BrowserManager::NewtabURL, + void openUrl(QUrl url = WebViewStack::NewtabURL, OpenType openType = OpenType::OpenUrl); - std::vector<QUrl> webViewUrls(); + std::vector<QUrl> urls(); u_int32_t currentWebViewIndex(); - u_int32_t webViewCount(); + u_int32_t count(); + QUrl currentUrl(); + void focusWebView(long index); - void nextWebView(); - void previousWebView(); + void next(); + void previous(); + + void close(long index); + void closeCurrent(); - void closeWebView(long index); - void closeCurrentWebView(); +private: + void setCurrentUrl(QUrl url); + QWebEngineView *createNewWebView(QUrl url = WebViewStack::NewtabURL, + bool focus = false); +private slots: void onNewWebViewRequest(QWebEngineNewWindowRequest &request); private: |
