2007-02-05 00:49:40 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* Copyright (C) 2007 by Pino Toscano <pino@kde.org> *
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#ifndef _OKULAR_AUDIOPLAYER_H_
|
|
|
|
#define _OKULAR_AUDIOPLAYER_H_
|
|
|
|
|
2014-10-27 21:35:06 +00:00
|
|
|
#include "okularcore_export.h"
|
2007-02-05 00:49:40 +00:00
|
|
|
|
|
|
|
#include <QtCore/QObject>
|
|
|
|
|
|
|
|
namespace Okular {
|
|
|
|
|
2007-07-10 18:24:18 +00:00
|
|
|
class AudioPlayerPrivate;
|
|
|
|
class Document;
|
2007-02-05 00:49:40 +00:00
|
|
|
class Sound;
|
2007-05-02 22:50:27 +00:00
|
|
|
class SoundAction;
|
2007-02-05 00:49:40 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @short An audio player.
|
|
|
|
*
|
|
|
|
* Singleton utility class to play sounds in documents using the KDE sound
|
|
|
|
* system.
|
|
|
|
*/
|
2014-10-27 21:35:06 +00:00
|
|
|
class OKULARCORE_EXPORT AudioPlayer : public QObject
|
2007-02-05 00:49:40 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2013-11-27 22:26:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The state of AudioPlayer
|
|
|
|
* @since 0.19 (KDE 4.13)
|
|
|
|
*/
|
|
|
|
enum State
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The AudioPlayer is playing a audio file.
|
|
|
|
*/
|
|
|
|
PlayingState,
|
|
|
|
/**
|
|
|
|
* The AudioPlayer isn't playing a audio file.
|
|
|
|
*/
|
|
|
|
StoppedState
|
|
|
|
};
|
|
|
|
|
2007-02-05 00:49:40 +00:00
|
|
|
~AudioPlayer();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the instance of the audio player.
|
|
|
|
*/
|
|
|
|
static AudioPlayer * instance();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enqueue the specified @p sound for playing, optionally taking more
|
|
|
|
* information about the playing from the @p soundlink .
|
|
|
|
*/
|
2007-05-02 22:50:27 +00:00
|
|
|
void playSound( const Sound * sound, const SoundAction * linksound = 0 );
|
2007-02-05 00:49:40 +00:00
|
|
|
|
2007-02-05 15:26:05 +00:00
|
|
|
/**
|
|
|
|
* Tell the AudioPlayer to stop all the playbacks.
|
|
|
|
*/
|
|
|
|
void stopPlaybacks();
|
|
|
|
|
2013-11-27 22:26:26 +00:00
|
|
|
/**
|
|
|
|
* Return state of sound (playing/stopped)
|
|
|
|
* @since 0.19 (KDE 4.13)
|
|
|
|
*/
|
|
|
|
State state() const;
|
|
|
|
|
2007-02-05 00:49:40 +00:00
|
|
|
private:
|
|
|
|
AudioPlayer();
|
|
|
|
|
2007-07-10 18:24:18 +00:00
|
|
|
friend class AudioPlayerPrivate;
|
|
|
|
AudioPlayerPrivate * const d;
|
|
|
|
friend class Document;
|
2007-02-05 00:49:40 +00:00
|
|
|
|
|
|
|
Q_DISABLE_COPY( AudioPlayer )
|
|
|
|
Q_PRIVATE_SLOT( d, void finished( int ) )
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|