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