2018-03-21 17:49:34 +00:00
|
|
|
/* This file is (c) 2018 Igor Kushnir <igorkuo@gmail.com>
|
|
|
|
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
|
|
|
|
|
|
|
|
#ifndef AUDIOPLAYERFACTORY_HH_INCLUDED
|
|
|
|
#define AUDIOPLAYERFACTORY_HH_INCLUDED
|
|
|
|
|
|
|
|
#include "audioplayerinterface.hh"
|
|
|
|
#include "config.hh"
|
|
|
|
|
2018-03-22 17:07:10 +00:00
|
|
|
class ExternalAudioPlayer;
|
|
|
|
|
2018-03-21 17:49:34 +00:00
|
|
|
class AudioPlayerFactory
|
|
|
|
{
|
|
|
|
Q_DISABLE_COPY( AudioPlayerFactory )
|
2023-07-20 08:02:22 +00:00
|
|
|
|
2018-03-21 17:49:34 +00:00
|
|
|
public:
|
|
|
|
explicit AudioPlayerFactory( Config::Preferences const & );
|
|
|
|
void setPreferences( Config::Preferences const & );
|
2018-03-22 17:07:10 +00:00
|
|
|
/// The returned reference to a smart pointer is valid as long as this object
|
|
|
|
/// exists. The pointer to the owned AudioPlayerInterface may change after the
|
|
|
|
/// call to setPreferences(), but it is guaranteed to never be null.
|
2018-03-21 17:49:34 +00:00
|
|
|
AudioPlayerPtr const & player() const
|
|
|
|
{
|
|
|
|
return playerPtr;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
void reset();
|
2018-03-22 17:07:10 +00:00
|
|
|
void setAudioPlaybackProgram( ExternalAudioPlayer & externalPlayer );
|
|
|
|
|
2018-03-21 17:49:34 +00:00
|
|
|
bool useInternalPlayer;
|
2018-03-29 17:00:53 +00:00
|
|
|
Config::InternalPlayerBackend internalPlayerBackend;
|
2018-03-22 17:07:10 +00:00
|
|
|
QString audioPlaybackProgram;
|
2018-03-21 17:49:34 +00:00
|
|
|
AudioPlayerPtr playerPtr;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // AUDIOPLAYERFACTORY_HH_INCLUDED
|