MythTV  master
prevreclist.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Peter G Bennett <pbennett@mythtv.org>
3  *
4  * This file is part of MythTV.
5  *
6  * MythTV is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Public License as
8  * published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * MythTV is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with MythTV. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 // C/C++
21 #include <algorithm>
22 #include <deque> // for _Deque_iterator, operator-, etc
23 #include <iterator> // for reverse_iterator
24 
25 // QT
26 #include <QDateTime>
27 #include <QString>
28 
29 //MythTV
31 #include "libmythbase/mythdb.h"
32 #include "libmythbase/stringutil.h"
39 #include "libmythui/mythuibutton.h"
41 #include "libmythui/mythuitext.h"
42 #include "libmythui/mythuiutils.h" // for UIUtilE, UIUtilW
43 #include "libmythui/xmlparsebase.h"
44 
45 // MythFrontend
46 #include "prevreclist.h"
47 
48 #define LOC QString("PrevRecordedList: ")
49 
50 // flags for PrevRecSortFlags setting
51 static const int fTitleGroup = 1;
52 static const int fReverseSort = 2;
53 static const int fDefault = fReverseSort;
54 
56  QString title) :
57  ScheduleCommon(parent,"PrevRecordedList"),
58  m_recid(recid),
59  m_title(std::move(title))
60 {
61 
62  if (m_recid && !m_title.isEmpty())
63  {
64  m_where = QString(" AND ( recordid = %1 OR title = :MTITLE )")
65  .arg(m_recid);
66  }
67  else if (!m_title.isEmpty())
68  {
69  m_where = QString("AND title = :MTITLE ");
70  }
71  else if (m_recid)
72  {
73  m_where = QString("AND recordid = %1 ").arg(m_recid);
74  }
75  else
76  {
77  // Get sort options if this is not a filtered list
78  int flags = gCoreContext->GetNumSetting("PrevRecSortFlags",fDefault);
79  m_titleGroup = ((flags & fTitleGroup) != 0);
80  m_reverseSort = ((flags & fReverseSort) != 0);
81 
82  }
83 }
84 
86 {
87  if (m_where.isEmpty())
88  {
89  // Save sort setting if this is not a filtered list
90  int flags = 0;
91  if (m_titleGroup)
92  flags |= fTitleGroup;
93  if (m_reverseSort)
94  flags |= fReverseSort;
95  gCoreContext->SaveSetting("PrevRecSortFlags", flags);
96  }
98  m_showData.clear();
100 }
101 
103 {
104  if (!LoadWindowFromXML("schedule-ui.xml", "prevreclist", this))
105  return false;
106 
107  bool err = false;
108  UIUtilE::Assign(this, m_titleList, "titles", &err);
109  UIUtilE::Assign(this, m_showList, "shows", &err);
110  UIUtilW::Assign(this, m_help1Text, "help1text");
111  UIUtilW::Assign(this, m_help2Text, "help2text");
112  UIUtilW::Assign(this, m_curviewText, "curview");
113 
114  if (err)
115  {
116  LOG(VB_GENERAL, LOG_ERR, "Cannot load screen 'prevreclist'");
117  return false;
118  }
119 
120  m_titleList->SetLCDTitles(tr("Programs"), "title");
121  m_showList->SetLCDTitles(tr("Episodes"), "startdate|parttitle");
122 
123  BuildFocusList();
124  gCoreContext->addListener(this);
125  m_loadShows = false;
127 
128  return true;
129 }
130 
132 {
133  gCoreContext->addListener(this);
142 
143  UpdateTitleList();
144  updateInfo();
145 }
146 
147 // When m_loadShows is false we are loading the left hand
148 // button list, when it is true the right hand.
150 {
151  if (m_loadShows)
152  {
153  if (m_titleGroup)
155  else
156  LoadShowsByDate();
157  }
158  else
159  {
160  if (m_titleGroup)
161  LoadTitles();
162  else
163  LoadDates();
164  }
165  auto *slce = new ScreenLoadCompletionEvent(objectName());
166  QCoreApplication::postEvent(this, slce);
167 }
168 
169 static bool comp_sorttitle_lt(const ProgramInfo *a, const ProgramInfo *b)
170 {
172 }
173 
174 static bool comp_sorttitle_lt_rev(const ProgramInfo *a, const ProgramInfo *b)
175 {
177 }
178 
179 static bool comp_sortdate_lt(
180  const ProgramInfo *a, const ProgramInfo *b)
181 {
182  return a->GetRecordingStartTime() < b->GetRecordingStartTime();
183 }
184 
186  const ProgramInfo *a, const ProgramInfo *b)
187 {
188  return b->GetRecordingStartTime() < a->GetRecordingStartTime();
189 }
190 
191 // Load a list of titles without subtitle or other info.
192 // each title can represent multiple recordings.
194 {
195  QString querystr = "SELECT DISTINCT title FROM oldrecorded "
196  "WHERE oldrecorded.future = 0 " + m_where;
197 
198  m_titleData.clear();
199 
200  MSqlQuery query(MSqlQuery::InitCon());
201  query.prepare(querystr);
202 
203  if (!m_title.isEmpty())
204  query.bindValue(":MTITLE", m_title);
205 
206  if (!query.exec())
207  {
208  MythDB::DBError("PrevRecordedList::LoadTitles", query);
209  return false;
210  }
211 
212  while (query.next())
213  {
214  QString title(query.value(0).toString());
215  auto *program = new ProgramInfo();
216  program->SetTitle(title);
217  m_titleData.push_back(program);
218  }
219  if (m_reverseSort)
220  {
221  std::stable_sort(m_titleData.begin(), m_titleData.end(),
223  }
224  else
225  {
226  std::stable_sort(m_titleData.begin(), m_titleData.end(),
228  }
229  return true;
230 }
231 
233 {
234  QString querystr = "SELECT DISTINCT "
235  "YEAR(CONVERT_TZ(starttime,'UTC','SYSTEM')), "
236  "MONTH(CONVERT_TZ(starttime,'UTC','SYSTEM')) "
237  "FROM oldrecorded "
238  "WHERE oldrecorded.future = 0 " + m_where;
239 
240  m_titleData.clear();
241 
242  MSqlQuery query(MSqlQuery::InitCon());
243  query.prepare(querystr);
244 
245  if (!m_title.isEmpty())
246  query.bindValue(":MTITLE", m_title);
247 
248  if (!query.exec())
249  {
250  MythDB::DBError("PrevRecordedList::LoadDates", query);
251  return false;
252  }
253 
254  // Create "Last two weeks" entry
255  // It is identified by bogus date of 0000/00
256 
257  auto *program = new ProgramInfo();
258  program->SetRecordingStartTime(QDateTime::currentDateTime());
259  program->SetTitle(tr("Last two weeks"), "0000/00");
260  m_titleData.push_back(program);
261 
262  while (query.next())
263  {
264  int year(query.value(0).toInt());
265  int month(query.value(1).toInt());
266  program = new ProgramInfo();
267  QDate startdate(year,month,1);
268 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
269  QDateTime starttime(startdate);
270 #else
271  QDateTime starttime = startdate.startOfDay();
272 #endif
273  program->SetRecordingStartTime(starttime);
274  QString date = QString("%1/%2")
275  .arg(year,4,10,QChar('0')).arg(month,2,10,QChar('0'));
276  QLocale locale = gCoreContext->GetLocale()->ToQLocale();
277  QString title = QString("%1 %2").
278  arg(locale.monthName(month)).arg(year);
279  program->SetTitle(title, date);
280  m_titleData.push_back(program);
281  }
282  if (m_reverseSort)
283  {
284  std::stable_sort(m_titleData.begin(), m_titleData.end(),
286  }
287  else
288  {
289  std::stable_sort(m_titleData.begin(), m_titleData.end(),
291  }
292  return true;
293 }
294 
296 {
298 }
299 
301 {
303 }
304 
306  ProgramList *progData, bool isShows) const
307 {
308  bnList->Reset();
309  for (auto *pg : *progData)
310  {
311  auto *item = new MythUIButtonListItem(bnList, "",
312  QVariant::fromValue(pg));
313  InfoMap infoMap;
314  pg->ToMap(infoMap,true);
315  QString state;
316  if (isShows)
317  {
318  QString partTitle;
319  if (m_titleGroup)
320  partTitle = infoMap["subtitle"];
321  else
322  partTitle = infoMap["titlesubtitle"];
323  infoMap["parttitle"] = partTitle;
324  state = RecStatus::toUIState(pg->GetRecordingStatus());
325  if ((state == "warning"))
326  state = "disabled";
327  }
328  else
329  infoMap["buttontext"] = infoMap["title"];
330 
331  item->SetTextFromMap(infoMap, state);
332  }
333 }
334 
336 {
337  if (m_help1Text)
338  m_help1Text->Reset();
339  if (m_help2Text)
340  m_help2Text->Reset();
341 
342  if (!m_showData.empty())
343  {
344  InfoMap infoMap;
345  m_showData[m_showList->GetCurrentPos()]->ToMap(infoMap,true);
346  SetTextFromMap(infoMap);
347  m_infoMap = infoMap;
348  }
349  else
350  {
352 
353  if (m_titleGroup)
354  {
355  m_titleList->SetLCDTitles(tr("Programs"), "title");
356  m_showList->SetLCDTitles(tr("Episodes"), "startdate|parttitle");
357  if (m_help1Text)
358  m_help1Text->SetText(tr("Select a program..."));
359  if (m_help2Text)
360  {
361  m_help2Text->SetText(tr(
362  "Select the title of the program you wish to find. "
363  "When finished return with the left arrow key. "
364  "To search by date press 1."));
365  }
366  if (m_curviewText)
367  {
368  if (m_reverseSort)
369  m_curviewText->SetText(tr("Reverse Title","Sort sequence"));
370  else
371  m_curviewText->SetText(tr("Title","Sort sequence"));
372  }
373  }
374  else
375  {
376  m_titleList->SetLCDTitles(tr("Dates"), "title");
377  m_showList->SetLCDTitles(tr("Programs"), "startdate|parttitle");
378  if (m_help1Text)
379  m_help1Text->SetText(tr("Select a month ..."));
380  if (m_help2Text)
381  {
382  m_help2Text->SetText(tr(
383  "Select a month to search. "
384  "When finished return with the left arrow key. "
385  "To search by title press 2."));
386  }
387  if (m_curviewText)
388  {
389  if (m_reverseSort)
390  m_curviewText->SetText(tr("Reverse Time","Sort sequence"));
391  else
392  m_curviewText->SetText(tr("Time","Sort sequence"));
393  }
394  }
395  }
396 }
397 
399 {
400  m_showData.clear();
401  m_showList->Reset();
402  updateInfo();
403 }
404 
406 {
407  m_loadShows = true;
409 }
410 
412 {
413  MSqlBindings bindings;
414  QString sql = " AND oldrecorded.title = :TITLE " + m_where;
415  uint selected = m_titleList->GetCurrentPos();
416  if (selected < m_titleData.size() && (m_titleData[selected] != nullptr))
417  bindings[":TITLE"] = m_titleData[selected]->GetTitle();
418  else
419  bindings[":TITLE"] = "";
420  if (!m_title.isEmpty())
421  bindings[":MTITLE"] = m_title;
422  m_showData.clear();
423  LoadFromOldRecorded(m_showData, sql, bindings);
424 }
425 
427 {
428  MSqlBindings bindings;
429  int selected = m_titleList->GetCurrentPos();
430  if (m_titleData[selected] == nullptr)
431  {
432  LOG(VB_GENERAL, LOG_ERR, LOC +
433  QString("Invalid selection in title data: %1").arg(selected));
434  return;
435  }
436  QString sortTitle = m_titleData[selected]->GetSortTitle();
437  QStringList dateParts = sortTitle.split('/');
438  if (dateParts.size() != 2)
439  {
440  LOG(VB_GENERAL, LOG_ERR, LOC +
441  QString("Invalid sort Date: %1").arg(sortTitle));
442  return;
443  }
444  QString sortorder;
445  if (m_reverseSort)
446  sortorder = "DESC";
447  QString sql;
448  if (dateParts[0] == "0000")
449  sql = "AND TIMESTAMPDIFF(DAY, starttime, NOW()) < 14 ";
450  else
451  {
452  sql =
453  " AND YEAR(CONVERT_TZ(starttime,'UTC','SYSTEM')) = :YEAR "
454  " AND MONTH(CONVERT_TZ(starttime,'UTC','SYSTEM')) = :MONTH ";
455  bindings[":YEAR"] = dateParts[0];
456  bindings[":MONTH"] = dateParts[1];
457  }
458  sql = sql + m_where + QString(" ORDER BY starttime %1 ").arg(sortorder);
459  if (!m_title.isEmpty())
460  bindings[":MTITLE"] = m_title;
461  m_showData.clear();
462  LoadFromOldRecorded(m_showData, sql, bindings);
463 }
464 
466 {
467  if (!m_allowEvents)
468  return true;
469 
471  {
472  m_allowEvents = true;
473  return true;
474  }
475 
476  m_allowEvents = false;
477 
478  QStringList actions;
479  bool handled = GetMythMainWindow()->TranslateKeyPress(
480  "TV Frontend", e, actions);
481 
482  bool needUpdate = false;
483  for (uint i = 0; i < uint(actions.size()) && !handled; ++i)
484  {
485  QString action = actions[i];
486  handled = true;
487 
488  if (action == "CUSTOMEDIT")
489  EditCustom();
490  else if (action == "EDIT")
491  EditScheduled();
492  else if (action == "DELETE")
494  else if (action == "DETAILS" || action == "INFO")
495  ShowDetails();
496  else if (action == "GUIDE")
497  ShowGuide();
498  else if (action == "UPCOMING")
499  ShowUpcoming();
500  else if (action == "1")
501  {
502  if (m_titleGroup)
503  {
504  m_titleGroup = false;
505  m_reverseSort = true;
506  }
507  else
508  {
510  }
511  needUpdate = true;
512  }
513  else if (action == "2")
514  {
515  if (!m_titleGroup)
516  {
517  m_titleGroup = true;
518  m_reverseSort = false;
519  }
520  else
521  {
523  }
524  needUpdate = true;
525  }
526  else
527  {
528  handled = false;
529  }
530  }
531 
532  if (!handled && MythScreenType::keyPressEvent(e))
533  handled = true;
534 
535  if (needUpdate)
536  {
537  m_loadShows = false;
539  }
540 
541  m_allowEvents = true;
542 
543  return handled;
544 }
545 
547 {
548  auto *sortMenu = new MythMenu(tr("Sort Options"), this, "sortmenu");
549  sortMenu->AddItem(tr("Reverse Sort Order"));
550  sortMenu->AddItem(tr("Sort By Title"));
551  sortMenu->AddItem(tr("Sort By Time"));
552 
553  auto *menu = new MythMenu(tr("List Options"), this, "menu");
554 
555  menu->AddItem(tr("Sort"), nullptr, sortMenu);
556 
558  if (pi)
559  {
560  menu->AddItem(tr("Edit Schedule"), qOverload<>(&PrevRecordedList::EditScheduled));
561  menu->AddItem(tr("Custom Edit"), &PrevRecordedList::EditCustom);
562  menu->AddItem(tr("Program Details"), &PrevRecordedList::ShowDetails);
563  menu->AddItem(tr("Upcoming"), qOverload<>(&PrevRecordedList::ShowUpcoming));
564  menu->AddItem(tr("Channel Search"), &PrevRecordedList::ShowChannelSearch);
565  }
566  menu->AddItem(tr("Program Guide"), &PrevRecordedList::ShowGuide);
567  MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
568  auto *menuPopup = new MythDialogBox(menu, popupStack, "menuPopup");
569 
570  if (!menuPopup->Create())
571  {
572  delete menuPopup;
573  return;
574  }
575 
576  popupStack->AddScreen(menuPopup);
577 }
578 
580 {
581  auto *menu = new MythMenu(tr("Recording Options"), this, "menu");
582 
584  if (pi)
585  {
586  if (pi->IsDuplicate())
587  menu->AddItem(tr("Allow this episode to re-record"), &PrevRecordedList::AllowRecord);
588  else
589  menu->AddItem(tr("Never record this episode"), &PrevRecordedList::PreventRecord);
590  menu->AddItem(tr("Remove this episode from the list"),
592  menu->AddItem(tr("Remove all episodes for this title"),
594  }
595  MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
596  auto *menuPopup = new MythDialogBox(menu, popupStack, "menuPopup");
597 
598  if (!menuPopup->Create())
599  {
600  delete menuPopup;
601  return;
602  }
603 
604  popupStack->AddScreen(menuPopup);
605 }
606 
607 void PrevRecordedList::customEvent(QEvent *event)
608 {
609  bool needUpdate = false;
610 
611  if (event->type() == DialogCompletionEvent::kEventType)
612  {
613  auto *dce = (DialogCompletionEvent*)(event);
614 
615  QString resultid = dce->GetId();
616 // QString resulttext = dce->GetResultText();
617  int buttonnum = dce->GetResult();
618 
619  if (resultid == "sortmenu")
620  {
621  switch (buttonnum)
622  {
623  case 0:
625  needUpdate = true;
626  break;
627  case 1:
628  m_titleGroup = true;
629  m_reverseSort = false;
630  needUpdate = true;
631  break;
632  case 2:
633  m_titleGroup = false;
634  m_reverseSort = true;
635  needUpdate = true;
636  break;
637  }
638  }
639  else if (resultid == "deleterule")
640  {
641  auto *record = dce->GetData().value<RecordingRule *>();
642  if (record && buttonnum > 0 && !record->Delete())
643  {
644  LOG(VB_GENERAL, LOG_ERR, LOC +
645  "Failed to delete recording rule");
646  }
647  delete record;
648  }
649  else
650  {
652  }
653  }
654  else if (event->type() == ScreenLoadCompletionEvent::kEventType)
655  {
656  auto *slce = (ScreenLoadCompletionEvent*)(event);
657  QString id = slce->GetId();
658 
659  if (id == objectName())
660  {
661  // CloseBusyPopup(); // opened by LoadInBackground()
662  if (m_loadShows)
663  {
664  UpdateShowList();
665  CloseBusyPopup(); // opened by LoadInBackground()
666  }
667  else
668  {
669  UpdateTitleList();
670  m_showData.clear();
671  m_showList->Reset();
672  updateInfo();
673  CloseBusyPopup(); // opened by LoadInBackground()
675  }
676  }
677  }
678 
679  if (needUpdate)
680  {
681  m_loadShows = false;
683  }
684 }
685 
687 {
689  if (pi)
690  {
691  int pos = m_showList->GetCurrentPos();
692  RecordingInfo ri(*pi);
693  ri.ForgetHistory();
695  updateInfo();
697  }
698 }
699 
701 {
703  if (pi)
704  {
705  int pos = m_showList->GetCurrentPos();
706  RecordingInfo ri(*pi);
707  ri.SetDupHistory();
709  updateInfo();
711  }
712 }
713 
714 
716 {
717  int pos = m_showList->GetCurrentPos();
718  if (pos >= 0 && pos < (int) m_showData.size())
719  return m_showData[pos];
720  return nullptr;
721 }
722 
724 {
726 
727  if (!pi)
728  return;
729 
730  QString message = tr("Delete this episode of '%1' from the previously recorded history?").arg(pi->GetTitle());
731 
732  ShowOkPopup(message, this, &PrevRecordedList::DeleteOldEpisode, true);
733 }
734 
736 {
738  if (!ok || !pi)
739  return;
740 
741  MSqlQuery query(MSqlQuery::InitCon());
742  query.prepare(
743  "DELETE FROM oldrecorded "
744  "WHERE chanid = :CHANID AND "
745  " starttime = :STARTTIME");
746  query.bindValue(":CHANID", pi->GetChanID());
747  query.bindValue(":STARTTIME", pi->GetScheduledStartTime());
748 
749  if (!query.exec())
750  MythDB::DBError("ProgLister::DeleteOldEpisode", query);
751 
752  ScheduledRecording::RescheduleCheck(*pi, "DeleteOldEpisode");
753 
754  // Delete the current item from both m_showData and m_showList.
755  auto it = m_showData.begin() + m_showList->GetCurrentPos();
756  m_showData.erase(it);
758  m_showList->RemoveItem(item);
759 }
760 
762 {
764 
765  if (!pi)
766  return;
767 
768  QString message = tr("Delete all episodes of '%1' from the previously recorded history?").arg(pi->GetTitle());
769 
770  ShowOkPopup(message, this, &PrevRecordedList::DeleteOldSeries, true);
771 }
772 
774 {
776  if (!ok || !pi)
777  return;
778  QString title = pi->GetTitle();
779 
780  MSqlQuery query(MSqlQuery::InitCon());
781  query.prepare("DELETE FROM oldrecorded "
782  "WHERE title = :TITLE "
783  " AND recstatus <> :PENDING "
784  " AND recstatus <> :TUNING "
785  " AND recstatus <> :RECORDING "
786  " AND recstatus <> :FAILING "
787  " AND future = 0");
788  query.bindValue(":TITLE", title);
789  query.bindValue(":PENDING", RecStatus::Pending);
790  query.bindValue(":TUNING", RecStatus::Tuning);
791  query.bindValue(":RECORDING", RecStatus::Recording);
792  query.bindValue(":FAILING", RecStatus::Failing);
793  if (!query.exec())
794  MythDB::DBError("ProgLister::DeleteOldSeries -- delete", query);
795 
796  // Set the programid to the special value of "**any**" which the
797  // scheduler recognizes to mean the entire series was deleted.
798  RecordingInfo tempri(*pi);
799  tempri.SetProgramID("**any**");
800  ScheduledRecording::RescheduleCheck(tempri, "DeleteOldSeries");
801 
802  // Delete the matching items from both m_showData and m_showList.
803  int pos = 0;
804  auto it = m_showData.begin();
805  while (pos < (int)m_showData.size())
806  {
807  if ((*it)->GetTitle() == title
808  && (*it)->GetRecordingStatus() != RecStatus::Pending
809  && (*it)->GetRecordingStatus() != RecStatus::Tuning
810  && (*it)->GetRecordingStatus() != RecStatus::Recording
811  && (*it)->GetRecordingStatus() != RecStatus::Failing)
812  {
813  LOG(VB_GENERAL, LOG_INFO, QString("Deleting %1 at pos %2")
814  .arg(title).arg(pos));
815  it = m_showData.erase(it);
817  m_showList->RemoveItem(item);
818  }
819  else
820  {
821  ++pos;
822  ++it;
823  }
824  }
825 }
PrevRecordedList::DeleteOldSeries
void DeleteOldSeries(bool ok)
Definition: prevreclist.cpp:773
ProgramInfo::GetSortTitle
QString GetSortTitle(void) const
Definition: programinfo.h:362
MSqlBindings
QMap< QString, QVariant > MSqlBindings
typedef for a map of string -> string bindings for generic queries.
Definition: mythdbcon.h:101
MythUIButtonList::GetItemAt
MythUIButtonListItem * GetItemAt(int pos) const
Definition: mythuibuttonlist.cpp:1673
MythScreenType::LoadInBackground
void LoadInBackground(const QString &message="")
Definition: mythscreentype.cpp:286
MSqlQuery::next
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
Definition: mythdbcon.cpp:811
MSqlQuery
QSqlQuery wrapper that fetches a DB connection from the connection pool.
Definition: mythdbcon.h:128
RecStatus::toUIState
static QString toUIState(RecStatus::Type recstatus)
Definition: recordingstatus.cpp:5
PrevRecordedList::m_curviewText
MythUIText * m_curviewText
Definition: prevreclist.h:78
MythUIButtonList::GetItemCurrent
MythUIButtonListItem * GetItemCurrent() const
Definition: mythuibuttonlist.cpp:1587
PrevRecordedList::ShowDeleteOldEpisodeMenu
void ShowDeleteOldEpisodeMenu(void)
Definition: prevreclist.cpp:723
PrevRecordedList::updateInfo
void updateInfo(void)
Definition: prevreclist.cpp:335
PrevRecordedList::m_help1Text
MythUIText * m_help1Text
Definition: prevreclist.h:79
ProgramInfo::IsDuplicate
bool IsDuplicate(void) const
Definition: programinfo.h:488
mythuitext.h
PrevRecordedList::UpdateShowList
void UpdateShowList(void)
Definition: prevreclist.cpp:300
MythUIText::Reset
void Reset(void) override
Reset the widget to it's original state, should not reset changes made by the theme.
Definition: mythuitext.cpp:82
StringUtil::naturalSortCompare
bool naturalSortCompare(const QString &a, const QString &b, Qt::CaseSensitivity caseSensitivity=Qt::CaseSensitive)
naturalCompare as a std::sort compatible function (ignoring the third parameter, which is never used)...
Definition: stringutil.h:54
mythdb.h
comp_sorttitle_lt_rev
static bool comp_sorttitle_lt_rev(const ProgramInfo *a, const ProgramInfo *b)
Definition: prevreclist.cpp:174
MythUIComposite::ResetMap
virtual void ResetMap(const InfoMap &infoMap)
Definition: mythuicomposite.cpp:28
PrevRecordedList::m_titleList
MythUIButtonList * m_titleList
Definition: prevreclist.h:72
PrevRecordedList::m_reverseSort
bool m_reverseSort
Definition: prevreclist.h:85
ScheduleCommon::customEvent
void customEvent(QEvent *event) override
Definition: schedulecommon.cpp:481
PrevRecordedList::ShowDeleteOldSeriesMenu
void ShowDeleteOldSeriesMenu(void)
Definition: prevreclist.cpp:761
MythCoreContext::GetLocale
MythLocale * GetLocale(void) const
Definition: mythcorecontext.cpp:1761
RecStatus::Tuning
@ Tuning
Definition: recordingstatus.h:22
RecordingInfo
Holds information on a TV Program one might wish to record.
Definition: recordinginfo.h:35
MythUIButtonList::RemoveItem
void RemoveItem(MythUIButtonListItem *item)
Definition: mythuibuttonlist.cpp:1485
mythscreenstack.h
RecordingInfo::ForgetHistory
void ForgetHistory(void)
Forget the recording of a program so it will be recorded again.
Definition: recordinginfo.cpp:1459
AutoDeleteDeque::clear
void clear(void)
Definition: autodeletedeque.h:40
MythUIButtonList::itemSelected
void itemSelected(MythUIButtonListItem *item)
MythLocale::ToQLocale
QLocale ToQLocale() const
Definition: mythlocale.h:29
AutoDeleteDeque::empty
bool empty(void) const
Definition: autodeletedeque.h:66
mythdialogbox.h
MSqlQuery::value
QVariant value(int i) const
Definition: mythdbcon.h:205
MythScreenStack
Definition: mythscreenstack.h:16
RecordingRule
Internal representation of a recording rule, mirrors the record table.
Definition: recordingrule.h:28
PrevRecordedList::PreventRecord
void PreventRecord(void)
Definition: prevreclist.cpp:700
MSqlQuery::exec
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
Definition: mythdbcon.cpp:617
PrevRecordedList::m_recid
uint m_recid
Definition: prevreclist.h:87
ScheduleCommon::ShowGuide
virtual void ShowGuide(void) const
Show the program guide.
Definition: schedulecommon.cpp:132
PrevRecordedList::UpdateList
void UpdateList(MythUIButtonList *bnList, ProgramList *progData, bool isShows) const
Definition: prevreclist.cpp:305
PrevRecordedList::LoadShowsByDate
void LoadShowsByDate(void)
Definition: prevreclist.cpp:426
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39
PrevRecordedList::Init
void Init(void) override
Used after calling Load() to assign data to widgets and other UI initilisation which is prohibited in...
Definition: prevreclist.cpp:131
PrevRecordedList::ShowItemMenu
void ShowItemMenu(void)
Definition: prevreclist.cpp:579
ProgramInfo::SetProgramID
void SetProgramID(const QString &id)
Definition: programinfo.h:533
PrevRecordedList::customEvent
void customEvent(QEvent *event) override
Definition: prevreclist.cpp:607
mythuibuttonlist.h
PrevRecordedList::Load
void Load(void) override
Load data which will ultimately be displayed on-screen or used to determine what appears on-screen (S...
Definition: prevreclist.cpp:149
comp_sortdate_lt
static bool comp_sortdate_lt(const ProgramInfo *a, const ProgramInfo *b)
Definition: prevreclist.cpp:179
ScheduleCommon::ShowDetails
virtual void ShowDetails(void) const
Show the Program Details screen.
Definition: schedulecommon.cpp:27
ProgramInfo::GetRecordingStartTime
QDateTime GetRecordingStartTime(void) const
Approximate time the recording started.
Definition: programinfo.h:404
ScheduleCommon::EditScheduled
virtual void EditScheduled(void)
Creates a dialog for editing the recording schedule.
Definition: schedulecommon.cpp:166
PrevRecordedList::showListTakeFocus
void showListTakeFocus(void)
Definition: prevreclist.cpp:405
MythScreenType::GetFocusWidget
MythUIType * GetFocusWidget(void) const
Definition: mythscreentype.cpp:113
prevreclist.h
MythUIType::TakingFocus
void TakingFocus()
InfoMap
QHash< QString, QString > InfoMap
Definition: mythtypes.h:15
MythObservable::addListener
void addListener(QObject *listener)
Add a listener to the observable.
Definition: mythobservable.cpp:38
comp_sortdate_lt_rev
static bool comp_sortdate_lt_rev(const ProgramInfo *a, const ProgramInfo *b)
Definition: prevreclist.cpp:185
AutoDeleteDeque::begin
iterator begin(void)
Definition: autodeletedeque.h:50
PrevRecordedList::m_loadShows
bool m_loadShows
Definition: prevreclist.h:90
mythuiutils.h
MythUIButtonListItem
Definition: mythuibuttonlist.h:41
fTitleGroup
static const int fTitleGroup
Definition: prevreclist.cpp:51
PrevRecordedList::m_where
QString m_where
Definition: prevreclist.h:89
PrevRecordedList::m_showData
ProgramList m_showData
Definition: prevreclist.h:74
ProgramInfo::GetScheduledStartTime
QDateTime GetScheduledStartTime(void) const
The scheduled start time of program.
Definition: programinfo.h:390
ScheduleCommon::EditCustom
virtual void EditCustom(void)
Creates a dialog for creating a custom recording rule.
Definition: schedulecommon.cpp:202
MythUIButtonList::itemClicked
void itemClicked(MythUIButtonListItem *item)
MythMainWindow::TranslateKeyPress
bool TranslateKeyPress(const QString &Context, QKeyEvent *Event, QStringList &Actions, bool AllowJumps=true)
Get a list of actions for a keypress in the given context.
Definition: mythmainwindow.cpp:1111
MythUIButtonList::GetCurrentPos
int GetCurrentPos() const
Definition: mythuibuttonlist.h:238
MythScreenType::SetFocusWidget
bool SetFocusWidget(MythUIType *widget=nullptr)
Definition: mythscreentype.cpp:118
PrevRecordedList::m_showList
MythUIButtonList * m_showList
Definition: prevreclist.h:75
MythDialogBox
Basic menu dialog, message and a list of options.
Definition: mythdialogbox.h:166
menu
static MythThemedMenu * menu
Definition: mythtv-setup.cpp:58
ProgramInfo::GetTitle
QString GetTitle(void) const
Definition: programinfo.h:361
MSqlQuery::InitCon
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
Definition: mythdbcon.cpp:549
MythDB::DBError
static void DBError(const QString &where, const MSqlQuery &query)
Definition: mythdb.cpp:226
PrevRecordedList::~PrevRecordedList
~PrevRecordedList() override
Definition: prevreclist.cpp:85
PrevRecordedList::m_titleData
ProgramList m_titleData
Definition: prevreclist.h:71
fDefault
static const int fDefault
Definition: prevreclist.cpp:53
MythScreenType::BuildFocusList
void BuildFocusList(void)
Definition: mythscreentype.cpp:206
RecStatus::Failing
@ Failing
Definition: recordingstatus.h:18
PrevRecordedList::LoadDates
bool LoadDates(void)
Definition: prevreclist.cpp:232
stringutil.h
MythUIComposite::SetTextFromMap
virtual void SetTextFromMap(const InfoMap &infoMap)
Definition: mythuicomposite.cpp:9
ScheduleCommon
Definition: schedulecommon.h:15
PrevRecordedList::LoadShowsByTitle
void LoadShowsByTitle(void)
Definition: prevreclist.cpp:411
scheduledrecording.h
xmlparsebase.h
PrevRecordedList::UpdateTitleList
void UpdateTitleList(void)
Definition: prevreclist.cpp:295
ScheduledRecording::RescheduleCheck
static void RescheduleCheck(const RecordingInfo &recinfo, const QString &why)
Definition: scheduledrecording.h:23
MythUIButtonList::SetLCDTitles
void SetLCDTitles(const QString &title, const QString &columnList="")
Definition: mythuibuttonlist.cpp:3034
uint
unsigned int uint
Definition: compat.h:81
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:55
comp_sorttitle_lt
static bool comp_sorttitle_lt(const ProgramInfo *a, const ProgramInfo *b)
Definition: prevreclist.cpp:169
PrevRecordedList::GetCurrentProgram
ProgramInfo * GetCurrentProgram(void) const override
Definition: prevreclist.cpp:715
AutoDeleteDeque::end
iterator end(void)
Definition: autodeletedeque.h:51
MythCoreContext::GetNumSetting
int GetNumSetting(const QString &key, int defaultval=0)
Definition: mythcorecontext.cpp:911
PrevRecordedList::m_allowEvents
bool m_allowEvents
Definition: prevreclist.h:86
UIUtilDisp::Assign
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
Definition: mythuiutils.h:27
PrevRecordedList::m_infoMap
InfoMap m_infoMap
Definition: prevreclist.h:82
RecStatus::Pending
@ Pending
Definition: recordingstatus.h:17
AutoDeleteDeque< ProgramInfo * >
ScreenLoadCompletionEvent
Event that can be dispatched from a MythScreenType when it has completed loading.
Definition: mythscreentype.h:25
PrevRecordedList::LoadTitles
bool LoadTitles(void)
Definition: prevreclist.cpp:193
recordinginfo.h
ProgramInfo::GetChanID
uint GetChanID(void) const
This is the unique key used in the database to locate tuning information.
Definition: programinfo.h:372
MythMenu
Definition: mythdialogbox.h:99
AutoDeleteDeque::push_back
void push_back(T info)
Definition: autodeletedeque.h:69
ProgramInfo
Holds information on recordings and videos.
Definition: programinfo.h:67
MythScreenType::keyPressEvent
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
Definition: mythscreentype.cpp:404
RecStatus::Recording
@ Recording
Definition: recordingstatus.h:30
mythcorecontext.h
XMLParseBase::LoadWindowFromXML
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
Definition: xmlparsebase.cpp:695
MSqlQuery::bindValue
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
Definition: mythdbcon.cpp:887
std
Definition: mythchrono.h:23
DialogCompletionEvent
Event dispatched from MythUI modal dialogs to a listening class containing a result of some form.
Definition: mythdialogbox.h:41
PrevRecordedList::Create
bool Create(void) override
Definition: prevreclist.cpp:102
MythUIText::SetText
virtual void SetText(const QString &text)
Definition: mythuitext.cpp:132
PrevRecordedList::ShowMenu
void ShowMenu(void) override
Definition: prevreclist.cpp:546
PrevRecordedList::m_title
QString m_title
Definition: prevreclist.h:88
ScheduleCommon::ShowUpcoming
virtual void ShowUpcoming(void) const
Show the upcoming recordings for this title.
Definition: schedulecommon.cpp:67
DialogCompletionEvent::kEventType
static const Type kEventType
Definition: mythdialogbox.h:57
PrevRecordedList::m_titleGroup
bool m_titleGroup
Definition: prevreclist.h:84
MythUIButtonList::Reset
void Reset() override
Reset the widget to it's original state, should not reset changes made by the theme.
Definition: mythuibuttonlist.cpp:116
GetMythMainWindow
MythMainWindow * GetMythMainWindow(void)
Definition: mythmainwindow.cpp:104
MythUIButtonList::SetItemCurrent
void SetItemCurrent(MythUIButtonListItem *item)
Definition: mythuibuttonlist.cpp:1554
build_compdb.action
action
Definition: build_compdb.py:9
mythuibutton.h
LoadFromOldRecorded
bool LoadFromOldRecorded(ProgramList &destination, const QString &sql, const MSqlBindings &bindings)
Definition: programinfo.cpp:5830
MythMainWindow::GetStack
MythScreenStack * GetStack(const QString &Stackname)
Definition: mythmainwindow.cpp:323
PrevRecordedList::m_help2Text
MythUIText * m_help2Text
Definition: prevreclist.h:80
PrevRecordedList::keyPressEvent
bool keyPressEvent(QKeyEvent *e) override
Key event handler.
Definition: prevreclist.cpp:465
PrevRecordedList::PrevRecordedList
PrevRecordedList(MythScreenStack *parent, uint recid=0, QString title=QString())
Definition: prevreclist.cpp:55
PrevRecordedList::showListLoseFocus
void showListLoseFocus(void)
Definition: prevreclist.cpp:398
ScheduleCommon::ShowChannelSearch
virtual void ShowChannelSearch(void) const
Show the channel search.
Definition: schedulecommon.cpp:113
AutoDeleteDeque::erase
iterator erase(iterator it)
Definition: autodeletedeque.h:34
MythCoreContext::SaveSetting
void SaveSetting(const QString &key, int newValue)
Definition: mythcorecontext.cpp:880
MythUIType::LosingFocus
void LosingFocus()
recordingrule.h
fReverseSort
static const int fReverseSort
Definition: prevreclist.cpp:52
MythUIButtonList
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
Definition: mythuibuttonlist.h:191
mythmainwindow.h
MythScreenStack::AddScreen
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
Definition: mythscreenstack.cpp:52
PrevRecordedList::AllowRecord
void AllowRecord(void)
Definition: prevreclist.cpp:686
ShowOkPopup
MythConfirmationDialog * ShowOkPopup(const QString &message, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
Definition: mythdialogbox.cpp:562
MythObservable::removeListener
void removeListener(QObject *listener)
Remove a listener to the observable.
Definition: mythobservable.cpp:55
LOC
#define LOC
Definition: prevreclist.cpp:48
ScreenLoadCompletionEvent::kEventType
static const Type kEventType
Definition: mythscreentype.h:33
MythScreenType::CloseBusyPopup
void CloseBusyPopup(void)
Definition: mythscreentype.cpp:338
PrevRecordedList::DeleteOldEpisode
void DeleteOldEpisode(bool ok)
Definition: prevreclist.cpp:735
AutoDeleteDeque::size
size_t size(void) const
Definition: autodeletedeque.h:67
MSqlQuery::prepare
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
Definition: mythdbcon.cpp:836
RecordingInfo::SetDupHistory
void SetDupHistory(void)
Set the duplicate flag in oldrecorded.
Definition: recordinginfo.cpp:1642