File indexing completed on 2025-01-19 06:43:48
0001 /* 0002 SPDX-FileCopyrightText: 2010 Daniel Laidig <d.laidig@gmx.de> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #ifndef PRACTICE_AUDIOBUTTON_H 0007 #define PRACTICE_AUDIOBUTTON_H 0008 0009 #include <QMediaPlayer> 0010 #include <QToolButton> 0011 #include <QUrl> 0012 0013 namespace Practice 0014 { 0015 class AudioButton : public QToolButton 0016 { 0017 Q_OBJECT 0018 public: 0019 explicit AudioButton(QWidget *parent); 0020 void setSoundFile(const QUrl &url); 0021 0022 private Q_SLOTS: 0023 void playAudio(); 0024 void stopAudio(); 0025 void playerStateChanged(QMediaPlayer::PlaybackState newState); 0026 0027 private: 0028 QMediaPlayer *m_player; ///< media object for the files 0029 QUrl m_url; 0030 }; 0031 0032 } 0033 0034 #endif // PRACTICE_AUDIOBUTTON_H