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

@@ -32,7 +32,6 @@
#include <QDateTime>
#include <QString>
#include <QUrl>
#include <QSettings>
#include "urlhandler.h"
#include "engine/engine_fwd.h"
@@ -71,6 +70,8 @@ class PlayerInterface : public QObject {
public slots:
virtual void ReloadSettings() = 0;
virtual void LoadVolume() = 0;
virtual void SaveVolume() = 0;
// Manual track change to the specified track
virtual void PlayAt(const int index, const quint64 offset_nanosec, Engine::TrackChangeFlags change, const Playlist::AutoScroll autoscroll, const bool reshuffle, const bool force_inform = false) = 0;
@@ -84,7 +85,8 @@ class PlayerInterface : public QObject {
virtual void Next() = 0;
virtual void Previous() = 0;
virtual void PlayPlaylist(const QString &playlist_name) = 0;
virtual void SetVolumeFromValue(const int value) = 0;
virtual void SetVolumeFromEngine(const uint volume) = 0;
virtual void SetVolumeFromSlider(const int value) = 0;
virtual void SetVolume(const uint volume) = 0;
virtual void VolumeUp() = 0;
virtual void VolumeDown() = 0;
@@ -133,7 +135,6 @@ class Player : public PlayerInterface {
public:
explicit Player(Application *app, QObject *parent);
~Player() override;
static const char *kSettingsGroup;
@@ -159,6 +160,8 @@ class Player : public PlayerInterface {
public slots:
void ReloadSettings() override;
void LoadVolume() override;
void SaveVolume() override;
void PlayAt(const int index, const quint64 offset_nanosec, Engine::TrackChangeFlags change, const Playlist::AutoScroll autoscroll, const bool reshuffle, const bool force_inform = false) override;
void PlayPause(const quint64 offset_nanosec = 0, const Playlist::AutoScroll autoscroll = Playlist::AutoScroll_Always) override;
@@ -167,8 +170,9 @@ class Player : public PlayerInterface {
void Next() override;
void Previous() override;
void PlayPlaylist(const QString &playlist_name) override;
void SetVolumeFromValue(const int value) override;
void SetVolume(const uint value) override;
void SetVolumeFromSlider(const int value) override;
void SetVolumeFromEngine(const uint volume) override;
void SetVolume(const uint volume) override;
void VolumeUp() override;
void VolumeDown() override;
void SeekTo(const quint64 seconds) override;
@@ -225,8 +229,6 @@ class Player : public PlayerInterface {
AnalyzerContainer *analyzer_;
Equalizer *equalizer_;
QSettings settings_;
PlaylistItemPtr current_item_;
Engine::TrackChangeFlags stream_change_type_;
@@ -237,6 +239,7 @@ class Player : public PlayerInterface {
QMap<QString, UrlHandler*> url_handlers_;
QList<QUrl> loading_async_;
uint volume_;
uint volume_before_mute_;
QDateTime last_pressed_previous_;
@@ -245,8 +248,6 @@ class Player : public PlayerInterface {
BehaviourSettingsPage::PreviousBehaviour menu_previousmode_;
int seek_step_sec_;
bool volume_control_;
QDateTime pause_time_;
quint64 play_offset_nanosec_;