MythTV  master
welcomesettings.cpp
Go to the documentation of this file.
1 //myth
3 #include "libmythbase/mythdirs.h"
4 
5 // mythwelcome
6 #include "welcomesettings.h"
7 
9 // daily wakeup/shutdown settings
11 
12 #define TR MythWelcomeSettings::tr
13 
14 static StandardSetting *DailyWakeupStart(const QString& n)
15 {
16  auto *gc = new GlobalTimeBoxSetting("DailyWakeupStartPeriod" + n, "00:00");
17  gc->setLabel(TR("Period %1 start time").arg(n));
18  gc->setHelpText(TR("Period %1 start time. "
19  "Defines a period the master backend should be awake. "
20  "Set both Start & End times to 00:00 to disable.").arg(n));
21  return gc;
22 }
23 
24 static StandardSetting *DailyWakeupEnd(const QString& n)
25 {
26  auto *gc = new GlobalTimeBoxSetting("DailyWakeupEndPeriod" + n, "00:00");
27  gc->setLabel(TR("Period %1 end time").arg(n));
28  gc->setHelpText(TR("Period %1 end time. "
29  "Defines a period the master backend should be awake. "
30  "Set both Start & End times to 00:00 to disable.").arg(n));
31  return gc;
32 }
33 
34 static StandardSetting *DailyWakeup(const QString& n)
35 {
36  auto *gc = new GroupSetting();
37 
38  gc->setLabel(TR("Daily Wakeup/ShutDown Period %1").arg(n));
39  gc->addChild(DailyWakeupStart(n));
40  gc->addChild(DailyWakeupEnd(n));
41  return gc;
42 }
43 
45 {
46  auto *gc = new HostCheckBoxSetting("AutoStartFrontend");
47  gc->setLabel(TR("Automatically Start mythfrontend"));
48  gc->setValue(true);
49  gc->setHelpText(TR("Mythwelcome will automatically "
50  "start mythfrontend if it is determined that it was "
51  "not started to record a program."));
52  return gc;
53 }
54 
56 {
57  auto *gc = new HostCheckBoxSetting("ShutdownWithMasterBE");
58  gc->setLabel(TR("Shutdown with Master Backend"));
59  gc->setValue(false);
60  gc->setHelpText(TR("Mythwelcome will automatically "
61  "shutdown this computer when the master backend shuts "
62  "down. Should only be set on frontend only machines"));
63  return gc;
64 }
65 
67 {
68  setLabel(tr("MythWelcome Settings"));
69 
70  addChild(DailyWakeup("1"));
71  addChild(DailyWakeup("2"));
72 
74 
75  // this setting only makes sense on frontend only machines
78 }
79 
81 // mythshutdown script settings
83 
84 #undef TR
85 #define TR MythShutdownSettings::tr
86 
88 {
89  auto *gc = new HostTextEditSetting("MythShutdownNvramCmd");
90  gc->setLabel(TR("Command to Set Wakeup Time"));
91  gc->setValue("/usr/bin/nvram-wakeup --settime $time");
92  gc->setHelpText(TR("Command to set the wakeup time "
93  "in the BIOS. See the README file for more examples."));
94  return gc;
95 }
96 
98 {
99  auto *gc = new HostComboBoxSetting("MythShutdownWakeupTimeFmt", true);
100  gc->setLabel(TR("Wakeup time format"));
101  gc->addSelection("time_t");
102  gc->addSelection("yyyy-MM-dd hh:mm:ss");
103  gc->setHelpText(TR("The format of the time string "
104  "passed to the \'Set Wakeup Time Command\' as $time. "
105  "See QT::QDateTime.toString() for details. Set to "
106  "'time_t' for seconds since epoch (use time_t for "
107  "nvram_wakeup)."));
108  return gc;
109 }
110 
112 {
113  auto *gc = new HostTextEditSetting("MythShutdownNvramRestartCmd");
114  gc->setLabel(TR("nvram-wakeup Restart Command"));
115  gc->setValue("/sbin/grub-set-default 1");
116  gc->setHelpText(TR("Command to run if your bios "
117  "requires you to reboot to allow nvram-wakeup settings "
118  "to take effect. Leave blank if your bios does not "
119  "require a reboot. See the README file for more "
120  "examples."));
121  return gc;
122 }
123 
125 {
126  auto *gc = new HostTextEditSetting("MythShutdownReboot");
127  gc->setLabel(TR("Command to reboot"));
128  gc->setValue("/sbin/reboot");
129  gc->setHelpText(TR("Command to reboot computer."));
130  return gc;
131 }
132 
134 {
135  auto *gc = new HostTextEditSetting("MythShutdownPowerOff");
136  gc->setLabel(TR("Command to shutdown"));
137  gc->setValue("/sbin/poweroff");
138  gc->setHelpText(TR("Command to shutdown computer."));
139  return gc;
140 }
141 
143 {
144  auto *gc = new HostTextEditSetting("MythWelcomeStartFECmd");
145  gc->setLabel(TR("Command to run to start the Frontend"));
146  gc->setValue(GetAppBinDir() + "mythfrontend");
147  gc->setHelpText(TR("Command to start mythfrontend."));
148  return gc;
149 }
150 
152 {
153  auto *gc = new HostTextEditSetting("MythShutdownXTermCmd");
154  gc->setLabel(TR("Command to run Xterm"));
155  gc->setValue("xterm");
156  gc->setHelpText(TR("Command to start an Xterm. Can "
157  "be disabled by leaving this "
158  "setting blank."));
159  return gc;
160 }
161 
163 {
164  setLabel(tr("MythShutdown/MythWelcome Settings"));
172 }
welcomesettings.h
MythWelcomeSettings::MythWelcomeSettings
MythWelcomeSettings()
Definition: welcomesettings.cpp:66
DailyWakeupStart
static StandardSetting * DailyWakeupStart(const QString &n)
Definition: welcomesettings.cpp:14
MythCoreContext::IsFrontendOnly
bool IsFrontendOnly(void)
is there a frontend, but no backend, running on this host
Definition: mythcorecontext.cpp:749
HostTextEditSetting
Definition: standardsettings.h:168
MythShutdownSettings::MythShutdownSettings
MythShutdownSettings()
Definition: welcomesettings.cpp:162
DailyWakeup
static StandardSetting * DailyWakeup(const QString &n)
Definition: welcomesettings.cpp:34
TR
#define TR
Definition: welcomesettings.cpp:85
mythdirs.h
HostCheckBoxSetting
Definition: standardsettings.h:417
StandardSetting::addChild
virtual void addChild(StandardSetting *child)
Definition: standardsettings.cpp:71
GlobalTimeBoxSetting
Definition: standardsettings.h:301
MythShutdownXTermCmd
static StandardSetting * MythShutdownXTermCmd()
Definition: welcomesettings.cpp:151
MythShutdownNvramRestartCmd
static StandardSetting * MythShutdownNvramRestartCmd()
Definition: welcomesettings.cpp:111
WakeupTimeFormat
static StandardSetting * WakeupTimeFormat()
Definition: welcomesettings.cpp:97
MythShutdownPowerOff
static StandardSetting * MythShutdownPowerOff()
Definition: welcomesettings.cpp:133
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:55
ShutdownWithBE
static StandardSetting * ShutdownWithBE()
Definition: welcomesettings.cpp:55
StandardSetting::setLabel
virtual void setLabel(QString str)
Definition: standardsettings.h:34
DailyWakeupEnd
static StandardSetting * DailyWakeupEnd(const QString &n)
Definition: welcomesettings.cpp:24
MythShutdownNvramCmd
static StandardSetting * MythShutdownNvramCmd()
Definition: welcomesettings.cpp:87
mythcorecontext.h
HostComboBoxSetting
Definition: standardsettings.h:257
MythShutdownStartFECmd
static StandardSetting * MythShutdownStartFECmd()
Definition: welcomesettings.cpp:142
GetAppBinDir
QString GetAppBinDir(void)
Definition: mythdirs.cpp:253
StandardSetting
Definition: standardsettings.h:29
MythShutdownReboot
static StandardSetting * MythShutdownReboot()
Definition: welcomesettings.cpp:124
AutoStartFrontend
static StandardSetting * AutoStartFrontend()
Definition: welcomesettings.cpp:44
GroupSetting
Definition: standardsettings.h:435