fixed next/previous buttons, simplyfied volume

This commit is contained in:
Anika Raemer 2021-10-13 13:47:16 +02:00
parent e9a031e6d3
commit 2d985ca17d
3 changed files with 33 additions and 70 deletions

View file

@ -20,7 +20,6 @@ class MusicPlayer : public QMediaPlayer
Q_PROPERTY(QString pMediaLength READ getMediaLength NOTIFY mediaLengthChanged)
Q_PROPERTY(QString pTime READ getTime NOTIFY progressChanged)
Q_PROPERTY(QString pMediaTitle READ getMediaTitle NOTIFY mediaTitleChanged)
Q_PROPERTY(int pAudioVolume READ getAudioVolume WRITE setAudioVolume NOTIFY audioVolumeChanged)
signals:
void navigateTo(NavigationItemModel *item);
@ -31,7 +30,6 @@ signals:
void progressChanged();
void mediaLengthChanged();
void mediaTitleChanged();
void audioVolumeChanged(int newVolume);
public:
MusicPlayer(QObject *parent = Q_NULLPTR);
@ -50,25 +48,6 @@ public:
bool hasNext() const;
bool hasPrevious() const;
/**
* @brief Get audio volume. Range is in between 0 and 100
* Relays info from QMediaPlayer::volume as Q_PROPERTY does seem to have
* trouble accessing base class functions directly.
*/
inline int getAudioVolume() const { return volume(); }
/**
* @brief Set audio volume.
* @param newVolume value between 0 and 100 (audio level in percent)
* Ensures that volume is inbetween 0 and 100. If this range is exceeded,
* the volume is set to the lowest and highest allowed value, respectively.
*
* Relay info to QMediaPlayer::setVolume as Q_PROPERTY does seem to have
* trouble accessing base class functions directly.
*
* @todo save to config file?
*/
void setAudioVolume(int newVolume);
double getProgress() const;
QString getMediaTitle() const;
@ -91,10 +70,6 @@ private:
void readMedia(const QString& path);
QString timeToString(int time);
bool mIsPlaying = false;
bool mHasNext = false;
bool mHasPrevious = false;
int mCurrentMediaItemLength = 0;
int mCurrentTime = 0;
double mCurrentMediaItemProgress = 0;