Skip to content

Commit e35edbe

Browse files
committed
playbackbox: Add groupAlphabet buttonlist for quick navigation within groups.
Themes can add a <buttonlist name="groupsAlphabet"> to <window name="watchrecordings"> When the user presses left (up) from the Groups list they will be presented with the list of first letters allowing quick navigation to a group/show title.
1 parent 7aac916 commit e35edbe

File tree

10 files changed

+271
-10
lines changed

10 files changed

+271
-10
lines changed

mythtv/programs/mythfrontend/playbackbox.cpp

Lines changed: 64 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@ bool PlaybackBox::Create()
499499
return false;
500500

501501
m_recgroupList = dynamic_cast<MythUIButtonList *> (GetChild("recgroups"));
502+
m_groupAlphaList = dynamic_cast<MythUIButtonList *> (GetChild("groupsAlphabet"));
502503
m_groupList = dynamic_cast<MythUIButtonList *> (GetChild("groups"));
503504
m_recordingList = dynamic_cast<MythUIButtonList *> (GetChild("recordings"));
504505

@@ -522,15 +523,21 @@ bool PlaybackBox::Create()
522523
{
523524
if (gCoreContext->GetBoolSetting("RecGroupsFocusable", false))
524525
{
525-
connect(m_recgroupList, &MythUIButtonList::itemSelected,
526-
this, &PlaybackBox::updateRecGroup);
526+
connect(m_recgroupList, &MythUIButtonList::itemSelected,
527+
this, &PlaybackBox::updateRecGroup);
527528
}
528529
else
529530
{
530531
m_recgroupList->SetCanTakeFocus(false);
531532
}
532533
}
533534

535+
if (m_groupAlphaList)
536+
{
537+
connect(m_groupAlphaList, &MythUIButtonList::itemSelected,
538+
this, &PlaybackBox::selectUIGroupsAlphabet);
539+
}
540+
534541
connect(m_groupList, &MythUIButtonList::itemSelected,
535542
this, &PlaybackBox::updateRecList);
536543
connect(m_groupList, &MythUIButtonList::itemClicked,
@@ -550,6 +557,7 @@ bool PlaybackBox::Create()
550557
connect(m_artTimer[kArtworkCoverart], &QTimer::timeout, this, &PlaybackBox::coverartLoad);
551558

552559
BuildFocusList();
560+
SetFocusWidget(m_groupList);
553561
m_programInfoCache.ScheduleLoad(false);
554562
LoadInBackground();
555563

@@ -595,7 +603,8 @@ void PlaybackBox::SwitchList()
595603
{
596604
if (GetFocusWidget() == m_groupList)
597605
SetFocusWidget(m_recordingList);
598-
else if (GetFocusWidget() == m_recordingList)
606+
else if (GetFocusWidget() == m_recordingList ||
607+
GetFocusWidget() == m_groupAlphaList)
599608
SetFocusWidget(m_groupList);
600609
}
601610

@@ -1403,18 +1412,21 @@ void PlaybackBox::UpdateUIRecGroupList(void)
14031412
void PlaybackBox::UpdateUIGroupList(const QStringList &groupPreferences)
14041413
{
14051414
m_groupList->Reset();
1415+
if (m_groupAlphaList)
1416+
m_groupAlphaList->Reset();
14061417

14071418
if (!m_titleList.isEmpty())
14081419
{
14091420
int best_pref = INT_MAX;
14101421
int sel_idx = 0;
1422+
14111423
QStringList::iterator it;
14121424
for (it = m_titleList.begin(); it != m_titleList.end(); ++it)
14131425
{
14141426
const QString& groupname = (*it);
14151427

14161428
auto *item = new MythUIButtonListItem(m_groupList, "",
1417-
QVariant::fromValue(groupname.toLower()));
1429+
QVariant::fromValue(groupname.toLower()));
14181430

14191431
int pref = groupPreferences.indexOf(groupname.toLower());
14201432
if ((pref >= 0) && (pref < best_pref))
@@ -1449,6 +1461,17 @@ void PlaybackBox::UpdateUIGroupList(const QStringList &groupPreferences)
14491461
// to be called with m_needUpdate set.
14501462
if (!sel_idx)
14511463
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+
}
14521475
}
14531476
}
14541477

@@ -1483,7 +1506,6 @@ void PlaybackBox::updateRecList(MythUIButtonListItem *sel_item)
14831506
QString grouplabel = sel_item->GetText();
14841507

14851508
updateGroupInfo(groupname, grouplabel);
1486-
14871509
if (((m_currentGroup == groupname) && !m_needUpdate) ||
14881510
m_playingSomething)
14891511
return;
@@ -1524,6 +1546,33 @@ void PlaybackBox::updateRecList(MythUIButtonListItem *sel_item)
15241546
m_noRecordingsText->SetVisible(true);
15251547
}
15261548
}
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+
}
15271576
}
15281577

15291578
static bool save_position(
@@ -2077,6 +2126,16 @@ bool PlaybackBox::UpdateUILists(void)
20772126
}
20782127
}
20792128

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+
20802139
UpdateUIRecGroupList();
20812140
UpdateUIGroupList(groupSelPref);
20822141
UpdateUsageUI();

mythtv/programs/mythfrontend/playbackbox.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ class PlaybackBox : public ScheduleCommon
140140

141141
protected slots:
142142
void updateRecList(MythUIButtonListItem *sel_item);
143+
void selectUIGroupsAlphabet(MythUIButtonListItem *item);
143144
void ItemSelected(MythUIButtonListItem *item)
144145
{ UpdateUIListItem(item, true); }
145146
void ItemVisible(MythUIButtonListItem *item);
@@ -355,6 +356,7 @@ class PlaybackBox : public ScheduleCommon
355356

356357

357358
MythUIButtonList *m_recgroupList {nullptr};
359+
MythUIButtonList *m_groupAlphaList {nullptr};
358360
MythUIButtonList *m_groupList {nullptr};
359361
MythUIButtonList *m_recordingList {nullptr};
360362

@@ -392,6 +394,10 @@ class PlaybackBox : public ScheduleCommon
392394
/// listOrder controls the ordering of the recordings in the list
393395
int m_listOrder {1};
394396

397+
// Group alphabet support
398+
QString m_currentLetter;
399+
QMap<QString, QString> m_groupAlphabet;
400+
395401
// Recording Group settings
396402
QString m_groupDisplayName;
397403
QString m_recGroup;

mythtv/themes/MythCenter-wide/recordings-ui.xml

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,46 @@
134134

135135
</buttonlist>
136136

137+
<buttonlist name="groupsAlphabet" from="basebuttonlist">
138+
<area>300,85,45,45</area>
139+
<buttonarea>0,0,100%,100%</buttonarea>
140+
<spacing>0</spacing>
141+
<scrollstyle>center</scrollstyle>
142+
<wrapstyle>items</wrapstyle>
143+
<statetype name="buttonitem">
144+
<area>0,0,100%,100%</area>
145+
<state name="active">
146+
<area>0,0,100%,100%</area>
147+
<shape name="basebackground">
148+
<area>0,0,100%,100%</area>
149+
</shape>
150+
<shape name="selectbar">
151+
<area>0,0,100%,100%</area>
152+
<line color="#FFFF00" alpha="250" width="2" />
153+
</shape>
154+
<textarea name="buttontext">
155+
<area>1,1,-1,-1</area>
156+
<font>basemedium_selected_button</font>
157+
<align>center</align>
158+
</textarea>
159+
</state>
160+
<state name="selectedactive" from="active" />
161+
162+
<state name="inactive">
163+
<area>0,0,0,0</area>
164+
</state>
165+
<state name="selectedinactive">
166+
<area>0,0,0,0</area>
167+
</state>
168+
</statetype>
169+
<statetype name="upscrollarrow">
170+
<area>0,0,0,0</area>
171+
</statetype>
172+
<statetype name="downscrollarrow">
173+
<area>0,0,0,0</area>
174+
</statetype>
175+
</buttonlist>
176+
137177
<buttonlist name="groups" from="basebuttonlist2">
138178
<area>25,54,315,350</area>
139179
<buttonarea>0,36,255,270</buttonarea>
@@ -181,7 +221,6 @@
181221
<statetype name="downscrollarrow">
182222
<position>270,310</position>
183223
</statetype>
184-
185224
</buttonlist>
186225

187226
<buttonlist name="recordings" from="basebuttonlist2">

mythtv/themes/MythCenter-wide/themeinfo.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<major>1</major>
3535

3636
<!-- Minor version changes are backwards compatible -->
37-
<minor>11</minor>
37+
<minor>12</minor>
3838
</version>
3939

4040
<!-- Theme Details (Required) -->

mythtv/themes/MythCenter/recordings-ui.xml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,46 @@
134134

135135
</buttonlist>
136136

137+
<buttonlist name="groupsAlphabet" from="basebuttonlist">
138+
<area>200,85,35,35</area>
139+
<buttonarea>0,0,100%,100%</buttonarea>
140+
<spacing>0</spacing>
141+
<scrollstyle>center</scrollstyle>
142+
<wrapstyle>items</wrapstyle>
143+
<statetype name="buttonitem">
144+
<area>0,0,100%,100%</area>
145+
<state name="active">
146+
<area>0,0,100%,100%</area>
147+
<shape name="basebackground">
148+
<area>0,0,100%,100%</area>
149+
</shape>
150+
<shape name="selectbar">
151+
<area>0,0,100%,100%</area>
152+
<line color="#FFFF00" alpha="250" width="2" />
153+
</shape>
154+
<textarea name="buttontext">
155+
<area>1,1,-1,-1</area>
156+
<font>basemedium_selected_button</font>
157+
<align>center</align>
158+
</textarea>
159+
</state>
160+
<state name="selectedactive" from="active" />
161+
162+
<state name="inactive">
163+
<area>0,0,0,0</area>
164+
</state>
165+
<state name="selectedinactive">
166+
<area>0,0,0,0</area>
167+
</state>
168+
</statetype>
169+
<statetype name="upscrollarrow">
170+
<area>0,0,0,0</area>
171+
</statetype>
172+
<statetype name="downscrollarrow">
173+
<area>0,0,0,0</area>
174+
</statetype>
175+
</buttonlist>
176+
137177
<buttonlist name="groups" from="basebuttonlist2">
138178
<area>15,85,220,240</area>
139179
<buttonarea>0,0,220,210</buttonarea>

mythtv/themes/MythCenter/themeinfo.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<author>
2323
<!-- Your name -->
2424
<name>Jeroen Brosens</name>
25-
25+
2626
<!-- Your Email Address -->
2727
<email>[email protected]</email>
2828
</author>
@@ -34,7 +34,7 @@
3434
<major>1</major>
3535

3636
<!-- Minor version changes are backwards compatible -->
37-
<minor>6</minor>
37+
<minor>7</minor>
3838
</version>
3939

4040
<!-- Theme Details (Required) -->

mythtv/themes/Terra/recordings-ui.xml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,46 @@
1616
<filename>recordings/groupframe.png</filename>
1717
</imagetype>
1818

19+
<buttonlist name="groupsAlphabet">
20+
<area>50%-420,98,840,40</area>
21+
<spacing>0</spacing>
22+
<scrollstyle>center</scrollstyle>
23+
<wrapstyle>items</wrapstyle>
24+
<layout>horizontal</layout>
25+
<buttonarea>0,0,100%,100%</buttonarea>
26+
27+
<statetype name="buttonitem">
28+
<area>0,0,100%,100%</area>
29+
30+
<state name="active">
31+
<area>0,0,40,40</area>
32+
<shape name="basebackground">
33+
<area>0,0,100%,100%</area>
34+
<fill color="#686855" />
35+
<line color="#A7AC93" alpha="255" width="1" />
36+
</shape>
37+
<textarea name="buttontext">
38+
<area>1,1,-1,-1</area>
39+
<font>basemedium</font>
40+
<align>center</align>
41+
</textarea>
42+
</state>
43+
<state name="selectedactive" from="active">
44+
<shape name="basebackground">
45+
<area>0,0,100%,100%</area>
46+
<fill color="#868872" />
47+
</shape>
48+
</state>
49+
50+
<state name="inactive">
51+
<area>0,0,0,0</area>
52+
</state>
53+
<state name="selectedinactive">
54+
<area>0,0,0,0</area>
55+
</state>
56+
</statetype>
57+
</buttonlist>
58+
1959
<buttonlist name="groups">
2060
<area>0,58,1280,38</area>
2161
<spacing>15</spacing>
@@ -26,6 +66,7 @@
2666
<statetype name="buttonitem">
2767
<state name="active">
2868
<area>0,0,240,40</area>
69+
2970
<textarea name="name" from="basetextarea">
3071
<area>4,3,232,36</area>
3172
<align>allcenter</align>

mythtv/themes/Terra/themeinfo.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<major>1</major>
3636

3737
<!-- Minor version changes are backwards compatible -->
38-
<minor>5</minor>
38+
<minor>6</minor>
3939
</version>
4040

4141
<!-- Theme Details (Required) -->

0 commit comments

Comments
 (0)