From c9545460bbab9d5c3e54ee63fb0ddb7cb6ff087d Mon Sep 17 00:00:00 2001
From: Roger Siddons <dizygotheca@ntlworld.com>
Date: Sat, 11 Oct 2014 18:18:47 +0100
Subject: [PATCH] Upcoming: Add Active filter
diff --git a/mythtv/programs/mythfrontend/viewscheduled.cpp b/mythtv/programs/mythfrontend/viewscheduled.cpp
index 72dbe3c..efd82f4 100644
a
|
b
|
ViewScheduled::ViewScheduled(MythScreenStack *parent, TV* player, bool showTV) |
36 | 36 | m_conflictDate(QDate()), |
37 | 37 | m_schedulesList(NULL), |
38 | 38 | m_groupList(NULL), |
39 | | m_showAll(!gCoreContext->GetNumSetting("ViewSchedShowLevel", 0)), |
| 39 | m_showState(static_cast<ShowStatusType>(gCoreContext->GetNumSetting("ViewSchedShowLevel", 0))), |
40 | 40 | m_inEvent(false), |
41 | 41 | m_inFill(false), |
42 | 42 | m_needFill(false), |
… |
… |
ViewScheduled::ViewScheduled(MythScreenStack *parent, TV* player, bool showTV) |
56 | 56 | ViewScheduled::~ViewScheduled() |
57 | 57 | { |
58 | 58 | gCoreContext->removeListener(this); |
59 | | gCoreContext->SaveSetting("ViewSchedShowLevel", !m_showAll); |
| 59 | gCoreContext->SaveSetting("ViewSchedShowLevel", m_showState); |
60 | 60 | |
61 | 61 | // if we have a player, we need to tell we are done |
62 | 62 | if (m_player) |
… |
… |
bool ViewScheduled::keyPressEvent(QKeyEvent *event) |
178 | 178 | else if (action == ACTION_CHANNELSEARCH) |
179 | 179 | ShowChannelSearch(); |
180 | 180 | else if (action == "1") |
181 | | setShowAll(true); |
| 181 | setShowState(ssShowAll); |
182 | 182 | else if (action == "2") |
183 | | setShowAll(false); |
184 | | else if (action == "PREVVIEW" || action == "NEXTVIEW") |
185 | | setShowAll(!m_showAll); |
| 183 | setShowState(ssShowImportant); |
| 184 | else if (action == "3") |
| 185 | setShowState(ssShowActive); |
| 186 | else if (action == "PREVVIEW") |
| 187 | switch (m_showState) |
| 188 | { |
| 189 | case ssShowAll: |
| 190 | setShowState(ssShowActive); |
| 191 | break; |
| 192 | case ssShowActive: |
| 193 | setShowState(ssShowImportant); |
| 194 | break; |
| 195 | case ssShowImportant: |
| 196 | default: // reset invalid states |
| 197 | setShowState(ssShowAll); |
| 198 | } |
| 199 | else if (action == "NEXTVIEW") |
| 200 | switch (m_showState) |
| 201 | { |
| 202 | case ssShowAll: |
| 203 | setShowState(ssShowImportant); |
| 204 | break; |
| 205 | case ssShowImportant: |
| 206 | setShowState(ssShowActive); |
| 207 | break; |
| 208 | case ssShowActive: |
| 209 | default: // reset invalid states |
| 210 | setShowState(ssShowAll); |
| 211 | } |
186 | 212 | else if (action == "VIEWCARD") |
187 | 213 | viewCards(); |
188 | 214 | else if (action == "VIEWINPUT") |
… |
… |
bool ViewScheduled::keyPressEvent(QKeyEvent *event) |
204 | 230 | |
205 | 231 | void ViewScheduled::ShowMenu(void) |
206 | 232 | { |
207 | | QString label = tr("Options"); |
| 233 | MythMenu *showmenu = new MythMenu(tr("Show"), this, "showmenu"); |
| 234 | showmenu->AddItem(tr("All")); |
| 235 | showmenu->AddItem(tr("Important")); |
| 236 | showmenu->AddItem(tr("Active")); |
| 237 | |
| 238 | MythMenu *menu = new MythMenu(tr("Options"), this, "menu"); |
| 239 | |
| 240 | menu->AddItem(tr("Show"), NULL, showmenu); |
| 241 | menu->AddItem(tr("Program Details")); |
| 242 | menu->AddItem(tr("Program Guide")); |
| 243 | menu->AddItem(tr("Channel Search")); |
| 244 | menu->AddItem(tr("Upcoming by Title")); |
| 245 | menu->AddItem(tr("Upcoming Scheduled")); |
| 246 | menu->AddItem(tr("Previously Recorded")); |
| 247 | menu->AddItem(tr("Custom Edit")); |
| 248 | menu->AddItem(tr("Delete Rule")); |
| 249 | menu->AddItem(tr("Show Cards")); |
| 250 | menu->AddItem(tr("Show Inputs")); |
208 | 251 | |
209 | 252 | MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); |
210 | | MythDialogBox *menuPopup = new MythDialogBox(label, popupStack, |
211 | | "menuPopup"); |
| 253 | MythDialogBox *menuPopup = new MythDialogBox(menu, popupStack, "menuPopup"); |
212 | 254 | |
213 | 255 | if (menuPopup->Create()) |
214 | | { |
215 | | menuPopup->SetReturnEvent(this, "menu"); |
216 | | |
217 | | if (m_showAll) |
218 | | menuPopup->AddButton(tr("Show Important")); |
219 | | else |
220 | | menuPopup->AddButton(tr("Show All")); |
221 | | menuPopup->AddButton(tr("Program Details")); |
222 | | menuPopup->AddButton(tr("Program Guide")); |
223 | | menuPopup->AddButton(tr("Channel Search")); |
224 | | menuPopup->AddButton(tr("Upcoming by title")); |
225 | | menuPopup->AddButton(tr("Upcoming scheduled")); |
226 | | menuPopup->AddButton(tr("Previously Recorded")); |
227 | | menuPopup->AddButton(tr("Custom Edit")); |
228 | | menuPopup->AddButton(tr("Delete Rule")); |
229 | | menuPopup->AddButton(tr("Show Cards")); |
230 | | menuPopup->AddButton(tr("Show Inputs")); |
231 | | |
232 | 256 | popupStack->AddScreen(menuPopup); |
233 | | } |
234 | 257 | else |
235 | | { |
236 | 258 | delete menuPopup; |
237 | | } |
238 | 259 | } |
239 | 260 | |
240 | 261 | void ViewScheduled::LoadList(bool useExistingData) |
… |
… |
void ViewScheduled::LoadList(bool useExistingData) |
288 | 309 | recstatus == rsRecording || |
289 | 310 | recstatus == rsTuning || |
290 | 311 | recstatus == rsFailing) && |
291 | | (m_showAll || |
| 312 | (m_showState == ssShowAll || |
292 | 313 | (recstatus >= rsFailing && |
293 | 314 | recstatus <= rsWillRecord) || |
294 | | recstatus == rsDontRecord || |
295 | | (recstatus == rsTooManyRecordings && |
296 | | ++toomanycounts[pginfo->GetRecordingRuleID()] <= 1) || |
297 | | (recstatus > rsTooManyRecordings && |
298 | | recstatus != rsRepeat && |
299 | | recstatus != rsNeverRecord))) |
| 315 | (m_showState == ssShowImportant && |
| 316 | (recstatus == rsDontRecord || |
| 317 | (recstatus == rsTooManyRecordings && |
| 318 | ++toomanycounts[pginfo->GetRecordingRuleID()] <= 1) || |
| 319 | (recstatus > rsTooManyRecordings && |
| 320 | recstatus != rsRepeat && |
| 321 | recstatus != rsNeverRecord))))) |
300 | 322 | { |
301 | 323 | m_cardref[pginfo->GetCardID()]++; |
302 | 324 | if (pginfo->GetCardID() > m_maxcard) |
… |
… |
void ViewScheduled::FillList() |
502 | 524 | MythUIText *filterText = dynamic_cast<MythUIText*>(GetChild("filter")); |
503 | 525 | if (filterText) |
504 | 526 | { |
505 | | if (m_showAll) |
| 527 | switch (m_showState) { |
| 528 | case ssShowAll: |
506 | 529 | filterText->SetText(tr("All")); |
507 | | else |
| 530 | break; |
| 531 | case ssShowImportant: |
508 | 532 | filterText->SetText(tr("Important")); |
| 533 | break; |
| 534 | case ssShowActive: |
| 535 | filterText->SetText(tr("Active")); |
| 536 | break; |
| 537 | default: |
| 538 | filterText->SetText(""); |
| 539 | } |
509 | 540 | } |
510 | 541 | } |
511 | 542 | |
… |
… |
void ViewScheduled::deleteRule() |
566 | 597 | delete okPopup; |
567 | 598 | } |
568 | 599 | |
569 | | void ViewScheduled::setShowAll(bool all) |
| 600 | void ViewScheduled::setShowState(ShowStatusType state) |
570 | 601 | { |
571 | | m_showAll = all; |
| 602 | m_showState = state; |
572 | 603 | m_needFill = true; |
573 | 604 | } |
574 | 605 | |
… |
… |
void ViewScheduled::customEvent(QEvent *event) |
654 | 685 | |
655 | 686 | EmbedTVWindow(); |
656 | 687 | } |
657 | | else if (resultid == "menu") |
| 688 | else if (resultid == "showmenu") |
658 | 689 | { |
659 | | if (resulttext == tr("Show Important")) |
| 690 | if (resulttext == tr("All")) |
| 691 | { |
| 692 | setShowState(ssShowAll); |
| 693 | } |
| 694 | else if (resulttext == tr("Important")) |
660 | 695 | { |
661 | | setShowAll(false); |
| 696 | setShowState(ssShowImportant); |
662 | 697 | } |
663 | | else if (resulttext == tr("Show All")) |
| 698 | else if (resulttext == tr("Active")) |
664 | 699 | { |
665 | | setShowAll(true); |
| 700 | setShowState(ssShowActive); |
666 | 701 | } |
667 | | else if (resulttext == tr("Program Details")) |
| 702 | if (m_needFill) |
| 703 | LoadList(); |
| 704 | } |
| 705 | else if (resultid == "menu") |
| 706 | { |
| 707 | if (resulttext == tr("Program Details")) |
668 | 708 | { |
669 | 709 | ShowDetails(); |
670 | 710 | } |
… |
… |
void ViewScheduled::customEvent(QEvent *event) |
676 | 716 | { |
677 | 717 | ShowChannelSearch(); |
678 | 718 | } |
679 | | else if (resulttext == tr("Upcoming by title")) |
| 719 | else if (resulttext == tr("Upcoming by Title")) |
680 | 720 | { |
681 | 721 | ShowUpcoming(); |
682 | 722 | } |
683 | | else if (resulttext == tr("Upcoming scheduled")) |
| 723 | else if (resulttext == tr("Upcoming Scheduled")) |
684 | 724 | { |
685 | 725 | ShowUpcomingScheduled(); |
686 | 726 | } |
diff --git a/mythtv/programs/mythfrontend/viewscheduled.h b/mythtv/programs/mythfrontend/viewscheduled.h
index 611eb7a..347e072 100644
a
|
b
|
class ViewScheduled : public ScheduleCommon |
52 | 52 | virtual ProgramInfo *GetCurrentProgram(void) const; |
53 | 53 | |
54 | 54 | private: |
| 55 | typedef enum |
| 56 | { |
| 57 | ssShowAll = 0, |
| 58 | ssShowImportant = 1, |
| 59 | ssShowActive = 2, |
| 60 | } ShowStatusType; |
| 61 | |
55 | 62 | void FillList(void); |
56 | 63 | void LoadList(bool useExistingData = false); |
57 | | void setShowAll(bool all); |
| 64 | void setShowState(ShowStatusType state); |
58 | 65 | void viewCards(void); |
59 | 66 | void viewInputs(void); |
60 | 67 | |
… |
… |
class ViewScheduled : public ScheduleCommon |
68 | 75 | MythUIButtonList *m_schedulesList; |
69 | 76 | MythUIButtonList *m_groupList; |
70 | 77 | |
71 | | bool m_showAll; |
| 78 | ShowStatusType m_showState; |
72 | 79 | |
73 | 80 | bool m_inEvent; |
74 | 81 | bool m_inFill; |