Skip to content

Commit 3dbd1bd

Browse files
committed
Speed up initial loading of Watch Recordings screen.
Fixes #10161. Defer initialization of string properties and states in the PlaybackBox button list items until the item receives the itemVisible signal. This can greatly improve responsiveness when the recording group being displayed has 1000+ recordings and the frontend CPU is relatively weak, e.g. an ION-based system. The improvement is particularly noticeable when using the Change Group Filter menu item within the Watch Recordings screen.
1 parent 759fea8 commit 3dbd1bd

File tree

1 file changed

+44
-60
lines changed

1 file changed

+44
-60
lines changed

mythtv/programs/mythfrontend/playbackbox.cpp

Lines changed: 44 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,47 @@ void PlaybackBox::UpdateUIListItem(MythUIButtonListItem *item,
824824

825825
SetItemIcons(item, pginfo);
826826

827+
QMap<AudioProps, QString> audioFlags;
828+
audioFlags[AUD_DOLBY] = "dolby";
829+
audioFlags[AUD_SURROUND] = "surround";
830+
audioFlags[AUD_STEREO] = "stereo";
831+
audioFlags[AUD_MONO] = "mono";
832+
833+
QMap<VideoProps, QString> videoFlags;
834+
videoFlags[VID_1080] = "hd1080";
835+
videoFlags[VID_720] = "hd720";
836+
videoFlags[VID_HDTV] = "hdtv";
837+
videoFlags[VID_WIDESCREEN] = "widescreen";
838+
839+
QMap<SubtitleTypes, QString> subtitleFlags;
840+
subtitleFlags[SUB_SIGNED] = "deafsigned";
841+
subtitleFlags[SUB_ONSCREEN] = "onscreensub";
842+
subtitleFlags[SUB_NORMAL] = "subtitles";
843+
subtitleFlags[SUB_HARDHEAR] = "cc";
844+
845+
QMap<AudioProps, QString>::iterator ait;
846+
for (ait = audioFlags.begin(); ait != audioFlags.end(); ++ait)
847+
{
848+
if (pginfo->GetAudioProperties() & ait.key())
849+
item->DisplayState(ait.value(), "audioprops");
850+
}
851+
852+
QMap<VideoProps, QString>::iterator vit;
853+
for (vit = videoFlags.begin(); vit != videoFlags.end(); ++vit)
854+
{
855+
if (pginfo->GetVideoProperties() & vit.key())
856+
item->DisplayState(vit.value(), "videoprops");
857+
}
858+
859+
QMap<SubtitleTypes, QString>::iterator sit;
860+
for (sit = subtitleFlags.begin(); sit != subtitleFlags.end(); ++sit)
861+
{
862+
if (pginfo->GetSubtitleType() & sit.key())
863+
item->DisplayState(sit.value(), "subtitletypes");
864+
}
865+
866+
item->DisplayState(pginfo->GetCategoryType(), "categorytype");
867+
827868
QString rating = QString::number(pginfo->GetStars(10));
828869

829870
item->DisplayState(rating, "ratingstate");
@@ -920,6 +961,7 @@ void PlaybackBox::ItemVisible(MythUIButtonListItem *item)
920961
m_helper.GetPreviewImage(*sel_pginfo, false));
921962
}
922963
}
964+
UpdateUIListItem(item, item == sel_item, false);
923965
}
924966

925967

@@ -1316,24 +1358,6 @@ void PlaybackBox::updateRecList(MythUIButtonListItem *sel_item)
13161358

13171359
ProgramList &progList = *pmit;
13181360

1319-
QMap<AudioProps, QString> audioFlags;
1320-
audioFlags[AUD_DOLBY] = "dolby";
1321-
audioFlags[AUD_SURROUND] = "surround";
1322-
audioFlags[AUD_STEREO] = "stereo";
1323-
audioFlags[AUD_MONO] = "mono";
1324-
1325-
QMap<VideoProps, QString> videoFlags;
1326-
videoFlags[VID_1080] = "hd1080";
1327-
videoFlags[VID_720] = "hd720";
1328-
videoFlags[VID_HDTV] = "hdtv";
1329-
videoFlags[VID_WIDESCREEN] = "widescreen";
1330-
1331-
QMap<SubtitleTypes, QString> subtitleFlags;
1332-
subtitleFlags[SUB_SIGNED] = "deafsigned";
1333-
subtitleFlags[SUB_ONSCREEN] = "onscreensub";
1334-
subtitleFlags[SUB_NORMAL] = "subtitles";
1335-
subtitleFlags[SUB_HARDHEAR] = "cc";
1336-
13371361
ProgramList::iterator it = progList.begin();
13381362
for (; it != progList.end(); ++it)
13391363
{
@@ -1343,48 +1367,8 @@ void PlaybackBox::updateRecList(MythUIButtonListItem *sel_item)
13431367

13441368
MythUIButtonListItem *item =
13451369
new PlaybackBoxListItem(this, m_recordingList, *it);
1346-
1347-
QString state = extract_main_state(**it, m_player);
1348-
1349-
item->SetFontState(state);
1350-
1351-
InfoMap infoMap;
1352-
(*it)->ToMap(infoMap);
1353-
item->SetTextFromMap(infoMap);
1354-
1355-
QString tempSubTitle = extract_subtitle(**it, groupname);
1356-
1357-
if (groupname == (*it)->GetTitle().toLower())
1358-
item->SetText(tempSubTitle, "titlesubtitle");
1359-
1360-
item->DisplayState(state, "status");
1361-
1362-
item->DisplayState(QString::number((*it)->GetStars(10)), "ratingstate");
1363-
1364-
SetItemIcons(item, (*it));
1365-
1366-
QMap<AudioProps, QString>::iterator ait;
1367-
for (ait = audioFlags.begin(); ait != audioFlags.end(); ++ait)
1368-
{
1369-
if ((*it)->GetAudioProperties() & ait.key())
1370-
item->DisplayState(ait.value(), "audioprops");
1371-
}
1372-
1373-
QMap<VideoProps, QString>::iterator vit;
1374-
for (vit = videoFlags.begin(); vit != videoFlags.end(); ++vit)
1375-
{
1376-
if ((*it)->GetVideoProperties() & vit.key())
1377-
item->DisplayState(vit.value(), "videoprops");
1378-
}
1379-
1380-
QMap<SubtitleTypes, QString>::iterator sit;
1381-
for (sit = subtitleFlags.begin(); sit != subtitleFlags.end(); ++sit)
1382-
{
1383-
if ((*it)->GetSubtitleType() & sit.key())
1384-
item->DisplayState(sit.value(), "subtitletypes");
1385-
}
1386-
1387-
item->DisplayState((*it)->GetCategoryType(), "categorytype");
1370+
// Defer initialization of the item's properties until it
1371+
// first becomes visible.
13881372
}
13891373

13901374
if (m_noRecordingsText)

0 commit comments

Comments
 (0)