summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Kendall <mkendall@mythtv.org>2011-06-13 03:46:41 (GMT)
committer Mark Kendall <mkendall@mythtv.org>2011-06-13 03:46:41 (GMT)
commit1be38ea4edbbf251f0a06d8e44fec27cfa1b12af (patch)
tree3529f9ad7fd14852cc550f13c2291d125aaeb0a9
parent18ab626bb4de9a487dc36f481b2d93badef30160 (diff)
OSD: Fix subtitle window painting order.
The order of iterating over a QHash is arbitrary and the fact that subtitle and interactive screens have (mostly) been drawn in the correct order since the OSD re-write is pure luck. So switch to a QMap which, while marginally slower, will order on the basis of the key (QString) and force the subtitle/interactive screens to be painted first by adding some numerics to their identifiers. Should fix the ordering issue seen in #9822 and occasionally in the yet to be enabled blu-ray HDMV navigation mode. Cherry picked from master be25039cd6e511bedc55 Fixes #9822
-rw-r--r--mythtv/libs/libmythtv/osd.cpp12
-rw-r--r--mythtv/libs/libmythtv/osd.h12
2 files changed, 16 insertions, 8 deletions
diff --git a/mythtv/libs/libmythtv/osd.cpp b/mythtv/libs/libmythtv/osd.cpp
index 67f7869..bfa7262 100644
--- a/mythtv/libs/libmythtv/osd.cpp
+++ b/mythtv/libs/libmythtv/osd.cpp
@@ -200,7 +200,7 @@ void OSD::SetPainter(MythPainter *painter)
return;
m_CurrentPainter = painter;
- QHashIterator<QString, MythScreenType*> it(m_Children);
+ QMapIterator<QString, MythScreenType*> it(m_Children);
while (it.hasNext())
{
it.next();
@@ -275,7 +275,7 @@ bool OSD::IsVisible(void)
void OSD::HideAll(bool keepsubs, MythScreenType* except)
{
- QMutableHashIterator<QString, MythScreenType*> it(m_Children);
+ QMutableMapIterator<QString, MythScreenType*> it(m_Children);
while (it.hasNext())
{
it.next();
@@ -538,7 +538,7 @@ bool OSD::DrawDirect(MythPainter* painter, QSize size, bool repaint)
QTime now = QTime::currentTime();
CheckExpiry();
- QHash<QString,MythScreenType*>::iterator it;
+ QMap<QString,MythScreenType*>::const_iterator it;
for (it = m_Children.begin(); it != m_Children.end(); ++it)
{
if (it.value()->IsVisible())
@@ -594,7 +594,7 @@ QRegion OSD::Draw(MythPainter* painter, QPaintDevice *device, QSize size,
CheckExpiry();
// first update for alpha pulse and fade
- QHash<QString,MythScreenType*>::iterator it;
+ QMap<QString,MythScreenType*>::const_iterator it;
for (it = m_Children.begin(); it != m_Children.end(); ++it)
{
if (it.value()->IsVisible())
@@ -990,6 +990,8 @@ TeletextScreen* OSD::InitTeletext(void)
if (tt->Create())
{
m_Children.insert(OSD_WIN_TELETEXT, tt);
+ VERBOSE(VB_PLAYBACK, LOC + QString("Created window %1")
+ .arg(OSD_WIN_TELETEXT));
}
else
{
@@ -1096,6 +1098,8 @@ SubtitleScreen* OSD::InitSubtitles(void)
if (sub->Create())
{
m_Children.insert(OSD_WIN_SUBTITLE, sub);
+ VERBOSE(VB_PLAYBACK, LOC + QString("Created window %1")
+ .arg(OSD_WIN_SUBTITLE));
}
else
{
diff --git a/mythtv/libs/libmythtv/osd.h b/mythtv/libs/libmythtv/osd.h
index 2361492..d1e9df5 100644
--- a/mythtv/libs/libmythtv/osd.h
+++ b/mythtv/libs/libmythtv/osd.h
@@ -19,9 +19,13 @@ struct AVSubtitle;
#define OSD_DLG_EDITOR "OSD_EDITOR"
#define OSD_DLG_CUTPOINT "OSD_CUTPOINT"
#define OSD_DLG_DELETE "OSD_DELETE"
-#define OSD_WIN_TELETEXT "OSD_TELETEXT"
-#define OSD_WIN_SUBTITLE "OSD_SUBTITLES"
-#define OSD_WIN_INTERACT "OSD_INTERACTIVE"
+// Force subtitle/interactive screens to be drawn first (i.e. at the back) by
+// prepending their identifiers with a low numeric (may not always work as
+// QMap/QString ordering is based on unicode values)
+#define OSD_WIN_TELETEXT "00_OSD_TELETEXT"
+#define OSD_WIN_SUBTITLE "00_OSD_SUBTITLES"
+// MHEG should cover subtitles
+#define OSD_WIN_INTERACT "01_OSD_INTERACTIVE"
#define kOSDFadeTime 1000
@@ -210,7 +214,7 @@ class OSD
enum OSDFunctionalType m_FunctionalType;
QString m_FunctionalWindow;
- QHash<QString, MythScreenType*> m_Children;
+ QMap<QString, MythScreenType*> m_Children;
QHash<MythScreenType*, QDateTime> m_ExpireTimes;
};