-
Notifications
You must be signed in to change notification settings - Fork 0
/
musicplayer.h
48 lines (39 loc) · 1020 Bytes
/
musicplayer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef MUSICPLAYER_H
#define MUSICPLAYER_H
#include <QMediaPlayer>
#include <QLabel>
#include <QPushButton>
#include <dslider.h>
DWIDGET_USE_NAMESPACE
class MusicPlayer : public QWidget
{
Q_OBJECT
public:
explicit MusicPlayer(QWidget *parent = nullptr);
static QMediaPlayer *getPlayer();
static void stopAndClear();
signals:
private slots:
void playPause();
void stopPlay();
void playNext();
void playPre();
void onPlayStateChanged(QMediaPlayer::State state);
void setMusicName(QMediaPlayer::MediaStatus status);
void setDurationLabel(qint64 duration);
void setPositionLabel(qint64 position);
void onPositionSliderReleased();
void onPositionSliderPressed();
void onVolumeChanged(int volume);
private:
void resetMusicInfo();
private:
QMediaPlayer *player;
QLabel *nameLabel;
QLabel *volumeLabel;
QLabel *durationLabel;
QLabel *positionLabel;
DSlider *positionSlider;
QPushButton *playButton;
};
#endif // MUSICPLAYER_H