mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-16 09:40:10 +02:00
Update webwindow to use datawebview
This commit is contained in:
parent
53b5c7e971
commit
1193d86d7b
3 changed files with 12 additions and 15 deletions
|
@ -18,9 +18,10 @@
|
|||
#include <QListWidget>
|
||||
|
||||
#include "Application.h"
|
||||
#include "ui/DataWebPage.h"
|
||||
#include "MainWindow.h"
|
||||
#include "WindowScriptingInterface.h"
|
||||
#include "WebWindowClass.h"
|
||||
#include "WindowScriptingInterface.h"
|
||||
|
||||
ScriptEventBridge::ScriptEventBridge(QObject* parent) : QObject(parent) {
|
||||
}
|
||||
|
@ -33,17 +34,6 @@ void ScriptEventBridge::emitScriptEvent(const QString& data) {
|
|||
emit scriptEventReceived(data);
|
||||
}
|
||||
|
||||
|
||||
class InterfaceWebPage : public QWebPage {
|
||||
public:
|
||||
InterfaceWebPage(QWidget* parent = nullptr) : QWebPage(parent) { }
|
||||
protected:
|
||||
virtual QString userAgentForUrl(const QUrl & url) const {
|
||||
return "HighFidelityInterface/1.0";
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
WebWindowClass::WebWindowClass(const QString& title, const QString& url, int width, int height, bool isToolWindow)
|
||||
: QObject(NULL),
|
||||
_eventBridge(new ScriptEventBridge(this)),
|
||||
|
@ -71,7 +61,7 @@ WebWindowClass::WebWindowClass(const QString& title, const QString& url, int wid
|
|||
addEventBridgeToWindowObject();
|
||||
}
|
||||
|
||||
_webView->setPage(new InterfaceWebPage());
|
||||
_webView->setPage(new DataWebPage());
|
||||
_webView->setUrl(url);
|
||||
|
||||
|
||||
|
|
|
@ -40,4 +40,8 @@ bool DataWebPage::acceptNavigationRequest(QWebFrame* frame, const QNetworkReques
|
|||
Qt::AutoConnection, Q_ARG(const QString&, request.url().toString()));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString DataWebPage::userAgentForUrl(const QUrl & url) const {
|
||||
return INTERFACE_USER_AGENT;
|
||||
}
|
||||
|
|
|
@ -14,12 +14,15 @@
|
|||
|
||||
#include <qwebpage.h>
|
||||
|
||||
const QString INTERFACE_USER_AGENT = "HighFidelityInterface/1.0";
|
||||
|
||||
class DataWebPage : public QWebPage {
|
||||
public:
|
||||
DataWebPage(QObject* parent = 0);
|
||||
protected:
|
||||
void javaScriptConsoleMessage(const QString & message, int lineNumber, const QString & sourceID);
|
||||
bool acceptNavigationRequest(QWebFrame* frame, const QNetworkRequest& request, QWebPage::NavigationType type);
|
||||
virtual QString userAgentForUrl(const QUrl & url) const;
|
||||
};
|
||||
|
||||
#endif // hifi_DataWebPage_h
|
||||
#endif // hifi_DataWebPage_h
|
||||
|
|
Loading…
Reference in a new issue