5#include <QCoreApplication>
30 auto *vsb =
new ViewScheduled(mainStack,
static_cast<TV*
>(player), showTV);
33 mainStack->
AddScreen(vsb, (player ==
nullptr));
74 LOG(VB_GENERAL, LOG_ERR,
"Theme is missing critical theme elements.");
84 "shortstarttimedate|channel|titlesubtitle|card");
149 for (
int i = 0; i < actions.size() && !handled; i++)
151 const QString&
action = actions[i];
156 else if (
action ==
"CUSTOMEDIT")
158 else if (
action ==
"DELETE")
160 else if (
action ==
"UPCOMING")
162 else if (
action ==
"VIEWSCHEDULED")
164 else if (
action ==
"PREVRECORDED")
168 else if (
action ==
"GUIDE")
178 else if (
action ==
"VIEWINPUT")
197 QString label = tr(
"Options");
200 auto *menuPopup =
new MythDialogBox(label, popupStack,
"menuPopup");
202 if (menuPopup->Create())
204 menuPopup->SetReturnEvent(
this,
"menu");
207 menuPopup->AddButton(tr(
"Show Important"));
209 menuPopup->AddButton(tr(
"Show All"));
210 menuPopup->AddButton(tr(
"Program Details"));
211 menuPopup->AddButton(tr(
"Program Guide"));
212 menuPopup->AddButton(tr(
"Channel Search"));
213 menuPopup->AddButton(tr(
"Upcoming by title"));
214 menuPopup->AddButton(tr(
"Upcoming scheduled"));
215 menuPopup->AddButton(tr(
"Previously Recorded"));
216 menuPopup->AddButton(tr(
"Custom Edit"));
217 menuPopup->AddButton(tr(
"Delete Rule"));
218 menuPopup->AddButton(tr(
"Show Inputs"));
239 QDateTime recstartts;
248 startts = currentpginfo->GetScheduledStartTime();
249 recstartts = currentpginfo->GetRecordingStartTime();
255 QMap<int, int> toomanycounts;
263 if (!useExistingData)
273 if (pginfo ==
nullptr)
318 QMap<QDate,ProgramList>::iterator dateit =
m_recgroupList.begin();
321 if (dateit.key().isNull())
328 QVariant::fromValue(dateit.key()));
344 if (!callsign.isEmpty())
348 int listPos = ((int) plist.
size()) - 1;
349 for (
int i = listPos; i >= 0; --i)
352 if (pginfo ==
nullptr)
360 if (recstartts <= pginfo->GetRecordingStartTime())
376 auto group = item->
GetData().value<QDate>();
430 pginfo->
ToMap(infoMap);
460 auto pit = plist.
begin();
461 while (pit != plist.
end())
467 QVariant::fromValue(pginfo));
479 for (
auto & conflict : plist)
484 .toLocalTime().date();
491 QString cstring = tr(
"Conflict %1")
499 statusText->
SetText(tr(
"No Conflicts"));
507 filterText->
SetText(tr(
"All"));
509 filterText->
SetText(tr(
"Important"));
525 pginfo->
ToMap(infoMap);
534 QString
rating = QString::number(pginfo->GetStars(10));
552 if (!record->LoadByProgram(pginfo))
558 QString message = tr(
"Delete '%1' %2 rule?")
559 .arg(record->m_title,
toString(pginfo->GetRecordingRuleType()));
565 okPopup->SetReturnEvent(
this,
"deleterule");
566 okPopup->SetData(QVariant::fromValue(record));
568 if (okPopup->Create())
604 auto *me =
dynamic_cast<MythEvent *
>(event);
608 const QString& message = me->
Message();
609 if (message ==
"SCHEDULE_CHANGE")
622 else if (message.startsWith(
"UPDATE_FILE_SIZE"))
624 QStringList tokens = message.simplified().split(
" ");
625 if (tokens.size() < 3)
629 uint recordingID = tokens[1].toUInt();
630 uint64_t filesize = tokens[2].toLongLong(&ok);
648 GetItemByData(QVariant::fromValue(pginfo));
656 if (item == selected)
670 QString resultid = dce->GetId();
671 QString resulttext = dce->GetResultText();
672 int buttonnum = dce->GetResult();
674 if (resultid ==
"deleterule")
681 if (!record->Delete())
682 LOG(VB_GENERAL, LOG_ERR,
683 "Failed to delete recording rule");
690 else if (resultid ==
"menu")
692 if (resulttext == tr(
"Show Important"))
696 else if (resulttext == tr(
"Show All"))
700 else if (resulttext == tr(
"Program Details"))
704 else if (resulttext == tr(
"Program Guide"))
708 else if (resulttext == tr(
"Channel Search"))
712 else if (resulttext == tr(
"Upcoming by title"))
716 else if (resulttext == tr(
"Upcoming scheduled"))
720 else if (resulttext == tr(
"Previously Recorded"))
724 else if (resulttext == tr(
"Custom Edit"))
728 else if (resulttext == tr(
"Delete Rule"))
732 else if (resulttext == tr(
"Show Inputs"))
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
Dialog asking for user confirmation.
void SaveBoolSetting(const QString &key, bool newValue)
Basic menu dialog, message and a list of options.
This class is used as a container for messages.
const QString & Message() const
static const Type kMythEventMessage
MythScreenStack * GetMainStack()
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 PopScreen(MythScreenType *screen=nullptr, bool allowFade=true, bool deleteScreen=true)
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
void LoadInBackground(const QString &message="")
void BuildFocusList(void)
MythUIType * GetFocusWidget(void) const
MythScreenStack * GetScreenStack() const
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
bool SetFocusWidget(MythUIType *widget=nullptr)
virtual void SetTextFromMap(const InfoMap &infoMap)
void Set(int start, int total, int used)
This widget is used for grouping other widgets for display when a particular named state is called.
bool DisplayState(const QString &name)
All purpose text widget, displays a text string.
virtual void SetText(const QString &text)
virtual void SetVisible(bool visible)
MythUIType * GetChild(const QString &name) const
Get a named child of this UIType.
Holds information on recordings and videos.
float GetStars(void) const
uint GetRecordingRuleID(void) const
uint GetRecordingID(void) const
QDateTime GetScheduledEndTime(void) const
The scheduled end time of the program.
void CalculateRecordedProgress()
virtual void SetFilesize(uint64_t sz)
QDateTime GetRecordingStartTime(void) const
Approximate time the recording started.
QDateTime GetScheduledStartTime(void) const
The scheduled start time of program.
virtual void ToMap(InfoMap &progMap, bool showrerecord=false, uint star_range=10, uint date_format=0) const
Converts ProgramInfo into QString QHash containing each field in ProgramInfo converted into localized...
uint GetInputID(void) const
int GetRecordingPriority2(void) const
uint GetRecordedPercent() const
RecStatus::Type GetRecordingStatus(void) const
QDateTime GetRecordingEndTime(void) const
Approximate time the recording should have ended, did end, or is intended to end.
QString GetChannelSchedulingID(void) const
This is the unique programming identifier of a channel.
Internal representation of a recording rule, mirrors the record table.
virtual int DecrRef(void)
Decrements reference count and deletes on 0.
virtual int IncrRef(void)
Increments reference count.
virtual void EditScheduled(void)
Creates a dialog for editing the recording schedule.
virtual void EditRecording(bool may_watch_now=false)
Creates a dialog for editing the recording status, blocking until user leaves dialog.
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 ShowUpcomingScheduled(void) const
Show the upcoming recordings for this 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.
virtual void ShowPrevious(void) const
Show the previous recordings for this recording rule.
void RequestEmbedding(bool Embed, const QRect &Rect={}, const QStringList &Data={})
MythUIButtonList * m_groupList
QMap< QDate, ProgramList > m_recgroupList
~ViewScheduled() override
ProgramInfo * GetCurrentProgram(void) const override
void ChangeGroup(MythUIButtonListItem *item)
void updateInfo(MythUIButtonListItem *item)
bool Create(void) override
void customEvent(QEvent *event) override
ViewScheduled(MythScreenStack *parent, TV *player=nullptr, bool showTV=false)
void Close(void) override
void setShowAll(bool all)
void ShowMenu(void) override
static void * RunViewScheduled(void *player, bool showTv)
void Load(void) override
Load data which will ultimately be displayed on-screen or used to determine what appears on-screen (S...
QMap< int, int > m_inputref
void Init(void) override
Used after calling Load() to assign data to widgets and other UI initilisation which is prohibited in...
MythUIProgressBar * m_progressBar
void UpdateUIListItem(MythUIButtonListItem *item, ProgramInfo *pginfo) const
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
void LoadList(bool useExistingData=false)
MythUIButtonList * m_schedulesList
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
MythMainWindow * GetMythMainWindow(void)
QHash< QString, QString > InfoMap
QString toString(const QDateTime &raw_dt, uint format)
Returns formatted string representing the time.
@ kSimplify
Do Today/Yesterday/Tomorrow transform.
@ kDateFull
Default local time.
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
def rating(profile, smoonURL, gate)
bool LoadFromScheduler(AutoDeleteDeque< TYPE * > &destination, bool &hasConflicts, const QString &altTable="", int recordid=-1)
AutoDeleteDeque< ProgramInfo * > ProgramList
#define ACTION_CHANNELSEARCH