11#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
12#include <QtSystemDetection>
15#include <QGuiApplication>
39 m_updateStatusTimer(new QTimer(this)),
40 m_updateScreenTimer(new QTimer(this))
77 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'welcome_screen'");
104 if (!startFECmd.contains(
"platform"))
105 args << QString(
"--platform %1").arg(QGuiApplication::platformName());
126 QString command =
m_appBinDir +
"mythshutdown --startup";
130 LOG(VB_GENERAL, LOG_NOTICE,
131 QString(
"mythshutdown --startup returned: %1").arg(state));
135 if (state == 1 && bAutoStartFrontend)
150 if (me->Message().startsWith(
"RECORDING_LIST_CHANGE") ||
151 me->Message() ==
"UPDATE_PROG_INFO")
153 LOG(VB_GENERAL, LOG_NOTICE,
154 "MythWelcome received a recording list change event");
160 LOG(VB_GENERAL, LOG_NOTICE,
161 " [deferred to pending handler]");
170 else if (me->Message().startsWith(
"SCHEDULE_CHANGE"))
172 LOG(VB_GENERAL, LOG_NOTICE,
173 "MythWelcome received a SCHEDULE_CHANGE event");
179 LOG(VB_GENERAL, LOG_NOTICE,
180 " [deferred to pending handler]");
188 else if (me->Message().startsWith(
"SHUTDOWN_COUNTDOWN"))
191 LOG(VB_GENERAL, LOG_NOTICE,
192 "MythWelcome received a SHUTDOWN_COUNTDOWN event");
194 QString secs = me->Message().mid(19);
199 else if (me->Message().startsWith(
"SHUTDOWN_NOW"))
201 LOG(VB_GENERAL, LOG_NOTICE,
202 "MythWelcome received a SHUTDOWN_NOW event");
209 LOG(VB_GENERAL, LOG_NOTICE,
210 "MythWelcome is shutting this computer down now");
212 if (!poweroff_cmd.isEmpty())
238 for (
int i = 0; i < actions.size() && !handled; i++)
240 const QString&
action = actions[i];
251 else if (
action ==
"NEXTVIEW")
255 else if (
action ==
"INFO")
259 else if (
action ==
"SHOWSETTINGS")
265 QString mythshutdown_status =
267 QString mythshutdown_unlock =
269 QString mythshutdown_lock =
276 if (!(statusCode & 0xFF00) && statusCode & 16)
288 else if (
action ==
"STARTXTERM")
294 else if (
action ==
"STARTSETUP")
296 QString mythtv_setup =
m_appBinDir +
"mythtv-setup";
360 status = tr(
"Tuner %1 is recording:").arg(tuner.
id);
363 status +=
"\n" + tuner.
title;
368 tr(
"%1 to %2",
"Time period, 'starttime to endtime'")
374 status = tr(
"There are no recordings currently taking place");
388 progInfo.
ToMap(infomap);
392 status = infomap[
"channame"] +
"\n";
393 status += infomap[
"title"];
394 if (!infomap[
"subtitle"].isEmpty())
395 status +=
"\n(" + infomap[
"subtitle"] +
")";
397 status +=
"\n" + infomap[
"timedate"];
406 status = tr(
"There are no scheduled recordings");
414 status = tr(
"Please Wait...");
445 command = QString(
"%1 %2").arg(mfpath, mfarg);
450 LOG(VB_GENERAL, LOG_INFO, QString(
"Grabbing EPG data using command: %1\n")
520 m_statusList.append(tr(
"MythTV is about to start recording."));
528 QString mythshutdown_status =
m_appBinDir +
"mythshutdown --status 0";
531 if (!(statusCode & 0xFF00))
536 m_statusList.append(tr(
"MythTV is busy flagging commercials."));
538 m_statusList.append(tr(
"MythTV is busy grabbing EPG data."));
542 m_statusList.append(tr(
"MythTV has running or pending jobs."));
544 m_statusList.append(tr(
"MythTV is in a daily wakeup/shutdown period."));
545 if (statusCode & 128)
546 m_statusList.append(tr(
"MythTV is about to start a wakeup/shutdown period."));
553 m_statusList.append(tr(
"MythTV is idle and will shutdown in %n "
605 QString mythshutdown_status =
m_appBinDir +
"mythshutdown --status 0";
608 if (!(statusCode & 0xFF00) && statusCode & 16)
621 QString command =
m_appBinDir +
"mythshutdown --lock";
630 QString command =
m_appBinDir +
"mythshutdown --unlock";
640 std::this_thread::sleep_for(1s);
650 LOG(VB_GENERAL, LOG_INFO,
651 "MythWelcome is shutting this computer down now");
653 if (!poweroff_cmd.isEmpty())
661 ShowOkPopup(tr(
"Cannot shutdown because MythTV is currently recording"));
672 ShowOkPopup(tr(
"Cannot shutdown because MythTV is about to start recording"));
677 QString command =
m_appBinDir +
"mythshutdown --status 0";
681 if (!(statusCode & 0xFF00) && statusCode & 128)
683 ShowOkPopup(tr(
"Cannot shutdown because MythTV is about to start "
684 "a wakeup/shutdown period."));
695 restarttime = restarttime.addSecs((-1LL) * add);
700 "echo \'Wakeuptime would "
701 "be $time if command "
704 if (wakeup_timeformat ==
"time_t")
707 setwakeup_cmd.replace(
"$time",
708 time_ts.setNum(restarttime.toSecsSinceEpoch())
713 setwakeup_cmd.replace(
714 "$time", restarttime.toLocalTime().toString(wakeup_timeformat));
717 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)