Ticket #10092: settings-mythfrontend-2012-03-09.diff

File settings-mythfrontend-2012-03-09.diff, 230.7 KB (added by Xavier Hervy <xavier.hervy@…>, 14 years ago)
  • mythtv/programs/mythfrontend/audiogeneralsettings.cpp

    diff --git a/mythtv/programs/mythfrontend/audiogeneralsettings.cpp b/mythtv/programs/mythfrontend/audiogeneralsettings.cpp
    index 1c8e2d5..ab57b8a 100644
    a b extern "C" {  
    2525#include "libavformat/avformat.h"
    2626}
    2727
    28 
    29 class TriggeredItem : public TriggeredConfigurationGroup
    30 {
    31   public:
    32     TriggeredItem(Setting *checkbox, ConfigurationGroup *group) :
    33         TriggeredConfigurationGroup(false, false, false, false)
    34     {
    35         setTrigger(checkbox);
    36 
    37         addTarget("1", group);
    38         addTarget("0", new VerticalConfigurationGroup(true));
    39     }
    40     TriggeredItem(Setting *checkbox, Setting *setting) :
    41         TriggeredConfigurationGroup(false, false, false, false)
    42     {
    43         setTrigger(checkbox);
    44 
    45         addTarget("1", setting);
    46         addTarget("0", new VerticalConfigurationGroup(false, false));
    47     }
    48 };
    49 
    5028AudioDeviceComboBox::AudioDeviceComboBox(AudioConfigSettings *parent) :
    51     HostComboBox("AudioOutputDevice", true), m_parent(parent)
     29    HostComboBoxSetting("AudioOutputDevice", true), m_parent(parent)
    5230{
    5331    setLabel(QObject::tr("Audio output device"));
    5432#ifdef USING_ALSA
    AudioDeviceComboBox::AudioDeviceComboBox(AudioConfigSettings *parent) :  
    6644                                               dflt);
    6745    addSelection(current, current, true);
    6846
    69     connect(this, SIGNAL(valueChanged(const QString&)),
    70             this, SLOT(AudioDescriptionHelp(const QString&)));
     47    connect(this, SIGNAL(valueChanged(StandardSetting *)),
     48            this, SLOT(AudioDescriptionHelp(StandardSetting *)));
     49}
     50
     51void AudioDeviceComboBox::edit(MythScreenType * screen)
     52{
     53    AudioRescan();
     54    HostComboBoxSetting::edit(screen);
    7155}
    7256
    7357void AudioDeviceComboBox::AudioRescan()
    void AudioDeviceComboBox::AudioRescan()  
    8064
    8165    QString value = getValue();
    8266    clearSelections();
    83     resetMaxCount(vect.size());
    8467
    8568    bool found = false;
    8669    for (it = vect.begin(); it != vect.end(); ++it)
    void AudioDeviceComboBox::AudioRescan()  
    8871                     value == it->name ? (found = true) : false);
    8972    if (!found)
    9073    {
    91         resetMaxCount(vect.size()+1);
    9274        addSelection(value, value, true);
    9375    }
    94         // For some reason, it adds an empty entry, remove it
    95     removeSelection(QString::null);
    9676}
    9777
    98 void AudioDeviceComboBox::AudioDescriptionHelp(const QString &device)
     78void AudioDeviceComboBox::AudioDescriptionHelp(StandardSetting * setting)
    9979{
    100     QString desc = m_parent->AudioDeviceMap().value(device).desc;
     80    QString desc = m_parent->AudioDeviceMap().value(setting->getValue()).desc;
    10181    setHelpText(desc);
    10282}
    10383
    104 AudioConfigSettings::AudioConfigSettings(ConfigurationWizard *parent) :
    105     VerticalConfigurationGroup(false, true, false, false),
    106     m_OutputDevice(NULL),   m_MaxAudioChannels(NULL),
    107     m_AudioUpmix(NULL),     m_AudioUpmixType(NULL),
    108     m_AC3PassThrough(NULL), m_DTSPassThrough(NULL),
    109     m_EAC3PassThrough(NULL),m_TrueHDPassThrough(NULL), m_DTSHDPassThrough(NULL),
    110     m_parent(parent)
     84
     85AudioConfigSettings::AudioConfigSettings() :
     86    GroupSetting()
    11187{
    11288    setLabel(QObject::tr("Audio System"));
    113     setUseLabel(false);
    114 
    115     ConfigurationGroup *devicegroup = new HorizontalConfigurationGroup(false,
    116                                                                        false);
    117     devicegroup->addChild((m_OutputDevice = new AudioDeviceComboBox(this)));
    118         // Rescan button
    119     TransButtonSetting *rescan = new TransButtonSetting("rescan");
    120     rescan->setLabel(QObject::tr("Rescan"));
    121     rescan->setHelpText(QObject::tr("Rescan for available audio devices. "
    122                                     "Current entry will be checked and "
    123                                     "capability entries populated."));
    124     devicegroup->addChild(rescan);
    125     connect(rescan, SIGNAL(pressed()), this, SLOT(AudioRescan()));
    126     addChild(devicegroup);
     89
     90    this->addChild((m_OutputDevice = new AudioDeviceComboBox(this)));
    12791
    12892    QString name = m_OutputDevice->getValue();
    12993    AudioOutput::AudioDeviceConfig *adc =
    AudioConfigSettings::AudioConfigSettings(ConfigurationWizard *parent) :  
    139103
    140104    delete adc;
    141105
    142     ConfigurationGroup *maingroup = new VerticalConfigurationGroup(false,
    143                                                                    false);
    144     addChild(maingroup);
    145106
    146     m_triggerDigital = new TransCheckBoxSetting();
    147     m_AC3PassThrough = AC3PassThrough();
    148     m_DTSPassThrough = DTSPassThrough();
    149     m_EAC3PassThrough = EAC3PassThrough();
    150     m_TrueHDPassThrough = TrueHDPassThrough();
    151     m_DTSHDPassThrough = DTSHDPassThrough();
     107    // digital settings
     108    m_triggerDigital = new GroupSetting();
     109    m_triggerDigital->setLabel(QObject::tr("Digital Audio Capabilities"));
     110    m_triggerDigital->addChild(m_AC3PassThrough = AC3PassThrough());
     111    m_triggerDigital->addChild(m_DTSPassThrough = DTSPassThrough());
     112    m_triggerDigital->addChild(m_EAC3PassThrough = EAC3PassThrough());
     113    m_triggerDigital->addChild(m_TrueHDPassThrough = TrueHDPassThrough());
     114    m_triggerDigital->addChild(m_DTSHDPassThrough = DTSHDPassThrough());
     115    addChild(m_triggerDigital);
     116
     117    addChild((m_MaxAudioChannels = MaxAudioChannels()));
     118    addChild((m_AudioUpmix = AudioUpmix()));
     119    addChild((m_AudioUpmixType = AudioUpmixType()));
     120    addChild(MythControlsVolume());
     121
    152122
    153     m_cgsettings = new HorizontalConfigurationGroup();
    154     m_cgsettings->setLabel(QObject::tr("Digital Audio Capabilities"));
    155     m_cgsettings->addChild(m_AC3PassThrough);
    156     m_cgsettings->addChild(m_DTSPassThrough);
    157     m_cgsettings->addChild(m_EAC3PassThrough);
    158     m_cgsettings->addChild(m_TrueHDPassThrough);
    159     m_cgsettings->addChild(m_DTSHDPassThrough);
     123    //Advanced Settings
     124    GroupSetting * advancedSettings = new GroupSetting();
     125    advancedSettings->setLabel(QObject::tr("Advanced Audio Settings"));
     126    advancedSettings->setHelpText(QObject::tr("Enable extra audio settings. Under most "
     127                                  "usage all options should be left alone"));
     128    addChild(advancedSettings);
     129    m_PassThroughOverride = PassThroughOverride();
     130    advancedSettings->addChild(m_PassThroughOverride);
     131    m_PassThroughDeviceOverride = PassThroughOutputDevice();
     132    advancedSettings->addChild(m_PassThroughDeviceOverride);
     133    connect(m_PassThroughOverride, SIGNAL(valueChanged(bool)),
     134            m_PassThroughDeviceOverride, SLOT(setEnabled(bool)));
    160135
    161     TriggeredItem *sub1 = new TriggeredItem(m_triggerDigital, m_cgsettings);
    162136
    163     maingroup->addChild(sub1);
     137    StandardSetting *srcqualityoverride = SRCQualityOverride();
     138    srcqualityoverride->addTargetedChild("1",SRCQuality());
    164139
    165     maingroup->addChild((m_MaxAudioChannels = MaxAudioChannels()));
    166     maingroup->addChild((m_AudioUpmix = AudioUpmix()));
    167     maingroup->addChild((m_AudioUpmixType = AudioUpmixType()));
     140    advancedSettings->addChild(Audio48kOverride());
     141#if USING_ALSA
     142    advancedSettings->addChild(SPDIFRateOverride());
     143#endif
    168144
    169     TransButtonSetting *test = new TransButtonSetting("test");
    170     test->setLabel(QObject::tr("Test"));
    171     test->setHelpText(QObject::tr("Will play a test pattern on all configured "
    172                                   "speakers"));
    173     connect(test, SIGNAL(pressed()), this, SLOT(StartAudioTest()));
    174     addChild(test);
     145    advancedSettings->addChild(m_MPCM = MPCM());
    175146
    176     TransButtonSetting *advanced = new TransButtonSetting("advanced");
    177     advanced->setLabel(QObject::tr("Advanced Audio Settings"));
    178     advanced->setHelpText(QObject::tr("Enable extra audio settings. Under most "
    179                                   "usage all options should be left alone"));
    180     connect(advanced, SIGNAL(pressed()), this, SLOT(AudioAdvanced()));
    181     addChild(advanced);
     147    addChild(m_audioTest = new AudioTest());
    182148
    183149        // Set slots
    184     connect(m_MaxAudioChannels, SIGNAL(valueChanged(const QString&)),
    185             this, SLOT(UpdateVisibility(const QString&)));
    186     connect(m_OutputDevice, SIGNAL(valueChanged(const QString&)),
    187             this, SLOT(UpdateCapabilities(const QString&)));
    188     connect(m_AC3PassThrough, SIGNAL(valueChanged(const QString&)),
    189             this, SLOT(UpdateCapabilities(const QString&)));
    190     connect(m_DTSPassThrough, SIGNAL(valueChanged(const QString&)),
    191             this, SLOT(UpdateCapabilities(const QString&)));
    192     connect(m_EAC3PassThrough, SIGNAL(valueChanged(const QString&)),
    193             this, SLOT(UpdateCapabilities(const QString&)));
    194     connect(m_TrueHDPassThrough, SIGNAL(valueChanged(const QString&)),
    195             this, SLOT(UpdateCapabilities(const QString&)));
    196     connect(m_DTSHDPassThrough, SIGNAL(valueChanged(const QString&)),
    197             this, SLOT(UpdateCapabilities(const QString&)));
     150    connect(m_MaxAudioChannels, SIGNAL(valueChanged(StandardSetting *)),
     151            this, SLOT(UpdateVisibility(StandardSetting *)));
     152    connect(m_OutputDevice, SIGNAL(valueChanged(StandardSetting *)),
     153            this, SLOT(UpdateCapabilities(StandardSetting *)));
     154    connect(m_AC3PassThrough, SIGNAL(valueChanged(StandardSetting *)),
     155            this, SLOT(UpdateCapabilities(StandardSetting *)));
     156    connect(m_DTSPassThrough, SIGNAL(valueChanged(StandardSetting *)),
     157            this, SLOT(UpdateCapabilities(StandardSetting *)));
     158    connect(m_EAC3PassThrough, SIGNAL(valueChanged(StandardSetting *)),
     159            this, SLOT(UpdateCapabilities(StandardSetting *)));
     160    connect(m_TrueHDPassThrough, SIGNAL(valueChanged(StandardSetting *)),
     161            this, SLOT(UpdateCapabilities(StandardSetting *)));
     162    connect(m_DTSHDPassThrough, SIGNAL(valueChanged(StandardSetting *)),
     163            this, SLOT(UpdateCapabilities(StandardSetting *)));
     164    //Slot for audio test
     165    connect(m_OutputDevice,SIGNAL(valueChanged(StandardSetting *)),
     166            this,SLOT(UpdateAudioTest()));
     167    connect(m_MaxAudioChannels,SIGNAL(valueChanged(StandardSetting *)),
     168            this,SLOT(UpdateAudioTest()));
     169
     170
    198171    AudioRescan();
    199172}
    200173
    201174void AudioConfigSettings::AudioRescan()
    202175{
     176
     177        LOG(VB_GENERAL, LOG_ERR,
     178            QString("AudioConfigSettings::AudioRescan()"));
    203179    if (!slotlock.tryLock())
    204180        return;
    205181
    void AudioConfigSettings::AudioRescan()  
    237213    {
    238214        QString msg =QObject::tr("Passthrough device is invalid or not useable."
    239215                                 " Check configuration in Advanced Settings:") +
    240             gCoreContext->GetSetting("PassThruOutputDevice");
     216            m_PassThroughDeviceOverride->getValue();
    241217        MythPopupBox::showOkPopup(
    242218            GetMythMainWindow(), QObject::tr("Warning"), msg);
    243219        LOG(VB_GENERAL, LOG_ERR, QString("Audio device %1 isn't usable")
    244220                .arg(name));
    245221    }
    246222    slotlock.unlock();
    247     UpdateCapabilities(QString::null);
     223    UpdateCapabilities(NULL);
    248224}
    249225
    250 void AudioConfigSettings::UpdateVisibility(const QString &device)
     226void AudioConfigSettings::UpdateVisibility(StandardSetting *)
    251227{
    252228    if (!m_MaxAudioChannels && !m_AudioUpmix && !m_AudioUpmixType)
    253229        return;
    void AudioConfigSettings::UpdateVisibility(const QString &device)  
    258234}
    259235
    260236AudioOutputSettings AudioConfigSettings::UpdateCapabilities(
    261     const QString &device)
     237    StandardSetting *)
    262238{
    263239    int max_speakers = 8;
    264240    int realmax_speakers = 8;
    AudioOutputSettings AudioConfigSettings::UpdateCapabilities(  
    290266    }
    291267    else
    292268    {
    293         bool bForceDigital =
    294             gCoreContext->GetNumSetting("PassThruDeviceOverride", false);
     269
     270        bool bForceDigital = m_PassThroughOverride->boolValue();
    295271
    296272        settings = audiodevs.value(out).settings;
    297273        settingsdigital = bForceDigital ?
    298             audiodevs.value(gCoreContext->GetSetting("PassThruOutputDevice"))
     274            audiodevs.value(m_PassThroughDeviceOverride->getValue())
    299275            .settings : settings;
    300276
    301277        realmax_speakers = max_speakers = settings.BestSupportedChannels();
    AudioOutputSettings AudioConfigSettings::UpdateCapabilities(  
    320296            max_speakers = 6;
    321297    }
    322298
    323     m_triggerDigital->setValue(invalid || settingsdigital.canFeature(
     299    m_triggerDigital->setEnabled(invalid || settingsdigital.canFeature(
    324300                                   FEATURE_AC3 | FEATURE_DTS | FEATURE_EAC3 |
    325301                                   FEATURE_TRUEHD | FEATURE_DTSHD));
     302   
    326303    m_EAC3PassThrough->setEnabled(bEAC3);
    327304    m_TrueHDPassThrough->setEnabled(bTRUEHD);
    328305    m_DTSHDPassThrough->setEnabled(bDTSHD);
    AudioOutputSettings AudioConfigSettings::UpdateCapabilities(  
    335312        cur_speakers = max_speakers;
    336313    }
    337314
    338         // Remove everything and re-add available channels
     315    // Remove everything and re-add available channels
    339316    m_MaxAudioChannels->clearSelections();
    340     m_MaxAudioChannels->resetMaxCount(3);
    341317    for (int i = 1; i <= max_speakers; i++)
    342318    {
    343319        if (invalid || settings.IsSupportedChannels(i))
    AudioOutputSettings AudioConfigSettings::UpdateCapabilities(  
    362338                                             i == cur_speakers);
    363339        }
    364340    }
     341
     342    setMPCMEnabled(settings.canPassthrough() >= 0);
    365343        // Return values is used by audio test
    366344        // where we mainly are interested by the number of channels
    367345        // if we support AC3 and/or LPCM
    AudioOutputSettings AudioConfigSettings::UpdateCapabilities(  
    373351    return settings;
    374352}
    375353
    376 void AudioConfigSettings::AudioAdvanced()
    377 {
    378     QString out  = m_OutputDevice->getValue();
    379     bool invalid = false;
    380     AudioOutputSettings settings;
    381 
    382     if (!audiodevs.contains(out))
    383     {
    384         invalid = true;
    385     }
    386     else
    387     {
    388         settings = audiodevs.value(out).settings;
    389     }
    390 
    391     AudioAdvancedSettingsGroup audiosettings(invalid ||
    392                                              (settings.canPassthrough() >= 0));
    393 
    394     if (audiosettings.exec() == kDialogCodeAccepted)
    395     {
    396         AudioRescan();
    397         UpdateCapabilities(QString::null);
    398     }
    399 }
    400 
    401 HostComboBox *AudioConfigSettings::MaxAudioChannels()
     354HostComboBoxSetting *AudioConfigSettings::MaxAudioChannels()
    402355{
    403356    QString name = "MaxChannels";
    404     HostComboBox *gc = new HostComboBox(name, false);
     357    HostComboBoxSetting *gc = new HostComboBoxSetting(name, false);
    405358    gc->setLabel(QObject::tr("Speaker configuration"));
    406359    gc->addSelection(QObject::tr("Stereo"), "2", true); // default
    407360    gc->setHelpText(QObject::tr("Select the maximum number of audio "
    HostComboBox *AudioConfigSettings::MaxAudioChannels()  
    410363    return gc;
    411364}
    412365
    413 HostCheckBox *AudioConfigSettings::AudioUpmix()
     366HostCheckBoxSetting *AudioConfigSettings::AudioUpmix()
    414367{
    415     HostCheckBox *gc = new HostCheckBox("AudioDefaultUpmix");
     368    HostCheckBoxSetting *gc = new HostCheckBoxSetting("AudioDefaultUpmix");
    416369    gc->setLabel(QObject::tr("Upconvert stereo to 5.1 surround"));
    417370    gc->setValue(true);
    418371    gc->setHelpText(QObject::tr("If enabled, MythTV will upconvert stereo "
    HostCheckBox *AudioConfigSettings::AudioUpmix()  
    421374    return gc;
    422375}
    423376
    424 HostComboBox *AudioConfigSettings::AudioUpmixType()
     377HostComboBoxSetting *AudioConfigSettings::AudioUpmixType()
    425378{
    426     HostComboBox *gc = new HostComboBox("AudioUpmixType",false);
     379    HostComboBoxSetting *gc = new HostComboBoxSetting("AudioUpmixType",false);
    427380    gc->setLabel(QObject::tr("Upmix Quality"));
    428381    gc->addSelection(QObject::tr("Good"), "1");
    429382    gc->addSelection(QObject::tr("Best"), "2", true);  // default
    HostComboBox *AudioConfigSettings::AudioUpmixType()  
    431384    return gc;
    432385}
    433386
    434 HostCheckBox *AudioConfigSettings::AC3PassThrough()
     387HostCheckBoxSetting *AudioConfigSettings::AC3PassThrough()
    435388{
    436     HostCheckBox *gc = new HostCheckBox("AC3PassThru");
     389    HostCheckBoxSetting *gc = new HostCheckBoxSetting("AC3PassThru");
    437390    gc->setLabel(QObject::tr("Dolby Digital"));
    438391    gc->setValue(false);
    439392    gc->setHelpText(QObject::tr("Enable if your amplifier or sound decoder "
    HostCheckBox *AudioConfigSettings::AC3PassThrough()  
    442395    return gc;
    443396}
    444397
    445 HostCheckBox *AudioConfigSettings::DTSPassThrough()
     398HostCheckBoxSetting *AudioConfigSettings::DTSPassThrough()
    446399{
    447     HostCheckBox *gc = new HostCheckBox("DTSPassThru");
     400    HostCheckBoxSetting *gc = new HostCheckBoxSetting("DTSPassThru");
    448401    gc->setLabel(QObject::tr("DTS"));
    449402    gc->setValue(false);
    450403    gc->setHelpText(QObject::tr("Enable if your amplifier or sound decoder "
    HostCheckBox *AudioConfigSettings::DTSPassThrough()  
    453406    return gc;
    454407}
    455408
    456 HostCheckBox *AudioConfigSettings::EAC3PassThrough()
     409HostCheckBoxSetting *AudioConfigSettings::EAC3PassThrough()
    457410{
    458     HostCheckBox *gc = new HostCheckBox("EAC3PassThru");
     411    HostCheckBoxSetting *gc = new HostCheckBoxSetting("EAC3PassThru");
    459412    gc->setLabel(QObject::tr("E-AC-3"));
    460413    gc->setValue(false);
    461414    gc->setHelpText(QObject::tr("Enable if your amplifier or sound decoder "
    HostCheckBox *AudioConfigSettings::EAC3PassThrough()  
    463416    return gc;
    464417}
    465418
    466 HostCheckBox *AudioConfigSettings::TrueHDPassThrough()
     419HostCheckBoxSetting *AudioConfigSettings::TrueHDPassThrough()
    467420{
    468     HostCheckBox *gc = new HostCheckBox("TrueHDPassThru");
     421    HostCheckBoxSetting *gc = new HostCheckBoxSetting("TrueHDPassThru");
    469422    gc->setLabel(QObject::tr("TrueHD"));
    470423    gc->setValue(false);
    471424    gc->setHelpText(QObject::tr("Enable if your amplifier or sound decoder "
    HostCheckBox *AudioConfigSettings::TrueHDPassThrough()  
    473426    return gc;
    474427}
    475428
    476 HostCheckBox *AudioConfigSettings::DTSHDPassThrough()
     429HostCheckBoxSetting *AudioConfigSettings::DTSHDPassThrough()
    477430{
    478     HostCheckBox *gc = new HostCheckBox("DTSHDPassThru");
     431    HostCheckBoxSetting *gc = new HostCheckBoxSetting("DTSHDPassThru");
    479432    gc->setLabel(QObject::tr("DTS-HD"));
    480433    gc->setValue(false);
    481434    gc->setHelpText(QObject::tr("Enable if your amplifier or sound decoder "
    bool AudioConfigSettings::CheckPassthrough()  
    487440{
    488441    bool ok = true;
    489442
    490     if (gCoreContext->GetNumSetting("PassThruDeviceOverride", false))
     443    if (m_PassThroughOverride->boolValue())
    491444    {
    492         QString name = gCoreContext->GetSetting("PassThruOutputDevice");
     445        QString name = m_PassThroughDeviceOverride->getValue();
    493446        AudioOutput::AudioDeviceConfig *adc =
    494447            AudioOutput::GetAudioDeviceConfig(name, name, true);
    495448        if (adc->settings.IsInvalid())
    bool AudioConfigSettings::CheckPassthrough()  
    507460    return ok;
    508461}
    509462
    510 void AudioConfigSettings::StartAudioTest()
     463static void fillSelectionsFromDir(HostComboBoxSetting *comboBox, const QDir& dir, bool absPath = true)
     464
     465{
     466    QFileInfoList il = dir.entryInfoList();
     467
     468    for (QFileInfoList::Iterator it = il.begin();
     469                                 it != il.end();
     470                                ++it )
     471    {
     472         QFileInfo &fi = *it;
     473
     474        if (absPath)
     475            comboBox->addSelection( fi.absoluteFilePath() );
     476        else
     477            comboBox->addSelection( fi.fileName() );
     478    }
     479}
     480
     481HostComboBoxSetting *AudioConfigSettings::MixerDevice()
     482{
     483    HostComboBoxSetting *gc = new HostComboBoxSetting("MixerDevice", true);
     484    gc->setLabel(QObject::tr("Mixer device"));
     485
     486#ifdef USING_OSS
     487    QDir dev("/dev", "mixer*", QDir::Name, QDir::System);
     488    fillSelectionsFromDir(gc, dev);
     489
     490    dev.setPath("/dev/sound");
     491    if (dev.exists())
     492    {
     493        fillSelectionsFromDir(gc, dev);
     494    }
     495#endif
     496#ifdef USING_ALSA
     497    gc->addSelection("ALSA:default", "ALSA:default");
     498#endif
     499#ifdef USING_MINGW
     500    gc->addSelection("DirectX:", "DirectX:");
     501    gc->addSelection("Windows:", "Windows:");
     502#endif
     503#if !defined(USING_MINGW)
     504    gc->addSelection("software", "software");
     505    gc->setHelpText(QObject::tr("Setting the mixer device to \"software\" "
     506                    "lets MythTV control the volume of all audio at the "
     507                    "expense of a slight quality loss."));
     508#endif
     509
     510    return gc;
     511}
     512
     513static const char* MixerControlControls[] = { "PCM",
     514                                              "Master" };
     515
     516HostComboBoxSetting *AudioConfigSettings::MixerControl()
    511517{
    512     AudioOutputSettings settings = UpdateCapabilities(QString::null);
     518    HostComboBoxSetting *gc = new HostComboBoxSetting("MixerControl", true);
     519    gc->setLabel(QObject::tr("Mixer controls"));
     520    for (unsigned int i = 0; i < sizeof(MixerControlControls) / sizeof(char*);
     521         ++i)
     522    {
     523        gc->addSelection(QObject::tr(MixerControlControls[i]),
     524                         MixerControlControls[i]);
     525    }
     526
     527    gc->setHelpText(QObject::tr("Changing the volume adjusts the selected mixer."));
     528    return gc;
     529}
     530
     531
     532//TODO was a slider
     533HostSpinBoxSetting *AudioConfigSettings::MixerVolume()
     534{
     535    HostSpinBoxSetting *gs = new HostSpinBoxSetting("MasterMixerVolume", 0, 100, 1);
     536    gs->setLabel(QObject::tr("Master mixer volume"));
     537    gs->setValue(70);
     538    gs->setHelpText(QObject::tr("Initial volume for the Master mixer. "
     539                    "This affects all sound created by the audio device. "
     540                    "Note: Do not set this too low."));
     541    return gs;
     542}
     543
     544//TODO was a slider
     545HostSpinBoxSetting *AudioConfigSettings::PCMVolume()
     546{
     547    HostSpinBoxSetting *gs = new HostSpinBoxSetting("PCMMixerVolume", 0, 100, 1);
     548    gs->setLabel(QObject::tr("PCM mixer volume"));
     549    gs->setValue(70);
     550    gs->setHelpText(QObject::tr("Initial volume for PCM output. Using the "
     551                    "volume keys in MythTV will adjust this parameter."));
     552    return gs;
     553}
     554
     555
     556HostCheckBoxSetting *AudioConfigSettings::MythControlsVolume()
     557{
     558    HostCheckBoxSetting *gc = new HostCheckBoxSetting("MythControlsVolume");
     559    gc->setLabel(QObject::tr("Use internal volume controls"));
     560    gc->setValue(true);
     561    gc->setHelpText(QObject::tr("If enabled, MythTV will control the PCM and "
     562                    "master mixer volume. Disable this option if you prefer "
     563                    "to control the volume externally (for example, using "
     564                    "your amplifier) or if you use an external mixer program."));
     565
     566    gc->addTargetedChild("1",MixerDevice());
     567    gc->addTargetedChild("1",MixerControl());
     568    gc->addTargetedChild("1",MixerVolume());
     569    gc->addTargetedChild("1",PCMVolume());
     570    return gc;
     571}
     572
     573void AudioConfigSettings::UpdateAudioTest()
     574{
     575
     576    LOG(VB_GENERAL, LOG_ERR, "AudioConfigSettings::UpdateAudioTest()");
     577    AudioOutputSettings settings = UpdateCapabilities(NULL);
    513578   
    514579    QString out  = m_OutputDevice->getValue();
    515     QString passthrough =
    516         gCoreContext->GetNumSetting("PassThruDeviceOverride", false) ?
    517         gCoreContext->GetSetting("PassThruOutputDevice") : QString::null;
     580    QString passthrough = m_PassThroughOverride->boolValue() ?
     581                     m_PassThroughDeviceOverride->getValue(): QString::null;
    518582    int channels = m_MaxAudioChannels->getValue().toInt();
    519     QString errMsg;
    520583
    521     AudioTestGroup audiotest(out, passthrough, channels, settings);
     584    m_audioTest->UpdateCapabilities(out, passthrough, channels, settings);
    522585
    523     audiotest.exec();
    524586}
    525587
    526588AudioTestThread::AudioTestThread(QObject *parent,
    void AudioTestThread::run()  
    691753    RunEpilog();
    692754}
    693755
    694 AudioTest::AudioTest(QString main, QString passthrough,
    695                      int channels, AudioOutputSettings settings)
    696     : VerticalConfigurationGroup(false, true, false, false),
    697       m_frontleft(NULL), m_frontright(NULL), m_center(NULL),
    698       m_surroundleft(NULL), m_surroundright(NULL),
    699       m_rearleft(NULL), m_rearright(NULL), m_lfe(NULL),
    700       m_main(main), m_passthrough(passthrough), m_settings(settings),
     756AudioTest::AudioTest()
     757    : GroupSetting(),
     758      m_at(NULL),
    701759      m_quality(false)
    702760{
     761    int channels=2;
     762
     763
    703764    m_channels = gCoreContext->GetNumSetting("TestingChannels", channels);
    704765    setLabel(QObject::tr("Audio Configuration Testing"));
     766    setHelpText(QObject::tr("Will play a test pattern on all configured "
     767                                  "speakers"));
    705768
    706     m_at = new AudioTestThread(this, m_main, m_passthrough, m_channels,
    707                                m_settings, m_quality);
    708     if (!m_at->result().isEmpty())
    709     {
    710         QString msg = main + QObject::tr(" is invalid or not "
    711                                          "useable.");
    712         MythPopupBox::showOkPopup(
    713             GetMythMainWindow(), QObject::tr("Warning"), msg);
    714         return;
    715     }
    716 
    717     m_button = new TransButtonSetting("start");
    718     m_button->setLabel(QObject::tr("Test All"));
    719     m_button->setHelpText(QObject::tr("Start all channels test"));
    720     connect(m_button, SIGNAL(pressed(QString)), this, SLOT(toggle(QString)));
    721 
    722     ConfigurationGroup *frontgroup =
    723         new HorizontalConfigurationGroup(false,
    724                                          false);
    725     ConfigurationGroup *middlegroup =
    726         new HorizontalConfigurationGroup(false,
    727                                          false);
    728     ConfigurationGroup *reargroup =
    729         new HorizontalConfigurationGroup(false,
    730                                          false);
    731     m_frontleft = new TransButtonSetting("0");
     769    m_frontleft = new ButtonStandardSetting("0");
    732770    m_frontleft->setLabel(QObject::tr("Front Left"));
     771    addChild(m_frontleft);
    733772    connect(m_frontleft,
    734             SIGNAL(pressed(QString)), this, SLOT(toggle(QString)));
    735     m_frontright = new TransButtonSetting(m_channels == 2 ? "1" : "2");
     773            SIGNAL(clicked()), this, SLOT(toggle()));
     774    m_frontright = new ButtonStandardSetting(m_channels == 2 ? "1" : "2");
    736775    m_frontright->setLabel(QObject::tr("Front Right"));
     776    addChild(m_frontright);
    737777    connect(m_frontright,
    738             SIGNAL(pressed(QString)), this, SLOT(toggle(QString)));
    739     frontgroup->addChild(m_frontleft);
    740 
    741     switch(m_channels)
    742     {
    743         case 8:
    744             m_rearleft = new TransButtonSetting("5");
    745             m_rearleft->setLabel(QObject::tr("Rear Left"));
    746             connect(m_rearleft,
    747                     SIGNAL(pressed(QString)), this, SLOT(toggle(QString)));
    748             reargroup->addChild(m_rearleft);
    749 
    750         case 7:
    751             m_rearright = new TransButtonSetting("4");
    752             m_rearright->setLabel(QObject::tr(m_channels == 8 ?
    753                                               "Rear Right" : "Rear Center"));
    754             connect(m_rearright,
    755                     SIGNAL(pressed(QString)), this, SLOT(toggle(QString)));
    756 
    757             reargroup->addChild(m_rearright);
    758 
    759         case 6:
    760             m_lfe = new TransButtonSetting(m_channels == 6 ? "5" :
    761                                            m_channels == 7 ? "6" : "7");
    762             m_lfe->setLabel(QObject::tr("LFE"));
    763             connect(m_lfe,
    764                     SIGNAL(pressed(QString)), this, SLOT(toggle(QString)));
    765 
    766         case 5:
    767             m_surroundleft = new TransButtonSetting(m_channels == 6 ? "4" :
    768                                                     m_channels == 7 ? "5" : "6");
    769             m_surroundleft->setLabel(QObject::tr("Surround Left"));
    770             connect(m_surroundleft,
    771                     SIGNAL(pressed(QString)), this, SLOT(toggle(QString)));
    772             m_surroundright = new TransButtonSetting("3");
    773             m_surroundright->setLabel(QObject::tr("Surround Right"));
    774             connect(m_surroundright,
    775                     SIGNAL(pressed(QString)), this, SLOT(toggle(QString)));
    776             m_center = new TransButtonSetting("1");
    777             m_center->setLabel(QObject::tr("Center"));
    778             connect(m_center,
    779                     SIGNAL(pressed(QString)), this, SLOT(toggle(QString)));
    780             frontgroup->addChild(m_center);
    781             middlegroup->addChild(m_surroundleft);
    782             if (m_lfe)
    783                 middlegroup->addChild(m_lfe);
    784             middlegroup->addChild(m_surroundright);
    785 
    786         case 2:
    787             break;
    788     }
    789     frontgroup->addChild(m_frontright);
    790     addChild(frontgroup);
    791     addChild(middlegroup);
    792     addChild(reargroup);
    793     addChild(m_button);
    794 
    795     m_hd = new TransCheckBoxSetting();
     778            SIGNAL(clicked()), this, SLOT(toggle()));
     779
     780    m_rearleft = new ButtonStandardSetting("5");
     781    m_rearleft->setLabel(QObject::tr("Rear Left"));
     782    addChild(m_rearleft);
     783    connect(m_rearleft,
     784            SIGNAL(clicked()), this, SLOT(toggle()));
     785
     786    m_rearright = new ButtonStandardSetting("4");
     787    m_rearright->setLabel(QObject::tr("Rear Right"));
     788    addChild(m_rearright);
     789    connect(m_rearright,
     790            SIGNAL(clicked()), this, SLOT(toggle()));
     791
     792    m_lfe = new ButtonStandardSetting(m_channels == 6 ? "5" :
     793                                   m_channels == 7 ? "6" : "7");
     794    m_lfe->setLabel(QObject::tr("LFE"));
     795    addChild(m_lfe);
     796    connect(m_lfe,
     797            SIGNAL(clicked()), this, SLOT(toggle()));
     798
     799    m_surroundleft = new ButtonStandardSetting(m_channels == 6 ? "4" :
     800                                            m_channels == 7 ? "5" : "6");
     801    m_surroundleft->setLabel(QObject::tr("Surround Left"));
     802    addChild(m_surroundleft);
     803    connect(m_surroundleft,
     804            SIGNAL(clicked()), this, SLOT(toggle()));
     805
     806    m_surroundright = new ButtonStandardSetting("3");
     807    m_surroundright->setLabel(QObject::tr("Surround Right"));
     808    addChild(m_surroundright);
     809    connect(m_surroundright,
     810            SIGNAL(clicked()), this, SLOT(toggle()));
     811
     812    m_center = new ButtonStandardSetting("1");
     813    m_center->setLabel(QObject::tr("Center"));
     814    addChild(m_center);
     815    connect(m_center,
     816            SIGNAL(clicked()), this, SLOT(toggle()));
     817
     818    m_startButton = new ButtonStandardSetting("start");
     819    m_startButton->setLabel(QObject::tr("Test All"));
     820    m_startButton->setHelpText(QObject::tr("Start all channels test"));
     821    addChild(m_startButton);
     822    connect(m_startButton, SIGNAL(clicked()), this, SLOT(toggle()));
     823
     824    m_hd = new TransMythUICheckBoxSetting();
    796825    m_hd->setLabel(QObject::tr("Use Highest Quality Mode"));
    797826    m_hd->setHelpText(QObject::tr("Use the highest audio quality settings "
    798827                                  "supported by your audio card. This will be "
    AudioTest::AudioTest(QString main, QString passthrough,  
    804833
    805834AudioTest::~AudioTest()
    806835{
    807     m_at->cancel();
    808     m_at->wait();
    809     delete m_at;
     836    if (m_at)
     837    {
     838        m_at->cancel();
     839        m_at->wait();
     840        delete m_at;
     841    }
     842}
     843
     844
     845void AudioTest::UpdateCapabilities(QString main, QString passthrough,
     846          int channels, AudioOutputSettings settings)
     847{
     848    m_rearleft->setEnabled(m_channels>=8);
     849    m_rearright->setEnabled(m_channels>=7);
     850    m_lfe->setEnabled(m_channels>=6);
     851    m_surroundleft->setEnabled(m_channels>=5);
     852    m_surroundright->setEnabled(m_channels>=5);
     853    m_center->setEnabled(m_channels>=5);
    810854}
    811855
    812 void AudioTest::toggle(QString str)
     856void AudioTest::toggle()
    813857{
    814     if (str == "start")
     858    if (this->sender() == m_startButton)
    815859    {
    816         if (m_at->isRunning())
    817         {
    818             m_at->cancel();
    819             m_button->setLabel(QObject::tr("Test All"));
    820             if (m_frontleft)
    821                 m_frontleft->setEnabled(true);
    822             if (m_frontright)
    823                 m_frontright->setEnabled(true);
    824             if (m_center)
    825                 m_center->setEnabled(true);
    826             if (m_surroundleft)
    827                 m_surroundleft->setEnabled(true);
    828             if (m_surroundright)
    829                 m_surroundright->setEnabled(true);
    830             if (m_rearleft)
    831                 m_rearleft->setEnabled(true);
    832             if (m_rearright)
    833                 m_rearright->setEnabled(true);
    834             if (m_lfe)
    835                 m_lfe->setEnabled(true);
    836         }
     860        if (m_at != NULL && m_at->isRunning())
     861            cancelTest();
    837862        else
    838863        {
     864            prepareTest();
     865            LOG(VB_GENERAL, LOG_ERR, QString("AudioTest::toggle() Starting all"));
    839866            m_at->setChannel(-1);
    840867            m_at->start();
    841             m_button->setLabel(QObject::tr("Stop"));
     868            m_startButton->setLabel(QObject::tr("Stop"));
    842869        }
    843870        return;
    844871    }
    845     if (m_at->isRunning())
     872    if (m_at != NULL && m_at->isRunning())
    846873    {
     874        LOG(VB_GENERAL, LOG_ERR, QString("AudioTest::toggle() Stopping"));
    847875        m_at->cancel();
    848876        m_at->wait();
    849877    }
    850878
    851     int channel = str.toInt();
     879    prepareTest();
     880   
     881    int channel=1;
     882
     883    if (this->sender() == m_frontleft)
     884        channel=0;
     885    else if (this->sender() == m_frontright)
     886        channel = (m_channels == 2) ? 1 : 2;
     887    else if (this->sender() == m_rearleft)
     888        channel=5;
     889    else if (this->sender() == m_rearright)
     890        channel=4;
     891    else if (this->sender() == m_lfe)
     892        channel=((m_channels == 6) ? 5 :((m_channels == 7) ? 6 : 7));
     893    else if (this->sender() == m_surroundleft)
     894        channel=((m_channels == 6) ? 4 : ((m_channels == 7) ? 5 : 6));
     895    else if (this->sender() == m_surroundright)
     896        channel=3;
     897    else if (this->sender() == m_center)
     898        channel=1;
     899
     900/*    int channel = str.toInt();*/
    852901    m_at->setChannel(channel);
    853902
    854903    m_at->start();
    855904}
    856905
     906
    857907void AudioTest::togglequality()
    858908{
    859     if (m_at->isRunning())
     909    cancelTest();
     910    m_quality = m_hd->boolValue();
     911}
     912
     913
     914void AudioTest::cancelTest()
     915{
     916    if (m_at !=NULL && m_at->isRunning())
    860917    {
    861         toggle("start");
     918        LOG(VB_GENERAL, LOG_ERR, QString("AudioTest::toggle() Stopping all"));
     919        m_at->cancel();
     920        m_startButton->setLabel(QObject::tr("Test All"));
    862921    }
     922}
    863923
    864     m_quality = m_hd->boolValue();
    865     delete m_at;
     924void AudioTest::prepareTest()
     925{
     926    cancelTest();
     927    if (m_at!=NULL)
     928    {
     929        m_at->cancel();
     930        m_at->wait();
     931        delete m_at;
     932    }
    866933    m_at = new AudioTestThread(this, m_main, m_passthrough, m_channels,
    867934                               m_settings, m_quality);
    868935    if (!m_at->result().isEmpty())
    869936    {
    870         QString msg = QObject::tr("Audio device is invalid or not useable.");
    871         MythPopupBox::showOkPopup(
    872             GetMythMainWindow(), QObject::tr("Warning"), msg);
     937
     938        MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
     939
     940        MythConfirmationDialog *mcd = new MythConfirmationDialog(mainStack,
     941            QObject::tr("Audio device is invalid or not useable."), false);
     942
     943        if (mcd->Create())
     944            mainStack->AddScreen(mcd);
    873945    }
    874946}
    875947
    bool AudioTest::event(QEvent *event)  
    9391011}
    9401012
    9411013
    942 AudioTestGroup::AudioTestGroup(QString main, QString passthrough,
    943                                int channels, AudioOutputSettings settings)
     1014HostCheckBoxSetting *AudioConfigSettings::MPCM()
    9441015{
    945     addChild(new AudioTest(main, passthrough, channels, settings));
    946 }
    947 
    948 HostCheckBox *AudioMixerSettings::MythControlsVolume()
    949 {
    950     HostCheckBox *gc = new HostCheckBox("MythControlsVolume");
    951     gc->setLabel(QObject::tr("Use internal volume controls"));
    952     gc->setValue(true);
    953     gc->setHelpText(QObject::tr("If enabled, MythTV will control the PCM and "
    954                     "master mixer volume. Disable this option if you prefer "
    955                     "to control the volume externally (for example, using "
    956                     "your amplifier) or if you use an external mixer program."));
    957     return gc;
    958 }
    959 
    960 HostComboBox *AudioMixerSettings::MixerDevice()
    961 {
    962     HostComboBox *gc = new HostComboBox("MixerDevice", true);
    963     gc->setLabel(QObject::tr("Mixer device"));
    964 
    965 #ifdef USING_OSS
    966     QDir dev("/dev", "mixer*", QDir::Name, QDir::System);
    967     gc->fillSelectionsFromDir(dev);
    968 
    969     dev.setPath("/dev/sound");
    970     if (dev.exists())
    971     {
    972         gc->fillSelectionsFromDir(dev);
    973     }
    974 #endif
    975 #ifdef USING_ALSA
    976     gc->addSelection("ALSA:default", "ALSA:default");
    977 #endif
    978 #ifdef USING_MINGW
    979     gc->addSelection("DirectX:", "DirectX:");
    980     gc->addSelection("Windows:", "Windows:");
    981 #endif
    982 #if !defined(USING_MINGW)
    983     gc->addSelection("software", "software");
    984     gc->setHelpText(QObject::tr("Setting the mixer device to \"software\" "
    985                     "lets MythTV control the volume of all audio at the "
    986                     "expense of a slight quality loss."));
    987 #endif
    988 
    989     return gc;
    990 }
    991 
    992 const char* AudioMixerSettings::MixerControlControls[] = { "PCM",
    993                                                            "Master" };
    994 
    995 HostComboBox *AudioMixerSettings::MixerControl()
    996 {
    997     HostComboBox *gc = new HostComboBox("MixerControl", true);
    998     gc->setLabel(QObject::tr("Mixer controls"));
    999     for (unsigned int i = 0; i < sizeof(MixerControlControls) / sizeof(char*);
    1000          ++i)
    1001     {
    1002         gc->addSelection(QObject::tr(MixerControlControls[i]),
    1003                          MixerControlControls[i]);
    1004     }
    1005 
    1006     gc->setHelpText(QObject::tr("Changing the volume adjusts the selected mixer."));
    1007     return gc;
    1008 }
    1009 
    1010 HostSlider *AudioMixerSettings::MixerVolume()
    1011 {
    1012     HostSlider *gs = new HostSlider("MasterMixerVolume", 0, 100, 1);
    1013     gs->setLabel(QObject::tr("Master mixer volume"));
    1014     gs->setValue(70);
    1015     gs->setHelpText(QObject::tr("Initial volume for the Master mixer. "
    1016                     "This affects all sound created by the audio device. "
    1017                     "Note: Do not set this too low."));
    1018     return gs;
    1019 }
    1020 
    1021 HostSlider *AudioMixerSettings::PCMVolume()
    1022 {
    1023     HostSlider *gs = new HostSlider("PCMMixerVolume", 0, 100, 1);
    1024     gs->setLabel(QObject::tr("PCM mixer volume"));
    1025     gs->setValue(70);
    1026     gs->setHelpText(QObject::tr("Initial volume for PCM output. Using the "
    1027                     "volume keys in MythTV will adjust this parameter."));
    1028     return gs;
    1029 }
    1030 
    1031 AudioMixerSettings::AudioMixerSettings() :
    1032     TriggeredConfigurationGroup(false, true, false, false)
    1033 {
    1034     setLabel(QObject::tr("Audio Mixer"));
    1035     setUseLabel(false);
    1036 
    1037     Setting *volumeControl = MythControlsVolume();
    1038     addChild(volumeControl);
    1039 
    1040         // Mixer settings
    1041     ConfigurationGroup *settings =
    1042         new VerticalConfigurationGroup(false, true, false, false);
    1043     settings->addChild(MixerDevice());
    1044     settings->addChild(MixerControl());
    1045     settings->addChild(MixerVolume());
    1046     settings->addChild(PCMVolume());
    1047 
    1048     ConfigurationGroup *dummy =
    1049         new VerticalConfigurationGroup(false, true, false, false);
    1050 
    1051         // Show Mixer config only if internal volume controls enabled
    1052     setTrigger(volumeControl);
    1053     addTarget("0", dummy);
    1054     addTarget("1", settings);
    1055 }
    1056 
    1057 AudioGeneralSettings::AudioGeneralSettings()
    1058 {
    1059     addChild(new AudioConfigSettings(this));
    1060     addChild(new AudioMixerSettings());
    1061 }
    1062 
    1063 HostCheckBox *AudioAdvancedSettings::MPCM()
    1064 {
    1065     HostCheckBox *gc = new HostCheckBox("StereoPCM");
     1016    HostCheckBoxSetting *gc = new HostCheckBoxSetting("StereoPCM");
    10661017    gc->setLabel(QObject::tr("Stereo PCM Only"));
    10671018    gc->setValue(false);
    10681019    gc->setHelpText(QObject::tr("Enable if your amplifier or sound decoder "
    HostCheckBox *AudioAdvancedSettings::MPCM()  
    10721023    return gc;
    10731024}
    10741025
    1075 HostCheckBox *AudioAdvancedSettings::SRCQualityOverride()
     1026HostCheckBoxSetting *AudioConfigSettings::SRCQualityOverride()
    10761027{
    1077     HostCheckBox *gc = new HostCheckBox("SRCQualityOverride");
     1028    HostCheckBoxSetting *gc = new HostCheckBoxSetting("SRCQualityOverride");
    10781029    gc->setLabel(QObject::tr("Override SRC quality"));
    10791030    gc->setValue(false);
    10801031    gc->setHelpText(QObject::tr("Enable to override audio sample rate "
    HostCheckBox *AudioAdvancedSettings::SRCQualityOverride()  
    10821033    return gc;
    10831034}
    10841035
    1085 HostComboBox *AudioAdvancedSettings::SRCQuality()
     1036HostComboBoxSetting *AudioConfigSettings::SRCQuality()
    10861037{
    1087     HostComboBox *gc = new HostComboBox("SRCQuality", false);
     1038    HostComboBoxSetting *gc = new HostComboBoxSetting("SRCQuality", false);
    10881039    gc->setLabel(QObject::tr("Sample rate conversion"));
    10891040    gc->addSelection(QObject::tr("Disabled"), "-1");
    10901041    gc->addSelection(QObject::tr("Fastest"), "0");
    HostComboBox *AudioAdvancedSettings::SRCQuality()  
    10971048    return gc;
    10981049}
    10991050
    1100 HostCheckBox *AudioAdvancedSettings::Audio48kOverride()
     1051HostCheckBoxSetting *AudioConfigSettings::Audio48kOverride()
    11011052{
    1102     HostCheckBox *gc = new HostCheckBox("Audio48kOverride");
     1053    HostCheckBoxSetting *gc = new HostCheckBoxSetting("Audio48kOverride");
    11031054    gc->setLabel(QObject::tr("Force audio device output to 48kHz"));
    11041055    gc->setValue(false);
    11051056    gc->setHelpText(QObject::tr("Force audio sample rate to 48kHz. "
    HostCheckBox *AudioAdvancedSettings::Audio48kOverride()  
    11081059    return gc;
    11091060}
    11101061
    1111 HostCheckBox *AudioAdvancedSettings::PassThroughOverride()
     1062HostCheckBoxSetting *AudioConfigSettings::PassThroughOverride()
    11121063{
    1113     HostCheckBox *gc = new HostCheckBox("PassThruDeviceOverride");
     1064    HostCheckBoxSetting *gc = new HostCheckBoxSetting("PassThruDeviceOverride");
    11141065    gc->setLabel(QObject::tr("Separate digital output device"));
    11151066    gc->setValue(false);
    11161067    gc->setHelpText(QObject::tr("Use a distinct digital output device from "
    HostCheckBox *AudioAdvancedSettings::PassThroughOverride()  
    11191070    return gc;
    11201071}
    11211072
    1122 HostComboBox *AudioAdvancedSettings::PassThroughOutputDevice()
     1073HostComboBoxSetting *AudioConfigSettings::PassThroughOutputDevice()
    11231074{
    1124     HostComboBox *gc = new HostComboBox("PassThruOutputDevice", true);
     1075    HostComboBoxSetting *gc = new HostComboBoxSetting("PassThruOutputDevice", true);
    11251076
    11261077    gc->setLabel(QObject::tr("Digital output device"));
    1127     gc->addSelection(QObject::tr("Default"), "Default");
     1078    //TODO Is default not equivalent to PassThroughOverride off? if so PassThruDeviceOverride dsetting could be removed
     1079    gc->addSelection(QObject::tr("Default"), "Default");
    11281080#ifdef USING_MINGW
    11291081    gc->addSelection("DirectX:Primary Sound Driver");
    11301082#else
    HostComboBox *AudioAdvancedSettings::PassThroughOutputDevice()  
    11401092    return gc;
    11411093}
    11421094
    1143 HostCheckBox *AudioAdvancedSettings::SPDIFRateOverride()
     1095HostCheckBoxSetting *AudioConfigSettings::SPDIFRateOverride()
    11441096{
    1145     HostCheckBox *gc = new HostCheckBox("SPDIFRateOverride");
     1097    HostCheckBoxSetting *gc = new HostCheckBoxSetting("SPDIFRateOverride");
    11461098    gc->setLabel(QObject::tr("SPDIF 48kHz rate override"));
    11471099    gc->setValue(false);
    11481100    gc->setHelpText(QObject::tr("ALSA only. By default, let ALSA determine "
    HostCheckBox *AudioAdvancedSettings::SPDIFRateOverride()  
    11521104    return gc;
    11531105}
    11541106
    1155 HostCheckBox *AudioAdvancedSettings::HBRPassthrough()
     1107HostCheckBoxSetting *AudioConfigSettings::HBRPassthrough()
    11561108{
    1157     HostCheckBox *gc = new HostCheckBox("HBRPassthru");
     1109    HostCheckBoxSetting *gc = new HostCheckBoxSetting("HBRPassthru");
    11581110    gc->setLabel(QObject::tr("HBR passthrough support"));
    11591111    gc->setValue(true);
    11601112    gc->setHelpText(QObject::tr("HBR support is required for TrueHD and DTS-HD "
    HostCheckBox *AudioAdvancedSettings::HBRPassthrough()  
    11661118    return gc;
    11671119}
    11681120
    1169 AudioAdvancedSettings::AudioAdvancedSettings(bool mpcm)
    1170 {
    1171     ConfigurationGroup *settings3 =
    1172         new HorizontalConfigurationGroup(false, false);
    1173 
    1174     m_PassThroughOverride = PassThroughOverride();
    1175     TriggeredItem *sub3 =
    1176         new TriggeredItem(m_PassThroughOverride, PassThroughOutputDevice());
    1177     settings3->addChild(m_PassThroughOverride);
    1178     settings3->addChild(sub3);
    1179 
    1180     ConfigurationGroup *settings4 =
    1181         new HorizontalConfigurationGroup(false, false);
    1182     Setting *srcqualityoverride = SRCQualityOverride();
    1183     TriggeredItem *sub4 =
    1184         new TriggeredItem(srcqualityoverride, SRCQuality());
    1185     settings4->addChild(srcqualityoverride);
    1186     settings4->addChild(sub4);
    1187 
    1188     ConfigurationGroup *settings5 =
    1189         new HorizontalConfigurationGroup(false, false);
    1190     settings5->addChild(Audio48kOverride());
    1191 #if USING_ALSA
    1192     settings5->addChild(SPDIFRateOverride());
    1193 #endif
    1194 
    1195     ConfigurationGroup *settings6 =
    1196         new HorizontalConfigurationGroup(false, false);
    1197     settings6->addChild(HBRPassthrough());
    1198 
    1199     addChild(settings4);
    1200     addChild(settings5);
    1201     addChild(settings3);
    1202     addChild(settings6);
    1203 
    1204     if (mpcm)
    1205     {
    1206         ConfigurationGroup *settings7;
    1207         settings7 = new HorizontalConfigurationGroup(false, false);
    1208         settings7->addChild(MPCM());
    1209         addChild(settings7);
    1210     }
    1211 }
    1212 
    1213 AudioAdvancedSettingsGroup::AudioAdvancedSettingsGroup(bool mpcm)
     1121void AudioConfigSettings::setMPCMEnabled(bool flag)
    12141122{
    1215     addChild(new AudioAdvancedSettings(mpcm));
     1123    m_MPCM->setEnabled(flag);
    12161124}
    12171125// vim:set sw=4 ts=4 expandtab:
  • mythtv/programs/mythfrontend/audiogeneralsettings.h

    diff --git a/mythtv/programs/mythfrontend/audiogeneralsettings.h b/mythtv/programs/mythfrontend/audiogeneralsettings.h
    index fe31bd8..b9522e8 100644
    a b  
    1111#include "mythuibutton.h"
    1212#include "audiooutput.h"
    1313#include "mythcontext.h"
    14 #include "settings.h"
     14#include "standardsettings.h"
    1515#include "mthread.h"
    1616
    1717class AudioDeviceComboBox;
     18class AudioAdvancedSettings;
     19class AudioTest;
    1820
    19 class AudioConfigSettings : public VerticalConfigurationGroup
     21class AudioConfigSettings : public GroupSetting
    2022{
    2123    Q_OBJECT
    2224
    2325  public:
    24     AudioConfigSettings(ConfigurationWizard *);
     26    AudioConfigSettings();
    2527
    2628    typedef QMap<QString,AudioOutput::AudioDeviceConfig> ADCMap;
    2729
    class AudioConfigSettings : public VerticalConfigurationGroup  
    2931    AudioOutput::ADCVect &AudioDeviceVect(void) { return devices; };
    3032
    3133  private slots:
    32     void UpdateVisibility(const QString&);
    33     AudioOutputSettings UpdateCapabilities(const QString&);
     34    void UpdateVisibility(StandardSetting *);
     35    AudioOutputSettings UpdateCapabilities(StandardSetting *);
    3436    void AudioRescan();
    35     void AudioAdvanced();
    36     void StartAudioTest();
     37    void UpdateAudioTest();
    3738
    3839  private:
     40    void setMPCMEnabled(bool flag);
     41
    3942    AudioDeviceComboBox *OutputDevice();
    40     HostComboBox        *MaxAudioChannels();
    41     HostCheckBox        *AudioUpmix();
    42     HostComboBox        *AudioUpmixType();
    43     HostCheckBox        *AC3PassThrough();
    44     HostCheckBox        *DTSPassThrough();
    45     HostCheckBox        *EAC3PassThrough();
    46     HostCheckBox        *TrueHDPassThrough();
    47     HostCheckBox        *DTSHDPassThrough();
    48     bool                 CheckPassthrough();
    49 
    50     ConfigurationGroup  *m_cgsettings;
     43    HostComboBoxSetting *MaxAudioChannels();
     44    HostCheckBoxSetting *AudioUpmix();
     45    HostComboBoxSetting *AudioUpmixType();
     46    HostCheckBoxSetting *AC3PassThrough();
     47    HostCheckBoxSetting *DTSPassThrough();
     48    HostCheckBoxSetting *EAC3PassThrough();
     49    HostCheckBoxSetting *TrueHDPassThrough();
     50    HostCheckBoxSetting *DTSHDPassThrough();
     51    HostCheckBoxSetting *MythControlsVolume();
     52    HostComboBoxSetting *MixerDevice();
     53    HostComboBoxSetting *MixerControl();
     54    HostSpinBoxSetting  *MixerVolume();
     55    HostSpinBoxSetting  *PCMVolume();
     56
     57    //advanced setting
     58    HostCheckBoxSetting *MPCM();
     59    HostCheckBoxSetting *SRCQualityOverride();
     60    HostComboBoxSetting *SRCQuality();
     61    HostCheckBoxSetting *Audio48kOverride();
     62    HostCheckBoxSetting *PassThroughOverride();
     63    HostComboBoxSetting *PassThroughOutputDevice();
     64    HostCheckBoxSetting *SPDIFRateOverride();
     65    HostCheckBoxSetting *HBRPassthrough();
     66
     67    bool                CheckPassthrough();
     68
    5169    AudioDeviceComboBox *m_OutputDevice;
    52     HostComboBox        *m_MaxAudioChannels;
    53     HostCheckBox        *m_AudioUpmix;
    54     HostComboBox        *m_AudioUpmixType;
    55     CheckBoxSetting     *m_triggerDigital;
    56     HostCheckBox        *m_AC3PassThrough;
    57     HostCheckBox        *m_DTSPassThrough;
    58     HostCheckBox        *m_EAC3PassThrough;
    59     HostCheckBox        *m_TrueHDPassThrough;
    60     HostCheckBox        *m_DTSHDPassThrough;
     70    HostComboBoxSetting *m_MaxAudioChannels;
     71    HostCheckBoxSetting *m_AudioUpmix;
     72    HostComboBoxSetting *m_AudioUpmixType;
     73
     74    // digital settings
     75    GroupSetting        *m_triggerDigital;
     76    HostCheckBoxSetting *m_AC3PassThrough;
     77    HostCheckBoxSetting *m_DTSPassThrough;
     78    HostCheckBoxSetting *m_EAC3PassThrough;
     79    HostCheckBoxSetting *m_TrueHDPassThrough;
     80    HostCheckBoxSetting *m_DTSHDPassThrough;
     81    //advanced setting
     82    HostCheckBoxSetting       *m_MPCM;
     83    HostCheckBoxSetting       *m_PassThroughOverride; 
     84    HostComboBoxSetting       *m_PassThroughDeviceOverride;
     85
     86    AudioTest           *m_audioTest;
     87
    6188    ADCMap               audiodevs;
    6289    AudioOutput::ADCVect devices;
    6390    QMutex               slotlock;
    64     ConfigurationWizard *m_parent;
     91
    6592};
    6693
    67 class AudioDeviceComboBox : public HostComboBox
     94class AudioDeviceComboBox : public HostComboBoxSetting
    6895{
    6996    Q_OBJECT
    7097  public:
    7198    AudioDeviceComboBox(AudioConfigSettings*);
    7299    void AudioRescan();
    73100
     101    virtual void edit(MythScreenType * screen);
     102
    74103  private slots:
    75     void AudioDescriptionHelp(const QString&);
     104    void AudioDescriptionHelp(StandardSetting * setting);
    76105
    77106  private:
    78107    AudioConfigSettings *m_parent;
    79108};
    80 
    81 class AudioMixerSettings : public TriggeredConfigurationGroup
     109/*
     110class AudioMixerSettings : public GroupSetting
    82111{
    83112  public:
    84113    AudioMixerSettings();
    85114  private:
    86     HostCheckBox       *MythControlsVolume();
    87     HostComboBox       *MixerDevice();
    88     HostComboBox       *MixerControl();
    89     HostSlider         *MixerVolume();
    90     HostSlider         *PCMVolume();
    91     static const char  *MixerControlControls[];
    92 };
    93 
    94 class AudioGeneralSettings : public ConfigurationWizard
    95 {
    96   public:
    97     AudioGeneralSettings();
    98 };
    99 
    100 class AudioAdvancedSettings : public VerticalConfigurationGroup
    101 {
    102   public:
    103     AudioAdvancedSettings(bool mpcm);
    104 
    105     HostCheckBox       *MPCM();
    106     HostCheckBox       *SRCQualityOverride();
    107     HostComboBox       *SRCQuality();
    108     HostCheckBox       *Audio48kOverride();
    109     HostCheckBox       *PassThroughOverride();
    110     HostComboBox       *PassThroughOutputDevice();
    111     HostCheckBox       *SPDIFRateOverride();
    112     HostCheckBox       *HBRPassthrough();
    113 
    114     CheckBoxSetting    *m_triggerMPCM;
    115     HostCheckBox       *m_MPCM;
    116     HostCheckBox       *m_PassThroughOverride;
    117 };
    118 
    119 class AudioAdvancedSettingsGroup : public ConfigurationWizard
    120 {
    121   public:
    122     AudioAdvancedSettingsGroup(bool mpcm);
    123 };
    124 
    125 class AudioTestGroup : public ConfigurationWizard
    126 {
    127   public:
    128     AudioTestGroup(QString main, QString passthrough,
    129                    int channels, AudioOutputSettings settings);
    130 };
     115    HostCheckBoxSetting *MythControlsVolume();
     116    HostComboBoxSetting *MixerDevice();
     117    HostComboBoxSetting *MixerControl();
     118    HostSpinBoxSetting  *MixerVolume();
     119    HostSpinBoxSetting  *PCMVolume();
     120    static const char   *MixerControlControls[];
     121};*/
    131122
    132123class ChannelChangedEvent : public QEvent
    133124{
    class AudioTestThread : public MThread  
    170161    AudioFormat             m_format;
    171162};
    172163
    173 class AudioTest : public VerticalConfigurationGroup
     164class AudioTest : public GroupSetting
    174165{
    175166    Q_OBJECT
    176167  public:
    177     AudioTest(QString main, QString passthrough,
    178               int channels, AudioOutputSettings settings);
     168    AudioTest(/*QString main, QString passthrough,
     169              int channels, AudioOutputSettings settings*/);
    179170    ~AudioTest();
     171   // m_audioTest->UpdateCapabilities(out, passthrough, channels, settings);
     172    void UpdateCapabilities(QString main, QString passthrough,
     173              int channels, AudioOutputSettings settings);
    180174    bool event(QEvent *event);
    181175
    182176  private:
    183     int                     m_channels;
    184     TransButtonSetting     *m_frontleft;
    185     TransButtonSetting     *m_frontright;
    186     TransButtonSetting     *m_center;
    187     TransButtonSetting     *m_surroundleft;
    188     TransButtonSetting     *m_surroundright;
    189     TransButtonSetting     *m_rearleft;
    190     TransButtonSetting     *m_rearright;
    191     TransButtonSetting     *m_lfe;
    192     AudioTestThread        *m_at;
    193     TransButtonSetting     *m_button;
    194     TransCheckBoxSetting  *m_hd;
    195     QString                 m_main;
    196     QString                 m_passthrough;
    197     AudioOutputSettings     m_settings;
    198     bool                    m_quality;
     177    int                         m_channels;
     178    ButtonStandardSetting      *m_frontleft;
     179    ButtonStandardSetting      *m_frontright;
     180    ButtonStandardSetting      *m_center;
     181    ButtonStandardSetting      *m_surroundleft;
     182    ButtonStandardSetting      *m_surroundright;
     183    ButtonStandardSetting      *m_rearleft;
     184    ButtonStandardSetting      *m_rearright;
     185    ButtonStandardSetting      *m_lfe;
     186    AudioTestThread            *m_at;
     187    ButtonStandardSetting      *m_startButton;
     188    TransMythUICheckBoxSetting *m_hd;
     189    QString                     m_main;
     190    QString                     m_passthrough;
     191    AudioOutputSettings         m_settings;
     192    bool                        m_quality;
    199193
    200194  private slots:
    201     void toggle(QString str);
     195    void toggle();
    202196    void togglequality(void);
     197    void cancelTest();
     198    void prepareTest();
    203199};
    204200#endif
  • mythtv/programs/mythfrontend/globalsettings.cpp

    diff --git a/mythtv/programs/mythfrontend/globalsettings.cpp b/mythtv/programs/mythfrontend/globalsettings.cpp
    index 2a5ae68..db80603 100644
    a b  
    33
    44// Standard UNIX C headers
    55#include <unistd.h>
     6#include <cmath>
    67#include <fcntl.h>
    78#include <sys/types.h>
    89#include <sys/stat.h>
     
    3940#include "mythdirs.h"
    4041#include "mythuihelper.h"
    4142
    42 static HostCheckBox *DecodeExtraAudio()
     43//Use for playBackGroup, to be remove at one point
     44#include "playgroup.h"
     45
     46static HostCheckBoxSetting *DecodeExtraAudio()
    4347{
    44     HostCheckBox *gc = new HostCheckBox("DecodeExtraAudio");
     48    HostCheckBoxSetting *gc = new HostCheckBoxSetting("DecodeExtraAudio");
    4549    gc->setLabel(QObject::tr("Extra audio buffering"));
    4650    gc->setValue(true);
    4751    gc->setHelpText(QObject::tr("Enable this setting if MythTV is playing "
    static HostCheckBox *DecodeExtraAudio()  
    5357    return gc;
    5458}
    5559
    56 static HostComboBox *PIPLocationComboBox()
     60static HostComboBoxSetting *PIPLocationComboBox()
    5761{
    58     HostComboBox *gc = new HostComboBox("PIPLocation");
     62    HostComboBoxSetting *gc = new HostComboBoxSetting("PIPLocation");
    5963    gc->setLabel(QObject::tr("PIP video location"));
    6064    for (uint loc = 0; loc < kPIP_END; ++loc)
    6165        gc->addSelection(toString((PIPLocation) loc), QString::number(loc));
    static HostComboBox *PIPLocationComboBox()  
    6367    return gc;
    6468}
    6569
    66 static HostComboBox *DisplayRecGroup()
     70static HostComboBoxSetting *DisplayRecGroup()
    6771{
    68     HostComboBox *gc = new HostComboBox("DisplayRecGroup");
     72    HostComboBoxSetting *gc = new HostComboBoxSetting("DisplayRecGroup");
    6973    gc->setLabel(QObject::tr("Default group filter to apply"));
    7074
    7175    gc->addSelection(QObject::tr("All Programs"), QString("All Programs"));
    static HostComboBox *DisplayRecGroup()  
    99103
    100104    gc->setHelpText(QObject::tr("Default group filter to apply "
    101105                    "on the View Recordings screen."));
     106
    102107    return gc;
    103108}
    104109
    105 static HostCheckBox *QueryInitialFilter()
     110static HostCheckBoxSetting *QueryInitialFilter()
    106111{
    107     HostCheckBox *gc = new HostCheckBox("QueryInitialFilter");
     112    HostCheckBoxSetting *gc = new HostCheckBoxSetting("QueryInitialFilter");
    108113    gc->setLabel(QObject::tr("Always prompt for initial group filter"));
    109114    gc->setValue(false);
    110115    gc->setHelpText(QObject::tr("If enabled, always prompt the user for the "
    static HostCheckBox *QueryInitialFilter()  
    113118    return gc;
    114119}
    115120
    116 static HostCheckBox *RememberRecGroup()
     121static HostCheckBoxSetting *RememberRecGroup()
    117122{
    118     HostCheckBox *gc = new HostCheckBox("RememberRecGroup");
     123    HostCheckBoxSetting *gc = new HostCheckBoxSetting("RememberRecGroup");
    119124    gc->setLabel(QObject::tr("Save current group filter when changed"));
    120125    gc->setValue(true);
    121126    gc->setHelpText(QObject::tr("If enabled, remember the last selected filter "
    static HostCheckBox *RememberRecGroup()  
    124129    return gc;
    125130}
    126131
    127 static HostCheckBox *UseGroupNameAsAllPrograms()
     132static HostCheckBoxSetting *UseGroupNameAsAllPrograms()
    128133{
    129     HostCheckBox *gc = new HostCheckBox("DispRecGroupAsAllProg");
     134    HostCheckBoxSetting *gc = new HostCheckBoxSetting("DispRecGroupAsAllProg");
    130135    gc->setLabel(QObject::tr("Show filter name instead of \"All Programs\""));
    131136    gc->setValue(false);
    132137    gc->setHelpText(QObject::tr("If enabled, use the name of the display "
    static HostCheckBox *UseGroupNameAsAllPrograms()  
    135140    return gc;
    136141}
    137142
    138 static HostCheckBox *PBBStartInTitle()
     143static HostCheckBoxSetting *PBBStartInTitle()
    139144{
    140     HostCheckBox *gc = new HostCheckBox("PlaybackBoxStartInTitle");
     145    HostCheckBoxSetting *gc = new HostCheckBoxSetting("PlaybackBoxStartInTitle");
    141146    gc->setLabel(QObject::tr("Start in group list"));
    142147    gc->setValue(true);
    143148    gc->setHelpText(QObject::tr("If enabled, the focus will "
    static HostCheckBox *PBBStartInTitle()  
    146151    return gc;
    147152}
    148153
    149 static HostCheckBox *SmartForward()
     154static HostCheckBoxSetting *SmartForward()
    150155{
    151     HostCheckBox *gc = new HostCheckBox("SmartForward");
     156    HostCheckBoxSetting *gc = new HostCheckBoxSetting("SmartForward");
    152157    gc->setLabel(QObject::tr("Smart fast forwarding"));
    153158    gc->setValue(false);
    154159    gc->setHelpText(QObject::tr("If enabled, then immediately after "
    static HostCheckBox *SmartForward()  
    157162    return gc;
    158163}
    159164
    160 static HostCheckBox *ExactSeeking()
     165static HostCheckBoxSetting *ExactSeeking()
    161166{
    162     HostCheckBox *gc = new HostCheckBox("ExactSeeking");
     167    HostCheckBoxSetting *gc = new HostCheckBoxSetting("ExactSeeking");
    163168    gc->setLabel(QObject::tr("Seek to exact frame"));
    164169    gc->setValue(false);
    165170    gc->setHelpText(QObject::tr("If enabled, seeking is frame exact, but "
    static HostCheckBox *ExactSeeking()  
    167172    return gc;
    168173}
    169174
    170 static GlobalComboBox *CommercialSkipMethod()
     175static GlobalComboBoxSetting *CommercialSkipMethod()
    171176{
    172     GlobalComboBox *bc = new GlobalComboBox("CommercialSkipMethod");
     177    GlobalComboBoxSetting *bc = new GlobalComboBoxSetting("CommercialSkipMethod");
    173178    bc->setLabel(QObject::tr("Commercial detection method"));
    174179    bc->setHelpText(QObject::tr(
    175180                        "This determines the method used by MythTV to "
    static GlobalComboBox *CommercialSkipMethod()  
    182187    return bc;
    183188}
    184189
    185 static GlobalCheckBox *CommFlagFast()
     190static GlobalCheckBoxSetting *CommFlagFast()
    186191{
    187     GlobalCheckBox *gc = new GlobalCheckBox("CommFlagFast");
     192    GlobalCheckBoxSetting *gc = new GlobalCheckBoxSetting("CommFlagFast");
    188193    gc->setLabel(QObject::tr("Enable experimental speedup of commercial detection"));
    189194    gc->setValue(false);
    190195    gc->setHelpText(QObject::tr("If enabled, experimental commercial detection "
    static GlobalCheckBox *CommFlagFast()  
    192197    return gc;
    193198}
    194199
    195 static HostComboBox *AutoCommercialSkip()
     200static HostComboBoxSetting *AutoCommercialSkip()
    196201{
    197     HostComboBox *gc = new HostComboBox("AutoCommercialSkip");
     202    HostComboBoxSetting *gc = new HostComboBoxSetting("AutoCommercialSkip");
    198203    gc->setLabel(QObject::tr("Automatically skip commercials"));
    199204    gc->addSelection(QObject::tr("Off"), "0");
    200205    gc->addSelection(QObject::tr("Notify, but do not skip"), "2");
    static HostComboBox *AutoCommercialSkip()  
    206211    return gc;
    207212}
    208213
    209 static GlobalCheckBox *AutoMetadataLookup()
     214static GlobalCheckBoxSetting *AutoMetadataLookup()
    210215{
    211     GlobalCheckBox *bc = new GlobalCheckBox("AutoMetadataLookup");
     216    GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("AutoMetadataLookup");
    212217    bc->setLabel(QObject::tr("Run metadata lookup"));
    213218    bc->setValue(true);
    214219    bc->setHelpText(QObject::tr("This is the default value used for the "
    static GlobalCheckBox *AutoMetadataLookup()  
    217222    return bc;
    218223}
    219224
    220 static GlobalCheckBox *AutoCommercialFlag()
     225static GlobalCheckBoxSetting *AutoCommercialFlag()
    221226{
    222     GlobalCheckBox *bc = new GlobalCheckBox("AutoCommercialFlag");
     227    GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("AutoCommercialFlag");
    223228    bc->setLabel(QObject::tr("Run commercial detection"));
    224229    bc->setValue(true);
    225230    bc->setHelpText(QObject::tr("This is the default value used for the "
    static GlobalCheckBox *AutoCommercialFlag()  
    228233    return bc;
    229234}
    230235
    231 static GlobalCheckBox *AutoTranscode()
     236static GlobalCheckBoxSetting *AutoTranscode()
    232237{
    233     GlobalCheckBox *bc = new GlobalCheckBox("AutoTranscode");
     238    GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("AutoTranscode");
    234239    bc->setLabel(QObject::tr("Run transcoder"));
    235240    bc->setValue(false);
    236241    bc->setHelpText(QObject::tr("This is the default value used for the "
    static GlobalCheckBox *AutoTranscode()  
    239244    return bc;
    240245}
    241246
    242 static GlobalComboBox *DefaultTranscoder()
     247/*TODO This function is borrowed from RecordingProfile::fillSelections and sligthly modified
     248I will need to change the original to use a pure abstract class instead of SelectSetting
     249*/
     250static void RecordingProfile_fillSelections(MythUIComboBoxSetting *setting, int group,
     251                                      bool foldautodetect)
     252{
     253    if (!group)
     254    {
     255       for (uint i = 0; !availProfiles[i].isEmpty(); i++)
     256           setting->addSelection(availProfiles[i], availProfiles[i]);
     257       return;
     258    }
     259
     260    MSqlQuery result(MSqlQuery::InitCon());
     261    result.prepare(
     262        "SELECT name, id "
     263        "FROM recordingprofiles "
     264        "WHERE profilegroup = :GROUP "
     265        "ORDER BY id");
     266    result.bindValue(":GROUP", group);
     267
     268    if (!result.exec())
     269    {
     270        MythDB::DBError("RecordingProfile::fillSelections 1", result);
     271        return;
     272    }
     273    else if (!result.next())
     274    {
     275        return;
     276    }
     277
     278    if (group == RecordingProfile::TranscoderGroup && foldautodetect)
     279    {
     280        QString id = QString::number(RecordingProfile::TranscoderAutodetect);
     281        setting->addSelection(QObject::tr("Autodetect"), id);
     282    }
     283
     284    do
     285    {
     286        QString name = result.value(0).toString();
     287        QString id   = result.value(1).toString();
     288
     289        if (group == RecordingProfile::TranscoderGroup)
     290        {
     291            if (name == "RTjpeg/MPEG4" || name == "MPEG2")
     292            {
     293                if (!foldautodetect)
     294                {
     295                    setting->addSelection(
     296                        QObject::tr("Autodetect from %1").arg(name), id);
     297                }
     298            }
     299            else
     300            {
     301                setting->addSelection(name, id);
     302            }
     303            continue;
     304        }
     305
     306        setting->addSelection(name, id);
     307    }
     308    while (result.next());
     309}
     310
     311static GlobalComboBoxSetting *DefaultTranscoder()
    243312{
    244     GlobalComboBox *bc = new GlobalComboBox("DefaultTranscoder");
     313    GlobalComboBoxSetting *bc = new GlobalComboBoxSetting("DefaultTranscoder");
    245314    bc->setLabel(QObject::tr("Default transcoder"));
    246     RecordingProfile::fillSelections(bc, RecordingProfile::TranscoderGroup,
     315    RecordingProfile_fillSelections(bc, RecordingProfile::TranscoderGroup,
    247316                                     true);
     317
    248318    bc->setHelpText(QObject::tr("This is the default value used for the "
    249319                    "transcoder setting when a new scheduled "
    250320                    "recording is created."));
    251321    return bc;
    252322}
    253323
    254 static GlobalSpinBox *DeferAutoTranscodeDays()
     324static GlobalSpinBoxSetting *DeferAutoTranscodeDays()
    255325{
    256     GlobalSpinBox *gs = new GlobalSpinBox("DeferAutoTranscodeDays", 0, 365, 1);
     326    GlobalSpinBoxSetting *gs = new GlobalSpinBoxSetting("DeferAutoTranscodeDays", 0, 365, 1);
    257327    gs->setLabel(QObject::tr("Deferral days for auto transcode jobs"));
    258328    gs->setHelpText(QObject::tr("If non-zero, automatic transcode jobs will "
    259329                    "be scheduled to run this many days after a recording "
    static GlobalSpinBox *DeferAutoTranscodeDays()  
    262332    return gs;
    263333}
    264334
    265 static GlobalCheckBox *AutoRunUserJob(uint job_num)
     335static GlobalCheckBoxSetting *AutoRunUserJob(uint job_num)
    266336{
    267337    QString dbStr = QString("AutoRunUserJob%1").arg(job_num);
    268338    QString label = QObject::tr("Run user job #%1")
    269339        .arg(job_num);
    270     GlobalCheckBox *bc = new GlobalCheckBox(dbStr);
     340    GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting(dbStr);
    271341    bc->setLabel(label);
    272342    bc->setValue(false);
    273343    bc->setHelpText(QObject::tr("This is the default value used for the "
    static GlobalCheckBox *AutoRunUserJob(uint job_num)  
    278348    return bc;
    279349}
    280350
    281 static GlobalCheckBox *AggressiveCommDetect()
     351static GlobalCheckBoxSetting *AggressiveCommDetect()
    282352{
    283     GlobalCheckBox *bc = new GlobalCheckBox("AggressiveCommDetect");
     353    GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("AggressiveCommDetect");
    284354    bc->setLabel(QObject::tr("Strict commercial detection"));
    285355    bc->setValue(true);
    286356    bc->setHelpText(QObject::tr("Enable stricter commercial detection code. "
    static GlobalCheckBox *AggressiveCommDetect()  
    288358    return bc;
    289359}
    290360
    291 static HostSpinBox *CommRewindAmount()
     361static HostSpinBoxSetting *CommRewindAmount()
    292362{
    293     HostSpinBox *gs = new HostSpinBox("CommRewindAmount", 0, 10, 1);
     363    HostSpinBoxSetting *gs = new HostSpinBoxSetting("CommRewindAmount", 0, 10, 1);
    294364    gs->setLabel(QObject::tr("Commercial skip automatic rewind amount (secs)"));
    295365    gs->setHelpText(QObject::tr("MythTV will automatically rewind "
    296366                    "this many seconds after performing a commercial skip."));
    static HostSpinBox *CommRewindAmount()  
    298368    return gs;
    299369}
    300370
    301 static HostSpinBox *CommNotifyAmount()
     371static HostSpinBoxSetting *CommNotifyAmount()
    302372{
    303     HostSpinBox *gs = new HostSpinBox("CommNotifyAmount", 0, 10, 1);
     373    HostSpinBoxSetting *gs = new HostSpinBoxSetting("CommNotifyAmount", 0, 10, 1);
    304374    gs->setLabel(QObject::tr("Commercial skip notify amount (secs)"));
    305375    gs->setHelpText(QObject::tr("MythTV will act like a commercial "
    306376                    "begins this many seconds early. This can be useful "
    static HostSpinBox *CommNotifyAmount()  
    310380    return gs;
    311381}
    312382
    313 static GlobalSpinBox *MaximumCommercialSkip()
     383static GlobalSpinBoxSetting *MaximumCommercialSkip()
    314384{
    315     GlobalSpinBox *bs = new GlobalSpinBox("MaximumCommercialSkip", 0, 3600, 10);
     385    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("MaximumCommercialSkip", 0, 3600, 10);
    316386    bs->setLabel(QObject::tr("Maximum commercial skip (secs)"));
    317387    bs->setHelpText(QObject::tr("MythTV will discourage long manual commercial "
    318388                    "skips. Skips which are longer than this will require the "
    static GlobalSpinBox *MaximumCommercialSkip()  
    322392    return bs;
    323393}
    324394
    325 static GlobalSpinBox *MergeShortCommBreaks()
     395static GlobalSpinBoxSetting *MergeShortCommBreaks()
    326396{
    327     GlobalSpinBox *bs = new GlobalSpinBox("MergeShortCommBreaks", 0, 3600, 5);
     397    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("MergeShortCommBreaks", 0, 3600, 5);
    328398    bs->setLabel(QObject::tr("Merge short commercial breaks (secs)"));
    329399    bs->setHelpText(QObject::tr("Treat consecutive commercial breaks shorter "
    330400                    "than this as one break when skipping forward. Useful if "
    static GlobalSpinBox *MergeShortCommBreaks()  
    334404    return bs;
    335405}
    336406
    337 static GlobalSpinBox *AutoExpireExtraSpace()
     407
     408static GlobalSpinBoxSetting *AutoExpireExtraSpace()
    338409{
    339     GlobalSpinBox *bs = new GlobalSpinBox("AutoExpireExtraSpace", 0, 200, 1);
     410    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("AutoExpireExtraSpace", 0, 200, 1);
    340411    bs->setLabel(QObject::tr("Extra disk space (GB)"));
    341412    bs->setHelpText(QObject::tr("Extra disk space (in gigabytes) beyond what "
    342413                    "MythTV requires that you want to keep free on the "
    static GlobalSpinBox *AutoExpireExtraSpace()  
    345416    return bs;
    346417};
    347418
    348 #if 0
    349 static GlobalCheckBox *AutoExpireInsteadOfDelete()
    350 {
    351     GlobalCheckBox *cb = new GlobalCheckBox("AutoExpireInsteadOfDelete");
    352     cb->setLabel(QObject::tr("Auto-Expire instead of delete recording"));
    353     cb->setValue(false);
    354     cb->setHelpText(QObject::tr("If enabled, move deleted recordings to the "
    355                     "'Deleted' recgroup and turn on autoexpire "
    356                     "instead of deleting immediately."));
    357     return cb;
    358 }
    359 #endif
    360 
    361 static GlobalSpinBox *DeletedMaxAge()
     419static GlobalSpinBoxSetting *DeletedMaxAge()
    362420{
    363     GlobalSpinBox *bs = new GlobalSpinBox("DeletedMaxAge", -1, 365, 1);
     421    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("DeletedMaxAge", 0, 365, 1);
    364422    bs->setLabel(QObject::tr("Time to retain deleted recordings (days)"));
    365423    bs->setHelpText(QObject::tr("Determines the maximum number of days before "
    366424                                "undeleting a recording will become impossible. "
    static GlobalSpinBox *DeletedMaxAge()  
    374432    return bs;
    375433};
    376434
    377 static GlobalCheckBox *DeletedFifoOrder()
     435static GlobalCheckBoxSetting *DeletedFifoOrder()
    378436{
    379     GlobalCheckBox *cb = new GlobalCheckBox("DeletedFifoOrder");
     437    GlobalCheckBoxSetting *cb = new GlobalCheckBoxSetting("DeletedFifoOrder");
    380438    cb->setLabel(QObject::tr("Expire in deleted order"));
    381439    cb->setValue(false);
    382440    cb->setHelpText(QObject::tr(
    static GlobalCheckBox *DeletedFifoOrder()  
    386444};
    387445
    388446#if 0
    389 class DeletedExpireOptions : public TriggeredConfigurationGroup
     447static GlobalCheckBoxSetting *AutoExpireInsteadOfDelete()
    390448{
    391     public:
    392      DeletedExpireOptions() :
    393          TriggeredConfigurationGroup(false, false, false, false)
    394          {
    395              setLabel(QObject::tr("DeletedExpireOptions"));
    396              Setting* enabled = AutoExpireInsteadOfDelete();
    397              addChild(enabled);
    398              setTrigger(enabled);
    399 
    400              HorizontalConfigurationGroup* settings =
    401                  new HorizontalConfigurationGroup(false);
    402              settings->addChild(DeletedFifoOrder());
    403              settings->addChild(DeletedMaxAge());
    404              addTarget("1", settings);
    405 
    406              // show nothing if fillEnabled is off
    407              addTarget("0", new HorizontalConfigurationGroup(true));
    408          };
    409 };
     449    GlobalCheckBoxSetting *cb = new GlobalCheckBoxSetting("AutoExpireInsteadOfDelete");
     450    cb->setLabel(QObject::tr("Auto-Expire instead of delete recording"));
     451    cb->setValue(false);
     452    cb->setHelpText(QObject::tr("If enabled, move deleted recordings to the "
     453                    "'Deleted' recgroup and turn on autoexpire "
     454                    "instead of deleting immediately."));
     455
     456    cb->addTargetedChild("1",DeletedFifoOrder());
     457    cb->addTargetedChild("1",DeletedMaxAge());
     458    return cb;
     459}
     460
    410461#endif
    411462
    412 static GlobalComboBox *AutoExpireMethod()
     463static GlobalComboBoxSetting *AutoExpireMethod()
    413464{
    414     GlobalComboBox *bc = new GlobalComboBox("AutoExpireMethod");
     465    GlobalComboBoxSetting *bc = new GlobalComboBoxSetting("AutoExpireMethod");
    415466    bc->setLabel(QObject::tr("Auto-Expire method"));
    416467    bc->addSelection(QObject::tr("Oldest show first"), "1");
    417468    bc->addSelection(QObject::tr("Lowest priority first"), "2");
    static GlobalComboBox *AutoExpireMethod()  
    423474    return bc;
    424475}
    425476
    426 static GlobalCheckBox *AutoExpireWatchedPriority()
     477static GlobalCheckBoxSetting *AutoExpireWatchedPriority()
    427478{
    428     GlobalCheckBox *bc = new GlobalCheckBox("AutoExpireWatchedPriority");
     479    GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("AutoExpireWatchedPriority");
    429480    bc->setLabel(QObject::tr("Watched before unwatched"));
    430481    bc->setValue(false);
    431482    bc->setHelpText(QObject::tr("If enabled, programs that have been marked as "
    static GlobalCheckBox *AutoExpireWatchedPriority()  
    434485    return bc;
    435486}
    436487
    437 static GlobalSpinBox *AutoExpireDayPriority()
     488static GlobalSpinBoxSetting *AutoExpireDayPriority()
    438489{
    439     GlobalSpinBox *bs = new GlobalSpinBox("AutoExpireDayPriority", 1, 400, 1);
     490    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("AutoExpireDayPriority", 1, 400, 1);
    440491    bs->setLabel(QObject::tr("Priority weight"));
    441492    bs->setHelpText(QObject::tr("The number of days bonus a program gets for "
    442493                    "each priority point. This is only used when the Weighted "
    static GlobalSpinBox *AutoExpireDayPriority()  
    445496    return bs;
    446497};
    447498
    448 static GlobalCheckBox *AutoExpireDefault()
     499static GlobalCheckBoxSetting *AutoExpireDefault()
    449500{
    450     GlobalCheckBox *bc = new GlobalCheckBox("AutoExpireDefault");
     501    GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("AutoExpireDefault");
    451502    bc->setLabel(QObject::tr("Auto-Expire default"));
    452503    bc->setValue(true);
    453504    bc->setHelpText(QObject::tr("If enabled, any new recording schedules "
    static GlobalCheckBox *AutoExpireDefault()  
    456507    return bc;
    457508}
    458509
    459 static GlobalSpinBox *AutoExpireLiveTVMaxAge()
     510static GlobalSpinBoxSetting *AutoExpireLiveTVMaxAge()
    460511{
    461     GlobalSpinBox *bs = new GlobalSpinBox("AutoExpireLiveTVMaxAge", 1, 365, 1);
     512    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("AutoExpireLiveTVMaxAge", 1, 365, 1);
    462513    bs->setLabel(QObject::tr("Live TV max age (days)"));
    463514    bs->setHelpText(QObject::tr("Auto-Expire will force expiration of Live "
    464515                    "TV recordings when they are this many days old. Live TV "
    465516                    "recordings may also be expired early if necessary to "
    466517                    "free up disk space."));
    467     bs->setValue(1);
     518    bs->setValue((int)1);
    468519    return bs;
    469520};
    470521
    static GlobalSpinBox *MinRecordDiskThreshold()  
    483534}
    484535#endif
    485536
    486 static GlobalCheckBox *RerecordWatched()
     537static GlobalCheckBoxSetting *RerecordWatched()
    487538{
    488     GlobalCheckBox *bc = new GlobalCheckBox("RerecordWatched");
     539    GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("RerecordWatched");
    489540    bc->setLabel(QObject::tr("Re-record watched"));
    490541    bc->setValue(false);
    491542    bc->setHelpText(QObject::tr("If enabled, programs that have been marked as "
    static GlobalCheckBox *RerecordWatched()  
    494545    return bc;
    495546}
    496547
    497 static GlobalSpinBox *RecordPreRoll()
     548static GlobalSpinBoxSetting *RecordPreRoll()
    498549{
    499     GlobalSpinBox *bs = new GlobalSpinBox("RecordPreRoll", 0, 600, 60, true);
     550    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("RecordPreRoll", 0, 600, 60, true);
    500551    bs->setLabel(QObject::tr("Time to record before start of show "
    501552                 "(secs)"));
    502553    bs->setHelpText(QObject::tr("This global setting allows the recorder "
    static GlobalSpinBox *RecordPreRoll()  
    507558    return bs;
    508559}
    509560
    510 static GlobalSpinBox *RecordOverTime()
     561static GlobalSpinBoxSetting *RecordOverTime()
    511562{
    512     GlobalSpinBox *bs = new GlobalSpinBox("RecordOverTime", 0, 1800, 60, true);
     563    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("RecordOverTime", 0, 1800, 60, true);
    513564    bs->setLabel(QObject::tr("Time to record past end of show (secs)"));
    514565    bs->setValue(0);
    515566    bs->setHelpText(QObject::tr("This global setting allows the recorder "
    static GlobalSpinBox *RecordOverTime()  
    519570    return bs;
    520571}
    521572
    522 static GlobalComboBox *OverTimeCategory()
     573static GlobalComboBoxSetting *OverTimeCategory()
    523574{
    524     GlobalComboBox *gc = new GlobalComboBox("OverTimeCategory");
     575    GlobalComboBoxSetting *gc = new GlobalComboBoxSetting("OverTimeCategory");
    525576    gc->setLabel(QObject::tr("Category of shows to be extended"));
    526577    gc->setHelpText(QObject::tr("For a special category (e.g. "
    527578                    "\"Sports event\"), request that shows be autoextended. "
    528579                    "Only works if a show's category can be determined."));
    529580
    530581    MSqlQuery query(MSqlQuery::InitCon());
     582    //TODO We should not have any SQL here
    531583    query.prepare("SELECT DISTINCT category FROM program GROUP BY category;");
    532584
    533585    gc->addSelection("", "");
     586
    534587    if (query.exec())
    535588    {
    536589        while (query.next())
    static GlobalComboBox *OverTimeCategory()  
    544597    return gc;
    545598}
    546599
    547 static GlobalSpinBox *CategoryOverTime()
     600static GlobalSpinBoxSetting *CategoryOverTime()
    548601{
    549     GlobalSpinBox *bs = new GlobalSpinBox("CategoryOverTime",
     602    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("CategoryOverTime",
    550603                                          0, 180, 60, true);
    551604    bs->setLabel(QObject::tr("Record past end of show (mins)"));
    552605    bs->setValue(30);
    static GlobalSpinBox *CategoryOverTime()  
    557610    return bs;
    558611}
    559612
    560 static VerticalConfigurationGroup *CategoryOverTimeSettings()
     613static GroupSetting *CategoryOverTimeSettings()
    561614{
    562     VerticalConfigurationGroup *vcg =
    563         new VerticalConfigurationGroup(false, false);
    564 
     615    GroupSetting *vcg = new GroupSetting();
    565616    vcg->setLabel(QObject::tr("Category record over-time"));
    566     vcg->setUseLabel(true);
    567617    vcg->addChild(OverTimeCategory());
    568618    vcg->addChild(CategoryOverTime());
    569619    return vcg;
    static QString pad(const QString &str, int len)  
    588638
    589639    return tmp;
    590640}
    591 
     641/*
    592642PlaybackProfileItemConfig::PlaybackProfileItemConfig(ProfileItem &_item) :
    593643    item(_item)
    594644{
    void PlaybackProfileConfig::swap(int i, int j)  
    11171167    labels[i]->setValue(label_j);
    11181168    labels[j]->setValue(label_i);
    11191169}
     1170*/
     1171
     1172static HostComboBoxSetting * CurrentPlaybackProfile()
     1173{
     1174    HostComboBoxSetting *grouptrigger = new HostComboBoxSetting("DefaultVideoPlaybackProfile");
     1175    grouptrigger->setLabel(QObject::tr("Current Video Playback Profile"));
     1176
     1177    QString host = gCoreContext->GetHostName();
     1178    QStringList profiles = VideoDisplayProfile::GetProfiles(host);
     1179    if (profiles.empty())
     1180    {
     1181        VideoDisplayProfile::CreateProfiles(host);
     1182        profiles = VideoDisplayProfile::GetProfiles(host);
     1183    }
     1184    if (profiles.empty())
     1185        return grouptrigger;
     1186
     1187    if (!profiles.contains("Normal") &&
     1188        !profiles.contains("High Quality") &&
     1189        !profiles.contains("Slim"))
     1190    {
     1191        VideoDisplayProfile::CreateNewProfiles(host);
     1192        profiles = VideoDisplayProfile::GetProfiles(host);
     1193    }
     1194
     1195    if (!profiles.contains("VDPAU Normal") &&
     1196        !profiles.contains("VDPAU High Quality") &&
     1197        !profiles.contains("VDPAU Slim"))
     1198    {
     1199        VideoDisplayProfile::CreateVDPAUProfiles(host);
     1200        profiles = VideoDisplayProfile::GetProfiles(host);
     1201    }
     1202
     1203    QString profile = VideoDisplayProfile::GetDefaultProfileName(host);
     1204    if (!profiles.contains(profile))
     1205    {
     1206        profile = (profiles.contains("Normal")) ? "Normal" : profiles[0];
     1207        VideoDisplayProfile::SetDefaultProfileName(profile, host);
     1208    }
     1209
     1210    QStringList::const_iterator it;
     1211    for (it = profiles.begin(); it != profiles.end(); ++it)
     1212        grouptrigger->addSelection(ProgramInfo::i18n(*it), *it);
     1213    return grouptrigger;
     1214}
    11201215
    1121 PlaybackProfileConfigs::PlaybackProfileConfigs(const QString &str) :
     1216/*
     1217PlaybackProfileConfigs::PlaybackProfileConfigs() :
    11221218    TriggeredConfigurationGroup(false, true,  true, true,
    11231219                                false, false, true, true), grouptrigger(NULL)
    11241220{
    1125     setLabel(QObject::tr("Playback Profiles") + str);
     1221    setLabel(QObject::tr("Playback Profiles"));
    11261222
    11271223    QString host = gCoreContext->GetHostName();
    11281224    QStringList profiles = VideoDisplayProfile::GetProfiles(host);
    void PlaybackProfileConfigs::btnPress(QString cmd)  
    12561352void PlaybackProfileConfigs::triggerChanged(const QString &trig)
    12571353{
    12581354    TriggeredConfigurationGroup::triggerChanged(trig);
    1259 }
     1355}*/
     1356/*
     1357class PlaybackProfileConfigsButton : public StandardSetting, public TransientStorage
     1358{
     1359  public:
     1360    PlaybackProfileConfigsButton():StandardSetting(),TransientStorage()
     1361    {
     1362        setLabel()
     1363       
     1364    };
    12601365
    1261 static HostComboBox *PlayBoxOrdering()
     1366    virtual void Load(void){StandardSetting::Load();};
     1367    virtual void Save(void){StandardSetting::Save();};
     1368    virtual bool edit(MythScreenType * screen);
     1369    virtual void resultEdit(DialogCompletionEvent *dce, MythUIButtonListItem *item){};
     1370    virtual void applyChange(){};
     1371};*/
     1372
     1373static HostComboBoxSetting *PlayBoxOrdering()
    12621374{
    12631375    QString str[4] =
    12641376    {
    static HostComboBox *PlayBoxOrdering()  
    12731385        "refers to sections (e.g. \"All Programs\") which list "
    12741386        "multiple titles. Sections in parentheses are not affected.");
    12751387
    1276     HostComboBox *gc = new HostComboBox("PlayBoxOrdering");
     1388    HostComboBoxSetting *gc = new HostComboBoxSetting("PlayBoxOrdering");
    12771389    gc->setLabel(QObject::tr("Episode sort orderings"));
    12781390
    12791391    for (int i = 0; i < 4; ++i)
    static HostComboBox *PlayBoxOrdering()  
    12851397    return gc;
    12861398}
    12871399
    1288 static HostComboBox *PlayBoxEpisodeSort()
     1400static HostComboBoxSetting *PlayBoxEpisodeSort()
    12891401{
    1290     HostComboBox *gc = new HostComboBox("PlayBoxEpisodeSort");
     1402    HostComboBoxSetting *gc = new HostComboBoxSetting("PlayBoxEpisodeSort");
    12911403    gc->setLabel(QObject::tr("Sort episodes"));
    12921404    gc->addSelection(QObject::tr("Record date"), "Date");
    12931405    gc->addSelection(QObject::tr("Season/Episode"), "Season");
    static HostComboBox *PlayBoxEpisodeSort()  
    12971409    return gc;
    12981410}
    12991411
    1300 static HostSpinBox *FFRewReposTime()
     1412static HostSpinBoxSetting *FFRewReposTime()
    13011413{
    1302     HostSpinBox *gs = new HostSpinBox("FFRewReposTime", 0, 200, 5);
     1414    HostSpinBoxSetting *gs = new HostSpinBoxSetting("FFRewReposTime", 0, 200, 5);
    13031415    gs->setLabel(QObject::tr("Fast forward/rewind reposition amount"));
    13041416    gs->setValue(100);
    13051417    gs->setHelpText(QObject::tr("When exiting sticky keys fast forward/rewind "
    static HostSpinBox *FFRewReposTime()  
    13101422    return gs;
    13111423}
    13121424
    1313 static HostCheckBox *FFRewReverse()
     1425static HostCheckBoxSetting *FFRewReverse()
    13141426{
    1315     HostCheckBox *gc = new HostCheckBox("FFRewReverse");
     1427    HostCheckBoxSetting *gc = new HostCheckBoxSetting("FFRewReverse");
    13161428    gc->setLabel(QObject::tr("Reverse direction in fast forward/rewind"));
    13171429    gc->setValue(true);
    13181430    gc->setHelpText(QObject::tr("If enabled, pressing the sticky rewind key "
    static HostCheckBox *FFRewReverse()  
    13231435    return gc;
    13241436}
    13251437
    1326 static HostComboBox *MenuTheme()
     1438static HostComboBoxSetting *MenuTheme()
    13271439{
    1328     HostComboBox *gc = new HostComboBox("MenuTheme");
     1440    HostComboBoxSetting *gc = new HostComboBoxSetting("MenuTheme");
    13291441    gc->setLabel(QObject::tr("Menu theme"));
    13301442
    13311443    QList<ThemeInfo> themelist = GetMythUI()->GetThemes(THEME_MENU);
    static HostComboBox MUNUSED *DecodeVBIFormat()  
    13581470    return gc;
    13591471}
    13601472
    1361 static HostSpinBox *OSDCC708TextZoomPercentage(void)
     1473static HostSpinBoxSetting *OSDCC708TextZoomPercentage(void)
    13621474{
    1363     HostSpinBox *gs = new HostSpinBox("OSDCC708TextZoom", 50, 200, 5);
     1475    HostSpinBoxSetting *gs = new HostSpinBoxSetting("OSDCC708TextZoom", 50, 200, 5);
    13641476    gs->setLabel(QObject::tr("Subtitle text zoom percentage"));
    13651477    gs->setValue(100);
    13661478    gs->setHelpText(QObject::tr("Use this to enlarge or shrink text based subtitles."));
    static HostSpinBox *OSDCC708TextZoomPercentage(void)  
    13681480    return gs;
    13691481}
    13701482
    1371 static HostComboBox *SubtitleFont()
     1483static HostComboBoxSetting *SubtitleFont()
    13721484{
    1373     HostComboBox *hcb = new HostComboBox("DefaultSubtitleFont");
     1485    HostComboBoxSetting *hcb = new HostComboBoxSetting("DefaultSubtitleFont");
    13741486    QFontDatabase db;
    13751487    QStringList fonts = db.families();
    13761488    QStringList hide  = db.families(QFontDatabase::Symbol);
    static HostComboBox *SubtitleFont()  
    13851497    return hcb;
    13861498}
    13871499
    1388 static HostComboBox *SubtitleCodec()
     1500static HostComboBoxSetting *SubtitleCodec()
    13891501{
    1390     HostComboBox *gc = new HostComboBox("SubtitleCodec");
     1502    HostComboBoxSetting *gc = new HostComboBoxSetting("SubtitleCodec");
    13911503
    13921504    gc->setLabel(QObject::tr("Subtitle Codec"));
    13931505    QList<QByteArray> list = QTextCodec::availableCodecs();
    static HostComboBox *SubtitleCodec()  
    14001512    return gc;
    14011513}
    14021514
    1403 static HostComboBox *ChannelOrdering()
     1515static HostComboBoxSetting *ChannelOrdering()
    14041516{
    1405     HostComboBox *gc = new HostComboBox("ChannelOrdering");
     1517    HostComboBoxSetting *gc = new HostComboBoxSetting("ChannelOrdering");
    14061518    gc->setLabel(QObject::tr("Channel ordering"));
    14071519    gc->addSelection(QObject::tr("channel number"), "channum");
    14081520    gc->addSelection(QObject::tr("callsign"),       "callsign");
    14091521    return gc;
    14101522}
    14111523
    1412 static HostSpinBox *VertScanPercentage()
     1524static HostSpinBoxSetting *VertScanPercentage()
    14131525{
    1414     HostSpinBox *gs = new HostSpinBox("VertScanPercentage", -100, 100, 1);
     1526    HostSpinBoxSetting *gs = new HostSpinBoxSetting("VertScanPercentage", -100, 100, 1);
     1527    //TODO should this not be 0% -> 200%
    14151528    gs->setLabel(QObject::tr("Vertical scaling"));
    14161529    gs->setValue(0);
    14171530    gs->setHelpText(QObject::tr(
    static HostSpinBox *VertScanPercentage()  
    14201533    return gs;
    14211534}
    14221535
    1423 static HostSpinBox *HorizScanPercentage()
     1536static HostSpinBoxSetting *HorizScanPercentage()
    14241537{
    1425     HostSpinBox *gs = new HostSpinBox("HorizScanPercentage", -100, 100, 1);
     1538    HostSpinBoxSetting *gs = new HostSpinBoxSetting("HorizScanPercentage", -100, 100, 1);
     1539    //TODO should this not be 0% -> 200%
    14261540    gs->setLabel(QObject::tr("Horizontal scaling"));
    14271541    gs->setValue(0);
    14281542    gs->setHelpText(QObject::tr(
    static HostSpinBox *HorizScanPercentage()  
    14311545    return gs;
    14321546};
    14331547
    1434 static HostSpinBox *XScanDisplacement()
     1548static HostSpinBoxSetting *XScanDisplacement()
    14351549{
    1436     HostSpinBox *gs = new HostSpinBox("XScanDisplacement", -50, 50, 1);
     1550    HostSpinBoxSetting *gs = new HostSpinBoxSetting("XScanDisplacement", -50, 50, 1);
    14371551    gs->setLabel(QObject::tr("Scan displacement (X)"));
    14381552    gs->setValue(0);
    14391553    gs->setHelpText(QObject::tr("Adjust this to move the image horizontally."));
    14401554    return gs;
    14411555}
    14421556
    1443 static HostSpinBox *YScanDisplacement()
     1557static HostSpinBoxSetting *YScanDisplacement()
    14441558{
    1445     HostSpinBox *gs = new HostSpinBox("YScanDisplacement", -50, 50, 1);
     1559    HostSpinBoxSetting *gs = new HostSpinBoxSetting("YScanDisplacement", -50, 50, 1);
    14461560    gs->setLabel(QObject::tr("Scan displacement (Y)"));
    14471561    gs->setValue(0);
    14481562    gs->setHelpText(QObject::tr("Adjust this to move the image vertically."));
    14491563    return gs;
    14501564};
    14511565
    1452 static HostCheckBox *CCBackground()
     1566static HostCheckBoxSetting *CCBackground()
    14531567{
    1454     HostCheckBox *gc = new HostCheckBox("CCBackground");
     1568    HostCheckBoxSetting *gc = new HostCheckBoxSetting("CCBackground");
    14551569    gc->setLabel(QObject::tr("Black background for closed captioning"));
    14561570    gc->setValue(false);
    14571571    gc->setHelpText(QObject::tr(
    static HostCheckBox *CCBackground()  
    14611575    return gc;
    14621576}
    14631577
    1464 static HostCheckBox *DefaultCCMode()
     1578static HostCheckBoxSetting *DefaultCCMode()
    14651579{
    1466     HostCheckBox *gc = new HostCheckBox("DefaultCCMode");
     1580    HostCheckBoxSetting *gc = new HostCheckBoxSetting("DefaultCCMode");
    14671581    gc->setLabel(QObject::tr("Always display closed captioning or subtitles"));
    14681582    gc->setValue(false);
    14691583    gc->setHelpText(QObject::tr(
    static HostCheckBox *DefaultCCMode()  
    14741588    return gc;
    14751589}
    14761590
    1477 static HostCheckBox *PreferCC708()
     1591static HostCheckBoxSetting *PreferCC708()
    14781592{
    1479     HostCheckBox *gc = new HostCheckBox("Prefer708Captions");
     1593    HostCheckBoxSetting *gc = new HostCheckBoxSetting("Prefer708Captions");
    14801594    gc->setLabel(QObject::tr("Prefer EIA-708 over EIA-608 captions"));
    14811595    gc->setValue(true);
    14821596    gc->setHelpText(
    static HostCheckBox *PreferCC708()  
    14871601    return gc;
    14881602}
    14891603
    1490 static HostCheckBox *EnableMHEG()
     1604static HostCheckBoxSetting *EnableMHEG()
    14911605{
    1492     HostCheckBox *gc = new HostCheckBox("EnableMHEG");
     1606    HostCheckBoxSetting *gc = new HostCheckBoxSetting("EnableMHEG");
    14931607    gc->setLabel(QObject::tr("Enable interactive TV"));
    14941608    gc->setValue(false);
    14951609    gc->setHelpText(QObject::tr(
    static HostCheckBox *EnableMHEG()  
    14991613    return gc;
    15001614}
    15011615
    1502 static HostCheckBox *PersistentBrowseMode()
     1616static HostCheckBoxSetting *PersistentBrowseMode()
    15031617{
    1504     HostCheckBox *gc = new HostCheckBox("PersistentBrowseMode");
     1618    HostCheckBoxSetting *gc = new HostCheckBoxSetting("PersistentBrowseMode");
    15051619    gc->setLabel(QObject::tr("Always use browse mode in Live TV"));
    15061620    gc->setValue(true);
    15071621    gc->setHelpText(
    static HostCheckBox *PersistentBrowseMode()  
    15111625    return gc;
    15121626}
    15131627
    1514 static HostCheckBox *BrowseAllTuners()
     1628static HostCheckBoxSetting *BrowseAllTuners()
    15151629{
    1516     HostCheckBox *gc = new HostCheckBox("BrowseAllTuners");
     1630    HostCheckBoxSetting *gc = new HostCheckBoxSetting("BrowseAllTuners");
    15171631    gc->setLabel(QObject::tr("Browse all channels"));
    15181632    gc->setValue(false);
    15191633    gc->setHelpText(
    static HostCheckBox *BrowseAllTuners()  
    15241638    return gc;
    15251639}
    15261640
    1527 static HostCheckBox *ClearSavedPosition()
     1641static HostCheckBoxSetting *ClearSavedPosition()
    15281642{
    1529     HostCheckBox *gc = new HostCheckBox("ClearSavedPosition");
     1643    HostCheckBoxSetting *gc = new HostCheckBoxSetting("ClearSavedPosition");
    15301644    gc->setLabel(QObject::tr("Clear bookmark on playback"));
    15311645    gc->setValue(true);
    15321646    gc->setHelpText(QObject::tr("If enabled, automatically clear the "
    static HostCheckBox *ClearSavedPosition()  
    15361650    return gc;
    15371651}
    15381652
    1539 static HostCheckBox *AltClearSavedPosition()
     1653static HostCheckBoxSetting *AltClearSavedPosition()
    15401654{
    1541     HostCheckBox *gc = new HostCheckBox("AltClearSavedPosition");
     1655    HostCheckBoxSetting *gc = new HostCheckBoxSetting("AltClearSavedPosition");
    15421656    gc->setLabel(QObject::tr("Alternate clear and save bookmark"));
    15431657    gc->setValue(true);
    15441658    gc->setHelpText(QObject::tr("During playback the SELECT key "
    static HostCheckBox *AltClearSavedPosition()  
    15491663    return gc;
    15501664}
    15511665
    1552 static HostComboBox *PlaybackExitPrompt()
     1666static HostComboBoxSetting *PlaybackExitPrompt()
    15531667{
    1554     HostComboBox *gc = new HostComboBox("PlaybackExitPrompt");
     1668    HostComboBoxSetting *gc = new HostComboBoxSetting("PlaybackExitPrompt");
    15551669    gc->setLabel(QObject::tr("Action on playback exit"));
    15561670    gc->addSelection(QObject::tr("Just exit"), "0");
    15571671    gc->addSelection(QObject::tr("Save position and exit"), "2");
    static HostComboBox *PlaybackExitPrompt()  
    15651679    return gc;
    15661680}
    15671681
    1568 static HostCheckBox *EndOfRecordingExitPrompt()
     1682static HostCheckBoxSetting *EndOfRecordingExitPrompt()
    15691683{
    1570     HostCheckBox *gc = new HostCheckBox("EndOfRecordingExitPrompt");
     1684    HostCheckBoxSetting *gc = new HostCheckBoxSetting("EndOfRecordingExitPrompt");
    15711685    gc->setLabel(QObject::tr("Prompt at end of recording"));
    15721686    gc->setValue(false);
    15731687    gc->setHelpText(QObject::tr("If enabled, a menu will be displayed allowing "
    static HostCheckBox *EndOfRecordingExitPrompt()  
    15761690    return gc;
    15771691}
    15781692
    1579 static HostCheckBox *JumpToProgramOSD()
     1693static HostCheckBoxSetting *JumpToProgramOSD()
    15801694{
    1581     HostCheckBox *gc = new HostCheckBox("JumpToProgramOSD");
     1695    HostCheckBoxSetting *gc = new HostCheckBoxSetting("JumpToProgramOSD");
    15821696    gc->setLabel(QObject::tr("Jump to program OSD"));
    15831697    gc->setValue(true);
    15841698    gc->setHelpText(QObject::tr(
    static HostCheckBox *JumpToProgramOSD()  
    15901704    return gc;
    15911705}
    15921706
    1593 static HostCheckBox *ContinueEmbeddedTVPlay()
     1707static HostCheckBoxSetting *ContinueEmbeddedTVPlay()
    15941708{
    1595     HostCheckBox *gc = new HostCheckBox("ContinueEmbeddedTVPlay");
     1709    HostCheckBoxSetting *gc = new HostCheckBoxSetting("ContinueEmbeddedTVPlay");
    15961710    gc->setLabel(QObject::tr("Continue playback when embedded"));
    15971711    gc->setValue(false);
    15981712    gc->setHelpText(QObject::tr(
    static HostCheckBox *ContinueEmbeddedTVPlay()  
    16031717    return gc;
    16041718}
    16051719
    1606 static HostCheckBox *AutomaticSetWatched()
     1720static HostCheckBoxSetting *AutomaticSetWatched()
    16071721{
    1608     HostCheckBox *gc = new HostCheckBox("AutomaticSetWatched");
     1722    HostCheckBoxSetting *gc = new HostCheckBoxSetting("AutomaticSetWatched");
    16091723    gc->setLabel(QObject::tr("Automatically mark a recording as watched"));
    16101724    gc->setValue(false);
    16111725    gc->setHelpText(QObject::tr("If enabled, when you exit near the end of a "
    static HostCheckBox *AutomaticSetWatched()  
    16161730    return gc;
    16171731}
    16181732
    1619 static HostSpinBox *LiveTVIdleTimeout()
     1733static HostSpinBoxSetting *LiveTVIdleTimeout()
    16201734{
    1621     HostSpinBox *gs = new HostSpinBox("LiveTVIdleTimeout", 0, 3600, 1);
     1735    HostSpinBoxSetting *gs = new HostSpinBoxSetting("LiveTVIdleTimeout", 0, 3600, 1);
    16221736    gs->setLabel(QObject::tr("Live TV idle timeout (mins)"));
    16231737    gs->setValue(0);
    16241738    gs->setHelpText(QObject::tr(
    static HostSpinBox *LiveTVIdleTimeout()  
    16531767//     return gc;
    16541768// }
    16551769
    1656 static HostCheckBox *UseVirtualKeyboard()
     1770static HostCheckBoxSetting *UseVirtualKeyboard()
    16571771{
    1658     HostCheckBox *gc = new HostCheckBox("UseVirtualKeyboard");
     1772    HostCheckBoxSetting *gc = new HostCheckBoxSetting("UseVirtualKeyboard");
    16591773    gc->setLabel(QObject::tr("Use line edit virtual keyboards"));
    16601774    gc->setValue(true);
    16611775    gc->setHelpText(QObject::tr("If enabled, you can use a virtual keyboard "
    static HostCheckBox *UseVirtualKeyboard()  
    16641778    return gc;
    16651779}
    16661780
    1667 static HostComboBox *OverrideExitMenu()
     1781static HostComboBoxSetting *OverrideExitMenu()
    16681782{
    1669     HostComboBox *gc = new HostComboBox("OverrideExitMenu");
     1783    HostComboBoxSetting *gc = new HostComboBoxSetting("OverrideExitMenu");
    16701784    gc->setLabel(QObject::tr("Customize exit menu options"));
    16711785    gc->addSelection(QObject::tr("Default"), "0");
    16721786    gc->addSelection(QObject::tr("Show quit"), "1");
    static HostComboBox *OverrideExitMenu()  
    16811795    return gc;
    16821796}
    16831797
    1684 static HostLineEdit *RebootCommand()
     1798static HostTextEditSetting *RebootCommand()
    16851799{
    1686     HostLineEdit *ge = new HostLineEdit("RebootCommand");
     1800    HostTextEditSetting *ge = new HostTextEditSetting("RebootCommand");
    16871801    ge->setLabel(QObject::tr("Reboot command"));
    16881802    ge->setValue("");
    16891803    ge->setHelpText(QObject::tr("Optional. Script to run if you select "
    static HostLineEdit *RebootCommand()  
    16931807    return ge;
    16941808}
    16951809
    1696 static HostLineEdit *HaltCommand()
     1810static HostTextEditSetting *HaltCommand()
    16971811{
    1698     HostLineEdit *ge = new HostLineEdit("HaltCommand");
     1812    HostTextEditSetting *ge = new HostTextEditSetting("HaltCommand");
    16991813    ge->setLabel(QObject::tr("Halt command"));
    17001814    ge->setValue("");
    17011815    ge->setHelpText(QObject::tr("Optional. Script to run if you select "
    static HostLineEdit *HaltCommand()  
    17051819    return ge;
    17061820}
    17071821
    1708 static HostLineEdit *LircDaemonDevice()
     1822static HostTextEditSetting *LircDaemonDevice()
    17091823{
    1710     HostLineEdit *ge = new HostLineEdit("LircSocket");
     1824// TODO Cannot use File browser as it can be address[:port]
     1825//    HostFileBrowserSetting *ge = new HostFileBrowserSetting("LircSocket");
     1826    HostTextEditSetting *ge = new HostTextEditSetting("LircSocket");
    17111827    ge->setLabel(QObject::tr("LIRC daemon socket"));
    17121828
    17131829    /* lircd socket moved from /dev/ to /var/run/lirc/ in lirc 0.8.6 */
    static HostLineEdit *LircDaemonDevice()  
    17221838    return ge;
    17231839}
    17241840
    1725 static HostLineEdit *ScreenShotPath()
     1841static HostTextEditSetting *ScreenShotPath()
    17261842{
    1727     HostLineEdit *ge = new HostLineEdit("ScreenShotPath");
     1843    HostTextEditSetting *ge = new HostTextEditSetting("ScreenShotPath");
    17281844    ge->setLabel(QObject::tr("Screen shot path"));
    17291845    ge->setValue("/tmp/");
    17301846    ge->setHelpText(QObject::tr("Path to screenshot storage location. Should be writable by the frontend"));
    17311847    return ge;
    17321848}
    17331849
    1734 static HostLineEdit *SetupPinCode()
     1850static HostTextEditSetting *SetupPinCode()
    17351851{
    1736     HostLineEdit *ge = new HostLineEdit("SetupPinCode");
     1852    HostTextEditSetting *ge = new HostTextEditSetting("SetupPinCode");
    17371853    ge->setLabel(QObject::tr("Setup PIN code"));
    17381854    ge->setHelpText(QObject::tr("This PIN is used to control access to the "
    17391855                    "setup menus. If you want to use this feature, then "
    static HostLineEdit *SetupPinCode()  
    17421858    return ge;
    17431859}
    17441860
    1745 static HostCheckBox *SetupPinCodeRequired()
     1861static HostCheckBoxSetting *SetupPinCodeRequired()
    17461862{
    1747     HostCheckBox *gc = new HostCheckBox("SetupPinCodeRequired");
     1863    HostCheckBoxSetting *gc = new HostCheckBoxSetting("SetupPinCodeRequired");
    17481864    gc->setLabel(QObject::tr("Require setup PIN") + "    ");
    17491865    gc->setValue(false);
    17501866    gc->setHelpText(QObject::tr("If enabled, you will not be able to return "
    static HostCheckBox *SetupPinCodeRequired()  
    17531869    return gc;
    17541870}
    17551871
    1756 static HostComboBox *XineramaScreen()
     1872static HostComboBoxSetting *XineramaScreen()
    17571873{
    1758     HostComboBox *gc = new HostComboBox("XineramaScreen", false);
     1874    HostComboBoxSetting *gc = new HostComboBoxSetting("XineramaScreen");
    17591875    int num = MythDisplay::GetNumberXineramaScreens();
    17601876    for (int i=0; i<num; ++i)
    17611877        gc->addSelection(QString::number(i), QString::number(i));
    static HostComboBox *XineramaScreen()  
    17681884}
    17691885
    17701886
    1771 static HostComboBox *XineramaMonitorAspectRatio()
     1887static HostComboBoxSetting *XineramaMonitorAspectRatio()
    17721888{
    1773     HostComboBox *gc = new HostComboBox("XineramaMonitorAspectRatio");
     1889    HostComboBoxSetting *gc = new HostComboBoxSetting("XineramaMonitorAspectRatio");
    17741890    gc->setLabel(QObject::tr("Monitor aspect ratio"));
    17751891    gc->addSelection(QObject::tr("4:3"),   "1.3333");
    17761892    gc->addSelection(QObject::tr("16:9"),  "1.7777");
    static HostComboBox *XineramaMonitorAspectRatio()  
    17811897    return gc;
    17821898}
    17831899
    1784 static HostComboBox *LetterboxingColour()
     1900static HostComboBoxSetting *LetterboxingColour()
    17851901{
    1786     HostComboBox *gc = new HostComboBox("LetterboxColour");
     1902    HostComboBoxSetting *gc = new HostComboBoxSetting("LetterboxColour");
    17871903    gc->setLabel(QObject::tr("Letterboxing color"));
    17881904    for (int m = kLetterBoxColour_Black; m < kLetterBoxColour_END; ++m)
    17891905        gc->addSelection(toString((LetterBoxColour)m), QString::number(m));
    static HostComboBox *LetterboxingColour()  
    17961912    return gc;
    17971913}
    17981914
    1799 static HostComboBox *AspectOverride()
     1915static HostComboBoxSetting *AspectOverride()
    18001916{
    1801     HostComboBox *gc = new HostComboBox("AspectOverride");
     1917    HostComboBoxSetting *gc = new HostComboBoxSetting("AspectOverride");
    18021918    gc->setLabel(QObject::tr("Video aspect override"));
    18031919    for (int m = kAspect_Off; m < kAspect_END; ++m)
    18041920        gc->addSelection(toString((AspectOverrideMode)m), QString::number(m));
    static HostComboBox *AspectOverride()  
    18091925    return gc;
    18101926}
    18111927
    1812 static HostComboBox *AdjustFill()
     1928static HostComboBoxSetting *AdjustFill()
    18131929{
    1814     HostComboBox *gc = new HostComboBox("AdjustFill");
     1930    HostComboBoxSetting *gc = new HostComboBoxSetting("AdjustFill");
    18151931    gc->setLabel(QObject::tr("Zoom"));
    18161932    for (int m = kAdjustFill_Off; m < kAdjustFill_END; ++m)
    18171933        gc->addSelection(toString((AdjustFillMode)m), QString::number(m));
    static HostComboBox *AdjustFill()  
    18271943
    18281944// Theme settings
    18291945
    1830 static HostSpinBox *GuiWidth()
     1946static HostSpinBoxSetting *GuiWidth()
    18311947{
    1832     HostSpinBox *gs = new HostSpinBox("GuiWidth", 0, 1920, 8, true);
     1948    HostSpinBoxSetting *gs = new HostSpinBoxSetting("GuiWidth", 0, 1920, 8, true);
    18331949    gs->setLabel(QObject::tr("GUI width (pixels)"));
    18341950    gs->setValue(0);
    18351951    gs->setHelpText(QObject::tr("The width of the GUI. Do not make the GUI "
    static HostSpinBox *GuiWidth()  
    18381954    return gs;
    18391955}
    18401956
    1841 static HostSpinBox *GuiHeight()
     1957static HostSpinBoxSetting *GuiHeight()
    18421958{
    1843     HostSpinBox *gs = new HostSpinBox("GuiHeight", 0, 1600, 8, true);
     1959    HostSpinBoxSetting *gs = new HostSpinBoxSetting("GuiHeight", 0, 1600, 8, true);
    18441960    gs->setLabel(QObject::tr("GUI height (pixels)"));
    18451961    gs->setValue(0);
    18461962    gs->setHelpText(QObject::tr("The height of the GUI. Do not make the GUI "
    static HostSpinBox *GuiHeight()  
    18491965    return gs;
    18501966}
    18511967
    1852 static HostSpinBox *GuiOffsetX()
     1968static HostSpinBoxSetting *GuiOffsetX()
    18531969{
    1854     HostSpinBox *gs = new HostSpinBox("GuiOffsetX", -3840, 3840, 32, true);
     1970    HostSpinBoxSetting *gs = new HostSpinBoxSetting("GuiOffsetX", -3840, 3840, 32, true);
    18551971    gs->setLabel(QObject::tr("GUI X offset"));
    18561972    gs->setValue(0);
    18571973    gs->setHelpText(QObject::tr("The horizontal offset where the GUI will be "
    static HostSpinBox *GuiOffsetX()  
    18591975    return gs;
    18601976}
    18611977
    1862 static HostSpinBox *GuiOffsetY()
     1978static HostSpinBoxSetting *GuiOffsetY()
    18631979{
    1864     HostSpinBox *gs = new HostSpinBox("GuiOffsetY", -1600, 1600, 8, true);
     1980    HostSpinBoxSetting *gs = new HostSpinBoxSetting("GuiOffsetY", -1600, 1600, 8, true);
    18651981    gs->setLabel(QObject::tr("GUI Y offset"));
    18661982    gs->setValue(0);
    18671983    gs->setHelpText(QObject::tr("The vertical offset where the GUI will be "
    static HostSpinBox *DisplaySizeHeight()  
    18932009}
    18942010#endif
    18952011
    1896 static HostCheckBox *GuiSizeForTV()
     2012static HostCheckBoxSetting *GuiSizeForTV()
    18972013{
    1898     HostCheckBox *gc = new HostCheckBox("GuiSizeForTV");
     2014    HostCheckBoxSetting *gc = new HostCheckBoxSetting("GuiSizeForTV");
    18992015    gc->setLabel(QObject::tr("Use GUI size for TV playback"));
    19002016    gc->setValue(true);
    19012017    gc->setHelpText(QObject::tr("If enabled, use the above size for TV, "
    static HostCheckBox *GuiSizeForTV()  
    19042020}
    19052021
    19062022#if defined(USING_XRANDR) || CONFIG_DARWIN
    1907 static HostCheckBox *UseVideoModes()
    1908 {
    1909     HostCheckBox *gc = new HostCheckBox("UseVideoModes");
    1910     gc->setLabel(QObject::tr("Separate video modes for GUI and TV playback"));
    1911     gc->setValue(false);
    1912     gc->setHelpText(QObject::tr("Switch X Window video modes for TV. "
    1913                     "Requires \"xrandr\" support."));
    1914     return gc;
    1915 }
    19162023
    1917 static HostSpinBox *VidModeWidth(int idx)
     2024static HostSpinBoxSetting *VidModeWidth(int idx)
    19182025{
    1919     HostSpinBox *gs = new HostSpinBox(QString("VidModeWidth%1").arg(idx),
     2026    HostSpinBoxSetting *gs = new HostSpinBoxSetting(QString("VidModeWidth%1").arg(idx),
    19202027                                            0, 1920, 16, true);
    19212028    gs->setLabel((idx<1) ? QObject::tr("In X"): "");
    1922     gs->setLabelAboveWidget(idx<1);
    19232029    gs->setValue(0);
    19242030    gs->setHelpText(QObject::tr("Horizontal resolution of video "
    19252031                    "which needs a special output resolution."));
    19262032    return gs;
    19272033}
    19282034
    1929 static HostSpinBox *VidModeHeight(int idx)
     2035static HostSpinBoxSetting *VidModeHeight(int idx)
    19302036{
    1931     HostSpinBox *gs = new HostSpinBox(QString("VidModeHeight%1").arg(idx),
     2037    HostSpinBoxSetting *gs = new HostSpinBoxSetting(QString("VidModeHeight%1").arg(idx),
    19322038                                            0, 1080, 16, true);
    19332039    gs->setLabel((idx<1) ? QObject::tr("In Y"): "");
    1934     gs->setLabelAboveWidget(idx<1);
    19352040    gs->setValue(0);
    19362041    gs->setHelpText(QObject::tr("Vertical resolution of video "
    19372042                    "which needs a special output resolution."));
    19382043    return gs;
    19392044}
    19402045
    1941 static HostComboBox *GuiVidModeResolution()
     2046static HostComboBoxSetting *GuiVidModeResolution()
    19422047{
    1943     HostComboBox *gc = new HostComboBox("GuiVidModeResolution");
     2048    HostComboBoxSetting *gc = new HostComboBoxSetting("GuiVidModeResolution");
    19442049    gc->setLabel(QObject::tr("GUI"));
    1945     gc->setLabelAboveWidget(true);
    19462050    gc->setHelpText(QObject::tr("Resolution of screen "
    19472051                    "when not watching a video."));
    19482052
    static HostComboBox *GuiVidModeResolution()  
    19712075    return gc;
    19722076}
    19732077
    1974 static HostComboBox *TVVidModeResolution(int idx=-1)
     2078static HostComboBoxSetting *TVVidModeResolution(int idx=-1)
    19752079{
    19762080    QString dhelp = QObject::tr("Default screen resolution "
    19772081                                "when watching a video.");
    static HostComboBox *TVVidModeResolution(int idx=-1)  
    19802084
    19812085    QString qstr = (idx<0) ? "TVVidModeResolution" :
    19822086        QString("TVVidModeResolution%1").arg(idx);
    1983     HostComboBox *gc = new HostComboBox(qstr);
     2087    HostComboBoxSetting *gc = new HostComboBoxSetting(qstr);
    19842088    QString lstr = (idx<0) ? QObject::tr("Video output") :
    19852089        ((idx<1) ? QObject::tr("Output") : "");
    19862090    QString hstr = (idx<0) ? dhelp : ohelp;
    19872091
    19882092    gc->setLabel(lstr);
    1989     gc->setLabelAboveWidget(idx<1);
    19902093    gc->setHelpText(hstr);
    19912094
    19922095    const vector<DisplayResScreen> scr = GetVideoModes();
    static HostComboBox *TVVidModeResolution(int idx=-1)  
    19982101    return gc;
    19992102}
    20002103
    2001 static HostRefreshRateComboBox *TVVidModeRefreshRate(int idx=-1)
     2104
     2105void HostRefreshRateComboBoxSetting::ChangeResolution(StandardSetting * setting)
     2106{
     2107    clearSelections();
     2108    QString resolution = setting->getValue();
     2109
     2110    const vector<double> list = GetRefreshRates(resolution);
     2111    addSelection(QObject::tr("Auto"), "0");
     2112    int hz50 = -1, hz60 = -1;
     2113    for (uint i=0; i<list.size(); ++i)
     2114    {
     2115        QString sel = QString::number((double) list[i],'f', 3);
     2116        addSelection(sel+" Hz", sel);
     2117        hz50 = (fabs(50.0 - list[i]) < 0.01) ? i : hz50;
     2118        hz60 = (fabs(60.0 - list[i]) < 0.01) ? i : hz60;
     2119    }
     2120
     2121    setValue(0);
     2122    if ("640x480" == resolution || "720x480" == resolution)
     2123        setValue(hz60+1);
     2124    if ("640x576" == resolution || "720x576" == resolution)
     2125        setValue(hz50+1);
     2126
     2127    setEnabled(list.size());
     2128}
     2129
     2130const vector<double> HostRefreshRateComboBoxSetting::GetRefreshRates(const QString &res)
     2131{
     2132    QStringList slist = res.split("x");
     2133    int w = 0, h = 0;
     2134    bool ok0 = false, ok1 = false;
     2135    if (2 == slist.size())
     2136    {
     2137        w = slist[0].toInt(&ok0);
     2138        h = slist[1].toInt(&ok1);
     2139    }
     2140
     2141    DisplayRes *display_res = DisplayRes::GetDisplayRes();
     2142    if (display_res && ok0 && ok1)
     2143        return display_res->GetRefreshRates(w, h);
     2144
     2145    vector<double> list;
     2146    return list;
     2147}
     2148
     2149
     2150static HostRefreshRateComboBoxSetting *TVVidModeRefreshRate(int idx=-1)
    20022151{
    20032152    QString dhelp = QObject::tr("Default refresh rate "
    20042153                                "when watching a video. "
    static HostRefreshRateComboBox *TVVidModeRefreshRate(int idx=-1)  
    20082157                                "Leave at \"Auto\" to automatically use the best available");
    20092158    QString qstr = (idx<0) ? "TVVidModeRefreshRate" :
    20102159        QString("TVVidModeRefreshRate%1").arg(idx);
    2011     HostRefreshRateComboBox *gc = new HostRefreshRateComboBox(qstr);
     2160    HostRefreshRateComboBoxSetting *gc = new HostRefreshRateComboBoxSetting(qstr);
    20122161    QString lstr = (idx<1) ? QObject::tr("Rate") : "";
    20132162    QString hstr = (idx<0) ? dhelp : ohelp;
    20142163
    20152164    gc->setLabel(lstr);
    2016     gc->setLabelAboveWidget(idx<1);
    20172165    gc->setHelpText(hstr);
    20182166    gc->setEnabled(false);
    20192167    return gc;
    20202168}
    20212169
    2022 static HostComboBox *TVVidModeForceAspect(int idx=-1)
     2170static HostComboBoxSetting *TVVidModeForceAspect(int idx=-1)
    20232171{
    20242172    QString dhelp = QObject::tr("Aspect ratio when watching a video.");
    20252173    QString ohelp = QObject::tr("Aspect ratio when watching a "
    static HostComboBox *TVVidModeForceAspect(int idx=-1)  
    20272175
    20282176    QString qstr = (idx<0) ? "TVVidModeForceAspect" :
    20292177        QString("TVVidModeForceAspect%1").arg(idx);
    2030     HostComboBox *gc = new HostComboBox(qstr);
     2178    HostComboBoxSetting *gc = new HostComboBoxSetting(qstr);
    20312179    gc->setLabel( (idx<1) ? QObject::tr("Aspect") : "" );
    2032     gc->setLabelAboveWidget(idx<1);
    20332180
    20342181    QString hstr = (idx<0) ? dhelp : ohelp;
    20352182    gc->setHelpText(hstr+"  "+
    static HostComboBox *TVVidModeForceAspect(int idx=-1)  
    20422189    return gc;
    20432190}
    20442191
     2192
     2193
     2194class DefaultVideoMode : public GroupSetting
     2195{
     2196  public:
     2197    DefaultVideoMode():GroupSetting()
     2198    {
     2199        setLabel(QObject::tr("Video Mode Settings"));
     2200        m_res = TVVidModeResolution();
     2201        m_rate = TVVidModeRefreshRate();
     2202        addChild(GuiVidModeResolution());
     2203        addChild(m_res);
     2204        addChild(m_rate);
     2205        addChild(TVVidModeForceAspect());
     2206        connect(m_res, SIGNAL(valueChanged(StandardSetting *)),
     2207                m_rate, SLOT(ChangeResolution(StandardSetting *)));
     2208   }
     2209  private:
     2210    HostComboBoxSetting *m_res;
     2211    HostRefreshRateComboBoxSetting *m_rate;
     2212};
     2213
     2214
     2215class OverrideVideoMode : public GroupSetting
     2216{
     2217  public:
     2218    OverrideVideoMode (int idx):GroupSetting()
     2219    {
     2220        setLabel(QObject::tr("Override video mode #%1").arg(idx));
     2221        // input side
     2222        addChild(VidModeWidth(idx));
     2223        addChild(VidModeHeight(idx));
     2224        // output side
     2225        addChild(m_res = TVVidModeResolution(idx));
     2226        addChild(m_rate = TVVidModeRefreshRate(idx));
     2227        addChild(TVVidModeForceAspect(idx));
     2228                connect(m_res, SIGNAL(valueChanged(StandardSetting *)),
     2229                        m_rate, SLOT(ChangeResolution(StandardSetting *)));
     2230    }
     2231  private:
     2232    HostComboBoxSetting *m_res;
     2233    HostRefreshRateComboBoxSetting *m_rate;
     2234};
     2235
     2236static HostCheckBoxSetting *UseVideoModes() // replace VideoModeSettings
     2237{
     2238    HostCheckBoxSetting *gc = new HostCheckBoxSetting("UseVideoModes");
     2239    gc->setLabel(QObject::tr("Separate video modes for GUI and TV playback"));
     2240    gc->setValue(false);
     2241    gc->setHelpText(QObject::tr("Switch X Window video modes for TV. "
     2242                    "Requires \"xrandr\" support."));
     2243
     2244    gc->addTargetedChild("1",new DefaultVideoMode());
     2245
     2246    for (int idx = 0; idx < 3; ++idx)
     2247    {
     2248        gc->addTargetedChild("1",new OverrideVideoMode(idx));
     2249    }
     2250    return gc;
     2251}
     2252
     2253/*
    20452254class VideoModeSettings : public TriggeredConfigurationGroup
    20462255{
    20472256  public:
    class VideoModeSettings : public TriggeredConfigurationGroup  
    20582267        ConfigurationGroup* defaultsettings =
    20592268            new HorizontalConfigurationGroup(false, false);
    20602269
    2061         HostComboBox *res = TVVidModeResolution();
     2270        HostComboBoxSetting *res = TVVidModeResolution();
    20622271        HostRefreshRateComboBox *rate = TVVidModeRefreshRate();
    20632272        defaultsettings->addChild(GuiVidModeResolution());
    20642273        defaultsettings->addChild(res);
    class VideoModeSettings : public TriggeredConfigurationGroup  
    20912300        addTarget("1", settings);
    20922301        addTarget("0", new VerticalConfigurationGroup(true));
    20932302    }
    2094 };
     2303};*/
    20952304#endif
    20962305
    2097 static HostCheckBox *HideMouseCursor()
     2306static HostCheckBoxSetting *HideMouseCursor()
    20982307{
    2099     HostCheckBox *gc = new HostCheckBox("HideMouseCursor");
     2308    HostCheckBoxSetting *gc = new HostCheckBoxSetting("HideMouseCursor");
    21002309    gc->setLabel(QObject::tr("Hide mouse cursor in MythTV"));
    21012310    gc->setValue(false);
    21022311    gc->setHelpText(QObject::tr("Toggles mouse cursor visibility for touchscreens. "
    static HostCheckBox *HideMouseCursor()  
    21062315};
    21072316
    21082317
    2109 static HostCheckBox *RunInWindow()
     2318static HostCheckBoxSetting *RunInWindow()
    21102319{
    2111     HostCheckBox *gc = new HostCheckBox("RunFrontendInWindow");
     2320    HostCheckBoxSetting *gc = new HostCheckBoxSetting("RunFrontendInWindow");
    21122321    gc->setLabel(QObject::tr("Use window border"));
    21132322    gc->setValue(false);
    21142323    gc->setHelpText(QObject::tr("Toggles between windowed and "
    static HostCheckBox *RunInWindow()  
    21162325    return gc;
    21172326}
    21182327
    2119 static HostCheckBox *UseFixedWindowSize()
     2328static HostCheckBoxSetting *UseFixedWindowSize()
    21202329{
    21212330{
    2122     HostCheckBox *gc = new HostCheckBox("UseFixedWindowSize");
     2331    HostCheckBoxSetting *gc = new HostCheckBoxSetting("UseFixedWindowSize");
    21232332    gc->setLabel(QObject::tr("Use fixed window size"));
    21242333    gc->setValue(true);
    21252334    gc->setHelpText(QObject::tr(
    static HostCheckBox *UseFixedWindowSize()  
    21292338}
    21302339}
    21312340
    2132 static HostComboBox *MythDateFormatCB()
     2341static HostComboBoxSetting *MythDateFormatCB()
    21332342{
    2134     HostComboBox *gc = new HostComboBox("DateFormat");
     2343    HostComboBoxSetting *gc = new HostComboBoxSetting("DateFormat");
    21352344    gc->setLabel(QObject::tr("Date format"));
    21362345
    21372346    QDate sampdate = QDate::currentDate();
    static HostComboBox *MythDateFormatCB()  
    21702379    return gc;
    21712380}
    21722381
    2173 static HostComboBox *MythShortDateFormat()
     2382static HostComboBoxSetting *MythShortDateFormat()
    21742383{
    2175     HostComboBox *gc = new HostComboBox("ShortDateFormat");
     2384    HostComboBoxSetting *gc = new HostComboBoxSetting("ShortDateFormat");
    21762385    gc->setLabel(QObject::tr("Short date format"));
    21772386
    21782387    QDate sampdate = QDate::currentDate();
    static HostComboBox *MythShortDateFormat()  
    22092418    return gc;
    22102419}
    22112420
    2212 static HostComboBox *MythTimeFormat()
     2421static HostComboBoxSetting *MythTimeFormat()
    22132422{
    2214     HostComboBox *gc = new HostComboBox("TimeFormat");
     2423    HostComboBoxSetting *gc = new HostComboBoxSetting("TimeFormat");
    22152424    gc->setLabel(QObject::tr("Time format"));
    22162425
    22172426    QTime samptime = QTime::currentTime();
    static HostComboBox *MythTimeFormat()  
    22292438    return gc;
    22302439}
    22312440
    2232 static HostComboBox *ChannelFormat()
     2441static HostComboBoxSetting *ChannelFormat()
    22332442{
    2234     HostComboBox *gc = new HostComboBox("ChannelFormat");
     2443    HostComboBoxSetting *gc = new HostComboBoxSetting("ChannelFormat");
    22352444    gc->setLabel(QObject::tr("Channel format"));
    22362445    gc->addSelection(QObject::tr("number"), "<num>");
    22372446    gc->addSelection(QObject::tr("number callsign"), "<num> <sign>");
    static HostComboBox *ChannelFormat()  
    22432452    return gc;
    22442453}
    22452454
    2246 static HostComboBox *LongChannelFormat()
     2455static HostComboBoxSetting *LongChannelFormat()
    22472456{
    2248     HostComboBox *gc = new HostComboBox("LongChannelFormat");
     2457    HostComboBoxSetting *gc = new HostComboBoxSetting("LongChannelFormat");
    22492458    gc->setLabel(QObject::tr("Long channel format"));
    22502459    gc->addSelection(QObject::tr("number"), "<num>");
    22512460    gc->addSelection(QObject::tr("number callsign"), "<num> <sign>");
    static HostComboBox *LongChannelFormat()  
    22572466    return gc;
    22582467}
    22592468
    2260 static GlobalCheckBox *LiveTVPriority()
     2469static GlobalCheckBoxSetting *LiveTVPriority()
    22612470{
    2262     GlobalCheckBox *bc = new GlobalCheckBox("LiveTVPriority");
     2471    GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("LiveTVPriority");
    22632472    bc->setLabel(QObject::tr("Allow Live TV to move scheduled shows"));
    22642473    bc->setValue(false);
    22652474    bc->setHelpText(QObject::tr("If enabled, scheduled recordings will "
    static GlobalCheckBox *LiveTVPriority()  
    22682477    return bc;
    22692478}
    22702479
    2271 static HostCheckBox *ChannelGroupRememberLast()
    2272 {
    2273     HostCheckBox *gc = new HostCheckBox("ChannelGroupRememberLast");
    2274     gc->setLabel(QObject::tr("Remember last channel group"));
    2275     gc->setHelpText(QObject::tr("If enabled, the EPG will initially display "
    2276                     "only the channels from the last channel group selected. Pressing "
    2277                     "\"4\" will toggle channel group."));
    2278     gc->setValue(false);
    2279     return gc;
    2280 }
    22812480
    2282 static HostComboBox *ChannelGroupDefault()
     2481
     2482static HostComboBoxSetting *ChannelGroupDefault()
    22832483{
    2284     HostComboBox *gc = new HostComboBox("ChannelGroupDefault");
     2484    HostComboBoxSetting *gc = new HostComboBoxSetting("ChannelGroupDefault");
    22852485    gc->setLabel(QObject::tr("Default channel group"));
    22862486
    22872487    ChannelGroupList changrplist;
    static HostComboBox *ChannelGroupDefault()  
    23012501    return gc;
    23022502}
    23032503
    2304 static HostCheckBox *BrowseChannelGroup()
     2504static HostCheckBoxSetting *ChannelGroupRememberLast()
     2505{
     2506    HostCheckBoxSetting *gc = new HostCheckBoxSetting("ChannelGroupRememberLast");
     2507    gc->setLabel(QObject::tr("Remember last channel group"));
     2508    gc->setHelpText(QObject::tr("If enabled, the EPG will initially display "
     2509                    "only the channels from the last channel group selected. Pressing "
     2510                    "\"4\" will toggle channel group."));
     2511    gc->setValue(false);
     2512    gc->addTargetedChild("0", ChannelGroupDefault());
     2513    return gc;
     2514}
     2515
     2516static HostCheckBoxSetting *BrowseChannelGroup()
    23052517{
    2306     HostCheckBox *gc = new HostCheckBox("BrowseChannelGroup");
     2518    HostCheckBoxSetting *gc = new HostCheckBoxSetting("BrowseChannelGroup");
    23072519    gc->setLabel(QObject::tr("Browse/change channels from Channel Group"));
    23082520    gc->setHelpText(QObject::tr("If enabled, Live TV will browse or change "
    23092521                    "channels from the selected channel group. The \"All "
    static HostCheckBox *BrowseChannelGroup()  
    23132525    return gc;
    23142526}
    23152527
    2316 // Channel Group Settings
    2317 class ChannelGroupSettings : public TriggeredConfigurationGroup
    2318 {
    2319   public:
    2320     ChannelGroupSettings() : TriggeredConfigurationGroup(false, true, false, false)
    2321     {
    2322          setLabel(QObject::tr("Remember last channel group"));
    2323          setUseLabel(false);
    2324 
    2325          Setting* RememberChanGrpEnabled = ChannelGroupRememberLast();
    2326          addChild(RememberChanGrpEnabled);
    2327          setTrigger(RememberChanGrpEnabled);
    2328 
    2329          ConfigurationGroup* settings = new VerticalConfigurationGroup(false,false);
    2330          settings->addChild(ChannelGroupDefault());
    2331          addTarget("0", settings);
    2332 
    2333          // show nothing if RememberChanGrpEnabled is on
    2334          addTarget("1", new VerticalConfigurationGroup(true,false));
    2335      };
    2336 };
    2337 
    23382528// General RecPriorities settings
    23392529
    2340 static GlobalCheckBox *GRSchedMoveHigher()
     2530static GlobalCheckBoxSetting *GRSchedMoveHigher()
    23412531{
    2342     GlobalCheckBox *bc = new GlobalCheckBox("SchedMoveHigher");
     2532    GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("SchedMoveHigher");
    23432533    bc->setLabel(QObject::tr("Reschedule higher priorities"));
    23442534    bc->setHelpText(QObject::tr("Move higher priority programs to other "
    23452535                    "cards and showings when resolving conflicts. This "
    static GlobalCheckBox *GRSchedMoveHigher()  
    23502540    return bc;
    23512541}
    23522542
    2353 static GlobalComboBox *GRSchedOpenEnd()
     2543static GlobalComboBoxSetting *GRSchedOpenEnd()
    23542544{
    2355     GlobalComboBox *bc = new GlobalComboBox("SchedOpenEnd");
     2545    GlobalComboBoxSetting *bc = new GlobalComboBoxSetting("SchedOpenEnd");
    23562546    bc->setLabel(QObject::tr("Avoid back to back recordings"));
    23572547    bc->setHelpText(QObject::tr("Selects the situations where the scheduler "
    23582548                    "will avoid assigning shows to the same card if their "
    static GlobalComboBox *GRSchedOpenEnd()  
    23652555    return bc;
    23662556}
    23672557
    2368 static GlobalSpinBox *GRDefaultStartOffset()
     2558static GlobalSpinBoxSetting *GRDefaultStartOffset()
    23692559{
    2370     GlobalSpinBox *bs = new GlobalSpinBox("DefaultStartOffset",
     2560    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("DefaultStartOffset",
    23712561                                          -10, 30, 5, true);
    23722562    bs->setLabel(QObject::tr("Default 'Start Early' minutes for new "
    23732563                             "recording rules"));
    static GlobalSpinBox *GRDefaultStartOffset()  
    23802570    return bs;
    23812571}
    23822572
    2383 static GlobalSpinBox *GRDefaultEndOffset()
     2573static GlobalSpinBoxSetting *GRDefaultEndOffset()
    23842574{
    2385     GlobalSpinBox *bs = new GlobalSpinBox("DefaultEndOffset",
     2575    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("DefaultEndOffset",
    23862576                                          -10, 30, 5, true);
    23872577    bs->setLabel(QObject::tr("Default 'End Late' minutes for new "
    23882578                             "recording rules"));
    static GlobalSpinBox *GRDefaultEndOffset()  
    23952585    return bs;
    23962586}
    23972587
    2398 static GlobalSpinBox *GRPrefInputRecPriority()
     2588static GlobalSpinBoxSetting *GRPrefInputRecPriority()
    23992589{
    2400     GlobalSpinBox *bs = new GlobalSpinBox("PrefInputPriority", 1, 99, 1);
     2590    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("PrefInputPriority", 1, 99, 1);
    24012591    bs->setLabel(QObject::tr("Preferred input priority"));
    24022592    bs->setHelpText(QObject::tr("Additional priority when a showing "
    24032593                    "matches the preferred input selected in the 'Scheduling "
    static GlobalSpinBox *GRPrefInputRecPriority()  
    24062596    return bs;
    24072597}
    24082598
    2409 static GlobalSpinBox *GRHDTVRecPriority()
     2599static GlobalSpinBoxSetting *GRHDTVRecPriority()
    24102600{
    2411     GlobalSpinBox *bs = new GlobalSpinBox("HDTVRecPriority", -99, 99, 1);
     2601    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("HDTVRecPriority", -99, 99, 1);
    24122602    bs->setLabel(QObject::tr("HDTV recording priority"));
    24132603    bs->setHelpText(QObject::tr("Additional priority when a showing "
    24142604                    "is marked as an HDTV broadcast in the TV listings."));
    static GlobalSpinBox *GRHDTVRecPriority()  
    24162606    return bs;
    24172607}
    24182608
    2419 static GlobalSpinBox *GRWSRecPriority()
     2609static GlobalSpinBoxSetting *GRWSRecPriority()
    24202610{
    2421     GlobalSpinBox *bs = new GlobalSpinBox("WSRecPriority", -99, 99, 1);
     2611    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("WSRecPriority", -99, 99, 1);
    24222612    bs->setLabel(QObject::tr("Widescreen recording priority"));
    24232613    bs->setHelpText(QObject::tr("Additional priority when a showing "
    24242614                    "is marked as widescreen in the TV listings."));
    static GlobalSpinBox *GRWSRecPriority()  
    24262616    return bs;
    24272617}
    24282618
    2429 static GlobalSpinBox *GRAutoRecPriority()
     2619static GlobalSpinBoxSetting *GRAutoRecPriority()
    24302620{
    2431     GlobalSpinBox *bs = new GlobalSpinBox("AutoRecPriority", -99, 99, 1);
     2621    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("AutoRecPriority", -99, 99, 1);
    24322622    bs->setLabel(QObject::tr("Automatic priority range (+/-)"));
    24332623    bs->setHelpText(QObject::tr("Up to this number of priority points may "
    24342624                    "be added for titles that are usually watched soon after "
    static GlobalSpinBox *GRAutoRecPriority()  
    24382628    return bs;
    24392629}
    24402630
    2441 static GlobalSpinBox *GRSignLangRecPriority()
     2631static GlobalSpinBoxSetting *GRSignLangRecPriority()
    24422632{
    2443     GlobalSpinBox *bs = new GlobalSpinBox("SignLangRecPriority",
     2633    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("SignLangRecPriority",
    24442634                                            -99, 99, 1);
    24452635    bs->setLabel(QObject::tr("Sign language recording priority"));
    24462636    bs->setHelpText(QObject::tr("Additional priority when a showing "
    static GlobalSpinBox *GRSignLangRecPriority()  
    24492639    return bs;
    24502640}
    24512641
    2452 static GlobalSpinBox *GROnScrSubRecPriority()
     2642static GlobalSpinBoxSetting *GROnScrSubRecPriority()
    24532643{
    2454     GlobalSpinBox *bs = new GlobalSpinBox("OnScrSubRecPriority",
     2644    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("OnScrSubRecPriority",
    24552645                                            -99, 99, 1);
    24562646    bs->setLabel(QObject::tr("In-vision Subtitles Recording Priority"));
    24572647    bs->setHelpText(QObject::tr("Additional priority when a showing "
    static GlobalSpinBox *GROnScrSubRecPriority()  
    24602650    return bs;
    24612651}
    24622652
    2463 static GlobalSpinBox *GRCCRecPriority()
     2653static GlobalSpinBoxSetting *GRCCRecPriority()
    24642654{
    2465     GlobalSpinBox *bs = new GlobalSpinBox("CCRecPriority",
     2655    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("CCRecPriority",
    24662656                                            -99, 99, 1);
    24672657    bs->setLabel(QObject::tr("Subtitles/CC recording priority"));
    24682658    bs->setHelpText(QObject::tr("Additional priority when a showing "
    static GlobalSpinBox *GRCCRecPriority()  
    24722662    return bs;
    24732663}
    24742664
    2475 static GlobalSpinBox *GRHardHearRecPriority()
     2665static GlobalSpinBoxSetting *GRHardHearRecPriority()
    24762666{
    2477     GlobalSpinBox *bs = new GlobalSpinBox("HardHearRecPriority",
     2667    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("HardHearRecPriority",
    24782668                                            -99, 99, 1);
    24792669    bs->setLabel(QObject::tr("Hard of hearing priority"));
    24802670    bs->setHelpText(QObject::tr("Additional priority when a showing "
    static GlobalSpinBox *GRHardHearRecPriority()  
    24842674    return bs;
    24852675}
    24862676
    2487 static GlobalSpinBox *GRAudioDescRecPriority()
     2677static GlobalSpinBoxSetting *GRAudioDescRecPriority()
    24882678{
    2489     GlobalSpinBox *bs = new GlobalSpinBox("AudioDescRecPriority",
     2679    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("AudioDescRecPriority",
    24902680                                            -99, 99, 1);
    24912681    bs->setLabel(QObject::tr("Audio described priority"));
    24922682    bs->setHelpText(QObject::tr("Additional priority when a showing "
    static GlobalSpinBox *GRAudioDescRecPriority()  
    24952685    return bs;
    24962686}
    24972687
    2498 static GlobalSpinBox *GRSingleRecordRecPriority()
     2688static GlobalSpinBoxSetting *GRSingleRecordRecPriority()
    24992689{
    2500     GlobalSpinBox *bs = new GlobalSpinBox("SingleRecordRecPriority",
     2690    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("SingleRecordRecPriority",
    25012691                                            -99, 99, 1);
    25022692    bs->setLabel(QObject::tr("Single recordings priority"));
    25032693    bs->setHelpText(QObject::tr("Single recordings will receive this "
    static GlobalSpinBox *GRSingleRecordRecPriority()  
    25062696    return bs;
    25072697}
    25082698
    2509 static GlobalSpinBox *GRWeekslotRecordRecPriority()
     2699static GlobalSpinBoxSetting *GRWeekslotRecordRecPriority()
    25102700{
    2511     GlobalSpinBox *bs = new GlobalSpinBox("WeekslotRecordRecPriority",
     2701    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("WeekslotRecordRecPriority",
    25122702                                            -99, 99, 1);
    25132703    bs->setLabel(QObject::tr("Weekslot recordings priority"));
    25142704    bs->setHelpText(QObject::tr("Weekslot recordings will receive this "
    static GlobalSpinBox *GRWeekslotRecordRecPriority()  
    25172707    return bs;
    25182708}
    25192709
    2520 static GlobalSpinBox *GRTimeslotRecordRecPriority()
     2710static GlobalSpinBoxSetting *GRTimeslotRecordRecPriority()
    25212711{
    2522     GlobalSpinBox *bs = new GlobalSpinBox("TimeslotRecordRecPriority",
     2712    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("TimeslotRecordRecPriority",
    25232713                                            -99, 99, 1);
    25242714    bs->setLabel(QObject::tr("Timeslot recordings priority"));
    25252715    bs->setHelpText(QObject::tr("Timeslot recordings will receive this "
    static GlobalSpinBox *GRTimeslotRecordRecPriority()  
    25282718    return bs;
    25292719}
    25302720
    2531 static GlobalSpinBox *GRChannelRecordRecPriority()
     2721static GlobalSpinBoxSetting *GRChannelRecordRecPriority()
    25322722{
    2533     GlobalSpinBox *bs = new GlobalSpinBox("ChannelRecordRecPriority",
     2723    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("ChannelRecordRecPriority",
    25342724                                            -99, 99, 1);
    25352725    bs->setLabel(QObject::tr("Channel recordings priority"));
    25362726    bs->setHelpText(QObject::tr("Channel recordings will receive this "
    static GlobalSpinBox *GRChannelRecordRecPriority()  
    25392729    return bs;
    25402730}
    25412731
    2542 static GlobalSpinBox *GRAllRecordRecPriority()
     2732static GlobalSpinBoxSetting *GRAllRecordRecPriority()
    25432733{
    2544     GlobalSpinBox *bs = new GlobalSpinBox("AllRecordRecPriority",
     2734    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("AllRecordRecPriority",
    25452735                                            -99, 99, 1);
    25462736    bs->setLabel(QObject::tr("All recordings priority"));
    25472737    bs->setHelpText(QObject::tr("The 'All' recording type will receive this "
    static GlobalSpinBox *GRAllRecordRecPriority()  
    25502740    return bs;
    25512741}
    25522742
    2553 static GlobalSpinBox *GRFindOneRecordRecPriority()
     2743static GlobalSpinBoxSetting *GRFindOneRecordRecPriority()
    25542744{
    2555     GlobalSpinBox *bs = new GlobalSpinBox("FindOneRecordRecPriority",
     2745    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("FindOneRecordRecPriority",
    25562746                                            -99, 99, 1);
    25572747    bs->setLabel(QObject::tr("Find one recordings priority"));
    25582748    bs->setHelpText(QObject::tr("Find One, Find Weekly and Find Daily "
    static GlobalSpinBox *GRFindOneRecordRecPriority()  
    25622752    return bs;
    25632753}
    25642754
    2565 static GlobalSpinBox *GROverrideRecordRecPriority()
     2755static GlobalSpinBoxSetting *GROverrideRecordRecPriority()
    25662756{
    2567     GlobalSpinBox *bs = new GlobalSpinBox("OverrideRecordRecPriority",
     2757    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("OverrideRecordRecPriority",
    25682758                                            -99, 99, 1);
    25692759    bs->setLabel(QObject::tr("Override recordings priority"));
    25702760    bs->setHelpText(QObject::tr("Override recordings will receive this "
    static GlobalSpinBox *GROverrideRecordRecPriority()  
    25732763    return bs;
    25742764}
    25752765
    2576 static HostLineEdit *DefaultTVChannel()
     2766static HostTextEditSetting *DefaultTVChannel()
    25772767{
    2578     HostLineEdit *ge = new HostLineEdit("DefaultTVChannel");
     2768    HostTextEditSetting *ge = new HostTextEditSetting("DefaultTVChannel");
    25792769    ge->setLabel(QObject::tr("Guide starts at channel"));
    25802770    ge->setValue("3");
    25812771    ge->setHelpText(QObject::tr("The program guide starts on this channel if "
    static HostLineEdit *DefaultTVChannel()  
    25832773    return ge;
    25842774}
    25852775
    2586 static HostSpinBox *EPGRecThreshold()
     2776static HostSpinBoxSetting *EPGRecThreshold()
    25872777{
    2588     HostSpinBox *gs = new HostSpinBox("SelChangeRecThreshold", 1, 600, 1);
     2778    HostSpinBoxSetting *gs = new HostSpinBoxSetting("SelChangeRecThreshold", 1, 600, 1);
    25892779    gs->setLabel(QObject::tr("Record threshold"));
    25902780    gs->setValue(16);
    25912781    gs->setHelpText(QObject::tr("Pressing SELECT on a show that is at least "
    static HostSpinBox *EPGRecThreshold()  
    25942784    return gs;
    25952785}
    25962786
    2597 static HostComboBox *MythLanguage()
     2787static HostComboBoxSetting *MythLanguage()
    25982788{
    2599     HostComboBox *gc = new HostComboBox("Language");
     2789    HostComboBoxSetting *gc = new HostComboBoxSetting("Language");
    26002790    gc->setLabel(QObject::tr("Language"));
    26012791
    26022792    QMap<QString, QString> langMap = MythTranslation::getLanguages();
    static HostComboBox *MythLanguage()  
    26182808    return gc;
    26192809}
    26202810
    2621 static void ISO639_fill_selections(SelectSetting *widget, uint i)
     2811static void ISO639_fill_selections(MythUIComboBoxSetting *comboBox, uint i)
    26222812{
    2623     widget->clearSelections();
     2813    comboBox->clearSelections();
    26242814    QString q = QString("ISO639Language%1").arg(i);
    26252815    QString lang = gCoreContext->GetSetting(q, "").toLower();
    26262816
    static void ISO639_fill_selections(SelectSetting *widget, uint i)  
    26412831            desc = desc.left(idx);
    26422832
    26432833        const QString il = iso639_key_to_str3(it.key());
    2644         widget->addSelection(desc, il, il == lang);
     2834        comboBox->addSelection(desc, il, il == lang);
    26452835    }
    26462836}
    26472837
    2648 static GlobalComboBox *ISO639PreferredLanguage(uint i)
     2838static GlobalComboBoxSetting *ISO639PreferredLanguage(uint i)
    26492839{
    2650     GlobalComboBox *gc = new GlobalComboBox(QString("ISO639Language%1").arg(i));
     2840    GlobalComboBoxSetting *gc = new GlobalComboBoxSetting(QString("ISO639Language%1").arg(i));
    26512841    gc->setLabel(QObject::tr("Guide language #%1").arg(i+1));
    26522842    // We should try to get language from "MythLanguage"
    26532843    // then use code 2 to code 3 map in iso639.h
    static GlobalComboBox *ISO639PreferredLanguage(uint i)  
    26582848    return gc;
    26592849}
    26602850
    2661 static HostCheckBox *NetworkControlEnabled()
    2662 {
    2663     HostCheckBox *gc = new HostCheckBox("NetworkControlEnabled");
    2664     gc->setLabel(QObject::tr("Enable Network Remote Control interface"));
    2665     gc->setHelpText(QObject::tr("This enables support for controlling "
    2666                     "mythfrontend over the network."));
    2667     gc->setValue(false);
    2668     return gc;
    2669 }
    26702851
    2671 static HostSpinBox *NetworkControlPort()
     2852static HostSpinBoxSetting *NetworkControlPort()
    26722853{
    2673     HostSpinBox *gs = new HostSpinBox("NetworkControlPort", 1025, 65535, 1);
     2854    HostSpinBoxSetting *gs = new HostSpinBoxSetting("NetworkControlPort", 1025, 65535, 1);
    26742855    gs->setLabel(QObject::tr("Network Remote Control port"));
    26752856    gs->setValue(6546);
    26762857    gs->setHelpText(QObject::tr("This specifies what port the network remote "
    static HostSpinBox *NetworkControlPort()  
    26782859    return gs;
    26792860}
    26802861
    2681 static HostLineEdit *UDPNotifyPort()
     2862static HostTextEditSetting *UDPNotifyPort()
    26822863{
    2683     HostLineEdit *ge = new HostLineEdit("UDPNotifyPort");
     2864    HostTextEditSetting *ge = new HostTextEditSetting("UDPNotifyPort");
    26842865    ge->setLabel(QObject::tr("UDP notify port"));
    26852866    ge->setValue("6948");
    26862867    ge->setHelpText(QObject::tr("MythTV will listen for connections "
    static HostLineEdit *UDPNotifyPort()  
    26882869    return ge;
    26892870}
    26902871
    2691 static HostCheckBox *RealtimePriority()
     2872static HostCheckBoxSetting *NetworkControlEnabled()
     2873{
     2874    HostCheckBoxSetting *gc = new HostCheckBoxSetting("NetworkControlEnabled");
     2875    gc->setLabel(QObject::tr("Enable Network Remote Control interface"));
     2876    gc->setHelpText(QObject::tr("This enables support for controlling "
     2877                    "mythfrontend over the network."));
     2878    gc->setValue(false);
     2879
     2880    gc->addTargetedChild("1",NetworkControlPort());
     2881    gc->addTargetedChild("1",UDPNotifyPort());
     2882    return gc;
     2883}
     2884
     2885static HostCheckBoxSetting *RealtimePriority()
    26922886{
    2693     HostCheckBox *gc = new HostCheckBox("RealtimePriority");
     2887    HostCheckBoxSetting *gc = new HostCheckBoxSetting("RealtimePriority");
    26942888    gc->setLabel(QObject::tr("Enable realtime priority threads"));
    26952889    gc->setHelpText(QObject::tr("When running mythfrontend with root "
    26962890                    "privileges, some threads can be given enhanced priority. "
    static HostCheckBox *RealtimePriority()  
    27002894    return gc;
    27012895}
    27022896
    2703 static HostCheckBox *EnableMediaMon()
    2704 {
    2705     HostCheckBox *gc = new HostCheckBox("MonitorDrives");
    2706     gc->setLabel(QObject::tr("Monitor CD/DVD") +
    2707                  QObject::tr(" (and other removable devices)"));
    2708     gc->setHelpText(QObject::tr("This enables support for monitoring your "
    2709                     "CD/DVD drives for new disks and launching the proper "
    2710                     "plugin to handle them. Requires restart."));
    2711     gc->setValue(false);
    2712     return gc;
    2713 }
    2714 
    2715 static HostLineEdit *IgnoreMedia()
     2897static HostTextEditSetting *IgnoreMedia()
    27162898{
    2717     HostLineEdit *ge = new HostLineEdit("IgnoreDevices");
     2899    HostTextEditSetting *ge = new HostTextEditSetting("IgnoreDevices");
    27182900    ge->setLabel(QObject::tr("Ignore devices"));
    27192901    ge->setValue("");
    27202902    ge->setHelpText(QObject::tr("If there are any devices that you do not want "
    static HostLineEdit *IgnoreMedia()  
    27242906    return ge;
    27252907}
    27262908
    2727 class MythMediaSettings : public TriggeredConfigurationGroup
     2909static HostCheckBoxSetting *EnableMediaMon()
    27282910{
    2729   public:
    2730      MythMediaSettings() :
    2731          TriggeredConfigurationGroup(false, false, true, true)
    2732      {
    2733          setLabel(QObject::tr("MythMediaMonitor"));
    2734          setUseLabel(false);
    2735 
    2736          Setting* enabled = EnableMediaMon();
    2737          addChild(enabled);
    2738          setTrigger(enabled);
    2739 
    2740          ConfigurationGroup* settings = new VerticalConfigurationGroup(false);
    2741          settings->addChild(IgnoreMedia());
    2742          addTarget("1", settings);
    2743 
    2744          // show nothing if fillEnabled is off
    2745          addTarget("0", new VerticalConfigurationGroup(true));
    2746      };
    2747 };
    2748 
     2911    HostCheckBoxSetting *gc = new HostCheckBoxSetting("MonitorDrives");
     2912    gc->setLabel(QObject::tr("Media Monitor"));
     2913    gc->setHelpText(QObject::tr("This enables support for monitoring "
     2914                    "your CD/DVD drives for new disks and launching "
     2915                    "the proper plugin to handle them. Requires restart."));
     2916    gc->setValue(false);
     2917    gc->addTargetedChild("1", IgnoreMedia());
     2918    return gc;
     2919}
    27492920
    2750 static HostComboBox *DisplayGroupTitleSort()
     2921static HostComboBoxSetting *DisplayGroupTitleSort()
    27512922{
    2752     HostComboBox *gc = new HostComboBox("DisplayGroupTitleSort");
     2923    HostComboBoxSetting *gc = new HostComboBoxSetting("DisplayGroupTitleSort");
    27532924    gc->setLabel(QObject::tr("Sort titles"));
    27542925    gc->addSelection(QObject::tr("Alphabetically"),
    27552926            QString::number(PlaybackBox::TitleSortAlphabetical));
    static HostComboBox *DisplayGroupTitleSort()  
    27602931    return gc;
    27612932}
    27622933
    2763 static HostCheckBox *PlaybackWatchList()
    2764 {
    2765     HostCheckBox *gc = new HostCheckBox("PlaybackWatchList");
    2766     gc->setLabel(QObject::tr("Include the 'Watch List' group"));
    2767     gc->setValue(true);
    2768     gc->setHelpText(QObject::tr("The 'Watch List' is an abbreviated list of "
    2769                                 "recordings sorted to highlight series and "
    2770                                 "shows that need attention in order to "
    2771                                 "keep up to date."));
    2772     return gc;
    2773 }
    2774 
    2775 static HostCheckBox *PlaybackWLStart()
     2934static HostCheckBoxSetting *PlaybackWLStart()
    27762935{
    2777     HostCheckBox *gc = new HostCheckBox("PlaybackWLStart");
     2936    HostCheckBoxSetting *gc = new HostCheckBoxSetting("PlaybackWLStart");
    27782937    gc->setLabel(QObject::tr("Start from the Watch List view"));
    27792938    gc->setValue(false);
    27802939    gc->setHelpText(QObject::tr("If enabled, the 'Watch List' will be the "
    static HostCheckBox *PlaybackWLStart()  
    27832942    return gc;
    27842943}
    27852944
    2786 static HostCheckBox *PlaybackWLAutoExpire()
     2945static HostCheckBoxSetting *PlaybackWLAutoExpire()
    27872946{
    2788     HostCheckBox *gc = new HostCheckBox("PlaybackWLAutoExpire");
     2947    HostCheckBoxSetting *gc = new HostCheckBoxSetting("PlaybackWLAutoExpire");
    27892948    gc->setLabel(QObject::tr("Exclude recordings not set for Auto-Expire"));
    27902949    gc->setValue(false);
    27912950    gc->setHelpText(QObject::tr("Set this if you turn off Auto-Expire only "
    static HostCheckBox *PlaybackWLAutoExpire()  
    27952954    return gc;
    27962955}
    27972956
    2798 static HostSpinBox *PlaybackWLMaxAge()
     2957static HostSpinBoxSetting *PlaybackWLMaxAge()
    27992958{
    2800     HostSpinBox *gs = new HostSpinBox("PlaybackWLMaxAge", 30, 180, 10);
     2959    HostSpinBoxSetting *gs = new HostSpinBoxSetting("PlaybackWLMaxAge", 30, 180, 10);
    28012960    gs->setLabel(QObject::tr("Maximum days counted in the score"));
    28022961    gs->setValue(60);
    28032962    gs->setHelpText(QObject::tr("The 'Watch List' scores are based on 1 point "
    static HostSpinBox *PlaybackWLMaxAge()  
    28072966    return gs;
    28082967}
    28092968
    2810 static HostSpinBox *PlaybackWLBlackOut()
     2969static HostSpinBoxSetting *PlaybackWLBlackOut()
    28112970{
    2812     HostSpinBox *gs = new HostSpinBox("PlaybackWLBlackOut", 0, 5, 1);
     2971    HostSpinBoxSetting *gs = new HostSpinBoxSetting("PlaybackWLBlackOut", 0, 5, 1);
    28132972    gs->setLabel(QObject::tr("Days to exclude weekly episodes after delete"));
    28142973    gs->setValue(2);
    28152974    gs->setHelpText(QObject::tr("When an episode is deleted or marked as "
    static HostSpinBox *PlaybackWLBlackOut()  
    28202979    return gs;
    28212980}
    28222981
    2823 class WatchListSettings : public TriggeredConfigurationGroup
     2982static HostCheckBoxSetting *PlaybackWatchList()
    28242983{
    2825   public:
    2826      WatchListSettings() :
    2827          TriggeredConfigurationGroup(false, false, true, true)
    2828      {
    2829 
    2830          Setting* watchList = PlaybackWatchList();
    2831          addChild(watchList);
    2832          setTrigger(watchList);
    2833 
    2834          ConfigurationGroup* settings = new VerticalConfigurationGroup(false);
    2835          settings->addChild(PlaybackWLStart());
    2836          settings->addChild(PlaybackWLAutoExpire());
    2837          settings->addChild(PlaybackWLMaxAge());
    2838          settings->addChild(PlaybackWLBlackOut());
    2839          addTarget("1", settings);
    2840 
    2841          addTarget("0", new VerticalConfigurationGroup(true));
    2842     };
    2843 };
     2984    HostCheckBoxSetting *gc = new HostCheckBoxSetting("PlaybackWatchList");
     2985    gc->setLabel(QObject::tr("Include the 'Watch List' group"));
     2986    gc->setValue(true);
     2987    gc->setHelpText(QObject::tr("The 'Watch List' is an abbreviated list of "
     2988                                "recordings sorted to highlight series and "
     2989                                "shows that need attention in order to "
     2990                                "keep up to date."));
     2991
     2992    gc->addTargetedChild("1", PlaybackWLStart());
     2993    gc->addTargetedChild("1", PlaybackWLAutoExpire());
     2994    gc->addTargetedChild("1", PlaybackWLMaxAge());
     2995    gc->addTargetedChild("1", PlaybackWLBlackOut());
     2996    return gc;
     2997}
    28442998
    2845 static HostCheckBox *LCDShowTime()
     2999static HostCheckBoxSetting *LCDShowTime()
    28463000{
    2847     HostCheckBox *gc = new HostCheckBox("LCDShowTime");
     3001    HostCheckBoxSetting *gc = new HostCheckBoxSetting("LCDShowTime");
    28483002    gc->setLabel(QObject::tr("Display time"));
    28493003    gc->setHelpText(QObject::tr("Display current time on idle LCD display. "));
    28503004    gc->setValue(true);
    28513005    return gc;
    28523006}
    28533007
    2854 static HostCheckBox *LCDShowRecStatus()
     3008static HostCheckBoxSetting *LCDShowRecStatus()
    28553009{
    2856     HostCheckBox *gc = new HostCheckBox("LCDShowRecStatus");
     3010    HostCheckBoxSetting *gc = new HostCheckBoxSetting("LCDShowRecStatus");
    28573011    gc->setLabel(QObject::tr("Display recording status"));
    28583012    gc->setHelpText(QObject::tr("Display current recordings information on "
    28593013                                "LCD display."));
    static HostCheckBox *LCDShowRecStatus()  
    28613015    return gc;
    28623016}
    28633017
    2864 static HostCheckBox *LCDShowMenu()
     3018static HostCheckBoxSetting *LCDShowMenu()
    28653019{
    2866     HostCheckBox *gc = new HostCheckBox("LCDShowMenu");
     3020    HostCheckBoxSetting *gc = new HostCheckBoxSetting("LCDShowMenu");
    28673021    gc->setLabel(QObject::tr("Display menus"));
    28683022    gc->setHelpText(QObject::tr("Display selected menu on LCD display. "));
    28693023    gc->setValue(true);
    28703024    return gc;
    28713025}
    28723026
    2873 static HostSpinBox *LCDPopupTime()
     3027static HostSpinBoxSetting *LCDPopupTime()
    28743028{
    2875     HostSpinBox *gs = new HostSpinBox("LCDPopupTime", 1, 300, 1, true);
     3029    HostSpinBoxSetting *gs = new HostSpinBoxSetting("LCDPopupTime", 1, 300, 1, true);
    28763030    gs->setLabel(QObject::tr("Menu pop-up time"));
    28773031    gs->setHelpText(QObject::tr("How many seconds the menu will "
    28783032                    "remain visible after navigation."));
    static HostSpinBox *LCDPopupTime()  
    28803034    return gs;
    28813035}
    28823036
    2883 static HostCheckBox *LCDShowMusic()
     3037static HostCheckBoxSetting *LCDShowMusic()
    28843038{
    2885     HostCheckBox *gc = new HostCheckBox("LCDShowMusic");
     3039    HostCheckBoxSetting *gc = new HostCheckBoxSetting("LCDShowMusic");
    28863040    gc->setLabel(QObject::tr("Display music artist and title"));
    28873041    gc->setHelpText(QObject::tr("Display playing artist and song title in "
    28883042                    "MythMusic on LCD display."));
    static HostCheckBox *LCDShowMusic()  
    28903044    return gc;
    28913045}
    28923046
    2893 static HostComboBox *LCDShowMusicItems()
     3047static HostComboBoxSetting *LCDShowMusicItems()
    28943048{
    2895     HostComboBox *gc = new HostComboBox("LCDShowMusicItems");
     3049    HostComboBoxSetting *gc = new HostComboBoxSetting("LCDShowMusicItems");
    28963050    gc->setLabel(QObject::tr("Items"));
    28973051    gc->addSelection(QObject::tr("Artist - Title"), "ArtistTitle");
    28983052    gc->addSelection(QObject::tr("Artist [Album] Title"), "ArtistAlbumTitle");
    static HostComboBox *LCDShowMusicItems()  
    29003054    return gc;
    29013055}
    29023056
    2903 static HostCheckBox *LCDShowChannel()
     3057static HostCheckBoxSetting *LCDShowChannel()
    29043058{
    2905     HostCheckBox *gc = new HostCheckBox("LCDShowChannel");
     3059    HostCheckBoxSetting *gc = new HostCheckBoxSetting("LCDShowChannel");
    29063060    gc->setLabel(QObject::tr("Display channel information"));
    29073061    gc->setHelpText(QObject::tr("Display tuned channel information on LCD display."));
    29083062    gc->setValue(true);
    29093063    return gc;
    29103064}
    29113065
    2912 static HostCheckBox *LCDShowVolume()
     3066static HostCheckBoxSetting *LCDShowVolume()
    29133067{
    2914     HostCheckBox *gc = new HostCheckBox("LCDShowVolume");
     3068    HostCheckBoxSetting *gc = new HostCheckBoxSetting("LCDShowVolume");
    29153069    gc->setLabel(QObject::tr("Display volume information"));
    29163070    gc->setHelpText(QObject::tr("Display volume level information "
    29173071                                "on LCD display."));
    static HostCheckBox *LCDShowVolume()  
    29193073    return gc;
    29203074}
    29213075
    2922 static HostCheckBox *LCDShowGeneric()
     3076static HostCheckBoxSetting *LCDShowGeneric()
    29233077{
    2924     HostCheckBox *gc = new HostCheckBox("LCDShowGeneric");
     3078    HostCheckBoxSetting *gc = new HostCheckBoxSetting("LCDShowGeneric");
    29253079    gc->setLabel(QObject::tr("Display generic information"));
    29263080    gc->setHelpText(QObject::tr("Display generic information on LCD display."));
    29273081    gc->setValue(true);
    29283082    return gc;
    29293083}
    29303084
    2931 static HostCheckBox *LCDBacklightOn()
     3085static HostCheckBoxSetting *LCDBacklightOn()
    29323086{
    2933     HostCheckBox *gc = new HostCheckBox("LCDBacklightOn");
     3087    HostCheckBoxSetting *gc = new HostCheckBoxSetting("LCDBacklightOn");
    29343088    gc->setLabel(QObject::tr("Backlight always on"));
    29353089    gc->setHelpText(QObject::tr("Turn on the backlight permanently "
    29363090                                "on the LCD display."));
    static HostCheckBox *LCDBacklightOn()  
    29383092    return gc;
    29393093}
    29403094
    2941 static HostCheckBox *LCDHeartBeatOn()
     3095static HostCheckBoxSetting *LCDHeartBeatOn()
    29423096{
    2943     HostCheckBox *gc = new HostCheckBox("LCDHeartBeatOn");
     3097    HostCheckBoxSetting *gc = new HostCheckBoxSetting("LCDHeartBeatOn");
    29443098    gc->setLabel(QObject::tr("Heartbeat always on"));
    29453099    gc->setHelpText(QObject::tr("Turn on the LCD heartbeat."));
    29463100    gc->setValue(false);
    29473101    return gc;
    29483102}
    29493103
    2950 static HostCheckBox *LCDBigClock()
     3104static HostCheckBoxSetting *LCDBigClock()
    29513105{
    2952     HostCheckBox *gc = new HostCheckBox("LCDBigClock");
     3106    HostCheckBoxSetting *gc = new HostCheckBoxSetting("LCDBigClock");
    29533107    gc->setLabel(QObject::tr("Display large clock"));
    29543108    gc->setHelpText(QObject::tr("On multiline displays try and display the time as large as possible."));
    29553109    gc->setValue(false);
    29563110    return gc;
    29573111}
    29583112
    2959 static HostLineEdit *LCDKeyString()
     3113static HostTextEditSetting *LCDKeyString()
    29603114{
    2961     HostLineEdit *ge = new HostLineEdit("LCDKeyString");
     3115    HostTextEditSetting *ge = new HostTextEditSetting("LCDKeyString");
    29623116    ge->setLabel(QObject::tr("LCD key order"));
    29633117    ge->setValue("ABCDEF");
    29643118    ge->setHelpText(QObject::tr("Enter the 6 Keypad Return Codes for your "
    static HostLineEdit *LCDKeyString()  
    29693123    return ge;
    29703124}
    29713125
    2972 static HostCheckBox *LCDEnable()
     3126static HostCheckBoxSetting *LCDEnable()
    29733127{
    2974     HostCheckBox *gc = new HostCheckBox("LCDEnable");
     3128    HostCheckBoxSetting *gc = new HostCheckBoxSetting("LCDEnable");
    29753129    gc->setLabel(QObject::tr("Enable LCD device"));
    29763130    gc->setHelpText(QObject::tr("Use an LCD display to view MythTV status "
    29773131                    "information."));
    29783132    gc->setValue(false);
     3133    gc->addTargetedChild("1",LCDShowTime());
     3134    gc->addTargetedChild("1",LCDShowMenu());
     3135    gc->addTargetedChild("1",LCDShowMusic());
     3136    gc->addTargetedChild("1",LCDShowMusicItems());
     3137    gc->addTargetedChild("1",LCDShowChannel());
     3138    gc->addTargetedChild("1",LCDShowRecStatus());
     3139    gc->addTargetedChild("1",LCDShowVolume());
     3140    gc->addTargetedChild("1",LCDShowGeneric());
     3141    gc->addTargetedChild("1",LCDBacklightOn());
     3142    gc->addTargetedChild("1",LCDHeartBeatOn());
     3143    gc->addTargetedChild("1",LCDBigClock());
     3144    gc->addTargetedChild("1",LCDKeyString());
     3145    gc->addTargetedChild("1",LCDPopupTime());
    29793146    return gc;
    29803147}
    29813148
    2982 class LcdSettings : public TriggeredConfigurationGroup
    2983 {
    2984   public:
    2985     LcdSettings() : TriggeredConfigurationGroup(false, false,  false, false,
    2986                                                 false, false, false, false)
    2987     {
    2988          setLabel(QObject::tr("LCD device display"));
    2989          setUseLabel(false);
    2990 
    2991          Setting* lcd_enable = LCDEnable();
    2992          addChild(lcd_enable);
    2993          setTrigger(lcd_enable);
    2994 
    2995          ConfigurationGroup *settings =
    2996              new VerticalConfigurationGroup(false, true, false, false);
    2997          ConfigurationGroup *setHoriz =
    2998              new HorizontalConfigurationGroup(false, false, false, false);
    2999 
    3000          ConfigurationGroup* setLeft  =
    3001              new VerticalConfigurationGroup(false, false, false, false);
    3002          ConfigurationGroup* setRight =
    3003              new VerticalConfigurationGroup(false, false, false, false);
    3004 
    3005          setLeft->addChild(LCDShowTime());
    3006          setLeft->addChild(LCDShowMenu());
    3007          setLeft->addChild(LCDShowMusic());
    3008          setLeft->addChild(LCDShowMusicItems());
    3009          setLeft->addChild(LCDShowChannel());
    3010          setLeft->addChild(LCDShowRecStatus());
    3011          setRight->addChild(LCDShowVolume());
    3012          setRight->addChild(LCDShowGeneric());
    3013          setRight->addChild(LCDBacklightOn());
    3014          setRight->addChild(LCDHeartBeatOn());
    3015          setRight->addChild(LCDBigClock());
    3016          setRight->addChild(LCDKeyString());
    3017          setHoriz->addChild(setLeft);
    3018          setHoriz->addChild(setRight);
    3019          settings->addChild(setHoriz);
    3020          settings->addChild(LCDPopupTime());
    3021 
    3022          addTarget("1", settings);
    3023 
    3024          addTarget("0", new VerticalConfigurationGroup(true));
    3025     };
    3026 };
    3027 
    30283149
    30293150#if CONFIG_DARWIN
    3030 static HostCheckBox *MacGammaCorrect()
     3151static HostCheckBoxSetting *MacGammaCorrect()
    30313152{
    3032     HostCheckBox *gc = new HostCheckBox("MacGammaCorrect");
     3153    HostCheckBoxSetting *gc = new HostCheckBoxSetting("MacGammaCorrect");
    30333154    gc->setLabel(QObject::tr("Enable gamma correction for video"));
    30343155    gc->setValue(false);
    30353156    gc->setHelpText(QObject::tr("If enabled, QuickTime will correct the gamma "
    static HostCheckBox *MacGammaCorrect()  
    30383159    return gc;
    30393160}
    30403161
    3041 static HostCheckBox *MacScaleUp()
     3162static HostCheckBoxSetting *MacScaleUp()
    30423163{
    3043     HostCheckBox *gc = new HostCheckBox("MacScaleUp");
     3164    HostCheckBoxSetting *gc = new HostCheckBoxSetting("MacScaleUp");
    30443165    gc->setLabel(QObject::tr("Scale video as necessary"));
    30453166    gc->setValue(true);
    30463167    gc->setHelpText(QObject::tr("If enabled, video will be scaled to fit your "
    static HostCheckBox *MacScaleUp()  
    30493170    return gc;
    30503171}
    30513172
    3052 static HostSpinBox *MacFullSkip()
     3173static HostSpinBoxSetting *MacFullSkip()
    30533174{
    3054     HostSpinBox *gs = new HostSpinBox("MacFullSkip", 0, 30, 1, true);
     3175    HostSpinBoxSetting *gs = new HostSpinBoxSetting("MacFullSkip", 0, 30, 1, true);
    30553176    gs->setLabel(QObject::tr("Frames to skip in fullscreen mode"));
    30563177    gs->setValue(0);
    30573178    gs->setHelpText(QObject::tr("Video displayed in fullscreen or non-windowed "
    static HostSpinBox *MacFullSkip()  
    30623183    return gs;
    30633184}
    30643185
    3065 static HostCheckBox *MacMainEnabled()
    3066 {
    3067     HostCheckBox *gc = new HostCheckBox("MacMainEnabled");
    3068     gc->setLabel(QObject::tr("Video in main window"));
    3069     gc->setValue(true);
    3070     gc->setHelpText(QObject::tr("If enabled, video will be displayed in the "
    3071                     "main GUI window. Disable this when you only want video "
    3072                     "on the desktop or in a floating window. Only valid when "
    3073                     "\"Use GUI size for TV playback\" and \"Run the "
    3074                     "frontend in a window\" are checked."));
    3075     return gc;
    3076 }
    30773186
    3078 static HostSpinBox *MacMainSkip()
     3187
     3188static HostSpinBoxSetting *MacMainSkip()
    30793189{
    3080     HostSpinBox *gs = new HostSpinBox("MacMainSkip", 0, 30, 1, true);
     3190    HostSpinBoxSetting *gs = new HostSpinBoxSetting("MacMainSkip", 0, 30, 1, true);
    30813191    gs->setLabel(QObject::tr("Frames to skip"));
    30823192    gs->setValue(0);
    30833193    gs->setHelpText(QObject::tr("Video in the main window will skip this many "
    static HostSpinBox *MacMainSkip()  
    30863196    return gs;
    30873197}
    30883198
    3089 static HostSpinBox *MacMainOpacity()
     3199static HostSpinBoxSetting *MacMainOpacity()
    30903200{
    3091     HostSpinBox *gs = new HostSpinBox("MacMainOpacity", 0, 100, 5, false);
     3201    HostSpinBoxSetting *gs = new HostSpinBoxSetting("MacMainOpacity", 0, 100, 5, false);
    30923202    gs->setLabel(QObject::tr("Opacity"));
    30933203    gs->setValue(100);
    30943204    gs->setHelpText(QObject::tr("The opacity of the main window. Set to "
    static HostSpinBox *MacMainOpacity()  
    30973207    return gs;
    30983208}
    30993209
    3100 class MacMainSettings : public TriggeredConfigurationGroup
     3210static HostCheckBoxSetting *MacMainEnabled()
    31013211{
    3102   public:
    3103     MacMainSettings() : TriggeredConfigurationGroup(false)
    3104     {
    3105         setLabel(QObject::tr("Video in main window"));
    3106         setUseLabel(false);
    3107         Setting *gc = MacMainEnabled();
    3108         addChild(gc);
    3109         setTrigger(gc);
    3110 
    3111         VerticalConfigurationGroup *opts =
    3112             new VerticalConfigurationGroup(false, false);
    3113         opts->addChild(MacMainSkip());
    3114         opts->addChild(MacMainOpacity());
    3115 
    3116         addTarget("1", opts);
    3117         addTarget("0", new VerticalConfigurationGroup(false, false));
    3118     }
    3119 };
     3212    HostCheckBoxSetting *gc = new HostCheckBoxSetting("MacMainEnabled");
     3213    gc->setLabel(QObject::tr("Video in main window"));
     3214    gc->setValue(true);
     3215    gc->setHelpText(QObject::tr("If enabled, video will be displayed in the "
     3216                    "main GUI window. Disable this when you only want video "
     3217                    "on the desktop or in a floating window. Only valid when "
     3218                    "\"Use GUI size for TV playback\" and \"Run the "
     3219                    "frontend in a window\" are checked."));
    31203220
    3121 static HostCheckBox *MacFloatEnabled()
    3122 {
    3123     HostCheckBox *gc = new HostCheckBox("MacFloatEnabled");
    3124     gc->setLabel(QObject::tr("Video in floating window"));
    3125     gc->setValue(false);
    3126     gc->setHelpText(QObject::tr("If enabled, video will be displayed in a "
    3127                     "floating window. Only valid when \"Use GUI size for TV "
    3128                     "playback\" and \"Run the frontend in a window\" are "
    3129                     "checked."));
     3221    gc->addTargetedChild("1", MacMainSkip());
     3222    gc->addTargetedChild("1", MacMainOpacity());
    31303223    return gc;
    31313224}
    31323225
    3133 static HostSpinBox *MacFloatSkip()
     3226static HostSpinBoxSetting *MacFloatSkip()
    31343227{
    3135     HostSpinBox *gs = new HostSpinBox("MacFloatSkip", 0, 30, 1, true);
     3228    HostSpinBoxSetting *gs = new HostSpinBoxSetting("MacFloatSkip", 0, 30, 1, true);
    31363229    gs->setLabel(QObject::tr("Frames to skip"));
    31373230    gs->setValue(0);
    31383231    gs->setHelpText(QObject::tr("Video in the floating window will skip "
    static HostSpinBox *MacFloatSkip()  
    31413234    return gs;
    31423235}
    31433236
    3144 static HostSpinBox *MacFloatOpacity()
     3237static HostSpinBoxSetting *MacFloatOpacity()
    31453238{
    3146     HostSpinBox *gs = new HostSpinBox("MacFloatOpacity", 0, 100, 5, false);
     3239    HostSpinBoxSetting *gs = new HostSpinBoxSetting("MacFloatOpacity", 0, 100, 5, false);
    31473240    gs->setLabel(QObject::tr("Opacity"));
    31483241    gs->setValue(100);
    31493242    gs->setHelpText(QObject::tr("The opacity of the floating window. Set to "
    static HostSpinBox *MacFloatOpacity()  
    31523245    return gs;
    31533246}
    31543247
    3155 class MacFloatSettings : public TriggeredConfigurationGroup
     3248static HostCheckBoxSetting *MacFloatEnabled()
    31563249{
    3157   public:
    3158     MacFloatSettings() : TriggeredConfigurationGroup(false)
    3159     {
    3160         setLabel(QObject::tr("Video in floating window"));
    3161         setUseLabel(false);
    3162         Setting *gc = MacFloatEnabled();
    3163         addChild(gc);
    3164         setTrigger(gc);
     3250    HostCheckBoxSetting *gc = new HostCheckBoxSetting("MacFloatEnabled");
     3251    gc->setLabel(QObject::tr("Video in floating window"));
     3252    gc->setValue(false);
     3253    gc->setHelpText(QObject::tr("If enabled, video will be displayed in a "
     3254                    "floating window. Only valid when \"Use GUI size for TV "
     3255                    "playback\" and \"Run the frontend in a window\" are "
     3256                    "checked."));
    31653257
    3166         VerticalConfigurationGroup *opts =
    3167             new VerticalConfigurationGroup(false, false);
    3168         opts->addChild(MacFloatSkip());
    3169         opts->addChild(MacFloatOpacity());
     3258    gc->addTargetedChild("1", MacFloatSkip());
     3259    gc->addTargetedChild("1", MacFloatOpacity());
     3260    return gc;
     3261}
    31703262
    3171         addTarget("1", opts);
    3172         addTarget("0", new VerticalConfigurationGroup(false, false));
    3173     }
    3174 };
     3263static HostSpinBoxSetting *MacDockSkip()
     3264{
     3265    HostSpinBoxSetting *gs = new HostSpinBoxSetting("MacDockSkip", 0, 30, 1, true);
     3266    gs->setLabel(QObject::tr("Frames to skip"));
     3267    gs->setValue(3);
     3268    gs->setHelpText(QObject::tr("Video in the dock icon will skip this many "
     3269                    "frames for each frame drawn. Set to 0 to show "
     3270                    "every frame."));
     3271    return gs;
     3272}
    31753273
    3176 static HostCheckBox *MacDockEnabled()
     3274static HostCheckBoxSetting *MacDockEnabled()
    31773275{
    3178     HostCheckBox *gc = new HostCheckBox("MacDockEnabled");
     3276    HostCheckBoxSetting *gc = new HostCheckBoxSetting("MacDockEnabled");
    31793277    gc->setLabel(QObject::tr("Video in the dock"));
    31803278    gc->setValue(true);
    31813279    gc->setHelpText(QObject::tr("If enabled, video will be displayed in the "
    31823280                    "application's dock icon. Only valid when \"Use GUI size "
    31833281                    "for TV playback\" and \"Run the frontend in a window\" "
    31843282                    "are checked."));
     3283    gc->addTargetedChild("1", MacDockSkip());
     3284   
    31853285    return gc;
    31863286}
    31873287
    3188 static HostSpinBox *MacDockSkip()
     3288static HostSpinBoxSetting *MacDesktopSkip()
    31893289{
    3190     HostSpinBox *gs = new HostSpinBox("MacDockSkip", 0, 30, 1, true);
     3290    HostSpinBoxSetting *gs = new HostSpinBoxSetting("MacDesktopSkip", 0, 30, 1, true);
    31913291    gs->setLabel(QObject::tr("Frames to skip"));
    3192     gs->setValue(3);
    3193     gs->setHelpText(QObject::tr("Video in the dock icon will skip this many "
     3292    gs->setValue(0);
     3293    gs->setHelpText(QObject::tr("Video on the desktop will skip this many "
    31943294                    "frames for each frame drawn. Set to 0 to show "
    31953295                    "every frame."));
    31963296    return gs;
    31973297}
    31983298
    3199 class MacDockSettings : public TriggeredConfigurationGroup
    3200 {
    3201   public:
    3202     MacDockSettings() : TriggeredConfigurationGroup(false)
    3203     {
    3204         setLabel(QObject::tr("Video in the dock"));
    3205         setUseLabel(false);
    3206         Setting *gc = MacDockEnabled();
    3207         addChild(gc);
    3208         setTrigger(gc);
    3209 
    3210         Setting *skip = MacDockSkip();
    3211         addTarget("1", skip);
    3212         addTarget("0", new HorizontalConfigurationGroup(false, false));
    3213     }
    3214 };
    3215 
    3216 static HostCheckBox *MacDesktopEnabled()
     3299static HostCheckBoxSetting *MacDesktopEnabled()
    32173300{
    3218     HostCheckBox *gc = new HostCheckBox("MacDesktopEnabled");
     3301    HostCheckBoxSetting *gc = new HostCheckBoxSetting("MacDesktopEnabled");
    32193302    gc->setLabel(QObject::tr("Video on the desktop"));
    32203303    gc->setValue(false);
    32213304    gc->setHelpText(QObject::tr("If enabled, video will be displayed on the "
    32223305                    "desktop, behind the Finder icons. Only valid when \"Use "
    32233306                    "GUI size for TV playback\" and \"Run the frontend in a "
    32243307                    "window\" are checked."));
     3308
     3309    gc->addTarget("1", MacDesktopSkip());
     3310
    32253311    return gc;
    32263312}
    32273313
    3228 static HostSpinBox *MacDesktopSkip()
     3314#endif
     3315
     3316static HostCheckBoxSetting *WatchTVGuide()
    32293317{
    3230     HostSpinBox *gs = new HostSpinBox("MacDesktopSkip", 0, 30, 1, true);
    3231     gs->setLabel(QObject::tr("Frames to skip"));
    3232     gs->setValue(0);
    3233     gs->setHelpText(QObject::tr("Video on the desktop will skip this many "
    3234                     "frames for each frame drawn. Set to 0 to show "
    3235                     "every frame."));
    3236     return gs;
     3318    HostCheckBoxSetting *gc = new HostCheckBoxSetting("WatchTVGuide");
     3319    gc->setLabel(QObject::tr("Show the program guide when starting Live TV"));
     3320    gc->setHelpText(QObject::tr("This starts the program guide immediately "
     3321             "upon starting to watch Live TV."));
     3322    gc->setValue(false);
     3323    return gc;
    32373324}
    32383325
    3239 class MacDesktopSettings : public TriggeredConfigurationGroup
     3326
     3327/* This code is a duplication the class DatabaseSettings. As it it also use bymythbackend I rewrote here for the time being */
     3328
     3329class DatabaseGroupSetting : public GroupSetting
    32403330{
    32413331  public:
    3242     MacDesktopSettings() : TriggeredConfigurationGroup(false)
     3332    DatabaseGroupSetting(const QString &DBhostOverride = QString::null):GroupSetting()
    32433333    {
    3244         setLabel(QObject::tr("Video on the desktop"));
    3245         setUseLabel(false);
    3246         Setting *gc = MacDesktopEnabled();
    3247         addChild(gc);
    3248         setTrigger(gc);
    3249 
    3250         Setting *skip = MacDesktopSkip();
    3251         addTarget("1", skip);
    3252         addTarget("0", new HorizontalConfigurationGroup(false, false));
     3334        m_DBhostOverride = DBhostOverride;
     3335
     3336        setLabel(QObject::tr("Database Configuration"));
     3337
     3338        MSqlQuery query(MSqlQuery::InitCon());
     3339        if (query.isConnected())
     3340            setHelpText(QObject::tr("All database settings take effect when "
     3341                                       "you restart this program."));
     3342        else
     3343            setHelpText(QObject::tr("MythTV could not connect to the database. "
     3344                                       "Please verify your database settings "
     3345                                       "below."));
     3346
     3347        dbHostName = new TransTextEditSetting();
     3348        dbHostName->setLabel(QObject::tr("Hostname"));
     3349        dbHostName->setHelpText(QObject::tr("The host name or IP address of "
     3350                                        "the machine hosting the database. "
     3351                                        "This information is required."));
     3352        addChild(dbHostName);
     3353
     3354        dbHostPing = new TransMythUICheckBoxSetting();
     3355        dbHostPing->setLabel(QObject::tr("Ping test server?"));
     3356        dbHostPing->setHelpText(QObject::tr("Test basic host connectivity using "
     3357                                            "the ping command. Turn off if your "
     3358                                            "host or network don't support ping "
     3359                                            "(ICMP ECHO) packets"));
     3360        addChild(dbHostPing);
     3361
     3362        dbPort = new TransTextEditSetting();
     3363        dbPort->setLabel(QObject::tr("Port"));
     3364        dbPort->setHelpText(QObject::tr("The port number the database is running "
     3365                                        "on.  Leave blank if using the default "
     3366                                        "port (3306)."));
     3367        addChild(dbPort);
     3368
     3369        dbName = new TransTextEditSetting();
     3370        dbName->setLabel(QObject::tr("Database name"));
     3371        dbName->setHelpText(QObject::tr("The name of the database. "
     3372                                        "This information is required."));
     3373        addChild(dbName);
     3374
     3375        dbUserName = new TransTextEditSetting();
     3376        dbUserName->setLabel(QObject::tr("User"));
     3377        dbUserName->setHelpText(QObject::tr("The user name to use while "
     3378                                            "connecting to the database. "
     3379                                            "This information is required."));
     3380        addChild(dbUserName);
     3381
     3382        dbPassword = new TransTextEditSetting();
     3383        dbPassword->setLabel(QObject::tr("Password"));
     3384        dbPassword->setHelpText(QObject::tr("The password to use while "
     3385                                            "connecting to the database. "
     3386                                            "This information is required."));
     3387        addChild(dbPassword);
     3388
     3389        localEnabled = new TransMythUICheckBoxSetting();
     3390        localEnabled->setLabel(QObject::tr("Use custom identifier for frontend "
     3391                                           "preferences"));
     3392        localEnabled->setHelpText(QObject::tr("If this frontend's host name "
     3393                                              "changes often, check this box "
     3394                                              "and provide a network-unique "
     3395                                              "name to identify it. "
     3396                                              "If unchecked, the frontend "
     3397                                              "machine's local host name will "
     3398                                              "be used to save preferences in "
     3399                                              "the database."));
     3400        addChild(localEnabled);
     3401
     3402
     3403        localHostName = new TransTextEditSetting();
     3404        localHostName->setLabel(QObject::tr("Custom identifier"));
     3405        localHostName->setHelpText(QObject::tr("An identifier to use while "
     3406                                               "saving the settings for this "
     3407                                               "frontend."));
     3408        localEnabled->addTargetedChild("1", localHostName);
     3409
     3410
     3411        wolEnabled = new TransMythUICheckBoxSetting();
     3412        wolEnabled->setLabel(QObject::tr("Enable database server wakeup"));
     3413        wolEnabled->setHelpText(QObject::tr("If enabled, the frontend will use "
     3414                                            "database wakeup parameters to "
     3415                                            "reconnect to the database server."));
     3416        addChild(wolEnabled);
     3417
     3418        wolReconnect = new TransMythUISpinBoxSetting(0, 60, 1, true);
     3419        wolReconnect->setLabel(QObject::tr("Reconnect time"));
     3420        wolReconnect->setHelpText(QObject::tr("The time in seconds to wait for "
     3421                                          "the server to wake up."));
     3422        wolEnabled->addTargetedChild("1",wolReconnect);
     3423
     3424
     3425        wolRetry = new TransMythUISpinBoxSetting(1, 10, 1, true);
     3426        wolRetry->setLabel(QObject::tr("Retry attempts"));
     3427        wolRetry->setHelpText(QObject::tr("The number of retries to wake the "
     3428                                      "server before the frontend gives "
     3429                                      "up."));
     3430        wolEnabled->addTargetedChild("1",wolRetry);
     3431
     3432        wolCommand = new TransTextEditSetting();
     3433        wolCommand->setLabel(QObject::tr("Wake command"));
     3434        wolCommand->setHelpText(QObject::tr("The command executed on this "
     3435                                        "frontend to wake up the database "
     3436                                        "server (eg. sudo /etc/init.d/mysql "
     3437                                        "restart)."));
     3438        wolEnabled->addTargetedChild("1",wolCommand);
    32533439    }
     3440
     3441    void Load(void)
     3442    {
     3443            LOG(VB_GENERAL, LOG_ERR, QString("DatabaseGroupSetting::Load()"));
     3444
     3445        DatabaseParams params = gContext->GetDatabaseParams();
     3446
     3447        if (params.dbHostName.isEmpty() ||
     3448            params.dbUserName.isEmpty() ||
     3449            params.dbPassword.isEmpty() ||
     3450            params.dbName.isEmpty())
     3451            setHelpText(getHelpText() + "\n" +
     3452                           QObject::tr("Required fields are"
     3453                                       " marked with an asterisk (*)."));
     3454
     3455        if (params.dbHostName.isEmpty())
     3456        {
     3457            dbHostName->setLabel("* " + dbHostName->getLabel());
     3458            dbHostName->setValue(m_DBhostOverride);
     3459        }
     3460        else
     3461            dbHostName->setValue(params.dbHostName);
     3462
     3463        dbHostPing->setValue(params.dbHostPing);
     3464
     3465        if (params.dbPort)
     3466            dbPort->setValue(QString::number(params.dbPort));
     3467
     3468        dbUserName->setValue(params.dbUserName);
     3469        if (params.dbUserName.isEmpty())
     3470            dbUserName->setLabel("* " + dbUserName->getLabel());
     3471        dbPassword->setValue(params.dbPassword);
     3472        if (params.dbPassword.isEmpty())
     3473            dbPassword->setLabel("* " + dbPassword->getLabel());
     3474        dbName->setValue(params.dbName);
     3475        if (params.dbName.isEmpty())
     3476            dbName->setLabel("* " + dbName->getLabel());
     3477
     3478        localEnabled->setValue(params.localEnabled);
     3479        localHostName->setValue(params.localHostName);
     3480
     3481        wolEnabled->setValue(params.wolEnabled);
     3482        wolReconnect->setValue(params.wolReconnect);
     3483        wolRetry->setValue(params.wolRetry);
     3484        wolCommand->setValue(params.wolCommand);
     3485        //set all the children's m_haveChanged to false
     3486        GroupSetting::Load();
     3487    };
     3488    void Save(void)
     3489    {
     3490        DatabaseParams params = gContext->GetDatabaseParams();
     3491
     3492        params.dbHostName    = dbHostName->getValue();
     3493        params.dbHostPing    = dbHostPing->boolValue();
     3494        params.dbPort        = dbPort->getValue().toInt();
     3495        params.dbUserName    = dbUserName->getValue();
     3496        params.dbPassword    = dbPassword->getValue();
     3497        params.dbName        = dbName->getValue();
     3498        params.dbType        = "QMYSQL";
     3499
     3500        params.localEnabled  = localEnabled->boolValue();
     3501        params.localHostName = localHostName->getValue();
     3502
     3503        params.wolEnabled    = wolEnabled->boolValue();
     3504        params.wolReconnect  = wolReconnect->intValue();
     3505        params.wolRetry      = wolRetry->intValue();
     3506        params.wolCommand    = wolCommand->getValue();
     3507
     3508        gContext->SaveDatabaseParams(params);
     3509        //set all the children's m_haveChanged to false
     3510        GroupSetting::Save();
     3511    };
     3512
     3513  protected:
     3514    TransTextEditSetting       *dbHostName;
     3515    TransMythUICheckBoxSetting *dbHostPing;
     3516    TransTextEditSetting       *dbPort;
     3517    TransTextEditSetting       *dbName;
     3518    TransTextEditSetting       *dbUserName;
     3519    TransTextEditSetting       *dbPassword;
     3520    TransMythUICheckBoxSetting *localEnabled;
     3521    TransTextEditSetting       *localHostName;
     3522    TransMythUICheckBoxSetting *wolEnabled;
     3523    TransMythUISpinBoxSetting  *wolReconnect;
     3524    TransMythUISpinBoxSetting  *wolRetry;
     3525    TransTextEditSetting       *wolCommand;
     3526
     3527    QString              m_DBhostOverride;
    32543528};
    3255 #endif
    32563529
    3257 static HostCheckBox *WatchTVGuide()
     3530/* end of duplicated code form DatabaseSettings */
     3531
     3532
     3533class ShutDownRebootSetting : public GroupSetting
    32583534{
    3259     HostCheckBox *gc = new HostCheckBox("WatchTVGuide");
    3260     gc->setLabel(QObject::tr("Show the program guide when starting Live TV"));
    3261     gc->setHelpText(QObject::tr("This starts the program guide immediately "
    3262              "upon starting to watch Live TV."));
    3263     gc->setValue(false);
    3264     return gc;
     3535  public:
     3536    ShutDownRebootSetting();
     3537  private slots:
     3538    void childChanged(StandardSetting *);
     3539  private:
     3540    StandardSetting * m_overrideExitMenu;
     3541    StandardSetting * m_haltCommand;
     3542    StandardSetting * m_rebootCommand;
     3543   
     3544};
     3545
     3546ShutDownRebootSetting::ShutDownRebootSetting()
     3547    :GroupSetting()
     3548{
     3549    setLabel(QObject::tr("Shutdown/Reboot Settings"));
     3550    addChild(m_overrideExitMenu = OverrideExitMenu());
     3551    addChild(m_haltCommand      = HaltCommand());
     3552    addChild(m_rebootCommand    = RebootCommand());
     3553    connect(m_overrideExitMenu,SIGNAL(valueChanged(StandardSetting *)),
     3554            this,SLOT(childChanged(StandardSetting *)));
     3555}
     3556
     3557void ShutDownRebootSetting::childChanged(StandardSetting *)
     3558{
     3559    switch (m_overrideExitMenu->getValue().toInt())
     3560    {
     3561        case 2:
     3562        case 4:
     3563            m_haltCommand->setEnabled(true);
     3564            m_rebootCommand->setEnabled(false);
     3565            break;
     3566        case 3:
     3567        case 6:
     3568            m_haltCommand->setEnabled(true);
     3569            m_rebootCommand->setEnabled(true);
     3570            break;
     3571        case 5:
     3572            m_haltCommand->setEnabled(false);
     3573            m_rebootCommand->setEnabled(true);
     3574            break;
     3575        case 0:
     3576        case 1:
     3577        default:
     3578            m_haltCommand->setEnabled(false);
     3579            m_rebootCommand->setEnabled(false);
     3580            break;
     3581    }
    32653582}
    32663583
     3584
    32673585MainGeneralSettings::MainGeneralSettings()
    32683586{
    3269     DatabaseSettings::addDatabaseSettings(this);
     3587    //DatabaseSettings::addDatabaseSettings(this);
     3588    setLabel(QObject::tr("Main Settings"));
     3589
     3590    addChild(new DatabaseGroupSetting());
    32703591
    3271     VerticalConfigurationGroup *pin =
    3272         new VerticalConfigurationGroup(false, true, false, false);
     3592    GroupSetting *pin = new GroupSetting();
    32733593    pin->setLabel(QObject::tr("Settings Access"));
    32743594    pin->addChild(SetupPinCodeRequired());
    32753595    pin->addChild(SetupPinCode());
    32763596    addChild(pin);
    32773597
    3278     VerticalConfigurationGroup *general =
    3279         new VerticalConfigurationGroup(false, true, false, false);
     3598    GroupSetting *general = new GroupSetting();
    32803599    general->setLabel(QObject::tr("General"));
    32813600    general->addChild(UseVirtualKeyboard());
    32823601    general->addChild(ScreenShotPath());
    32833602    addChild(general);
    32843603
    3285     VerticalConfigurationGroup *media =
    3286         new VerticalConfigurationGroup(false, true, false, false);
    3287     media->setLabel(QObject::tr("Media Monitor"));
    3288     MythMediaSettings *mediaMon = new MythMediaSettings();
    3289     media->addChild(mediaMon);
    3290     addChild(media);
    3291 
    3292     VerticalConfigurationGroup *shutdownSettings =
    3293         new VerticalConfigurationGroup(true, true, false, false);
    3294     shutdownSettings->setLabel(QObject::tr("Shutdown/Reboot Settings"));
    3295     shutdownSettings->addChild(OverrideExitMenu());
    3296     shutdownSettings->addChild(HaltCommand());
    3297     shutdownSettings->addChild(RebootCommand());
    3298     addChild(shutdownSettings);
    3299 
    3300     VerticalConfigurationGroup *remotecontrol =
    3301         new VerticalConfigurationGroup(false, true, false, false);
     3604    addChild(EnableMediaMon());
     3605
     3606    addChild(new ShutDownRebootSetting());
     3607
     3608    GroupSetting *remotecontrol = new GroupSetting();
    33023609    remotecontrol->setLabel(QObject::tr("Remote Control"));
    33033610    remotecontrol->addChild(LircDaemonDevice());
    33043611    remotecontrol->addChild(NetworkControlEnabled());
    3305     remotecontrol->addChild(NetworkControlPort());
    3306     remotecontrol->addChild(UDPNotifyPort());
    33073612    addChild(remotecontrol);
    33083613}
    33093614
     3615void MainGeneralSettings::applyChange()
     3616{
     3617    QStringList strlist( QString("REFRESH_BACKEND") );
     3618    gCoreContext->SendReceiveStringList(strlist);
     3619}
     3620
     3621
     3622class PlayBackScaling : public GroupSetting
     3623{
     3624    public:
     3625        PlayBackScaling();
     3626        virtual void updateButton(MythUIButtonListItem *item);
     3627   
     3628    private slots:
     3629        virtual void childChanged(StandardSetting *);
     3630    private:
     3631        StandardSetting * m_VertScan;
     3632        StandardSetting * m_HorizScan;
     3633        StandardSetting * m_XScan;
     3634        StandardSetting * m_YScan;
     3635};
     3636
     3637PlayBackScaling::PlayBackScaling()
     3638    :GroupSetting()
     3639{
     3640    setLabel(QObject::tr("Scaling"));
     3641    addChild(m_VertScan = VertScanPercentage());
     3642    addChild(m_YScan = YScanDisplacement());
     3643    addChild(m_HorizScan = HorizScanPercentage());
     3644    addChild(m_XScan = XScanDisplacement());
     3645    connect(m_VertScan,SIGNAL(valueChanged(StandardSetting *)),
     3646                    this,SLOT(childChanged(StandardSetting *)));
     3647    connect(m_YScan,SIGNAL(valueChanged(StandardSetting *)),
     3648                    this,SLOT(childChanged(StandardSetting *)));
     3649    connect(m_HorizScan,SIGNAL(valueChanged(StandardSetting *)),
     3650                    this,SLOT(childChanged(StandardSetting *)));
     3651    connect(m_XScan,SIGNAL(valueChanged(StandardSetting *)),
     3652                    this,SLOT(childChanged(StandardSetting *)));
     3653}
     3654
     3655
     3656void PlayBackScaling::updateButton(MythUIButtonListItem *item)
     3657{
     3658    GroupSetting::updateButton(item);
     3659    if (   m_VertScan->getValue()=="0"
     3660        && m_HorizScan->getValue()=="0"
     3661        && m_YScan->getValue()=="0"
     3662        && m_XScan->getValue()=="0")
     3663        item->SetText(QObject::tr("No scaling"),"value");
     3664    else
     3665        item->SetText(QString("%1%x%2%+%3%+%4%")
     3666                .arg(m_HorizScan->getValue())
     3667                .arg(m_VertScan->getValue())
     3668                .arg(m_XScan->getValue())
     3669                .arg(m_YScan->getValue()),"value");
     3670}
     3671
     3672void PlayBackScaling::childChanged(StandardSetting *)
     3673{
     3674    emit ShouldRedraw(this);
     3675}
     3676
    33103677PlaybackSettings::PlaybackSettings()
    33113678{
    3312     uint i = 0, total = 8;
    3313 #if CONFIG_DARWIN
    3314     total += 2;
    3315 #endif // USING_DARWIN
     3679    setLabel(QObject::tr("Playback settings"));
    33163680
     3681    GroupSetting* general = new GroupSetting();
     3682    general->setLabel(QObject::tr("General Playback"));
     3683    general->addChild(RealtimePriority());
     3684    general->addChild(DecodeExtraAudio());
     3685    general->addChild(JumpToProgramOSD());
     3686    general->addChild(ClearSavedPosition());
     3687    general->addChild(AltClearSavedPosition());
     3688    general->addChild(AutomaticSetWatched());
     3689    general->addChild(ContinueEmbeddedTVPlay());
     3690    general->addChild(LiveTVIdleTimeout());
    33173691
    3318     VerticalConfigurationGroup* general1 =
    3319         new VerticalConfigurationGroup(false);
    3320     general1->setLabel(QObject::tr("General Playback") +
    3321                       QString(" (%1/%2)").arg(++i).arg(total));
     3692    general->addChild(new PlayBackScaling());
    33223693
    3323     HorizontalConfigurationGroup *columns =
    3324         new HorizontalConfigurationGroup(false, false, true, true);
     3694    general->addChild(AspectOverride());
     3695    general->addChild(AdjustFill());
    33253696
    3326     VerticalConfigurationGroup *column1 =
    3327         new VerticalConfigurationGroup(false, false, true, true);
    3328     column1->addChild(RealtimePriority());
    3329     column1->addChild(DecodeExtraAudio());
    3330     column1->addChild(JumpToProgramOSD());
    3331     columns->addChild(column1);
     3697    general->addChild(LetterboxingColour());
     3698    general->addChild(PIPLocationComboBox());
     3699    general->addChild(PlaybackExitPrompt());
     3700    general->addChild(EndOfRecordingExitPrompt());
     3701    addChild(general);
    33323702
    3333     VerticalConfigurationGroup *column2 =
    3334         new VerticalConfigurationGroup(false, false, true, true);
    3335     column2->addChild(ClearSavedPosition());
    3336     column2->addChild(AltClearSavedPosition());
    3337     column2->addChild(AutomaticSetWatched());
    3338     column2->addChild(ContinueEmbeddedTVPlay());
    3339     columns->addChild(column2);
    3340 
    3341     general1->addChild(columns);
    3342     general1->addChild(LiveTVIdleTimeout());
    3343     addChild(general1);
    3344 
    3345     VerticalConfigurationGroup* general2 =
    3346         new VerticalConfigurationGroup(false);
    3347     general2->setLabel(QObject::tr("General Playback") +
    3348                       QString(" (%1/%2)").arg(++i).arg(total));
    3349 
    3350     HorizontalConfigurationGroup* oscan =
    3351         new HorizontalConfigurationGroup(false, false, true, true);
    3352     VerticalConfigurationGroup *ocol1 =
    3353         new VerticalConfigurationGroup(false, false, true, true);
    3354     VerticalConfigurationGroup *ocol2 =
    3355         new VerticalConfigurationGroup(false, false, true, true);
    3356     ocol1->addChild(VertScanPercentage());
    3357     ocol1->addChild(YScanDisplacement());
    3358     ocol2->addChild(HorizScanPercentage());
    3359     ocol2->addChild(XScanDisplacement());
    3360     oscan->addChild(ocol1);
    3361     oscan->addChild(ocol2);
    3362 
    3363     HorizontalConfigurationGroup* aspect_fill =
    3364         new HorizontalConfigurationGroup(false, false, true, true);
    3365     aspect_fill->addChild(AspectOverride());
    3366     aspect_fill->addChild(AdjustFill());
    3367 
    3368     general2->addChild(oscan);
    3369     general2->addChild(aspect_fill);
    3370     general2->addChild(LetterboxingColour());
    3371     general2->addChild(PIPLocationComboBox());
    3372     general2->addChild(PlaybackExitPrompt());
    3373     general2->addChild(EndOfRecordingExitPrompt());
    3374     addChild(general2);
     3703    addChild(CurrentPlaybackProfile());
    33753704
    3376     QString tmp = QString(" (%1/%2)").arg(++i).arg(total);
    3377     addChild(new PlaybackProfileConfigs(tmp));
    33783705
    3379     VerticalConfigurationGroup* pbox = new VerticalConfigurationGroup(false);
    3380     pbox->setLabel(QObject::tr("View Recordings") +
    3381                    QString(" (%1/%2)").arg(++i).arg(total));
     3706    GroupSetting* pbox = new GroupSetting();
     3707    pbox->setLabel(QObject::tr("View Recordings"));
    33823708    pbox->addChild(PlayBoxOrdering());
    33833709    pbox->addChild(PlayBoxEpisodeSort());
    33843710    // Disabled until we re-enable live previews
    33853711    // pbox->addChild(PlaybackPreview());
    33863712    // pbox->addChild(HWAccelPlaybackPreview());
    33873713    pbox->addChild(PBBStartInTitle());
    3388     addChild(pbox);
    33893714
    3390     VerticalConfigurationGroup* pbox2 = new VerticalConfigurationGroup(false);
    3391     pbox2->setLabel(QObject::tr("Recording Groups") +
    3392                     QString(" (%1/%2)").arg(++i).arg(total));
     3715
     3716    GroupSetting* pbox2 = new GroupSetting();
     3717    pbox2->setLabel(QObject::tr("Recording Groups"));
    33933718    pbox2->addChild(DisplayRecGroup());
    33943719    pbox2->addChild(QueryInitialFilter());
    33953720    pbox2->addChild(RememberRecGroup());
    33963721    pbox2->addChild(UseGroupNameAsAllPrograms());
    3397     addChild(pbox2);
    3398 
    3399     VerticalConfigurationGroup* pbox3 = new VerticalConfigurationGroup(false);
    3400     pbox3->setLabel(QObject::tr("View Recordings") +
    3401                     QString(" (%1/%2)").arg(++i).arg(total));
    3402     pbox3->addChild(DisplayGroupTitleSort());
    3403     pbox3->addChild(new WatchListSettings());
    3404     addChild(pbox3);
    3405 
    3406     VerticalConfigurationGroup* seek = new VerticalConfigurationGroup(false);
    3407     seek->setLabel(QObject::tr("Seeking") +
    3408                    QString(" (%1/%2)").arg(++i).arg(total));
     3722    pbox->addChild(pbox2);
     3723
     3724    pbox->addChild(DisplayGroupTitleSort());
     3725    pbox->addChild(PlaybackWatchList());
     3726    addChild(pbox);
     3727
     3728    GroupSetting* seek = new GroupSetting();
     3729    seek->setLabel(QObject::tr("Seeking"));
    34093730    seek->addChild(SmartForward());
    34103731    seek->addChild(FFRewReposTime());
    34113732    seek->addChild(FFRewReverse());
    34123733    seek->addChild(ExactSeeking());
    34133734    addChild(seek);
    34143735
    3415     VerticalConfigurationGroup* comms = new VerticalConfigurationGroup(false);
    3416     comms->setLabel(QObject::tr("Commercial Skip") +
    3417                     QString(" (%1/%2)").arg(++i).arg(total));
     3736
     3737
     3738    GroupSetting* comms = new GroupSetting();
     3739    comms->setLabel(QObject::tr("Commercial Skip"));
    34183740    comms->addChild(AutoCommercialSkip());
    34193741    comms->addChild(CommRewindAmount());
    34203742    comms->addChild(CommNotifyAmount());
     3743    //TODO mixing Host setting with Global setting, not very clear for the user
    34213744    comms->addChild(MaximumCommercialSkip());
    34223745    comms->addChild(MergeShortCommBreaks());
    34233746    addChild(comms);
    34243747
    34253748#if CONFIG_DARWIN
    3426     VerticalConfigurationGroup* mac1 = new VerticalConfigurationGroup(false);
    3427     mac1->setLabel(QObject::tr("Mac OS X Video Settings") +
    3428                    QString(" (%1/%2)").arg(++i).arg(total));
    3429     mac1->addChild(MacGammaCorrect());
    3430     mac1->addChild(MacScaleUp());
    3431     mac1->addChild(MacFullSkip());
    3432     addChild(mac1);
    3433 
    3434     VerticalConfigurationGroup* mac2 = new VerticalConfigurationGroup(false);
    3435     mac2->setLabel(QObject::tr("Mac OS X Video Settings") +
    3436                    QString(" (%1/%2)").arg(++i).arg(total));
    3437     mac2->addChild(new MacMainSettings());
    3438     mac2->addChild(new MacFloatSettings());
    3439 
    3440     HorizontalConfigurationGroup *row =
    3441         new HorizontalConfigurationGroup(false, false, true, true);
    3442     row->addChild(new MacDockSettings());
    3443     row->addChild(new MacDesktopSettings());
    3444     mac2->addChild(row);
    3445 
    3446     addChild(mac2);
     3749    GroupSetting* ma1 = new GroupSetting(false);
     3750    mac->setLabel(QObject::tr("Mac OS X Video Settings"));
     3751    mac->addChild(MacGammaCorrect());
     3752    mac->addChild(MacScaleUp());
     3753    mac->addChild(MacFullSkip());
     3754
     3755    mac->addChild(MacMainEnabled());
     3756    mac->addChild(MacFloatEnabled());
     3757    mac->addChild(MacDockEnabled());
     3758    mac->addChild(MacDesktopEnabled());
     3759    mac->addChild(row);
     3760
     3761    addChild(mac);
    34473762#endif
    34483763}
    34493764
    34503765OSDSettings::OSDSettings()
    34513766{
    3452     VerticalConfigurationGroup* osd = new VerticalConfigurationGroup(false);
    3453     osd->setLabel(QObject::tr("On-screen Display"));
     3767    setLabel(QObject::tr("On-screen Display"));
    34543768
    3455     osd->addChild(EnableMHEG());
    3456     osd->addChild(PersistentBrowseMode());
    3457     osd->addChild(BrowseAllTuners());
    3458     osd->addChild(CCBackground());
    3459     osd->addChild(DefaultCCMode());
    3460     osd->addChild(PreferCC708());
    3461     osd->addChild(SubtitleFont());
    3462     osd->addChild(OSDCC708TextZoomPercentage());
    3463     osd->addChild(SubtitleCodec());
    3464     addChild(osd);
     3769    addChild(EnableMHEG());
     3770    addChild(PersistentBrowseMode());
     3771    addChild(BrowseAllTuners());
     3772    addChild(CCBackground());
     3773    addChild(DefaultCCMode());
     3774    addChild(PreferCC708());
     3775    addChild(SubtitleFont());
     3776    addChild(OSDCC708TextZoomPercentage());
     3777    addChild(SubtitleCodec());
    34653778
    34663779    //VerticalConfigurationGroup *cc = new VerticalConfigurationGroup(false);
    34673780    //cc->setLabel(QObject::tr("Closed Captions"));
    OSDSettings::OSDSettings()  
    34763789
    34773790GeneralSettings::GeneralSettings()
    34783791{
    3479     VerticalConfigurationGroup* general = new VerticalConfigurationGroup(false);
    3480     general->setLabel(QObject::tr("General (Basic)"));
     3792    setLabel(QObject::tr("General"));
     3793    GroupSetting* general = new GroupSetting();
     3794    general->setLabel(QObject::tr("Basic"));
    34813795    general->addChild(ChannelOrdering());
    34823796    general->addChild(ChannelFormat());
    34833797    general->addChild(LongChannelFormat());
     3798    //LiveTVPriority (backend setting) should probably not be mixed with frontend settings
    34843799    general->addChild(LiveTVPriority());
    34853800    addChild(general);
    34863801
    3487     VerticalConfigurationGroup* autoexp = new VerticalConfigurationGroup(false);
    3488     autoexp->setLabel(QObject::tr("General (Auto-Expire)"));
     3802    GroupSetting* autoexp = new GroupSetting();
     3803    autoexp->setLabel(QObject::tr("Auto-Expire"));
    34893804    autoexp->addChild(AutoExpireMethod());
    3490 
    3491     VerticalConfigurationGroup *expgrp0 =
    3492         new VerticalConfigurationGroup(false, false, true, true);
    3493     expgrp0->addChild(AutoExpireDefault());
    3494     expgrp0->addChild(RerecordWatched());
    3495     expgrp0->addChild(AutoExpireWatchedPriority());
    3496 
    3497     VerticalConfigurationGroup *expgrp1 =
    3498         new VerticalConfigurationGroup(false, false, true, true);
    3499     expgrp1->addChild(AutoExpireLiveTVMaxAge());
    3500     expgrp1->addChild(AutoExpireDayPriority());
    3501     expgrp1->addChild(AutoExpireExtraSpace());
    3502 
    3503     HorizontalConfigurationGroup *expgrp =
    3504         new HorizontalConfigurationGroup(false, false, true, true);
    3505     expgrp->addChild(expgrp0);
    3506     expgrp->addChild(expgrp1);
    3507 
    3508     autoexp->addChild(expgrp);
    3509 //    autoexp->addChild(new DeletedExpireOptions());
     3805    autoexp->addChild(AutoExpireDefault());
     3806    autoexp->addChild(RerecordWatched());
     3807    autoexp->addChild(AutoExpireWatchedPriority());
     3808    autoexp->addChild(AutoExpireLiveTVMaxAge());
     3809    autoexp->addChild(AutoExpireDayPriority());
     3810    autoexp->addChild(AutoExpireExtraSpace());
     3811    //autoexp->addChild(AutoExpireInsteadOfDelete());
    35103812    autoexp->addChild(DeletedFifoOrder());
    35113813    autoexp->addChild(DeletedMaxAge());
    3512 
    35133814    addChild(autoexp);
    35143815
    3515     VerticalConfigurationGroup* jobs = new VerticalConfigurationGroup(false);
    3516     jobs->setLabel(QObject::tr("General (Jobs)"));
     3816    GroupSetting* jobs = new GroupSetting();
     3817    jobs->setLabel(QObject::tr("Jobs"));
    35173818    jobs->addChild(CommercialSkipMethod());
    35183819    jobs->addChild(CommFlagFast());
    35193820    jobs->addChild(AggressiveCommDetect());
    35203821    jobs->addChild(DefaultTranscoder());
    35213822    jobs->addChild(DeferAutoTranscodeDays());
    35223823
    3523     VerticalConfigurationGroup* autogrp0 =
    3524         new VerticalConfigurationGroup(false, false, true, true);
    3525     autogrp0->addChild(AutoMetadataLookup());
    3526     autogrp0->addChild(AutoCommercialFlag());
    3527     autogrp0->addChild(AutoTranscode());
    3528 
    3529     VerticalConfigurationGroup* autogrp1 =
    3530         new VerticalConfigurationGroup(false, false, true, true);
    3531     autogrp0->addChild(AutoRunUserJob(1));
    3532     autogrp1->addChild(AutoRunUserJob(2));
    3533     autogrp1->addChild(AutoRunUserJob(3));
    3534     autogrp1->addChild(AutoRunUserJob(4));
    3535 
    3536     HorizontalConfigurationGroup *autogrp =
    3537         new HorizontalConfigurationGroup(true, true, false, true);
     3824    GroupSetting *autogrp = new GroupSetting();
    35383825    autogrp->setLabel(
    35393826        QObject::tr("Default Job Queue Settings for New Scheduled Recordings"));
    3540     autogrp->addChild(autogrp0);
    3541     autogrp->addChild(autogrp1);
     3827    autogrp->addChild(AutoMetadataLookup());
     3828    autogrp->addChild(AutoCommercialFlag());
     3829    autogrp->addChild(AutoTranscode());
     3830    autogrp->addChild(AutoRunUserJob(1));
     3831    autogrp->addChild(AutoRunUserJob(2));
     3832    autogrp->addChild(AutoRunUserJob(3));
     3833    autogrp->addChild(AutoRunUserJob(4));
     3834
    35423835    jobs->addChild(autogrp);
    35433836
    35443837    addChild(jobs);
    35453838
    3546     VerticalConfigurationGroup* general2 = new VerticalConfigurationGroup(false);
    3547     general2->setLabel(QObject::tr("General (Advanced)"));
     3839    GroupSetting* general2 = new GroupSetting();
     3840    general2->setLabel(QObject::tr("Advanced"));
    35483841    general2->addChild(RecordPreRoll());
    35493842    general2->addChild(RecordOverTime());
    35503843    general2->addChild(CategoryOverTimeSettings());
    35513844    addChild(general2);
    35523845
    3553     VerticalConfigurationGroup* changrp = new VerticalConfigurationGroup(false);
    3554     changrp->setLabel(QObject::tr("General (Channel Groups)"));
    3555     ChannelGroupSettings *changroupsettings = new ChannelGroupSettings();
    3556     changrp->addChild(changroupsettings);
     3846    GroupSetting* changrp = new GroupSetting();
     3847    changrp->setLabel(QObject::tr("Channel Groups"));
     3848    changrp->addChild(ChannelGroupRememberLast());
    35573849    changrp->addChild(BrowseChannelGroup());
    35583850    addChild(changrp);
    35593851}
    35603852
    35613853EPGSettings::EPGSettings()
    35623854{
    3563     VerticalConfigurationGroup* epg = new VerticalConfigurationGroup(false);
    3564     epg->setLabel(QObject::tr("Program Guide") + " 1/1");
    3565     epg->addChild(WatchTVGuide());
    3566     epg->addChild(DefaultTVChannel());
    3567     epg->addChild(EPGRecThreshold());
    3568     addChild(epg);
     3855    setLabel(QObject::tr("Program Guide"));
     3856    addChild(WatchTVGuide());
     3857    addChild(DefaultTVChannel());
     3858    addChild(EPGRecThreshold());
    35693859}
    35703860
    35713861GeneralRecPrioritiesSettings::GeneralRecPrioritiesSettings()
    35723862{
    3573     VerticalConfigurationGroup* sched = new VerticalConfigurationGroup(false);
     3863    GroupSetting* sched = new GroupSetting();
    35743864    sched->setLabel(QObject::tr("Scheduler Options"));
    35753865
    35763866    sched->addChild(GRSchedMoveHigher());
    GeneralRecPrioritiesSettings::GeneralRecPrioritiesSettings()  
    35833873    sched->addChild(GRAutoRecPriority());
    35843874    addChild(sched);
    35853875
    3586     VerticalConfigurationGroup* access = new VerticalConfigurationGroup(false);
     3876    GroupSetting* access = new GroupSetting();
    35873877    access->setLabel(QObject::tr("Accessibility Options"));
    35883878
    35893879    access->addChild(GRSignLangRecPriority());
    GeneralRecPrioritiesSettings::GeneralRecPrioritiesSettings()  
    35933883    access->addChild(GRAudioDescRecPriority());
    35943884    addChild(access);
    35953885
    3596     VerticalConfigurationGroup* rtype = new VerticalConfigurationGroup(false);
     3886    GroupSetting* rtype = new GroupSetting();
    35973887    rtype->setLabel(QObject::tr("Recording Type Priority Settings"));
    35983888
    35993889    rtype->addChild(GRSingleRecordRecPriority());
    GeneralRecPrioritiesSettings::GeneralRecPrioritiesSettings()  
    36063896    addChild(rtype);
    36073897}
    36083898
     3899
     3900class GuiDimension : public GroupSetting
     3901{
     3902    public:
     3903        GuiDimension();
     3904        //virtual QString getValue();
     3905        virtual void updateButton(MythUIButtonListItem *item);
     3906   
     3907    private slots:
     3908        virtual void childChanged(StandardSetting *);
     3909    private:
     3910        StandardSetting * m_width;
     3911        StandardSetting * m_height;
     3912        StandardSetting * m_offsetX;
     3913        StandardSetting * m_offsetY;
     3914};
     3915
     3916GuiDimension::GuiDimension()
     3917    :GroupSetting()
     3918{
     3919    setLabel(QObject::tr("Gui dimension"));
     3920    addChild(m_width   = GuiWidth());
     3921    addChild(m_height  = GuiHeight());
     3922    addChild(m_offsetX = GuiOffsetX());
     3923    addChild(m_offsetY = GuiOffsetY());
     3924    connect(m_width, SIGNAL(valueChanged(StandardSetting *)),
     3925                    this, SLOT(childChanged(StandardSetting *)));
     3926    connect(m_height, SIGNAL(valueChanged(StandardSetting *)),
     3927                    this, SLOT(childChanged(StandardSetting *)));
     3928    connect(m_offsetX, SIGNAL(valueChanged(StandardSetting *)),
     3929                    this, SLOT(childChanged(StandardSetting *)));
     3930    connect(m_offsetY, SIGNAL(valueChanged(StandardSetting *)),
     3931                    this, SLOT(childChanged(StandardSetting *)));
     3932}
     3933
     3934void GuiDimension::updateButton(MythUIButtonListItem *item)
     3935{
     3936    GroupSetting::updateButton(item);
     3937    if ((  m_width->getValue()=="0"
     3938        || m_height->getValue()=="0")
     3939        && m_offsetX->getValue()=="0"
     3940        && m_offsetY->getValue()=="0")
     3941        item->SetText(QObject::tr("Fullscreen"),"value");
     3942    else
     3943        item->SetText(QString("%1x%2+%3+%4")
     3944                .arg(m_width->getValue())
     3945                .arg(m_height->getValue())
     3946                .arg(m_offsetX->getValue())
     3947                .arg(m_offsetY->getValue()),"value");
     3948}
     3949
     3950
     3951
     3952void GuiDimension::childChanged(StandardSetting *)
     3953{
     3954    emit ShouldRedraw(this);
     3955}
     3956
     3957
     3958
    36093959AppearanceSettings::AppearanceSettings()
    36103960{
    3611     VerticalConfigurationGroup* screen = new VerticalConfigurationGroup(false);
     3961    GroupSetting* screen = new GroupSetting();
    36123962    screen->setLabel(QObject::tr("Theme") + " / " + QObject::tr("Screen Settings"));
     3963    addChild(screen);
    36133964
    36143965    screen->addChild(MenuTheme());
    36153966
    AppearanceSettings::AppearanceSettings()  
    36223973//    screen->addChild(DisplaySizeHeight());
    36233974//    screen->addChild(DisplaySizeWidth());
    36243975
    3625     VerticalConfigurationGroup *column1 =
    3626         new VerticalConfigurationGroup(false, false, false, false);
    3627 
    3628     column1->addChild(GuiWidth());
    3629     column1->addChild(GuiHeight());
    3630     column1->addChild(GuiOffsetX());
    3631     column1->addChild(GuiOffsetY());
    3632 
    3633     VerticalConfigurationGroup *column2 =
    3634         new VerticalConfigurationGroup(false, false, false, false);
    3635 
    3636     column2->addChild(GuiSizeForTV());
    3637     column2->addChild(HideMouseCursor());
    3638     column2->addChild(RunInWindow());
    3639     column2->addChild(UseFixedWindowSize());
    3640 
    3641     HorizontalConfigurationGroup *columns =
    3642         new HorizontalConfigurationGroup(false, false, false, false);
     3976    screen->addChild(new GuiDimension());
    36433977
    3644     columns->addChild(column1);
    3645     columns->addChild(column2);
    3646 
    3647     screen->addChild(columns);
    3648 
    3649     addChild(screen);
     3978    screen->addChild(GuiSizeForTV());
     3979    screen->addChild(HideMouseCursor());
     3980    screen->addChild(RunInWindow());
     3981    screen->addChild(UseFixedWindowSize());
    36503982
    36513983#if defined(USING_XRANDR) || CONFIG_DARWIN
    36523984    const vector<DisplayResScreen> scr = GetVideoModes();
    36533985    if (!scr.empty())
    3654         addChild(new VideoModeSettings());
     3986        addChild(UseVideoModes());
    36553987#endif
    3656     VerticalConfigurationGroup* dates = new VerticalConfigurationGroup(false);
     3988    GroupSetting* dates = new GroupSetting();
    36573989    dates->setLabel(QObject::tr("Localization"));
    36583990    dates->addChild(MythLanguage());
    36593991    dates->addChild(ISO639PreferredLanguage(0));
    AppearanceSettings::AppearanceSettings()  
    36633995    dates->addChild(MythTimeFormat());
    36643996    addChild(dates);
    36653997
    3666     addChild(new LcdSettings());
     3998    addChild(LCDEnable());
     3999}
     4000
     4001void AppearanceSettings::applyChange()
     4002{
     4003    qApp->processEvents();
     4004    GetMythMainWindow()->JumpTo("Reload Theme");
     4005}
     4006
     4007/*******************************************************************************
     4008*                                PlayBack Groups                               *
     4009*******************************************************************************/
     4010
     4011
     4012class PlayBackGroupSetting : public GroupSetting
     4013{
     4014  public:
     4015    PlayBackGroupSetting(const QString &label, const QString &name);
     4016    virtual void updateButton(MythUIButtonListItem *item);
     4017    virtual void Load();
     4018    virtual void Save();
     4019    virtual void Close();
     4020  private:
     4021    TransTextEditSetting       *m_groupName;
     4022    TransTextEditSetting       *m_titleMatch;
     4023    TransMythUISpinBoxSetting  *m_skipAhead;
     4024    TransMythUISpinBoxSetting  *m_skipBack;
     4025    TransMythUISpinBoxSetting  *m_jumpMinutes;
     4026    TransMythUISpinBoxSetting  *m_timeStrech;
     4027    TransMythUICheckBoxSetting *m_markForDeletion;
     4028    bool                        m_isNew;
     4029};
     4030
     4031//TODO allow to delete a group
     4032
     4033void PlayBackGroupSetting::updateButton(MythUIButtonListItem *item)
     4034{
     4035    item->setEnabled(isEnabled());
     4036    item->SetText(m_label);
     4037    //item->SetText(m_settingValue,"value");
     4038    item->SetText(getHelpText(),"description");
     4039    item->setDrawArrow (haveSubSettings());
     4040}
     4041
     4042PlayBackGroupSetting::PlayBackGroupSetting(const QString &label, const QString &name)
     4043    :GroupSetting(),m_isNew(true)
     4044{
     4045
     4046    setLabel(label);
     4047    setValue(name);
     4048
     4049    m_groupName = new TransTextEditSetting();
     4050    m_groupName->setLabel(QObject::tr("Playback Group Name"));
     4051    addChild(m_groupName);
     4052
     4053    m_titleMatch = new TransTextEditSetting();
     4054    m_titleMatch->setLabel(QObject::tr("Title match (regex)"));
     4055    m_titleMatch->setHelpText(QObject::tr("Automatically set new recording rules to "
     4056                                "use this group if the title matches this "
     4057                                "regular expression.  For example, "
     4058                                "\"(News|CNN)\" would match any title in "
     4059                                "which \"News\" or \"CNN\" appears."));
     4060    addChild(m_titleMatch);
     4061
     4062    m_skipAhead = new TransMythUISpinBoxSetting(0, 600, 5, true);
     4063    m_skipAhead->addSelection(tr("Default"),"0",true);
     4064    m_skipAhead->setLabel(QObject::tr("Skip ahead (seconds)"));
     4065    m_skipAhead->setHelpText(QObject::tr("How many seconds to skip forward on a fast "
     4066                            "forward."));
     4067    addChild(m_skipAhead);
     4068
     4069    m_skipBack = new TransMythUISpinBoxSetting(0, 600, 5, true);
     4070    m_skipBack->addSelection(tr("Default"),"0",true);
     4071    m_skipBack->setLabel(QObject::tr("Skip back (seconds)"));
     4072    m_skipBack->setHelpText(QObject::tr("How many seconds to skip backward on a "
     4073                                "rewind."));
     4074    addChild(m_skipBack);
     4075
     4076    m_jumpMinutes = new TransMythUISpinBoxSetting(0, 30, 10, true);
     4077    m_jumpMinutes->addSelection(tr("Default"),"0",true);
     4078    m_jumpMinutes->setLabel(QObject::tr("Jump amount (minutes)"));
     4079    m_jumpMinutes->setHelpText(QObject::tr("How many minutes to jump forward or backward "
     4080                    "when the jump keys are pressed."));
     4081    addChild(m_jumpMinutes);
     4082
     4083    m_timeStrech = new TransMythUISpinBoxSetting(45, 200, 5, false);
     4084    m_timeStrech->addSelection(tr("Default"),"0",true);
     4085    m_timeStrech->setLabel(QObject::tr("Time stretch (speed x 100)"));
     4086    m_timeStrech->setHelpText(QObject::tr("Initial playback speed with adjusted audio.  "
     4087                                "Use 100 for normal speed, 50 for half speed "
     4088                                "and 200 for double speed."));
     4089    addChild(m_timeStrech);
     4090
     4091    m_markForDeletion = new TransMythUICheckBoxSetting();
     4092    m_markForDeletion->setLabel(QObject::tr("Mark for deletion"));
     4093    m_markForDeletion->setEnabled(false);
     4094    addChild(m_markForDeletion);
     4095}
     4096
     4097
     4098void PlayBackGroupSetting::Load()
     4099{
     4100    LOG(VB_GENERAL, LOG_ERR, QString("PlayBackGroupSetting::Load(%1)").arg(getLabel()));
     4101    if (getValue().isEmpty())
     4102    {
     4103        GroupSetting::Load();
     4104        return;
     4105    }
     4106    MSqlQuery query(MSqlQuery::InitCon());
     4107    query.prepare("SELECT name, titlematch, skipahead, skipback, jump, timestretch FROM playgroup "
     4108                  "WHERE name = :NAME ;");
     4109    query.bindValue(":NAME", getValue());
     4110    if (!query.exec())
     4111        MythDB::DBError("PlayBackGroupSetting::Load()", query);
     4112    else if (query.next())
     4113    {
     4114        LOG(VB_GENERAL, LOG_ERR, QString("PlayBackGroupSetting::Load(%1) SUCCESS").arg(getLabel()));
     4115        m_isNew=false;
     4116        m_groupName->setValue(query.value(0).toString());
     4117        m_groupName->setEnabled(getValue()!="Default");
     4118        m_titleMatch->setValue(query.value(1).toString());
     4119        m_skipAhead->setValue(query.value(2).toInt());
     4120        m_skipBack->setValue(query.value(3).toInt());
     4121        m_jumpMinutes->setValue(query.value(4).toInt());
     4122
     4123        if (query.value(5).toInt() < 45 || query.value(5).toInt() > 200)
     4124            m_timeStrech->setValue(0);
     4125        else
     4126            m_timeStrech->setValue(query.value(4).toInt());
     4127        m_markForDeletion->setEnabled(getValue()!="Default");
     4128        //mark setting as not changed
     4129        GroupSetting::Load();
     4130
     4131    }
     4132}
     4133
     4134void PlayBackGroupSetting::Close()
     4135{
     4136    Save();
     4137}
     4138
     4139void PlayBackGroupSetting::Save()
     4140{
     4141    LOG(VB_GENERAL, LOG_ERR, QString("PlayBackGroupSetting::Save(%1)").arg(getLabel()));
     4142    MSqlQuery query(MSqlQuery::InitCon());
     4143
     4144    if (m_isNew)
     4145    {
     4146        query.prepare("INSERT playgroup "
     4147                        "(name, titlematch, skipahead, skipback, jump, timestretch) "
     4148                        "VALUES "
     4149                        "(:NEWNAME, :TITLEMATCH, :SKIPAHEAD, :SKIPBACK, :JUMP, :TIMESTRETCH);");
     4150
     4151        query.bindValue(":NEWNAME",     m_groupName->getValue());
     4152        query.bindValue(":TITLEMATCH",  m_titleMatch->getValue());
     4153        query.bindValue(":SKIPAHEAD",   m_skipAhead->intValue());
     4154        query.bindValue(":SKIPBACK",    m_skipBack->intValue());
     4155        query.bindValue(":JUMP",        m_jumpMinutes->intValue());
     4156        query.bindValue(":TIMESTRETCH", m_timeStrech->intValue());
     4157
     4158        if (!query.exec())
     4159            MythDB::DBError("PlayBackGroupSetting::Save", query);
     4160    }
     4161    else if (m_markForDeletion->boolValue())
     4162    {
     4163        query.prepare("DELETE FROM playgroup "
     4164                        "WHERE name = :NAME ;");
     4165        query.bindValue(":NAME",        getValue());
     4166
     4167        if (!query.exec())
     4168            MythDB::DBError("PlayBackGroupSetting::Save", query);
     4169    }
     4170    else
     4171    {
     4172        query.prepare("UPDATE playgroup SET "
     4173                        "name        = :NEWNAME, "
     4174                        "titlematch  = :TITLEMATCH, "
     4175                        "skipahead   = :SKIPAHEAD, "
     4176                        "skipback    = :SKIPBACK, "
     4177                        "jump        = :JUMP, "
     4178                        "timestretch = :TIMESTRETCH "
     4179                        "WHERE name = :NAME ;");
     4180
     4181        query.bindValue(":NEWNAME",     m_groupName->getValue());
     4182        query.bindValue(":TITLEMATCH",  m_titleMatch->getValue());
     4183        query.bindValue(":SKIPAHEAD",   m_skipAhead->intValue());
     4184        query.bindValue(":SKIPBACK",    m_skipBack->intValue());
     4185        query.bindValue(":JUMP",        m_jumpMinutes->intValue());
     4186        query.bindValue(":TIMESTRETCH", m_timeStrech->intValue());
     4187        query.bindValue(":NAME",        getValue());
     4188
     4189        if (!query.exec())
     4190            MythDB::DBError("PlayBackGroupSetting::Save", query);
     4191    }
     4192
     4193    GroupSetting::Save();
     4194}
     4195
     4196
     4197PlayBackGroupsSetting::PlayBackGroupsSetting():
     4198    GroupSetting()
     4199{
     4200    setLabel(tr("Playback Groups"));
     4201}
     4202
     4203
     4204void PlayBackGroupsSetting::Open()
     4205{
     4206    //TODO the play groups are loaded twice when the dialog is open for the first time
     4207    Load();
     4208}
     4209
     4210
     4211void PlayBackGroupsSetting::Load()
     4212{
     4213    clearSettings();
     4214    addChild(new PlayBackGroupSetting(tr("Create new group"),""));
     4215
     4216    addChild(new PlayBackGroupSetting(tr("Default"),"Default"));
     4217
     4218    QStringList names = PlayGroup::GetNames();
     4219    while (!names.isEmpty())
     4220    {
     4221        addChild(new PlayBackGroupSetting(names.front(),names.front()));
     4222        names.pop_front();
     4223    }
     4224   
     4225    //Load all the groups
     4226    GroupSetting::Load();
     4227    //TODO select the new one or the edited one
     4228    emit settingsChanged(NULL);
     4229}
     4230
     4231
     4232/*******************************************************************************
     4233*                                Channel Groups                                *
     4234*******************************************************************************/
     4235
     4236class ChannelCheckBoxSetting : public TransMythUICheckBoxSetting
     4237{
     4238  public:
     4239    ChannelCheckBoxSetting(uint chanid,
     4240        const QString &channum, const QString &name);
     4241    uint getChannelId(){return m_channelId;};
     4242  private:
     4243    uint m_channelId;
     4244   
     4245};
     4246
     4247ChannelCheckBoxSetting::ChannelCheckBoxSetting(uint chanid,
     4248        const QString &channum, const QString &channame)
     4249    :TransMythUICheckBoxSetting(),
     4250    m_channelId(chanid)
     4251{
     4252    setLabel(QString("%1 %2").arg(channum).arg(channame));
     4253    setHelpText(QObject::tr("Select/Unselect channels for this channel group"));
     4254}
     4255
     4256
     4257
     4258ChannelGroupSetting::ChannelGroupSetting(const QString &groupName, int groupId = -1)
     4259    :GroupSetting(),
     4260    m_groupId(groupId),
     4261    m_groupName(NULL),
     4262    m_markForDeletion(NULL)
     4263{
     4264    setLabel(groupName);//TODO this should be the translated name if Favorite
     4265    setValue(groupName);
     4266    m_groupName = new TransTextEditSetting();
     4267    m_groupName->setLabel(groupName);
     4268}
     4269
     4270void ChannelGroupSetting::Open()
     4271{
     4272    Load();
     4273}
     4274
     4275void ChannelGroupSetting::Close()
     4276{
     4277    LOG(VB_GENERAL, LOG_ERR, QString("ChannelGroupSetting::Close() %1").arg(getLabel()));
     4278    if (m_markForDeletion)
     4279        LOG(VB_GENERAL, LOG_ERR, QString("m_markForDeletion => %1").arg(m_markForDeletion->boolValue()));
     4280    //Change the name
     4281    if (m_markForDeletion && m_markForDeletion->boolValue() && m_groupId>1)
     4282    {
     4283        MSqlQuery query(MSqlQuery::InitCon());
     4284        // Delete channels from this group
     4285        query.prepare("DELETE FROM channelgroup WHERE grpid = :GRPID;");
     4286        query.bindValue(":GRPID", m_groupId);
     4287        if (!query.exec())
     4288            MythDB::DBError("ChannelGroupSetting::Close", query);
     4289
     4290        // Now delete the group from channelgroupnames
     4291        query.prepare("DELETE FROM channelgroupnames WHERE grpid = :GRPID;");
     4292        query.bindValue(":GRPID", m_groupId);
     4293        if (!query.exec())
     4294            MythDB::DBError("ChannelGroupSetting::Close", query);
     4295        return;
     4296    }
     4297
     4298    if (m_groupName && m_groupName->haveChanged())
     4299    {
     4300        if (m_groupId==-1)//create a new group
     4301        {
     4302            MSqlQuery query(MSqlQuery::InitCon());
     4303            QString qstr = "INSERT INTO channelgroupnames (name) VALUE (:NEWNAME);";
     4304            query.prepare(qstr);
     4305            query.bindValue(":NEWNAME",     m_groupName->getValue());
     4306
     4307            if (!query.exec())
     4308                MythDB::DBError("ChannelGroupSetting::Close", query);
     4309            else
     4310            {
     4311                //update m_groupId
     4312                QString qstr = "SELECT grpid FROM channelgroupnames "
     4313                                "WHERE name = :NEWNAME;";
     4314                query.prepare(qstr);
     4315                query.bindValue(":NEWNAME",     m_groupName->getValue());
     4316                if (!query.exec())
     4317                    MythDB::DBError("ChannelGroupSetting::Close", query);
     4318            }
     4319        }
     4320        else
     4321        {
     4322            MSqlQuery query(MSqlQuery::InitCon());
     4323            QString qstr = "UPDATE channelgroupnames set name = :NEWNAME "
     4324                            " WHERE name = :OLDNAME ;";
     4325            query.prepare(qstr);
     4326            query.bindValue(":NEWNAME",     m_groupName->getValue());
     4327            query.bindValue(":OLDNAME",        getValue());
     4328
     4329            if (!query.exec())
     4330                MythDB::DBError("ChannelGroupSetting::Close", query);
     4331            else
     4332                m_groupId = query.value(0).toUInt();
     4333        }
     4334    }
     4335    if (m_groupId==-1) return;
     4336    QList<StandardSetting *> *children = getSubSettings();
     4337    if (children==NULL) return;
     4338    QList<StandardSetting *>::const_iterator i;
     4339    for (i = children->constBegin(); i != children->constEnd(); ++i)
     4340    {
     4341        if ((*i)->haveChanged())
     4342        {
     4343            if ((*i)==m_groupName)
     4344            {
     4345                LOG(VB_GENERAL, LOG_ERR, QString("ChannelGroupSetting::Close() change %1 to %2")
     4346                    .arg(getLabel())
     4347                    .arg(m_groupName->getValue()));
     4348            }
     4349            else
     4350            {
     4351                ChannelCheckBoxSetting *channel = dynamic_cast<ChannelCheckBoxSetting *>(*i);
     4352                if (channel)
     4353                {
     4354                    if (channel->boolValue())
     4355                    {
     4356                        LOG(VB_GENERAL, LOG_ERR, QString("ChannelGroupSetting::Close() add %1").arg(channel->getLabel()));
     4357                        ChannelGroup::AddChannel(channel->getChannelId(), m_groupId);
     4358                    }
     4359                    else
     4360                    {
     4361                        LOG(VB_GENERAL, LOG_ERR, QString("ChannelGroupSetting::Close() remove %1").arg(channel->getLabel()));
     4362                        ChannelGroup::DeleteChannel(channel->getChannelId(), m_groupId);
     4363                    }
     4364                }
     4365            }
     4366        }
     4367    }
     4368}
     4369
     4370void ChannelGroupSetting::Load()
     4371{
     4372    LOG(VB_GENERAL, LOG_ERR, QString("ChannelGroupSetting::Load() %1").arg(getLabel()));
     4373    clearSettings();
     4374    //We can not rename the Favorite group
     4375    //if (m_groupId!=1)
     4376    //{
     4377        m_groupName = new TransTextEditSetting();
     4378        m_groupName->setLabel(tr("Group name"));
     4379        if (m_groupId>-1)
     4380            m_groupName->setValue(getLabel());
     4381        m_groupName->setEnabled(m_groupId!=1);
     4382        addChild(m_groupName);
     4383    //}
     4384
     4385    MSqlQuery query(MSqlQuery::InitCon());
     4386
     4387    QString qstr = "SELECT channel.chanid, channum, name, grpid FROM channel "
     4388                    "LEFT JOIN channelgroup "
     4389                    "ON (channel.chanid = channelgroup.chanid AND  grpid = :GRPID) ;";
     4390
     4391    query.prepare(qstr);
     4392
     4393    query.bindValue(":GRPID",  m_groupId);
     4394
     4395    if (!query.exec() || !query.isActive())
     4396        MythDB::DBError("ChannelGroupSetting::Load", query);
     4397    else
     4398    {
     4399        while(query.next())
     4400        {
     4401            ChannelCheckBoxSetting * channelCheckBox =
     4402                    new ChannelCheckBoxSetting(
     4403                        query.value(0).toUInt(),
     4404                        query.value(1).toString(),
     4405                        query.value(2).toString()
     4406                    );
     4407            channelCheckBox->setValue(!query.value(3).isNull());
     4408            addChild(channelCheckBox);
     4409        }
     4410    }
     4411
     4412    //can not delete new group or Favorite
     4413    m_markForDeletion = new TransMythUICheckBoxSetting();
     4414    m_markForDeletion->setLabel(tr("Mark for deletion"));
     4415    addChild(m_markForDeletion);
     4416    m_markForDeletion->setEnabled(m_groupId>1);
     4417
     4418    GroupSetting::Load();
     4419}
     4420
     4421
     4422ChannelGroupsSetting::ChannelGroupsSetting():
     4423    GroupSetting()
     4424{
     4425    setLabel(tr("Channel Groups"));
     4426}
     4427
     4428
     4429void ChannelGroupsSetting::Open()
     4430{
     4431    //TODO the play groups are loaded twice when the dialog is open for the first time
     4432    Load();
     4433}
     4434
     4435
     4436
     4437void ChannelGroupsSetting::Load()
     4438{
     4439    clearSettings();
     4440    addChild(new ChannelGroupSetting(tr("Create New Channel Group")));
     4441    addChild(new ChannelGroupSetting(tr("Favorites"), 1));
     4442
     4443
     4444    MSqlQuery query(MSqlQuery::InitCon());
     4445
     4446    QString qstr = "SELECT grpid, name FROM channelgroupnames "
     4447                        " WHERE grpid <> 1 "
     4448                        " ORDER BY name ; ";
     4449
     4450    query.prepare(qstr);
     4451
     4452    if (!query.exec() || !query.isActive())
     4453        MythDB::DBError("ChannelGroupsSetting::Load", query);
     4454    else
     4455    {
     4456        while(query.next())
     4457        {
     4458            addChild(new ChannelGroupSetting(query.value(1).toString(),
     4459                    query.value(0).toUInt()));
     4460        }
     4461    }
     4462   
     4463    //Load all the groups
     4464    GroupSetting::Load();
     4465    //TODO select the new one or the edited one
     4466    emit settingsChanged(NULL);
    36674467}
    36684468
    36694469// vim:set sw=4 ts=4 expandtab:
  • mythtv/programs/mythfrontend/globalsettings.h

    diff --git a/mythtv/programs/mythfrontend/globalsettings.h b/mythtv/programs/mythfrontend/globalsettings.h
    index 93e774a..bc98f79 100644
    a b  
    44#include <QStringList>
    55#include <QObject>
    66
    7 #include "settings.h"
    87#include "mythcontext.h"
    98#include "videodisplayprofile.h"
     9#include "standardsettings.h"
    1010
    1111#include <QMutex>
    1212
    1313class QFileInfo;
    1414
    15 class PlaybackSettings : public ConfigurationWizard
     15class PlaybackSettings : public GroupSetting //ConfigurationWizard
    1616{
    1717  public:
    1818    PlaybackSettings();
    1919};
    2020
    21 class OSDSettings: virtual public ConfigurationWizard
     21//TODO check the purpose of virtual here
     22//class OSDSettings: virtual public ConfigurationWizard
     23class OSDSettings: public GroupSetting
    2224{
    2325  public:
    2426    OSDSettings();
    2527};
    2628
    27 class GeneralSettings : public ConfigurationWizard
     29class GeneralSettings : public GroupSetting
    2830{
    2931  public:
    3032    GeneralSettings();
    3133};
    3234
    33 class EPGSettings : public ConfigurationWizard
     35class EPGSettings : public GroupSetting
    3436{
    3537  public:
    3638    EPGSettings();
    3739};
    3840
    39 class AppearanceSettings : public ConfigurationWizard
     41class AppearanceSettings : public GroupSetting
    4042{
    4143  public:
    4244    AppearanceSettings();
     45    virtual void applyChange();
    4346};
    4447
    45 class MainGeneralSettings : public ConfigurationWizard
     48class HostRefreshRateComboBoxSetting : public HostComboBoxSetting
     49{
     50    Q_OBJECT
     51  public:
     52    HostRefreshRateComboBoxSetting(const QString &name) :
     53        HostComboBoxSetting(name) { }
     54    virtual ~HostRefreshRateComboBoxSetting() { ; }
     55
     56  public slots:
     57    virtual void ChangeResolution(StandardSetting *);
     58
     59  private:
     60    static const vector<double> GetRefreshRates(const QString &resolution);
     61};
     62
     63
     64class MainGeneralSettings : public GroupSetting
    4665{
    4766  public:
    4867    MainGeneralSettings();
     68    virtual void applyChange();
    4969};
    5070
    51 class GeneralRecPrioritiesSettings : public ConfigurationWizard
     71class GeneralRecPrioritiesSettings : public GroupSetting
    5272{
    5373  public:
    5474    GeneralRecPrioritiesSettings();
    class XboxSettings : public ConfigurationWizard  
    5979  public:
    6080    XboxSettings();
    6181};
    62 
     82/*
    6383class PlaybackProfileItemConfig : public QObject, public ConfigurationWizard
    6484{
    6585    Q_OBJECT
    class PlaybackProfileConfig : public VerticalConfigurationGroup  
    128148    vector<TransSpinBoxSetting*> priority;
    129149};
    130150
     151
    131152class PlaybackProfileConfigs : public TriggeredConfigurationGroup
    132153{
    133154    Q_OBJECT
    class PlaybackProfileConfigs : public TriggeredConfigurationGroup  
    146167  private:
    147168    QStringList   profiles;
    148169    HostComboBox *grouptrigger;
     170};*/
     171
     172
     173
     174class PlayBackGroupsSetting : public GroupSetting
     175{
     176    Q_OBJECT
     177  public:
     178    PlayBackGroupsSetting();
     179    virtual void Load();
     180    virtual void Open();
     181  public slots:
     182    //void newPlayBackGroup(StandardSetting *);
     183    //void editPlayBackGroup(StandardSetting *);
     184    //void RefreshList();
     185  private:
     186    ButtonStandardSetting *m_addGroupButton;
     187};
     188
     189class ChannelGroupSetting : public GroupSetting
     190{
     191  public:
     192    ChannelGroupSetting(const QString &groupName, int groupId);
     193    virtual void Load();
     194    virtual void Open();
     195    virtual void Close();
     196  private:
     197    int m_groupId;
     198    TransTextEditSetting       *m_groupName;
     199    TransMythUICheckBoxSetting *m_markForDeletion;
     200   
    149201};
    150202
     203class ChannelGroupsSetting : public GroupSetting
     204{
     205  public:
     206    ChannelGroupsSetting();
     207    virtual void Load();
     208    virtual void Open();
     209  private:
     210    ButtonStandardSetting *m_addGroupButton;
     211};
     212
     213
     214
    151215#endif
  • mythtv/programs/mythfrontend/main.cpp

    diff --git a/mythtv/programs/mythfrontend/main.cpp b/mythtv/programs/mythfrontend/main.cpp
    index b396624..2f6d818 100644
    a b  
    1 #include <unistd.h>
    21#include <fcntl.h>
    32#include <signal.h>
    43#include <cerrno>
    using namespace std;  
    7473#include "themechooser.h"
    7574#include "mythversion.h"
    7675#include "taskqueue.h"
     76#include "standardsettings.h"
    7777
    7878// Video
    7979#include "cleanup.h"
    namespace  
    144144
    145145            if (passwordValid)
    146146            {
    147                 VideoGeneralSettings settings;
    148                 settings.exec();
     147                MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
     148                StandardSettingDialog *ssd = new StandardSettingDialog(mainStack, "videogeneralsettings");
     149
     150                if (ssd->Create())
     151                {
     152                    ssd->loadSettings(new VideoGeneralSettings());
     153                    mainStack->AddScreen(ssd);
     154                }
     155                else
     156                    delete ssd;
    149157            }
    150158            else
    151159            {
    static void TVMenuCallback(void *data, QString &selection)  
    861869        startPrevious();
    862870    else if (sel == "settings appearance")
    863871    {
    864         AppearanceSettings *settings = new AppearanceSettings();
    865         DialogCode res = settings->exec();
    866         delete settings;
     872        MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
     873        StandardSettingDialog *ssd = new StandardSettingDialog(mainStack, "videogeneralsettings");
    867874
    868         if (kDialogCodeRejected != res)
     875        if (ssd->Create())
    869876        {
    870             qApp->processEvents();
    871             GetMythMainWindow()->JumpTo("Reload Theme");
     877            ssd->loadSettings(new AppearanceSettings());
     878            mainStack->AddScreen(ssd);
    872879        }
     880        else
     881            delete ssd;
    873882    }
    874883    else if (sel == "settings themechooser")
    875884    {
    static void TVMenuCallback(void *data, QString &selection)  
    911920    }
    912921    else if (sel == "settings playgroup")
    913922    {
    914         PlayGroupEditor editor;
    915         editor.exec();
     923        MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
     924        StandardSettingDialog *ssd = new StandardSettingDialog(mainStack, "playbackgroupsetting");
     925
     926        if (ssd->Create())
     927        {
     928            ssd->loadSettings(new PlayBackGroupsSetting());
     929            mainStack->AddScreen(ssd);
     930        }
     931        else
     932            delete ssd;
    916933    }
    917934    else if (sel == "settings general")
    918935    {
    919         GeneralSettings settings;
    920         settings.exec();
     936        MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
     937        StandardSettingDialog *ssd = new StandardSettingDialog(mainStack, "videogeneralsettings");
     938
     939        if (ssd->Create())
     940        {
     941            ssd->loadSettings(new GeneralSettings());
     942            mainStack->AddScreen(ssd);
     943        }
     944        else
     945            delete ssd;
    921946    }
    922947    else if (sel == "settings audiogeneral")
    923948    {
    924         AudioGeneralSettings audiosettings;
    925         audiosettings.exec();
     949        MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
     950        StandardSettingDialog *ssd = new StandardSettingDialog(mainStack, "videogeneralsettings");
     951
     952        if (ssd->Create())
     953        {
     954            ssd->loadSettings(new AudioConfigSettings());
     955            mainStack->AddScreen(ssd);
     956        }
     957        else
     958            delete ssd;
    926959    }
    927960    else if (sel == "settings maingeneral")
    928961    {
    929         MainGeneralSettings mainsettings;
    930         mainsettings.exec();
    931         QStringList strlist( QString("REFRESH_BACKEND") );
    932         gCoreContext->SendReceiveStringList(strlist);
     962        MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
     963        StandardSettingDialog *ssd = new StandardSettingDialog(mainStack, "videogeneralsettings");
     964
     965        if (ssd->Create())
     966        {
     967            ssd->loadSettings(new MainGeneralSettings());
     968            mainStack->AddScreen(ssd);
     969        }
     970        else
     971            delete ssd;
    933972    }
    934973    else if (sel == "settings playback")
    935974    {
    936         PlaybackSettings settings;
    937         settings.exec();
     975        MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
     976        StandardSettingDialog *ssd = new StandardSettingDialog(mainStack, "videogeneralsettings");
     977
     978        if (ssd->Create())
     979        {
     980            ssd->loadSettings(new PlaybackSettings());
     981            mainStack->AddScreen(ssd);
     982        }
     983        else
     984            delete ssd;
    938985    }
    939986    else if (sel == "settings osd")
    940987    {
    941         OSDSettings settings;
    942         settings.exec();
     988        MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
     989        StandardSettingDialog *ssd = new StandardSettingDialog(mainStack, "videogeneralsettings");
     990
     991        if (ssd->Create())
     992        {
     993            ssd->loadSettings(new OSDSettings());
     994            mainStack->AddScreen(ssd);
     995        }
     996        else
     997            delete ssd;
    943998    }
    944999    else if (sel == "settings epg")
    9451000    {
    946         EPGSettings settings;
    947         settings.exec();
     1001        MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
     1002        StandardSettingDialog *ssd = new StandardSettingDialog(mainStack, "videogeneralsettings");
     1003
     1004        if (ssd->Create())
     1005        {
     1006            ssd->loadSettings(new EPGSettings());
     1007            mainStack->AddScreen(ssd);
     1008        }
     1009        else
     1010            delete ssd;
    9481011    }
    9491012    else if (sel == "settings channelgroups")
    9501013    {
    951         ChannelGroupEditor editor;
    952         editor.exec();
     1014        MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
     1015        StandardSettingDialog *ssd = new StandardSettingDialog(mainStack, "videogeneralsettings");
     1016
     1017        if (ssd->Create())
     1018        {
     1019            ssd->loadSettings(new ChannelGroupsSetting());
     1020            mainStack->AddScreen(ssd);
     1021        }
     1022        else
     1023            delete ssd;
    9531024    }
    9541025    else if (sel == "settings generalrecpriorities")
    9551026    {
    956         GeneralRecPrioritiesSettings settings;
    957         settings.exec();
     1027        MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
     1028        StandardSettingDialog *ssd = new StandardSettingDialog(mainStack, "videogeneralsettings");
     1029
     1030        if (ssd->Create())
     1031        {
     1032            ssd->loadSettings(new GeneralRecPrioritiesSettings());
     1033            mainStack->AddScreen(ssd);
     1034        }
     1035        else
     1036            delete ssd;
    9581037    }
    9591038    else if (sel == "settings channelrecpriorities")
    9601039    {
    static void WriteDefaults()  
    11091188    VideoGeneralSettings vgs;
    11101189    vgs.Load();
    11111190    vgs.Save();
     1191    //TODo Playback group not loaded?
     1192    //TODo Channel group not loaded?
    11121193}
    11131194
    11141195static int internal_play_media(const QString &mrl, const QString &plot,
  • mythtv/programs/mythfrontend/videoglobalsettings.cpp

    diff --git a/mythtv/programs/mythfrontend/videoglobalsettings.cpp b/mythtv/programs/mythfrontend/videoglobalsettings.cpp
    index 0365bfc..efd595f 100644
    a b  
    99#include "videodlg.h"
    1010#include "videoglobalsettings.h"
    1111
     12#include "mythlogging.h"
     13
    1214namespace
    1315{
    1416// General Settings
    15 HostComboBox *VideoDefaultParentalLevel()
     17HostComboBoxSetting *VideoDefaultParentalLevel()
    1618{
    17     HostComboBox *gc = new HostComboBox("VideoDefaultParentalLevel");
     19    HostComboBoxSetting *gc = new HostComboBoxSetting("VideoDefaultParentalLevel");
    1820    gc->setLabel(QObject::tr("Starting Parental Level"));
    1921    gc->addSelection(QObject::tr("4 - Highest"),
    2022                     QString::number(ParentalLevel::plHigh));
    const char *password_clue =  
    3335    QT_TRANSLATE_NOOP("QObject", "Setting this value to all numbers will make your life "
    3436                "much easier.");
    3537
    36 HostLineEdit *VideoAdminPassword()
     38HostTextEditSetting *VideoAdminPassword()
    3739{
    38     HostLineEdit *gc = new HostLineEdit("VideoAdminPassword");
     40    HostTextEditSetting *gc = new HostTextEditSetting("VideoAdminPassword");
    3941    gc->setLabel(QObject::tr("Parental Level 4 PIN"));
    4042    gc->setHelpText(QString("%1 %2")
    4143        .arg(QObject::tr("This PIN is used to enter Parental Control "
    HostLineEdit *VideoAdminPassword()  
    4446    return gc;
    4547}
    4648
    47 HostLineEdit *VideoAdminPasswordThree()
     49HostTextEditSetting *VideoAdminPasswordThree()
    4850{
    49     HostLineEdit *gc = new HostLineEdit("VideoAdminPasswordThree");
     51    HostTextEditSetting *gc = new HostTextEditSetting("VideoAdminPasswordThree");
    5052    gc->setLabel(QObject::tr("Parental Level 3 PIN"));
    5153    gc->setHelpText(QString("%1 %2")
    5254        .arg(QObject::tr("This PIN is used to enter Parental Control Level 3."))
    HostLineEdit *VideoAdminPasswordThree()  
    5456    return gc;
    5557}
    5658
    57 HostLineEdit *VideoAdminPasswordTwo()
     59HostTextEditSetting *VideoAdminPasswordTwo()
    5860{
    59     HostLineEdit *gc = new HostLineEdit("VideoAdminPasswordTwo");
     61    HostTextEditSetting *gc = new HostTextEditSetting("VideoAdminPasswordTwo");
    6062    gc->setLabel(QObject::tr("Parental Level 2 PIN"));
    6163    gc->setHelpText(QString("%1 %2")
    6264        .arg(QObject::tr("This PIN is used to enter Parental Control Level 2."))
    HostLineEdit *VideoAdminPasswordTwo()  
    6466    return gc;
    6567}
    6668
    67 HostCheckBox *VideoAggressivePC()
     69HostCheckBoxSetting *VideoAggressivePC()
    6870{
    69     HostCheckBox *gc = new HostCheckBox("VideoAggressivePC");
     71    HostCheckBoxSetting *gc = new HostCheckBoxSetting("VideoAggressivePC");
    7072    gc->setLabel(QObject::tr("Aggressive Parental Control"));
    7173    gc->setValue(false);
    7274    gc->setHelpText(QObject::tr("If set, you will not be able to return "
    HostCheckBox *VideoAggressivePC()  
    7678    return gc;
    7779}
    7880
    79 HostLineEdit *VideoStartupDirectory()
     81//TODO use MythUIFileBrowser but we need to be able to have more than one directory
     82HostTextEditSetting *VideoStartupDirectory()
    8083{
    81     HostLineEdit *gc = new HostLineEdit("VideoStartupDir");
     84    HostTextEditSetting *gc = new HostTextEditSetting("VideoStartupDir");
    8285    gc->setLabel(QObject::tr("Directories that hold videos"));
    8386    gc->setValue(DEFAULT_VIDEOSTARTUP_DIR);
    8487    gc->setHelpText(QObject::tr("Multiple directories can be separated by ':'. "
    HostLineEdit *VideoStartupDirectory()  
    8790    return gc;
    8891}
    8992
    90 HostLineEdit *VideoArtworkDirectory()
     93HostFileBrowserSetting *VideoArtworkDirectory()
    9194{
    92     HostLineEdit *gc = new HostLineEdit("VideoArtworkDir");
     95    HostFileBrowserSetting *gc = new HostFileBrowserSetting("VideoArtworkDir");
    9396    gc->setLabel(QObject::tr("Directory that holds movie posters"));
    9497    gc->setValue(GetConfDir() + "/Video/Artwork");
    9598    gc->setHelpText(QObject::tr("This directory must exist, and the user "
    9699                    "running the frontend needs to have read/write permission "
    97100                    "to the directory."));
     101    gc->SetTypeFilter(QDir::AllDirs | QDir::Hidden);
    98102    return gc;
    99103}
    100104
    101 HostLineEdit *VideoScreenshotDirectory()
     105HostFileBrowserSetting *VideoScreenshotDirectory()
    102106{
    103     HostLineEdit *gc = new HostLineEdit("mythvideo.screenshotDir");
     107    HostFileBrowserSetting *gc = new HostFileBrowserSetting("mythvideo.screenshotDir");
    104108    gc->setLabel(QObject::tr("Directory that holds movie screenshots"));
    105109    gc->setValue(GetConfDir() + "/Video/Screenshots");
    106110    gc->setHelpText(QObject::tr("This directory must exist, and the user "
    107111                    "running the frontend needs to have read/write permission "
    108112                    "to the directory."));
     113    gc->SetTypeFilter(QDir::AllDirs | QDir::Hidden);
    109114    return gc;
    110115}
    111116
    112 HostLineEdit *VideoBannerDirectory()
     117HostFileBrowserSetting *VideoBannerDirectory()
    113118{
    114     HostLineEdit *gc = new HostLineEdit("mythvideo.bannerDir");
     119    HostFileBrowserSetting *gc = new HostFileBrowserSetting("mythvideo.bannerDir");
    115120    gc->setLabel(QObject::tr("Directory that holds movie/TV Banners"));
    116121    gc->setValue(GetConfDir() + "/Video/Banners");
    117122    gc->setHelpText(QObject::tr("This directory must exist, and the user "
    118123                    "running the frontend needs to have read/write permission "
    119124                    "to the directory."));
     125    gc->SetTypeFilter(QDir::AllDirs | QDir::Hidden);
    120126    return gc;
    121127}
    122128
    123 HostLineEdit *VideoFanartDirectory()
     129HostFileBrowserSetting *VideoFanartDirectory()
    124130{
    125     HostLineEdit *gc = new HostLineEdit("mythvideo.fanartDir");
     131    HostFileBrowserSetting *gc = new HostFileBrowserSetting("mythvideo.fanartDir");
    126132    gc->setLabel(QObject::tr("Directory that holds movie fanart"));
    127133    gc->setValue(GetConfDir() + "/Video/Fanart");
    128134    gc->setHelpText(QObject::tr("This directory must exist, and the user "
    129135                    "running the frontend needs to have read/write permission "
    130136                    "to the directory."));
     137    gc->SetTypeFilter(QDir::AllDirs | QDir::Hidden);
    131138    return gc;
    132139}
    133140
    134 HostLineEdit *TrailerDirectory()
     141HostFileBrowserSetting *TrailerDirectory()
    135142{
    136     HostLineEdit *gc = new HostLineEdit("mythvideo.TrailersDir");
     143    HostFileBrowserSetting *gc = new HostFileBrowserSetting("mythvideo.TrailersDir");
    137144    gc->setLabel(QObject::tr("Directory that holds movie trailers"));
    138145    gc->setValue(GetConfDir() + "/Video/Trailers");
    139146    gc->setHelpText(QObject::tr("This directory must exist, and the user "
    140147                    "running the frontend needs to have read/write permission "
    141148                    "to the directory."));
     149    gc->SetTypeFilter(QDir::AllDirs | QDir::Hidden);
    142150    return gc;
    143151}
    144152
    HostLineEdit *TrailerDirectory()  
    148156
    149157// General Settings
    150158
    151 HostComboBox *SetOnInsertDVD()
     159HostComboBoxSetting *SetOnInsertDVD()
    152160{
    153     HostComboBox *gc = new HostComboBox("DVDOnInsertDVD");
     161    HostComboBoxSetting *gc = new HostComboBoxSetting("DVDOnInsertDVD");
    154162    gc->setLabel(QObject::tr("On DVD insertion"));
    155163    gc->addSelection(QObject::tr("Display mythdvd menu"),"1");
    156164    gc->addSelection(QObject::tr("Do nothing"),"0");
    HostComboBox *SetOnInsertDVD()  
    160168    return gc;
    161169}
    162170
    163 HostCheckBox *VideoTreeRemember()
     171HostCheckBoxSetting *VideoTreeRemember()
    164172{
    165     HostCheckBox *gc = new HostCheckBox("mythvideo.VideoTreeRemember");
     173    HostCheckBoxSetting *gc = new HostCheckBoxSetting("mythvideo.VideoTreeRemember");
    166174    gc->setLabel(QObject::tr("Video Tree remembers last selected position"));
    167175    gc->setValue(false);
    168176    gc->setHelpText(QObject::tr("If set, the current position in the Video "
    HostCheckBox *VideoTreeRemember()  
    170178    return gc;
    171179}
    172180
    173 struct ConfigPage
    174 {
    175     typedef std::vector<ConfigurationGroup *> PageList;
    176 
    177   protected:
    178     ConfigPage(PageList &pl) : m_pl(pl)
    179     {
    180     }
    181 
    182     void Add(ConfigurationGroup *page)
    183     {
    184         m_pl.push_back(page);
    185     }
    186181
    187   private:
    188     ConfigPage(const ConfigPage &);
    189     ConfigPage &operator=(const ConfigPage &);
    190182
    191   private:
    192     PageList &m_pl;
    193 };
    194183
    195 struct VConfigPage : public ConfigPage
     184HostCheckBoxSetting *RatingsToPL()
    196185{
    197     VConfigPage(PageList &pl, bool luselabel = true, bool luseframe  = true,
    198                 bool lzeroMargin = false, bool lzeroSpace = false) :
    199         ConfigPage(pl)
    200     {
    201         m_vc_page = new VerticalConfigurationGroup(luselabel, luseframe,
    202                                                    lzeroMargin, lzeroSpace);
    203         Add(m_vc_page);
    204     }
    205 
    206     VerticalConfigurationGroup *operator->()
     186    HostCheckBoxSetting *r2pl =
     187            new HostCheckBoxSetting("mythvideo.ParentalLevelFromRating");
     188    r2pl->setLabel(QObject::tr("Enable automatic Parental Level from "
     189                               "rating"));
     190    r2pl->setValue(false);
     191    r2pl->setHelpText(QObject::tr("If enabled, searches will automatically "
     192                                  "set the Parental Level to the one "
     193                                  "matching the rating below."));
     194
     195    typedef std::map<ParentalLevel::Level, QString> r2pl_map;
     196    r2pl_map r2pl_defaults;
     197    r2pl_defaults.insert(r2pl_map::value_type(ParentalLevel::plLowest,
     198            QObject::tr("G", "PL 1 default search string.")));
     199    r2pl_defaults.insert(r2pl_map::value_type(ParentalLevel::plLow,
     200            QObject::tr("PG", "PL 2 default search string.")));
     201    r2pl_defaults.insert(r2pl_map::value_type(ParentalLevel::plMedium,
     202            QObject::tr("PG-13", "PL3 default search string.")));
     203    r2pl_defaults.insert(r2pl_map::value_type(ParentalLevel::plHigh,
     204            QObject::tr("R:NC-17", "PL4 default search string.")));
     205
     206    for (ParentalLevel pl(ParentalLevel::plLowest);
     207         pl.GetLevel() <= ParentalLevel::plHigh && pl.good(); ++pl)
    207208    {
    208         return m_vc_page;
    209     }
    210 
    211   private:
    212     VerticalConfigurationGroup *m_vc_page;
    213 };
    214 
    215 class RatingsToPL : public TriggeredConfigurationGroup
    216 {
    217   public:
    218     RatingsToPL() : TriggeredConfigurationGroup(false)
    219     {
    220         HostCheckBox *r2pl =
    221                 new HostCheckBox("mythvideo.ParentalLevelFromRating");
    222         r2pl->setLabel(QObject::tr("Enable automatic Parental Level from "
    223                                    "rating"));
    224         r2pl->setValue(false);
    225         r2pl->setHelpText(QObject::tr("If enabled, searches will automatically "
    226                                       "set the Parental Level to the one "
    227                                       "matching the rating below."));
    228         addChild(r2pl);
    229         setTrigger(r2pl);
    230 
    231         typedef std::map<ParentalLevel::Level, QString> r2pl_map;
    232         r2pl_map r2pl_defaults;
    233         r2pl_defaults.insert(r2pl_map::value_type(ParentalLevel::plLowest,
    234                 tr("G", "PL 1 default search string.")));
    235         r2pl_defaults.insert(r2pl_map::value_type(ParentalLevel::plLow,
    236                 tr("PG", "PL 2 default search string.")));
    237         r2pl_defaults.insert(r2pl_map::value_type(ParentalLevel::plMedium,
    238                 tr("PG-13", "PL3 default search string.")));
    239         r2pl_defaults.insert(r2pl_map::value_type(ParentalLevel::plHigh,
    240                 tr("R:NC-17", "PL4 default search string.")));
    241 
    242         VerticalConfigurationGroup *vcg = new VerticalConfigurationGroup(true);
    243 
    244         for (ParentalLevel pl(ParentalLevel::plLowest);
    245              pl.GetLevel() <= ParentalLevel::plHigh && pl.good(); ++pl)
     209        HostTextEditSetting *hle = new HostTextEditSetting(QString("mythvideo.AutoR2PL%1")
     210                                             .arg(pl.GetLevel()));
     211        hle->setLabel(QObject::tr("Level %1").arg(pl.GetLevel()));
     212        hle->setHelpText(QObject::tr("Ratings containing these strings "
     213                                     "(separated by :) will be assigned "
     214                                     "to Parental Level %1.")
     215                         .arg(pl.GetLevel()));
     216
     217        r2pl_map::const_iterator def_setting =
     218                r2pl_defaults.find(pl.GetLevel());
     219        if (def_setting != r2pl_defaults.end())
    246220        {
    247             HostLineEdit *hle = new HostLineEdit(QString("mythvideo.AutoR2PL%1")
    248                                                  .arg(pl.GetLevel()));
    249             hle->setLabel(QObject::tr("Level %1").arg(pl.GetLevel()));
    250             hle->setHelpText(QObject::tr("Ratings containing these strings "
    251                                          "(separated by :) will be assigned "
    252                                          "to Parental Level %1.")
    253                              .arg(pl.GetLevel()));
    254 
    255             r2pl_map::const_iterator def_setting =
    256                     r2pl_defaults.find(pl.GetLevel());
    257             if (def_setting != r2pl_defaults.end())
    258             {
    259                 hle->setValue(def_setting->second);
    260             }
    261 
    262             vcg->addChild(hle);
     221            hle->setValue(def_setting->second);
    263222        }
    264223
    265         addTarget("0", new VerticalConfigurationGroup(true));
    266         addTarget("1", vcg);
     224        r2pl->addTargetedChild("1", hle);
    267225    }
    268 };
    269226
    270 } // namespace
     227    return r2pl;
     228}
     229
     230}
    271231
    272232VideoGeneralSettings::VideoGeneralSettings()
     233    :GroupSetting()
    273234{
    274     ConfigPage::PageList pages;
    275 
    276     VConfigPage page1(pages, false);
    277     page1->addChild(VideoStartupDirectory());
    278     page1->addChild(TrailerDirectory());
    279     page1->addChild(VideoArtworkDirectory());
    280     page1->addChild(VideoScreenshotDirectory());
    281     page1->addChild(VideoBannerDirectory());
    282     page1->addChild(VideoFanartDirectory());
    283 
    284     VConfigPage page2(pages, false);
    285     page2->addChild(SetOnInsertDVD());
    286     page2->addChild(VideoTreeRemember());
    287 
    288     // page 3
    289     VerticalConfigurationGroup *pctrl =
    290             new VerticalConfigurationGroup(true, false);
     235    setLabel(QObject::tr("General settings"));
     236
     237    addChild(VideoStartupDirectory());
     238    addChild(TrailerDirectory());
     239    addChild(VideoArtworkDirectory());
     240    addChild(VideoScreenshotDirectory());
     241    addChild(VideoBannerDirectory());
     242    addChild(VideoFanartDirectory());
     243
     244    addChild(SetOnInsertDVD());
     245    addChild(VideoTreeRemember());
     246
     247    GroupSetting *pctrl =
     248            new GroupSetting();
    291249    pctrl->setLabel(QObject::tr("Parental Control Settings"));
     250
    292251    pctrl->addChild(VideoDefaultParentalLevel());
    293252    pctrl->addChild(VideoAdminPassword());
    294253    pctrl->addChild(VideoAdminPasswordThree());
    295254    pctrl->addChild(VideoAdminPasswordTwo());
    296255    pctrl->addChild(VideoAggressivePC());
    297     VConfigPage page3(pages, false);
    298     page3->addChild(pctrl);
    299256
    300     VConfigPage page4(pages, false);
    301     page4->addChild(new RatingsToPL());
     257    addChild(pctrl);
     258
     259    addChild(RatingsToPL());
    302260
    303     int page_num = 1;
    304     for (ConfigPage::PageList::const_iterator p = pages.begin();
    305          p != pages.end(); ++p, ++page_num)
    306     {
    307         (*p)->setLabel(QObject::tr("General Settings (%1/%2)").arg(page_num)
    308                        .arg(pages.size()));
    309         addChild(*p);
    310     }
    311261}
     262
  • mythtv/programs/mythfrontend/videoglobalsettings.h

    diff --git a/mythtv/programs/mythfrontend/videoglobalsettings.h b/mythtv/programs/mythfrontend/videoglobalsettings.h
    index 9f621e6..de155db 100644
    a b  
    33
    44#include "settings.h"
    55
    6 class VideoGeneralSettings : public ConfigurationWizard
     6#include "standardsettings.h"
     7
     8class VideoGeneralSettings : public GroupSetting
    79{
    810  public:
    911    VideoGeneralSettings();