Skip to content

Commit

Permalink
Add new OSD theme strings for cutlist-adjusted times and durations.
Browse files Browse the repository at this point in the history
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 990e579
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 8 deletions.
29 changes: 21 additions & 8 deletions mythtv/libs/libmythtv/mythplayer.cpp
Expand Up @@ -4685,9 +4685,21 @@ void MythPlayer::calcSliderPos(osdInfo &info, bool paddedFields)
playbackLen = max(playbackLen, 1); playbackLen = max(playbackLen, 1);
secsplayed = min((float)playbackLen, max(secsplayed, 0.0f)); secsplayed = min((float)playbackLen, max(secsplayed, 0.0f));


info.values.insert("secondsplayed", (int)secsplayed); // Set the raw values, followed by the translated values.
info.values.insert("totalseconds", playbackLen); for (int i = 0; i < 2 ; ++i)
info.values["position"] = (int)(1000.0f * (secsplayed / (float)playbackLen)); {
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 phours = (int)secsplayed / 3600;
int pmins = ((int)secsplayed - phours * 3600) / 60; int pmins = ((int)secsplayed - phours * 3600) / 60;
Expand Down Expand Up @@ -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[relPrefix + "description"] = QObject::tr("%1 of %2").arg(text1).arg(text2);
info.text["playedtime"] = text1; info.text[relPrefix + "playedtime"] = text1;
info.text["totaltime"] = text2; info.text[relPrefix + "totaltime"] = text2;
info.text["remainingtime"] = islive ? QString() : text3; info.text[relPrefix + "remainingtime"] = islive ? QString() : text3;
info.text["behindtime"] = islive ? text3 : QString(); info.text[relPrefix + "behindtime"] = islive ? text3 : QString();
}
} }


int MythPlayer::GetNumChapters() int MythPlayer::GetNumChapters()
Expand Down
12 changes: 12 additions & 0 deletions mythtv/libs/libmythtv/osd.cpp
Expand Up @@ -344,6 +344,18 @@ void OSD::SetValues(const QString &window, QHash<QString,int> &map,
found = true; 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) if (found)
SetExpiry(window, timeout); SetExpiry(window, timeout);
Expand Down

0 comments on commit 990e579

Please sign in to comment.