mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 18:00:41 +02:00
Open browser within Interface
This commit is contained in:
parent
fee3cc0aca
commit
a6ef459723
3 changed files with 119 additions and 3 deletions
|
@ -15,9 +15,7 @@ Rectangle {
|
||||||
width: 480
|
width: 480
|
||||||
height: 706
|
height: 706
|
||||||
|
|
||||||
HifiConstants { id: hifi; }
|
color: "#404040"
|
||||||
|
|
||||||
color: hifi.colors.baseGray
|
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
x: 45
|
x: 45
|
||||||
|
@ -56,6 +54,9 @@ Rectangle {
|
||||||
color: "white"
|
color: "white"
|
||||||
text: "<a href=\"https:/www.highfidelity.com\">www.highfidelity.com</a>."
|
text: "<a href=\"https:/www.highfidelity.com\">www.highfidelity.com</a>."
|
||||||
size: 20
|
size: 20
|
||||||
|
onLinkActivated: {
|
||||||
|
HiFiAbout.openUrl("https:/www.highfidelity.com");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Item { height: 40; width: 1 }
|
Item { height: 40; width: 1 }
|
||||||
Row {
|
Row {
|
||||||
|
@ -64,6 +65,12 @@ Rectangle {
|
||||||
sourceSize.width: 34
|
sourceSize.width: 34
|
||||||
sourceSize.height: 25
|
sourceSize.height: 25
|
||||||
source: "../../../images/about-qt.png"
|
source: "../../../images/about-qt.png"
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: {
|
||||||
|
HiFiAbout.openUrl("https://www.qt.io/");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
RalewayRegular {
|
RalewayRegular {
|
||||||
color: "white"
|
color: "white"
|
||||||
|
@ -91,6 +98,9 @@ Rectangle {
|
||||||
color: "white"
|
color: "white"
|
||||||
text: "Blockchain technology from <a href=\"https://elementsproject.org/elements/\">Elements</a>."
|
text: "Blockchain technology from <a href=\"https://elementsproject.org/elements/\">Elements</a>."
|
||||||
size: 14
|
size: 14
|
||||||
|
onLinkActivated: {
|
||||||
|
HiFiAbout.openUrl("https://elementsproject.org/elements/");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
RalewayRegular {
|
RalewayRegular {
|
||||||
color: "white"
|
color: "white"
|
||||||
|
@ -103,6 +113,9 @@ Rectangle {
|
||||||
linkColor: "#00B4EF"
|
linkColor: "#00B4EF"
|
||||||
text: "Distributed under the <a href=\"http://www.apache.org/licenses/LICENSE-2.0.html\">Apache License, Version 2.0.</a>."
|
text: "Distributed under the <a href=\"http://www.apache.org/licenses/LICENSE-2.0.html\">Apache License, Version 2.0.</a>."
|
||||||
size: 14
|
size: 14
|
||||||
|
onLinkActivated: {
|
||||||
|
HiFiAbout.openUrl("http://www.apache.org/licenses/LICENSE-2.0.html");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
63
interface/src/AboutUtil.cpp
Normal file
63
interface/src/AboutUtil.cpp
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
//
|
||||||
|
// AboutUtil.cpp
|
||||||
|
// interface/src
|
||||||
|
//
|
||||||
|
// Created by Vlad Stelmahovsky on 15/5/2018.
|
||||||
|
// Copyright 2018 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "AboutUtil.h"
|
||||||
|
#include "BuildInfo.h"
|
||||||
|
#include <ui/TabletScriptingInterface.h>
|
||||||
|
#include "DependencyManager.h"
|
||||||
|
#include "scripting/HMDScriptingInterface.h"
|
||||||
|
#include "Application.h"
|
||||||
|
#include <OffscreenQmlDialog.h>
|
||||||
|
|
||||||
|
AboutUtil::AboutUtil(QObject *parent) : QObject(parent) {}
|
||||||
|
|
||||||
|
AboutUtil *AboutUtil::getInstance()
|
||||||
|
{
|
||||||
|
static AboutUtil instance;
|
||||||
|
return &instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString AboutUtil::buildDate() const
|
||||||
|
{
|
||||||
|
return BuildInfo::BUILD_TIME;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString AboutUtil::buildVersion() const
|
||||||
|
{
|
||||||
|
return BuildInfo::VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString AboutUtil::qtVersion() const
|
||||||
|
{
|
||||||
|
return qVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AboutUtil::openUrl(const QString& url) const {
|
||||||
|
|
||||||
|
auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();
|
||||||
|
auto tablet = dynamic_cast<TabletProxy*>(tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system"));
|
||||||
|
auto hmd = DependencyManager::get<HMDScriptingInterface>();
|
||||||
|
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||||
|
|
||||||
|
if (tablet->getToolbarMode()) {
|
||||||
|
offscreenUi->load("Browser.qml", [=](QQmlContext* context, QObject* newObject) {
|
||||||
|
newObject->setProperty("url", url);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
if (!hmd->getShouldShowTablet() && !qApp->isHMDMode()) {
|
||||||
|
offscreenUi->load("Browser.qml", [=](QQmlContext* context, QObject* newObject) {
|
||||||
|
newObject->setProperty("url", url);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
tablet->gotoWebScreen(url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
40
interface/src/AboutUtil.h
Normal file
40
interface/src/AboutUtil.h
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
//
|
||||||
|
// AboutUtil.h
|
||||||
|
// interface/src
|
||||||
|
//
|
||||||
|
// Created by Vlad Stelmahovsky on 15/5/2018.
|
||||||
|
// Copyright 2018 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef hifi_AboutUtil_h
|
||||||
|
#define hifi_AboutUtil_h
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
class AboutUtil : public QObject {
|
||||||
|
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
Q_PROPERTY(QString buildDate READ buildDate CONSTANT)
|
||||||
|
Q_PROPERTY(QString buildVersion READ buildVersion CONSTANT)
|
||||||
|
Q_PROPERTY(QString qtVersion READ qtVersion CONSTANT)
|
||||||
|
|
||||||
|
AboutUtil(QObject* parent = nullptr);
|
||||||
|
public:
|
||||||
|
static AboutUtil* getInstance();
|
||||||
|
~AboutUtil() {}
|
||||||
|
|
||||||
|
QString buildDate() const;
|
||||||
|
QString buildVersion() const;
|
||||||
|
QString qtVersion() const;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void openUrl(const QString &url) const;
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // hifi_AboutUtil_h
|
Loading…
Reference in a new issue