]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/preferences.cpp
radiant: ask user to restart the editor when map load switches the brush format
[xonotic/netradiant.git] / radiant / preferences.cpp
index b52fb73be5321c8cb99db21fe7d0667699b68bc0..8aaa30b59e720646f00aadfeda890eacb33e402c 100644 (file)
@@ -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<const char*>::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<const char*>::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<void(const char *)> &returnz) {
                returnz(gamename_get());