summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Kendall <mkendall@mythtv.org>2011-06-12 15:26:10 (GMT)
committer Mark Kendall <mkendall@mythtv.org>2011-06-12 15:26:10 (GMT)
commitbe25039cd6e511bedc550dcede34794bb5d39671 (patch)
tree3b17af59d408b82d9eb4152092e8ac04348489e5
parent5bcddfd2769c92fed6001f2f1f3ad493e3606e20 (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. Refs #9822
-rw-r--r--mythtv/libs/libmythtv/osd.cpp12
-rw-r--r--mythtv/libs/libmythtv/osd.h14
2 files changed, 17 insertions, 9 deletions
diff --git a/mythtv/libs/libmythtv/osd.cpp b/mythtv/libs/libmythtv/osd.cpp
index 17e939e..76d9f79 100644
--- a/mythtv/libs/libmythtv/osd.cpp
+++ b/mythtv/libs/libmythtv/osd.cpp
@@ -202,7 +202,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();
@@ -278,7 +278,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();
@@ -542,7 +542,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())
@@ -598,7 +598,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())
@@ -1007,6 +1007,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
{
@@ -1083,6 +1085,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 35fc5c4..1f1ef1e 100644
--- a/mythtv/libs/libmythtv/osd.h
+++ b/mythtv/libs/libmythtv/osd.h
@@ -16,10 +16,14 @@
#define OSD_DLG_CUTPOINT "OSD_CUTPOINT"
#define OSD_DLG_DELETE "OSD_DELETE"
#define OSD_DLG_CONFIRM "mythconfirmpopup"
-#define OSD_WIN_TELETEXT "OSD_TELETEXT"
-#define OSD_WIN_SUBTITLE "OSD_SUBTITLES"
-#define OSD_WIN_INTERACT "OSD_INTERACTIVE"
-#define OSD_WIN_BDOVERLAY "OSD_BDOVERLAY"
+// 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 and blu-ray overlay should cover subtitles
+#define OSD_WIN_INTERACT "01_OSD_INTERACTIVE"
+#define OSD_WIN_BDOVERLAY "01_OSD_BDOVERLAY"
#define kOSDFadeTime 1000
@@ -208,7 +212,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;
};