File indexing completed on 2024-05-05 04:51:42

0001 /*
0002     SPDX-FileCopyrightText: 2010 Michal Malek <michalm@jabster.pl>
0003     SPDX-FileCopyrightText: 1998-2007 Sebastian Trueg <trueg@k3b.org>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef _K3B_AUDIO_TRACK_PLAYER_H_
0009 #define _K3B_AUDIO_TRACK_PLAYER_H_
0010 
0011 #include <QObject>
0012 #include <QScopedPointer>
0013 #include <qaudio.h>
0014 
0015 class KActionCollection;
0016 
0017 namespace K3b {
0018 
0019     class AudioDoc;
0020     class AudioTrack;
0021 
0022     class AudioTrackPlayer : public QObject
0023     {
0024         Q_OBJECT
0025 
0026     public:
0027         enum State {
0028             Stopped,
0029             Playing,
0030             Paused
0031         };
0032 
0033     public:
0034         AudioTrackPlayer( AudioDoc* doc, KActionCollection* actionCollection, QObject* parent = 0 );
0035         ~AudioTrackPlayer();
0036 
0037         State state() const;
0038 
0039         AudioTrack* currentTrack() const;
0040 
0041     public Q_SLOTS:
0042         void playTrack( const K3b::AudioTrack& track );
0043         void play();
0044         void pause();
0045         void stop();
0046         void next();
0047         void previous();
0048 
0049     Q_SIGNALS:
0050         void playingTrack( const K3b::AudioTrack& track );
0051         void stateChanged();
0052 
0053     private Q_SLOTS:
0054         void slotSeek( int bytes );
0055         void slotUpdateSlider();
0056         void slotCurrentTrackChanged( const K3b::AudioTrack& track );
0057         void slotStateChanged( QAudio::State state );
0058 
0059     private:
0060         class Private;
0061         QScopedPointer<Private> d;
0062         Q_DISABLE_COPY(AudioTrackPlayer)
0063     };
0064 }
0065 
0066 #endif