blob: 34b1658e81da0f65d3b42e7404e11d3262e53cfa (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#pragma once
#include <QStackedLayout>
#include <QWebEngineProfile>
#include <QWebEngineView>
#include <sys/types.h>
#include "Configuration.hpp"
#include "completion/TabsModel.hpp"
enum OpenType { OpenUrl, OpenUrlInTab, OpenUrlInBgTab, OpenUrlInWindow };
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);
std::vector<QUrl> urls();
u_int32_t currentWebViewIndex();
u_int32_t count();
QUrl currentUrl();
void focusWebView(long index);
void next();
void previous();
void close(long index);
void closeCurrent();
QList<Tab> getTabList();
private:
void setCurrentUrl(QUrl url);
QWebEngineView *createNewWebView(QUrl url, bool focus = false);
private slots:
void onNewWebViewRequest(QWebEngineNewWindowRequest &request);
private:
const Configuration *configuration;
QWebEngineProfile *profile;
QStackedLayout *layout;
QList<QWebEngineView *> webViewList;
};
|