Permalink
Browse files

Add new OSD theme strings for cutlist-adjusted times and durations.

The following strings are added, related to the corresponding string
without the "rel" prefix: relsecondsdisplayed, reltotalseconds,
relposition, reldescription, relplayedtime, reltotaltime,
relremainingtime, relbehindtime.

In addition, a progress bar called "relposition" is added, which is
the cutlist-adjusted version of the "position" progress bar.

Note: MythPlayer::calcSliderPos() isn't indented properly so that the
diffs are more apparent.  That will be fixed.

Refs #8631.
  • Loading branch information...
stichnot committed Apr 13, 2012
1 parent e326f26 commit 990e579f724bb2d1af87be98028ad664a5795bc0
Showing with 33 additions and 8 deletions.
  1. +21 −8 mythtv/libs/libmythtv/mythplayer.cpp
  2. +12 −0 mythtv/libs/libmythtv/osd.cpp
@@ -4685,9 +4685,21 @@ void MythPlayer::calcSliderPos(osdInfo &info, bool paddedFields)
playbackLen = max(playbackLen, 1);
secsplayed = min((float)playbackLen, max(secsplayed, 0.0f));
info.values.insert("secondsplayed", (int)secsplayed);
info.values.insert("totalseconds", playbackLen);
info.values["position"] = (int)(1000.0f * (secsplayed / (float)playbackLen));
// Set the raw values, followed by the translated values.
for (int i = 0; i < 2 ; ++i)
{
QString relPrefix = (i == 0 ? "" : "rel");
if (i > 0)
{
playbackLen = deleteMap.TranslatePositionAbsToRel(playbackLen * video_frame_rate) /
video_frame_rate;
secsplayed = deleteMap.TranslatePositionAbsToRel(secsplayed * video_frame_rate) /
video_frame_rate;
}
info.values.insert(relPrefix + "secondsplayed", (int)secsplayed);
info.values.insert(relPrefix + "totalseconds", playbackLen);
info.values[relPrefix + "position"] = (int)(1000.0f * (secsplayed / (float)playbackLen));
int phours = (int)secsplayed / 3600;
int pmins = ((int)secsplayed - phours * 3600) / 60;
@@ -4736,11 +4748,12 @@ void MythPlayer::calcSliderPos(osdInfo &info, bool paddedFields)
}
}
info.text["description"] = QObject::tr("%1 of %2").arg(text1).arg(text2);
info.text["playedtime"] = text1;
info.text["totaltime"] = text2;
info.text["remainingtime"] = islive ? QString() : text3;
info.text["behindtime"] = islive ? text3 : QString();
info.text[relPrefix + "description"] = QObject::tr("%1 of %2").arg(text1).arg(text2);
info.text[relPrefix + "playedtime"] = text1;
info.text[relPrefix + "totaltime"] = text2;
info.text[relPrefix + "remainingtime"] = islive ? QString() : text3;
info.text[relPrefix + "behindtime"] = islive ? text3 : QString();
}
}
int MythPlayer::GetNumChapters()
@@ -344,6 +344,18 @@ void OSD::SetValues(const QString &window, QHash<QString,int> &map,
found = true;
}
}
if (map.contains("relposition"))
{
MythUIProgressBar *bar = dynamic_cast<MythUIProgressBar *> (win->GetChild("relposition"));
if (bar)
{
bar->SetVisible(true);
bar->SetStart(0);
bar->SetTotal(1000);
bar->SetUsed(map.value("relposition"));
found = true;
}
}
if (found)
SetExpiry(window, timeout);

0 comments on commit 990e579

Please sign in to comment.