2012-03-27 18:49:57 -04:00
|
|
|
#ifndef _WEBPAGEMANAGER_H
|
|
|
|
#define _WEBPAGEMANAGER_H
|
2012-03-26 18:41:33 -04:00
|
|
|
#include <QList>
|
2012-06-29 10:41:08 -04:00
|
|
|
#include <QSet>
|
2012-03-28 23:05:24 -04:00
|
|
|
#include <QObject>
|
2012-06-29 10:41:08 -04:00
|
|
|
#include <QNetworkReply>
|
2012-06-29 12:14:22 -04:00
|
|
|
#include <QDebug>
|
|
|
|
#include <QFile>
|
2012-03-28 23:05:24 -04:00
|
|
|
|
2014-11-14 14:55:14 -05:00
|
|
|
#include "UnknownUrlHandler.h"
|
|
|
|
|
2012-03-28 23:05:24 -04:00
|
|
|
class WebPage;
|
2012-06-21 23:34:51 -04:00
|
|
|
class NetworkCookieJar;
|
2013-03-18 08:11:59 -04:00
|
|
|
class NetworkAccessManager;
|
2014-11-24 09:52:34 -05:00
|
|
|
class BlacklistedRequestHandler;
|
|
|
|
class CustomHeadersRequestHandler;
|
2012-03-26 18:41:33 -04:00
|
|
|
|
2012-04-04 15:40:18 -04:00
|
|
|
class WebPageManager : public QObject {
|
|
|
|
Q_OBJECT
|
|
|
|
|
2012-03-26 18:41:33 -04:00
|
|
|
public:
|
2012-04-04 15:40:18 -04:00
|
|
|
WebPageManager(QObject *parent = 0);
|
2012-03-26 18:41:33 -04:00
|
|
|
void append(WebPage *value);
|
2012-06-29 10:41:08 -04:00
|
|
|
QList<WebPage *> pages() const;
|
2012-03-28 23:05:24 -04:00
|
|
|
void setCurrentPage(WebPage *);
|
2012-06-29 12:14:22 -04:00
|
|
|
WebPage *currentPage() const;
|
2014-06-18 18:00:34 -04:00
|
|
|
WebPage *createPage();
|
|
|
|
void removePage(WebPage *);
|
2012-03-30 15:00:51 -04:00
|
|
|
void setIgnoreSslErrors(bool);
|
|
|
|
bool ignoreSslErrors();
|
2012-10-24 07:55:29 -04:00
|
|
|
void setTimeout(int);
|
|
|
|
int getTimeout();
|
2012-05-14 21:59:28 -04:00
|
|
|
void reset();
|
2012-06-21 23:34:51 -04:00
|
|
|
NetworkCookieJar *cookieJar();
|
2012-06-29 10:41:08 -04:00
|
|
|
bool isLoading() const;
|
2012-06-29 12:14:22 -04:00
|
|
|
QDebug logger() const;
|
|
|
|
void enableLogging();
|
2012-12-03 22:47:10 -05:00
|
|
|
void replyFinished(QNetworkReply *reply);
|
2013-03-18 08:11:59 -04:00
|
|
|
NetworkAccessManager *networkAccessManager();
|
2014-11-24 09:52:34 -05:00
|
|
|
void setUrlBlacklist(const QStringList &);
|
|
|
|
void addHeader(QString, QString);
|
2014-11-14 14:55:14 -05:00
|
|
|
void setUnknownUrlMode(UnknownUrlHandler::Mode);
|
|
|
|
void allowUrl(const QString &);
|
|
|
|
void blockUrl(const QString &);
|
2012-03-26 18:41:33 -04:00
|
|
|
|
2012-04-04 15:40:18 -04:00
|
|
|
public slots:
|
2012-05-14 21:59:28 -04:00
|
|
|
void emitLoadStarted();
|
2012-06-29 12:14:22 -04:00
|
|
|
void setPageStatus(bool);
|
2012-07-11 23:36:22 -04:00
|
|
|
void requestCreated(QByteArray &url, QNetworkReply *reply);
|
2012-12-03 22:47:10 -05:00
|
|
|
void handleReplyFinished();
|
2015-06-05 13:29:26 -04:00
|
|
|
void replyDestroyed(QObject *);
|
2012-04-04 15:40:18 -04:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void pageFinished(bool);
|
2012-05-14 21:59:28 -04:00
|
|
|
void loadStarted();
|
2012-04-04 15:40:18 -04:00
|
|
|
|
2012-03-26 18:41:33 -04:00
|
|
|
private:
|
2012-06-29 12:14:22 -04:00
|
|
|
void emitPageFinished();
|
|
|
|
static void handleDebugMessage(QtMsgType type, const char *message);
|
2017-03-26 16:31:29 -04:00
|
|
|
void initOfflineWebApplicationCache();
|
2012-06-29 12:14:22 -04:00
|
|
|
|
2012-03-27 18:49:57 -04:00
|
|
|
QList<WebPage *> m_pages;
|
2015-04-23 10:15:37 -04:00
|
|
|
QList<QNetworkReply *> m_pendingReplies;
|
2012-03-28 23:05:24 -04:00
|
|
|
WebPage *m_currentPage;
|
2012-04-04 15:40:18 -04:00
|
|
|
bool m_ignoreSslErrors;
|
2012-06-21 23:34:51 -04:00
|
|
|
NetworkCookieJar *m_cookieJar;
|
2012-12-05 19:38:03 -05:00
|
|
|
QSet<WebPage *> m_started;
|
2012-06-29 10:41:08 -04:00
|
|
|
bool m_success;
|
2012-06-29 12:14:22 -04:00
|
|
|
bool m_loggingEnabled;
|
2017-03-06 12:18:34 -05:00
|
|
|
bool m_isCacheInitialized;
|
2013-01-15 22:37:24 -05:00
|
|
|
QFile *m_ignoredOutput;
|
2012-10-24 07:55:29 -04:00
|
|
|
int m_timeout;
|
2013-03-18 08:11:59 -04:00
|
|
|
NetworkAccessManager *m_networkAccessManager;
|
2014-11-24 09:52:34 -05:00
|
|
|
BlacklistedRequestHandler *m_blacklistedRequestHandler;
|
|
|
|
CustomHeadersRequestHandler *m_customHeadersRequestHandler;
|
2014-11-14 14:55:14 -05:00
|
|
|
UnknownUrlHandler *m_unknownUrlHandler;
|
2012-03-26 18:41:33 -04:00
|
|
|
};
|
|
|
|
|
2012-03-27 18:49:57 -04:00
|
|
|
#endif // _WEBPAGEMANAGER_H
|