49 lines
1.5 KiB
C++
49 lines
1.5 KiB
C++
#pragma once
|
||
#include <QGroupBox>
|
||
#include <QLabel>
|
||
#include <QSlider>
|
||
#include <QPushButton>
|
||
#include <QCheckBox>
|
||
|
||
class CoverArtWidget;
|
||
namespace engine { struct Track; }
|
||
|
||
class NowPlayingPanel : public QGroupBox
|
||
{
|
||
Q_OBJECT
|
||
public:
|
||
explicit NowPlayingPanel(QWidget *parent = nullptr);
|
||
|
||
QCheckBox *shuffleCheckBox() const { return m_chkShuffle; }
|
||
QCheckBox *repeatCheckBox() const { return m_chkRepeat; }
|
||
|
||
public slots:
|
||
void updateTrack(const engine::Track *track);
|
||
void updatePosition(qint64 posFrames, qint64 totalFrames, float sampleRate);
|
||
void setPlaybackActive(bool playing);
|
||
|
||
signals:
|
||
void playPauseClicked();
|
||
void prevClicked();
|
||
void nextClicked();
|
||
void seekRequested(double fraction); // 0.0–1.0
|
||
void volumeChanged(int percent); // 0–100
|
||
|
||
private:
|
||
void buildLayout();
|
||
|
||
CoverArtWidget *m_cover;
|
||
QLabel *m_lblTitle = new QLabel("No track selected");
|
||
QLabel *m_lblArtist = new QLabel(" ");
|
||
QLabel *m_lblAlbum = new QLabel(" ");
|
||
QLabel *m_lblTime = new QLabel("0:00 / 0:00");
|
||
QSlider *m_seekBar = new QSlider(Qt::Horizontal);
|
||
QPushButton *m_btnPrev = new QPushButton("|<");
|
||
QPushButton *m_btnPlay = new QPushButton("Play");
|
||
QPushButton *m_btnNext = new QPushButton(">|");
|
||
QCheckBox *m_chkShuffle = new QCheckBox("Shuffle");
|
||
QCheckBox *m_chkRepeat = new QCheckBox("Repeat");
|
||
QSlider *m_volSlider = new QSlider(Qt::Horizontal);
|
||
|
||
bool m_seekDragging { false };
|
||
}; |