From ba0ab8dc5d83266684e8c5d92aa407e16cb34ab5 Mon Sep 17 00:00:00 2001 From: HifiExperiments Date: Thu, 20 Jun 2024 14:48:52 -0700 Subject: [PATCH] fix audio devices + login popup --- interface/src/Application.h | 2 +- interface/src/Application_Setup.cpp | 28 +++++++++++++-------------- interface/src/main.cpp | 1 + libraries/networking/src/NodeList.cpp | 1 - 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/interface/src/Application.h b/interface/src/Application.h index bb5928625c3..9a38e418f36 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -743,7 +743,7 @@ private slots: bool _cursorNeedsChanging { false }; bool _useSystemCursor { false }; - DialogsManagerScriptingInterface* _dialogsManagerScriptingInterface { new DialogsManagerScriptingInterface() }; + DialogsManagerScriptingInterface* _dialogsManagerScriptingInterface; QPointer _logDialog; QPointer _entityScriptServerLogDialog; diff --git a/interface/src/Application_Setup.cpp b/interface/src/Application_Setup.cpp index 7b87fe5df84..4b760fa4e33 100644 --- a/interface/src/Application_Setup.cpp +++ b/interface/src/Application_Setup.cpp @@ -475,6 +475,7 @@ void Application::initialize(const QCommandLineParser &parser) { _entityEditSender = std::make_shared(); _graphicsEngine = std::make_shared(); _applicationOverlay = std::make_shared(); + _dialogsManagerScriptingInterface = new DialogsManagerScriptingInterface(); auto steamClient = PluginManager::getInstance()->getSteamClientPlugin(); setProperty(hifi::properties::STEAM, (steamClient && steamClient->isRunning())); @@ -585,8 +586,9 @@ void Application::initialize(const QCommandLineParser &parser) { } #if !defined(Q_OS_ANDROID) && !defined(DISABLE_QML) + const bool DISABLE_LOGIN_SCREEN = true; // Login screen is currently disabled // Do not show login dialog if requested not to on the command line - if (parser.isSet("no-login-suggestion")) { + if (DISABLE_LOGIN_SCREEN || parser.isSet("no-login-suggestion")) { _noLoginSuggestion = true; } #endif @@ -803,6 +805,10 @@ void Application::initialize(const QCommandLineParser &parser) { showCursor(Cursor::Manager::lookupIcon(_preferredCursor.get())); } + // An audio device changed signal received before the display plugins are set up will cause a crash, + // so we defer the setup of the `scripting::Audio` class until this point + DependencyManager::set(); + // Create the rendering engine. This can be slow on some machines due to lots of // GPU pipeline creation. initializeRenderEngine(); @@ -2016,17 +2022,13 @@ void Application::setupSignalsAndOperators() { resumeAfterLoginDialogActionTaken(); }); #else - // Do not show login dialog if requested not to on the command line - if (_noLoginSuggestion) { - connect(offscreenUi, &OffscreenUi::keyboardFocusActive, [this]() { - resumeAfterLoginDialogActionTaken(); - }); - } else { - connect(offscreenUi, &OffscreenUi::keyboardFocusActive, [this]() { + connect(offscreenUi, &OffscreenUi::keyboardFocusActive, [this]() { + // Do not show login dialog if requested not to on the command line + if (!_noLoginSuggestion) { showLoginScreen(); - resumeAfterLoginDialogActionTaken(); - }); - } + } + resumeAfterLoginDialogActionTaken(); + }); #endif // Monitor model assets (e.g., from Clara.io) added to the world that may need resizing. @@ -2124,9 +2126,7 @@ void Application::setupSignalsAndOperators() { }); audioIO->startThread(); - // An audio device changed signal received before the display plugins are set up will cause a crash, - // so we defer the setup of the `scripting::Audio` class until this point - auto audioScriptingInterface = DependencyManager::set().data(); + auto audioScriptingInterface = DependencyManager::get().data(); connect(audioIO, &AudioClient::mutedByMixer, audioScriptingInterface, &AudioScriptingInterface::mutedByMixer); connect(audioIO, &AudioClient::receivedFirstPacket, audioScriptingInterface, &AudioScriptingInterface::receivedFirstPacket); connect(audioIO, &AudioClient::disconnected, audioScriptingInterface, &AudioScriptingInterface::disconnected); diff --git a/interface/src/main.cpp b/interface/src/main.cpp index ff946428153..d22089df909 100644 --- a/interface/src/main.cpp +++ b/interface/src/main.cpp @@ -311,6 +311,7 @@ int main(int argc, const char* argv[]) { parser.addOption(noLauncherOption); parser.addOption(responseTokensOption); parser.addOption(displayNameOption); + parser.addOption(noLoginOption); parser.addOption(overrideScriptsPathOption); parser.addOption(defaultScriptsOverrideOption); parser.addOption(traceFileOption); diff --git a/libraries/networking/src/NodeList.cpp b/libraries/networking/src/NodeList.cpp index a2309709092..73243243d37 100644 --- a/libraries/networking/src/NodeList.cpp +++ b/libraries/networking/src/NodeList.cpp @@ -99,7 +99,6 @@ NodeList::NodeList(char newOwnerType, int socketListenPort, int dtlsListenPort) // FIXME: Can remove this temporary work-around in version 2021.2.0. (New protocol version implies a domain server upgrade.) // Adjust our canRezAvatarEntities permissions on older domains that do not have this setting. // DomainServerList and DomainSettings packets can come in either order so need to adjust with both occurrences. - auto nodeList = DependencyManager::get(); connect(&_domainHandler, &DomainHandler::settingsReceived, this, &NodeList::adjustCanRezAvatarEntitiesPerSettings); auto accountManager = DependencyManager::get();