Merge pull request #15752 from PrestonB1123/moreToolbarTinkering

BUGZ-666: Toolbar Artifact Always Present
This commit is contained in:
Brad Hefta-Gaub 2019-06-12 17:14:18 -07:00 committed by GitHub
commit 50cfe4531e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 8 deletions

View file

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

View file

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

View file

@ -150,6 +150,9 @@ public:
* @returns {ToolbarProxy} * @returns {ToolbarProxy}
*/ */
Q_INVOKABLE ToolbarProxy* getToolbar(const QString& toolbarId); 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) { function onDisplayModeChanged(isHMDMode) {
if (isHMDMode) { if (isHMDMode) {
Camera.setModeString("first person"); 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); toolbar.writeProperty("visible", false);
}, TIMEOUT_BEFORE_REHIDE_TOOLBAR_MS); }
} }
} }
@ -497,7 +499,9 @@ function startup() {
if (!HMD.active) { if (!HMD.active) {
var toolbar = Toolbars.getToolbar(TOOLBAR_NAME); 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.localInjectorGainChanged.connect(maybeUpdateOutputDeviceMutedOverlay);
Audio.serverInjectorGainChanged.connect(maybeUpdateOutputDeviceMutedOverlay); Audio.serverInjectorGainChanged.connect(maybeUpdateOutputDeviceMutedOverlay);
Audio.systemInjectorGainChanged.connect(maybeUpdateOutputDeviceMutedOverlay); Audio.systemInjectorGainChanged.connect(maybeUpdateOutputDeviceMutedOverlay);
Toolbars.toolbarVisibleChanged.connect(onToolbarVisibleChanged);
oldShowAudioTools = AvatarInputs.showAudioTools; oldShowAudioTools = AvatarInputs.showAudioTools;
AvatarInputs.showAudioTools = false; AvatarInputs.showAudioTools = false;
@ -544,7 +549,7 @@ function shutdown() {
var toolbar = Toolbars.getToolbar(TOOLBAR_NAME); var toolbar = Toolbars.getToolbar(TOOLBAR_NAME);
if (toolbar) { if (toolbar) {
toolbar.writeProperty("visible", true); toolbar.writeProperty("visible", true);
} }
} }
} }
@ -573,6 +578,7 @@ function shutdown() {
Audio.localInjectorGainChanged.disconnect(maybeUpdateOutputDeviceMutedOverlay); Audio.localInjectorGainChanged.disconnect(maybeUpdateOutputDeviceMutedOverlay);
Audio.serverInjectorGainChanged.disconnect(maybeUpdateOutputDeviceMutedOverlay); Audio.serverInjectorGainChanged.disconnect(maybeUpdateOutputDeviceMutedOverlay);
Audio.systemInjectorGainChanged.disconnect(maybeUpdateOutputDeviceMutedOverlay); Audio.systemInjectorGainChanged.disconnect(maybeUpdateOutputDeviceMutedOverlay);
Toolbars.toolbarVisibleChanged.disconnect(onToolbarVisibleChanged);
AvatarInputs.showAudioTools = oldShowAudioTools; AvatarInputs.showAudioTools = oldShowAudioTools;
AvatarInputs.showBubbleTools = oldShowBubbleTools; AvatarInputs.showBubbleTools = oldShowBubbleTools;