Use system volume when possible

Fixes #1037
This commit is contained in:
Jonas Kvinge
2022-12-03 03:46:59 +01:00
parent 3a4199240e
commit b92ec71810
14 changed files with 203 additions and 129 deletions

View File

@@ -400,7 +400,7 @@ MainWindow::MainWindow(Application *app, std::shared_ptr<SystemTrayIcon> tray_ic
app_->player()->Init();
EngineChanged(app_->player()->engine()->type());
const uint volume = app_->player()->GetVolume();
ui_->volume->SetValueFromVolume(volume);
ui_->volume->SetValue(volume);
VolumeChanged(volume);
// Models
@@ -583,7 +583,7 @@ MainWindow::MainWindow(Application *app, std::shared_ptr<SystemTrayIcon> tray_ic
ui_->stop_button->setMenu(stop_menu);
// Player connections
QObject::connect(ui_->volume, &VolumeSlider::valueChanged, app_->player(), &Player::SetVolumeFromValue);
QObject::connect(ui_->volume, &VolumeSlider::valueChanged, app_->player(), &Player::SetVolumeFromSlider);
QObject::connect(app_->player(), &Player::EngineChanged, this, &MainWindow::EngineChanged);
QObject::connect(app_->player(), &Player::Error, this, &MainWindow::ShowErrorDialog);
@@ -606,7 +606,7 @@ MainWindow::MainWindow(Application *app, std::shared_ptr<SystemTrayIcon> tray_ic
QObject::connect(app_->player(), &Player::Stopped, osd_, &OSDBase::Stopped);
QObject::connect(app_->player(), &Player::PlaylistFinished, osd_, &OSDBase::PlaylistFinished);
QObject::connect(app_->player(), &Player::VolumeChanged, osd_, &OSDBase::VolumeChanged);
QObject::connect(app_->player(), &Player::VolumeChanged, ui_->volume, &VolumeSlider::SetValueFromVolume);
QObject::connect(app_->player(), &Player::VolumeChanged, ui_->volume, &VolumeSlider::SetValue);
QObject::connect(app_->player(), &Player::ForceShowOSD, this, &MainWindow::ForceShowOSD);
QObject::connect(app_->playlist_manager(), &PlaylistManager::CurrentSongChanged, this, &MainWindow::SongChanged);
@@ -1201,6 +1201,7 @@ void MainWindow::SaveSettings() {
SaveGeometry();
SavePlaybackStatus();
app_->player()->SaveVolume();
ui_->tabs->SaveSettings(kSettingsGroup);
ui_->playlist->view()->SaveSettings();
app_->scrobbler()->WriteCache();