[vlc-commits] [Git][videolan/vlc][master] qt: fix Reset Preferences not clearing Qt-specific settings
Steve Lhomme (@robUx4)
gitlab at videolan.org
Thu Mar 12 12:47:20 UTC 2026
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
b5206aae by YosfKenawy at 2026-03-12T12:06:12+00:00
qt: fix Reset Preferences not clearing Qt-specific settings
Fixes: #29568
- - - - -
3 changed files:
- modules/gui/qt/dialogs/preferences/preferences.cpp
- modules/gui/qt/maininterface/mainctx.cpp
- modules/gui/qt/qt.hpp
Changes:
=====================================
modules/gui/qt/dialogs/preferences/preferences.cpp
=====================================
@@ -372,15 +372,43 @@ void PrefsDialog::save()
p_intf->p_mi->reloadPrefs();
accept();
- QVLCTools::saveWidgetPosition( p_intf, "Preferences", this );
+ // Don't save widget position if reset is pending
+ if( !p_intf->preferencesResetPending )
+ QVLCTools::saveWidgetPosition( p_intf, "Preferences", this );
+
+ if( p_intf->preferencesResetPending )
+ {
+ int restart = QMessageBox::question(
+ nullptr,
+ qtr( "Restart Required" ),
+ qtr( "VLC needs to be restarted for the reset to take full effect.\n\nRestart now?" ),
+ QMessageBox::Yes | QMessageBox::No,
+ QMessageBox::Yes);
+
+ if( restart == QMessageBox::Yes )
+ {
+ // Quit VLC
+ emit p_intf->p_mi->askToQuit();
+ }
+ else
+ {
+ // User chose not to restart - clear the flag
+ p_intf->preferencesResetPending = false;
+ }
+ }
}
/* Clean the preferences, dunno if it does something really */
void PrefsDialog::cancel()
{
- QVLCTools::saveWidgetPosition( p_intf, "Preferences", this );
-
+ bool wasResetting = p_intf->preferencesResetPending;
+
+ // Clear the reset flag
+ p_intf->preferencesResetPending = false;
+
+ if( !wasResetting )
+ QVLCTools::saveWidgetPosition( p_intf, "Preferences", this );
reject();
}
@@ -399,6 +427,7 @@ void PrefsDialog::reset()
config_ResetAll();
config_SaveConfigFile( p_intf );
getSettings()->clear();
+ p_intf->preferencesResetPending = true;
p_intf->p_mi->reloadPrefs();
p_intf->p_mi->reloadFromSettings();
@@ -406,7 +435,6 @@ void PrefsDialog::reset()
simple_panels[0]->cleanLang();
#endif
- accept();
}
}
=====================================
modules/gui/qt/maininterface/mainctx.cpp
=====================================
@@ -307,27 +307,33 @@ MainCtx::~MainCtx()
m_threadRunner->destroy();
- settings->beginGroup("MainWindow");
- settings->setValue( "pl-dock-status", b_playlistDocked );
- settings->setValue( "ShowRemainingTime", m_showRemainingTime );
- settings->setValue( "interface-scale", QString::number( m_intfUserScaleFactor ) );
-
- /* Save playlist state */
- settings->setValue( "playlist-visible", m_playlistVisible );
- settings->setValue( "playlist-width-factor", QString::number( m_playlistWidthFactor ) );
- settings->setValue( "player-playlist-width-factor", QString::number( m_playerPlaylistWidthFactor ) );
-
- settings->setValue( "artist-albums-width-factor", QString::number( m_artistAlbumsWidthFactor ) );
-
- settings->setValue( "grid-view", m_gridView );
- settings->setValue( "grouping", m_grouping );
- settings->setValue( "album-sections", m_albumSections );
-
- settings->setValue( "color-scheme-index", m_colorScheme->currentIndex() );
- /* Save the stackCentralW sizes */
- settings->endGroup();
+ if ( !p_intf->preferencesResetPending)
+ {
+ settings->beginGroup("MainWindow");
+ settings->setValue( "pl-dock-status", b_playlistDocked );
+ settings->setValue( "ShowRemainingTime", m_showRemainingTime );
+ settings->setValue( "interface-scale", QString::number( m_intfUserScaleFactor ) );
+
+ /* Save playlist state */
+ settings->setValue( "playlist-visible", m_playlistVisible );
+ settings->setValue( "playlist-width-factor", QString::number( m_playlistWidthFactor ) );
+ settings->setValue( "player-playlist-width-factor", QString::number( m_playerPlaylistWidthFactor ) );
+
+ settings->setValue( "artist-albums-width-factor", QString::number( m_artistAlbumsWidthFactor ) );
+
+ settings->setValue( "grid-view", m_gridView );
+ settings->setValue( "grouping", m_grouping );
+
+ settings->setValue( "color-scheme-index", m_colorScheme->currentIndex() );
+ /* Save the stackCentralW sizes */
+ settings->endGroup();
+ }
+ else
+ {
+ settings->remove("MainWindow");
+ }
- if( var_InheritBool( p_intf, "save-recentplay" ) )
+ if( !p_intf->preferencesResetPending && var_InheritBool( p_intf, "save-recentplay" ) )
getSettings()->setValue( "filedialog-path", m_dialogFilepath );
else
getSettings()->remove( "filedialog-path" );
=====================================
modules/gui/qt/qt.hpp
=====================================
@@ -86,7 +86,7 @@ struct qt_intf_t
class MainCtx *p_mi; /* Main Interface, NULL if DialogProvider Mode */
class QSettings *mainSettings; /* Qt State settings not messing main VLC ones */
-
+ bool preferencesResetPending = false;
bool b_isDialogProvider; /* Qt mode or Skins mode */
vlc_playlist_t *p_playlist; /* playlist */
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/b5206aae397e8558a5b77d33f8a21b5d0f8f6546
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/b5206aae397e8558a5b77d33f8a21b5d0f8f6546
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list