Skip to content

Commit

Permalink
fix audio devices + login popup
Browse files Browse the repository at this point in the history
  • Loading branch information
HifiExperiments committed Jun 20, 2024
1 parent 69de648 commit ba0ab8d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion interface/src/Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ private slots:
bool _cursorNeedsChanging { false };
bool _useSystemCursor { false };

DialogsManagerScriptingInterface* _dialogsManagerScriptingInterface { new DialogsManagerScriptingInterface() };
DialogsManagerScriptingInterface* _dialogsManagerScriptingInterface;

QPointer<LogDialog> _logDialog;
QPointer<EntityScriptServerLogDialog> _entityScriptServerLogDialog;
Expand Down
28 changes: 14 additions & 14 deletions interface/src/Application_Setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,7 @@ void Application::initialize(const QCommandLineParser &parser) {
_entityEditSender = std::make_shared<EntityEditPacketSender>();
_graphicsEngine = std::make_shared<GraphicsEngine>();
_applicationOverlay = std::make_shared<ApplicationOverlay>();
_dialogsManagerScriptingInterface = new DialogsManagerScriptingInterface();

auto steamClient = PluginManager::getInstance()->getSteamClientPlugin();
setProperty(hifi::properties::STEAM, (steamClient && steamClient->isRunning()));
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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<AudioScriptingInterface, scripting::Audio>();

// Create the rendering engine. This can be slow on some machines due to lots of
// GPU pipeline creation.
initializeRenderEngine();
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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<AudioScriptingInterface, scripting::Audio>().data();
auto audioScriptingInterface = DependencyManager::get<AudioScriptingInterface>().data();
connect(audioIO, &AudioClient::mutedByMixer, audioScriptingInterface, &AudioScriptingInterface::mutedByMixer);
connect(audioIO, &AudioClient::receivedFirstPacket, audioScriptingInterface, &AudioScriptingInterface::receivedFirstPacket);
connect(audioIO, &AudioClient::disconnected, audioScriptingInterface, &AudioScriptingInterface::disconnected);
Expand Down
1 change: 1 addition & 0 deletions interface/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion libraries/networking/src/NodeList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<NodeList>();
connect(&_domainHandler, &DomainHandler::settingsReceived, this, &NodeList::adjustCanRezAvatarEntitiesPerSettings);

auto accountManager = DependencyManager::get<AccountManager>();
Expand Down

0 comments on commit ba0ab8d

Please sign in to comment.