@@ -499,6 +499,7 @@ bool PlaybackBox::Create()
499
499
return false ;
500
500
501
501
m_recgroupList = dynamic_cast <MythUIButtonList *> (GetChild (" recgroups" ));
502
+ m_groupAlphaList = dynamic_cast <MythUIButtonList *> (GetChild (" groupsAlphabet" ));
502
503
m_groupList = dynamic_cast <MythUIButtonList *> (GetChild (" groups" ));
503
504
m_recordingList = dynamic_cast <MythUIButtonList *> (GetChild (" recordings" ));
504
505
@@ -522,15 +523,21 @@ bool PlaybackBox::Create()
522
523
{
523
524
if (gCoreContext ->GetBoolSetting (" RecGroupsFocusable" , false ))
524
525
{
525
- connect (m_recgroupList, &MythUIButtonList::itemSelected,
526
- this , &PlaybackBox::updateRecGroup);
526
+ connect (m_recgroupList, &MythUIButtonList::itemSelected,
527
+ this , &PlaybackBox::updateRecGroup);
527
528
}
528
529
else
529
530
{
530
531
m_recgroupList->SetCanTakeFocus (false );
531
532
}
532
533
}
533
534
535
+ if (m_groupAlphaList)
536
+ {
537
+ connect (m_groupAlphaList, &MythUIButtonList::itemSelected,
538
+ this , &PlaybackBox::selectUIGroupsAlphabet);
539
+ }
540
+
534
541
connect (m_groupList, &MythUIButtonList::itemSelected,
535
542
this , &PlaybackBox::updateRecList);
536
543
connect (m_groupList, &MythUIButtonList::itemClicked,
@@ -550,6 +557,7 @@ bool PlaybackBox::Create()
550
557
connect (m_artTimer[kArtworkCoverart ], &QTimer::timeout, this , &PlaybackBox::coverartLoad);
551
558
552
559
BuildFocusList ();
560
+ SetFocusWidget (m_groupList);
553
561
m_programInfoCache.ScheduleLoad (false );
554
562
LoadInBackground ();
555
563
@@ -595,7 +603,8 @@ void PlaybackBox::SwitchList()
595
603
{
596
604
if (GetFocusWidget () == m_groupList)
597
605
SetFocusWidget (m_recordingList);
598
- else if (GetFocusWidget () == m_recordingList)
606
+ else if (GetFocusWidget () == m_recordingList ||
607
+ GetFocusWidget () == m_groupAlphaList)
599
608
SetFocusWidget (m_groupList);
600
609
}
601
610
@@ -1403,18 +1412,21 @@ void PlaybackBox::UpdateUIRecGroupList(void)
1403
1412
void PlaybackBox::UpdateUIGroupList (const QStringList &groupPreferences)
1404
1413
{
1405
1414
m_groupList->Reset ();
1415
+ if (m_groupAlphaList)
1416
+ m_groupAlphaList->Reset ();
1406
1417
1407
1418
if (!m_titleList.isEmpty ())
1408
1419
{
1409
1420
int best_pref = INT_MAX;
1410
1421
int sel_idx = 0 ;
1422
+
1411
1423
QStringList::iterator it;
1412
1424
for (it = m_titleList.begin (); it != m_titleList.end (); ++it)
1413
1425
{
1414
1426
const QString& groupname = (*it);
1415
1427
1416
1428
auto *item = new MythUIButtonListItem (m_groupList, " " ,
1417
- QVariant::fromValue (groupname.toLower ()));
1429
+ QVariant::fromValue (groupname.toLower ()));
1418
1430
1419
1431
int pref = groupPreferences.indexOf (groupname.toLower ());
1420
1432
if ((pref >= 0 ) && (pref < best_pref))
@@ -1449,6 +1461,17 @@ void PlaybackBox::UpdateUIGroupList(const QStringList &groupPreferences)
1449
1461
// to be called with m_needUpdate set.
1450
1462
if (!sel_idx)
1451
1463
updateRecList (m_groupList->GetItemCurrent ());
1464
+
1465
+ if (m_groupAlphaList)
1466
+ {
1467
+ for (auto Iqs = m_groupAlphabet.keyValueBegin ();
1468
+ Iqs != m_groupAlphabet.keyValueEnd (); ++Iqs)
1469
+ {
1470
+ auto *item = new MythUIButtonListItem (m_groupAlphaList, " " ,
1471
+ QVariant::fromValue (Iqs->first ));
1472
+ item->SetText (Iqs->first );
1473
+ }
1474
+ }
1452
1475
}
1453
1476
}
1454
1477
@@ -1483,7 +1506,6 @@ void PlaybackBox::updateRecList(MythUIButtonListItem *sel_item)
1483
1506
QString grouplabel = sel_item->GetText ();
1484
1507
1485
1508
updateGroupInfo (groupname, grouplabel);
1486
-
1487
1509
if (((m_currentGroup == groupname) && !m_needUpdate) ||
1488
1510
m_playingSomething)
1489
1511
return ;
@@ -1524,6 +1546,33 @@ void PlaybackBox::updateRecList(MythUIButtonListItem *sel_item)
1524
1546
m_noRecordingsText->SetVisible (true );
1525
1547
}
1526
1548
}
1549
+
1550
+ if (m_groupAlphaList)
1551
+ {
1552
+ if (grouplabel.startsWith (" Watch List" ) ||
1553
+ grouplabel.startsWith (" All Programs" ))
1554
+ {
1555
+ m_currentLetter = " All" ;
1556
+ }
1557
+ else
1558
+ {
1559
+ ProgramInfo *pginfo = GetCurrentProgram ();
1560
+ m_currentLetter = pginfo->GetSortTitle ().at (0 ).toUpper ();
1561
+ m_groupAlphaList->MoveToNamedPosition (m_currentLetter);
1562
+ }
1563
+ }
1564
+ }
1565
+
1566
+ void PlaybackBox::selectUIGroupsAlphabet (MythUIButtonListItem *item)
1567
+ {
1568
+ if (!item || (m_currentLetter == item->GetText ()) )
1569
+ return ;
1570
+
1571
+ if (!item->GetText ().isEmpty ())
1572
+ {
1573
+ m_currentLetter = item->GetText ();
1574
+ m_groupList->MoveToNamedPosition (m_groupAlphabet[m_currentLetter]);
1575
+ }
1527
1576
}
1528
1577
1529
1578
static bool save_position (
@@ -2077,6 +2126,16 @@ bool PlaybackBox::UpdateUILists(void)
2077
2126
}
2078
2127
}
2079
2128
2129
+ QChar first;
2130
+ m_groupAlphabet.clear ();
2131
+ for (auto it = sortedList.keyValueBegin ();
2132
+ it != sortedList.keyValueEnd (); ++it)
2133
+ {
2134
+ first = (*it).first .at (0 ).toUpper ();
2135
+ if (!m_groupAlphabet.contains (first))
2136
+ m_groupAlphabet[first] = (*it).second ;
2137
+ }
2138
+
2080
2139
UpdateUIRecGroupList ();
2081
2140
UpdateUIGroupList (groupSelPref);
2082
2141
UpdateUsageUI ();
0 commit comments