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);
229 QString querystr =
"SELECT DISTINCT "
230 "YEAR(CONVERT_TZ(starttime,'UTC','SYSTEM')), "
231 "MONTH(CONVERT_TZ(starttime,'UTC','SYSTEM')) "
233 "WHERE oldrecorded.future = 0 " +
m_where;
253 program->SetRecordingStartTime(QDateTime::currentDateTime());
254 program->SetTitle(tr(
"Last two weeks"),
"0000/00");
259 int year(query.
value(0).toInt());
260 int month(query.
value(1).toInt());
262 QDate startdate(year,month,1);
263 QDateTime starttime = startdate.startOfDay();
264 program->SetRecordingStartTime(starttime);
265 QString date = QString(
"%1/%2")
266 .arg(year,4,10,QChar(
'0')).arg(month,2,10,QChar(
'0'));
268 QString title = QString(
"%1 %2").
269 arg(locale.monthName(month)).arg(year);
270 program->SetTitle(title, date);
294 for (
auto *pg : *progData)
297 QVariant::fromValue(pg));
299 pg->ToMap(infoMap,
true);
305 partTitle = infoMap[
"subtitle"];
307 partTitle = infoMap[
"titlesubtitle"];
308 infoMap[
"parttitle"] = partTitle;
310 if ((state ==
"warning"))
315 infoMap[
"buttontext"] = infoMap[
"title"];
318 item->SetTextFromMap(infoMap, state);
349 "Select the title of the program you wish to find. "
350 "When finished return with the left arrow key. "
351 "To search by date press 1."));
370 "Select a month to search. "
371 "When finished return with the left arrow key. "
372 "To search by title press 2."));
401 QString sql =
" AND oldrecorded.title = :TITLE " +
m_where;
404 bindings[
":TITLE"] =
m_titleData[selected]->GetTitle();
406 bindings[
":TITLE"] =
"";
419 LOG(VB_GENERAL, LOG_ERR,
LOC +
420 QString(
"Invalid selection in title data: %1").arg(selected));
423 QString sortTitle =
m_titleData[selected]->GetSortTitle();
424 QStringList dateParts = sortTitle.split(
'/');
425 if (dateParts.size() != 2)
427 LOG(VB_GENERAL, LOG_ERR,
LOC +
428 QString(
"Invalid sort Date: %1").arg(sortTitle));
435 if (dateParts[0] ==
"0000")
437 sql =
"AND TIMESTAMPDIFF(DAY, starttime, NOW()) < 14 ";
442 " AND YEAR(CONVERT_TZ(starttime,'UTC','SYSTEM')) = :YEAR "
443 " AND MONTH(CONVERT_TZ(starttime,'UTC','SYSTEM')) = :MONTH ";
444 bindings[
":YEAR"] = dateParts[0];
445 bindings[
":MONTH"] = dateParts[1];
447 sql = sql +
m_where + QString(
" ORDER BY starttime %1 ").arg(sortorder);
469 "TV Frontend", e, actions);
471 bool needUpdate =
false;
472 for (
uint i = 0; i <
uint(actions.size()) && !handled; ++i)
474 const QString&
action = actions[i];
477 if (
action ==
"CUSTOMEDIT") {
479 }
else if (
action ==
"EDIT") {
481 }
else if (
action ==
"DELETE") {
485 }
else if (
action ==
"GUIDE") {
487 }
else if (
action ==
"UPCOMING") {
489 }
else if (
action ==
"1") {
500 }
else if (
action ==
"2") {
532 auto *sortMenu =
new MythMenu(tr(
"Sort Options"),
this,
"sortmenu");
533 sortMenu->AddItem(tr(
"Reverse Sort Order"));
534 sortMenu->AddItem(tr(
"Sort By Title"));
535 sortMenu->AddItem(tr(
"Sort By Time"));
537 auto *
menu =
new MythMenu(tr(
"List Options"),
this,
"menu");
539 menu->AddItem(tr(
"Sort"),
nullptr, sortMenu);
554 if (!menuPopup->Create())
565 auto *
menu =
new MythMenu(tr(
"Recording Options"),
this,
"menu");
574 menu->AddItem(tr(
"Remove this episode from the list"),
576 menu->AddItem(tr(
"Remove all episodes for this title"),
582 if (!menuPopup->Create())
593 bool needUpdate =
false;
599 QString resultid = dce->GetId();
601 int buttonnum = dce->GetResult();
603 if (resultid ==
"sortmenu")
623 else if (resultid ==
"deleterule")
626 if (record && buttonnum > 0 && !record->Delete())
628 LOG(VB_GENERAL, LOG_ERR,
LOC +
629 "Failed to delete recording rule");
641 QString
id = slce->GetId();
643 if (
id == objectName())
714 QString message = tr(
"Delete this episode of '%1' from the previously recorded history?").arg(pi->
GetTitle());
727 "DELETE FROM oldrecorded "
728 "WHERE chanid = :CHANID AND "
729 " starttime = :STARTTIME");
752 QString message = tr(
"Delete all episodes of '%1' from the previously recorded history?").arg(pi->
GetTitle());
765 query.
prepare(
"DELETE FROM oldrecorded "
766 "WHERE title = :TITLE "
767 " AND recstatus <> :PENDING "
768 " AND recstatus <> :TUNING "
769 " AND recstatus <> :RECORDING "
770 " AND recstatus <> :FAILING "
791 if ((*it)->GetTitle() == title
797 LOG(VB_GENERAL, LOG_INFO, QString(
"Deleting %1 at pos %2")
798 .arg(title).arg(pos));
iterator erase(const 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)