forked from Metrological/qtbrowser
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpage.h
More file actions
34 lines (28 loc) · 706 Bytes
/
webpage.h
File metadata and controls
34 lines (28 loc) · 706 Bytes
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
#ifndef __WEBPAGE__
#define __WEBPAGE__
#include <QString>
#include <QWebPage>
#include <QWebFrame>
#include <QUrl>
enum LogLevel
{
LOGGING_NONE,
LOGGING_SHORT,
LOGGING_EXTENDED
};
class WebPage : public QWebPage
{
public:
WebPage(LogLevel logLevel);
void setDefaultUserAgent(QString agent);
protected:
void javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& source);
void javaScriptAlert(QWebFrame*, const QString& message);
bool shouldInterruptJavaScript();
QString userAgentForUrl(const QUrl& url) const;
private:
QString defaultUserAgent;
QHash<QString, QString> userAgents;
LogLevel logLevel;
};
#endif // __WEBPAGE__