aboutsummaryrefslogtreecommitdiff
path: root/include/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'include/widgets')
-rw-r--r--include/widgets/MainWindow.hpp8
-rw-r--r--include/widgets/WebViewStack.hpp (renamed from include/widgets/BrowserManager.hpp)33
2 files changed, 23 insertions, 18 deletions
diff --git a/include/widgets/MainWindow.hpp b/include/widgets/MainWindow.hpp
index 4731fe4..99a3895 100644
--- a/include/widgets/MainWindow.hpp
+++ b/include/widgets/MainWindow.hpp
@@ -6,8 +6,8 @@
#include <QWebEngineView>
#include "LuaRuntime.hpp"
-#include "widgets/BrowserManager.hpp"
#include "widgets/InputLine.hpp"
+#include "widgets/WebViewStack.hpp"
class EvaluationType {
public:
@@ -20,10 +20,12 @@ class MainWindow : public QMainWindow {
public:
MainWindow();
-protected:
+private:
void keyPressEvent(QKeyEvent *event) override;
void onInputSubmit(QString input);
+
void evaluateCommand(QString command);
+
void hideInputLine();
void showInputLine();
void showURLInput(QString url, OpenType openType);
@@ -32,7 +34,7 @@ protected:
void setEvaluationType(EvaluationType *);
private:
- BrowserManager *browserManager;
+ WebViewStack *webViewStack;
InputLine *inputLine;
LuaRuntime *luaRuntime;
QStackedLayout *layout;
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: