diff --git a/livesupport/products/gLiveSupport/src/GLiveSupport.h b/livesupport/products/gLiveSupport/src/GLiveSupport.h index 4c52baedf..999fb7c0d 100644 --- a/livesupport/products/gLiveSupport/src/GLiveSupport.h +++ b/livesupport/products/gLiveSupport/src/GLiveSupport.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.46 $ + Version : $Revision: 1.47 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.h,v $ ------------------------------------------------------------------------------*/ @@ -102,7 +102,7 @@ class MasterPanelWindow; * respective documentation. * * @author $Author: fgerlits $ - * @version $Revision: 1.46 $ + * @version $Revision: 1.47 $ * @see LocalizedObject#getBundle(const xmlpp::Element &) * @see AuthenticationClientFactory * @see StorageClientFactory @@ -642,6 +642,21 @@ class GLiveSupport : public LocalizedConfigurable, pauseOutputAudio(void) throw (std::logic_error); + /** + * Determine the time elapsed in the current Playable object + * played by the output audio player. + * + * @return the current time position in the currently open + * Playable object. + * @exception std::logic_error if there is no Playable object open. + */ + virtual Ptr::Ref + getOutputAudioPosition(void) + throw (std::logic_error) + { + return outputPlayer->getPosition(); + } + /** * Play a Playable object using the cue audio player. * diff --git a/livesupport/products/gLiveSupport/src/NowPlaying.cxx b/livesupport/products/gLiveSupport/src/NowPlaying.cxx index 9320c0e8b..2e13b5820 100644 --- a/livesupport/products/gLiveSupport/src/NowPlaying.cxx +++ b/livesupport/products/gLiveSupport/src/NowPlaying.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.12 $ + Version : $Revision: 1.13 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/NowPlaying.cxx,v $ ------------------------------------------------------------------------------*/ @@ -159,7 +159,6 @@ NowPlaying :: setPlayable(Ptr::Ref playable) throw () label->set_markup(*infoString); audioLength = playable->getPlaylength(); - audioStart = TimeConversion::now(); } else { if (isActive && !isPaused) { @@ -172,7 +171,6 @@ NowPlaying :: setPlayable(Ptr::Ref playable) throw () elapsedTime->set_text(""); remainsTime->set_text(""); audioLength.reset(); - audioStart.reset(); } } @@ -184,11 +182,6 @@ void NowPlaying :: onPlayButtonClicked(void) throw () { if (isActive && isPaused) { - Ptr::Ref now = TimeConversion::now(); - time_duration pauseLength = *now - *pausedAtTime; - audioStart.reset(new ptime(*audioStart + pauseLength)); - pausedAtTime.reset(); - gLiveSupport->pauseOutputAudio(); // i.e., restart remove(*playButton); @@ -207,8 +200,6 @@ void NowPlaying :: onPauseButtonClicked(void) throw () { if (isActive && !isPaused) { - pausedAtTime = TimeConversion::now(); - gLiveSupport->pauseOutputAudio(); remove(*pauseButton); @@ -263,13 +254,12 @@ NowPlaying :: createFormattedLabel(int fontSize) throw () * Update the timer displays. This is called every second by the master panel. *----------------------------------------------------------------------------*/ void -NowPlaying :: onUpdateTime(void) throw () +NowPlaying :: onUpdateTime(void) + throw () { if (isActive) { - Ptr::Ref now = isPaused ? pausedAtTime - : TimeConversion::now(); - Ptr::Ref elapsed(new time_duration( - *now - *audioStart )); + Ptr::Ref elapsed = gLiveSupport-> + getOutputAudioPosition(); Ptr::Ref remains(new time_duration( *audioLength - *elapsed )); elapsedTime->set_text(*TimeConversion::timeDurationToHhMmSsString( diff --git a/livesupport/products/gLiveSupport/src/NowPlaying.h b/livesupport/products/gLiveSupport/src/NowPlaying.h index 1f281f361..20a0e3df1 100644 --- a/livesupport/products/gLiveSupport/src/NowPlaying.h +++ b/livesupport/products/gLiveSupport/src/NowPlaying.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.5 $ + Version : $Revision: 1.6 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/NowPlaying.h,v $ ------------------------------------------------------------------------------*/ @@ -66,7 +66,7 @@ using namespace LiveSupport::Widgets; * The box displaying "now playing" in the master panel. * * @author $Author: fgerlits $ - * @version $Revision: 1.5 $ + * @version $Revision: 1.6 $ */ class NowPlaying : public Gtk::HBox, public LocalizedObject @@ -88,17 +88,6 @@ class NowPlaying : public Gtk::HBox, */ Ptr::Ref audioLength; - /** - * The time the item started playing. - */ - Ptr::Ref audioStart; - - /** - * The time the pause button was pressed. - * Non-null if isPaused is true (which implies isActive). - */ - Ptr::Ref pausedAtTime; - /** * The label holding the title etc. of the now playing item. */