MythTV  master
zmsettings.cpp
Go to the documentation of this file.
1 /*
2  zomeminder settings.cpp
3 */
4 
5 #include <unistd.h>
6 
7 // myth
8 #include <mythcontext.h>
9 #include <mythdate.h>
10 
11 // mythzoneminder
12 #include "zmsettings.h"
13 
14 
16 {
17  HostTextEditSetting *gc = new HostTextEditSetting("ZoneMinderServerIP");
18  gc->setLabel(ZMSettings::tr("IP address of the MythZoneMinder server"));
19  gc->setValue("127.0.0.1");
20  gc->setHelpText(ZMSettings::tr("Enter the IP address of the MythZoneMinder "
21  "server that this frontend should connect "
22  "to."));
23  return gc;
24 };
25 
27 {
28  HostTextEditSetting *gc = new HostTextEditSetting("ZoneMinderServerPort");
29  gc->setLabel(ZMSettings::tr("Port the server runs on"));
30  gc->setValue("6548");
31  gc->setHelpText(ZMSettings::tr("Unless you've got good reason to, don't "
32  "change this."));
33  return gc;
34 };
35 
37 {
38  HostComboBoxSetting *gc = new HostComboBoxSetting("ZoneMinderDateFormat");
39  gc->setLabel(ZMSettings::tr("Date format"));
40 
41  QDate sampdate = MythDate::current().toLocalTime().date();
42  QString sampleStr = ZMSettings::tr("Samples are shown using today's date.");
43 
44  if (sampdate.month() == sampdate.day())
45  {
46  sampdate = sampdate.addDays(1);
47  sampleStr = ZMSettings::tr("Samples are shown using tomorrow's date.");
48  }
49 
50  gc->addSelection(sampdate.toString("ddd - dd/MM"), "ddd - dd/MM");
51  gc->addSelection(sampdate.toString("ddd MMM d"), "ddd MMM d");
52  gc->addSelection(sampdate.toString("ddd MMMM d"), "ddd MMMM d");
53  gc->addSelection(sampdate.toString("MMM d"), "MMM d");
54  gc->addSelection(sampdate.toString("MM/dd"), "MM/dd");
55  gc->addSelection(sampdate.toString("MM.dd"), "MM.dd");
56  gc->addSelection(sampdate.toString("ddd d MMM"), "ddd d MMM");
57  gc->addSelection(sampdate.toString("M/d/yyyy"), "M/d/yyyy");
58  gc->addSelection(sampdate.toString("dd.MM.yyyy"), "dd.MM.yyyy");
59  gc->addSelection(sampdate.toString("yyyy-MM-dd"), "yyyy-MM-dd");
60  gc->addSelection(sampdate.toString("ddd MMM d yyyy"), "ddd MMM d yyyy");
61  gc->addSelection(sampdate.toString("ddd yyyy-MM-dd"), "ddd yyyy-MM-dd");
62  gc->addSelection(sampdate.toString("ddd d MMM yyyy"), "ddd d MMM yyyy");
63  gc->addSelection(sampdate.toString("ddd dd MMM yyyy"), "ddd dd MMM yyyy");
64 
65  //: %1 gives additional info on the date used
66  gc->setHelpText(ZMSettings::tr("Your preferred date format to use on the "
67  "events screens. %1")
68  .arg(sampleStr));
69  return gc;
70 }
71 
73 {
74  HostComboBoxSetting *gc = new HostComboBoxSetting("ZoneMinderTimeFormat");
75  gc->setLabel(ZMSettings::tr("Time format"));
76 
77  QTime samptime = QTime::currentTime();
78 
79  gc->addSelection(samptime.toString("hh:mm AP"), "hh:mm AP");
80  gc->addSelection(samptime.toString("hh:mm"), "hh:mm");
81  gc->addSelection(samptime.toString("hh:mm:ss"), "hh:mm:ss");
82 
83  gc->setHelpText(ZMSettings::tr("Your preferred time format to display "
84  "on the events screens."));
85  return gc;
86 }
87 
89 {
90  setLabel(tr("MythZoneMinder Settings"));
95 }
static HostComboBoxSetting * ZMDateFormat()
Definition: zmsettings.cpp:36
void addSelection(const QString &label, QString value=QString(), bool select=false)
virtual void setHelpText(const QString &str)
static HostTextEditSetting * ZMServerIP()
Definition: zmsettings.cpp:15
static HostComboBoxSetting * ZMTimeFormat()
Definition: zmsettings.cpp:72
virtual void setLabel(QString str)
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
Definition: mythdate.cpp:10
virtual void addChild(StandardSetting *child)
virtual void setValue(const QString &newValue)
static HostTextEditSetting * ZMServerPort()
Definition: zmsettings.cpp:26