mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-27 01:18:45 +02:00
Merge pull request #778 from ctrlaltdavid/feature/chat-open-browser
Open chat hyperlinks in Interface browser window
This commit is contained in:
commit
ea4ae45d9e
6 changed files with 23 additions and 13 deletions
|
@ -5,6 +5,7 @@ module.exports = {
|
||||||
"ecmaVersion": 5
|
"ecmaVersion": 5
|
||||||
},
|
},
|
||||||
"globals": {
|
"globals": {
|
||||||
|
"About": false,
|
||||||
"Account": false,
|
"Account": false,
|
||||||
"Agent": false,
|
"Agent": false,
|
||||||
"AnimationCache": false,
|
"AnimationCache": false,
|
||||||
|
|
|
@ -45,6 +45,16 @@ QString AboutUtil::getQtVersion() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AboutUtil::openUrl(const QString& url) const {
|
void AboutUtil::openUrl(const QString& url) const {
|
||||||
|
auto abboutUtilInstance = AboutUtil::getInstance();
|
||||||
|
if (!abboutUtilInstance) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (QThread::currentThread() != thread()) {
|
||||||
|
QMetaObject::invokeMethod(abboutUtilInstance, "openUrl", Q_ARG(const QString&, url));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto tablet = DependencyManager::get<TabletScriptingInterface>()->getTablet("com.highfidelity.interface.tablet.system");
|
auto tablet = DependencyManager::get<TabletScriptingInterface>()->getTablet("com.highfidelity.interface.tablet.system");
|
||||||
auto hmd = DependencyManager::get<HMDScriptingInterface>();
|
auto hmd = DependencyManager::get<HMDScriptingInterface>();
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||||
|
|
|
@ -79,7 +79,7 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Display a web page in an Interface browser window.
|
* Display a web page in an Interface browser window or the tablet.
|
||||||
* @function About.openUrl
|
* @function About.openUrl
|
||||||
* @param {string} url - The URL of the web page you want to view in Interface.
|
* @param {string} url - The URL of the web page you want to view in Interface.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -645,12 +645,16 @@ void WindowScriptingInterface::setActiveDisplayPlugin(int index) {
|
||||||
qApp->setActiveDisplayPlugin(name);
|
qApp->setActiveDisplayPlugin(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowScriptingInterface::openWebBrowser() {
|
void WindowScriptingInterface::openWebBrowser(const QString& url) {
|
||||||
if (QThread::currentThread() != thread()) {
|
if (QThread::currentThread() != thread()) {
|
||||||
QMetaObject::invokeMethod(this, "openWebBrowser", Qt::QueuedConnection);
|
QMetaObject::invokeMethod(this, "openWebBrowser", Q_ARG(const QString&, url));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||||
offscreenUi->load("Browser.qml");
|
offscreenUi->load("Browser.qml", [=](QQmlContext* context, QObject* newObject) {
|
||||||
|
if (!url.isEmpty()) {
|
||||||
|
newObject->setProperty("url", url);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -616,10 +616,11 @@ public slots:
|
||||||
void setActiveDisplayPlugin(int index);
|
void setActiveDisplayPlugin(int index);
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Opens a web browser in a pop-up window.
|
* Opens an Interface web browser window.
|
||||||
* @function Window.openWebBrowser
|
* @function Window.openWebBrowser
|
||||||
|
* @param {string} [url=""] - The URL of the web page to display.
|
||||||
*/
|
*/
|
||||||
void openWebBrowser();
|
void openWebBrowser(const QString& url = "");
|
||||||
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
|
@ -322,13 +322,7 @@ function onWebEventReceived(event) {
|
||||||
gotoConfirm(event.url);
|
gotoConfirm(event.url);
|
||||||
}
|
}
|
||||||
if (event.cmd === "URL") {
|
if (event.cmd === "URL") {
|
||||||
new OverlayWebWindow({
|
Window.openWebBrowser(event.url);
|
||||||
title: 'Web',
|
|
||||||
source: event.url,
|
|
||||||
width: 900,
|
|
||||||
height: 700,
|
|
||||||
visible: true
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
if (event.cmd === "EXTERNALURL") {
|
if (event.cmd === "EXTERNALURL") {
|
||||||
Window.openUrl(event.url);
|
Window.openUrl(event.url);
|
||||||
|
|
Loading…
Reference in a new issue