Changed elapsed/remaining time display to use the AudioPlayerInterface::
getPosition() function instead of the local stopwatch thingie.
This commit is contained in:
parent
cb748119cd
commit
1dd735b754
3 changed files with 24 additions and 30 deletions
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
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 $
|
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.46 $
|
* @version $Revision: 1.47 $
|
||||||
* @see LocalizedObject#getBundle(const xmlpp::Element &)
|
* @see LocalizedObject#getBundle(const xmlpp::Element &)
|
||||||
* @see AuthenticationClientFactory
|
* @see AuthenticationClientFactory
|
||||||
* @see StorageClientFactory
|
* @see StorageClientFactory
|
||||||
|
@ -642,6 +642,21 @@ class GLiveSupport : public LocalizedConfigurable,
|
||||||
pauseOutputAudio(void)
|
pauseOutputAudio(void)
|
||||||
throw (std::logic_error);
|
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<time_duration>::Ref
|
||||||
|
getOutputAudioPosition(void)
|
||||||
|
throw (std::logic_error)
|
||||||
|
{
|
||||||
|
return outputPlayer->getPosition();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Play a Playable object using the cue audio player.
|
* Play a Playable object using the cue audio player.
|
||||||
*
|
*
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
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 $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/NowPlaying.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -159,7 +159,6 @@ NowPlaying :: setPlayable(Ptr<Playable>::Ref playable) throw ()
|
||||||
label->set_markup(*infoString);
|
label->set_markup(*infoString);
|
||||||
|
|
||||||
audioLength = playable->getPlaylength();
|
audioLength = playable->getPlaylength();
|
||||||
audioStart = TimeConversion::now();
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (isActive && !isPaused) {
|
if (isActive && !isPaused) {
|
||||||
|
@ -172,7 +171,6 @@ NowPlaying :: setPlayable(Ptr<Playable>::Ref playable) throw ()
|
||||||
elapsedTime->set_text("");
|
elapsedTime->set_text("");
|
||||||
remainsTime->set_text("");
|
remainsTime->set_text("");
|
||||||
audioLength.reset();
|
audioLength.reset();
|
||||||
audioStart.reset();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,11 +182,6 @@ void
|
||||||
NowPlaying :: onPlayButtonClicked(void) throw ()
|
NowPlaying :: onPlayButtonClicked(void) throw ()
|
||||||
{
|
{
|
||||||
if (isActive && isPaused) {
|
if (isActive && isPaused) {
|
||||||
Ptr<ptime>::Ref now = TimeConversion::now();
|
|
||||||
time_duration pauseLength = *now - *pausedAtTime;
|
|
||||||
audioStart.reset(new ptime(*audioStart + pauseLength));
|
|
||||||
pausedAtTime.reset();
|
|
||||||
|
|
||||||
gLiveSupport->pauseOutputAudio(); // i.e., restart
|
gLiveSupport->pauseOutputAudio(); // i.e., restart
|
||||||
|
|
||||||
remove(*playButton);
|
remove(*playButton);
|
||||||
|
@ -207,8 +200,6 @@ void
|
||||||
NowPlaying :: onPauseButtonClicked(void) throw ()
|
NowPlaying :: onPauseButtonClicked(void) throw ()
|
||||||
{
|
{
|
||||||
if (isActive && !isPaused) {
|
if (isActive && !isPaused) {
|
||||||
pausedAtTime = TimeConversion::now();
|
|
||||||
|
|
||||||
gLiveSupport->pauseOutputAudio();
|
gLiveSupport->pauseOutputAudio();
|
||||||
|
|
||||||
remove(*pauseButton);
|
remove(*pauseButton);
|
||||||
|
@ -263,13 +254,12 @@ NowPlaying :: createFormattedLabel(int fontSize) throw ()
|
||||||
* Update the timer displays. This is called every second by the master panel.
|
* Update the timer displays. This is called every second by the master panel.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
NowPlaying :: onUpdateTime(void) throw ()
|
NowPlaying :: onUpdateTime(void)
|
||||||
|
throw ()
|
||||||
{
|
{
|
||||||
if (isActive) {
|
if (isActive) {
|
||||||
Ptr<ptime>::Ref now = isPaused ? pausedAtTime
|
Ptr<time_duration>::Ref elapsed = gLiveSupport->
|
||||||
: TimeConversion::now();
|
getOutputAudioPosition();
|
||||||
Ptr<time_duration>::Ref elapsed(new time_duration(
|
|
||||||
*now - *audioStart ));
|
|
||||||
Ptr<time_duration>::Ref remains(new time_duration(
|
Ptr<time_duration>::Ref remains(new time_duration(
|
||||||
*audioLength - *elapsed ));
|
*audioLength - *elapsed ));
|
||||||
elapsedTime->set_text(*TimeConversion::timeDurationToHhMmSsString(
|
elapsedTime->set_text(*TimeConversion::timeDurationToHhMmSsString(
|
||||||
|
|
|
@ -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.h,v $
|
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.
|
* The box displaying "now playing" in the master panel.
|
||||||
*
|
*
|
||||||
* @author $Author: fgerlits $
|
* @author $Author: fgerlits $
|
||||||
* @version $Revision: 1.5 $
|
* @version $Revision: 1.6 $
|
||||||
*/
|
*/
|
||||||
class NowPlaying : public Gtk::HBox,
|
class NowPlaying : public Gtk::HBox,
|
||||||
public LocalizedObject
|
public LocalizedObject
|
||||||
|
@ -88,17 +88,6 @@ class NowPlaying : public Gtk::HBox,
|
||||||
*/
|
*/
|
||||||
Ptr<time_duration>::Ref audioLength;
|
Ptr<time_duration>::Ref audioLength;
|
||||||
|
|
||||||
/**
|
|
||||||
* The time the item started playing.
|
|
||||||
*/
|
|
||||||
Ptr<ptime>::Ref audioStart;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The time the pause button was pressed.
|
|
||||||
* Non-null if isPaused is true (which implies isActive).
|
|
||||||
*/
|
|
||||||
Ptr<ptime>::Ref pausedAtTime;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The label holding the title etc. of the now playing item.
|
* The label holding the title etc. of the now playing item.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue