5#include <QCoreApplication>
31 auto *vsb =
new ViewScheduled(mainStack,
static_cast<TV*
>(player), showTV);
34 mainStack->
AddScreen(vsb, (player ==
nullptr));
75 LOG(VB_GENERAL, LOG_ERR,
"Theme is missing critical theme elements.");
85 "shortstarttimedate|channel|titlesubtitle|card");
150 for (
int i = 0; i < actions.size() && !handled; i++)
152 const QString&
action = actions[i];
157 else if (
action ==
"CUSTOMEDIT")
159 else if (
action ==
"DELETE")
161 else if (
action ==
"UPCOMING")
163 else if (
action ==
"VIEWSCHEDULED")
165 else if (
action ==
"PREVRECORDED")
169 else if (
action ==
"GUIDE")
179 else if (
action ==
"VIEWINPUT")
198 QString label = tr(
"Options");
201 auto *menuPopup =
new MythDialogBox(label, popupStack,
"menuPopup");
203 if (menuPopup->Create())
205 menuPopup->SetReturnEvent(
this,
"menu");
208 menuPopup->AddButton(tr(
"Show Important"));
210 menuPopup->AddButton(tr(
"Show All"));
211 menuPopup->AddButton(tr(
"Program Details"));
212 menuPopup->AddButton(tr(
"Program Guide"));
213 menuPopup->AddButton(tr(
"Channel Search"));
214 menuPopup->AddButton(tr(
"Upcoming by title"));
215 menuPopup->AddButton(tr(
"Upcoming scheduled"));
216 menuPopup->AddButton(tr(
"Previously Recorded"));
217 menuPopup->AddButton(tr(
"Custom Edit"));
218 menuPopup->AddButton(tr(
"Delete Rule"));
219 menuPopup->AddButton(tr(
"Show Inputs"));
240 QDateTime recstartts;
249 startts = currentpginfo->GetScheduledStartTime();
250 recstartts = currentpginfo->GetRecordingStartTime();
256 QMap<int, int> toomanycounts;
264 if (!useExistingData)
274 if (pginfo ==
nullptr)
319 QMap<QDate,ProgramList>::iterator dateit =
m_recgroupList.begin();
322 if (dateit.key().isNull())
329 QVariant::fromValue(dateit.key()));
345 if (!callsign.isEmpty())
349 int listPos = ((int) plist.
size()) - 1;
350 for (
int i = listPos; i >= 0; --i)
353 if (pginfo ==
nullptr)
361 if (recstartts <= pginfo->GetRecordingStartTime())
377 auto group = item->
GetData().value<QDate>();
427 pginfo->
ToMap(infoMap);
457 auto pit = plist.
begin();
458 while (pit != plist.
end())
464 QVariant::fromValue(pginfo));
476 for (
auto & conflict : plist)
481 .toLocalTime().date();
488 QString cstring = tr(
"Conflict %1")
496 statusText->
SetText(tr(
"No Conflicts"));
504 filterText->
SetText(tr(
"All"));
506 filterText->
SetText(tr(
"Important"));
522 pginfo->
ToMap(infoMap);
531 QString
rating = QString::number(pginfo->GetStars(10));
549 if (!record->LoadByProgram(pginfo))
555 QString message = tr(
"Delete '%1' %2 rule?")
556 .arg(record->m_title,
toString(pginfo->GetRecordingRuleType()));
562 okPopup->SetReturnEvent(
this,
"deleterule");
563 okPopup->SetData(QVariant::fromValue(record));
565 if (okPopup->Create())
601 auto *me =
dynamic_cast<MythEvent *
>(event);
605 const QString& message = me->
Message();
606 if (message ==
"SCHEDULE_CHANGE")
619 else if (message.startsWith(
"UPDATE_FILE_SIZE"))
621 QStringList tokens = message.simplified().split(
" ");
622 if (tokens.size() < 3)
626 uint recordingID = tokens[1].toUInt();
627 uint64_t filesize = tokens[2].toLongLong(&ok);
645 GetItemByData(QVariant::fromValue(pginfo));
653 if (item == selected)
667 QString resultid = dce->GetId();
668 QString resulttext = dce->GetResultText();
669 int buttonnum = dce->GetResult();
671 if (resultid ==
"deleterule")
678 if (!record->Delete())
679 LOG(VB_GENERAL, LOG_ERR,
680 "Failed to delete recording rule");
687 else if (resultid ==
"menu")
689 if (resulttext == tr(
"Show Important"))
693 else if (resulttext == tr(
"Show All"))
697 else if (resulttext == tr(
"Program Details"))
701 else if (resulttext == tr(
"Program Guide"))
705 else if (resulttext == tr(
"Channel Search"))
709 else if (resulttext == tr(
"Upcoming by title"))
713 else if (resulttext == tr(
"Upcoming scheduled"))
717 else if (resulttext == tr(
"Previously Recorded"))
721 else if (resulttext == tr(
"Custom Edit"))
725 else if (resulttext == tr(
"Delete Rule"))
729 else if (resulttext == tr(
"Show Inputs"))
iterator erase(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