MythTV  master
backendsettings.cpp
Go to the documentation of this file.
1 #include <cstdio>
2 
3 #include "backendsettings.h"
4 #include "frequencies.h"
5 #include "mythcorecontext.h"
6 #include "channelsettings.h" // for ChannelTVFormat::GetFormats()
7 #include <unistd.h>
8 
9 #include <QNetworkInterface>
10 
11 
13 {
15  gc->setLabel(QObject::tr("This server is the Master Backend"));
16  gc->setValue(false);
17  gc->setHelpText(QObject::tr(
18  "Enable this if this is the only backend or is the "
19  "master backend server. If enabled, all frontend and "
20  "non-master backend machines "
21  "will connect to this server. To change to a new master "
22  "backend, run setup on that server and select it as "
23  "master backend."));
24  return gc;
25 };
26 
28 {
29  GlobalTextEditSetting *gc = new GlobalTextEditSetting("MasterServerName");
30  gc->setLabel(QObject::tr("Master Backend Name"));
31  gc->setValue("");
32  gc->setEnabled(false);
33  gc->setHelpText(QObject::tr(
34  "Host name of Master Backend. This is set by selecting "
35  "\"This server is the Master Backend\" on that server."));
36  return gc;
37 };
38 
40 {
41  HostCheckBoxSetting *gc = new HostCheckBoxSetting("AllowConnFromAll");
42  gc->setLabel(QObject::tr("Allow Connections from all Subnets"));
43  gc->setValue(false);
44  gc->setHelpText(QObject::tr(
45  "Allow this backend to receive connections from any IP "
46  "address on the internet. NOT recommended for most users. "
47  "Use this only if you have secure IPV4 and IPV6 " "firewalls."));
48  return gc;
49 };
50 
52 {
53  HostComboBoxSetting *gc = new HostComboBoxSetting("BackendServerIP");
54  gc->setLabel(QObject::tr("IPv4 address"));
55  QList<QHostAddress> list = QNetworkInterface::allAddresses();
56  QList<QHostAddress>::iterator it;
57  for (it = list.begin(); it != list.end(); ++it)
58  {
59  if ((*it).protocol() == QAbstractSocket::IPv4Protocol)
60  gc->addSelection((*it).toString(), (*it).toString());
61  }
62 
63  gc->setValue("127.0.0.1");
64  gc->setHelpText(QObject::tr("Enter the IP address of this machine. "
65  "Use an externally accessible address (ie, not "
66  "127.0.0.1) if you are going to be running a frontend "
67  "on a different machine than this one. Note, in IPv6 "
68  "setups, this is still required for certain extras "
69  "such as UPnP."));
70  return gc;
71 };
72 
74 {
75  HostComboBoxSetting *gc = new HostComboBoxSetting("BackendServerIP6");
76  gc->setLabel(QObject::tr("Listen on IPv6 address"));
77  QList<QHostAddress> list = QNetworkInterface::allAddresses();
78  QList<QHostAddress>::iterator it;
79  for (it = list.begin(); it != list.end(); ++it)
80  {
81  if ((*it).protocol() == QAbstractSocket::IPv6Protocol)
82  {
83  // If it is a link-local IPV6 address with scope,
84  // remove the scope.
85  it->setScopeId(QString());
86  gc->addSelection((*it).toString(), (*it).toString());
87  }
88  }
89 
90  if (list.isEmpty())
91  {
92  gc->setEnabled(false);
93  gc->setValue("");
94  }
95  else
96  {
97  if (list.contains(QHostAddress("::1")))
98  gc->setValue("::1");
99  }
100 
101  gc->setHelpText(QObject::tr("Enter the IPv6 address of this machine. "
102  "Use an externally accessible address (ie, not "
103  "::1) if you are going to be running a frontend "
104  "on a different machine than this one."));
105  return gc;
106 }
107 
109 {
110  HostCheckBoxSetting *hc = new HostCheckBoxSetting("AllowLinkLocal");
111  hc->setLabel(QObject::tr("Listen on Link-Local addresses"));
112  hc->setValue(true);
113  hc->setHelpText(QObject::tr("Enable servers on this machine to listen on "
114  "link-local addresses. These are auto-configured "
115  "addresses and not accessible outside the local network. "
116  "This must be enabled for anything requiring Bonjour to "
117  "work."));
118  return hc;
119 };
120 
122 {
123  public:
126  explicit IpAddressSettings(/*Setting* trigger*/) :
127  HostCheckBoxSetting("ListenOnAllIps")
128  {
129  setLabel(QObject::tr("Listen on All IP Addresses"));
130  setValue(true);
131  setHelpText(tr("Allow this backend to receive connections on any IP "
132  "Address assigned to it. Recommended for most users "
133  "for ease and reliability."));
134 
137  // show ip addresses if ListenOnAllIps is off
141  };
142 };
143 
144 
145 
147 {
148  HostTextEditSetting *gc = new HostTextEditSetting("BackendServerPort");
149  gc->setLabel(QObject::tr("Port"));
150  gc->setValue("6543");
151  gc->setHelpText(QObject::tr("Unless you've got good reason, don't "
152  "change this."));
153  return gc;
154 };
155 
157 {
158  HostTextEditSetting *gc = new HostTextEditSetting("BackendStatusPort");
159  gc->setLabel(QObject::tr("Status port"));
160  gc->setValue("6544");
161  gc->setHelpText(QObject::tr("Port on which the server will listen for "
162  "HTTP requests, including backend status and MythXML "
163  "requests."));
164  return gc;
165 };
166 
168 {
169  HostComboBoxSetting *gc = new HostComboBoxSetting("BackendServerAddr", true);
170  gc->setLabel(QObject::tr("Primary IP address / DNS name"));
171  gc->setValue("127.0.0.1");
172  gc->setHelpText(QObject::tr("The Primary IP address of this backend "
173  "server. You can select an IP "
174  "address from the list or type a DNS name "
175  "or host name. Other systems will contact this "
176  "server using this address. "
177  "If you use a host name make sure it is assigned "
178  "an ip address other than 127.0.0.1 in the hosts "
179  "file."));
180  return gc;
181 };
182 
183 // Deprecated
185 {
186  GlobalTextEditSetting *gc = new GlobalTextEditSetting("MasterServerIP");
187  gc->setLabel(QObject::tr("IP address"));
188  gc->setValue("127.0.0.1");
189  return gc;
190 };
191 
192 // Deprecated
194 {
195  GlobalTextEditSetting *gc = new GlobalTextEditSetting("MasterServerPort");
196  gc->setLabel(QObject::tr("Port"));
197  gc->setValue("6543");
198  return gc;
199 };
200 
202 {
203  HostTextEditSetting *gc = new HostTextEditSetting("SecurityPin");
204  gc->setLabel(QObject::tr("Security PIN (required)"));
205  gc->setValue("");
206  gc->setHelpText(QObject::tr("PIN code required for a frontend to connect "
207  "to the backend. Blank prevents all "
208  "connections; 0000 allows any client to "
209  "connect."));
210  return gc;
211 };
212 
214 {
215  GlobalComboBoxSetting *gc = new GlobalComboBoxSetting("TVFormat");
216  gc->setLabel(QObject::tr("TV format"));
217 
218  QStringList list = ChannelTVFormat::GetFormats();
219  for (int i = 0; i < list.size(); i++)
220  gc->addSelection(list[i]);
221 
222  gc->setHelpText(QObject::tr("The TV standard to use for viewing TV."));
223  return gc;
224 };
225 
227 {
228  GlobalComboBoxSetting *gc = new GlobalComboBoxSetting("VbiFormat");
229  gc->setLabel(QObject::tr("VBI format"));
230  gc->addSelection("None");
231  gc->addSelection("PAL teletext");
232  gc->addSelection("NTSC closed caption");
233  gc->setHelpText(QObject::tr("The VBI (Vertical Blanking Interval) is "
234  "used to carry Teletext or Closed Captioning "
235  "data."));
236  return gc;
237 };
238 
240 {
241  GlobalComboBoxSetting *gc = new GlobalComboBoxSetting("FreqTable");
242  gc->setLabel(QObject::tr("Channel frequency table"));
243 
244  for (uint i = 0; chanlists[i].name; i++)
245  gc->addSelection(chanlists[i].name);
246 
247  gc->setHelpText(QObject::tr("Select the appropriate frequency table for "
248  "your system. If you have an antenna, use a \"-bcast\" "
249  "frequency."));
250  return gc;
251 };
252 
254 {
255  GlobalCheckBoxSetting *gc = new GlobalCheckBoxSetting("SaveTranscoding");
256  gc->setLabel(QObject::tr("Save original files after transcoding (globally)"));
257  gc->setValue(false);
258  gc->setHelpText(QObject::tr("If enabled and the transcoder is active, the "
259  "original files will be renamed to .old once the "
260  "transcoding is complete."));
261  return gc;
262 };
263 
265 {
266  HostCheckBoxSetting *hc = new HostCheckBoxSetting("TruncateDeletesSlowly");
267  hc->setLabel(QObject::tr("Delete files slowly"));
268  hc->setValue(false);
269  hc->setHelpText(QObject::tr("Some filesystems use a lot of resources when "
270  "deleting large files. If enabled, this option makes "
271  "MythTV delete files slowly on this backend to lessen the "
272  "impact."));
273  return hc;
274 };
275 
277 {
278  GlobalCheckBoxSetting *gc = new GlobalCheckBoxSetting("DeletesFollowLinks");
279  gc->setLabel(QObject::tr("Follow symbolic links when deleting files"));
280  gc->setValue(false);
281  gc->setHelpText(QObject::tr("If enabled, MythTV will follow symlinks "
282  "when recordings and related files are deleted, instead "
283  "of deleting the symlink and leaving the actual file."));
284  return gc;
285 };
286 
288 {
290  "HDRingbufferSize", 25*188, 512*188, 25*188);
291  bs->setLabel(QObject::tr("HD ringbuffer size (kB)"));
292  bs->setHelpText(QObject::tr("The HD device ringbuffer allows the "
293  "backend to weather moments of stress. "
294  "The larger the ringbuffer (in kilobytes), the longer "
295  "the moments of stress can be. However, "
296  "setting the size too large can cause "
297  "swapping, which is detrimental."));
298  bs->setValue(50*188);
299  return bs;
300 }
301 
303 {
304  GlobalComboBoxSetting *gc = new GlobalComboBoxSetting("StorageScheduler");
305  gc->setLabel(QObject::tr("Storage Group disk scheduler"));
306  gc->addSelection(QObject::tr("Balanced free space"), "BalancedFreeSpace");
307  gc->addSelection(QObject::tr("Balanced percent free space"), "BalancedPercFreeSpace");
308  gc->addSelection(QObject::tr("Balanced disk I/O"), "BalancedDiskIO");
309  gc->addSelection(QObject::tr("Combination"), "Combination");
310  gc->setValue("BalancedFreeSpace");
311  gc->setHelpText(QObject::tr("This setting controls how the Storage Group "
312  "scheduling code will balance new recordings across "
313  "directories. 'Balanced Free Space' is the recommended "
314  "method for most users." ));
315  return gc;
316 };
317 
319 {
320  GlobalCheckBoxSetting *gc = new GlobalCheckBoxSetting("DisableAutomaticBackup");
321  gc->setLabel(QObject::tr("Disable automatic database backup"));
322  gc->setValue(false);
323  gc->setHelpText(QObject::tr("If enabled, MythTV will not backup the "
324  "database before upgrades. You should "
325  "therefore have your own database backup "
326  "strategy in place."));
327  return gc;
328 };
329 
331 {
332  HostCheckBoxSetting *hc = new HostCheckBoxSetting("DisableFirewireReset");
333  hc->setLabel(QObject::tr("Disable FireWire reset"));
334  hc->setHelpText(
335  QObject::tr(
336  "By default, MythTV resets the FireWire bus when a "
337  "FireWire recorder stops responding to commands. If "
338  "this causes problems, you can disable this behavior "
339  "here."));
340  hc->setValue(false);
341  return hc;
342 }
343 
345 {
346  HostTextEditSetting *he = new HostTextEditSetting("MiscStatusScript");
347  he->setLabel(QObject::tr("Miscellaneous status application"));
348  he->setValue("");
349  he->setHelpText(QObject::tr("External application or script that outputs "
350  "extra information for inclusion in the "
351  "backend status page. See http://www.mythtv."
352  "org/wiki/Miscellaneous_Status_Information"));
353  return he;
354 }
355 
357 {
358  GlobalSpinBoxSetting *gc = new GlobalSpinBoxSetting("EITTransportTimeout", 1, 15, 1);
359  gc->setLabel(QObject::tr("EIT transport timeout (mins)"));
360  gc->setValue(5);
361  QString helpText = QObject::tr(
362  "Maximum time to spend waiting (in minutes) for listings data "
363  "on one digital TV channel before checking for new listings data "
364  "on the next channel.");
365  gc->setHelpText(helpText);
366  return gc;
367 }
368 
370 {
371  GlobalCheckBoxSetting *gc = new GlobalCheckBoxSetting("MasterBackendOverride");
372  gc->setLabel(QObject::tr("Master backend override"));
373  gc->setValue(true);
374  gc->setHelpText(QObject::tr("If enabled, the master backend will stream and"
375  " delete files if it finds them in a storage directory. "
376  "Useful if you are using a central storage location, like "
377  "a NFS share, and your slave backend isn't running."));
378  return gc;
379 };
380 
382 {
383  GlobalSpinBoxSetting *gc = new GlobalSpinBoxSetting("EITCrawIdleStart", 30, 7200, 30);
384  gc->setLabel(QObject::tr("Backend idle before EIT crawl (secs)"));
385  gc->setValue(60);
386  QString help = QObject::tr(
387  "The minimum number of seconds after a recorder becomes idle "
388  "to wait before MythTV begins collecting EIT listings data.");
389  gc->setHelpText(help);
390  return gc;
391 }
392 
394 {
395  GlobalSpinBoxSetting *gc = new GlobalSpinBoxSetting("WOLbackendReconnectWaitTime", 0, 1200, 5);
396  gc->setLabel(QObject::tr("Delay between wake attempts (secs)"));
397  gc->setValue(0);
398  gc->setHelpText(QObject::tr("Length of time the frontend waits between "
399  "tries to wake up the master backend. This should be the "
400  "time your master backend needs to startup. Set to 0 to "
401  "disable."));
402  return gc;
403 };
404 
406 {
407  GlobalSpinBoxSetting *gc = new GlobalSpinBoxSetting("WOLbackendConnectRetry", 1, 60, 1);
408  gc->setLabel(QObject::tr("Wake attempts"));
409  gc->setHelpText(QObject::tr("Number of times the frontend will try to wake "
410  "up the master backend."));
411  gc->setValue(5);
412  return gc;
413 };
414 
416 {
417  GlobalTextEditSetting *gc = new GlobalTextEditSetting("WOLbackendCommand");
418  gc->setLabel(QObject::tr("Wake command"));
419  gc->setValue("");
420  gc->setHelpText(QObject::tr("The command used to wake up your master "
421  "backend server (e.g. wakeonlan 00:00:00:00:00:00)."));
422  return gc;
423 };
424 
426 {
427  HostTextEditSetting *gc = new HostTextEditSetting("SleepCommand");
428  gc->setLabel(QObject::tr("Sleep command"));
429  gc->setValue("");
430  gc->setHelpText(QObject::tr("The command used to put this slave to sleep. "
431  "If set, the master backend will use this command to put "
432  "this slave to sleep when it is not needed for recording."));
433  return gc;
434 };
435 
437 {
438  HostTextEditSetting *gc = new HostTextEditSetting("WakeUpCommand");
439  gc->setLabel(QObject::tr("Wake command"));
440  gc->setValue("");
441  gc->setHelpText(QObject::tr("The command used to wake up this slave "
442  "from sleep. This setting is not used on the master "
443  "backend."));
444  return gc;
445 };
446 
448 {
449  GlobalTextEditSetting *gc = new GlobalTextEditSetting("BackendStopCommand");
450  gc->setLabel(QObject::tr("Backend stop command"));
451  gc->setValue("killall mythbackend");
452  gc->setHelpText(QObject::tr("The command used to stop the backend"
453  " when running on the master backend server "
454  "(e.g. sudo /etc/init.d/mythtv-backend stop)"));
455  return gc;
456 };
457 
459 {
460  GlobalTextEditSetting *gc = new GlobalTextEditSetting("BackendStartCommand");
461  gc->setLabel(QObject::tr("Backend start command"));
462  gc->setValue("mythbackend");
463  gc->setHelpText(QObject::tr("The command used to start the backend"
464  " when running on the master backend server "
465  "(e.g. sudo /etc/init.d/mythtv-backend start)."));
466  return gc;
467 };
468 
470 {
471  GlobalSpinBoxSetting *gc = new GlobalSpinBoxSetting("idleTimeoutSecs", 0, 1200, 5);
472  gc->setLabel(QObject::tr("Idle shutdown timeout (secs)"));
473  gc->setValue(0);
474  gc->setHelpText(QObject::tr("The number of seconds the master backend "
475  "idles before it shuts down all other backends. Set to 0 to "
476  "disable automatic shutdown."));
477  return gc;
478 };
479 
481 {
482  GlobalSpinBoxSetting *gc = new GlobalSpinBoxSetting("idleWaitForRecordingTime", 0, 300, 1);
483  gc->setLabel(QObject::tr("Maximum wait for recording (mins)"));
484  gc->setValue(15);
485  gc->setHelpText(QObject::tr("The number of minutes the master backend "
486  "waits for a recording. If the backend is idle but a "
487  "recording starts within this time period, it won't "
488  "shut down."));
489  return gc;
490 };
491 
493 {
494  GlobalSpinBoxSetting *gc = new GlobalSpinBoxSetting("StartupSecsBeforeRecording", 0, 1200, 5);
495  gc->setLabel(QObject::tr("Startup before recording (secs)"));
496  gc->setValue(120);
497  gc->setHelpText(QObject::tr("The number of seconds the master backend "
498  "will be woken up before a recording starts."));
499  return gc;
500 };
501 
503 {
504  GlobalTextEditSetting *gc = new GlobalTextEditSetting("WakeupTimeFormat");
505  gc->setLabel(QObject::tr("Wakeup time format"));
506  gc->setValue("hh:mm yyyy-MM-dd");
507  gc->setHelpText(QObject::tr("The format of the time string passed to the "
508  "'Command to set wakeup time' as $time. See "
509  "QT::QDateTime.toString() for details. Set to 'time_t' for "
510  "seconds since epoch."));
511  return gc;
512 };
513 
515 {
516  GlobalTextEditSetting *gc = new GlobalTextEditSetting("SetWakeuptimeCommand");
517  gc->setLabel(QObject::tr("Command to set wakeup time"));
518  gc->setValue("");
519  gc->setHelpText(QObject::tr("The command used to set the wakeup time "
520  "(passed as $time) for the Master Backend"));
521  return gc;
522 };
523 
525 {
526  GlobalTextEditSetting *gc = new GlobalTextEditSetting("ServerHaltCommand");
527  gc->setLabel(QObject::tr("Server halt command"));
528  gc->setValue("sudo /sbin/halt -p");
529  gc->setHelpText(QObject::tr("The command used to halt the backends."));
530  return gc;
531 };
532 
534 {
535  GlobalTextEditSetting *gc = new GlobalTextEditSetting("preSDWUCheckCommand");
536  gc->setLabel(QObject::tr("Pre-shutdown-check command"));
537  gc->setValue("");
538  gc->setHelpText(QObject::tr("A command executed before the backend would "
539  "shutdown. The return value determines if "
540  "the backend can shutdown. 0 - yes, "
541  "1 - restart idling, "
542  "2 - reset the backend to wait for a frontend."));
543  return gc;
544 };
545 
547 {
548  GlobalCheckBoxSetting *gc = new GlobalCheckBoxSetting("blockSDWUwithoutClient");
549  gc->setLabel(QObject::tr("Block shutdown before client connected"));
550  gc->setValue(true);
551  gc->setHelpText(QObject::tr("If enabled, the automatic shutdown routine will "
552  "be disabled until a client connects."));
553  return gc;
554 };
555 
557 {
558  GlobalTextEditSetting *gc = new GlobalTextEditSetting("startupCommand");
559  gc->setLabel(QObject::tr("Startup command"));
560  gc->setValue("");
561  gc->setHelpText(QObject::tr("This command is executed right after starting "
562  "the BE. As a parameter '$status' is replaced by either "
563  "'auto' if the machine was started automatically or "
564  "'user' if a user switched it on."));
565  return gc;
566 };
567 
569 {
570  HostSpinBoxSetting *gc = new HostSpinBoxSetting("JobQueueMaxSimultaneousJobs", 1, 10, 1);
571  gc->setLabel(QObject::tr("Maximum simultaneous jobs on this backend"));
572  gc->setHelpText(QObject::tr("The Job Queue will be limited to running "
573  "this many simultaneous jobs on this backend."));
574  gc->setValue(1);
575  return gc;
576 };
577 
579 {
580  HostSpinBoxSetting *gc = new HostSpinBoxSetting("JobQueueCheckFrequency", 5, 300, 5);
581  gc->setLabel(QObject::tr("Job Queue check frequency (secs)"));
582  gc->setHelpText(QObject::tr("When looking for new jobs to process, the "
583  "Job Queue will wait this many seconds between checks."));
584  gc->setValue(60);
585  return gc;
586 };
587 
589 {
590  HostComboBoxSetting *gc = new HostComboBoxSetting("JobQueueCPU");
591  gc->setLabel(QObject::tr("CPU usage"));
592  gc->addSelection(QObject::tr("Low"), "0");
593  gc->addSelection(QObject::tr("Medium"), "1");
594  gc->addSelection(QObject::tr("High"), "2");
595  gc->setHelpText(QObject::tr("This setting controls approximately how "
596  "much CPU jobs in the queue may consume. "
597  "On 'High', all available CPU time may be used, "
598  "which could cause problems on slower systems." ));
599  return gc;
600 };
601 
603 {
604  HostTimeBoxSetting *gc = new HostTimeBoxSetting("JobQueueWindowStart", "00:00");
605  gc->setLabel(QObject::tr("Job Queue start time"));
606  gc->setHelpText(QObject::tr("This setting controls the start of the "
607  "Job Queue time window, which determines when new jobs "
608  "will be started."));
609  return gc;
610 };
611 
613 {
614  HostTimeBoxSetting *gc = new HostTimeBoxSetting("JobQueueWindowEnd", "23:59");
615  gc->setLabel(QObject::tr("Job Queue end time"));
616  gc->setHelpText(QObject::tr("This setting controls the end of the "
617  "Job Queue time window, which determines when new jobs "
618  "will be started."));
619  return gc;
620 };
621 
623 {
624  GlobalCheckBoxSetting *gc = new GlobalCheckBoxSetting("JobsRunOnRecordHost");
625  gc->setLabel(QObject::tr("Run jobs only on original recording backend"));
626  gc->setValue(false);
627  gc->setHelpText(QObject::tr("If enabled, jobs in the queue will be required "
628  "to run on the backend that made the "
629  "original recording."));
630  return gc;
631 };
632 
634 {
635  GlobalCheckBoxSetting *gc = new GlobalCheckBoxSetting("AutoTranscodeBeforeAutoCommflag");
636  gc->setLabel(QObject::tr("Run transcode jobs before auto commercial "
637  "detection"));
638  gc->setValue(false);
639  gc->setHelpText(QObject::tr("If enabled, and if both auto-transcode and "
640  "commercial detection are turned ON for a "
641  "recording, transcoding will run first; "
642  "otherwise, commercial detection runs first."));
643  return gc;
644 };
645 
647 {
648  GlobalCheckBoxSetting *gc = new GlobalCheckBoxSetting("AutoCommflagWhileRecording");
649  gc->setLabel(QObject::tr("Start auto-commercial-detection jobs when the "
650  "recording starts"));
651  gc->setValue(false);
652  gc->setHelpText(QObject::tr("If enabled, and Auto Commercial Detection is "
653  "ON for a recording, the flagging job will be "
654  "started as soon as the recording starts. NOT "
655  "recommended on underpowered systems."));
656  return gc;
657 };
658 
660 {
661  GlobalTextEditSetting *gc = new GlobalTextEditSetting(QString("UserJob%1").arg(job_num));
662  gc->setLabel(QObject::tr("User Job #%1 command").arg(job_num));
663  gc->setValue("");
664  gc->setHelpText(QObject::tr("The command to run whenever this User Job "
665  "number is scheduled."));
666  return gc;
667 };
668 
670 {
671  GlobalTextEditSetting *gc = new GlobalTextEditSetting(QString("UserJobDesc%1")
672  .arg(job_num));
673  gc->setLabel(QObject::tr("User Job #%1 description").arg(job_num));
674  gc->setValue(QObject::tr("User Job #%1").arg(job_num));
675  gc->setHelpText(QObject::tr("The description for this User Job."));
676  return gc;
677 };
678 
680 {
681  HostCheckBoxSetting *gc = new HostCheckBoxSetting("JobAllowMetadata");
682  gc->setLabel(QObject::tr("Allow metadata lookup jobs"));
683  gc->setValue(true);
684  gc->setHelpText(QObject::tr("If enabled, allow jobs of this type to "
685  "run on this backend."));
686  return gc;
687 };
688 
690 {
691  HostCheckBoxSetting *gc = new HostCheckBoxSetting("JobAllowCommFlag");
692  gc->setLabel(QObject::tr("Allow commercial-detection jobs"));
693  gc->setValue(true);
694  gc->setHelpText(QObject::tr("If enabled, allow jobs of this type to "
695  "run on this backend."));
696  return gc;
697 };
698 
700 {
701  HostCheckBoxSetting *gc = new HostCheckBoxSetting("JobAllowTranscode");
702  gc->setLabel(QObject::tr("Allow transcoding jobs"));
703  gc->setValue(true);
704  gc->setHelpText(QObject::tr("If enabled, allow jobs of this type to "
705  "run on this backend."));
706  return gc;
707 };
708 
710 {
711  HostCheckBoxSetting *gc = new HostCheckBoxSetting("JobAllowPreview");
712  gc->setLabel(QObject::tr("Allow preview jobs"));
713  gc->setValue(true);
714  gc->setHelpText(QObject::tr("If enabled, allow jobs of this type to "
715  "run on this backend."));
716  return gc;
717 };
718 
720 {
721  GlobalTextEditSetting *gc = new GlobalTextEditSetting("JobQueueTranscodeCommand");
722  gc->setLabel(QObject::tr("Transcoder command"));
723  gc->setValue("mythtranscode");
724  gc->setHelpText(QObject::tr("The program used to transcode recordings. "
725  "The default is 'mythtranscode' if this setting is empty."));
726  return gc;
727 };
728 
730 {
731  GlobalTextEditSetting *gc = new GlobalTextEditSetting("JobQueueCommFlagCommand");
732  gc->setLabel(QObject::tr("Commercial-detection command"));
733  gc->setValue("mythcommflag");
734  gc->setHelpText(QObject::tr("The program used to detect commercials in a "
735  "recording. The default is 'mythcommflag' "
736  "if this setting is empty."));
737  return gc;
738 };
739 
741 {
742  QString dbStr = QString("JobAllowUserJob%1").arg(job_num);
743  QString desc = gCoreContext->GetSetting(QString("UserJobDesc%1").arg(job_num));
744  QString label = QObject::tr("Allow %1 jobs").arg(desc);
745 
746  HostCheckBoxSetting *bc = new HostCheckBoxSetting(dbStr);
747  bc->setLabel(label);
748  bc->setValue(false);
749  // FIXME:
750  // It would be nice to disable inactive jobs,
751  // but enabling them currently requires a restart of mythtv-setup
752  // after entering the job command string. Will improve this logic later:
753  // if (QString(gCoreContext->GetSetting(QString("UserJob%1").arg(job_num)))
754  // .length() == 0)
755  // bc->setEnabled(false);
756  bc->setHelpText(QObject::tr("If enabled, allow jobs of this type to "
757  "run on this backend."));
758  return bc;
759 }
760 
761 #if 0
762 static GlobalCheckBoxSetting *UPNPShowRecordingUnderVideos()
763 {
764  GlobalCheckBoxSetting *gc = new GlobalCheckBoxSetting("UPnP/RecordingsUnderVideos");
765  gc->setLabel(QObject::tr("Include recordings in video list"));
766  gc->setValue(false);
767  gc->setHelpText(QObject::tr("If enabled, the master backend will include"
768  " the list of recorded shows in the list of videos. "
769  " This is mainly to accommodate UPnP players which do not"
770  " allow more than 1 video section." ));
771  return gc;
772 };
773 #endif
774 
776 {
777  GlobalComboBoxSetting *gc = new GlobalComboBoxSetting("UPnP/WMPSource");
778  gc->setLabel(QObject::tr("Video content to show a WMP client"));
779  gc->addSelection(QObject::tr("Recordings"),"0");
780  gc->addSelection(QObject::tr("Videos"),"1");
781  gc->setValue("0");
782  gc->setHelpText(QObject::tr("Which tree to show a Windows Media Player "
783  "client when it requests a list of videos."));
784  return gc;
785 };
786 
788 {
789  GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("MythFillEnabled");
790  bc->setLabel(QObject::tr("Automatically update program listings"));
791  bc->setValue(true);
792  bc->setHelpText(QObject::tr("If enabled, the guide data program "
793  "will be run automatically."));
794  return bc;
795 }
796 
798 {
799  GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("MythFillMinHour", 0, 23, 1);
800  bs->setLabel(QObject::tr("Guide data program execution start"));
801  bs->setValue(0);
802  bs->setHelpText(QObject::tr("This setting and the following one define a "
803  "time period when the guide data program is allowed "
804  "to run. For example, setting start to 11 and "
805  "end to 13 would mean that the program would only "
806  "run between 11:00 AM and 1:59 PM."));
807  return bs;
808 }
809 
811 {
812  GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("MythFillMaxHour", 0, 23, 1);
813  bs->setLabel(QObject::tr("Guide data program execution end"));
814  bs->setValue(23);
815  bs->setHelpText(QObject::tr("This setting and the preceding one define a "
816  "time period when the guide data program is allowed "
817  "to run. For example, setting start to 11 and "
818  "end to 13 would mean that the program would only "
819  "run between 11:00 AM and 1:59 PM."));
820  return bs;
821 }
822 
824 {
825  GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("MythFillGrabberSuggestsTime");
826  bc->setLabel(QObject::tr("Run guide data program at time suggested by the "
827  "grabber."));
828  bc->setValue(true);
829  bc->setHelpText(QObject::tr("If enabled, allow a guide data "
830  "provider to specify the next download time in order "
831  "to distribute load on their servers. Guide data program "
832  "execution start/end times are also ignored."));
833  return bc;
834 }
835 
837 {
838  GlobalTextEditSetting *be = new GlobalTextEditSetting("MythFillDatabasePath");
839  be->setLabel(QObject::tr("Guide data program"));
840  be->setValue("mythfilldatabase");
841  be->setHelpText(QObject::tr(
842  "Use 'mythfilldatabase' or the name of a custom "
843  "script that will populate the program guide info "
844  "for all your video sources."));
845  return be;
846 }
847 
849 {
850  GlobalTextEditSetting *be = new GlobalTextEditSetting("MythFillDatabaseArgs");
851  be->setLabel(QObject::tr("Guide data arguments"));
852  be->setValue("");
853  be->setHelpText(QObject::tr("Any arguments you want passed to the "
854  "guide data program."));
855  return be;
856 }
857 
859 {
860  public:
862  {
863  setLabel(QObject::tr("Program Schedule Downloading Options"));
864 
865  GlobalCheckBoxSetting* fillEnabled = MythFillEnabled();
866  addChild(fillEnabled);
867 
868  fillEnabled->addTargetedChild("1", MythFillDatabasePath());
869  fillEnabled->addTargetedChild("1", MythFillDatabaseArgs());
870  fillEnabled->addTargetedChild("1", MythFillMinHour());
871  fillEnabled->addTargetedChild("1", MythFillMaxHour());
872  fillEnabled->addTargetedChild("1", MythFillGrabberSuggestsTime());
873  }
874 };
875 
877 {
878  // These two are included for backward compatibility -
879  // used by python bindings. They could be removed later
882 
883  //++ Host Address Backend Setup ++
884  GroupSetting* server = new GroupSetting();
885  server->setLabel(tr("Host Address Backend Setup"));
887  server->addChild(m_localServerPort);
888  server->addChild(LocalStatusPort());
889  server->addChild(LocalSecurityPin());
890  server->addChild(AllowConnFromAll());
891  //+++ IP Addresses +++
893  server->addChild(m_ipAddressSettings);
897  static_cast<void (StandardSetting::*)(const QString&)>(&StandardSetting::valueChanged),
900  static_cast<void (StandardSetting::*)(const QString&)>(&StandardSetting::valueChanged),
903  server->addChild(m_backendServerAddr);
904  //++ Master Backend ++
908  server->addChild(m_isMasterBackend);
910  server->addChild(m_masterServerName);
911  addChild(server);
912 
913  //++ Locale Settings ++
914  GroupSetting* locale = new GroupSetting();
915  locale->setLabel(QObject::tr("Locale Settings"));
916  locale->addChild(TVFormat());
917  locale->addChild(VbiFormat());
918  locale->addChild(FreqTable());
919  addChild(locale);
920 
921  GroupSetting* group2 = new GroupSetting();
922  group2->setLabel(QObject::tr("Miscellaneous Settings"));
923 
924  GroupSetting* fm = new GroupSetting();
925  fm->setLabel(QObject::tr("File Management Settings"));
928  fm->addChild(TruncateDeletes());
929  fm->addChild(HDRingbufferSize());
930  fm->addChild(StorageScheduler());
931  group2->addChild(fm);
932  GroupSetting* upnp = new GroupSetting();
933  upnp->setLabel(QObject::tr("UPnP Server Settings"));
934  //upnp->addChild(UPNPShowRecordingUnderVideos());
935  upnp->addChild(UPNPWmpSource());
936  group2->addChild(upnp);
937  group2->addChild(MiscStatusScript());
938  group2->addChild(DisableAutomaticBackup());
939  group2->addChild(DisableFirewireReset());
940  addChild(group2);
941 
942  GroupSetting* group2a1 = new GroupSetting();
943  group2a1->setLabel(QObject::tr("EIT Scanner Options"));
944  group2a1->addChild(EITTransportTimeout());
945  group2a1->addChild(EITCrawIdleStart());
946  addChild(group2a1);
947 
948  GroupSetting* group3 = new GroupSetting();
949  group3->setLabel(QObject::tr("Shutdown/Wakeup Options"));
950  group3->addChild(startupCommand());
951  group3->addChild(blockSDWUwithoutClient());
952  group3->addChild(idleTimeoutSecs());
955  group3->addChild(WakeupTimeFormat());
956  group3->addChild(SetWakeuptimeCommand());
957  group3->addChild(ServerHaltCommand());
958  group3->addChild(preSDWUCheckCommand());
959  addChild(group3);
960 
961  GroupSetting* group4 = new GroupSetting();
962  group4->setLabel(QObject::tr("Backend Wakeup settings"));
963 
964  GroupSetting* backend = new GroupSetting();
965  backend->setLabel(QObject::tr("Master Backend"));
967  backend->addChild(WOLbackendConnectRetry());
968  backend->addChild(WOLbackendCommand());
969  group4->addChild(backend);
970 
971  GroupSetting* slaveBackend = new GroupSetting();
972  slaveBackend->setLabel(QObject::tr("Slave Backends"));
973  slaveBackend->addChild(SleepCommand());
974  slaveBackend->addChild(WakeUpCommand());
975  group4->addChild(slaveBackend);
976  addChild(group4);
977 
978  GroupSetting* backendControl = new GroupSetting();
979  backendControl->setLabel(QObject::tr("Backend Control"));
980  backendControl->addChild(BackendStopCommand());
981  backendControl->addChild(BackendStartCommand());
982  addChild(backendControl);
983 
984  GroupSetting* group5 = new GroupSetting();
985  group5->setLabel(QObject::tr("Job Queue (Backend-Specific)"));
987  group5->addChild(JobQueueCheckFrequency());
988  group5->addChild(JobQueueWindowStart());
989  group5->addChild(JobQueueWindowEnd());
990  group5->addChild(JobQueueCPU());
991  group5->addChild(JobAllowMetadata());
992  group5->addChild(JobAllowCommFlag());
993  group5->addChild(JobAllowTranscode());
994  group5->addChild(JobAllowPreview());
995  group5->addChild(JobAllowUserJob(1));
996  group5->addChild(JobAllowUserJob(2));
997  group5->addChild(JobAllowUserJob(3));
998  group5->addChild(JobAllowUserJob(4));
999  addChild(group5);
1000 
1001  GroupSetting* group6 = new GroupSetting();
1002  group6->setLabel(QObject::tr("Job Queue (Global)"));
1003  group6->addChild(JobsRunOnRecordHost());
1005  group6->addChild(JobQueueCommFlagCommand());
1008  group6->addChild(SaveTranscoding());
1009  addChild(group6);
1010 
1011  GroupSetting* group7 = new GroupSetting();
1012  group7->setLabel(QObject::tr("Job Queue (Job Commands)"));
1013  group7->addChild(UserJobDesc(1));
1014  group7->addChild(UserJob(1));
1015  group7->addChild(UserJobDesc(2));
1016  group7->addChild(UserJob(2));
1017  group7->addChild(UserJobDesc(3));
1018  group7->addChild(UserJob(3));
1019  group7->addChild(UserJobDesc(4));
1020  group7->addChild(UserJob(4));
1021  addChild(group7);
1022 
1023  MythFillSettings *mythfill = new MythFillSettings();
1024  addChild(mythfill);
1025 
1026 }
1027 
1029 {
1030  if (!m_isLoaded)
1031  return;
1032  bool ismasterchecked = m_isMasterBackend->boolValue();
1033  if (ismasterchecked)
1035  else
1037 }
1038 
1040 {
1041  if (!m_isLoaded)
1042  return;
1043  bool addrChanged = m_backendServerAddr->haveChanged();
1044  QString currentsetting = m_backendServerAddr->getValue();
1047  {
1048  QList<QHostAddress> list = QNetworkInterface::allAddresses();
1049  QList<QHostAddress>::iterator it;
1050  for (it = list.begin(); it != list.end(); ++it)
1051  {
1052  it->setScopeId(QString());
1053  m_backendServerAddr->addSelection((*it).toString(), (*it).toString());
1054  }
1055  }
1056  else
1057  {
1062  }
1063  // Remove the blank entry that is caused by clearSelections
1064  // TODO probably not needed anymore?
1065  // m_backendServerAddr->removeSelection(QString());
1066 
1067  QHostAddress addr;
1068  if (addr.setAddress(currentsetting))
1069  {
1070  // if prior setting is an ip address
1071  // it only if it is now in the list
1072  if (m_backendServerAddr->getValueIndex(currentsetting)
1073  > -1)
1074  m_backendServerAddr->setValue(currentsetting);
1075  else
1077  }
1078  else if (! currentsetting.isEmpty())
1079  {
1080  // if prior setting was not an ip address, it must
1081  // have been a dns name so add it back and select it.
1082  m_backendServerAddr->addSelection(currentsetting);
1083  m_backendServerAddr->setValue(currentsetting);
1084  }
1085  else
1087  m_backendServerAddr->setChanged(addrChanged);
1088 }
1089 
1090 
1092 {
1093  m_isLoaded=false;
1095 
1096  // These two are included for backward compatibility - only used by python
1097  // bindings. They should be removed later
1100 
1101  QString mastername = m_masterServerName->getValue();
1102  // new installation - default to master
1103  bool newInstall=false;
1104  if (mastername.isEmpty())
1105  {
1106  mastername = gCoreContext->GetHostName();
1107  newInstall=true;
1108  }
1109  bool ismaster = (mastername == gCoreContext->GetHostName());
1110  m_isMasterBackend->setValue(ismaster);
1111  m_priorMasterName = mastername;
1112  m_isLoaded=true;
1114  listenChanged();
1115  if (!newInstall)
1116  {
1118  m_isMasterBackend->setChanged(false);
1120  }
1121 }
1122 
1124 {
1125  // Setup deprecated backward compatibility settings
1127  {
1128  QString addr = m_backendServerAddr->getValue();
1129  QString ip = gCoreContext->resolveAddress(addr);
1132  }
1133 
1134  // If listen on all is specified, set up values for the
1135  // specific IPV4 and IPV6 addresses for backward
1136  // compatibilty with other things that may use them
1138  {
1139  QString bea = m_backendServerAddr->getValue();
1140  // initialize them to localhost values
1143  QString ip4 = gCoreContext->resolveAddress
1145  QString ip6 = gCoreContext->resolveAddress
1147  // the setValue calls below only set the value if it is in the list.
1150  }
1151 
1153 
1154  // These two are included for backward compatibility - only used by python
1155  // bindings. They should be removed later
1158 }
1159 
1161 {
1162  delete m_masterServerIP;
1163  m_masterServerIP=nullptr;
1164  delete m_masterServerPort;
1165  m_masterServerPort=nullptr;
1166 }
static GlobalSpinBoxSetting * MythFillMinHour()
void Save(void) override
static GlobalTextEditSetting * UserJobDesc(uint job_num)
static GlobalTextEditSetting * ServerHaltCommand()
static HostTextEditSetting * LocalServerPort()
static GlobalSpinBoxSetting * HDRingbufferSize()
QString m_priorMasterName
static GlobalSpinBoxSetting * WOLbackendReconnectWaitTime()
static GlobalCheckBoxSetting * MythFillEnabled()
static HostTimeBoxSetting * JobQueueWindowStart()
static GlobalTextEditSetting * SetWakeuptimeCommand()
static GlobalTextEditSetting * JobQueueCommFlagCommand()
static HostTextEditSetting * WakeUpCommand()
static HostCheckBoxSetting * JobAllowMetadata()
static GlobalCheckBoxSetting * MasterBackendOverride()
static GlobalSpinBoxSetting * MythFillMaxHour()
virtual void Load(void)
static GlobalSpinBoxSetting * EITTransportTimeout()
void addSelection(const QString &label, QString value=QString(), bool select=false)
static GlobalComboBoxSetting * UPNPWmpSource()
virtual void setHelpText(const QString &str)
static GlobalComboBoxSetting * FreqTable()
static QStringList GetFormats(void)
static GlobalTextEditSetting * MasterServerPort()
void setChanged(bool changed)
unsigned int uint
Definition: compat.h:140
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
void masterBackendChanged(void)
int getValueIndex(const QString &value) const
static HostSpinBoxSetting * JobQueueMaxSimultaneousJobs()
GlobalTextEditSetting * m_masterServerName
HostComboBoxSetting * m_backendServerAddr
static GlobalTextEditSetting * MythFillDatabasePath()
static GlobalCheckBoxSetting * MythFillGrabberSuggestsTime()
const char * name
Definition: frequencies.h:102
virtual QString getValue(void) const
static GlobalTextEditSetting * BackendStartCommand()
struct CHANLISTS chanlists[]
static HostComboBoxSetting * JobQueueCPU()
void setValue(int value) override
static GlobalCheckBoxSetting * blockSDWUwithoutClient()
static HostComboBoxSetting * LocalServerIP()
virtual void setLabel(QString str)
static GlobalTextEditSetting * MythFillDatabaseArgs()
static GlobalSpinBoxSetting * idleTimeoutSecs()
static GlobalTextEditSetting * MasterServerName()
static GlobalCheckBoxSetting * DeletesFollowLinks()
QString GetSetting(const QString &key, const QString &defaultval="")
static GlobalTextEditSetting * MasterServerIP()
static GlobalCheckBoxSetting * AutoCommflagWhileRecording()
bool haveChanged()
Return true if the setting have changed or any of its children.
virtual void setEnabled(bool enabled)
static HostComboBoxSetting * LocalServerIP6()
QString resolveAddress(const QString &host, ResolveType=ResolveAny, bool keepscope=false) const
if host is an IP address, it will be returned or resolved otherwise.
virtual void addChild(StandardSetting *child)
static HostCheckBoxSetting * TruncateDeletes()
static GlobalSpinBoxSetting * WOLbackendConnectRetry()
virtual void Save(void)
static GlobalTextEditSetting * WakeupTimeFormat()
static GlobalSpinBoxSetting * idleWaitForRecordingTime()
HostComboBoxSetting * localServerIP6
static GlobalComboBoxSetting * TVFormat()
static HostCheckBoxSetting * DisableFirewireReset()
static GlobalCheckBoxSetting * JobsRunOnRecordHost()
static GlobalCheckBoxSetting * DisableAutomaticBackup()
static HostCheckBoxSetting * JobAllowTranscode()
static GlobalSpinBoxSetting * StartupSecsBeforeRecording()
static HostTimeBoxSetting * JobQueueWindowEnd()
GroupSetting()=default
static HostCheckBoxSetting * UseLinkLocal()
static GlobalTextEditSetting * JobQueueTranscodeCommand()
static GlobalComboBoxSetting * StorageScheduler()
void listenChanged(void)
static GlobalCheckBoxSetting * SaveTranscoding()
static TransMythUICheckBoxSetting * IsMasterBackend()
static GlobalComboBoxSetting * VbiFormat()
void setValue(const QString &) override
static HostCheckBoxSetting * AllowConnFromAll()
static GlobalTextEditSetting * startupCommand()
GlobalTextEditSetting * m_masterServerPort
static GlobalCheckBoxSetting * AutoTranscodeBeforeAutoCommflag()
static HostSpinBoxSetting * JobQueueCheckFrequency()
static GlobalTextEditSetting * UserJob(uint job_num)
static HostTextEditSetting * SleepCommand()
static HostCheckBoxSetting * JobAllowCommFlag()
HostComboBoxSetting * localServerIP
static HostComboBoxSetting * BackendServerAddr()
static GlobalSpinBoxSetting * EITCrawIdleStart()
HostTextEditSetting * m_localServerPort
QString GetHostName(void)
IpAddressSettings * m_ipAddressSettings
void addTargetedChild(const QString &value, StandardSetting *setting)
static GlobalTextEditSetting * preSDWUCheckCommand()
static GlobalTextEditSetting * WOLbackendCommand()
virtual void setValue(const QString &newValue)
void Load(void) override
TransMythUICheckBoxSetting * m_isMasterBackend
static HostTextEditSetting * MiscStatusScript()
static HostTextEditSetting * LocalSecurityPin()
static HostTextEditSetting * LocalStatusPort()
static HostCheckBoxSetting * JobAllowUserJob(uint job_num)
static HostCheckBoxSetting * JobAllowPreview()
GlobalTextEditSetting * m_masterServerIP
void valueChanged(const QString &)
static GlobalTextEditSetting * BackendStopCommand()