diff --git a/apps/OpenSpace/ext/launcher/src/launcherwindow.cpp b/apps/OpenSpace/ext/launcher/src/launcherwindow.cpp index 416e268c05..f27284c0b7 100644 --- a/apps/OpenSpace/ext/launcher/src/launcherwindow.cpp +++ b/apps/OpenSpace/ext/launcher/src/launcherwindow.cpp @@ -401,8 +401,16 @@ QWidget* LauncherWindow::createCentralWidget() { connect( &dialog, &SettingsDialog::saveSettings, - [](Settings s) { + [this](Settings s) { saveSettings(s, findSettings()); + + if (s.profile.has_value()) { + populateProfilesList(*s.profile); + } + + if (s.configuration.has_value()) { + populateWindowConfigsList(*s.configuration); + } } ); diff --git a/apps/OpenSpace/main.cpp b/apps/OpenSpace/main.cpp index db2f9400a2..01663ead0a 100644 --- a/apps/OpenSpace/main.cpp +++ b/apps/OpenSpace/main.cpp @@ -1379,6 +1379,44 @@ int main(int argc, char* argv[]) { } glfwInit(); + // We are just reloading the configuration file here in case the user has changed + // anything in the settings panel. In that case want to apply these settings + // immediately rather than waiting for the next startup. + // What follows is some copy-paste code that should be cleaned up at some point + + LDEBUG("Reloading configuration from disk"); + // Find configuration + std::filesystem::path configurationFilePath; + if (commandlineArguments.configuration.has_value()) { + configurationFilePath = absPath(*commandlineArguments.configuration); + } + else { + LDEBUG("Finding configuration"); + configurationFilePath = findConfiguration(); + } + + // The previous incarnation of this was initializing GLFW to get the primary + // monitor's resolution, but that had some massive performance implications as + // there was some issue with the swap buffer handling inside of GLFW. My + // assumption is that GLFW doesn't like being initialized, destroyed, and then + // initialized again. Therefore we are using the platform specific functions now + glm::ivec2 size = glm::ivec2(1920, 1080); +#ifdef WIN32 + DEVMODEW dm = { 0 }; + dm.dmSize = sizeof(DEVMODEW); + BOOL success = EnumDisplaySettingsW(nullptr, ENUM_CURRENT_SETTINGS, &dm); + if (success) { + size.x = dm.dmPelsWidth; + size.y = dm.dmPelsHeight; + } +#endif // WIN32 + + *global::configuration = loadConfigurationFromFile( + configurationFilePath.string(), + findSettings(), + size + ); + global::configuration->profile = win.selectedProfile(); windowConfiguration = selectedSgctProfileFromLauncher( win,