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 const 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";
355 status = tr(
"Tuner %1 is recording:").arg(tuner.
id);
358 status +=
"\n" + tuner.
title;
363 tr(
"%1 to %2",
"Time period, 'starttime to endtime'")
369 status = tr(
"There are no recordings currently taking place");
383 progInfo.
ToMap(infomap);
387 status = infomap[
"channame"] +
"\n";
388 status += infomap[
"title"];
389 if (!infomap[
"subtitle"].isEmpty())
390 status +=
"\n(" + infomap[
"subtitle"] +
")";
392 status +=
"\n" + infomap[
"timedate"];
401 status = tr(
"There are no scheduled recordings");
409 status = tr(
"Please Wait...");
440 command = QString(
"%1 %2").arg(mfpath, mfarg);
445 LOG(VB_GENERAL, LOG_INFO, QString(
"Grabbing EPG data using command: %1\n")
515 m_statusList.append(tr(
"MythTV is about to start recording."));
523 QString mythshutdown_status =
m_appBinDir +
"mythshutdown --status 0";
526 if (!(statusCode & 0xFF00))
531 m_statusList.append(tr(
"MythTV is busy flagging commercials."));
533 m_statusList.append(tr(
"MythTV is busy grabbing EPG data."));
537 m_statusList.append(tr(
"MythTV has running or pending jobs."));
539 m_statusList.append(tr(
"MythTV is in a daily wakeup/shutdown period."));
540 if (statusCode & 128)
541 m_statusList.append(tr(
"MythTV is about to start a wakeup/shutdown period."));
548 m_statusList.append(tr(
"MythTV is idle and will shutdown in %n "
600 QString mythshutdown_status =
m_appBinDir +
"mythshutdown --status 0";
603 if (!(statusCode & 0xFF00) && statusCode & 16)
616 QString command =
m_appBinDir +
"mythshutdown --lock";
625 QString command =
m_appBinDir +
"mythshutdown --unlock";
645 LOG(VB_GENERAL, LOG_INFO,
646 "MythWelcome is shutting this computer down now");
648 if (!poweroff_cmd.isEmpty())
656 ShowOkPopup(tr(
"Cannot shutdown because MythTV is currently recording"));
667 ShowOkPopup(tr(
"Cannot shutdown because MythTV is about to start recording"));
672 QString command =
m_appBinDir +
"mythshutdown --status 0";
676 if (!(statusCode & 0xFF00) && statusCode & 128)
678 ShowOkPopup(tr(
"Cannot shutdown because MythTV is about to start "
679 "a wakeup/shutdown period."));
690 restarttime = restarttime.addSecs((-1LL) * add);
695 "echo \'Wakeuptime would "
696 "be $time if command "
699 if (wakeup_timeformat ==
"time_t")
702 setwakeup_cmd.replace(
"$time",
703 time_ts.setNum(restarttime.toSecsSinceEpoch())
708 setwakeup_cmd.replace(
709 "$time", restarttime.toLocalTime().toString(wakeup_timeformat));
712 if (!setwakeup_cmd.isEmpty())
bool IsConnectedToMaster(void)
bool SafeConnectToMasterServer(bool blockingClient=true, bool openEventSocket=true)
QString GetSetting(const QString &key, const QString &defaultval="")
bool IsFrontendOnly(void)
is there a frontend, but no backend, running on this host
int GetNumSetting(const QString &key, int defaultval=0)
std::enable_if_t< std::chrono::__is_duration< T >::value, T > GetDurSetting(const QString &key, T defaultval=T::zero())
bool GetBoolSetting(const QString &key, bool defaultval=false)
Basic menu dialog, message and a list of options.
void AddButton(const QString &title)
void SetReturnEvent(QObject *retobject, const QString &resultid)
bool Create(void) override
This class is used as a container for messages.
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 AddScreen(MythScreenType *screen, bool allowFade=true)
Screen in which all other widgets are contained and rendered.
void BuildFocusList(void)
MythUIType * GetFocusWidget(void) const
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
bool SetFocusWidget(MythUIType *widget=nullptr)
virtual void SetText(const QString &text)
virtual void SetVisible(bool visible)
Holds information on recordings and videos.
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...
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
MythConfirmationDialog * ShowOkPopup(const QString &message, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
QString GetAppBinDir(void)
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
MythMainWindow * GetMythMainWindow(void)
@ kMSDontBlockInputDevs
avoid blocking LIRC & Joystick Menu
@ kMSProcessEvents
process events while waiting
@ kMSDisableUDPListener
disable MythMessage UDP listener for the duration of application.
uint myth_system(const QString &command, uint flags, std::chrono::seconds timeout)
QHash< QString, QString > InfoMap
QString toString(const QDateTime &raw_dt, uint format)
Returns formatted string representing the time.
@ kTime
Default local time.
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
bool GetNextRecordingList(QDateTime &nextRecordingStart, bool *hasConflicts, std::vector< ProgramInfo > *list)
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
bool RemoteGetRecordingStatus(std::vector< TunerStatus > *tunerList, bool list_inactive)