diff options
author | James Meyer <james.meyer@operamail.com> | 2010-03-14 23:36:14 (GMT) |
---|---|---|
committer | James Meyer <james.meyer@operamail.com> | 2010-03-14 23:36:14 (GMT) |
commit | 2e9a78e69206e284e2e8411bc455d52b8dd9ca74 (patch) | |
tree | 2ee5f006d3e2eae1b969d7126708742532a33c40 /abs | |
parent | 3d7c59c43f41cf1a9a13831c287373211e089a02 (diff) | |
download | linhes_pkgbuild-2e9a78e69206e284e2e8411bc455d52b8dd9ca74.zip linhes_pkgbuild-2e9a78e69206e284e2e8411bc455d52b8dd9ca74.tar.gz linhes_pkgbuild-2e9a78e69206e284e2e8411bc455d52b8dd9ca74.tar.bz2 |
mythinstall: sync testing to core
bugfix
Diffstat (limited to 'abs')
27 files changed, 82 insertions, 12127 deletions
diff --git a/abs/core/mythinstall/PKGBUILD b/abs/core/mythinstall/PKGBUILD index bd58a19..c84c9de 100644 --- a/abs/core/mythinstall/PKGBUILD +++ b/abs/core/mythinstall/PKGBUILD @@ -1,49 +1,29 @@ # Maintainer: Jams pkgname=mythinstall -pkgver=1 -pkgrel=13 +pkgver=2 +pkgrel=26 pkgdesc="LinHES installer/systemconfig GUI." arch=i686 depends=() -makedepends=(mythtv) - -source=(autocard.cpp - autocard.h - infrared.cpp - infrared.h - installationtype.cpp - installationtype.h - installdialog.cpp - installdialog.h - installsettings.cpp - installsettings.h - main.cpp - misc_settings.cpp - misc_settings.h - mv_common.h - mythinstall.pro - password_manage.cpp - password_manage.h - settemplate.cpp - settemplate.h - statusbox.cpp - statusbox.h - xorgsettings.cpp - xorgsettings.h) +makedepends=('mythtv>=0.22') +source=('install-ui.xml') build() { # It is assumed that you have built the mythtv package in the same # LinHES-PKGBUILD area. - - cd ${srcdir} - qmake mythinstall.pro || return 1 - make || return 1 + cd $startdir + ./checkout_MythVantage.sh || exit 1 + cd - + #install -D MythVantage-app/mythinstall/install-ui.xml $pkgdir/usr/share/mythtv/themes/default/install-ui.xml + install -D $srcdir/install-ui.xml $pkgdir/usr/share/mythtv/themes/default/install-ui.xml MVBINDIR=$startdir/pkg/usr/MythVantage/bin mkdir -p $MVBINDIR - install -m 0755 mythinstall $MVBINDIR/MythVantage + install -m 0755 $startdir/mythinstall.bin $MVBINDIR/MythVantage cd $MVBINDIR ln -s MythVantage mythvantage ln -s MythVantage mythinstall cd - + } +md5sums=('dde64a79c09ff169a5c363f77ffb68c2') diff --git a/abs/core/mythinstall/autocard.cpp b/abs/core/mythinstall/autocard.cpp deleted file mode 100755 index 585fba7..0000000 --- a/abs/core/mythinstall/autocard.cpp +++ /dev/null @@ -1,186 +0,0 @@ -#include "libmyth/mythcontext.h" -#include "libmyth/mythdbcon.h" -#include <qsqldatabase.h> -#include <qheader.h> -#include <qcursor.h> -#include <qlayout.h> -#include <iostream> -#include "autocard.h" -#include <stdlib.h> -#include <cstdlib> - -AutoCard::AutoCard(void) : - listbox(new ListBoxSetting(this)) -{ - listbox->setLabel(tr("Cards")); - addChild(listbox); -} -void AutoCard::popup_menu(void) -{ - QString name = listbox->getValue(); -// cout << "in popup" << name << endl; - QString uniqid = name.section(' ', -1); - QString description = name.section('*',-3,-3); - description = description.section('.',1); - description = description.stripWhiteSpace(); -// cout << uniqid << endl; -// cout << "descriptn" << endl; -// cout << description << endl; - if (name.isEmpty() || name == "Default") - return; - - QString message = tr("Cardme:") + - QString("\n'%1'?").arg(name); - - DialogCode value = MythPopupBox::Show2ButtonPopup(gContext->GetMainWindow(), - "", message, - tr("Add Card"), - tr("Do not Add"), kDialogCodeButton0); - - if ( value == kDialogCodeButton1) - { - MSqlQuery query(MSqlQuery::InitCon()); - query.prepare("update autocard set devicestatus ='unused' where uniqid=:UNIQID and description=:DESCRIPTION;"); - query.bindValue(":UNIQID",uniqid ); - query.bindValue(":DESCRIPTION",description ); - if (!query.exec()) - MythContext::DBError("Autocard::popup", query); - - int lastIndex = listbox->getValueIndex(name); - lastValue = ""; - load(); - listbox->setValue(lastIndex); - } - else if (value == kDialogCodeButton0) - { - MSqlQuery query(MSqlQuery::InitCon()); - query.prepare("update autocard set devicestatus ='will-add' where uniqid=:UNIQID and description=:DESCRIPTION;"); - query.bindValue(":UNIQID",uniqid ); - query.bindValue(":DESCRIPTION",description ); - - - if (!query.exec()) - MythContext::DBError("Autocard::popup", query); - - int lastIndex = listbox->getValueIndex(name); - lastValue = ""; - load(); - listbox->setValue(lastIndex); - - - - - } - - - listbox->setFocus(); -} - - - -QStringList AutoCard::GetNames(void) -{ - QStringList names; - QString device; - QString description; - QString displayname ; - QString status ; - QString uniqid; - MSqlQuery query(MSqlQuery::InitCon()); - query.prepare("SELECT dev,description,uniqid,devicestatus FROM autocard order by uniqid"); - if (query.exec() && query.isActive() && query.size() > 0) - { - while (query.next()) - { - device=query.value(0).toString(); - description=query.value(1).toString(); - uniqid=query.value(2).toString(); - status=query.value(3).toString(); - //displayname=device; - displayname=". "; - displayname.append(description); - displayname.append(" * "); - displayname.append(status); - displayname.append(" * "); - - displayname.append(uniqid); - names << displayname ; - } - - return names; - } -} - -void AutoCard::open(QString name) -{ - lastValue = name; - bool created = false; - cout << name << endl; - if (name == "Mark all cards for addition") - { - cout <<"updating all cards" << endl; - MSqlQuery query(MSqlQuery::InitCon()); - query.prepare("update autocard set devicestatus='will-add' where devicestatus='unused' order by uniqid"); - query.exec(); - } - else if ( name == "Perform actions" ) - { - // write udev rules and reload udev - - system ("sudo autocard.py -w -i"); - system ("sudo autocard.py -r"); - - } - else if ( name == "Exit" ) - { - // write udev rules and reload udev - exit(0); - } - else - { - popup_menu(); -// bool ok = MythPopupBox::showGetTextPopup(gContext->GetMainWindow(), -// tr("Create New Playback Group"), -// tr("Enter group name or press SELECT to enter text via the " -// "On Screen Keyboard"), name); - - - } - -}; - -void AutoCard::load(void) -{ - listbox->clearSelections(); - - - QStringList names = AutoCard::GetNames(); - while (!names.isEmpty()) - { - listbox->addSelection(names.front()); - names.pop_front(); - } - listbox->addSelection("Mark all cards for addition"); - listbox->addSelection("Perform actions"); - listbox->addSelection("Exit"); - listbox->setValue(lastValue); - -} - - -int AutoCard::exec(void) -{ - while (ConfigurationDialog::exec() == QDialog::Accepted) - open(listbox->getValue()); - - return QDialog::Rejected; -} - - -MythDialog* AutoCard::dialogWidget(MythMainWindow* parent, - const char* widgetName) -{ - dialog = ConfigurationDialog::dialogWidget(parent, widgetName); - connect(dialog, SIGNAL(menuButtonPressed()), this, SLOT(popup_menu())); - return dialog; -} diff --git a/abs/core/mythinstall/autocard.h b/abs/core/mythinstall/autocard.h deleted file mode 100755 index 623fcc0..0000000 --- a/abs/core/mythinstall/autocard.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef AUTOCARD_H -#define AUTOCARD_H - -#include "qstringlist.h" -#include "libmyth/settings.h" -#include "libmyth/mythwidgets.h" - -class MPUBLIC AutoCard : public QObject, public ConfigurationDialog -{ - Q_OBJECT - - public: - AutoCard(); - virtual int exec(void); - virtual void load(void); - virtual void save(void) { }; - virtual void save(QString) { }; - virtual MythDialog* dialogWidget(MythMainWindow* parent, - const char* widgetName=0); - static QStringList GetNames(void); - protected slots: - void open(QString name); - void popup_menu(void); - - protected: - ListBoxSetting *listbox; - QString lastValue; -}; - -#endif diff --git a/abs/core/mythinstall/checkout_MythVantage.sh b/abs/core/mythinstall/checkout_MythVantage.sh new file mode 100755 index 0000000..58849bf --- /dev/null +++ b/abs/core/mythinstall/checkout_MythVantage.sh @@ -0,0 +1,49 @@ +#!/bin/bash +MYDIR=`pwd` +MYTHPATH="\/data\/LinHES-PKGBUILD\/abs\/core-testing\/mythtv\/stable-0.22\/mythtv\/src\/mythtv" + +function setup_links { +rm mythinstall.bin +rm mythbeselect.bin +ln -s $MYDIR/src/MythVantage-app/mythinstall/mythinstall ./mythinstall.bin +ln -s $MYDIR/src/MythVantage-app/mythbeselect/mythbeselect ./mythbeselect.bin +} + +function dl_repo { +mkdir src +cd src +if [ ! -d MythVantage-app ] +then + git clone http://mythvantage.com/MythVantage-app.git/ + cd MythVantage-app + git checkout --track -b LinHES origin/LinHES + cd $MYDIR + setup_links + cd - +else + echo "updating exisiting tree" + cd MythVantage-app + git pull + git checkout master + git merge + cd - +fi + +cd MythVantage-app +git checkout master +#git checkout origin/LinHES + +} + +dl_repo +sed -i "s/^MYTHPATH.*$/MYTHPATH\=\"$MYTHPATH\"/g" $MYDIR/src/MythVantage-app/mythinstall/mythinstall.pro +sed -i "s/#define __MVAPP__/\/\/#define __MVAPP__/g" $MYDIR/src/MythVantage-app/mythinstall/mv_common.h +sed -i "s/mythvantage/LinHES/g" $MYDIR/src/MythVantage-app/mythinstall/mv_common.h + +echo "INCLUDEPATH += /usr/include/mythtv" >> $MYDIR/src/MythVantage-app/mythbeselect/mythberestart.pro +echo "INCLUDEPATH += /usr/include/mythtv" >> $MYDIR/src/MythVantage-app/mythinstall/mythinstall.pro +cd $MYDIR/src/MythVantage-app/mythinstall && qmake +make || exit 1 +#cd $MYDIR/src/MythVantage-app/mythbeselect && qmake +#make ||exit 1 + diff --git a/abs/core/mythinstall/infrared.cpp b/abs/core/mythinstall/infrared.cpp deleted file mode 100755 index 2f56ae5..0000000 --- a/abs/core/mythinstall/infrared.cpp +++ /dev/null @@ -1,368 +0,0 @@ -#include <mythcontext.h> -#include <unistd.h> -#include <iostream> -#include <fstream> -#include <stdio.h> -#include <stdlib.h> -#include <cstdlib> -#include "misc_settings.h" -#include "infrared.h" -#include "mv_common.h" -#include "uitypes.h" - -extern HostParms hostparm; - - -HostRemoteTypeIR::HostRemoteTypeIR(): - 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); - const QFileInfoList *fil = remotes.entryInfoList(QDir::Dirs); - if (!fil) - return; - QFileInfoListIterator it( *fil ); - QFileInfo *remote; - for( ; it.current() != 0 ; ++it ) - { - remote = it.current(); - QFileInfo preview(remote->absFilePath() + "/preview.jpg"); - if (remote->fileName()[0] == '.' || !preview.exists() ) - { - VERBOSE(VB_IMPORTANT, remote->absFilePath() + "Can't find preivew image, doesn't look like a remote\n"); - continue; - } - QImage* previewImage = new QImage(preview.absFilePath()); - addImageSelection(remote->fileName(), previewImage); - } -}; - -static HostComboBox *HostReceiverType() -{ - HostComboBox *gc = new HostComboBox("HostReceiverType"); - gc->setLabel(QObject::tr("Receiver")); - gc->addSelection("Default"); - gc->addSelection("tinker"); - gc->addSelection("Serial"); - gc->addSelection("imon"); - gc->addSelection("Hauppauge"); - gc->addSelection("tinker"); - gc->addSelection("CommandIR"); - gc->addSelection("iguanaIR-usb"); - gc->addSelection("mceusb"); - gc->addSelection("mod_mce"); - gc->addSelection("pvr150"); - gc->addSelection("streamzap"); - gc->addSelection("tatir"); - gc->setHelpText(QObject::tr("The type of infrared receiver used.")); - gc->setValue("Default"); - return gc; -}; - - - -static HostComboBox *HostSerialPortlirc() -{ - HostComboBox *gc = new HostComboBox("HostSerialPortlirc",false); - gc->setLabel(QObject::tr("Serial Port")); - gc->addSelection("ttyS0"); - gc->addSelection("ttyS1"); - gc->addSelection("ttyS2"); - gc->addSelection("ttyS3"); - gc->setHelpText(QObject::tr("Serial port with the lirc receiver or transmitter")); - return gc; -} - -class LIRC_ReceiverSettings: public TriggeredConfigurationGroup { -public: - LIRC_ReceiverSettings(): - TriggeredConfigurationGroup(false, false, true, true,false, false, true, true) { - Setting* trigger = HostReceiverType() ; - addChild(trigger); - setTrigger(trigger); - - ConfigurationGroup* blanksettings = new GridConfigurationGroup(2,true); - - ConfigurationGroup* settings = new GridConfigurationGroup(2,true); - settings->addChild(HostSerialPortlirc()); - - addTarget("Default", blanksettings); - addTarget("Serial", settings); - addTarget("imon", blanksettings ); - addTarget("Hauppauge",blanksettings); - addTarget("tinker", blanksettings ); - addTarget("imon", blanksettings); - addTarget("Hauppauge", blanksettings); - addTarget("CommandIR", blanksettings); - addTarget("iguanaIR-usb", blanksettings); - addTarget("mceusb", blanksettings); - addTarget("mod_mce", blanksettings); - addTarget("pvr150", blanksettings); - addTarget("streamzap", blanksettings); - addTarget("tatir", blanksettings); - }; -}; - - - -IRFrame::IRFrame(): - VerticalConfigurationGroup(false,false,false,false) - { - LIRC_ReceiverSettings *receiversettings = new LIRC_ReceiverSettings(); - addChild(new HostRemoteTypeIR()); - addChild(receiversettings); - } - - -//----------------transmit settings-------------- -static HostComboBox *HostTransmitproto_1() -{ - HostComboBox *gc = new HostComboBox("HostTransmitproto_1",false); - gc->setLabel(QObject::tr("Transmitter")); - gc->addSelection("none"); - gc->setValue(0); - gc->setHelpText(QObject::tr("Remote codes to control a cable box")); - QString dirtxt; - dirtxt=MV_ROOT; - dirtxt.append("templates/transmit"); - QDir transmit(dirtxt); - transmit.setFilter(QDir::Dirs); - transmit.setSorting(QDir::Name | QDir::IgnoreCase); - const QFileInfoList *infos = transmit.entryInfoList(); - const QFileInfo *info; - if (!infos) - return gc; - QFileInfoListIterator infoIt( *infos ); - QString currentitem = "."; - while( (info=infoIt.current()) != 0 ) - { - currentitem = info->baseName( TRUE ); - if ( currentitem != ".." && currentitem != "." && currentitem != "") - { - gc->addSelection(currentitem); - } - ++infoIt; - } - return gc; -}; - -static HostComboBox *HostTransmitproto_2() -{ - HostComboBox *gc = new HostComboBox("HostTransmitproto_2",false); - gc->setLabel(QObject::tr("Transmitter")); - gc->addSelection("none"); - gc->setValue(0); - gc->setHelpText(QObject::tr("Remote codes to control a cable box")); - QString dirtxt; - dirtxt=MV_ROOT; - dirtxt.append("templates/transmit"); - QDir transmit(dirtxt); - transmit.setFilter(QDir::Dirs); - transmit.setSorting(QDir::Name | QDir::IgnoreCase); - const QFileInfoList *infos = transmit.entryInfoList(); - const QFileInfo *info; - if (!infos) - return gc; - QFileInfoListIterator infoIt( *infos ); - QString currentitem = "."; - while( (info=infoIt.current()) != 0 ) - { - currentitem = info->baseName( TRUE ); - if ( currentitem != ".." && currentitem != "." && currentitem != "") - { - gc->addSelection(currentitem); - } - ++infoIt; - } - return gc; -}; - -static HostComboBox *HostTransmitproto_3() -{ - HostComboBox *gc = new HostComboBox("HostTransmitproto_3",false); - gc->setLabel(QObject::tr("Transmitter")); - gc->addSelection("none"); - gc->setValue(0); - gc->setHelpText(QObject::tr("Remote codes to control a cable box")); - QString dirtxt; - dirtxt=MV_ROOT; - dirtxt.append("templates/transmit"); - QDir transmit(dirtxt); - transmit.setFilter(QDir::Dirs); - transmit.setSorting(QDir::Name | QDir::IgnoreCase); - const QFileInfoList *infos = transmit.entryInfoList(); - const QFileInfo *info; - if (!infos) - return gc; - QFileInfoListIterator infoIt( *infos ); - QString currentitem = "."; - while( (info=infoIt.current()) != 0 ) - { - currentitem = info->baseName( TRUE ); - if ( currentitem != ".." && currentitem != "." && currentitem != "") - { - gc->addSelection(currentitem); - } - ++infoIt; - } - return gc; -}; - -static HostComboBox *HostTransmitproto_4() -{ - HostComboBox *gc = new HostComboBox("HostTransmitproto_4",false); - gc->setLabel(QObject::tr("Transmitter")); - gc->addSelection("none"); - gc->setValue(0); - gc->setHelpText(QObject::tr("Remote codes to control a cable box")); - QString dirtxt; - dirtxt=MV_ROOT; - dirtxt.append("templates/transmit"); - QDir transmit(dirtxt); - transmit.setFilter(QDir::Dirs); - transmit.setSorting(QDir::Name | QDir::IgnoreCase); - const QFileInfoList *infos = transmit.entryInfoList(); - const QFileInfo *info; - if (!infos) - return gc; - QFileInfoListIterator infoIt( *infos ); - QString currentitem = "."; - while( (info=infoIt.current()) != 0 ) - { - currentitem = info->baseName( TRUE ); - if ( currentitem != ".." && currentitem != "." && currentitem != "") - { - gc->addSelection(currentitem); - } - ++infoIt; - } - return gc; -}; - - -static HostComboBox *HostBlasterType() -{ - HostComboBox *gc = new HostComboBox("HostBlasterType"); - gc->setLabel(QObject::tr("Blaster")); - gc->addSelection("None"); - gc->addSelection("Receiver"); - gc->addSelection("Serial"); - gc->addSelection("CommandIR"); - //gc->addSelection("Hauppauge"); - gc->addSelection("MCE"); - gc->addSelection("pvr150"); - gc->addSelection("iguanaIR-usb"); - gc->setHelpText(QObject::tr("The type of infrared transmitter being used. Selecting CommandIR will use that device for both transmiting and receiving. Any other receiver will be disabled.")); - gc->setValue("None"); - return gc; -}; - -static HostComboBox *HostSerialPort_blasterlirc() -{ - HostComboBox *gc = new HostComboBox("HostSerialPort_blasterlirc",false); - gc->setLabel(QObject::tr("Serial Port")); - gc->addSelection("ttyS0"); - gc->addSelection("ttyS1"); - gc->addSelection("ttyS2"); - gc->addSelection("ttyS3"); - gc->setHelpText(QObject::tr("Serial port with the lirc transmitter")); - return gc; -} - - - -class LIRC_BlasterSettings: public TriggeredConfigurationGroup { -public: - LIRC_BlasterSettings(): - TriggeredConfigurationGroup(false, false, true, true,false, false, true, true) { - Setting* trigger = HostBlasterType() ; - addChild(trigger); - setTrigger(trigger); - - ConfigurationGroup* blanksettings = new GridConfigurationGroup(2,true); - - ConfigurationGroup* settings = new GridConfigurationGroup(1,true); - settings->addChild(HostTransmitproto_1()); - - ConfigurationGroup* CommandIRsettings = new GridConfigurationGroup(1,true); - CommandIRsettings->addChild(HostTransmitproto_1()); - CommandIRsettings->addChild(HostTransmitproto_2()); - CommandIRsettings->addChild(HostTransmitproto_3()); - CommandIRsettings->addChild(HostTransmitproto_4()); - - ConfigurationGroup* mcesettings = new GridConfigurationGroup(1,true); - mcesettings->addChild(HostTransmitproto_1()); - mcesettings->addChild(HostTransmitproto_2()); - - - - ConfigurationGroup* serial_settings = new GridConfigurationGroup(1,true); - serial_settings->addChild(HostSerialPort_blasterlirc()); - serial_settings->addChild(HostTransmitproto_1()); - addTarget("None", blanksettings); - addTarget("Receiver", settings); - addTarget("Serial", serial_settings); - addTarget("CommandIR", CommandIRsettings); - addTarget("pvr150",blanksettings); - addTarget("MCE",mcesettings); - addTarget("iguanaIR-usb",mcesettings); -// addTarget("tinker", blanksettings ); - }; -}; - -IR_TransmitFrame::IR_TransmitFrame(): - VerticalConfigurationGroup(false,false,false,false) - { - LIRC_BlasterSettings *blastersettings = new LIRC_BlasterSettings(); - addChild(blastersettings); - } - -//------------------LCD settings------------- - - - -static HostComboBox *HostLCDType() -{ - HostComboBox *gc = new HostComboBox("HostLCDType",false); - gc->setLabel(QObject::tr("LCD/VFD model")); - gc->addSelection("no_lcd"); - gc->addSelection("tinker"); - gc->setValue(0); - gc->setHelpText(QObject::tr("VFD or LCD")); - QString dirtxt; - dirtxt=MV_ROOT; - dirtxt.append("templates/LCD"); - QDir transmit(dirtxt); - - //QDir transmit("/usr/share/templates/LCD"); - transmit.setFilter(QDir::Dirs); - transmit.setSorting(QDir::Name | QDir::IgnoreCase); - const QFileInfoList *infos = transmit.entryInfoList(); - const QFileInfo *info; - if (!infos) - return gc; - QFileInfoListIterator infoIt( *infos ); - QString currentitem = "."; - while( (info=infoIt.current()) != 0 ) - { - currentitem = info->baseName( TRUE ); - if ( currentitem != ".." && currentitem != "." && currentitem != "") - { - gc->addSelection(currentitem); - } - ++infoIt; - } - return gc; -}; - -LCDFrame::LCDFrame(): - VerticalConfigurationGroup(false,false,false,false) - { - addChild(HostLCDType()); - } - - diff --git a/abs/core/mythinstall/infrared.h b/abs/core/mythinstall/infrared.h deleted file mode 100755 index c647952..0000000 --- a/abs/core/mythinstall/infrared.h +++ /dev/null @@ -1,45 +0,0 @@ -#include <mythcontext.h> -#include <unistd.h> -#include <iostream> -#include <fstream> -#include <stdio.h> -#include "settings.h" -#include "installsettings.h" -#include <qsqldatabase.h> -#include <qsqlquery.h> - -#include <stdlib.h> -#include <cstdlib> -#include <mythtv/mythdbcon.h> -#include <qdir.h> -#include <qapplication.h> -#include "util.h" - -class IRFrame: public VerticalConfigurationGroup { - public: - IRFrame(); - }; - - -class HostRemoteTypeIR: public HostImageSelect { -public: - HostRemoteTypeIR(); -}; - -class IR_TransmitFrame: public VerticalConfigurationGroup { - public: - IR_TransmitFrame(); - - }; - -class LCDFrame: public VerticalConfigurationGroup { - public: - LCDFrame(); - - }; - - - - - - diff --git a/abs/core/mythinstall/install-ui.xml b/abs/core/mythinstall/install-ui.xml index 8cebd11..ef445bb 100755 --- a/abs/core/mythinstall/install-ui.xml +++ b/abs/core/mythinstall/install-ui.xml @@ -1,19 +1,6 @@ -<!-- - - This is a myth style theme file for mythwelcome - - (c) 2005 by a whole bunch of people associated with MythTV - ---> <mythuitheme> <window name="welcome_screen"> - - <!-- - - First, define all the fonts we need on this screen - - --> <font name="title" face="Arial"> <color>#ffff00</color> <dropcolor>#000000</dropcolor> @@ -66,19 +53,14 @@ <bold>no</bold> </font> - <container name="main_display"> - <area>0,0,800,600</area> + <textarea name="title" from="basetextarea"> + <area>50,10,700,40</area> + <font>title</font> + <align>allcenter</align> + <value>Welcome to LinHES!</value> + </textarea> - <textarea name="title" draworder="0" align="center"> - <multiline>no</multiline> - <font>title</font> - <area>50,40,700,40</area> - <value>Welcome to MythVantage! </value> - </textarea> - <!-- - time - --> <textarea name="time_text" draworder="0" align="right"> <multiline>no</multiline> <font>time</font> @@ -86,22 +68,24 @@ <value></value> </textarea> - <textarea name="date_text" draworder="0" align="hcenter"> + <textarea name="date_text" > <multiline>yes</multiline> - <font>time</font> - <area>20,75,740,100</area> + <font>warning</font> + <area>20,55,740,100</area> <value></value> + <align>allcenter</align> </textarea> <!-- current myth status --> - <textarea name="status_text" draworder="1" align="center"> + <textarea name="status_text"> <multiline>yes</multiline> <font>info</font> - <area>20,100,760,60</area> - <value>MythTV is idle and will shutdown shortly.</value> + <area>20,300,760,60</area> + <value></value> + <align>center</align> </textarea> <!-- @@ -115,60 +99,36 @@ <value></value> </textarea> - <textarea name="recording_text" draworder="1" align="hcenter"> + <textarea name="recording_text"> <multiline>yes</multiline> <font>biginfo</font> <area>20,140,760,150</area> <value></value> + <align>allcenter</align> </textarea> - <!-- - next scheduled recording status - --> - <textarea name="scheduled_label" draworder="1" align="center"> <font>label</font> <area>20,320,760,30</area> <value></value> </textarea> - <textarea name="scheduled_text" draworder="1" align="hcenter"> + <textarea name="scheduled_text"> <multiline>yes</multiline> <font>biginfo</font> <area>20,400,760,120</area> <value></value> + <align>allcenter</align> </textarea> - <textarea name="mythvantage_text" draworder="1" align="right"> + <textarea name="mythvantage_text"> <multiline>no</multiline> <font>tinyinfo</font> - <area>20,560,760,30</area> + <area>20,540,760,30</area> <value></value> + <align>right</align> </textarea> - <!-- - scheduled recordings conflict warning - --> - - <textarea name="conflicts_text" draworder="1" align="center"> - <font>warning</font> - <area>20,490,760,30</area> - <value>WARNING: There are conflicting scheduled recordings!</value> - </textarea> - - <!-- - start frontend button - - <textbutton name="startfrontend_button" draworder="1"> - <position>81,535</position> - <font>buttons</font> - <image function="on" filename="mw_text_button_on.png"></image> - <image function="off" filename="mw_text_button_off.png"></image> - <image function="pushed" filename="mw_text_button_pushed.png"></image> - </textbutton> - - --> - </container> </window> diff --git a/abs/core/mythinstall/install_proxy.sh b/abs/core/mythinstall/install_proxy.sh deleted file mode 100755 index a1a722e..0000000 --- a/abs/core/mythinstall/install_proxy.sh +++ /dev/null @@ -1,353 +0,0 @@ -#!/bin/bash -disk=$2 -rootfs=$3 -rootsize=$4 -datafs=$5 -datasize=$6 -swapsize=$7 -mountpoint="/new_boot" -run=/root/install_functions.sh -. /etc/systemconfig 2>/dev/null - - -progress () { -mypercent=`echo "$1" | cut -d. -f1` -if [ x$mypercent = x ] -then -echo "" > /tmp/.install_percent -else -echo "${mypercent}% complete" > /tmp/.install_percent -fi - - -} - -full_install () { - if [ -f /tmp/.this_is_upgrade ] - then - rm /tmp/.this_is_upgrade - fi - echo "Partitioning $disk" > /tmp/.install_state - progress 1 - sleep 1 - $run partition_it $disk $rootsize $datasize $swapsize - - echo "Formating $disk" > /tmp/.install_state - progress 2 - sleep 1 - $run format_it $disk $rootfs $datafs - - echo "Preparing $disk" > /tmp/.install_state - progress 3 - sleep 1 - $run mount_it $disk - - startsize=`statgrab -M disk.|grep $disk.write_bytes|cut -d= -f 2|tr -d " "` - - echo "STARTSIZE=$startsize">/tmp/.startsize.io - echo "Installing data" > /tmp/.install_state - - sleep 1 - $run copy_it $disk ALL - $run fstab_fix_it $disk $rootfs $datafs - - progress 99 - sleep 1 - $run grub_it $disk - - echo "Configuring system" > /tmp/.install_state - progress 100 - sleep 1 - cp -f /etc/systemconfig "$mountpoint"/etc - #run save syssettings to save settings, then copy to new mountpoint - /root/restore_default_settings.sh -c save -t syssettings -h myhost -d 127.0.0.1 - SE=/usr/share/templates/settings/syssettings - mkdir -p ${mountpoint}$SE - cp -rp $SE/* ${mountpoint}$SE/ - chown root:mythtv "$mountpoint"/etc/systemconfig - chown -R mythtv:mythtv ${mountpoint}$SE - - chmod -R 775 ${mountpoint}$SE - chmod 775 "$mountpoint"/etc/systemconfig - #copy over any updates that might have occured - cp -f /root/*.sh "$mountpoint"/root/ - chmod -R 755 ${mountpoint}/root - cp /etc/mtab "$mountpoint"/etc/mtab - chroot "$mountpoint" /root/systemconfig.sh misc,hostype,network - - if [ $SystemType = "Master_backend" -o $SystemType = "Standalone" ] - then - #installing DB to local machine - - chroot "$mountpoint" /root/install_db_chroot.sh - else - #update remotedb with this host settings - chroot "$mountpoint" /root/restore_default_settings.sh -c restore -t Default - chroot "$mountpoint" /root/restore_default_settings.sh -c restore -t syssettings - #Run second time - chroot "$mountpoint" /root/systemconfig.sh misc,hostype,network - fi - echo "Done" > /tmp/.install_state - $run unmount_it $disk -} - - - - -function upgrade () { - touch /tmp/.this_is_upgrade - - if [ ! x$rootfs = "xDo_not_format" ] - then - echo "Formating $disk" > /tmp/.install_state - progress 2 - sleep 1 - $run format_it $disk $rootfs NO - fi - - - echo "Preparing $disk" > /tmp/.install_state - progress 3 - sleep 1 - $run mount_it $disk - startsize=`statgrab -M disk.|grep $disk.write_bytes|cut -d= -f 2|tr -d " "` - echo "STARTSIZE=$startsize">/tmp/.startsize.io - echo "Installing data" > /tmp/.install_state - sleep 1 - cp -rf /tmp/etc /new_boot/etc.old - cp -rf /tmp/oss /new_boot/var/lib/oss.old - $run copy_it $disk bin.lzm,boot.lzm,etc.lzm,home.lzm,lib.lzm,opt.lzm,root.lzm,sbin.lzm,usr.lzm,var.lzm - - if [ x$rootfs = "xDo_not_format" ] - then - rootfs=`grep ${disk}1 /tmp/etc/fstab |awk ' { print $3 } '` - fi - datafs=`grep ${disk}3 /tmp/etc/fstab |awk ' { print $3 } '` - $run fstab_fix_it $disk $rootfs $datafs - - echo "Writing boot sector" > /tmp/.install_state - progress 99 - sleep 1 - $run grub_it $disk - - - echo "Configuring system" > /tmp/.install_state - progress - sleep 1 - cp /etc/mtab "$mountpoint"/etc/mtab - cp -f /etc/systemconfig "$mountpoint"/etc - cp -f /root/*.sh "$mountpoint"/root/ - chmod -R 755 ${mountpoint}/root - chown root:mythtv "$mountpoint"/etc/systemconfig - chmod 775 "$mountpoint"/etc/systemconfig - chroot "$mountpoint" /root/systemconfig.sh misc,hostype,network - # chroot "$mountpoint" /root/restore_default_settings.sh restore Default - chroot "$mountpoint" /root/restore_default_settings.sh -c restore -t syssettings - #Run second time - chroot "$mountpoint" /root/systemconfig.sh misc,hostype,network - # fi - - echo "Done" > /tmp/.install_state - - $run unmount_it $disk -} - - - -function killdhcp () { -if [ -f /etc/dhcpc/dhcpcd-eth0.pid ] - then - pid=`cat /etc/dhcpc/dhcpcd-eth0.pid` - kill -9 $pid - rm -f /etc/dhcpc/dhcpcd-eth0.pid - rm -f /var/run/dhcpcd* - fi -if [ -f /var/run/dhcpcd-eth0.pid ] - then - pid=`cat /var/rundhcpcd-eth0.pid` - kill -9 $pid - rm -f /var/run/dhcpcd-eth0.pid* - fi -ip address flush dev eth0 -} - -function network_setup () { -DEVICE=eth0 - if [ ! -f /etc/systemconfig ] - then - exit 1 - fi -killdhcp - -if [ $UseDHCP = 0 ] -then - /sbin/dhcpcd $DEVICE - if [ ! $? = 0 ] - then - exit 2 - fi -fi - -if [ $UseDHCP = 1 ] -then - - /sbin/ifconfig $DEVICE $ip - /sbin/route add default gw $route - echo "nameserver $nameserver" > /etc/resolv.conf -fi - - -} - -function SANE_SYSETTINGS () { -sed -e '/HOSTrootfstype/d' \ - -e '/HOSTrootfstype/d' \ - -e '/HOSTdatafstype/d' \ - -e '/HOSTOSsize/d' \ - -e '/HostUseALLdata/d' \ - -e '/HOSTDATAsize/d' \ - -e '/HOSTuprootfstype/d' \ - -e '/HostUseSWAP/d' \ - -e '/HOSTSWAPsize/d ' /tmp/usr/share/templates/settings/syssettings/settings.txt > /tmp/settings.new - mv /tmp/settings.new /tmp/usr/share/templates/settings/syssettings/settings.txt -} - -case $1 in - full_install_it ) - - full_install - ;; - find_update) - #TRY TO mount first partition of drive - #copy /etc/systemconfig to live, import settings into db - #umount drive - $run mount_it $disk - if [ -f /new_boot/etc/systemconfig ] - then - ###########ADD templates - mkdir -p /tmp/usr/share/templates - cp -pr /new_boot/usr/share/templates /tmp/usr/share - SANE_SYSETTINGS - cp -rp /tmp/usr/share/templates/settings /usr/share/templates - - - cp /new_boot/etc/systemconfig /etc/systemconfig - cp -rf /new_boot/etc /tmp/etc - cp -rf /new_boot/var/lib/oss /tmp/oss - - /root/restore_default_settings.sh -c restore -t syssettings -h myhost -d 127.0.0.1 - fi - $run umount_it $disk - ;; - - upgrade_it) - #"/root/install_proxy.sh upgrade_it " + install_drive + " " + rootfs + "&" - upgrade - - ;; - disk_model_it) - model="unknown" - size="xxx" - case $2 in - - h* ) - model=`cat /proc/ide/$2/model` - ;; - s*) model=`sginfo /dev/$2|grep Product|awk ' { print $2 } '` - ;; - esac - size=`parted /dev/$2 print |grep Disk|awk ' { print $3 } ' ` - - - echo ""$model" $size " >/tmp/model - - ;; - network_check_it) - #Should never return from check_network - case $2 in - setup_network) network_setup - ;; - - check_self) - myipeth0=`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'|head -n1` - ping -c 1 $myipeth0 - if [ ! $? = 0 ] - then - exit 3 - #can't ping yourself - fi - ;; - check_gw) - #check gateway - mygweth0=`/sbin/route |grep eth0|grep UG|awk '{ print $2}'` - ping -c 1 $mygweth0 - if [ ! $? = 0 ] - then - exit 4 - #can't ping the gw - fi - ;; - check_ns) - #check nameserver - mydns=`cat /etc/resolv.conf|grep nameserver|head -1|awk '{ print $2}'` - ping -c 1 $mydns - if [ ! $? = 0 ] - then - exit 5 - #can't ping the gw - fi - ;; - check_names) - host google.com - if [ ! $? = 0 ] - then - exit 6 - #can't ping the gw - fi - ;; - esac - exit 0 - ;; - - - * ) - state=`cat /tmp/.install_state` - if [ x"${state}" = "xConfiguring system" ] - then - progress "" - else - #finding the drive - ddrive=`df | grep $mountpoint | head -n1 | awk -F/ ' { print $3 } ' | cut -d" " -f 1|cut -b1,2,3 ` - used=`statgrab -M disk.|grep ${ddrive}.write_bytes|cut -d= -f 2|tr -d " "` - . /tmp/.startsize.io - used=`echo $used-$STARTSIZE|bc` - echo $used - - if [ ! x$used = x ] - then - . /root/.install_size - #somehow find if it's an install or update - if [ -f /tmp/.this_is_upgrade ] - then - total=$UPGRADESIZE - else - total=$TOTALSIZE - fi - percent=`echo "scale=2 ; ($used/$total) * 100 " |bc ` - cond2=$(echo "$percent > 100" |bc ) - if [ $cond2 -eq 1 ] - then - percent=100 - fi - cond3=$(echo "$percent < 3" |bc ) - if [ $cond3 -eq 0 ] - then - progress $percent - fi - fi - fi - ;; -esac - - - diff --git a/abs/core/mythinstall/installationtype.cpp b/abs/core/mythinstall/installationtype.cpp deleted file mode 100755 index d32b9fc..0000000 --- a/abs/core/mythinstall/installationtype.cpp +++ /dev/null @@ -1,272 +0,0 @@ -#include <mythcontext.h> -#include <unistd.h> -#include <iostream> -#include <fstream> -#include <stdio.h> -#include "settings.h" -#include "installsettings.h" -#include "installdialog.h" -#include "installationtype.h" -#include <qsqldatabase.h> -#include <qsqlquery.h> -#include <qdir.h> -#include <mythtv/mythdbcon.h> -#include "mv_common.h" - -int mythinstalltype (QString tmp_install_drive) -{ - - Mythinstalltype setting; - setting.load(); - setting.save(); - //setting.exec(); - int retc = 1 ; - if ( setting.exec() == QDialog::Accepted ) - { - retc = 0; - } - return retc; - -}; - - static HostComboBox *HOSTinstallationtype() -{ - HostComboBox *gc = new HostComboBox("HOSTinstallationtype"); - gc->setLabel(QObject::tr("Upgrade or Full install")); - gc->addSelection("Full/Auto") ; - gc->addSelection("Upgrade"); - - - gc->setHelpText(QObject::tr("A full install will erase the entire drive and repartition. An upgrade will only format or overlay the first parition of the drive.")); - - return gc; -} - -static HostSpinBox *HOSTOSsize() -{ - #ifdef __MVAPP__ - HostSpinBox *gc = new HostSpinBox("HOSTOSsize", 2, 15, 1, true); - #else - HostSpinBox *gc = new HostSpinBox("HOSTOSsize", 3, 25, 1, true); - #endif - gc->setLabel(QObject::tr("OS size (GB)")); - gc->setValue(2); - gc->setHelpText(QObject::tr("" )); - - return gc; -} -static HostSpinBox *HOSTDATAsize() -{ - HostSpinBox *gc = new HostSpinBox("HOSTDATAsize", 2, 1500, 1, true); - gc->setLabel(QObject::tr("Data size (GB)")); - gc->setValue(2); - gc->setHelpText(QObject::tr("" )); - - return gc; -} - -static HostSpinBox *HOSTSWAPsize() -{ - QString currentitem; - QString line; - QFile file("/proc/meminfo"); - if ( file.open(IO_ReadOnly | IO_Translate) ) - { - QTextStream t( &file ); // use a text stream - line = t.readLine(); - if ( line.startsWith("MemTotal:")) - { - currentitem = line.simplifyWhiteSpace(); - currentitem = currentitem.section( " ", 1, 1 ); - } - } - file.close(); - bool ok; - int mem = currentitem.toInt( &ok, 10 ); // dec == 0, ok == FALSE - mem = mem/1024 ; - if ( ! ok ) - mem = 120 ; - HostSpinBox *gc = new HostSpinBox("HOSTSWAPsize", 128, 128000, 128, true); - gc->setLabel(QObject::tr("Swapspace size (MB)")); - gc->setValue(mem); - gc->setHelpText(QObject::tr("" )); - - return gc; -} - -static HostCheckBox *HostUseSWAP() -{ - HostCheckBox *gc = new HostCheckBox("HostUseSWAP"); - gc->setLabel(QObject::tr("Use swap partition")); - gc->setValue(true); - gc->setHelpText(QObject::tr("Enable or disable the swap partition.")); - return gc; -}; - -static HostCheckBox *HostUseALLdata() -{ - HostCheckBox *gc = new HostCheckBox("HostUseALLdata"); - gc->setLabel(QObject::tr("Use all remaining space for data")); - gc->setValue(true); - gc->setHelpText(QObject::tr("If checked myth will use the rest of the drive for the data. Otherwise you will be able to set the size of the partition.")); - return gc; -}; - - -static HostComboBox *HOSTdatafstype() -{ - HostComboBox *gc = new HostComboBox("HOSTdatafstype"); - gc->setLabel(QObject::tr("Data filesystem")); - gc->addSelection("ext3") ; - gc->addSelection("ext4") ; - gc->addSelection("reiserfs"); - gc->addSelection("jfs"); - gc->addSelection("xfs"); - - gc->setHelpText(QObject::tr("Filesystem for data. ")); - - return gc; -} - - static HostComboBox *HOSTuprootfstype() -{ - HostComboBox *gc = new HostComboBox("HOSTuprootfstype"); - gc->setLabel(QObject::tr("OS file system")); - gc->addSelection("ext3") ; - gc->addSelection("ext4") ; - gc->addSelection("reiserfs"); - gc->addSelection("jfs"); - //gc->addSelection("xfs"); - gc->addSelection("Do_not_format"); - - gc->setHelpText(QObject::tr("Filesystem for OS. ")); - - return gc; -} - -static HostComboBox *HOSTrootfstype() -{ - HostComboBox *gc = new HostComboBox("HOSTrootfstype"); - gc->setLabel(QObject::tr("Root filesystem format")); - gc->addSelection("ext3") ; - gc->addSelection("ext4") ; - gc->addSelection("reiserfs"); - gc->addSelection("jfs"); - //gc->addSelection("xfs"); - - gc->setHelpText(QObject::tr("Filesystem for OS. ")); - - return gc; -} - -class USESwap: - public TriggeredConfigurationGroup { -public: - USESwap(): - //ConfigurationGroup(false, true, false, false), - //VerticalConfigurationGroup(false, true, false, false), - TriggeredConfigurationGroup(true,false,true,true,false,false,false,true) { - //setLabel(QObject::tr("" )); -// setUseLabel(false); - - - Setting* useswap = HostUseSWAP(); - addChild(useswap); - setTrigger(useswap); - - - ConfigurationGroup* swapyes = new VerticalConfigurationGroup(false); - swapyes->addChild(HOSTSWAPsize()); - - - - addTarget("1", swapyes ); - addTarget("0", new VerticalConfigurationGroup(true)); - - - - - }; -}; - -class DATAsize: - public TriggeredConfigurationGroup { -public: - DATAsize(): - //ConfigurationGroup(false, true, false, false), - //VerticalConfigurationGroup(false, true, false, false), - TriggeredConfigurationGroup(true,false,true,true,false,false,false,true) { - //setLabel(QObject::tr("" )); -// setUseLabel(false); - - - Setting* datasize = HostUseALLdata(); - addChild(datasize); - setTrigger(datasize); - - - ConfigurationGroup* alldatano = new VerticalConfigurationGroup(false); - alldatano->addChild(HOSTDATAsize()); - alldatano->addChild(HOSTdatafstype()); - - ConfigurationGroup* alldatayes = new VerticalConfigurationGroup(false); - alldatayes->addChild(HOSTdatafstype()); - - - - - addTarget("1", alldatayes); - addTarget("0", alldatano); - - - - }; -}; - - -class Installationtype: - public TriggeredConfigurationGroup { -public: - Installationtype(): - //ConfigurationGroup(false, true, false, false), - //VerticalConfigurationGroup(false, true, false, false), - TriggeredConfigurationGroup(true,false,true,true,false,false,false,true) { -// setLabel(QObject::tr("Upgrade or Full install" )); -// setUseLabel(false); - - - Setting* Mtemplate = HOSTinstallationtype(); - addChild(Mtemplate); - setTrigger(Mtemplate); - - - ConfigurationGroup* tupgrade = new VerticalConfigurationGroup(false); - tupgrade->addChild(HOSTuprootfstype()); - - ConfigurationGroup* tfull = new VerticalConfigurationGroup(false); - tfull->addChild(HOSTOSsize()); - tfull->addChild(HOSTrootfstype()); - tfull->addChild(new USESwap); - tfull->addChild(new DATAsize); - - - - addTarget("Upgrade",tupgrade ); - addTarget("Full/Auto", tfull); - - - }; -}; - -Mythinstalltype::Mythinstalltype() -{ - //Reseting the install type to remove "NET" - if ( gContext->GetSetting("Hostinstallationtype") == "NET") - gContext ->SaveSetting("HOSTinstallationtype","Full/Auto"); - Installationtype *installationtype = new Installationtype(); - addChild(installationtype); - -} - - - diff --git a/abs/core/mythinstall/installationtype.h b/abs/core/mythinstall/installationtype.h deleted file mode 100755 index ad29224..0000000 --- a/abs/core/mythinstall/installationtype.h +++ /dev/null @@ -1,11 +0,0 @@ -#include <settings.h> -#include "mythdialogs.h" -//###################################################################################################3 -class Mythinstalltype: public ConfigurationWizard { -public: - Mythinstalltype(); - -}; - -int mythinstalltype(QString); - diff --git a/abs/core/mythinstall/installdialog.cpp b/abs/core/mythinstall/installdialog.cpp deleted file mode 100755 index e5bdfc9..0000000 --- a/abs/core/mythinstall/installdialog.cpp +++ /dev/null @@ -1,1034 +0,0 @@ -#include <qapplication.h> -#include <unistd.h> -#include <fstream> -#include <sys/wait.h> // For WIFEXITED on Mac OS X - -#include "mythcontext.h" -#include "mythdbcon.h" -#include "lcddevice.h" -#include "tv.h" -#include "programinfo.h" -#include "uitypes.h" -#include "remoteutil.h" -#include <qdir.h> -#include "installdialog.h" -#include "installsettings.h" -#include "installationtype.h" -#include "mv_common.h" -#include "libmyth/dialogbox.h" -#include <stdlib.h> -#define UPDATE_STATUS_INTERVAL 5000 -#define UPDATE_SCREEN_INTERVAL 5000 - - - -WelcomeDialog::WelcomeDialog(MythMainWindow *parent, - QString window_name, - QString theme_filename, - const char* name) -:MythThemedDialog(parent, window_name, theme_filename, name) -{ - system("rm -f /tmp/.install_state"); - system("rm -f /tmp/.install_percent"); - system("rm -f /tmp/.install_error"); - install_drive = "" ; - recording_text = ""; - scheduled_text = ""; - install_text = ""; - version_text = ""; - I_AM_BUSY = false; - WORKING_ON_INSTALL = false; - current_hostname = ""; - - gContext->addListener(this); - m_timeFormat = gContext->GetSetting("TimeFormat", "h:mm AP"); - wireUpTheme(); - assignFirstFocus(); - - m_updateStatusTimer = new QTimer(this); - connect(m_updateStatusTimer, SIGNAL(timeout()), this, - SLOT(updateStatus())); - m_updateStatusTimer->start(UPDATE_STATUS_INTERVAL); - - m_updateScreenTimer = new QTimer(this); - connect(m_updateScreenTimer, SIGNAL(timeout()), this, - SLOT(updateScreen())); - - m_timeTimer = new QTimer(this); - connect(m_timeTimer, SIGNAL(timeout()), this, - SLOT(updateTime())); - m_timeTimer->start(1000); - - reboot_box = NULL; - popup = NULL; - showPopup(); -} -void WelcomeDialog::shutdownNow(int rc) -{ - QString NETBOOT = getenv("NETBOOT"); - NETBOOT=NETBOOT.stripWhiteSpace(); - system("rm -f /tmp/.install_state"); - system("rm -f /tmp/.install_percent"); - system("rm -f /tmp/.install_error"); - if (rc == 1) - system("/sbin/halt"); - else - system("/sbin/reboot"); - // system("/usr/bin/killall -9 X"); -} - -void WelcomeDialog::runLIVECD(void) -{ - cancelPopup(); - ask_validate_network(); - if ( runsettings(true) == 1 ) - { - QString PAINTER = gContext->GetSetting("ThemePainter"); - QString startFECmd = ("MYTHCONFDIR=/tmp mythfrontend -O ThemePainter=" + PAINTER ); - myth_system(startFECmd.ascii()); - } - else - { - cancelPopup(); - showPopup(); - } - - -} - - - -int WelcomeDialog::exec() -{ - updateAll(); - return MythDialog::exec(); -} - - - -void WelcomeDialog::keyPressEvent(QKeyEvent *e) -{ - bool handled = false; - QStringList actions; - gContext->GetMainWindow()->TranslateKeyPress("Welcome", e, actions); - for (unsigned int i = 0; i < actions.size() && !handled; i++) - { - QString action = actions[i]; - handled = true; - if (action == "ESCAPE") - { - return; // eat escape key - } - else if (action == "MENU") - { - showPopup(); - } - else if (action == "NEXTVIEW") - { - accept(); - } - else if (action == "SELECT") - { - activateCurrent(); - } - else - handled = false; - } - - if (!handled) - MythThemedDialog::keyPressEvent(e); -} - -UITextType* WelcomeDialog::getTextType(QString name) -{ - UITextType* type = getUITextType(name); - if (!type) - { - cout << "ERROR: Failed to find '" << name << "' UI element in theme file\n" - << "Bailing out!" << endl; - exit(0); - } - return type; -} - -void WelcomeDialog::wireUpTheme() -{ - m_status_text = getTextType("status_text"); - m_recording_text = getTextType("recording_text"); - m_scheduled_text = getTextType("scheduled_text"); - m_mv_text=getTextType("mythvantage_text"); - m_time_text = getTextType("time_text"); - m_date_text = getTextType("date_text"); - m_warning_text = getTextType("conflicts_text"); - m_warning_text->hide(); - buildFocusList(); -} - -void WelcomeDialog::closeDialog() -{ - done(1); -} - -WelcomeDialog::~WelcomeDialog() -{ - gContext->removeListener(this); - if (m_updateStatusTimer) - delete m_updateStatusTimer; - - if (m_updateScreenTimer) - delete m_updateScreenTimer; - - if (m_timeTimer) - delete m_timeTimer; -} - -void WelcomeDialog::updateTime(void) -{ - QString releasefile="/etc/"; - releasefile.append(RELEASEFILE); - - extern const char *myth_source_version; - extern const char *myth_source_path; - QString distro_line; - QFile file(releasefile); - if ( file.open(IO_ReadOnly | IO_Translate) ) - { - QTextStream t( &file ); // use a text stream - distro_line = t.readLine(); - file.close(); - } - - - QString s=""; - //QString s="MythVantage 1.4 Mythtv svn: "; - s.append(distro_line); - s.append( " , Mythtv svn:" ); - s.append(myth_source_version); - s.append(" "); - s.append(myth_source_path); - m_date_text->SetText(s); -} - -void WelcomeDialog::updateStatus(void) -{ -// checkConnectionToServer(); - updateStatusMessage(); -} - -void WelcomeDialog::updateScreen(void) -{ - QString cmdtxt; - cmdtxt=MV_ROOT ; - cmdtxt.append("bin/install_proxy.sh " ); - system(cmdtxt); - recording_text=" "; - mythvantage_text=" "; - error_text=" "; - scheduled_text=" "; - QFile mystatus("/tmp/.install_state"); - QFile mypercent("/tmp/.install_percent"); - QFile myerror("/tmp/.install_error"); - QFile mylog("/tmp/mythvantage_install.log"); - if ( mystatus.open(IO_ReadOnly | IO_Translate) ) - { - QTextStream t( &mystatus ); // use a text stream - scheduled_text = t.readLine(); - mystatus.close(); - } - - if ( mypercent.open(IO_ReadOnly | IO_Translate) ) - { - QTextStream t( &mypercent ); // use a text stream - recording_text = t.readLine(); - mypercent.close(); - } - - if ( myerror.open(IO_ReadOnly | IO_Translate) ) - { - QTextStream t( &myerror ); // use a text stream - error_text = t.readLine(); - myerror.close(); - scheduled_text = error_text; - recording_text = "FAILED"; - WORKING_ON_INSTALL = false; - } - - if ( WORKING_ON_INSTALL ) - { - if ( mylog.open( IO_ReadOnly| IO_Translate ) ) - { - QTextStream t( &mylog ); - while ( !t.atEnd() ) - { - mythvantage_text=t.readLine(); - } - mylog.close(); - } - } - else - mythvantage_text=""; - m_recording_text->SetText(recording_text); - m_scheduled_text->SetText(scheduled_text); - m_mv_text->SetText(mythvantage_text); - - if ( install_drive != "" ) - install_text = ""; - - m_status_text->SetText(install_text ); - m_updateScreenTimer->start(UPDATE_SCREEN_INTERVAL, true); - if ( scheduled_text == "Done" ) - { - Reboot_popup () ; - } - // shows the busy box when configuring the system - if ( scheduled_text == "Configuring system") - { - if ( ! I_AM_BUSY ) - busy_box(); - assignFirstFocus(); - } -}; - -void WelcomeDialog::busy_box(void) -{ - QString msgtext = "Please wait, " ; - msgtext.append(current_hostname); - msgtext.append(" is preparing for life"); - MythBusyDialog *busy = new MythBusyDialog(msgtext); - busy->start(); - - while ( scheduled_text == "Configuring system" ) - { - qApp->processEvents (); - usleep(900); - I_AM_BUSY = true; - } - busy->Close(); - I_AM_BUSY = false; - busy->deleteLater(); -} - -void WelcomeDialog::busy_find_oldsettings(void) -{ - MythBusyDialog *busy = new MythBusyDialog( - QObject::tr("Importing old settings")); - busy->start(); - int return_code = 0; - while ( return_code == 0 ) - { - qApp->processEvents (); - usleep(900); - I_AM_BUSY = true; - return_code = myth_system("ps -ef|grep install_proxy.sh|grep -v grep > /dev/null"); - - } - busy->Close(); - I_AM_BUSY = false; - busy->deleteLater(); - -} - - - -void WelcomeDialog::updateAll(void) -{ - updateRecordingList(); - updateScheduledList(); -} - -bool WelcomeDialog::updateRecordingList() -{ - return true; -} - -bool WelcomeDialog::updateScheduledList() -{ - updateStatus(); - updateScreen(); - return true; -} - -void WelcomeDialog::updateStatusMessage(void) -{ - -} - -void WelcomeDialog::showPopup(void) -{ - if (popup) - return; - popup = new MythPopupBox(gContext->GetMainWindow(), "Menu"); - QButton *topButton; - QLabel *label = popup->addLabel(tr("Menu"), MythPopupBox::Large, false); - label->setAlignment(Qt::AlignCenter | Qt::WordBreak); - // This is a bad way to lock the buttons but it works for now. - if ( scheduled_text.length() <= 2 ) - { - topButton = popup->addButton(tr("Install or Upgrade "), this, - SLOT(Display_2ndpopup())); - popup->addButton(tr("Run MythFrontend"), this, - SLOT(runLIVECD())); - popup->addButton(tr("Exit"), this, - SLOT(closeDialog())); - popup->addButton(tr("Close menu"), this, SLOT(cancelPopup())); - - popup->ShowPopup(this, SLOT(cancelPopup())); - - } - else - { - topButton= popup->addButton(tr("Exit"), this, - SLOT(closeDialog())); - popup->addButton(tr("Close menu"), this, SLOT(cancelPopup())); - - popup->ShowPopup(this, SLOT(cancelPopup())); - } - - topButton->setFocus(); -} - - -QString WelcomeDialog::diskmodel(QString drive , QString tsize) -{ - string line; - QString cmdtxt; - cmdtxt=MV_ROOT ; - cmdtxt.append("bin/install_proxy.sh disk_model_it " + drive + " " + tsize ); - myth_system(cmdtxt); - - ifstream model("/tmp/model"); - if (model.is_open()) - getline (model,line); - model.close(); - return line; -} - -QString WelcomeDialog::findinstallsouce(void) -{ - string line; - QString currentitem; - ifstream mountfile("/proc/mounts"); - //ifstream mountfile("procmounts"); - while (! mountfile.eof() ) - { - getline (mountfile,line); - if ( line.empty() ) - line = "oops didn't find andthing"; - currentitem = line; - - if ( ! currentitem.contains("/dev")) - currentitem="not the right line"; - - //if ( currentitem.contains("/mnt/live/mnt") ) - if ( currentitem.contains("/.livesys/medium") ) - { - int ndx = line.find(" "); - currentitem = line.substr(0,ndx); - ndx = currentitem.findRev("/"); - currentitem = currentitem.mid(ndx+1,3); - return currentitem; - }; - - } - -}; - -void WelcomeDialog::showPopup_2(void) -{ - - if (popup) - return; - popup = new MythPopupBox(gContext->GetMainWindow(), "Select the drive to install"); - findinstallsouce(); - QButton *CancelButton; - QLabel *label = popup->addLabel(tr("Select the install target."), MythPopupBox::Large, false); - label->setAlignment(Qt::AlignCenter | Qt::WordBreak); - string currentitem; - string sizeitem; - string disksize; - string line; - bool installsource = false; - - QString NETBOOT = getenv("NETBOOT"); - NETBOOT=NETBOOT.stripWhiteSpace(); - if ( NETBOOT == "YES" ) - popup->addButton(("Diskless Frontend " ), this, SLOT(install_net() ) ); - - QString INSTALLSOURCE = findinstallsouce(); - std::cout << "install source:" << std::endl; - std::cout << INSTALLSOURCE << std::endl; - ifstream partitions("/proc/partitions"); - if (partitions.is_open()) - while (! partitions.eof() ) - { - getline (partitions,line); - if ( line.empty() ) - { - line = "oops didn't find anything"; - } - int ndx = line.rfind(" "); - ndx = ndx +1; - int linelength = line.length(); - currentitem = line.substr(ndx,linelength); - sizeitem = line.substr(0,ndx-1); - linelength = sizeitem.length(); - ndx = sizeitem.rfind(" "); - disksize = sizeitem.substr(ndx+1,linelength); - -// std::cout << currentitem<< std::endl; - if( currentitem == INSTALLSOURCE ) - { - std::cout << currentitem<< std::endl; - installsource = true; - } - - - if (! installsource ) - { - if ( currentitem == "hda" ) - popup->addButton(("hda " + diskmodel(currentitem,disksize)), this, SLOT(install_hda() ) ); - if ( currentitem == "hdb" ) - popup->addButton(("hdb " + diskmodel(currentitem,disksize)), this, SLOT(install_hdb() ) ); - if ( currentitem == "hdc" ) - popup->addButton(("hdc " + diskmodel(currentitem,disksize)), this, SLOT(install_hdc() ) ); - if ( currentitem == "hdd" ) - popup->addButton(("hdd " + diskmodel(currentitem,disksize)), this, SLOT(install_hdd() ) ); - if (currentitem == "sda" ) - popup->addButton(("sda " + diskmodel(currentitem,disksize)), this, SLOT(install_sda() ) ); - if (currentitem == "sdb" ) - popup->addButton(("sdb " + diskmodel(currentitem,disksize)), this, SLOT(install_sdb() ) ); - if (currentitem == "sdc" ) - popup->addButton(("sdc "+ diskmodel(currentitem,disksize)), this, SLOT(install_sdc() ) ); - if (currentitem == "sdd" ) - popup->addButton(("sdd "+ diskmodel(currentitem,disksize)), this, SLOT(install_sdd() ) ); - } - installsource = false; - } - partitions.close(); - CancelButton = popup->addButton(tr("Cancel"), this, SLOT(MAINPopup())); - popup->ShowPopup(this, SLOT(cancelPopup())); - CancelButton->setFocus(); -} - -void WelcomeDialog::GO_popup(QString go_text) -{ - if (popup) - return; - DialogCode retval = MythPopupBox::Show2ButtonPopup(gContext->GetMainWindow(), - QString("Start the process"), - QObject::tr(go_text), - QObject::tr("Start the process"), QObject::tr("Cancel"), kDialogCodeButton0); - - if ( retval == kDialogCodeButton0 ) - { - install_it(); - } - else - { - cancelPopup(); - showPopup(); - } -} - - -void WelcomeDialog::Reboot_popup(void) -{ if (reboot_box) - return; - QString prompt1; - QFile updbstatus("/tmp/.upgrade_db_failed"); - if ( updbstatus.open(IO_ReadOnly | IO_Translate) ) - { - prompt1 = QObject::tr(" "); - prompt1.append("\n"); - prompt1.append("An error occured while attempting to restore the database!"); - prompt1.append("\n"); - prompt1.append("The old database could not be restored, so a new database was created"); - prompt1.append("\n"); - - } - else - { - prompt1 = QObject::tr("Ready to go!"); - } - - - - reboot_box = new DialogBox(gContext->GetMainWindow(), prompt1); - reboot_box->AddButton(QObject::tr("Reboot")); - reboot_box->AddButton(QObject::tr("Power off")); - - int returncode = 0; - DialogCode dcode = reboot_box->exec(); - reboot_box->deleteLater(); - if (kDialogCodeButton0 == dcode ) - returncode = 0; - if (kDialogCodeButton1 == dcode ) - returncode = 1; - if (kDialogCodeButton2 == dcode ) - returncode = 2; - - - reboot_box = NULL; - shutdownNow(returncode); -} - - - -void WelcomeDialog::cancelPopup(void) -{ - if (!popup) - return; - popup->hide(); - popup->deleteLater(); - popup = NULL; - setActiveWindow(); -} - -void WelcomeDialog::MAINPopup(void) -{ - if (!popup) - return; - popup->hide(); - popup->deleteLater(); - popup = NULL; - showPopup(); - setActiveWindow(); -} - -void WelcomeDialog::Display_2ndpopup(void) -{ - cancelPopup(); - showPopup_2(); - updateStatusMessage(); - updateScreen(); -} - -void WelcomeDialog::install_hda(void) -{ - install_drive = "hda" ; - install_generic(); -} - -void WelcomeDialog::install_hdb(void) -{ - install_drive = "hdb" ; - install_generic(); -} - -void WelcomeDialog::install_hdc(void) -{ - install_drive = "hdc" ; - install_generic(); -} - -void WelcomeDialog::install_hdd(void) -{ - install_drive = "hdd" ; - install_generic(); -} - -void WelcomeDialog::install_sda(void) -{ install_drive = "sda" ; - install_generic(); -} -void WelcomeDialog::install_sdb(void) -{ install_drive = "sdb" ; - install_generic(); -} - -void WelcomeDialog::install_sdc(void) -{ install_drive = "sdc" ; - install_generic(); -} - -void WelcomeDialog::install_sdd(void) -{ - install_drive = "sdd" ; - install_generic(); -} - -void WelcomeDialog::install_net(void) -{ - install_drive = "NET" ; - gContext->ActivateSettingsCache(false); - gContext ->SaveSetting("HOSTinstallationtype","NET"); - install_generic(); -} - -void WelcomeDialog::install_generic(void) -{ - gContext->ActivateSettingsCache(false); - cancelPopup(); - updateStatusMessage(); - updateScreen(); - QString installwarningtext; - int runNextSetting; - runNextSetting = 1; - int tflag; - tflag = 0; - int retcode; - retcode=0; - QString installtype; - if ( install_drive != "NET") - retcode = mythinstalltype(install_drive); - if ( retcode == 0 ) - { - installtype = gContext -> GetSetting("HOSTinstallationtype"); - if ( installtype == "Full/Auto" ) - { - runNextSetting = ask_validate_network(); - installwarningtext="Warning!"; - installwarningtext.append ("\n"); - installwarningtext.append ("\n"); - installwarningtext.append ("About to erase the entire"); - installwarningtext.append ("\n"); - installwarningtext.append ("installation drive of "); - installwarningtext.append (install_drive); - - } - else if ( installtype == "NET") - { - runNextSetting=0; - gContext ->SaveSetting("HostSystemType", "Frontend_only"); - gContext->SaveSetting("HostaccesshostypeSystemtype","0"); - installwarningtext.append ("About to install "); - installwarningtext.append ("\n"); - installwarningtext.append (install_drive); - // ask for hostname - runsettings(false,true,false,false,false,false,false); - } - else if ( installtype == "Upgrade" ) - { - installwarningtext="Warning!"; - installwarningtext.append ("\n"); - installwarningtext.append ("\n"); - installwarningtext.append ("About to erase the"); - installwarningtext.append ("\n"); - installwarningtext.append ("partition "); - installwarningtext.append (install_drive); - installwarningtext.append ("1"); - QString cmdtxt; - cmdtxt=MV_ROOT ; - cmdtxt.append("bin/install_proxy.sh find_update " + install_drive +" &"); - system(cmdtxt); - busy_find_oldsettings(); - bool flag = false; - QString line; - QString currentitem; - QFile file("/etc/systemconfig"); - if ( file.open(IO_ReadOnly | IO_Translate) ) - { - QTextStream t( &file ); // use a text stream - while ( !t.eof() ) - { - line = t.readLine(); - if ( line.startsWith("hostname")) - { - flag=true; - currentitem = line.section( "=", 1, 1 ); - current_hostname = currentitem ; - } - } - file.close(); - cout << current_hostname << endl; - } - if ( flag ) - { - // GO_popup(installwarningtext); - tflag = 1; - } - else - { - cout << "searching for knoppmyth-versin" << endl; - //couldn't open /etc/systemconfig, so now look for /tmp/etc/Knoppmyth-version - QFile file("/tmp/etc/KnoppMyth-version"); - if ( file.exists() ) - { //appears to be a knoppmyth version, proceed - cout << "found knoppmyth-version" << endl; - QFile kmfile("/tmp/etc/hostname"); - if ( kmfile.open(IO_ReadOnly | IO_Translate) ) - { - QTextStream t( &kmfile ); // use a text stream - line = t.readLine(); - flag=true; - currentitem = line.stripWhiteSpace(); - current_hostname = currentitem ; - //gContext->ActivateSettingsCache(true); - gContext->ClearSettingsCache(); - gContext->SetSetting("HostMyhostname",current_hostname); - gContext->SaveSetting("HostMyhostname",current_hostname); - } - kmfile.close(); - cout << current_hostname << endl; - runNextSetting = ask_validate_network(); - } - else - { - //popup things went wrong - DialogCode returncode = MythPopupBox::Show2ButtonPopup(gContext->GetMainWindow(), - QString(""), - QObject::tr("Couldn't find the old config file, proceed with update?"), - QObject::tr("No"), QObject::tr("Yes"), kDialogCodeButton1); - if ( returncode == kDialogCodeButton1 ) - { - runNextSetting = ask_validate_network(); - } - else if ( returncode == kDialogCodeButton0 ) - { - runNextSetting = 1; - } - } - - } - } - - } - - -//run through the system settings -if ( runNextSetting == 0 ) -{ - tflag = runsettings(false,false,true,true,false,false,false,false,false,false,true,false); - -} -else -{ - cancelPopup(); - showPopup(); -} - -if ( tflag == 1 ) - { - cancelPopup(); - GO_popup(installwarningtext); - } - else - { - cancelPopup(); - showPopup(); - } - -} - -void busy_network(void) -{ - MythBusyDialog *busy = new MythBusyDialog( - QObject::tr("Starting network")); - busy->start(); - int return_code = 0; - while ( return_code == 0 ) - { - qApp->processEvents (); - usleep(900); - return_code = myth_system("ps -ef|grep install_proxy.sh| grep setup_network |grep -v grep > /dev/null"); - } - busy->Close(); - busy->deleteLater(); -} - - -int WelcomeDialog::ask_validate_network(void) -{ - - QString pop_text="abc"; - int retval = 1; - while ( retval != 0 ) - { - int settingsrec = runsettings(false,true,false,false,false,false,false); - if ( settingsrec != 1 ) - return 1; - else - { - MythProgressDialog *network_check = NULL; - network_check = new MythProgressDialog(QObject::tr("Please wait while the network is checked."), 6); - updateScreen(); - QString cmdtxt; - cmdtxt=MV_ROOT ; - cmdtxt.append("bin/install_proxy.sh network_check_it setup_network &"); - retval = system(cmdtxt); - busy_network(); - if (network_check) - { - network_check->setProgress(1); - cmdtxt=MV_ROOT ; - cmdtxt.append("bin/install_proxy.sh network_check_it check_self"); - retval = system(cmdtxt); - if ( retval != 0 ) - { - network_check->Close(); - pop_text="Could not find myself on the network"; - } - } - - if ( retval == 0) - { - network_check->setProgress(2); - cmdtxt=MV_ROOT ; - cmdtxt.append("bin/install_proxy.sh network_check_it check_gw"); - retval = system(cmdtxt); - if ( retval != 0 ) - { - network_check->Close(); - pop_text="Could not locate gateway"; - } - } - - if (retval == 0) - { - network_check->setProgress(3); - cmdtxt=MV_ROOT ; - cmdtxt.append("bin/install_proxy.sh network_check_it check_ns"); - retval = system(cmdtxt); - if ( retval != 0 ) - { - network_check->Close(); - pop_text="Could not locate nameserver"; - } - } - if (retval == 0) - { - network_check->setProgress(4); - cmdtxt=MV_ROOT ; - cmdtxt.append("bin/install_proxy.sh network_check_it check_names"); - retval = system(cmdtxt); - if ( retval != 0 ) - { - network_check->Close(); - pop_text="Could not lookup names"; - } - } - if (retval == 0) - { - network_check->setProgress(5); - cmdtxt=MV_ROOT ; - cmdtxt.append("bin/install_proxy.sh network_check_it host_names"); - retval = system(cmdtxt); - if ( retval != 0 ) - { - network_check->Close(); - pop_text="Hostname already on the network"; - } - } - - - network_check->setProgress(6); - if (network_check) - { - network_check->Close(); - network_check->deleteLater(); - } - - if (retval != 0 ) - { - DialogCode val = MythPopupBox::Show2ButtonPopup(gContext->GetMainWindow(), QString(""), QObject::tr(pop_text), QObject::tr("Continue"), QObject::tr("Try again"), kDialogCodeButton0); - - if (kDialogCodeButton0 == val ) - retval = 0; - } - } - } -return 0; -} - - -void WelcomeDialog::install_it(void) -{ - QString installtype = gContext -> GetSetting("HOSTinstallationtype"); - QString rootfs = gContext -> GetSetting("HOSTrootfstype"); - QString datafs = gContext -> GetSetting("HOSTdatafstype"); - QString rootsize = gContext -> GetSetting("HOSTOSsize"); - rootsize=rootsize + "000"; - QString usealldata = gContext -> GetSetting("HostUseALLdata"); - QString datasize = gContext -> GetSetting("HOSTDATAsize"); - QString uprootfs = gContext -> GetSetting("HOSTuprootfstype"); - QString useswap = gContext -> GetSetting("HostUseSWAP"); - QString swapsize = gContext -> GetSetting("HOSTSWAPsize"); - if ( installtype != "Upgrade" ) - current_hostname = gContext->GetSetting("HostMyhostname"); - QString clean_upgrade = getenv("CLEAN_UPGRADE"); - if ( clean_upgrade == "YES" ) - current_hostname = gContext->GetSetting("HostMyhostname"); - -//get the hostname here if upgrade then use previous declarion of hostname - if ( usealldata == "1" ) - { - datasize="ALL"; - } - else - { - datasize=datasize + "000"; - } - if ( useswap == "0" ) - { - swapsize="NO"; - }; - - - if ( installtype == "Full/Auto" ) - { - QString currentitem; - QString line; - QFile file("/proc/meminfo"); - if ( file.open(IO_ReadOnly | IO_Translate) ) - { - QTextStream t( &file ); // use a text stream - line = t.readLine(); - if ( line.startsWith("MemTotal:")) - { - currentitem = line.simplifyWhiteSpace(); - currentitem = currentitem.section( " ", 1, 1 ); - } - } - file.close(); - bool ok; - int mem = currentitem.toInt( &ok, 10 ); // dec == 0, ok == FALSE - cout << mem << endl; - if ( mem >= 500000 ) - { - cout << gContext -> GetSetting("HostXres") << endl; - if ((gContext -> GetSetting("HostXres")) == "1280x720" ) - { - gContext->SaveSetting("Theme", "syth-lacquer-wide"); - cout <<"Setting theme to syth-wide" << endl; - } - } - - - QString cmdtxt=MV_ROOT ; - cmdtxt.append("bin/install_proxy.sh full_install_it " + install_drive + " " + rootfs + " " + rootsize + " " + datafs + " " + datasize + " " + swapsize + "&"); - system(cmdtxt); - } - else if ( installtype == "Upgrade" ) - { - QString cmdtxt=MV_ROOT ; - cmdtxt.append("bin/install_proxy.sh upgrade_it " + install_drive + " " + uprootfs + "&"); - system(cmdtxt); - } - else if (installtype=="NET") - { - QString olddb = gContext->GetSetting("HostMysqlserver"); - QString cmdtxt; - cmdtxt=MV_ROOT ; - char localhostname[1024]; - if (gethostname(localhostname, 1024)) - { - VERBOSE(VB_IMPORTANT, - "MCP: Error, could not determine host name." + ENO); - localhostname[0] = '\0'; - } - QString h; - h=localhostname; - cout << "calling restore_default_settings with hostname " << h << endl; - cmdtxt.append("bin/restore_default_settings.sh -c save -t syssettings -d 127.0.0.1 -h " + h); - system(cmdtxt); - cmdtxt=MV_ROOT ; - cmdtxt.append("bin/install_proxy.sh NETBOOT " + install_drive + " &"); - system(cmdtxt); - } - WORKING_ON_INSTALL = true; - usleep (500); - updateScreen(); - usleep (500); - updateScreen(); - cancelPopup(); -} diff --git a/abs/core/mythinstall/installdialog.h b/abs/core/mythinstall/installdialog.h deleted file mode 100755 index f1c98ab..0000000 --- a/abs/core/mythinstall/installdialog.h +++ /dev/null @@ -1,101 +0,0 @@ -#ifndef WELCOMEDIALOG_H_ -#define WELCOMEDIALOG_H_ - -#include <iostream> -using namespace std; - -#include <qdatetime.h> -#include "mythdialogs.h" -#include "libmyth/dialogbox.h" -class WelcomeDialog : public MythThemedDialog -{ - - Q_OBJECT - - public: - - WelcomeDialog(MythMainWindow *parent, - QString window_name, - QString theme_filename, - const char* name = 0); - ~WelcomeDialog(); - - void keyPressEvent(QKeyEvent *e); - void wireUpTheme(); - int exec(void); - - protected slots: - void updateAll(void); - void updateStatus(void); - void updateScreen(void); - void closeDialog(); - void updateTime(); - void showPopup(); - void showPopup_2(); - void GO_popup(QString); - void Reboot_popup(); - void cancelPopup(); - void MAINPopup(); - QString diskmodel(QString,QString); - QString findinstallsouce(void); - void Display_2ndpopup(); - bool updateRecordingList(void); - bool updateScheduledList(void); - void shutdownNow(int); - - void install_hda(void); - void install_hdb(void); - void install_hdc(void); - void install_hdd(void); - void install_sda(void); - void install_sdb(void); - void install_sdc(void); - void install_sdd(void); - void install_net(void); - void install_generic(void); - void install_it(void); - void runLIVECD(void); - void busy_box(void); - void busy_find_oldsettings(void); - int ask_validate_network(void); - private: - void updateStatusMessage(void); - UITextType* getTextType(QString name); - MythPopupBox *popup; - DialogBox *reboot_box; - DialogBox *upgrade_box; - // - // GUI stuff - // - UITextType *m_status_text; - UITextType *m_recording_text; - UITextType *m_scheduled_text; - UITextType *m_error_text; - UITextType *m_mv_text; - UITextType *m_warning_text; - UITextType *m_time_text; - UITextType *m_date_text; - QTimer *m_updateStatusTimer; - QTimer *m_updateScreenTimer; - QTimer *m_timeTimer; - - QString m_installDir; - QString m_timeFormat; - QStringList m_statusList; - QString install_drive ; - QString install_text; - QString version_text; - QString recording_text; - QString scheduled_text; - QString error_text; - QString mythvantage_text; - string bin_prefix; - QString current_hostname; - - bool I_AM_BUSY; - bool WORKING_ON_INSTALL; - - -}; - -#endif diff --git a/abs/core/mythinstall/installsettings.cpp b/abs/core/mythinstall/installsettings.cpp deleted file mode 100755 index 8118132..0000000 --- a/abs/core/mythinstall/installsettings.cpp +++ /dev/null @@ -1,4556 +0,0 @@ -//_include <mythcontext.h> -#include <unistd.h> -#include <iostream> -#include <fstream> -#include <stdio.h> -#include "settings.h" - -#include <string> -#include <fstream> -#include <sstream> -#include <stdexcept> -#include <vector> -#include <cassert> -#include <algorithm> -#include <tr1/unordered_map> - - -#include <sys/wait.h> // For WIFEXITED on Mac OS X -#include <qapplication.h> -#include "mythcontext.h" -#include "libmyth/mythdialogs.h" -#include "mythdbcon.h" -#include "lcddevice.h" -#include "tv.h" -#include "programinfo.h" -#include "uitypes.h" -#include "remoteutil.h" -#include <qdir.h> -#include <qimage.h> -#include <stdlib.h> -#include <cstdlib> - -#include "installsettings.h" -#include "installdialog.h" -#include "xorgsettings.h" -#include "password_manage.h" -#include "misc_settings.h" -#include "infrared.h" - -#include <qsqldatabase.h> -#include <qsqlquery.h> -#include "mv_common.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 displayuser = false; -bool displaywebuser = false; -bool displayddns = false; -bool displayinfrared = false; -bool displayscreensaver = false; -bool install_hobbit = 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 HostComboBox *HostMyhostname() -{ - HostComboBox *gc = new HostComboBox("HostMyhostname",true); - gc->setLabel(QObject::tr("Hostname")); - gc->addSelection("Envy"); - gc->addSelection("Greed"); - gc->addSelection("Lust"); - gc->addSelection("Sloth"); - gc->addSelection("Wrath"); - gc->addSelection("Gluttony"); - gc->addSelection("Pride"); - gc->addSelection("Humility"); - gc->addSelection("Generosity"); - gc->addSelection("Love"); - gc->addSelection("Kindness"); - gc->addSelection("SelfControl"); - gc->addSelection("Faith"); - gc->addSelection("Zeal"); - gc->addSelection("type_hostname_here"); - gc->setHelpText(QObject::tr("Hostname of this machine")); - return gc; -}; - -static HostCheckBox *HostDHCPHostname() -{ - HostCheckBox *gc = new HostCheckBox("HostDHCPhostname"); - gc->setLabel(QObject::tr("Use Hostname provided by DHCP")); - gc->setValue(false); - gc->setHelpText(QObject::tr("Checking this will use the hostname as provided by dhcp for the default interface. If none is provided by DHCP it will use the hostname provided in the hostname box")); - 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 support")); - 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); - }; -}; - - - - -// static HostLineEdit *HostIP() -// { -// HostLineEdit *gc = new HostLineEdit("HostIP"); -// gc->setLabel(QObject::tr("Ip address")); -// gc->setValue("192.168.1.12"); -// gc->setHelpText(QObject::tr("IP address of the new installation")); -// return gc; -// }; -// -// static HostComboBox *HostNETMASK() -// { -// HostComboBox *gc = new HostComboBox("HostNETMASK"); -// gc->setLabel(QObject::tr("Netmask")); -// gc->addSelection("/0 0.0.0.0"); -// gc->addSelection("/1 128.0.0.0"); -// gc->addSelection("/2 192.0.0.0"); -// gc->addSelection("/3 224.0.0.0"); -// gc->addSelection("/4 240.0.0.0"); -// gc->addSelection("/5 248.0.0.0"); -// gc->addSelection("/6 252.0.0.0"); -// gc->addSelection("/7 254.0.0.0"); -// gc->addSelection("/8 255.0.0.0"); -// gc->addSelection("/9 255.128.0.0"); -// gc->addSelection("/10 255.192.0.0 "); -// gc->addSelection("/11 255.224.0.0"); -// gc->addSelection("/12 255.240.0.0"); -// gc->addSelection("/13 255.248.0.0"); -// gc->addSelection("/14 255.252.0.0"); -// gc->addSelection("/15 255.254.0.0"); -// gc->addSelection("/16 255.255.0.0"); -// gc->addSelection("/17 255.255.128.0"); -// gc->addSelection("/18 255.255.192.0"); -// gc->addSelection("/19 255.255.224.0"); -// gc->addSelection("/20 255.255.240.0"); -// gc->addSelection("/21 255.255.248.0"); -// gc->addSelection("/22 255.255.252.0"); -// gc->addSelection("/23 255.255.254.0"); -// gc->addSelection("/24 255.255.255.0"); -// gc->addSelection("/25 255.255.255.128"); -// gc->addSelection("/26 255.255.255.192"); -// gc->addSelection("/27 255.255.255.224"); -// gc->addSelection("/28 255.255.255.240"); -// gc->addSelection("/29 255.255.255.248"); -// gc->addSelection("/30 255.255.255.252"); -// gc->addSelection("/31 255.255.255.254"); -// gc->addSelection("/32 255.255.255.255"); -// gc->setHelpText(QObject::tr("Netmask")); -// gc->setValue(24); -// return gc; -// }; - - -QString findnet() -{ - -QString netdev=""; -//QString netdev="eth0 eth1 wlan0 wlan1 ath0 "; -//QString netdev="eth0 eth1"; -system("/sbin/ifconfig -a > /tmp/.netinfo"); -QString line; -QFile file("/tmp/.netinfo"); - if ( file.open(IO_ReadOnly | IO_Translate) ) - { - QTextStream 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(IO_ReadOnly | IO_Translate) ) - { - QTextStream 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(); - cout << foundnet << endl; - - if (foundnet.contains(hostparm.ThisHostnetOLD)) - { -// cout << "old setting is still active" << endl; -// cout << hostparm.ThisHostnetOLD << endl; - QString s = "HostActiveonboot"; - s+=hostparm.ThisHostnetOLD; - gContext->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 HostLineEdit *HostGW() -// { -// HostLineEdit *gc = new HostLineEdit("HostGW"); -// gc->setLabel(QObject::tr("Gateway")); -// gc->setValue("192.168.1.1"); -// gc->setHelpText(QObject::tr("This is the default route")); -// return gc; -// }; -// -// static HostLineEdit *HostDNS() -// { -// HostLineEdit *gc = new HostLineEdit("HostDNS"); -// gc->setLabel(QObject::tr("Name server")); -// gc->setValue("192.168.1.1"); -// gc->setHelpText(QObject::tr("Name server")); -// 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(IO_ReadOnly | IO_Translate) ) - { - QTextStream 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 HostComboBox *HostEvrouterConfig() -{ - HostComboBox *gc = new HostComboBox("HostEvrouterConfig",true); - gc->setLabel(QObject::tr("Layout")); - gc->setHelpText(QObject::tr("Choose the keypad layout")); - QString dirtxt; - dirtxt=MV_ROOT; - dirtxt.append("templates/evrouter"); - QDir evrouter(dirtxt); - //evrouter.setFilter(QDir::Dirs); - evrouter.setSorting(QDir::Name | QDir::IgnoreCase); - const QFileInfoList *infos = evrouter.entryInfoList(); - const QFileInfo *info; - if (!infos) - return gc; - QFileInfoListIterator infoIt( *infos ); - QString currentitem = "."; - while( (info=infoIt.current()) != 0 ) - { - currentitem = info->baseName( TRUE ); - if ( currentitem != ".." && currentitem != "." && currentitem != "") - { - gc->addSelection(currentitem); - } - ++infoIt; - } - 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 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("Check to run a dhcp server.")); - return gc; -}; - -static HostCheckBox *HostRunEvrouter() -{ - HostCheckBox *gc = new HostCheckBox("HostRunEvrouter"); - gc->setLabel(QObject::tr("Enable special keys")); - gc->setValue(false); - gc->setHelpText(QObject::tr("Check if using evrouter")); - return gc; -}; - -static HostCheckBox *HostUsemythfrontend() -{ - HostCheckBox *gc = new HostCheckBox("HostUseMythWelcome"); - gc->setLabel(QObject::tr("Run MythWelcome")); - gc->setValue(false); - gc->setHelpText(QObject::tr("If this option is checked mythwelcome will be started, instead of the usual frontend")); - return gc; -}; - -static HostCheckBox *HostRunFrontend() -{ - HostCheckBox *gc = new HostCheckBox("HostRunFrontend"); - gc->setLabel(QObject::tr("Run the Frontend.")); - gc->setValue(true); - gc->setHelpText(QObject::tr("If this option is checked mythfrontend will also start")); - return gc; -}; - - -/* -static HostComboBox *HostTransmitproto() -{ - HostComboBox *gc = new HostComboBox("HostTransmitproto",false); - gc->setLabel(QObject::tr("Transmitter")); - gc->addSelection("none"); - gc->setValue(0); - gc->setHelpText(QObject::tr("Remote codes to control a cable box")); - QString dirtxt; - dirtxt=MV_ROOT; - dirtxt.append("templates/transmit"); - QDir transmit(dirtxt); - transmit.setFilter(QDir::Dirs); - transmit.setSorting(QDir::Name | QDir::IgnoreCase); - const QFileInfoList *infos = transmit.entryInfoList(); - const QFileInfo *info; - if (!infos) - return gc; - QFileInfoListIterator infoIt( *infos ); - QString currentitem = "."; - while( (info=infoIt.current()) != 0 ) - { - currentitem = info->baseName( TRUE ); - if ( currentitem != ".." && currentitem != "." && currentitem != "") - { - gc->addSelection(currentitem); - } - ++infoIt; - } - return gc; -}; - - - -static HostComboBox *HostReceiverType() -{ - HostComboBox *gc = new HostComboBox("HostReceiverType"); - gc->setLabel(QObject::tr("Receiver")); - gc->addSelection("Default"); - gc->addSelection("Serial"); - gc->addSelection("Usb"); - gc->addSelection("Usb-imon"); - gc->addSelection("Hauppauge"); - gc->addSelection("tinker"); - gc->setHelpText(QObject::tr("The type of infrared receiver and transmitter being used.")); - gc->setValue("Default"); - return gc; -}; - -static HostComboBox *HostSerialPortlirc() -{ - HostComboBox *gc = new HostComboBox("HostSerialPortlirc",false); - gc->setLabel(QObject::tr("Serial Port")); - gc->addSelection("ttyS0"); - gc->addSelection("ttyS1"); - gc->addSelection("ttyS2"); - gc->addSelection("ttyS3"); - gc->setHelpText(QObject::tr("Serial port with the lirc receiver or transmitter")); - 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(IO_ReadOnly | IO_Translate) ) - { - QTextStream 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 ); - //cout << currentitem << endl; - 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 ( ((gContext->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 resulting backup file to another location")); - return gc; -}; - - -static HostComboBox *HostRemoteBackupDir() -{ - QString tempItem; - HostComboBox *gc = new HostComboBox("HostRemoteBackupDir",true); - gc->setLabel(QObject::tr("dir or host" )); - gc->addSelection("dir:/localdir"); - MSqlQuery query(MSqlQuery::InitCon()); - - - query.prepare( "SELECT DISTINCT hostname from settings where hostname is not null and not (hostname=:HOSTNAME);"); - query.bindValue( ":HOSTNAME" , gContext->GetHostName() ); - if (query.exec() && query.isActive() && query.size() > 0) - { - while (query.next()) - { - tempItem = query.value(0).toString(); - gc->addSelection(tempItem); - } - } - - gc->setHelpText(QObject::tr("Host to copy backup file to. dir:/$localdir will copy to a local directory instead of a remote host ")); - - 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(true); - gc->setHelpText(QObject::tr("Callerid popup, 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 info")); - 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->setHelpText(QObject::tr("Serial port where callerid capable modem is connected")); - return gc; -} - -static HostCheckBox *Hostbootsplash() -{ - HostCheckBox *gc = new HostCheckBox("Hostbootsplash"); - gc->setLabel(QObject::tr("Enable bootsplash")); - gc->setValue(false); - gc->setHelpText(QObject::tr("Covers up boot messages. ")); - 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("Screen saver program to use.")); - 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 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(IO_ReadOnly | IO_Translate) ) - { - QTextStream 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("Screen saver to display.")); - QString dirtxt; - dirtxt=MV_ROOT; - dirtxt.append("templates/xscreensavers"); - //read in from a file. - QString line; - QFile file(dirtxt); - if ( file.open(IO_ReadOnly | IO_Translate) ) - { - QTextStream 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 (1/1)")); - 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 screen. Checked means the screen is enabled.")); - return gc; -}; - -static HostCheckBox *Hostaccesshostype() -{ - HostCheckBox *gc = new HostCheckBox("Hostaccesshostype"); - gc->setLabel(QObject::tr("hostype ")); - gc->setValue(true); - gc->setHelpText(QObject::tr("Control access to hostype screen. Checked means the screen is enabled.")); - return gc; -}; - -static HostCheckBox *HostaccesshostypeSystemtype() -{ - HostCheckBox *gc = new HostCheckBox("HostaccesshostypeSystemtype"); - gc->setLabel(QObject::tr("Change hostype")); - gc->setValue(false); - gc->setHelpText(QObject::tr("Ability to change sql server and system type. Checked means the screen is enabled.")); - return gc; -}; - -static HostCheckBox *Hostaccessmisc() -{ - HostCheckBox *gc = new HostCheckBox("Hostaccessmisc"); - gc->setLabel(QObject::tr("misc ")); - gc->setValue(true); - gc->setHelpText(QObject::tr("Control access to misc screen. Checked means the screen is enabled.")); - return gc; -}; - -static HostCheckBox *Hostaccesssleep() -{ - HostCheckBox *gc = new HostCheckBox("Hostaccesssleep"); - gc->setLabel(QObject::tr("sleep ")); - gc->setValue(true); - gc->setHelpText(QObject::tr("Control access to sleep screen. 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 screen. Checked means the screen is enabled. ")); - return gc; -}; - -static HostCheckBox *HostaccessadvancedX() -{ - HostCheckBox *gc = new HostCheckBox("HostaccessadvancedX"); - gc->setLabel(QObject::tr("advancedX ")); - gc->setValue(true); - gc->setHelpText(QObject::tr("Control access to advancedX screen. Checked means the screen is enabled. ")); - return gc; -}; -static HostCheckBox *Hostaccesssound() -{ - HostCheckBox *gc = new HostCheckBox("Hostaccesssound"); - gc->setLabel(QObject::tr("sound ")); - gc->setValue(true); - gc->setHelpText(QObject::tr("Control access to sound screen. Checked means the screen is enabled.")); - return gc; -}; - -static HostCheckBox *Hostaccessplugins() -{ - HostCheckBox *gc = new HostCheckBox("Hostaccessplugins"); - gc->setLabel(QObject::tr("plugins")); - gc->setValue(true); - gc->setHelpText(QObject::tr("Control access to plugin screen. Checked means the screen is enabled.")); - return gc; -}; - -static HostCheckBox *Hostaccessuser() -{ - HostCheckBox *gc = new HostCheckBox("Hostaccessuser"); - gc->setLabel(QObject::tr("User")); - gc->setValue(false); - gc->setHelpText(QObject::tr("Control access to the user managment screen. Checked means the screen is enabled.")); - return gc; -}; - -static HostCheckBox *Hostaccesswebuser() -{ - HostCheckBox *gc = new HostCheckBox("Hostaccesswebuser"); - gc->setLabel(QObject::tr("Web password")); - gc->setValue(true); - gc->setHelpText(QObject::tr("Control access to the web password screen. 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 *Hostpluginmythflix() -{ - HostCheckBox *gc = new HostCheckBox("Hostpluginmythflix"); - gc->setLabel(QObject::tr("mythflix")); - gc->setValue(true); - gc->setHelpText(QObject::tr("check to enable mythflix")); - 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 *HostpluginmythgameZsnes() -{ - HostCheckBox *gc = new HostCheckBox("HostpluginmythgameZsnes"); - gc->setLabel(QObject::tr("zsnes")); - gc->setValue(false); - gc->setHelpText(QObject::tr("Zsnes, super nintendo emulator")); - return gc; -}; - -static HostCheckBox *HostpluginmythgameFceu() -{ - HostCheckBox *gc = new HostCheckBox("HostpluginmythgameFceu"); - gc->setLabel(QObject::tr("fceu")); - gc->setValue(false); - gc->setHelpText(QObject::tr("Fceu, nintendo 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 MythGames to store information about games. If you are into games, this is recommended.")); - 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 *Hostpluginmythphone() -{ - HostCheckBox *gc = new HostCheckBox("Hostpluginmythphone"); - gc->setLabel(QObject::tr("mythphone")); - gc->setValue(false); - gc->setHelpText(QObject::tr("check to enable mythphone")); - 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 *Hostpluginmythvodka() -{ - HostCheckBox *gc = new HostCheckBox("Hostpluginmythvodka"); - gc->setLabel(QObject::tr("mythvodka")); - gc->setValue(false); - gc->setHelpText(QObject::tr("Myth Video On Demand Killer App.")); - 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("Used to 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 otherplatform.")); - 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 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; - - gContext->SetSetting("Hostfoldingusername", username); - gContext->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(false); - Setting* trigger = HostncidDaemon() ; - addChild(trigger); - setTrigger(trigger); - ConfigurationGroup* settings = new HorizontalConfigurationGroup(false,false); - settings->addChild(HostSerialPortncid()); - 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 LIRCsettings: public TriggeredConfigurationGroup { -public: - LIRCsettings(): - TriggeredConfigurationGroup(false, false, true, true,false, false, true, true) { - //SetVertical(false); - setLabel(QObject::tr("Misc Settings")); - Setting* trigger = HostReceiverType() ; - addChild(trigger); - setTrigger(trigger); - - ConfigurationGroup* settings = new GridConfigurationGroup(2,true); - settings->addChild(HostLircWait()); - settings->addChild(HostSerialPortlirc()); - - ConfigurationGroup* settings2 = new VerticalConfigurationGroup(true,true); - settings2->addChild(HostLircWait()); - - addTarget("Default", settings2); - addTarget("Serial", settings); - addTarget("Usb", settings2); - addTarget("Usb-imon", settings2 ); - addTarget("Hauppauge",settings2); - addTarget("tinker", new VerticalConfigurationGroup(false, false)); - }; -};*/ - -class Evroutersettings: public TriggeredConfigurationGroup { - public: - Evroutersettings(): - TriggeredConfigurationGroup(false, false, true, true,false, false, true, true) { - //SetVertical(false); - 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) { - //SetVertical(false); - //setLabel(QObject::tr("Evrouter config")); - Setting* trigger = Hostpluginmythgame() ; - addChild(trigger); - setTrigger(trigger); - - ConfigurationGroup* settings = new GridConfigurationGroup(3,true,true); - settings->addChild(HostpluginmythgameZsnes()); - settings->addChild(HostpluginmythgameFceu()); - settings->addChild(HostpluginmythgameMame()); - settings->addChild(HostpluginmythgameMednafen()); - settings->addChild(HostpluginmythgameROMDB()); - - - 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" ) - { - cout <<"ETH0: set other defaults buttons to off"<<endl; - hostparm.ThisHostDefaultInterface="eth0"; - emit eth0_is_default(); - } -} -void NetworkSettingseth0::eth0_disabled() -{ - cout << " eth0 is not default" << endl; - HostDefaulteth0->setValue(0); -} -void NetworkSettingseth0::eth0_wireless_settings(void) -{ - //cout <<"button pressed for eth0"<<endl; - eth0options eth0screen; - eth0screen.exec(); -} - -void NetworkSettingseth0::eth0_wireless_disable() -{ - cout << " eth0 disabling wireless button" << endl; - 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->setUseLabel(true); - 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" ) - { - cout <<"ETH1: set other defaults buttons to off"<<endl; - hostparm.ThisHostDefaultInterface="eth1"; - emit eth1_is_default(); - } -} -void NetworkSettingseth1::eth1_disabled() -{ - cout << " eth1 is not default" << endl; - HostDefaulteth1->setValue(0); -} - -void NetworkSettingseth1::eth1_wireless_settings(void) -{ - //cout <<"button pressed for eth1"<<endl; - eth1options eth1screen; - eth1screen.exec(); -} - -void NetworkSettingseth1::eth1_wireless_disable() -{ - cout << " eth1 disabling wireless button" << endl; - 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->setUseLabel(true); - 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" ) - { - cout <<"WLAN0: set other defaults buttons to off"<<endl; - hostparm.ThisHostDefaultInterface="wlan0"; - emit wlan0_is_default(); - } - - - -} -void NetworkSettingswlan0::wlan0_disabled() -{ - cout << " wlan0 is not default" << endl; - HostDefaultwlan0->setValue(0); -} - - -void NetworkSettingswlan0::wlan0_wireless_settings(void) -{ - //cout <<"button pressed for wlan0"<<endl; - Wlan0options wlan0screen; - wlan0screen.exec(); -} -void NetworkSettingswlan0::wlan0_wireless_disable() -{ - cout << " wlan0 disabling wireless button" << endl; - 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->setUseLabel(true); - 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" ) - { - cout <<"WLAN1: set other defaults buttons to off"<<endl; - hostparm.ThisHostDefaultInterface="wlan1"; - emit wlan1_is_default(); - } -} - -void NetworkSettingswlan1::wlan1_disabled() -{ - cout << " wlan1 is not default" << endl; - HostDefaultwlan1->setValue(0); - - -} -void NetworkSettingswlan1::wlan1_wireless_disable() -{ - cout << " wlan1 disabling wireless button" << endl; - wirelessbuttonwlan1->setEnabled(false); -} - -void NetworkSettingswlan1::wlan1_wireless_settings(void) -{ -// cout <<"button pressed for wlan1"<<endl; - 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->setUseLabel(true); - 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" ) - { - cout <<"ATH0: set other defaults buttons to off"<<endl; - hostparm.ThisHostDefaultInterface="ath0"; - emit ath0_is_default(); - } -} -void NetworkSettingsath0::ath0_disabled() -{ - cout << " ath0 is not default" << endl; - HostDefaultath0->setValue(0); -} - -void NetworkSettingsath0::ath0_wireless_settings(void) -{ - //cout <<"button pressed for ath0"<<endl; - ath0options ath0screen; - ath0screen.exec(); -} - -void NetworkSettingsath0::ath0_wireless_disable() -{ - cout << " ath0 disabling wireless button" << endl; - wirelessbuttonath0->setEnabled(false); -} - - -//-- - -class NetworkSettingsFrame: - public TriggeredConfigurationGroup { -public: - NetworkSettingsFrame(): - TriggeredConfigurationGroup(false, false, true, true,false, false, true, true) { - setLabel(QObject::tr("Network Settings Page (2/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); - }; -}; - - -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; -}; - - - - - -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); - //HostXres = new HostComboBox("HostXres"); - ConfigurationGroup* setting1 = new GridConfigurationGroup(2,false); - setting1->addChild(HostXres()); - setting1->addChild(HostUsemythfrontend()); - - 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("Type of system setup")); - HostSystemType->addSelection("Standalone"); - HostSystemType->addSelection("Frontend_only"); - HostSystemType->addSelection("Master_backend"); - HostSystemType->addSelection("Slave_backend"); - -// HostXres = new HostComboBox("HostXres"); - if ( ((gContext->GetSetting("HostaccesshostypeSystemtype")) == "0" )) - HostSystemType->setEnabled(false); - - addChild(HostSystemType); - setTrigger(HostSystemType); - - ConfigurationGroup* standalone = new VerticalConfigurationGroup(false,false,true,true); - standalone->addChild(HostXres()); - standalone->addChild(new HostRemoteType); - standalone->addChild(HostUsemythfrontend()); - - ConfigurationGroup* frontend = new VerticalConfigurationGroup(false,false,true,true); - frontend->addChild(HostMysqlserverip_listbox()); - frontend->addChild(HostXres()); - frontend->addChild(new HostRemoteType); - frontend->addChild(HostUsemythfrontend()); - - 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("Configuration for this system. Most people will use standalone")); - 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 master backend already on the network"; - if (selectedhostype == "Master_backend") - msg="Tuners, scheduling and database. This allows for remote frontend and slave backends"; - if (selectedhostype == "Slave_backend") - msg="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); - const QFileInfoList *fil = remotes.entryInfoList(QDir::Dirs); - if (!fil) - return; - - QFileInfoListIterator it( *fil ); - QFileInfo *remote; - for( ; it.current() != 0 ; ++it ) - { - remote = it.current(); - QFileInfo preview(remote->absFilePath() + "/preview.jpg"); - if (remote->fileName()[0] == '.' || !preview.exists() ) - { - //cout << remote->absFilePath() << " Can't find preivew image, doesn't look like a remote\n"; - continue; - } - QImage* previewImage = new QImage(preview.absFilePath()); - addImageSelection(remote->fileName(), previewImage); - - } - -} -/* -static HostComboBox *HostLCDType() -{ - HostComboBox *gc = new HostComboBox("HostLCDType",false); - gc->setLabel(QObject::tr("LCD/VFD model")); - gc->addSelection("no_lcd"); - gc->addSelection("tinker"); - gc->setValue(0); - gc->setHelpText(QObject::tr("VFD or LCD")); - QString dirtxt; - dirtxt=MV_ROOT; - dirtxt.append("templates/LCD"); - QDir transmit(dirtxt); - - //QDir transmit("/usr/share/templates/LCD"); - transmit.setFilter(QDir::Dirs); - transmit.setSorting(QDir::Name | QDir::IgnoreCase); - const QFileInfoList *infos = transmit.entryInfoList(); - const QFileInfo *info; - if (!infos) - return gc; - QFileInfoListIterator infoIt( *infos ); - QString currentitem = "."; - while( (info=infoIt.current()) != 0 ) - { - currentitem = info->baseName( TRUE ); - if ( currentitem != ".." && currentitem != "." && currentitem != "") - { - gc->addSelection(currentitem); - } - ++infoIt; - } - return gc; -}; -*/ - -class AdvancedSettings: public TriggeredConfigurationGroup { -public: - void smb_busy_box() { - system ("nmbscan -d > /tmp/smbdomainlist & "); - QString msgtext="Searching for windows workgroups"; - int return_code; - MythBusyDialog *busy = new MythBusyDialog(msgtext); - // yet another incorrect way todo things, but I don't know anybetter - // as long as ps can find systemconfig in the list the busy box will appear and update - busy->start(); - while ( return_code == 0 ) - { - return_code = myth_system("ps -ef|grep nmbscan|grep -v grep > /dev/null"); - qApp->processEvents (); - usleep(900); - } - busy->Close(); - busy->deleteLater(); - } - - AdvancedSettings(): - TriggeredConfigurationGroup(true,true,true,true,true,true,true,true) - { - - setLabel(QObject::tr("Advanced settings (1/3)")); - Setting* Autodown = HostAutodown(); - setTrigger(Autodown); - hostparm.ThisSystemType = gContext->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); - #ifdef __MVAPP__ - checkbox->addChild(GlobalServiceHobbitserver() ); - #else - checkbox->addChild(HostServiceRRD() ); - #endif - settings->addChild(checkbox) ; - } - else if (hostparm.ThisSystemType == "Master_backend" ) - { - smb_busy_box(); - checkbox->addChild(GlobalPKG_MIRROR()); - settings->addChild(new NCIDsettings); - settings->addChild(new SAMBAsettings); - #ifdef __MVAPP__ - checkbox->addChild(GlobalServiceHobbitserver() ); - #else - checkbox->addChild(HostServiceRRD() ); - #endif - settings->addChild(checkbox) ; - } - else if (hostparm.ThisSystemType == "Frontend_only" ) - { - settings->addChild(Hostbootsplash()); - settings->addChild(HostncidClient()); - #ifdef __MVAPP__ - cout << gContext->GetSetting("GlobalServiceHobbitserver") << endl; - cout << "above"<<endl; - if ( gContext->GetSetting("GlobalServiceHobbitserver") != "0" ) - settings->addChild(HostServiceHobbitclient() ); - #else - settings->addChild(HostServiceRRD() ); - #endif - - - if ( (gContext->GetSetting("GlobalPKG_MIRROR") ) == "1" ) - settings->addChild(HostPKG_MIRROR()); - } - else if (hostparm.ThisSystemType == "Slave_backend" ) - { - settings->addChild(Hostbootsplash()); - settings->addChild(HostncidClient()); - #ifdef __MVAPP__ - if ( gContext->GetSetting("GlobalServiceHobbitserver") != "0" ) - settings->addChild(HostServiceHobbitclient() ); - #else - settings->addChild(HostServiceRRD() ); - #endif - - if ( (gContext->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/3)")); - Setting* Autodown = HostAutodown(); - setTrigger(Autodown); - hostparm.ThisSystemType = gContext->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(HostLCDType()); -// settings->addChild(HostTransmitproto()); -// settings->addChild(new LIRCsettings); - settings->addChild(HostRunDHCP()); - - settings->addChild(new Evroutersettings); - } - else if (hostparm.ThisSystemType == "Master_backend" ) - { -// settings->addChild(HostLCDType()); -// settings->addChild(HostTransmitproto()); -// settings->addChild(new LIRCsettings); - settings->addChild(new Backupsettings); - settings->addChild(HostRunDHCP()); - settings->addChild(new Evroutersettings); - } - else if (hostparm.ThisSystemType == "Frontend_only" ) - { -// settings->addChild(HostLCDType()); -// settings->addChild(new LIRCsettings); - settings->addChild(new Evroutersettings); - } - else if (hostparm.ThisSystemType == "Slave_backend" ) - { -// settings->addChild(HostLCDType()); -// settings->addChild(HostTransmitproto()); -// settings->addChild(new LIRCsettings); - settings->addChild(new Evroutersettings); - }; - - addTarget("", settings); - -}; -}; - - - -/*_______________________________Sound settings ____________________*/ -SoundSettings::SoundSettings(): - TriggeredConfigurationGroup(true,true,true,true,true,true,true,true) { - setLabel(QObject::tr("Audio out 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("OSS or ALSA, your choice")); - 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 real OSS! More information can be found at:"); - - TransLabelSetting *osslabel1 = new TransLabelSetting(); - osslabel1->setValue(" http://www.opensound.com "); - - TransLabelSetting *AlsaLabel = new TransLabelSetting(); - AlsaLabel->setValue("The inferior and complicated soundsystem known as ALSA "); - -// 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() -{ - cout << "oss button pressed" << endl; - -// Add info popup right here - QString cmdtxt; - cmdtxt="sudo "; - cmdtxt.append(MV_ROOT) ; -// cmdtxt=MV_ROOT ; - cmdtxt.append("bin/soundconfig.sh -t LOAD -i OSS &"); - system(cmdtxt); - int return_code = 0; - QString msgtext = "Loading OSS driver" ; - - MythBusyDialog *busy = new MythBusyDialog(msgtext); - // yet another incorrect way todo things, but I don't know anybetter - // as long as ps can find systemconfig in the list the busy box will appear and update - busy->start(); - while ( return_code == 0 ) - { - return_code = myth_system("ps -ef|grep soundconfig.sh|grep -v grep > /dev/null"); - qApp->processEvents (); - usleep(900); - } - busy->Close(); - busy->deleteLater(); - fillossselection(); - -} -void SoundALSAsettings::loadalsadriver() -{ - cout << "Loading alsa driver" << endl; - 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" ; - - MythBusyDialog *busy = new MythBusyDialog(msgtext); - // yet another incorrect way todo things, but I don't know anybetter - // as long as ps can find systemconfig in the list the busy box will appear and update - busy->start(); - while ( return_code == 0 ) - { - return_code = myth_system("ps -ef|grep soundconfig.sh|grep -v grep > /dev/null"); - qApp->processEvents (); - usleep(900); - } - busy->Close(); - busy->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(IO_ReadOnly | IO_Translate) ) - { - QTextStream 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 temphwdevice; - QString simpleitem; - QFile file(currentfile); - if ( file.open(IO_ReadOnly | IO_Translate) ) - { - QTextStream 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 [Intel 82801DB-ICH4], device 0: Intel ICH [Intel 82801DB-ICH4] - alsadescription=line.section( "," , 0 ,0 ); - alsadescription=alsadescription.section(":",1,1); - 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=alsadescription + "(hw:" + hwdevice + ")"; - if (line.contains("IEC958") ) - 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" ; - MythBusyDialog *busy = new MythBusyDialog(msgtext); - // yet another incorrect way todo things, but I don't know anybetter - // as long as ps can find systemconfig in the list the busy box will appear and update - busy->start(); - while ( return_code == 0 ) - { - return_code = myth_system("ps -ef|grep soundconfig.sh|grep -v grep > /dev/null"); - qApp->processEvents (); - usleep(900); - } - busy->Close(); - busy->deleteLater(); -}; - -void SoundALSAsettings::soundalsagathersettings(void) -{ - - hostparm.ThisHostSoundALSATypeout = HostSoundALSATypeout->getValue() ; - hostparm.ThisHostSoundALSAAnalog = HostSoundALSAAnalog->getValue(); - hostparm.ThisHostSoundALSADigital = HostSoundALSADigital->getValue(); -// cout << hostparm.ThisHostSoundALSATypeout << endl; -// cout << hostparm.ThisHostSoundALSAAnalog << endl; -// cout << hostparm.ThisHostSoundALSADigital << endl; - - // Intel [HDA Intel](hw:0,0) - -// cout << "--------" << endl; - 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" ; - - MythBusyDialog *busy = new MythBusyDialog(msgtext); - busy->start(); - while ( return_code == 0 ) - { - return_code = myth_system("ps -ef|grep soundconfig.sh|grep -v grep > /dev/null"); - qApp->processEvents (); - usleep(900); - } - busy->Close(); - busy->deleteLater(); -}; - - -/* __________________________ END OF CLASSES_________________________*/ - -void pre_writesettings () -{ - hostparm.ThisSystemType = gContext->GetSetting("HostSystemType"); - hostparm.ThisDBhost = gContext->GetSetting("HostMysqlServer"); - hostparm.ThisHostName = gContext->GetSetting("HostMyhostname"); - - if ( hostparm.ThisSystemType == "Standalone" ) - { - hostparm.ThisDBhost = "localhost" ; - hostparm.ThisRunfrontend = "1" ; - gContext->SaveSetting("HostRunFrontend", hostparm.ThisRunfrontend ); - // disable pkgmirror - hostparm.ThisHostPKG_MIRROR = "0"; - gContext->SaveSetting("GlobalPKG_MIRROR", hostparm.ThisHostPKG_MIRROR ); - hostparm.ThisHostServiceHobbit = gContext->GetSetting("GlobalServiceHobbitserver"); - if (hostparm.ThisHostServiceHobbit == "" ) - { - hostparm.ThisHostServiceHobbit = "1"; - QString s = "GlobalServiceHobbitserver"; - gContext->SaveSettingOnHost(s, hostparm.ThisHostServiceHobbit ,NULL); - } - } - else if (hostparm.ThisSystemType == "Master_backend" ) - { - if ( hostparm.ThisNFS =="" && gContext->GetSetting("HostServiceNFS") == "" ) - { - hostparm.ThisNFS = "1"; - gContext->SaveSetting("HostServiceNFS",hostparm.ThisNFS ); - } - hostparm.ThisDBhost = "127.0.0.1" ; - //GlobalPKG is only an option for MBE - hostparm.ThisHostPKG_MIRROR = (gContext->GetSetting("GlobalPKG_MIRROR")) ; - hostparm.ThisHostServiceHobbit = gContext->GetSetting("GlobalServiceHobbitserver"); - if (hostparm.ThisHostServiceHobbit == "" ) - { - hostparm.ThisHostServiceHobbit = "1"; - QString s = "GlobalServiceHobbitserver"; - gContext->SaveSettingOnHost(s, hostparm.ThisHostServiceHobbit,NULL ); - } - } - else if (hostparm.ThisSystemType == "Frontend_only" ) - { - hostparm.ThisRunfrontend = "1" ; - hostparm.ThisSamba = "0"; - hostparm.ThisNFS = "0"; - hostparm.ThisMythWEB = "0"; - gContext->SaveSetting("HostRunFrontend", hostparm.ThisRunfrontend ); - gContext->SaveSetting("HostServiceSamba", hostparm.ThisSamba ); - gContext->SaveSetting("HostServiceNFS", hostparm.ThisNFS ); - gContext->SaveSetting("HostServiceMythWEB",hostparm.ThisMythWEB ); - // if GBL is enabled, then check for host setting, else disable it - if ( (gContext->GetSetting("GlobalPKG_MIRROR") ) == "1" ) - { - hostparm.ThisHostPKG_MIRROR = gContext->GetSetting("HostPKG_MIRROR"); - } - else - { - hostparm.ThisHostPKG_MIRROR = "0"; - }; -// cout << "install_hobbit:" <<endl; -// cout << install_hobbit << endl; -// cout <<"-----------------"<< endl; - if ( ((gContext->GetSetting("GlobalServiceHobbitserver") ) == "1") || install_hobbit ) - { - hostparm.ThisHostServiceHobbit = gContext->GetSetting("HostServiceHobbitclient"); -// cout <<"might install hobbit!" << endl; - cout << hostparm.ThisHostServiceHobbit << endl; - - } - else - { - hostparm.ThisHostServiceHobbit = "0"; - cout <<" don't install hobbit" << endl; - } - - gContext->SaveSetting("HostPKG_MIRROR", hostparm.ThisHostPKG_MIRROR ); - gContext->SaveSetting("HostServiceHobbitclient", hostparm.ThisHostServiceHobbit); - - } - else if (hostparm.ThisSystemType == "Slave_backend" ) - { - hostparm.ThisSamba = "0"; - hostparm.ThisNFS = "0"; - hostparm.ThisMythWEB = "0"; - gContext->SaveSetting("HostServiceSamba", hostparm.ThisSamba ); - gContext->SaveSetting("HostServiceNFS", hostparm.ThisNFS ); - gContext->SaveSetting("HostServiceMythWEB",hostparm.ThisMythWEB ); - if ( (gContext->GetSetting("GlobalPKG_MIRROR") ) == "1" ) - { - hostparm.ThisHostPKG_MIRROR = gContext->GetSetting("HostPKG_MIRROR"); - } - else - { - hostparm.ThisHostPKG_MIRROR = "0"; - } - if ( ((gContext->GetSetting("GlobalServiceHobbitserver") ) == "1") || install_hobbit ) - { - hostparm.ThisHostServiceHobbit = gContext->GetSetting("HostServiceHobbitclient"); - } - else - { - - hostparm.ThisHostServiceHobbit = "0"; - } - - gContext->SaveSetting("HostPKG_MIRROR", hostparm.ThisHostPKG_MIRROR ); - gContext->SaveSetting("HostServiceHobbitclient", hostparm.ThisHostServiceHobbit); - - }; - - if ( hostparm.ThisHostDefaultInterface == "" ) - { - if ( gContext->GetSetting("HostDefaulteth0") == "1" ) - hostparm.ThisHostDefaultInterface = "eth0"; - else if ( gContext->GetSetting("HostDefaulteth1") == "1" ) - hostparm.ThisHostDefaultInterface = "eth1"; - else if ( gContext->GetSetting("HostDefaultwlan0") == "1" ) - hostparm.ThisHostDefaultInterface = "wlan0"; - else if ( gContext->GetSetting("HostDefaultwlan1") == "1" ) - hostparm.ThisHostDefaultInterface = "wlan1"; - else if ( gContext->GetSetting("HostActiveonbooteth0") == "1" ) - hostparm.ThisHostDefaultInterface = "eth0"; - else if ( gContext->GetSetting("HostActiveonbooteth1") == "1" ) - hostparm.ThisHostDefaultInterface = "eth1"; - else if ( gContext->GetSetting("HostActiveonbootwlan0") == "1" ) - hostparm.ThisHostDefaultInterface = "wlan0"; - else if ( gContext->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 ); - //remove spaces from hostname - std::string s = hostparm.ThisHostName; - std::string::iterator it = std::remove_if(s.begin(), s.end(), std::bind2nd(std::equal_to<char>(), ' ')); - s = std::string(s.begin(), it); - hostparm.ThisHostName = s; - if ( hostparm.ThisHostName == "" ) - { - hostparm.ThisHostName=gContext->GetHostName(); - std::string s = hostparm.ThisHostName; - std::string::iterator it = std::remove_if(s.begin(), s.end(), std::bind2nd(std::equal_to<char>(), ' ')); - s = std::string(s.begin(), it); - hostparm.ThisHostName = s; - if ( hostparm.ThisHostName == "" ) - hostparm.ThisHostName = "You_Fool"; - } - // piece togther the timezone - QString tz; - QString tregion; - QString tsubregion; - - tz=gContext->GetSetting("HostTimeZone"); - - cout << "tz extracted from database: " << tz << endl; - if ( tz.isEmpty() || (tz == "Unknown")) - timezone_unknown = TRUE; - - tregion=gContext->GetSetting("HostTimeZoneRegion"); - tsubregion=gContext->GetSetting("HostTimeZoneRegion_"+tregion); - if ( tsubregion.isEmpty() ) - hostparm.ThisTimeZone = tregion; - else - hostparm.ThisTimeZone = tregion + "/" + tsubregion; - - cout << "hostparm.ThisTimeZone " << hostparm.ThisTimeZone << endl; - // save some settings back to the datebase - gContext->SaveSetting("HostMyhostname" , hostparm.ThisHostName ); - gContext->SaveSetting("HostMysqlserver", hostparm.ThisDBhost ); - gContext->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(gContext->GetSetting("HostMyhostname")); - msgtext.append(" is configured"); - MythBusyDialog *busy = new MythBusyDialog(msgtext); - busy->start(); - while ( return_code == 0 ) - { - return_code = myth_system("ps -ef|grep systemconfig.sh|grep -v grep > /dev/null"); - qApp->processEvents (); - usleep(900); - } - busy->Close(); - busy->deleteLater(); - if (restart) - { - return_code = 1; - int loopnumber=0 ; - bool doloop = true; - MythBusyDialog *busy = new MythBusyDialog( - QObject::tr("Transferring database settings")); - // yet another incorrect way todo things, but I don't know anybetter - // as long as ps can find systemconfig in the list the busy box will appear and update - busy->start(); - while ( doloop ) - { - return_code = myth_system(dbcommand); - qApp->processEvents (); - usleep(100); - loopnumber++ ; - if ( return_code == 0 || loopnumber >= 20000000 ) - doloop=false; - cout << loopnumber << endl; - } - busy->Close(); - busy->deleteLater(); - }; - - - -} - - - -int runsettings (bool mysqlonly , bool shownetwork , bool showhostype, bool showmisc , bool showshutdown, bool showadvanced,bool showsound,bool showadvancedX, bool showaccesscontrol, bool showplugins , bool showuser , bool showwebuser , bool showddns , bool showinfrared , bool showscreensaver ) -{ - displaymysqlonly = false ; - displayshownetwork =false ; - displayshowhostype = false ; - displayshowmisc =false ; - displayshowshutdown =false ; - displayshowadvanced = false; - displayshowsound = false ; - displayshowadvancedX = false; - displayaccesscontrol= false; - displayplugins= false; - displayuser = false; - displaywebuser = false; - displayddns = false; - displayinfrared = false; - displayscreensaver = false; - - gContext->ActivateSettingsCache(true); - gContext->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 || showuser || showwebuser || showddns || showinfrared || showscreensaver ) - { - runothers=true; - displayshowmisc = showmisc; - displayshowshutdown = showshutdown; - displayshowadvanced = showadvanced; - displayshowsound = showsound; - displayshowadvancedX = showadvancedX; - hostparm.displayshowadvancedX=showadvancedX; - displayaccesscontrol = showaccesscontrol ; - displayplugins = showplugins; - displayuser = showuser; - displaywebuser = showwebuser; - displayddns = showddns ; - displayinfrared = showinfrared; - displayscreensaver = showscreensaver; - - if (displayshowadvancedX) - { - ReadDDCvalues(); - } - }; - - - if ( runothers && continuerun ) - { - //do I need this prewerite? - pre_writesettings(); - DatabaseParams params = gContext->GetDatabaseParams(); - QString cmdtxt=MV_ROOT ; - cmdtxt.append("bin/timezip.py -m "); - QString zipcommand=cmdtxt; - zipcommand.append(hostparm.ThisDBhost); - zipcommand.append(" -d " + params.dbHostName ); - cout << zipcommand << endl; - myth_system(zipcommand); - hostparm.ThisHostZipcode = gContext->GetSetting("HostZipcode"); - hostparm.ThisTimeZone = gContext->GetSetting("HostTimeZone"); - hostparm.ThisHostServiceHobbit = gContext->GetSetting("HostServiceHobbitclient"); - if ( hostparm.ThisHostServiceHobbit == "1" ) - install_hobbit = true; -/* - cout << "install_hobbit:" <<endl; - cout << install_hobbit << endl; - cout <<"-----------------"<< endl; */ - - MythInstallSettings settings2; - settings2.load(); - settings2.save(); - gContext->SaveSetting("HostServiceHobbitclient", hostparm.ThisHostServiceHobbit ); - if ( settings2.exec() == QDialog::Accepted ) - { - retc = 1; - cout <<"i should save my settings(2)" << endl; - } - else - { - continuerun=false; - retc=2; - cout <<"no save for settings2 " << endl; - }; - }; - 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; - hostparm.ThisHostName = gContext->GetSetting("HostMyhostname"); - hostparm.ThisHostDHCPhostname = gContext->GetSetting("HostDHCPhostname"); - //hostparm.ThisTimeZone = gContext->GetSetting("HostTimeZone"); - hostparm.ThisHostIP = gContext->GetSetting("HostIP"); - hostparm.ThisNETMASK = gContext->GetSetting("HostNETMASK"); - hostparm.ThisGW = gContext->GetSetting("HostGW"); - hostparm.ThisDNS = gContext->GetSetting("HostDNS"); - hostparm.ThisDHCP = gContext->GetSetting("HostUseDHCP"); - - //hostparm.ThisHostDefaultInterface=gContext->GetSetting("HostDefaultInterface"); - - hostparm.ThisHostIPeth0 = gContext->GetSetting("HostIPeth0"); - hostparm.ThisHostNETMASKeth0 = gContext->GetSetting("HostNETMASKeth0"); - hostparm.ThisHostDNSeth0 = gContext->GetSetting("HostDNSeth0"); - hostparm.ThisHostUSEDHCPeth0 = gContext->GetSetting("HostUseDHCPeth0"); - hostparm.ThisHostGWeth0 = gContext->GetSetting("HostGWeth0"); - hostparm.ThisHostActiveonbooteth0 = gContext->GetSetting("HostActiveonbooteth0"); - hostparm.ThisHOSTESSIDeth0 = gContext->GetSetting("HOSTESSIDeth0"); - hostparm.ThisHostUseEncryptioneth0 = gContext->GetSetting("HostUseEncryptioneth0"); - hostparm.ThisHostkeyeth0 = gContext->GetSetting("Hostkeyeth0"); - hostparm.ThisHostMTUeth0 = gContext->GetSetting("HostMTUeth0"); - - hostparm.ThisHostIPeth1 = gContext->GetSetting("HostIPeth1"); - hostparm.ThisHostNETMASKeth1 = gContext->GetSetting("HostNETMASKeth1"); - hostparm.ThisHostDNSeth1 = gContext->GetSetting("HostDNSeth1"); - hostparm.ThisHostUSEDHCPeth1 = gContext->GetSetting("HostUseDHCPeth1"); - hostparm.ThisHostGWeth1 = gContext->GetSetting("HostGWeth1"); - hostparm.ThisHostActiveonbooteth1 = gContext->GetSetting("HostActiveonbooteth1"); - hostparm.ThisHOSTESSIDeth1 = gContext->GetSetting("HOSTESSIDeth1"); - hostparm.ThisHostUseEncryptioneth1 = gContext->GetSetting("HostUseEncryptioneth1"); - hostparm.ThisHostkeyeth1 = gContext->GetSetting("Hostkeyeth1"); - hostparm.ThisHostMTUeth1 = gContext->GetSetting("HostMTUeth1"); - - hostparm.ThisHostIPwlan0 = gContext->GetSetting("HostIPwlan0"); - hostparm.ThisHostNETMASKwlan0 = gContext->GetSetting("HostNETMASKwlan0"); - hostparm.ThisHostDNSwlan0 = gContext->GetSetting("HostDNSwlan0"); - hostparm.ThisHostUSEDHCPwlan0 = gContext->GetSetting("HostUseDHCPwlan0"); - hostparm.ThisHostGWwlan0 = gContext->GetSetting("HostGWwlan0"); - hostparm.ThisHostActiveonbootwlan0 = gContext->GetSetting("HostActiveonbootwlan0"); - hostparm.ThisHOSTESSIDwlan0 = gContext->GetSetting("HOSTESSIDwlan0"); - hostparm.ThisHostUseEncryptionwlan0 = gContext->GetSetting("HostUseEncryptionwlan0"); - hostparm.ThisHostkeywlan0 = gContext->GetSetting("Hostkeywlan0"); - hostparm.ThisHostMTUwlan0 = gContext->GetSetting("HostMTUwlan0"); - - hostparm.ThisHostIPwlan1 = gContext->GetSetting("HostIPwlan1"); - hostparm.ThisHostNETMASKwlan1 = gContext->GetSetting("HostNETMASKwlan1"); - hostparm.ThisHostDNSwlan1 = gContext->GetSetting("HostDNSwlan1"); - hostparm.ThisHostUSEDHCPwlan1 = gContext->GetSetting("HostUseDHCPwlan1"); - hostparm.ThisHostGWwlan1 = gContext->GetSetting("HostGWwlan1"); - hostparm.ThisHostActiveonbootwlan1 = gContext->GetSetting("HostActiveonbootwlan1"); - hostparm.ThisHOSTESSIDwlan1 = gContext->GetSetting("HOSTESSIDwlan1"); - hostparm.ThisHostUseEncryptionwlan1 = gContext->GetSetting("HostUseEncryptionwlan1"); - hostparm.ThisHostkeywlan1 = gContext->GetSetting("Hostkeywlan1"); - hostparm.ThisHostMTUwlan1 = gContext->GetSetting("HostMTUwlan1"); - - hostparm.ThisHostIPath0 = gContext->GetSetting("HostIPath0"); - hostparm.ThisHostNETMASKath0 = gContext->GetSetting("HostNETMASKath0"); - hostparm.ThisHostDNSath0 = gContext->GetSetting("HostDNSath0"); - hostparm.ThisHostUSEDHCPath0 = gContext->GetSetting("HostUseDHCPath0"); - hostparm.ThisHostGWath0 = gContext->GetSetting("HostGWath0"); - hostparm.ThisHostActiveonbootath0 = gContext->GetSetting("HostActiveonbootath0"); - hostparm.ThisHOSTESSIDath0 = gContext->GetSetting("HOSTESSIDath0"); - hostparm.ThisHostUseEncryptionath0 = gContext->GetSetting("HostUseEncryptionath0"); - hostparm.ThisHostkeyath0 = gContext->GetSetting("Hostkeyath0"); - hostparm.ThisHostMTUath0 = gContext->GetSetting("HostMTUath0"); - - - hostparm.ThisHostServiceRRD = gContext->GetSetting("HostServiceRRD"); - hostparm.ThisSamba = gContext->GetSetting("HostServiceSamba"); - hostparm.ThisHostServiceSamba_media = gContext->GetSetting("HostServiceSamba_media"); - hostparm.ThisHostServiceSamba_write = gContext->GetSetting("HostServiceSamba_write"); - hostparm.ThisHostServiceSamba_home = gContext->GetSetting("HostServiceSamba_home"); - hostparm.ThisHostServiceSamba_writehome = gContext->GetSetting("HostServiceSamba_writehome"); - hostparm.ThisHostServiceSamba_domain = gContext->GetSetting("HostServiceSamba_domain"); - hostparm.ThisNFS = gContext->GetSetting("HostServiceNFS"); - hostparm.ThisMythWEB = gContext->GetSetting("HostServiceMythWEB"); - hostparm.ThisHostwebauth = gContext->GetSetting("HOSTwebauth"); - - hostparm.ThisHostRunDHCP = gContext->GetSetting("HostRunDHCP"); - hostparm.ThisSystemType = gContext->GetSetting("HostSystemType"); - hostparm.ThisRemote = gContext->GetSetting("HostRemoteType"); - hostparm.ThisHostLircWait = gContext->GetSetting("HostLircWait"); - // hostparm.ThisBlaster = gContext->GetSetting("HostTransmitproto"); - hostparm.ThisReceiverType = gContext->GetSetting("HostReceiverType"); - hostparm.ThisHostSerialPortlirc = gContext->GetSetting("HostSerialPortlirc"); - hostparm.ThisHostUseEvrouter = gContext->GetSetting("HostRunEvrouter"); - hostparm.ThisHostEvrouterConfig = gContext->GetSetting("HostEvrouterConfig"); - hostparm.ThisXres = gContext->GetSetting("HostXres"); - hostparm.ThisAutodown = gContext->GetSetting("HostAutodown"); - hostparm.ThisShutdowntime = gContext->GetSetting("HostShutdownTime"); - hostparm.ThisShutdowntime2 = gContext->GetSetting("HostShutdownTime2"); - hostparm.ThisWakeuptime = gContext->GetSetting("HostWakeupTime"); - hostparm.ThisUseNVRAM = gContext->GetSetting("HostUseNVRAM"); - hostparm.ThisUseWOL = gContext->GetSetting("HostUseWOL"); - hostparm.ThisKeepPackage = gContext->GetSetting("HostKeepPackages"); - hostparm.ThisMythWelcome = gContext->GetSetting("HostUseMythWelcome"); - hostparm.ThisHaveNFS = gContext->GetSetting("HostHaveCentralNFS"); - hostparm.ThisNFSserver = gContext->GetSetting("HostCentralNFSIP"); - hostparm.ThisNFSmountpoint = gContext->GetSetting("HostNFSmountpoint"); - hostparm.ThisHostupdateplan = gContext->GetSetting("Hostupdateplan"); - hostparm.ThisShowToolTips = gContext->GetSetting("HostShowToolTips"); - hostparm.ThisRunfrontend = gContext->GetSetting("HostRunFrontend"); - hostparm.ThisHostZipcode = gContext->GetSetting("HostZipcode"); - hostparm.ThisHostncidClient = gContext->GetSetting("HostncidClient"); - hostparm.ThisHostncidDaemon = gContext->GetSetting("HostncidDaemon"); - hostparm.ThisHostSerialPortncid = gContext->GetSetting("HostSerialPortncid"); - hostparm.ThisHostbootsplash = gContext->GetSetting("Hostbootsplash"); - - hostparm.ThisXIgnoreConfig =gContext->GetSetting("HostXIgnoreConfig"); - hostparm.ThisXcardtype =gContext->GetSetting("HostXcardtype"); - hostparm.ThisXUseAdvanced =gContext->GetSetting("HostXUseAdvanced"); - hostparm.ThisXIgnoreEDID =gContext->GetSetting("HostXIgnoreEDID"); - hostparm.ThisXconnection =gContext->GetSetting("HostXconnection"); - hostparm.ThisXDisplaysize =gContext -> GetSetting("HostXDisplaysize"); - hostparm.ThisHostXNvidia1080p =gContext -> GetSetting("HostXNvidia1080p"); - hostparm.ThisHostXNvidia1080i =gContext -> GetSetting("HostXNvidia1080i"); - hostparm.ThisHostXNvidia720p =gContext -> GetSetting("HostXNvidia720p"); - hostparm.ThisHostXNvidia480p =gContext -> GetSetting("HostXNvidia480p"); -// EDID settings - QString tempstring; - tempstring = gContext->GetSetting("HostXHsyncLow"); - tempstring.append(" - "); - tempstring.append(gContext->GetSetting("HostXHsyncHigh") ); - hostparm.ThisXHsync=tempstring; - tempstring =""; - tempstring=gContext->GetSetting("HostXVrefreshLow"); - tempstring.append(" - "); - tempstring.append(gContext->GetSetting("HostXVrefreshHigh")); - hostparm.ThisXVrefresh=tempstring; - -// Assemble the advanced modeline string - QString modelinetype = gContext->GetSetting("HostXModelineCatagory");; - QString tempmodeline = "HostXadvancedres" + modelinetype ; - QString modeline = gContext ->GetSetting(tempmodeline); - hostparm.ThisXresadvanced = modelinetype +"_"+modeline; - -// Gather settings based on card type - if ( hostparm.ThisXcardtype == "nVidia" ) - { - hostparm.ThisXTVstandard = gContext->GetSetting("HostXnVidiaTVstandard"); - hostparm.ThisXTVconnection= gContext->GetSetting("HostXnVidiaTVformat"); - modelinetype = gContext->GetSetting("HostXNvidiaModelineCatagory");; - tempmodeline = "HostXNvidiaadvancedres" + modelinetype ; - modeline = gContext ->GetSetting(tempmodeline); - hostparm.ThisXresadvanced = modelinetype +"_"+modeline; - } - else if ( hostparm.ThisXcardtype == "ATI" ) - { - hostparm.ThisXTVstandard = gContext->GetSetting("HostXATITVstandard"); - hostparm.ThisXTVconnection= gContext->GetSetting("HostXati-tvformat"); - } - - -//********************************************************************************************* -// AUDIO SETTINGS -//****************************************************************************************** - hostparm.ThisHostAudiotype = gContext ->GetSetting("HostAudiotype"); - hostparm.ThisHostsyncXine = gContext ->GetSetting("HostsyncXine"); - hostparm.ThisHostsyncMplayer = gContext ->GetSetting("HostsyncMplayer"); - hostparm.ThisHostsyncMythMusic = gContext ->GetSetting("HostsyncMythMusic"); - hostparm.ThisHostsyncMythFrontend = gContext ->GetSetting("HostsyncMythFrontend"); - hostparm.ThisHostSoundTypeout = gContext ->GetSetting("HostSoundTypeout") ; - hostparm.ThisHostSoundOSSAnalog = gContext ->GetSetting("HostSoundOssAnalog"); - hostparm.ThisHostSoundOSSDigital = gContext ->GetSetting("HostSoundOssDigital"); - hostparm.ThisHostSoundALSATypeout = gContext ->GetSetting("HostSoundALSATypeout") ; - hostparm.ThisHostSoundALSAAnalog = gContext ->GetSetting("HostSoundALSAAnalog"); - hostparm.ThisHostSoundALSADigital = gContext ->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" ) - gContext->SaveSetting("MythControlsVolume","0"); - -// LCD TYPE - hostparm.ThisHostLCDType = gContext ->GetSetting("HostLCDType"); - if ( hostparm.ThisHostLCDType != "no_lcd" && hostparm.ThisHostLCDType != "tinker" && hostparm.ThisHostLCDType != "" ) - { - // enable mythtv lcddevice - gContext->SaveSetting("LCDEnable","1"); - }; -// Backupsettings - hostparm.ThisHostRemoteBackup = gContext ->GetSetting("HostRemoteBackup"); - hostparm.ThisHostRemoteBackupDir = gContext ->GetSetting("HostRemoteBackupDir"); -//plugins - hostparm.ThisHostpluginmytharchive = gContext->GetSetting("Hostpluginmytharchive"); - hostparm.ThisHostpluginmythbrowser = gContext->GetSetting("Hostpluginmythbrowser"); - hostparm.ThisHostpluginmythcontrols = gContext->GetSetting("Hostpluginmythcontrols"); - hostparm.ThisHostpluginmythflix = gContext->GetSetting("Hostpluginmythflix"); - hostparm.ThisHostpluginmythgallery = gContext->GetSetting("Hostpluginmythgallery"); - hostparm.ThisHostpluginmythgame = gContext->GetSetting("Hostpluginmythgame"); - hostparm.ThisHostpluginmythmovietime = gContext->GetSetting("Hostpluginmythmovietime"); - hostparm.ThisHostpluginmythmusic = gContext->GetSetting("Hostpluginmythmusic"); - hostparm.ThisHostpluginmythnews = gContext->GetSetting("Hostpluginmythnews"); - hostparm.ThisHostpluginmythphone = gContext->GetSetting("Hostpluginmythphone"); - hostparm.ThisHostpluginmythsmolt = gContext->GetSetting("Hostpluginmythsmolt"); - hostparm.ThisHostpluginmythvideo = gContext->GetSetting("Hostpluginmythvideo"); - hostparm.ThisHostpluginmythweather = gContext->GetSetting("Hostpluginmythweather"); - hostparm.ThisHostpluginmythzoneminder = gContext->GetSetting("Hostpluginmythzoneminder"); - hostparm.ThisHostpluginmythgameFceu = gContext->GetSetting("HostpluginmythgameFceu"); - hostparm.ThisHostpluginmythgameZsnes = gContext->GetSetting("HostpluginmythgameZsnes"); - hostparm.ThisHostpluginmythgameMame = gContext->GetSetting("HostpluginmythgameMame"); - hostparm.ThisHostpluginmythvideo_dvdcss = gContext->GetSetting("Hostpluginmythvideo_dvdcss"); - hostparm.ThisHostpluginmythappletrailers= gContext->GetSetting("Hostpluginmythappletrailers"); - hostparm.ThisHostpluginmythstream= gContext->GetSetting("Hostpluginmythstream"); - hostparm.ThisHostpluginmythvodka= gContext->GetSetting("Hostpluginmythvodka"); - hostparm.ThisHostMiro= gContext->GetSetting("HostMiro"); - hostparm.ThisHostpluginmythgameMednafen= gContext->GetSetting("HostpluginmythgameMednafen"); - hostparm.ThisHostpluginmythgameROMDB= gContext->GetSetting("HostpluginmythgameROMDB"); - hostparm.ThisHostXine = gContext->GetSetting("HostXine"); - hostparm.ThisHostwebmin = gContext->GetSetting("Hostwebmin"); - hostparm.ThisHostfuppes = gContext->GetSetting("Hostfuppes"); - hostparm.ThisHostfoldingathome = gContext->GetSetting("Hostfoldingathome"); - hostparm.ThisHostfoldingusername = gContext->GetSetting("Hostfoldingusername"); - hostparm.ThisHostfoldingworksize = gContext->GetSetting("Hostfoldingworksize"); - hostparm.ThisHostDDnslogin = gContext->GetSetting("HostDDnslogin"); - hostparm.ThisHostDDnspassword = gContext->GetSetting("HostDDnspassword"); - hostparm.ThisHostDDnshostname = gContext->GetSetting("HostDDnshostname"); - hostparm.ThisHostDDnsEnable = gContext->GetSetting("HostDDnsEnable"); - hostparm.ThisHostscreensavertype = gContext->GetSetting("Hostscreensavertype"); - hostparm.ThisHostscreensaveridle = gContext->GetSetting("Hostscreensaveridle"); - if (gContext->GetSetting("HostScreensaverBlank") == "1" ) - hostparm.ThisHostscreensavertheme="Blank"; - else if (gContext->GetSetting("HostScreensaverRandom") == "1" ) - hostparm.ThisHostscreensavertheme="Random"; - else - { - if ( hostparm.ThisHostscreensavertype == "gscreensaver" ) - hostparm.ThisHostscreensavertheme = gContext->GetSetting("HostGScreensavertheme"); - if ( hostparm.ThisHostscreensavertype == "xscreensaver" ) - hostparm.ThisHostscreensavertheme = gContext->GetSetting("HostXScreensavertheme"); - } - - hostparm.ThisHostTransmitproto_1 = - gContext->GetSetting("HostTransmitproto_1"); - hostparm.ThisHostTransmitproto_2 = - gContext->GetSetting("HostTransmitproto_2"); - hostparm.ThisHostTransmitproto_3 = - gContext->GetSetting("HostTransmitproto_3"); - hostparm.ThisHostTransmitproto_4 = - gContext->GetSetting("HostTransmitproto_4"); - hostparm.ThisHostBlasterType = - gContext->GetSetting("HostBlasterType"); - hostparm.ThisHostSerialPort_blasterlirc = - gContext->GetSetting("HostSerialPort_blasterlirc"); - hostparm.ThisHostnumblaster = "1"; - if ( hostparm.ThisHostBlasterType == "CommandIR" ) - hostparm.ThisHostnumblaster = "4" ; - if ( hostparm.ThisHostBlasterType == "MCE" ) - hostparm.ThisHostnumblaster = "2" ; - hostparm.ThisHOSTrootSSH = gContext->GetSetting("HOSTrootSSH"); - - - - - -//______________________WRITE OUT THE FILE__________________________ - QString systemheader; - - myfile.open ("/etc/systemconfig"); - myfile << "hostname=\"" + hostparm.ThisHostName + "\"\n"; - myfile << "dhcphostname=\"" + hostparm.ThisHostDHCPhostname + "\"\n"; - myfile << "timezone=\"" + hostparm.ThisTimeZone + "\"\n"; - myfile << "ip=\"" + hostparm.ThisHostIP + "\"\n"; - myfile << "netmask=\"" + hostparm.ThisNETMASK + "\"\n"; - myfile << "route=\"" + hostparm.ThisGW + "\"\n"; - myfile << "nameserver=\"" + hostparm.ThisDNS + "\"\n"; - - myfile << "default_interface=\"" + hostparm.ThisHostDefaultInterface + "\"\n"; - - if ( hostparm.ThisHostActiveonbooteth0 == "1" ) - { - systemheader= "\n#Network config for eth0 \n" ; - myfile << systemheader ; - 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 << "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 << "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 << "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 << "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 << "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 << "UseHobbit=\"" + hostparm.ThisHostServiceHobbit + "\"\n"; - myfile << "UseRRD=\"" + hostparm.ThisHostServiceRRD + "\"\n"; - myfile << "UseNFS=\"" + hostparm.ThisNFS + "\"\n"; - myfile << "UseMythWEB=\"" + hostparm.ThisMythWEB + "\"\n"; - myfile << "UseMythWEB_auth=\"" + hostparm.ThisHostwebauth + "\"\n"; - myfile << "UseDHCP=\"" + hostparm.ThisDHCP + "\"\n"; - myfile << "RunDHCP=\"" + hostparm.ThisHostRunDHCP + "\"\n"; - myfile << "SystemType=\"" + hostparm.ThisSystemType + "\"\n"; - - myfile << "UseEvrouter=\"" + hostparm.ThisHostUseEvrouter + "\"\n"; - myfile << "EvrouterConfig=\"" + hostparm.ThisHostEvrouterConfig + "\"\n"; - myfile << "dbhost=\"" + hostparm.ThisDBhost + "\"\n"; - myfile << "Xres=\"" + hostparm.ThisXres + "\"\n"; - 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"; - myfile << "KeepPackages=\"" + hostparm.ThisKeepPackage + "\"\n"; - myfile << "UseMythWelcome=\"" + hostparm.ThisMythWelcome + "\"\n"; - myfile << "HaveCentralNFS=\"" + hostparm.ThisHaveNFS + "\"\n"; - myfile << "NFSserver=\"" + hostparm.ThisNFSserver + "\"\n"; - myfile << "NFSmount=\"" + hostparm.ThisNFSmountpoint + "\"\n"; - myfile << "Hostupdateplan=\"" + hostparm.ThisHostupdateplan + "\"\n"; - myfile << "ShowTips=\"" + hostparm.ThisShowToolTips + "\"\n"; - myfile << "PKG_MIRROR=\"" + hostparm.ThisHostPKG_MIRROR + "\"\n"; - myfile << "RunFrontend=\"" + hostparm.ThisRunfrontend + "\"\n"; - myfile << "zipcode=\"" + hostparm.ThisHostZipcode + "\"\n"; - myfile << "ncidclient=\"" + hostparm.ThisHostncidClient + "\"\n"; - myfile << "Runncidd=\"" + hostparm.ThisHostncidDaemon + "\"\n"; - myfile << "nciddSerialPort=\"" + hostparm.ThisHostSerialPortncid + "\"\n"; - myfile << "Usebootsplash=\"" + hostparm.ThisHostbootsplash + "\"\n"; - myfile << "LCDtype=\"" + hostparm.ThisHostLCDType + "\"\n"; - myfile << "RemoteBackup=\"" + hostparm.ThisHostRemoteBackup + "\"\n"; - myfile << "RemoteBackupDir=\"" + hostparm.ThisHostRemoteBackupDir + "\"\n"; - - - systemheader= "\n#X display settings \n" ; - myfile << systemheader ; - myfile << "XIgnoreConfig=\"" + hostparm.ThisXIgnoreConfig + "\"\n"; - myfile << "Xcardtype=\"" + hostparm.ThisXcardtype + "\"\n"; - myfile << "XUseAdvanced=\"" + hostparm.ThisXUseAdvanced + "\"\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 << "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 << "mytharchive=\"" + hostparm.ThisHostpluginmytharchive + "\"\n"; - myfile << "mythbrowser=\"" + hostparm.ThisHostpluginmythbrowser + "\"\n"; - myfile << "mythcontrols=\"" + hostparm.ThisHostpluginmythcontrols + "\"\n"; - myfile << "mythflix=\"" + hostparm.ThisHostpluginmythflix + "\"\n"; - myfile << "mythgallery=\"" + hostparm.ThisHostpluginmythgallery + "\"\n"; - myfile << "mythgame=\"" + hostparm.ThisHostpluginmythgame + "\"\n"; - myfile << "mythmovietime=\"" + hostparm.ThisHostpluginmythmovietime + "\"\n"; - myfile << "mythmusic=\"" + hostparm.ThisHostpluginmythmusic + "\"\n"; - myfile << "mythnews=\"" + hostparm.ThisHostpluginmythnews + "\"\n"; - myfile << "mythphone=\"" + hostparm.ThisHostpluginmythphone + "\"\n"; - myfile << "mythsmolt=\"" + hostparm.ThisHostpluginmythsmolt + "\"\n"; - myfile << "mythvideo=\"" + hostparm.ThisHostpluginmythvideo + "\"\n"; - myfile << "mythweather=\"" + hostparm.ThisHostpluginmythweather + "\"\n"; - myfile << "mythzoneminder=\"" + hostparm.ThisHostpluginmythzoneminder + "\"\n"; - - myfile << "fceu=\"" + hostparm.ThisHostpluginmythgameFceu + "\"\n"; - myfile << "zsnes=\"" + hostparm.ThisHostpluginmythgameZsnes + "\"\n"; - myfile << "mame=\"" + hostparm.ThisHostpluginmythgameMame + "\"\n"; - myfile << "dvdcss=\"" + hostparm.ThisHostpluginmythvideo_dvdcss + "\"\n"; - - myfile << "mythappletrailers=\"" + hostparm.ThisHostpluginmythappletrailers + "\"\n"; - myfile << "mythstream=\"" + hostparm.ThisHostpluginmythstream + "\"\n"; - myfile << "mythvodka=\"" +hostparm.ThisHostpluginmythvodka + "\"\n"; - myfile << "miro=\"" + hostparm.ThisHostMiro + "\"\n"; - myfile << "mednafen=\"" + hostparm.ThisHostpluginmythgameMednafen + "\"\n"; - myfile << "romdb=\"" + hostparm.ThisHostpluginmythgameROMDB + "\"\n"; - myfile << "xine=\"" + hostparm.ThisHostXine + "\"\n"; - myfile << "webmin=\"" + hostparm.ThisHostwebmin + "\"\n"; - myfile << "fuppes=\"" + hostparm.ThisHostfuppes + "\"\n"; - myfile << "foldingathome=\"" + hostparm.ThisHostfoldingathome + "\"\n"; - myfile << "foldingusername=\"" + hostparm.ThisHostfoldingusername + "\"\n"; - myfile << "foldingworksize=\"" + hostparm.ThisHostfoldingworksize + "\"\n"; - - - - myfile << "DDnslogin=\"" + hostparm.ThisHostDDnslogin + "\"\n"; - myfile << "DDnspassword=\"" + hostparm.ThisHostDDnspassword + "\"\n"; - myfile << "DDnshostname=\"" + hostparm.ThisHostDDnshostname + "\"\n"; - myfile << "DDnsEnable=\"" + hostparm.ThisHostDDnsEnable + "\"\n"; - myfile << "Screensavertype=\"" + hostparm.ThisHostscreensavertype + "\"\n"; - myfile << "Screensaveridle=\"" + hostparm.ThisHostscreensaveridle + "\"\n"; - myfile << "Screensavertheme=\"" + hostparm.ThisHostscreensavertheme + "\"\n"; - - systemheader="\n#IR settings\n" ; - myfile << systemheader ; - myfile << "Remotetype=\"" + hostparm.ThisRemote + "\"\n"; - //myfile << "Blastertype=\"" + hostparm.ThisBlaster + "\"\n"; - myfile << "ReceiverType=\"" + hostparm.ThisReceiverType + "\"\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 << "HostBlasterType=\"" + hostparm.ThisHostBlasterType + "\"\n"; - myfile << "HostSerialPort_blasterlirc=\"" + hostparm.ThisHostSerialPort_blasterlirc + "\"\n"; - myfile << "Hostnumblaster=\"" + hostparm.ThisHostnumblaster + "\"\n"; - myfile << "rootSSH=\"" + hostparm.ThisHOSTrootSSH + "\"\n"; - - myfile.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(" You do not have access to this screen " ); denied->addChild(deniedlabel); - if ( displaymysqlonly ) - { - vcg->addChild(HostMysqlserverip_listbox()); - vcg->addChild(ThemePainter()); - addChild(vcg); - } - else - { - 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 ( ((gContext->GetSetting("Hostaccessnetwork")) == "0" ) ) - { - denied ->setLabel(QObject::tr("Host Settings")); - addChild(denied); - } - else - { - - hostparm.ThisHostnetOLD = gContext ->GetSetting("HostNetDevice"); - QString s = "HostActiveonboot"; - s+=hostparm.ThisHostnetOLD; - hostparm.ThisHostnetActiveOLD = gContext ->GetSetting(s); - MSqlQuery query(MSqlQuery::InitCon()); - query.prepare( "delete from settings where hostname=:HOSTNAME and value = 'HOSTNetDevice'; " ); - query.bindValue( ":HOSTNAME" , gContext->GetHostName() ); - query.exec(); - - - VerticalConfigurationGroup* networksettings = new VerticalConfigurationGroup(false,true ,false,false); - networksettings->addChild(HostMyhostname()); - networksettings->addChild(HostDHCPHostname()); - networksettings ->setLabel(QObject::tr("Network Settings Page (1/2)")); - - NetworkSettingsFrame *netsettingsframe = new NetworkSettingsFrame(); - addChild(networksettings); - addChild(netsettingsframe); - - }; - } - - if ( displayshowhostype ) - { - if ( ((gContext->GetSetting("Hostaccesshostype")) =="0" )) - { - denied ->setLabel(QObject::tr("System type")); - addChild(denied); - } - else - { - SystemtypeGroup *systemtypegroup = new SystemtypeGroup(); - vcg->addChild(systemtypegroup); - addChild(vcg); - } - } - - if ( displayshowmisc ) - { - if ( ((gContext->GetSetting("Hostaccessmisc")) == "0" )) - { - denied ->setLabel(QObject::tr("NFS Settings")); - addChild(denied); - } - else - { - MiscMainFrame *miscsettings = new MiscMainFrame(); - MiscMainFrame2 *miscsettings2 = new MiscMainFrame2(); - addChild(miscsettings); - addChild(miscsettings2); - } - } - if ( displayshowshutdown ) - { - if ( ((gContext->GetSetting("Hostaccesssleep")) == "0" )) - { - denied ->setLabel(QObject::tr("WOL settings")); - addChild(denied); - } - else - { - WakeSettings *wakesettings = new WakeSettings(); - addChild(wakesettings); - } - } - if ( displayshowadvanced ) - { - if ( ((gContext->GetSetting("Hostaccessadvanced")) == "0" ) ) - { - denied ->setLabel(QObject::tr("Advaned Settings")); - addChild(denied); - } - else - { - AdvancedSettings *advancedsettings = new AdvancedSettings(); - AdvancedSettings_2 *advancedsettings_2 = new AdvancedSettings_2(); - - // Screensaverhostsettings *advancedsettings_3 = new Screensaverhostsettings(); -// advancedsettings_3 ->setLabel(QObject::tr("Advanced settings page 3")); - - - addChild(advancedsettings); - addChild(advancedsettings_2); - // addChild(advancedsettings_3); - } - } - if ( displayshowsound ) - { - if ( ((gContext->GetSetting("Hostaccesssound")) =="0") ) - { - denied ->setLabel(QObject::tr("Sound 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 = gContext ->GetSetting("HostSoundOssAnalog"); - hostparm.OLDHostSoundOSSDigital = gContext ->GetSetting("HostSoundOssDigital"); - hostparm.OLDHostSoundALSAAnalog = gContext ->GetSetting("HostSoundALSAAnalog"); - hostparm.OLDHostSoundALSADigital= gContext ->GetSetting("HostSoundALSADigital"); - - - MSqlQuery query(MSqlQuery::InitCon()); - query.prepare( "delete from settings where hostname=:HOSTNAME and value = 'HOSTSoundOssAnalog'; " ); - query.bindValue( ":HOSTNAME" , gContext->GetHostName() ); - query.exec(); - query.prepare( "delete from settings where hostname=:HOSTNAME and value = 'HOSTSoundALSAAnalog'; " ); - query.bindValue( ":HOSTNAME" , gContext->GetHostName() ); - query.exec(); - query.prepare( "delete from settings where hostname=:HOSTNAME and value = 'HOSTSoundALSADigital'; " ); - query.bindValue( ":HOSTNAME" , gContext->GetHostName() ); - query.exec(); - query.prepare( "delete from settings where hostname=:HOSTNAME and value = 'HOSTSoundOssDigital'; " ); - query.bindValue( ":HOSTNAME" , gContext->GetHostName() ); - query.exec(); - - - SoundSettings *soundsettings = new SoundSettings(); - addChild(soundsettings); - } - } - if ( displayshowadvancedX ) - { - if ( ((gContext->GetSetting("HostaccessadvancedX")) == "0" )) - { - denied ->setLabel(QObject::tr("AdvancedX Settings")); - addChild(denied); - } - else - { - AdvancedXSettings *advancedXsettings = new AdvancedXSettings(); - addChild(advancedXsettings); - } - } - if ( displayaccesscontrol ) - { - VerticalConfigurationGroup* accessettings = - new VerticalConfigurationGroup(false, true,false,false);; - ConfigurationGroup *GridAccess = - new GridConfigurationGroup(2,false,false,false,false); - - GridAccess->addChild(Hostaccessmisc()); - GridAccess->addChild(Hostaccesssleep()); - GridAccess->addChild(Hostaccessadvanced()); - GridAccess->addChild(HostaccessadvancedX()); - GridAccess->addChild(Hostaccesssound()); - GridAccess->addChild(Hostaccessplugins()); -// GridAccess->addChild(Hostaccessuser()); - GridAccess->addChild(Hostaccesswebuser()); - - accessettings->addChild(Hostaccessnetwork()); - accessettings->addChild(new ACCESShostsettings); - accessettings->addChild(GridAccess); - accessettings ->setLabel(QObject::tr("Access control")); - addChild(accessettings); - } - - if ( displayplugins ) - { - if ( ((gContext->GetSetting("Hostaccessplugins")) == "0" )) - { - denied ->setLabel(QObject::tr("Plugins")); - addChild(denied); - } - else - { - ConfigurationGroup *GridShowPlugin = new GridConfigurationGroup(2); - GridShowPlugin->addChild(Hostpluginmytharchive()); - GridShowPlugin->addChild(Hostpluginmythbrowser()); - GridShowPlugin->addChild(Hostpluginmythcontrols()); - GridShowPlugin->addChild(Hostpluginmythflix()); - GridShowPlugin->addChild(Hostpluginmythgallery()); - GridShowPlugin->addChild(Hostpluginmythmovietime()); - - ConfigurationGroup *GridShowPlugin2 = new GridConfigurationGroup(2); - GridShowPlugin2->addChild(Hostpluginmythmusic()); - GridShowPlugin2->addChild(Hostpluginmythnews()); - GridShowPlugin2->addChild(Hostpluginmythphone()); - GridShowPlugin2->addChild(Hostpluginmythsmolt()); - GridShowPlugin2->addChild(Hostpluginmythweather()); - GridShowPlugin2->addChild(Hostpluginmythzoneminder()); - - ConfigurationGroup *GridShowPlugin4 = new GridConfigurationGroup(2); - GridShowPlugin4->addChild(Hostpluginmythappletrailers()); - GridShowPlugin4->addChild(Hostpluginmythstream()); - GridShowPlugin4->addChild(Hostpluginmythvodka()); - GridShowPlugin4->addChild(HostMiro()); - GridShowPlugin4->addChild(HostXine()); - GridShowPlugin4->addChild(Hostwebmin()); - - ConfigurationGroup *GridShowPlugin5 = new GridConfigurationGroup(2); - GridShowPlugin5->addChild(Hostfuppes()); - - ConfigurationGroup *GridShowPlugin6 = new VerticalConfigurationGroup(true,true); - GridShowPlugin6->addChild(Hostfoldingathome()); - GridShowPlugin6->addChild(Hostfoldingusername()); - GridShowPlugin6->addChild(Hostfoldingworksize()); - - ConfigurationGroup *Mythvideoplugin = new HorizontalConfigurationGroup(); - Mythvideoplugin->addChild(Hostpluginmythvideo()); - Mythvideoplugin->addChild(Hostpluginmythvideo_dvdcss()); - - - ConfigurationGroup *GridShowPlugin3 = new VerticalConfigurationGroup(true,true); - GridShowPlugin3->addChild(new MythGamesettings); - GridShowPlugin3->addChild(Mythvideoplugin); - - - - addChild(GridShowPlugin); - addChild(GridShowPlugin2); - addChild(GridShowPlugin3); - addChild(GridShowPlugin4); - addChild(GridShowPlugin5); - addChild(GridShowPlugin6); - } - } - if ( displayuser ) - { - if ( ((gContext->GetSetting("Hostaccessuser")) == "0" )) - { - denied ->setLabel(QObject::tr("User Management")); - addChild(denied); - } - else - { - UserManagement *usermanagement = new UserManagement(); - addChild(usermanagement); - } - } - - if ( displaywebuser ) - { - if ( ((gContext->GetSetting("Hostaccesswebuser")) == "0" )) - { - denied ->setLabel(QObject::tr("Web security")); - addChild(denied); - } - else - { - WebPasswordFrame *webpasswordframe = new WebPasswordFrame(); - addChild(webpasswordframe); - - } - - } - if ( displayddns ) - { - if ( ((gContext->GetSetting("Hostaccessddns")) == "0" )) - { - denied ->setLabel(QObject::tr("DDNS security")); - addChild(denied); - } - else - { - DDnssettings *ddnsframe = new DDnssettings(); - addChild(ddnsframe); - } - } - if ( displayinfrared ) - { -// if ( ((gContext->GetSetting("Hostaccessddns")) == "0" )) -// { -// denied ->setLabel(QObject::tr("DDNS security")); -// addChild(denied); -// } -// else -// { - VERBOSE(VB_IMPORTANT, "LIRC"); - IRFrame *irframe = new IRFrame(); - IR_TransmitFrame *transmitframe = new IR_TransmitFrame(); - LCDFrame *lcdframe = new LCDFrame(); - addChild(irframe); - addChild(transmitframe); - addChild(lcdframe); - //} - } - if ( displayscreensaver ) - { -// if ( ((gContext->GetSetting("Hostaccessddns")) == "0" )) -// { -// denied ->setLabel(QObject::tr("DDNS security")); -// addChild(denied); -// } -// else -// { - VERBOSE(VB_IMPORTANT, "screensaver"); - Screensaverhostsettings *screensaver = new Screensaverhostsettings(); - addChild(screensaver); - //} - } - } - -}; - diff --git a/abs/core/mythinstall/installsettings.h b/abs/core/mythinstall/installsettings.h deleted file mode 100755 index 0df1d4e..0000000 --- a/abs/core/mythinstall/installsettings.h +++ /dev/null @@ -1,489 +0,0 @@ -#ifndef WELCOMESETTINGS_H -#define WELCOMESETTINGS_H - -#include <settings.h> -#include "mythdialogs.h" -#include "libmyth/mythdialogs.h" -#include "libmyth/mythwidgets.h" - - -class SystemtypeGroup: public TriggeredConfigurationGroup { -Q_OBJECT -public: - SystemtypeGroup(); - HostComboBox *HostSystemType; -public slots: - void SystemtypeHelp(); -}; - -//------------------------------------------- -class NetworkSettingseth0: - public TriggeredConfigurationGroup { -Q_OBJECT -public: - NetworkSettingseth0(); - - HostLineEdit *HostIPeth0; - HostComboBox *HostNETMASKeth0; - HostLineEdit *HostGWeth0; - HostLineEdit *HostDNSeth0; - HostCheckBox *HostActiveonbooteth0; - HostCheckBox *HostUseDHCPeth0 ; - HostCheckBox *HostDefaulteth0; - TransButtonSetting *wirelessbuttoneth0; - -signals: - void eth0_is_default(void); -public slots: - void eth0_wireless_settings(); - void eth0_disable_others(); - void eth0_disabled(); - void eth0_wireless_disable(); -}; - -class eth0options : public ConfigurationWizard -{ -public: - eth0options(); -}; - - -class NetworkSettingseth1: - public TriggeredConfigurationGroup { -Q_OBJECT -public: - NetworkSettingseth1(); - - HostLineEdit *HostIPeth1; - HostComboBox *HostNETMASKeth1; - HostLineEdit *HostGWeth1; - HostLineEdit *HostDNSeth1; - HostCheckBox *HostActiveonbooteth1; - HostCheckBox *HostUseDHCPeth1 ; - HostCheckBox *HostDefaulteth1; - TransButtonSetting *wirelessbuttoneth1; -signals: - void eth1_is_default(void); -public slots: - void eth1_wireless_settings(); - void eth1_disable_others(); - void eth1_disabled(); - void eth1_wireless_disable(); -}; - -class eth1options : public ConfigurationWizard -{ -public: - eth1options(); -}; - - - -class NetworkSettingswlan0: - public TriggeredConfigurationGroup { -Q_OBJECT -public: - NetworkSettingswlan0(); - - HostLineEdit *HostIPwlan0; - HostComboBox *HostNETMASKwlan0; - HostLineEdit *HostGWwlan0; - HostLineEdit *HostDNSwlan0; - HostCheckBox *HostActiveonbootwlan0; - HostCheckBox *HostUseDHCPwlan0 ; - HostCheckBox *HostDefaultwlan0; - TransButtonSetting *wirelessbuttonwlan0; -signals: - void wlan0_is_default(void); -public slots: - void wlan0_wireless_settings(); - void wlan0_disable_others(); - void wlan0_disabled(); - void wlan0_wireless_disable(); -}; - -class Wlan0options : public ConfigurationWizard -{ -public: - Wlan0options(); -}; - - -class NetworkSettingswlan1: - public TriggeredConfigurationGroup { -Q_OBJECT -public: - NetworkSettingswlan1(); - - HostLineEdit *HostIPwlan1; - HostComboBox *HostNETMASKwlan1; - HostLineEdit *HostGWwlan1; - HostLineEdit *HostDNSwlan1; - HostCheckBox *HostActiveonbootwlan1; - HostCheckBox *HostUseDHCPwlan1 ; - HostCheckBox *HostDefaultwlan1; - TransButtonSetting *wirelessbuttonwlan1; -signals: - void wlan1_is_default(void); -public slots: - void wlan1_wireless_settings(); - void wlan1_disable_others(); - void wlan1_disabled(); - void wlan1_wireless_disable(); -}; - -class wlan1options : public ConfigurationWizard -{ -public: - wlan1options(); -}; - - - -class NetworkSettingsath0: - public TriggeredConfigurationGroup { -Q_OBJECT -public: - NetworkSettingsath0(); - - HostLineEdit *HostIPath0; - HostComboBox *HostNETMASKath0; - HostLineEdit *HostGWath0; - HostLineEdit *HostDNSath0; - HostCheckBox *HostActiveonbootath0; - HostCheckBox *HostUseDHCPath0 ; - HostCheckBox *HostDefaultath0; - TransButtonSetting *wirelessbuttonath0; -signals: - void ath0_is_default(void); -public slots: - void ath0_wireless_settings(); - void ath0_disable_others(); - void ath0_disabled(); - void ath0_wireless_disable(); -}; - -class ath0options : public ConfigurationWizard -{ -public: - ath0options(); -}; - - - -//-------------------------------------------- - - -class SoundSettings: public TriggeredConfigurationGroup { -Q_OBJECT -public: - SoundSettings(); - HostComboBox *HostAudiotype; - HostCheckBox *HostsyncXine; - HostCheckBox *HostsyncMplayer; - HostCheckBox *HostsyncMythMusic; - HostCheckBox *HostsyncMythFrontend; - - -signals: - void oss_sig(void); - void alsa_sig(void); -public slots: - void soundossgathersettings_1(); - void soundalsagathersettings_1(); - -}; - - -class SoundOSSsettings: public TriggeredConfigurationGroup { -Q_OBJECT -public: - SoundOSSsettings(); - HostComboBox *HostSoundOssAnalog; - HostComboBox *HostSoundOssDigital; - HostComboBox *HostSoundTypeout; - void fillossselection(); -public slots: - void soundossgathersettings(); - void loadossdriver(); -}; - -class SoundALSAsettings: public TriggeredConfigurationGroup { -Q_OBJECT -public: - SoundALSAsettings(); - HostComboBox *HostSoundALSAAnalog; - HostComboBox *HostSoundALSADigital; - HostComboBox *HostSoundALSATypeout; - void fillALSAselection(); -public slots: - void soundalsagathersettings(); - void loadalsadriver(); - -}; - - -//############################################ -class MythInstallSettings: public ConfigurationWizard -{ - -public: - MythInstallSettings(); - void testme(); -private: - MythPopupBox *popup; - -}; - - - - -class HostRemoteType: public HostImageSelect { -public: - HostRemoteType(); -}; - - - -#define MV_ROOT "/usr/MythVantage/" -int runsettings(bool = false , bool = false , bool = false ,bool = false ,bool = false, bool = false,bool = false,bool = false , bool = false , bool = false , bool = false, bool = false , bool = false , bool = false , bool = false); -//void ReadDDCifno(void); -void run_systemconfig(QString,bool = false,QString = ""); -void writesettings(); - -//void testXconfiguration(); - - - - - -struct HostParms -{ - QString ThisHostName; - QString ThisHostDHCPhostname; - - QString ThisHostIP; - QString ThisNETMASK; - QString ThisGW; - QString ThisDNS; - QString ThisDHCP; - QString ThisHostnetOLD; - QString ThisHostnetActiveOLD; - - QString ThisHostDefaultInterface; - QString ThisHostIPeth0; - QString ThisHostNETMASKeth0; - QString ThisHostDNSeth0; - QString ThisHostUSEDHCPeth0; - QString ThisHostGWeth0; - QString ThisHOST_iswirelesseth0; - QString ThisHostActiveonbooteth0; - QString ThisHOSTESSIDeth0; - QString ThisHostUseEncryptioneth0; - QString ThisHostkeyeth0; - QString ThisHostMTUeth0; - - - QString ThisHostIPeth1; - QString ThisHostNETMASKeth1; - QString ThisHostDNSeth1; - QString ThisHostUSEDHCPeth1; - QString ThisHostGWeth1; - QString ThisHostActiveonbooteth1 ; - QString ThisHOST_iswirelesseth1; - QString ThisHOSTESSIDeth1; - QString ThisHostUseEncryptioneth1; - QString ThisHostkeyeth1; - QString ThisHostMTUeth1; - - QString ThisHostIPwlan0; - QString ThisHostNETMASKwlan0; - QString ThisHostDNSwlan0; - QString ThisHostUSEDHCPwlan0; - QString ThisHostGWwlan0; - QString ThisHostActiveonbootwlan0; - QString ThisHOST_iswirelesswlan0; - QString ThisHOSTESSIDwlan0; - QString ThisHostUseEncryptionwlan0; - QString ThisHostkeywlan0; - QString ThisHostMTUwlan0; - - - QString ThisHostIPwlan1; - QString ThisHostNETMASKwlan1; - QString ThisHostDNSwlan1; - QString ThisHostUSEDHCPwlan1; - QString ThisHostGWwlan1; - QString ThisHostActiveonbootwlan1; - QString ThisHOST_iswirelesswlan1; - QString ThisHOSTESSIDwlan1; - QString ThisHostUseEncryptionwlan1; - QString ThisHostkeywlan1; - QString ThisHostMTUwlan1; - - QString ThisHostIPath0; - QString ThisHostNETMASKath0; - QString ThisHostDNSath0; - QString ThisHostUSEDHCPath0; - QString ThisHostGWath0; - QString ThisHostActiveonbootath0; - QString ThisHOST_iswirelessath0; - QString ThisHOSTESSIDath0; - QString ThisHostUseEncryptionath0; - QString ThisHostkeyath0; - QString ThisHostMTUath0; - - - QString ThisRemote; - QString ThisTimeZone; - QString ThisSamba; - QString ThisHostServiceSamba_media; - QString ThisHostServiceSamba_home; - QString ThisHostServiceSamba_writehome; - QString ThisHostServiceSamba_write; - QString ThisHostServiceSamba_domain; - QString ThisNFS; - QString ThisMythWEB; - QString ThisHostwebauth; - QString ThisHostServiceHobbit; - QString ThisHostServiceRRD; - - QString ThisHostRunDHCP; - QString ThisSystemType; -// QString ThisBlaster; - - QString ThisHostTransmitproto_1; - QString ThisHostTransmitproto_2; - QString ThisHostTransmitproto_3; - QString ThisHostTransmitproto_4; - QString ThisHostBlasterType; - QString ThisHostSerialPort_blasterlirc; - QString ThisHostnumblaster; - - QString ThisReceiverType; - QString ThisHostLircWait; - QString ThisHostSerialPortlirc; - QString ThisHostUseEvrouter; - QString ThisHostEvrouterConfig; - QString ThisDBhost; - QString ThisXres; - QString ThisShutdowntime; - QString ThisShutdowntime2; - QString ThisWakeuptime; - QString ThisAutodown; - QString ThisUseNVRAM; - QString ThisUseWOL; - QString ThisKeepPackage; - QString ThisMythWelcome; - QString ThisHaveNFS; - QString ThisNFSserver; - QString ThisNFSmountpoint; - QString ThisHostupdateplan; - // QString ThisOSS; - QString ThisShowToolTips; - QString ThisHostPKG_MIRROR; - QString ThisRunfrontend; - QString ThisHostZipcode; - QString ThisHostncidClient; - QString ThisHostncidDaemon; - QString ThisHostSerialPortncid; - QString ThisHostbootsplash; - QString ThisXIgnoreConfig; - QString ThisXcardtype; - QString ThisXUseAdvanced; - QString ThisXIgnoreEDID; - QString ThisXconnection; - QString ThisXHsync; - QString ThisXVrefresh; - QString ThisXresadvanced; - QString ThisXTVstandard; - QString ThisXTVconnection; - QString ThisXDisplaysize ; - - QString ThisHostXNvidia1080p; - QString ThisHostXNvidia1080i; - QString ThisHostXNvidia720p; - QString ThisHostXNvidia480p; - QString ThisHostAudiotype; - - QString ThisHostSoundTypeout; - QString ThisHostSoundOSSAnalog; - QString OLDHostSoundOSSAnalog; - QString ThisHostSoundOSSDigital; - QString OLDHostSoundOSSDigital; - - QString ThisHostSoundDigital; - QString ThisHostSoundDevice; - - QString ThisHostSoundALSAAnalog; - QString OLDHostSoundALSAAnalog; - QString ThisHostSoundALSADigital; - QString OLDHostSoundALSADigital; - QString ThisHostSoundALSATypeout; - - - QString ThisHostsyncXine; - QString ThisHostsyncMplayer; - QString ThisHostsyncMythMusic; - QString ThisHostsyncMythFrontend; - QString ThisHostLCDType; - QString ThisHostRemoteBackup; - QString ThisHostRemoteBackupDir; - QString ThisHostpluginmytharchive; - QString ThisHostpluginmythbrowser; - QString ThisHostpluginmythcontrols; - QString ThisHostpluginmythflix; - QString ThisHostpluginmythgallery; - QString ThisHostpluginmythgame; - QString ThisHostpluginmythmovietime; - QString ThisHostpluginmythmusic; - QString ThisHostpluginmythnews; - QString ThisHostpluginmythphone; - QString ThisHostpluginmythsmolt; - QString ThisHostpluginmythvideo; - QString ThisHostpluginmythweather; - QString ThisHostpluginmythzoneminder; - QString ThisHostpluginmythgameFceu; - QString ThisHostpluginmythgameZsnes; - QString ThisHostpluginmythgameMame; - QString ThisHostpluginmythvideo_dvdcss; - QString ThisHostpluginmythappletrailers; - QString ThisHostpluginmythstream; - QString ThisHostpluginmythvodka; - QString ThisHostMiro; - QString ThisHostpluginmythgameMednafen; - QString ThisHostpluginmythgameROMDB; - QString ThisHostXine; - QString ThisHostwebmin; - QString ThisHostfuppes; - QString ThisHostfoldingathome; - QString ThisHostfoldingusername; - QString ThisHostfoldingworksize; - - QString ThisHostDDnslogin; - QString ThisHostDDnspassword; - QString ThisHostDDnshostname; - QString ThisHostDDnsEnable; - QString ThisHostscreensavertype; - QString ThisHostscreensaveridle; - QString ThisHostscreensavertheme; - QString ThisHOSTrootSSH; - bool displayshowadvancedX; - - -}; - -struct DDCinfo -{ - QString XVrefresh; - QString XHsync; - QString Displaysize; -}; - - - - - - - -#endif diff --git a/abs/core/mythinstall/main.cpp b/abs/core/mythinstall/main.cpp deleted file mode 100755 index afee4ea..0000000 --- a/abs/core/mythinstall/main.cpp +++ /dev/null @@ -1,533 +0,0 @@ -#include <qapplication.h> -#include <cstdlib> -//#include "libmyth/mythdialogs.h" -#include "libmyth/mythcontext.h" -#include "libmyth/settings.h" -#include "libmyth/langsettings.h" -#include "libmyth/mythdbcon.h" -#include <libmyth/exitcodes.h> -#include "libmythtv/tv.h" -#include "installdialog.h" -#include "installsettings.h" -#include "password_manage.h" -#include "autocard.h" -#include "settemplate.h" -#include "mythdialogbox.h" -//#include "mv_common.h" - -#include <iostream> -#include <fstream> -#include <stdio.h> - -#include "libmyth/dialogbox.h" -#include <qlist.h> -#include <qvaluevector.h> -#include <qdir.h> -HostParms hostparm; -DDCinfo ddcinfo; - - -void initKeys(void) -{ - REG_KEY("Welcome", "STARTXTERM", "Open an Xterm window", "F12"); - REG_KEY("Welcome", "SHOWSETTINGS", "Show Mythshutdown settings", "F11"); -} - - -int main(int argc, char **argv) -{ - bool bShowSettings = false; - bool bShowNetwork = false; - bool bShowHostype = false; - bool bShowMisc = false; - bool bShowshutdown = false; - bool bShowadvanced = false; - bool bShowsound = false; - bool bShowadvancedX = false; - bool bShowAccesscontrol = false; - bool bShowplugins = false; - bool bShowTemplate = false; - bool bShowuser = false; - bool bShowwebuser = false; - bool bRunSetup = false; - bool bShowHelp = false; - bool bShowReadme = false; - bool bShowddns = false; - bool bShowinfrared = false; - bool bShowscreensaver = false; - - QStringList template_c_line ; - QString modulelist = "" ; - QString templateop=""; - QString templatename=""; - QString templatehostname=""; - QApplication a(argc, argv); - - gContext = NULL; - gContext = new MythContext(MYTH_BINARY_VERSION); - if (!gContext->Init()) - { - VERBOSE(VB_IMPORTANT, "mythwelcome: Could not initialize myth context. " - "Exiting."); - return FRONTEND_EXIT_NO_MYTHCONTEXT; - } - - if (!MSqlQuery::testDBConnection()) - { - VERBOSE(VB_IMPORTANT, "mythwelcome: Could not open the database. " - "Exiting."); - return -1; - } - - // Check command line arguments - for (int argpos = 1; argpos < a.argc(); ++argpos) - { - - if (!strcmp(a.argv()[argpos],"-v") || - !strcmp(a.argv()[argpos],"--verbose")) - { - if (a.argc()-1 > argpos) - { - if (parse_verbose_arg(a.argv()[argpos+1]) == - GENERIC_EXIT_INVALID_CMDLINE) - return FRONTEND_EXIT_INVALID_CMDLINE; - - ++argpos; - } - else - { - cerr << "Missing argument to -v/--verbose option\n"; - return FRONTEND_EXIT_INVALID_CMDLINE; - } - } - else if (!strcmp(a.argv()[argpos],"-s") || - !strcmp(a.argv()[argpos],"--setup")) - { - bShowSettings = true; -//--------------------------------------------- - if (a.argc()-1 > argpos) - { - QString tmpArg = a.argv()[argpos+1]; - if (tmpArg.startsWith("-")) - { - cerr << "Invalid or missing argument to -s \n"; - return FRONTEND_EXIT_INVALID_CMDLINE; - } - - QStringList pairs = QStringList::split(",", tmpArg); - for (unsigned int index = 0; index < pairs.size(); ++index) - { - if ( pairs[index] == "network" ) - { - // cout << pairs[index] << endl; - bShowNetwork = true; - modulelist.append("network,"); - } - else if ( pairs[index] == "misc" ) - { - // cout << pairs[index] << endl; - bShowMisc = true; - modulelist.append("misc,"); - } - else if ( pairs[index] == "sleep" ) - { - // cout << pairs[index] << endl; - bShowshutdown = true; - modulelist.append("sleep,"); - } - else if ( pairs[index] == "hostype" ) - { - // cout << pairs[index] << endl; - bShowHostype = true; - modulelist.append("hostype,"); - } - else if ( pairs[index] == "advanced" ) - { - // cout << pairs[index] << endl; - bShowadvanced = true; - modulelist.append("advanced,"); - } - else if ( pairs[index] == "sound" ) - { - // cout << pairs[index] << endl; - bShowsound = true; - modulelist.append("audio,"); - } - else if ( pairs[index] == "advancedX" ) - { - // cout << pairs[index] << endl; - bShowadvancedX = true; - modulelist.append("advancedX,"); - } - else if ( pairs[index] == "accesscontrol" ) - { - // cout << pairs[index] << endl; - bShowAccesscontrol = true; - modulelist.append("accesscontrol,"); - } - else if ( pairs[index] == "plugins" ) - { - // cout << pairs[index] << endl; - bShowplugins = true; - modulelist.append("plugins,"); - } - else if ( pairs[index] == "user" ) - { - // cout << pairs[index] << endl; - bShowuser = true; - modulelist.append("user,"); - } - else if ( pairs[index] == "webuser" ) - { - // cout << pairs[index] << endl; - bShowwebuser = true; - modulelist.append("webuser,"); - } - else if ( pairs[index] == "ddns" ) - { - // cout << pairs[index] << endl; - bShowddns = true; - modulelist.append("ddns,"); - } - else if ( pairs[index] == "ir" ) - { - // cout << pairs[index] << endl; - bShowinfrared = true; - modulelist.append("ir,"); - } - else if ( pairs[index] == "screensaver" ) - { - // cout << pairs[index] << endl; - bShowscreensaver = true; - modulelist.append("screensaver,"); - } - - } - // return FRONTEND_EXIT_OK; - } - else - { - // if no args, then show the default steup. - bShowNetwork = true; - bShowHostype = true; - bShowMisc = true; - bShowuser = true; - bShowshutdown = true; - - modulelist="network,hostype,misc,sleep"; - - } - - ++argpos; - - -//--------------------------------------------- - } - else if (!strcmp(a.argv()[argpos],"-u")) - bShowuser = true; - else if (!strcmp(a.argv()[argpos],"-t")) - { - bShowTemplate = true; - if (a.argc()-1 > argpos) - { - QString tmpArg = a.argv()[argpos+1]; - if (tmpArg.startsWith("-")) - { - cerr << "Invalid or missing argument to -t \n"; - return FRONTEND_EXIT_INVALID_CMDLINE; - } - template_c_line = QStringList::split(",", tmpArg); - if ( template_c_line.size() != 0 ) - { - if ( template_c_line.size() >3 || template_c_line.size() <2 ) - { - cerr << "Invalid or missing argument to -t \n"; - return FRONTEND_EXIT_INVALID_CMDLINE; - } - } - ++argpos; - } - - } - else if (!strcmp(a.argv()[argpos],"-b")) - { - bRunSetup = true; - } - else if (!strcmp(a.argv()[argpos],"-h")) - { - bShowHelp = true; - } - else if (!strcmp(a.argv()[argpos],"-r")) - { - bShowReadme = true; - } - else - { - cerr << "Invalid argument: " << a.argv()[argpos] << endl << - "Valid options are: " << endl << - "-v or --verbose debug-level Use '-v help' for level info" << endl << - "-b run backend setup" << endl << - "-h for help screens " << endl << - "-t show template screens (op,tname,hname)" << endl << - "-s or --setup (network,hostype,misc,sleep,advanced,advancedX,sound,accesscontrol, user,webuser,ddns,ir,screensaver)" << endl; - return FRONTEND_EXIT_INVALID_CMDLINE; - } - } - - gContext->LoadQtConfig(); - - LanguageSettings::load("mythfrontend"); - - MythMainWindow *mainWindow = GetMythMainWindow(); - // if parms were passed to -t then doen't init the screen. - if ( template_c_line.size() == 0 ) - { - gContext->SaveSetting("HOSTtemplatetype","Do Nothing" ); - mainWindow->Init(); - gContext->SetMainWindow(mainWindow); - }; - initKeys(); - - - if (bShowSettings) - { - bool runconfig = false; - system("cp -f /etc/systemconfig /tmp/systemconfig.bak"); - QString olddb = gContext->GetSetting("HostMysqlserver"); - QString oldhostype = gContext->GetSetting("HostSystemType"); - runsettings(false,bShowNetwork,bShowHostype,bShowMisc,bShowshutdown,bShowadvanced,bShowsound,bShowadvancedX,bShowAccesscontrol,bShowplugins,bShowuser,bShowwebuser,bShowddns,bShowinfrared,bShowscreensaver); - QString newdb = gContext->GetSetting("HostMysqlserver"); - QString newhostype = gContext->GetSetting("HostSystemType"); - int status = system("diff /tmp/systemconfig.bak /etc/systemconfig"); - bool restart = false; - - // save my settings in case db switches - //cout << "save for the heck of it " << endl; - QString cmdtxt; - cmdtxt=MV_ROOT ; - cmdtxt.append("bin/restore_default_settings.sh -c save -t syssettings -d " + olddb); - system(cmdtxt); - //system("/root/restore_default_settings.sh -c save -t syssettings -d " + olddb); - - if ( status != 0 ) - { - runconfig = true; - } - - if ( newdb != olddb ) - { - runconfig = true; - restart = true; - //db changed save setting from olddb - // cout << "newdb_olddb" << endl; - QString cmdtxt; - cmdtxt=MV_ROOT ; - cmdtxt.append("bin/restore_default_settings.sh -c save -t syssettings -d " + olddb ) ; - system(cmdtxt); - //system("/root/restore_default_settings.sh -c save -t syssettings -d " + olddb ) ; - } - - if ( runconfig ) - { - if ( newhostype != oldhostype ) - modulelist.append("hostypec,"); - //trim off last , - modulelist.truncate(modulelist.length()-1); - - - cout << modulelist <<endl; - QString cmdtxt; - cmdtxt=MV_ROOT ; - cmdtxt.append("bin/restore_default_settings.sh -c restore -t syssettings -d "); - QString dbcommand = cmdtxt; - //QString dbcommand="/root/restore_default_settings.sh -c restore -t syssettings -d "; - dbcommand.append(newdb); - // cout << dbcommand << endl; - run_systemconfig(modulelist,restart,dbcommand); - // cout << "running config" <<endl; - } - system("rm -f /tmp/systemconfig.bak"); - - if ( restart ) - { - //restore settings to new database - //cout << " restoreing settings to new db" << endl; - //system("/root/restore_default_settings.sh save syssettings " + olddb ) ; - // system("/root/restore_default_settings.sh restore syssettings " + newdb) ; - DialogBox *dia = NULL; - QString prompt; - QString *problems = new QString("The network address of the database has changed."); - problems->append("\n"); - problems->append("The frontend will need to restart to connect to the new database."); - problems->append("\n"); - dia = new DialogBox(mainWindow, problems->append("\n" )); - dia->AddButton(QObject::tr("OK")); - int returncode = 0; - returncode = dia->exec(); - dia->deleteLater(); - cout << "restarting" << endl; - //system("/root/systemconfig.sh restartfe" ); - QString cmdtxt; - cmdtxt=MV_ROOT ; - cmdtxt.append("bin/systemconfig.sh reloadfe" ); - system(cmdtxt); - } - - } - else if (bShowTemplate) - { - // cout << templateparms << endl; - if ( template_c_line.size() == 2) - { - templateop=template_c_line[0]; - templatename=template_c_line[1]; - } - else if ( template_c_line.size() == 3) - { - templateop=template_c_line[0]; - templatename=template_c_line[1]; - templatehostname=template_c_line[2]; - }; - choosetemplate(templateop,templatename,templatehostname); - } - - else if (bRunSetup) - { - DialogBox *dia = NULL; - QString prompt; - QString *problems = new QString("To configure the TV cards and program guide the setup program needs to be run."); - problems->append("\n"); - problems->append("\n"); - - problems->append("For those in North America, guide data is provided by Schedules Direct."); - problems->append("\n"); - problems->append("Visit http://www.schedulesdirect.org/ to signup for your account today"); - problems->append("\n"); problems->append("\n"); problems->append("\n"); - - problems->append("If you choose to not run mythtv-setup now, the program can be run at any time by typing mythtv-setup or hitting ALT+s"); - problems->append("\n"); - - problems->append("\n"); - prompt = QObject::tr("Do you wish to run mythtv-setup ?"); - - dia = new DialogBox(mainWindow, problems->append("\n" + prompt)); - dia->AddButton(QObject::tr("Yes")); - dia->AddButton(QObject::tr("Yes and try to autodetect cards")); - dia->AddButton(QObject::tr("No")); - int returncode = 0; - //returncode = dia->exec(); - DialogCode dcode = dia->exec(); - dia->deleteLater(); - if (kDialogCodeButton0 == dcode ) - returncode = 0; - if (kDialogCodeButton1 == dcode ) - returncode = 1; - if (kDialogCodeButton2 == dcode ) - returncode = 2; - - if (returncode == 1) - { - AutoCard listcards; - listcards.exec(); - } - - return returncode; - - - } -else if (bShowHelp) - { - DialogBox *dia = NULL; - QString prompt; - QString *problems = new QString(" Help Screen"); - problems->append("\n"); - problems->append("-------------------------------------------------"); - problems->append("\n"); - problems->append("Alt+h This screen"); - problems->append("\n"); - #ifdef __MVAPP__ - problems->append("F2 open/close terminal"); - problems->append("\n"); - problems->append("Shift + Return opens new xterm"); - problems->append("\n"); - problems->append("Alt+F2 for 2nd desktop Alt+F1 to go back"); - problems->append("\n"); - problems->append("Alt+c Capture myth screenshot"); - problems->append("\n"); - #else - problems->append("Alt + X opens new xterm "); - problems->append("\n"); - problems->append("Alt + m start mythfrontend"); - problems->append("\n"); - problems->append("m will display a popup for power/about"); - problems->append("\n"); - #endif - problems->append("Ctrl + Alt + u unhide mouse cursor"); - problems->append("\n"); - problems->append("Alt+1 start masterbackend"); - problems->append("\n"); - problems->append("Alt+2 stop masterbackend"); - problems->append("\n"); - problems->append("Alt+3 restart masterbackend"); - problems->append("\n"); - problems->append("Alt+s run mythtv-setup"); - problems->append("\n"); - - - dia = new DialogBox(mainWindow, problems->append("\n" )); - dia->AddButton(QObject::tr("OK")); - // dia->AddButton(QObject::tr("No")); - int returncode = 0; - returncode = dia->exec(); - dia->deleteLater(); - return returncode; - - - } -else if (bShowReadme) - { - DialogBox *dia = NULL; - QString prompt; - QString line; - QString *problems = new QString(""); - problems->append("\n"); - QFile file("/usr/MythVantage/README"); - if ( file.open(IO_ReadOnly | IO_Translate) ) - { - QTextStream t( &file ); // use a text stream - while ( !t.eof() ) - { - line = t.readLine(); - problems->append(line); - problems->append("\n"); - } - file.close(); - } - else - problems->append("Couldn't open file"); - - dia = new DialogBox(mainWindow, problems->append("\n" )); - dia->AddButton(QObject::tr("OK")); - // dia->AddButton(QObject::tr("No")); - int returncode = 0; - returncode = dia->exec(); - dia->deleteLater(); - return returncode; - } - else - - { - WelcomeDialog *mythWelcome = new WelcomeDialog(gContext->GetMainWindow(), - "welcome_screen", "install-", - "welcome_screen"); - - mythWelcome->exec(); - - - delete mythWelcome; - } - -// delete gContext; - - return 0; -} diff --git a/abs/core/mythinstall/misc_settings.cpp b/abs/core/mythinstall/misc_settings.cpp deleted file mode 100755 index 7c3eb67..0000000 --- a/abs/core/mythinstall/misc_settings.cpp +++ /dev/null @@ -1,621 +0,0 @@ -#include <mythcontext.h> -#include <unistd.h> -#include <iostream> -#include <fstream> -#include <stdio.h> -#include <stdlib.h> -#include <cstdlib> -#include "misc_settings.h" -#include "mv_common.h" -#include "uitypes.h" - -extern HostParms hostparm; - -static HostCheckBox *HostShowToolTips() -{ - HostCheckBox *gc = new HostCheckBox("HostShowToolTips"); - gc->setLabel(QObject::tr("Show shortcuts")); - gc->setValue(true); - gc->setHelpText(QObject::tr("Shows a popup window describing how to open a console and various other items.")); - return gc; -}; - -static HostComboBox *Hostupdateplan() -{ - HostComboBox *gc = new HostComboBox("Hostupdateplan"); - gc->setLabel(QObject::tr("Automatic updates")); - gc->addSelection("None"); - gc->addSelection("Myth_only"); - gc->addSelection("All"); - gc->setHelpText("Download and apply updates. None: Will not download any updates , Myth_only: automatic updates for MythTV, All: Automatic updates for the entire system."); - return gc; - -} -static HostLineEdit *HostZipcode() -{ - HostLineEdit *gc = new HostLineEdit("HostZipcode"); - gc->setLabel(QObject::tr("Zip Code")); - gc->setHelpText(QObject::tr("The zipcode will be used to configure MythMovieTimes. Leave it blank to use the existing value. People located outside the U.S.A should probably leave this blank")); - //gc->setRW(); - //gc->setRO(); - return gc; -}; - -//_______________Misc main frame -MiscMainFrame::MiscMainFrame(): - VerticalConfigurationGroup(false,false,false,false) - -{ - bool MVAPP; - #ifdef __MVAPP__ - MVAPP = true ; - #else - MVAPP = false ; - #endif - bool showLabels; - hostparm.ThisSystemType = gContext->GetSetting("HostSystemType"); - if ( hostparm.ThisSystemType == "Standalone" || hostparm.ThisSystemType=="Master_backend") - { - showLabels = false; - } - else - { - showLabels = true; - } - TransLabelSetting *temptimezone = new TransLabelSetting(); - temptimezone->setValue("Timezone: " + hostparm.ThisTimeZone ); - TransLabelSetting *tempzipcode = new TransLabelSetting(); - tempzipcode->setValue("Zipcode: " + hostparm.ThisHostZipcode ); - GridConfigurationGroup* miscsettings_2 = - new GridConfigurationGroup(1,true, true,false,false); - - if ( showLabels && ( hostparm.ThisHostZipcode != "" )) - if (MVAPP) - miscsettings_2->addChild(tempzipcode); - else - miscsettings_2->addChild(HostZipcode()); - else - miscsettings_2->addChild(HostZipcode()); - - TimezoneRegion *timezoneregion = new TimezoneRegion(); - TimezoneButton *timezonebutton = new TimezoneButton(); - - VerticalConfigurationGroup* miscsettings = - new VerticalConfigurationGroup(false, true,false,false); - if ( showLabels && ( hostparm.ThisTimeZone != "" )) - { - if (MVAPP) - { - miscsettings->addChild(temptimezone); - timezonebutton->disableButton(); - } - else - miscsettings->addChild(timezoneregion); - } - else - miscsettings->addChild(timezoneregion); - - miscsettings->addChild(timezonebutton); - miscsettings->addChild(miscsettings_2); - addChild(miscsettings); - - connect(timezonebutton, SIGNAL(mf_launch_tzgui()),timezoneregion ,SLOT(timezone_gathersettings())); - connect(timezoneregion,SIGNAL(mf_show_tz(QString)),this,SLOT(mf_show_tz(QString))); - connect(this,SIGNAL(update_timezone(QString)),timezoneregion,SLOT(update_timezone_values(QString))); - - autoLaunchTimer = new QTimer(this); - connect(autoLaunchTimer, SIGNAL(timeout()), timezonebutton, SLOT(launch_tzgui())); - autoLaunchTimer->start(0); - } - -QString MiscMainFrame::mf_show_tz(QString tz) -{ - QString GTimezone; - int rc; - - if (autoLaunchTimer->isActive()) - { - autoLaunchTimer->stop(); - - // This was triggered by the timer. Only launch the timezone gui if the timezone is unknown. - if (!timezone_unknown) - return NULL; - } - - cout << "MiscMainFrame::mf_show_tz " << tz << "\n"; - - if ((tz == "") || timezone_unknown) - tz = "guess"; - - //launch tzgui and load output into Gtimezone - int screenheight = 0, screenwidth = 0; - float wmult = 0, hmult = 0; - QString m_height , m_width , cmd; - gContext->GetScreenSettings(screenwidth, wmult, screenheight, hmult); - m_height.setNum(screenheight); - m_width.setNum(screenwidth); - QString tzpath; - tzpath=MV_ROOT; - tzpath.append("bin/timezone.bin"); - //cmd="ACCEL=500 " + tzpath + " -z " + tz + " -h " + m_height + " -w " + m_width + " > /tmp/.selected_tz" ; - cmd=tzpath + " -z " + tz + " -h " + m_height + " -w " + m_width + " > /tmp/.selected_tz" ; - rc=myth_system(cmd); - if ( rc == 0 ) - { - //read in value - QString line; - QFile file("/tmp/.selected_tz"); - if ( file.open(IO_ReadOnly | IO_Translate) ) - { - QTextStream t( &file ); // use a text stream - while ( !t.eof() ) - { - line = t.readLine(); - if ( line.contains("/")) - { - GTimezone = line.simplifyWhiteSpace(); - break; - } - } - file.close(); - } - timezone_unknown = FALSE; - emit update_timezone(GTimezone); - } - -} - - -//_______________Misc main frame -MiscMainFrame2::MiscMainFrame2(): - VerticalConfigurationGroup(false,false,false,false) - { - VerticalConfigurationGroup* miscsettings = - new VerticalConfigurationGroup(false, true,false,false); - - GridConfigurationGroup* miscsettings_2 = - new GridConfigurationGroup(1,false, false,false,false); - miscsettings_2->addChild(HostShowToolTips()); - miscsettings_2->addChild(Hostupdateplan()); - - NFSSettings *nfssettings = new NFSSettings(); - - miscsettings->addChild(nfssettings); - miscsettings->addChild(miscsettings_2); - - addChild(miscsettings); - - } - - -//_______________Misc time timezone - -TimezoneButton::TimezoneButton(): - VerticalConfigurationGroup(false,false,false,false) - { - TZButton = new TransButtonSetting; - TZButton->setLabel("Hitchhikers guide to timezones"); - addChild(TZButton); - connect(TZButton, SIGNAL(pressed()),this,SLOT(launch_tzgui())); - - }; - -void TimezoneButton::launch_tzgui() -{ - emit mf_launch_tzgui(); -} - -void TimezoneButton::disableButton() -{ - TZButton->setEnabled(false); -} - - - -//This is used for the timezone -QStringList findFilesRecursively ( QStringList paths, QString fileTypes ) { - if ( fileTypes.isEmpty() ) fileTypes = "*"; - QStringList result, more; - QStringList::Iterator it; - for ( uint i = 0 ; i < paths.size() ; i++ ) - { // inefficient...whatever - QDir dir( paths[i] ); - dir.setSorting( QDir::Reversed ); - more = dir.entryList( fileTypes, QDir::Files ); - for ( it = more.begin() ; it != more.end() ; ++it ) - result.append( paths[i] + "/" + *it ); - // reg exp in next line excludes . and .. dirs (and .* actually) - more = dir.entryList( QDir::Dirs ).grep( QRegExp( "[^.]" ) ); - for ( it = more.begin() ; it != more.end() ; ++it ) - *it = paths[i] + "/" + *it; - more = findFilesRecursively( more, fileTypes ); - for ( it = more.begin() ; it != more.end() ; ++it ) - result.append( *it ); - } - return result; // yields absolute paths -} - - -void TimezoneRegion::timezoneregion_fillselection_zone() -{ - HostTimeZoneRegion->setLabel(QObject::tr("TimeZone")); - HostTimeZoneRegion->addSelection("US"); - HostTimeZoneRegion->addSelection("Pacific"); - HostTimeZoneRegion->addSelection("Mideast"); - HostTimeZoneRegion->addSelection("Mexico"); - HostTimeZoneRegion->addSelection("Indian"); - HostTimeZoneRegion->addSelection("Europe"); - HostTimeZoneRegion->addSelection("Etc"); - HostTimeZoneRegion->addSelection("Chile"); - HostTimeZoneRegion->addSelection("Canada"); - HostTimeZoneRegion->addSelection("Brazil"); - HostTimeZoneRegion->addSelection("Australia"); - HostTimeZoneRegion->addSelection("Atlantic"); - HostTimeZoneRegion->addSelection("Asia"); - HostTimeZoneRegion->addSelection("Arctic"); - HostTimeZoneRegion->addSelection("Antarctica"); - HostTimeZoneRegion->addSelection("America"); - HostTimeZoneRegion->addSelection("Africa"); - //--single region - HostTimeZoneRegion->addSelection("Zulu"); - HostTimeZoneRegion->addSelection("WET"); - HostTimeZoneRegion->addSelection("W-SU"); - HostTimeZoneRegion->addSelection("Universal"); - HostTimeZoneRegion->addSelection("UTC"); - HostTimeZoneRegion->addSelection("UCT"); - HostTimeZoneRegion->addSelection("Turkey"); - HostTimeZoneRegion->addSelection("Singapore"); - HostTimeZoneRegion->addSelection("ROK"); - HostTimeZoneRegion->addSelection("ROC"); - HostTimeZoneRegion->addSelection("Portugal"); - HostTimeZoneRegion->addSelection("Poland"); - HostTimeZoneRegion->addSelection("PST8PDT"); - HostTimeZoneRegion->addSelection("PRC"); - HostTimeZoneRegion->addSelection("Navajo"); - HostTimeZoneRegion->addSelection("NZ-CHAT"); - HostTimeZoneRegion->addSelection("NZ"); - HostTimeZoneRegion->addSelection("MST7MDT"); - HostTimeZoneRegion->addSelection("MST"); - HostTimeZoneRegion->addSelection("MET"); - HostTimeZoneRegion->addSelection("Libya"); - HostTimeZoneRegion->addSelection("Kwajalein"); - HostTimeZoneRegion->addSelection("Japan"); - HostTimeZoneRegion->addSelection("Jamaica"); - HostTimeZoneRegion->addSelection("Israel"); - HostTimeZoneRegion->addSelection("Iran"); - HostTimeZoneRegion->addSelection("Iceland"); - HostTimeZoneRegion->addSelection("Hongkong"); - HostTimeZoneRegion->addSelection("HST"); - HostTimeZoneRegion->addSelection("Greenwich"); - HostTimeZoneRegion->addSelection("GMT0"); - HostTimeZoneRegion->addSelection("GMT-0"); - HostTimeZoneRegion->addSelection("GMT+0"); - HostTimeZoneRegion->addSelection("GMT"); - HostTimeZoneRegion->addSelection("GB-Eire"); - HostTimeZoneRegion->addSelection("GB"); - HostTimeZoneRegion->addSelection("Factory"); - HostTimeZoneRegion->addSelection("Eire"); - HostTimeZoneRegion->addSelection("Egypt"); - HostTimeZoneRegion->addSelection("EST5EDT"); - HostTimeZoneRegion->addSelection("EST"); - HostTimeZoneRegion->addSelection("EET"); - HostTimeZoneRegion->addSelection("Cuba"); - HostTimeZoneRegion->addSelection("CST6CDT"); - HostTimeZoneRegion->addSelection("CET"); - HostTimeZoneRegion->setHelpText(QObject::tr("Timezone Region")); -} - -void TimezoneRegion::timezoneregion_fillselection(QString tzonefile ) -{ - QString currentitem; - int foundtab; - int foundslashes; - QString timezonefile="/usr/share/zoneinfo/posix/"; - timezonefile.append(tzonefile); - QStringList answer = findFilesRecursively( timezonefile, "*" ); - QStringList onlyfiles = ""; - QStringList::Iterator it; - for ( it = answer.begin(); it != answer.end(); ++it ) - { - currentitem = *it; - foundtab=currentitem.contains(".tab"); - if ( foundtab == 0 ) - { - foundslashes=currentitem.contains("/"); - currentitem = currentitem.section( '/', 6, foundslashes ); - - if ( tzonefile == "US") - HostTimezoneRegion_US->addSelection(currentitem); - else if ( tzonefile == "Pacific") - HostTimezoneRegion_Pacific->addSelection(currentitem); - else if ( tzonefile == "Mideast") - HostTimezoneRegion_Mideast->addSelection(currentitem); - else if ( tzonefile == "Mexico") - HostTimezoneRegion_Mexico->addSelection(currentitem); - else if ( tzonefile == "Indian") - HostTimezoneRegion_Indian->addSelection(currentitem); - else if ( tzonefile == "Europe") - HostTimezoneRegion_Europe->addSelection(currentitem); - else if ( tzonefile == "Etc") - HostTimezoneRegion_Etc->addSelection(currentitem); - else if ( tzonefile == "Chile") - HostTimezoneRegion_Chile->addSelection(currentitem); - else if ( tzonefile == "Canada") - HostTimezoneRegion_Canada->addSelection(currentitem); - else if ( tzonefile == "Brazil") - HostTimezoneRegion_Brazil->addSelection(currentitem); - else if ( tzonefile == "Australia") - HostTimezoneRegion_Australia->addSelection(currentitem); - else if ( tzonefile == "Atlantic") - HostTimezoneRegion_Atlantic->addSelection(currentitem); - else if ( tzonefile == "Asia") - HostTimezoneRegion_Asia->addSelection(currentitem); - else if ( tzonefile == "Arctic") - HostTimezoneRegion_Arctic->addSelection(currentitem); - else if ( tzonefile == "Antarctica") - HostTimezoneRegion_Antarctica->addSelection(currentitem); - else if ( tzonefile == "America") - HostTimezoneRegion_America->addSelection(currentitem); - else if ( tzonefile == "Africa") - HostTimezoneRegion_Africa->addSelection(currentitem); - } - } -}; - -void TimezoneRegion::timezone_gathersettings() -{ - QString tz; - QString subregion; - QString region=HostTimeZoneRegion->getValue(); - if ( region == "US") - subregion=HostTimezoneRegion_US->getValue(); - else if ( region == "Pacific") - subregion=HostTimezoneRegion_Pacific->getValue(); - else if ( region == "Mideast") - subregion=HostTimezoneRegion_Mideast->getValue(); - else if ( region == "Mexico") - subregion=HostTimezoneRegion_Mexico->getValue(); - else if ( region == "Indian") - subregion=HostTimezoneRegion_Indian->getValue(); - else if ( region == "Europe") - subregion=HostTimezoneRegion_Europe->getValue(); - else if ( region == "Etc") - subregion=HostTimezoneRegion_Etc->getValue(); - else if ( region == "Chile") - subregion=HostTimezoneRegion_Chile->getValue(); - else if ( region == "Canada") - subregion=HostTimezoneRegion_Canada->getValue(); - else if ( region == "Brazil") - subregion=HostTimezoneRegion_Brazil->getValue(); - else if ( region == "Australia") - subregion=HostTimezoneRegion_Australia->getValue(); - else if ( region == "Atlantic") - subregion=HostTimezoneRegion_Atlantic->getValue(); - else if ( region == "Asia") - subregion=HostTimezoneRegion_Asia->getValue(); - else if ( region == "Arctic") - subregion=HostTimezoneRegion_Arctic->getValue(); - else if ( region == "Antarctica") - subregion=HostTimezoneRegion_Antarctica->getValue(); - else if ( region == "America") - subregion=HostTimezoneRegion_America->getValue(); - else if ( region == "Africa") - subregion=HostTimezoneRegion_Africa->getValue(); - - tz=region+"/"+subregion; - - emit mf_show_tz(tz); -} - -TimezoneRegion::TimezoneRegion(): - TriggeredConfigurationGroup(true,false,true,true,true,true,true,true) -{ - SetVertical(false); - HostTimeZoneRegion= new HostComboBox("HostTimeZoneRegion"); - timezoneregion_fillselection_zone(); - Setting* trigger = HostTimeZoneRegion; - addChild(trigger); - setTrigger(trigger); - //define all the new comboboxes - HostTimezoneRegion_US = new HostComboBox("HostTimezoneRegion_US"); - HostTimezoneRegion_Pacific = new HostComboBox("HostTimezoneRegion_Pacific"); - HostTimezoneRegion_Mideast = new HostComboBox("HostTimezoneRegion_Mideast"); - HostTimezoneRegion_Mexico = new HostComboBox("HostTimezoneRegion_Mexico"); - HostTimezoneRegion_Indian = new HostComboBox("HostTimezoneRegion_Indian"); - HostTimezoneRegion_Europe = new HostComboBox("HostTimezoneRegion_Europe"); - HostTimezoneRegion_Etc = new HostComboBox("HostTimezoneRegion_Etc"); - HostTimezoneRegion_Chile = new HostComboBox("HostTimezoneRegion_Chile"); - HostTimezoneRegion_Canada = new HostComboBox("HostTimezoneRegion_Canada"); - HostTimezoneRegion_Brazil = new HostComboBox("HostTimezoneRegion_Brazil"); - HostTimezoneRegion_Australia = new HostComboBox("HostTimezoneRegion_Australia"); - HostTimezoneRegion_Atlantic = new HostComboBox("HostTimezoneRegion_Atlantic"); - HostTimezoneRegion_Asia = new HostComboBox("HostTimezoneRegion_Asia"); - HostTimezoneRegion_Arctic = new HostComboBox("HostTimezoneRegion_Arctic"); - HostTimezoneRegion_Antarctica = new HostComboBox("HostTimezoneRegion_Antarctica"); - HostTimezoneRegion_America = new HostComboBox("HostTimezoneRegion_America"); - HostTimezoneRegion_Africa = new HostComboBox("HostTimezoneRegion_Africa"); - //fill the new comboboxes - timezoneregion_fillselection("US"); - timezoneregion_fillselection("Pacific"); - timezoneregion_fillselection("Mideast"); - timezoneregion_fillselection("Mexico"); - timezoneregion_fillselection("Indian"); - timezoneregion_fillselection("Europe"); - timezoneregion_fillselection("Etc"); - timezoneregion_fillselection("Chile"); - timezoneregion_fillselection("Canada"); - timezoneregion_fillselection("Brazil"); - timezoneregion_fillselection("Australia"); - timezoneregion_fillselection("Atlantic"); - timezoneregion_fillselection("Asia"); - timezoneregion_fillselection("Arctic"); - timezoneregion_fillselection("Antarctica"); - timezoneregion_fillselection("America"); - timezoneregion_fillselection("Africa"); - - // Add subregions to regions - addTarget("US", HostTimezoneRegion_US ); - addTarget("Pacific", HostTimezoneRegion_Pacific ); - addTarget("Mideast", HostTimezoneRegion_Mideast ); - addTarget("Mexico", HostTimezoneRegion_Mexico ); - addTarget("Indian", HostTimezoneRegion_Indian ); - addTarget("Europe", HostTimezoneRegion_Europe ); - addTarget("Etc", HostTimezoneRegion_Etc ); - addTarget("Chile", HostTimezoneRegion_Chile ); - addTarget("Canada", HostTimezoneRegion_Canada ); - addTarget("Brazil", HostTimezoneRegion_Brazil ); - addTarget("Australia", HostTimezoneRegion_Australia ); - addTarget("Atlantic", HostTimezoneRegion_Atlantic ); - addTarget("Asia", HostTimezoneRegion_Asia ); - addTarget("Arctic", HostTimezoneRegion_Arctic ); - addTarget("Antarctica", HostTimezoneRegion_Antarctica ); - addTarget("America", HostTimezoneRegion_America ); - addTarget("Africa", HostTimezoneRegion_Africa ); - //--single region - addTarget("Zulu", new VerticalConfigurationGroup(false, false)); - addTarget("WET", new VerticalConfigurationGroup(false, false)); - addTarget("W-SU", new VerticalConfigurationGroup(false, false)); - addTarget("Universal", new VerticalConfigurationGroup(false, false)); - addTarget("UTC", new VerticalConfigurationGroup(false, false)); - addTarget("UCT", new VerticalConfigurationGroup(false, false)); - addTarget("Turkey", new VerticalConfigurationGroup(false, false)); - addTarget("Singapore", new VerticalConfigurationGroup(false, false)); - addTarget("ROK", new VerticalConfigurationGroup(false, false)); - addTarget("ROC", new VerticalConfigurationGroup(false, false)); - addTarget("Portugal", new VerticalConfigurationGroup(false, false)); - addTarget("Poland", new VerticalConfigurationGroup(false, false)); - addTarget("PST8PDT", new VerticalConfigurationGroup(false, false)); - addTarget("PRC", new VerticalConfigurationGroup(false, false)); - addTarget("Navajo", new VerticalConfigurationGroup(false, false)); - addTarget("NZ-CHAT", new VerticalConfigurationGroup(false, false)); - addTarget("NZ", new VerticalConfigurationGroup(false, false)); - addTarget("MST7MDT", new VerticalConfigurationGroup(false, false)); - addTarget("MST", new VerticalConfigurationGroup(false, false)); - addTarget("MET", new VerticalConfigurationGroup(false, false)); - addTarget("Libya", new VerticalConfigurationGroup(false, false)); - addTarget("Kwajalein", new VerticalConfigurationGroup(false, false)); - addTarget("Japan", new VerticalConfigurationGroup(false, false)); - addTarget("Jamaica", new VerticalConfigurationGroup(false, false)); - addTarget("Israel", new VerticalConfigurationGroup(false, false)); - addTarget("Iran", new VerticalConfigurationGroup(false, false)); - addTarget("Iceland", new VerticalConfigurationGroup(false, false)); - addTarget("Hongkong", new VerticalConfigurationGroup(false, false)); - addTarget("HST", new VerticalConfigurationGroup(false, false)); - addTarget("Greenwich", new VerticalConfigurationGroup(false, false)); - addTarget("GMT0", new VerticalConfigurationGroup(false, false)); - addTarget("GMT-0", new VerticalConfigurationGroup(false, false)); - addTarget("GMT+0", new VerticalConfigurationGroup(false, false)); - addTarget("GMT", new VerticalConfigurationGroup(false, false)); - addTarget("GB-Eire", new VerticalConfigurationGroup(false, false)); - addTarget("GB", new VerticalConfigurationGroup(false, false)); - addTarget("Factory", new VerticalConfigurationGroup(false, false)); - addTarget("Eire", new VerticalConfigurationGroup(false, false)); - addTarget("Egypt", new VerticalConfigurationGroup(false, false)); - addTarget("EST5EDT", new VerticalConfigurationGroup(false, false)); - addTarget("EST", new VerticalConfigurationGroup(false, false)); - addTarget("EET", new VerticalConfigurationGroup(false, false)); - addTarget("Cuba", new VerticalConfigurationGroup(false, false)); - addTarget("CST6CDT", new VerticalConfigurationGroup(false, false)); - addTarget("CET", new VerticalConfigurationGroup(false, false)); -}; - -void TimezoneRegion::update_timezone_values(QString Gtimezone) -{ - QString region; - QString subregion; - region=Gtimezone.section('/',0,0); - subregion=Gtimezone.section('/',1,1); - HostTimeZoneRegion->setValue(region); - - if ( region == "US") - HostTimezoneRegion_US->setValue(subregion); - else if ( region == "Pacific") - HostTimezoneRegion_Pacific->setValue(subregion); - else if ( region == "Mideast") - HostTimezoneRegion_Mideast->setValue(subregion); - else if ( region == "Mexico") - HostTimezoneRegion_Mexico->setValue(subregion); - else if ( region == "Indian") - HostTimezoneRegion_Indian->setValue(subregion); - else if ( region == "Europe") - HostTimezoneRegion_Europe->setValue(subregion); - else if ( region == "Etc") - HostTimezoneRegion_Etc->setValue(subregion); - else if ( region == "Chile") - HostTimezoneRegion_Chile->setValue(subregion); - else if ( region == "Canada") - HostTimezoneRegion_Canada->setValue(subregion); - else if ( region == "Brazil") - HostTimezoneRegion_Brazil->setValue(subregion); - else if ( region == "Australia") - HostTimezoneRegion_Australia->setValue(subregion); - else if ( region == "Atlantic") - HostTimezoneRegion_Atlantic->setValue(subregion); - else if ( region == "Asia") - HostTimezoneRegion_Asia->setValue(subregion); - else if ( region == "Arctic") - HostTimezoneRegion_Arctic->setValue(subregion); - else if ( region == "Antarctica") - HostTimezoneRegion_Antarctica->setValue(subregion); - else if ( region == "America") - HostTimezoneRegion_America->setValue(subregion); - else if ( region == "Africa") - HostTimezoneRegion_Africa->setValue(subregion); -} - - -//________________Misc (NFS) Screen SETTINGS_________________________ -static HostComboBox *HostHaveCentralNFS() -{ - HostComboBox *gc = new HostComboBox("HostHaveCentralNFS"); - gc->setLabel(QObject::tr("Central NFS server")); - gc->addSelection("no"); - gc->addSelection("yes") ; - gc->setHelpText(QObject::tr("Select yes, if your media is stored on an NFS server different than the masterbackend. Say no if you are confused.")); - - return gc; -} - -static HostComboBox *HostCentralNFSIP() -{ - HostComboBox *gc = new HostComboBox("HostCentralNFSIP",true); - gc->setLabel(QObject::tr("NFS server and sharename ")); - gc->setHelpText(QObject::tr("Format should be IP:/SHARENAME, for example 192.168.1.6:/media. file:nfsmap will load shares from the nfsmap file")); - gc->addSelection("file:nfsmap") ; - gc->addSelection("") ; - return gc; -}; - -static HostComboBox *HostNFSmountpoint() -{ - #ifdef __MVAPP__ - HostComboBox *gc = new HostComboBox("HostNFSmountpoint"); - gc->addSelection("/data/media"); - #else - HostComboBox *gc = new HostComboBox("HostNFSmountpoint",true); - gc->addSelection("/myth"); - #endif - gc->setLabel(QObject::tr("Local mount point of NFS share")); - gc->addSelection("/mnt") ; - gc->setHelpText(QObject::tr("")); - return gc; -} - - -NFSSettings::NFSSettings(): - TriggeredConfigurationGroup(false,false,false,true,true,false,false,true) - { - setLabel(QObject::tr("Misc Settings")); - - Setting* havenfs = HostHaveCentralNFS(); - addChild(havenfs); - setTrigger(havenfs); - - ConfigurationGroup* settings = new VerticalConfigurationGroup(); - settings->addChild(HostCentralNFSIP()); - settings->addChild(HostNFSmountpoint()); - - addTarget("no", new VerticalConfigurationGroup()); - addTarget("yes", settings); - }; - diff --git a/abs/core/mythinstall/misc_settings.h b/abs/core/mythinstall/misc_settings.h deleted file mode 100755 index 66ad99c..0000000 --- a/abs/core/mythinstall/misc_settings.h +++ /dev/null @@ -1,97 +0,0 @@ -#include <mythcontext.h> -#include <unistd.h> -#include <iostream> -#include <fstream> -#include <stdio.h> -#include "settings.h" -#include "installsettings.h" -#include <qsqldatabase.h> -#include <qsqlquery.h> - -#include <stdlib.h> -#include <cstdlib> -#include <mythtv/mythdbcon.h> -#include <qdir.h> -#include <qapplication.h> -#include "util.h" - - -class MiscMainFrame: public VerticalConfigurationGroup { -Q_OBJECT -public: - MiscMainFrame(); -QTimer *autoLaunchTimer; - -public slots: - QString mf_show_tz(QString); - -signals: - void update_timezone(QString); -}; - -class MiscMainFrame2: public VerticalConfigurationGroup { -Q_OBJECT -public: - MiscMainFrame2(); -}; - - -class TimezoneButton: public VerticalConfigurationGroup { -Q_OBJECT -public: - TimezoneButton(); - TransButtonSetting *TZButton; - void disableButton(); -public slots: - void launch_tzgui(); -signals: - QString mf_launch_tzgui(); - //QString update_timezone(QString); -}; - -class TimezoneRegion: public TriggeredConfigurationGroup { -Q_OBJECT -public: - TimezoneRegion(); - HostComboBox *HostTimeZoneRegion; - HostComboBox *HostTimezoneRegion_US; - HostComboBox *HostTimezoneRegion_Pacific; - HostComboBox *HostTimezoneRegion_Mideast; - HostComboBox *HostTimezoneRegion_Mexico; - HostComboBox *HostTimezoneRegion_Indian; - HostComboBox *HostTimezoneRegion_Europe; - HostComboBox *HostTimezoneRegion_Etc; - HostComboBox *HostTimezoneRegion_Chile; - HostComboBox *HostTimezoneRegion_Canada; - HostComboBox *HostTimezoneRegion_Brazil; - HostComboBox *HostTimezoneRegion_Australia; - HostComboBox *HostTimezoneRegion_Atlantic; - HostComboBox *HostTimezoneRegion_Asia; - HostComboBox *HostTimezoneRegion_Arctic; - HostComboBox *HostTimezoneRegion_Antarctica; - HostComboBox *HostTimezoneRegion_America; - HostComboBox *HostTimezoneRegion_Africa; - void timezoneregion_fillselection(QString); - void timezoneregion_fillselection_zone(); - - -public slots: - void update_timezone_values(QString); - void timezone_gathersettings(); -signals: - void mf_show_tz(QString); -}; - - -class NFSSettings: public - TriggeredConfigurationGroup { - public: - NFSSettings(); - -}; - - - - - - diff --git a/abs/core/mythinstall/mv_common.h b/abs/core/mythinstall/mv_common.h deleted file mode 100755 index 865eb3d..0000000 --- a/abs/core/mythinstall/mv_common.h +++ /dev/null @@ -1,4 +0,0 @@ -//#define __MVAPP__ MythVantage -#define RELEASEFILE "LinHES-release" - -extern int timezone_unknown; diff --git a/abs/core/mythinstall/mythinstall.pro b/abs/core/mythinstall/mythinstall.pro deleted file mode 100755 index 0a273cc..0000000 --- a/abs/core/mythinstall/mythinstall.pro +++ /dev/null @@ -1,46 +0,0 @@ -# This is the path to the mythtv src. The assumtion is that this package and -# mythtv are both being build in the LinHES-PKGBUILD. -MYTHPATH="/data/LinHES-PKGBUILD/abs/core-testing/mythtv/stable/mythtv/src/mythtv-0.21" - -include ( $$MYTHPATH/libs/libmyth/mythconfig.mak) -include ( $$MYTHPATH/settings.pro) - -#pulled from program-libs.pro and modified to use $$MYTHPATH -INCLUDEPATH += $$MYTHPATH $$MYTHPATH/libs/ $$MYTHPATH/libs/libmyth $$MYTHPATH/libs/libmythtv -INCLUDEPATH += $$MYTHPATH/libs/libavutil $$MYTHPATH/libs/libavformat $$MYTHPATH/libs/libavcodec -INCLUDEPATH += $$MYTHPATH/libs/libmythupnp $$MYTHPATH/libs/libmythui -INCLUDEPATH += $$MYTHPATH/libs/libmythlivemedia - -LIBS += -L$$MYTHPATH/libs/libmyth -L$$MYTHPATH/libs/libmythtv -LIBS += -L$$MYTHPATH/libs/libavutil -L$$MYTHPATH/libs/libavcodec -L$$MYTHPATH/libs/libavformat -LIBS += -L$$MYTHPATH/libs/libmythfreemheg -LIBS += -L$$MYTHPATH/libs/libmythui -LIBS += -L$$MYTHPATH/libs/libmythupnp -LIBS += -L$$MYTHPATH/libs/libmythlivemedia - -LIBS += -lmythtv-$$LIBVERSION -lmythavformat-$$LIBVERSION -LIBS += -lmythavutil-$$LIBVERSION -lmythavcodec-$$LIBVERSION -LIBS += -lmythfreemheg-$$LIBVERSION -LIBS += -lmythupnp-$$LIBVERSION -LIBS += -lmythlivemedia-$$LIBVERSION - - - -TEMPLATE = app -CONFIG += thread -TARGET = mythinstall -target.path = $${PREFIX}/bin - -INSTALLS = target - -uifiles.path = $${PREFIX}/share/mythtv/themes/default -uifiles.files = install-ui.xml images/*.png - -INSTALLS += uifiles - -QMAKE_CLEAN += $(TARGET) - -# Input -HEADERS += installdialog.h installsettings.h settemplate.h installationtype.h autocard.h xorgsettings.h password_manage.h misc_settings.h mv_common.h infrared.h -SOURCES += main.cpp installdialog.cpp installsettings.cpp settemplate.cpp installationtype.cpp autocard.cpp xorgsettings.cpp password_manage.cpp misc_settings.cpp infrared.cpp -INCLUDEPATH += /usr/include/mythtv diff --git a/abs/core/mythinstall/password_manage.cpp b/abs/core/mythinstall/password_manage.cpp deleted file mode 100755 index 5156636..0000000 --- a/abs/core/mythinstall/password_manage.cpp +++ /dev/null @@ -1,445 +0,0 @@ -#include <mythcontext.h> -#include <unistd.h> -#include <iostream> -#include <fstream> -#include <stdio.h> -#include "settings.h" -#include "installsettings.h" -#include "installdialog.h" -#include "password_manage.h" -#include <qsqldatabase.h> -#include <qsqlquery.h> - -#include <stdlib.h> -#include <cstdlib> -#include <mythtv/mythdbcon.h> -#include <qdir.h> -#include <qapplication.h> -#include "util.h" -#include <qregexp.h> -/****************************************************************************/ -typedef enum { - UseraddPopup_OK = 0, - UseraddPopup_CANCEL, - UseraddPopup_DELETE -} - UseraddPopupResult; - bool passtoggle = TRUE; - QString invalid_chars = "&<>/~`;:!"; - -class AddUserPopup -{ - public: - static UseraddPopupResult showPopup(MythMainWindow *parent, QString title, - QString message, QString& text); -}; - -UseraddPopupResult AddUserPopup::showPopup(MythMainWindow *parent, - QString title, QString message, QString& text) -{ - MythPopupBox *popup = new MythPopupBox(parent, title); - popup->addLabel(message); - - MythLineEdit *textEdit = new MythLineEdit(popup, "chooseEdit"); - textEdit->setText(text); - popup->addWidget(textEdit); - - popup->addButton(QObject::tr("OK"), popup, SLOT(accept())); - popup->addButton(QObject::tr("Cancel"), popup, SLOT(reject())); - - textEdit->setFocus(); - - bool ok = (MythDialog::Accepted == popup->ExecPopup()); - if (ok) - text = QDeepCopy<QString>(textEdit->text()); - - popup->hide(); - popup->deleteLater(); - - return (ok) ? UseraddPopup_OK : UseraddPopup_CANCEL; -} - -/****************************************************************************/ - - -void UserManagement::user_fillselection() -{ - //only add users with UID above 1000 - QString line; - QString user; - QString quid; - int uid; - QFile file("/etc/passwd"); - if ( file.open(IO_ReadOnly | IO_Translate) ) - { - QTextStream t( &file ); // use a text stream - while ( !t.eof() ) - { - line = t.readLine(); - user = line.section(":",0,0); - quid = line.section(":",2,2); - uid=quid.toInt(); - if ( uid >= 1000 ) - userlist->addSelection(user); - } - file.close(); - } - -} - -bool UserManagement::user_exisit_check(QString name) -{ - QString line; - QString user; - QString quid; - bool founduser; - founduser=false; - int uid; - QFile file("/etc/passwd"); - if ( file.open(IO_ReadOnly | IO_Translate) ) - { - QTextStream t( &file ); // use a text stream - while ( !t.eof() ) - { - line = t.readLine(); - user = line.section(":",0,0); - quid = line.section(":",2,2); - uid=quid.toInt(); - if ( user == name ) - { - founduser=true; - break; - } - } - file.close(); - } - - return founduser; - -} - -bool UserManagement::user_valid_check(QString check_string) -{ - QChar current_char; - int upperlimit; - int found_char; - int i ; - upperlimit = invalid_chars.length() -1 ; - for(i= 0; i <= upperlimit; i++) - { - found_char = -1; - current_char = invalid_chars.at(i); - found_char = check_string.contains(current_char,FALSE); - if ( found_char > 0 ) - return FALSE; - } - return TRUE ; - -} - -UserManagement::UserManagement(): - VerticalConfigurationGroup(false,false,false,false) - { - setLabel(QObject::tr("Password Management")); - userlist = new TransComboBoxSetting(false); - userlist->setLabel(QObject::tr("Current Accounts")); - userlist->addSelection("root"); - userlist->addSelection("mythtv"); - user_fillselection(); - userlist->setHelpText(QObject::tr("Select the account for password reset")); - - userpass1= new TransLineEditSetting(true); - userpass1->setLabel("Password"); - userpass1->SetPasswordEcho(passtoggle); - userpass1->setHelpText(QObject::tr("The following characters will not be accepted: " + invalid_chars)); - - - passToggleButton = new TransButtonSetting; - passToggleButton->setLabel("Toggle password view"); - passToggleButton->setHelpText(QObject::tr("Hide or show the password")); - - info = new TransLabelSetting; - info->setValue(""); - - userapplyButton = new TransButtonSetting; - userapplyButton->setLabel("Apply new password"); - - usercreateButton = new TransButtonSetting; - usercreateButton->setLabel("Create a new user account"); - usercreateButton->setHelpText(QObject::tr("The following characters will not be accepted: " + invalid_chars)); - - userdeleteButton = new TransButtonSetting; - userdeleteButton->setLabel("Delete current account"); - ConfigurationGroup *buttonlist = new GridConfigurationGroup(2,false); - buttonlist-> addChild(usercreateButton); - buttonlist-> addChild(userdeleteButton); - - ConfigurationGroup *buttonlist2 = new GridConfigurationGroup(2,false); - buttonlist2-> addChild(passToggleButton); - buttonlist2-> addChild(userapplyButton); - - rootSSH = new HostCheckBox("HOSTrootSSH"); - rootSSH->setLabel("Enable remote access for the root account."); - rootSSH->setHelpText(QObject::tr("Checking this will enable ssh for the root account. Leave this disabled unless you know what your doing.")); - rootSSH->setValue(false); - - addChild(userlist); - addChild(buttonlist); - addChild(userpass1); - addChild(info); - addChild(rootSSH); - addChild(buttonlist2); - - connect(userapplyButton, SIGNAL(pressed()), this, SLOT(applychanges())); - connect(userlist, SIGNAL(valueChanged(const QString&)), this, SLOT(userchanged())); - connect(usercreateButton, SIGNAL(pressed()), this, SLOT(usercreatepopup())); - connect(userdeleteButton, SIGNAL(pressed()), this, SLOT(userdeletepopup())); - connect(passToggleButton, SIGNAL(pressed()), this, SLOT(togglepass())); -}; - -void UserManagement::togglepass() -{ - - if ( passtoggle) - passtoggle = false; - else - passtoggle = true; - userpass1->SetPasswordEcho(passtoggle); -} - -void UserManagement::applychanges() -{ - QString user; - QString password; - QString user_e; - - user=userlist->getValue(); - password=userpass1->getValue(); - - user_e = QRegExp::escape( user ); - password = QRegExp::escape( password ); - if ( ! user_valid_check (password)) - { - info->setValue(" Password contains invalid characters!"); - return; - } - info->setValue(" Password has been changed for user: " + user ); - QString cmdtxt; - cmdtxt="sudo "; - cmdtxt.append("myth_user_call -c pass -u " + user_e + " -p " + password ); - myth_system(cmdtxt); - - -} - -void UserManagement::userchanged() -{ - info->setValue(" "); - userpass1->setValue(""); -} - -void UserManagement::usercreatepopup() -{ - QString name; - QString name_e; - int key = 0; - UseraddPopupResult result = AddUserPopup::showPopup( - gContext->GetMainWindow(), - tr(""), - tr("Enter a new user account name"), name); - if (result == UseraddPopup_CANCEL) - return; - //check if name exisit || add it - if ( user_exisit_check(name) ) - { - info->setValue(name + " Already present"); - userlist->setFocus(); - key = Qt::Key_Down; - QApplication::postEvent(gContext->GetMainWindow(), - new ExternalKeycodeEvent(key)); - - return; - } - - if ( ! user_valid_check (name)) - { - info->setValue(" Username contains invalid characters!"); - return; - } - userlist->addSelection(name); - userlist->setValue(name); - //run program to add user right here - QString cmdtxt; - name_e = QRegExp::escape( name ); - - cmdtxt="sudo "; - cmdtxt.append("myth_user_call -c add -u " + name_e ); - myth_system(cmdtxt); - - info->setValue("Now enter a password for " + name + " and press the apply button."); - //Set focus to userlist, then press down three times to set focus to the password box. - userlist->setFocus(); - - key = Qt::Key_Down; - QApplication::postEvent(gContext->GetMainWindow(), - new ExternalKeycodeEvent(key)); - key = Qt::Key_Down; - QApplication::postEvent(gContext->GetMainWindow(), - new ExternalKeycodeEvent(key)); - key = Qt::Key_Down; - QApplication::postEvent(gContext->GetMainWindow(), - new ExternalKeycodeEvent(key)); - -} - -void UserManagement::userdeletepopup() -{ - QString user; - QString user_e; - user=userlist->getValue(); - QString message = user ; - - DialogCode value = MythPopupBox::Show2ButtonPopup( - gContext->GetMainWindow(), "", message, - tr("Remove this account"), - tr("Do not remove this account"), - kDialogCodeButton1); - - if (kDialogCodeButton0 == value) - { - info->setValue("removed account: " + user); - if ( user == "root" || user == "mythtv" ) - { - info->setValue("Can not remove the account"); - return; - } - userlist->setValue("root"); - userlist->removeSelection(user); - //run program to remove user - QString cmdtxt; - user_e = QRegExp::escape( user ); - cmdtxt="sudo "; - cmdtxt.append("myth_user_call -c delete -u " + user_e ); - myth_system(cmdtxt); - info->setValue("Removed account: " + user); - } - else - info->setValue("Did not remove account: " + user); -} - -WebPassword::WebPassword(): - TriggeredConfigurationGroup(true,false,true,true,true,true,true,true) -{ - - webAuth = new HostCheckBox("HOSTwebauth"); - webAuth->setLabel("Enable password"); - webAuth->setHelpText(QObject::tr("Enable the use of password protection for the local website.")); - webAuth->setValue(false); - webuser = new HostLineEdit("Hostwebuser"); - webuser->setLabel("Username"); - webuser->setHelpText(QObject::tr("The following characters will not be accepted: " + invalid_chars)); - - webpassword = new HostLineEdit("Hostwebpassword"); - webpassword->setLabel("Password"); - webpassword->SetPasswordEcho(passtoggle); - webpassword->setHelpText(QObject::tr("The following characters will not be accepted: " + invalid_chars)); - - webpassToggleButton = new TransButtonSetting; - webpassToggleButton->setLabel("Toggle password view"); - webpassToggleButton->setHelpText(QObject::tr("Hide or show the password")); - - webapplyButton = new TransButtonSetting; - webapplyButton->setLabel("Apply new password"); - - info = new TransLabelSetting; - info->setValue(""); - - connect(webpassToggleButton, SIGNAL(pressed()), this, SLOT(togglepass())); - connect(webapplyButton, SIGNAL(pressed()),this , SLOT(webpassword_gathersettings())); - - ConfigurationGroup* webpassgroup = new VerticalConfigurationGroup(false); - webpassgroup->addChild(webuser); - webpassgroup->addChild(webpassword); - webpassgroup->addChild(info); - webpassgroup->addChild(webpassToggleButton); - webpassgroup->addChild(webapplyButton); - - addChild(webAuth); - setTrigger(webAuth); - - addTarget("0", new VerticalConfigurationGroup(false, false)); - addTarget("1", webpassgroup); - -} - - -void WebPassword::togglepass() -{ - if ( passtoggle) - passtoggle = false; - else - passtoggle = true; - webpassword->SetPasswordEcho(passtoggle); -} - -bool WebPassword::valid_check(QString check_string) -{ - // QString invalid_chars; - QChar current_char; - int upperlimit; - int found_char; - int i ; - //invalid_chars = "&<>/~`;"; - upperlimit = invalid_chars.length() -1 ; - for(i= 0; i <= upperlimit; i++) - { - found_char = -1; - current_char = invalid_chars.at(i); - found_char = check_string.contains(current_char,FALSE); - if ( found_char > 0 ) - return FALSE; - } - return TRUE ; - -} - -void WebPassword::webpassword_gathersettings() -{ - - QString pass_enabled; - QString web_user; - QString web_pass; - QString webuser_e; - QString webpass_e; - pass_enabled=webAuth->getValue(); - web_user=webuser->getValue(); - web_pass=webpassword->getValue(); - webuser_e = QRegExp::escape( web_user ); - webpass_e = QRegExp::escape( web_pass ); - if ( ! valid_check (webuser_e)) - { - info->setValue(" Username contains invalid characters!"); - return; - } - - if ( ! valid_check (webpass_e)) - { - info->setValue(" Password contains invalid characters!"); - return; - } - cout << "Running program to make the changes for web password" << endl; - QString cmdtxt; - - cmdtxt="sudo "; - cmdtxt.append("myth_user_call -c web -u " + webuser_e + " -p " + webpass_e ); - myth_system(cmdtxt); - info->setValue(" Changes applied"); - -} - -WebPasswordFrame::WebPasswordFrame(): - VerticalConfigurationGroup() -{ - WebPassword *webpassword = new WebPassword(); - addChild(webpassword); -} diff --git a/abs/core/mythinstall/password_manage.h b/abs/core/mythinstall/password_manage.h deleted file mode 100755 index 665f23f..0000000 --- a/abs/core/mythinstall/password_manage.h +++ /dev/null @@ -1,60 +0,0 @@ -#include <settings.h> -#include "mythdialogs.h" -#include "libmyth/mythdialogs.h" -#include "libmyth/mythwidgets.h" -#include "installsettings.h" - - -class UserManagement: public VerticalConfigurationGroup { - Q_OBJECT -public: - UserManagement(); - TransComboBoxSetting *userlist; - TransLineEditSetting *userpass1; - TransButtonSetting *userapplyButton; - TransButtonSetting *usercreateButton; - TransButtonSetting *userdeleteButton; - TransButtonSetting *passToggleButton; - TransLabelSetting *info; - TransCheckBoxSetting *lockaccount; - HostCheckBox *rootSSH; - void user_fillselection(void); - bool user_exisit_check(QString); - bool user_valid_check(QString); - -public slots: - void applychanges(); - void userchanged(); - void usercreatepopup(); - void userdeletepopup(); - void togglepass(); -}; - - - -class WebPassword: public - TriggeredConfigurationGroup { - Q_OBJECT -public: - WebPassword(); - HostLineEdit *webuser; - HostLineEdit *webpassword; - HostCheckBox *webAuth; - TransButtonSetting *webpassToggleButton; - TransLabelSetting *info; - bool valid_check(QString); - TransButtonSetting *webapplyButton; - -public slots: - void webpassword_gathersettings(); - void togglepass(); -}; - -class WebPasswordFrame: public - VerticalConfigurationGroup { - Q_OBJECT -public: - WebPasswordFrame(); - TransButtonSetting *webapplyButton; - -}; diff --git a/abs/core/mythinstall/settemplate.cpp b/abs/core/mythinstall/settemplate.cpp deleted file mode 100755 index c12ef06..0000000 --- a/abs/core/mythinstall/settemplate.cpp +++ /dev/null @@ -1,419 +0,0 @@ -#include <mythcontext.h> -#include <unistd.h> -#include <iostream> -#include <fstream> -#include <stdio.h> -#include "settings.h" -#include "installsettings.h" -#include "installdialog.h" -#include "settemplate.h" -#include <qsqldatabase.h> -#include <qsqlquery.h> -#include <stdlib.h> -#include <cstdlib> - -#include <mythtv/mythdbcon.h> - -void create_temp_table (QString create_table_name,QString like_name) -{ - MSqlQuery query(MSqlQuery::InitCon()); - query.prepare("create table " + create_table_name + " like " + like_name + ";" ); - query.exec(); - if ( like_name == "settings") - { - query.prepare("Alter table " + create_table_name + " add unique ( value ) ; " ); - query.exec(); - } - query.prepare(" truncate " + create_table_name + ";" ); - query.exec(); -}; - -void drop_temp_table (QString tname) -{ - MSqlQuery query(MSqlQuery::InitCon()); - query.prepare("drop table " + tname + ";" ); - query.exec(); -} - -void restart_frontend () -{ - - QString cmdtxt; - cmdtxt=MV_ROOT ; - cmdtxt.append("bin/systemconfig.sh reloadfe" ); - cout << "Calling systemconfig.sh reloadfe" << endl; - system(cmdtxt); - //system("/root/systemconfig.sh reloadfe" ); -} - -void choosetemplate (QString templateop, QString templatename , QString templatehostname = "") -{ - if ( templateop == "" ) - { - MythCtemplate setting; - setting.load(); - setting.save(); - setting.exec(); - }; - - QString thistemplate; - QString thisoperation; - QString thishost; - //QString runcommand = "/root/restore_default_settings.sh"; - QString runcommand = "echo "; - // cout << templateop << endl; - // cout << templatename << endl; - // cout << templatehostname << endl; - - if (templateop == "") - thisoperation = gContext -> GetSetting("HOSTtemplatetype"); - else - thisoperation = templateop; - - thistemplate = "none"; - - - if ( thisoperation == "save" ) - { - if (templatename == "" ) - thistemplate = gContext -> GetSetting("HostTemplateSave"); - else - thistemplate = templatename; - - savesettings(thistemplate); - } - else if ( thisoperation == "restore" ) - { - if (templatename == "" ) - thistemplate = gContext -> GetSetting("HostTemplateRestore"); - else - thistemplate = templatename; - - if ( thistemplate == "default_1") - c_from("default_1" , thistemplate); - else if ( thistemplate == "default_2") - c_from("default_2" ,thistemplate); - else - restoresettings(thistemplate); - - } - else if ( thisoperation == "copy_from" ) - { - if (templatename == "" ) - { - thishost = gContext ->GetSetting("HostSelectcopy_from"); - thistemplate = gContext ->GetSetting("HostTemplateRestore"); - } - else - { - thishost=templatehostname; - thistemplate=templatename; - }; - - c_from(thishost,thistemplate); - } - - -// if ( thistemplate != "none" ) -// { -// std::cout << runcommand << endl; - // system(runcommand); - //} -}; - - -void savesettings (QString templatenumber ) -{ - cout << "SAVING....." << templatenumber << endl; - QString templatename = "settings_" + templatenumber ; - // Remove old saved values - MSqlQuery query(MSqlQuery::InitCon()); - query.prepare( "delete from " + templatename + " where hostname=:HOSTNAME ;" ); - query.bindValue( ":HOSTNAME" , gContext->GetHostName() ); - query.exec(); - //insert all new settings - query.prepare( "replace into " + templatename + " (select * from settings where hostname=:HOSTNAME ) ;" ) ; - query.bindValue( ":HOSTNAME" , gContext->GetHostName() ); - query.exec(); - - // repeat for keybindings - templatename = "keybindings_" + templatenumber ; - query.prepare( "delete from " + templatename + " where hostname=:HOSTNAME ;" ); - query.bindValue( ":HOSTNAME" , gContext->GetHostName() ); - query.exec(); - - query.prepare( "replace into " + templatename + " (select * from keybindings where hostname=:HOSTNAME ) ;" ); - query.bindValue( ":HOSTNAME" , gContext->GetHostName() ); - query.exec(); - -} - -void restoresettings (QString templatenumber ) -{ - cout << "RESTORING....." << templatenumber << endl; -// DEFAULT settings are handled by the copy from routine - MSqlQuery query(MSqlQuery::InitCon()); - QStringList tablelist ; - QStringList::Iterator it; - QString current_table; - tablelist.append ("settings"); - tablelist.append ("keybindings"); - QString templatename; - - for ( it = tablelist.begin(); it != tablelist.end(); ++it ) - { - current_table = *it ; - //find template table to use - QString templatename = current_table + "_" + templatenumber ; - QString temptable="temp_table_" + current_table + "_" + gContext->GetHostName() ; - // create temp table for merging settings, The merge is needed to accoutn for any new settings. - create_temp_table(temptable, current_table ); - - // copy in current settings - query.prepare( "replace into " + temptable + " (select * from " + current_table + " where hostname=:HOSTNAME ) ; " ); - query.bindValue( ":HOSTNAME" , gContext->GetHostName() ); - query.exec(); - - // need to remove all non HOST settigns - - // copy in stored settings - query.prepare( "replace into " + temptable + " (select * from " + templatename + " where hostname=:HOSTNAME ) ; " ); - query.bindValue( ":HOSTNAME" , gContext->GetHostName() ); - query.exec(); - - // remove current settings. Need to remove because the old table allows for duplicates and replace into doesn' seem to "replace" - query.prepare( "delete from " + current_table + " where hostname=:HOSTNAME ;" ); - query.bindValue( ":HOSTNAME" , gContext->GetHostName() ); - query.exec(); - - - // copy new settings from temp to current - query.prepare( "replace into " + current_table + " (select * from " + temptable + " );" ); - query.exec(); - - // drop temptable - drop_temp_table(temptable); - - } -restart_frontend(); -}; - -void c_from(QString copyhost, QString templatenumber) -{ - cout << "Copying....." + copyhost + " " + "templatenumber" << endl; - MSqlQuery query(MSqlQuery::InitCon()); - //Create temp table, copy in settings from host_template, update hostname for new host,copy temp_table to settings. - QStringList tablelist ; - QStringList::Iterator it; - QString current_table ; - tablelist.append ("settings"); - tablelist.append ("keybindings"); - QString templatename; - QString temptable; - for ( it = tablelist.begin(); it != tablelist.end(); ++it ) - { - current_table = *it ; - cout << current_table << endl; - //find template table to use - if ( templatenumber == "Current" ) - templatename = current_table ; - else - templatename = current_table + "_" + templatenumber ; - - temptable="temp_table_" + current_table + "_" + gContext->GetHostName() ; - // create temp table for merging settings - - create_temp_table(temptable, current_table ); - cout << temptable + " " + current_table << endl; - - // copy current settings from this host into temptable minus all Mythvantage settings - if ( current_table == "settings") - { - query.prepare( "replace into " + temptable + " (select * from " + current_table + " where hostname=:HOSTNAME and value not like 'HOST%' ) ; " ); - query.bindValue( ":HOSTNAME" , gContext->GetHostName() ); - } - else - query.prepare( "replace into " + temptable + " (select * from " + current_table + " where hostname=:HOSTNAME ) ; " ); - query.bindValue( ":HOSTNAME" , gContext->GetHostName() ); - query.exec(); - - // update hostname to match whatever the hostname of the template is - query.prepare ("update " + temptable + " set hostname=:HOSTNAME ; " ); - query.bindValue( ":HOSTNAME" , copyhost ); - query.exec(); - - // copy current settings from copy host into temptable minus all Mythvantage settings - if ( current_table == "settings") - query.prepare( "replace into " + temptable + " (select * from " + templatename + " where hostname=:HOSTNAME and value not like 'HOST%' ) ; " ); - - else - query.prepare( "replace into " + temptable + " (select * from " + templatename + " where hostname=:HOSTNAME ) ; " ); - - query.bindValue( ":HOSTNAME" , copyhost ); - query.exec(); - - //update hostname - query.prepare ("update " + temptable + " set hostname=:HOSTNAME ; " ); - query.bindValue( ":HOSTNAME" , gContext->GetHostName() ); - query.exec(); - - // delete old settings from settings table - if ( current_table == "settings") - { - query.prepare( "delete from " + current_table + " where hostname=:HOSTNAME and value not like 'HOST%' ;" ); - query.bindValue( ":HOSTNAME" , gContext->GetHostName() ); - } - else - { - query.prepare( "delete from " + current_table + " where hostname=:HOSTNAME ;" ); - query.bindValue( ":HOSTNAME" , gContext->GetHostName() ); - } - query.exec(); - - // copy settings from temptable to settings - if ( current_table == "settings") - query.prepare( "replace into " + current_table + " (select * from " + temptable + " where value not like 'HOST% ' ) ;" ); - else - query.prepare( "replace into " + current_table + " (select * from " + temptable + " );" ); - - - query.exec(); - - // drop temptable - // drop_temp_table(temptable); - - -restart_frontend(); -}; - - -}; - - - - - static HostComboBox *HOSTtemplatetype() -{ - HostComboBox *gc = new HostComboBox("HOSTtemplatetype"); - gc->setLabel(QObject::tr("Template options")); - gc->addSelection("Do Nothing") ; - gc->addSelection("restore"); - gc->addSelection("save") ; - gc->addSelection("copy_from"); - - gc->setHelpText(QObject::tr("Select the name to save, this will make a copy of your keybindings and videoplayback. Choose none if you do not wish to change anything.")); - - return gc; -} - - static HostComboBox *HostTemplateSave() -{ - HostComboBox *gc = new HostComboBox("HostTemplateSave"); - gc->setLabel(QObject::tr("Save Template")); - // gc->addSelection("none"); - gc->addSelection("user1") ; - gc->addSelection("user2") ; - gc->addSelection("user3") ; - gc->setHelpText(QObject::tr("Select the name to save, this will make a copy of your keybindings and videoplayback. Choose none if you do not wish to change anything.")); - - return gc; -} - static HostComboBox *HostTemplateCopy_restore() -{ - HostComboBox *gc = new HostComboBox("HostTemplateRestore"); - gc->setLabel(QObject::tr("Template")); - // gc->addSelection("none"); - gc->addSelection("Current"); - gc->addSelection("user1") ; - gc->addSelection("user2") ; - gc->addSelection("user3") ; - gc->setHelpText(QObject::tr("Select the template you wish to restore. This will change the way Myth repsonds to you remote buttons. Choose none if you do not wish to change anything.")); - - return gc; -} - - static HostComboBox *HostTemplateRestore() -{ - HostComboBox *gc = new HostComboBox("HostTemplateRestore"); - gc->setLabel(QObject::tr("Template")); - // gc->addSelection("none"); - gc->addSelection("default_1"); - gc->addSelection("default_2"); - gc->addSelection("user1") ; - gc->addSelection("user2") ; - gc->addSelection("user3") ; - gc->setHelpText(QObject::tr("Select the template you wish to restore. This will change the way Myth repsonds to you remote buttons. Choose none if you do not wish to change anything.")); - - return gc; -} - - static HostComboBox *HostSelectcopy_from() -{ - HostComboBox *gc = new HostComboBox("HostSelectcopy_from"); - gc->setLabel(QObject::tr("Host")); - // gc->addSelection("none"); - - QString tempItem; - - MSqlQuery query(MSqlQuery::InitCon()); - - query.prepare( "SELECT DISTINCT hostname from settings where hostname is not null;"); - - if (query.exec() && query.isActive() && query.size() > 0) - { - while (query.next()) - { - tempItem = query.value(0).toString(); - gc->addSelection(tempItem); - - } - } - gc->setHelpText(QObject::tr("Select the Host you wish to copy settings from.")); - - return gc; -} - -class TemplateSettings: - public TriggeredConfigurationGroup { -public: - TemplateSettings(): - //ConfigurationGroup(false, true, false, false), - //VerticalConfigurationGroup(false, true, false, false), - TriggeredConfigurationGroup(true) { - setLabel(QObject::tr("Manage templates")); -// setUseLabel(false); - - Setting* Mtemplate = HOSTtemplatetype(); - addChild(Mtemplate); - setTrigger(Mtemplate); - - - ConfigurationGroup* trestore = new VerticalConfigurationGroup(false); - trestore->addChild(HostTemplateRestore()); - - ConfigurationGroup* tsave = new VerticalConfigurationGroup(false); - tsave->addChild(HostTemplateSave()); - - ConfigurationGroup* tcopy = new VerticalConfigurationGroup(false); - tcopy->addChild(HostSelectcopy_from()); - tcopy->addChild(HostTemplateCopy_restore()); - - - addTarget("Do Nothing", new VerticalConfigurationGroup(true)); - addTarget("restore", trestore); - addTarget("save", tsave); - addTarget("copy_from", tcopy); - - }; -}; - -MythCtemplate::MythCtemplate() -{ - - TemplateSettings *templatesettings = new TemplateSettings(); - addChild(templatesettings); - -} - - - diff --git a/abs/core/mythinstall/settemplate.h b/abs/core/mythinstall/settemplate.h deleted file mode 100755 index a730cf5..0000000 --- a/abs/core/mythinstall/settemplate.h +++ /dev/null @@ -1,13 +0,0 @@ -#include <settings.h> -#include "mythdialogs.h" - -class MythCtemplate: public ConfigurationWizard { -public: - MythCtemplate(); - -}; - -void choosetemplate(QString,QString,QString); -void savesettings(QString); -void restoresettings(QString); -void c_from(QString , QString="current" ); diff --git a/abs/core/mythinstall/statusbox.cpp b/abs/core/mythinstall/statusbox.cpp deleted file mode 100755 index fd8a6cd..0000000 --- a/abs/core/mythinstall/statusbox.cpp +++ /dev/null @@ -1,1411 +0,0 @@ -#include <qlayout.h> -#include <qiconview.h> -#include <qsqldatabase.h> -#include <qwidgetstack.h> -#include <qvbox.h> -#include <qgrid.h> -#include <qregexp.h> -#include <qhostaddress.h> - -#include <unistd.h> - -#include <iostream> -#include <cerrno> -using namespace std; - -#include "config.h" -#include "statusbox.h" -#include "mythcontext.h" -#include "remoteutil.h" -#include "programinfo.h" -#include "tv.h" -#include "jobqueue.h" -#include "util.h" -#include "mythdbcon.h" -#include "cardutil.h" - -#define REC_CAN_BE_DELETED(rec) \ - ((((rec)->programflags & FL_INUSEPLAYING) == 0) && \ - ((((rec)->programflags & FL_INUSERECORDING) == 0) || \ - ((rec)->recgroup != "LiveTV"))) - - -/** \class StatusBox - * \brief Reports on various status items. - * - * StatusBox reports on the listing status, that is how far - * into the future program listings exits. It also reports - * on the status of each tuner, the log entries, the status - * of the job queue, and the machine status. - */ - -StatusBox::StatusBox(MythMainWindow *parent, const char *name) - : MythDialog(parent, name), errored(false) -{ - // Set this value to the number of items in icon_list - // to prevent scrolling off the bottom - int item_count = 0; - dateFormat = gContext->GetSetting("ShortDateFormat", "M/d"); - timeFormat = gContext->GetSetting("TimeFormat", "h:mm AP"); - timeDateFormat = timeFormat + " " + dateFormat; - - setNoErase(); - LoadTheme(); - if (IsErrored()) - return; - - icon_list->SetItemText(item_count++, QObject::tr("Listings Status")); - icon_list->SetItemText(item_count++, QObject::tr("Tuner Status")); - icon_list->SetItemText(item_count++, QObject::tr("Log Entries")); - icon_list->SetItemText(item_count++, QObject::tr("Job Queue")); - icon_list->SetItemText(item_count++, QObject::tr("Machine Status")); - icon_list->SetItemText(item_count++, QObject::tr("AutoExpire List")); - icon_list->SetItemCurrent(0); - icon_list->SetActive(true); - - QStringList strlist; - strlist << "QUERY_IS_ACTIVE_BACKEND"; - strlist << gContext->GetHostName(); - - gContext->SendReceiveStringList(strlist); - - if (QString(strlist[0]) == "FALSE") - isBackend = false; - else if (QString(strlist[0]) == "TRUE") - isBackend = true; - else - isBackend = false; - - VERBOSE(VB_NETWORK, QString("QUERY_IS_ACTIVE_BACKEND=%1").arg(strlist[0])); - - max_icons = item_count; - inContent = false; - contentPos = 0; - contentTotalLines = 0; - contentSize = 0; - contentMid = 0; - min_level = gContext->GetNumSetting("LogDefaultView",5); - my_parent = parent; - clicked(); - - gContext->addCurrentLocation("StatusBox"); -} - -StatusBox::~StatusBox(void) -{ - gContext->removeCurrentLocation(); -} - -void StatusBox::paintEvent(QPaintEvent *e) -{ - QRect r = e->rect(); - - if (r.intersects(TopRect)) - updateTopBar(); - if (r.intersects(SelectRect)) - updateSelector(); - if (r.intersects(ContentRect)) - updateContent(); -} - -void StatusBox::updateContent() -{ - QRect pr = ContentRect; - QPixmap pix(pr.size()); - pix.fill(this, pr.topLeft()); - QPainter tmp(&pix); - QPainter p(this); - - // Normalize the variables here and set the contentMid - contentSize = list_area->GetItems(); - if (contentSize > contentTotalLines) - contentSize = contentTotalLines; - contentMid = contentSize / 2; - - int startPos = 0; - int highlightPos = 0; - - if (contentPos < contentMid) - { - startPos = 0; - highlightPos = contentPos; - } - else if (contentPos >= (contentTotalLines - contentMid)) - { - startPos = contentTotalLines - contentSize; - highlightPos = contentSize - (contentTotalLines - contentPos); - } - else if (contentPos >= contentMid) - { - startPos = contentPos - contentMid; - highlightPos = contentMid; - } - - if (content == NULL) return; - LayerSet *container = content; - - list_area->ResetList(); - for (int x = startPos; (x - startPos) <= contentSize; x++) - { - if (contentLines.contains(x)) - { - list_area->SetItemText(x - startPos, contentLines[x]); - if (contentFont.contains(x)) - list_area->EnableForcedFont(x - startPos, contentFont[x]); - } - } - - list_area->SetItemCurrent(highlightPos); - - if (inContent) - { - helptext->SetText(contentDetail[contentPos]); - update(TopRect); - } - - list_area->SetUpArrow((startPos > 0) && (contentSize < contentTotalLines)); - list_area->SetDownArrow((startPos + contentSize) < contentTotalLines); - - container->Draw(&tmp, 0, 0); - container->Draw(&tmp, 1, 0); - container->Draw(&tmp, 2, 0); - container->Draw(&tmp, 3, 0); - container->Draw(&tmp, 4, 0); - container->Draw(&tmp, 5, 0); - container->Draw(&tmp, 6, 0); - container->Draw(&tmp, 7, 0); - container->Draw(&tmp, 8, 0); - tmp.end(); - p.drawPixmap(pr.topLeft(), pix); -} - -void StatusBox::updateSelector() -{ - QRect pr = SelectRect; - QPixmap pix(pr.size()); - pix.fill(this, pr.topLeft()); - QPainter tmp(&pix); - QPainter p(this); - - if (selector == NULL) return; - LayerSet *container = selector; - - container->Draw(&tmp, 0, 0); - container->Draw(&tmp, 1, 0); - container->Draw(&tmp, 2, 0); - container->Draw(&tmp, 3, 0); - container->Draw(&tmp, 4, 0); - container->Draw(&tmp, 5, 0); - container->Draw(&tmp, 6, 0); - container->Draw(&tmp, 7, 0); - container->Draw(&tmp, 8, 0); - tmp.end(); - p.drawPixmap(pr.topLeft(), pix); -} - -void StatusBox::updateTopBar() -{ - QRect pr = TopRect; - QPixmap pix(pr.size()); - pix.fill(this, pr.topLeft()); - QPainter tmp(&pix); - QPainter p(this); - - if (topbar == NULL) return; - LayerSet *container = topbar; - - container->Draw(&tmp, 0, 0); - tmp.end(); - p.drawPixmap(pr.topLeft(), pix); -} - -void StatusBox::LoadTheme() -{ - int screenheight = 0, screenwidth = 0; - float wmult = 0, hmult = 0; - - gContext->GetScreenSettings(screenwidth, wmult, screenheight, hmult); - - theme = new XMLParse(); - theme->SetWMult(wmult); - theme->SetHMult(hmult); - if (!theme->LoadTheme(xmldata, "status", "status-")) - { - VERBOSE(VB_IMPORTANT, "StatusBox: Unable to load theme."); - errored = true; - return; - } - - for (QDomNode child = xmldata.firstChild(); !child.isNull(); - child = child.nextSibling()) { - - QDomElement e = child.toElement(); - if (!e.isNull()) { - if (e.tagName() == "font") { - theme->parseFont(e); - } - else if (e.tagName() == "container") { - QRect area; - QString name; - int context; - theme->parseContainer(e, name, context, area); - - if (name.lower() == "topbar") - TopRect = area; - if (name.lower() == "selector") - SelectRect = area; - if (name.lower() == "content") - ContentRect = area; - } - else { - QString msg = - QString(tr("The theme you are using contains an " - "unknown element ('%1'). It will be ignored")) - .arg(e.tagName()); - VERBOSE(VB_IMPORTANT, msg); - errored = true; - } - } - } - - selector = theme->GetSet("selector"); - if (!selector) - { - VERBOSE(VB_IMPORTANT, "StatusBox: Failed to get selector container."); - errored = true; - } - - icon_list = (UIListType*)selector->GetType("icon_list"); - if (!icon_list) - { - VERBOSE(VB_IMPORTANT, "StatusBox: Failed to get icon list area."); - errored = true; - } - - content = theme->GetSet("content"); - if (!content) - { - VERBOSE(VB_IMPORTANT, "StatusBox: Failed to get content container."); - errored = true; - } - - list_area = (UIListType*)content->GetType("list_area"); - if (!list_area) - { - VERBOSE(VB_IMPORTANT, "StatusBox: Failed to get list area."); - errored = true; - } - - topbar = theme->GetSet("topbar"); - if (!topbar) - { - VERBOSE(VB_IMPORTANT, "StatusBox: Failed to get topbar container."); - errored = true; - } - - heading = (UITextType*)topbar->GetType("heading"); - if (!heading) - { - VERBOSE(VB_IMPORTANT, "StatusBox: Failed to get heading area."); - errored = true; - } - - helptext = (UITextType*)topbar->GetType("helptext"); - if (!helptext) - { - VERBOSE(VB_IMPORTANT, "StatusBox: Failed to get helptext area."); - errored = true; - } -} - -void StatusBox::keyPressEvent(QKeyEvent *e) -{ - bool handled = false; - QStringList actions; - gContext->GetMainWindow()->TranslateKeyPress("Status", e, actions); - - for (unsigned int i = 0; i < actions.size() && !handled; i++) - { - QString action = actions[i]; - QString currentItem; - QRegExp logNumberKeys( "^[12345678]$" ); - - currentItem = icon_list->GetItemText(icon_list->GetCurrentItem()); - handled = true; - - if (action == "SELECT") - { - clicked(); - } - else if (action == "MENU") - { - if ((inContent) && - (currentItem == QObject::tr("Log Entries"))) - { - int retval = MythPopupBox::show2ButtonPopup(my_parent, - QString("AckLogEntry"), - QObject::tr("Acknowledge all log entries at " - "this priority level or lower?"), - QObject::tr("Yes"), QObject::tr("No"), 0); - if (retval == 0) - { - MSqlQuery query(MSqlQuery::InitCon()); - query.prepare("UPDATE mythlog SET acknowledged = 1 " - "WHERE priority <= :PRIORITY ;"); - query.bindValue(":PRIORITY", min_level); - query.exec(); - doLogEntries(); - } - } - else if ((inContent) && - (currentItem == QObject::tr("Job Queue"))) - { - clicked(); - } - } - else if (action == "UP") - { - if (inContent) - { - if (contentPos > 0) - contentPos--; - update(ContentRect); - } - else - { - if (icon_list->GetCurrentItem() > 0) - icon_list->SetItemCurrent(icon_list->GetCurrentItem()-1); - clicked(); - setHelpText(); - update(SelectRect); - } - - } - else if (action == "DOWN") - { - if (inContent) - { - if (contentPos < (contentTotalLines - 1)) - contentPos++; - update(ContentRect); - } - else - { - if (icon_list->GetCurrentItem() < (max_icons - 1)) - icon_list->SetItemCurrent(icon_list->GetCurrentItem()+1); - clicked(); - setHelpText(); - update(SelectRect); - } - } - else if (action == "PAGEUP" && inContent) - { - contentPos -= contentSize; - if (contentPos < 0) - contentPos = 0; - update(ContentRect); - } - else if (action == "PAGEDOWN" && inContent) - { - contentPos += contentSize; - if (contentPos > (contentTotalLines - 1)) - contentPos = contentTotalLines - 1; - update(ContentRect); - } - else if ((action == "RIGHT") && - (!inContent) && - ((contentTotalLines > contentSize) || - (doScroll))) - { - clicked(); - inContent = true; - contentPos = 0; - icon_list->SetActive(false); - list_area->SetActive(true); - update(SelectRect); - update(ContentRect); - } - else if (action == "LEFT") - { - if (inContent) - { - inContent = false; - contentPos = 0; - list_area->SetActive(false); - icon_list->SetActive(true); - setHelpText(); - update(SelectRect); - update(ContentRect); - } - else - { - if (gContext->GetNumSetting("UseArrowAccels", 1)) - accept(); - } - } - else if ((currentItem == QObject::tr("Log Entries")) && - (logNumberKeys.search(action) == 0)) - { - min_level = action.toInt(); - helptext->SetText(QObject::tr("Setting priority level to %1") - .arg(min_level)); - update(TopRect); - doLogEntries(); - } - else - handled = false; - } - - if (!handled) - MythDialog::keyPressEvent(e); -} - -void StatusBox::setHelpText() -{ - if (inContent) - { - helptext->SetText(contentDetail[contentPos]); - } else { - topbar->ClearAllText(); - QString currentItem; - - currentItem = icon_list->GetItemText(icon_list->GetCurrentItem()); - - if (currentItem == QObject::tr("Listings Status")) - helptext->SetText(QObject::tr("Listings Status shows the latest " - "status information from " - "mythfilldatabase")); - - if (currentItem == QObject::tr("Tuner Status")) - helptext->SetText(QObject::tr("Tuner Status shows the current " - "information about the state of " - "backend tuner cards")); - - if (currentItem == QObject::tr("DVB Status")) - helptext->SetText(QObject::tr("DVB Status shows the quality " - "statistics of all DVB cards, if " - "present")); - - if (currentItem == QObject::tr("Log Entries")) - helptext->SetText(QObject::tr("Log Entries shows any unread log " - "entries from the system if you " - "have logging enabled")); - if (currentItem == QObject::tr("Job Queue")) - helptext->SetText(QObject::tr("Job Queue shows any jobs currently " - "in Myth's Job Queue such as a " - "commercial flagging job.")); - if (currentItem == QObject::tr("Machine Status")) - { - QString machineStr = QObject::tr("Machine Status shows " - "some operating system " - "statistics of this machine"); - if (!isBackend) - machineStr.append(" " + QObject::tr("and the MythTV server")); - - helptext->SetText(machineStr); - } - - if (currentItem == QObject::tr("AutoExpire List")) - helptext->SetText(QObject::tr("The AutoExpire List shows all " - "recordings which may be expired and the order of their " - "expiration. Recordings at the top of the list will be " - "expired first.")); - } - update(TopRect); -} - -void StatusBox::clicked() -{ - QString currentItem = icon_list->GetItemText(icon_list->GetCurrentItem()); - - if (inContent) - { - if (currentItem == QObject::tr("Log Entries")) - { - int retval; - - retval = MythPopupBox::show2ButtonPopup(my_parent, - QString("AckLogEntry"), - QObject::tr("Acknowledge this log entry?"), - QObject::tr("Yes"), QObject::tr("No"), 0); - if (retval == 0) - { - MSqlQuery query(MSqlQuery::InitCon()); - query.prepare("UPDATE mythlog SET acknowledged = 1 " - "WHERE logid = :LOGID ;"); - query.bindValue(":LOGID", contentData[contentPos]); - query.exec(); - doLogEntries(); - } - } - else if (currentItem == QObject::tr("Job Queue")) - { - QStringList msgs; - int jobStatus; - int retval; - - jobStatus = JobQueue::GetJobStatus( - contentData[contentPos].toInt()); - - if (jobStatus == JOB_QUEUED) - { - retval = MythPopupBox::show2ButtonPopup(my_parent, - QString("JobQueuePopup"), - QObject::tr("Delete Job?"), - QObject::tr("Yes"), - QObject::tr("No"), 1); - if (retval == 0) - { - JobQueue::DeleteJob(contentData[contentPos].toInt()); - doJobQueueStatus(); - } - } - else if ((jobStatus == JOB_PENDING) || - (jobStatus == JOB_STARTING) || - (jobStatus == JOB_RUNNING)) - { - msgs << QObject::tr("Pause"); - msgs << QObject::tr("Stop"); - msgs << QObject::tr("No Change"); - retval = MythPopupBox::showButtonPopup(my_parent, - QString("JobQueuePopup"), - QObject::tr("Job Queue Actions:"), - msgs, 2); - if (retval == 0) - { - JobQueue::PauseJob(contentData[contentPos].toInt()); - doJobQueueStatus(); - } - else if (retval == 1) - { - JobQueue::StopJob(contentData[contentPos].toInt()); - doJobQueueStatus(); - } - } - else if (jobStatus == JOB_PAUSED) - { - msgs << QObject::tr("Resume"); - msgs << QObject::tr("Stop"); - msgs << QObject::tr("No Change"); - retval = MythPopupBox::showButtonPopup(my_parent, - QString("JobQueuePopup"), - QObject::tr("Job Queue Actions:"), - msgs, 2); - if (retval == 0) - { - JobQueue::ResumeJob(contentData[contentPos].toInt()); - doJobQueueStatus(); - } - else if (retval == 1) - { - JobQueue::StopJob(contentData[contentPos].toInt()); - doJobQueueStatus(); - } - } - else if (jobStatus & JOB_DONE) - { - retval = MythPopupBox::show2ButtonPopup(my_parent, - QString("JobQueuePopup"), - QObject::tr("Requeue Job?"), - QObject::tr("Yes"), - QObject::tr("No"), 1); - if (retval == 0) - { - JobQueue::ChangeJobStatus(contentData[contentPos].toInt(), - JOB_QUEUED); - doJobQueueStatus(); - } - } - } - else if (currentItem == QObject::tr("AutoExpire List")) - { - ProgramInfo* rec; - - rec = expList[contentPos]; - - if (rec) - { - QStringList msgs; - int retval; - - msgs << QObject::tr("Delete Now"); - msgs << QObject::tr("Disable AutoExpire"); - msgs << QObject::tr("No Change"); - - retval = MythPopupBox::showButtonPopup(my_parent, - QString("AutoExpirePopup"), - QObject::tr("AutoExpire Actions:"), - msgs, 2); - - if (retval == 0 && REC_CAN_BE_DELETED(rec)) - { - RemoteDeleteRecording(rec, false, false); - } - else if (retval == 1) - { - rec->SetAutoExpire(0); - if ((rec)->recgroup == "LiveTV") - rec->ApplyRecordRecGroupChange("Default"); - } - - // Update list, prevent selected item going off bottom - doAutoExpireList(); - if (contentPos >= (int)expList.size()) - contentPos = max((int)expList.size()-1,0); - } - } - return; - } - - // Clear all visible content elements here - // I'm sure there's a better way to do this but I can't find it - content->ClearAllText(); - list_area->ResetList(); - contentLines.clear(); - contentDetail.clear(); - contentFont.clear(); - contentData.clear(); - - if (currentItem == QObject::tr("Listings Status")) - doListingsStatus(); - else if (currentItem == QObject::tr("Tuner Status")) - doTunerStatus(); - else if (currentItem == QObject::tr("Log Entries")) - doLogEntries(); - else if (currentItem == QObject::tr("Job Queue")) - doJobQueueStatus(); - else if (currentItem == QObject::tr("Machine Status")) - doMachineStatus(); - else if (currentItem == QObject::tr("AutoExpire List")) - doAutoExpireList(); -} - -void StatusBox::doListingsStatus() -{ - QString mfdLastRunStart, mfdLastRunEnd, mfdLastRunStatus, mfdNextRunStart; - QString querytext, Status, DataDirectMessage; - int DaysOfData; - QDateTime qdtNow, GuideDataThrough; - int count = 0; - - contentLines.clear(); - contentDetail.clear(); - contentFont.clear(); - doScroll = false; - - qdtNow = QDateTime::currentDateTime(); - - MSqlQuery query(MSqlQuery::InitCon()); - query.prepare("SELECT max(endtime) FROM program WHERE manualid=0;"); - query.exec(); - - if (query.isActive() && query.size()) - { - query.next(); - GuideDataThrough = QDateTime::fromString(query.value(0).toString(), - Qt::ISODate); - } - - mfdLastRunStart = gContext->GetSetting("mythfilldatabaseLastRunStart"); - mfdLastRunEnd = gContext->GetSetting("mythfilldatabaseLastRunEnd"); - mfdLastRunStatus = gContext->GetSetting("mythfilldatabaseLastRunStatus"); - mfdNextRunStart = gContext->GetSetting("MythFillSuggestedRunTime"); - DataDirectMessage = gContext->GetSetting("DataDirectMessage"); - - mfdNextRunStart.replace("T", " "); - - extern const char *myth_source_version; - contentLines[count++] = QObject::tr("Myth version:") + " " + - MYTH_BINARY_VERSION + " " + - myth_source_version; - contentLines[count++] = QObject::tr("Last mythfilldatabase guide update:"); - contentLines[count++] = QObject::tr("Started: ") + mfdLastRunStart; - - if (mfdLastRunEnd >= mfdLastRunStart) //if end < start, it's still running. - contentLines[count++] = QObject::tr("Finished: ") + mfdLastRunEnd; - - contentLines[count++] = QObject::tr("Result: ") + mfdLastRunStatus; - - - if (mfdNextRunStart >= mfdLastRunStart) - contentLines[count++] = QObject::tr("Suggested Next: ") + - mfdNextRunStart; - - DaysOfData = qdtNow.daysTo(GuideDataThrough); - - if (GuideDataThrough.isNull()) - { - contentLines[count++] = ""; - contentLines[count++] = QObject::tr("There's no guide data available!"); - contentLines[count++] = QObject::tr("Have you run mythfilldatabase?"); - } - else - { - contentLines[count++] = QObject::tr("There is guide data until ") + - QDateTime(GuideDataThrough) - .toString("yyyy-MM-dd hh:mm"); - - if (DaysOfData > 0) - { - Status = QString("(%1 ").arg(DaysOfData); - if (DaysOfData >1) - Status += QObject::tr("days"); - else - Status += QObject::tr("day"); - Status += ")."; - contentLines[count++] = Status; - } - } - - if (DaysOfData <= 3) - { - contentLines[count++] = QObject::tr("WARNING: is mythfilldatabase " - "running?"); - } - - if (!DataDirectMessage.isNull()) - { - contentLines[count++] = QObject::tr("DataDirect Status: "); - contentLines[count++] = DataDirectMessage; - } - - contentTotalLines = count; - update(ContentRect); -} - -void StatusBox::doTunerStatus() -{ - doScroll = true; - contentLines.clear(); - contentDetail.clear(); - contentFont.clear(); - - MSqlQuery query(MSqlQuery::InitCon()); - query.prepare( - "SELECT cardid, cardtype, videodevice " - "FROM capturecard WHERE parentid='0' ORDER BY cardid"); - - if (!query.exec() || !query.isActive()) - { - MythContext::DBError("StatusBox::doTunerStatus()", query); - contentTotalLines = 0; - update(ContentRect); - return; - } - - uint count = 0; - while (query.next()) - { - int cardid = query.value(0).toInt(); - - QString cmd = QString("QUERY_REMOTEENCODER %1").arg(cardid); - QStringList strlist = cmd; - strlist << "GET_STATE"; - - gContext->SendReceiveStringList(strlist); - int state = strlist[0].toInt(); - - QString status = ""; - if (state == kState_Error) - status = tr("is unavailable"); - else if (state == kState_WatchingLiveTV) - status = tr("is watching live TV"); - else if (state == kState_RecordingOnly || - state == kState_WatchingRecording) - status = tr("is recording"); - else - status = tr("is not recording"); - - QString tun = tr("Tuner %1 ").arg(cardid); - QString devlabel = CardUtil::GetDeviceLabel( - cardid, query.value(1).toString(), query.value(2).toString()); - - contentLines[count] = tun + status; - contentDetail[count] = tun + devlabel + " " + status; - - if (state == kState_RecordingOnly || - state == kState_WatchingRecording) - { - strlist = QString("QUERY_RECORDER %1").arg(cardid); - strlist << "GET_RECORDING"; - gContext->SendReceiveStringList(strlist); - ProgramInfo *proginfo = new ProgramInfo; - proginfo->FromStringList(strlist, 0); - - status += " " + proginfo->title; - status += "\n"; - status += proginfo->subtitle; - contentDetail[count] = tun + devlabel + " " + status; - } - count++; - } - contentTotalLines = count; - update(ContentRect); -} - -void StatusBox::doLogEntries(void) -{ - QString line; - int count = 0; - - doScroll = true; - - contentLines.clear(); - contentDetail.clear(); - contentFont.clear(); - contentData.clear(); - - MSqlQuery query(MSqlQuery::InitCon()); - query.prepare("SELECT logid, module, priority, logdate, host, " - "message, details " - "FROM mythlog WHERE acknowledged = 0 " - "AND priority <= :PRIORITY ORDER BY logdate DESC;"); - query.bindValue(":PRIORITY", min_level); - query.exec(); - - if (query.isActive()) - { - while (query.next()) - { - line = QString("%1").arg(query.value(5).toString()); - contentLines[count] = line; - - if (query.value(6).toString() != "") - line = tr("On %1 %2 from %3.%4\n%5\n%6") - .arg(query.value(3).toDateTime() - .toString(dateFormat)) - .arg(query.value(3).toDateTime() - .toString(timeFormat)) - .arg(query.value(4).toString()) - .arg(query.value(1).toString()) - .arg(query.value(5).toString()) - .arg(QString::fromUtf8(query.value(6).toString())); - else - line = tr("On %1 %2 from %3.%4\n%5\nNo other details") - .arg(query.value(3).toDateTime() - .toString(dateFormat)) - .arg(query.value(3).toDateTime() - .toString(timeFormat)) - .arg(query.value(4).toString()) - .arg(query.value(1).toString()) - .arg(query.value(5).toString()); - contentDetail[count] = line; - contentData[count++] = query.value(0).toString(); - } - } - - if (!count) - { - doScroll = false; - contentLines[count++] = QObject::tr("No items found at priority " - "level %1 or lower.") - .arg(min_level); - contentLines[count++] = QObject::tr("Use 1-8 to change priority " - "level."); - } - - contentTotalLines = count; - if (contentPos > (contentTotalLines - 1)) - contentPos = contentTotalLines - 1; - - update(ContentRect); -} - -void StatusBox::doJobQueueStatus() -{ - QMap<int, JobQueueEntry> jobs; - QMap<int, JobQueueEntry>::Iterator it; - int count = 0; - - QString detail; - - JobQueue::GetJobsInQueue(jobs, - JOB_LIST_NOT_DONE | JOB_LIST_ERROR | - JOB_LIST_RECENT); - - doScroll = true; - - contentLines.clear(); - contentDetail.clear(); - contentFont.clear(); - contentData.clear(); - - if (jobs.size()) - { - for (it = jobs.begin(); it != jobs.end(); ++it) - { - QString chanid = it.data().chanid; - QDateTime starttime = it.data().starttime; - ProgramInfo *pginfo; - - pginfo = ProgramInfo::GetProgramFromRecorded(chanid, starttime); - - if (!pginfo) - continue; - - detail = pginfo->title + "\n" + - pginfo->channame + " " + pginfo->chanstr + - " @ " + starttime.toString(timeDateFormat) + "\n" + - tr("Job:") + " " + JobQueue::JobText(it.data().type) + - " " + tr("Status: ") + - JobQueue::StatusText(it.data().status); - - if (it.data().status != JOB_QUEUED) - detail += " (" + it.data().hostname + ")"; - - detail += "\n" + it.data().comment; - - contentLines[count] = pginfo->title + " @ " + - starttime.toString(timeDateFormat); - - contentDetail[count] = detail; - contentData[count] = QString("%1").arg(it.data().id); - - if (it.data().status == JOB_ERRORED) - contentFont[count] = "error"; - else if (it.data().status == JOB_ABORTED) - contentFont[count] = "warning"; - - count++; - - delete pginfo; - } - } - else - { - contentLines[count++] = QObject::tr("Job Queue is currently empty."); - doScroll = false; - } - - contentTotalLines = count; - update(ContentRect); -} - -// Some helper routines for doMachineStatus() that format the output strings - -/** \fn sm_str(long long, int) - * \brief Returns a short string describing an amount of space, choosing - * one of a number of useful units, "TB", "GB", "MB", or "KB". - * \param sizeKB Number of kilobytes. - * \param prec Precision to use if we have less than ten of whatever - * unit is chosen. - */ -static const QString sm_str(long long sizeKB, int prec=1) -{ - if (sizeKB>1024*1024*1024) // Terabytes - { - double sizeGB = sizeKB/(1024*1024*1024.0); - return QString("%1 TB").arg(sizeGB, 0, 'f', (sizeGB>10)?0:prec); - } - else if (sizeKB>1024*1024) // Gigabytes - { - double sizeGB = sizeKB/(1024*1024.0); - return QString("%1 GB").arg(sizeGB, 0, 'f', (sizeGB>10)?0:prec); - } - else if (sizeKB>1024) // Megabytes - { - double sizeMB = sizeKB/1024.0; - return QString("%1 MB").arg(sizeMB, 0, 'f', (sizeMB>10)?0:prec); - } - // Kilobytes - return QString("%1 KB").arg(sizeKB); -} - -static const QString usage_str_kb(long long total, - long long used, - long long free) -{ - QString ret = QObject::tr("Unknown"); - if (total > 0.0 && free > 0.0) - { - double percent = (100.0*free)/total; - ret = QObject::tr("%1 total, %2 used, %3 (or %4%) free.") - .arg(sm_str(total)).arg(sm_str(used)) - .arg(sm_str(free)).arg(percent, 0, 'f', (percent >= 10.0) ? 0 : 2); - } - return ret; -} - -static const QString usage_str_mb(float total, float used, float free) -{ - return usage_str_kb((long long)(total*1024), (long long)(used*1024), - (long long)(free*1024)); -} - -static void disk_usage_with_rec_time_kb(QStringList& out, long long total, - long long used, long long free, - const recprof2bps_t& prof2bps) -{ - const QString tail = QObject::tr(", using your %1 rate of %2 Kb/sec"); - - out<<usage_str_kb(total, used, free); - if (free<0) - return; - - recprof2bps_t::const_iterator it = prof2bps.begin(); - for (; it != prof2bps.end(); ++it) - { - const QString pro = - tail.arg(it.key()).arg((int)((float)it.data() / 1024.0)); - - long long bytesPerMin = (it.data() >> 1) * 15; - uint minLeft = ((free<<5)/bytesPerMin)<<5; - minLeft = (minLeft/15)*15; - uint hoursLeft = minLeft/60; - if (hoursLeft > 3) - out<<QObject::tr("%1 hours left").arg(hoursLeft) + pro; - else if (minLeft > 90) - out<<QObject::tr("%1 hours and %2 minutes left") - .arg(hoursLeft).arg(minLeft%60) + pro; - else - out<<QObject::tr("%1 minutes left").arg(minLeft) + pro; - } -} - -static const QString uptimeStr(time_t uptime) -{ - int days, hours, min, secs; - QString str; - - str = QString(" " + QObject::tr("Uptime") + ": "); - - if (uptime == 0) - return str + "unknown"; - - days = uptime/(60*60*24); - uptime -= days*60*60*24; - hours = uptime/(60*60); - uptime -= hours*60*60; - min = uptime/60; - secs = uptime%60; - - if (days > 0) - { - char buff[6]; - QString dayLabel; - - if (days == 1) - dayLabel = QObject::tr("day"); - else - dayLabel = QObject::tr("days"); - - sprintf(buff, "%d:%02d", hours, min); - - return str + QString("%1 %2, %3").arg(days).arg(dayLabel).arg(buff); - } - else - { - char buff[9]; - - sprintf(buff, "%d:%02d:%02d", hours, min, secs); - - return str + buff; - } -} - -/** \fn StatusBox::getActualRecordedBPS(QString hostnames) - * \brief Fills in recordingProfilesBPS w/ average bitrate from recorded table - */ -void StatusBox::getActualRecordedBPS(QString hostnames) -{ - recordingProfilesBPS.clear(); - - QString querystr; - MSqlQuery query(MSqlQuery::InitCon()); - - querystr = - "SELECT sum(filesize) * 8 / " - "sum(((unix_timestamp(endtime) - unix_timestamp(starttime)))) " - "AS avg_bitrate " - "FROM recorded WHERE hostname in (%1) " - "AND (unix_timestamp(endtime) - unix_timestamp(starttime)) > 300;"; - - query.prepare(querystr.arg(hostnames)); - - if (query.exec() && query.isActive() && query.size() > 0 && query.next() && - query.value(0).toDouble() > 0) - { - recordingProfilesBPS[QObject::tr("average")] = - (int)(query.value(0).toDouble()); - } - - querystr = - "SELECT max(filesize * 8 / " - "(unix_timestamp(endtime) - unix_timestamp(starttime))) " - "AS max_bitrate " - "FROM recorded WHERE hostname in (%1) " - "AND (unix_timestamp(endtime) - unix_timestamp(starttime)) > 300;"; - - query.prepare(querystr.arg(hostnames)); - - if (query.exec() && query.isActive() && query.size() > 0 && query.next() && - query.value(0).toDouble() > 0) - { - recordingProfilesBPS[QObject::tr("maximum")] = - (int)(query.value(0).toDouble()); - } -} - -/** \fn StatusBox::doMachineStatus() - * \brief Show machine status. - * - * This returns statisics for master backend when using - * a frontend only machine. And returns info on the current - * system if frontend is running on a backend machine. - * \bug We should report on all backends and the current frontend. - */ -void StatusBox::doMachineStatus() -{ - int count(0); - int totalM, usedM, freeM; // Physical memory - int totalS, usedS, freeS; // Virtual memory (swap) - time_t uptime; - int detailBegin; - QString detailString; - int detailLoop; - - contentLines.clear(); - contentDetail.clear(); - contentFont.clear(); - doScroll = true; - - detailBegin = count; - detailString = ""; - - if (isBackend) - contentLines[count] = QObject::tr("System") + ":"; - else - contentLines[count] = QObject::tr("This machine") + ":"; - detailString += contentLines[count] + "\n"; - count++; - - // uptime - if (!getUptime(uptime)) - uptime = 0; - contentLines[count] = uptimeStr(uptime); - - // weighted average loads - contentLines[count].append(". " + QObject::tr("Load") + ": "); - - double loads[3]; - if (getloadavg(loads,3) == -1) - contentLines[count].append(QObject::tr("unknown") + - " - getloadavg() " + QObject::tr("failed")); - else - { - char buff[30]; - - sprintf(buff, "%0.2lf, %0.2lf, %0.2lf", loads[0], loads[1], loads[2]); - contentLines[count].append(QString(buff)); - } - detailString += contentLines[count] + "\n"; - count++; - - - // memory usage - if (getMemStats(totalM, freeM, totalS, freeS)) - { - usedM = totalM - freeM; - if (totalM > 0) - { - contentLines[count] = " " + QObject::tr("RAM") + - ": " + usage_str_mb(totalM, usedM, freeM); - detailString += contentLines[count] + "\n"; - count++; - } - usedS = totalS - freeS; - if (totalS > 0) - { - contentLines[count] = " " + QObject::tr("Swap") + - ": " + usage_str_mb(totalS, usedS, freeS); - detailString += contentLines[count] + "\n"; - count++; - } - } - - for (detailLoop = detailBegin; detailLoop < count; detailLoop++) - contentDetail[detailLoop] = detailString; - - detailBegin = count; - detailString = ""; - - if (!isBackend) - { - contentLines[count] = QObject::tr("MythTV server") + ":"; - detailString += contentLines[count] + "\n"; - count++; - - // uptime - if (!RemoteGetUptime(uptime)) - uptime = 0; - contentLines[count] = uptimeStr(uptime); - - // weighted average loads - contentLines[count].append(". " + QObject::tr("Load") + ": "); - float loads[3]; - if (RemoteGetLoad(loads)) - { - char buff[30]; - - sprintf(buff, "%0.2f, %0.2f, %0.2f", loads[0], loads[1], loads[2]); - contentLines[count].append(QString(buff)); - } - else - contentLines[count].append(QObject::tr("unknown")); - - detailString += contentLines[count] + "\n"; - count++; - - // memory usage - if (RemoteGetMemStats(totalM, freeM, totalS, freeS)) - { - usedM = totalM - freeM; - if (totalM > 0) - { - contentLines[count] = " " + QObject::tr("RAM") + - ": " + usage_str_mb(totalM, usedM, freeM); - detailString += contentLines[count] + "\n"; - count++; - } - - usedS = totalS - freeS; - if (totalS > 0) - { - contentLines[count] = " " + QObject::tr("Swap") + - ": " + usage_str_mb(totalS, usedS, freeS); - detailString += contentLines[count] + "\n"; - count++; - } - } - } - - for (detailLoop = detailBegin; detailLoop < count; detailLoop++) - contentDetail[detailLoop] = detailString; - - detailBegin = count; - detailString = ""; - - // get free disk space - QString hostnames; - - vector<FileSystemInfo> fsInfos = RemoteGetFreeSpace(); - for (uint i=0; i<fsInfos.size(); i++) - { - hostnames = QString("\"%1\"").arg(fsInfos[i].hostname); - hostnames.replace(QRegExp(" "), ""); - hostnames.replace(QRegExp(","), "\",\""); - - getActualRecordedBPS(hostnames); - - QStringList list; - disk_usage_with_rec_time_kb(list, - fsInfos[i].totalSpaceKB, fsInfos[i].usedSpaceKB, - fsInfos[i].totalSpaceKB - fsInfos[i].usedSpaceKB, - recordingProfilesBPS); - - contentLines[count] = - QObject::tr("Disk usage on %1:").arg(fsInfos[i].hostname); - detailString += contentLines[count] + "\n"; - count++; - - QStringList::iterator it = list.begin(); - for (;it != list.end(); ++it) - { - contentLines[count] = QString(" ") + (*it); - detailString += contentLines[count] + "\n"; - count++; - } - - for (detailLoop = detailBegin; detailLoop < count; detailLoop++) - contentDetail[detailLoop] = detailString; - - detailBegin = count; - detailString = ""; - } - - contentTotalLines = count; - update(ContentRect); -} - -/** \fn StatusBox::doAutoExpireList() - * \brief Show list of recordings which may AutoExpire - */ -void StatusBox::doAutoExpireList() -{ - int count(0); - ProgramInfo* pginfo; - QString contentLine; - QString detailInfo; - QString staticInfo; - long long totalSize(0); - long long liveTVSize(0); - int liveTVCount(0); - - contentLines.clear(); - contentDetail.clear(); - contentFont.clear(); - doScroll = true; - - vector<ProgramInfo *>::iterator it; - for (it = expList.begin(); it != expList.end(); it++) - delete *it; - expList.clear(); - - RemoteGetAllExpiringRecordings(expList); - - for (it = expList.begin(); it != expList.end(); it++) - { - pginfo = *it; - - totalSize += pginfo->filesize; - if (pginfo->recgroup == "LiveTV") - { - liveTVSize += pginfo->filesize; - liveTVCount++; - } - } - - staticInfo = tr("%1 recordings consuming %2 are allowed to expire") - .arg(expList.size()).arg(sm_str(totalSize / 1024)) + "\n"; - - if (liveTVCount) - staticInfo += tr("%1 of these are LiveTV and consume %2") - .arg(liveTVCount).arg(sm_str(liveTVSize / 1024)) + "\n"; - else - staticInfo += "\n"; - - for (it = expList.begin(); it != expList.end(); it++) - { - pginfo = *it; - contentLine = pginfo->recstartts.toString(dateFormat) + " - "; - - if (pginfo->recgroup == "LiveTV") - contentLine += "(" + tr("LiveTV") + ") "; - - contentLine += pginfo->title + - " (" + sm_str(pginfo->filesize / 1024) + ")"; - - detailInfo = staticInfo; - detailInfo += pginfo->recstartts.toString(timeDateFormat) + " - " + - pginfo->recendts.toString(timeDateFormat); - - detailInfo += " (" + sm_str(pginfo->filesize / 1024) + ")"; - - if (pginfo->recgroup == "LiveTV") - detailInfo += " (" + tr("LiveTV") + ")"; - - detailInfo += "\n" + pginfo->title; - - if (pginfo->subtitle != "") - detailInfo += " - " + pginfo->subtitle + ""; - - contentLines[count] = contentLine; - contentDetail[count] = detailInfo; - count++; - } - - contentTotalLines = count; - update(ContentRect); -} - -/* vim: set expandtab tabstop=4 shiftwidth=4: */ diff --git a/abs/core/mythinstall/statusbox.h b/abs/core/mythinstall/statusbox.h deleted file mode 100755 index dd209ca..0000000 --- a/abs/core/mythinstall/statusbox.h +++ /dev/null @@ -1,76 +0,0 @@ -#ifndef STATUSBOX_H_ -#define STATUSBOX_H_ - -#include <qstringlist.h> -#include "mythwidgets.h" -#include "mythdialogs.h" -#include "uitypes.h" -#include "xmlparse.h" -#include "programinfo.h" - -typedef QMap<QString, unsigned int> recprof2bps_t; - -class LayerSet; - -class StatusBox : public MythDialog -{ - Q_OBJECT - public: - StatusBox(MythMainWindow *parent, const char *name = 0); - ~StatusBox(void); - - bool IsErrored() const { return errored; } - - protected slots: - - protected: - void keyPressEvent(QKeyEvent *e); - void paintEvent(QPaintEvent *e); - - private: - void updateTopBar(); - void updateSelector(); - void updateContent(); - void LoadTheme(); - void doListingsStatus(); - void doTunerStatus(); - void doLogEntries(); - void doJobQueueStatus(); - void doMachineStatus(); - void doAutoExpireList(); - void clicked(); - void setHelpText(); - void getActualRecordedBPS(QString hostnames); - - XMLParse *theme; - QDomElement xmldata; - QRect TopRect, SelectRect, ContentRect; - UITextType *heading, *helptext; - UIListType *icon_list, *list_area; - LayerSet *selector, *topbar, *content; - - int max_icons; - - bool inContent, doScroll; - int contentTotalLines; - int contentSize; - int contentPos; - int contentMid; - int min_level; - QString dateFormat, timeFormat, timeDateFormat; - - QMap<int, QString> contentLines; - QMap<int, QString> contentDetail; - QMap<int, QString> contentFont; - QMap<int, QString> contentData; - recprof2bps_t recordingProfilesBPS; - - vector<ProgramInfo *> expList; - - MythMainWindow *my_parent; - - bool isBackend; - bool errored; -}; - -#endif diff --git a/abs/core/mythinstall/xorgsettings.cpp b/abs/core/mythinstall/xorgsettings.cpp deleted file mode 100755 index 02fa3ce..0000000 --- a/abs/core/mythinstall/xorgsettings.cpp +++ /dev/null @@ -1,686 +0,0 @@ - - -//_include <mythcontext.h> -#include <unistd.h> -#include <iostream> -#include <fstream> -#include <stdio.h> -#include "settings.h" - -#include <string> -#include <fstream> -#include <sstream> -#include <stdexcept> -#include <vector> -#include <cassert> -#include <algorithm> -#include <tr1/unordered_map> - - -#include <sys/wait.h> // For WIFEXITED on Mac OS X -#include <qapplication.h> -#include "mythcontext.h" -#include "libmyth/mythdialogs.h" -#include "mythdbcon.h" -#include "lcddevice.h" -#include "tv.h" -#include "programinfo.h" -#include "uitypes.h" -#include "remoteutil.h" -#include <qdir.h> -#include <qimage.h> -#include <stdlib.h> -#include <cstdlib> - -#include "installsettings.h" -#include "installdialog.h" -#include "xorgsettings.h" -#include <qsqldatabase.h> -#include <qsqlquery.h> -#include "installsettings.h" -extern HostParms hostparm; -extern DDCinfo ddcinfo; -// __________________All the Xorg settings______________ -void ReadDDCvalues (void) -{ - QString line; - QString currentitem; - system ("/usr/sbin/ddcprobe > /tmp/ddcinfo"); - QFile file("/tmp/ddcinfo"); - if ( file.open(IO_ReadOnly | IO_Translate) ) - { - QTextStream t( &file ); // use a text stream - while ( !t.eof() ) - { - line = t.readLine(); - if ( line.contains("Timing ranges:") ) - { - currentitem = line.section( "=", 1,1 ); - ddcinfo.XVrefresh = line.section( "=", 2,2 ); - ddcinfo.XHsync = currentitem.section( "," , 0,0 ); - } - else if ( line.contains (" Dimensions") ) - { - ddcinfo.Displaysize= line.section( ":", 1,1 ); - }; - } - file.close(); - } -}; - -static HostCheckBox *HostXUseAdvanced() -{ - HostCheckBox *gc = new HostCheckBox("HostXUseAdvanced"); - gc->setLabel(QObject::tr("Advanced xorg configuration")); - gc->setValue(false); - gc->setHelpText(QObject::tr("Displays more settings for Xorg")); - return gc; -}; - -static HostComboBox *HostXgeneric_connection() -{ - HostComboBox *gc = new HostComboBox("HostXgenericConnection",false); - gc->setLabel(QObject::tr("Connection")); - gc->addSelection("VGA"); - gc->addSelection("DVI"); - gc->addSelection("TV"); - gc->addSelection("AUTO"); - gc->setHelpText(QObject::tr("Video-out")); - return gc; -} - - -static HostCheckBox *HostXIgnoreEDID() -{ - HostCheckBox *gc = new HostCheckBox("HostXIgnoreEDID"); - gc->setLabel(QObject::tr("Ignore data provided by monitor")); - gc->setValue(false); - gc->setHelpText(QObject::tr("")); - return gc; -}; - - -static HostSpinBox *HostXHsyncLow() -{ - HostSpinBox *gc = new HostSpinBox("HostXHsyncLow", 1, 200, 1, true); - gc->setLabel(QObject::tr("Hsync")); - gc->setValue(6); - gc->setHelpText(QObject::tr("" )); - return gc; -} -static HostSpinBox *HostXHsyncHigh() -{ - HostSpinBox *gc = new HostSpinBox("HostXHsyncHigh", 1, 200, 1, true); - gc->setLabel(QObject::tr("")); - gc->setValue(6); - gc->setHelpText(QObject::tr("" )); - return gc; -} - -static HostSpinBox *HostXVrefreshLow() -{ - HostSpinBox *gc = new HostSpinBox("HostXVrefreshLow", 1, 200, 1, true); - gc->setLabel(QObject::tr("Vrefresh")); - gc->setValue(6); - gc->setHelpText(QObject::tr("" )); - return gc; -} -static HostSpinBox *HostXVrefreshHigh() -{ - HostSpinBox *gc = new HostSpinBox("HostXVrefreshHigh", 1, 200, 1, true); - gc->setLabel(QObject::tr("")); - gc->setValue(6); - gc->setHelpText(QObject::tr("" )); - return gc; -} - -static HostComboBox *HostXDisplaysize() -{ - HostComboBox *gc = new HostComboBox("HostXdisplaysize",true); - gc->setLabel(QObject::tr("Display size")); - gc->setHelpText(QObject::tr("Format should be two numbers 320 250" )); - gc->addSelection("487 274 _ 1920x1080 at 100dpi (16:9)"); - gc->addSelection("325 182 _ 1280x720 at 100dpi (16:9)"); - gc->addSelection("325 243 _ 1280x960 at 100dpi (4:3)"); - gc->addSelection("260 195 _ 1024x768 at 100dpi (4:3)"); - gc->addSelection("203 153 _ 800x600 at 100dpi (4:3)"); - gc->addSelection("162 121 _ 640x480 at 100dpi (4:3)"); - gc->addSelection("Custom"); - return gc; -} - -class EDIDprobedinfo : public TransLabelSetting -{ -public: - EDIDprobedinfo() - { - QString currentitem = "Reported info \n"; - currentitem.append("Hsync: "); - currentitem.append (ddcinfo.XHsync); - currentitem.append (" Vrefresh: "); - currentitem.append(ddcinfo.XVrefresh ); - currentitem.append (" Displaysize: "); - currentitem.append(ddcinfo.Displaysize); - setLabel(currentitem); - }; -}; - - -void AdvancedXGeneric_modelines::generic_fillselection(QString modelinefile ) -{ - if ( hostparm.displayshowadvancedX ) - { - QString currentitem; - QString cfiletxt; - cfiletxt=MV_ROOT; - cfiletxt.append("templates/xorg/modeline." ); - QString currentfile = cfiletxt; - currentfile.append(modelinefile); - QString line; - QRegExp sep( "\"" ); - QFile file(currentfile); - if ( file.open(IO_ReadOnly | IO_Translate) ) - { - QTextStream t( &file ); // use a text stream - while ( !t.eof() ) - { - line = t.readLine(); - if ( line.startsWith("ModeLine")) - { - currentitem = line.section( sep , 1,1 ); - if ( modelinefile == "VESA") - HostXadvancedresVESA->addSelection(currentitem); - else if ( modelinefile == "ATSC") - HostXadvancedresATSC->addSelection(currentitem); - else if ( modelinefile == "DVD") - HostXadvancedresDVD->addSelection(currentitem); - else if ( modelinefile == "NTSC") - HostXadvancedresNTSC->addSelection(currentitem); - else if ( modelinefile == "Custom") - HostXadvancedresCustom->addSelection(currentitem); - } - } - file.close(); - } - } -return ; - -} - - -class UseEDID: public TriggeredConfigurationGroup { -public: - UseEDID(): - TriggeredConfigurationGroup(true,false,true,true,false,false,false,true) { - Setting* useedid = HostXIgnoreEDID(); - addChild(useedid); - setTrigger(useedid); - - ConfigurationGroup* XSYNC = new GridConfigurationGroup(2,false); - XSYNC->addChild(HostXHsyncLow()); - XSYNC->addChild(HostXHsyncHigh()); - - ConfigurationGroup* XVREFRESH = new GridConfigurationGroup(2,false); - XVREFRESH->addChild(HostXVrefreshLow()); - XVREFRESH->addChild(HostXVrefreshHigh()); - - - ConfigurationGroup* settings = new GridConfigurationGroup(1,false); - settings->addChild(new EDIDprobedinfo); - settings->addChild( XSYNC); - settings->addChild(XVREFRESH); - settings->addChild(HostXDisplaysize()); - - addTarget("0", new GridConfigurationGroup(1,false)); - addTarget("1", settings); - }; -}; - - -EDIDOptions::EDIDOptions() -{ - VerticalConfigurationGroup* rec = new VerticalConfigurationGroup(false); - rec->setLabel(QObject::tr("Advanced X options")); - rec->setUseLabel(false); - rec->addChild(new UseEDID); - addChild(rec); -} - - -AdvancedXGeneric_modelines::AdvancedXGeneric_modelines(): - TriggeredConfigurationGroup(true,false,true,true,true,true,true,true) -{ - SetVertical(false); - HostXModelineCatagory = new HostComboBox("HostXModelineCatagory"); - HostXModelineCatagory->setLabel(QObject::tr("Type")); - HostXModelineCatagory->addSelection("Auto"); - HostXModelineCatagory->addSelection("VESA"); - HostXModelineCatagory->addSelection("ATSC"); - HostXModelineCatagory->addSelection("DVD"); - HostXModelineCatagory->addSelection("NTSC"); - HostXModelineCatagory->addSelection("Custom"); - //HostXModelineCatagory->addSelection("nVidia Modeline"); - HostXModelineCatagory->setHelpText(QObject::tr("")); - - HostXadvancedresVESA = new HostComboBox("HostXadvancedresVESA"); - HostXadvancedresATSC = new HostComboBox("HostXadvancedresATSC"); - HostXadvancedresDVD = new HostComboBox("HostXadvancedresDVD"); - HostXadvancedresNTSC = new HostComboBox("HostXadvancedresNTSC"); - HostXadvancedresCustom= new HostComboBox("HostXadvancedresCustom"); - - generic_fillselection("VESA"); - generic_fillselection("ATSC"); - generic_fillselection("DVD"); - generic_fillselection("NTSC"); - generic_fillselection("Custom"); - - addChild(HostXModelineCatagory); - setTrigger(HostXModelineCatagory); - - addTarget("VESA", HostXadvancedresVESA); - addTarget("ATSC", HostXadvancedresATSC); - addTarget("DVD", HostXadvancedresDVD); - addTarget("NTSC", HostXadvancedresNTSC); - addTarget("Custom",HostXadvancedresCustom); - addTarget("Auto", new VerticalConfigurationGroup(false, false)); - -}; - -void AdvancedXGeneric_modelines::AdvancedXGeneric_modelines_GatherSettings(void) -{ - QString modelinetype = HostXModelineCatagory->getValue(); - QString tempmodeline = "HostXadvancedres" + modelinetype ; - QString modeline; - if ( modelinetype == "VESA") - modeline= HostXadvancedresVESA->getValue() ; - else if ( modelinetype == "ATSC") - modeline= HostXadvancedresATSC->getValue() ; - else if ( modelinetype == "DVD") - modeline= HostXadvancedresDVD->getValue(); - else if ( modelinetype == "NTSC") - modeline= HostXadvancedresNTSC->getValue(); - else if ( modelinetype == "Custom") - modeline= HostXadvancedresCustom->getValue(); - hostparm.ThisXresadvanced = modelinetype +"_"+modeline; - // Jump to final step - testXconfiguration(); -} - - -// --------------------------------------------start of nvidia specific ------------------------------------ - - -AdvancedXNvidiaConnections::AdvancedXNvidiaConnections(): - TriggeredConfigurationGroup(false,false,true,true,true,true,true,true) { - - HostXNvidiaConnection = new HostComboBox("HostXNvidiaConnection",false); - HostXNvidiaConnection->setLabel(QObject::tr("Connection")); - HostXNvidiaConnection->addSelection("Auto"); - HostXNvidiaConnection->addSelection("DVI"); - HostXNvidiaConnection->addSelection("VGA"); - HostXNvidiaConnection->addSelection("TV"); - HostXNvidiaConnection->setHelpText(QObject::tr("Video-out")); - - addChild(HostXNvidiaConnection); - setTrigger(HostXNvidiaConnection); - AdvancedXNvidia_modelines *ADVANCEDXNVIDIA_MODELINES = new AdvancedXNvidia_modelines; - - HostXnVidiaTVstandard = new HostComboBox("HostXnVidiaTVstandard"); - HostXnVidiaTVstandard->setLabel(QObject::tr("nVidia-out")); - HostXnVidiaTVstandard->addSelection("PAL-B" ); - HostXnVidiaTVstandard->addSelection("PAL-D" ); - HostXnVidiaTVstandard->addSelection("PAL-G" ); - HostXnVidiaTVstandard->addSelection("PAL-H" ); - HostXnVidiaTVstandard->addSelection("PAL-I" ); - HostXnVidiaTVstandard->addSelection("PAL-K1"); - HostXnVidiaTVstandard->addSelection("PAL-M" ); - HostXnVidiaTVstandard->addSelection("PAL-N" ); - HostXnVidiaTVstandard->addSelection("PAL-NC"); - HostXnVidiaTVstandard->addSelection("NTSC-J"); - HostXnVidiaTVstandard->addSelection("NTSC-M"); - HostXnVidiaTVstandard->addSelection("HD480i" ); - HostXnVidiaTVstandard->addSelection("HD480p" ); - HostXnVidiaTVstandard->addSelection("HD720p" ); - HostXnVidiaTVstandard->addSelection("HD1080i" ); - HostXnVidiaTVstandard->addSelection("HD1080p"); - HostXnVidiaTVstandard->addSelection("HD576i" ); - HostXnVidiaTVstandard->addSelection("HD576p" ); - HostXnVidiaTVstandard->setHelpText(QObject::tr("Indrustry standard resolution to send to the TV")); - - HostXnVidiaTVformat = new HostComboBox("HostXnVidiaTVformat"); - HostXnVidiaTVformat->setLabel(QObject::tr("TV-Format(nvidia)")); - HostXnVidiaTVformat->addSelection("AUTOSELECT"); - HostXnVidiaTVformat->addSelection("COMPOSITE"); - HostXnVidiaTVformat->addSelection("SVIDEO"); - HostXnVidiaTVformat->addSelection("COMPONENT"); - HostXnVidiaTVformat->addSelection("SCART"); - HostXnVidiaTVformat->setHelpText(QObject::tr("Physical connection to the nvidia card")); - - ConfigurationGroup* nvtvout = new VerticalConfigurationGroup(false); - nvtvout ->addChild(HostXnVidiaTVformat); - nvtvout->addChild(HostXnVidiaTVstandard); - - addTarget("Auto",ADVANCEDXNVIDIA_MODELINES ); - addTarget("DVI", ADVANCEDXNVIDIA_MODELINES ); - addTarget("VGA",ADVANCEDXNVIDIA_MODELINES); - addTarget("TV", nvtvout); - - connect(this, SIGNAL(nVidia_sig(void)), - ADVANCEDXNVIDIA_MODELINES, SLOT(AdvancedXNvidia_modelines_GatherSettings())); -}; - - - - -void AdvancedXNvidia_modelines::Nvidia_fillselection(QString modelinefile ) -{ - if ( hostparm.displayshowadvancedX ) - { - QString currentitem; - QString cfiletxt; - cfiletxt=MV_ROOT; - cfiletxt.append("templates/xorg/modeline." ); - QString currentfile = cfiletxt; - currentfile.append(modelinefile); - QString line; - QRegExp sep( "\"" ); - QFile file(currentfile); - if ( file.open(IO_ReadOnly | IO_Translate) ) - { - QTextStream t( &file ); // use a text stream - while ( !t.eof() ) - { - line = t.readLine(); - if ( line.startsWith("ModeLine")) - { - currentitem = line.section( sep , 1,1 ); - if ( modelinefile == "VESA") - HostXNvidiaadvancedresVESA->addSelection(currentitem); - else if ( modelinefile == "ATSC") - HostXNvidiaadvancedresATSC->addSelection(currentitem); - else if ( modelinefile == "DVD") - HostXNvidiaadvancedresDVD->addSelection(currentitem); - else if ( modelinefile == "NTSC") - HostXNvidiaadvancedresNTSC->addSelection(currentitem); - else if ( modelinefile == "Custom") - HostXNvidiaadvancedresCustom->addSelection(currentitem); - } - } - file.close(); - } - } -return ; - -} - - - -AdvancedXNvidia_modelines::AdvancedXNvidia_modelines(): - TriggeredConfigurationGroup(true,false,true,true,true,true,true,true) -{ - SetVertical(true); - HostXNvidiaModelineCatagory = new HostComboBox("HostXNvidiaModelineCatagory"); - HostXNvidiaModelineCatagory->setLabel(QObject::tr("Category")); - HostXNvidiaModelineCatagory->addSelection("Auto"); - HostXNvidiaModelineCatagory->addSelection("VESA"); - HostXNvidiaModelineCatagory->addSelection("ATSC"); - HostXNvidiaModelineCatagory->addSelection("DVD"); - HostXNvidiaModelineCatagory->addSelection("NTSC"); - HostXNvidiaModelineCatagory->addSelection("Custom"); - HostXNvidiaModelineCatagory->addSelection("nVidia Modeline"); - HostXNvidiaModelineCatagory->setHelpText(QObject::tr("")); - - HostXNvidiaadvancedresVESA = new HostComboBox("HostXNvidiaadvancedresVESA"); - HostXNvidiaadvancedresATSC = new HostComboBox("HostXNvidiaadvancedresATSC"); - HostXNvidiaadvancedresDVD = new HostComboBox("HostXNvidiaadvancedresDVD"); - HostXNvidiaadvancedresNTSC = new HostComboBox("HostXNvidiaadvancedresNTSC"); - HostXNvidiaadvancedresCustom= new HostComboBox("HostXNvidiaadvancedresCustom"); - - Nvidia_fillselection("VESA"); - Nvidia_fillselection("ATSC"); - Nvidia_fillselection("DVD"); - Nvidia_fillselection("NTSC"); - Nvidia_fillselection("Custom"); - - HostXnVidia1080p = new HostCheckBox("HostXnVidia1080p"); - HostXnVidia1080p->setLabel(QObject::tr("1080p")); - HostXnVidia1080p->setValue(true); - HostXnVidia1080p->setHelpText(QObject::tr(" ")); - - HostXnVidia1080i = new HostCheckBox("HostXnVidia1080i"); - HostXnVidia1080i->setLabel(QObject::tr("1080i")); - HostXnVidia1080i->setValue(true); - HostXnVidia1080i->setHelpText(QObject::tr(" ")); - - HostXnVidia720p = new HostCheckBox("HostXnVidia720p"); - HostXnVidia720p->setLabel(QObject::tr("720p")); - HostXnVidia720p->setValue(true); - HostXnVidia720p->setHelpText(QObject::tr(" ")); - - HostXnVidia480p = new HostCheckBox("HostXnVidia480p"); - HostXnVidia480p->setLabel(QObject::tr("480p")); - HostXnVidia480p->setValue(true); - HostXnVidia480p->setHelpText(QObject::tr(" ")); - - ConfigurationGroup* nVidiastandard = new HorizontalConfigurationGroup(false,false,true,true); - nVidiastandard ->addChild(HostXnVidia480p); - nVidiastandard ->addChild(HostXnVidia720p); - nVidiastandard ->addChild(HostXnVidia1080p); - nVidiastandard ->addChild(HostXnVidia1080i); - nVidiastandard ->setLabel(QObject::tr("Standard Nvidia Modelines")); - - - addChild(HostXNvidiaModelineCatagory); - setTrigger(HostXNvidiaModelineCatagory); - - addTarget("VESA", HostXNvidiaadvancedresVESA); - addTarget("ATSC", HostXNvidiaadvancedresATSC); - addTarget("DVD", HostXNvidiaadvancedresDVD); - addTarget("NTSC", HostXNvidiaadvancedresNTSC); - addTarget("Custom",HostXNvidiaadvancedresCustom); - addTarget("nVidia Modeline",nVidiastandard); - addTarget("Auto", new VerticalConfigurationGroup(false, false)); -}; - - -void AdvancedXNvidiaConnections::AdvancedXNvidiaConnectionsGatherSettings(void) -{ - cout << "inside AdvancedXNvidiaConnectionsGatherSettings" << endl; - hostparm.ThisXconnection = HostXNvidiaConnection->getValue(); - hostparm.ThisXTVstandard = HostXnVidiaTVformat->getValue(); - hostparm.ThisXTVconnection = HostXnVidiaTVstandard->getValue(); - emit nVidia_sig(); // jump to AdvancedXNvidia_modelines_GatherSettings - -}; - - -void AdvancedXNvidia_modelines::AdvancedXNvidia_modelines_GatherSettings(void) -{ - QString modelinecatagory = HostXNvidiaModelineCatagory->getValue(); - QString tempmodeline = "HostXadvancedres" + modelinecatagory ; - QString modeline; - - if ( modelinecatagory == "VESA") - modeline= HostXNvidiaadvancedresVESA->getValue() ; - else if ( modelinecatagory == "ATSC") - modeline= HostXNvidiaadvancedresATSC->getValue() ; - else if ( modelinecatagory == "DVD") - modeline= HostXNvidiaadvancedresDVD->getValue(); - else if ( modelinecatagory == "NTSC") - modeline= HostXNvidiaadvancedresNTSC->getValue(); - else if ( modelinecatagory == "Custom") - modeline= HostXNvidiaadvancedresCustom->getValue(); - else if ( modelinecatagory == "nVidia Modeline" ) - modeline = "Builtin" ; - // need to add stuff to find the built in nvidia modelines - hostparm.ThisXresadvanced = modelinecatagory +"_"+modeline; - - cout << " in nvidia modeline gather settings" << endl; - // Jump to final step - testXconfiguration(); -}; -// ----------------------------------------END nvidia specific - - - -AdvancedXcardtype::AdvancedXcardtype(): - TriggeredConfigurationGroup(false,false,true,true,true,true,false,false) { - HostXcardtype = new HostComboBox("HostXcardtype",false); - HostXcardtype->setLabel(QObject::tr("Video card/driver")); - HostXcardtype->addSelection("nVidia"); - HostXcardtype->addSelection("ATI"); - HostXcardtype->addSelection("VMWARE"); - HostXcardtype->addSelection("Intel"); - HostXcardtype->addSelection("Via"); - HostXcardtype->setHelpText(QObject::tr("nVidia work, ati works,VMWARE works, Intel does not work(yet), Via is a joke")); - addChild(HostXcardtype); - setTrigger(HostXcardtype); - - AdvancedXGeneric_modelines *ADVANCEDXGENERICMODELINES = new AdvancedXGeneric_modelines; - AdvancedXNvidiaConnections *ADVANCEDXNVIDIACONNECTIONS = new AdvancedXNvidiaConnections; - - addTarget("VMWARE", ADVANCEDXGENERICMODELINES); - addTarget("Intel", ADVANCEDXGENERICMODELINES); - addTarget("Via", ADVANCEDXGENERICMODELINES); - - addTarget("nVidia",ADVANCEDXNVIDIACONNECTIONS); - addTarget("ATI",ADVANCEDXGENERICMODELINES); - - connect(this, SIGNAL(go(void)), - ADVANCEDXGENERICMODELINES, SLOT(AdvancedXGeneric_modelines_GatherSettings())); - connect(this, SIGNAL(gonVidia(void)), - ADVANCEDXNVIDIACONNECTIONS, SLOT(AdvancedXNvidiaConnectionsGatherSettings())); - -}; - -void AdvancedXcardtype::AdvancedXcardgatherSettings(void) -{ - //called when test button is pressed - hostparm.ThisXcardtype = HostXcardtype->getValue() ; - if (hostparm.ThisXcardtype == "nVidia") - emit gonVidia(); - else if (hostparm.ThisXcardtype =="ATI") - emit goATI(); - else - emit go(); -}; - - -AdvancedXSettings::AdvancedXSettings(): - TriggeredConfigurationGroup(true,true,true,true,true,true,true,true) { - setLabel(QObject::tr("Advanced X settings")); - Setting* Advancedxsettings = HostXUseAdvanced(); - addChild(Advancedxsettings); - setTrigger(Advancedxsettings); - HostXIgnoreConfig = new HostCheckBox("HostXIgnoreConfig"); - HostXIgnoreConfig->setLabel(QObject::tr("User supplied config. ")); - HostXIgnoreConfig->setValue(false); - #ifdef __MVAPP__ - HostXIgnoreConfig->setHelpText(QObject::tr("When this is checked, the system will use the configuration file provided by YOU. Place the file you want to use in /data/home/mythtv/templates/xorg.user.")); - #else - HostXIgnoreConfig->setHelpText(QObject::tr("When this is checked, the system will use the configuration file provided by YOU. Place the file you want to use in /home/mythtv/templates/xorg.user.")); - #endif - HorizontalConfigurationGroup *lp = - new HorizontalConfigurationGroup(false, false, true, true); - - TransButtonSetting *EDIDbutton = new TransButtonSetting(); - EDIDbutton->setLabel(tr("Display Settings")); - - TransButtonSetting *TestXbutton = new TransButtonSetting(); - TestXbutton->setLabel(tr("Test X Configuration")); - lp->addChild(EDIDbutton); - lp->addChild(TestXbutton); - - AdvancedXcardtype *AXCT = new AdvancedXcardtype ; - - ConfigurationGroup* settings = new VerticalConfigurationGroup(false); - settings->addChild(AXCT); - settings->addChild(lp); - - ConfigurationGroup* setting1 = new GridConfigurationGroup(1,false); - setting1->addChild(HostXres()); - setting1->addChild(HostXIgnoreConfig); - - connect(EDIDbutton, SIGNAL(pressed()), this, SLOT(ADJUSTEDID())); - connect(TestXbutton, SIGNAL(pressed()), AXCT, SLOT(AdvancedXcardgatherSettings())); - addTarget("0",setting1); - addTarget("1", settings); -}; - -void AdvancedXSettings::ADJUSTEDID(void) -{ - EDIDOptions edidscreen; - edidscreen.exec(); -} - - -void testXconfiguration(void) -{ - hostparm.ThisXIgnoreEDID =gContext->GetSetting("HostXIgnoreEDID"); - QString tempstring ; - tempstring = gContext->GetSetting("HostXHsyncLow"); - tempstring.append(" - "); - tempstring.append(gContext->GetSetting("HostXHsyncHigh") ); - hostparm.ThisXHsync=tempstring; - - tempstring =""; - tempstring=gContext->GetSetting("HostXVrefreshLow"); - tempstring.append(" - "); - tempstring.append(gContext->GetSetting("HostXVrefreshHigh")); - hostparm.ThisXVrefresh=tempstring; - hostparm.ThisXDisplaysize= gContext -> GetSetting("HostXDisplaysize"); - -// Assemble the advanced modeline string -/* - QString modelinetype = gContext->GetSetting("HostXModelineCatagory");; - QString tempmodeline = "HostXadvancedres" + modelinetype ; - QString modeline = gContext ->GetSetting(tempmodeline); - hostparm.ThisXresadvanced = modelinetype +"_"+modeline; -*/ -/* - cout << "start of parm list" << endl; - cout << "--------------------"<<endl; - cout << hostparm.ThisXcardtype << endl; - cout << hostparm. ThisXresadvanced<< endl; - cout << hostparm.ThisXconnection << endl; - cout << hostparm.ThisXTVstandard << endl; - cout << hostparm.ThisXTVconnection << endl; - cout << hostparm.ThisXIgnoreEDID << endl; - cout << hostparm.ThisXHsync << endl; - cout << hostparm.ThisXVrefresh<< endl; - cout << hostparm.ThisXDisplaysize<< endl; -*/ - QString commandline = "xconfig.sh test 0 "; - commandline.append(hostparm.ThisXcardtype); - commandline.append(" " ); - commandline.append(hostparm.ThisXIgnoreEDID ); - commandline.append(" " ); - commandline.append(hostparm.ThisXconnection ); - commandline.append(" \"" ); - commandline.append(hostparm.ThisXHsync ); - commandline.append(" \" " ); - commandline.append(" \"" ); - commandline.append(hostparm.ThisXVrefresh); - commandline.append(" \" " ); - commandline.append(hostparm.ThisXresadvanced ); - commandline.append(" " ); - commandline.append(hostparm.ThisXTVconnection ); - commandline.append(" " ); - commandline.append(" \"" ); - commandline.append(hostparm.ThisXDisplaysize); - commandline.append(" \" " ); - //cout << commandline << endl; - - QString message; - message = "Someday this button will do something, but for right now all it does is show this message."; - message.append ("\n"); - - message.append(commandline); - MythPopupBox::showOkPopup( - gContext->GetMainWindow(), QObject::tr("Test X button"), - message); -}; - - - - diff --git a/abs/core/mythinstall/xorgsettings.h b/abs/core/mythinstall/xorgsettings.h deleted file mode 100755 index 46c4952..0000000 --- a/abs/core/mythinstall/xorgsettings.h +++ /dev/null @@ -1,178 +0,0 @@ -#include <settings.h> -#include "mythdialogs.h" -#include "libmyth/mythdialogs.h" -#include "libmyth/mythwidgets.h" -#include "installsettings.h" - -class AdvancedXNvidiaConnections: public TriggeredConfigurationGroup { -Q_OBJECT -public: - AdvancedXNvidiaConnections(); - HostComboBox *HostXNvidiaConnection; - HostComboBox *HostXnVidiaTVformat; - HostComboBox *HostXnVidiaTVstandard; - -public slots: - void AdvancedXNvidiaConnectionsGatherSettings(); -signals: - void nVidia_sig(void); -}; - - -class AdvancedXNvidia_modelines: public TriggeredConfigurationGroup { - Q_OBJECT -public: - AdvancedXNvidia_modelines(); - HostComboBox *HostXNvidiaModelineCatagory; - HostComboBox *HostXNvidiaadvancedresVESA; - HostComboBox *HostXNvidiaadvancedresATSC; - HostComboBox *HostXNvidiaadvancedresDVD; - HostComboBox *HostXNvidiaadvancedresNTSC; - HostComboBox *HostXNvidiaadvancedresCustom; - HostCheckBox *HostXnVidia1080p; - HostCheckBox *HostXnVidia1080i; - HostCheckBox *HostXnVidia720p; - HostCheckBox *HostXnVidia480p; - void Nvidia_fillselection(QString); -public slots: - void AdvancedXNvidia_modelines_GatherSettings(void); -}; - - -//------------------------------------------------- - -class AdvancedXcardtype: public TriggeredConfigurationGroup { -Q_OBJECT -public: - AdvancedXcardtype(); - HostComboBox *HostXcardtype; - -public slots: - void AdvancedXcardgatherSettings(); -signals: - void go(void ); - void goATI(void); - void gonVidia(void); -}; - - -class AdvancedXSettings: public TriggeredConfigurationGroup { -Q_OBJECT -public: - AdvancedXSettings(); - HostCheckBox *HostXIgnoreConfig; -protected slots: - void ADJUSTEDID(void); -}; - - -class AdvancedXGeneric_modelines: public TriggeredConfigurationGroup { - Q_OBJECT -public: - AdvancedXGeneric_modelines(); - HostComboBox *HostXModelineCatagory; - HostComboBox *HostXadvancedresVESA; - HostComboBox *HostXadvancedresATSC; - HostComboBox *HostXadvancedresDVD; - HostComboBox *HostXadvancedresNTSC; - HostComboBox *HostXadvancedresCustom; - void generic_fillselection(QString); -public slots: - void AdvancedXGeneric_modelines_GatherSettings(void); -}; - - -class EDIDOptions : public ConfigurationWizard -{ -public: - EDIDOptions(); -}; - - - - - - - - -void testXconfiguration(); -void ReadDDCvalues(); -static HostComboBox *HostXres() -//Used in the simple config -{ - HostComboBox *gc = new HostComboBox("HostXres"); - gc->setLabel(QObject::tr("Initial resolution")); - const int num_defaults = 2; - char *defaults[num_defaults]={"800x600","1280x720"}; - int defaults_added[num_defaults]={0,0}; - int found_modes_in_xorg_log = FALSE; - - gc->addSelection("Auto"); - - { - FILE *modelines; - const char*mode_extract_command = - "sed -n 's/[[:space:]]\\+/ /g;" // compress whitespace - "s/[\\) ]: /#/g;" // Insert # as a field delimiter - "/Modes in ModePool/,/ModePool/p'" // get the Modelool lines - " /var/log/Xorg.0.log |" // from the Xorg log - "cut -d# -f2-3 | " // select the mode and description fields - "sed '/^\\\"/!d;" // Only selest modeline lines. - "/DoubleScan/d;" // Remove doublescan modelines. - "/nvidia-auto-select/d;" // Remove auto modeline. - "s/ x /x/g;" - "s/ @ /@/g;" - "s/From: //g;" - "s/ Format [0-9]*) (/, /g;" - "s/ Format [0-9]*//g;" - "s/ Server//g'"; //reformat. - cout << mode_extract_command << endl; - modelines = popen (mode_extract_command, "r"); - - char previous_mode[200]={0}; - - if (modelines) - { - char line_in[200]; - while (fgets (line_in, sizeof (line_in), modelines)) - { - char *separator; - - if (strchr (line_in, '\n')) - strchr (line_in, '\n')[0]=0; - - separator = strchr (line_in, '#'); - - if (separator) - { - separator[0]=0; - separator++; - - // Skip this mode if the description is identical to the previous. - if (strcmp (previous_mode, separator) == 0) - continue; - - strncpy (previous_mode, separator, sizeof(previous_mode)); - gc->addSelection(separator, line_in); - found_modes_in_xorg_log = TRUE; - - for (int def = 0; def < num_defaults; def++) - if (strncmp (&line_in[1], defaults[def], strlen (defaults[def]))==0) - defaults_added[def]=1; - } - } - pclose (modelines); - } - } - - for (int def = 0; def < num_defaults; def++) - if (!defaults_added[def]) - gc->addSelection(defaults[def], defaults[def]); - - if (found_modes_in_xorg_log) - gc->setHelpText(QObject::tr("Choose a resolution to match your display and a refresh rate to match the content you will be recording - 60 Hz for NTSC (e.g. US) 50 Hz for PAL (e.g. UK, Aust, NZ).")); - else - gc->setHelpText(QObject::tr("Choose the resolution to use when the system reboots.")); - - return gc; -} |