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);
196 QString querystr =
"SELECT DISTINCT title FROM oldrecorded "
197 "WHERE oldrecorded.future = 0 " +
m_where;
215 QString title(query.
value(0).toString());
217 program->SetTitle(title);
235 QString querystr =
"SELECT DISTINCT "
236 "YEAR(CONVERT_TZ(starttime,'UTC','SYSTEM')), "
237 "MONTH(CONVERT_TZ(starttime,'UTC','SYSTEM')) "
239 "WHERE oldrecorded.future = 0 " +
m_where;
259 program->SetRecordingStartTime(QDateTime::currentDateTime());
260 program->SetTitle(tr(
"Last two weeks"),
"0000/00");
265 int year(query.
value(0).toInt());
266 int month(query.
value(1).toInt());
268 QDate startdate(year,month,1);
269 QDateTime starttime = startdate.startOfDay();
270 program->SetRecordingStartTime(starttime);
271 QString date = QString(
"%1/%2")
272 .arg(year,4,10,QChar(
'0')).arg(month,2,10,QChar(
'0'));
274 QString title = QString(
"%1 %2").
275 arg(locale.monthName(month)).arg(year);
276 program->SetTitle(title, date);
306 for (
auto *pg : *progData)
309 QVariant::fromValue(pg));
311 pg->ToMap(infoMap,
true);
317 partTitle = infoMap[
"subtitle"];
319 partTitle = infoMap[
"titlesubtitle"];
320 infoMap[
"parttitle"] = partTitle;
322 if ((state ==
"warning"))
327 infoMap[
"buttontext"] = infoMap[
"title"];
330 item->SetTextFromMap(infoMap, state);
361 "Select the title of the program you wish to find. "
362 "When finished return with the left arrow key. "
363 "To search by date press 1."));
382 "Select a month to search. "
383 "When finished return with the left arrow key. "
384 "To search by title press 2."));
413 QString sql =
" AND oldrecorded.title = :TITLE " +
m_where;
416 bindings[
":TITLE"] =
m_titleData[selected]->GetTitle();
418 bindings[
":TITLE"] =
"";
431 LOG(VB_GENERAL, LOG_ERR,
LOC +
432 QString(
"Invalid selection in title data: %1").arg(selected));
435 QString sortTitle =
m_titleData[selected]->GetSortTitle();
436 QStringList dateParts = sortTitle.split(
'/');
437 if (dateParts.size() != 2)
439 LOG(VB_GENERAL, LOG_ERR,
LOC +
440 QString(
"Invalid sort Date: %1").arg(sortTitle));
447 if (dateParts[0] ==
"0000")
448 sql =
"AND TIMESTAMPDIFF(DAY, starttime, NOW()) < 14 ";
452 " AND YEAR(CONVERT_TZ(starttime,'UTC','SYSTEM')) = :YEAR "
453 " AND MONTH(CONVERT_TZ(starttime,'UTC','SYSTEM')) = :MONTH ";
454 bindings[
":YEAR"] = dateParts[0];
455 bindings[
":MONTH"] = dateParts[1];
457 sql = sql +
m_where + QString(
" ORDER BY starttime %1 ").arg(sortorder);
479 "TV Frontend", e, actions);
481 bool needUpdate =
false;
482 for (
uint i = 0; i <
uint(actions.size()) && !handled; ++i)
484 const QString&
action = actions[i];
487 if (
action ==
"CUSTOMEDIT")
489 else if (
action ==
"EDIT")
491 else if (
action ==
"DELETE")
495 else if (
action ==
"GUIDE")
497 else if (
action ==
"UPCOMING")
547 auto *sortMenu =
new MythMenu(tr(
"Sort Options"),
this,
"sortmenu");
548 sortMenu->AddItem(tr(
"Reverse Sort Order"));
549 sortMenu->AddItem(tr(
"Sort By Title"));
550 sortMenu->AddItem(tr(
"Sort By Time"));
552 auto *
menu =
new MythMenu(tr(
"List Options"),
this,
"menu");
554 menu->AddItem(tr(
"Sort"),
nullptr, sortMenu);
569 if (!menuPopup->Create())
580 auto *
menu =
new MythMenu(tr(
"Recording Options"),
this,
"menu");
589 menu->AddItem(tr(
"Remove this episode from the list"),
591 menu->AddItem(tr(
"Remove all episodes for this title"),
597 if (!menuPopup->Create())
608 bool needUpdate =
false;
614 QString resultid = dce->GetId();
616 int buttonnum = dce->GetResult();
618 if (resultid ==
"sortmenu")
638 else if (resultid ==
"deleterule")
641 if (record && buttonnum > 0 && !record->Delete())
643 LOG(VB_GENERAL, LOG_ERR,
LOC +
644 "Failed to delete recording rule");
656 QString
id = slce->GetId();
658 if (
id == objectName())
729 QString message = tr(
"Delete this episode of '%1' from the previously recorded history?").arg(pi->
GetTitle());
742 "DELETE FROM oldrecorded "
743 "WHERE chanid = :CHANID AND "
744 " starttime = :STARTTIME");
767 QString message = tr(
"Delete all episodes of '%1' from the previously recorded history?").arg(pi->
GetTitle());
780 query.
prepare(
"DELETE FROM oldrecorded "
781 "WHERE title = :TITLE "
782 " AND recstatus <> :PENDING "
783 " AND recstatus <> :TUNING "
784 " AND recstatus <> :RECORDING "
785 " AND recstatus <> :FAILING "
806 if ((*it)->GetTitle() == title
812 LOG(VB_GENERAL, LOG_INFO, QString(
"Deleting %1 at pos %2")
813 .arg(title).arg(pos));
iterator erase(iterator it)
Event dispatched from MythUI modal dialogs to a listening class containing a result of some form.
static const Type kEventType
QSqlQuery wrapper that fetches a DB connection from the connection pool.
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
QVariant value(int i) const
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
void SaveSetting(const QString &key, int newValue)
int GetNumSetting(const QString &key, int defaultval=0)
MythLocale * GetLocale(void) const
static void DBError(const QString &where, const MSqlQuery &query)
Basic menu dialog, message and a list of options.
QLocale ToQLocale() const
bool TranslateKeyPress(const QString &Context, QKeyEvent *Event, QStringList &Actions, bool AllowJumps=true)
Get a list of actions for a keypress in the given context.
MythScreenStack * GetStack(const QString &Stackname)
void addListener(QObject *listener)
Add a listener to the observable.
void removeListener(QObject *listener)
Remove a listener to the observable.
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
void LoadInBackground(const QString &message="")
void BuildFocusList(void)
MythUIType * GetFocusWidget(void) const
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
bool SetFocusWidget(MythUIType *widget=nullptr)
void CloseBusyPopup(void)
virtual void SetTextFromMap(const InfoMap &infoMap)
virtual void ResetMap(const InfoMap &infoMap)
void Reset(void) override
Reset the widget to it's original state, should not reset changes made by the theme.
virtual void SetText(const QString &text)
void Load(void) override
Load data which will ultimately be displayed on-screen or used to determine what appears on-screen (S...
void UpdateShowList(void)
MythUIButtonList * m_showList
void customEvent(QEvent *event) override
void LoadShowsByTitle(void)
void UpdateList(MythUIButtonList *bnList, ProgramList *progData, bool isShows) const
~PrevRecordedList() override
void Init(void) override
Used after calling Load() to assign data to widgets and other UI initilisation which is prohibited in...
bool Create(void) override
void UpdateTitleList(void)
void ShowDeleteOldSeriesMenu(void)
PrevRecordedList(MythScreenStack *parent, uint recid=0, QString title=QString())
ProgramInfo * GetCurrentProgram(void) const override
void ShowDeleteOldEpisodeMenu(void)
MythUIButtonList * m_titleList
void showListTakeFocus(void)
MythUIText * m_curviewText
void showListLoseFocus(void)
bool keyPressEvent(QKeyEvent *e) override
Key event handler.
void DeleteOldSeries(bool ok)
void LoadShowsByDate(void)
void ShowMenu(void) override
void DeleteOldEpisode(bool ok)
Holds information on recordings and videos.
uint GetChanID(void) const
This is the unique key used in the database to locate tuning information.
QString GetTitle(void) const
QDateTime GetRecordingStartTime(void) const
Approximate time the recording started.
QDateTime GetScheduledStartTime(void) const
The scheduled start time of program.
bool IsDuplicate(void) const
QString GetSortTitle(void) const
void SetProgramID(const QString &id)
static QString toUIState(RecStatus::Type recstatus)
Holds information on a TV Program one might wish to record.
void SetDupHistory(void)
Set the duplicate flag in oldrecorded.
void ForgetHistory(void)
Forget the recording of a program so it will be recorded again.
Internal representation of a recording rule, mirrors the record table.
virtual void EditScheduled(void)
Creates a dialog for editing the recording schedule.
virtual void ShowDetails(void) const
Show the Program Details screen.
void customEvent(QEvent *event) override
virtual void EditCustom(void)
Creates a dialog for creating a custom recording rule.
virtual void ShowGuide(void) const
Show the program guide.
virtual void ShowUpcoming(void) const
Show the upcoming recordings for this title.
virtual void ShowChannelSearch(void) const
Show the channel search.
static void RescheduleCheck(const RecordingInfo &recinfo, const QString &why)
Event that can be dispatched from a MythScreenType when it has completed loading.
static const Type kEventType
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
QMap< QString, QVariant > MSqlBindings
typedef for a map of string -> string bindings for generic queries.
MythConfirmationDialog * ShowOkPopup(const QString &message, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
MythMainWindow * GetMythMainWindow(void)
static MythThemedMenu * menu
QHash< QString, QString > InfoMap
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)
static bool comp_sortdate_lt_rev(const ProgramInfo *a, const ProgramInfo *b)
static bool comp_sortdate_lt(const ProgramInfo *a, const ProgramInfo *b)
static const int fReverseSort
static const int fDefault
static bool comp_sorttitle_lt(const ProgramInfo *a, const ProgramInfo *b)
static const int fTitleGroup
bool LoadFromOldRecorded(ProgramList &destination, const QString &sql, const MSqlBindings &bindings)
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)