Allow user to select another video when paused

Fixes #648

Also little play/pause fix.
This commit is contained in:
Andrew Bryson
2012-02-16 19:57:37 +00:00
committed by Mark Liversedge
parent 84cb8541ab
commit 0430568d99
3 changed files with 26 additions and 4 deletions

View File

@@ -655,7 +655,7 @@ void TrainTool::Start() // when start button is pressed
if (status&RT_PAUSED) {
// UN PAUSE!
play->setIcon(playIcon);
play->setIcon(pauseIcon);
session_time.start();
lap_time.start();
@@ -667,6 +667,8 @@ void TrainTool::Start() // when start button is pressed
load_period.restart();
if (status & RT_WORKOUT) load_timer->start(LOADRATE);
mediaTree->setEnabled(false);
// tell the world
main->notifyUnPause();
@@ -685,6 +687,11 @@ void TrainTool::Start() // when start button is pressed
if (status & RT_WORKOUT) load_timer->stop();
load_msecs += load_period.restart();
#if defined Q_OS_MAC || defined GC_HAVE_VLC
// enable media tree so we can change movie
mediaTree->setEnabled(true);
#endif
// tell the world
main->notifyPause();
@@ -808,6 +815,10 @@ void TrainTool::Pause() // pause capture to recalibrate
load_period.restart();
if (status & RT_WORKOUT) load_timer->start(LOADRATE);
#if defined Q_OS_MAC || defined GC_HAVE_VLC
mediaTree->setEnabled(false);
#endif
// tell the world
main->notifyUnPause();
@@ -823,6 +834,9 @@ void TrainTool::Pause() // pause capture to recalibrate
if (status & RT_WORKOUT) load_timer->stop();
load_msecs += load_period.restart();
// enable media tree so we can change movie
mediaTree->setEnabled(true);
// tell the world
main->notifyPause();
}

View File

@@ -19,7 +19,7 @@
#include "VideoWindow.h"
VideoWindow::VideoWindow(MainWindow *parent, const QDir &home) :
GcWindow(parent), home(home), main(parent)
GcWindow(parent), home(home), main(parent), m_MediaChanged(false)
{
setControls(NULL);
setInstanceName("Video Window");
@@ -114,7 +114,6 @@ void VideoWindow::resizeEvent(QResizeEvent * )
void VideoWindow::startPlayback()
{
if (!m) return; // ignore if no media selected
// stop playback & wipe player
@@ -125,6 +124,8 @@ void VideoWindow::startPlayback()
/* play the media_player */
libvlc_media_player_play (mp);
m_MediaChanged = false;
}
void VideoWindow::stopPlayback()
{
@@ -147,7 +148,10 @@ void VideoWindow::resumePlayback()
if (!m) return; // ignore if no media selected
// stop playback & wipe player
libvlc_media_player_pause (mp);
if(m_MediaChanged)
startPlayback();
else
libvlc_media_player_pause (mp);
}
void VideoWindow::seekPlayback(long ms)
@@ -182,6 +186,8 @@ void VideoWindow::mediaSelected(QString filename)
/* set the media to playback */
if (m) libvlc_media_player_set_media (mp, m);
m_MediaChanged = true;
}
}

View File

@@ -87,6 +87,8 @@ class VideoWindow : public GcWindow
QDir home;
MainWindow *main;
bool m_MediaChanged;
libvlc_instance_t * inst;
//libvlc_exception_t exceptions;
libvlc_media_player_t *mp;