mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 23:40:11 +02:00
Merge branch 'master' of github.com:highfidelity/hifi into fix-dont-send-non-entity-edits-over-wire
This commit is contained in:
commit
9ab2a61a4b
5 changed files with 72 additions and 49 deletions
|
@ -18,7 +18,7 @@ Item {
|
||||||
property string url
|
property string url
|
||||||
property string scriptURL
|
property string scriptURL
|
||||||
property alias eventBridge: eventBridgeWrapper.eventBridge
|
property alias eventBridge: eventBridgeWrapper.eventBridge
|
||||||
property bool keyboardEnabled: HMD.active
|
property bool keyboardEnabled: false
|
||||||
property bool keyboardRaised: false
|
property bool keyboardRaised: false
|
||||||
property bool punctuationMode: false
|
property bool punctuationMode: false
|
||||||
property bool isDesktop: false
|
property bool isDesktop: false
|
||||||
|
@ -273,7 +273,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WebEngineView.LoadFailedStatus == loadRequest.status) {
|
if (WebEngineView.LoadFailedStatus == loadRequest.status) {
|
||||||
console.log(" Tablet WebEngineView failed to laod url: " + loadRequest.url.toString());
|
console.log(" Tablet WebEngineView failed to load url: " + loadRequest.url.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WebEngineView.LoadSucceededStatus == loadRequest.status) {
|
if (WebEngineView.LoadSucceededStatus == loadRequest.status) {
|
||||||
|
@ -281,6 +281,7 @@ Item {
|
||||||
web.initialPage = webview.url;
|
web.initialPage = webview.url;
|
||||||
startingUp = false;
|
startingUp = false;
|
||||||
}
|
}
|
||||||
|
webview.forceActiveFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -305,6 +306,7 @@ Item {
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
web.isDesktop = (typeof desktop !== "undefined");
|
web.isDesktop = (typeof desktop !== "undefined");
|
||||||
|
keyboardEnabled = HMD.active;
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys.onPressed: {
|
Keys.onPressed: {
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
#include <InfoView.h>
|
#include <InfoView.h>
|
||||||
#include "SoundEffect.h"
|
#include "SoundEffect.h"
|
||||||
|
|
||||||
|
const QString SYSTEM_TOOLBAR = "com.highfidelity.interface.toolbar.system";
|
||||||
|
const QString SYSTEM_TABLET = "com.highfidelity.interface.tablet.system";
|
||||||
|
|
||||||
QScriptValue tabletToScriptValue(QScriptEngine* engine, TabletProxy* const &in) {
|
QScriptValue tabletToScriptValue(QScriptEngine* engine, TabletProxy* const &in) {
|
||||||
return engine->newQObject(in, QScriptEngine::QtOwnership, QScriptEngine::ExcludeDeleteLater | QScriptEngine::ExcludeChildObjects);
|
return engine->newQObject(in, QScriptEngine::QtOwnership, QScriptEngine::ExcludeDeleteLater | QScriptEngine::ExcludeChildObjects);
|
||||||
|
@ -35,11 +37,11 @@ TabletScriptingInterface::TabletScriptingInterface() {
|
||||||
}
|
}
|
||||||
|
|
||||||
QObject* TabletScriptingInterface::getSystemToolbarProxy() {
|
QObject* TabletScriptingInterface::getSystemToolbarProxy() {
|
||||||
const QString SYSTEM_TOOLBAR = "com.highfidelity.interface.toolbar.system";
|
|
||||||
Qt::ConnectionType connectionType = Qt::AutoConnection;
|
Qt::ConnectionType connectionType = Qt::AutoConnection;
|
||||||
if (QThread::currentThread() != _toolbarScriptingInterface->thread()) {
|
if (QThread::currentThread() != _toolbarScriptingInterface->thread()) {
|
||||||
connectionType = Qt::BlockingQueuedConnection;
|
connectionType = Qt::BlockingQueuedConnection;
|
||||||
}
|
}
|
||||||
|
|
||||||
QObject* toolbarProxy = nullptr;
|
QObject* toolbarProxy = nullptr;
|
||||||
bool hasResult = QMetaObject::invokeMethod(_toolbarScriptingInterface, "getToolbar", connectionType, Q_RETURN_ARG(QObject*, toolbarProxy), Q_ARG(QString, SYSTEM_TOOLBAR));
|
bool hasResult = QMetaObject::invokeMethod(_toolbarScriptingInterface, "getToolbar", connectionType, Q_RETURN_ARG(QObject*, toolbarProxy), Q_ARG(QString, SYSTEM_TOOLBAR));
|
||||||
if (hasResult) {
|
if (hasResult) {
|
||||||
|
@ -51,28 +53,38 @@ QObject* TabletScriptingInterface::getSystemToolbarProxy() {
|
||||||
}
|
}
|
||||||
|
|
||||||
TabletProxy* TabletScriptingInterface::getTablet(const QString& tabletId) {
|
TabletProxy* TabletScriptingInterface::getTablet(const QString& tabletId) {
|
||||||
|
TabletProxy* tabletProxy = nullptr;
|
||||||
|
{
|
||||||
|
// the only thing guarded should be map mutation
|
||||||
|
// this avoids a deadlock with the Main thread
|
||||||
|
// from Qt::BlockingQueuedEvent invocations later in the call-tree
|
||||||
|
std::lock_guard<std::mutex> guard(_mapMutex);
|
||||||
|
|
||||||
std::lock_guard<std::mutex> guard(_mutex);
|
|
||||||
|
|
||||||
// look up tabletId in the map.
|
|
||||||
auto iter = _tabletProxies.find(tabletId);
|
auto iter = _tabletProxies.find(tabletId);
|
||||||
if (iter != _tabletProxies.end()) {
|
if (iter != _tabletProxies.end()) {
|
||||||
// tablet already exists, just return it.
|
// tablet already exists
|
||||||
return iter->second;
|
return iter->second;
|
||||||
} else {
|
} else {
|
||||||
// allocate a new tablet, add it to the map then return it.
|
// tablet must be created
|
||||||
auto tabletProxy = new TabletProxy(tabletId);
|
tabletProxy = new TabletProxy(this, tabletId);
|
||||||
tabletProxy->setParent(this);
|
|
||||||
_tabletProxies[tabletId] = tabletProxy;
|
_tabletProxies[tabletId] = tabletProxy;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(tabletProxy);
|
||||||
|
// initialize new tablet
|
||||||
tabletProxy->setToolbarMode(_toolbarMode);
|
tabletProxy->setToolbarMode(_toolbarMode);
|
||||||
return tabletProxy;
|
return tabletProxy;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabletScriptingInterface::setToolbarMode(bool toolbarMode) {
|
void TabletScriptingInterface::setToolbarMode(bool toolbarMode) {
|
||||||
std::lock_guard<std::mutex> guard(_mutex);
|
{
|
||||||
|
// the only thing guarded should be _toolbarMode
|
||||||
|
// this avoids a deadlock with the Main thread
|
||||||
|
// from Qt::BlockingQueuedEvent invocations later in the call-tree
|
||||||
|
std::lock_guard<std::mutex> guard(_mapMutex);
|
||||||
_toolbarMode = toolbarMode;
|
_toolbarMode = toolbarMode;
|
||||||
|
}
|
||||||
|
|
||||||
for (auto& iter : _tabletProxies) {
|
for (auto& iter : _tabletProxies) {
|
||||||
iter.second->setToolbarMode(toolbarMode);
|
iter.second->setToolbarMode(toolbarMode);
|
||||||
|
@ -89,8 +101,9 @@ void TabletScriptingInterface::setQmlTabletRoot(QString tabletId, QQuickItem* qm
|
||||||
}
|
}
|
||||||
|
|
||||||
QQuickWindow* TabletScriptingInterface::getTabletWindow() {
|
QQuickWindow* TabletScriptingInterface::getTabletWindow() {
|
||||||
TabletProxy* tablet = qobject_cast<TabletProxy*>(getTablet("com.highfidelity.interface.tablet.system"));
|
TabletProxy* tablet = qobject_cast<TabletProxy*>(getTablet(SYSTEM_TABLET));
|
||||||
QObject* qmlSurface = tablet->getTabletSurface();
|
QObject* qmlSurface = tablet->getTabletSurface();
|
||||||
|
|
||||||
OffscreenQmlSurface* surface = dynamic_cast<OffscreenQmlSurface*>(qmlSurface);
|
OffscreenQmlSurface* surface = dynamic_cast<OffscreenQmlSurface*>(qmlSurface);
|
||||||
|
|
||||||
if (!surface) {
|
if (!surface) {
|
||||||
|
@ -156,7 +169,7 @@ void TabletScriptingInterface::processTabletEvents(QObject* object, const QKeyEv
|
||||||
|
|
||||||
|
|
||||||
void TabletScriptingInterface::processEvent(const QKeyEvent* event) {
|
void TabletScriptingInterface::processEvent(const QKeyEvent* event) {
|
||||||
TabletProxy* tablet = qobject_cast<TabletProxy*>(getTablet("com.highfidelity.interface.tablet.system"));
|
TabletProxy* tablet = qobject_cast<TabletProxy*>(getTablet(SYSTEM_TABLET));
|
||||||
QObject* qmlTablet = tablet->getQmlTablet();
|
QObject* qmlTablet = tablet->getQmlTablet();
|
||||||
QObject* qmlMenu = tablet->getQmlMenu();
|
QObject* qmlMenu = tablet->getQmlMenu();
|
||||||
|
|
||||||
|
@ -185,10 +198,12 @@ class TabletRootWindow : public QmlWindowClass {
|
||||||
virtual QString qmlSource() const override { return "hifi/tablet/WindowRoot.qml"; }
|
virtual QString qmlSource() const override { return "hifi/tablet/WindowRoot.qml"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
TabletProxy::TabletProxy(QString name) : _name(name) {
|
TabletProxy::TabletProxy(QObject* parent, QString name) : QObject(parent), _name(name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabletProxy::setToolbarMode(bool toolbarMode) {
|
void TabletProxy::setToolbarMode(bool toolbarMode) {
|
||||||
|
std::lock_guard<std::mutex> guard(_tabletMutex);
|
||||||
|
|
||||||
if (toolbarMode == _toolbarMode) {
|
if (toolbarMode == _toolbarMode) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -288,7 +303,7 @@ bool TabletProxy::isPathLoaded(QVariant path) {
|
||||||
return path.toString() == _currentPathLoaded.toString();
|
return path.toString() == _currentPathLoaded.toString();
|
||||||
}
|
}
|
||||||
void TabletProxy::setQmlTabletRoot(QQuickItem* qmlTabletRoot, QObject* qmlOffscreenSurface) {
|
void TabletProxy::setQmlTabletRoot(QQuickItem* qmlTabletRoot, QObject* qmlOffscreenSurface) {
|
||||||
std::lock_guard<std::mutex> guard(_mutex);
|
std::lock_guard<std::mutex> guard(_tabletMutex);
|
||||||
_qmlOffscreenSurface = qmlOffscreenSurface;
|
_qmlOffscreenSurface = qmlOffscreenSurface;
|
||||||
_qmlTabletRoot = qmlTabletRoot;
|
_qmlTabletRoot = qmlTabletRoot;
|
||||||
if (_qmlTabletRoot && _qmlOffscreenSurface) {
|
if (_qmlTabletRoot && _qmlOffscreenSurface) {
|
||||||
|
@ -519,7 +534,7 @@ void TabletProxy::gotoWebScreen(const QString& url, const QString& injectedJavaS
|
||||||
|
|
||||||
QObject* TabletProxy::addButton(const QVariant& properties) {
|
QObject* TabletProxy::addButton(const QVariant& properties) {
|
||||||
auto tabletButtonProxy = QSharedPointer<TabletButtonProxy>(new TabletButtonProxy(properties.toMap()));
|
auto tabletButtonProxy = QSharedPointer<TabletButtonProxy>(new TabletButtonProxy(properties.toMap()));
|
||||||
std::lock_guard<std::mutex> guard(_mutex);
|
std::lock_guard<std::mutex> guard(_tabletMutex);
|
||||||
_tabletButtonProxies.push_back(tabletButtonProxy);
|
_tabletButtonProxies.push_back(tabletButtonProxy);
|
||||||
if (!_toolbarMode && _qmlTabletRoot) {
|
if (!_toolbarMode && _qmlTabletRoot) {
|
||||||
auto tablet = getQmlTablet();
|
auto tablet = getQmlTablet();
|
||||||
|
@ -555,7 +570,7 @@ bool TabletProxy::onHomeScreen() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabletProxy::removeButton(QObject* tabletButtonProxy) {
|
void TabletProxy::removeButton(QObject* tabletButtonProxy) {
|
||||||
std::lock_guard<std::mutex> guard(_mutex);
|
std::lock_guard<std::mutex> guard(_tabletMutex);
|
||||||
|
|
||||||
auto tablet = getQmlTablet();
|
auto tablet = getQmlTablet();
|
||||||
if (!tablet) {
|
if (!tablet) {
|
||||||
|
@ -743,12 +758,12 @@ TabletButtonProxy::TabletButtonProxy(const QVariantMap& properties) :
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabletButtonProxy::setQmlButton(QQuickItem* qmlButton) {
|
void TabletButtonProxy::setQmlButton(QQuickItem* qmlButton) {
|
||||||
std::lock_guard<std::mutex> guard(_mutex);
|
std::lock_guard<std::mutex> guard(_buttonMutex);
|
||||||
_qmlButton = qmlButton;
|
_qmlButton = qmlButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabletButtonProxy::setToolbarButtonProxy(QObject* toolbarButtonProxy) {
|
void TabletButtonProxy::setToolbarButtonProxy(QObject* toolbarButtonProxy) {
|
||||||
std::lock_guard<std::mutex> guard(_mutex);
|
std::lock_guard<std::mutex> guard(_buttonMutex);
|
||||||
_toolbarButtonProxy = toolbarButtonProxy;
|
_toolbarButtonProxy = toolbarButtonProxy;
|
||||||
if (_toolbarButtonProxy) {
|
if (_toolbarButtonProxy) {
|
||||||
QObject::connect(_toolbarButtonProxy, SIGNAL(clicked()), this, SLOT(clickedSlot()));
|
QObject::connect(_toolbarButtonProxy, SIGNAL(clicked()), this, SLOT(clickedSlot()));
|
||||||
|
@ -756,12 +771,12 @@ void TabletButtonProxy::setToolbarButtonProxy(QObject* toolbarButtonProxy) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantMap TabletButtonProxy::getProperties() const {
|
QVariantMap TabletButtonProxy::getProperties() const {
|
||||||
std::lock_guard<std::mutex> guard(_mutex);
|
std::lock_guard<std::mutex> guard(_buttonMutex);
|
||||||
return _properties;
|
return _properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabletButtonProxy::editProperties(QVariantMap properties) {
|
void TabletButtonProxy::editProperties(QVariantMap properties) {
|
||||||
std::lock_guard<std::mutex> guard(_mutex);
|
std::lock_guard<std::mutex> guard(_buttonMutex);
|
||||||
|
|
||||||
QVariantMap::const_iterator iter = properties.constBegin();
|
QVariantMap::const_iterator iter = properties.constBegin();
|
||||||
while (iter != properties.constEnd()) {
|
while (iter != properties.constEnd()) {
|
||||||
|
|
|
@ -71,7 +71,7 @@ private:
|
||||||
void processTabletEvents(QObject* object, const QKeyEvent* event);
|
void processTabletEvents(QObject* object, const QKeyEvent* event);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::mutex _mutex;
|
std::mutex _mapMutex;
|
||||||
std::map<QString, TabletProxy*> _tabletProxies;
|
std::map<QString, TabletProxy*> _tabletProxies;
|
||||||
QObject* _toolbarScriptingInterface { nullptr };
|
QObject* _toolbarScriptingInterface { nullptr };
|
||||||
bool _toolbarMode { false };
|
bool _toolbarMode { false };
|
||||||
|
@ -90,7 +90,7 @@ class TabletProxy : public QObject {
|
||||||
Q_PROPERTY(bool landscape READ getLandscape WRITE setLandscape)
|
Q_PROPERTY(bool landscape READ getLandscape WRITE setLandscape)
|
||||||
Q_PROPERTY(bool tabletShown MEMBER _tabletShown NOTIFY tabletShownChanged)
|
Q_PROPERTY(bool tabletShown MEMBER _tabletShown NOTIFY tabletShownChanged)
|
||||||
public:
|
public:
|
||||||
TabletProxy(QString name);
|
TabletProxy(QObject* parent, QString name);
|
||||||
|
|
||||||
void setQmlTabletRoot(QQuickItem* qmlTabletRoot, QObject* qmlOffscreenSurface);
|
void setQmlTabletRoot(QQuickItem* qmlTabletRoot, QObject* qmlOffscreenSurface);
|
||||||
|
|
||||||
|
@ -248,7 +248,7 @@ protected:
|
||||||
QVariant _initialPath { "" };
|
QVariant _initialPath { "" };
|
||||||
QVariant _currentPathLoaded { "" };
|
QVariant _currentPathLoaded { "" };
|
||||||
QString _name;
|
QString _name;
|
||||||
std::mutex _mutex;
|
std::mutex _tabletMutex;
|
||||||
std::vector<QSharedPointer<TabletButtonProxy>> _tabletButtonProxies;
|
std::vector<QSharedPointer<TabletButtonProxy>> _tabletButtonProxies;
|
||||||
QQuickItem* _qmlTabletRoot { nullptr };
|
QQuickItem* _qmlTabletRoot { nullptr };
|
||||||
QObject* _qmlOffscreenSurface { nullptr };
|
QObject* _qmlOffscreenSurface { nullptr };
|
||||||
|
@ -309,7 +309,7 @@ signals:
|
||||||
protected:
|
protected:
|
||||||
QUuid _uuid;
|
QUuid _uuid;
|
||||||
int _stableOrder;
|
int _stableOrder;
|
||||||
mutable std::mutex _mutex;
|
mutable std::mutex _buttonMutex;
|
||||||
QQuickItem* _qmlButton { nullptr };
|
QQuickItem* _qmlButton { nullptr };
|
||||||
QObject* _toolbarButtonProxy { nullptr };
|
QObject* _toolbarButtonProxy { nullptr };
|
||||||
QVariantMap _properties;
|
QVariantMap _properties;
|
||||||
|
|
|
@ -53,10 +53,6 @@ function updatePlayersUnused() {
|
||||||
elPlayersUnused.innerHTML = numberOfPlayers - recordingsBeingPlayed.length;
|
elPlayersUnused.innerHTML = numberOfPlayers - recordingsBeingPlayed.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
function orderRecording(a, b) {
|
|
||||||
return a.filename > b.filename ? 1 : -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateRecordings() {
|
function updateRecordings() {
|
||||||
var tbody,
|
var tbody,
|
||||||
tr,
|
tr,
|
||||||
|
@ -68,8 +64,6 @@ function updateRecordings() {
|
||||||
i,
|
i,
|
||||||
HIFI_GLYPH_CLOSE = "w";
|
HIFI_GLYPH_CLOSE = "w";
|
||||||
|
|
||||||
recordingsBeingPlayed.sort(orderRecording);
|
|
||||||
|
|
||||||
tbody = document.createElement("tbody");
|
tbody = document.createElement("tbody");
|
||||||
tbody.id = "recordings-list";
|
tbody.id = "recordings-list";
|
||||||
|
|
||||||
|
|
|
@ -277,6 +277,7 @@
|
||||||
playerIsPlayings = [], // True if AC player script is playing a recording.
|
playerIsPlayings = [], // True if AC player script is playing a recording.
|
||||||
playerRecordings = [], // Assignment client mappings of recordings being played.
|
playerRecordings = [], // Assignment client mappings of recordings being played.
|
||||||
playerTimestamps = [], // Timestamps of last heartbeat update from player script.
|
playerTimestamps = [], // Timestamps of last heartbeat update from player script.
|
||||||
|
playerStartupTimeouts = [], // Timers that check that recording has started playing.
|
||||||
|
|
||||||
updateTimer,
|
updateTimer,
|
||||||
UPDATE_INTERVAL = 5000; // Must be > player's HEARTBEAT_INTERVAL.
|
UPDATE_INTERVAL = 5000; // Must be > player's HEARTBEAT_INTERVAL.
|
||||||
|
@ -297,6 +298,7 @@
|
||||||
playerIsPlayings.splice(i, 1);
|
playerIsPlayings.splice(i, 1);
|
||||||
playerRecordings.splice(i, 1);
|
playerRecordings.splice(i, 1);
|
||||||
playerTimestamps.splice(i, 1);
|
playerTimestamps.splice(i, 1);
|
||||||
|
playerStartupTimeouts.splice(i, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,16 +335,25 @@
|
||||||
orientation: orientation
|
orientation: orientation
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Script.setTimeout(function () {
|
playerStartupTimeouts[index] = Script.setTimeout(function () {
|
||||||
if (!playerIsPlayings[index] || playerRecordings[index] !== recording) {
|
if ((!playerIsPlayings[index] || playerRecordings[index] !== recording) && playerStartupTimeouts[index]) {
|
||||||
error("Didn't start playing recording "
|
error("Didn't start playing recording "
|
||||||
+ recording.slice(4) + "!"); // Remove leading "atp:" from recording.
|
+ recording.slice(4) + "!"); // Remove leading "atp:" from recording.
|
||||||
}
|
}
|
||||||
|
playerStartupTimeouts[index] = null;
|
||||||
}, CHECK_PLAYING_TIMEOUT);
|
}, CHECK_PLAYING_TIMEOUT);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function stopPlayingRecording(playerID) {
|
function stopPlayingRecording(playerID) {
|
||||||
|
var index;
|
||||||
|
|
||||||
|
// Cancel check that recording started playing.
|
||||||
|
index = playerIDs.indexOf(playerID);
|
||||||
|
if (index !== -1 && playerStartupTimeouts[index] !== null) {
|
||||||
|
// Cannot clearTimeout() without program log error, so just set null.
|
||||||
|
playerStartupTimeouts[index] = null;
|
||||||
|
}
|
||||||
|
|
||||||
Messages.sendMessage(HIFI_PLAYER_CHANNEL, JSON.stringify({
|
Messages.sendMessage(HIFI_PLAYER_CHANNEL, JSON.stringify({
|
||||||
player: playerID,
|
player: playerID,
|
||||||
command: PLAYER_COMMAND_STOP
|
command: PLAYER_COMMAND_STOP
|
||||||
|
@ -375,6 +386,7 @@
|
||||||
playerIsPlayings = [];
|
playerIsPlayings = [];
|
||||||
playerRecordings = [];
|
playerRecordings = [];
|
||||||
playerTimestamps = [];
|
playerTimestamps = [];
|
||||||
|
playerStartupTimeouts = [];
|
||||||
Dialog.updatePlayerDetails(playerIsPlayings, playerRecordings, playerIDs);
|
Dialog.updatePlayerDetails(playerIsPlayings, playerRecordings, playerIDs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue