Go to the documentation of this file.
49 #define LOC QString("PrevRecordedList: ")
60 m_title(std::move(
title))
65 m_where = QString(
" AND ( recordid = %1 OR title = :MTITLE )")
70 m_where = QString(
"AND title = :MTITLE ");
117 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'prevreclist'");
167 QCoreApplication::postEvent(
this, slce);
202 QString querystr =
"SELECT DISTINCT title FROM oldrecorded "
203 "WHERE oldrecorded.future = 0 " +
m_where;
223 program->SetTitle(
title);
241 QString querystr =
"SELECT DISTINCT "
242 "YEAR(CONVERT_TZ(starttime,'UTC','SYSTEM')), "
243 "MONTH(CONVERT_TZ(starttime,'UTC','SYSTEM')) "
245 "WHERE oldrecorded.future = 0 " +
m_where;
265 program->SetRecordingStartTime(QDateTime::currentDateTime());
266 program->SetTitle(tr(
"Last two weeks"),
"0000/00");
274 QDate startdate(year,month,1);
275 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
276 QDateTime starttime(startdate);
278 QDateTime starttime = startdate.startOfDay();
280 program->SetRecordingStartTime(starttime);
281 QString date = QString(
"%1/%2")
282 .arg(year,4,10,QChar(
'0')).arg(month,2,10,QChar(
'0'));
284 QString
title = QString(
"%1 %2").
285 arg(locale.monthName(month)).arg(year);
286 program->SetTitle(
title, date);
316 for (
auto *pg : *progData)
319 QVariant::fromValue(pg));
321 pg->ToMap(infoMap,
true);
327 partTitle = infoMap[
"subtitle"];
329 partTitle = infoMap[
"titlesubtitle"];
330 infoMap[
"parttitle"] = partTitle;
332 if ((state ==
"warning"))
336 infoMap[
"buttontext"] = infoMap[
"title"];
338 item->SetTextFromMap(infoMap, state);
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."));
390 "Select a month to search. "
391 "When finished return with the left arrow key. "
392 "To search by title press 2."));
421 QString sql =
" AND oldrecorded.title = :TITLE " +
m_where;
424 bindings[
":TITLE"] =
m_titleData[selected]->GetTitle();
426 bindings[
":TITLE"] =
"";
437 QString sortTitle =
m_titleData[selected]->GetSortTitle();
438 QStringList dateParts = sortTitle.split(
'/');
439 if (dateParts.size() != 2)
441 LOG(VB_GENERAL, LOG_ERR,
LOC +
442 QString(
"Invalid sort Date: %1").
arg(sortTitle));
449 if (dateParts[0] ==
"0000")
450 sql =
"AND TIMESTAMPDIFF(DAY, starttime, NOW()) < 14 ";
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];
459 sql = sql +
m_where + QString(
" ORDER BY starttime %1 ").arg(sortorder);
481 "TV Frontend",
e, actions);
483 bool needUpdate =
false;
484 for (
uint i = 0; i <
uint(actions.size()) && !handled; ++i)
486 QString
action = actions[i];
489 if (
action ==
"CUSTOMEDIT")
491 else if (
action ==
"EDIT")
493 else if (
action ==
"DELETE")
497 else if (
action ==
"GUIDE")
499 else if (
action ==
"UPCOMING")
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"));
554 auto *
menu =
new MythMenu(tr(
"List Options"),
this,
"menu");
556 menu->AddItem(tr(
"Sort"),
nullptr, sortMenu);
571 if (!menuPopup->Create())
582 auto *
menu =
new MythMenu(tr(
"Recording Options"),
this,
"menu");
591 menu->AddItem(tr(
"Remove this episode from the list"),
593 menu->AddItem(tr(
"Remove all episodes for this title"),
599 if (!menuPopup->Create())
610 bool needUpdate =
false;
616 QString resultid = dce->GetId();
618 int buttonnum = dce->GetResult();
620 if (resultid ==
"sortmenu")
640 else if (resultid ==
"deleterule")
643 if (record && buttonnum > 0 && !record->Delete())
645 LOG(VB_GENERAL, LOG_ERR,
LOC +
646 "Failed to delete recording rule");
658 QString
id = slce->GetId();
660 if (
id == objectName())
731 QString message = tr(
"Delete this episode of '%1' from the previously recorded history?").arg(pi->
GetTitle());
744 "DELETE FROM oldrecorded "
745 "WHERE chanid = :CHANID AND "
746 " starttime = :STARTTIME");
769 QString message = tr(
"Delete all episodes of '%1' from the previously recorded history?").arg(pi->
GetTitle());
783 "WHERE title = :TITLE "
784 " AND recstatus <> :PENDING "
785 " AND recstatus <> :TUNING "
786 " AND recstatus <> :RECORDING "
787 " AND recstatus <> :FAILING "
808 if ((*it)->GetTitle() ==
title
814 LOG(VB_GENERAL, LOG_INFO, QString(
"Deleting %1 at pos %2")
void DeleteOldSeries(bool ok)
QString GetSortTitle(void) const
QMap< QString, QVariant > MSqlBindings
typedef for a map of string -> string bindings for generic queries.
void LoadInBackground(const QString &message="")
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
QSqlQuery wrapper that fetches a DB connection from the connection pool.
MythUIText * m_curviewText
void ShowDeleteOldEpisodeMenu(void)
bool IsDuplicate(void) const
void UpdateShowList(void)
void Reset(void) override
Reset the widget to it's original state, should not reset changes made by the theme.
static bool comp_sorttitle_lt_rev(const ProgramInfo *a, const ProgramInfo *b)
virtual void ResetMap(const InfoMap &infoMap)
MythUIButtonList * m_titleList
void customEvent(QEvent *event) override
void ShowDeleteOldSeriesMenu(void)
MythLocale * GetLocale(void) const
Holds information on a TV Program one might wish to record.
void ForgetHistory(void)
Forget the recording of a program so it will be recorded again.
QLocale ToQLocale() const
QVariant value(int i) const
arg(title).arg(filename).arg(doDelete))
Internal representation of a recording rule, mirrors the record table.
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
virtual void ShowGuide(void) const
Show the program guide.
void UpdateList(MythUIButtonList *bnList, ProgramList *progData, bool isShows) const
void LoadShowsByDate(void)
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
void Init(void) override
Used after calling Load() to assign data to widgets and other UI initilisation which is prohibited in...
void SetProgramID(const QString &id)
void customEvent(QEvent *event) override
static MythThemedMenu * menu
void Load(void) override
Load data which will ultimately be displayed on-screen or used to determine what appears on-screen (S...
static bool comp_sortdate_lt(const ProgramInfo *a, const ProgramInfo *b)
virtual void ShowDetails(void) const
Show the Program Details screen.
QDateTime GetRecordingStartTime(void) const
Approximate time the recording started.
virtual void EditScheduled(void)
Creates a dialog for editing the recording schedule.
void showListTakeFocus(void)
MythUIType * GetFocusWidget(void) const
QHash< QString, QString > InfoMap
void addListener(QObject *listener)
Add a listener to the observable.
static bool comp_sortdate_lt_rev(const ProgramInfo *a, const ProgramInfo *b)
static const int fTitleGroup
static QString toUIState(Type recstatus)
QDateTime GetScheduledStartTime(void) const
The scheduled start time of program.
virtual void EditCustom(void)
Creates a dialog for creating a custom recording rule.
bool TranslateKeyPress(const QString &Context, QKeyEvent *Event, QStringList &Actions, bool AllowJumps=true)
Get a list of actions for a keypress in the given context.
bool SetFocusWidget(MythUIType *widget=nullptr)
MythUIButtonList * m_showList
Basic menu dialog, message and a list of options.
QString GetTitle(void) const
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
static void DBError(const QString &where, const MSqlQuery &query)
~PrevRecordedList() override
static const int fDefault
void BuildFocusList(void)
virtual void SetTextFromMap(const InfoMap &infoMap)
void LoadShowsByTitle(void)
void UpdateTitleList(void)
static void RescheduleCheck(const RecordingInfo &recinfo, const QString &why)
int naturalCompare(const QString &_a, const QString &_b, Qt::CaseSensitivity caseSensitivity)
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
static bool comp_sorttitle_lt(const ProgramInfo *a, const ProgramInfo *b)
ProgramInfo * GetCurrentProgram(void) const override
int GetNumSetting(const QString &key, int defaultval=0)
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
Event that can be dispatched from a MythScreenType when it has completed loading.
uint GetChanID(void) const
This is the unique key used in the database to locate tuning information.
Holds information on recordings and videos.
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
Event dispatched from MythUI modal dialogs to a listening class containing a result of some form.
bool Create(void) override
virtual void SetText(const QString &text)
void ShowMenu(void) override
virtual void ShowUpcoming(void) const
Show the upcoming recordings for this title.
MythMainWindow * GetMythMainWindow(void)
bool LoadFromOldRecorded(ProgramList &destination, const QString &sql, const MSqlBindings &bindings)
MythScreenStack * GetStack(const QString &Stackname)
bool keyPressEvent(QKeyEvent *e) override
Key event handler.
PrevRecordedList(MythScreenStack *parent, uint recid=0, QString title=QString())
void showListLoseFocus(void)
virtual void ShowChannelSearch(void) const
Show the channel search.
iterator erase(iterator it)
void SaveSetting(const QString &key, int newValue)
static const int fReverseSort
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
MSqlQuery query(MSqlQuery::InitCon())
MythConfirmationDialog * ShowOkPopup(const QString &message, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
void removeListener(QObject *listener)
Remove a listener to the observable.
void CloseBusyPopup(void)
void DeleteOldEpisode(bool ok)
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
void SetDupHistory(void)
Set the duplicate flag in oldrecorded.