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