Merge branch 'master' of github.com:highfidelity/hifi into nut

This commit is contained in:
Sam Gateau 2019-06-12 19:15:25 -07:00
commit fbab3fcde9
4 changed files with 29 additions and 8 deletions

View file

@ -12,6 +12,8 @@ import controlsUit 1.0
OriginalDesktop.Desktop {
id: desktop
property alias toolbarObjectName: sysToolbar.objectName
MouseArea {
id: hoverWatch
anchors.fill: parent
@ -70,7 +72,12 @@ OriginalDesktop.Desktop {
x: sysToolbar.x
buttonModel: tablet ? tablet.buttons : null;
shown: tablet ? tablet.toolbarMode : false;
onVisibleChanged: {
desktop.toolbarVisibleChanged(visible, sysToolbar.objectName);
}
}
signal toolbarVisibleChanged(bool isVisible, string toolbarName);
QtSettings.Settings {
id: settings;

View file

@ -27,6 +27,7 @@
#include "VrMenu.h"
#include "ui/Logging.h"
#include "ui/ToolbarScriptingInterface.h"
#include <PointerManager.h>
#include "MainWindow.h"
@ -688,6 +689,10 @@ void OffscreenUi::createDesktop(const QUrl& url) {
menuInitializer(_vrMenu);
}
auto toolbarScriptingInterface = DependencyManager::get<ToolbarScriptingInterface>();
connect(_desktop, SIGNAL(toolbarVisibleChanged(bool, QString)), toolbarScriptingInterface.data(), SIGNAL(toolbarVisibleChanged(bool, QString)));
auto keyboardFocus = new KeyboardFocusHack();
connect(_desktop, SIGNAL(showDesktop()), this, SIGNAL(showDesktop()));
emit desktopReady();

View file

@ -150,6 +150,9 @@ public:
* @returns {ToolbarProxy}
*/
Q_INVOKABLE ToolbarProxy* getToolbar(const QString& toolbarId);
signals:
void toolbarVisibleChanged(bool isVisible, QString toolbarName);
};

View file

@ -457,16 +457,18 @@ function onGeometryChanged(rect) {
}
}
var TIMEOUT_BEFORE_REHIDE_TOOLBAR_MS = 700;
function onDisplayModeChanged(isHMDMode) {
if (isHMDMode) {
Camera.setModeString("first person");
} else if (Settings.getValue("simplifiedUI/keepExistingUIAndScripts", false)) {
// works for now, but not a permanent fix by any means.
Script.setTimeout(function () {
var toolbar = Toolbars.getToolbar(TOOLBAR_NAME);
}
}
function onToolbarVisibleChanged(isVisible, toolbarName) {
if (isVisible && toolbarName == TOOLBAR_NAME && !Settings.getValue("simplifiedUI/keepExistingUIAndScripts", false)) {
var toolbar = Toolbars.getToolbar(toolbarName);
if (toolbar) {
toolbar.writeProperty("visible", false);
}, TIMEOUT_BEFORE_REHIDE_TOOLBAR_MS);
}
}
}
@ -497,7 +499,9 @@ function startup() {
if (!HMD.active) {
var toolbar = Toolbars.getToolbar(TOOLBAR_NAME);
toolbar.writeProperty("visible", false);
if (toolbar) {
toolbar.writeProperty("visible", false);
}
}
}
@ -517,6 +521,7 @@ function startup() {
Audio.localInjectorGainChanged.connect(maybeUpdateOutputDeviceMutedOverlay);
Audio.serverInjectorGainChanged.connect(maybeUpdateOutputDeviceMutedOverlay);
Audio.systemInjectorGainChanged.connect(maybeUpdateOutputDeviceMutedOverlay);
Toolbars.toolbarVisibleChanged.connect(onToolbarVisibleChanged);
oldShowAudioTools = AvatarInputs.showAudioTools;
AvatarInputs.showAudioTools = false;
@ -544,7 +549,7 @@ function shutdown() {
var toolbar = Toolbars.getToolbar(TOOLBAR_NAME);
if (toolbar) {
toolbar.writeProperty("visible", true);
}
}
}
}
@ -573,6 +578,7 @@ function shutdown() {
Audio.localInjectorGainChanged.disconnect(maybeUpdateOutputDeviceMutedOverlay);
Audio.serverInjectorGainChanged.disconnect(maybeUpdateOutputDeviceMutedOverlay);
Audio.systemInjectorGainChanged.disconnect(maybeUpdateOutputDeviceMutedOverlay);
Toolbars.toolbarVisibleChanged.disconnect(onToolbarVisibleChanged);
AvatarInputs.showAudioTools = oldShowAudioTools;
AvatarInputs.showBubbleTools = oldShowBubbleTools;