Go to the documentation of this file.
10 #include <QGuiApplication>
34 m_updateStatusTimer(new QTimer(this)),
35 m_updateScreenTimer(new QTimer(this))
72 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'welcome_screen'");
99 if (!startFECmd.contains(
"platform"))
100 args << QString(
"--platform %1").arg(QGuiApplication::platformName());
121 QString command =
m_appBinDir +
"mythshutdown --startup";
125 LOG(VB_GENERAL, LOG_NOTICE,
126 QString(
"mythshutdown --startup returned: %1").arg(state));
130 if (state == 1 && bAutoStartFrontend)
145 if (me->Message().startsWith(
"RECORDING_LIST_CHANGE") ||
146 me->Message() ==
"UPDATE_PROG_INFO")
148 LOG(VB_GENERAL, LOG_NOTICE,
149 "MythWelcome received a recording list change event");
155 LOG(VB_GENERAL, LOG_NOTICE,
156 " [deferred to pending handler]");
165 else if (me->Message().startsWith(
"SCHEDULE_CHANGE"))
167 LOG(VB_GENERAL, LOG_NOTICE,
168 "MythWelcome received a SCHEDULE_CHANGE event");
174 LOG(VB_GENERAL, LOG_NOTICE,
175 " [deferred to pending handler]");
183 else if (me->Message().startsWith(
"SHUTDOWN_COUNTDOWN"))
186 LOG(VB_GENERAL, LOG_NOTICE,
187 "MythWelcome received a SHUTDOWN_COUNTDOWN event");
189 QString secs = me->Message().mid(19);
194 else if (me->Message().startsWith(
"SHUTDOWN_NOW"))
196 LOG(VB_GENERAL, LOG_NOTICE,
197 "MythWelcome received a SHUTDOWN_NOW event");
204 LOG(VB_GENERAL, LOG_NOTICE,
205 "MythWelcome is shutting this computer down now");
207 if (!poweroff_cmd.isEmpty())
233 for (
int i = 0; i < actions.size() && !handled; i++)
235 QString
action = actions[i];
246 else if (
action ==
"NEXTVIEW")
250 else if (
action ==
"INFO")
254 else if (
action ==
"SHOWSETTINGS")
260 QString mythshutdown_status =
262 QString mythshutdown_unlock =
264 QString mythshutdown_lock =
271 if (!(statusCode & 0xFF00) && statusCode & 16)
283 else if (
action ==
"STARTXTERM")
289 else if (
action ==
"STARTSETUP")
291 QString mythtv_setup =
m_appBinDir +
"mythtv-setup";
354 status = tr(
"Tuner %1 is recording:").arg(tuner.
id);
357 status +=
"\n" + tuner.
title;
362 tr(
"%1 to %2",
"Time period, 'starttime to endtime'")
367 status = tr(
"There are no recordings currently taking place");
380 progInfo.
ToMap(infomap);
384 status = infomap[
"channame"] +
"\n";
385 status += infomap[
"title"];
386 if (!infomap[
"subtitle"].isEmpty())
387 status +=
"\n(" + infomap[
"subtitle"] +
")";
389 status +=
"\n" + infomap[
"timedate"];
397 status = tr(
"There are no scheduled recordings");
404 status = tr(
"Please Wait...");
435 command = QString(
"%1 %2").arg(mfpath, mfarg);
440 LOG(VB_GENERAL, LOG_INFO, QString(
"Grabbing EPG data using command: %1\n")
510 m_statusList.append(tr(
"MythTV is about to start recording."));
518 QString mythshutdown_status =
m_appBinDir +
"mythshutdown --status 0";
521 if (!(statusCode & 0xFF00))
526 m_statusList.append(tr(
"MythTV is busy flagging commercials."));
528 m_statusList.append(tr(
"MythTV is busy grabbing EPG data."));
532 m_statusList.append(tr(
"MythTV has running or pending jobs."));
534 m_statusList.append(tr(
"MythTV is in a daily wakeup/shutdown period."));
535 if (statusCode & 128)
536 m_statusList.append(tr(
"MythTV is about to start a wakeup/shutdown period."));
543 m_statusList.append(tr(
"MythTV is idle and will shutdown in %n "
593 QString mythshutdown_status =
m_appBinDir +
"mythshutdown --status 0";
596 if (!(statusCode & 0xFF00) && statusCode & 16)
609 QString command =
m_appBinDir +
"mythshutdown --lock";
618 QString command =
m_appBinDir +
"mythshutdown --unlock";
638 LOG(VB_GENERAL, LOG_INFO,
639 "MythWelcome is shutting this computer down now");
641 if (!poweroff_cmd.isEmpty())
649 ShowOkPopup(tr(
"Cannot shutdown because MythTV is currently recording"));
660 ShowOkPopup(tr(
"Cannot shutdown because MythTV is about to start recording"));
665 QString command =
m_appBinDir +
"mythshutdown --status 0";
669 if (!(statusCode & 0xFF00) && statusCode & 128)
671 ShowOkPopup(tr(
"Cannot shutdown because MythTV is about to start "
672 "a wakeup/shutdown period."));
683 restarttime = restarttime.addSecs((-1LL) * add);
688 "echo \'Wakeuptime would "
689 "be $time if command "
692 if (wakeup_timeformat ==
"time_t")
695 setwakeup_cmd.replace(
"$time",
696 time_ts.setNum(restarttime.toSecsSinceEpoch())
700 setwakeup_cmd.replace(
701 "$time", restarttime.toLocalTime().toString(wakeup_timeformat));
703 if (!setwakeup_cmd.isEmpty())
MythScreenStack * GetMainStack()
void SetReturnEvent(QObject *retobject, const QString &resultid)
QString toString(const QDateTime &raw_dt, uint format)
Returns formatted string representing the time.
static Type MythEventMessage
@ kMSDontBlockInputDevs
avoid blocking LIRC & Joystick Menu
bool IsFrontendOnly(void)
is there a frontend, but no backend, running on this host
This class is used as a container for messages.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Screen in which all other widgets are contained and rendered.
uint myth_system(const QString &command, uint flags, std::chrono::seconds timeout)
bool SafeConnectToMasterServer(bool blockingClient=true, bool openEventSocket=true)
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
MythUIType * GetFocusWidget(void) const
QHash< QString, QString > InfoMap
void addListener(QObject *listener)
Add a listener to the observable.
bool IsConnectedToMaster(void)
bool TranslateKeyPress(const QString &Context, QKeyEvent *Event, QStringList &Actions, bool AllowJumps=true)
Get a list of actions for a keypress in the given context.
int RemoteGetRecordingStatus(const ProgramInfo *pginfo, int overrecsecs, int underrecsecs)
Get status of an individual programme (with pre-post roll?).
bool SetFocusWidget(MythUIType *widget=nullptr)
void AddButton(const QString &title)
Basic menu dialog, message and a list of options.
bool Create(void) override
std::enable_if_t< std::chrono::__is_duration< T >::value, T > GetDurSetting(const QString &key, T defaultval=T::zero())
void BuildFocusList(void)
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...
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
int GetNumSetting(const QString &key, int defaultval=0)
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
bool GetBoolSetting(const QString &key, bool defaultval=false)
@ kMSDisableUDPListener
disable MythMessage UDP listener for the duration of application.
Holds information on recordings and videos.
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
bool GetNextRecordingList(QDateTime &nextRecordingStart, bool *hasConflicts, std::vector< ProgramInfo > *list)
@ kMSProcessEvents
process events while waiting
virtual void SetText(const QString &text)
virtual void SetVisible(bool visible)
QString GetAppBinDir(void)
MythMainWindow * GetMythMainWindow(void)
MythScreenStack * GetStack(const QString &Stackname)
@ kTime
Default local time.
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
MythConfirmationDialog * ShowOkPopup(const QString &message, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
void removeListener(QObject *listener)
Remove a listener to the observable.
QString GetSetting(const QString &key, const QString &defaultval="")