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