44 #include <AudioOutput>
45 #include <MediaObject>
46 #include <MediaSource>
47 #include <VideoWidget>
56 static Beedo global_instance;
57 return global_instance;
68 #ifndef BEEDOOLDQTFALLBACK
71 QFile videoresource ( QString::fromUtf8 (
":/beedo.ogv" ) );
72 videoresource.open ( QIODevice::ReadOnly );
73 _videobuffer.open ( QIODevice::ReadWrite );
74 _videobuffer.write ( videoresource.readAll() );
75 _videobuffer.seek ( 0 );
93 Qt::X11BypassWindowManagerHint |
94 Qt::CustomizeWindowHint |
95 Qt::WindowStaysOnTopHint
97 _media =
new Phonon::MediaObject (
nullptr );
98 _audio =
new Phonon::AudioOutput ( Phonon::NotificationCategory,
nullptr );
102 const QSize widgetsize ( 256, 256 );
103 const QRect widgetrect ( QPoint ( 0,0 ),widgetsize );
104 _display->setGeometry ( widgetrect );
105 _display->setMinimumSize ( widgetsize );
106 _display->setMinimumSize ( widgetsize );
107 _video->setGeometry ( widgetrect );
108 _video->setMinimumSize ( widgetsize );
109 _video->setMaximumSize ( widgetsize );
110 _display->setWindowIcon ( QIcon::fromTheme ( QString::fromUtf8 (
"dialog-warning" ) ) );
111 connect (
_media, SIGNAL ( stateChanged ( Phonon::State,Phonon::State ) ),
this, SLOT (
phononStateChange ( Phonon::State,Phonon::State ) ) );
147 catch ( std::exception& e )
166 catch ( std::exception& e )
178 #ifdef BEEDOOLDQTFALLBACK
183 #ifndef BEEDOOLDQTFALLBACK
184 _media->setCurrentSource ( QUrl ( QString::fromUtf8 (
"qrc:/beedo.ogv" ) ) );
186 _videobuffer.seek ( 0 );
187 _media->setCurrentSource ( &_videobuffer );
189 #ifndef BEEDOOLDQTFALLBACK
190 while (
_media->state() == Phonon::LoadingState )
198 std::cout <<
"Cannot play \"Beedo\" video resource!" << std::endl;
210 if ( newState == Phonon::PlayingState && oldState != Phonon::PlayingState )
212 if ( newState != Phonon::PlayingState && oldState == Phonon::PlayingState && !
_go )
214 if ( newState != Phonon::PlayingState && oldState == Phonon::PlayingState &&
_go )
void destroy()
Destroy all media objects.
void playAlarmVideo()
Instruct phonon to start playing.
#define nullptr
Allow using the nullptr keyword with GCC < 4.6.
void phononStateChange(const Phonon::State newState, const Phonon::State oldState)
React on a Phonon state change.
void signalStop()
Signal GUI to stop playing.
QWidget * _display
Video window.
void start_internal() noexcept
Internal routine to start video/audio playback.
bool _go
Video/audio play flag.
static Beedo & instance()
Get singleton instance.
void createMediaObjects()
Create the Qt objects to play a media file.
void stop_internal() noexcept
Internal routine to stop video/audio playback.
Phonon::AudioOutput * _audio
Phonon audio output encapsulation.
Provide an opto-acoustic alarm notification on a control room PC.
void destroyMediaObjects()
Delete the Qt and Phonon objects.
Namespace for Alarm Notifications application.
#define noexcept
Allow using the noexcept keyword with GCC < 4.6.
Phonon::VideoWidget * _video
Phonon video output encapsulation.
void ExceptionHandler(std::exception &e, std::string location, const bool quit=false) noexcept
Generic exception handler for known exceptions.
void signalPlay()
Signal GUI to start playing.
Phonon::MediaObject * _media
Phonon media file encapsulation.
Generic functions for exception handling.
virtual ~Beedo()
Destructor.
Opto-acoustic alarm engine.
Phonon::Path _mediaToVideo
Connection between _media and _video.
Phonon::Path _mediaToAudio
Connection between _media and _audio.
void stopAlarmVideo()
Instruct Phonon to stop playing.