Skip to content

Commit

Permalink
Bluray: Use the new kUpdateTvProgressEventType to update TvPlayWindow
Browse files Browse the repository at this point in the history
This also adds the necessary hookup in the TV class.

TvPlayWindow should now receive a kick each time a new bluray file is
opened. This will update the progress bar (if present) and the call to
qApp->ProcessEvents will repaint the window when the repaint timer has
occurred. Animated images will also be updated if present (which serve
as an alternative progress ticker).

No themes were harmed in the making of this patch - so they'll need
updating to use the functionality.

N.B. The progress bar wraps around when it reaches 100 - this is because
we don't know how much work the bluray object needs to do when opening
the disc structure.
  • Loading branch information
Mark Kendall committed Jan 26, 2011
1 parent 98c1c0b commit 987bf8d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
11 changes: 8 additions & 3 deletions mythtv/libs/libmythtv/bdringbuffer.cpp
Expand Up @@ -8,6 +8,8 @@
#include "bdnav/bdparse.h"
#include "decoders/overlay.h"

#include "mythmainwindow.h"
#include "mythevent.h"
#include "iso639.h"
#include "bdringbuffer.h"
#include "mythverbose.h"
Expand Down Expand Up @@ -261,9 +263,12 @@ void BDRingBuffer::ProgressUpdate(void)
{
// This thread check is probably unnecessary as processEvents should
// only handle events in the calling thread - and not all threads
if (QThread::currentThread() == m_mainThread)
if (qApp->hasPendingEvents())
qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
if (QThread::currentThread() != m_mainThread)
return;

qApp->postEvent(GetMythMainWindow(),
new MythEvent(MythEvent::kUpdateTvProgressEventType));
qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
}

bool BDRingBuffer::OpenFile(const QString &lfilename, uint retry_ms)
Expand Down
9 changes: 8 additions & 1 deletion mythtv/libs/libmythtv/tv_play.cpp
Expand Up @@ -3278,7 +3278,8 @@ bool TV::eventFilter(QObject *o, QEvent *e)
return ignoreKeyPresses?false:event(e);

if (e->type() == MythEvent::MythEventMessage ||
e->type() == MythEvent::MythUserMessage)
e->type() == MythEvent::MythUserMessage ||
e->type() == MythEvent::kUpdateTvProgressEventType)
{
customEvent(e);
return true;
Expand Down Expand Up @@ -8131,6 +8132,12 @@ void TV::PauseAudioUntilBuffered(PlayerContext *ctx)
/// This handles all custom events
void TV::customEvent(QEvent *e)
{
if (e->type() == MythEvent::kUpdateTvProgressEventType && myWindow)
{
myWindow->UpdateProgress();
return;
}

if (e->type() == MythEvent::MythUserMessage)
{
MythEvent *me = (MythEvent *)e;
Expand Down

0 comments on commit 987bf8d

Please sign in to comment.