00001
00002
00003
00004
00005 #include <unistd.h>
00006
00007
00008 #include <mythcontext.h>
00009
00010
00011 #include "zmsettings.h"
00012
00013
00014 static HostLineEdit *ZMServerIP()
00015 {
00016 HostLineEdit *gc = new HostLineEdit("ZoneMinderServerIP");
00017 gc->setLabel(QObject::tr("IP address of the MythZoneMinder server"));
00018 gc->setValue("127.0.0.1");
00019 gc->setHelpText(QObject::tr("Enter the IP address of the MythZoneMinder server "
00020 "that this frontend should connect to."));
00021 return gc;
00022 };
00023
00024 static HostLineEdit *ZMServerPort()
00025 {
00026 HostLineEdit *gc = new HostLineEdit("ZoneMinderServerPort");
00027 gc->setLabel(QObject::tr("Port the server runs on"));
00028 gc->setValue("6548");
00029 gc->setHelpText(QObject::tr("Unless you've got good reason to, don't "
00030 "change this."));
00031 return gc;
00032 };
00033
00034 static HostComboBox *ZMDateFormat()
00035 {
00036 HostComboBox *gc = new HostComboBox("ZoneMinderDateFormat");
00037 gc->setLabel(QObject::tr("Date format"));
00038
00039 QDate sampdate = QDate::currentDate();
00040 QString sampleStr =
00041 QObject::tr("Samples are shown using today's date.");
00042
00043 if (sampdate.month() == sampdate.day())
00044 {
00045 sampdate = sampdate.addDays(1);
00046 sampleStr =
00047 QObject::tr("Samples are shown using tomorrow's date.");
00048 }
00049
00050 gc->addSelection(sampdate.toString("ddd - dd/MM"), "ddd - dd/MM");
00051 gc->addSelection(sampdate.toString("ddd MMM d"), "ddd MMM d");
00052 gc->addSelection(sampdate.toString("ddd MMMM d"), "ddd MMMM d");
00053 gc->addSelection(sampdate.toString("MMM d"), "MMM d");
00054 gc->addSelection(sampdate.toString("MM/dd"), "MM/dd");
00055 gc->addSelection(sampdate.toString("MM.dd"), "MM.dd");
00056 gc->addSelection(sampdate.toString("ddd d MMM"), "ddd d MMM");
00057 gc->addSelection(sampdate.toString("M/d/yyyy"), "M/d/yyyy");
00058 gc->addSelection(sampdate.toString("dd.MM.yyyy"), "dd.MM.yyyy");
00059 gc->addSelection(sampdate.toString("yyyy-MM-dd"), "yyyy-MM-dd");
00060 gc->addSelection(sampdate.toString("ddd MMM d yyyy"), "ddd MMM d yyyy");
00061 gc->addSelection(sampdate.toString("ddd yyyy-MM-dd"), "ddd yyyy-MM-dd");
00062 gc->addSelection(sampdate.toString("ddd dd MMM yyyy"), "ddd dd MMM yyyy");
00063 gc->setHelpText(QObject::tr("Your preferred date format to use on the events screens.")
00064 + " " + sampleStr);
00065 return gc;
00066 }
00067
00068 static HostComboBox *ZMTimeFormat()
00069 {
00070 HostComboBox *gc = new HostComboBox("ZoneMinderTimeFormat");
00071 gc->setLabel(QObject::tr("Time format"));
00072
00073 QTime samptime = QTime::currentTime();
00074
00075 gc->addSelection(samptime.toString("hh:mm AP"), "hh:mm AP");
00076 gc->addSelection(samptime.toString("hh:mm"), "hh:mm");
00077 gc->addSelection(samptime.toString("hh:mm:ss"), "hh:mm:ss");
00078
00079 gc->setHelpText(QObject::tr("Your preferred time format to display "
00080 "on the events screens."));
00081 return gc;
00082 }
00083
00084 ZMSettings::ZMSettings()
00085 {
00086 VerticalConfigurationGroup* vcg1 = new VerticalConfigurationGroup(false);
00087 vcg1->setLabel(QObject::tr("MythZoneMinder Settings"));
00088 vcg1->addChild(ZMServerIP());
00089 vcg1->addChild(ZMServerPort());
00090 vcg1->addChild(ZMDateFormat());
00091 vcg1->addChild(ZMTimeFormat());
00092 addChild(vcg1);
00093 }