Permalink
Browse files

Bluray: Use the new kUpdateTvProgressEventType to update TvPlayWindow

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...
1 parent 98c1c0b commit 987bf8d074e6d078991b9cbdd8a7cef88623bdcb Mark Kendall committed Jan 26, 2011
Showing with 16 additions and 4 deletions.
  1. +8 −3 mythtv/libs/libmythtv/bdringbuffer.cpp
  2. +8 −1 mythtv/libs/libmythtv/tv_play.cpp
@@ -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"
@@ -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)
@@ -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;
@@ -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;

0 comments on commit 987bf8d

Please sign in to comment.