summaryrefslogtreecommitdiffstats
path: root/src/slxbrowser.h
blob: fd0cf0655a7699a093a8905ec645367060c03f1d (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
53
54
55
56
57
#ifndef SLXBROWSER_H_
#define SLXBROWSER_H_

#include <QMainWindow>
#include <QList>
#include <QSslError>
#include <QTimer>

class QNetworkReply;
class WebView;
class QProgressBar;
class QNetworkReply;

struct BrowserSettings
{
	QString url;
	bool fullscreen;
	bool maximized;
	bool ignoreSslErrors;
	int reloadInterval;
	QStringList blackList, whiteList;
};

class SlxBrowser : public QMainWindow
{
	Q_OBJECT
public:
	SlxBrowser(BrowserSettings settings);
	virtual ~SlxBrowser();
	void activity() { _activity = true; }

private slots:
	void loadStarted();
	void loadFinished(bool ok);
	void loadProgress(int progress);
	void sslErrors(QNetworkReply * reply, const QList<QSslError> & errors);
	void requestFinished(QNetworkReply *reply);
	void reloadInitial();
	void maybeTriggerBack();

private:
	BrowserSettings _settings;
    bool _unsupportedUri;
	bool _blockedSite;
	WebView *_browser;
	QProgressBar *_progress;
	QTimer _reset;
	QList<QSslError> _sslErrors;
	QString _normalError;
	qint64 _lastPageLoad;
	bool _activity;
	qint64 _lastActivity;
	bool _pageValid;
};

#endif /* SLXBROWSER_H_ */