diff options
author | James Meyer <james.meyer@operamail.com> | 2009-08-02 04:36:08 (GMT) |
---|---|---|
committer | James Meyer <james.meyer@operamail.com> | 2009-08-02 04:36:08 (GMT) |
commit | 9a4b520578e61b098b4dce7a3ba2376c0c74b01e (patch) | |
tree | 0b77dde997c3554e8211e386485ddc1199ecc476 /abs/core-testing/mythinstall/infrared.cpp | |
parent | 68f0ad93db42767b17f0c9187354b3f0533e896c (diff) | |
parent | 657aa7b8d352108a98719a22e6422b490e598d26 (diff) | |
download | linhes_pkgbuild-9a4b520578e61b098b4dce7a3ba2376c0c74b01e.zip linhes_pkgbuild-9a4b520578e61b098b4dce7a3ba2376c0c74b01e.tar.gz linhes_pkgbuild-9a4b520578e61b098b4dce7a3ba2376c0c74b01e.tar.bz2 |
Merge branch 'HEAD' of ssh://jams@knoppmyth.net/mount/repository/LinHES-PKGBUILD
Diffstat (limited to 'abs/core-testing/mythinstall/infrared.cpp')
-rwxr-xr-x | abs/core-testing/mythinstall/infrared.cpp | 368 |
1 files changed, 368 insertions, 0 deletions
diff --git a/abs/core-testing/mythinstall/infrared.cpp b/abs/core-testing/mythinstall/infrared.cpp new file mode 100755 index 0000000..2f56ae5 --- /dev/null +++ b/abs/core-testing/mythinstall/infrared.cpp @@ -0,0 +1,368 @@ +#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()); + } + + |