diff options
Diffstat (limited to 'abs/core/mythinstall/MythVantage-app/mythinstall/installsettings.cpp')
-rwxr-xr-x | abs/core/mythinstall/MythVantage-app/mythinstall/installsettings.cpp | 4910 |
1 files changed, 4910 insertions, 0 deletions
diff --git a/abs/core/mythinstall/MythVantage-app/mythinstall/installsettings.cpp b/abs/core/mythinstall/MythVantage-app/mythinstall/installsettings.cpp new file mode 100755 index 0000000..2e505f1 --- /dev/null +++ b/abs/core/mythinstall/MythVantage-app/mythinstall/installsettings.cpp @@ -0,0 +1,4910 @@ +//_include <mythcontext.h> +#include <unistd.h> +#include <stdio.h> +#include <QtNetwork> + + +//Added by qt3to4: +#include <Q3TextStream> +//#include "tv.h" +#include <stdlib.h> +#include "mythprogressdialog.h" +#include "mythsystemlegacy.h" + +#include "xorgsettings.h" +#include "password_manage.h" +#include "misc_settings.h" +#include "infrared.h" +#include "supplemental.h" +#include "vnc.h" +#include "fileshare.h" + + + +int timezone_unknown = FALSE; +extern HostParms hostparm; +//extern DDCinfo ddcinfo; + + + +bool displaymysqlonly = false ; +bool displayshownetwork =false ; +bool displayshowhostype = false ; +bool displayshowmisc =false ; +bool displayshowshutdown =false ; +bool displayshowadvanced = false; +bool displayshowsound = false ; +bool displayshowadvancedX = false; +bool displayaccesscontrol= false; +bool displayplugins = false; +bool displaysoftware = false; +bool displayuser = false; +bool displaywebuser = false; +bool displayddns = false; +bool displayinfrared = false; +bool displayscreensaver = false; +//bool install_hobbit = false; +bool displaysupplemental = false; +bool displayremotesonly = false; +bool displayvnc = false; +bool displayfileshare = false; + + +static HostComboBox *ThemePainter() +{ + HostComboBox *gc = new HostComboBox("ThemePainter"); + gc->setLabel(QObject::tr("Paint Engine")); + gc->addSelection(QObject::tr("Qt"), "qt"); + gc->addSelection(QObject::tr("OpenGL"), "opengl"); + gc->setHelpText(QObject::tr("This selects what Myth uses to draw. If you have decent hardware, select OpenGL. Changing this requires a restart.")); + return gc; + +} + + +static HostLineEdit *HostDDnslogin() +{ + HostLineEdit *gc = new HostLineEdit("HostDDnslogin"); + gc->setLabel(QObject::tr("Login")); + gc->setValue(""); + gc->setHelpText(QObject::tr("Login for DDNS account.")); + return gc; +}; + +static HostLineEdit *HostDDnspassword() +{ + HostLineEdit *gc = new HostLineEdit("HostDDnspassword"); + gc->setLabel(QObject::tr("Password")); + gc->setValue(""); + gc->SetPasswordEcho(true); + gc->setHelpText(QObject::tr("Password for DDNS account.")); + return gc; +}; + +static HostLineEdit *HostDDnshostname() +{ + HostLineEdit *gc = new HostLineEdit("HostDDnshostname"); + gc->setLabel(QObject::tr("DDNS hostname")); + gc->setValue(""); + gc->setHelpText(QObject::tr("Hostname used for DDNS.")); + return gc; +}; + +static HostCheckBox *HostDDnsEnable() +{ + HostCheckBox *gc = new HostCheckBox("HostDDnsEnable"); + gc->setLabel(QObject::tr("Enable DDNS")); + gc->setValue(false); + gc->setHelpText(QObject::tr("Update DDNS records at dyndns.com. Visit http://dyndns.com to setup your account.")); + return gc; +}; + +class DDnssettings: public TriggeredConfigurationGroup { +public: + DDnssettings(): + TriggeredConfigurationGroup(false,false,false,false) { + setLabel(QObject::tr("DDNS Settings")); + SetVertical(true); + Setting* trigger = HostDDnsEnable() ; + addChild(trigger); + setTrigger(trigger); + + ConfigurationGroup* settings = new VerticalConfigurationGroup(false,false,false,false); + settings->addChild(HostDDnshostname()); + settings->addChild(HostDDnslogin()); + settings->addChild(HostDDnspassword()); + + addTarget("0", new VerticalConfigurationGroup(false, false)); + addTarget("1", settings); + }; +}; + + + +QString findnet() +{ + + QString netdev=""; + //QString netdev="eth0 eth1 wlan0 wlan1 ath0 "; + //QString netdev="eth0 eth1"; + QList<QNetworkInterface> ifaces = QNetworkInterface::allInterfaces(); + for (int i = 0; i < ifaces.count(); ++i) + { + netdev+=ifaces[i].name(); + } + return netdev; +} + +/* + system("/sbin/ifconfig -a > /tmp/.netinfo"); + QString line; + QFile file("/tmp/.netinfo"); + if ( file.open(QIODevice::ReadOnly | QIODevice::Text) ) + { + Q3TextStream t( &file ); // use a text stream + while ( !t.eof() ) + { + line = t.readLine(); + if ( line.contains("HWaddr")) + { + QString s = line.simplifyWhiteSpace(); + s = s.section( " ", 0, 0 ); // s == "surname" + netdev+=s; + netdev+=" "; + } + } + file.close(); + } + return netdev;*/ +//} + +QString findnet_wireless() +{ + + QString netdev=""; +//QString netdev="eth0 eth1 wlan0 wlan1 ath0 "; + system("/usr/sbin/iwconfig > /tmp/.netinfo_wireless"); + QString line; + QFile file("/tmp/.netinfo_wireless"); + if ( file.open(QIODevice::ReadOnly | QIODevice::Text) ) + { + Q3TextStream t( &file ); // use a text stream + while ( !t.eof() ) + { + line = t.readLine(); + if ( line.contains("Nickname") || line.contains("ESSID")) + { + QString s = line.simplifyWhiteSpace(); + s = s.section( " ", 0, 0 ); // s == "surname" + netdev+=s; + netdev+=" "; + } + } + file.close(); + } + return netdev; +} + +static HostComboBox *HostNetDevice() +{ + HostComboBox *gc = new HostComboBox("HostNetDevice"); + gc->setLabel(QObject::tr("Device")); + QString foundnet=findnet(); + + if (foundnet.contains(hostparm.ThisHostnetOLD)) + { + QString s = "HostActiveonboot"; + s+=hostparm.ThisHostnetOLD; + gCoreContext->SaveSetting(s, hostparm.ThisHostnetActiveOLD ); + } + + if (foundnet.contains("eth0")) + gc->addSelection("eth0"); + + if (foundnet.contains("eth1")) + gc->addSelection("eth1"); + + if (foundnet.contains("wlan0")) + gc->addSelection("wlan0"); + + if (foundnet.contains("wlan1")) + gc->addSelection("wlan1"); + + if (foundnet.contains("ath0")) + gc->addSelection("ath0"); + + int findoldnetdevice=gc->findSelection(hostparm.ThisHostnetOLD); + gc->setValue(findoldnetdevice); + + + + gc->setHelpText(QObject::tr("Network interface")); + return gc; +}; + + +static HostCheckBox *HostActiveonboot() +{ + HostCheckBox *gc = new HostCheckBox("HostActiveonboot"); + gc->setLabel(QObject::tr("Device is active on boot")); + gc->setValue(false); + gc->setHelpText(QObject::tr("Network is started on boot")); + return gc; +}; + +/* +static HostCheckBox *HostServiceSamba() +{ + HostCheckBox *gc = new HostCheckBox("HostServiceSamba"); + gc->setLabel(QObject::tr("Windows sharing")); + gc->setValue(false); + gc->setHelpText(QObject::tr("Allow window machines to access recorded files")); + return gc; +}; + +static HostCheckBox *HostServiceSamba_write() +{ + HostCheckBox *gc = new HostCheckBox("HostServiceSamba_write"); + gc->setLabel(QObject::tr("Readonly")); + gc->setValue(false); + gc->setHelpText(QObject::tr("If checked, all remote connections will be read only. If not checked then remote clients will have write and delete abilites. ")); + return gc; +}; + + +static HostCheckBox *HostServiceSamba_writehome() +{ + HostCheckBox *gc = new HostCheckBox("HostServiceSamba_writehome"); + gc->setLabel(QObject::tr("Readonly")); + gc->setValue(false); + gc->setHelpText(QObject::tr("If checked, all remote connections will be read only. If not checked then remote clients will have write and delete abilites. ")); + return gc; +}; + +static HostCheckBox *HostServiceSamba_media() +{ + HostCheckBox *gc = new HostCheckBox("HostServiceSamba_media"); + gc->setLabel(QObject::tr("share media")); + gc->setValue(true); + gc->setHelpText(QObject::tr(" ")); + return gc; +}; + +static HostCheckBox *HostServiceSamba_home() +{ + HostCheckBox *gc = new HostCheckBox("HostServiceSamba_home"); + gc->setLabel(QObject::tr("share home")); + gc->setValue(true); + gc->setHelpText(QObject::tr(" ")); + return gc; +}; + + + +static HostComboBox *HostServiceSamba_domain() +{ + HostComboBox *gc = new HostComboBox("HostServiceSamba_domain",true); + gc->setLabel(QObject::tr("Workgroup")); + gc->setHelpText(QObject::tr("Workgroup for smb share")); + gc->addSelection("WORKGROUP"); + QString currentitem; + QString line; + QFile file("/tmp/smbdomainlist"); + if ( file.open(QIODevice::ReadOnly | QIODevice::Text) ) + { + Q3TextStream t( &file ); // use a text stream + while ( !t.eof() ) + { + line = t.readLine(); + if ( line.startsWith("domain")) + { + currentitem = line.section( " ", 1, 1 ); + if ( currentitem != "-" ) + gc->addSelection(currentitem); + } + } + file.close(); + } + gc->addSelection("type_workgroup_here"); + return gc; +};*/ + +static HostCheckBox *HostLircWait() +{ + HostCheckBox *gc = new HostCheckBox("HostLircWait"); + gc->setLabel(QObject::tr("Wait for lirc")); + gc->setValue(false); + gc->setHelpText(QObject::tr("System will wait for lirc before starting the UI ")); + return gc; +}; + +static HostCheckBox *HostBEWait() +{ + HostCheckBox *gc = new HostCheckBox("HostBEWait"); + gc->setLabel(QObject::tr("Delay starting mythfrontend until mythbackend is running")); + gc->setValue(true); + gc->setHelpText(QObject::tr("The system will check if mythbackend is online before starting mythfrontend. This will avoid connection errors and configuration screens.")); + return gc; +}; + + + +// static HostComboBox *HostEvrouterConfig() +// { +// HostComboBox *gc = new HostComboBox("HostEvrouterConfig",true); +// gc->setLabel(QObject::tr("Key Configuration")); +// gc->setHelpText(QObject::tr("Choose the key definations that will be used by the event router")); +// QString dirtxt; +// dirtxt=MV_ROOT; +// dirtxt.append("templates/evrouter"); +// QDir evrouter(dirtxt); +// +// evrouter.setSorting(QDir::Name | QDir::IgnoreCase); +// QFileInfoList fil = evrouter.entryInfoList(QDir::Dirs); +// for( QFileInfoList::iterator it = fil.begin(); +// it != fil.end(); +// ++it ) +// { +// QFileInfo ¤titem = *it; +// //JM VERBOSE(VB_IMPORTANT, currentitem.fileName()); +// if ( currentitem.fileName() != ".." && currentitem.fileName() != "." && currentitem.fileName() != "") +// { +// gc->addSelection(currentitem.fileName()); +// } +// } +// gc->addSelection("tinker"); +// return gc; +// }; + + +// static HostCheckBox *HostServiceNFS() +// { +// HostCheckBox *gc = new HostCheckBox("HostServiceNFS"); +// gc->setLabel(QObject::tr("Standard file sharing")); +// gc->setValue(true); +// gc->setHelpText(QObject::tr("Allow all machines to access recorded files with nfs")); +// return gc; +// }; + + +static HostCheckBox *HostServiceMythWEB() +{ + HostCheckBox *gc = new HostCheckBox("HostServiceMythWEB"); + gc->setLabel(QObject::tr("Enable MythWeb")); + gc->setValue(false); + gc->setHelpText(QObject::tr("Allow MythTV scheduling using a web browser.")); + return gc; +}; + +// static HostCheckBox *HostServiceHobbitclient() +// { +// HostCheckBox *gc = new HostCheckBox("HostServiceHobbitclient"); +// gc->setLabel(QObject::tr("Hobbit-client")); +// gc->setValue(false); +// gc->setHelpText(QObject::tr("Report stats and other stuff to the master backend")); +// return gc; +// }; +// +// static GlobalCheckBox *GlobalServiceHobbitserver() +// { +// GlobalCheckBox *gc = new GlobalCheckBox("GlobalServiceHobbitserver"); +// gc->setLabel(QObject::tr("Hobbit-server")); +// gc->setValue(true); +// gc->setHelpText(QObject::tr("Run the hobbit server to collect stats and other stuff")); +// return gc; +// }; + + +// static HostCheckBox *HostServiceRRD() +// { +// HostCheckBox *gc = new HostCheckBox("HostServiceRRD"); +// gc->setLabel(QObject::tr("rrd_stats")); +// gc->setValue(false); +// gc->setHelpText(QObject::tr("Collect stats and create graphs of various system resources.")); +// return gc; +// }; + +static HostCheckBox *HostUseDHCP() +{ + HostCheckBox *gc = new HostCheckBox("HostUseDHCP"); + gc->setLabel(QObject::tr("Static ip address")); + gc->setValue(false); + gc->setHelpText(QObject::tr("Enable to use a static ip address, otherwise dhcp will be used.")); + return gc; +}; + +static HostCheckBox *HostRunDHCP() +{ + HostCheckBox *gc = new HostCheckBox("HostRunDHCP"); + gc->setLabel(QObject::tr("DHCP Server")); + gc->setValue(false); + gc->setHelpText(QObject::tr("Only one DHCP server should run on a network. Leave this unchecked if you are not sure.")); + return gc; +}; + +// static HostCheckBox *HostRunEvrouter() +// { +// HostCheckBox *gc = new HostCheckBox("HostRunEvrouter"); +// gc->setLabel(QObject::tr("Use evrouter")); +// gc->setValue(false); +// gc->setHelpText(QObject::tr("Evrouter will run custom actions, based on the user defined events.")); +// return gc; +// }; + +static HostCheckBox *HostUsemythfrontend() +{ + HostCheckBox *gc = new HostCheckBox("HostUseMythWelcome"); + gc->setLabel(QObject::tr("Run MythWelcome")); + gc->setValue(false); + gc->setHelpText(QObject::tr("If checked mythwelcome will be started instead of mythfrontend.")); + return gc; +}; + +static HostCheckBox *HostRunFrontend() +{ + HostCheckBox *gc = new HostCheckBox("HostRunFrontend"); + gc->setLabel(QObject::tr("Run Frontend")); + gc->setValue(true); + gc->setHelpText(QObject::tr("If checked the frontend X windows GUI will start. Most people will want this checked. Disable the frontend if you want the system to run without a display connected.")); + return gc; +}; + + +static HostComboBox *HostMysqlserverip_listbox() +{ + HostComboBox *gc = new HostComboBox("HostMysqlServer",true); + gc->setLabel(QObject::tr("Mysql server")); + + QString currentitem; + QString prevline; + QString line; + QFile file("/tmp/mysqllist"); + if ( file.open(QIODevice::ReadOnly | QIODevice::Text) ) + { + Q3TextStream t( &file ); // use a text stream + while ( !t.eof() ) + { + line = t.readLine(); + if ( line.startsWith(" address")) + { + currentitem = line.section( " ", 5, 5 ); + currentitem = currentitem.section( "[" , 1,1 ); + currentitem = currentitem.section( "]" , 0, 0 ); + + currentitem = currentitem + "\t" + prevline.section( " ",5,5 ); + gc->addSelection(currentitem); + } + prevline = line; + } + file.close(); + //system ("rm -f /tmp/mysqllist"); + } + gc->addSelection("Manual: type ip here"); + gc->setHelpText(QObject::tr("")); + + QString NETBOOT = getenv("NETBOOT"); + NETBOOT=NETBOOT.stripWhiteSpace(); + if ( NETBOOT != "YES" ) + { + if ( ((gCoreContext->GetSetting("HostaccesshostypeSystemtype")) == "0" )) + gc->setEnabled(false); + } + + return gc; +} + + + +static HostCheckBox *HostRemoteBackup() +{ + HostCheckBox *gc = new HostCheckBox("HostRemoteBackup"); + gc->setLabel(QObject::tr("Remote Backup")); + gc->setValue(false); + gc->setHelpText(QObject::tr("Copy the system backup file to another directory or host.")); + return gc; +}; + + +static HostComboBox *HostRemoteBackupDir() +{ + QString tempItem; + HostComboBox *gc = new HostComboBox("HostRemoteBackupDir",true); + gc->setLabel(QObject::tr(" Dir or Host" )); + gc->addSelection("dir:/data/storage/disk0"); + MSqlQuery query(MSqlQuery::InitCon()); + + + query.prepare( "SELECT DISTINCT hostname from settings where hostname is not null and not (hostname=:HOSTNAME);"); + query.bindValue( ":HOSTNAME" , gCoreContext->GetHostName() ); + if (query.exec() && query.isActive() && query.size() > 0) + { + while (query.next()) + { + tempItem = query.value(0).toString(); + gc->addSelection(tempItem); + } + } + + gc->setHelpText(QObject::tr("Remote host that will receive a copy of the backup file. To copy the file to a local dir instead of a remote host use dir:/backup_dir_name")); + + return gc; +}; + +class Backupsettings: public TriggeredConfigurationGroup { +public: + Backupsettings(): + TriggeredConfigurationGroup(false, false, true, true,false, false, true, true) { + SetVertical(false); + setLabel(QObject::tr("Backup Settings")); + Setting* trigger = HostRemoteBackup(); + addChild(trigger); + setTrigger(trigger); + ConfigurationGroup* settings = new VerticalConfigurationGroup(false,false); + settings->addChild(HostRemoteBackupDir()); + + addTarget("0", new VerticalConfigurationGroup(false, false)); + addTarget("1", settings); + + }; +}; + + + +// static HostCheckBox *HostPKG_MIRROR() +// { +// HostCheckBox *gc = new HostCheckBox("HostPKG_MIRROR"); +// gc->setLabel(QObject::tr("Use Local mirror")); +// gc->setValue(false); +// gc->setHelpText(QObject::tr("Master Backend will be used as the repo source.")); +// return gc; +// }; + +// static GlobalCheckBox *GlobalPKG_MIRROR() +// { +// GlobalCheckBox *gc = new GlobalCheckBox("GlobalPKG_MIRROR"); +// gc->setLabel(QObject::tr("Local mirror")); +// gc->setValue(false); +// gc->setHelpText(QObject::tr("Keep a local copy of the packages. Allow other frontends to install from the local copy.")); +// return gc; +// }; + + + +static HostCheckBox *HostncidClient() +{ + HostCheckBox *gc = new HostCheckBox("HostncidClient"); + gc->setLabel(QObject::tr("Show CallerID")); + gc->setValue(false); + gc->setHelpText(QObject::tr("Show CallerID popup. The backend must be running the CallerID program.")); + return gc; +}; + +static HostCheckBox *HostncidDaemon() +{ + HostCheckBox *gc = new HostCheckBox("HostncidDaemon"); + gc->setLabel(QObject::tr("Run CallerID")); + gc->setValue(false); + gc->setHelpText(QObject::tr("Run daemon to collect CallerID information.")); + return gc; +}; + +static HostComboBox *HostSerialPortncid() +{ + HostComboBox *gc = new HostComboBox("HostSerialPortncid",false); + gc->setLabel(QObject::tr("Serial Port")); + gc->addSelection("ttyS0"); + gc->addSelection("ttyS1"); + gc->addSelection("ttyS2"); + gc->addSelection("ttyS3"); + gc->addSelection("ttyACM0"); + gc->setHelpText(QObject::tr("Serial port where callerid capable modem is connected")); + return gc; +} + +static HostCheckBox *HostNcidDeviceNetCallerID() +{ + HostCheckBox *gc = new HostCheckBox("HostNcidDeviceNetCallerID"); + gc->setLabel(QObject::tr("Using a NetCallerID")); + gc->setValue(false); + gc->setHelpText(QObject::tr("Instead of a typical modem, the serial device is a NetCallerID")); + return gc; +}; + + +static HostCheckBox *Hostbootsplash() +{ + HostCheckBox *gc = new HostCheckBox("Hostbootsplash"); + gc->setLabel(QObject::tr("Enable Boot Splash")); + gc->setValue(false); + gc->setHelpText(QObject::tr("Covers up boot messages with LinHES logo.")); + return gc; +}; + +//-------------------------------------screensaver settings------------------- + +static HostComboBox *HostScreensaverType() +{ + HostComboBox *gc = new HostComboBox("HostScreensaverType"); + gc->setLabel(QObject::tr("Screensaver Program")); + gc->addSelection("xscreensaver"); + //gc->addSelection("gscreensaver"); + gc->addSelection("none"); + gc->addSelection("tinker"); + gc->setHelpText(QObject::tr("Set the screensaver program.")); + gc->setValue("none"); + return gc; +}; + +static HostSpinBox *HostScreensaverIdle() +{ + HostSpinBox *gc = new HostSpinBox("HostScreensaverIdle", 5, 60, 1, true); + gc->setLabel(QObject::tr("Idle Time")); + gc->setValue(5); + gc->setHelpText(QObject::tr("Number of minutes to wait before starting the screensaver." )); + return gc; +} + +static HostCheckBox *HostScreensaverBlank() +{ + HostCheckBox *gc = new HostCheckBox("HostScreensaverBlank"); + gc->setLabel(QObject::tr("Blank")); + gc->setValue(false); + gc->setHelpText(QObject::tr("Blank the screen instead of using a screensaver")); + return gc; +}; + +static HostCheckBox *HostScreensaverRandom() +{ + HostCheckBox *gc = new HostCheckBox("HostScreensaverRandom"); + gc->setLabel(QObject::tr("Random")); + gc->setValue(false); + gc->setHelpText(QObject::tr("Use a random screensaver.")); + return gc; +}; + + + +static HostComboBox *HostGScreensaverTheme() +{ + HostComboBox *gc = new HostComboBox("HostGScreensaverTheme"); + gc->setLabel(QObject::tr("Screensaver")); + gc->setHelpText(QObject::tr("Screen saver program to use.")); + QString line; + QString dirtxt=MV_ROOT; + dirtxt.append("templates/gscreensavers"); + QFile file(dirtxt); + if ( file.open(QIODevice::ReadOnly | QIODevice::Text) ) + { + Q3TextStream t( &file ); // use a text stream + while ( !t.eof() ) + { + line = t.readLine(); + gc->addSelection(line); + } + file.close(); + } + return gc; +}; + +static HostComboBox *HostXScreensaverTheme() +{ + HostComboBox *gc = new HostComboBox("HostXScreensaverTheme"); + gc->setLabel(QObject::tr("Screensaver")); + gc->setHelpText(QObject::tr("Screensaver to display.")); + QString dirtxt; + dirtxt=MV_ROOT; + dirtxt.append("templates/xscreensavers"); + //read in from a file. + QString line; + QFile file(dirtxt); + if ( file.open(QIODevice::ReadOnly | QIODevice::Text) ) + { + Q3TextStream t( &file ); // use a text stream + while ( !t.eof() ) + { + line = t.readLine(); + gc->addSelection(line); + } + file.close(); + } + return gc; +}; + +class Screensaverhostsettings: public TriggeredConfigurationGroup { +public: + Screensaverhostsettings(): + + TriggeredConfigurationGroup() { + SetVertical(true); + setLabel(QObject::tr("Screensaver Settings")); + Setting* trigger = HostScreensaverType() ; + addChild(trigger); + setTrigger(trigger); + ConfigurationGroup* screensaversettings = new GridConfigurationGroup(2); + screensaversettings->addChild(HostScreensaverBlank()); + screensaversettings->addChild(HostScreensaverRandom()); + + ConfigurationGroup* xscreensaversettings = new VerticalConfigurationGroup(); + xscreensaversettings->addChild(screensaversettings); + xscreensaversettings->addChild(HostScreensaverIdle()); + xscreensaversettings->addChild(HostXScreensaverTheme()); + + + ConfigurationGroup* gscreensaversettings = new VerticalConfigurationGroup(); + gscreensaversettings->addChild(screensaversettings); + gscreensaversettings->addChild(HostScreensaverIdle()); + gscreensaversettings->addChild(HostGScreensaverTheme()); + + + + addTarget("tinker", new VerticalConfigurationGroup(false, false)); + addTarget("none", new VerticalConfigurationGroup(false, false)); + addTarget("gscreensaver", gscreensaversettings); + addTarget("xscreensaver", xscreensaversettings); + }; +}; + + + + +//-------------------------------------access setting---------------------- + +static HostCheckBox *Hostaccessnetwork() +{ + HostCheckBox *gc = new HostCheckBox("Hostaccessnetwork"); + gc->setLabel(QObject::tr("Network")); + gc->setValue(false); + gc->setHelpText(QObject::tr("Control access to Network Settings. Checked means the screen is enabled.")); + return gc; +}; + +static HostCheckBox *Hostaccesshostype() +{ + HostCheckBox *gc = new HostCheckBox("Hostaccesshostype"); + gc->setLabel(QObject::tr("Host")); + gc->setValue(true); + gc->setHelpText(QObject::tr("Control access to Host Settings. Checked means the screen is enabled.")); + return gc; +}; + +static HostCheckBox *HostaccesshostypeSystemtype() +{ + HostCheckBox *gc = new HostCheckBox("HostaccesshostypeSystemtype"); + gc->setLabel(QObject::tr("Change System Type")); + gc->setValue(false); + gc->setHelpText(QObject::tr("Ability to change the System Type in Host Settings. Checked means the screen is enabled.")); + return gc; +}; + +static HostCheckBox *Hostaccessmisc() +{ + HostCheckBox *gc = new HostCheckBox("Hostaccessmisc"); + gc->setLabel(QObject::tr("Miscellanous")); + gc->setValue(true); + gc->setHelpText(QObject::tr("Control access to Miscellanous Settings. Checked means the screen is enabled.")); + return gc; +}; + +static HostCheckBox *Hostaccesssleep() +{ + HostCheckBox *gc = new HostCheckBox("Hostaccesssleep"); + gc->setLabel(QObject::tr("Shutdown")); + gc->setValue(true); + gc->setHelpText(QObject::tr("Control access to Shutdown Settings. Checked means the screen is enabled.")); + return gc; +}; + +static HostCheckBox *Hostaccessadvanced() +{ + HostCheckBox *gc = new HostCheckBox("Hostaccessadvanced"); + gc->setLabel(QObject::tr("Advanced")); + gc->setValue(true); + gc->setHelpText(QObject::tr("Control access to Advanced Settings. Checked means the screen is enabled. ")); + return gc; +}; + +static HostCheckBox *HostaccessadvancedX() +{ + HostCheckBox *gc = new HostCheckBox("HostaccessadvancedX"); + gc->setLabel(QObject::tr("Display")); + gc->setValue(true); + gc->setHelpText(QObject::tr("Control access to Display Settings. Checked means the screen is enabled. ")); + return gc; +}; +static HostCheckBox *Hostaccessddns() +{ + HostCheckBox *gc = new HostCheckBox("Hostaccessddns"); + gc->setLabel(QObject::tr("Dynamic DNS")); + gc->setValue(true); + gc->setHelpText(QObject::tr("Control access to DDNS Settings. Checked means the screen is enabled. ")); + return gc; +}; + +static HostCheckBox *Hostaccesssound() +{ + HostCheckBox *gc = new HostCheckBox("Hostaccesssound"); + gc->setLabel(QObject::tr("Audio")); + gc->setValue(true); + gc->setHelpText(QObject::tr("Control access to Audio Settings. Checked means the screen is enabled.")); + return gc; +}; + +static HostCheckBox *Hostaccessscreensaver() +{ + HostCheckBox *gc = new HostCheckBox("Hostaccessscreensaver"); + gc->setLabel(QObject::tr("Screensaver")); + gc->setValue(true); + gc->setHelpText(QObject::tr("Control access to Screensaver Settings. Checked means the screen is enabled.")); + return gc; +}; + +static HostCheckBox *Hostaccessir() +{ + HostCheckBox *gc = new HostCheckBox("Hostaccessir"); + gc->setLabel(QObject::tr("Remotes")); + gc->setValue(true); + gc->setHelpText(QObject::tr("Control access to Remotes Settings. Checked means the screen is enabled.")); + return gc; +}; + +static HostCheckBox *Hostaccessplugins() +{ + HostCheckBox *gc = new HostCheckBox("Hostaccessplugins"); + gc->setLabel(QObject::tr("Programs")); + gc->setValue(true); + gc->setHelpText(QObject::tr("Control access to Programs. Checked means the screen is enabled.")); + return gc; +}; + +static HostCheckBox *Hostaccessuser() +{ + HostCheckBox *gc = new HostCheckBox("Hostaccessuser"); + gc->setLabel(QObject::tr("User Accounts")); + gc->setValue(false); + gc->setHelpText(QObject::tr("Control access to User Accounts. Checked means the screen is enabled.")); + return gc; +}; + +static HostCheckBox *Hostaccesswebuser() +{ + HostCheckBox *gc = new HostCheckBox("Hostaccesswebuser"); + gc->setLabel(QObject::tr("Web Security")); + gc->setValue(true); + gc->setHelpText(QObject::tr("Control access to Web Security Settings. Checked means the screen is enabled.")); + return gc; +}; + +static HostCheckBox *Hostaccessvnc() +{ + HostCheckBox *gc = new HostCheckBox("Hostaccessvnc"); + gc->setLabel(QObject::tr("Screen Sharing")); + gc->setValue(true); + gc->setHelpText(QObject::tr("Control access to Screen Sharing Settings. Checked means the screen is enabled.")); + return gc; +}; + + +static HostCheckBox *Hostaccessfileshare() +{ + HostCheckBox *gc = new HostCheckBox("Hostaccessfileshare"); + gc->setLabel(QObject::tr("File Sharing")); + gc->setValue(true); + gc->setHelpText(QObject::tr("Control access to File Sharing Settings. Checked means the screen is enabled.")); + return gc; +}; + + +class ACCESShostsettings: public TriggeredConfigurationGroup { +public: + ACCESShostsettings(): + TriggeredConfigurationGroup(false,false,false,false) { + SetVertical(false); + Setting* trigger = Hostaccesshostype () ; + addChild(trigger); + setTrigger(trigger); + + ConfigurationGroup* settings = new VerticalConfigurationGroup(false,false,false,false); + //settings->addChild(HostServiceSamba()); + settings->addChild(HostaccesshostypeSystemtype()); + + + addTarget("0", new VerticalConfigurationGroup(false, false)); + addTarget("1", settings); + }; +}; + + +//---------------------------------- PLUGINS ---------------------- + +static HostCheckBox *Hostpluginmytharchive() +{ + HostCheckBox *gc = new HostCheckBox("Hostpluginmytharchive"); + gc->setLabel(QObject::tr("MythArchive")); + gc->setValue(false); + gc->setHelpText(QObject::tr("Check to enable MythArchive.")); + return gc; +}; + + +static HostCheckBox *Hostpluginmythbrowser() +{ + HostCheckBox *gc = new HostCheckBox("Hostpluginmythbrowser"); + gc->setLabel(QObject::tr("MythBrowser")); + gc->setValue(false); + gc->setHelpText(QObject::tr("Check to enable MythBrowser.")); + return gc; +}; + + +// static HostCheckBox *Hostpluginmythcontrols() +// { +// HostCheckBox *gc = new HostCheckBox("Hostpluginmythcontrols"); +// gc->setLabel(QObject::tr("mythcontrols")); +// gc->setValue(true); +// gc->setHelpText(QObject::tr("check to enable mythcontrols")); +// return gc; +// }; + + +static HostCheckBox *Hostpluginmythnetvision() +{ + HostCheckBox *gc = new HostCheckBox("Hostpluginmythnetvision"); + gc->setLabel(QObject::tr("MythNetvision")); + gc->setValue(true); + gc->setHelpText(QObject::tr("Check to enable MythNetvision.")); + return gc; +}; + + +static HostCheckBox *Hostpluginmythgallery() +{ + HostCheckBox *gc = new HostCheckBox("Hostpluginmythgallery"); + gc->setLabel(QObject::tr("MythGallery")); + gc->setValue(true); + gc->setHelpText(QObject::tr("Check to enable MythGallery.")); + return gc; +}; + + +static HostCheckBox *Hostpluginmythgame() +{ + HostCheckBox *gc = new HostCheckBox("Hostpluginmythgame"); + gc->setLabel(QObject::tr("MythGame")); + gc->setValue(false); + gc->setHelpText(QObject::tr("Check to enable MythGame.")); + return gc; +}; + +static HostCheckBox *Hostpluginmythgamesnes9x() +{ + HostCheckBox *gc = new HostCheckBox("Hostpluginmythgamesnes9x"); + gc->setLabel(QObject::tr("snes9x")); + gc->setValue(false); + gc->setHelpText(QObject::tr("Super Nintendo emulator")); + return gc; +}; + +static HostCheckBox *Hostpluginmythgamefceux() +{ + HostCheckBox *gc = new HostCheckBox("Hostpluginmythgamefceux"); + gc->setLabel(QObject::tr("fceux")); + gc->setValue(false); + gc->setHelpText(QObject::tr("NES emulator")); + return gc; +}; + +static HostCheckBox *HostpluginmythgameMame() +{ + HostCheckBox *gc = new HostCheckBox("HostpluginmythgameMame"); + gc->setLabel(QObject::tr("mame")); + gc->setValue(false); + gc->setHelpText(QObject::tr("Mame, Multiple Arcade Machine Emulator")); + return gc; +}; + +static HostCheckBox *HostpluginmythgameMednafen() +{ + HostCheckBox *gc = new HostCheckBox("HostpluginmythgameMednafen"); + gc->setLabel(QObject::tr("Mednafen")); + gc->setValue(false); + gc->setHelpText(QObject::tr("Mednafen is a portable, utilizing OpenGL and SDL, command-line driven multi-system emulator with many advanced features.")); + return gc; +}; + +static HostCheckBox *HostpluginmythgameROMDB() +{ + HostCheckBox *gc = new HostCheckBox("HostpluginmythgameROMDB"); + gc->setLabel(QObject::tr("RomDB")); + gc->setValue(true); + gc->setHelpText(QObject::tr("Table used my MythGame to store information about games. If you are into games, this is recommended.")); + return gc; +}; + +static HostCheckBox *Hostpluginmythgamemupen64() +{ + HostCheckBox *gc = new HostCheckBox("Hostpluginmythgamemupen64"); + gc->setLabel(QObject::tr("mupen64")); + gc->setValue(false); + gc->setHelpText(QObject::tr("n64 emulator")); + return gc; +}; + +static HostCheckBox *HostpluginmythgameDolphin() +{ + HostCheckBox *gc = new HostCheckBox("HostpluginmythgameDolphin"); + gc->setLabel(QObject::tr("Dolphin")); + gc->setValue(false); + gc->setHelpText(QObject::tr("Nintendo Wii emulator")); + return gc; +}; + +static HostCheckBox *HostpluginmythgameXe() +{ + HostCheckBox *gc = new HostCheckBox("HostpluginmythgameXe"); + gc->setLabel(QObject::tr("Xe")); + gc->setValue(false); + gc->setHelpText(QObject::tr("Xe is a multisystem emulator. http://www.xe-emulator.com/ for the complete list.")); + return gc; +}; + + +/* +static HostCheckBox *Hostpluginmythmovietime() +{ + HostCheckBox *gc = new HostCheckBox("Hostpluginmythmovietime"); + gc->setLabel(QObject::tr("mythmovietime")); + gc->setValue(true); + gc->setHelpText(QObject::tr("Check to enable mythmovietime")); + return gc; +};*/ + + +static HostCheckBox *Hostpluginmythmusic() +{ + HostCheckBox *gc = new HostCheckBox("Hostpluginmythmusic"); + gc->setLabel(QObject::tr("MythMusic")); + gc->setValue(true); + gc->setHelpText(QObject::tr("Check to enable MythMusic.")); + return gc; +}; + + +static HostCheckBox *Hostpluginmythnews() +{ + HostCheckBox *gc = new HostCheckBox("Hostpluginmythnews"); + gc->setLabel(QObject::tr("MythNews")); + gc->setValue(false); + gc->setHelpText(QObject::tr("Check to enable MythNews.")); + return gc; +}; + + +// static HostCheckBox *Hostpluginmythsmolt() +// { +// HostCheckBox *gc = new HostCheckBox("Hostpluginmythsmolt"); +// gc->setLabel(QObject::tr("mythsmolt")); +// gc->setValue(true); +// gc->setHelpText(QObject::tr("check to enable mythsmolt")); +// return gc; +// }; + + +// static HostCheckBox *Hostpluginmythvideo() +// { +// HostCheckBox *gc = new HostCheckBox("Hostpluginmythvideo"); +// gc->setLabel(QObject::tr("mythvideo")); +// gc->setValue(true); +// gc->setHelpText(QObject::tr("check to enable mythvideo")); +// return gc; +// }; + +static HostCheckBox *Hostpluginmythvideo_dvdcss() +{ + HostCheckBox *gc = new HostCheckBox("Hostpluginmythvideo_dvdcss"); + gc->setLabel(QObject::tr("dvdcss")); + gc->setValue(false); + gc->setHelpText(QObject::tr("libdvdcss is a simple library designed for accessing DVDs like a block device without having to bother about the decryption.")); + return gc; +}; + + + +// static HostCheckBox *Hostpluginmythstream() +// { +// HostCheckBox *gc = new HostCheckBox("Hostpluginmythstream"); +// gc->setLabel(QObject::tr("mythstream")); +// gc->setValue(false); +// gc->setHelpText(QObject::tr("MythStream is an unofficial MythTv plugin that plays Internet audio and video streams.")); +// return gc; +// }; + +static HostCheckBox *Hostpluginmythappletrailers() +{ + HostCheckBox *gc = new HostCheckBox("Hostpluginmythappletrailers"); + gc->setLabel(QObject::tr("MythAppleTrailers")); + gc->setValue(false); + gc->setHelpText(QObject::tr("Stream trailer's from Apple's website.")); + return gc; +}; + + +static HostCheckBox *Hostpluginmythweather() +{ + HostCheckBox *gc = new HostCheckBox("Hostpluginmythweather"); + gc->setLabel(QObject::tr("MythWeather")); + gc->setValue(false); + gc->setHelpText(QObject::tr("Check to enable MythWeather.")); + return gc; +}; + + +static HostCheckBox *HostMiro() +{ + HostCheckBox *gc = new HostCheckBox("HostMiro"); + gc->setLabel(QObject::tr("Miro")); + gc->setValue(false); + gc->setHelpText(QObject::tr("Miro is a popular, free, and open internet TV application. It brings video channels from thousands of sources and has more free HD than any other platform.")); + return gc; +}; + + +// static HostCheckBox *HostXine() +// { +// HostCheckBox *gc = new HostCheckBox("HostXine"); +// gc->setLabel(QObject::tr("Xine")); +// gc->setValue(false); +// gc->setHelpText(QObject::tr("Xine is a free multimedia player")); +// return gc; +// }; + + +// static HostCheckBox *Hostwebmin() +// { +// HostCheckBox *gc = new HostCheckBox("Hostwebmin"); +// gc->setLabel(QObject::tr("Webmin")); +// gc->setValue(false); +// gc->setHelpText(QObject::tr("Webmin is a web-based interface for system administration for Unix. Once installed, you can access it at https://ip.of.back.end:10000 using your root password.")); +// return gc; +// }; + +// static HostCheckBox *Hostfuppes() +// { +// HostCheckBox *gc = new HostCheckBox("Hostfuppes"); +// gc->setLabel(QObject::tr("Fuppes")); +// gc->setValue(false); +// gc->setHelpText(QObject::tr("Upnp server")); +// return gc; +// }; + +static HostCheckBox *Hostfoldingathome() +{ + HostCheckBox *gc = new HostCheckBox("Hostfoldingathome"); + gc->setLabel(QObject::tr("Folding@home")); + gc->setValue(false); + gc->setHelpText(QObject::tr("A distributed computing project which studies protein folding, misfolding, aggregation, and related diseases.")); + return gc; +}; + + + +static HostCheckBox *Hostwebonlinhes() +{ + HostCheckBox *gc = new HostCheckBox("Hostwebonlinhes"); + gc->setLabel(QObject::tr("Web On LinHES")); + gc->setValue(false); + gc->setHelpText(QObject::tr("Includes Google Chrome and multiple websites with 10' UIs in Media Library --> Online Content.")); + return gc; +}; + +static HostCheckBox *HostHuluDesktop() +{ + HostCheckBox *gc = new HostCheckBox("HostHuluDesktop"); + gc->setLabel(QObject::tr("Hulu Desktop")); + gc->setValue(false); + gc->setHelpText(QObject::tr("Hulu Desktop for Linux.")); + return gc; +}; + + +static HostComboBox *Hostfoldingusername() +{ + // If there is an old R5.5 style folding directory /myth/folding@home, attempt + // to retrieve the old username. + + FILE *username_pipe; + username_pipe = + popen ( + "grep username= /myth/folding@home/client.cfg 2> /dev/null | " + "sed 's/username=//g'", "r"); + + if (username_pipe) + { + char username[200]; + if (fgets (username, sizeof (username), username_pipe)) + { + char *new_line; + username[sizeof(username)-1]=0; + if ((new_line = strchr (username, '\n'))) + new_line[0] = 0; + + cout << "found old username " << username << endl; + //FIXME?? + //gCoreContext->SetSetting("Hostfoldingusername", username); + gCoreContext->SaveSetting("Hostfoldingusername", username); + } + pclose (username_pipe); + } + + HostComboBox *gc = new HostComboBox("Hostfoldingusername",true); + gc->setLabel(QObject::tr("Folding Username")); + gc->setValue(""); + + gc->setHelpText(QObject::tr("The username associated to the work-units you return.")); + return gc; +}; + +static HostComboBox *Hostfoldingworksize() +{ + HostComboBox *gc = new HostComboBox("Hostfoldingworksize"); + gc->setLabel(QObject::tr("Work Packet Size")); + gc->addSelection("Big", "big"); + gc->addSelection("Normal", "normal"); + gc->addSelection("Small", "small"); + gc->setHelpText(QObject::tr("Acceptable size of work assignment and work result packets (bigger units may have large memory demands).")); + return gc; +}; + +// static HostCheckBox *HostXscreensaver() +// { +// HostCheckBox *gc = new HostCheckBox("HostXscreensaver"); +// gc->setLabel(QObject::tr("Screensaver")); +// gc->setValue(false); +// gc->setHelpText(QObject::tr("Run screensaver after 10 minutes of inactivity.")); +// return gc; +// }; + + +static HostCheckBox *Hostpluginmythzoneminder() +{ + HostCheckBox *gc = new HostCheckBox("Hostpluginmythzoneminder"); + gc->setLabel(QObject::tr("MythZoneMinder")); + gc->setValue(false); + gc->setHelpText(QObject::tr("Check to enable MythZoneMinder.")); + return gc; +}; + + +// -------------End plugins-------------------------------- + + + +class NCIDsettings: public TriggeredConfigurationGroup { +public: + NCIDsettings(): + TriggeredConfigurationGroup(false, false, true, true,false, false, true, true) { + SetVertical(true); + Setting* trigger = HostncidDaemon() ; + addChild(trigger); + setTrigger(trigger); + ConfigurationGroup* settings = new GridConfigurationGroup(1,false,false); + settings->addChild(HostSerialPortncid()); + settings->addChild(HostNcidDeviceNetCallerID()); + addTarget("0", new HorizontalConfigurationGroup(false, false)); + addTarget("1", settings); + }; +}; + +// class SAMBAsettings: public TriggeredConfigurationGroup { +// public: +// SAMBAsettings(): +// TriggeredConfigurationGroup(false, true, true, true,false, false, true, true) { +// SetVertical(false); +// Setting* trigger = HostServiceSamba() ; +// addChild(trigger); +// setTrigger(trigger); +// +// ConfigurationGroup* settings = new GridConfigurationGroup(2,false,false); +// //settings->addChild(HostServiceSamba()); +// settings->addChild(HostServiceSamba_media()); +// settings->addChild(HostServiceSamba_write()); +// settings->addChild(HostServiceSamba_home()); +// settings->addChild(HostServiceSamba_writehome()); +// settings->addChild(HostServiceSamba_domain()); +// +// addTarget("0", new GridConfigurationGroup(2,false, false)); +// addTarget("1", settings); +// }; +// }; + + +// class Evroutersettings: public TriggeredConfigurationGroup { +// public: +// Evroutersettings(): +// TriggeredConfigurationGroup(false, false, true, true,false, false, true, true) { +// setLabel(QObject::tr("Evrouter config")); +// Setting* trigger = HostRunEvrouter() ; +// addChild(trigger); +// setTrigger(trigger); +// +// ConfigurationGroup* settings = new VerticalConfigurationGroup(false,false); +// settings->addChild(HostEvrouterConfig()); +// +// addTarget("0", new VerticalConfigurationGroup(false, false)); +// addTarget("1", settings); +// }; +// }; + +class MythGamesettings: public TriggeredConfigurationGroup { +public: + MythGamesettings(): + TriggeredConfigurationGroup(false, false, true, true,false, false, true, true) { + setLabel(QObject::tr("Programs - Games")); + Setting* trigger = Hostpluginmythgame() ; + addChild(trigger); + setTrigger(trigger); + + ConfigurationGroup* settings = new GridConfigurationGroup(3,true,true); + settings->addChild(HostpluginmythgameROMDB()); + settings->addChild(Hostpluginmythgamesnes9x()); + settings->addChild(Hostpluginmythgamefceux()); + settings->addChild(HostpluginmythgameMame()); + settings->addChild(HostpluginmythgameMednafen()); + settings->addChild(Hostpluginmythgamemupen64()); + settings->addChild(HostpluginmythgameDolphin()); + settings->addChild(HostpluginmythgameXe()); + + + addTarget("0", new VerticalConfigurationGroup(false, false)); + addTarget("1", settings); + }; +}; + + +//____________________________________________________________________________ +class eth0_settings: public TriggeredConfigurationGroup { +public: + eth0_settings(): + TriggeredConfigurationGroup(true,false,true,true,false,false,false,true) { + + HostComboBox *HOSTESSIDeth0 = new HostComboBox("HOSTESSIDeth0",true); + HOSTESSIDeth0->setLabel(QObject::tr("ESSID")); + HOSTESSIDeth0->addSelection("MythVantage"); + HOSTESSIDeth0->addSelection("home_lan"); + HOSTESSIDeth0->addSelection("type_it_here"); + HOSTESSIDeth0->setHelpText(QObject::tr("ESSID")); + addChild(HOSTESSIDeth0); + + HostComboBox *HostUseEncryptioneth0 = new HostComboBox("HostUseEncryptioneth0"); + HostUseEncryptioneth0->setLabel(QObject::tr("Encryption")); + HostUseEncryptioneth0->setHelpText(QObject::tr("WPA uses a shared key phrase this is the most secure. For WEP use the generated key, this type of encryption is not recommended.")); + HostUseEncryptioneth0->addSelection("none"); + HostUseEncryptioneth0->addSelection("WPA"); + HostUseEncryptioneth0->addSelection("WEP"); + + Setting* HostUseEncryption = HostUseEncryptioneth0; + addChild(HostUseEncryption); + setTrigger(HostUseEncryption); + + HostLineEdit *Hostkeyeth0 = new HostLineEdit("Hostkeyeth0"); + Hostkeyeth0->setLabel(QObject::tr("key")); + Hostkeyeth0->setHelpText(QObject::tr("Key to use for encryption.")); + + ConfigurationGroup* settings = new GridConfigurationGroup(1,false); + settings->addChild(Hostkeyeth0); + addTarget("none", new GridConfigurationGroup(1,false)); + addTarget("WPA", settings); + addTarget("WEP", settings); + }; +}; + + +NetworkSettingseth0::NetworkSettingseth0(): + TriggeredConfigurationGroup(false,false,false,false) { + setLabel(QObject::tr("Network Settings")); + HostLineEdit *HostIPeth0 = new HostLineEdit("HostIPeth0"); + HostIPeth0->setLabel(QObject::tr("IP Address")); + HostIPeth0->setValue("192.168.1.12"); + HostIPeth0->setHelpText(QObject::tr("IP address of the new installation.")); + + HostComboBox *HostNETMASKeth0 = new HostComboBox("HostNETMASKeth0"); + HostNETMASKeth0->setLabel(QObject::tr("Netmask")); + HostNETMASKeth0->addSelection("/0 0.0.0.0"); + HostNETMASKeth0->addSelection("/1 128.0.0.0"); + HostNETMASKeth0->addSelection("/2 192.0.0.0"); + HostNETMASKeth0->addSelection("/3 224.0.0.0"); + HostNETMASKeth0->addSelection("/4 240.0.0.0"); + HostNETMASKeth0->addSelection("/5 248.0.0.0"); + HostNETMASKeth0->addSelection("/6 252.0.0.0"); + HostNETMASKeth0->addSelection("/7 254.0.0.0"); + HostNETMASKeth0->addSelection("/8 255.0.0.0"); + HostNETMASKeth0->addSelection("/9 255.128.0.0"); + HostNETMASKeth0->addSelection("/10 255.192.0.0 "); + HostNETMASKeth0->addSelection("/11 255.224.0.0"); + HostNETMASKeth0->addSelection("/12 255.240.0.0"); + HostNETMASKeth0->addSelection("/13 255.248.0.0"); + HostNETMASKeth0->addSelection("/14 255.252.0.0"); + HostNETMASKeth0->addSelection("/15 255.254.0.0"); + HostNETMASKeth0->addSelection("/16 255.255.0.0"); + HostNETMASKeth0->addSelection("/17 255.255.128.0"); + HostNETMASKeth0->addSelection("/18 255.255.192.0"); + HostNETMASKeth0->addSelection("/19 255.255.224.0"); + HostNETMASKeth0->addSelection("/20 255.255.240.0"); + HostNETMASKeth0->addSelection("/21 255.255.248.0"); + HostNETMASKeth0->addSelection("/22 255.255.252.0"); + HostNETMASKeth0->addSelection("/23 255.255.254.0"); + HostNETMASKeth0->addSelection("/24 255.255.255.0"); + HostNETMASKeth0->addSelection("/25 255.255.255.128"); + HostNETMASKeth0->addSelection("/26 255.255.255.192"); + HostNETMASKeth0->addSelection("/27 255.255.255.224"); + HostNETMASKeth0->addSelection("/28 255.255.255.240"); + HostNETMASKeth0->addSelection("/29 255.255.255.248"); + HostNETMASKeth0->addSelection("/30 255.255.255.252"); + HostNETMASKeth0->addSelection("/31 255.255.255.254"); + HostNETMASKeth0->addSelection("/32 255.255.255.255"); + HostNETMASKeth0->setHelpText(QObject::tr("Netmask")); + HostNETMASKeth0->setValue(24); + + HostLineEdit *HostGWeth0 = new HostLineEdit("HostGWeth0"); + HostGWeth0->setLabel(QObject::tr("Gateway")); + HostGWeth0->setValue("192.168.1.1"); + HostGWeth0->setHelpText(QObject::tr("This is the default route.")); + + + HostLineEdit *HostDNSeth0 = new HostLineEdit("HostDNSeth0"); + HostDNSeth0->setLabel(QObject::tr("Name Server")); + HostDNSeth0->setValue("192.168.1.1"); + HostDNSeth0->setHelpText(QObject::tr("Name server")); + + + HostCheckBox *HostActiveonbooteth0 = new HostCheckBox("HostActiveonbooteth0"); + HostActiveonbooteth0->setLabel(QObject::tr("Active")); + HostActiveonbooteth0->setValue(true); + HostActiveonbooteth0->setHelpText(QObject::tr("Network is started on boot.")); + + HostDefaulteth0 = new HostCheckBox("HostDefaulteth0"); + HostDefaulteth0->setLabel(QObject::tr("Default")); + HostDefaulteth0->setValue(true); + HostDefaulteth0->setHelpText(QObject::tr("Will be used as the primary interface.")); + + connect(HostDefaulteth0, SIGNAL(valueChanged(bool)), this, SLOT(eth0_disable_others())); + + HostCheckBox *HostUseDHCPeth0 = new HostCheckBox("HostUseDHCPeth0"); + HostUseDHCPeth0 ->setLabel(QObject::tr("Static IP Address")); + HostUseDHCPeth0 ->setValue(false); + HostUseDHCPeth0 ->setHelpText(QObject::tr("Enable to use a static IP address, otherwise DHCP will be used.")); + + wirelessbuttoneth0 = new TransButtonSetting(); + wirelessbuttoneth0->setLabel(tr("Wireless Settings")); + connect(wirelessbuttoneth0, SIGNAL(pressed()), this, SLOT(eth0_wireless_settings())); + + ConfigurationGroup* settings1 = new GridConfigurationGroup(3,false, false, true, true); + settings1->addChild(HostActiveonbooteth0); + settings1->addChild(HostDefaulteth0); + settings1-> addChild(wirelessbuttoneth0); + addChild(settings1); + + + Setting* dhcpEnabled = HostUseDHCPeth0; + addChild(dhcpEnabled); + setTrigger(dhcpEnabled); + + ConfigurationGroup* settings = new VerticalConfigurationGroup(false, false, false, false); + settings->addChild(HostIPeth0); + settings->addChild(HostNETMASKeth0); + settings->addChild(HostGWeth0); + settings->addChild(HostDNSeth0); + + addTarget("0", new VerticalConfigurationGroup(false,false,false,false)); + addTarget("1", settings); +}; + +eth0options::eth0options() +{ + + VerticalConfigurationGroup* rec = new VerticalConfigurationGroup(false); + rec->setLabel(QObject::tr("Wireless configuration for eth0")); + //rec->setUseLabel(true); + rec->addChild(new eth0_settings); + addChild(rec); +} + +void NetworkSettingseth0::eth0_disable_others() +{ + QString my_current_value; + my_current_value = HostDefaulteth0->getValue(); + if ( my_current_value == "1" ) + { + hostparm.ThisHostDefaultInterface="eth0"; + emit eth0_is_default(); + } +} +void NetworkSettingseth0::eth0_disabled() +{ + HostDefaulteth0->setValue(0); +} +void NetworkSettingseth0::eth0_wireless_settings(void) +{ + eth0options eth0screen; + eth0screen.exec(); +} + +void NetworkSettingseth0::eth0_wireless_disable() +{ + wirelessbuttoneth0->setEnabled(false); +} + +class eth1_settings: public TriggeredConfigurationGroup { +public: + eth1_settings(): + TriggeredConfigurationGroup(true,false,true,true,false,false,false,true) { + + HostComboBox *HOSTESSIDeth1 = new HostComboBox("HOSTESSIDeth1",true); + HOSTESSIDeth1->setLabel(QObject::tr("ESSID")); + HOSTESSIDeth1->addSelection("MythVantage"); + HOSTESSIDeth1->addSelection("home_lan"); + HOSTESSIDeth1->addSelection("type_it_here"); + HOSTESSIDeth1->setHelpText(QObject::tr("ESSID")); + addChild(HOSTESSIDeth1); + HostComboBox *HostUseEncryptioneth0 = new HostComboBox("HostUseEncryptioneth0"); + HostUseEncryptioneth0->setLabel(QObject::tr("Encryption")); + HostUseEncryptioneth0->setHelpText(QObject::tr("WPA, WEP, none")); + HostUseEncryptioneth0->addSelection("none"); + HostUseEncryptioneth0->addSelection("WPA"); + HostUseEncryptioneth0->addSelection("WEP"); + + Setting* HostUseEncryption = HostUseEncryptioneth0; + addChild(HostUseEncryption); + setTrigger(HostUseEncryption); + + HostLineEdit *Hostkeyeth0 = new HostLineEdit("Hostkeyeth0"); + Hostkeyeth0->setLabel(QObject::tr("key")); + Hostkeyeth0->setHelpText(QObject::tr("Key to use for encryption")); + + ConfigurationGroup* settings = new GridConfigurationGroup(1,false); + settings->addChild(Hostkeyeth0); + addTarget("none", new GridConfigurationGroup(1,false)); + addTarget("WPA", settings); + addTarget("WEP", settings); + }; +}; + + +NetworkSettingseth1::NetworkSettingseth1(): + TriggeredConfigurationGroup(false,false,false,false) { + setLabel(QObject::tr("Network Settings")); + HostLineEdit *HostIPeth1 = new HostLineEdit("HostIPeth1"); + HostIPeth1->setLabel(QObject::tr("Ip address")); + HostIPeth1->setValue("192.168.1.12"); + HostIPeth1->setHelpText(QObject::tr("IP address of the new installation")); + + HostComboBox *HostNETMASKeth1 = new HostComboBox("HostNETMASKeth1"); + HostNETMASKeth1->setLabel(QObject::tr("Netmask")); + HostNETMASKeth1->addSelection("/0 0.0.0.0"); + HostNETMASKeth1->addSelection("/1 128.0.0.0"); + HostNETMASKeth1->addSelection("/2 192.0.0.0"); + HostNETMASKeth1->addSelection("/3 224.0.0.0"); + HostNETMASKeth1->addSelection("/4 240.0.0.0"); + HostNETMASKeth1->addSelection("/5 248.0.0.0"); + HostNETMASKeth1->addSelection("/6 252.0.0.0"); + HostNETMASKeth1->addSelection("/7 254.0.0.0"); + HostNETMASKeth1->addSelection("/8 255.0.0.0"); + HostNETMASKeth1->addSelection("/9 255.128.0.0"); + HostNETMASKeth1->addSelection("/10 255.192.0.0 "); + HostNETMASKeth1->addSelection("/11 255.224.0.0"); + HostNETMASKeth1->addSelection("/12 255.240.0.0"); + HostNETMASKeth1->addSelection("/13 255.248.0.0"); + HostNETMASKeth1->addSelection("/14 255.252.0.0"); + HostNETMASKeth1->addSelection("/15 255.254.0.0"); + HostNETMASKeth1->addSelection("/16 255.255.0.0"); + HostNETMASKeth1->addSelection("/17 255.255.128.0"); + HostNETMASKeth1->addSelection("/18 255.255.192.0"); + HostNETMASKeth1->addSelection("/19 255.255.224.0"); + HostNETMASKeth1->addSelection("/20 255.255.240.0"); + HostNETMASKeth1->addSelection("/21 255.255.248.0"); + HostNETMASKeth1->addSelection("/22 255.255.252.0"); + HostNETMASKeth1->addSelection("/23 255.255.254.0"); + HostNETMASKeth1->addSelection("/24 255.255.255.0"); + HostNETMASKeth1->addSelection("/25 255.255.255.128"); + HostNETMASKeth1->addSelection("/26 255.255.255.192"); + HostNETMASKeth1->addSelection("/27 255.255.255.224"); + HostNETMASKeth1->addSelection("/28 255.255.255.240"); + HostNETMASKeth1->addSelection("/29 255.255.255.248"); + HostNETMASKeth1->addSelection("/30 255.255.255.252"); + HostNETMASKeth1->addSelection("/31 255.255.255.254"); + HostNETMASKeth1->addSelection("/32 255.255.255.255"); + HostNETMASKeth1->setHelpText(QObject::tr("Netmask")); + HostNETMASKeth1->setValue(24); + + HostLineEdit *HostGWeth1 = new HostLineEdit("HostGWeth1"); + HostGWeth1->setLabel(QObject::tr("Gateway")); + HostGWeth1->setValue("192.168.1.1"); + HostGWeth1->setHelpText(QObject::tr("This is the default route")); + + + HostLineEdit *HostDNSeth1 = new HostLineEdit("HostDNSeth1"); + HostDNSeth1->setLabel(QObject::tr("Name server")); + HostDNSeth1->setValue("192.168.1.1"); + HostDNSeth1->setHelpText(QObject::tr("Name server")); + + + HostCheckBox *HostActiveonbooteth1 = new HostCheckBox("HostActiveonbooteth1"); + HostActiveonbooteth1->setLabel(QObject::tr("Active")); + HostActiveonbooteth1->setValue(false); + HostActiveonbooteth1->setHelpText(QObject::tr("Network is started on boot")); + + HostDefaulteth1 = new HostCheckBox("HostDefaulteth1"); + HostDefaulteth1->setLabel(QObject::tr("Default")); + HostDefaulteth1->setValue(false); + HostDefaulteth1->setHelpText(QObject::tr("Will be used as the primary interface")); + connect(HostDefaulteth1, SIGNAL(valueChanged(bool)), this, SLOT(eth1_disable_others())); + + HostCheckBox *HostUseDHCPeth1 = new HostCheckBox("HostUseDHCPeth1"); + HostUseDHCPeth1 ->setLabel(QObject::tr("Static ip address")); + HostUseDHCPeth1 ->setValue(false); + HostUseDHCPeth1 ->setHelpText(QObject::tr("Enable to use a static ip address, otherwise dhcp will be used.")); + + wirelessbuttoneth1 = new TransButtonSetting(); + wirelessbuttoneth1->setLabel(tr("Wireless Settings")); + connect(wirelessbuttoneth1, SIGNAL(pressed()), this, SLOT(eth1_wireless_settings())); + + ConfigurationGroup* settings1 = new GridConfigurationGroup(3,false, false, false,false); + settings1->addChild(HostActiveonbooteth1); + settings1->addChild(HostDefaulteth1); + settings1-> addChild(wirelessbuttoneth1); + + addChild(settings1); + + Setting* dhcpEnabled = HostUseDHCPeth1; + addChild(dhcpEnabled); + setTrigger(dhcpEnabled); + + ConfigurationGroup* settings = new VerticalConfigurationGroup(false, false,false,false); + settings->addChild(HostIPeth1); + settings->addChild(HostNETMASKeth1); + settings->addChild(HostGWeth1); + settings->addChild(HostDNSeth1); + + addTarget("0", new VerticalConfigurationGroup(false,false,false,false)); + addTarget("1", settings); +}; +eth1options::eth1options() +{ + VerticalConfigurationGroup* rec = new VerticalConfigurationGroup(false); + rec->setLabel(QObject::tr("Wireless configuration for eth1")); + rec->addChild(new eth1_settings); + addChild(rec); +} + +void NetworkSettingseth1::eth1_disable_others() +{ + QString my_current_value; + my_current_value = HostDefaulteth1->getValue(); + if ( my_current_value == "1" ) + { + hostparm.ThisHostDefaultInterface="eth1"; + emit eth1_is_default(); + } +} +void NetworkSettingseth1::eth1_disabled() +{ + HostDefaulteth1->setValue(0); +} + +void NetworkSettingseth1::eth1_wireless_settings(void) +{ + eth1options eth1screen; + eth1screen.exec(); +} + +void NetworkSettingseth1::eth1_wireless_disable() +{ + wirelessbuttoneth1->setEnabled(false); +} + + +class wlan0_settings: public TriggeredConfigurationGroup { +public: + wlan0_settings(): + TriggeredConfigurationGroup(true,false,true,true,false,false,false,true) { + + HostComboBox *HOSTESSIDwlan0 = new HostComboBox("HOSTESSIDwlan0",true); + HOSTESSIDwlan0->setLabel(QObject::tr("ESSID")); + HOSTESSIDwlan0->addSelection("MythVantage"); + HOSTESSIDwlan0->addSelection("home_lan"); + HOSTESSIDwlan0->addSelection("type_it_here"); + HOSTESSIDwlan0->setHelpText(QObject::tr("ESSID")); + addChild(HOSTESSIDwlan0); + HostComboBox *HostUseEncryptionwlan0 = new HostComboBox("HostUseEncryptionwlan0"); + HostUseEncryptionwlan0->setLabel(QObject::tr("Encryption")); + HostUseEncryptionwlan0->setHelpText(QObject::tr("WPA, WEP, none")); + HostUseEncryptionwlan0->addSelection("none"); + HostUseEncryptionwlan0->addSelection("WPA"); + HostUseEncryptionwlan0->addSelection("WEP"); + + Setting* HostUseEncryption = HostUseEncryptionwlan0; + addChild(HostUseEncryption); + setTrigger(HostUseEncryption); + + HostLineEdit *Hostkeywlan0 = new HostLineEdit("Hostkeywlan0"); + Hostkeywlan0->setLabel(QObject::tr("key")); + Hostkeywlan0->setHelpText(QObject::tr("Key to use for encryption")); + + ConfigurationGroup* settings = new GridConfigurationGroup(1,false); + settings->addChild(Hostkeywlan0); + addTarget("none", new GridConfigurationGroup(1,false)); + addTarget("WPA", settings); + addTarget("WEP", settings); + }; +}; + +NetworkSettingswlan0::NetworkSettingswlan0(): + TriggeredConfigurationGroup(false,false,false,false) { + setLabel(QObject::tr("Network Settings")); + + HostIPwlan0 = new HostLineEdit("HostIPwlan0"); + HostIPwlan0->setLabel(QObject::tr("Ip address")); + HostIPwlan0->setValue("192.168.1.12"); + HostIPwlan0->setHelpText(QObject::tr("IP address of the new installation")); + + HostNETMASKwlan0 = new HostComboBox("HostNETMASKwlan0"); + HostNETMASKwlan0->setLabel(QObject::tr("Netmask")); + HostNETMASKwlan0->addSelection("/0 0.0.0.0"); + HostNETMASKwlan0->addSelection("/1 128.0.0.0"); + HostNETMASKwlan0->addSelection("/2 192.0.0.0"); + HostNETMASKwlan0->addSelection("/3 224.0.0.0"); + HostNETMASKwlan0->addSelection("/4 240.0.0.0"); + HostNETMASKwlan0->addSelection("/5 248.0.0.0"); + HostNETMASKwlan0->addSelection("/6 252.0.0.0"); + HostNETMASKwlan0->addSelection("/7 254.0.0.0"); + HostNETMASKwlan0->addSelection("/8 255.0.0.0"); + HostNETMASKwlan0->addSelection("/9 255.128.0.0"); + HostNETMASKwlan0->addSelection("/10 255.192.0.0 "); + HostNETMASKwlan0->addSelection("/11 255.224.0.0"); + HostNETMASKwlan0->addSelection("/12 255.240.0.0"); + HostNETMASKwlan0->addSelection("/13 255.248.0.0"); + HostNETMASKwlan0->addSelection("/14 255.252.0.0"); + HostNETMASKwlan0->addSelection("/15 255.254.0.0"); + HostNETMASKwlan0->addSelection("/16 255.255.0.0"); + HostNETMASKwlan0->addSelection("/17 255.255.128.0"); + HostNETMASKwlan0->addSelection("/18 255.255.192.0"); + HostNETMASKwlan0->addSelection("/19 255.255.224.0"); + HostNETMASKwlan0->addSelection("/20 255.255.240.0"); + HostNETMASKwlan0->addSelection("/21 255.255.248.0"); + HostNETMASKwlan0->addSelection("/22 255.255.252.0"); + HostNETMASKwlan0->addSelection("/23 255.255.254.0"); + HostNETMASKwlan0->addSelection("/24 255.255.255.0"); + HostNETMASKwlan0->addSelection("/25 255.255.255.128"); + HostNETMASKwlan0->addSelection("/26 255.255.255.192"); + HostNETMASKwlan0->addSelection("/27 255.255.255.224"); + HostNETMASKwlan0->addSelection("/28 255.255.255.240"); + HostNETMASKwlan0->addSelection("/29 255.255.255.248"); + HostNETMASKwlan0->addSelection("/30 255.255.255.252"); + HostNETMASKwlan0->addSelection("/31 255.255.255.254"); + HostNETMASKwlan0->addSelection("/32 255.255.255.255"); + HostNETMASKwlan0->setHelpText(QObject::tr("Netmask")); + HostNETMASKwlan0->setValue(24); + + HostGWwlan0 = new HostLineEdit("HostGWwlan0"); + HostGWwlan0->setLabel(QObject::tr("Gateway")); + HostGWwlan0->setValue("192.168.1.1"); + HostGWwlan0->setHelpText(QObject::tr("This is the default route")); + + + HostDNSwlan0 = new HostLineEdit("HostDNSwlan0"); + HostDNSwlan0->setLabel(QObject::tr("Name server")); + HostDNSwlan0->setValue("192.168.1.1"); + HostDNSwlan0->setHelpText(QObject::tr("Name server")); + + + HostActiveonbootwlan0 = new HostCheckBox("HostActiveonbootwlan0"); + HostActiveonbootwlan0->setLabel(QObject::tr("Active")); + HostActiveonbootwlan0->setValue(false); + HostActiveonbootwlan0->setHelpText(QObject::tr("Network is started on boot")); + + HostDefaultwlan0 = new HostCheckBox("HostDefaultwlan0"); + HostDefaultwlan0->setLabel(QObject::tr("Default")); + HostDefaultwlan0->setValue(false); + HostDefaultwlan0->setHelpText(QObject::tr("Will be used as the primary interface")); + connect(HostDefaultwlan0, SIGNAL(valueChanged(bool)), this, SLOT(wlan0_disable_others())); + + HostUseDHCPwlan0 = new HostCheckBox("HostUseDHCPwlan0"); + HostUseDHCPwlan0 ->setLabel(QObject::tr("Static ip address")); + HostUseDHCPwlan0 ->setValue(false); + HostUseDHCPwlan0 ->setHelpText(QObject::tr("Enable to use a static ip address, otherwise dhcp will be used.")); + + wirelessbuttonwlan0 = new TransButtonSetting(); + wirelessbuttonwlan0->setLabel(tr("Wireless Settings")); + connect(wirelessbuttonwlan0, SIGNAL(pressed()), this, SLOT(wlan0_wireless_settings())); + + + ConfigurationGroup* settings1 = new GridConfigurationGroup(3,false, false, false,false); + settings1->addChild(HostActiveonbootwlan0); + settings1->addChild(HostDefaultwlan0); + settings1-> addChild(wirelessbuttonwlan0); + addChild(settings1); + + Setting* dhcpEnabled = HostUseDHCPwlan0; + addChild(dhcpEnabled); + setTrigger(dhcpEnabled); + + ConfigurationGroup* settings = new VerticalConfigurationGroup(false, false,false,false); + settings->addChild(HostIPwlan0); + settings->addChild(HostNETMASKwlan0); + settings->addChild(HostGWwlan0); + settings->addChild(HostDNSwlan0); + + addTarget("0", new VerticalConfigurationGroup(false,false,false,false)); + addTarget("1", settings); + +}; + +Wlan0options::Wlan0options() +{ + VerticalConfigurationGroup* rec = new VerticalConfigurationGroup(false); + rec->setLabel(QObject::tr("Wireless configuration for wlan0")); + rec->addChild(new wlan0_settings); + addChild(rec); +} + +void NetworkSettingswlan0::wlan0_disable_others() +{ + QString my_current_value; + my_current_value = HostDefaultwlan0->getValue(); + if ( my_current_value == "1" ) + { + hostparm.ThisHostDefaultInterface="wlan0"; + emit wlan0_is_default(); + } + + + +} +void NetworkSettingswlan0::wlan0_disabled() +{ + HostDefaultwlan0->setValue(0); +} + + +void NetworkSettingswlan0::wlan0_wireless_settings(void) +{ + Wlan0options wlan0screen; + wlan0screen.exec(); +} +void NetworkSettingswlan0::wlan0_wireless_disable() +{ + wirelessbuttonwlan0->setEnabled(false); +} + + +class wlan1_settings: public TriggeredConfigurationGroup { +public: + wlan1_settings(): + TriggeredConfigurationGroup(true,false,true,true,false,false,false,true) { + + HostComboBox *HOSTESSIDwlan1 = new HostComboBox("HOSTESSIDwlan1",true); + HOSTESSIDwlan1->setLabel(QObject::tr("ESSID")); + HOSTESSIDwlan1->addSelection("MythVantage"); + HOSTESSIDwlan1->addSelection("home_lan"); + HOSTESSIDwlan1->addSelection("type_it_here"); + HOSTESSIDwlan1->setHelpText(QObject::tr("ESSID")); + addChild(HOSTESSIDwlan1); + + + HostComboBox *HostUseEncryptionwlan1 = new HostComboBox("HostUseEncryptionwlan1"); + HostUseEncryptionwlan1->setLabel(QObject::tr("Encryption")); + HostUseEncryptionwlan1->setHelpText(QObject::tr("WPA, WEP, none")); + HostUseEncryptionwlan1->addSelection("none"); + HostUseEncryptionwlan1->addSelection("WPA"); + HostUseEncryptionwlan1->addSelection("WEP"); + + Setting* HostUseEncryption = HostUseEncryptionwlan1; + addChild(HostUseEncryption); + setTrigger(HostUseEncryption); + + HostLineEdit *Hostkeywlan1 = new HostLineEdit("Hostkeywlan1"); + Hostkeywlan1->setLabel(QObject::tr("key")); + Hostkeywlan1->setHelpText(QObject::tr("Key to use for encryption")); + + ConfigurationGroup* settings = new GridConfigurationGroup(1,false); + settings->addChild(Hostkeywlan1); + addTarget("none", new GridConfigurationGroup(1,false)); + addTarget("WPA", settings); + addTarget("WEP", settings); + + }; +}; + +NetworkSettingswlan1::NetworkSettingswlan1(): + TriggeredConfigurationGroup(false,false,false,false) { + setLabel(QObject::tr("Network Settings")); + + HostIPwlan1 = new HostLineEdit("HostIPwlan1"); + HostIPwlan1->setLabel(QObject::tr("Ip address")); + HostIPwlan1->setValue("192.168.1.12"); + HostIPwlan1->setHelpText(QObject::tr("IP address of the new installation")); + + HostNETMASKwlan1 = new HostComboBox("HostNETMASKwlan1"); + HostNETMASKwlan1->setLabel(QObject::tr("Netmask")); + HostNETMASKwlan1->addSelection("/0 0.0.0.0"); + HostNETMASKwlan1->addSelection("/1 128.0.0.0"); + HostNETMASKwlan1->addSelection("/2 192.0.0.0"); + HostNETMASKwlan1->addSelection("/3 224.0.0.0"); + HostNETMASKwlan1->addSelection("/4 240.0.0.0"); + HostNETMASKwlan1->addSelection("/5 248.0.0.0"); + HostNETMASKwlan1->addSelection("/6 252.0.0.0"); + HostNETMASKwlan1->addSelection("/7 254.0.0.0"); + HostNETMASKwlan1->addSelection("/8 255.0.0.0"); + HostNETMASKwlan1->addSelection("/9 255.128.0.0"); + HostNETMASKwlan1->addSelection("/10 255.192.0.0 "); + HostNETMASKwlan1->addSelection("/11 255.224.0.0"); + HostNETMASKwlan1->addSelection("/12 255.240.0.0"); + HostNETMASKwlan1->addSelection("/13 255.248.0.0"); + HostNETMASKwlan1->addSelection("/14 255.252.0.0"); + HostNETMASKwlan1->addSelection("/15 255.254.0.0"); + HostNETMASKwlan1->addSelection("/16 255.255.0.0"); + HostNETMASKwlan1->addSelection("/17 255.255.128.0"); + HostNETMASKwlan1->addSelection("/18 255.255.192.0"); + HostNETMASKwlan1->addSelection("/19 255.255.224.0"); + HostNETMASKwlan1->addSelection("/20 255.255.240.0"); + HostNETMASKwlan1->addSelection("/21 255.255.248.0"); + HostNETMASKwlan1->addSelection("/22 255.255.252.0"); + HostNETMASKwlan1->addSelection("/23 255.255.254.0"); + HostNETMASKwlan1->addSelection("/24 255.255.255.0"); + HostNETMASKwlan1->addSelection("/25 255.255.255.128"); + HostNETMASKwlan1->addSelection("/26 255.255.255.192"); + HostNETMASKwlan1->addSelection("/27 255.255.255.224"); + HostNETMASKwlan1->addSelection("/28 255.255.255.240"); + HostNETMASKwlan1->addSelection("/29 255.255.255.248"); + HostNETMASKwlan1->addSelection("/30 255.255.255.252"); + HostNETMASKwlan1->addSelection("/31 255.255.255.254"); + HostNETMASKwlan1->addSelection("/32 255.255.255.255"); + HostNETMASKwlan1->setHelpText(QObject::tr("Netmask")); + HostNETMASKwlan1->setValue(24); + + HostGWwlan1 = new HostLineEdit("HostGWwlan1"); + HostGWwlan1->setLabel(QObject::tr("Gateway")); + HostGWwlan1->setValue("192.168.1.1"); + HostGWwlan1->setHelpText(QObject::tr("This is the default route")); + + + HostDNSwlan1 = new HostLineEdit("HostDNSwlan1"); + HostDNSwlan1->setLabel(QObject::tr("Name server")); + HostDNSwlan1->setValue("192.168.1.1"); + HostDNSwlan1->setHelpText(QObject::tr("Name server")); + + + HostActiveonbootwlan1 = new HostCheckBox("HostActiveonbootwlan1"); + HostActiveonbootwlan1->setLabel(QObject::tr("Active")); + HostActiveonbootwlan1->setValue(false); + HostActiveonbootwlan1->setHelpText(QObject::tr("Network is started on boot")); + + HostUseDHCPwlan1 = new HostCheckBox("HostUseDHCPwlan1"); + HostUseDHCPwlan1 ->setLabel(QObject::tr("Static ip address")); + HostUseDHCPwlan1 ->setValue(false); + HostUseDHCPwlan1 ->setHelpText(QObject::tr("Enable to use a static ip address, otherwise dhcp will be used.")); + + wirelessbuttonwlan1 = new TransButtonSetting(); + wirelessbuttonwlan1->setLabel(tr("Wireless Settings")); + connect(wirelessbuttonwlan1, SIGNAL(pressed()), this, SLOT(wlan1_wireless_settings())); + + HostDefaultwlan1 = new HostCheckBox("HostDefaultwlan1"); + HostDefaultwlan1->setLabel(QObject::tr("Default")); + HostDefaultwlan1->setValue(false); + HostDefaultwlan1->setHelpText(QObject::tr("Will be used as the primary interface")); + connect(HostDefaultwlan1, SIGNAL(valueChanged(bool)), this, SLOT(wlan1_disable_others())); + + + ConfigurationGroup* settings1 = new GridConfigurationGroup(3,false, false, false, false); + settings1->addChild(HostActiveonbootwlan1); + settings1->addChild(HostDefaultwlan1); + settings1-> addChild(wirelessbuttonwlan1); + + addChild(settings1); + + Setting* dhcpEnabled = HostUseDHCPwlan1; + addChild(dhcpEnabled); + setTrigger(dhcpEnabled); + + ConfigurationGroup* settings = new VerticalConfigurationGroup(false, false,false,false); + settings->addChild(HostIPwlan1); + settings->addChild(HostNETMASKwlan1); + settings->addChild(HostGWwlan1); + settings->addChild(HostDNSwlan1); + + addTarget("0", new VerticalConfigurationGroup(true)); + addTarget("1", settings); +}; + +wlan1options::wlan1options() +{ + VerticalConfigurationGroup* rec = new VerticalConfigurationGroup(false); + rec->setLabel(QObject::tr("Wireless configuration for wlan1")); + rec->addChild(new wlan1_settings); + addChild(rec); +} +void NetworkSettingswlan1::wlan1_disable_others() +{ + QString my_current_value; + my_current_value = HostDefaultwlan1->getValue(); + if ( my_current_value == "1" ) + { + hostparm.ThisHostDefaultInterface="wlan1"; + emit wlan1_is_default(); + } +} + +void NetworkSettingswlan1::wlan1_disabled() +{ + HostDefaultwlan1->setValue(0); +} +void NetworkSettingswlan1::wlan1_wireless_disable() +{ + wirelessbuttonwlan1->setEnabled(false); +} + +void NetworkSettingswlan1::wlan1_wireless_settings(void) +{ + wlan1options wlan1screen; + wlan1screen.exec(); +} + +//--- + +class ath0_settings: public TriggeredConfigurationGroup { +public: + ath0_settings(): + TriggeredConfigurationGroup(true,false,true,true,false,false,false,true) { + + HostComboBox *HOSTESSIDath0 = new HostComboBox("HOSTESSIDath0",true); + HOSTESSIDath0->setLabel(QObject::tr("ESSID")); + HOSTESSIDath0->addSelection("MythVantage"); + HOSTESSIDath0->addSelection("home_lan"); + HOSTESSIDath0->addSelection("type_it_here"); + HOSTESSIDath0->setHelpText(QObject::tr("ESSID")); + addChild(HOSTESSIDath0); + + HostComboBox *HostUseEncryptionath0 = new HostComboBox("HostUseEncryptionath0"); + HostUseEncryptionath0->setLabel(QObject::tr("Encryption")); + HostUseEncryptionath0->setHelpText(QObject::tr("WPA, WEP, none")); + HostUseEncryptionath0->addSelection("none"); + HostUseEncryptionath0->addSelection("WPA"); + HostUseEncryptionath0->addSelection("WEP"); + + Setting* HostUseEncryption = HostUseEncryptionath0; + addChild(HostUseEncryption); + setTrigger(HostUseEncryption); + + HostLineEdit *Hostkeyath0 = new HostLineEdit("Hostkeyath0"); + Hostkeyath0->setLabel(QObject::tr("key")); + Hostkeyath0->setHelpText(QObject::tr("Key to use for encryption")); + + ConfigurationGroup* settings = new GridConfigurationGroup(1,false); + settings->addChild(Hostkeyath0); + addTarget("none", new GridConfigurationGroup(1,false)); + addTarget("WPA", settings); + addTarget("WEP", settings); + //- + + }; +}; + + +NetworkSettingsath0::NetworkSettingsath0(): + TriggeredConfigurationGroup(false,false,false,false) { + setLabel(QObject::tr("Network Settings")); + HostLineEdit *HostIPath0 = new HostLineEdit("HostIPath0"); + HostIPath0->setLabel(QObject::tr("Ip address")); + HostIPath0->setValue("192.168.1.12"); + HostIPath0->setHelpText(QObject::tr("IP address of the new installation")); + + HostComboBox *HostNETMASKath0 = new HostComboBox("HostNETMASKath0"); + HostNETMASKath0->setLabel(QObject::tr("Netmask")); + HostNETMASKath0->addSelection("/0 0.0.0.0"); + HostNETMASKath0->addSelection("/1 128.0.0.0"); + HostNETMASKath0->addSelection("/2 192.0.0.0"); + HostNETMASKath0->addSelection("/3 224.0.0.0"); + HostNETMASKath0->addSelection("/4 240.0.0.0"); + HostNETMASKath0->addSelection("/5 248.0.0.0"); + HostNETMASKath0->addSelection("/6 252.0.0.0"); + HostNETMASKath0->addSelection("/7 254.0.0.0"); + HostNETMASKath0->addSelection("/8 255.0.0.0"); + HostNETMASKath0->addSelection("/9 255.128.0.0"); + HostNETMASKath0->addSelection("/10 255.192.0.0 "); + HostNETMASKath0->addSelection("/11 255.224.0.0"); + HostNETMASKath0->addSelection("/12 255.240.0.0"); + HostNETMASKath0->addSelection("/13 255.248.0.0"); + HostNETMASKath0->addSelection("/14 255.252.0.0"); + HostNETMASKath0->addSelection("/15 255.254.0.0"); + HostNETMASKath0->addSelection("/16 255.255.0.0"); + HostNETMASKath0->addSelection("/17 255.255.128.0"); + HostNETMASKath0->addSelection("/18 255.255.192.0"); + HostNETMASKath0->addSelection("/19 255.255.224.0"); + HostNETMASKath0->addSelection("/20 255.255.240.0"); + HostNETMASKath0->addSelection("/21 255.255.248.0"); + HostNETMASKath0->addSelection("/22 255.255.252.0"); + HostNETMASKath0->addSelection("/23 255.255.254.0"); + HostNETMASKath0->addSelection("/24 255.255.255.0"); + HostNETMASKath0->addSelection("/25 255.255.255.128"); + HostNETMASKath0->addSelection("/26 255.255.255.192"); + HostNETMASKath0->addSelection("/27 255.255.255.224"); + HostNETMASKath0->addSelection("/28 255.255.255.240"); + HostNETMASKath0->addSelection("/29 255.255.255.248"); + HostNETMASKath0->addSelection("/30 255.255.255.252"); + HostNETMASKath0->addSelection("/31 255.255.255.254"); + HostNETMASKath0->addSelection("/32 255.255.255.255"); + HostNETMASKath0->setHelpText(QObject::tr("Netmask")); + HostNETMASKath0->setValue(24); + + HostLineEdit *HostGWath0 = new HostLineEdit("HostGWath0"); + HostGWath0->setLabel(QObject::tr("Gateway")); + HostGWath0->setValue("192.168.1.1"); + HostGWath0->setHelpText(QObject::tr("This is the default route")); + + + HostLineEdit *HostDNSath0 = new HostLineEdit("HostDNSath0"); + HostDNSath0->setLabel(QObject::tr("Name server")); + HostDNSath0->setValue("192.168.1.1"); + HostDNSath0->setHelpText(QObject::tr("Name server")); + + + HostCheckBox *HostActiveonbootath0 = new HostCheckBox("HostActiveonbootath0"); + HostActiveonbootath0->setLabel(QObject::tr("Active")); + HostActiveonbootath0->setValue(false); + HostActiveonbootath0->setHelpText(QObject::tr("Network is started on boot")); + + HostDefaultath0 = new HostCheckBox("HostDefaultath0"); + HostDefaultath0->setLabel(QObject::tr("Default")); + HostDefaultath0->setValue(false); + HostDefaultath0->setHelpText(QObject::tr("Will be used as the primary interface")); + connect(HostDefaultath0, SIGNAL(valueChanged(bool)), this, SLOT(ath0_disable_others())); + + HostCheckBox *HostUseDHCPath0 = new HostCheckBox("HostUseDHCPath0"); + HostUseDHCPath0 ->setLabel(QObject::tr("Static ip address")); + HostUseDHCPath0 ->setValue(false); + HostUseDHCPath0 ->setHelpText(QObject::tr("Enable to use a static ip address, otherwise dhcp will be used.")); + + wirelessbuttonath0 = new TransButtonSetting(); + wirelessbuttonath0->setLabel(tr("Wireless Settings")); + connect(wirelessbuttonath0, SIGNAL(pressed()), this, SLOT(ath0_wireless_settings())); + + ConfigurationGroup* settings1 = new GridConfigurationGroup(3,false, false, false,false); + settings1->addChild(HostActiveonbootath0); + settings1->addChild(HostDefaultath0); + settings1-> addChild(wirelessbuttonath0); + + addChild(settings1); + + Setting* dhcpEnabled = HostUseDHCPath0; + addChild(dhcpEnabled); + setTrigger(dhcpEnabled); + + ConfigurationGroup* settings = new VerticalConfigurationGroup(false, false,false,false); + settings->addChild(HostIPath0); + settings->addChild(HostNETMASKath0); + settings->addChild(HostGWath0); + settings->addChild(HostDNSath0); + + addTarget("0", new VerticalConfigurationGroup(false,false,false,false)); + addTarget("1", settings); +}; +ath0options::ath0options() +{ + + VerticalConfigurationGroup* rec = new VerticalConfigurationGroup(false); + rec->setLabel(QObject::tr("Wireless configuration for ath0")); + rec->addChild(new ath0_settings); + addChild(rec); +} + +void NetworkSettingsath0::ath0_disable_others() +{ + QString my_current_value; + my_current_value = HostDefaultath0->getValue(); + if ( my_current_value == "1" ) + { + hostparm.ThisHostDefaultInterface="ath0"; + emit ath0_is_default(); + } +} +void NetworkSettingsath0::ath0_disabled() +{ + HostDefaultath0->setValue(0); +} + +void NetworkSettingsath0::ath0_wireless_settings(void) +{ + ath0options ath0screen; + ath0screen.exec(); +} + +void NetworkSettingsath0::ath0_wireless_disable() +{ + wirelessbuttonath0->setEnabled(false); +} + + +//-- + +class NetworkSettingsFrame: + public TriggeredConfigurationGroup { +public: + NetworkSettingsFrame(): + TriggeredConfigurationGroup(false, false, true, true,false, false, true, true) { + setLabel(QObject::tr("Network Settings (1/2)")); + Setting* netdevice = HostNetDevice(); + addChild(netdevice); + setTrigger(netdevice); + + NetworkSettingswlan0 *Nwlan0 = new NetworkSettingswlan0 ; + NetworkSettingswlan1 *Nwlan1 = new NetworkSettingswlan1 ; + NetworkSettingseth0 *Neth0 = new NetworkSettingseth0 ; + NetworkSettingseth1 *Neth1 = new NetworkSettingseth1 ; + NetworkSettingsath0 *Nath0 = new NetworkSettingsath0 ; + + QString found_wireless=findnet_wireless(); + + if ( not found_wireless.contains("eth0")) + { + Neth0->eth0_wireless_disable(); + hostparm.ThisHOST_iswirelesseth0="0"; + } + else + { + hostparm.ThisHOST_iswirelesseth0="1"; + } + + if ( not found_wireless.contains("eth1")) + { + Neth1->eth1_wireless_disable(); + hostparm.ThisHOST_iswirelesseth1="0"; + } + else + { + hostparm.ThisHOST_iswirelesseth1="1"; + } + + if ( not found_wireless.contains("wlan0")) + { + Nwlan0->wlan0_wireless_disable(); + hostparm.ThisHOST_iswirelesswlan0="0"; + } + else + { + hostparm.ThisHOST_iswirelesswlan0="1"; + } + + if ( not found_wireless.contains("wlan1")) + { + Nwlan1->wlan1_wireless_disable(); + hostparm.ThisHOST_iswirelesswlan1="0"; + } + else + { + hostparm.ThisHOST_iswirelesswlan0="1"; + } + + if ( not found_wireless.contains("ath0")) + { + Nath0->ath0_wireless_disable(); + hostparm.ThisHOST_iswirelessath0="0"; + } + else + { + hostparm.ThisHOST_iswirelessath0="1"; + } + connect(Nwlan1, SIGNAL(wlan1_is_default(void)), Nwlan0, SLOT(wlan0_disabled())); + connect(Nwlan1, SIGNAL(wlan1_is_default(void)), Neth0, SLOT(eth0_disabled())); + connect(Nwlan1, SIGNAL(wlan1_is_default(void)), Neth1, SLOT(eth1_disabled())); + connect(Nwlan1, SIGNAL(wlan1_is_default(void)), Nath0, SLOT(ath0_disabled())); + + connect(Nwlan0, SIGNAL(wlan0_is_default(void)), Nwlan1, SLOT(wlan1_disabled())); + connect(Nwlan0, SIGNAL(wlan0_is_default(void)), Neth0, SLOT(eth0_disabled())); + connect(Nwlan0, SIGNAL(wlan0_is_default(void)), Neth1, SLOT(eth1_disabled())); + connect(Nwlan0, SIGNAL(wlan0_is_default(void)), Nath0, SLOT(ath0_disabled())); + + connect(Neth1, SIGNAL(eth1_is_default(void)), Nwlan1, SLOT(wlan1_disabled())); + connect(Neth1, SIGNAL(eth1_is_default(void)), Nwlan0, SLOT(wlan0_disabled())); + connect(Neth1, SIGNAL(eth1_is_default(void)), Neth0, SLOT(eth0_disabled())); + connect(Neth1, SIGNAL(eth1_is_default(void)), Nath0, SLOT(ath0_disabled())); + + connect(Neth0, SIGNAL(eth0_is_default(void)), Nwlan0, SLOT(wlan0_disabled())); + connect(Neth0, SIGNAL(eth0_is_default(void)), Nwlan1, SLOT(wlan1_disabled())); + connect(Neth0, SIGNAL(eth0_is_default(void)), Neth1, SLOT(eth1_disabled())); + connect(Neth0, SIGNAL(eth0_is_default(void)), Nath0, SLOT(ath0_disabled())); + + connect(Nath0, SIGNAL(ath0_is_default(void)), Nwlan0, SLOT(wlan0_disabled())); + connect(Nath0, SIGNAL(ath0_is_default(void)), Nwlan1, SLOT(wlan1_disabled())); + connect(Nath0, SIGNAL(ath0_is_default(void)), Neth1, SLOT(eth1_disabled())); + connect(Nath0, SIGNAL(ath0_is_default(void)), Neth0, SLOT(eth0_disabled())); + + + HostLineEdit *HostMTUeth0 = new HostLineEdit("HostMTUeth0"); + HostMTUeth0->setLabel(QObject::tr("MTU")); + HostMTUeth0->setValue(""); + HostMTUeth0->setHelpText(QObject::tr("Leave this blank for default values. Changing this setting can have adverse affects, use with caution. Not all values will be supported by the device.")); + + ConfigurationGroup* settingseth0 = new GridConfigurationGroup(1,false, false, false, false); + settingseth0->addChild(Neth0); + settingseth0->addChild(HostMTUeth0); + + + HostLineEdit *HostMTUeth1 = new HostLineEdit("HostMTUeth1"); + HostMTUeth1->setLabel(QObject::tr("MTU")); + HostMTUeth1->setValue(""); + HostMTUeth1->setHelpText(QObject::tr("Leave this blank for default values. Changing this setting can have adverse affects, use with caution. Not all values will be supported by the device.")); + + ConfigurationGroup* settingseth1 = new GridConfigurationGroup(1,false, false, true, true); + settingseth1->addChild(Neth1); + settingseth1->addChild(HostMTUeth1); + + HostLineEdit *HostMTUwlan0 = new HostLineEdit("HostMTUwlan0"); + HostMTUwlan0->setLabel(QObject::tr("MTU")); + HostMTUwlan0->setValue(""); + HostMTUwlan0->setHelpText(QObject::tr("Leave this blank for default values. Changing this setting can have adverse affects, use with caution. Not all values will be supported by the device.")); + + ConfigurationGroup* settingswlan0 = new GridConfigurationGroup(1,false, false, false, false); + settingswlan0->addChild(Nwlan0); + settingswlan0->addChild(HostMTUwlan0); + + HostLineEdit *HostMTUwlan1 = new HostLineEdit("HostMTUwlan1"); + HostMTUwlan1->setLabel(QObject::tr("MTU")); + HostMTUwlan1->setValue(""); + HostMTUwlan1->setHelpText(QObject::tr("Leave this blank for default values. Changing this setting can have adverse affects, use with caution. Not all values will be supported by the device.")); + + ConfigurationGroup* settingswlan1 = new GridConfigurationGroup(1,false, false, false, false); + settingswlan1->addChild(Nwlan1); + settingswlan1->addChild(HostMTUwlan1); + + HostLineEdit *HostMTUath0 = new HostLineEdit("HostMTUath0"); + HostMTUath0->setLabel(QObject::tr("MTU")); + HostMTUath0->setValue(""); + HostMTUath0->setHelpText(QObject::tr("Leave this blank for default values. Changing this setting can have adverse affects, use with caution. Not all values will be supported by the device.")); + + ConfigurationGroup* settingsath0 = new GridConfigurationGroup(1,false, false, false, false); + settingsath0->addChild(Nath0); + settingsath0->addChild(HostMTUath0); + + addTarget("wlan0", settingswlan0); + addTarget("wlan1", settingswlan1); + addTarget("eth0", settingseth0); + addTarget("eth1", settingseth1); + addTarget("ath0", settingsath0); + }; +}; + + + +NetworkOptionsFrame::NetworkOptionsFrame(): + VerticalConfigurationGroup(false,false,false,false) +{ + setLabel(QObject::tr("Network Settings (2/2)")); + HostMyhostname = new HostComboBox("HostMyhostname",true); + HostMyhostname->setLabel(QObject::tr("Hostname")); + HostMyhostname->addSelection("Envy"); + HostMyhostname->addSelection("Greed"); + HostMyhostname->addSelection("Lust"); + HostMyhostname->addSelection("Sloth"); + HostMyhostname->addSelection("Wrath"); + HostMyhostname->addSelection("Gluttony"); + HostMyhostname->addSelection("Pride"); + HostMyhostname->addSelection("Humility"); + HostMyhostname->addSelection("Generosity"); + HostMyhostname->addSelection("Love"); + HostMyhostname->addSelection("Kindness"); + HostMyhostname->addSelection("SelfControl"); + HostMyhostname->addSelection("Faith"); + HostMyhostname->addSelection("Zeal"); + HostMyhostname->addSelection("type_hostname_here"); + HostMyhostname->setHelpText(QObject::tr("The hostname must resolve via DNS. If DNS is not available then append .local to the end of the hostname. When using .local, names must not include an additional .")); + + FetchDhcpHostnameButton = new TransButtonSetting(); + FetchDhcpHostnameButton ->setLabel(tr("Ask DHCP server for hostname")); + connect(FetchDhcpHostnameButton, SIGNAL(pressed()), this, SLOT(fetch_hostname())); + + networklabel = new TransLabelSetting(); + QString labelstring; + labelstring = "Will use " + hostparm.ThisHostDefaultInterface + " to check for hostname"; + networklabel->setValue(labelstring); + + ConfigurationGroup* settings = new VerticalConfigurationGroup(false, false,false,false); + settings->addChild(HostMyhostname); + settings->addChild(networklabel); + settings->addChild(FetchDhcpHostnameButton); + + addChild(settings); + +} + +QString NetworkOptionsFrame::find_hostname() +{ + QString new_host; + QString cmdtxt; + new_host="null"; + cmdtxt="sudo "; + cmdtxt.append(MV_ROOT) ; + cmdtxt.append("bin/systemconfig.py -m dhcp_request -d " ); + cmdtxt.append(hostparm.ThisHostDefaultInterface); + myth_system(cmdtxt); + system(cmdtxt); + QString line; + QFile file("/tmp/mvnetwork.dhcpinfo"); + if ( file.open(QIODevice::ReadOnly | QIODevice::Text) ) + { + Q3TextStream t( &file ); // use a text stream + while ( !t.eof() ) + { + line = t.readLine(); + if ( line.contains("new_host_name")) + { + QString s = line.simplifyWhiteSpace(); + s = s.section( "=", 1, 1 ); // s == "surname" + new_host = s.simplifyWhiteSpace(); + } + } + file.close(); + } + + return new_host; +} + +void NetworkOptionsFrame::fetch_hostname() +{ + QString new_host; + new_host=find_hostname(); + if ( new_host != "null" ) + { + networklabel->setValue("Updated the hostname."); + HostMyhostname->addSelection(new_host); + HostMyhostname->setValue(new_host); + } + else + networklabel->setValue("DHCP server did not return a hostname."); +} + +static HostCheckBox *HostAutodown() +{ + HostCheckBox *gc = new HostCheckBox("HostAutodown"); + gc->setLabel(QObject::tr("Turn off machine at a specified time")); + gc->setValue(false); + gc->setHelpText(QObject::tr("Will turn off this system.")); + return gc; +}; + +static HostSpinBox *HostWakeupTime() +{ + HostSpinBox *gc = new HostSpinBox("HostWakeupTime", -1, 23, 1, true); + gc->setLabel(QObject::tr("Power on time")); + gc->setValue(6); + gc->setHelpText(QObject::tr("Select the hour to auto poweron this system. Use -1 to disable" )); + return gc; +} + +static HostSpinBox *HostShutdownTime() +{ + HostSpinBox *gc = new HostSpinBox("HostShutdownTime", -1, 23, 1, true); + gc->setLabel(QObject::tr("Auto Shutdown time")); + gc->setValue(2); + gc->setHelpText(QObject::tr("Select the hour to poweroff this syste. Times are in 24hour format. Use -1 to disable" )); + return gc; +} + +static HostSpinBox *HostShutdownTime2() +{ + HostSpinBox *gc = new HostSpinBox("HostShutdownTime2", -1, 23, 1, true); + gc->setLabel(QObject::tr("2nd auto Shutdown time")); + gc->setValue(2); + gc->setHelpText(QObject::tr("Select the hour to poweroff this syste. Times are in 24hour format. Use -1 to disable" )); + return gc; +} + + + +static HostCheckBox *HostUseWOL() +{ + HostCheckBox *gc = new HostCheckBox("HostUseWOL"); + gc->setLabel(QObject::tr("Use Wake on Lan to turn on system")); + gc->setValue(true); + gc->setHelpText(QObject::tr("Unless you know what your doing leave it checked")); + return gc; +}; + +static HostCheckBox *HostUseNVRAM() +{ + HostCheckBox *gc = new HostCheckBox("HostUseNVRAM"); + gc->setLabel(QObject::tr("Use nvram to turn on system")); + gc->setValue(true); + gc->setHelpText(QObject::tr("Leaved checked unless nvram causes problems.")); + return gc; +}; + + +static HostCheckBox *HostUseXLargeMouse() +{ + HostCheckBox *gc = new HostCheckBox("HostUseXLargeMouse"); + gc->setLabel(QObject::tr("Large Mouse Pointer")); + gc->setValue(true); + gc->setHelpText(QObject::tr("Use an extra large mouse pointer. This takes effect the next time the frontend is started.")); + return gc; +}; + + + +class WakeSettings: public TriggeredConfigurationGroup { +public: + WakeSettings(): + + TriggeredConfigurationGroup(true) { + setLabel(QObject::tr("Shutdown Settings")); + Setting* Autodown = HostAutodown(); + addChild(Autodown); + setTrigger(Autodown); + ConfigurationGroup* settings = new VerticalConfigurationGroup(false); + settings->addChild(HostShutdownTime()); + settings->addChild(HostShutdownTime2()); + // settings->addChild(HostWakeupTime()); + // settings->addChild(HostUseNVRAM()); + // settings->addChild(HostUseWOL()); + addTarget("0", new VerticalConfigurationGroup(true)); + addTarget("1", settings); + }; +}; + +class Frontend_settings_group: public TriggeredConfigurationGroup { +public: + Frontend_settings_group(): + TriggeredConfigurationGroup(true,false,true,true,false,false,false,true) { + Setting* fe = HostRunFrontend(); + addChild(fe); + setTrigger(fe); + ConfigurationGroup* setting1 = new GridConfigurationGroup(2,false); + + setting1->addChild(HostUseXLargeMouse()); + setting1->addChild(HostUsemythfrontend()); +// setting1->addChild(HostXres()); + + ConfigurationGroup* settings = new VerticalConfigurationGroup(false); + settings->addChild(setting1); + +// settings->addChild(new HostRemoteType); + + addTarget("0", new VerticalConfigurationGroup(false)); + addTarget("1", settings); + + }; +}; + +SystemtypeGroup::SystemtypeGroup(): TriggeredConfigurationGroup(true,true,true,true,true,true,true,true) { + setLabel(QObject::tr("System Type")); + HostSystemType = new HostComboBox("HostSystemType"); + HostSystemType->setLabel(QObject::tr("System Type")); + HostSystemType->addSelection("Master_backend"); + HostSystemType->addSelection("Frontend_only"); +// HostSystemType->addSelection("Standalone"); + HostSystemType->addSelection("Slave_backend"); + + if ( ((gCoreContext->GetSetting("HostaccesshostypeSystemtype")) == "0" )) + HostSystemType->setEnabled(false); + + addChild(HostSystemType); + setTrigger(HostSystemType); + + ConfigurationGroup* fe1 = new GridConfigurationGroup(2,false,false,true,true); + fe1->addChild(HostUseXLargeMouse()); + fe1->addChild(HostUsemythfrontend()); + + ConfigurationGroup* standalone = new VerticalConfigurationGroup(false,false,true,true); +// standalone->addChild(HostXres()); + //FIXME +// standalone->addChild(new HostRemoteType); + standalone->addChild(fe1); + + + ConfigurationGroup* frontend = new VerticalConfigurationGroup(false,false,true,true); + frontend->addChild(HostMysqlserverip_listbox()); +// frontend->addChild(HostXres()); + //FIXME +// frontend->addChild(new HostRemoteType); + frontend->addChild(fe1); + + ConfigurationGroup* backend = new VerticalConfigurationGroup(false,false,false,false); + backend->addChild( new Frontend_settings_group); + + ConfigurationGroup* slave = new VerticalConfigurationGroup(false,false,true,true); + slave->addChild(HostMysqlserverip_listbox()); + slave->addChild( new Frontend_settings_group); + + + addTarget("Standalone", standalone); + addTarget("Frontend_only", frontend); + addTarget("Master_backend", backend); + addTarget("Slave_backend", slave); + connect(HostSystemType, SIGNAL(valueChanged(const QString&)), + this, SLOT(SystemtypeHelp())); + +}; + +void SystemtypeGroup::SystemtypeHelp(void) +{ + QString msg = (QObject::tr("Type of configuration for this system")); + QString selectedhostype; + selectedhostype = HostSystemType->getValue(); + if ( selectedhostype.isEmpty()) + { + HostSystemType->setHelpText(msg) ; + return; + } + + if (selectedhostype == "Standalone") + msg="Complete System, that doesn't allow outside connections."; + if (selectedhostype == "Frontend_only") + msg="Frontend_only needs a primary system (master backend) already on the network."; + if (selectedhostype == "Master_backend") + msg="Primary system with tuners, scheduling and database. This allows for remote frontend and slave backends."; + if (selectedhostype == "Slave_backend") + msg="Secondary system for extra tuners."; + + HostSystemType->setHelpText(msg) ; +} + + + +// HostRemoteType::HostRemoteType(): +// HostImageSelect("HostRemoteType") { +// setLabel(QObject::tr("Remote")); +// QString dirtxt; +// dirtxt=MV_ROOT; +// dirtxt.append("templates/remotes"); +// QDir remotes(dirtxt); +// remotes.setFilter(QDir::Dirs); +// remotes.setSorting(QDir::Name | QDir::IgnoreCase); +// QFileInfoList fil = remotes.entryInfoList(QDir::Dirs); +// for( QFileInfoList::iterator it = fil.begin(); +// it != fil.end(); +// ++it ) +// { +// QFileInfo &remote = *it; +// if (remote.fileName() == "." || remote.fileName() == ".." ) +// continue; +// +// QString name = remote.fileName(); +// QString defaultpreview = remotes.absolutePath(); +// defaultpreview += "/"; +// defaultpreview += name; +// defaultpreview += "/preview.jpg"; +// QFileInfo preview(defaultpreview); +// if (!preview.exists()) +// { +// LOG(VB_GENERAL, LOG_ERR, QString("Theme %1 missing preview image.").arg(remote.fileName())); +// } +// else +// { +// QImage* previewImage = new QImage(preview.absoluteFilePath()); +// if (previewImage->width() == 0 || previewImage->height() == 0) +// LOG(VB_GENERAL, LOG_ERR, QString("Problem reading remote preview %1").arg(preview.filePath())); +// +// //Add the remote +// addImageSelection(name, previewImage, remote.fileName()); +// LOG(VB_GENERAL, LOG_DEBUG, QString("Adding remote %1.").arg(name)); +// } +// } +// +// } + +class AdvancedSettings: public TriggeredConfigurationGroup { +public: + + AdvancedSettings(): + TriggeredConfigurationGroup(true,true,true,true,true,true,true,true) + { + + setLabel(QObject::tr("Advanced Settings (1/2)")); + Setting* Autodown = HostAutodown(); + setTrigger(Autodown); + hostparm.ThisSystemType = gCoreContext->GetSetting("HostSystemType"); + ConfigurationGroup *checkbox = new GridConfigurationGroup(2,false); + checkbox->addChild(HostServiceMythWEB()); + // checkbox->addChild(HostServiceNFS()); + checkbox->addChild(Hostbootsplash()); + checkbox->addChild(HostncidClient()); + + ConfigurationGroup* settings = new VerticalConfigurationGroup(false); + if ( hostparm.ThisSystemType == "Standalone" ) + { + // smb_busy_box(); + settings->addChild(new NCIDsettings); + // settings->addChild(new SAMBAsettings); + // checkbox->addChild(HostServiceRRD() ); + settings->addChild(checkbox) ; + } + else if (hostparm.ThisSystemType == "Master_backend" ) + { + // smb_busy_box(); +// checkbox->addChild(GlobalPKG_MIRROR()); + settings->addChild(new NCIDsettings); + // settings->addChild(new SAMBAsettings); + // checkbox->addChild(HostServiceRRD() ); + settings->addChild(checkbox) ; + } + else if (hostparm.ThisSystemType == "Frontend_only" ) + { + settings->addChild(Hostbootsplash()); + settings->addChild(HostncidClient()); +// settings->addChild(HostServiceRRD() ); + } + else if (hostparm.ThisSystemType == "Slave_backend" ) + { + settings->addChild(Hostbootsplash()); + settings->addChild(HostncidClient()); + +// settings->addChild(HostServiceRRD() ); + +// if ( (gCoreContext->GetSetting("GlobalPKG_MIRROR")) == "1") +// settings->addChild(HostPKG_MIRROR()); + }; + addTarget("", settings); + }; +}; + + +class AdvancedSettings_2: public TriggeredConfigurationGroup { +public: + AdvancedSettings_2(): + TriggeredConfigurationGroup(true,true,true,true,true,true,true,true) { + setLabel(QObject::tr("Advanced Settings (2/2)")); + Setting* Autodown = HostAutodown(); + setTrigger(Autodown); + hostparm.ThisSystemType = gCoreContext->GetSetting("HostSystemType"); +/* + ConfigurationGroup *checkbox = new GridConfigurationGroup(2,false); + checkbox->addChild(HostServiceMythWEB()); + checkbox->addChild(HostServiceNFS()); + checkbox->addChild(Hostbootsplash()); + checkbox->addChild(HostncidClient());*/ + + ConfigurationGroup* settings = new VerticalConfigurationGroup(false); + if ( hostparm.ThisSystemType == "Standalone" ) + { + settings->addChild(HostRunDHCP()); + settings->addChild(HostBEWait()); + //settings->addChild(new Evroutersettings); + } + else if (hostparm.ThisSystemType == "Master_backend" ) + { + settings->addChild(new Backupsettings); + settings->addChild(HostRunDHCP()); + settings->addChild(HostBEWait()); + //settings->addChild(new Evroutersettings); + } + else if (hostparm.ThisSystemType == "Frontend_only" ) + { + //settings->addChild(new Evroutersettings); + settings->addChild(HostBEWait()); + } + else if (hostparm.ThisSystemType == "Slave_backend" ) + { + //settings->addChild(new Evroutersettings); + settings->addChild(HostBEWait()); + }; + + addTarget("", settings); + }; +}; + + +/*_______________________________Sound settings ____________________*/ +SoundSettings::SoundSettings(): + TriggeredConfigurationGroup(true,true,true,true,true,true,true,true) { + setLabel(QObject::tr("Audio Settings")); + + HostAudiotype = new HostComboBox("HostAudiotype",false); + HostAudiotype->setLabel(QObject::tr("Sound Card Driver")); + HostAudiotype->addSelection("OSS"); + HostAudiotype->addSelection("ALSA"); + HostAudiotype->addSelection("tinker"); + + HostAudiotype->setHelpText(QObject::tr("Select the sound driver, OSS or ALSA." ) ); + addChild(HostAudiotype); + setTrigger(HostAudiotype); + +// HostsyncXine = new HostCheckBox("HostsyncXine"); +// HostsyncXine->setLabel(QObject::tr("Xine")); +// HostsyncXine->setValue(true); +// +// HostsyncMplayer = new HostCheckBox("HostsyncMplayer"); +// HostsyncMplayer->setLabel(QObject::tr("mplayer")); +// HostsyncMplayer->setValue(true); +// +// HostsyncMythMusic = new HostCheckBox("HostsyncMythMusic"); +// HostsyncMythMusic->setLabel(QObject::tr("mythmusic")); +// HostsyncMythMusic->setValue(true); +// +// HostsyncMythFrontend = new HostCheckBox("HostsyncMythFrontend"); +// HostsyncMythFrontend->setLabel(QObject::tr("mythfrontend")); +// HostsyncMythFrontend->setValue(true); + + + + +// HorizontalConfigurationGroup *syncboxes = new HorizontalConfigurationGroup(false, false, true, true); +// syncboxes->addChild(HostsyncXine); +// syncboxes->addChild(HostsyncMplayer); +// syncboxes->addChild(HostsyncMythMusic); +// syncboxes->addChild(HostsyncMythFrontend); + + HorizontalConfigurationGroup *lp = new HorizontalConfigurationGroup(false, false, true, true); + HorizontalConfigurationGroup *lpalsa = new HorizontalConfigurationGroup(false, false, true, true); + + TransButtonSetting *LoadOSSbutton = new TransButtonSetting(); + LoadOSSbutton->setLabel(tr("Load OSS driver")); + TransButtonSetting *LoadALSAbutton = new TransButtonSetting(); + LoadALSAbutton->setLabel(tr("Load ALSA driver")); + + TransButtonSetting *TestAudiobutton = new TransButtonSetting(); + TestAudiobutton->setLabel(tr("Test Audio Settings")); + lp->addChild(TestAudiobutton); + lp->addChild(LoadOSSbutton); + + TransButtonSetting *TestALSAAudiobutton = new TransButtonSetting(); + TestALSAAudiobutton->setLabel(tr("Test ALSA Audio Settings")); + lpalsa->addChild(TestALSAAudiobutton); + lpalsa->addChild(LoadALSAbutton); + + TransLabelSetting *osslabel = new TransLabelSetting(); + osslabel->setValue("The original OSS! More information can be found at:"); + + TransLabelSetting *osslabel1 = new TransLabelSetting(); + osslabel1->setValue("http://www.opensound.com \n\nPlease note to fully configure sound visit the \nMythTV audio setup.\n"); + + TransLabelSetting *AlsaLabel = new TransLabelSetting(); + AlsaLabel->setValue("ALSA, the alternative to OSS\n\nPlease note to fully configure sound visit the \nMythTV audio setup.\n"); + +// OSS GROUP + SoundOSSsettings *OSS = new SoundOSSsettings ; + ConfigurationGroup* osssettings = new VerticalConfigurationGroup(false); + osssettings->addChild(osslabel); + osssettings->addChild(osslabel1); + osssettings->addChild(OSS); + // osssettings->addChild(syncboxes); + osssettings->addChild(lp); + connect(this, SIGNAL(oss_sig()), + OSS, SLOT(soundossgathersettings())); + connect(TestAudiobutton, SIGNAL(pressed()), + this, SLOT(soundossgathersettings_1())); + connect(LoadOSSbutton, SIGNAL(pressed()), + OSS, SLOT(loadossdriver())); + +// ALSA GROUP + SoundALSAsettings *ALSA = new SoundALSAsettings ; + ConfigurationGroup* alsasettings = new VerticalConfigurationGroup(false); + alsasettings->addChild(AlsaLabel); + alsasettings->addChild(ALSA); +// alsasettings->addChild(syncboxes); + alsasettings->addChild(lpalsa); + + connect(this, SIGNAL(alsa_sig()), + ALSA, SLOT(soundalsagathersettings())); + connect(TestALSAAudiobutton, SIGNAL(pressed()), + this, SLOT(soundalsagathersettings_1())); + connect(LoadALSAbutton, SIGNAL(pressed()), + ALSA, SLOT(loadalsadriver())); + addTarget("ALSA", alsasettings); + addTarget("OSS", osssettings); + addTarget("tinker", new VerticalConfigurationGroup(false)); +}; + + +SoundOSSsettings::SoundOSSsettings(): + TriggeredConfigurationGroup(true,false,true,true,true,true,true,true) +{ + SetVertical(true); + HostSoundTypeout = new HostComboBox("HostSoundTypeout"); + HostSoundTypeout->setLabel(QObject::tr("Type")); + HostSoundTypeout->addSelection("Analog"); + HostSoundTypeout->addSelection("Digital"); + HostSoundTypeout->setHelpText(QObject::tr("")); + + HostSoundOssAnalog = new HostComboBox("HostSoundOssAnalog"); + HostSoundOssDigital = new HostComboBox("HostSoundOssDigital"); + fillossselection(); + int findossanalog=HostSoundOssAnalog->findSelection(hostparm.OLDHostSoundOSSAnalog ); + int findossdigital=HostSoundOssDigital->findSelection(hostparm.OLDHostSoundOSSDigital ); + HostSoundOssAnalog->setValue(findossanalog); + HostSoundOssDigital->setValue(findossdigital); + addChild(HostSoundTypeout); + setTrigger(HostSoundTypeout); + addTarget("Analog", HostSoundOssAnalog); + addTarget("Digital", HostSoundOssDigital); +}; + +SoundALSAsettings::SoundALSAsettings(): + TriggeredConfigurationGroup(true,false,true,true,true,true,true,true) +{ + SetVertical(true); + HostSoundALSATypeout = new HostComboBox("HostSoundALSATypeout"); + HostSoundALSATypeout->setLabel(QObject::tr("Type")); + HostSoundALSATypeout->addSelection("Analog"); + HostSoundALSATypeout->addSelection("Digital"); + HostSoundALSATypeout->setHelpText(QObject::tr("")); + + HostSoundALSAAnalog = new HostComboBox("HostSoundALSAAnalog"); + HostSoundALSADigital = new HostComboBox("HostSoundALSADigital"); + fillALSAselection(); + int findalsaanalog=HostSoundALSAAnalog->findSelection(hostparm.OLDHostSoundALSAAnalog ); + int findalsadigital=HostSoundALSADigital->findSelection(hostparm.OLDHostSoundALSADigital ); + HostSoundALSAAnalog->setValue(findalsaanalog); + HostSoundALSADigital->setValue(findalsadigital); + addChild(HostSoundALSATypeout); + setTrigger(HostSoundALSATypeout); + addTarget("Analog", HostSoundALSAAnalog); + addTarget("Digital", HostSoundALSADigital); +}; + +void SoundOSSsettings::loadossdriver() +{ +// Add info popup right here + QString cmdtxt; + cmdtxt="sudo "; + cmdtxt.append(MV_ROOT) ; + cmdtxt.append("bin/soundconfig.sh -t LOAD -i OSS &"); + system(cmdtxt); + int return_code = 0; + + QString msgtext = "Loading OSS driver" ; + + MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); + MythUIBusyDialog *busyPopup = new MythUIBusyDialog(msgtext, popupStack, + "ossbusy"); + + int progressbar=1; + MythProgressDialog *popupProgress = NULL; + popupProgress = new MythProgressDialog(msgtext, 50); + if (popupProgress) + { + popupProgress->setProgress(progressbar); + } + + if (busyPopup->Create()) + { + popupStack->AddScreen(busyPopup, false); + } + else + { + delete busyPopup; + busyPopup = NULL; + } + + + while ( return_code == 0 ) + { + progressbar++; + popupProgress->setProgress(progressbar); + if (progressbar > 50 ) + progressbar = 10; + + return_code = myth_system("ps -ef|grep soundconfig.sh|grep -v grep > /dev/null"); + qApp->processEvents (); + usleep(900); + } + + if (busyPopup) + { + busyPopup->Close(); + busyPopup = NULL; + } + + + if (popupProgress) + { + popupProgress->Close(); + popupProgress->deleteLater(); + } + + fillossselection(); + +} +void SoundALSAsettings::loadalsadriver() +{ + QString cmdtxt; + cmdtxt="sudo "; + cmdtxt.append(MV_ROOT) ; + cmdtxt.append("bin/soundconfig.sh -t LOAD -i ALSA &"); + system(cmdtxt); + int return_code = 0; + QString msgtext = "Loading ALSA driver" ; + MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); + MythUIBusyDialog *busyPopup = new MythUIBusyDialog(msgtext, popupStack,"installbusy"); + if (busyPopup->Create()) + { + popupStack->AddScreen(busyPopup, false); + } + else + { + delete busyPopup; + busyPopup = NULL; + } + + + int progressbar=1; + MythProgressDialog *popupProgress = NULL; + popupProgress = new MythProgressDialog(msgtext, 50); + if (popupProgress) + { + popupProgress->setProgress(progressbar); + } + + + while ( return_code == 0 ) + { + progressbar++; + popupProgress->setProgress(progressbar); + if (progressbar > 50 ) + progressbar = 10; + + return_code = myth_system("ps -ef|grep soundconfig.sh|grep -v grep > /dev/null"); + qApp->processEvents (); + usleep(900); + } + + if (busyPopup) + { + busyPopup->Close(); + busyPopup = NULL; + } + + if (popupProgress) + { + popupProgress->Close(); + popupProgress->deleteLater(); + } + + HostSoundALSAAnalog-> clearSelections(); + HostSoundALSADigital-> clearSelections(); + + fillALSAselection(); + +} +void SoundOSSsettings::fillossselection() +{ + myth_system("ossinfo -v1 -a |grep device > /tmp/ossdevices"); + QString currentitem; + QString currentfile = "/tmp/ossdevices"; + QString line; + QString legacy_device; + QString simpleitem; + QString currentitemtext; + QRegExp sep( "\t" ); + QFile file(currentfile); + QString ossfound="false"; + HostSoundOssAnalog->clearSelections(); + HostSoundOssDigital-> clearSelections(); + + + if ( file.open(QIODevice::ReadOnly | QIODevice::Text) ) + { + Q3TextStream t( &file ); // use a text stream + while ( !t.eof() ) + { + line = t.readLine(); + if (line.contains("device index") ) + { + legacy_device = t.readLine(); + legacy_device= legacy_device.section( "/",2,2); + currentitemtext=line.section( "/" , 0 ,0 ); + simpleitem = currentitemtext.simplifyWhiteSpace(); + simpleitem = simpleitem.remove ( "(" ); + simpleitem = simpleitem.remove ( ")" ); + simpleitem.append(" ("); + simpleitem.append(legacy_device); + simpleitem.append(")"); + if (line.contains("spdout") || line.contains("digital") ) + HostSoundOssDigital->addSelection(simpleitem); + else + HostSoundOssAnalog->addSelection(simpleitem); + ossfound="true"; + } + } + if (ossfound=="false") + { + simpleitem="No cards found, try loading the OSS drivers"; + HostSoundOssAnalog->addSelection(simpleitem); + HostSoundOssDigital->addSelection(simpleitem); + } + } + return ; +}; + + +void SoundALSAsettings::fillALSAselection() +{ + HostSoundALSAAnalog-> clearSelections(); + HostSoundALSADigital-> clearSelections(); + myth_system("aplay -l > /tmp/alsadevices"); + QString currentfile = "/tmp/alsadevices"; + QString line; + QString hwdevice; + QString alsadescription; + QString alsadescription2; + QString temphwdevice; + QString simpleitem; + QFile file(currentfile); + if ( file.open(QIODevice::ReadOnly | QIODevice::Text) ) + { + Q3TextStream t( &file ); // use a text stream + while ( !t.eof() ) + { + line = t.readLine(); + if (line.startsWith("card") ) + { + if (line.contains("snd_ctl_card_info")) + { + simpleitem="Try loading the alsa drivers"; + HostSoundALSAAnalog->addSelection(simpleitem); + HostSoundALSADigital->addSelection(simpleitem); + break; + } + //card 0: I82801DBICH4:q [Intel 82801DB-ICH4], device 0: Intel ICH [Intel 82801DB-ICH4] + alsadescription=line.section( "," , 0 ,0 ); + alsadescription=alsadescription.section(":",1,1); + + alsadescription2=line.section( "," , 1 ,1 ); + //alsadescription2=alsadescription.section(":",0,0); + + hwdevice=line.section( ":" , 0 ,0 ); + hwdevice=hwdevice.section( " " , -1,-1 ); + //grabbing 2nd half of device + temphwdevice=line.section(",",1,1); + temphwdevice=temphwdevice.section(":",0,0); + temphwdevice=temphwdevice.section(" ",-1,-1 ); + hwdevice.append(","); + hwdevice.append(temphwdevice); + simpleitem=alsadescription2 + "(hw:" + hwdevice + ")"; + if (line.contains("IEC958") || line.contains("Digital")) + HostSoundALSADigital->addSelection(simpleitem); + else + HostSoundALSAAnalog->addSelection(simpleitem); + } + } + } + return ; + +} + +void SoundSettings::soundossgathersettings_1 (void) +{ + hostparm.ThisHostAudiotype = HostAudiotype->getValue(); +// hostparm.ThisHostsyncXine = HostsyncXine->getValue(); +// hostparm.ThisHostsyncMplayer = HostsyncMplayer->getValue(); +// hostparm.ThisHostsyncMythMusic = HostsyncMythMusic->getValue(); +// hostparm.ThisHostsyncMythFrontend = HostsyncMythFrontend->getValue(); + // emit the signal to call soundossgathersetting. + emit oss_sig(); +}; +void SoundSettings::soundalsagathersettings_1 (void) +{ + hostparm.ThisHostAudiotype = HostAudiotype->getValue(); +// hostparm.ThisHostsyncXine = HostsyncXine->getValue(); +// hostparm.ThisHostsyncMplayer = HostsyncMplayer->getValue(); +// hostparm.ThisHostsyncMythMusic = HostsyncMythMusic->getValue(); +// hostparm.ThisHostsyncMythFrontend = HostsyncMythFrontend->getValue(); + // emit the signal to call soundALSAgathersetting. + emit alsa_sig(); +}; + + +void SoundOSSsettings::soundossgathersettings(void) +{ + hostparm.ThisHostSoundTypeout = HostSoundTypeout->getValue() ; + hostparm.ThisHostSoundOSSAnalog = HostSoundOssAnalog->getValue(); + hostparm.ThisHostSoundOSSDigital = HostSoundOssDigital->getValue(); + QString tempdevice; + if ( hostparm.ThisHostSoundTypeout == "Analog" ) + { + tempdevice = hostparm.ThisHostSoundOSSAnalog ; + } + else + { + tempdevice = hostparm.ThisHostSoundOSSDigital ; + }; + tempdevice = tempdevice.section( "(", 1,1 ); + tempdevice = tempdevice.section( ")", 0,0 ); + hostparm.ThisHostSoundDevice = "/dev/"; + hostparm.ThisHostSoundDevice.append(tempdevice); + // Add info popup right here + QString cmdtxt; + cmdtxt=MV_ROOT ; + cmdtxt.append("bin/soundconfig.sh -t test -i OSS -d " + hostparm.ThisHostSoundDevice + "&"); + system(cmdtxt); + int return_code = 0; + QString msgtext = "Playing sample audio" ; + + MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); + MythUIBusyDialog *busyPopup = new MythUIBusyDialog(msgtext, popupStack,"installbusy"); + + int progressbar=1; + MythProgressDialog *popupProgress = NULL; + popupProgress = new MythProgressDialog(msgtext, 50); + if (popupProgress) + { + popupProgress->setProgress(progressbar); + } + + + + + + if (busyPopup->Create()) + { + popupStack->AddScreen(busyPopup, false); + } + else + { + delete busyPopup; + busyPopup = NULL; + } + + + + + while ( return_code == 0 ) + { + progressbar++; + popupProgress->setProgress(progressbar); + if (progressbar > 50 ) + progressbar = 10; + + return_code = myth_system("ps -ef|grep soundconfig.sh|grep -v grep > /dev/null"); + qApp->processEvents (); + usleep(900); + } + + if (busyPopup) + { + busyPopup->Close(); + busyPopup = NULL; + } + + if (popupProgress) + { + popupProgress->Close(); + popupProgress->deleteLater(); + } + +}; + +void SoundALSAsettings::soundalsagathersettings(void) +{ + + hostparm.ThisHostSoundALSATypeout = HostSoundALSATypeout->getValue() ; + hostparm.ThisHostSoundALSAAnalog = HostSoundALSAAnalog->getValue(); + hostparm.ThisHostSoundALSADigital = HostSoundALSADigital->getValue(); + + QString tempdevice; + if ( hostparm.ThisHostSoundALSATypeout == "Analog" ) + { + tempdevice = hostparm.ThisHostSoundALSAAnalog ; + } + else + { + tempdevice = hostparm.ThisHostSoundALSADigital ; + }; + tempdevice = tempdevice.section( "(", 1,1 ); + tempdevice = tempdevice.section( ")", 0,0 ); + hostparm.ThisHostSoundDevice = tempdevice; + // Add info popup right here + QString cmdtxt; + cmdtxt=MV_ROOT ; + cmdtxt.append("bin/soundconfig.sh -t test -i ALSA -d " + hostparm.ThisHostSoundDevice + "&"); + system(cmdtxt); + int return_code = 0; + QString msgtext = "Playing sample audio" ; + MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); + MythUIBusyDialog *busyPopup = new MythUIBusyDialog(msgtext, popupStack,"installbusy"); + if (busyPopup->Create()) + { + popupStack->AddScreen(busyPopup, false); + } + else + { + delete busyPopup; + busyPopup = NULL; + } + + int progressbar=1; + MythProgressDialog *popupProgress = NULL; + popupProgress = new MythProgressDialog(msgtext, 50); + if (popupProgress) + { + popupProgress->setProgress(progressbar); + } + + + + while ( return_code == 0 ) + { + progressbar++; + popupProgress->setProgress(progressbar); + if (progressbar > 50 ) + progressbar = 10; + + + return_code = myth_system("ps -ef|grep soundconfig.sh|grep -v grep > /dev/null"); + qApp->processEvents (); + usleep(900); + } + + if (busyPopup) + { + busyPopup->Close(); + busyPopup = NULL; + } + + if (popupProgress) + { + popupProgress->Close(); + popupProgress->deleteLater(); + } + + + + +}; + + +/* __________________________ END OF CLASSES_________________________*/ + +void pre_writesettings () +{ + hostparm.ThisSystemType = gCoreContext->GetSetting("HostSystemType"); + hostparm.ThisDBhost = gCoreContext->GetSetting("HostMysqlServer"); + hostparm.ThisHostName = gCoreContext->GetSetting("HostMyhostname"); + + if ( hostparm.ThisSystemType == "Standalone" ) + { + hostparm.ThisDBhost = "localhost" ; + hostparm.ThisRunfrontend = "1" ; + gCoreContext->SaveSetting("HostRunFrontend", hostparm.ThisRunfrontend ); + // disable pkgmirror +// hostparm.ThisHostPKG_MIRROR = "0"; +// //gCoreContext->SaveSetting("GlobalPKG_MIRROR", hostparm.ThisHostPKG_MIRROR ); +// hostparm.ThisHostServiceHobbit = gCoreContext->GetSetting("GlobalServiceHobbitserver"); +// if (hostparm.ThisHostServiceHobbit == "" ) +// { +// hostparm.ThisHostServiceHobbit = "1"; +// QString s = "GlobalServiceHobbitserver"; +// gCoreContext->SaveSettingOnHost(s, hostparm.ThisHostServiceHobbit ,NULL); +// } + } + else if (hostparm.ThisSystemType == "Master_backend" ) + { + if ( hostparm.ThisNFS =="" && gCoreContext->GetSetting("HostServiceNFS") == "" ) + { + hostparm.ThisNFS = "1"; + gCoreContext->SaveSetting("HostServiceNFS",hostparm.ThisNFS ); + } + hostparm.ThisDBhost = "127.0.0.1" ; + //GlobalPKG is only an option for MBE +// hostparm.ThisHostPKG_MIRROR = (gCoreContext->GetSetting("GlobalPKG_MIRROR")) ; +// hostparm.ThisHostServiceHobbit = gCoreContext->GetSetting("GlobalServiceHobbitserver"); +// if (hostparm.ThisHostServiceHobbit == "" ) +// { +// hostparm.ThisHostServiceHobbit = "1"; +// QString s = "GlobalServiceHobbitserver"; +// gCoreContext->SaveSettingOnHost(s, hostparm.ThisHostServiceHobbit,NULL ); +// } + } + else if (hostparm.ThisSystemType == "Frontend_only" ) + { + hostparm.ThisRunfrontend = "1" ; + hostparm.ThisSamba = "0"; + hostparm.ThisNFS = "0"; + hostparm.ThisMythWEB = "0"; + gCoreContext->SaveSetting("HostRunFrontend", hostparm.ThisRunfrontend ); + gCoreContext->SaveSetting("HostServiceSamba", hostparm.ThisSamba ); + gCoreContext->SaveSetting("HostServiceNFS", hostparm.ThisNFS ); + gCoreContext->SaveSetting("HostServiceMythWEB",hostparm.ThisMythWEB ); + // if GBL is enabled, then check for host setting, else disable it +// if ( (gCoreContext->GetSetting("GlobalPKG_MIRROR") ) == "1" ) +// { +// hostparm.ThisHostPKG_MIRROR = gCoreContext->GetSetting("HostPKG_MIRROR"); +// } +// else +// { +// hostparm.ThisHostPKG_MIRROR = "0"; +// }; +// +// if ( ((gCoreContext->GetSetting("GlobalServiceHobbitserver") ) == "1") || install_hobbit ) +// { +// hostparm.ThisHostServiceHobbit = gCoreContext->GetSetting("HostServiceHobbitclient"); +// } +// else +// { +// hostparm.ThisHostServiceHobbit = "0"; +// } +// +// gCoreContext->SaveSetting("HostPKG_MIRROR", hostparm.ThisHostPKG_MIRROR ); +// gCoreContext->SaveSetting("HostServiceHobbitclient", hostparm.ThisHostServiceHobbit); + + } + else if (hostparm.ThisSystemType == "Slave_backend" ) + { + hostparm.ThisSamba = "0"; + hostparm.ThisNFS = "0"; + hostparm.ThisMythWEB = "0"; + gCoreContext->SaveSetting("HostServiceSamba", hostparm.ThisSamba ); + gCoreContext->SaveSetting("HostServiceNFS", hostparm.ThisNFS ); + gCoreContext->SaveSetting("HostServiceMythWEB",hostparm.ThisMythWEB ); +// if ( (gCoreContext->GetSetting("GlobalPKG_MIRROR") ) == "1" ) +// { +// hostparm.ThisHostPKG_MIRROR = gCoreContext->GetSetting("HostPKG_MIRROR"); +// } +// else +// { +// hostparm.ThisHostPKG_MIRROR = "0"; +// } +// if ( ((gCoreContext->GetSetting("GlobalServiceHobbitserver") ) == "1") || install_hobbit ) +// { +// hostparm.ThisHostServiceHobbit = gCoreContext->GetSetting("HostServiceHobbitclient"); +// } +// else +// { +// +// hostparm.ThisHostServiceHobbit = "0"; +// } +// +// gCoreContext->SaveSetting("HostPKG_MIRROR", hostparm.ThisHostPKG_MIRROR ); +// gCoreContext->SaveSetting("HostServiceHobbitclient", hostparm.ThisHostServiceHobbit); + + }; + +// if ( hostparm.ThisHostDefaultInterface == "" ) +// { +// if ( gCoreContext->GetSetting("HostDefaulteth0") == "1" ) +// hostparm.ThisHostDefaultInterface = "eth0"; +// else if ( gCoreContext->GetSetting("HostDefaulteth1") == "1" ) +// hostparm.ThisHostDefaultInterface = "eth1"; +// else if ( gCoreContext->GetSetting("HostDefaultwlan0") == "1" ) +// hostparm.ThisHostDefaultInterface = "wlan0"; +// else if ( gCoreContext->GetSetting("HostDefaultwlan1") == "1" ) +// hostparm.ThisHostDefaultInterface = "wlan1"; +// else if ( gCoreContext->GetSetting("HostActiveonbooteth0") == "1" ) +// hostparm.ThisHostDefaultInterface = "eth0"; +// else if ( gCoreContext->GetSetting("HostActiveonbooteth1") == "1" ) +// hostparm.ThisHostDefaultInterface = "eth1"; +// else if ( gCoreContext->GetSetting("HostActiveonbootwlan0") == "1" ) +// hostparm.ThisHostDefaultInterface = "wlan0"; +// else if ( gCoreContext->GetSetting("HostActiveonbootwlan1") == "1" ) +// hostparm.ThisHostDefaultInterface = "wlan1"; +// else +// hostparm.ThisHostDefaultInterface = "ack"; +// } +// Even after all the above, it's still possible to set the Default interface to one that isn't active. + + hostparm.ThisDBhost = hostparm.ThisDBhost.section( "\t", 0, 0 ); + if ( hostparm.ThisHostName == "" || hostparm.ThisHostName == "type_hostname_here") + hostparm.ThisHostName = "diamonds"; + //remove spaces from hostname + QString s = hostparm.ThisHostName.replace ( QRegExp(" "),""); + hostparm.ThisHostName = s; + if ( hostparm.ThisHostName == "" ) + { + hostparm.ThisHostName=gCoreContext->GetHostName(); + } + + // piece togther the timezone + QString tz; + QString tregion; + QString tsubregion; +//----------------- +//I don't think this is needed anymore + tz=gCoreContext->GetSetting("HostTimeZone"); + if ( tz.isEmpty() || (tz == "Unknown")) + timezone_unknown = TRUE; +//----------- + + tregion=gCoreContext->GetSetting("HostTimeZoneRegion"); + tsubregion=gCoreContext->GetSetting("HostTimeZoneRegion_"+tregion); + if ( tsubregion.isEmpty() ) + hostparm.ThisTimeZone = tregion; + else + hostparm.ThisTimeZone = tregion + "/" + tsubregion; + + gCoreContext->SaveSetting("HostMyhostname" , hostparm.ThisHostName ); + gCoreContext->SaveSetting("HostMysqlserver", hostparm.ThisDBhost ); + gCoreContext->SaveSetting("HostTimeZone", hostparm.ThisTimeZone ); +} + +void run_systemconfig(QString modulelist, bool restart, QString dbcommand) +{ + QString cmdtxt; + cmdtxt="sudo "; + cmdtxt.append(MV_ROOT) ; + cmdtxt.append("bin/systemconfig.sh " + modulelist + " &"); + myth_system(cmdtxt); + int return_code = 0; + QString msgtext = "Please wait while " ; + msgtext.append(gCoreContext->GetSetting("HostMyhostname")); + msgtext.append(" is configured"); + MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); + MythUIBusyDialog *busyPopup = new MythUIBusyDialog(msgtext, popupStack,"installbusy"); + if (busyPopup->Create()) + { + popupStack->AddScreen(busyPopup, false); + } + else + { + delete busyPopup; + busyPopup = NULL; + } + while ( return_code == 0 ) + { + return_code = myth_system("ps -ef|grep systemconfig.sh|grep -v grep > /dev/null"); + qApp->processEvents (); + usleep(900); + } + + if (busyPopup) + { + busyPopup->Close(); + busyPopup = NULL; + } + + + + if (restart) + { + return_code = 1; + int loopnumber=0 ; + bool doloop = true; + + QString msgtext = "Transferring database settings" ; + MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); + MythUIBusyDialog *busyPopup = new MythUIBusyDialog(msgtext, popupStack,"installbusy"); + if (busyPopup->Create()) + { + popupStack->AddScreen(busyPopup, false); + } + else + { + delete busyPopup; + busyPopup = NULL; + } + + + + + while ( doloop ) + { + return_code = myth_system(dbcommand); + qApp->processEvents (); + usleep(100); + loopnumber++ ; + if ( return_code == 0 || loopnumber >= 20000000 ) + doloop=false; + } + if (busyPopup) + { + busyPopup->Close(); + busyPopup = NULL; + } + + }; + + + +} + + + +int runsettings (bool mysqlonly , bool shownetwork , bool showhostype, + bool showmisc , bool showshutdown, bool showadvanced, + bool showsound,bool showadvancedX, bool showaccesscontrol, + bool showplugins , bool showsoftware, bool showuser , + bool showwebuser , bool showddns , bool showinfrared , + bool showscreensaver , bool showsupplemental, + bool showremotesonly, bool showvnc, bool showfileshare) +{ + displaymysqlonly = false ; + displayshownetwork =false ; + displayshowhostype = false ; + displayshowmisc =false ; + displayshowshutdown =false ; + displayshowadvanced = false; + displayshowsound = false ; + displayshowadvancedX = false; + displayaccesscontrol= false; + displayplugins= false; + displaysoftware= false; + displayuser = false; + displaywebuser = false; + displayddns = false; + displayinfrared = false; + displayscreensaver = false; + displaysupplemental = false; + displayremotesonly = false; + displayvnc = false; + displayfileshare = false; + + //gCoreContext->ActivateSettingsCache(true); + //gCoreContext->ClearSettingsCache(); + bool runothers=false; + bool continuerun=true; + int retc = 0 ; + displaymysqlonly = mysqlonly; + + if (displaymysqlonly ) + { + MythInstallSettings mysqlsettings; + mysqlsettings.Load(); + mysqlsettings.Save(); + if ( mysqlsettings.exec() == QDialog::Accepted ) + { + retc = 1; + } + else + { + retc=2; + }; + }; + + if ( shownetwork ) + { + displayshownetwork = shownetwork; + MythInstallSettings settings; + settings.Load(); + settings.Save(); + if ( settings.exec() == QDialog::Accepted ) + { + retc = 1; + } + else + { + continuerun=false; + retc=2; + }; + displayshownetwork = false; + }; + + if ( showhostype && continuerun ) + { + displayshowhostype = showhostype; + system ("avahi-browse -l -r -t _mysql._tcp > /tmp/mysqllist"); + MythInstallSettings settings1; + settings1.Load(); + settings1.Save(); + if ( settings1.exec() == QDialog::Accepted ) + { + retc = 1; + } + else + { + continuerun=false; + retc=2; + }; + displayshowhostype=false; + } + + if ( showmisc || showshutdown || showsound || showadvancedX || showadvanced || showaccesscontrol || showplugins || showsoftware || showuser || showwebuser || showddns || showinfrared || showscreensaver || showsupplemental || showremotesonly || showvnc || showfileshare) + { + runothers=true; + displayshowmisc = showmisc; + displayshowshutdown = showshutdown; + displayshowadvanced = showadvanced; + displayshowsound = showsound; + displayshowadvancedX = showadvancedX; + hostparm.displayshowadvancedX=showadvancedX; + displayaccesscontrol = showaccesscontrol ; + displayplugins = showplugins; + displaysoftware = showsoftware; + displayuser = showuser; + displaywebuser = showwebuser; + displayddns = showddns ; + displayinfrared = showinfrared; + displayscreensaver = showscreensaver; + displaysupplemental = showsupplemental ; + displayremotesonly = showremotesonly ; + displayvnc = showvnc ; + displayfileshare = showfileshare; +// if (displayshowadvancedX) +// { +// ReadDDCvalues(); +// } + }; + + + if ( runothers && continuerun ) + { + //do I need this prewerite? + pre_writesettings(); + //FINDME + DatabaseParams params = gContext->GetDatabaseParams(); + QString cmdtxt=MV_ROOT ; + cmdtxt.append("bin/timezip.py -m "); + QString zipcommand=cmdtxt; + zipcommand.append(hostparm.ThisDBhost); + //FINDME + zipcommand.append(" -d " + params.dbHostName ); + //cout << zipcommand << endl; + myth_system(zipcommand); + //hostparm.ThisHostZipcode = gCoreContext->GetSetting("HostZipcode"); + hostparm.ThisTimeZone = gCoreContext->GetSetting("HostTimeZone"); +// hostparm.ThisHostServiceHobbit = gCoreContext->GetSetting("HostServiceHobbitclient"); +// if ( hostparm.ThisHostServiceHobbit == "1" ) +// install_hobbit = true; + + MythInstallSettings settings2; + settings2.Load(); + settings2.Save(); +// gCoreContext->SaveSetting("HostServiceHobbitclient", hostparm.ThisHostServiceHobbit ); + if ( settings2.exec() == QDialog::Accepted ) + { + retc = 1; + } + else + { + continuerun=false; + retc=2; + }; + }; + pre_writesettings(); + if ( mysqlonly ) + { + QString cmdtxt; + cmdtxt=MV_ROOT ; + cmdtxt.append("bin/systemconfig.sh Mysql_only " + hostparm.ThisDBhost); + myth_system(cmdtxt); + } + else + { + if (retc == 1) + writesettings(); + } + return retc; +}; + + + +void writesettings () +{ + // ofstream myfile; + gCoreContext->ClearSettingsCache(); + //gCoreContext->ActivateSettingsCache(false); + hostparm.language = gCoreContext->GetSetting("language"); + hostparm.ThisHostName = gCoreContext->GetSetting("HostMyhostname").toLower(); + hostparm.ThisTimeZone = gCoreContext->GetSetting("HostTimeZone"); + + hostparm.ThisHostIPeth0 = gCoreContext->GetSetting("HostIPeth0"); + hostparm.ThisHostNETMASKeth0 = gCoreContext->GetSetting("HostNETMASKeth0"); + hostparm.ThisHostDNSeth0 = gCoreContext->GetSetting("HostDNSeth0"); + hostparm.ThisHostUSEDHCPeth0 = gCoreContext->GetSetting("HostUseDHCPeth0"); + hostparm.ThisHostGWeth0 = gCoreContext->GetSetting("HostGWeth0"); + hostparm.ThisHostActiveonbooteth0 = gCoreContext->GetSetting("HostActiveonbooteth0"); + hostparm.ThisHOSTESSIDeth0 = gCoreContext->GetSetting("HOSTESSIDeth0"); + hostparm.ThisHostUseEncryptioneth0 = gCoreContext->GetSetting("HostUseEncryptioneth0"); + hostparm.ThisHostkeyeth0 = gCoreContext->GetSetting("Hostkeyeth0"); + hostparm.ThisHostMTUeth0 = gCoreContext->GetSetting("HostMTUeth0"); + + hostparm.ThisHostIPeth1 = gCoreContext->GetSetting("HostIPeth1"); + hostparm.ThisHostNETMASKeth1 = gCoreContext->GetSetting("HostNETMASKeth1"); + hostparm.ThisHostDNSeth1 = gCoreContext->GetSetting("HostDNSeth1"); + hostparm.ThisHostUSEDHCPeth1 = gCoreContext->GetSetting("HostUseDHCPeth1"); + hostparm.ThisHostGWeth1 = gCoreContext->GetSetting("HostGWeth1"); + hostparm.ThisHostActiveonbooteth1 = gCoreContext->GetSetting("HostActiveonbooteth1"); + hostparm.ThisHOSTESSIDeth1 = gCoreContext->GetSetting("HOSTESSIDeth1"); + hostparm.ThisHostUseEncryptioneth1 = gCoreContext->GetSetting("HostUseEncryptioneth1"); + hostparm.ThisHostkeyeth1 = gCoreContext->GetSetting("Hostkeyeth1"); + hostparm.ThisHostMTUeth1 = gCoreContext->GetSetting("HostMTUeth1"); + + hostparm.ThisHostIPwlan0 = gCoreContext->GetSetting("HostIPwlan0"); + hostparm.ThisHostNETMASKwlan0 = gCoreContext->GetSetting("HostNETMASKwlan0"); + hostparm.ThisHostDNSwlan0 = gCoreContext->GetSetting("HostDNSwlan0"); + hostparm.ThisHostUSEDHCPwlan0 = gCoreContext->GetSetting("HostUseDHCPwlan0"); + hostparm.ThisHostGWwlan0 = gCoreContext->GetSetting("HostGWwlan0"); + hostparm.ThisHostActiveonbootwlan0 = gCoreContext->GetSetting("HostActiveonbootwlan0"); + hostparm.ThisHOSTESSIDwlan0 = gCoreContext->GetSetting("HOSTESSIDwlan0"); + hostparm.ThisHostUseEncryptionwlan0 = gCoreContext->GetSetting("HostUseEncryptionwlan0"); + hostparm.ThisHostkeywlan0 = gCoreContext->GetSetting("Hostkeywlan0"); + hostparm.ThisHostMTUwlan0 = gCoreContext->GetSetting("HostMTUwlan0"); + + hostparm.ThisHostIPwlan1 = gCoreContext->GetSetting("HostIPwlan1"); + hostparm.ThisHostNETMASKwlan1 = gCoreContext->GetSetting("HostNETMASKwlan1"); + hostparm.ThisHostDNSwlan1 = gCoreContext->GetSetting("HostDNSwlan1"); + hostparm.ThisHostUSEDHCPwlan1 = gCoreContext->GetSetting("HostUseDHCPwlan1"); + hostparm.ThisHostGWwlan1 = gCoreContext->GetSetting("HostGWwlan1"); + hostparm.ThisHostActiveonbootwlan1 = gCoreContext->GetSetting("HostActiveonbootwlan1"); + hostparm.ThisHOSTESSIDwlan1 = gCoreContext->GetSetting("HOSTESSIDwlan1"); + hostparm.ThisHostUseEncryptionwlan1 = gCoreContext->GetSetting("HostUseEncryptionwlan1"); + hostparm.ThisHostkeywlan1 = gCoreContext->GetSetting("Hostkeywlan1"); + hostparm.ThisHostMTUwlan1 = gCoreContext->GetSetting("HostMTUwlan1"); + + hostparm.ThisHostIPath0 = gCoreContext->GetSetting("HostIPath0"); + hostparm.ThisHostNETMASKath0 = gCoreContext->GetSetting("HostNETMASKath0"); + hostparm.ThisHostDNSath0 = gCoreContext->GetSetting("HostDNSath0"); + hostparm.ThisHostUSEDHCPath0 = gCoreContext->GetSetting("HostUseDHCPath0"); + hostparm.ThisHostGWath0 = gCoreContext->GetSetting("HostGWath0"); + hostparm.ThisHostActiveonbootath0 = gCoreContext->GetSetting("HostActiveonbootath0"); + hostparm.ThisHOSTESSIDath0 = gCoreContext->GetSetting("HOSTESSIDath0"); + hostparm.ThisHostUseEncryptionath0 = gCoreContext->GetSetting("HostUseEncryptionath0"); + hostparm.ThisHostkeyath0 = gCoreContext->GetSetting("Hostkeyath0"); + hostparm.ThisHostMTUath0 = gCoreContext->GetSetting("HostMTUath0"); + + + // hostparm.ThisHostServiceRRD = gCoreContext->GetSetting("HostServiceRRD"); + hostparm.ThisSamba = gCoreContext->GetSetting("HostServiceSamba"); + hostparm.ThisHostServiceSamba_media = gCoreContext->GetSetting("HostServiceSamba_media"); + hostparm.ThisHostServiceSamba_write = gCoreContext->GetSetting("HostServiceSamba_write"); + hostparm.ThisHostServiceSamba_home = gCoreContext->GetSetting("HostServiceSamba_home"); + hostparm.ThisHostServiceSamba_writehome = gCoreContext->GetSetting("HostServiceSamba_writehome"); + hostparm.ThisHostServiceSamba_domain = gCoreContext->GetSetting("HostServiceSamba_domain"); + hostparm.ThisNFS = gCoreContext->GetSetting("HostServiceNFS"); + hostparm.ThisHostCentralNFSallhosts = gCoreContext->GetSetting("HostCentralNFSallhosts"); + hostparm.ThisMythWEB = gCoreContext->GetSetting("HostServiceMythWEB"); + hostparm.ThisHostwebauth = gCoreContext->GetSetting("HOSTwebauth"); + + hostparm.ThisHostRunDHCP = gCoreContext->GetSetting("HostRunDHCP"); + hostparm.ThisSystemType = gCoreContext->GetSetting("HostSystemType"); + + // determine the remote based off the host bucket. + hostparm.ThisHostRemotebucket = gCoreContext->GetSetting("HostRemotebucket"); + if ( hostparm.ThisHostRemotebucket == "favorites" ) + hostparm.ThisRemote = gCoreContext->GetSetting("HostRemoteType_favorites"); + if ( hostparm.ThisHostRemotebucket == "user" ) + hostparm.ThisRemote = gCoreContext->GetSetting("HostRemoteType_user"); + if ( hostparm.ThisHostRemotebucket == "other" ) + hostparm.ThisRemote = gCoreContext->GetSetting("HostRemoteType_other"); + if ( hostparm.ThisHostRemotebucket == "hauppauge" ) + hostparm.ThisRemote = gCoreContext->GetSetting("HostRemoteType_hauppauge"); + if ( hostparm.ThisHostRemotebucket == "ATI" ) + hostparm.ThisRemote = gCoreContext->GetSetting("HostRemoteType_ATI"); + + hostparm.ThisHostBEWait = gCoreContext->GetSetting("HostBEWait"); + hostparm.ThisHostLircWait = gCoreContext->GetSetting("HostLircWait"); + + hostparm.ThisHDHRlirc_device = gCoreContext->GetSetting("HostHDHRlirc_device"); + hostparm.ThisReceiverType = gCoreContext->GetSetting("HostReceiverType"); + hostparm.ThisHostSerialPortlirc = gCoreContext->GetSetting("HostSerialPortlirc"); + // hostparm.ThisHostUseEvrouter = gCoreContext->GetSetting("HostRunEvrouter"); + // hostparm.ThisHostEvrouterConfig = gCoreContext->GetSetting("HostEvrouterConfig"); + hostparm.ThisXres = gCoreContext->GetSetting("HostXres"); + hostparm.ThisHostUseXLargeMouse = gCoreContext->GetSetting("HostUseXLargeMouse"); + hostparm.ThisAutodown = gCoreContext->GetSetting("HostAutodown"); + hostparm.ThisShutdowntime = gCoreContext->GetSetting("HostShutdownTime"); + hostparm.ThisShutdowntime2 = gCoreContext->GetSetting("HostShutdownTime2"); + hostparm.ThisWakeuptime = gCoreContext->GetSetting("HostWakeupTime"); + hostparm.ThisUseNVRAM = gCoreContext->GetSetting("HostUseNVRAM"); + hostparm.ThisUseWOL = gCoreContext->GetSetting("HostUseWOL"); + hostparm.ThisKeepPackage = gCoreContext->GetSetting("HostKeepPackages"); + hostparm.ThisMythWelcome = gCoreContext->GetSetting("HostUseMythWelcome"); + hostparm.ThisHaveNFS = gCoreContext->GetSetting("HostHaveCentralNFS"); + hostparm.ThisNFSserver = gCoreContext->GetSetting("HostCentralNFSIP"); + hostparm.ThisNFSmountpoint = gCoreContext->GetSetting("HostNFSmountpoint"); + hostparm.ThisHostupdateplan = gCoreContext->GetSetting("Hostupdateplan"); + hostparm.ThisShowToolTips = gCoreContext->GetSetting("HostShowToolTips"); + hostparm.ThisRunfrontend = gCoreContext->GetSetting("HostRunFrontend"); + //hostparm.ThisHostZipcode = gCoreContext->GetSetting("HostZipcode"); + hostparm.ThisHostncidClient = gCoreContext->GetSetting("HostncidClient"); + hostparm.ThisHostncidDaemon = gCoreContext->GetSetting("HostncidDaemon"); + hostparm.ThisHostSerialPortncid = gCoreContext->GetSetting("HostSerialPortncid"); + hostparm.ThisHostNcidDeviceNetCallerID = gCoreContext->GetSetting("HostNcidDeviceNetCallerID"); + hostparm.ThisHostbootsplash = gCoreContext->GetSetting("Hostbootsplash"); + + hostparm.ThisXIgnoreConfig =gCoreContext->GetSetting("HostXIgnoreConfig"); + hostparm.ThisXcardtype =gCoreContext->GetSetting("HostXcardtype"); + hostparm.ThisXUseAdvanced =gCoreContext->GetSetting("HostXUseAdvanced"); + hostparm.ThisXIgnoreEDID =gCoreContext->GetSetting("HostXIgnoreEDID"); + hostparm.ThisXconnection =gCoreContext->GetSetting("HostXconnection"); + hostparm.ThisXDisplaysize =gCoreContext->GetSetting("HostXDisplaysize"); + hostparm.ThisHostXNvidia1080p =gCoreContext->GetSetting("HostXNvidia1080p"); + hostparm.ThisHostXNvidia1080i =gCoreContext->GetSetting("HostXNvidia1080i"); + hostparm.ThisHostXNvidia720p =gCoreContext->GetSetting("HostXNvidia720p"); + hostparm.ThisHostXNvidia480p =gCoreContext->GetSetting("HostXNvidia480p"); +// EDID settings + QString tempstring; + tempstring = gCoreContext->GetSetting("HostXHsyncLow"); + tempstring.append(" - "); + tempstring.append(gCoreContext->GetSetting("HostXHsyncHigh") ); + hostparm.ThisXHsync=tempstring; + tempstring =""; + tempstring=gCoreContext->GetSetting("HostXVrefreshLow"); + tempstring.append(" - "); + tempstring.append(gCoreContext->GetSetting("HostXVrefreshHigh")); + hostparm.ThisXVrefresh=tempstring; + +// Assemble the advanced modeline string + QString modelinetype = gCoreContext->GetSetting("HostXModelineCatagory");; + QString tempmodeline = "HostXadvancedres" + modelinetype ; + QString modeline = gCoreContext->GetSetting(tempmodeline); + hostparm.ThisXresadvanced = modelinetype +"_"+modeline; + +// Gather settings based on card type + if ( hostparm.ThisXcardtype == "nVidia" ) + { + hostparm.ThisXTVstandard = gCoreContext->GetSetting("HostXnVidiaTVstandard"); + hostparm.ThisXTVconnection= gCoreContext->GetSetting("HostXnVidiaTVformat"); + modelinetype = gCoreContext->GetSetting("HostXNvidiaModelineCatagory");; + tempmodeline = "HostXNvidiaadvancedres" + modelinetype ; + modeline = gCoreContext->GetSetting(tempmodeline); + hostparm.ThisXresadvanced = modelinetype +"_"+modeline; + } + else if ( hostparm.ThisXcardtype == "ATI" ) + { + hostparm.ThisXTVstandard = gCoreContext->GetSetting("HostXATITVstandard"); + hostparm.ThisXTVconnection= gCoreContext->GetSetting("HostXati-tvformat"); + } + + +//********************************************************************************************* +// AUDIO SETTINGS +//****************************************************************************************** + hostparm.ThisHostAudiotype = gCoreContext->GetSetting("HostAudiotype"); +// hostparm.ThisHostsyncXine = gCoreContext->GetSetting("HostsyncXine"); +// hostparm.ThisHostsyncMplayer = gCoreContext->GetSetting("HostsyncMplayer"); +// hostparm.ThisHostsyncMythMusic = gCoreContext->GetSetting("HostsyncMythMusic"); +// hostparm.ThisHostsyncMythFrontend = gCoreContext->GetSetting("HostsyncMythFrontend"); + hostparm.ThisHostSoundTypeout = gCoreContext->GetSetting("HostSoundTypeout") ; + hostparm.ThisHostSoundOSSAnalog = gCoreContext->GetSetting("HostSoundOssAnalog"); + hostparm.ThisHostSoundOSSDigital = gCoreContext->GetSetting("HostSoundOssDigital"); + hostparm.ThisHostSoundALSATypeout = gCoreContext->GetSetting("HostSoundALSATypeout") ; + hostparm.ThisHostSoundALSAAnalog = gCoreContext->GetSetting("HostSoundALSAAnalog"); + hostparm.ThisHostSoundALSADigital = gCoreContext->GetSetting("HostSoundALSADigital"); + + if ( hostparm.ThisHostAudiotype == "OSS" ) + { + QString tempdevice; + QChar tempchar ; + hostparm.ThisHostSoundDevice = "/dev/dsp"; + if ( hostparm.ThisHostSoundTypeout == "Analog" ) + tempdevice = hostparm.ThisHostSoundOSSAnalog ; + + if ( hostparm.ThisHostSoundTypeout == "Digital" ) + tempdevice = hostparm.ThisHostSoundOSSDigital ; + + int tlength=(tempdevice.length() -2 ); + if ( tlength > 0 ) + { + tempchar = tempdevice.at( tlength); + hostparm.ThisHostSoundDevice.append(tempchar); + }; + } + + + if ( hostparm.ThisHostAudiotype == "ALSA" ) + { + QString tempdevice; + hostparm.ThisHostSoundTypeout = hostparm.ThisHostSoundALSATypeout; + if ( hostparm.ThisHostSoundTypeout == "Digital" ) + tempdevice=hostparm.ThisHostSoundALSADigital; + if ( hostparm.ThisHostSoundTypeout == "Analog" ) + tempdevice=hostparm.ThisHostSoundALSAAnalog; + + tempdevice = tempdevice.section( "(", 1,1 ); + tempdevice = tempdevice.section( ")", 0,0 ); + hostparm.ThisHostSoundDevice = tempdevice; + } +// Turn off internal audio controls is digital audio is seleced + if ( hostparm.ThisHostSoundTypeout == "Digital" ) + gCoreContext->SaveSetting("MythControlsVolume","0"); + +// LCD TYPE + hostparm.ThisHostLCDType = gCoreContext->GetSetting("HostLCDType"); + if ( hostparm.ThisHostLCDType != "no_lcd" && hostparm.ThisHostLCDType != "tinker" && hostparm.ThisHostLCDType != "" ) + { + // enable mythtv lcddevice + gCoreContext->SaveSetting("LCDEnable","1"); + }; +// Backupsettings + hostparm.ThisHostRemoteBackup = gCoreContext->GetSetting("HostRemoteBackup"); + hostparm.ThisHostRemoteBackupDir = gCoreContext->GetSetting("HostRemoteBackupDir"); +//plugins + hostparm.ThisHostpluginmytharchive = gCoreContext->GetSetting("Hostpluginmytharchive"); + hostparm.ThisHostpluginmythbrowser = gCoreContext->GetSetting("Hostpluginmythbrowser"); + //hostparm.ThisHostpluginmythcontrols = gCoreContext->GetSetting("Hostpluginmythcontrols"); + hostparm.ThisHostpluginmythnetvision = gCoreContext->GetSetting("Hostpluginmythnetvision"); + hostparm.ThisHostpluginmythgallery = gCoreContext->GetSetting("Hostpluginmythgallery"); + hostparm.ThisHostpluginmythgame = gCoreContext->GetSetting("Hostpluginmythgame"); + // hostparm.ThisHostpluginmythmovietime = gCoreContext->GetSetting("Hostpluginmythmovietime"); + hostparm.ThisHostpluginmythmusic = gCoreContext->GetSetting("Hostpluginmythmusic"); + hostparm.ThisHostpluginmythnews = gCoreContext->GetSetting("Hostpluginmythnews"); +// hostparm.ThisHostpluginmythphone = gCoreContext->GetSetting("Hostpluginmythphone"); +// hostparm.ThisHostpluginmythsmolt = gCoreContext->GetSetting("Hostpluginmythsmolt"); +// hostparm.ThisHostpluginmythvideo = gCoreContext->GetSetting("Hostpluginmythvideo"); + hostparm.ThisHostpluginmythweather = gCoreContext->GetSetting("Hostpluginmythweather"); + hostparm.ThisHostpluginmythzoneminder = gCoreContext->GetSetting("Hostpluginmythzoneminder"); + hostparm.ThisHostpluginmythgamefceux = gCoreContext->GetSetting("Hostpluginmythgamefceux"); + hostparm.ThisHostpluginmythgamesnes9x = gCoreContext->GetSetting("Hostpluginmythgamesnes9x"); + hostparm.ThisHostpluginmythgameMame = gCoreContext->GetSetting("HostpluginmythgameMame"); + hostparm.ThisHostpluginmythgameDolphin = gCoreContext->GetSetting("HostpluginmythgameDolphin"); + hostparm.ThisHostpluginmythgameXe = gCoreContext->GetSetting("HostpluginmythgameXe"); + + hostparm.ThisHostpluginmythvideo_dvdcss = gCoreContext->GetSetting("Hostpluginmythvideo_dvdcss"); + hostparm.ThisHostpluginmythappletrailers= gCoreContext->GetSetting("Hostpluginmythappletrailers"); +// hostparm.ThisHostpluginmythstream= gCoreContext->GetSetting("Hostpluginmythstream"); +// hostparm.ThisHostpluginmythvodka= gCoreContext->GetSetting("Hostpluginmythvodka"); + hostparm.ThisHostMiro= gCoreContext->GetSetting("HostMiro"); + hostparm.ThisHostpluginmythgameMednafen= gCoreContext->GetSetting("HostpluginmythgameMednafen"); + hostparm.ThisHostpluginmythgameROMDB= gCoreContext->GetSetting("HostpluginmythgameROMDB"); + hostparm.ThisHostpluginmythgameMupen64= gCoreContext->GetSetting("HostpluginmythgameMupen64"); +// hostparm.ThisHostXine = gCoreContext->GetSetting("HostXine"); +// hostparm.ThisHostwebmin = gCoreContext->GetSetting("Hostwebmin"); +// hostparm.ThisHostfuppes = gCoreContext->GetSetting("Hostfuppes"); + hostparm.ThisHostHuluDesktop = gCoreContext->GetSetting("HostHuluDesktop"); + hostparm.ThisHostwebonlinhes = gCoreContext->GetSetting("HostWebonlinhes"); + +// hostparm.ThisHostfuppes = gCoreContext->GetSetting("Hostfuppes"); + + + + + hostparm.ThisHostfoldingathome = gCoreContext->GetSetting("Hostfoldingathome"); + hostparm.ThisHostfoldingusername = gCoreContext->GetSetting("Hostfoldingusername"); + hostparm.ThisHostfoldingworksize = gCoreContext->GetSetting("Hostfoldingworksize"); + hostparm.ThisHostDDnslogin = gCoreContext->GetSetting("HostDDnslogin"); + hostparm.ThisHostDDnspassword = gCoreContext->GetSetting("HostDDnspassword"); + hostparm.ThisHostDDnshostname = gCoreContext->GetSetting("HostDDnshostname"); + hostparm.ThisHostDDnsEnable = gCoreContext->GetSetting("HostDDnsEnable"); + hostparm.ThisHostscreensavertype = gCoreContext->GetSetting("Hostscreensavertype"); + hostparm.ThisHostscreensaveridle = gCoreContext->GetSetting("Hostscreensaveridle"); + if (gCoreContext->GetSetting("HostScreensaverBlank") == "1" ) + hostparm.ThisHostscreensavertheme="Blank"; + else if (gCoreContext->GetSetting("HostScreensaverRandom") == "1" ) + hostparm.ThisHostscreensavertheme="Random"; + else + { + if ( hostparm.ThisHostscreensavertype == "gscreensaver" ) + hostparm.ThisHostscreensavertheme = gCoreContext->GetSetting("HostGScreensavertheme"); + if ( hostparm.ThisHostscreensavertype == "xscreensaver" ) + hostparm.ThisHostscreensavertheme = gCoreContext->GetSetting("HostXScreensavertheme"); + } + + hostparm.ThisHostTransmitproto_1 = + gCoreContext->GetSetting("HostTransmitproto_1"); + hostparm.ThisHostTransmitproto_2 = + gCoreContext->GetSetting("HostTransmitproto_2"); + hostparm.ThisHostTransmitproto_3 = + gCoreContext->GetSetting("HostTransmitproto_3"); + hostparm.ThisHostTransmitproto_4 = + gCoreContext->GetSetting("HostTransmitproto_4"); + hostparm.ThisHostBlasterType = + gCoreContext->GetSetting("HostBlasterType"); + hostparm.ThisHostSerialPort_blasterlirc = + gCoreContext->GetSetting("HostSerialPort_blasterlirc"); + hostparm.ThisHostnumblaster = "1"; + if ( hostparm.ThisHostBlasterType == "CommandIR" ) + hostparm.ThisHostnumblaster = "4" ; + if ( hostparm.ThisHostBlasterType == "MCE" ) + hostparm.ThisHostnumblaster = "2" ; + + hostparm.ThisHostTransmitDelay_1 = + gCoreContext->GetSetting("HostTransmitDelay_1"); + hostparm.ThisHostTransmitSend_after_1 = + gCoreContext->GetSetting("HostTransmitSend_after_1"); + + hostparm.ThisHostTransmitDelay_2 = + gCoreContext->GetSetting("HostTransmitDelay_2"); + hostparm.ThisHostTransmitSend_after_2 = + gCoreContext->GetSetting("HostTransmitSend_after_2"); + + hostparm.ThisHostTransmitDelay_3 = + gCoreContext->GetSetting("HostTransmitDelay_3"); + hostparm.ThisHostTransmitSend_after_3 = + gCoreContext->GetSetting("HostTransmitSend_after_3"); + + + hostparm.ThisHostTransmitDelay_4 = + gCoreContext->GetSetting("HostTransmitDelay_4"); + hostparm.ThisHostTransmitSend_after_4 = + gCoreContext->GetSetting("HostTransmitSend_after_4"); + + + hostparm.ThisHOSTrootSSH = gCoreContext->GetSetting("HOSTrootSSH"); + + + + hostparm.ThisHostSupplemental = gCoreContext->GetSetting("HostSupplemental"); + hostparm.ThisHostWindowManager = gCoreContext->GetSetting("HostWindowManager"); + hostparm.ThisHostEnhancedWMStyle = gCoreContext->GetSetting("HostEnhancedWMStyle"); + + hostparm.ThisHostVNCEnable = gCoreContext->GetSetting("HostVNCEnable"); + hostparm.ThisHostVNCpassword = gCoreContext->GetSetting("HostVNCpassword"); + hostparm.ThisHostXVNCEnable = gCoreContext->GetSetting("HostXVNCEnable"); + hostparm.ThisHostXVNCpassword = gCoreContext->GetSetting("HostXVNCpassword"); + + + + + +//______________________WRITE OUT THE FILE__________________________ + QString systemheader; + QString divider; + + QFile f( "/etc/systemconfig" ); + if( !f.open( IO_WriteOnly ) ) + std::cout << "Failed to open file /etc/systemconfig." << std::endl; + QTextStream myfile( &f ); + + divider = "#-----------------------------\n"; + systemheader= "\n# Language \n" ; + myfile << systemheader ; + myfile << divider ; + myfile << "language=\"" + hostparm.language + "\"\n"; + + divider = "#-----------------------------\n"; + systemheader= "\n# Hostype \n" ; + myfile << systemheader ; + myfile << divider ; + myfile << "SystemType=\"" + hostparm.ThisSystemType + "\"\n"; + myfile << "dbhost=\"" + hostparm.ThisDBhost + "\"\n"; + myfile << "RunFrontend=\"" + hostparm.ThisRunfrontend + "\"\n"; + myfile << "UseMythWelcome=\"" + hostparm.ThisMythWelcome + "\"\n"; + + systemheader= "\n# Network config\n" ; + myfile << systemheader ; + myfile << divider ; + myfile << "hostname=\"" + hostparm.ThisHostName + "\"\n"; + myfile << "default_interface=\"" + hostparm.ThisHostDefaultInterface + "\"\n"; + + + + if ( hostparm.ThisHostActiveonbooteth0 == "1" ) + { + systemheader= "\n# Network config for eth0 \n" ; + myfile << systemheader ; + myfile << divider ; + myfile << "Hostipeth0=\"" + hostparm.ThisHostIPeth0 + "\"\n"; + myfile << "Hostnetmasketh0=\"" +hostparm.ThisHostNETMASKeth0 + "\"\n"; + myfile << "HostDNSeth0=\"" +hostparm.ThisHostDNSeth0 + "\"\n"; + myfile << "HostUSEDHCPeth0=\"" +hostparm.ThisHostUSEDHCPeth0 + "\"\n"; + myfile << "HostGWeth0=\"" +hostparm.ThisHostGWeth0 + "\"\n"; + myfile << "HostActiveeth0=\"" +hostparm.ThisHostActiveonbooteth0 + "\"\n"; + myfile << "HostESSIDeth0=\"" + hostparm.ThisHOSTESSIDeth0 + "\"\n"; + myfile << "HostUseEncryptioneth0=\"" + hostparm.ThisHostUseEncryptioneth0 + "\"\n"; + myfile << "HostKeyeth0=\"" + hostparm.ThisHostkeyeth0 + "\"\n"; + myfile << "HOST_iswirelesseth0=\"" + hostparm.ThisHOST_iswirelesseth0 + "\"\n"; + myfile << "HostMTUeth0=\"" + hostparm.ThisHostMTUeth0 + "\"\n"; + } + + if ( hostparm.ThisHostActiveonbooteth1 == "1" ) + { + systemheader= "\n# Network config for eth1 \n" ; + myfile << systemheader ; + myfile << divider ; + myfile << "Hostipeth1=\"" + hostparm.ThisHostIPeth1 + "\"\n"; + myfile << "Hostnetmasketh1=\"" +hostparm.ThisHostNETMASKeth1 + "\"\n"; + myfile << "HostDNSeth1=\"" +hostparm.ThisHostDNSeth1 + "\"\n"; + myfile << "HostUSEDHCPeth1=\"" +hostparm.ThisHostUSEDHCPeth1 + "\"\n"; + myfile << "HostGWeth1=\"" +hostparm.ThisHostGWeth1 + "\"\n"; + myfile << "HostActiveeth1=\"" +hostparm.ThisHostActiveonbooteth1 + "\"\n"; + myfile << "HostESSIDeth1=\"" + hostparm.ThisHOSTESSIDeth1 + "\"\n"; + myfile << "HostUseEncryptioneth1=\"" + hostparm.ThisHostUseEncryptioneth1 + "\"\n"; + myfile << "HostKeyeth1=\"" + hostparm.ThisHostkeyeth1 + "\"\n"; + myfile << "HOST_iswirelesseth1=\"" + hostparm.ThisHOST_iswirelesseth1 + "\"\n"; + myfile << "HostMTUeth1=\"" + hostparm.ThisHostMTUeth1 + "\"\n"; + } + if ( hostparm.ThisHostActiveonbootwlan0 == "1" ) + { + systemheader= "\n# Network config for wlan0 \n" ; + myfile << systemheader ; + myfile << divider ; + myfile << "Hostipwlan0=\"" + hostparm.ThisHostIPwlan0 + "\"\n"; + myfile << "Hostnetmaskwlan0=\"" +hostparm.ThisHostNETMASKwlan0 + "\"\n"; + myfile << "HostDNSwlan0=\"" +hostparm.ThisHostDNSwlan0 + "\"\n"; + myfile << "HostUSEDHCPwlan0=\"" +hostparm.ThisHostUSEDHCPwlan0 + "\"\n"; + myfile << "HostGWwlan0=\"" +hostparm.ThisHostGWwlan0 + "\"\n"; + myfile << "HostActivewlan0=\"" +hostparm.ThisHostActiveonbootwlan0 + "\"\n"; + myfile << "HostESSIDwlan0=\"" + hostparm.ThisHOSTESSIDwlan0 + "\"\n"; + myfile << "HostUseEncryptionwlan0=\"" + hostparm.ThisHostUseEncryptionwlan0 + "\"\n"; + myfile << "HostKeywlan0=\"" + hostparm.ThisHostkeywlan0 + "\"\n"; + myfile << "HOST_iswirelesswlan0=\"" + hostparm.ThisHOST_iswirelesswlan0 + "\"\n"; + myfile << "HostMTUwlan0=\"" + hostparm.ThisHostMTUwlan0 + "\"\n"; + } + if ( hostparm.ThisHostActiveonbootwlan1 == "1" ) + { + systemheader= "\n# Network config for wlan1 \n" ; + myfile << systemheader ; + myfile << divider ; + myfile << "Hostipwlan1=\"" + hostparm.ThisHostIPwlan1 + "\"\n"; + myfile << "Hostnetmaskwlan1=\"" +hostparm.ThisHostNETMASKwlan1 + "\"\n"; + myfile << "HostDNSwlan1=\"" +hostparm.ThisHostDNSwlan1 + "\"\n"; + myfile << "HostUSEDHCPwlan1=\"" +hostparm.ThisHostUSEDHCPwlan1 + "\"\n"; + myfile << "HostGWwlan1=\"" +hostparm.ThisHostGWwlan1 + "\"\n"; + myfile << "HostActivewlan1=\"" +hostparm.ThisHostActiveonbootwlan1 + "\"\n"; + myfile << "HostESSIDwlan1=\"" + hostparm.ThisHOSTESSIDwlan1 + "\"\n"; + myfile << "HostUseEncryptionwlan1=\"" + hostparm.ThisHostUseEncryptionwlan1 + "\"\n"; + myfile << "HostKeywlan1=\"" + hostparm.ThisHostkeywlan1 + "\"\n"; + myfile << "HOST_iswirelesswlan1=\"" + hostparm.ThisHOST_iswirelesswlan1 + "\"\n"; + myfile << "HostMTUwlan1=\"" + hostparm.ThisHostMTUwlan1 + "\"\n"; + } + + if ( hostparm.ThisHostActiveonbootath0 == "1" ) + { + systemheader= "\n# Network config for ath0 \n" ; + myfile << systemheader ; + myfile << divider ; + myfile << "Hostipath0=\"" + hostparm.ThisHostIPath0 + "\"\n"; + myfile << "Hostnetmaskath0=\"" +hostparm.ThisHostNETMASKath0 + "\"\n"; + myfile << "HostDNSath0=\"" +hostparm.ThisHostDNSath0 + "\"\n"; + myfile << "HostUSEDHCPath0=\"" +hostparm.ThisHostUSEDHCPath0 + "\"\n"; + myfile << "HostGWath0=\"" +hostparm.ThisHostGWath0 + "\"\n"; + myfile << "HostActiveath0=\"" +hostparm.ThisHostActiveonbootath0 + "\"\n"; + myfile << "HostESSIDath0=\"" + hostparm.ThisHOSTESSIDath0 + "\"\n"; + myfile << "HostUseEncryptionath0=\"" + hostparm.ThisHostUseEncryptionath0 + "\"\n"; + myfile << "HostKeyath0=\"" + hostparm.ThisHostkeyath0 + "\"\n"; + myfile << "HOST_iswirelessath0=\"" + hostparm.ThisHOST_iswirelessath0 + "\"\n"; + myfile << "HostMTUath0=\"" + hostparm.ThisHostMTUath0 + "\"\n"; + } + + + systemheader= "\n# Misc \n" ; + myfile << systemheader ; + myfile << divider ; + myfile << "timezone=\"" + hostparm.ThisTimeZone + "\"\n"; + myfile << "Hostupdateplan=\"" + hostparm.ThisHostupdateplan + "\"\n"; + myfile << "ShowTips=\"" + hostparm.ThisShowToolTips + "\"\n"; + + + systemheader= "\n# Advanced \n" ; + myfile << systemheader ; + myfile << divider ; + myfile << "bewait=\"" + hostparm.ThisHostBEWait + "\"\n"; + myfile << "ncidclient=\"" + hostparm.ThisHostncidClient + "\"\n"; + myfile << "Runncidd=\"" + hostparm.ThisHostncidDaemon + "\"\n"; + myfile << "nciddSerialPort=\"" + hostparm.ThisHostSerialPortncid + "\"\n"; + myfile << "nciddDeviceNetCallerID=\"" + hostparm.ThisHostNcidDeviceNetCallerID + "\"\n"; + myfile << "Usebootsplash=\"" + hostparm.ThisHostbootsplash + "\"\n"; + myfile << "RemoteBackup=\"" + hostparm.ThisHostRemoteBackup + "\"\n"; + myfile << "RemoteBackupDir=\"" + hostparm.ThisHostRemoteBackupDir + "\"\n"; + // special keys + // myfile << "UseEvrouter=\"" + hostparm.ThisHostUseEvrouter + "\"\n"; + // myfile << "EvrouterConfig=\"" + hostparm.ThisHostEvrouterConfig + "\"\n"; + //run dhcp server + myfile << "RunDHCP=\"" + hostparm.ThisHostRunDHCP + "\"\n"; + myfile << "UseMythWEB=\"" + hostparm.ThisMythWEB + "\"\n"; + + systemheader= "\n# fileshare \n" ; + myfile << systemheader ; + myfile << divider ; + myfile << "UseSamba=\"" + hostparm.ThisSamba + "\"\n"; + myfile << "Samba_media=\"" + hostparm.ThisHostServiceSamba_media + "\"\n"; + myfile << "Samba_mediareadonly=\"" + hostparm.ThisHostServiceSamba_write + "\"\n"; + myfile << "Samba_home=\"" + hostparm.ThisHostServiceSamba_home + "\"\n"; + myfile << "Samba_homereadonly=\"" + hostparm.ThisHostServiceSamba_writehome + "\"\n"; + myfile << "Samba_domain=\"" + hostparm.ThisHostServiceSamba_domain + "\"\n"; + myfile << "UseNFS=\"" + hostparm.ThisNFS + "\"\n"; + myfile << "HaveCentralNFS=\"" + hostparm.ThisHaveNFS + "\"\n"; + myfile << "NFSserver=\"" + hostparm.ThisNFSserver + "\"\n"; + myfile << "NFSmount=\"" + hostparm.ThisNFSmountpoint + "\"\n"; + myfile << "CentralNFSallhosts=\"" + hostparm.ThisHostCentralNFSallhosts + "\"\n"; + + + + + + //not used anymore + // myfile << "UseDHCP=\"" + hostparm.ThisDHCP + "\"\n"; + + + systemheader= "\n# sleep \n" ; + myfile << systemheader ; + myfile << divider ; + myfile << "AutoShutdown=\"" + hostparm.ThisAutodown + "\"\n"; + myfile << "Shutdowntime=\"" + hostparm.ThisShutdowntime + "\"\n"; + myfile << "Shutdowntime2=\"" + hostparm.ThisShutdowntime2 + "\"\n"; + + //myfile << "Wakeuptime=\"" + hostparm.ThisWakeuptime + "\"\n"; + //myfile << "UseNVRAM=\"" + hostparm.ThisUseNVRAM + "\"\n"; + //myfile << "UseWOL=\"" + hostparm.ThisUseWOL + "\"\n"; + //not used + //myfile << "KeepPackages=\"" + hostparm.ThisKeepPackage + "\"\n"; + // myfile << "PKG_MIRROR=\"" + hostparm.ThisHostPKG_MIRROR + "\"\n"; + //myfile << "zipcode=\"" + hostparm.ThisHostZipcode + "\"\n"; + + + + + + + systemheader= "\n# X display settings \n" ; + myfile << systemheader ; + myfile << divider ; + myfile << "XIgnoreConfig=\"" + hostparm.ThisXIgnoreConfig + "\"\n"; + myfile << "Xcardtype=\"" + hostparm.ThisXcardtype + "\"\n"; + myfile << "XUseAdvanced=\"" + hostparm.ThisXUseAdvanced + "\"\n"; + myfile << "Xres=\"" + hostparm.ThisXres + "\"\n"; + myfile << "UseXLargeMouse=\"" + hostparm.ThisHostUseXLargeMouse + "\"\n"; +// myfile << "XIgnoreEDID=\"" + hostparm.ThisXIgnoreEDID + "\"\n"; +// myfile << "Xconnection=\"" + hostparm.ThisXconnection + "\"\n"; +// myfile << "XHsync=\"" + hostparm.ThisXHsync + "\"\n"; +// myfile << "XVrefresh=\"" + hostparm.ThisXVrefresh+ "\"\n"; +// myfile << "Xresadvanced=\"" + hostparm.ThisXresadvanced + "\"\n"; +// myfile << "XTVstandard=\"" + hostparm.ThisXTVstandard + "\"\n"; +// myfile << "XTVconnection=\"" + hostparm.ThisXTVconnection + "\"\n"; +// myfile << "XDisplaysize=\"" + hostparm.ThisXDisplaysize + "\"\n"; +// myfile << "XnVidia1080p=\"" + hostparm.ThisHostXNvidia1080p+ "\"\n"; +// myfile << "XnVidia1080i=\"" + hostparm.ThisHostXNvidia1080i+ "\"\n"; +// myfile << "XnVidia720p=\"" + hostparm.ThisHostXNvidia720p+ "\"\n"; +// myfile << "XnVidia480p=\"" + hostparm.ThisHostXNvidia480p+ "\"\n"; + + systemheader= "\n# Audio settings\n" ; + myfile << systemheader ; + myfile << divider ; + myfile << "Audiotype=\"" + hostparm.ThisHostAudiotype + "\"\n"; + myfile << "Audiotypeout=\"" + hostparm.ThisHostSoundTypeout + "\"\n"; + myfile << "SoundDevice=\"" + hostparm.ThisHostSoundDevice+ "\"\n"; +// myfile << "syncXine=\"" + hostparm.ThisHostsyncXine + "\"\n"; +// myfile << "syncMplayer=\"" + hostparm.ThisHostsyncMplayer + "\"\n"; +// myfile << "syncMythMusic=\"" + hostparm.ThisHostsyncMythMusic + "\"\n"; +// myfile << "syncMythFrontend=\"" + hostparm.ThisHostsyncMythFrontend + "\"\n"; + + + systemheader= "\n# Software settings\n" ; + myfile << systemheader ; + myfile << divider ; + myfile << "mytharchive=\"" + hostparm.ThisHostpluginmytharchive + "\"\n"; + myfile << "mythbrowser=\"" + hostparm.ThisHostpluginmythbrowser + "\"\n"; + myfile << "mythnetvision=\"" + hostparm.ThisHostpluginmythnetvision + "\"\n"; + myfile << "mythgallery=\"" + hostparm.ThisHostpluginmythgallery + "\"\n"; + myfile << "mythgame=\"" + hostparm.ThisHostpluginmythgame + "\"\n"; + myfile << "mythmusic=\"" + hostparm.ThisHostpluginmythmusic + "\"\n"; + myfile << "mythnews=\"" + hostparm.ThisHostpluginmythnews + "\"\n"; + myfile << "mythzoneminder=\"" + hostparm.ThisHostpluginmythzoneminder + "\"\n"; + myfile << "mythweather=\"" + hostparm.ThisHostpluginmythweather + "\"\n"; + myfile << divider ; + //game emulator + myfile << "romdb=\"" + hostparm.ThisHostpluginmythgameROMDB + "\"\n"; + myfile << "snes9x=\"" + hostparm.ThisHostpluginmythgamesnes9x + "\"\n"; + myfile << "fceux=\"" + hostparm.ThisHostpluginmythgamefceux + "\"\n"; + myfile << "mame=\"" + hostparm.ThisHostpluginmythgameMame + "\"\n"; + myfile << "mednafen=\"" + hostparm.ThisHostpluginmythgameMednafen + "\"\n"; + myfile << "mupen64=\"" + hostparm.ThisHostpluginmythgameMupen64 + "\"\n"; + myfile << "dolphinemu=\"" + hostparm.ThisHostpluginmythgameDolphin + "\"\n"; + myfile << "xe=\"" + hostparm.ThisHostpluginmythgameXe + "\"\n"; + myfile << divider ; + //other + myfile << "dvdcss=\"" + hostparm.ThisHostpluginmythvideo_dvdcss + "\"\n"; + myfile << "mythappletrailers=\"" + hostparm.ThisHostpluginmythappletrailers + "\"\n"; + + myfile << "miro=\"" + hostparm.ThisHostMiro + "\"\n"; + myfile << "webonlinhes=\"" + hostparm.ThisHostwebonlinhes + "\"\n"; + myfile << "huludesktop=\"" + hostparm.ThisHostHuluDesktop + "\"\n"; + //myfile << "fuppes=\"" + hostparm.ThisHostfuppes + "\"\n"; + myfile << "foldingathome=\"" + hostparm.ThisHostfoldingathome + "\"\n"; + myfile << "foldingusername=\"" + hostparm.ThisHostfoldingusername + "\"\n"; + myfile << "foldingworksize=\"" + hostparm.ThisHostfoldingworksize + "\"\n"; + //myfile << "mythstream=\"" + hostparm.ThisHostpluginmythstream + "\"\n"; + // myfile << "mythphone=\"" + hostparm.ThisHostpluginmythphone + "\"\n"; + // myfile << "mythsmolt=\"" + hostparm.ThisHostpluginmythsmolt + "\"\n"; + // myfile << "mythvideo=\"" + hostparm.ThisHostpluginmythvideo + "\"\n"; + // myfile << "mythcontrols=\"" + hostparm.ThisHostpluginmythcontrols + "\"\n"; + // myfile << "mythmovietime=\"" + hostparm.ThisHostpluginmythmovietime + "\"\n"; + // myfile << "mythvodka=\"" +hostparm.ThisHostpluginmythvodka + "\"\n"; + // myfile << "xine=\"" + hostparm.ThisHostXine + "\"\n"; + // myfile << "webmin=\"" + hostparm.ThisHostwebmin + "\"\n";er + "\"\n"; + + + systemheader="\n# ddns settings\n" ; + myfile << systemheader ; + myfile << divider ; + myfile << "DDnslogin=\"" + hostparm.ThisHostDDnslogin + "\"\n"; + myfile << "DDnspassword=\"" + hostparm.ThisHostDDnspassword + "\"\n"; + myfile << "DDnshostname=\"" + hostparm.ThisHostDDnshostname + "\"\n"; + myfile << "DDnsEnable=\"" + hostparm.ThisHostDDnsEnable + "\"\n"; + + systemheader="\n# screensaver settings\n" ; + myfile << systemheader ; + myfile << divider ; + myfile << "Screensavertype=\"" + hostparm.ThisHostscreensavertype + "\"\n"; + myfile << "Screensaveridle=\"" + hostparm.ThisHostscreensaveridle + "\"\n"; + myfile << "Screensavertheme=\"" + hostparm.ThisHostscreensavertheme + "\"\n"; + + systemheader="\n# IR settings\n" ; + myfile << systemheader ; + myfile << divider ; + myfile << "Remotetype=\"" + hostparm.ThisRemote + "\"\n"; + myfile << "Remotebucket=\"" + hostparm.ThisHostRemotebucket + "\"\n"; + myfile << "ReceiverType=\"" + hostparm.ThisReceiverType + "\"\n"; + myfile << "HDHRlirc_device=\"" + hostparm.ThisHDHRlirc_device + "\"\n"; + myfile << "HostLircWait=\"" + hostparm.ThisHostLircWait + "\"\n"; + + myfile << "ReceiverSerialport=\"" + hostparm.ThisHostSerialPortlirc + "\"\n"; + myfile << "HostTransmitproto_1=\"" + hostparm.ThisHostTransmitproto_1 + "\"\n"; + myfile << "HostTransmitproto_2=\"" + hostparm.ThisHostTransmitproto_2 + "\"\n"; + myfile << "HostTransmitproto_3=\"" + hostparm.ThisHostTransmitproto_3 + "\"\n"; + myfile << "HostTransmitproto_4=\"" + hostparm.ThisHostTransmitproto_4 + "\"\n"; + + myfile << "HostTransmitDelay_1=\"" + hostparm.ThisHostTransmitDelay_1 + "\"\n"; + myfile << "HostTransmitDelay_2=\"" + hostparm.ThisHostTransmitDelay_2 + "\"\n"; + myfile << "HostTransmitDelay_3=\"" + hostparm.ThisHostTransmitDelay_3 + "\"\n"; + myfile << "HostTransmitDelay_4=\"" + hostparm.ThisHostTransmitDelay_4 + "\"\n"; + +// myfile << "HostTransmitSend_after_1=\"" + hostparm.ThisHostTransmitSend_after_1 + "\"\n"; +// myfile << "HostTransmitSend_after_2=\"" + hostparm.ThisHostTransmitSend_after_2 + "\"\n"; +// myfile << "HostTransmitSend_after_3=\"" + hostparm.ThisHostTransmitSend_after_3 + "\"\n"; +// myfile << "HostTransmitSend_after_4=\"" + hostparm.ThisHostTransmitSend_after_4 + "\"\n"; + + myfile << "HostBlasterType=\"" + hostparm.ThisHostBlasterType + "\"\n"; + myfile << "HostSerialPort_blasterlirc=\"" + hostparm.ThisHostSerialPort_blasterlirc + "\"\n"; + myfile << "Hostnumblaster=\"" + hostparm.ThisHostnumblaster + "\"\n"; + myfile << "LCDtype=\"" + hostparm.ThisHostLCDType + "\"\n"; + + + systemheader="\n# user settings\n" ; + myfile << systemheader ; + myfile << divider ; + myfile << "rootSSH=\"" + hostparm.ThisHOSTrootSSH + "\"\n"; + + systemheader="\n# Supplemental\n" ; + myfile << systemheader ; + myfile << divider ; + myfile << "supplemental=\"" + hostparm.ThisHostSupplemental + "\"\n"; + myfile << "windowmanager=\"" + hostparm.ThisHostWindowManager + "\"\n"; + myfile << "EnhancedWMStyle=\"" + hostparm.ThisHostEnhancedWMStyle + "\"\n"; + + systemheader="\n# VNC\n" ; + myfile << systemheader ; + myfile << divider ; + myfile << "vncenable=\"" + hostparm.ThisHostVNCEnable + "\"\n"; + myfile << "vncpassword=\"" + hostparm.ThisHostVNCpassword + "\"\n"; + myfile << "xvncenable=\"" + hostparm.ThisHostXVNCEnable + "\"\n"; + myfile << "xvncpassword=\"" + hostparm.ThisHostXVNCpassword + "\"\n"; + + systemheader= "\n# webuser \n" ; + myfile << systemheader ; + myfile << divider ; + myfile << "UseMythWEB_auth=\"" + hostparm.ThisHostwebauth + "\"\n"; + + + + f.close(); + +} + + +MythInstallSettings::MythInstallSettings() +{ + VerticalConfigurationGroup* vcg = new VerticalConfigurationGroup(false,false,true,true); + VerticalConfigurationGroup* denied = new VerticalConfigurationGroup(false,false,true,true); + TransLabelSetting *deniedlabel = new TransLabelSetting(); + deniedlabel->setValue(" Access to these settings is disabled.\n Access can be enabled in Access Settings." ); + denied->addChild(deniedlabel); + if ( displaymysqlonly ) + { + vcg->addChild(HostMysqlserverip_listbox()); + vcg->addChild(ThemePainter()); + addChild(vcg); + } + else + { + // This is needed to stop default=interface from being wiped every time + if ( gCoreContext->GetSetting("HostDefaulteth0") == "1" ) + hostparm.ThisHostDefaultInterface = "eth0"; + else if ( gCoreContext->GetSetting("HostDefaulteth1") == "1" ) + hostparm.ThisHostDefaultInterface = "eth1"; + else if ( gCoreContext->GetSetting("HostDefaultwlan0") == "1" ) + hostparm.ThisHostDefaultInterface = "wlan0"; + else if ( gCoreContext->GetSetting("HostDefaultwlan1") == "1" ) + hostparm.ThisHostDefaultInterface = "wlan1"; + else if ( gCoreContext->GetSetting("HostActiveonbooteth0") == "1" ) + hostparm.ThisHostDefaultInterface = "eth0"; + else if ( gCoreContext->GetSetting("HostActiveonbooteth1") == "1" ) + hostparm.ThisHostDefaultInterface = "eth1"; + else if ( gCoreContext->GetSetting("HostActiveonbootwlan0") == "1" ) + hostparm.ThisHostDefaultInterface = "wlan0"; + else if ( gCoreContext->GetSetting("HostActiveonbootwlan1") == "1" ) + hostparm.ThisHostDefaultInterface = "wlan1"; + else if ( gCoreContext->GetSetting("HostActiveonbootath0") == "1" ) + hostparm.ThisHostDefaultInterface = "ath0"; + else + hostparm.ThisHostDefaultInterface = "eth0"; + + + + vcg->setLabel(QObject::tr("Host Settings")); + // Check to see if screen should appear + if ( displayshownetwork ) + { + //Check to see if screen is allowed to appear + if ( ((gCoreContext->GetSetting("Hostaccessnetwork")) == "0" ) ) + { + denied ->setLabel(QObject::tr("Network Settings")); + addChild(denied); + } + else + { + + hostparm.ThisHostnetOLD = gCoreContext->GetSetting("HostNetDevice"); + QString s = "HostActiveonboot"; + s+=hostparm.ThisHostnetOLD; + hostparm.ThisHostnetActiveOLD = gCoreContext->GetSetting(s); + MSqlQuery query(MSqlQuery::InitCon()); + query.prepare( "delete from settings where hostname=:HOSTNAME and value = 'HOSTNetDevice'; " ); + query.bindValue( ":HOSTNAME" , gCoreContext->GetHostName() ); + query.exec(); + + + if ( gCoreContext->GetSetting("HostDefaulteth0") == "1" ) + hostparm.ThisHostDefaultInterface = "eth0"; + else if ( gCoreContext->GetSetting("HostDefaulteth1") == "1" ) + hostparm.ThisHostDefaultInterface = "eth1"; + else if ( gCoreContext->GetSetting("HostDefaultwlan0") == "1" ) + hostparm.ThisHostDefaultInterface = "wlan0"; + else if ( gCoreContext->GetSetting("HostDefaultwlan1") == "1" ) + hostparm.ThisHostDefaultInterface = "wlan1"; + else if ( gCoreContext->GetSetting("HostActiveonbooteth0") == "1" ) + hostparm.ThisHostDefaultInterface = "eth0"; + else if ( gCoreContext->GetSetting("HostActiveonbooteth1") == "1" ) + hostparm.ThisHostDefaultInterface = "eth1"; + else if ( gCoreContext->GetSetting("HostActiveonbootwlan0") == "1" ) + hostparm.ThisHostDefaultInterface = "wlan0"; + else if ( gCoreContext->GetSetting("HostActiveonbootwlan1") == "1" ) + hostparm.ThisHostDefaultInterface = "wlan1"; + else if ( gCoreContext->GetSetting("HostActiveonbootath0") == "1" ) + hostparm.ThisHostDefaultInterface = "ath0"; + else + hostparm.ThisHostDefaultInterface = "eth0"; + + + NetworkOptionsFrame *networkoptionsframe = new NetworkOptionsFrame(); + NetworkSettingsFrame *netsettingsframe = new NetworkSettingsFrame(); + + addChild(netsettingsframe); + addChild(networkoptionsframe); + + }; + } + + if ( displayshowhostype ) + { + if ( ((gCoreContext->GetSetting("Hostaccesshostype")) =="0" )) + { + denied ->setLabel(QObject::tr("Host Settings")); + addChild(denied); + } + else + { + SystemtypeGroup *systemtypegroup = new SystemtypeGroup(); + vcg->addChild(systemtypegroup); + addChild(vcg); + } + } + + if ( displayremotesonly ) + { + if ( ((gCoreContext->GetSetting("Hostaccessir")) =="0" )) + { + denied ->setLabel(QObject::tr("Remotes Settings")); + addChild(denied); + } + else + { + IRFrame *irframe = new IRFrame(); + addChild(irframe); + } + } + + if ( displayshowadvancedX ) + { + if ( ((gCoreContext->GetSetting("HostaccessadvancedX")) == "0" )) + { + denied ->setLabel(QObject::tr("Display Settings")); + addChild(denied); + } + else + { + AdvancedXSettings *advancedXsettings = new AdvancedXSettings(); + addChild(advancedXsettings); + } + } + + if ( displayvnc ) + { + if ( ((gCoreContext->GetSetting("Hostaccessvnc")) == "0" )) + { + denied ->setLabel(QObject::tr("VNC Settings")); + addChild(denied); + } + else + { + VNChostsettings* vnchostsettings= new VNChostsettings(); + addChild(vnchostsettings); + } + } + + if ( displayfileshare ) + { + if ( ((gCoreContext->GetSetting("Hostaccessfileshare")) == "0" )) + { + denied ->setLabel(QObject::tr("File Sharing Settings")); + addChild(denied); + } + else + { + FileShareMainFrameClient *nfsclient = new FileShareMainFrameClient(); + addChild(nfsclient); + + FileShareMainFrameServer *fileserver = new FileShareMainFrameServer(); + addChild(fileserver); + } + } + + if ( displayshowmisc ) + { + if ( ((gCoreContext->GetSetting("Hostaccessmisc")) == "0" )) + { + denied ->setLabel(QObject::tr("Miscellanous")); + addChild(denied); + } + else + { + MiscMainFrame *miscsettings = new MiscMainFrame(); + // MiscMainFrame2 *miscsettings2 = new MiscMainFrame2(); + addChild(miscsettings); + // addChild(miscsettings2); + } + } + + if ( displaysupplemental ) + { + //JM VERBOSE(VB_IMPORTANT, "screensaver"); + Supplementalhostsettings *supplemental = new Supplementalhostsettings(); + addChild(supplemental); + } + + if ( displayshowshutdown ) + { + if ( ((gCoreContext->GetSetting("Hostaccesssleep")) == "0" )) + { + denied ->setLabel(QObject::tr("Shutdown Settings")); + addChild(denied); + } + else + { + WakeSettings *wakesettings = new WakeSettings(); + addChild(wakesettings); + } + } + + if ( displayshowadvanced ) + { + if ( ((gCoreContext->GetSetting("Hostaccessadvanced")) == "0" ) ) + { + denied ->setLabel(QObject::tr("Advanced Settings")); + addChild(denied); + } + else + { + AdvancedSettings *advancedsettings = new AdvancedSettings(); + AdvancedSettings_2 *advancedsettings_2 = new AdvancedSettings_2(); + + addChild(advancedsettings); + addChild(advancedsettings_2); + } + } + + if ( displayshowsound ) + { + if ( ((gCoreContext->GetSetting("Hostaccesssound")) =="0") ) + { + denied ->setLabel(QObject::tr("Audio Settings")); + addChild(denied); + } + else + { + //remove old sound card setting from the db. This is useful for when the saved setting is no longer valid for this machine. + // Later search the list and set the value to the old setting if found in the dropdown. + hostparm.OLDHostSoundOSSAnalog = gCoreContext->GetSetting("HostSoundOssAnalog"); + hostparm.OLDHostSoundOSSDigital = gCoreContext->GetSetting("HostSoundOssDigital"); + hostparm.OLDHostSoundALSAAnalog = gCoreContext->GetSetting("HostSoundALSAAnalog"); + hostparm.OLDHostSoundALSADigital= gCoreContext->GetSetting("HostSoundALSADigital"); + + + MSqlQuery query(MSqlQuery::InitCon()); + query.prepare( "delete from settings where hostname=:HOSTNAME and value = 'HOSTSoundOssAnalog'; " ); + query.bindValue( ":HOSTNAME" , gCoreContext->GetHostName() ); + query.exec(); + query.prepare( "delete from settings where hostname=:HOSTNAME and value = 'HOSTSoundALSAAnalog'; " ); + query.bindValue( ":HOSTNAME" , gCoreContext->GetHostName() ); + query.exec(); + query.prepare( "delete from settings where hostname=:HOSTNAME and value = 'HOSTSoundALSADigital'; " ); + query.bindValue( ":HOSTNAME" , gCoreContext->GetHostName() ); + query.exec(); + query.prepare( "delete from settings where hostname=:HOSTNAME and value = 'HOSTSoundOssDigital'; " ); + query.bindValue( ":HOSTNAME" , gCoreContext->GetHostName() ); + query.exec(); + + + SoundSettings *soundsettings = new SoundSettings(); + addChild(soundsettings); + } + } + + if ( displayaccesscontrol ) + { + VerticalConfigurationGroup* accessettings = + new VerticalConfigurationGroup(false,true,false,false); + ConfigurationGroup *GridAccess = + new GridConfigurationGroup(2,false,false,false,false); + + GridAccess->addChild(Hostaccessadvanced()); + GridAccess->addChild(Hostaccesssound()); + GridAccess->addChild(HostaccessadvancedX()); + GridAccess->addChild(Hostaccessddns()); + GridAccess->addChild(Hostaccessfileshare()); + GridAccess->addChild(Hostaccessmisc()); + GridAccess->addChild(Hostaccessnetwork()); + GridAccess->addChild(Hostaccessplugins()); + GridAccess->addChild(Hostaccessir()); + GridAccess->addChild(Hostaccessscreensaver()); +//screensaver + GridAccess->addChild(Hostaccessvnc()); + GridAccess->addChild(Hostaccesssleep()); +// GridAccess->addChild(Hostaccessuser()); + GridAccess->addChild(Hostaccesswebuser()); + +// accessettings->addChild(Hostaccessnetwork()); + accessettings->addChild(new ACCESShostsettings); + accessettings->addChild(GridAccess); + accessettings ->setLabel(QObject::tr("Access Settings")); + addChild(accessettings); + } + + if ( displayplugins ) + { + if ( ((gCoreContext->GetSetting("Hostaccessplugins")) == "0" )) + { + denied ->setLabel(QObject::tr("Programs")); + addChild(denied); + } + else + { + ConfigurationGroup *GridShowPlugin = new GridConfigurationGroup(2,false); + GridShowPlugin->setLabel(QObject::tr("Programs (1/4)")); + GridShowPlugin->addChild(Hostpluginmytharchive()); + GridShowPlugin->addChild(Hostpluginmythbrowser()); + //GridShowPlugin->addChild(Hostpluginmythcontrols()); + GridShowPlugin->addChild(Hostpluginmythnetvision()); + GridShowPlugin->addChild(Hostpluginmythgallery()); + //GridShowPlugin->addChild(Hostpluginmythmovietime()); + + //ConfigurationGroup *GridShowPlugin2 = new GridConfigurationGroup(2); + GridShowPlugin->addChild(Hostpluginmythmusic()); + GridShowPlugin->addChild(Hostpluginmythnews()); + //GridShowPlugin2->addChild(Hostpluginmythphone()); + //GridShowPlugin2->addChild(Hostpluginmythsmolt()); + GridShowPlugin->addChild(Hostpluginmythweather()); + GridShowPlugin->addChild(Hostpluginmythzoneminder()); + + +// ConfigurationGroup *Mythvideoplugin = new HorizontalConfigurationGroup(); +// Mythvideoplugin->addChild(Hostpluginmythvideo()); +// Mythvideoplugin->addChild(Hostpluginmythvideo_dvdcss()); + + + ConfigurationGroup *GridShowPlugin3 = new VerticalConfigurationGroup(false,true); + GridShowPlugin3->setLabel(QObject::tr("Programs (2/4)")); + GridShowPlugin3->addChild(new MythGamesettings); + GridShowPlugin3->addChild(Hostpluginmythvideo_dvdcss()); + //GridShowPlugin3->addChild(Mythvideoplugin); + + addChild(GridShowPlugin); +// addChild(GridShowPlugin2); + addChild(GridShowPlugin3); + } + } + + if ( displaysoftware ) + { + if ( ((gCoreContext->GetSetting("Hostaccessplugins")) == "0" )) + { + denied ->setLabel(QObject::tr("Programs")); + addChild(denied); + } + else + { + ConfigurationGroup *GridShowPlugin4 = new GridConfigurationGroup(2,false); + GridShowPlugin4->setLabel(QObject::tr("Programs (3/4)")); + GridShowPlugin4->addChild(Hostpluginmythappletrailers()); + //GridShowPlugin4->addChild(Hostpluginmythstream()); + //GridShowPlugin4->addChild(Hostpluginmythvodka()); + GridShowPlugin4->addChild(HostMiro()); + //GridShowPlugin4->addChild(HostXine()); + //GridShowPlugin4->addChild(Hostwebmin()); + //GridShowPlugin4->addChild(Hostfuppes()); + GridShowPlugin4->addChild(HostHuluDesktop()); + GridShowPlugin4->addChild(Hostwebonlinhes()); + + + ConfigurationGroup *GridShowPlugin5 = new GridConfigurationGroup(2); + //GridShowPlugin5->addChild(Hostfuppes()); + + ConfigurationGroup *GridShowPlugin6 = new VerticalConfigurationGroup(false,true); + GridShowPlugin6->setLabel(QObject::tr("Programs (4/4)")); + GridShowPlugin6->addChild(Hostfoldingathome()); + GridShowPlugin6->addChild(Hostfoldingusername()); + GridShowPlugin6->addChild(Hostfoldingworksize()); + + addChild(GridShowPlugin4); + //addChild(GridShowPlugin5); + addChild(GridShowPlugin6); + } + } + if ( displayuser ) + { + if ( ((gCoreContext->GetSetting("Hostaccessuser")) == "0" )) + { + denied ->setLabel(QObject::tr("User Accounts")); + addChild(denied); + } + else + { + UserManagement *usermanagement = new UserManagement(); + addChild(usermanagement); + } + } + + if ( displaywebuser ) + { + if ( ((gCoreContext->GetSetting("Hostaccesswebuser")) == "0" )) + { + denied ->setLabel(QObject::tr("Web Security Settings")); + addChild(denied); + } + else + { + WebPasswordFrame *webpasswordframe = new WebPasswordFrame(); + addChild(webpasswordframe); + } + + } + + if ( displayddns ) + { + if ( ((gCoreContext->GetSetting("Hostaccessddns")) == "0" )) + { + denied ->setLabel(QObject::tr("DDNS Settings")); + addChild(denied); + } + else + { + DDnssettings *ddnsframe = new DDnssettings(); + addChild(ddnsframe); + } + } + + if ( displayinfrared ) + { + if ( ((gCoreContext->GetSetting("Hostaccessir")) =="0" )) + { + denied ->setLabel(QObject::tr("Remotes Settings")); + addChild(denied); + } + else + { + IRFrame *irframe = new IRFrame(); + IR_TransmitFrame *transmitframe = new IR_TransmitFrame(); + LCDFrame *lcdframe = new LCDFrame(); + addChild(irframe); + addChild(transmitframe); + addChild(lcdframe); + } + } + + if ( displayscreensaver ) + { + if ( ((gCoreContext->GetSetting("Hostaccessscreensaver")) =="0" )) + { + denied ->setLabel(QObject::tr("Screensaver Settings")); + addChild(denied); + } + else + { + //JM VERBOSE(VB_IMPORTANT, "screensaver"); + Screensaverhostsettings *screensaver = new Screensaverhostsettings(); + addChild(screensaver); + } + } + + + } + +}; + + |