Qt 5.10 Book Examples
SoundPlayer.h
Go to the documentation of this file.
1 // ======================================================================
2 // SoundPlayer.h
3 // ======================================================================
4 // This file is a part of the book
5 // "Qt 5.10 Professional programming with C++"
6 // http://qt-book.com
7 // ======================================================================
8 // Copyright (c) 2017 by Max Schlee
9 // ======================================================================
10 
11 #pragma once
12 #include <QWidget>
13 #include <QMediaPlayer>
14 
15 class QPushButton;
16 class QSlider;
17 class QLabel;
18 class QVBoxLayout;
19 
20 // ======================================================================
21 class SoundPlayer : public QWidget {
22  Q_OBJECT
23 protected:
24  QMediaPlayer* m_pmp;
25  QVBoxLayout* m_pvbxMainLayout;
26 
27 private:
28  QPushButton* m_pcmdPlay;
29  QPushButton* m_pcmdStop;
30  QSlider* m_psldPosition;
31  QLabel* m_plblCurrent;
32  QLabel* m_plblRemain;
33 
34  QString msecsToString(qint64 n);
35 
36 public:
37  SoundPlayer(QWidget* pwgt = 0);
38 
39 private slots:
40  void slotOpen ( );
41  void slotPlay ( );
42  void slotSetSliderPosition(qint64 );
43  void slotSetMediaPosition (int );
44  void slotSetDuration (qint64 );
45  void slotStatusChanged (QMediaPlayer::State);
46 };
SoundPlayer(QWidget *pwgt=0)
Definition: SoundPlayer.cpp:15
QVBoxLayout * m_pvbxMainLayout
Definition: SoundPlayer.h:25
QMediaPlayer * m_pmp
Definition: SoundPlayer.h:24