1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- #include "qspnetworkaccessmanager.h"
- #include "qspreply.h"
- QspNetworkAccessManager::QspNetworkAccessManager(QNetworkAccessManager *oldManager, QObject *parent) : QNetworkAccessManager(parent)
- {
- //setCache(oldManager->cache());
- setCookieJar(oldManager->cookieJar());
- //setProxy(oldManager->proxy());
- //setProxyFactory(oldManager->proxyFactory());
- }
- QspNetworkAccessManager::~QspNetworkAccessManager()
- {
- }
- void QspNetworkAccessManager::SetPlainText(const QString &text)
- {
- m_isUseHtml = false;
- m_text= text;
- }
- void QspNetworkAccessManager::SetHtml(const QString &text)
- {
- m_isUseHtml = true;
- m_text =text;
- }
- void QspNetworkAccessManager::SetGamePath(const QString &path)
- {
- m_path = path;
- }
- void QspNetworkAccessManager::SetLinkColor(const QColor &color)
- {
- m_linkColor = color;
- }
- void QspNetworkAccessManager::SetBackgroundColor(const QColor &color)
- {
- m_backColor = color;
- }
- void QspNetworkAccessManager::SetForegroundColor(const QColor &color)
- {
- m_fontColor = color;
- }
- void QspNetworkAccessManager::SetBackgroundImage(const QString &path)
- {
- m_bmpBg = path;
- }
- void QspNetworkAccessManager::SetTextFont(const QFont &new_font)
- {
- m_font = new_font;
- }
- QNetworkReply *QspNetworkAccessManager::createRequest(
- QNetworkAccessManager::Operation operation, const QNetworkRequest &request,
- QIODevice *device)
- {
- if (request.url().scheme() == "http" || request.url().scheme() == "https")
- return QNetworkAccessManager::createRequest(operation, request, device);
- if (operation == GetOperation)
- // Handle qsp:// URLs separately by creating custom QNetworkReply objects.
- return new QspReply(request.url(), m_text, m_isUseHtml, m_path, m_linkColor, m_backColor, m_fontColor, m_bmpBg, m_font);
- else
- return QNetworkAccessManager::createRequest(operation, request, device);
- }
|