00001 #include <mythcontext.h> 00002 00003 #include <unistd.h> 00004 00005 #include "welcomesettings.h" 00006 00008 // daily wakeup/shutdown settings 00010 00011 static GlobalTimeBox *DailyWakeupStart1() 00012 { 00013 GlobalTimeBox *gc = new GlobalTimeBox("DailyWakeupStartPeriod1", "00:00"); 00014 gc->setLabel(QObject::tr("Period") + " 1 " + QObject::tr("start time")); 00015 gc->setHelpText(QObject::tr("Period") + " 1 " + QObject::tr("start time") + 00016 ". " + QObject::tr("Defines a period the master backend should be awake") + 00017 ". " + QObject::tr("Set both Start & End times to 00:00 " 00018 "to disable.")); 00019 return gc; 00020 }; 00021 00022 static GlobalTimeBox *DailyWakeupEnd1() 00023 { 00024 GlobalTimeBox *gc = new GlobalTimeBox("DailyWakeupEndPeriod1", "00:00"); 00025 gc->setLabel(QObject::tr("Period") + " 1 " + QObject::tr("end time")); 00026 gc->setHelpText(QObject::tr("Period") + " 1 " + QObject::tr("end time") + 00027 ". " + QObject::tr("Defines a period the master backend should be awake") + 00028 ". " + QObject::tr("Set both Start & End times to 00:00 " 00029 "to disable.")); 00030 return gc; 00031 }; 00032 00033 static GlobalTimeBox *DailyWakeupStart2() 00034 { 00035 GlobalTimeBox *gc = new GlobalTimeBox("DailyWakeupStartPeriod2", "00:00"); 00036 gc->setLabel(QObject::tr("Period") + " 2 " + QObject::tr("start time")); 00037 gc->setHelpText(QObject::tr("Period") + " 2 " + QObject::tr("start time") + 00038 ". " + QObject::tr("Defines a period the master backend should be awake") + 00039 ". " + QObject::tr("Set both Start & End times to 00:00 " 00040 "to disable.")); 00041 return gc; 00042 }; 00043 00044 static GlobalTimeBox *DailyWakeupEnd2() 00045 { 00046 GlobalTimeBox *gc = new GlobalTimeBox("DailyWakeupEndPeriod2", "00:00"); 00047 gc->setLabel(QObject::tr("Period") + " 2 " + QObject::tr("end time")); 00048 gc->setHelpText(QObject::tr("Period") + " 2 " + QObject::tr("end time") + 00049 ". " + QObject::tr("Defines a period the master backend should be awake") + 00050 ". " + QObject::tr("Set both Start & End times to 00:00 " 00051 "to disable.")); 00052 return gc; 00053 }; 00054 00055 static HostCheckBox *AutoStartFrontend() 00056 { 00057 HostCheckBox *gc = new HostCheckBox("AutoStartFrontend"); 00058 gc->setLabel(QObject::tr("Automatically Start Myth Frontend")); 00059 gc->setValue(true); 00060 gc->setHelpText(QObject::tr("Mythwelcome will automatically start the " 00061 "mythfrontend if it is determined that it was not started to " 00062 "record a program.")); 00063 return gc; 00064 }; 00065 00066 static HostCheckBox *ShutdownWithBE() 00067 { 00068 HostCheckBox *gc = new HostCheckBox("ShutdownWithMasterBE"); 00069 gc->setLabel(QObject::tr("Shutdown with Master Backend")); 00070 gc->setValue(false); 00071 gc->setHelpText(QObject::tr("Mythwelcome will automatically shutdown " 00072 "this computer when the master backend shuts down. " 00073 "Should only be set on frontend only machines")); 00074 return gc; 00075 }; 00076 00077 static HostLineEdit *MythWelcomeDateFormat() 00078 { 00079 HostLineEdit *gc = new HostLineEdit("MythWelcomeDateFormat"); 00080 gc->setLabel(QObject::tr("Date Format")); 00081 gc->setValue("dddd\ndd MMM yyyy"); 00082 gc->setHelpText(QObject::tr("This is the format to use to display the date. " 00083 "See http://doc.trolltech.com/3.3/qdate.html#toString " 00084 "for a list of valid format specifiers.")); 00085 return gc; 00086 }; 00087 00088 MythWelcomeSettings::MythWelcomeSettings() 00089 { 00090 HorizontalConfigurationGroup* hcg1 = 00091 new HorizontalConfigurationGroup(true, true); 00092 HorizontalConfigurationGroup* hcg2 = 00093 new HorizontalConfigurationGroup(true, true); 00094 VerticalConfigurationGroup* vcg = 00095 new VerticalConfigurationGroup(false); 00096 00097 vcg->setLabel(QObject::tr("MythWelcome Settings")); 00098 00099 hcg1->setLabel(QObject::tr("Daily Wakeup/ShutDown Period") + " 1"); 00100 hcg1->addChild(DailyWakeupStart1()); 00101 hcg1->addChild(DailyWakeupEnd1()); 00102 vcg->addChild(hcg1); 00103 00104 hcg2->setLabel(QObject::tr("Daily Wakeup/ShutDown Period") + " 2"); 00105 hcg2->addChild(DailyWakeupStart2()); 00106 hcg2->addChild(DailyWakeupEnd2()); 00107 vcg->addChild(hcg2); 00108 00109 vcg->addChild(AutoStartFrontend()); 00110 00111 // this setting only makes sense on frontend only machines 00112 if (gContext->IsFrontendOnly()) 00113 { 00114 vcg->addChild(ShutdownWithBE()); 00115 } 00116 00117 vcg->addChild(MythWelcomeDateFormat()); 00118 00119 addChild(vcg); 00120 } 00121 00123 // mythshutdown script settings 00125 00126 static HostLineEdit *MythShutdownNvramCmd() 00127 { 00128 HostLineEdit *gc = new HostLineEdit("MythShutdownNvramCmd"); 00129 gc->setLabel(QObject::tr("Command to Set Wakeup Time")); 00130 gc->setValue("/usr/bin/nvram-wakeup --settime $time"); 00131 gc->setHelpText(QObject::tr("Command to set the wakeup time in the BIOS. " 00132 "See the README file for more examples.")); 00133 return gc; 00134 }; 00135 00136 static HostComboBox *WakeupTimeFormat() 00137 { 00138 HostComboBox *gc = new HostComboBox("MythShutdownWakeupTimeFmt", true); 00139 gc->setLabel(QObject::tr("Wakeup time format")); 00140 gc->addSelection("time_t"); 00141 gc->addSelection("yyyy-MM-dd hh:mm:ss"); 00142 gc->setHelpText(QObject::tr("The format of the time string passed to the " 00143 "\'Set Wakeup Time Command\' as $time. See " 00144 "QT::QDateTime.toString() for details. Set to 'time_t' for " 00145 "seconds since epoch (use time_t for nvram_wakeup).")); 00146 return gc; 00147 }; 00148 00149 static HostLineEdit *MythShutdownNvramRestartCmd() 00150 { 00151 HostLineEdit *gc = new HostLineEdit("MythShutdownNvramRestartCmd"); 00152 gc->setLabel(QObject::tr("nvram-wakeup Restart Command")); 00153 gc->setValue("/sbin/grub-set-default 1"); 00154 gc->setHelpText(QObject::tr("Command to run if your bios requires you to " 00155 "reboot to allow nvram-wakeup settings to " 00156 "take effect. Leave blank if your bios does not " 00157 "require a reboot. See the README file for more " 00158 "examples.")); 00159 return gc; 00160 }; 00161 00162 static HostLineEdit *MythShutdownReboot() 00163 { 00164 HostLineEdit *gc = new HostLineEdit("MythShutdownReboot"); 00165 gc->setLabel(QObject::tr("Command to reboot")); 00166 gc->setValue("/sbin/reboot"); 00167 gc->setHelpText(QObject::tr("Command to reboot computer.")); 00168 return gc; 00169 }; 00170 00171 static HostLineEdit *MythShutdownPowerOff() 00172 { 00173 HostLineEdit *gc = new HostLineEdit("MythShutdownPowerOff"); 00174 gc->setLabel(QObject::tr("Command to shutdown")); 00175 gc->setValue("/sbin/poweroff"); 00176 gc->setHelpText(QObject::tr("Command to shutdown computer.")); 00177 return gc; 00178 }; 00179 00180 static HostLineEdit *MythShutdownStartFECmd() 00181 { 00182 HostLineEdit *gc = new HostLineEdit("MythWelcomeStartFECmd"); 00183 gc->setLabel(QObject::tr("Command to run to start the Frontend")); 00184 gc->setValue(gContext->GetInstallPrefix() + "/bin/mythfrontend"); 00185 gc->setHelpText(QObject::tr("Command to start mythfrontend.")); 00186 return gc; 00187 }; 00188 00189 static HostLineEdit *MythShutdownXTermCmd() 00190 { 00191 HostLineEdit *gc = new HostLineEdit("MythShutdownXTermCmd"); 00192 gc->setLabel(QObject::tr("Command to run Xterm")); 00193 gc->setValue("xterm"); 00194 gc->setHelpText(QObject::tr("Command to start an Xterm. Can be disabled by " 00195 "leaving this setting blank.")); 00196 return gc; 00197 }; 00198 00199 00200 MythShutdownSettings::MythShutdownSettings() 00201 { 00202 VerticalConfigurationGroup* vcg = 00203 new VerticalConfigurationGroup(false); 00204 00205 vcg->setLabel(QObject::tr("MythShutdown/MythWelcome Settings")); 00206 vcg->addChild(MythShutdownNvramCmd()); 00207 vcg->addChild(WakeupTimeFormat()); 00208 vcg->addChild(MythShutdownNvramRestartCmd()); 00209 vcg->addChild(MythShutdownReboot()); 00210 vcg->addChild(MythShutdownPowerOff()); 00211 vcg->addChild(MythShutdownXTermCmd()); 00212 vcg->addChild(MythShutdownStartFECmd()); 00213 00214 addChild(vcg); 00215 }
1.5.5