MainWindow: Save tab mode immediately when changed
The sidebar mode (tabs on top, large sidebar, etc.) was only being saved when the application exits normally. This caused the setting to be lost if the application crashed or was force-closed, reverting to the default "Large Sidebar" mode on next startup. This fix connects the FancyTabWidget::ModeChanged signal to immediately save the tab_mode setting when the user changes it via the context menu. Fixes issue where sidebar keeps periodically reverting to Large mode. Co-authored-by: jonaski <10343810+jonaski@users.noreply.github.com>
This commit is contained in:
@@ -447,6 +447,14 @@ MainWindow::MainWindow(Application *app,
|
||||
ui_->tabs->SetBackgroundPixmap(QPixmap(u":/pictures/sidebar-background.png"_s));
|
||||
ui_->tabs->LoadSettings(QLatin1String(MainWindowSettings::kSettingsGroup));
|
||||
|
||||
// Save tab mode immediately when changed to avoid losing the setting
|
||||
QObject::connect(ui_->tabs, &FancyTabWidget::ModeChanged, this, [this](FancyTabWidget::Mode mode) {
|
||||
Settings s;
|
||||
s.beginGroup(MainWindowSettings::kSettingsGroup);
|
||||
s.setValue("tab_mode", static_cast<int>(mode));
|
||||
s.endGroup();
|
||||
});
|
||||
|
||||
track_position_timer_->setInterval(kTrackPositionUpdateTimeMs);
|
||||
QObject::connect(track_position_timer_, &QTimer::timeout, this, &MainWindow::UpdateTrackPosition);
|
||||
track_slider_timer_->setInterval(kTrackSliderUpdateTimeMs);
|
||||
|
||||
Reference in New Issue
Block a user