Go to the documentation of this file.
48 #define LOC QString("PrevRecordedList: ")
59 m_title(
std::move(title))
64 m_where = QString(
" AND ( recordid = %1 OR title = :MTITLE )")
69 m_where = QString(
"AND title = :MTITLE ");
116 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'prevreclist'");
166 QCoreApplication::postEvent(
this, slce);
195 QString querystr =
"SELECT DISTINCT title FROM oldrecorded "
196 "WHERE oldrecorded.future = 0 " +
m_where;
214 QString title(query.
value(0).toString());
216 program->SetTitle(title);
234 QString querystr =
"SELECT DISTINCT "
235 "YEAR(CONVERT_TZ(starttime,'UTC','SYSTEM')), "
236 "MONTH(CONVERT_TZ(starttime,'UTC','SYSTEM')) "
238 "WHERE oldrecorded.future = 0 " +
m_where;
258 program->SetRecordingStartTime(QDateTime::currentDateTime());
259 program->SetTitle(tr(
"Last two weeks"),
"0000/00");
264 int year(query.
value(0).toInt());
265 int month(query.
value(1).toInt());
267 QDate startdate(year,month,1);
268 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
269 QDateTime starttime(startdate);
271 QDateTime starttime = startdate.startOfDay();
273 program->SetRecordingStartTime(starttime);
274 QString date = QString(
"%1/%2")
275 .arg(year,4,10,QChar(
'0')).arg(month,2,10,QChar(
'0'));
277 QString title = QString(
"%1 %2").
278 arg(locale.monthName(month)).arg(year);
279 program->SetTitle(title, date);
309 for (
auto *pg : *progData)
312 QVariant::fromValue(pg));
314 pg->ToMap(infoMap,
true);
320 partTitle = infoMap[
"subtitle"];
322 partTitle = infoMap[
"titlesubtitle"];
323 infoMap[
"parttitle"] = partTitle;
325 if ((state ==
"warning"))
329 infoMap[
"buttontext"] = infoMap[
"title"];
331 item->SetTextFromMap(infoMap, state);
362 "Select the title of the program you wish to find. "
363 "When finished return with the left arrow key. "
364 "To search by date press 1."));
383 "Select a month to search. "
384 "When finished return with the left arrow key. "
385 "To search by title press 2."));
414 QString sql =
" AND oldrecorded.title = :TITLE " +
m_where;
417 bindings[
":TITLE"] =
m_titleData[selected]->GetTitle();
419 bindings[
":TITLE"] =
"";
432 LOG(VB_GENERAL, LOG_ERR,
LOC +
433 QString(
"Invalid selection in title data: %1").arg(selected));
436 QString sortTitle =
m_titleData[selected]->GetSortTitle();
437 QStringList dateParts = sortTitle.split(
'/');
438 if (dateParts.size() != 2)
440 LOG(VB_GENERAL, LOG_ERR,
LOC +
441 QString(
"Invalid sort Date: %1").arg(sortTitle));
448 if (dateParts[0] ==
"0000")
449 sql =
"AND TIMESTAMPDIFF(DAY, starttime, NOW()) < 14 ";
453 " AND YEAR(CONVERT_TZ(starttime,'UTC','SYSTEM')) = :YEAR "
454 " AND MONTH(CONVERT_TZ(starttime,'UTC','SYSTEM')) = :MONTH ";
455 bindings[
":YEAR"] = dateParts[0];
456 bindings[
":MONTH"] = dateParts[1];
458 sql = sql +
m_where + QString(
" ORDER BY starttime %1 ").arg(sortorder);
480 "TV Frontend", e, actions);
482 bool needUpdate =
false;
483 for (
uint i = 0; i <
uint(actions.size()) && !handled; ++i)
485 QString
action = actions[i];
488 if (
action ==
"CUSTOMEDIT")
490 else if (
action ==
"EDIT")
492 else if (
action ==
"DELETE")
496 else if (
action ==
"GUIDE")
498 else if (
action ==
"UPCOMING")
548 auto *sortMenu =
new MythMenu(tr(
"Sort Options"),
this,
"sortmenu");
549 sortMenu->AddItem(tr(
"Reverse Sort Order"));
550 sortMenu->AddItem(tr(
"Sort By Title"));
551 sortMenu->AddItem(tr(
"Sort By Time"));
553 auto *
menu =
new MythMenu(tr(
"List Options"),
this,
"menu");
555 menu->AddItem(tr(
"Sort"),
nullptr, sortMenu);
570 if (!menuPopup->Create())
581 auto *
menu =
new MythMenu(tr(
"Recording Options"),
this,
"menu");
590 menu->AddItem(tr(
"Remove this episode from the list"),
592 menu->AddItem(tr(
"Remove all episodes for this title"),
598 if (!menuPopup->Create())
609 bool needUpdate =
false;
615 QString resultid = dce->GetId();
617 int buttonnum = dce->GetResult();
619 if (resultid ==
"sortmenu")
639 else if (resultid ==
"deleterule")
642 if (record && buttonnum > 0 && !record->Delete())
644 LOG(VB_GENERAL, LOG_ERR,
LOC +
645 "Failed to delete recording rule");
657 QString
id = slce->GetId();
659 if (
id == objectName())
730 QString message = tr(
"Delete this episode of '%1' from the previously recorded history?").arg(pi->
GetTitle());
743 "DELETE FROM oldrecorded "
744 "WHERE chanid = :CHANID AND "
745 " starttime = :STARTTIME");
768 QString message = tr(
"Delete all episodes of '%1' from the previously recorded history?").arg(pi->
GetTitle());
781 query.
prepare(
"DELETE FROM oldrecorded "
782 "WHERE title = :TITLE "
783 " AND recstatus <> :PENDING "
784 " AND recstatus <> :TUNING "
785 " AND recstatus <> :RECORDING "
786 " AND recstatus <> :FAILING "
807 if ((*it)->GetTitle() == title
813 LOG(VB_GENERAL, LOG_INFO, QString(
"Deleting %1 at pos %2")
814 .arg(title).arg(pos));
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.
static QString toUIState(RecStatus::Type recstatus)
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.
bool naturalSortCompare(const QString &a, const QString &b, Qt::CaseSensitivity caseSensitivity=Qt::CaseSensitive)
naturalCompare as a std::sort compatible function (ignoring the third parameter, which is never used)...
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
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
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
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.
static MythThemedMenu * menu
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)
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.
static const Type kEventType
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)
MythConfirmationDialog * ShowOkPopup(const QString &message, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
void removeListener(QObject *listener)
Remove a listener to the observable.
static const Type kEventType
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.