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