added flags to prevent pause from firing onStop()

This commit is contained in:
fgerlits 2005-07-01 22:19:30 +00:00
parent 0b20c3ccf0
commit ad9b8acf2b
4 changed files with 76 additions and 5 deletions

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.4 $ Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/CuePlayer.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/CuePlayer.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -174,11 +174,13 @@ void
CuePlayer :: onPauseButtonClicked(void) throw () CuePlayer :: onPauseButtonClicked(void) throw ()
{ {
try { try {
gLiveSupport->setCueAudioPauseFlag(true);
gLiveSupport->pauseCueAudio(); gLiveSupport->pauseCueAudio();
audioState = pausedState; audioState = pausedState;
remove(*pauseButton); remove(*pauseButton);
pack_end(*playButton, Gtk::PACK_SHRINK, 3); pack_end(*playButton, Gtk::PACK_SHRINK, 3);
playButton->show(); playButton->show();
gLiveSupport->setCueAudioPauseFlag(false);
} catch (std::logic_error &e) { } catch (std::logic_error &e) {
std::cerr << "GLiveSupport::pauseCueAudio() error:" << std::endl std::cerr << "GLiveSupport::pauseCueAudio() error:" << std::endl
<< e.what() << std::endl; << e.what() << std::endl;
@ -209,6 +211,10 @@ CuePlayer :: onStopButtonClicked(void) throw ()
void void
CuePlayer :: onStop(void) throw () CuePlayer :: onStop(void) throw ()
{ {
if (gLiveSupport->getCueAudioPauseFlag()) {
return; // onStop() is fired on pause, unfortunately
}
switch (audioState) { switch (audioState) {
case pausedState: case pausedState:
remove(*playButton); remove(*playButton);

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.55 $ Version : $Revision: 1.56 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -836,6 +836,10 @@ void
LiveSupport :: GLiveSupport :: LiveSupport :: GLiveSupport ::
GLiveSupport :: onStop(void) throw () GLiveSupport :: onStop(void) throw ()
{ {
if (getOutputAudioPauseFlag()) {
return; // onStop() is fired on pause, unfortunately
}
releaseOutputAudio(); releaseOutputAudio();
Ptr<Playable>::Ref playable = masterPanel->getNextItemToPlay(); Ptr<Playable>::Ref playable = masterPanel->getNextItemToPlay();

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.41 $ Version : $Revision: 1.42 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -102,7 +102,7 @@ class MasterPanelWindow;
* respective documentation. * respective documentation.
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.41 $ * @version $Revision: 1.42 $
* @see LocalizedObject#getBundle(const xmlpp::Element &) * @see LocalizedObject#getBundle(const xmlpp::Element &)
* @see AuthenticationClientFactory * @see AuthenticationClientFactory
* @see StorageClientFactory * @see StorageClientFactory
@ -212,11 +212,21 @@ class GLiveSupport : public LocalizedConfigurable,
*/ */
bool outputPlayerIsPaused; bool outputPlayerIsPaused;
/**
* Set to prevent onStop() from being fired by pausing.
*/
bool outputAudioPauseFlag;
/** /**
* True if the cue audio player has been paused. * True if the cue audio player has been paused.
*/ */
bool cuePlayerIsPaused; bool cuePlayerIsPaused;
/**
* Set to prevent onStop() from being fired by pausing.
*/
bool cueAudioPauseFlag;
/** /**
* The raw image containing the station logo. * The raw image containing the station logo.
*/ */
@ -624,6 +634,30 @@ class GLiveSupport : public LocalizedConfigurable,
pauseOutputAudio(void) pauseOutputAudio(void)
throw (std::logic_error); throw (std::logic_error);
/**
* Set the output audio pause flag. This is set to true before
* a call to pauseOutputAudio() and to false afterwards, in
* order to prevent the onStop() method from executing on pause.
*
* @param value the new value of the flag.
*/
virtual void
setOutputAudioPauseFlag(bool value) throw ()
{
outputAudioPauseFlag = value;
}
/**
* Get the output audio pause flag.
*
* @see setOutputAudioPauseFlag()
*/
virtual bool
getOutputAudioPauseFlag(void) throw ()
{
return outputAudioPauseFlag;
}
/** /**
* Play a Playable object using the cue audio player. * Play a Playable object using the cue audio player.
* *
@ -656,6 +690,30 @@ class GLiveSupport : public LocalizedConfigurable,
pauseCueAudio(void) pauseCueAudio(void)
throw (std::logic_error); throw (std::logic_error);
/**
* Set the cue audio pause flag. This is set to true before
* a call to pauseCueAudio() and to false afterwards, in
* order to prevent the onStop() method from executing on pause.
*
* @param value the new value of the flag.
*/
virtual void
setCueAudioPauseFlag(bool value) throw ()
{
cueAudioPauseFlag = value;
}
/**
* Get the cue audio pause flag.
*
* @see setOutputAudioPauseFlag()
*/
virtual bool
getCueAudioPauseFlag(void) throw ()
{
return cueAudioPauseFlag;
}
/** /**
* Attach a listener for the cue audio player (the listener * Attach a listener for the cue audio player (the listener
* will be notified when the cue audio player has stopped playing). * will be notified when the cue audio player has stopped playing).

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.5 $ Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/NowPlaying.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/NowPlaying.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -162,6 +162,8 @@ NowPlaying :: onPlayButtonClicked(void) throw ()
void void
NowPlaying :: onPauseButtonClicked(void) throw () NowPlaying :: onPauseButtonClicked(void) throw ()
{ {
gLiveSupport->setOutputAudioPauseFlag(true);
gLiveSupport->pauseOutputAudio(); gLiveSupport->pauseOutputAudio();
remove(*pauseButton); remove(*pauseButton);
@ -169,6 +171,7 @@ NowPlaying :: onPauseButtonClicked(void) throw ()
playButton->show(); playButton->show();
isPaused = true; isPaused = true;
gLiveSupport->setOutputAudioPauseFlag(false);
} }