10#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
11#include <QtSystemDetection>
14#include <QGuiApplication>
38 m_updateStatusTimer(new QTimer(this)),
39 m_updateScreenTimer(new QTimer(this))
76 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'welcome_screen'");
103 if (!startFECmd.contains(
"platform"))
104 args << QString(
"--platform %1").arg(QGuiApplication::platformName());
125 QString command =
m_appBinDir +
"mythshutdown --startup";
129 LOG(VB_GENERAL, LOG_NOTICE,
130 QString(
"mythshutdown --startup returned: %1").arg(state));
134 if (state == 1 && bAutoStartFrontend)
149 if (me->Message().startsWith(
"RECORDING_LIST_CHANGE") ||
150 me->Message() ==
"UPDATE_PROG_INFO")
152 LOG(VB_GENERAL, LOG_NOTICE,
153 "MythWelcome received a recording list change event");
159 LOG(VB_GENERAL, LOG_NOTICE,
160 " [deferred to pending handler]");
169 else if (me->Message().startsWith(
"SCHEDULE_CHANGE"))
171 LOG(VB_GENERAL, LOG_NOTICE,
172 "MythWelcome received a SCHEDULE_CHANGE event");
178 LOG(VB_GENERAL, LOG_NOTICE,
179 " [deferred to pending handler]");
187 else if (me->Message().startsWith(
"SHUTDOWN_COUNTDOWN"))
190 LOG(VB_GENERAL, LOG_NOTICE,
191 "MythWelcome received a SHUTDOWN_COUNTDOWN event");
193 QString secs = me->Message().mid(19);
198 else if (me->Message().startsWith(
"SHUTDOWN_NOW"))
200 LOG(VB_GENERAL, LOG_NOTICE,
201 "MythWelcome received a SHUTDOWN_NOW event");
208 LOG(VB_GENERAL, LOG_NOTICE,
209 "MythWelcome is shutting this computer down now");
211 if (!poweroff_cmd.isEmpty())
237 for (
int i = 0; i < actions.size() && !handled; i++)
239 const QString&
action = actions[i];
250 else if (
action ==
"NEXTVIEW")
254 else if (
action ==
"INFO")
258 else if (
action ==
"SHOWSETTINGS")
264 QString mythshutdown_status =
266 QString mythshutdown_unlock =
268 QString mythshutdown_lock =
275 if (!(statusCode & 0xFF00) && statusCode & 16)
287 else if (
action ==
"STARTXTERM")
293 else if (
action ==
"STARTSETUP")
295 QString mythtv_setup =
m_appBinDir +
"mythtv-setup";
359 status = tr(
"Tuner %1 is recording:").arg(tuner.
id);
362 status +=
"\n" + tuner.
title;
367 tr(
"%1 to %2",
"Time period, 'starttime to endtime'")
373 status = tr(
"There are no recordings currently taking place");
387 progInfo.
ToMap(infomap);
391 status = infomap[
"channame"] +
"\n";
392 status += infomap[
"title"];
393 if (!infomap[
"subtitle"].isEmpty())
394 status +=
"\n(" + infomap[
"subtitle"] +
")";
396 status +=
"\n" + infomap[
"timedate"];
405 status = tr(
"There are no scheduled recordings");
413 status = tr(
"Please Wait...");
444 command = QString(
"%1 %2").arg(mfpath, mfarg);
449 LOG(VB_GENERAL, LOG_INFO, QString(
"Grabbing EPG data using command: %1\n")
519 m_statusList.append(tr(
"MythTV is about to start recording."));
527 QString mythshutdown_status =
m_appBinDir +
"mythshutdown --status 0";
530 if (!(statusCode & 0xFF00))
535 m_statusList.append(tr(
"MythTV is busy flagging commercials."));
537 m_statusList.append(tr(
"MythTV is busy grabbing EPG data."));
541 m_statusList.append(tr(
"MythTV has running or pending jobs."));
543 m_statusList.append(tr(
"MythTV is in a daily wakeup/shutdown period."));
544 if (statusCode & 128)
545 m_statusList.append(tr(
"MythTV is about to start a wakeup/shutdown period."));
552 m_statusList.append(tr(
"MythTV is idle and will shutdown in %n "
604 QString mythshutdown_status =
m_appBinDir +
"mythshutdown --status 0";
607 if (!(statusCode & 0xFF00) && statusCode & 16)
620 QString command =
m_appBinDir +
"mythshutdown --lock";
629 QString command =
m_appBinDir +
"mythshutdown --unlock";
649 LOG(VB_GENERAL, LOG_INFO,
650 "MythWelcome is shutting this computer down now");
652 if (!poweroff_cmd.isEmpty())
660 ShowOkPopup(tr(
"Cannot shutdown because MythTV is currently recording"));
671 ShowOkPopup(tr(
"Cannot shutdown because MythTV is about to start recording"));
676 QString command =
m_appBinDir +
"mythshutdown --status 0";
680 if (!(statusCode & 0xFF00) && statusCode & 128)
682 ShowOkPopup(tr(
"Cannot shutdown because MythTV is about to start "
683 "a wakeup/shutdown period."));
694 restarttime = restarttime.addSecs((-1LL) * add);
699 "echo \'Wakeuptime would "
700 "be $time if command "
703 if (wakeup_timeformat ==
"time_t")
706 setwakeup_cmd.replace(
"$time",
707 time_ts.setNum(restarttime.toSecsSinceEpoch())
712 setwakeup_cmd.replace(
713 "$time", restarttime.toLocalTime().toString(wakeup_timeformat));
716 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)