mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 20:31:29 +02:00
Tablet buttons now work in toolbar.
Switching between tablet and toolbar is not as dynamic as I'd like but it's a start.
This commit is contained in:
parent
4503923665
commit
912e8aa04a
8 changed files with 211 additions and 47 deletions
|
@ -33,6 +33,8 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setShown(value) {}
|
||||||
|
|
||||||
SoundEffect {
|
SoundEffect {
|
||||||
id: buttonClickSound
|
id: buttonClickSound
|
||||||
volume: 0.1
|
volume: 0.1
|
||||||
|
@ -85,5 +87,5 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
width: 480
|
width: 480
|
||||||
height: 720
|
height: 706
|
||||||
}
|
}
|
||||||
|
|
94
interface/resources/qml/hifi/tablet/WindowRoot.qml
Normal file
94
interface/resources/qml/hifi/tablet/WindowRoot.qml
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
//
|
||||||
|
// WindowRoot.qml
|
||||||
|
//
|
||||||
|
// Created by Anthony Thibault on 14 Feb 2017
|
||||||
|
// Copyright 2017 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
|
||||||
|
//
|
||||||
|
// This qml is used when tablet content is shown on the 2d overlay ui
|
||||||
|
// TODO: FIXME: this is practically identical to TabletRoot.qml
|
||||||
|
|
||||||
|
import "../../windows" as Windows
|
||||||
|
import QtQuick 2.0
|
||||||
|
import Hifi 1.0
|
||||||
|
|
||||||
|
Windows.ScrollingWindow {
|
||||||
|
id: tabletRoot
|
||||||
|
objectName: "tabletRoot"
|
||||||
|
property string username: "Unknown user"
|
||||||
|
property var eventBridge;
|
||||||
|
shown: false
|
||||||
|
resizable: false
|
||||||
|
|
||||||
|
signal showDesktop();
|
||||||
|
|
||||||
|
function loadSource(url) {
|
||||||
|
loader.source = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadWebUrl(url, injectedJavaScriptUrl) {
|
||||||
|
loader.item.url = url;
|
||||||
|
loader.item.scriptURL = injectedJavaScriptUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// used to send a message from qml to interface script.
|
||||||
|
signal sendToScript(var message);
|
||||||
|
|
||||||
|
// used to receive messages from interface script
|
||||||
|
function fromScript(message) {
|
||||||
|
if (loader.item.hasOwnProperty("fromScript")) {
|
||||||
|
loader.item.fromScript(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SoundEffect {
|
||||||
|
id: buttonClickSound
|
||||||
|
volume: 0.1
|
||||||
|
source: "../../../sounds/Gamemaster-Audio-button-click.wav"
|
||||||
|
}
|
||||||
|
|
||||||
|
function playButtonClickSound() {
|
||||||
|
// Because of the asynchronous nature of initalization, it is possible for this function to be
|
||||||
|
// called before the C++ has set the globalPosition context variable.
|
||||||
|
if (typeof globalPosition !== 'undefined') {
|
||||||
|
buttonClickSound.play(globalPosition);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setUsername(newUsername) {
|
||||||
|
username = newUsername;
|
||||||
|
}
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
id: loader
|
||||||
|
objectName: "loader"
|
||||||
|
asynchronous: false
|
||||||
|
|
||||||
|
height: pane.scrollHeight
|
||||||
|
width: pane.contentWidth
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.top: parent.top
|
||||||
|
|
||||||
|
onLoaded: {
|
||||||
|
if (loader.item.hasOwnProperty("eventBridge")) {
|
||||||
|
loader.item.eventBridge = eventBridge;
|
||||||
|
|
||||||
|
// Hook up callback for clara.io download from the marketplace.
|
||||||
|
eventBridge.webEventReceived.connect(function (event) {
|
||||||
|
if (event.slice(0, 17) === "CLARA.IO DOWNLOAD") {
|
||||||
|
ApplicationInterface.addAssetToWorldFromURL(event.slice(18));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (loader.item.hasOwnProperty("sendToScript")) {
|
||||||
|
loader.item.sendToScript.connect(tabletRoot.sendToScript);
|
||||||
|
}
|
||||||
|
loader.item.forceActiveFocus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
implicitWidth: 480
|
||||||
|
implicitHeight: 706
|
||||||
|
}
|
|
@ -12,7 +12,9 @@ StateImage {
|
||||||
property int imageOnIn: 2
|
property int imageOnIn: 2
|
||||||
|
|
||||||
property string text: ""
|
property string text: ""
|
||||||
|
property string activeText: button.text
|
||||||
property string icon: "icons/tablet-icons/blank.svg"
|
property string icon: "icons/tablet-icons/blank.svg"
|
||||||
|
property string activeIcon: button.icon
|
||||||
|
|
||||||
signal clicked()
|
signal clicked()
|
||||||
|
|
||||||
|
@ -73,13 +75,13 @@ StateImage {
|
||||||
anchors.bottomMargin: 0
|
anchors.bottomMargin: 0
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
fillMode: Image.Stretch
|
fillMode: Image.Stretch
|
||||||
source: urlHelper(button.icon)
|
source: urlHelper(button.isActive ? button.activeIcon : button.icon)
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
id: caption
|
id: caption
|
||||||
color: "#ffffff"
|
color: button.isActive ? "#000000" : "#ffffff"
|
||||||
text: button.text
|
text: button.isActive ? button.activeText : button.text
|
||||||
font.bold: false
|
font.bold: false
|
||||||
font.pixelSize: 9
|
font.pixelSize: 9
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
|
|
|
@ -85,6 +85,10 @@ Fadable {
|
||||||
|
|
||||||
function setDefaultFocus() {} // Default function; can be overridden by dialogs.
|
function setDefaultFocus() {} // Default function; can be overridden by dialogs.
|
||||||
|
|
||||||
|
function setShown(value) {
|
||||||
|
window.shown = value;
|
||||||
|
}
|
||||||
|
|
||||||
property var rectifier: Timer {
|
property var rectifier: Timer {
|
||||||
property bool executing: false;
|
property bool executing: false;
|
||||||
interval: 100
|
interval: 100
|
||||||
|
|
|
@ -15,7 +15,8 @@
|
||||||
#include <RegisteredMetaTypes.h>
|
#include <RegisteredMetaTypes.h>
|
||||||
#include "ScriptEngineLogging.h"
|
#include "ScriptEngineLogging.h"
|
||||||
#include "DependencyManager.h"
|
#include "DependencyManager.h"
|
||||||
#include "OffscreenUi.h"
|
#include <OffscreenUi.h>
|
||||||
|
#include <InfoView.h>
|
||||||
#include "SoundEffect.h"
|
#include "SoundEffect.h"
|
||||||
|
|
||||||
TabletScriptingInterface::TabletScriptingInterface() {
|
TabletScriptingInterface::TabletScriptingInterface() {
|
||||||
|
@ -156,9 +157,10 @@ QObject* TabletScriptingInterface::getFlags()
|
||||||
static const char* TABLET_SOURCE_URL = "Tablet.qml";
|
static const char* TABLET_SOURCE_URL = "Tablet.qml";
|
||||||
static const char* WEB_VIEW_SOURCE_URL = "TabletWebView.qml";
|
static const char* WEB_VIEW_SOURCE_URL = "TabletWebView.qml";
|
||||||
static const char* VRMENU_SOURCE_URL = "TabletMenu.qml";
|
static const char* VRMENU_SOURCE_URL = "TabletMenu.qml";
|
||||||
|
static int s_windowNameCounter = 1;
|
||||||
|
|
||||||
TabletProxy::TabletProxy(QString name) : _name(name) {
|
TabletProxy::TabletProxy(QString name) : _name(name) {
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabletProxy::setToolbarMode(bool toolbarMode) {
|
void TabletProxy::setToolbarMode(bool toolbarMode) {
|
||||||
|
@ -171,9 +173,27 @@ void TabletProxy::setToolbarMode(bool toolbarMode) {
|
||||||
if (toolbarMode) {
|
if (toolbarMode) {
|
||||||
removeButtonsFromHomeScreen();
|
removeButtonsFromHomeScreen();
|
||||||
addButtonsToToolbar();
|
addButtonsToToolbar();
|
||||||
|
|
||||||
|
// create new desktop window
|
||||||
|
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||||
|
offscreenUi->executeOnUiThread([=, this] {
|
||||||
|
InfoView::registerType();
|
||||||
|
QString name = _name + QString("%1").arg(s_windowNameCounter++);
|
||||||
|
offscreenUi->show(QUrl("hifi/tablet/WindowRoot.qml"), name, [&](QQmlContext* context, QObject* newObject) {
|
||||||
|
QQuickItem* item = dynamic_cast<QQuickItem*>(newObject);
|
||||||
|
_desktopWindow = item;
|
||||||
|
QObject::connect(_desktopWindow, SIGNAL(windowClosed), this, SLOT(desktopWindowClosed()));
|
||||||
|
});
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
removeButtonsFromToolbar();
|
removeButtonsFromToolbar();
|
||||||
addButtonsToHomeScreen();
|
addButtonsToHomeScreen();
|
||||||
|
|
||||||
|
// destroy desktop window
|
||||||
|
if (_desktopWindow) {
|
||||||
|
_desktopWindow->deleteLater();
|
||||||
|
_desktopWindow = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,39 +266,63 @@ void TabletProxy::setQmlTabletRoot(QQuickItem* qmlTabletRoot, QObject* qmlOffscr
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabletProxy::gotoMenuScreen(const QString& submenu) {
|
void TabletProxy::gotoMenuScreen(const QString& submenu) {
|
||||||
if (_qmlTabletRoot) {
|
|
||||||
|
QObject* root = nullptr;
|
||||||
|
if (!_toolbarMode && _qmlTabletRoot) {
|
||||||
|
root = _qmlTabletRoot;
|
||||||
|
} else if (_toolbarMode && _desktopWindow) {
|
||||||
|
root = _desktopWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (root) {
|
||||||
if (_state != State::Menu) {
|
if (_state != State::Menu) {
|
||||||
removeButtonsFromHomeScreen();
|
removeButtonsFromHomeScreen();
|
||||||
QMetaObject::invokeMethod(_qmlTabletRoot, "setOption", Q_ARG(const QVariant&, QVariant(submenu)));
|
QMetaObject::invokeMethod(root, "setOption", Q_ARG(const QVariant&, QVariant(submenu)));
|
||||||
auto loader = _qmlTabletRoot->findChild<QQuickItem*>("loader");
|
auto loader = root->findChild<QQuickItem*>("loader");
|
||||||
QObject::connect(loader, SIGNAL(loaded()), this, SLOT(addButtonsToMenuScreen()), Qt::DirectConnection);
|
QObject::connect(loader, SIGNAL(loaded()), this, SLOT(addButtonsToMenuScreen()), Qt::DirectConnection);
|
||||||
QMetaObject::invokeMethod(_qmlTabletRoot, "loadSource", Q_ARG(const QVariant&, QVariant(VRMENU_SOURCE_URL)));
|
QMetaObject::invokeMethod(root, "loadSource", Q_ARG(const QVariant&, QVariant(VRMENU_SOURCE_URL)));
|
||||||
_state = State::Menu;
|
_state = State::Menu;
|
||||||
emit screenChanged(QVariant("Menu"), QVariant(VRMENU_SOURCE_URL));
|
emit screenChanged(QVariant("Menu"), QVariant(VRMENU_SOURCE_URL));
|
||||||
|
QMetaObject::invokeMethod(root, "setShown", Q_ARG(const QVariant&, QVariant(true)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabletProxy::loadQMLSource(const QVariant& path) {
|
void TabletProxy::loadQMLSource(const QVariant& path) {
|
||||||
if (_qmlTabletRoot) {
|
|
||||||
|
QObject* root = nullptr;
|
||||||
|
if (!_toolbarMode && _qmlTabletRoot) {
|
||||||
|
root = _qmlTabletRoot;
|
||||||
|
} else if (_toolbarMode && _desktopWindow) {
|
||||||
|
root = _desktopWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (root) {
|
||||||
if (_state != State::QML) {
|
if (_state != State::QML) {
|
||||||
removeButtonsFromHomeScreen();
|
removeButtonsFromHomeScreen();
|
||||||
QMetaObject::invokeMethod(_qmlTabletRoot, "loadSource", Q_ARG(const QVariant&, path));
|
QMetaObject::invokeMethod(root, "loadSource", Q_ARG(const QVariant&, path));
|
||||||
_state = State::QML;
|
_state = State::QML;
|
||||||
emit screenChanged(QVariant("QML"), path);
|
emit screenChanged(QVariant("QML"), path);
|
||||||
|
QMetaObject::invokeMethod(root, "setShown", Q_ARG(const QVariant&, QVariant(true)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabletProxy::gotoHomeScreen() {
|
void TabletProxy::gotoHomeScreen() {
|
||||||
if (_qmlTabletRoot) {
|
if (_state != State::Home) {
|
||||||
if (_state != State::Home) {
|
if (!_toolbarMode && _qmlTabletRoot) {
|
||||||
auto loader = _qmlTabletRoot->findChild<QQuickItem*>("loader");
|
auto loader = _qmlTabletRoot->findChild<QQuickItem*>("loader");
|
||||||
QObject::connect(loader, SIGNAL(loaded()), this, SLOT(addButtonsToHomeScreen()), Qt::DirectConnection);
|
QObject::connect(loader, SIGNAL(loaded()), this, SLOT(addButtonsToHomeScreen()), Qt::DirectConnection);
|
||||||
QMetaObject::invokeMethod(_qmlTabletRoot, "loadSource", Q_ARG(const QVariant&, QVariant(TABLET_SOURCE_URL)));
|
QMetaObject::invokeMethod(_qmlTabletRoot, "loadSource", Q_ARG(const QVariant&, QVariant(TABLET_SOURCE_URL)));
|
||||||
QMetaObject::invokeMethod(_qmlTabletRoot, "playButtonClickSound");
|
QMetaObject::invokeMethod(_qmlTabletRoot, "playButtonClickSound");
|
||||||
_state = State::Home;
|
} else if (_toolbarMode && _desktopWindow) {
|
||||||
emit screenChanged(QVariant("Home"), QVariant(TABLET_SOURCE_URL));
|
// close desktop window
|
||||||
|
if (_desktopWindow) {
|
||||||
|
QMetaObject::invokeMethod(_desktopWindow, "setShown", Q_ARG(const QVariant&, QVariant(false)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
_state = State::Home;
|
||||||
|
emit screenChanged(QVariant("Home"), QVariant(TABLET_SOURCE_URL));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,17 +331,24 @@ void TabletProxy::gotoWebScreen(const QString& url) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabletProxy::gotoWebScreen(const QString& url, const QString& injectedJavaScriptUrl) {
|
void TabletProxy::gotoWebScreen(const QString& url, const QString& injectedJavaScriptUrl) {
|
||||||
if (_qmlTabletRoot) {
|
|
||||||
if (_state == State::Home) {
|
QObject* root = nullptr;
|
||||||
removeButtonsFromHomeScreen();
|
if (!_toolbarMode && _qmlTabletRoot) {
|
||||||
|
root = _qmlTabletRoot;
|
||||||
|
} else if (_toolbarMode && _desktopWindow) {
|
||||||
|
root = _desktopWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_state != State::Web) {
|
||||||
|
if (root) {
|
||||||
|
QMetaObject::invokeMethod(root, "loadSource", Q_ARG(const QVariant&, QVariant(WEB_VIEW_SOURCE_URL)));
|
||||||
}
|
}
|
||||||
if (_state != State::Web) {
|
_state = State::Web;
|
||||||
QMetaObject::invokeMethod(_qmlTabletRoot, "loadSource", Q_ARG(const QVariant&, QVariant(WEB_VIEW_SOURCE_URL)));
|
emit screenChanged(QVariant("Web"), QVariant(url));
|
||||||
_state = State::Web;
|
}
|
||||||
emit screenChanged(QVariant("Web"), QVariant(url));
|
if (root) {
|
||||||
}
|
QMetaObject::invokeMethod(root, "setShown", Q_ARG(const QVariant&, QVariant(true)));
|
||||||
QMetaObject::invokeMethod(_qmlTabletRoot, "loadWebUrl", Q_ARG(const QVariant&, QVariant(url)),
|
QMetaObject::invokeMethod(root, "loadWebUrl", Q_ARG(const QVariant&, QVariant(url)), Q_ARG(const QVariant&, QVariant(injectedJavaScriptUrl)));
|
||||||
Q_ARG(const QVariant&, QVariant(injectedJavaScriptUrl)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,11 +442,18 @@ QObject* TabletProxy::getTabletSurface() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabletProxy::addButtonsToMenuScreen() {
|
void TabletProxy::addButtonsToMenuScreen() {
|
||||||
if (!_qmlTabletRoot) {
|
QObject* root = nullptr;
|
||||||
|
if (!_toolbarMode && _qmlTabletRoot) {
|
||||||
|
root = _qmlTabletRoot;
|
||||||
|
} else if (_toolbarMode && _desktopWindow) {
|
||||||
|
root = _desktopWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!root) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto loader = _qmlTabletRoot->findChild<QQuickItem*>("loader");
|
auto loader = root->findChild<QQuickItem*>("loader");
|
||||||
if (!loader) {
|
if (!loader) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -420,6 +478,10 @@ void TabletProxy::removeButtonsFromHomeScreen() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TabletProxy::desktopWindowClosed() {
|
||||||
|
gotoHomeScreen();
|
||||||
|
}
|
||||||
|
|
||||||
void TabletProxy::addButtonsToToolbar() {
|
void TabletProxy::addButtonsToToolbar() {
|
||||||
auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();
|
auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();
|
||||||
QObject* toolbarProxy = tabletScriptingInterface->getSystemToolbarProxy();
|
QObject* toolbarProxy = tabletScriptingInterface->getSystemToolbarProxy();
|
||||||
|
@ -515,6 +577,9 @@ void TabletButtonProxy::setQmlButton(QQuickItem* qmlButton) {
|
||||||
void TabletButtonProxy::setToolbarButtonProxy(QObject* toolbarButtonProxy) {
|
void TabletButtonProxy::setToolbarButtonProxy(QObject* toolbarButtonProxy) {
|
||||||
std::lock_guard<std::mutex> guard(_mutex);
|
std::lock_guard<std::mutex> guard(_mutex);
|
||||||
_toolbarButtonProxy = toolbarButtonProxy;
|
_toolbarButtonProxy = toolbarButtonProxy;
|
||||||
|
if (_toolbarButtonProxy) {
|
||||||
|
QObject::connect(_toolbarButtonProxy, SIGNAL(clicked()), this, SLOT(clickedSlot()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantMap TabletButtonProxy::getProperties() const {
|
QVariantMap TabletButtonProxy::getProperties() const {
|
||||||
|
|
|
@ -182,6 +182,7 @@ signals:
|
||||||
protected slots:
|
protected slots:
|
||||||
void addButtonsToHomeScreen();
|
void addButtonsToHomeScreen();
|
||||||
void addButtonsToMenuScreen();
|
void addButtonsToMenuScreen();
|
||||||
|
void desktopWindowClosed();
|
||||||
protected:
|
protected:
|
||||||
void removeButtonsFromHomeScreen();
|
void removeButtonsFromHomeScreen();
|
||||||
void addButtonsToToolbar();
|
void addButtonsToToolbar();
|
||||||
|
@ -192,6 +193,7 @@ protected:
|
||||||
std::vector<QSharedPointer<TabletButtonProxy>> _tabletButtonProxies;
|
std::vector<QSharedPointer<TabletButtonProxy>> _tabletButtonProxies;
|
||||||
QQuickItem* _qmlTabletRoot { nullptr };
|
QQuickItem* _qmlTabletRoot { nullptr };
|
||||||
QObject* _qmlOffscreenSurface { nullptr };
|
QObject* _qmlOffscreenSurface { nullptr };
|
||||||
|
QQuickItem* _desktopWindow { nullptr };
|
||||||
bool _toolbarMode { false };
|
bool _toolbarMode { false };
|
||||||
|
|
||||||
enum class State { Uninitialized, Home, Web, Menu, QML };
|
enum class State { Uninitialized, Home, Web, Menu, QML };
|
||||||
|
|
|
@ -20,17 +20,22 @@ const QString InfoView::NAME{ "InfoView" };
|
||||||
|
|
||||||
Setting::Handle<QString> infoVersion("info-version", QString());
|
Setting::Handle<QString> infoVersion("info-version", QString());
|
||||||
|
|
||||||
InfoView::InfoView(QQuickItem* parent) : QQuickItem(parent) {
|
static bool registered{ false };
|
||||||
|
|
||||||
|
InfoView::InfoView(QQuickItem* parent) : QQuickItem(parent) {
|
||||||
|
registerType();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InfoView::registerType() {
|
void InfoView::registerType() {
|
||||||
qmlRegisterType<InfoView>("Hifi", 1, 0, NAME.toLocal8Bit().constData());
|
if (!registered) {
|
||||||
}
|
qmlRegisterType<InfoView>("Hifi", 1, 0, NAME.toLocal8Bit().constData());
|
||||||
|
registered = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QString fetchVersion(const QUrl& url) {
|
QString fetchVersion(const QUrl& url) {
|
||||||
QXmlQuery query;
|
QXmlQuery query;
|
||||||
query.bindVariable("file", QVariant(url));
|
query.bindVariable("file", QVariant(url));
|
||||||
query.setQuery("string((doc($file)//input[@id='version'])[1]/@value)");
|
query.setQuery("string((doc($file)//input[@id='version'])[1]/@value)");
|
||||||
QString r;
|
QString r;
|
||||||
query.evaluateTo(&r);
|
query.evaluateTo(&r);
|
||||||
|
@ -38,14 +43,10 @@ QString fetchVersion(const QUrl& url) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void InfoView::show(const QString& path, bool firstOrChangedOnly, QString urlQuery) {
|
void InfoView::show(const QString& path, bool firstOrChangedOnly, QString urlQuery) {
|
||||||
static bool registered{ false };
|
registerType();
|
||||||
if (!registered) {
|
|
||||||
registerType();
|
|
||||||
registered = true;
|
|
||||||
}
|
|
||||||
QUrl url;
|
QUrl url;
|
||||||
if (QDir(path).isRelative()) {
|
if (QDir(path).isRelative()) {
|
||||||
url = QUrl::fromLocalFile(PathUtils::resourcesPath() + path);
|
url = QUrl::fromLocalFile(PathUtils::resourcesPath() + path);
|
||||||
} else {
|
} else {
|
||||||
url = QUrl::fromLocalFile(path);
|
url = QUrl::fromLocalFile(path);
|
||||||
}
|
}
|
||||||
|
@ -56,7 +57,7 @@ void InfoView::show(const QString& path, bool firstOrChangedOnly, QString urlQue
|
||||||
const QString version = fetchVersion(url);
|
const QString version = fetchVersion(url);
|
||||||
// If we have version information stored
|
// If we have version information stored
|
||||||
if (lastVersion != QString::null) {
|
if (lastVersion != QString::null) {
|
||||||
// Check to see the document version. If it's valid and matches
|
// Check to see the document version. If it's valid and matches
|
||||||
// the stored version, we're done, so exit
|
// the stored version, we're done, so exit
|
||||||
if (version == QString::null || version == lastVersion) {
|
if (version == QString::null || version == lastVersion) {
|
||||||
return;
|
return;
|
||||||
|
@ -87,4 +88,3 @@ void InfoView::setUrl(const QUrl& url) {
|
||||||
emit urlChanged();
|
emit urlChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -547,7 +547,7 @@ function startup(mode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// var mode = Settings.getValue("HUDUIEnabled");
|
// var mode = Settings.getValue("HUDUIEnabled");
|
||||||
startup(HMD.active ? "tablet" : "toolbar");
|
startup("tablet");
|
||||||
|
|
||||||
var isWired = false;
|
var isWired = false;
|
||||||
var audioTimer;
|
var audioTimer;
|
||||||
|
@ -720,9 +720,4 @@ function shutdown() {
|
||||||
//
|
//
|
||||||
Script.scriptEnding.connect(shutdown);
|
Script.scriptEnding.connect(shutdown);
|
||||||
|
|
||||||
HMD.displayModeChanged.connect(function () {
|
|
||||||
shutdown();
|
|
||||||
startup(HMD.active ? "tablet" : "toolbar");
|
|
||||||
});
|
|
||||||
|
|
||||||
}()); // END LOCAL_SCOPE
|
}()); // END LOCAL_SCOPE
|
||||||
|
|
Loading…
Reference in a new issue