X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=radiant%2Fpreferences.cpp;h=8aaa30b59e720646f00aadfeda890eacb33e402c;hb=1891a24dfcbb40abb498a4c8c20adbbb44cc3175;hp=b52fb73be5321c8cb99db21fe7d0667699b68bc0;hpb=0b1f60f28f95e7ed12fea4ed1dc3e30588f2a2ed;p=xonotic%2Fnetradiant.git diff --git a/radiant/preferences.cpp b/radiant/preferences.cpp index b52fb73b..8aaa30b5 100644 --- a/radiant/preferences.cpp +++ b/radiant/preferences.cpp @@ -934,31 +934,39 @@ void PreferencesDialog_restartRequired( const char* staticName ){ g_restart_required.push_back( staticName ); } -void PreferencesDialog_showDialog(){ - if ( ConfirmModified( "Edit Preferences" ) && g_Preferences.DoModal() == eIDOK ) { - if ( !g_restart_required.empty() ) { - StringOutputStream message( 256 ); - message << "Preference changes require a restart:\n\n"; +bool PreferencesDialog_isRestartRequired(){ + return !g_restart_required.empty(); +} - for ( std::vector::iterator i = g_restart_required.begin(); i != g_restart_required.end(); ++i ) - { - message << ( *i ) << '\n'; - } +void PreferencesDialog_restartIfRequired(){ + if ( !g_restart_required.empty() ) { + StringOutputStream message( 256 ); + message << "Preference changes require a restart:\n\n"; + + for ( std::vector::iterator i = g_restart_required.begin(); i != g_restart_required.end(); ++i ) + { + message << ( *i ) << '\n'; + } - message << "\nRestart now?"; + message << "\nRestart now?"; - auto ret = ui::alert( MainFrame_getWindow(), message.c_str(), "Restart " RADIANT_NAME "?", ui::alert_type::YESNO, ui::alert_icon::Question ); + auto ret = ui::alert( MainFrame_getWindow(), message.c_str(), "Restart " RADIANT_NAME "?", ui::alert_type::YESNO, ui::alert_icon::Question ); - g_restart_required.clear(); + g_restart_required.clear(); - if ( ret == ui::alert_response::YES ) { - g_GamesDialog.m_bSkipGamePromptOnce = true; - Radiant_Restart(); - } + if ( ret == ui::alert_response::YES ) { + g_GamesDialog.m_bSkipGamePromptOnce = true; + Radiant_Restart(); } } } +void PreferencesDialog_showDialog(){ + if ( ConfirmModified( "Edit Preferences" ) && g_Preferences.DoModal() == eIDOK ) { + PreferencesDialog_restartIfRequired(); + } +} + struct GameName { static void Export(const Callback &returnz) { returnz(gamename_get());