50#define LOC QString("PrevRecordedList: ")
61 m_title(std::move(title))
66 m_where = QString(
" AND ( recordid = %1 OR title = :MTITLE )")
71 m_where = QString(
"AND title = :MTITLE ");
118 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'prevreclist'");
168 QCoreApplication::postEvent(
this, slce);
197 QString querystr =
"SELECT DISTINCT title FROM oldrecorded "
198 "WHERE oldrecorded.future = 0 " +
m_where;
216 QString title(query.
value(0).toString());
218 program->SetTitle(title);
230 QString querystr =
"SELECT DISTINCT "
231 "YEAR(CONVERT_TZ(starttime,'UTC','SYSTEM')), "
232 "MONTH(CONVERT_TZ(starttime,'UTC','SYSTEM')) "
234 "WHERE oldrecorded.future = 0 " +
m_where;
254 program->SetRecordingStartTime(QDateTime::currentDateTime());
255 program->SetTitle(tr(
"Last two weeks"),
"0000/00");
260 int year(query.
value(0).toInt());
261 int month(query.
value(1).toInt());
263 QDate startdate(year,month,1);
264 QDateTime starttime = startdate.startOfDay();
265 program->SetRecordingStartTime(starttime);
266 QString date = QString(
"%1/%2")
267 .arg(year,4,10,QChar(
'0')).arg(month,2,10,QChar(
'0'));
269 QString title = QString(
"%1 %2").
270 arg(locale.monthName(month)).arg(year);
271 program->SetTitle(title, date);
295 for (
auto *pg : *progData)
298 QVariant::fromValue(pg));
300 pg->ToMap(infoMap,
true);
306 partTitle = infoMap[
"subtitle"];
308 partTitle = infoMap[
"titlesubtitle"];
309 infoMap[
"parttitle"] = partTitle;
311 if ((state ==
"warning"))
316 infoMap[
"buttontext"] = infoMap[
"title"];
319 item->SetTextFromMap(infoMap, state);
350 "Select the title of the program you wish to find. "
351 "When finished return with the left arrow key. "
352 "To search by date press 1."));
371 "Select a month to search. "
372 "When finished return with the left arrow key. "
373 "To search by title press 2."));
402 QString sql =
" AND oldrecorded.title = :TITLE " +
m_where;
405 bindings[
":TITLE"] =
m_titleData[selected]->GetTitle();
407 bindings[
":TITLE"] =
"";
420 LOG(VB_GENERAL, LOG_ERR,
LOC +
421 QString(
"Invalid selection in title data: %1").arg(selected));
424 QString sortTitle =
m_titleData[selected]->GetSortTitle();
425 QStringList dateParts = sortTitle.split(
'/');
426 if (dateParts.size() != 2)
428 LOG(VB_GENERAL, LOG_ERR,
LOC +
429 QString(
"Invalid sort Date: %1").arg(sortTitle));
436 if (dateParts[0] ==
"0000")
438 sql =
"AND TIMESTAMPDIFF(DAY, starttime, NOW()) < 14 ";
443 " AND YEAR(CONVERT_TZ(starttime,'UTC','SYSTEM')) = :YEAR "
444 " AND MONTH(CONVERT_TZ(starttime,'UTC','SYSTEM')) = :MONTH ";
445 bindings[
":YEAR"] = dateParts[0];
446 bindings[
":MONTH"] = dateParts[1];
448 sql = sql +
m_where + QString(
" ORDER BY starttime %1 ").arg(sortorder);
470 "TV Frontend", e, actions);
472 bool needUpdate =
false;
473 for (
uint i = 0; i <
uint(actions.size()) && !handled; ++i)
475 const QString&
action = actions[i];
478 if (
action ==
"CUSTOMEDIT") {
480 }
else if (
action ==
"EDIT") {
482 }
else if (
action ==
"DELETE") {
486 }
else if (
action ==
"GUIDE") {
488 }
else if (
action ==
"UPCOMING") {
490 }
else if (
action ==
"1") {
501 }
else if (
action ==
"2") {
533 auto *sortMenu =
new MythMenu(tr(
"Sort Options"),
this,
"sortmenu");
534 sortMenu->AddItem(tr(
"Reverse Sort Order"));
535 sortMenu->AddItem(tr(
"Sort By Title"));
536 sortMenu->AddItem(tr(
"Sort By Time"));
538 auto *
menu =
new MythMenu(tr(
"List Options"),
this,
"menu");
540 menu->AddItem(tr(
"Sort"),
nullptr, sortMenu);
555 if (!menuPopup->Create())
566 auto *
menu =
new MythMenu(tr(
"Recording Options"),
this,
"menu");
575 menu->AddItem(tr(
"Remove this episode from the list"),
577 menu->AddItem(tr(
"Remove all episodes for this title"),
583 if (!menuPopup->Create())
594 bool needUpdate =
false;
600 QString resultid = dce->GetId();
602 int buttonnum = dce->GetResult();
604 if (resultid ==
"sortmenu")
624 else if (resultid ==
"deleterule")
627 if (record && buttonnum > 0 && !record->Delete())
629 LOG(VB_GENERAL, LOG_ERR,
LOC +
630 "Failed to delete recording rule");
642 QString
id = slce->GetId();
644 if (
id == objectName())
715 QString message = tr(
"Delete this episode of '%1' from the previously recorded history?").arg(pi->
GetTitle());
728 "DELETE FROM oldrecorded "
729 "WHERE chanid = :CHANID AND "
730 " starttime = :STARTTIME");
753 QString message = tr(
"Delete all episodes of '%1' from the previously recorded history?").arg(pi->
GetTitle());
766 query.
prepare(
"DELETE FROM oldrecorded "
767 "WHERE title = :TITLE "
768 " AND recstatus <> :PENDING "
769 " AND recstatus <> :TUNING "
770 " AND recstatus <> :RECORDING "
771 " AND recstatus <> :FAILING "
792 if ((*it)->GetTitle() == title
798 LOG(VB_GENERAL, LOG_INFO, QString(
"Deleting %1 at pos %2")
799 .arg(title).arg(pos));
812#include "moc_prevreclist.cpp"
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)