]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/preferences.cpp
radiant: make restart notification a question
[xonotic/netradiant.git] / radiant / preferences.cpp
index 14a39f71c3e1293bdf4d276bc5eb085109390401..8e2e0268f8ec882132528af56cc110fffcecc330 100644 (file)
@@ -281,7 +281,11 @@ void CGameDialog::GameFileImport( int value ){
        {
                ++iGame;
        }
-       m_sGameFile = ( *iGame )->mGameFile;
+
+       if ( ( *iGame )->mGameFile != m_sGameFile ) {
+               m_sGameFile = ( *iGame )->mGameFile;
+               PreferencesDialog_restartRequired( "Selected Game" );
+       }
 }
 
 void CGameDialog::GameFileExport( const Callback<void(int)> & importCallback ) const {
@@ -909,12 +913,21 @@ void PreferencesDialog_showDialog(){
                if ( !g_restart_required.empty() ) {
                        StringOutputStream message( 256 );
                        message << "Preference changes require a restart:\n";
+
                        for ( std::vector<const char*>::iterator i = g_restart_required.begin(); i != g_restart_required.end(); ++i )
                        {
                                message << ( *i ) << '\n';
                        }
-                       ui::alert( MainFrame_getWindow(), message.c_str() );
+
+                       message << "\nRestart now?";
+
+                       auto ret = ui::alert( MainFrame_getWindow(), message.c_str(), "Restart " RADIANT_NAME "?", ui::alert_type::YESNO, ui::alert_icon::Question );
+
                        g_restart_required.clear();
+
+                       if ( ret == ui::alert_response::YES ) {
+                               Radiant_Restart();
+                       }
                }
        }
 }