Ticket #10092: mythfrontendsetup-16-02-2012.diff

File mythfrontendsetup-16-02-2012.diff, 236.5 KB (added by Xavier Hervy <xavier.hervy@…>, 15 years ago)

Pick up directory via MythUIFileBrowser, Use a Spin box dialog #10342 instead of text edit dialog when necessary, add advanced audio setting. Test audio button is still missing

  • mythtv/programs/mythfrontend/audiogeneralsettings.cpp

    diff --git a/mythtv/programs/mythfrontend/audiogeneralsettings.cpp b/mythtv/programs/mythfrontend/audiogeneralsettings.cpp
    index 1115c27..aa84c9e 100644
    a b class TriggeredItem : public TriggeredConfigurationGroup  
    4848};
    4949
    5050AudioDeviceComboBox::AudioDeviceComboBox(AudioConfigSettings *parent) :
    51     HostComboBox("AudioOutputDevice", true), m_parent(parent)
     51    HostComboBoxSetting("AudioOutputDevice", true), m_parent(parent)
    5252{
    5353    setLabel(QObject::tr("Audio output device"));
    5454#ifdef USING_ALSA
    AudioDeviceComboBox::AudioDeviceComboBox(AudioConfigSettings *parent) :  
    7070            this, SLOT(AudioDescriptionHelp(const QString&)));
    7171}
    7272
     73void AudioDeviceComboBox::edit(MythScreenType * screen)
     74{
     75    AudioRescan();
     76    HostComboBoxSetting::edit(screen);
     77}
     78
    7379void AudioDeviceComboBox::AudioRescan()
    7480{
    7581    AudioOutput::ADCVect &vect = m_parent->AudioDeviceVect();
    void AudioDeviceComboBox::AudioRescan()  
    8086
    8187    QString value = getValue();
    8288    clearSelections();
    83     resetMaxCount(vect.size());
    8489
    8590    bool found = false;
    8691    for (it = vect.begin(); it != vect.end(); ++it)
    void AudioDeviceComboBox::AudioRescan()  
    8893                     value == it->name ? (found = true) : false);
    8994    if (!found)
    9095    {
    91         resetMaxCount(vect.size()+1);
    9296        addSelection(value, value, true);
    9397    }
    94         // For some reason, it adds an empty entry, remove it
    95     removeSelection(QString::null);
    9698}
    9799
    98100void AudioDeviceComboBox::AudioDescriptionHelp(const QString &device)
    void AudioDeviceComboBox::AudioDescriptionHelp(const QString &device)  
    101103    setHelpText(desc);
    102104}
    103105
    104 AudioConfigSettings::AudioConfigSettings(ConfigurationWizard *parent) :
    105     VerticalConfigurationGroup(false, true, false, false),
     106AudioConfigSettings::AudioConfigSettings() :
     107    GroupSetting(),
    106108    m_OutputDevice(NULL),   m_MaxAudioChannels(NULL),
    107109    m_AudioUpmix(NULL),     m_AudioUpmixType(NULL),
    108110    m_AC3PassThrough(NULL), m_DTSPassThrough(NULL),
    109     m_EAC3PassThrough(NULL),m_TrueHDPassThrough(NULL), m_DTSHDPassThrough(NULL),
    110     m_parent(parent)
     111    m_EAC3PassThrough(NULL),m_TrueHDPassThrough(NULL), m_DTSHDPassThrough(NULL)
    111112{
    112113    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);
     114
     115    this->addChild((m_OutputDevice = new AudioDeviceComboBox(this)));
    127116
    128117    QString name = m_OutputDevice->getValue();
    129118    AudioOutput::AudioDeviceConfig *adc =
    AudioConfigSettings::AudioConfigSettings(ConfigurationWizard *parent) :  
    139128
    140129    delete adc;
    141130
    142     ConfigurationGroup *maingroup = new VerticalConfigurationGroup(false,
    143                                                                    false);
    144     addChild(maingroup);
    145131
    146     m_triggerDigital = new TransCheckBoxSetting();
     132    m_triggerDigital = new GroupSetting();
     133
    147134    m_AC3PassThrough = AC3PassThrough();
    148135    m_DTSPassThrough = DTSPassThrough();
    149136    m_EAC3PassThrough = EAC3PassThrough();
    150137    m_TrueHDPassThrough = TrueHDPassThrough();
    151138    m_DTSHDPassThrough = DTSHDPassThrough();
    152139
    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);
     140    m_triggerDigital->setLabel(QObject::tr("Digital Audio Capabilities"));
     141    m_triggerDigital->addChild(m_AC3PassThrough);
     142    m_triggerDigital->addChild(m_DTSPassThrough);
     143    m_triggerDigital->addChild(m_EAC3PassThrough);
     144    m_triggerDigital->addChild(m_TrueHDPassThrough);
     145    m_triggerDigital->addChild(m_DTSHDPassThrough);
     146    addChild(m_triggerDigital);
    160147
    161     TriggeredItem *sub1 = new TriggeredItem(m_triggerDigital, m_cgsettings);
     148    addChild((m_MaxAudioChannels = MaxAudioChannels()));
     149    addChild((m_AudioUpmix = AudioUpmix()));
     150    addChild((m_AudioUpmixType = AudioUpmixType()));
     151    addChild(MythControlsVolume());
    162152
    163     maingroup->addChild(sub1);
    164153
    165     maingroup->addChild((m_MaxAudioChannels = MaxAudioChannels()));
    166     maingroup->addChild((m_AudioUpmix = AudioUpmix()));
    167     maingroup->addChild((m_AudioUpmixType = AudioUpmixType()));
    168154
    169     TransButtonSetting *test = new TransButtonSetting("test");
     155
     156    addChild(m_advancedSettings = new AudioAdvancedSettings());
     157
     158    GroupSetting *test = new GroupSetting(/*"test"*/);
    170159    test->setLabel(QObject::tr("Test"));
    171160    test->setHelpText(QObject::tr("Will play a test pattern on all configured "
    172161                                  "speakers"));
    173     connect(test, SIGNAL(pressed()), this, SLOT(StartAudioTest()));
     162    //connect(test, SIGNAL(pressed()), this, SLOT(StartAudioTest()));
    174163    addChild(test);
    175164
    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);
    182 
    183165        // 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&)));
     166    connect(m_MaxAudioChannels, SIGNAL(valueChanged(StandardSetting *)),
     167            this, SLOT(UpdateVisibility(StandardSetting *)));
     168    connect(m_OutputDevice, SIGNAL(valueChanged(StandardSetting *)),
     169            this, SLOT(UpdateCapabilities(StandardSetting *)));
     170    connect(m_AC3PassThrough, SIGNAL(valueChanged(StandardSetting *)),
     171            this, SLOT(UpdateCapabilities(StandardSetting *)));
     172    connect(m_DTSPassThrough, SIGNAL(valueChanged(StandardSetting *)),
     173            this, SLOT(UpdateCapabilities(StandardSetting *)));
     174    connect(m_EAC3PassThrough, SIGNAL(valueChanged(StandardSetting *)),
     175            this, SLOT(UpdateCapabilities(StandardSetting *)));
     176    connect(m_TrueHDPassThrough, SIGNAL(valueChanged(StandardSetting *)),
     177            this, SLOT(UpdateCapabilities(StandardSetting *)));
     178    connect(m_DTSHDPassThrough, SIGNAL(valueChanged(StandardSetting *)),
     179            this, SLOT(UpdateCapabilities(StandardSetting *)));
    198180    AudioRescan();
    199181}
    200182
    201183void AudioConfigSettings::AudioRescan()
    202184{
     185
     186        LOG(VB_GENERAL, LOG_ERR,
     187            QString("AudioConfigSettings::AudioRescan()"));
    203188    if (!slotlock.tryLock())
    204189        return;
    205190
    void AudioConfigSettings::AudioRescan()  
    244229                .arg(name));
    245230    }
    246231    slotlock.unlock();
    247     UpdateCapabilities(QString::null);
     232    UpdateCapabilities(NULL);
    248233}
    249234
    250 void AudioConfigSettings::UpdateVisibility(const QString &device)
     235void AudioConfigSettings::UpdateVisibility(StandardSetting *)
    251236{
    252237    if (!m_MaxAudioChannels && !m_AudioUpmix && !m_AudioUpmixType)
    253238        return;
    void AudioConfigSettings::UpdateVisibility(const QString &device)  
    258243}
    259244
    260245AudioOutputSettings AudioConfigSettings::UpdateCapabilities(
    261     const QString &device)
     246    StandardSetting *)
    262247{
    263248    int max_speakers = 8;
    264249    int realmax_speakers = 8;
    AudioOutputSettings AudioConfigSettings::UpdateCapabilities(  
    290275    }
    291276    else
    292277    {
     278
    293279        bool bForceDigital =
    294280            gCoreContext->GetNumSetting("PassThruDeviceOverride", false);
    295281
    AudioOutputSettings AudioConfigSettings::UpdateCapabilities(  
    320306            max_speakers = 6;
    321307    }
    322308
    323     m_triggerDigital->setValue(invalid || settingsdigital.canFeature(
     309    m_triggerDigital->setEnabled(invalid || settingsdigital.canFeature(
    324310                                   FEATURE_AC3 | FEATURE_DTS | FEATURE_EAC3 |
    325311                                   FEATURE_TRUEHD | FEATURE_DTSHD));
     312   
    326313    m_EAC3PassThrough->setEnabled(bEAC3);
    327314    m_TrueHDPassThrough->setEnabled(bTRUEHD);
    328315    m_DTSHDPassThrough->setEnabled(bDTSHD);
    AudioOutputSettings AudioConfigSettings::UpdateCapabilities(  
    337324
    338325        // Remove everything and re-add available channels
    339326    m_MaxAudioChannels->clearSelections();
    340     m_MaxAudioChannels->resetMaxCount(3);
     327//TODO    m_MaxAudioChannels->resetMaxCount(3);
    341328    for (int i = 1; i <= max_speakers; i++)
    342329    {
    343330        if (invalid || settings.IsSupportedChannels(i))
    AudioOutputSettings AudioConfigSettings::UpdateCapabilities(  
    362349                                             i == cur_speakers);
    363350        }
    364351    }
     352
     353    m_advancedSettings->setMPCMEnabled(settings.canLPCM() &&
     354                                              settings.canPassthrough() >= 0);
    365355        // Return values is used by audio test
    366356        // where we mainly are interested by the number of channels
    367357        // if we support AC3 and/or LPCM
    AudioOutputSettings AudioConfigSettings::UpdateCapabilities(  
    375365
    376366void AudioConfigSettings::AudioAdvanced()
    377367{
    378     QString out  = m_OutputDevice->getValue();
     368/*    QString out  = m_OutputDevice->getValue();
    379369    bool invalid = false;
    380370    AudioOutputSettings settings;
    381371
    void AudioConfigSettings::AudioAdvanced()  
    383373    {
    384374        invalid = true;
    385375    }
    386     else
     376    elsem_MPCM
    387377    {
    388378        settings = audiodevs.value(out).settings;
    389379    }
    void AudioConfigSettings::AudioAdvanced()  
    397387        AudioRescan();
    398388        UpdateCapabilities(QString::null);
    399389    }
     390*/
    400391}
    401392
    402 HostComboBox *AudioConfigSettings::MaxAudioChannels()
     393HostComboBoxSetting *AudioConfigSettings::MaxAudioChannels()
    403394{
    404395    QString name = "MaxChannels";
    405     HostComboBox *gc = new HostComboBox(name, false);
     396    HostComboBoxSetting *gc = new HostComboBoxSetting(name, false);
    406397    gc->setLabel(QObject::tr("Speaker configuration"));
    407398    gc->addSelection(QObject::tr("Stereo"), "2", true); // default
    408399    gc->setHelpText(QObject::tr("Select the maximum number of audio "
    HostComboBox *AudioConfigSettings::MaxAudioChannels()  
    411402    return gc;
    412403}
    413404
    414 HostCheckBox *AudioConfigSettings::AudioUpmix()
     405HostCheckBoxSetting *AudioConfigSettings::AudioUpmix()
    415406{
    416     HostCheckBox *gc = new HostCheckBox("AudioDefaultUpmix");
     407    HostCheckBoxSetting *gc = new HostCheckBoxSetting("AudioDefaultUpmix");
    417408    gc->setLabel(QObject::tr("Upconvert stereo to 5.1 surround"));
    418409    gc->setValue(true);
    419410    gc->setHelpText(QObject::tr("If enabled, MythTV will upconvert stereo "
    HostCheckBox *AudioConfigSettings::AudioUpmix()  
    422413    return gc;
    423414}
    424415
    425 HostComboBox *AudioConfigSettings::AudioUpmixType()
     416HostComboBoxSetting *AudioConfigSettings::AudioUpmixType()
    426417{
    427     HostComboBox *gc = new HostComboBox("AudioUpmixType",false);
     418    HostComboBoxSetting *gc = new HostComboBoxSetting("AudioUpmixType",false);
    428419    gc->setLabel(QObject::tr("Upmix Quality"));
    429420    gc->addSelection(QObject::tr("Good"), "1");
    430421    gc->addSelection(QObject::tr("Best"), "2", true);  // default
    HostComboBox *AudioConfigSettings::AudioUpmixType()  
    432423    return gc;
    433424}
    434425
    435 HostCheckBox *AudioConfigSettings::AC3PassThrough()
     426HostCheckBoxSetting *AudioConfigSettings::AC3PassThrough()
    436427{
    437     HostCheckBox *gc = new HostCheckBox("AC3PassThru");
     428    HostCheckBoxSetting *gc = new HostCheckBoxSetting("AC3PassThru");
    438429    gc->setLabel(QObject::tr("Dolby Digital"));
    439430    gc->setValue(false);
    440431    gc->setHelpText(QObject::tr("Enable if your amplifier or sound decoder "
    HostCheckBox *AudioConfigSettings::AC3PassThrough()  
    443434    return gc;
    444435}
    445436
    446 HostCheckBox *AudioConfigSettings::DTSPassThrough()
     437HostCheckBoxSetting *AudioConfigSettings::DTSPassThrough()
    447438{
    448     HostCheckBox *gc = new HostCheckBox("DTSPassThru");
     439    HostCheckBoxSetting *gc = new HostCheckBoxSetting("DTSPassThru");
    449440    gc->setLabel(QObject::tr("DTS"));
    450441    gc->setValue(false);
    451442    gc->setHelpText(QObject::tr("Enable if your amplifier or sound decoder "
    HostCheckBox *AudioConfigSettings::DTSPassThrough()  
    454445    return gc;
    455446}
    456447
    457 HostCheckBox *AudioConfigSettings::EAC3PassThrough()
     448HostCheckBoxSetting *AudioConfigSettings::EAC3PassThrough()
    458449{
    459     HostCheckBox *gc = new HostCheckBox("EAC3PassThru");
     450    HostCheckBoxSetting *gc = new HostCheckBoxSetting("EAC3PassThru");
    460451    gc->setLabel(QObject::tr("E-AC3"));
    461452    gc->setValue(false);
    462453    gc->setHelpText(QObject::tr("Enable if your amplifier or sound decoder "
    HostCheckBox *AudioConfigSettings::EAC3PassThrough()  
    464455    return gc;
    465456}
    466457
    467 HostCheckBox *AudioConfigSettings::TrueHDPassThrough()
     458HostCheckBoxSetting *AudioConfigSettings::TrueHDPassThrough()
    468459{
    469     HostCheckBox *gc = new HostCheckBox("TrueHDPassThru");
     460    HostCheckBoxSetting *gc = new HostCheckBoxSetting("TrueHDPassThru");
    470461    gc->setLabel(QObject::tr("TrueHD"));
    471462    gc->setValue(false);
    472463    gc->setHelpText(QObject::tr("Enable if your amplifier or sound decoder "
    HostCheckBox *AudioConfigSettings::TrueHDPassThrough()  
    474465    return gc;
    475466}
    476467
    477 HostCheckBox *AudioConfigSettings::DTSHDPassThrough()
     468HostCheckBoxSetting *AudioConfigSettings::DTSHDPassThrough()
    478469{
    479     HostCheckBox *gc = new HostCheckBox("DTSHDPassThru");
     470    HostCheckBoxSetting *gc = new HostCheckBoxSetting("DTSHDPassThru");
    480471    gc->setLabel(QObject::tr("DTS-HD"));
    481472    gc->setValue(false);
    482473    gc->setHelpText(QObject::tr("Enable if your amplifier or sound decoder "
    bool AudioConfigSettings::CheckPassthrough()  
    508499    return ok;
    509500}
    510501
     502//TODO create a interface instead
     503static void fillSelectionsFromDir(HostComboBoxSetting *comboBox, const QDir& dir, bool absPath = true)
     504
     505{
     506    QFileInfoList il = dir.entryInfoList();
     507
     508    for (QFileInfoList::Iterator it = il.begin();
     509                                 it != il.end();
     510                                ++it )
     511    {
     512         QFileInfo &fi = *it;
     513
     514        if (absPath)
     515            comboBox->addSelection( fi.absoluteFilePath() );
     516        else
     517            comboBox->addSelection( fi.fileName() );
     518    }
     519}
     520
     521HostComboBoxSetting *AudioConfigSettings::MixerDevice()
     522{
     523    HostComboBoxSetting *gc = new HostComboBoxSetting("MixerDevice", true);
     524    gc->setLabel(QObject::tr("Mixer device"));
     525
     526#ifdef USING_OSS
     527    QDir dev("/dev", "mixer*", QDir::Name, QDir::System);
     528    fillSelectionsFromDir(gc, dev);
     529
     530    dev.setPath("/dev/sound");
     531    if (dev.exists())
     532    {
     533        fillSelectionsFromDir(gc, dev);
     534    }
     535#endif
     536#ifdef USING_ALSA
     537    gc->addSelection("ALSA:default", "ALSA:default");
     538#endif
     539#ifdef USING_MINGW
     540    gc->addSelection("DirectX:", "DirectX:");
     541    gc->addSelection("Windows:", "Windows:");
     542#endif
     543#if !defined(USING_MINGW)
     544    gc->addSelection("software", "software");
     545    gc->setHelpText(QObject::tr("Setting the mixer device to \"software\" "
     546                    "lets MythTV control the volume of all audio at the "
     547                    "expense of a slight quality loss."));
     548#endif
     549
     550    return gc;
     551}
     552
     553static const char* MixerControlControls[] = { "PCM",
     554                                              "Master" };
     555
     556HostComboBoxSetting *AudioConfigSettings::MixerControl()
     557{
     558    HostComboBoxSetting *gc = new HostComboBoxSetting("MixerControl", true);
     559    gc->setLabel(QObject::tr("Mixer controls"));
     560    for (unsigned int i = 0; i < sizeof(MixerControlControls) / sizeof(char*);
     561         ++i)
     562    {
     563        gc->addSelection(QObject::tr(MixerControlControls[i]),
     564                         MixerControlControls[i]);
     565    }
     566
     567    gc->setHelpText(QObject::tr("Changing the volume adjusts the selected mixer."));
     568    return gc;
     569}
     570
     571
     572//TODO was a slider
     573HostSpinBoxSetting *AudioConfigSettings::MixerVolume()
     574{
     575    HostSpinBoxSetting *gs = new HostSpinBoxSetting("MasterMixerVolume", 0, 100, 1);
     576    gs->setLabel(QObject::tr("Master mixer volume"));
     577    gs->setValue(70);
     578    gs->setHelpText(QObject::tr("Initial volume for the Master mixer. "
     579                    "This affects all sound created by the audio device. "
     580                    "Note: Do not set this too low."));
     581    return gs;
     582}
     583
     584//TODO was a slider
     585HostSpinBoxSetting *AudioConfigSettings::PCMVolume()
     586{
     587    HostSpinBoxSetting *gs = new HostSpinBoxSetting("PCMMixerVolume", 0, 100, 1);
     588    gs->setLabel(QObject::tr("PCM mixer volume"));
     589    gs->setValue(70);
     590    gs->setHelpText(QObject::tr("Initial volume for PCM output. Using the "
     591                    "volume keys in MythTV will adjust this parameter."));
     592    return gs;
     593}
     594
     595
     596HostCheckBoxSetting *AudioConfigSettings::MythControlsVolume()
     597{
     598    HostCheckBoxSetting *gc = new HostCheckBoxSetting("MythControlsVolume");
     599    gc->setLabel(QObject::tr("Use internal volume controls"));
     600    gc->setValue(true);
     601    gc->setHelpText(QObject::tr("If enabled, MythTV will control the PCM and "
     602                    "master mixer volume. Disable this option if you prefer "
     603                    "to control the volume externally (for example, using "
     604                    "your amplifier) or if you use an external mixer program."));
     605
     606    gc->addTargetedChild("1",MixerDevice());
     607    gc->addTargetedChild("1",MixerControl());
     608    gc->addTargetedChild("1",MixerVolume());
     609    gc->addTargetedChild("1",PCMVolume());
     610    return gc;
     611}
     612
    511613void AudioConfigSettings::StartAudioTest()
    512614{
    513     AudioOutputSettings settings = UpdateCapabilities(QString::null);
     615    AudioOutputSettings settings = UpdateCapabilities(NULL);
    514616   
    515617    QString out  = m_OutputDevice->getValue();
    516618    QString passthrough =
    AudioTestGroup::AudioTestGroup(QString main, QString passthrough,  
    9461048    addChild(new AudioTest(main, passthrough, channels, settings));
    9471049}
    9481050
    949 HostCheckBox *AudioMixerSettings::MythControlsVolume()
    950 {
    951     HostCheckBox *gc = new HostCheckBox("MythControlsVolume");
    952     gc->setLabel(QObject::tr("Use internal volume controls"));
    953     gc->setValue(true);
    954     gc->setHelpText(QObject::tr("If enabled, MythTV will control the PCM and "
    955                     "master mixer volume. Disable this option if you prefer "
    956                     "to control the volume externally (for example, using "
    957                     "your amplifier) or if you use an external mixer program."));
    958     return gc;
    959 }
    960 
    961 HostComboBox *AudioMixerSettings::MixerDevice()
    962 {
    963     HostComboBox *gc = new HostComboBox("MixerDevice", true);
    964     gc->setLabel(QObject::tr("Mixer device"));
    965 
    966 #ifdef USING_OSS
    967     QDir dev("/dev", "mixer*", QDir::Name, QDir::System);
    968     gc->fillSelectionsFromDir(dev);
    969 
    970     dev.setPath("/dev/sound");
    971     if (dev.exists())
    972     {
    973         gc->fillSelectionsFromDir(dev);
    974     }
    975 #endif
    976 #ifdef USING_ALSA
    977     gc->addSelection("ALSA:default", "ALSA:default");
    978 #endif
    979 #ifdef USING_MINGW
    980     gc->addSelection("DirectX:", "DirectX:");
    981     gc->addSelection("Windows:", "Windows:");
    982 #endif
    983 #if !defined(USING_MINGW)
    984     gc->addSelection("software", "software");
    985     gc->setHelpText(QObject::tr("Setting the mixer device to \"software\" "
    986                     "lets MythTV control the volume of all audio at the "
    987                     "expense of a slight quality loss."));
    988 #endif
    989 
    990     return gc;
    991 }
    992 
    993 const char* AudioMixerSettings::MixerControlControls[] = { "PCM",
    994                                                            "Master" };
    995 
    996 HostComboBox *AudioMixerSettings::MixerControl()
    997 {
    998     HostComboBox *gc = new HostComboBox("MixerControl", true);
    999     gc->setLabel(QObject::tr("Mixer controls"));
    1000     for (unsigned int i = 0; i < sizeof(MixerControlControls) / sizeof(char*);
    1001          ++i)
    1002     {
    1003         gc->addSelection(QObject::tr(MixerControlControls[i]),
    1004                          MixerControlControls[i]);
    1005     }
    1006 
    1007     gc->setHelpText(QObject::tr("Changing the volume adjusts the selected mixer."));
    1008     return gc;
    1009 }
    1010 
    1011 HostSlider *AudioMixerSettings::MixerVolume()
    1012 {
    1013     HostSlider *gs = new HostSlider("MasterMixerVolume", 0, 100, 1);
    1014     gs->setLabel(QObject::tr("Master mixer volume"));
    1015     gs->setValue(70);
    1016     gs->setHelpText(QObject::tr("Initial volume for the Master mixer. "
    1017                     "This affects all sound created by the audio device. "
    1018                     "Note: Do not set this too low."));
    1019     return gs;
    1020 }
    1021 
    1022 HostSlider *AudioMixerSettings::PCMVolume()
    1023 {
    1024     HostSlider *gs = new HostSlider("PCMMixerVolume", 0, 100, 1);
    1025     gs->setLabel(QObject::tr("PCM mixer volume"));
    1026     gs->setValue(70);
    1027     gs->setHelpText(QObject::tr("Initial volume for PCM output. Using the "
    1028                     "volume keys in MythTV will adjust this parameter."));
    1029     return gs;
    1030 }
    1031 
    1032 AudioMixerSettings::AudioMixerSettings() :
    1033     TriggeredConfigurationGroup(false, true, false, false)
    1034 {
    1035     setLabel(QObject::tr("Audio Mixer"));
    1036     setUseLabel(false);
    1037 
    1038     Setting *volumeControl = MythControlsVolume();
    1039     addChild(volumeControl);
    1040 
    1041         // Mixer settings
    1042     ConfigurationGroup *settings =
    1043         new VerticalConfigurationGroup(false, true, false, false);
    1044     settings->addChild(MixerDevice());
    1045     settings->addChild(MixerControl());
    1046     settings->addChild(MixerVolume());
    1047     settings->addChild(PCMVolume());
    1048 
    1049     ConfigurationGroup *dummy =
    1050         new VerticalConfigurationGroup(false, true, false, false);
    1051 
    1052         // Show Mixer config only if internal volume controls enabled
    1053     setTrigger(volumeControl);
    1054     addTarget("0", dummy);
    1055     addTarget("1", settings);
    1056 }
    1057 
    1058 AudioGeneralSettings::AudioGeneralSettings()
    1059 {
    1060     addChild(new AudioConfigSettings(this));
    1061     addChild(new AudioMixerSettings());
    1062 }
    1063 
    1064 HostCheckBox *AudioAdvancedSettings::MPCM()
     1051HostCheckBoxSetting *AudioAdvancedSettings::MPCM()
    10651052{
    1066     HostCheckBox *gc = new HostCheckBox("StereoPCM");
     1053    HostCheckBoxSetting *gc = new HostCheckBoxSetting("StereoPCM");
    10671054    gc->setLabel(QObject::tr("Stereo PCM Only"));
    10681055    gc->setValue(false);
    10691056    gc->setHelpText(QObject::tr("Enable if your amplifier or sound decoder "
    HostCheckBox *AudioAdvancedSettings::MPCM()  
    10731060    return gc;
    10741061}
    10751062
    1076 HostCheckBox *AudioAdvancedSettings::SRCQualityOverride()
     1063HostCheckBoxSetting *AudioAdvancedSettings::SRCQualityOverride()
    10771064{
    1078     HostCheckBox *gc = new HostCheckBox("SRCQualityOverride");
     1065    HostCheckBoxSetting *gc = new HostCheckBoxSetting("SRCQualityOverride");
    10791066    gc->setLabel(QObject::tr("Override SRC quality"));
    10801067    gc->setValue(false);
    10811068    gc->setHelpText(QObject::tr("Enable to override audio sample rate "
    HostCheckBox *AudioAdvancedSettings::SRCQualityOverride()  
    10831070    return gc;
    10841071}
    10851072
    1086 HostComboBox *AudioAdvancedSettings::SRCQuality()
     1073HostComboBoxSetting *AudioAdvancedSettings::SRCQuality()
    10871074{
    1088     HostComboBox *gc = new HostComboBox("SRCQuality", false);
     1075    HostComboBoxSetting *gc = new HostComboBoxSetting("SRCQuality", false);
    10891076    gc->setLabel(QObject::tr("Sample rate conversion"));
    10901077    gc->addSelection(QObject::tr("Disabled"), "-1");
    10911078    gc->addSelection(QObject::tr("Fastest"), "0");
    HostComboBox *AudioAdvancedSettings::SRCQuality()  
    10981085    return gc;
    10991086}
    11001087
    1101 HostCheckBox *AudioAdvancedSettings::Audio48kOverride()
     1088HostCheckBoxSetting *AudioAdvancedSettings::Audio48kOverride()
    11021089{
    1103     HostCheckBox *gc = new HostCheckBox("Audio48kOverride");
     1090    HostCheckBoxSetting *gc = new HostCheckBoxSetting("Audio48kOverride");
    11041091    gc->setLabel(QObject::tr("Force audio device output to 48kHz"));
    11051092    gc->setValue(false);
    11061093    gc->setHelpText(QObject::tr("Force audio sample rate to 48kHz. "
    HostCheckBox *AudioAdvancedSettings::Audio48kOverride()  
    11091096    return gc;
    11101097}
    11111098
    1112 HostCheckBox *AudioAdvancedSettings::PassThroughOverride()
     1099HostCheckBoxSetting *AudioAdvancedSettings::PassThroughOverride()
    11131100{
    1114     HostCheckBox *gc = new HostCheckBox("PassThruDeviceOverride");
     1101    HostCheckBoxSetting *gc = new HostCheckBoxSetting("PassThruDeviceOverride");
    11151102    gc->setLabel(QObject::tr("Separate digital output device"));
    11161103    gc->setValue(false);
    11171104    gc->setHelpText(QObject::tr("Use a distinct digital output device from "
    HostCheckBox *AudioAdvancedSettings::PassThroughOverride()  
    11201107    return gc;
    11211108}
    11221109
    1123 HostComboBox *AudioAdvancedSettings::PassThroughOutputDevice()
     1110HostComboBoxSetting *AudioAdvancedSettings::PassThroughOutputDevice()
    11241111{
    1125     HostComboBox *gc = new HostComboBox("PassThruOutputDevice", true);
     1112    HostComboBoxSetting *gc = new HostComboBoxSetting("PassThruOutputDevice", true);
    11261113
    11271114    gc->setLabel(QObject::tr("Digital output device"));
    11281115    gc->addSelection(QObject::tr("Default"), "Default");
    HostComboBox *AudioAdvancedSettings::PassThroughOutputDevice()  
    11411128    return gc;
    11421129}
    11431130
    1144 HostCheckBox *AudioAdvancedSettings::SPDIFRateOverride()
     1131HostCheckBoxSetting *AudioAdvancedSettings::SPDIFRateOverride()
    11451132{
    1146     HostCheckBox *gc = new HostCheckBox("SPDIFRateOverride");
     1133    HostCheckBoxSetting *gc = new HostCheckBoxSetting("SPDIFRateOverride");
    11471134    gc->setLabel(QObject::tr("SPDIF 48k rate override"));
    11481135    gc->setValue(false);
    11491136    gc->setHelpText(QObject::tr("ALSA only. By default, let ALSA determine "
    HostCheckBox *AudioAdvancedSettings::SPDIFRateOverride()  
    11531140    return gc;
    11541141}
    11551142
    1156 HostCheckBox *AudioAdvancedSettings::HBRPassthrough()
     1143HostCheckBoxSetting *AudioAdvancedSettings::HBRPassthrough()
    11571144{
    1158     HostCheckBox *gc = new HostCheckBox("HBRPassthru");
     1145    HostCheckBoxSetting *gc = new HostCheckBoxSetting("HBRPassthru");
    11591146    gc->setLabel(QObject::tr("HBR passthrough support"));
    11601147    gc->setValue(true);
    11611148    gc->setHelpText(QObject::tr("HBR support is required for TrueHD and DTS-HD "
    HostCheckBox *AudioAdvancedSettings::HBRPassthrough()  
    11671154    return gc;
    11681155}
    11691156
    1170 AudioAdvancedSettings::AudioAdvancedSettings(bool mpcm)
     1157void AudioAdvancedSettings::setMPCMEnabled(bool flag)
    11711158{
    1172     ConfigurationGroup *settings3 =
    1173         new HorizontalConfigurationGroup(false, false);
     1159    m_MPCM->setEnabled(flag);
     1160}
    11741161
     1162AudioAdvancedSettings::AudioAdvancedSettings()
     1163{
     1164
     1165    setLabel(QObject::tr("Advanced Audio Settings"));
     1166    setHelpText(QObject::tr("Enable extra audio settings. Under most "
     1167                                  "usage all options should be left alone"));
    11751168    m_PassThroughOverride = PassThroughOverride();
    1176     TriggeredItem *sub3 =
    1177         new TriggeredItem(m_PassThroughOverride, PassThroughOutputDevice());
    1178     settings3->addChild(m_PassThroughOverride);
    1179     settings3->addChild(sub3);
    1180 
    1181     ConfigurationGroup *settings4 =
    1182         new HorizontalConfigurationGroup(false, false);
    1183     Setting *srcqualityoverride = SRCQualityOverride();
    1184     TriggeredItem *sub4 =
    1185         new TriggeredItem(srcqualityoverride, SRCQuality());
    1186     settings4->addChild(srcqualityoverride);
    1187     settings4->addChild(sub4);
    1188 
    1189     ConfigurationGroup *settings5 =
    1190         new HorizontalConfigurationGroup(false, false);
    1191     settings5->addChild(Audio48kOverride());
    1192 #if USING_ALSA
    1193     settings5->addChild(SPDIFRateOverride());
    1194 #endif
     1169    m_PassThroughOverride->addTargetedChild("1",PassThroughOutputDevice());
     1170    addChild(m_PassThroughOverride);
    11951171
    1196     ConfigurationGroup *settings6 =
    1197         new HorizontalConfigurationGroup(false, false);
    1198     settings6->addChild(HBRPassthrough());
     1172    StandardSetting *srcqualityoverride = SRCQualityOverride();
     1173    srcqualityoverride->addTargetedChild("1",SRCQuality());
    11991174
    1200     addChild(settings4);
    1201     addChild(settings5);
    1202     addChild(settings3);
    1203     addChild(settings6);
     1175    addChild(Audio48kOverride());
     1176#if USING_ALSA
     1177    addChild(SPDIFRateOverride());
     1178#endif
    12041179
    1205     if (mpcm)
    1206     {
    1207         ConfigurationGroup *settings7;
    1208         settings7 = new HorizontalConfigurationGroup(false, false);
    1209         settings7->addChild(MPCM());
    1210         addChild(settings7);
    1211     }
     1180    addChild(m_MPCM = MPCM());
    12121181}
    1213 
     1182/*
    12141183AudioAdvancedSettingsGroup::AudioAdvancedSettingsGroup(bool mpcm)
    12151184{
    12161185    addChild(new AudioAdvancedSettings(mpcm));
    1217 }
     1186}*/
    12181187// 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..1c5affe 100644
    a b  
    1212#include "audiooutput.h"
    1313#include "mythcontext.h"
    1414#include "settings.h"
     15#include "standardsettings.h"
    1516#include "mthread.h"
    1617
    1718class AudioDeviceComboBox;
     19class AudioAdvancedSettings;
    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();
    3537    void AudioAdvanced();
    3638    void StartAudioTest();
    3739
    3840  private:
    3941    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();
     42    HostComboBoxSetting        *MaxAudioChannels();
     43    HostCheckBoxSetting        *AudioUpmix();
     44    HostComboBoxSetting        *AudioUpmixType();
     45    HostCheckBoxSetting        *AC3PassThrough();
     46    HostCheckBoxSetting        *DTSPassThrough();
     47    HostCheckBoxSetting        *EAC3PassThrough();
     48    HostCheckBoxSetting        *TrueHDPassThrough();
     49    HostCheckBoxSetting        *DTSHDPassThrough();
     50    HostCheckBoxSetting        *MythControlsVolume();
     51    HostComboBoxSetting        *MixerDevice();
     52    HostComboBoxSetting        *MixerControl();
     53    HostSpinBoxSetting         *MixerVolume();
     54    HostSpinBoxSetting         *PCMVolume();
    4855    bool                 CheckPassthrough();
    4956
    50     ConfigurationGroup  *m_cgsettings;
    51     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;
     57    GroupSetting               *m_cgsettings;
     58    AudioDeviceComboBox        *m_OutputDevice;
     59    HostComboBoxSetting        *m_MaxAudioChannels;
     60    HostCheckBoxSetting        *m_AudioUpmix;
     61    HostComboBoxSetting        *m_AudioUpmixType;
     62    GroupSetting               *m_triggerDigital;
     63    HostCheckBoxSetting        *m_AC3PassThrough;
     64    HostCheckBoxSetting        *m_DTSPassThrough;
     65    HostCheckBoxSetting        *m_EAC3PassThrough;
     66    HostCheckBoxSetting        *m_TrueHDPassThrough;
     67    HostCheckBoxSetting        *m_DTSHDPassThrough;
     68    AudioAdvancedSettings      *m_advancedSettings;
    6169    ADCMap               audiodevs;
    6270    AudioOutput::ADCVect devices;
    6371    QMutex               slotlock;
    64     ConfigurationWizard *m_parent;
     72    GroupSetting *m_parent;
     73
    6574};
    6675
    67 class AudioDeviceComboBox : public HostComboBox
     76class AudioDeviceComboBox : public HostComboBoxSetting
    6877{
    6978    Q_OBJECT
    7079  public:
    7180    AudioDeviceComboBox(AudioConfigSettings*);
    7281    void AudioRescan();
    7382
     83    virtual void edit(MythScreenType * screen);
     84
    7485  private slots:
    7586    void AudioDescriptionHelp(const QString&);
    7687
    class AudioDeviceComboBox : public HostComboBox  
    7889    AudioConfigSettings *m_parent;
    7990};
    8091
    81 class AudioMixerSettings : public TriggeredConfigurationGroup
     92class AudioMixerSettings : public GroupSetting
    8293{
    8394  public:
    8495    AudioMixerSettings();
    8596  private:
    86     HostCheckBox      *MythControlsVolume();
    87     HostComboBox      *MixerDevice();
    88     HostComboBox      *MixerControl();
    89     HostSlider         *MixerVolume();
    90     HostSlider         *PCMVolume();
    91     static const char  *MixerControlControls[];
     97    HostCheckBoxSetting *MythControlsVolume();
     98    HostComboBoxSetting *MixerDevice();
     99    HostComboBoxSetting *MixerControl();
     100    HostSpinBoxSetting  *MixerVolume();
     101    HostSpinBoxSetting  *PCMVolume();
     102    static const char   *MixerControlControls[];
    92103};
    93104
    94 class AudioGeneralSettings : public ConfigurationWizard
     105class AudioAdvancedSettings : public GroupSetting
    95106{
    96107  public:
    97     AudioGeneralSettings();
    98 };
     108    AudioAdvancedSettings(/*bool mpcm*/);
     109    void setMPCMEnabled(bool flag);
     110  private:
    99111
    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;
     112    HostCheckBoxSetting       *MPCM();
     113    HostCheckBoxSetting       *SRCQualityOverride();
     114    HostComboBoxSetting       *SRCQuality();
     115    HostCheckBoxSetting       *Audio48kOverride();
     116    HostCheckBoxSetting       *PassThroughOverride();
     117    HostComboBoxSetting       *PassThroughOutputDevice();
     118    HostCheckBoxSetting       *SPDIFRateOverride();
     119    HostCheckBoxSetting       *HBRPassthrough();
     120
     121
     122
     123    CheckBoxSetting           *m_triggerMPCM;
     124    HostCheckBoxSetting       *m_MPCM;
     125    HostCheckBoxSetting       *m_PassThroughOverride; 
    117126};
    118127
     128/*
    119129class AudioAdvancedSettingsGroup : public ConfigurationWizard
    120130{
    121131  public:
    122132    AudioAdvancedSettingsGroup(bool mpcm);
    123133};
     134*/
    124135
    125136class AudioTestGroup : public ConfigurationWizard
    126137{
  • mythtv/programs/mythfrontend/globalsettings.cpp

    diff --git a/mythtv/programs/mythfrontend/globalsettings.cpp b/mythtv/programs/mythfrontend/globalsettings.cpp
    index 7e6fad3..cadd601 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()
     43static HostCheckBoxSetting *DecodeExtraAudio()
    4344{
    44     HostCheckBox *gc = new HostCheckBox("DecodeExtraAudio");
     45    HostCheckBoxSetting *gc = new HostCheckBoxSetting("DecodeExtraAudio");
    4546    gc->setLabel(QObject::tr("Extra audio buffering"));
    4647    gc->setValue(true);
    4748    gc->setHelpText(QObject::tr("Enable this setting if MythTV is playing "
    static HostCheckBox *DecodeExtraAudio()  
    5354    return gc;
    5455}
    5556
    56 static HostComboBox *PIPLocationComboBox()
     57static HostComboBoxSetting *PIPLocationComboBox()
    5758{
    58     HostComboBox *gc = new HostComboBox("PIPLocation");
     59    HostComboBoxSetting *gc = new HostComboBoxSetting("PIPLocation");
    5960    gc->setLabel(QObject::tr("PIP video location"));
    6061    for (uint loc = 0; loc < kPIP_END; ++loc)
    6162        gc->addSelection(toString((PIPLocation) loc), QString::number(loc));
    static HostComboBox *PIPLocationComboBox()  
    6364    return gc;
    6465}
    6566
    66 static HostComboBox *DisplayRecGroup()
     67static HostComboBoxSetting *DisplayRecGroup()
    6768{
    68     HostComboBox *gc = new HostComboBox("DisplayRecGroup");
     69    HostComboBoxSetting *gc = new HostComboBoxSetting("DisplayRecGroup");
    6970    gc->setLabel(QObject::tr("Default group filter to apply"));
    7071
    7172    gc->addSelection(QObject::tr("All Programs"), QString("All Programs"));
    static HostComboBox *DisplayRecGroup()  
    99100
    100101    gc->setHelpText(QObject::tr("Default group filter to apply "
    101102                    "on the View Recordings screen."));
     103
    102104    return gc;
    103105}
    104106
    105 static HostCheckBox *QueryInitialFilter()
     107static HostCheckBoxSetting *QueryInitialFilter()
    106108{
    107     HostCheckBox *gc = new HostCheckBox("QueryInitialFilter");
     109    HostCheckBoxSetting *gc = new HostCheckBoxSetting("QueryInitialFilter");
    108110    gc->setLabel(QObject::tr("Always prompt for initial group filter"));
    109111    gc->setValue(false);
    110112    gc->setHelpText(QObject::tr("If enabled, always prompt the user for the "
    static HostCheckBox *QueryInitialFilter()  
    113115    return gc;
    114116}
    115117
    116 static HostCheckBox *RememberRecGroup()
     118static HostCheckBoxSetting *RememberRecGroup()
    117119{
    118     HostCheckBox *gc = new HostCheckBox("RememberRecGroup");
     120    HostCheckBoxSetting *gc = new HostCheckBoxSetting("RememberRecGroup");
    119121    gc->setLabel(QObject::tr("Save current group filter when changed"));
    120122    gc->setValue(true);
    121123    gc->setHelpText(QObject::tr("If enabled, remember the last selected filter "
    static HostCheckBox *RememberRecGroup()  
    124126    return gc;
    125127}
    126128
    127 static HostCheckBox *UseGroupNameAsAllPrograms()
     129static HostCheckBoxSetting *UseGroupNameAsAllPrograms()
    128130{
    129     HostCheckBox *gc = new HostCheckBox("DispRecGroupAsAllProg");
     131    HostCheckBoxSetting *gc = new HostCheckBoxSetting("DispRecGroupAsAllProg");
    130132    gc->setLabel(QObject::tr("Show filter name instead of \"All Programs\""));
    131133    gc->setValue(false);
    132134    gc->setHelpText(QObject::tr("If enabled, use the name of the display "
    static HostCheckBox *UseGroupNameAsAllPrograms()  
    135137    return gc;
    136138}
    137139
    138 static HostCheckBox *PBBStartInTitle()
     140static HostCheckBoxSetting *PBBStartInTitle()
    139141{
    140     HostCheckBox *gc = new HostCheckBox("PlaybackBoxStartInTitle");
     142    HostCheckBoxSetting *gc = new HostCheckBoxSetting("PlaybackBoxStartInTitle");
    141143    gc->setLabel(QObject::tr("Start in group list"));
    142144    gc->setValue(true);
    143145    gc->setHelpText(QObject::tr("If enabled, the focus will "
    static HostCheckBox *PBBStartInTitle()  
    146148    return gc;
    147149}
    148150
    149 static HostCheckBox *SmartForward()
     151static HostCheckBoxSetting *SmartForward()
    150152{
    151     HostCheckBox *gc = new HostCheckBox("SmartForward");
     153    HostCheckBoxSetting *gc = new HostCheckBoxSetting("SmartForward");
    152154    gc->setLabel(QObject::tr("Smart fast forwarding"));
    153155    gc->setValue(false);
    154156    gc->setHelpText(QObject::tr("If enabled, then immediately after "
    static HostCheckBox *SmartForward()  
    157159    return gc;
    158160}
    159161
    160 static HostCheckBox *ExactSeeking()
     162static HostCheckBoxSetting *ExactSeeking()
    161163{
    162     HostCheckBox *gc = new HostCheckBox("ExactSeeking");
     164    HostCheckBoxSetting *gc = new HostCheckBoxSetting("ExactSeeking");
    163165    gc->setLabel(QObject::tr("Seek to exact frame"));
    164166    gc->setValue(false);
    165167    gc->setHelpText(QObject::tr("If enabled, seeking is frame exact, but "
    static HostCheckBox *ExactSeeking()  
    167169    return gc;
    168170}
    169171
    170 static GlobalComboBox *CommercialSkipMethod()
     172static GlobalComboBoxSetting *CommercialSkipMethod()
    171173{
    172     GlobalComboBox *bc = new GlobalComboBox("CommercialSkipMethod");
     174    GlobalComboBoxSetting *bc = new GlobalComboBoxSetting("CommercialSkipMethod");
    173175    bc->setLabel(QObject::tr("Commercial detection method"));
    174176    bc->setHelpText(QObject::tr(
    175177                        "This determines the method used by MythTV to "
    static GlobalComboBox *CommercialSkipMethod()  
    182184    return bc;
    183185}
    184186
    185 static GlobalCheckBox *CommFlagFast()
     187static GlobalCheckBoxSetting *CommFlagFast()
    186188{
    187     GlobalCheckBox *gc = new GlobalCheckBox("CommFlagFast");
     189    GlobalCheckBoxSetting *gc = new GlobalCheckBoxSetting("CommFlagFast");
    188190    gc->setLabel(QObject::tr("Enable experimental speedup of commercial detection"));
    189191    gc->setValue(false);
    190192    gc->setHelpText(QObject::tr("If enabled, experimental commercial detection "
    static GlobalCheckBox *CommFlagFast()  
    192194    return gc;
    193195}
    194196
    195 static HostComboBox *AutoCommercialSkip()
     197static HostComboBoxSetting *AutoCommercialSkip()
    196198{
    197     HostComboBox *gc = new HostComboBox("AutoCommercialSkip");
     199    HostComboBoxSetting *gc = new HostComboBoxSetting("AutoCommercialSkip");
    198200    gc->setLabel(QObject::tr("Automatically skip commercials"));
    199201    gc->addSelection(QObject::tr("Off"), "0");
    200202    gc->addSelection(QObject::tr("Notify, but do not skip"), "2");
    static HostComboBox *AutoCommercialSkip()  
    206208    return gc;
    207209}
    208210
    209 static GlobalCheckBox *AutoMetadataLookup()
     211static GlobalCheckBoxSetting *AutoMetadataLookup()
    210212{
    211     GlobalCheckBox *bc = new GlobalCheckBox("AutoMetadataLookup");
     213    GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("AutoMetadataLookup");
    212214    bc->setLabel(QObject::tr("Run metadata lookup"));
    213215    bc->setValue(true);
    214216    bc->setHelpText(QObject::tr("This is the default value used for the "
    static GlobalCheckBox *AutoMetadataLookup()  
    217219    return bc;
    218220}
    219221
    220 static GlobalCheckBox *AutoCommercialFlag()
     222static GlobalCheckBoxSetting *AutoCommercialFlag()
    221223{
    222     GlobalCheckBox *bc = new GlobalCheckBox("AutoCommercialFlag");
     224    GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("AutoCommercialFlag");
    223225    bc->setLabel(QObject::tr("Run commercial detection"));
    224226    bc->setValue(true);
    225227    bc->setHelpText(QObject::tr("This is the default value used for the "
    static GlobalCheckBox *AutoCommercialFlag()  
    228230    return bc;
    229231}
    230232
    231 static GlobalCheckBox *AutoTranscode()
     233static GlobalCheckBoxSetting *AutoTranscode()
    232234{
    233     GlobalCheckBox *bc = new GlobalCheckBox("AutoTranscode");
     235    GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("AutoTranscode");
    234236    bc->setLabel(QObject::tr("Run transcoder"));
    235237    bc->setValue(false);
    236238    bc->setHelpText(QObject::tr("This is the default value used for the "
    static GlobalCheckBox *AutoTranscode()  
    239241    return bc;
    240242}
    241243
    242 static GlobalComboBox *DefaultTranscoder()
     244/*TODO This function is borrowed from RecordingProfile::fillSelections and sligthly modified
     245I will need to change the original to use a pure abstract class instead of SelectSetting
     246*/
     247static void RecordingProfile_fillSelections(MythUIComboBoxSetting *setting, int group,
     248                                      bool foldautodetect)
     249{
     250    if (!group)
     251    {
     252       for (uint i = 0; !availProfiles[i].isEmpty(); i++)
     253           setting->addSelection(availProfiles[i], availProfiles[i]);
     254       return;
     255    }
     256
     257    MSqlQuery result(MSqlQuery::InitCon());
     258    result.prepare(
     259        "SELECT name, id "
     260        "FROM recordingprofiles "
     261        "WHERE profilegroup = :GROUP "
     262        "ORDER BY id");
     263    result.bindValue(":GROUP", group);
     264
     265    if (!result.exec())
     266    {
     267        MythDB::DBError("RecordingProfile::fillSelections 1", result);
     268        return;
     269    }
     270    else if (!result.next())
     271    {
     272        return;
     273    }
     274
     275    if (group == RecordingProfile::TranscoderGroup && foldautodetect)
     276    {
     277        QString id = QString::number(RecordingProfile::TranscoderAutodetect);
     278        setting->addSelection(QObject::tr("Autodetect"), id);
     279    }
     280
     281    do
     282    {
     283        QString name = result.value(0).toString();
     284        QString id   = result.value(1).toString();
     285
     286        if (group == RecordingProfile::TranscoderGroup)
     287        {
     288            if (name == "RTjpeg/MPEG4" || name == "MPEG2")
     289            {
     290                if (!foldautodetect)
     291                {
     292                    setting->addSelection(
     293                        QObject::tr("Autodetect from %1").arg(name), id);
     294                }
     295            }
     296            else
     297            {
     298                setting->addSelection(name, id);
     299            }
     300            continue;
     301        }
     302
     303        setting->addSelection(name, id);
     304    }
     305    while (result.next());
     306}
     307
     308static GlobalComboBoxSetting *DefaultTranscoder()
    243309{
    244     GlobalComboBox *bc = new GlobalComboBox("DefaultTranscoder");
     310    GlobalComboBoxSetting *bc = new GlobalComboBoxSetting("DefaultTranscoder");
    245311    bc->setLabel(QObject::tr("Default transcoder"));
    246     RecordingProfile::fillSelections(bc, RecordingProfile::TranscoderGroup,
     312    RecordingProfile_fillSelections(bc, RecordingProfile::TranscoderGroup,
    247313                                     true);
     314
    248315    bc->setHelpText(QObject::tr("This is the default value used for the "
    249316                    "transcoder setting when a new scheduled "
    250317                    "recording is created."));
    251318    return bc;
    252319}
    253320
    254 static GlobalSpinBox *DeferAutoTranscodeDays()
     321static GlobalSpinBoxSetting *DeferAutoTranscodeDays()
    255322{
    256     GlobalSpinBox *gs = new GlobalSpinBox("DeferAutoTranscodeDays", 0, 365, 1);
     323    GlobalSpinBoxSetting *gs = new GlobalSpinBoxSetting("DeferAutoTranscodeDays", 0, 365, 1);
    257324    gs->setLabel(QObject::tr("Deferral days for auto transcode jobs"));
    258325    gs->setHelpText(QObject::tr("If non-zero, automatic transcode jobs will "
    259326                    "be scheduled to run this many days after a recording "
    static GlobalSpinBox *DeferAutoTranscodeDays()  
    262329    return gs;
    263330}
    264331
    265 static GlobalCheckBox *AutoRunUserJob(uint job_num)
     332static GlobalCheckBoxSetting *AutoRunUserJob(uint job_num)
    266333{
    267334    QString dbStr = QString("AutoRunUserJob%1").arg(job_num);
    268335    QString label = QObject::tr("Run user job #%1")
    269336        .arg(job_num);
    270     GlobalCheckBox *bc = new GlobalCheckBox(dbStr);
     337    GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting(dbStr);
    271338    bc->setLabel(label);
    272339    bc->setValue(false);
    273340    bc->setHelpText(QObject::tr("This is the default value used for the "
    static GlobalCheckBox *AutoRunUserJob(uint job_num)  
    278345    return bc;
    279346}
    280347
    281 static GlobalCheckBox *AggressiveCommDetect()
     348static GlobalCheckBoxSetting *AggressiveCommDetect()
    282349{
    283     GlobalCheckBox *bc = new GlobalCheckBox("AggressiveCommDetect");
     350    GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("AggressiveCommDetect");
    284351    bc->setLabel(QObject::tr("Strict commercial detection"));
    285352    bc->setValue(true);
    286353    bc->setHelpText(QObject::tr("Enable stricter commercial detection code. "
    static GlobalCheckBox *AggressiveCommDetect()  
    288355    return bc;
    289356}
    290357
    291 static HostSpinBox *CommRewindAmount()
     358static HostSpinBoxSetting *CommRewindAmount()
    292359{
    293     HostSpinBox *gs = new HostSpinBox("CommRewindAmount", 0, 10, 1);
     360    HostSpinBoxSetting *gs = new HostSpinBoxSetting("CommRewindAmount", 0, 10, 1);
    294361    gs->setLabel(QObject::tr("Commercial skip automatic rewind amount (secs)"));
    295362    gs->setHelpText(QObject::tr("MythTV will automatically rewind "
    296363                    "this many seconds after performing a commercial skip."));
    static HostSpinBox *CommRewindAmount()  
    298365    return gs;
    299366}
    300367
    301 static HostSpinBox *CommNotifyAmount()
     368static HostSpinBoxSetting *CommNotifyAmount()
    302369{
    303     HostSpinBox *gs = new HostSpinBox("CommNotifyAmount", 0, 10, 1);
     370    HostSpinBoxSetting *gs = new HostSpinBoxSetting("CommNotifyAmount", 0, 10, 1);
    304371    gs->setLabel(QObject::tr("Commercial skip notify amount (secs)"));
    305372    gs->setHelpText(QObject::tr("MythTV will act like a commercial "
    306373                    "begins this many seconds early. This can be useful "
    static HostSpinBox *CommNotifyAmount()  
    310377    return gs;
    311378}
    312379
    313 static GlobalSpinBox *MaximumCommercialSkip()
     380static GlobalSpinBoxSetting *MaximumCommercialSkip()
    314381{
    315     GlobalSpinBox *bs = new GlobalSpinBox("MaximumCommercialSkip", 0, 3600, 10);
     382    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("MaximumCommercialSkip", 0, 3600, 10);
    316383    bs->setLabel(QObject::tr("Maximum commercial skip (secs)"));
    317384    bs->setHelpText(QObject::tr("MythTV will discourage long manual commercial "
    318385                    "skips. Skips which are longer than this will require the "
    static GlobalSpinBox *MaximumCommercialSkip()  
    322389    return bs;
    323390}
    324391
    325 static GlobalSpinBox *MergeShortCommBreaks()
     392static GlobalSpinBoxSetting *MergeShortCommBreaks()
    326393{
    327     GlobalSpinBox *bs = new GlobalSpinBox("MergeShortCommBreaks", 0, 3600, 5);
     394    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("MergeShortCommBreaks", 0, 3600, 5);
    328395    bs->setLabel(QObject::tr("Merge short commercial breaks (secs)"));
    329396    bs->setHelpText(QObject::tr("Treat consecutive commercial breaks shorter "
    330397                    "than this as one break when skipping forward. Useful if "
    static GlobalSpinBox *MergeShortCommBreaks()  
    334401    return bs;
    335402}
    336403
    337 static GlobalSpinBox *AutoExpireExtraSpace()
     404static GlobalSpinBoxSetting *AutoExpireExtraSpace()
    338405{
    339     GlobalSpinBox *bs = new GlobalSpinBox("AutoExpireExtraSpace", 0, 200, 1);
     406    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("AutoExpireExtraSpace", 0, 200, 1);
    340407    bs->setLabel(QObject::tr("Extra disk space (GB)"));
    341408    bs->setHelpText(QObject::tr("Extra disk space (in gigabytes) beyond what "
    342409                    "MythTV requires that you want to keep free on the "
    static GlobalSpinBox *AutoExpireExtraSpace()  
    345412    return bs;
    346413};
    347414
    348 static GlobalCheckBox *AutoExpireInsteadOfDelete()
    349 {
    350     GlobalCheckBox *cb = new GlobalCheckBox("AutoExpireInsteadOfDelete");
    351     cb->setLabel(QObject::tr("Auto-Expire instead of delete recording"));
    352     cb->setValue(false);
    353     cb->setHelpText(QObject::tr("If enabled, move deleted recordings to the "
    354                     "'Deleted' recgroup and turn on autoexpire "
    355                     "instead of deleting immediately."));
    356     return cb;
    357 }
    358 
    359 static GlobalSpinBox *DeletedMaxAge()
     415static GlobalSpinBoxSetting *DeletedMaxAge()
    360416{
    361     GlobalSpinBox *bs = new GlobalSpinBox("DeletedMaxAge", 0, 365, 1);
     417    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("DeletedMaxAge", 0, 365, 1);
    362418    bs->setLabel(QObject::tr("Deleted max age (days)"));
    363419    bs->setHelpText(QObject::tr("When set to a number greater than zero, "
    364420                    "Auto-Expire will force expiration of Deleted recordings "
    static GlobalSpinBox *DeletedMaxAge()  
    367423    return bs;
    368424};
    369425
    370 static GlobalCheckBox *DeletedFifoOrder()
     426static GlobalCheckBoxSetting *DeletedFifoOrder()
    371427{
    372     GlobalCheckBox *cb = new GlobalCheckBox("DeletedFifoOrder");
     428    GlobalCheckBoxSetting *cb = new GlobalCheckBoxSetting("DeletedFifoOrder");
    373429    cb->setLabel(QObject::tr("Expire in deleted order"));
    374430    cb->setValue(false);
    375431    cb->setHelpText(QObject::tr(
    static GlobalCheckBox *DeletedFifoOrder()  
    378434    return cb;
    379435};
    380436
    381 class DeletedExpireOptions : public TriggeredConfigurationGroup
     437static GlobalCheckBoxSetting *AutoExpireInsteadOfDelete()
    382438{
    383     public:
    384      DeletedExpireOptions() :
    385          TriggeredConfigurationGroup(false, false, false, false)
    386          {
    387              setLabel(QObject::tr("DeletedExpireOptions"));
    388              Setting* enabled = AutoExpireInsteadOfDelete();
    389              addChild(enabled);
    390              setTrigger(enabled);
    391 
    392              HorizontalConfigurationGroup* settings =
    393                  new HorizontalConfigurationGroup(false);
    394              settings->addChild(DeletedFifoOrder());
    395              settings->addChild(DeletedMaxAge());
    396              addTarget("1", settings);
    397 
    398              // show nothing if fillEnabled is off
    399              addTarget("0", new HorizontalConfigurationGroup(true));
    400          };
    401 };
     439    GlobalCheckBoxSetting *cb = new GlobalCheckBoxSetting("AutoExpireInsteadOfDelete");
     440    cb->setLabel(QObject::tr("Auto-Expire instead of delete recording"));
     441    cb->setValue(false);
     442    cb->setHelpText(QObject::tr("If enabled, move deleted recordings to the "
     443                    "'Deleted' recgroup and turn on autoexpire "
     444                    "instead of deleting immediately."));
    402445
    403 static GlobalComboBox *AutoExpireMethod()
     446    cb->addTargetedChild("1",DeletedFifoOrder());
     447    cb->addTargetedChild("1",DeletedMaxAge());
     448    return cb;
     449}
     450
     451static GlobalComboBoxSetting *AutoExpireMethod()
    404452{
    405     GlobalComboBox *bc = new GlobalComboBox("AutoExpireMethod");
     453    GlobalComboBoxSetting *bc = new GlobalComboBoxSetting("AutoExpireMethod");
    406454    bc->setLabel(QObject::tr("Auto-Expire method"));
    407455    bc->addSelection(QObject::tr("Oldest show first"), "1");
    408456    bc->addSelection(QObject::tr("Lowest priority first"), "2");
    static GlobalComboBox *AutoExpireMethod()  
    414462    return bc;
    415463}
    416464
    417 static GlobalCheckBox *AutoExpireWatchedPriority()
     465static GlobalCheckBoxSetting *AutoExpireWatchedPriority()
    418466{
    419     GlobalCheckBox *bc = new GlobalCheckBox("AutoExpireWatchedPriority");
     467    GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("AutoExpireWatchedPriority");
    420468    bc->setLabel(QObject::tr("Watched before unwatched"));
    421469    bc->setValue(false);
    422470    bc->setHelpText(QObject::tr("If enabled, programs that have been marked as "
    static GlobalCheckBox *AutoExpireWatchedPriority()  
    425473    return bc;
    426474}
    427475
    428 static GlobalSpinBox *AutoExpireDayPriority()
     476static GlobalSpinBoxSetting *AutoExpireDayPriority()
    429477{
    430     GlobalSpinBox *bs = new GlobalSpinBox("AutoExpireDayPriority", 1, 400, 1);
     478    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("AutoExpireDayPriority", 1, 400, 1);
    431479    bs->setLabel(QObject::tr("Priority weight"));
    432480    bs->setHelpText(QObject::tr("The number of days bonus a program gets for "
    433481                    "each priority point. This is only used when the Weighted "
    static GlobalSpinBox *AutoExpireDayPriority()  
    436484    return bs;
    437485};
    438486
    439 static GlobalCheckBox *AutoExpireDefault()
     487static GlobalCheckBoxSetting *AutoExpireDefault()
    440488{
    441     GlobalCheckBox *bc = new GlobalCheckBox("AutoExpireDefault");
     489    GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("AutoExpireDefault");
    442490    bc->setLabel(QObject::tr("Auto-Expire default"));
    443491    bc->setValue(true);
    444492    bc->setHelpText(QObject::tr("If enabled, any new recording schedules "
    static GlobalCheckBox *AutoExpireDefault()  
    447495    return bc;
    448496}
    449497
    450 static GlobalSpinBox *AutoExpireLiveTVMaxAge()
     498static GlobalSpinBoxSetting *AutoExpireLiveTVMaxAge()
    451499{
    452     GlobalSpinBox *bs = new GlobalSpinBox("AutoExpireLiveTVMaxAge", 1, 365, 1);
     500    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("AutoExpireLiveTVMaxAge", 1, 365, 1);
    453501    bs->setLabel(QObject::tr("Live TV max age (days)"));
    454502    bs->setHelpText(QObject::tr("Auto-Expire will force expiration of Live "
    455503                    "TV recordings when they are this many days old. Live TV "
    456504                    "recordings may also be expired early if necessary to "
    457505                    "free up disk space."));
    458     bs->setValue(1);
     506    bs->setValue((int)1);
    459507    return bs;
    460508};
    461509
    static GlobalSpinBox *MinRecordDiskThreshold()  
    474522}
    475523#endif
    476524
    477 static GlobalCheckBox *RerecordWatched()
     525static GlobalCheckBoxSetting *RerecordWatched()
    478526{
    479     GlobalCheckBox *bc = new GlobalCheckBox("RerecordWatched");
     527    GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("RerecordWatched");
    480528    bc->setLabel(QObject::tr("Re-record watched"));
    481529    bc->setValue(false);
    482530    bc->setHelpText(QObject::tr("If enabled, programs that have been marked as "
    static GlobalCheckBox *RerecordWatched()  
    485533    return bc;
    486534}
    487535
    488 static GlobalSpinBox *RecordPreRoll()
     536static GlobalSpinBoxSetting *RecordPreRoll()
    489537{
    490     GlobalSpinBox *bs = new GlobalSpinBox("RecordPreRoll", 0, 600, 60, true);
     538    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("RecordPreRoll", 0, 600, 60, true);
    491539    bs->setLabel(QObject::tr("Time to record before start of show "
    492540                 "(secs)"));
    493541    bs->setHelpText(QObject::tr("This global setting allows the recorder "
    static GlobalSpinBox *RecordPreRoll()  
    498546    return bs;
    499547}
    500548
    501 static GlobalSpinBox *RecordOverTime()
     549static GlobalSpinBoxSetting *RecordOverTime()
    502550{
    503     GlobalSpinBox *bs = new GlobalSpinBox("RecordOverTime", 0, 1800, 60, true);
     551    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("RecordOverTime", 0, 1800, 60, true);
    504552    bs->setLabel(QObject::tr("Time to record past end of show (secs)"));
    505553    bs->setValue(0);
    506554    bs->setHelpText(QObject::tr("This global setting allows the recorder "
    static GlobalSpinBox *RecordOverTime()  
    510558    return bs;
    511559}
    512560
    513 static GlobalComboBox *OverTimeCategory()
     561static GlobalComboBoxSetting *OverTimeCategory()
    514562{
    515     GlobalComboBox *gc = new GlobalComboBox("OverTimeCategory");
     563    GlobalComboBoxSetting *gc = new GlobalComboBoxSetting("OverTimeCategory");
    516564    gc->setLabel(QObject::tr("Category of shows to be extended"));
    517565    gc->setHelpText(QObject::tr("For a special category (e.g. "
    518566                    "\"Sports event\"), request that shows be autoextended. "
    519567                    "Only works if a show's category can be determined."));
    520568
    521569    MSqlQuery query(MSqlQuery::InitCon());
     570    //TODO We should not have any SQL here
    522571    query.prepare("SELECT DISTINCT category FROM program GROUP BY category;");
    523572
    524573    gc->addSelection("", "");
     574
    525575    if (query.exec())
    526576    {
    527577        while (query.next())
    static GlobalComboBox *OverTimeCategory()  
    535585    return gc;
    536586}
    537587
    538 static GlobalSpinBox *CategoryOverTime()
     588static GlobalSpinBoxSetting *CategoryOverTime()
    539589{
    540     GlobalSpinBox *bs = new GlobalSpinBox("CategoryOverTime",
     590    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("CategoryOverTime",
    541591                                          0, 180, 60, true);
    542592    bs->setLabel(QObject::tr("Record past end of show (mins)"));
    543593    bs->setValue(30);
    static GlobalSpinBox *CategoryOverTime()  
    548598    return bs;
    549599}
    550600
    551 static VerticalConfigurationGroup *CategoryOverTimeSettings()
     601static GroupSetting *CategoryOverTimeSettings()
    552602{
    553     VerticalConfigurationGroup *vcg =
    554         new VerticalConfigurationGroup(false, false);
    555 
     603    GroupSetting *vcg = new GroupSetting();
    556604    vcg->setLabel(QObject::tr("Category record over-time"));
    557     vcg->setUseLabel(true);
    558605    vcg->addChild(OverTimeCategory());
    559606    vcg->addChild(CategoryOverTime());
    560607    return vcg;
    static QString pad(const QString &str, int len)  
    579626
    580627    return tmp;
    581628}
    582 
     629/*
    583630PlaybackProfileItemConfig::PlaybackProfileItemConfig(ProfileItem &_item) :
    584631    item(_item)
    585632{
    void PlaybackProfileConfig::swap(int i, int j)  
    11081155    labels[i]->setValue(label_j);
    11091156    labels[j]->setValue(label_i);
    11101157}
     1158*/
     1159
     1160static HostComboBoxSetting * CurrentPlaybackProfile()
     1161{
     1162    HostComboBoxSetting *grouptrigger = new HostComboBoxSetting("DefaultVideoPlaybackProfile");
     1163    grouptrigger->setLabel(QObject::tr("Current Video Playback Profile"));
    11111164
    1112 PlaybackProfileConfigs::PlaybackProfileConfigs(const QString &str) :
     1165    QString host = gCoreContext->GetHostName();
     1166    QStringList profiles = VideoDisplayProfile::GetProfiles(host);
     1167    if (profiles.empty())
     1168    {
     1169        VideoDisplayProfile::CreateProfiles(host);
     1170        profiles = VideoDisplayProfile::GetProfiles(host);
     1171    }
     1172    if (profiles.empty())
     1173        return grouptrigger;
     1174
     1175    if (!profiles.contains("Normal") &&
     1176        !profiles.contains("High Quality") &&
     1177        !profiles.contains("Slim"))
     1178    {
     1179        VideoDisplayProfile::CreateNewProfiles(host);
     1180        profiles = VideoDisplayProfile::GetProfiles(host);
     1181    }
     1182
     1183    if (!profiles.contains("VDPAU Normal") &&
     1184        !profiles.contains("VDPAU High Quality") &&
     1185        !profiles.contains("VDPAU Slim"))
     1186    {
     1187        VideoDisplayProfile::CreateVDPAUProfiles(host);
     1188        profiles = VideoDisplayProfile::GetProfiles(host);
     1189    }
     1190
     1191    QString profile = VideoDisplayProfile::GetDefaultProfileName(host);
     1192    if (!profiles.contains(profile))
     1193    {
     1194        profile = (profiles.contains("Normal")) ? "Normal" : profiles[0];
     1195        VideoDisplayProfile::SetDefaultProfileName(profile, host);
     1196    }
     1197
     1198    QStringList::const_iterator it;
     1199    for (it = profiles.begin(); it != profiles.end(); ++it)
     1200        grouptrigger->addSelection(ProgramInfo::i18n(*it), *it);
     1201    return grouptrigger;
     1202}
     1203
     1204/*
     1205PlaybackProfileConfigs::PlaybackProfileConfigs() :
    11131206    TriggeredConfigurationGroup(false, true,  true, true,
    11141207                                false, false, true, true), grouptrigger(NULL)
    11151208{
    1116     setLabel(QObject::tr("Playback Profiles") + str);
     1209    setLabel(QObject::tr("Playback Profiles"));
    11171210
    11181211    QString host = gCoreContext->GetHostName();
    11191212    QStringList profiles = VideoDisplayProfile::GetProfiles(host);
    void PlaybackProfileConfigs::btnPress(QString cmd)  
    12471340void PlaybackProfileConfigs::triggerChanged(const QString &trig)
    12481341{
    12491342    TriggeredConfigurationGroup::triggerChanged(trig);
    1250 }
     1343}*/
     1344/*
     1345class PlaybackProfileConfigsButton : public StandardSetting, public TransientStorage
     1346{
     1347  public:
     1348    PlaybackProfileConfigsButton():StandardSetting(),TransientStorage()
     1349    {
     1350        setLabel()
     1351       
     1352    };
     1353
     1354    virtual void Load(void){StandardSetting::Load();};
     1355    virtual void Save(void){StandardSetting::Save();};
     1356    virtual bool edit(MythScreenType * screen);
     1357    virtual void resultEdit(DialogCompletionEvent *dce, MythUIButtonListItem *item){};
     1358    virtual void applyChange(){};
     1359};*/
    12511360
    1252 static HostComboBox *PlayBoxOrdering()
     1361static HostComboBoxSetting *PlayBoxOrdering()
    12531362{
    12541363    QString str[4] =
    12551364    {
    static HostComboBox *PlayBoxOrdering()  
    12641373        "refers to sections (e.g. \"All Programs\") which list "
    12651374        "multiple titles. Sections in parentheses are not affected.");
    12661375
    1267     HostComboBox *gc = new HostComboBox("PlayBoxOrdering");
     1376    HostComboBoxSetting *gc = new HostComboBoxSetting("PlayBoxOrdering");
    12681377    gc->setLabel(QObject::tr("Episode sort orderings"));
    12691378
    12701379    for (int i = 0; i < 4; ++i)
    static HostComboBox *PlayBoxOrdering()  
    12761385    return gc;
    12771386}
    12781387
    1279 static HostComboBox *PlayBoxEpisodeSort()
     1388static HostComboBoxSetting *PlayBoxEpisodeSort()
    12801389{
    1281     HostComboBox *gc = new HostComboBox("PlayBoxEpisodeSort");
     1390    HostComboBoxSetting *gc = new HostComboBoxSetting("PlayBoxEpisodeSort");
    12821391    gc->setLabel(QObject::tr("Sort episodes"));
    12831392    gc->addSelection(QObject::tr("Record date"), "Date");
    12841393    gc->addSelection(QObject::tr("Season/Episode"), "Season");
    static HostComboBox *PlayBoxEpisodeSort()  
    12881397    return gc;
    12891398}
    12901399
    1291 static HostSpinBox *FFRewReposTime()
     1400static HostSpinBoxSetting *FFRewReposTime()
    12921401{
    1293     HostSpinBox *gs = new HostSpinBox("FFRewReposTime", 0, 200, 5);
     1402    HostSpinBoxSetting *gs = new HostSpinBoxSetting("FFRewReposTime", 0, 200, 5);
    12941403    gs->setLabel(QObject::tr("Fast forward/rewind reposition amount"));
    12951404    gs->setValue(100);
    12961405    gs->setHelpText(QObject::tr("When exiting sticky keys fast forward/rewind "
    static HostSpinBox *FFRewReposTime()  
    13011410    return gs;
    13021411}
    13031412
    1304 static HostCheckBox *FFRewReverse()
     1413static HostCheckBoxSetting *FFRewReverse()
    13051414{
    1306     HostCheckBox *gc = new HostCheckBox("FFRewReverse");
     1415    HostCheckBoxSetting *gc = new HostCheckBoxSetting("FFRewReverse");
    13071416    gc->setLabel(QObject::tr("Reverse direction in fast forward/rewind"));
    13081417    gc->setValue(true);
    13091418    gc->setHelpText(QObject::tr("If enabled, pressing the sticky rewind key "
    static HostCheckBox *FFRewReverse()  
    13141423    return gc;
    13151424}
    13161425
    1317 static HostComboBox *MenuTheme()
     1426static HostComboBoxSetting *MenuTheme()
    13181427{
    1319     HostComboBox *gc = new HostComboBox("MenuTheme");
     1428    HostComboBoxSetting *gc = new HostComboBoxSetting("MenuTheme");
    13201429    gc->setLabel(QObject::tr("Menu theme"));
    13211430
    13221431    QList<ThemeInfo> themelist = GetMythUI()->GetThemes(THEME_MENU);
    static HostComboBox MUNUSED *DecodeVBIFormat()  
    13481457    return gc;
    13491458}
    13501459
    1351 static HostSpinBox *OSDCC708TextZoomPercentage(void)
     1460static HostSpinBoxSetting *OSDCC708TextZoomPercentage(void)
    13521461{
    1353     HostSpinBox *gs = new HostSpinBox("OSDCC708TextZoom", 50, 200, 5);
     1462    HostSpinBoxSetting *gs = new HostSpinBoxSetting("OSDCC708TextZoom", 50, 200, 5);
    13541463    gs->setLabel(QObject::tr("Subtitle text zoom percentage"));
    13551464    gs->setValue(100);
    13561465    gs->setHelpText(QObject::tr("Use this to enlarge or shrink text based subtitles."));
    static HostSpinBox *OSDCC708TextZoomPercentage(void)  
    13581467    return gs;
    13591468}
    13601469
    1361 static HostComboBox *SubtitleFont()
     1470static HostComboBoxSetting *SubtitleFont()
    13621471{
    1363     HostComboBox *hcb = new HostComboBox("OSDSubFont");
     1472    HostComboBoxSetting *hcb = new HostComboBoxSetting("OSDSubFont");
    13641473    QFontDatabase db;
    13651474    QStringList fonts = db.families();
    13661475    QStringList hide  = db.families(QFontDatabase::Symbol);
    static HostComboBox *SubtitleFont()  
    13751484    return hcb;
    13761485}
    13771486
    1378 static HostComboBox *SubtitleCodec()
     1487static HostComboBoxSetting *SubtitleCodec()
    13791488{
    1380     HostComboBox *gc = new HostComboBox("SubtitleCodec");
     1489    HostComboBoxSetting *gc = new HostComboBoxSetting("SubtitleCodec");
    13811490
    13821491    gc->setLabel(QObject::tr("Subtitle Codec"));
    13831492    QList<QByteArray> list = QTextCodec::availableCodecs();
    static HostComboBox *SubtitleCodec()  
    13901499    return gc;
    13911500}
    13921501
    1393 static HostComboBox *ChannelOrdering()
     1502static HostComboBoxSetting *ChannelOrdering()
    13941503{
    1395     HostComboBox *gc = new HostComboBox("ChannelOrdering");
     1504    HostComboBoxSetting *gc = new HostComboBoxSetting("ChannelOrdering");
    13961505    gc->setLabel(QObject::tr("Channel ordering"));
    13971506    gc->addSelection(QObject::tr("channel number"), "channum");
    13981507    gc->addSelection(QObject::tr("callsign"),       "callsign");
    13991508    return gc;
    14001509}
    14011510
    1402 static HostSpinBox *VertScanPercentage()
     1511static HostSpinBoxSetting *VertScanPercentage()
    14031512{
    1404     HostSpinBox *gs = new HostSpinBox("VertScanPercentage", -100, 100, 1);
     1513    HostSpinBoxSetting *gs = new HostSpinBoxSetting("VertScanPercentage", -100, 100, 1);
     1514    //TODO should this not be 0% -> 200%
    14051515    gs->setLabel(QObject::tr("Vertical scaling"));
    14061516    gs->setValue(0);
    14071517    gs->setHelpText(QObject::tr(
    static HostSpinBox *VertScanPercentage()  
    14101520    return gs;
    14111521}
    14121522
    1413 static HostSpinBox *HorizScanPercentage()
     1523static HostSpinBoxSetting *HorizScanPercentage()
    14141524{
    1415     HostSpinBox *gs = new HostSpinBox("HorizScanPercentage", -100, 100, 1);
     1525    HostSpinBoxSetting *gs = new HostSpinBoxSetting("HorizScanPercentage", -100, 100, 1);
     1526    //TODO should this not be 0% -> 200%
    14161527    gs->setLabel(QObject::tr("Horizontal scaling"));
    14171528    gs->setValue(0);
    14181529    gs->setHelpText(QObject::tr(
    static HostSpinBox *HorizScanPercentage()  
    14211532    return gs;
    14221533};
    14231534
    1424 static HostSpinBox *XScanDisplacement()
     1535static HostSpinBoxSetting *XScanDisplacement()
    14251536{
    1426     HostSpinBox *gs = new HostSpinBox("XScanDisplacement", -50, 50, 1);
     1537    HostSpinBoxSetting *gs = new HostSpinBoxSetting("XScanDisplacement", -50, 50, 1);
    14271538    gs->setLabel(QObject::tr("Scan displacement (X)"));
    14281539    gs->setValue(0);
    14291540    gs->setHelpText(QObject::tr("Adjust this to move the image horizontally."));
    14301541    return gs;
    14311542}
    14321543
    1433 static HostSpinBox *YScanDisplacement()
     1544static HostSpinBoxSetting *YScanDisplacement()
    14341545{
    1435     HostSpinBox *gs = new HostSpinBox("YScanDisplacement", -50, 50, 1);
     1546    HostSpinBoxSetting *gs = new HostSpinBoxSetting("YScanDisplacement", -50, 50, 1);
    14361547    gs->setLabel(QObject::tr("Scan displacement (Y)"));
    14371548    gs->setValue(0);
    14381549    gs->setHelpText(QObject::tr("Adjust this to move the image vertically."));
    14391550    return gs;
    14401551};
    14411552
    1442 static HostCheckBox *CCBackground()
     1553static HostCheckBoxSetting *CCBackground()
    14431554{
    1444     HostCheckBox *gc = new HostCheckBox("CCBackground");
     1555    HostCheckBoxSetting *gc = new HostCheckBoxSetting("CCBackground");
    14451556    gc->setLabel(QObject::tr("Black background for closed captioning"));
    14461557    gc->setValue(false);
    14471558    gc->setHelpText(QObject::tr(
    static HostCheckBox *CCBackground()  
    14511562    return gc;
    14521563}
    14531564
    1454 static HostCheckBox *DefaultCCMode()
     1565static HostCheckBoxSetting *DefaultCCMode()
    14551566{
    1456     HostCheckBox *gc = new HostCheckBox("DefaultCCMode");
     1567    HostCheckBoxSetting *gc = new HostCheckBoxSetting("DefaultCCMode");
    14571568    gc->setLabel(QObject::tr("Always display closed captioning or subtitles"));
    14581569    gc->setValue(false);
    14591570    gc->setHelpText(QObject::tr(
    static HostCheckBox *DefaultCCMode()  
    14641575    return gc;
    14651576}
    14661577
    1467 static HostCheckBox *PreferCC708()
     1578static HostCheckBoxSetting *PreferCC708()
    14681579{
    1469     HostCheckBox *gc = new HostCheckBox("Prefer708Captions");
     1580    HostCheckBoxSetting *gc = new HostCheckBoxSetting("Prefer708Captions");
    14701581    gc->setLabel(QObject::tr("Prefer EIA-708 over EIA-608 captions"));
    14711582    gc->setValue(true);
    14721583    gc->setHelpText(
    static HostCheckBox *PreferCC708()  
    14771588    return gc;
    14781589}
    14791590
    1480 static HostCheckBox *EnableMHEG()
     1591static HostCheckBoxSetting *EnableMHEG()
    14811592{
    1482     HostCheckBox *gc = new HostCheckBox("EnableMHEG");
     1593    HostCheckBoxSetting *gc = new HostCheckBoxSetting("EnableMHEG");
    14831594    gc->setLabel(QObject::tr("Enable interactive TV"));
    14841595    gc->setValue(false);
    14851596    gc->setHelpText(QObject::tr(
    static HostCheckBox *EnableMHEG()  
    14891600    return gc;
    14901601}
    14911602
    1492 static HostCheckBox *PersistentBrowseMode()
     1603static HostCheckBoxSetting *PersistentBrowseMode()
    14931604{
    1494     HostCheckBox *gc = new HostCheckBox("PersistentBrowseMode");
     1605    HostCheckBoxSetting *gc = new HostCheckBoxSetting("PersistentBrowseMode");
    14951606    gc->setLabel(QObject::tr("Always use browse mode in Live TV"));
    14961607    gc->setValue(true);
    14971608    gc->setHelpText(
    static HostCheckBox *PersistentBrowseMode()  
    15011612    return gc;
    15021613}
    15031614
    1504 static HostCheckBox *BrowseAllTuners()
     1615static HostCheckBoxSetting *BrowseAllTuners()
    15051616{
    1506     HostCheckBox *gc = new HostCheckBox("BrowseAllTuners");
     1617    HostCheckBoxSetting *gc = new HostCheckBoxSetting("BrowseAllTuners");
    15071618    gc->setLabel(QObject::tr("Browse all channels"));
    15081619    gc->setValue(false);
    15091620    gc->setHelpText(
    static HostCheckBox *BrowseAllTuners()  
    15141625    return gc;
    15151626}
    15161627
    1517 static HostCheckBox *ClearSavedPosition()
     1628static HostCheckBoxSetting *ClearSavedPosition()
    15181629{
    1519     HostCheckBox *gc = new HostCheckBox("ClearSavedPosition");
     1630    HostCheckBoxSetting *gc = new HostCheckBoxSetting("ClearSavedPosition");
    15201631    gc->setLabel(QObject::tr("Clear bookmark on playback"));
    15211632    gc->setValue(true);
    15221633    gc->setHelpText(QObject::tr("If enabled, automatically clear the "
    static HostCheckBox *ClearSavedPosition()  
    15261637    return gc;
    15271638}
    15281639
    1529 static HostCheckBox *AltClearSavedPosition()
     1640static HostCheckBoxSetting *AltClearSavedPosition()
    15301641{
    1531     HostCheckBox *gc = new HostCheckBox("AltClearSavedPosition");
     1642    HostCheckBoxSetting *gc = new HostCheckBoxSetting("AltClearSavedPosition");
    15321643    gc->setLabel(QObject::tr("Alternate clear and save bookmark"));
    15331644    gc->setValue(true);
    15341645    gc->setHelpText(QObject::tr("During playback the SELECT key "
    static HostCheckBox *AltClearSavedPosition()  
    15391650    return gc;
    15401651}
    15411652
    1542 static HostComboBox *PlaybackExitPrompt()
     1653static HostComboBoxSetting *PlaybackExitPrompt()
    15431654{
    1544     HostComboBox *gc = new HostComboBox("PlaybackExitPrompt");
     1655    HostComboBoxSetting *gc = new HostComboBoxSetting("PlaybackExitPrompt");
    15451656    gc->setLabel(QObject::tr("Action on playback exit"));
    15461657    gc->addSelection(QObject::tr("Just exit"), "0");
    15471658    gc->addSelection(QObject::tr("Save position and exit"), "2");
    static HostComboBox *PlaybackExitPrompt()  
    15551666    return gc;
    15561667}
    15571668
    1558 static HostCheckBox *EndOfRecordingExitPrompt()
     1669static HostCheckBoxSetting *EndOfRecordingExitPrompt()
    15591670{
    1560     HostCheckBox *gc = new HostCheckBox("EndOfRecordingExitPrompt");
     1671    HostCheckBoxSetting *gc = new HostCheckBoxSetting("EndOfRecordingExitPrompt");
    15611672    gc->setLabel(QObject::tr("Prompt at end of recording"));
    15621673    gc->setValue(false);
    15631674    gc->setHelpText(QObject::tr("If enabled, a menu will be displayed allowing "
    static HostCheckBox *EndOfRecordingExitPrompt()  
    15661677    return gc;
    15671678}
    15681679
    1569 static HostCheckBox *JumpToProgramOSD()
     1680static HostCheckBoxSetting *JumpToProgramOSD()
    15701681{
    1571     HostCheckBox *gc = new HostCheckBox("JumpToProgramOSD");
     1682    HostCheckBoxSetting *gc = new HostCheckBoxSetting("JumpToProgramOSD");
    15721683    gc->setLabel(QObject::tr("Jump to program OSD"));
    15731684    gc->setValue(true);
    15741685    gc->setHelpText(QObject::tr(
    static HostCheckBox *JumpToProgramOSD()  
    15801691    return gc;
    15811692}
    15821693
    1583 static HostCheckBox *ContinueEmbeddedTVPlay()
     1694static HostCheckBoxSetting *ContinueEmbeddedTVPlay()
    15841695{
    1585     HostCheckBox *gc = new HostCheckBox("ContinueEmbeddedTVPlay");
     1696    HostCheckBoxSetting *gc = new HostCheckBoxSetting("ContinueEmbeddedTVPlay");
    15861697    gc->setLabel(QObject::tr("Continue playback when embedded"));
    15871698    gc->setValue(false);
    15881699    gc->setHelpText(QObject::tr(
    static HostCheckBox *ContinueEmbeddedTVPlay()  
    15931704    return gc;
    15941705}
    15951706
    1596 static HostCheckBox *AutomaticSetWatched()
     1707static HostCheckBoxSetting *AutomaticSetWatched()
    15971708{
    1598     HostCheckBox *gc = new HostCheckBox("AutomaticSetWatched");
     1709    HostCheckBoxSetting *gc = new HostCheckBoxSetting("AutomaticSetWatched");
    15991710    gc->setLabel(QObject::tr("Automatically mark a recording as watched"));
    16001711    gc->setValue(false);
    16011712    gc->setHelpText(QObject::tr("If enabled, when you exit near the end of a "
    static HostCheckBox *AutomaticSetWatched()  
    16061717    return gc;
    16071718}
    16081719
    1609 static HostSpinBox *LiveTVIdleTimeout()
     1720static HostSpinBoxSetting *LiveTVIdleTimeout()
    16101721{
    1611     HostSpinBox *gs = new HostSpinBox("LiveTVIdleTimeout", 0, 3600, 1);
     1722    HostSpinBoxSetting *gs = new HostSpinBoxSetting("LiveTVIdleTimeout", 0, 3600, 1);
    16121723    gs->setLabel(QObject::tr("Live TV idle timeout (mins)"));
    16131724    gs->setValue(0);
    16141725    gs->setHelpText(QObject::tr(
    static HostSpinBox *LiveTVIdleTimeout()  
    16431754//     return gc;
    16441755// }
    16451756
    1646 static HostCheckBox *UseVirtualKeyboard()
     1757static HostCheckBoxSetting *UseVirtualKeyboard()
    16471758{
    1648     HostCheckBox *gc = new HostCheckBox("UseVirtualKeyboard");
     1759    HostCheckBoxSetting *gc = new HostCheckBoxSetting("UseVirtualKeyboard");
    16491760    gc->setLabel(QObject::tr("Use line edit virtual keyboards"));
    16501761    gc->setValue(true);
    16511762    gc->setHelpText(QObject::tr("If enabled, you can use a virtual keyboard "
    static HostCheckBox *UseVirtualKeyboard()  
    16541765    return gc;
    16551766}
    16561767
    1657 static HostComboBox *OverrideExitMenu()
     1768static HostComboBoxSetting *OverrideExitMenu()
    16581769{
    1659     HostComboBox *gc = new HostComboBox("OverrideExitMenu");
     1770    HostComboBoxSetting *gc = new HostComboBoxSetting("OverrideExitMenu");
    16601771    gc->setLabel(QObject::tr("Customize exit menu options"));
    16611772    gc->addSelection(QObject::tr("Default"), "0");
    16621773    gc->addSelection(QObject::tr("Show quit"), "1");
    static HostComboBox *OverrideExitMenu()  
    16711782    return gc;
    16721783}
    16731784
    1674 static HostLineEdit *RebootCommand()
     1785static HostTextEditSetting *RebootCommand()
    16751786{
    1676     HostLineEdit *ge = new HostLineEdit("RebootCommand");
     1787    HostTextEditSetting *ge = new HostTextEditSetting("RebootCommand");
    16771788    ge->setLabel(QObject::tr("Reboot command"));
    16781789    ge->setValue("");
    16791790    ge->setHelpText(QObject::tr("Optional. Script to run if you select "
    static HostLineEdit *RebootCommand()  
    16831794    return ge;
    16841795}
    16851796
    1686 static HostLineEdit *HaltCommand()
     1797static HostTextEditSetting *HaltCommand()
    16871798{
    1688     HostLineEdit *ge = new HostLineEdit("HaltCommand");
     1799    HostTextEditSetting *ge = new HostTextEditSetting("HaltCommand");
    16891800    ge->setLabel(QObject::tr("Halt command"));
    16901801    ge->setValue("");
    16911802    ge->setHelpText(QObject::tr("Optional. Script to run if you select "
    static HostLineEdit *HaltCommand()  
    16951806    return ge;
    16961807}
    16971808
    1698 static HostLineEdit *LircDaemonDevice()
     1809static HostTextEditSetting *LircDaemonDevice()
    16991810{
    1700     HostLineEdit *ge = new HostLineEdit("LircSocket");
     1811// TODO Cannot use File browser as it can be address[:port]
     1812//    HostFileBrowserSetting *ge = new HostFileBrowserSetting("LircSocket");
     1813    HostTextEditSetting *ge = new HostTextEditSetting("LircSocket");
    17011814    ge->setLabel(QObject::tr("LIRC daemon socket"));
    17021815
    17031816    /* lircd socket moved from /dev/ to /var/run/lirc/ in lirc 0.8.6 */
    static HostLineEdit *LircDaemonDevice()  
    17121825    return ge;
    17131826}
    17141827
    1715 static HostLineEdit *ScreenShotPath()
     1828static HostTextEditSetting *ScreenShotPath()
    17161829{
    1717     HostLineEdit *ge = new HostLineEdit("ScreenShotPath");
     1830    HostTextEditSetting *ge = new HostTextEditSetting("ScreenShotPath");
    17181831    ge->setLabel(QObject::tr("Screen shot path"));
    17191832    ge->setValue("/tmp/");
    17201833    ge->setHelpText(QObject::tr("Path to screenshot storage location. Should be writable by the frontend"));
    17211834    return ge;
    17221835}
    17231836
    1724 static HostLineEdit *SetupPinCode()
     1837static HostTextEditSetting *SetupPinCode()
    17251838{
    1726     HostLineEdit *ge = new HostLineEdit("SetupPinCode");
     1839    HostTextEditSetting *ge = new HostTextEditSetting("SetupPinCode");
    17271840    ge->setLabel(QObject::tr("Setup PIN code"));
    17281841    ge->setHelpText(QObject::tr("This PIN is used to control access to the "
    17291842                    "setup menus. If you want to use this feature, then "
    static HostLineEdit *SetupPinCode()  
    17321845    return ge;
    17331846}
    17341847
    1735 static HostCheckBox *SetupPinCodeRequired()
     1848static HostCheckBoxSetting *SetupPinCodeRequired()
    17361849{
    1737     HostCheckBox *gc = new HostCheckBox("SetupPinCodeRequired");
     1850    HostCheckBoxSetting *gc = new HostCheckBoxSetting("SetupPinCodeRequired");
    17381851    gc->setLabel(QObject::tr("Require setup PIN") + "    ");
    17391852    gc->setValue(false);
    17401853    gc->setHelpText(QObject::tr("If enabled, you will not be able to return "
    static HostCheckBox *SetupPinCodeRequired()  
    17431856    return gc;
    17441857}
    17451858
    1746 static HostComboBox *XineramaScreen()
     1859static HostComboBoxSetting *XineramaScreen()
    17471860{
    1748     HostComboBox *gc = new HostComboBox("XineramaScreen", false);
     1861    HostComboBoxSetting *gc = new HostComboBoxSetting("XineramaScreen");
    17491862    int num = MythDisplay::GetNumberXineramaScreens();
    17501863    for (int i=0; i<num; ++i)
    17511864        gc->addSelection(QString::number(i), QString::number(i));
    static HostComboBox *XineramaScreen()  
    17581871}
    17591872
    17601873
    1761 static HostComboBox *XineramaMonitorAspectRatio()
     1874static HostComboBoxSetting *XineramaMonitorAspectRatio()
    17621875{
    1763     HostComboBox *gc = new HostComboBox("XineramaMonitorAspectRatio");
     1876    HostComboBoxSetting *gc = new HostComboBoxSetting("XineramaMonitorAspectRatio");
    17641877    gc->setLabel(QObject::tr("Monitor aspect ratio"));
    17651878    gc->addSelection(QObject::tr("4:3"),   "1.3333");
    17661879    gc->addSelection(QObject::tr("16:9"),  "1.7777");
    static HostComboBox *XineramaMonitorAspectRatio()  
    17711884    return gc;
    17721885}
    17731886
    1774 static HostComboBox *LetterboxingColour()
     1887static HostComboBoxSetting *LetterboxingColour()
    17751888{
    1776     HostComboBox *gc = new HostComboBox("LetterboxColour");
     1889    HostComboBoxSetting *gc = new HostComboBoxSetting("LetterboxColour");
    17771890    gc->setLabel(QObject::tr("Letterboxing color"));
    17781891    for (int m = kLetterBoxColour_Black; m < kLetterBoxColour_END; ++m)
    17791892        gc->addSelection(toString((LetterBoxColour)m), QString::number(m));
    static HostComboBox *LetterboxingColour()  
    17861899    return gc;
    17871900}
    17881901
    1789 static HostComboBox *AspectOverride()
     1902static HostComboBoxSetting *AspectOverride()
    17901903{
    1791     HostComboBox *gc = new HostComboBox("AspectOverride");
     1904    HostComboBoxSetting *gc = new HostComboBoxSetting("AspectOverride");
    17921905    gc->setLabel(QObject::tr("Video aspect override"));
    17931906    for (int m = kAspect_Off; m < kAspect_END; ++m)
    17941907        gc->addSelection(toString((AspectOverrideMode)m), QString::number(m));
    static HostComboBox *AspectOverride()  
    17991912    return gc;
    18001913}
    18011914
    1802 static HostComboBox *AdjustFill()
     1915static HostComboBoxSetting *AdjustFill()
    18031916{
    1804     HostComboBox *gc = new HostComboBox("AdjustFill");
     1917    HostComboBoxSetting *gc = new HostComboBoxSetting("AdjustFill");
    18051918    gc->setLabel(QObject::tr("Zoom"));
    18061919    for (int m = kAdjustFill_Off; m < kAdjustFill_END; ++m)
    18071920        gc->addSelection(toString((AdjustFillMode)m), QString::number(m));
    static HostComboBox *AdjustFill()  
    18171930
    18181931// Theme settings
    18191932
    1820 static HostSpinBox *GuiWidth()
     1933static HostSpinBoxSetting *GuiWidth()
    18211934{
    1822     HostSpinBox *gs = new HostSpinBox("GuiWidth", 0, 1920, 8, true);
     1935    HostSpinBoxSetting *gs = new HostSpinBoxSetting("GuiWidth", 0, 1920, 8, true);
    18231936    gs->setLabel(QObject::tr("GUI width (pixels)"));
    18241937    gs->setValue(0);
    18251938    gs->setHelpText(QObject::tr("The width of the GUI. Do not make the GUI "
    static HostSpinBox *GuiWidth()  
    18281941    return gs;
    18291942}
    18301943
    1831 static HostSpinBox *GuiHeight()
     1944static HostSpinBoxSetting *GuiHeight()
    18321945{
    1833     HostSpinBox *gs = new HostSpinBox("GuiHeight", 0, 1600, 8, true);
     1946    HostSpinBoxSetting *gs = new HostSpinBoxSetting("GuiHeight", 0, 1600, 8, true);
    18341947    gs->setLabel(QObject::tr("GUI height (pixels)"));
    18351948    gs->setValue(0);
    18361949    gs->setHelpText(QObject::tr("The height of the GUI. Do not make the GUI "
    static HostSpinBox *GuiHeight()  
    18391952    return gs;
    18401953}
    18411954
    1842 static HostSpinBox *GuiOffsetX()
     1955static HostSpinBoxSetting *GuiOffsetX()
    18431956{
    1844     HostSpinBox *gs = new HostSpinBox("GuiOffsetX", -3840, 3840, 32, true);
     1957    HostSpinBoxSetting *gs = new HostSpinBoxSetting("GuiOffsetX", -3840, 3840, 32, true);
    18451958    gs->setLabel(QObject::tr("GUI X offset"));
    18461959    gs->setValue(0);
    18471960    gs->setHelpText(QObject::tr("The horizontal offset where the GUI will be "
    static HostSpinBox *GuiOffsetX()  
    18491962    return gs;
    18501963}
    18511964
    1852 static HostSpinBox *GuiOffsetY()
     1965static HostSpinBoxSetting *GuiOffsetY()
    18531966{
    1854     HostSpinBox *gs = new HostSpinBox("GuiOffsetY", -1600, 1600, 8, true);
     1967    HostSpinBoxSetting *gs = new HostSpinBoxSetting("GuiOffsetY", -1600, 1600, 8, true);
    18551968    gs->setLabel(QObject::tr("GUI Y offset"));
    18561969    gs->setValue(0);
    18571970    gs->setHelpText(QObject::tr("The vertical offset where the GUI will be "
    static HostSpinBox *DisplaySizeHeight()  
    18831996}
    18841997#endif
    18851998
    1886 static HostCheckBox *GuiSizeForTV()
     1999static HostCheckBoxSetting *GuiSizeForTV()
    18872000{
    1888     HostCheckBox *gc = new HostCheckBox("GuiSizeForTV");
     2001    HostCheckBoxSetting *gc = new HostCheckBoxSetting("GuiSizeForTV");
    18892002    gc->setLabel(QObject::tr("Use GUI size for TV playback"));
    18902003    gc->setValue(true);
    18912004    gc->setHelpText(QObject::tr("If enabled, use the above size for TV, "
    static HostCheckBox *GuiSizeForTV()  
    18942007}
    18952008
    18962009#if defined(USING_XRANDR) || CONFIG_DARWIN
    1897 static HostCheckBox *UseVideoModes()
    1898 {
    1899     HostCheckBox *gc = new HostCheckBox("UseVideoModes");
    1900     gc->setLabel(QObject::tr("Separate video modes for GUI and TV playback"));
    1901     gc->setValue(false);
    1902     gc->setHelpText(QObject::tr("Switch X Window video modes for TV. "
    1903                     "Requires \"xrandr\" support."));
    1904     return gc;
    1905 }
    19062010
    1907 static HostSpinBox *VidModeWidth(int idx)
     2011static HostSpinBoxSetting *VidModeWidth(int idx)
    19082012{
    1909     HostSpinBox *gs = new HostSpinBox(QString("VidModeWidth%1").arg(idx),
     2013    HostSpinBoxSetting *gs = new HostSpinBoxSetting(QString("VidModeWidth%1").arg(idx),
    19102014                                            0, 1920, 16, true);
    19112015    gs->setLabel((idx<1) ? QObject::tr("In X"): "");
    1912     gs->setLabelAboveWidget(idx<1);
    19132016    gs->setValue(0);
    19142017    gs->setHelpText(QObject::tr("Horizontal resolution of video "
    19152018                    "which needs a special output resolution."));
    19162019    return gs;
    19172020}
    19182021
    1919 static HostSpinBox *VidModeHeight(int idx)
     2022static HostSpinBoxSetting *VidModeHeight(int idx)
    19202023{
    1921     HostSpinBox *gs = new HostSpinBox(QString("VidModeHeight%1").arg(idx),
     2024    HostSpinBoxSetting *gs = new HostSpinBoxSetting(QString("VidModeHeight%1").arg(idx),
    19222025                                            0, 1080, 16, true);
    19232026    gs->setLabel((idx<1) ? QObject::tr("In Y"): "");
    1924     gs->setLabelAboveWidget(idx<1);
    19252027    gs->setValue(0);
    19262028    gs->setHelpText(QObject::tr("Vertical resolution of video "
    19272029                    "which needs a special output resolution."));
    19282030    return gs;
    19292031}
    19302032
    1931 static HostComboBox *GuiVidModeResolution()
     2033static HostComboBoxSetting *GuiVidModeResolution()
    19322034{
    1933     HostComboBox *gc = new HostComboBox("GuiVidModeResolution");
     2035    HostComboBoxSetting *gc = new HostComboBoxSetting("GuiVidModeResolution");
    19342036    gc->setLabel(QObject::tr("GUI"));
    1935     gc->setLabelAboveWidget(true);
    19362037    gc->setHelpText(QObject::tr("Resolution of screen "
    19372038                    "when not watching a video."));
    19382039
    static HostComboBox *GuiVidModeResolution()  
    19612062    return gc;
    19622063}
    19632064
    1964 static HostComboBox *TVVidModeResolution(int idx=-1)
     2065static HostComboBoxSetting *TVVidModeResolution(int idx=-1)
    19652066{
    19662067    QString dhelp = QObject::tr("Default screen resolution "
    19672068                                "when watching a video.");
    static HostComboBox *TVVidModeResolution(int idx=-1)  
    19702071
    19712072    QString qstr = (idx<0) ? "TVVidModeResolution" :
    19722073        QString("TVVidModeResolution%1").arg(idx);
    1973     HostComboBox *gc = new HostComboBox(qstr);
     2074    HostComboBoxSetting *gc = new HostComboBoxSetting(qstr);
    19742075    QString lstr = (idx<0) ? QObject::tr("Video output") :
    19752076        ((idx<1) ? QObject::tr("Output") : "");
    19762077    QString hstr = (idx<0) ? dhelp : ohelp;
    19772078
    19782079    gc->setLabel(lstr);
    1979     gc->setLabelAboveWidget(idx<1);
    19802080    gc->setHelpText(hstr);
    19812081
    19822082    const vector<DisplayResScreen> scr = GetVideoModes();
    static HostComboBox *TVVidModeResolution(int idx=-1)  
    19882088    return gc;
    19892089}
    19902090
    1991 static HostRefreshRateComboBox *TVVidModeRefreshRate(int idx=-1)
     2091
     2092void HostRefreshRateComboBoxSetting::ChangeResolution(StandardSetting * setting)
     2093{
     2094    clearSelections();
     2095    QString resolution = setting->getValue();
     2096
     2097    const vector<double> list = GetRefreshRates(resolution);
     2098    addSelection(QObject::tr("Auto"), "0");
     2099    int hz50 = -1, hz60 = -1;
     2100    for (uint i=0; i<list.size(); ++i)
     2101    {
     2102        QString sel = QString::number((double) list[i],'f', 3);
     2103        addSelection(sel+" Hz", sel);
     2104        hz50 = (fabs(50.0 - list[i]) < 0.01) ? i : hz50;
     2105        hz60 = (fabs(60.0 - list[i]) < 0.01) ? i : hz60;
     2106    }
     2107
     2108    setValue(0);
     2109    if ("640x480" == resolution || "720x480" == resolution)
     2110        setValue(hz60+1);
     2111    if ("640x576" == resolution || "720x576" == resolution)
     2112        setValue(hz50+1);
     2113
     2114    setEnabled(list.size());
     2115}
     2116
     2117const vector<double> HostRefreshRateComboBoxSetting::GetRefreshRates(const QString &res)
     2118{
     2119    QStringList slist = res.split("x");
     2120    int w = 0, h = 0;
     2121    bool ok0 = false, ok1 = false;
     2122    if (2 == slist.size())
     2123    {
     2124        w = slist[0].toInt(&ok0);
     2125        h = slist[1].toInt(&ok1);
     2126    }
     2127
     2128    DisplayRes *display_res = DisplayRes::GetDisplayRes();
     2129    if (display_res && ok0 && ok1)
     2130        return display_res->GetRefreshRates(w, h);
     2131
     2132    vector<double> list;
     2133    return list;
     2134}
     2135
     2136
     2137static HostRefreshRateComboBoxSetting *TVVidModeRefreshRate(int idx=-1)
    19922138{
    19932139    QString dhelp = QObject::tr("Default refresh rate "
    19942140                                "when watching a video. "
    static HostRefreshRateComboBox *TVVidModeRefreshRate(int idx=-1)  
    19982144                                "Leave at \"Auto\" to automatically use the best available");
    19992145    QString qstr = (idx<0) ? "TVVidModeRefreshRate" :
    20002146        QString("TVVidModeRefreshRate%1").arg(idx);
    2001     HostRefreshRateComboBox *gc = new HostRefreshRateComboBox(qstr);
     2147    HostRefreshRateComboBoxSetting *gc = new HostRefreshRateComboBoxSetting(qstr);
    20022148    QString lstr = (idx<1) ? QObject::tr("Rate") : "";
    20032149    QString hstr = (idx<0) ? dhelp : ohelp;
    20042150
    20052151    gc->setLabel(lstr);
    2006     gc->setLabelAboveWidget(idx<1);
    20072152    gc->setHelpText(hstr);
    20082153    gc->setEnabled(false);
    20092154    return gc;
    20102155}
    20112156
    2012 static HostComboBox *TVVidModeForceAspect(int idx=-1)
     2157static HostComboBoxSetting *TVVidModeForceAspect(int idx=-1)
    20132158{
    20142159    QString dhelp = QObject::tr("Aspect ratio when watching a video.");
    20152160    QString ohelp = QObject::tr("Aspect ratio when watching a "
    static HostComboBox *TVVidModeForceAspect(int idx=-1)  
    20172162
    20182163    QString qstr = (idx<0) ? "TVVidModeForceAspect" :
    20192164        QString("TVVidModeForceAspect%1").arg(idx);
    2020     HostComboBox *gc = new HostComboBox(qstr);
     2165    HostComboBoxSetting *gc = new HostComboBoxSetting(qstr);
    20212166    gc->setLabel( (idx<1) ? QObject::tr("Aspect") : "" );
    2022     gc->setLabelAboveWidget(idx<1);
    20232167
    20242168    QString hstr = (idx<0) ? dhelp : ohelp;
    20252169    gc->setHelpText(hstr+"  "+
    static HostComboBox *TVVidModeForceAspect(int idx=-1)  
    20322176    return gc;
    20332177}
    20342178
     2179
     2180
     2181class DefaultVideoMode : public GroupSetting
     2182{
     2183  public:
     2184    DefaultVideoMode():GroupSetting()
     2185    {
     2186        setLabel(QObject::tr("Video Mode Settings"));
     2187        m_res = TVVidModeResolution();
     2188        m_rate = TVVidModeRefreshRate();
     2189        addChild(GuiVidModeResolution());
     2190        addChild(m_res);
     2191        addChild(m_rate);
     2192        addChild(TVVidModeForceAspect());
     2193        connect(m_res, SIGNAL(valueChanged(StandardSetting *)),
     2194                m_rate, SLOT(ChangeResolution(StandardSetting *)));
     2195   }
     2196  private:
     2197    HostComboBoxSetting *m_res;
     2198    HostRefreshRateComboBoxSetting *m_rate;
     2199};
     2200
     2201
     2202class OverrideVideoMode : public GroupSetting
     2203{
     2204  public:
     2205    OverrideVideoMode (int idx):GroupSetting()
     2206    {
     2207        setLabel(QObject::tr("Override video mode #%1").arg(idx));
     2208        // input side
     2209        addChild(VidModeWidth(idx));
     2210        addChild(VidModeHeight(idx));
     2211        // output side
     2212        addChild(m_res = TVVidModeResolution(idx));
     2213        addChild(m_rate = TVVidModeRefreshRate(idx));
     2214        addChild(TVVidModeForceAspect(idx));
     2215                connect(m_res, SIGNAL(valueChanged(StandardSetting *)),
     2216                        m_rate, SLOT(ChangeResolution(StandardSetting *)));
     2217    }
     2218  private:
     2219    HostComboBoxSetting *m_res;
     2220    HostRefreshRateComboBoxSetting *m_rate;
     2221};
     2222
     2223static HostCheckBoxSetting *UseVideoModes() // replace VideoModeSettings
     2224{
     2225    HostCheckBoxSetting *gc = new HostCheckBoxSetting("UseVideoModes");
     2226    gc->setLabel(QObject::tr("Separate video modes for GUI and TV playback"));
     2227    gc->setValue(false);
     2228    gc->setHelpText(QObject::tr("Switch X Window video modes for TV. "
     2229                    "Requires \"xrandr\" support."));
     2230
     2231    gc->addTargetedChild("1",new DefaultVideoMode());
     2232
     2233    for (int idx = 0; idx < 3; ++idx)
     2234    {
     2235        gc->addTargetedChild("1",new OverrideVideoMode(idx));
     2236    }
     2237    return gc;
     2238}
     2239
     2240/*
    20352241class VideoModeSettings : public TriggeredConfigurationGroup
    20362242{
    20372243  public:
    class VideoModeSettings : public TriggeredConfigurationGroup  
    20482254        ConfigurationGroup* defaultsettings =
    20492255            new HorizontalConfigurationGroup(false, false);
    20502256
    2051         HostComboBox *res = TVVidModeResolution();
     2257        HostComboBoxSetting *res = TVVidModeResolution();
    20522258        HostRefreshRateComboBox *rate = TVVidModeRefreshRate();
    20532259        defaultsettings->addChild(GuiVidModeResolution());
    20542260        defaultsettings->addChild(res);
    class VideoModeSettings : public TriggeredConfigurationGroup  
    20812287        addTarget("1", settings);
    20822288        addTarget("0", new VerticalConfigurationGroup(true));
    20832289    }
    2084 };
     2290};*/
    20852291#endif
    20862292
    2087 static HostCheckBox *HideMouseCursor()
     2293static HostCheckBoxSetting *HideMouseCursor()
    20882294{
    2089     HostCheckBox *gc = new HostCheckBox("HideMouseCursor");
     2295    HostCheckBoxSetting *gc = new HostCheckBoxSetting("HideMouseCursor");
    20902296    gc->setLabel(QObject::tr("Hide mouse cursor in MythTV"));
    20912297    gc->setValue(false);
    20922298    gc->setHelpText(QObject::tr("Toggles mouse cursor visibility for touchscreens. "
    static HostCheckBox *HideMouseCursor()  
    20962302};
    20972303
    20982304
    2099 static HostCheckBox *RunInWindow()
     2305static HostCheckBoxSetting *RunInWindow()
    21002306{
    2101     HostCheckBox *gc = new HostCheckBox("RunFrontendInWindow");
     2307    HostCheckBoxSetting *gc = new HostCheckBoxSetting("RunFrontendInWindow");
    21022308    gc->setLabel(QObject::tr("Use window border"));
    21032309    gc->setValue(false);
    21042310    gc->setHelpText(QObject::tr("Toggles between windowed and "
    static HostCheckBox *RunInWindow()  
    21062312    return gc;
    21072313}
    21082314
    2109 static HostCheckBox *UseFixedWindowSize()
     2315static HostCheckBoxSetting *UseFixedWindowSize()
    21102316{
    21112317{
    2112     HostCheckBox *gc = new HostCheckBox("UseFixedWindowSize");
     2318    HostCheckBoxSetting *gc = new HostCheckBoxSetting("UseFixedWindowSize");
    21132319    gc->setLabel(QObject::tr("Use fixed window size"));
    21142320    gc->setValue(true);
    21152321    gc->setHelpText(QObject::tr(
    static HostCheckBox *UseFixedWindowSize()  
    21192325}
    21202326}
    21212327
    2122 static HostComboBox *MythDateFormatCB()
     2328static HostComboBoxSetting *MythDateFormatCB()
    21232329{
    2124     HostComboBox *gc = new HostComboBox("DateFormat");
     2330    HostComboBoxSetting *gc = new HostComboBoxSetting("DateFormat");
    21252331    gc->setLabel(QObject::tr("Date format"));
    21262332
    21272333    QDate sampdate = QDate::currentDate();
    static HostComboBox *MythDateFormatCB()  
    21602366    return gc;
    21612367}
    21622368
    2163 static HostComboBox *MythShortDateFormat()
     2369static HostComboBoxSetting *MythShortDateFormat()
    21642370{
    2165     HostComboBox *gc = new HostComboBox("ShortDateFormat");
     2371    HostComboBoxSetting *gc = new HostComboBoxSetting("ShortDateFormat");
    21662372    gc->setLabel(QObject::tr("Short date format"));
    21672373
    21682374    QDate sampdate = QDate::currentDate();
    static HostComboBox *MythShortDateFormat()  
    21992405    return gc;
    22002406}
    22012407
    2202 static HostComboBox *MythTimeFormat()
     2408static HostComboBoxSetting *MythTimeFormat()
    22032409{
    2204     HostComboBox *gc = new HostComboBox("TimeFormat");
     2410    HostComboBoxSetting *gc = new HostComboBoxSetting("TimeFormat");
    22052411    gc->setLabel(QObject::tr("Time format"));
    22062412
    22072413    QTime samptime = QTime::currentTime();
    static HostComboBox *MythTimeFormat()  
    22192425    return gc;
    22202426}
    22212427
    2222 static HostComboBox *ChannelFormat()
     2428static HostComboBoxSetting *ChannelFormat()
    22232429{
    2224     HostComboBox *gc = new HostComboBox("ChannelFormat");
     2430    HostComboBoxSetting *gc = new HostComboBoxSetting("ChannelFormat");
    22252431    gc->setLabel(QObject::tr("Channel format"));
    22262432    gc->addSelection(QObject::tr("number"), "<num>");
    22272433    gc->addSelection(QObject::tr("number callsign"), "<num> <sign>");
    static HostComboBox *ChannelFormat()  
    22332439    return gc;
    22342440}
    22352441
    2236 static HostComboBox *LongChannelFormat()
     2442static HostComboBoxSetting *LongChannelFormat()
    22372443{
    2238     HostComboBox *gc = new HostComboBox("LongChannelFormat");
     2444    HostComboBoxSetting *gc = new HostComboBoxSetting("LongChannelFormat");
    22392445    gc->setLabel(QObject::tr("Long channel format"));
    22402446    gc->addSelection(QObject::tr("number"), "<num>");
    22412447    gc->addSelection(QObject::tr("number callsign"), "<num> <sign>");
    static HostComboBox *LongChannelFormat()  
    22472453    return gc;
    22482454}
    22492455
    2250 static GlobalCheckBox *LiveTVPriority()
     2456static GlobalCheckBoxSetting *LiveTVPriority()
    22512457{
    2252     GlobalCheckBox *bc = new GlobalCheckBox("LiveTVPriority");
     2458    GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("LiveTVPriority");
    22532459    bc->setLabel(QObject::tr("Allow Live TV to move scheduled shows"));
    22542460    bc->setValue(false);
    22552461    bc->setHelpText(QObject::tr("If enabled, scheduled recordings will "
    static GlobalCheckBox *LiveTVPriority()  
    22582464    return bc;
    22592465}
    22602466
    2261 static HostCheckBox *ChannelGroupRememberLast()
    2262 {
    2263     HostCheckBox *gc = new HostCheckBox("ChannelGroupRememberLast");
    2264     gc->setLabel(QObject::tr("Remember last channel group"));
    2265     gc->setHelpText(QObject::tr("If enabled, the EPG will initially display "
    2266                     "only the channels from the last channel group selected. Pressing "
    2267                     "\"4\" will toggle channel group."));
    2268     gc->setValue(false);
    2269     return gc;
    2270 }
    22712467
    2272 static HostComboBox *ChannelGroupDefault()
     2468
     2469static HostComboBoxSetting *ChannelGroupDefault()
    22732470{
    2274     HostComboBox *gc = new HostComboBox("ChannelGroupDefault");
     2471    HostComboBoxSetting *gc = new HostComboBoxSetting("ChannelGroupDefault");
    22752472    gc->setLabel(QObject::tr("Default channel group"));
    22762473
    22772474    ChannelGroupList changrplist;
    static HostComboBox *ChannelGroupDefault()  
    22912488    return gc;
    22922489}
    22932490
    2294 static HostCheckBox *BrowseChannelGroup()
     2491static HostCheckBoxSetting *ChannelGroupRememberLast()
     2492{
     2493    HostCheckBoxSetting *gc = new HostCheckBoxSetting("ChannelGroupRememberLast");
     2494    gc->setLabel(QObject::tr("Remember last channel group"));
     2495    gc->setHelpText(QObject::tr("If enabled, the EPG will initially display "
     2496                    "only the channels from the last channel group selected. Pressing "
     2497                    "\"4\" will toggle channel group."));
     2498    gc->setValue(false);
     2499    gc->addTargetedChild("0", ChannelGroupDefault());
     2500    return gc;
     2501}
     2502
     2503static HostCheckBoxSetting *BrowseChannelGroup()
    22952504{
    2296     HostCheckBox *gc = new HostCheckBox("BrowseChannelGroup");
     2505    HostCheckBoxSetting *gc = new HostCheckBoxSetting("BrowseChannelGroup");
    22972506    gc->setLabel(QObject::tr("Browse/change channels from Channel Group"));
    22982507    gc->setHelpText(QObject::tr("If enabled, Live TV will browse or change "
    22992508                    "channels from the selected channel group. The \"All "
    static HostCheckBox *BrowseChannelGroup()  
    23032512    return gc;
    23042513}
    23052514
    2306 // Channel Group Settings
    2307 class ChannelGroupSettings : public TriggeredConfigurationGroup
    2308 {
    2309   public:
    2310     ChannelGroupSettings() : TriggeredConfigurationGroup(false, true, false, false)
    2311     {
    2312          setLabel(QObject::tr("Remember last channel group"));
    2313          setUseLabel(false);
    2314 
    2315          Setting* RememberChanGrpEnabled = ChannelGroupRememberLast();
    2316          addChild(RememberChanGrpEnabled);
    2317          setTrigger(RememberChanGrpEnabled);
    2318 
    2319          ConfigurationGroup* settings = new VerticalConfigurationGroup(false,false);
    2320          settings->addChild(ChannelGroupDefault());
    2321          addTarget("0", settings);
    2322 
    2323          // show nothing if RememberChanGrpEnabled is on
    2324          addTarget("1", new VerticalConfigurationGroup(true,false));
    2325      };
    2326 };
    2327 
    23282515// General RecPriorities settings
    23292516
    2330 static GlobalCheckBox *GRSchedMoveHigher()
     2517static GlobalCheckBoxSetting *GRSchedMoveHigher()
    23312518{
    2332     GlobalCheckBox *bc = new GlobalCheckBox("SchedMoveHigher");
     2519    GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("SchedMoveHigher");
    23332520    bc->setLabel(QObject::tr("Reschedule higher priorities"));
    23342521    bc->setHelpText(QObject::tr("Move higher priority programs to other "
    23352522                    "cards and showings when resolving conflicts. This "
    static GlobalCheckBox *GRSchedMoveHigher()  
    23402527    return bc;
    23412528}
    23422529
    2343 static GlobalComboBox *GRSchedOpenEnd()
     2530static GlobalComboBoxSetting *GRSchedOpenEnd()
    23442531{
    2345     GlobalComboBox *bc = new GlobalComboBox("SchedOpenEnd");
     2532    GlobalComboBoxSetting *bc = new GlobalComboBoxSetting("SchedOpenEnd");
    23462533    bc->setLabel(QObject::tr("Avoid back to back recordings"));
    23472534    bc->setHelpText(QObject::tr("Selects the situations where the scheduler "
    23482535                    "will avoid assigning shows to the same card if their "
    static GlobalComboBox *GRSchedOpenEnd()  
    23552542    return bc;
    23562543}
    23572544
    2358 static GlobalSpinBox *GRDefaultStartOffset()
     2545static GlobalSpinBoxSetting *GRDefaultStartOffset()
    23592546{
    2360     GlobalSpinBox *bs = new GlobalSpinBox("DefaultStartOffset",
     2547    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("DefaultStartOffset",
    23612548                                          -10, 30, 5, true);
    23622549    bs->setLabel(QObject::tr("Default 'Start Early' minutes for new "
    23632550                             "recording rules"));
    static GlobalSpinBox *GRDefaultStartOffset()  
    23702557    return bs;
    23712558}
    23722559
    2373 static GlobalSpinBox *GRDefaultEndOffset()
     2560static GlobalSpinBoxSetting *GRDefaultEndOffset()
    23742561{
    2375     GlobalSpinBox *bs = new GlobalSpinBox("DefaultEndOffset",
     2562    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("DefaultEndOffset",
    23762563                                          -10, 30, 5, true);
    23772564    bs->setLabel(QObject::tr("Default 'End Late' minutes for new "
    23782565                             "recording rules"));
    static GlobalSpinBox *GRDefaultEndOffset()  
    23852572    return bs;
    23862573}
    23872574
    2388 static GlobalSpinBox *GRPrefInputRecPriority()
     2575static GlobalSpinBoxSetting *GRPrefInputRecPriority()
    23892576{
    2390     GlobalSpinBox *bs = new GlobalSpinBox("PrefInputPriority", 1, 99, 1);
     2577    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("PrefInputPriority", 1, 99, 1);
    23912578    bs->setLabel(QObject::tr("Preferred input priority"));
    23922579    bs->setHelpText(QObject::tr("Additional priority when a showing "
    23932580                    "matches the preferred input selected in the 'Scheduling "
    static GlobalSpinBox *GRPrefInputRecPriority()  
    23962583    return bs;
    23972584}
    23982585
    2399 static GlobalSpinBox *GRHDTVRecPriority()
     2586static GlobalSpinBoxSetting *GRHDTVRecPriority()
    24002587{
    2401     GlobalSpinBox *bs = new GlobalSpinBox("HDTVRecPriority", -99, 99, 1);
     2588    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("HDTVRecPriority", -99, 99, 1);
    24022589    bs->setLabel(QObject::tr("HDTV recording priority"));
    24032590    bs->setHelpText(QObject::tr("Additional priority when a showing "
    24042591                    "is marked as an HDTV broadcast in the TV listings."));
    static GlobalSpinBox *GRHDTVRecPriority()  
    24062593    return bs;
    24072594}
    24082595
    2409 static GlobalSpinBox *GRWSRecPriority()
     2596static GlobalSpinBoxSetting *GRWSRecPriority()
    24102597{
    2411     GlobalSpinBox *bs = new GlobalSpinBox("WSRecPriority", -99, 99, 1);
     2598    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("WSRecPriority", -99, 99, 1);
    24122599    bs->setLabel(QObject::tr("Widescreen recording priority"));
    24132600    bs->setHelpText(QObject::tr("Additional priority when a showing "
    24142601                    "is marked as widescreen in the TV listings."));
    static GlobalSpinBox *GRWSRecPriority()  
    24162603    return bs;
    24172604}
    24182605
    2419 static GlobalSpinBox *GRAutoRecPriority()
     2606static GlobalSpinBoxSetting *GRAutoRecPriority()
    24202607{
    2421     GlobalSpinBox *bs = new GlobalSpinBox("AutoRecPriority", -99, 99, 1);
     2608    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("AutoRecPriority", -99, 99, 1);
    24222609    bs->setLabel(QObject::tr("Automatic priority range (+/-)"));
    24232610    bs->setHelpText(QObject::tr("Up to this number of priority points may "
    24242611                    "be added for titles that are usually watched soon after "
    static GlobalSpinBox *GRAutoRecPriority()  
    24282615    return bs;
    24292616}
    24302617
    2431 static GlobalSpinBox *GRSignLangRecPriority()
     2618static GlobalSpinBoxSetting *GRSignLangRecPriority()
    24322619{
    2433     GlobalSpinBox *bs = new GlobalSpinBox("SignLangRecPriority",
     2620    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("SignLangRecPriority",
    24342621                                            -99, 99, 1);
    24352622    bs->setLabel(QObject::tr("Sign language recording priority"));
    24362623    bs->setHelpText(QObject::tr("Additional priority when a showing "
    static GlobalSpinBox *GRSignLangRecPriority()  
    24392626    return bs;
    24402627}
    24412628
    2442 static GlobalSpinBox *GROnScrSubRecPriority()
     2629static GlobalSpinBoxSetting *GROnScrSubRecPriority()
    24432630{
    2444     GlobalSpinBox *bs = new GlobalSpinBox("OnScrSubRecPriority",
     2631    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("OnScrSubRecPriority",
    24452632                                            -99, 99, 1);
    24462633    bs->setLabel(QObject::tr("In-vision Subtitles Recording Priority"));
    24472634    bs->setHelpText(QObject::tr("Additional priority when a showing "
    static GlobalSpinBox *GROnScrSubRecPriority()  
    24502637    return bs;
    24512638}
    24522639
    2453 static GlobalSpinBox *GRCCRecPriority()
     2640static GlobalSpinBoxSetting *GRCCRecPriority()
    24542641{
    2455     GlobalSpinBox *bs = new GlobalSpinBox("CCRecPriority",
     2642    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("CCRecPriority",
    24562643                                            -99, 99, 1);
    24572644    bs->setLabel(QObject::tr("Subtitles/CC recording priority"));
    24582645    bs->setHelpText(QObject::tr("Additional priority when a showing "
    static GlobalSpinBox *GRCCRecPriority()  
    24622649    return bs;
    24632650}
    24642651
    2465 static GlobalSpinBox *GRHardHearRecPriority()
     2652static GlobalSpinBoxSetting *GRHardHearRecPriority()
    24662653{
    2467     GlobalSpinBox *bs = new GlobalSpinBox("HardHearRecPriority",
     2654    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("HardHearRecPriority",
    24682655                                            -99, 99, 1);
    24692656    bs->setLabel(QObject::tr("Hard of hearing priority"));
    24702657    bs->setHelpText(QObject::tr("Additional priority when a showing "
    static GlobalSpinBox *GRHardHearRecPriority()  
    24742661    return bs;
    24752662}
    24762663
    2477 static GlobalSpinBox *GRAudioDescRecPriority()
     2664static GlobalSpinBoxSetting *GRAudioDescRecPriority()
    24782665{
    2479     GlobalSpinBox *bs = new GlobalSpinBox("AudioDescRecPriority",
     2666    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("AudioDescRecPriority",
    24802667                                            -99, 99, 1);
    24812668    bs->setLabel(QObject::tr("Audio described priority"));
    24822669    bs->setHelpText(QObject::tr("Additional priority when a showing "
    static GlobalSpinBox *GRAudioDescRecPriority()  
    24852672    return bs;
    24862673}
    24872674
    2488 static GlobalSpinBox *GRSingleRecordRecPriority()
     2675static GlobalSpinBoxSetting *GRSingleRecordRecPriority()
    24892676{
    2490     GlobalSpinBox *bs = new GlobalSpinBox("SingleRecordRecPriority",
     2677    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("SingleRecordRecPriority",
    24912678                                            -99, 99, 1);
    24922679    bs->setLabel(QObject::tr("Single recordings priority"));
    24932680    bs->setHelpText(QObject::tr("Single recordings will receive this "
    static GlobalSpinBox *GRSingleRecordRecPriority()  
    24962683    return bs;
    24972684}
    24982685
    2499 static GlobalSpinBox *GRWeekslotRecordRecPriority()
     2686static GlobalSpinBoxSetting *GRWeekslotRecordRecPriority()
    25002687{
    2501     GlobalSpinBox *bs = new GlobalSpinBox("WeekslotRecordRecPriority",
     2688    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("WeekslotRecordRecPriority",
    25022689                                            -99, 99, 1);
    25032690    bs->setLabel(QObject::tr("Weekslot recordings priority"));
    25042691    bs->setHelpText(QObject::tr("Weekslot recordings will receive this "
    static GlobalSpinBox *GRWeekslotRecordRecPriority()  
    25072694    return bs;
    25082695}
    25092696
    2510 static GlobalSpinBox *GRTimeslotRecordRecPriority()
     2697static GlobalSpinBoxSetting *GRTimeslotRecordRecPriority()
    25112698{
    2512     GlobalSpinBox *bs = new GlobalSpinBox("TimeslotRecordRecPriority",
     2699    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("TimeslotRecordRecPriority",
    25132700                                            -99, 99, 1);
    25142701    bs->setLabel(QObject::tr("Timeslot recordings priority"));
    25152702    bs->setHelpText(QObject::tr("Timeslot recordings will receive this "
    static GlobalSpinBox *GRTimeslotRecordRecPriority()  
    25182705    return bs;
    25192706}
    25202707
    2521 static GlobalSpinBox *GRChannelRecordRecPriority()
     2708static GlobalSpinBoxSetting *GRChannelRecordRecPriority()
    25222709{
    2523     GlobalSpinBox *bs = new GlobalSpinBox("ChannelRecordRecPriority",
     2710    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("ChannelRecordRecPriority",
    25242711                                            -99, 99, 1);
    25252712    bs->setLabel(QObject::tr("Channel recordings priority"));
    25262713    bs->setHelpText(QObject::tr("Channel recordings will receive this "
    static GlobalSpinBox *GRChannelRecordRecPriority()  
    25292716    return bs;
    25302717}
    25312718
    2532 static GlobalSpinBox *GRAllRecordRecPriority()
     2719static GlobalSpinBoxSetting *GRAllRecordRecPriority()
    25332720{
    2534     GlobalSpinBox *bs = new GlobalSpinBox("AllRecordRecPriority",
     2721    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("AllRecordRecPriority",
    25352722                                            -99, 99, 1);
    25362723    bs->setLabel(QObject::tr("All recordings priority"));
    25372724    bs->setHelpText(QObject::tr("The 'All' recording type will receive this "
    static GlobalSpinBox *GRAllRecordRecPriority()  
    25402727    return bs;
    25412728}
    25422729
    2543 static GlobalSpinBox *GRFindOneRecordRecPriority()
     2730static GlobalSpinBoxSetting *GRFindOneRecordRecPriority()
    25442731{
    2545     GlobalSpinBox *bs = new GlobalSpinBox("FindOneRecordRecPriority",
     2732    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("FindOneRecordRecPriority",
    25462733                                            -99, 99, 1);
    25472734    bs->setLabel(QObject::tr("Find one recordings priority"));
    25482735    bs->setHelpText(QObject::tr("Find One, Find Weekly and Find Daily "
    static GlobalSpinBox *GRFindOneRecordRecPriority()  
    25522739    return bs;
    25532740}
    25542741
    2555 static GlobalSpinBox *GROverrideRecordRecPriority()
     2742static GlobalSpinBoxSetting *GROverrideRecordRecPriority()
    25562743{
    2557     GlobalSpinBox *bs = new GlobalSpinBox("OverrideRecordRecPriority",
     2744    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("OverrideRecordRecPriority",
    25582745                                            -99, 99, 1);
    25592746    bs->setLabel(QObject::tr("Override recordings priority"));
    25602747    bs->setHelpText(QObject::tr("Override recordings will receive this "
    static GlobalSpinBox *GROverrideRecordRecPriority()  
    25632750    return bs;
    25642751}
    25652752
    2566 static HostLineEdit *DefaultTVChannel()
     2753static HostTextEditSetting *DefaultTVChannel()
    25672754{
    2568     HostLineEdit *ge = new HostLineEdit("DefaultTVChannel");
     2755    HostTextEditSetting *ge = new HostTextEditSetting("DefaultTVChannel");
    25692756    ge->setLabel(QObject::tr("Guide starts at channel"));
    25702757    ge->setValue("3");
    25712758    ge->setHelpText(QObject::tr("The program guide starts on this channel if "
    static HostLineEdit *DefaultTVChannel()  
    25732760    return ge;
    25742761}
    25752762
    2576 static HostSpinBox *EPGRecThreshold()
     2763static HostSpinBoxSetting *EPGRecThreshold()
    25772764{
    2578     HostSpinBox *gs = new HostSpinBox("SelChangeRecThreshold", 1, 600, 1);
     2765    HostSpinBoxSetting *gs = new HostSpinBoxSetting("SelChangeRecThreshold", 1, 600, 1);
    25792766    gs->setLabel(QObject::tr("Record threshold"));
    25802767    gs->setValue(16);
    25812768    gs->setHelpText(QObject::tr("Pressing SELECT on a show that is at least "
    static HostSpinBox *EPGRecThreshold()  
    25842771    return gs;
    25852772}
    25862773
    2587 static HostComboBox *MythLanguage()
     2774static HostComboBoxSetting *MythLanguage()
    25882775{
    2589     HostComboBox *gc = new HostComboBox("Language");
     2776    HostComboBoxSetting *gc = new HostComboBoxSetting("Language");
    25902777    gc->setLabel(QObject::tr("Language"));
    25912778
    25922779    QMap<QString, QString> langMap = MythTranslation::getLanguages();
    static HostComboBox *MythLanguage()  
    26082795    return gc;
    26092796}
    26102797
    2611 static void ISO639_fill_selections(SelectSetting *widget, uint i)
     2798static void ISO639_fill_selections(MythUIComboBoxSetting *comboBox, uint i)
    26122799{
    2613     widget->clearSelections();
     2800    comboBox->clearSelections();
    26142801    QString q = QString("ISO639Language%1").arg(i);
    26152802    QString lang = gCoreContext->GetSetting(q, "").toLower();
    26162803
    static void ISO639_fill_selections(SelectSetting *widget, uint i)  
    26312818            desc = desc.left(idx);
    26322819
    26332820        const QString il = iso639_key_to_str3(it.key());
    2634         widget->addSelection(desc, il, il == lang);
     2821        comboBox->addSelection(desc, il, il == lang);
    26352822    }
    26362823}
    26372824
    2638 static GlobalComboBox *ISO639PreferredLanguage(uint i)
     2825static GlobalComboBoxSetting *ISO639PreferredLanguage(uint i)
    26392826{
    2640     GlobalComboBox *gc = new GlobalComboBox(QString("ISO639Language%1").arg(i));
     2827    GlobalComboBoxSetting *gc = new GlobalComboBoxSetting(QString("ISO639Language%1").arg(i));
    26412828    gc->setLabel(QObject::tr("Guide language #%1").arg(i+1));
    26422829    // We should try to get language from "MythLanguage"
    26432830    // then use code 2 to code 3 map in iso639.h
    static GlobalComboBox *ISO639PreferredLanguage(uint i)  
    26482835    return gc;
    26492836}
    26502837
    2651 static HostCheckBox *NetworkControlEnabled()
    2652 {
    2653     HostCheckBox *gc = new HostCheckBox("NetworkControlEnabled");
    2654     gc->setLabel(QObject::tr("Enable Network Remote Control interface"));
    2655     gc->setHelpText(QObject::tr("This enables support for controlling "
    2656                     "mythfrontend over the network."));
    2657     gc->setValue(false);
    2658     return gc;
    2659 }
    26602838
    2661 static HostSpinBox *NetworkControlPort()
     2839static HostSpinBoxSetting *NetworkControlPort()
    26622840{
    2663     HostSpinBox *gs = new HostSpinBox("NetworkControlPort", 1025, 65535, 1);
     2841    HostSpinBoxSetting *gs = new HostSpinBoxSetting("NetworkControlPort", 1025, 65535, 1);
    26642842    gs->setLabel(QObject::tr("Network Remote Control port"));
    26652843    gs->setValue(6546);
    26662844    gs->setHelpText(QObject::tr("This specifies what port the network remote "
    static HostSpinBox *NetworkControlPort()  
    26682846    return gs;
    26692847}
    26702848
    2671 static HostLineEdit *UDPNotifyPort()
     2849static HostTextEditSetting *UDPNotifyPort()
    26722850{
    2673     HostLineEdit *ge = new HostLineEdit("UDPNotifyPort");
     2851    HostTextEditSetting *ge = new HostTextEditSetting("UDPNotifyPort");
    26742852    ge->setLabel(QObject::tr("UDP notify port"));
    26752853    ge->setValue("6948");
    26762854    ge->setHelpText(QObject::tr("MythTV will listen for "
    static HostLineEdit *UDPNotifyPort()  
    26802858    return ge;
    26812859}
    26822860
    2683 static HostCheckBox *RealtimePriority()
     2861static HostCheckBoxSetting *NetworkControlEnabled()
    26842862{
    2685     HostCheckBox *gc = new HostCheckBox("RealtimePriority");
     2863    HostCheckBoxSetting *gc = new HostCheckBoxSetting("NetworkControlEnabled");
     2864    gc->setLabel(QObject::tr("Enable Network Remote Control interface"));
     2865    gc->setHelpText(QObject::tr("This enables support for controlling "
     2866                    "mythfrontend over the network."));
     2867    gc->setValue(false);
     2868
     2869    gc->addTargetedChild("1",NetworkControlPort());
     2870    gc->addTargetedChild("1",UDPNotifyPort());
     2871    return gc;
     2872}
     2873
     2874static HostCheckBoxSetting *RealtimePriority()
     2875{
     2876    HostCheckBoxSetting *gc = new HostCheckBoxSetting("RealtimePriority");
    26862877    gc->setLabel(QObject::tr("Enable realtime priority threads"));
    26872878    gc->setHelpText(QObject::tr("When running mythfrontend with root "
    26882879                    "privileges, some threads can be given enhanced priority. "
    static HostCheckBox *RealtimePriority()  
    26922883    return gc;
    26932884}
    26942885
    2695 static HostCheckBox *EnableMediaMon()
    2696 {
    2697     HostCheckBox *gc = new HostCheckBox("MonitorDrives");
    2698     gc->setLabel(QObject::tr("Monitor CD/DVD") +
    2699                  QObject::tr(" (and other removable devices)"));
    2700     gc->setHelpText(QObject::tr("This enables support for monitoring "
    2701                     "your CD/DVD drives for new disks and launching "
    2702                     "the proper plugin to handle them."));
    2703     gc->setValue(false);
    2704     return gc;
    2705 }
    2706 
    2707 static HostLineEdit *IgnoreMedia()
     2886static HostTextEditSetting *IgnoreMedia()
    27082887{
    2709     HostLineEdit *ge = new HostLineEdit("IgnoreDevices");
     2888    HostTextEditSetting *ge = new HostTextEditSetting("IgnoreDevices");
    27102889    ge->setLabel(QObject::tr("Ignore devices"));
    27112890    ge->setValue("");
    27122891    ge->setHelpText(QObject::tr("If there are any devices that you do not want "
    static HostLineEdit *IgnoreMedia()  
    27152894    return ge;
    27162895}
    27172896
    2718 class MythMediaSettings : public TriggeredConfigurationGroup
     2897static HostCheckBoxSetting *EnableMediaMon()
    27192898{
    2720   public:
    2721      MythMediaSettings() :
    2722          TriggeredConfigurationGroup(false, false, true, true)
    2723      {
    2724          setLabel(QObject::tr("MythMediaMonitor"));
    2725          setUseLabel(false);
    2726 
    2727          Setting* enabled = EnableMediaMon();
    2728          addChild(enabled);
    2729          setTrigger(enabled);
    2730 
    2731          ConfigurationGroup* settings = new VerticalConfigurationGroup(false);
    2732          settings->addChild(IgnoreMedia());
    2733          addTarget("1", settings);
    2734 
    2735          // show nothing if fillEnabled is off
    2736          addTarget("0", new VerticalConfigurationGroup(true));
    2737      };
    2738 };
    2739 
     2899    HostCheckBoxSetting *gc = new HostCheckBoxSetting("MonitorDrives");
     2900    gc->setLabel(QObject::tr("Media Monitor"));
     2901    gc->setHelpText(QObject::tr("This enables support for monitoring "
     2902                    "your CD/DVD drives for new disks and launching "
     2903                    "the proper plugin to handle them."));
     2904    gc->setValue(false);
     2905    gc->addTargetedChild("1", IgnoreMedia());
     2906    return gc;
     2907}
    27402908
    2741 static HostComboBox *DisplayGroupTitleSort()
     2909static HostComboBoxSetting *DisplayGroupTitleSort()
    27422910{
    2743     HostComboBox *gc = new HostComboBox("DisplayGroupTitleSort");
     2911    HostComboBoxSetting *gc = new HostComboBoxSetting("DisplayGroupTitleSort");
    27442912    gc->setLabel(QObject::tr("Sort titles"));
    27452913    gc->addSelection(QObject::tr("Alphabetically"),
    27462914            QString::number(PlaybackBox::TitleSortAlphabetical));
    static HostComboBox *DisplayGroupTitleSort()  
    27512919    return gc;
    27522920}
    27532921
    2754 static HostCheckBox *PlaybackWatchList()
     2922static HostCheckBoxSetting *PlaybackWLStart()
    27552923{
    2756     HostCheckBox *gc = new HostCheckBox("PlaybackWatchList");
    2757     gc->setLabel(QObject::tr("Include the 'Watch List' group"));
    2758     gc->setValue(true);
    2759     gc->setHelpText(QObject::tr("The 'Watch List' is an abbreviated list of "
    2760                                 "recordings sorted to highlight series and "
    2761                                 "shows that need attention in order to "
    2762                                 "keep up to date."));
    2763     return gc;
    2764 }
    2765 
    2766 static HostCheckBox *PlaybackWLStart()
    2767 {
    2768     HostCheckBox *gc = new HostCheckBox("PlaybackWLStart");
     2924    HostCheckBoxSetting *gc = new HostCheckBoxSetting("PlaybackWLStart");
    27692925    gc->setLabel(QObject::tr("Start from the Watch List view"));
    27702926    gc->setValue(false);
    27712927    gc->setHelpText(QObject::tr("If enabled, the 'Watch List' will be the "
    static HostCheckBox *PlaybackWLStart()  
    27742930    return gc;
    27752931}
    27762932
    2777 static HostCheckBox *PlaybackWLAutoExpire()
     2933static HostCheckBoxSetting *PlaybackWLAutoExpire()
    27782934{
    2779     HostCheckBox *gc = new HostCheckBox("PlaybackWLAutoExpire");
     2935    HostCheckBoxSetting *gc = new HostCheckBoxSetting("PlaybackWLAutoExpire");
    27802936    gc->setLabel(QObject::tr("Exclude recordings not set for Auto-Expire"));
    27812937    gc->setValue(false);
    27822938    gc->setHelpText(QObject::tr("Set this if you turn off Auto-Expire only "
    static HostCheckBox *PlaybackWLAutoExpire()  
    27862942    return gc;
    27872943}
    27882944
    2789 static HostSpinBox *PlaybackWLMaxAge()
     2945static HostSpinBoxSetting *PlaybackWLMaxAge()
    27902946{
    2791     HostSpinBox *gs = new HostSpinBox("PlaybackWLMaxAge", 30, 180, 10);
     2947    HostSpinBoxSetting *gs = new HostSpinBoxSetting("PlaybackWLMaxAge", 30, 180, 10);
    27922948    gs->setLabel(QObject::tr("Maximum days counted in the score"));
    27932949    gs->setValue(60);
    27942950    gs->setHelpText(QObject::tr("The 'Watch List' scores are based on 1 point "
    static HostSpinBox *PlaybackWLMaxAge()  
    27982954    return gs;
    27992955}
    28002956
    2801 static HostSpinBox *PlaybackWLBlackOut()
     2957static HostSpinBoxSetting *PlaybackWLBlackOut()
    28022958{
    2803     HostSpinBox *gs = new HostSpinBox("PlaybackWLBlackOut", 0, 5, 1);
     2959    HostSpinBoxSetting *gs = new HostSpinBoxSetting("PlaybackWLBlackOut", 0, 5, 1);
    28042960    gs->setLabel(QObject::tr("Days to exclude weekly episodes after delete"));
    28052961    gs->setValue(2);
    28062962    gs->setHelpText(QObject::tr("When an episode is deleted or marked as "
    static HostSpinBox *PlaybackWLBlackOut()  
    28112967    return gs;
    28122968}
    28132969
    2814 class WatchListSettings : public TriggeredConfigurationGroup
     2970static HostCheckBoxSetting *PlaybackWatchList()
    28152971{
    2816   public:
    2817      WatchListSettings() :
    2818          TriggeredConfigurationGroup(false, false, true, true)
    2819      {
    2820 
    2821          Setting* watchList = PlaybackWatchList();
    2822          addChild(watchList);
    2823          setTrigger(watchList);
    2824 
    2825          ConfigurationGroup* settings = new VerticalConfigurationGroup(false);
    2826          settings->addChild(PlaybackWLStart());
    2827          settings->addChild(PlaybackWLAutoExpire());
    2828          settings->addChild(PlaybackWLMaxAge());
    2829          settings->addChild(PlaybackWLBlackOut());
    2830          addTarget("1", settings);
    2831 
    2832          addTarget("0", new VerticalConfigurationGroup(true));
    2833     };
    2834 };
     2972    HostCheckBoxSetting *gc = new HostCheckBoxSetting("PlaybackWatchList");
     2973    gc->setLabel(QObject::tr("Include the 'Watch List' group"));
     2974    gc->setValue(true);
     2975    gc->setHelpText(QObject::tr("The 'Watch List' is an abbreviated list of "
     2976                                "recordings sorted to highlight series and "
     2977                                "shows that need attention in order to "
     2978                                "keep up to date."));
     2979
     2980    gc->addTargetedChild("1", PlaybackWLStart());
     2981    gc->addTargetedChild("1", PlaybackWLAutoExpire());
     2982    gc->addTargetedChild("1", PlaybackWLMaxAge());
     2983    gc->addTargetedChild("1", PlaybackWLBlackOut());
     2984    return gc;
     2985}
    28352986
    2836 static HostCheckBox *LCDShowTime()
     2987static HostCheckBoxSetting *LCDShowTime()
    28372988{
    2838     HostCheckBox *gc = new HostCheckBox("LCDShowTime");
     2989    HostCheckBoxSetting *gc = new HostCheckBoxSetting("LCDShowTime");
    28392990    gc->setLabel(QObject::tr("Display time"));
    28402991    gc->setHelpText(QObject::tr("Display current time on idle LCD display. "));
    28412992    gc->setValue(true);
    28422993    return gc;
    28432994}
    28442995
    2845 static HostCheckBox *LCDShowRecStatus()
     2996static HostCheckBoxSetting *LCDShowRecStatus()
    28462997{
    2847     HostCheckBox *gc = new HostCheckBox("LCDShowRecStatus");
     2998    HostCheckBoxSetting *gc = new HostCheckBoxSetting("LCDShowRecStatus");
    28482999    gc->setLabel(QObject::tr("Display recording status"));
    28493000    gc->setHelpText(QObject::tr("Display current recordings information on "
    28503001                                "LCD display."));
    static HostCheckBox *LCDShowRecStatus()  
    28523003    return gc;
    28533004}
    28543005
    2855 static HostCheckBox *LCDShowMenu()
     3006static HostCheckBoxSetting *LCDShowMenu()
    28563007{
    2857     HostCheckBox *gc = new HostCheckBox("LCDShowMenu");
     3008    HostCheckBoxSetting *gc = new HostCheckBoxSetting("LCDShowMenu");
    28583009    gc->setLabel(QObject::tr("Display menus"));
    28593010    gc->setHelpText(QObject::tr("Display selected menu on LCD display. "));
    28603011    gc->setValue(true);
    28613012    return gc;
    28623013}
    28633014
    2864 static HostSpinBox *LCDPopupTime()
     3015static HostSpinBoxSetting *LCDPopupTime()
    28653016{
    2866     HostSpinBox *gs = new HostSpinBox("LCDPopupTime", 1, 300, 1, true);
     3017    HostSpinBoxSetting *gs = new HostSpinBoxSetting("LCDPopupTime", 1, 300, 1, true);
    28673018    gs->setLabel(QObject::tr("Menu pop-up time"));
    28683019    gs->setHelpText(QObject::tr("How many seconds the menu will "
    28693020                    "remain visible after navigation."));
    static HostSpinBox *LCDPopupTime()  
    28713022    return gs;
    28723023}
    28733024
    2874 static HostCheckBox *LCDShowMusic()
     3025static HostCheckBoxSetting *LCDShowMusic()
    28753026{
    2876     HostCheckBox *gc = new HostCheckBox("LCDShowMusic");
     3027    HostCheckBoxSetting *gc = new HostCheckBoxSetting("LCDShowMusic");
    28773028    gc->setLabel(QObject::tr("Display music artist and title"));
    28783029    gc->setHelpText(QObject::tr("Display playing artist and song title in "
    28793030                    "MythMusic on LCD display."));
    static HostCheckBox *LCDShowMusic()  
    28813032    return gc;
    28823033}
    28833034
    2884 static HostComboBox *LCDShowMusicItems()
     3035static HostComboBoxSetting *LCDShowMusicItems()
    28853036{
    2886     HostComboBox *gc = new HostComboBox("LCDShowMusicItems");
     3037    HostComboBoxSetting *gc = new HostComboBoxSetting("LCDShowMusicItems");
    28873038    gc->setLabel(QObject::tr("Items"));
    28883039    gc->addSelection(QObject::tr("Artist - Title"), "ArtistTitle");
    28893040    gc->addSelection(QObject::tr("Artist [Album] Title"), "ArtistAlbumTitle");
    static HostComboBox *LCDShowMusicItems()  
    28913042    return gc;
    28923043}
    28933044
    2894 static HostCheckBox *LCDShowChannel()
     3045static HostCheckBoxSetting *LCDShowChannel()
    28953046{
    2896     HostCheckBox *gc = new HostCheckBox("LCDShowChannel");
     3047    HostCheckBoxSetting *gc = new HostCheckBoxSetting("LCDShowChannel");
    28973048    gc->setLabel(QObject::tr("Display channel information"));
    28983049    gc->setHelpText(QObject::tr("Display tuned channel information on LCD display."));
    28993050    gc->setValue(true);
    29003051    return gc;
    29013052}
    29023053
    2903 static HostCheckBox *LCDShowVolume()
     3054static HostCheckBoxSetting *LCDShowVolume()
    29043055{
    2905     HostCheckBox *gc = new HostCheckBox("LCDShowVolume");
     3056    HostCheckBoxSetting *gc = new HostCheckBoxSetting("LCDShowVolume");
    29063057    gc->setLabel(QObject::tr("Display volume information"));
    29073058    gc->setHelpText(QObject::tr("Display volume level information "
    29083059                                "on LCD display."));
    static HostCheckBox *LCDShowVolume()  
    29103061    return gc;
    29113062}
    29123063
    2913 static HostCheckBox *LCDShowGeneric()
     3064static HostCheckBoxSetting *LCDShowGeneric()
    29143065{
    2915     HostCheckBox *gc = new HostCheckBox("LCDShowGeneric");
     3066    HostCheckBoxSetting *gc = new HostCheckBoxSetting("LCDShowGeneric");
    29163067    gc->setLabel(QObject::tr("Display generic information"));
    29173068    gc->setHelpText(QObject::tr("Display generic information on LCD display."));
    29183069    gc->setValue(true);
    29193070    return gc;
    29203071}
    29213072
    2922 static HostCheckBox *LCDBacklightOn()
     3073static HostCheckBoxSetting *LCDBacklightOn()
    29233074{
    2924     HostCheckBox *gc = new HostCheckBox("LCDBacklightOn");
     3075    HostCheckBoxSetting *gc = new HostCheckBoxSetting("LCDBacklightOn");
    29253076    gc->setLabel(QObject::tr("Backlight always on"));
    29263077    gc->setHelpText(QObject::tr("Turn on the backlight permanently "
    29273078                                "on the LCD display."));
    static HostCheckBox *LCDBacklightOn()  
    29293080    return gc;
    29303081}
    29313082
    2932 static HostCheckBox *LCDHeartBeatOn()
     3083static HostCheckBoxSetting *LCDHeartBeatOn()
    29333084{
    2934     HostCheckBox *gc = new HostCheckBox("LCDHeartBeatOn");
     3085    HostCheckBoxSetting *gc = new HostCheckBoxSetting("LCDHeartBeatOn");
    29353086    gc->setLabel(QObject::tr("Heartbeat always on"));
    29363087    gc->setHelpText(QObject::tr("Turn on the LCD heartbeat."));
    29373088    gc->setValue(false);
    29383089    return gc;
    29393090}
    29403091
    2941 static HostCheckBox *LCDBigClock()
     3092static HostCheckBoxSetting *LCDBigClock()
    29423093{
    2943     HostCheckBox *gc = new HostCheckBox("LCDBigClock");
     3094    HostCheckBoxSetting *gc = new HostCheckBoxSetting("LCDBigClock");
    29443095    gc->setLabel(QObject::tr("Display large clock"));
    29453096    gc->setHelpText(QObject::tr("On multiline displays try and display the time as large as possible."));
    29463097    gc->setValue(false);
    29473098    return gc;
    29483099}
    29493100
    2950 static HostLineEdit *LCDKeyString()
     3101static HostTextEditSetting *LCDKeyString()
    29513102{
    2952     HostLineEdit *ge = new HostLineEdit("LCDKeyString");
     3103    HostTextEditSetting *ge = new HostTextEditSetting("LCDKeyString");
    29533104    ge->setLabel(QObject::tr("LCD key order"));
    29543105    ge->setValue("ABCDEF");
    29553106    ge->setHelpText(QObject::tr("Enter the 6 Keypad Return Codes for your "
    static HostLineEdit *LCDKeyString()  
    29603111    return ge;
    29613112}
    29623113
    2963 static HostCheckBox *LCDEnable()
     3114static HostCheckBoxSetting *LCDEnable()
    29643115{
    2965     HostCheckBox *gc = new HostCheckBox("LCDEnable");
     3116    HostCheckBoxSetting *gc = new HostCheckBoxSetting("LCDEnable");
    29663117    gc->setLabel(QObject::tr("Enable LCD device"));
    29673118    gc->setHelpText(QObject::tr("Use an LCD display to view MythTV status "
    29683119                    "information."));
    29693120    gc->setValue(false);
     3121    gc->addTargetedChild("1",LCDShowTime());
     3122    gc->addTargetedChild("1",LCDShowMenu());
     3123    gc->addTargetedChild("1",LCDShowMusic());
     3124    gc->addTargetedChild("1",LCDShowMusicItems());
     3125    gc->addTargetedChild("1",LCDShowChannel());
     3126    gc->addTargetedChild("1",LCDShowRecStatus());
     3127    gc->addTargetedChild("1",LCDShowVolume());
     3128    gc->addTargetedChild("1",LCDShowGeneric());
     3129    gc->addTargetedChild("1",LCDBacklightOn());
     3130    gc->addTargetedChild("1",LCDHeartBeatOn());
     3131    gc->addTargetedChild("1",LCDBigClock());
     3132    gc->addTargetedChild("1",LCDKeyString());
     3133    gc->addTargetedChild("1",LCDPopupTime());
    29703134    return gc;
    29713135}
    29723136
    2973 class LcdSettings : public TriggeredConfigurationGroup
    2974 {
    2975   public:
    2976     LcdSettings() : TriggeredConfigurationGroup(false, false,  false, false,
    2977                                                 false, false, false, false)
    2978     {
    2979          setLabel(QObject::tr("LCD device display"));
    2980          setUseLabel(false);
    2981 
    2982          Setting* lcd_enable = LCDEnable();
    2983          addChild(lcd_enable);
    2984          setTrigger(lcd_enable);
    2985 
    2986          ConfigurationGroup *settings =
    2987              new VerticalConfigurationGroup(false, true, false, false);
    2988          ConfigurationGroup *setHoriz =
    2989              new HorizontalConfigurationGroup(false, false, false, false);
    2990 
    2991          ConfigurationGroup* setLeft  =
    2992              new VerticalConfigurationGroup(false, false, false, false);
    2993          ConfigurationGroup* setRight =
    2994              new VerticalConfigurationGroup(false, false, false, false);
    2995 
    2996          setLeft->addChild(LCDShowTime());
    2997          setLeft->addChild(LCDShowMenu());
    2998          setLeft->addChild(LCDShowMusic());
    2999          setLeft->addChild(LCDShowMusicItems());
    3000          setLeft->addChild(LCDShowChannel());
    3001          setLeft->addChild(LCDShowRecStatus());
    3002          setRight->addChild(LCDShowVolume());
    3003          setRight->addChild(LCDShowGeneric());
    3004          setRight->addChild(LCDBacklightOn());
    3005          setRight->addChild(LCDHeartBeatOn());
    3006          setRight->addChild(LCDBigClock());
    3007          setRight->addChild(LCDKeyString());
    3008          setHoriz->addChild(setLeft);
    3009          setHoriz->addChild(setRight);
    3010          settings->addChild(setHoriz);
    3011          settings->addChild(LCDPopupTime());
    3012 
    3013          addTarget("1", settings);
    3014 
    3015          addTarget("0", new VerticalConfigurationGroup(true));
    3016     };
    3017 };
    3018 
    30193137
    30203138#if CONFIG_DARWIN
    3021 static HostCheckBox *MacGammaCorrect()
     3139static HostCheckBoxSetting *MacGammaCorrect()
    30223140{
    3023     HostCheckBox *gc = new HostCheckBox("MacGammaCorrect");
     3141    HostCheckBoxSetting *gc = new HostCheckBoxSetting("MacGammaCorrect");
    30243142    gc->setLabel(QObject::tr("Enable gamma correction for video"));
    30253143    gc->setValue(false);
    30263144    gc->setHelpText(QObject::tr("If enabled, QuickTime will correct the gamma "
    static HostCheckBox *MacGammaCorrect()  
    30293147    return gc;
    30303148}
    30313149
    3032 static HostCheckBox *MacScaleUp()
     3150static HostCheckBoxSetting *MacScaleUp()
    30333151{
    3034     HostCheckBox *gc = new HostCheckBox("MacScaleUp");
     3152    HostCheckBoxSetting *gc = new HostCheckBoxSetting("MacScaleUp");
    30353153    gc->setLabel(QObject::tr("Scale video as necessary"));
    30363154    gc->setValue(true);
    30373155    gc->setHelpText(QObject::tr("If enabled, video will be scaled to fit your "
    static HostCheckBox *MacScaleUp()  
    30403158    return gc;
    30413159}
    30423160
    3043 static HostSpinBox *MacFullSkip()
     3161static HostSpinBoxSetting *MacFullSkip()
    30443162{
    3045     HostSpinBox *gs = new HostSpinBox("MacFullSkip", 0, 30, 1, true);
     3163    HostSpinBoxSetting *gs = new HostSpinBoxSetting("MacFullSkip", 0, 30, 1, true);
    30463164    gs->setLabel(QObject::tr("Frames to skip in fullscreen mode"));
    30473165    gs->setValue(0);
    30483166    gs->setHelpText(QObject::tr("Video displayed in fullscreen or non-windowed "
    static HostSpinBox *MacFullSkip()  
    30533171    return gs;
    30543172}
    30553173
    3056 static HostCheckBox *MacMainEnabled()
    3057 {
    3058     HostCheckBox *gc = new HostCheckBox("MacMainEnabled");
    3059     gc->setLabel(QObject::tr("Video in main window"));
    3060     gc->setValue(true);
    3061     gc->setHelpText(QObject::tr("If enabled, video will be displayed in the "
    3062                     "main GUI window. Disable this when you only want video "
    3063                     "on the desktop or in a floating window. Only valid when "
    3064                     "\"Use GUI size for TV playback\" and \"Run the "
    3065                     "frontend in a window\" are checked."));
    3066     return gc;
    3067 }
    30683174
    3069 static HostSpinBox *MacMainSkip()
     3175
     3176static HostSpinBoxSetting *MacMainSkip()
    30703177{
    3071     HostSpinBox *gs = new HostSpinBox("MacMainSkip", 0, 30, 1, true);
     3178    HostSpinBoxSetting *gs = new HostSpinBoxSetting("MacMainSkip", 0, 30, 1, true);
    30723179    gs->setLabel(QObject::tr("Frames to skip"));
    30733180    gs->setValue(0);
    30743181    gs->setHelpText(QObject::tr("Video in the main window will skip this many "
    static HostSpinBox *MacMainSkip()  
    30773184    return gs;
    30783185}
    30793186
    3080 static HostSpinBox *MacMainOpacity()
     3187static HostSpinBoxSetting *MacMainOpacity()
    30813188{
    3082     HostSpinBox *gs = new HostSpinBox("MacMainOpacity", 0, 100, 5, false);
     3189    HostSpinBoxSetting *gs = new HostSpinBoxSetting("MacMainOpacity", 0, 100, 5, false);
    30833190    gs->setLabel(QObject::tr("Opacity"));
    30843191    gs->setValue(100);
    30853192    gs->setHelpText(QObject::tr("The opacity of the main window. Set to "
    static HostSpinBox *MacMainOpacity()  
    30883195    return gs;
    30893196}
    30903197
    3091 class MacMainSettings : public TriggeredConfigurationGroup
     3198static HostCheckBoxSetting *MacMainEnabled()
    30923199{
    3093   public:
    3094     MacMainSettings() : TriggeredConfigurationGroup(false)
    3095     {
    3096         setLabel(QObject::tr("Video in main window"));
    3097         setUseLabel(false);
    3098         Setting *gc = MacMainEnabled();
    3099         addChild(gc);
    3100         setTrigger(gc);
    3101 
    3102         VerticalConfigurationGroup *opts =
    3103             new VerticalConfigurationGroup(false, false);
    3104         opts->addChild(MacMainSkip());
    3105         opts->addChild(MacMainOpacity());
    3106 
    3107         addTarget("1", opts);
    3108         addTarget("0", new VerticalConfigurationGroup(false, false));
    3109     }
    3110 };
     3200    HostCheckBoxSetting *gc = new HostCheckBoxSetting("MacMainEnabled");
     3201    gc->setLabel(QObject::tr("Video in main window"));
     3202    gc->setValue(true);
     3203    gc->setHelpText(QObject::tr("If enabled, video will be displayed in the "
     3204                    "main GUI window. Disable this when you only want video "
     3205                    "on the desktop or in a floating window. Only valid when "
     3206                    "\"Use GUI size for TV playback\" and \"Run the "
     3207                    "frontend in a window\" are checked."));
    31113208
    3112 static HostCheckBox *MacFloatEnabled()
    3113 {
    3114     HostCheckBox *gc = new HostCheckBox("MacFloatEnabled");
    3115     gc->setLabel(QObject::tr("Video in floating window"));
    3116     gc->setValue(false);
    3117     gc->setHelpText(QObject::tr("If enabled, video will be displayed in a "
    3118                     "floating window. Only valid when \"Use GUI size for TV "
    3119                     "playback\" and \"Run the frontend in a window\" are "
    3120                     "checked."));
     3209    gc->addTargetedChild("1", MacMainSkip());
     3210    gc->addTargetedChild("1", MacMainOpacity());
    31213211    return gc;
    31223212}
    31233213
    3124 static HostSpinBox *MacFloatSkip()
     3214static HostSpinBoxSetting *MacFloatSkip()
    31253215{
    3126     HostSpinBox *gs = new HostSpinBox("MacFloatSkip", 0, 30, 1, true);
     3216    HostSpinBoxSetting *gs = new HostSpinBoxSetting("MacFloatSkip", 0, 30, 1, true);
    31273217    gs->setLabel(QObject::tr("Frames to skip"));
    31283218    gs->setValue(0);
    31293219    gs->setHelpText(QObject::tr("Video in the floating window will skip "
    static HostSpinBox *MacFloatSkip()  
    31323222    return gs;
    31333223}
    31343224
    3135 static HostSpinBox *MacFloatOpacity()
     3225static HostSpinBoxSetting *MacFloatOpacity()
    31363226{
    3137     HostSpinBox *gs = new HostSpinBox("MacFloatOpacity", 0, 100, 5, false);
     3227    HostSpinBoxSetting *gs = new HostSpinBoxSetting("MacFloatOpacity", 0, 100, 5, false);
    31383228    gs->setLabel(QObject::tr("Opacity"));
    31393229    gs->setValue(100);
    31403230    gs->setHelpText(QObject::tr("The opacity of the floating window. Set to "
    static HostSpinBox *MacFloatOpacity()  
    31433233    return gs;
    31443234}
    31453235
    3146 class MacFloatSettings : public TriggeredConfigurationGroup
     3236static HostCheckBoxSetting *MacFloatEnabled()
    31473237{
    3148   public:
    3149     MacFloatSettings() : TriggeredConfigurationGroup(false)
    3150     {
    3151         setLabel(QObject::tr("Video in floating window"));
    3152         setUseLabel(false);
    3153         Setting *gc = MacFloatEnabled();
    3154         addChild(gc);
    3155         setTrigger(gc);
     3238    HostCheckBoxSetting *gc = new HostCheckBoxSetting("MacFloatEnabled");
     3239    gc->setLabel(QObject::tr("Video in floating window"));
     3240    gc->setValue(false);
     3241    gc->setHelpText(QObject::tr("If enabled, video will be displayed in a "
     3242                    "floating window. Only valid when \"Use GUI size for TV "
     3243                    "playback\" and \"Run the frontend in a window\" are "
     3244                    "checked."));
    31563245
    3157         VerticalConfigurationGroup *opts =
    3158             new VerticalConfigurationGroup(false, false);
    3159         opts->addChild(MacFloatSkip());
    3160         opts->addChild(MacFloatOpacity());
     3246    gc->addTargetedChild("1", MacFloatSkip());
     3247    gc->addTargetedChild("1", MacFloatOpacity());
     3248    return gc;
     3249}
    31613250
    3162         addTarget("1", opts);
    3163         addTarget("0", new VerticalConfigurationGroup(false, false));
    3164     }
    3165 };
     3251static HostSpinBoxSetting *MacDockSkip()
     3252{
     3253    HostSpinBoxSetting *gs = new HostSpinBoxSetting("MacDockSkip", 0, 30, 1, true);
     3254    gs->setLabel(QObject::tr("Frames to skip"));
     3255    gs->setValue(3);
     3256    gs->setHelpText(QObject::tr("Video in the dock icon will skip this many "
     3257                    "frames for each frame drawn. Set to 0 to show "
     3258                    "every frame."));
     3259    return gs;
     3260}
    31663261
    3167 static HostCheckBox *MacDockEnabled()
     3262static HostCheckBoxSetting *MacDockEnabled()
    31683263{
    3169     HostCheckBox *gc = new HostCheckBox("MacDockEnabled");
     3264    HostCheckBoxSetting *gc = new HostCheckBoxSetting("MacDockEnabled");
    31703265    gc->setLabel(QObject::tr("Video in the dock"));
    31713266    gc->setValue(true);
    31723267    gc->setHelpText(QObject::tr("If enabled, video will be displayed in the "
    31733268                    "application's dock icon. Only valid when \"Use GUI size "
    31743269                    "for TV playback\" and \"Run the frontend in a window\" "
    31753270                    "are checked."));
     3271    gc->addTargetedChild("1", MacDockSkip());
     3272   
    31763273    return gc;
    31773274}
    31783275
    3179 static HostSpinBox *MacDockSkip()
     3276static HostSpinBoxSetting *MacDesktopSkip()
    31803277{
    3181     HostSpinBox *gs = new HostSpinBox("MacDockSkip", 0, 30, 1, true);
     3278    HostSpinBoxSetting *gs = new HostSpinBoxSetting("MacDesktopSkip", 0, 30, 1, true);
    31823279    gs->setLabel(QObject::tr("Frames to skip"));
    3183     gs->setValue(3);
    3184     gs->setHelpText(QObject::tr("Video in the dock icon will skip this many "
     3280    gs->setValue(0);
     3281    gs->setHelpText(QObject::tr("Video on the desktop will skip this many "
    31853282                    "frames for each frame drawn. Set to 0 to show "
    31863283                    "every frame."));
    31873284    return gs;
    31883285}
    31893286
    3190 class MacDockSettings : public TriggeredConfigurationGroup
    3191 {
    3192   public:
    3193     MacDockSettings() : TriggeredConfigurationGroup(false)
    3194     {
    3195         setLabel(QObject::tr("Video in the dock"));
    3196         setUseLabel(false);
    3197         Setting *gc = MacDockEnabled();
    3198         addChild(gc);
    3199         setTrigger(gc);
    3200 
    3201         Setting *skip = MacDockSkip();
    3202         addTarget("1", skip);
    3203         addTarget("0", new HorizontalConfigurationGroup(false, false));
    3204     }
    3205 };
    3206 
    3207 static HostCheckBox *MacDesktopEnabled()
     3287static HostCheckBoxSetting *MacDesktopEnabled()
    32083288{
    3209     HostCheckBox *gc = new HostCheckBox("MacDesktopEnabled");
     3289    HostCheckBoxSetting *gc = new HostCheckBoxSetting("MacDesktopEnabled");
    32103290    gc->setLabel(QObject::tr("Video on the desktop"));
    32113291    gc->setValue(false);
    32123292    gc->setHelpText(QObject::tr("If enabled, video will be displayed on the "
    32133293                    "desktop, behind the Finder icons. Only valid when \"Use "
    32143294                    "GUI size for TV playback\" and \"Run the frontend in a "
    32153295                    "window\" are checked."));
     3296
     3297    gc->addTarget("1", MacDesktopSkip());
     3298
    32163299    return gc;
    32173300}
    32183301
    3219 static HostSpinBox *MacDesktopSkip()
     3302#endif
     3303
     3304static HostCheckBoxSetting *WatchTVGuide()
    32203305{
    3221     HostSpinBox *gs = new HostSpinBox("MacDesktopSkip", 0, 30, 1, true);
    3222     gs->setLabel(QObject::tr("Frames to skip"));
    3223     gs->setValue(0);
    3224     gs->setHelpText(QObject::tr("Video on the desktop will skip this many "
    3225                     "frames for each frame drawn. Set to 0 to show "
    3226                     "every frame."));
    3227     return gs;
     3306    HostCheckBoxSetting *gc = new HostCheckBoxSetting("WatchTVGuide");
     3307    gc->setLabel(QObject::tr("Show the program guide when starting Live TV"));
     3308    gc->setHelpText(QObject::tr("This starts the program guide immediately "
     3309             "upon starting to watch Live TV."));
     3310    gc->setValue(false);
     3311    return gc;
    32283312}
    32293313
    3230 class MacDesktopSettings : public TriggeredConfigurationGroup
     3314
     3315/* This code is a duplication the class DatabaseSettings. As it it also use bymythbackend I rewrote here for the time being */
     3316
     3317class DatabaseGroupSetting : public GroupSetting
    32313318{
    32323319  public:
    3233     MacDesktopSettings() : TriggeredConfigurationGroup(false)
     3320    DatabaseGroupSetting(const QString &DBhostOverride = QString::null):GroupSetting()
    32343321    {
    3235         setLabel(QObject::tr("Video on the desktop"));
    3236         setUseLabel(false);
    3237         Setting *gc = MacDesktopEnabled();
    3238         addChild(gc);
    3239         setTrigger(gc);
    3240 
    3241         Setting *skip = MacDesktopSkip();
    3242         addTarget("1", skip);
    3243         addTarget("0", new HorizontalConfigurationGroup(false, false));
     3322        m_DBhostOverride = DBhostOverride;
     3323
     3324        setLabel(QObject::tr("Database Configuration"));
     3325
     3326        MSqlQuery query(MSqlQuery::InitCon());
     3327        if (query.isConnected())
     3328            setHelpText(QObject::tr("All database settings take effect when "
     3329                                       "you restart this program."));
     3330        else
     3331            setHelpText(QObject::tr("MythTV could not connect to the database. "
     3332                                       "Please verify your database settings "
     3333                                       "below."));
     3334
     3335        dbHostName = new TransTextEditSetting();
     3336        dbHostName->setLabel(QObject::tr("Hostname"));
     3337        dbHostName->setHelpText(QObject::tr("The host name or IP address of "
     3338                                        "the machine hosting the database. "
     3339                                        "This information is required."));
     3340        addChild(dbHostName);
     3341
     3342        dbHostPing = new TransMythUICheckBoxSetting();
     3343        dbHostPing->setLabel(QObject::tr("Ping test server?"));
     3344        dbHostPing->setHelpText(QObject::tr("Test basic host connectivity using "
     3345                                            "the ping command. Turn off if your "
     3346                                            "host or network don't support ping "
     3347                                            "(ICMP ECHO) packets"));
     3348        addChild(dbHostPing);
     3349
     3350        dbPort = new TransTextEditSetting();
     3351        dbPort->setLabel(QObject::tr("Port"));
     3352        dbPort->setHelpText(QObject::tr("The port number the database is running "
     3353                                        "on.  Leave blank if using the default "
     3354                                        "port (3306)."));
     3355        addChild(dbPort);
     3356
     3357        dbName = new TransTextEditSetting();
     3358        dbName->setLabel(QObject::tr("Database name"));
     3359        dbName->setHelpText(QObject::tr("The name of the database. "
     3360                                        "This information is required."));
     3361        addChild(dbName);
     3362
     3363        dbUserName = new TransTextEditSetting();
     3364        dbUserName->setLabel(QObject::tr("User"));
     3365        dbUserName->setHelpText(QObject::tr("The user name to use while "
     3366                                            "connecting to the database. "
     3367                                            "This information is required."));
     3368        addChild(dbUserName);
     3369
     3370        dbPassword = new TransTextEditSetting();
     3371        dbPassword->setLabel(QObject::tr("Password"));
     3372        dbPassword->setHelpText(QObject::tr("The password to use while "
     3373                                            "connecting to the database. "
     3374                                            "This information is required."));
     3375        addChild(dbPassword);
     3376
     3377        localEnabled = new TransMythUICheckBoxSetting();
     3378        localEnabled->setLabel(QObject::tr("Use custom identifier for frontend "
     3379                                           "preferences"));
     3380        localEnabled->setHelpText(QObject::tr("If this frontend's host name "
     3381                                              "changes often, check this box "
     3382                                              "and provide a network-unique "
     3383                                              "name to identify it. "
     3384                                              "If unchecked, the frontend "
     3385                                              "machine's local host name will "
     3386                                              "be used to save preferences in "
     3387                                              "the database."));
     3388        addChild(localEnabled);
     3389
     3390
     3391        localHostName = new TransTextEditSetting();
     3392        localHostName->setLabel(QObject::tr("Custom identifier"));
     3393        localHostName->setHelpText(QObject::tr("An identifier to use while "
     3394                                               "saving the settings for this "
     3395                                               "frontend."));
     3396        localEnabled->addTargetedChild("1", localHostName);
     3397
     3398
     3399        wolEnabled = new TransMythUICheckBoxSetting();
     3400        wolEnabled->setLabel(QObject::tr("Enable database server wakeup"));
     3401        wolEnabled->setHelpText(QObject::tr("If enabled, the frontend will use "
     3402                                            "database wakeup parameters to "
     3403                                            "reconnect to the database server."));
     3404        addChild(wolEnabled);
     3405
     3406        wolReconnect = new TransMythUISpinBoxSetting(0, 60, 1, true);
     3407        wolReconnect->setLabel(QObject::tr("Reconnect time"));
     3408        wolReconnect->setHelpText(QObject::tr("The time in seconds to wait for "
     3409                                          "the server to wake up."));
     3410        wolEnabled->addTargetedChild("1",wolReconnect);
     3411
     3412
     3413        wolRetry = new TransMythUISpinBoxSetting(1, 10, 1, true);
     3414        wolRetry->setLabel(QObject::tr("Retry attempts"));
     3415        wolRetry->setHelpText(QObject::tr("The number of retries to wake the "
     3416                                      "server before the frontend gives "
     3417                                      "up."));
     3418        wolEnabled->addTargetedChild("1",wolRetry);
     3419
     3420        wolCommand = new TransTextEditSetting();
     3421        wolCommand->setLabel(QObject::tr("Wake command"));
     3422        wolCommand->setHelpText(QObject::tr("The command executed on this "
     3423                                        "frontend to wake up the database "
     3424                                        "server (eg. sudo /etc/init.d/mysql "
     3425                                        "restart)."));
     3426        wolEnabled->addTargetedChild("1",wolCommand);
    32443427    }
     3428
     3429    void Load(void)
     3430    {
     3431
     3432        DatabaseParams params = gContext->GetDatabaseParams();
     3433
     3434        if (params.dbHostName.isEmpty() ||
     3435            params.dbUserName.isEmpty() ||
     3436            params.dbPassword.isEmpty() ||
     3437            params.dbName.isEmpty())
     3438            setHelpText(getHelpText() + "\n" +
     3439                           QObject::tr("Required fields are"
     3440                                       " marked with an asterisk (*)."));
     3441
     3442        if (params.dbHostName.isEmpty())
     3443        {
     3444            dbHostName->setLabel("* " + dbHostName->getLabel());
     3445            dbHostName->setValue(m_DBhostOverride);
     3446        }
     3447        else
     3448            dbHostName->setValue(params.dbHostName);
     3449
     3450        dbHostPing->setValue(params.dbHostPing);
     3451
     3452        if (params.dbPort)
     3453            dbPort->setValue(QString::number(params.dbPort));
     3454
     3455        dbUserName->setValue(params.dbUserName);
     3456        if (params.dbUserName.isEmpty())
     3457            dbUserName->setLabel("* " + dbUserName->getLabel());
     3458        dbPassword->setValue(params.dbPassword);
     3459        if (params.dbPassword.isEmpty())
     3460            dbPassword->setLabel("* " + dbPassword->getLabel());
     3461        dbName->setValue(params.dbName);
     3462        if (params.dbName.isEmpty())
     3463            dbName->setLabel("* " + dbName->getLabel());
     3464
     3465        localEnabled->setValue(params.localEnabled);
     3466        localHostName->setValue(params.localHostName);
     3467
     3468        wolEnabled->setValue(params.wolEnabled);
     3469        wolReconnect->setValue(params.wolReconnect);
     3470        wolRetry->setValue(params.wolRetry);
     3471        wolCommand->setValue(params.wolCommand);
     3472        //TODO set all the children's m_haveChanged to false
     3473    };
     3474    void Save(void)
     3475    {
     3476        DatabaseParams params = gContext->GetDatabaseParams();
     3477
     3478        params.dbHostName    = dbHostName->getValue();
     3479        params.dbHostPing    = dbHostPing->boolValue();
     3480        params.dbPort        = dbPort->getValue().toInt();
     3481        params.dbUserName    = dbUserName->getValue();
     3482        params.dbPassword    = dbPassword->getValue();
     3483        params.dbName        = dbName->getValue();
     3484        params.dbType        = "QMYSQL";
     3485
     3486        params.localEnabled  = localEnabled->boolValue();
     3487        params.localHostName = localHostName->getValue();
     3488
     3489        params.wolEnabled    = wolEnabled->boolValue();
     3490        params.wolReconnect  = wolReconnect->intValue();
     3491        params.wolRetry      = wolRetry->intValue();
     3492        params.wolCommand    = wolCommand->getValue();
     3493
     3494        gContext->SaveDatabaseParams(params);
     3495        //TODO set all the children's m_haveChanged to false
     3496    };
     3497
     3498  protected:
     3499    TransTextEditSetting       *dbHostName;
     3500    TransMythUICheckBoxSetting *dbHostPing;
     3501    TransTextEditSetting       *dbPort;
     3502    TransTextEditSetting       *dbName;
     3503    TransTextEditSetting       *dbUserName;
     3504    TransTextEditSetting       *dbPassword;
     3505    TransMythUICheckBoxSetting *localEnabled;
     3506    TransTextEditSetting       *localHostName;
     3507    TransMythUICheckBoxSetting *wolEnabled;
     3508    TransMythUISpinBoxSetting  *wolReconnect;
     3509    TransMythUISpinBoxSetting  *wolRetry;
     3510    TransTextEditSetting       *wolCommand;
     3511
     3512    QString              m_DBhostOverride;
    32453513};
    3246 #endif
    32473514
    3248 static HostCheckBox *WatchTVGuide()
     3515/* end of duplicated code form DatabaseSettings */
     3516
     3517
     3518class ShutDownRebootSetting : public GroupValueSetting
    32493519{
    3250     HostCheckBox *gc = new HostCheckBox("WatchTVGuide");
    3251     gc->setLabel(QObject::tr("Show the program guide when starting Live TV"));
    3252     gc->setHelpText(QObject::tr("This starts the program guide immediately "
    3253              "upon starting to watch Live TV."));
    3254     gc->setValue(false);
    3255     return gc;
     3520  public:
     3521    ShutDownRebootSetting();
     3522  private slots:
     3523    void childChanged(StandardSetting *);
     3524  private:
     3525    StandardSetting * m_overrideExitMenu;
     3526    StandardSetting * m_haltCommand;
     3527    StandardSetting * m_rebootCommand;
     3528   
     3529};
     3530
     3531ShutDownRebootSetting::ShutDownRebootSetting()
     3532    :GroupValueSetting()
     3533{
     3534    setLabel(QObject::tr("Shutdown/Reboot Settings"));
     3535    addChild(m_overrideExitMenu = OverrideExitMenu());
     3536    addChild(m_haltCommand      = HaltCommand());
     3537    addChild(m_rebootCommand    = RebootCommand());
     3538    connect(m_overrideExitMenu,SIGNAL(valueChanged(StandardSetting *)),
     3539            this,SLOT(childChanged(StandardSetting *)));
    32563540}
    32573541
     3542void ShutDownRebootSetting::childChanged(StandardSetting *)
     3543{
     3544    switch (m_overrideExitMenu->getValue().toInt())
     3545    {
     3546        case 2:
     3547        case 4:
     3548            m_haltCommand->setEnabled(true);
     3549            m_rebootCommand->setEnabled(false);
     3550            break;
     3551        case 3:
     3552        case 6:
     3553            m_haltCommand->setEnabled(true);
     3554            m_rebootCommand->setEnabled(true);
     3555            break;
     3556        case 5:
     3557            m_haltCommand->setEnabled(false);
     3558            m_rebootCommand->setEnabled(true);
     3559            break;
     3560        case 0:
     3561        case 1:
     3562        default:
     3563            m_haltCommand->setEnabled(false);
     3564            m_rebootCommand->setEnabled(false);
     3565            break;
     3566    }
     3567}
     3568
     3569
    32583570MainGeneralSettings::MainGeneralSettings()
    32593571{
    3260     DatabaseSettings::addDatabaseSettings(this);
     3572    //DatabaseSettings::addDatabaseSettings(this);
     3573    setLabel(QObject::tr("Main Settings"));
     3574
     3575    addChild(new DatabaseGroupSetting());
    32613576
    3262     VerticalConfigurationGroup *pin =
    3263         new VerticalConfigurationGroup(false, true, false, false);
     3577    GroupSetting *pin = new GroupSetting();
    32643578    pin->setLabel(QObject::tr("Settings Access"));
    32653579    pin->addChild(SetupPinCodeRequired());
    32663580    pin->addChild(SetupPinCode());
    32673581    addChild(pin);
    32683582
    3269     VerticalConfigurationGroup *general =
    3270         new VerticalConfigurationGroup(false, true, false, false);
     3583    GroupSetting *general = new GroupSetting();
    32713584    general->setLabel(QObject::tr("General"));
    32723585    general->addChild(UseVirtualKeyboard());
    32733586    general->addChild(ScreenShotPath());
    32743587    addChild(general);
    32753588
    3276     VerticalConfigurationGroup *media =
    3277         new VerticalConfigurationGroup(false, true, false, false);
    3278     media->setLabel(QObject::tr("Media Monitor"));
    3279     MythMediaSettings *mediaMon = new MythMediaSettings();
    3280     media->addChild(mediaMon);
    3281     addChild(media);
    3282 
    3283     VerticalConfigurationGroup *shutdownSettings =
    3284         new VerticalConfigurationGroup(true, true, false, false);
    3285     shutdownSettings->setLabel(QObject::tr("Shutdown/Reboot Settings"));
    3286     shutdownSettings->addChild(OverrideExitMenu());
    3287     shutdownSettings->addChild(HaltCommand());
    3288     shutdownSettings->addChild(RebootCommand());
    3289     addChild(shutdownSettings);
    3290 
    3291     VerticalConfigurationGroup *remotecontrol =
    3292         new VerticalConfigurationGroup(false, true, false, false);
     3589    addChild(EnableMediaMon());
     3590
     3591    addChild(new ShutDownRebootSetting());
     3592
     3593    GroupSetting *remotecontrol = new GroupSetting();
    32933594    remotecontrol->setLabel(QObject::tr("Remote Control"));
    32943595    remotecontrol->addChild(LircDaemonDevice());
    32953596    remotecontrol->addChild(NetworkControlEnabled());
    3296     remotecontrol->addChild(NetworkControlPort());
    3297     remotecontrol->addChild(UDPNotifyPort());
    32983597    addChild(remotecontrol);
    32993598}
    33003599
     3600void MainGeneralSettings::applyChange()
     3601{
     3602    QStringList strlist( QString("REFRESH_BACKEND") );
     3603    gCoreContext->SendReceiveStringList(strlist);
     3604}
     3605
     3606
     3607class PlayBackScaling : public GroupValueSetting
     3608{
     3609    public:
     3610        PlayBackScaling();
     3611   
     3612    private slots:
     3613        virtual void childChanged(StandardSetting *);
     3614    private:
     3615        StandardSetting * m_VertScan;
     3616        StandardSetting * m_HorizScan;
     3617        StandardSetting * m_XScan;
     3618        StandardSetting * m_YScan;
     3619};
     3620
     3621PlayBackScaling::PlayBackScaling()
     3622    :GroupValueSetting()
     3623{
     3624    setLabel(QObject::tr("Scaling"));
     3625    addChild(m_VertScan = VertScanPercentage());
     3626    addChild(m_YScan = YScanDisplacement());
     3627    addChild(m_HorizScan = HorizScanPercentage());
     3628    addChild(m_XScan = XScanDisplacement());
     3629}
     3630
     3631
     3632void PlayBackScaling::childChanged(StandardSetting *)
     3633{
     3634    if (   m_VertScan->getValue()=="0"
     3635        && m_HorizScan->getValue()=="0"
     3636        && m_YScan->getValue()=="0"
     3637        && m_XScan->getValue()=="0")
     3638        setValue(QObject::tr("No scaling"));
     3639    else
     3640        setValue(QString("%1%x%2%+%3%+%4%")
     3641                .arg(m_HorizScan->getValue())
     3642                .arg(m_VertScan->getValue())
     3643                .arg(m_XScan->getValue())
     3644                .arg(m_YScan->getValue()));
     3645}
     3646
     3647
     3648
    33013649PlaybackSettings::PlaybackSettings()
    33023650{
    3303     uint i = 0, total = 8;
    3304 #if CONFIG_DARWIN
    3305     total += 2;
    3306 #endif // USING_DARWIN
     3651    setLabel(QObject::tr("Playback settings"));
    33073652
     3653    GroupSetting* general = new GroupSetting();
     3654    general->setLabel(QObject::tr("General Playback"));
     3655    general->addChild(RealtimePriority());
     3656    general->addChild(DecodeExtraAudio());
     3657    general->addChild(JumpToProgramOSD());
     3658    general->addChild(ClearSavedPosition());
     3659    general->addChild(AltClearSavedPosition());
     3660    general->addChild(AutomaticSetWatched());
     3661    general->addChild(ContinueEmbeddedTVPlay());
     3662    general->addChild(LiveTVIdleTimeout());
    33083663
    3309     VerticalConfigurationGroup* general1 =
    3310         new VerticalConfigurationGroup(false);
    3311     general1->setLabel(QObject::tr("General Playback") +
    3312                       QString(" (%1/%2)").arg(++i).arg(total));
     3664    general->addChild(new PlayBackScaling());
    33133665
    3314     HorizontalConfigurationGroup *columns =
    3315         new HorizontalConfigurationGroup(false, false, true, true);
     3666    general->addChild(AspectOverride());
     3667    general->addChild(AdjustFill());
    33163668
    3317     VerticalConfigurationGroup *column1 =
    3318         new VerticalConfigurationGroup(false, false, true, true);
    3319     column1->addChild(RealtimePriority());
    3320     column1->addChild(DecodeExtraAudio());
    3321     column1->addChild(JumpToProgramOSD());
    3322     columns->addChild(column1);
     3669    general->addChild(LetterboxingColour());
     3670    general->addChild(PIPLocationComboBox());
     3671    general->addChild(PlaybackExitPrompt());
     3672    general->addChild(EndOfRecordingExitPrompt());
     3673    addChild(general);
    33233674
    3324     VerticalConfigurationGroup *column2 =
    3325         new VerticalConfigurationGroup(false, false, true, true);
    3326     column2->addChild(ClearSavedPosition());
    3327     column2->addChild(AltClearSavedPosition());
    3328     column2->addChild(AutomaticSetWatched());
    3329     column2->addChild(ContinueEmbeddedTVPlay());
    3330     columns->addChild(column2);
    3331 
    3332     general1->addChild(columns);
    3333     general1->addChild(LiveTVIdleTimeout());
    3334     addChild(general1);
    3335 
    3336     VerticalConfigurationGroup* general2 =
    3337         new VerticalConfigurationGroup(false);
    3338     general2->setLabel(QObject::tr("General Playback") +
    3339                       QString(" (%1/%2)").arg(++i).arg(total));
    3340 
    3341     HorizontalConfigurationGroup* oscan =
    3342         new HorizontalConfigurationGroup(false, false, true, true);
    3343     VerticalConfigurationGroup *ocol1 =
    3344         new VerticalConfigurationGroup(false, false, true, true);
    3345     VerticalConfigurationGroup *ocol2 =
    3346         new VerticalConfigurationGroup(false, false, true, true);
    3347     ocol1->addChild(VertScanPercentage());
    3348     ocol1->addChild(YScanDisplacement());
    3349     ocol2->addChild(HorizScanPercentage());
    3350     ocol2->addChild(XScanDisplacement());
    3351     oscan->addChild(ocol1);
    3352     oscan->addChild(ocol2);
    3353 
    3354     HorizontalConfigurationGroup* aspect_fill =
    3355         new HorizontalConfigurationGroup(false, false, true, true);
    3356     aspect_fill->addChild(AspectOverride());
    3357     aspect_fill->addChild(AdjustFill());
    3358 
    3359     general2->addChild(oscan);
    3360     general2->addChild(aspect_fill);
    3361     general2->addChild(LetterboxingColour());
    3362     general2->addChild(PIPLocationComboBox());
    3363     general2->addChild(PlaybackExitPrompt());
    3364     general2->addChild(EndOfRecordingExitPrompt());
    3365     addChild(general2);
     3675    addChild(CurrentPlaybackProfile());
    33663676
    3367     QString tmp = QString(" (%1/%2)").arg(++i).arg(total);
    3368     addChild(new PlaybackProfileConfigs(tmp));
    33693677
    3370     VerticalConfigurationGroup* pbox = new VerticalConfigurationGroup(false);
    3371     pbox->setLabel(QObject::tr("View Recordings") +
    3372                    QString(" (%1/%2)").arg(++i).arg(total));
     3678    GroupSetting* pbox = new GroupSetting();
     3679    pbox->setLabel(QObject::tr("View Recordings"));
    33733680    pbox->addChild(PlayBoxOrdering());
    33743681    pbox->addChild(PlayBoxEpisodeSort());
    33753682    // Disabled until we re-enable live previews
    33763683    // pbox->addChild(PlaybackPreview());
    33773684    // pbox->addChild(HWAccelPlaybackPreview());
    33783685    pbox->addChild(PBBStartInTitle());
    3379     addChild(pbox);
    33803686
    3381     VerticalConfigurationGroup* pbox2 = new VerticalConfigurationGroup(false);
    3382     pbox2->setLabel(QObject::tr("Recording Groups") +
    3383                     QString(" (%1/%2)").arg(++i).arg(total));
     3687
     3688    GroupSetting* pbox2 = new GroupSetting();
     3689    pbox2->setLabel(QObject::tr("Recording Groups"));
    33843690    pbox2->addChild(DisplayRecGroup());
    33853691    pbox2->addChild(QueryInitialFilter());
    33863692    pbox2->addChild(RememberRecGroup());
    33873693    pbox2->addChild(UseGroupNameAsAllPrograms());
    3388     addChild(pbox2);
    3389 
    3390     VerticalConfigurationGroup* pbox3 = new VerticalConfigurationGroup(false);
    3391     pbox3->setLabel(QObject::tr("View Recordings") +
    3392                     QString(" (%1/%2)").arg(++i).arg(total));
    3393     pbox3->addChild(DisplayGroupTitleSort());
    3394     pbox3->addChild(new WatchListSettings());
    3395     addChild(pbox3);
    3396 
    3397     VerticalConfigurationGroup* seek = new VerticalConfigurationGroup(false);
    3398     seek->setLabel(QObject::tr("Seeking") +
    3399                    QString(" (%1/%2)").arg(++i).arg(total));
     3694    pbox->addChild(pbox2);
     3695
     3696    pbox->addChild(DisplayGroupTitleSort());
     3697    pbox->addChild(PlaybackWatchList());
     3698    addChild(pbox);
     3699
     3700    GroupSetting* seek = new GroupSetting();
     3701    seek->setLabel(QObject::tr("Seeking"));
    34003702    seek->addChild(SmartForward());
    34013703    seek->addChild(FFRewReposTime());
    34023704    seek->addChild(FFRewReverse());
    34033705    seek->addChild(ExactSeeking());
    34043706    addChild(seek);
    34053707
    3406     VerticalConfigurationGroup* comms = new VerticalConfigurationGroup(false);
    3407     comms->setLabel(QObject::tr("Commercial Skip") +
    3408                     QString(" (%1/%2)").arg(++i).arg(total));
     3708
     3709
     3710    GroupSetting* comms = new GroupSetting();
     3711    comms->setLabel(QObject::tr("Commercial Skip"));
    34093712    comms->addChild(AutoCommercialSkip());
    34103713    comms->addChild(CommRewindAmount());
    34113714    comms->addChild(CommNotifyAmount());
     3715    //TODO mixing Host setting with Global setting, not very clear for the user
    34123716    comms->addChild(MaximumCommercialSkip());
    34133717    comms->addChild(MergeShortCommBreaks());
    34143718    addChild(comms);
    34153719
    34163720#if CONFIG_DARWIN
    3417     VerticalConfigurationGroup* mac1 = new VerticalConfigurationGroup(false);
    3418     mac1->setLabel(QObject::tr("Mac OS X Video Settings") +
    3419                    QString(" (%1/%2)").arg(++i).arg(total));
    3420     mac1->addChild(MacGammaCorrect());
    3421     mac1->addChild(MacScaleUp());
    3422     mac1->addChild(MacFullSkip());
    3423     addChild(mac1);
    3424 
    3425     VerticalConfigurationGroup* mac2 = new VerticalConfigurationGroup(false);
    3426     mac2->setLabel(QObject::tr("Mac OS X Video Settings") +
    3427                    QString(" (%1/%2)").arg(++i).arg(total));
    3428     mac2->addChild(new MacMainSettings());
    3429     mac2->addChild(new MacFloatSettings());
    3430 
    3431     HorizontalConfigurationGroup *row =
    3432         new HorizontalConfigurationGroup(false, false, true, true);
    3433     row->addChild(new MacDockSettings());
    3434     row->addChild(new MacDesktopSettings());
    3435     mac2->addChild(row);
    3436 
    3437     addChild(mac2);
     3721    GroupSetting* ma1 = new GroupSetting(false);
     3722    mac->setLabel(QObject::tr("Mac OS X Video Settings"));
     3723    mac->addChild(MacGammaCorrect());
     3724    mac->addChild(MacScaleUp());
     3725    mac->addChild(MacFullSkip());
     3726
     3727    mac->addChild(MacMainEnabled());
     3728    mac->addChild(MacFloatEnabled());
     3729    mac->addChild(MacDockEnabled());
     3730    mac->addChild(MacDesktopEnabled());
     3731    mac->addChild(row);
     3732
     3733    addChild(mac);
    34383734#endif
    34393735}
    34403736
    34413737OSDSettings::OSDSettings()
    34423738{
    3443     VerticalConfigurationGroup* osd = new VerticalConfigurationGroup(false);
    3444     osd->setLabel(QObject::tr("On-screen Display"));
     3739    setLabel(QObject::tr("On-screen Display"));
    34453740
    3446     osd->addChild(EnableMHEG());
    3447     osd->addChild(PersistentBrowseMode());
    3448     osd->addChild(BrowseAllTuners());
    3449     osd->addChild(CCBackground());
    3450     osd->addChild(DefaultCCMode());
    3451     osd->addChild(PreferCC708());
    3452     osd->addChild(SubtitleFont());
    3453     osd->addChild(OSDCC708TextZoomPercentage());
    3454     osd->addChild(SubtitleCodec());
    3455     addChild(osd);
     3741    addChild(EnableMHEG());
     3742    addChild(PersistentBrowseMode());
     3743    addChild(BrowseAllTuners());
     3744    addChild(CCBackground());
     3745    addChild(DefaultCCMode());
     3746    addChild(PreferCC708());
     3747    addChild(SubtitleFont());
     3748    addChild(OSDCC708TextZoomPercentage());
     3749    addChild(SubtitleCodec());
    34563750
    34573751    //VerticalConfigurationGroup *cc = new VerticalConfigurationGroup(false);
    34583752    //cc->setLabel(QObject::tr("Closed Captions"));
    OSDSettings::OSDSettings()  
    34673761
    34683762GeneralSettings::GeneralSettings()
    34693763{
    3470     VerticalConfigurationGroup* general = new VerticalConfigurationGroup(false);
    3471     general->setLabel(QObject::tr("General (Basic)"));
     3764    setLabel(QObject::tr("General"));
     3765    GroupSetting* general = new GroupSetting();
     3766    general->setLabel(QObject::tr("Basic"));
    34723767    general->addChild(ChannelOrdering());
    34733768    general->addChild(ChannelFormat());
    34743769    general->addChild(LongChannelFormat());
     3770    //LiveTVPriority (backend setting) should probably not be mixed with frontend settings
    34753771    general->addChild(LiveTVPriority());
    34763772    addChild(general);
    34773773
    3478     VerticalConfigurationGroup* autoexp = new VerticalConfigurationGroup(false);
    3479     autoexp->setLabel(QObject::tr("General (Auto-Expire)"));
     3774    GroupSetting* autoexp = new GroupSetting();
     3775    autoexp->setLabel(QObject::tr("Auto-Expire"));
    34803776    autoexp->addChild(AutoExpireMethod());
    3481 
    3482     VerticalConfigurationGroup *expgrp0 =
    3483         new VerticalConfigurationGroup(false, false, true, true);
    3484     expgrp0->addChild(AutoExpireDefault());
    3485     expgrp0->addChild(RerecordWatched());
    3486     expgrp0->addChild(AutoExpireWatchedPriority());
    3487 
    3488     VerticalConfigurationGroup *expgrp1 =
    3489         new VerticalConfigurationGroup(false, false, true, true);
    3490     expgrp1->addChild(AutoExpireLiveTVMaxAge());
    3491     expgrp1->addChild(AutoExpireDayPriority());
    3492     expgrp1->addChild(AutoExpireExtraSpace());
    3493 
    3494     HorizontalConfigurationGroup *expgrp =
    3495         new HorizontalConfigurationGroup(false, false, true, true);
    3496     expgrp->addChild(expgrp0);
    3497     expgrp->addChild(expgrp1);
    3498 
    3499     autoexp->addChild(expgrp);
    3500     autoexp->addChild(new DeletedExpireOptions());
    3501 
     3777    autoexp->addChild(AutoExpireDefault());
     3778    autoexp->addChild(RerecordWatched());
     3779    autoexp->addChild(AutoExpireWatchedPriority());
     3780    autoexp->addChild(AutoExpireLiveTVMaxAge());
     3781    autoexp->addChild(AutoExpireDayPriority());
     3782    autoexp->addChild(AutoExpireExtraSpace());
     3783    autoexp->addChild(AutoExpireInsteadOfDelete());
    35023784    addChild(autoexp);
    35033785
    3504     VerticalConfigurationGroup* jobs = new VerticalConfigurationGroup(false);
    3505     jobs->setLabel(QObject::tr("General (Jobs)"));
     3786    GroupSetting* jobs = new GroupSetting();
     3787    jobs->setLabel(QObject::tr("Jobs"));
    35063788    jobs->addChild(CommercialSkipMethod());
    35073789    jobs->addChild(CommFlagFast());
    35083790    jobs->addChild(AggressiveCommDetect());
    35093791    jobs->addChild(DefaultTranscoder());
    35103792    jobs->addChild(DeferAutoTranscodeDays());
    35113793
    3512     VerticalConfigurationGroup* autogrp0 =
    3513         new VerticalConfigurationGroup(false, false, true, true);
    3514     autogrp0->addChild(AutoMetadataLookup());
    3515     autogrp0->addChild(AutoCommercialFlag());
    3516     autogrp0->addChild(AutoTranscode());
    3517 
    3518     VerticalConfigurationGroup* autogrp1 =
    3519         new VerticalConfigurationGroup(false, false, true, true);
    3520     autogrp0->addChild(AutoRunUserJob(1));
    3521     autogrp1->addChild(AutoRunUserJob(2));
    3522     autogrp1->addChild(AutoRunUserJob(3));
    3523     autogrp1->addChild(AutoRunUserJob(4));
    3524 
    3525     HorizontalConfigurationGroup *autogrp =
    3526         new HorizontalConfigurationGroup(true, true, false, true);
     3794    GroupSetting *autogrp = new GroupSetting();
    35273795    autogrp->setLabel(
    35283796        QObject::tr("Default Job Queue Settings for New Scheduled Recordings"));
    3529     autogrp->addChild(autogrp0);
    3530     autogrp->addChild(autogrp1);
     3797    autogrp->addChild(AutoMetadataLookup());
     3798    autogrp->addChild(AutoCommercialFlag());
     3799    autogrp->addChild(AutoTranscode());
     3800    autogrp->addChild(AutoRunUserJob(1));
     3801    autogrp->addChild(AutoRunUserJob(2));
     3802    autogrp->addChild(AutoRunUserJob(3));
     3803    autogrp->addChild(AutoRunUserJob(4));
     3804
    35313805    jobs->addChild(autogrp);
    35323806
    35333807    addChild(jobs);
    35343808
    3535     VerticalConfigurationGroup* general2 = new VerticalConfigurationGroup(false);
    3536     general2->setLabel(QObject::tr("General (Advanced)"));
     3809    GroupSetting* general2 = new GroupSetting();
     3810    general2->setLabel(QObject::tr("Advanced"));
    35373811    general2->addChild(RecordPreRoll());
    35383812    general2->addChild(RecordOverTime());
    35393813    general2->addChild(CategoryOverTimeSettings());
    35403814    addChild(general2);
    35413815
    3542     VerticalConfigurationGroup* changrp = new VerticalConfigurationGroup(false);
    3543     changrp->setLabel(QObject::tr("General (Channel Groups)"));
    3544     ChannelGroupSettings *changroupsettings = new ChannelGroupSettings();
    3545     changrp->addChild(changroupsettings);
     3816    GroupSetting* changrp = new GroupSetting();
     3817    changrp->setLabel(QObject::tr("Channel Groups"));
     3818    changrp->addChild(ChannelGroupRememberLast());
    35463819    changrp->addChild(BrowseChannelGroup());
    35473820    addChild(changrp);
    35483821}
    35493822
    35503823EPGSettings::EPGSettings()
    35513824{
    3552     VerticalConfigurationGroup* epg = new VerticalConfigurationGroup(false);
    3553     epg->setLabel(QObject::tr("Program Guide") + " 1/1");
    3554     epg->addChild(WatchTVGuide());
    3555     epg->addChild(DefaultTVChannel());
    3556     epg->addChild(EPGRecThreshold());
    3557     addChild(epg);
     3825    setLabel(QObject::tr("Program Guide"));
     3826    addChild(WatchTVGuide());
     3827    addChild(DefaultTVChannel());
     3828    addChild(EPGRecThreshold());
    35583829}
    35593830
    35603831GeneralRecPrioritiesSettings::GeneralRecPrioritiesSettings()
    35613832{
    3562     VerticalConfigurationGroup* sched = new VerticalConfigurationGroup(false);
     3833    GroupSetting* sched = new GroupSetting();
    35633834    sched->setLabel(QObject::tr("Scheduler Options"));
    35643835
    35653836    sched->addChild(GRSchedMoveHigher());
    GeneralRecPrioritiesSettings::GeneralRecPrioritiesSettings()  
    35723843    sched->addChild(GRAutoRecPriority());
    35733844    addChild(sched);
    35743845
    3575     VerticalConfigurationGroup* access = new VerticalConfigurationGroup(false);
     3846    GroupSetting* access = new GroupSetting();
    35763847    access->setLabel(QObject::tr("Accessibility Options"));
    35773848
    35783849    access->addChild(GRSignLangRecPriority());
    GeneralRecPrioritiesSettings::GeneralRecPrioritiesSettings()  
    35823853    access->addChild(GRAudioDescRecPriority());
    35833854    addChild(access);
    35843855
    3585     VerticalConfigurationGroup* rtype = new VerticalConfigurationGroup(false);
     3856    GroupSetting* rtype = new GroupSetting();
    35863857    rtype->setLabel(QObject::tr("Recording Type Priority Settings"));
    35873858
    35883859    rtype->addChild(GRSingleRecordRecPriority());
    GeneralRecPrioritiesSettings::GeneralRecPrioritiesSettings()  
    35953866    addChild(rtype);
    35963867}
    35973868
     3869
     3870class GuiDimension : public GroupValueSetting
     3871{
     3872    public:
     3873        GuiDimension();
     3874   
     3875    private slots:
     3876        virtual void childChanged(StandardSetting *);
     3877    private:
     3878        StandardSetting * m_width;
     3879        StandardSetting * m_height;
     3880        StandardSetting * m_offsetX;
     3881        StandardSetting * m_offsetY;
     3882};
     3883
     3884GuiDimension::GuiDimension()
     3885    :GroupValueSetting()
     3886{
     3887    setLabel(QObject::tr("Gui dimension"));
     3888    addChild(m_width   = GuiWidth());
     3889    addChild(m_height  = GuiHeight());
     3890    addChild(m_offsetX = GuiOffsetX());
     3891    addChild(m_offsetY = GuiOffsetY());
     3892}
     3893
     3894
     3895void GuiDimension::childChanged(StandardSetting *)
     3896{
     3897    if ((  m_width->getValue()=="0"
     3898        || m_height->getValue()=="0")
     3899        && m_offsetX->getValue()=="0"
     3900        && m_offsetY->getValue()=="0")
     3901        setValue(QObject::tr("Fullscreen"));
     3902    else
     3903        setValue(QString("%1x%2+%3+%4")
     3904                .arg(m_width->getValue())
     3905                .arg(m_height->getValue())
     3906                .arg(m_offsetX->getValue())
     3907                .arg(m_offsetY->getValue()));
     3908}
     3909
     3910
     3911
    35983912AppearanceSettings::AppearanceSettings()
    35993913{
    3600     VerticalConfigurationGroup* screen = new VerticalConfigurationGroup(false);
     3914    GroupSetting* screen = new GroupSetting();
    36013915    screen->setLabel(QObject::tr("Theme") + " / " + QObject::tr("Screen Settings"));
     3916    addChild(screen);
    36023917
    36033918    screen->addChild(MenuTheme());
    36043919
    AppearanceSettings::AppearanceSettings()  
    36113926//    screen->addChild(DisplaySizeHeight());
    36123927//    screen->addChild(DisplaySizeWidth());
    36133928
    3614     VerticalConfigurationGroup *column1 =
    3615         new VerticalConfigurationGroup(false, false, false, false);
    3616 
    3617     column1->addChild(GuiWidth());
    3618     column1->addChild(GuiHeight());
    3619     column1->addChild(GuiOffsetX());
    3620     column1->addChild(GuiOffsetY());
    3621 
    3622     VerticalConfigurationGroup *column2 =
    3623         new VerticalConfigurationGroup(false, false, false, false);
    3624 
    3625     column2->addChild(GuiSizeForTV());
    3626     column2->addChild(HideMouseCursor());
    3627     column2->addChild(RunInWindow());
    3628     column2->addChild(UseFixedWindowSize());
    3629 
    3630     HorizontalConfigurationGroup *columns =
    3631         new HorizontalConfigurationGroup(false, false, false, false);
     3929    screen->addChild(new GuiDimension());
    36323930
    3633     columns->addChild(column1);
    3634     columns->addChild(column2);
    3635 
    3636     screen->addChild(columns);
    3637 
    3638     addChild(screen);
     3931    screen->addChild(GuiSizeForTV());
     3932    screen->addChild(HideMouseCursor());
     3933    screen->addChild(RunInWindow());
     3934    screen->addChild(UseFixedWindowSize());
    36393935
    36403936#if defined(USING_XRANDR) || CONFIG_DARWIN
    36413937    const vector<DisplayResScreen> scr = GetVideoModes();
    36423938    if (!scr.empty())
    3643         addChild(new VideoModeSettings());
     3939        addChild(UseVideoModes());
    36443940#endif
    3645     VerticalConfigurationGroup* dates = new VerticalConfigurationGroup(false);
     3941    GroupSetting* dates = new GroupSetting();
    36463942    dates->setLabel(QObject::tr("Localization"));
    36473943    dates->addChild(MythLanguage());
    36483944    dates->addChild(ISO639PreferredLanguage(0));
    AppearanceSettings::AppearanceSettings()  
    36523948    dates->addChild(MythTimeFormat());
    36533949    addChild(dates);
    36543950
    3655     addChild(new LcdSettings());
     3951    addChild(LCDEnable());
     3952}
     3953
     3954void AppearanceSettings::applyChange()
     3955{
     3956    qApp->processEvents();
     3957    GetMythMainWindow()->JumpTo("Reload Theme");
    36563958}
    36573959
    36583960// 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..8c224e6 100644
    a b  
    77#include "settings.h"
    88#include "mythcontext.h"
    99#include "videodisplayprofile.h"
     10#include "standardsettings.h"
    1011
    1112#include <QMutex>
    1213
    1314class QFileInfo;
    1415
    15 class PlaybackSettings : public ConfigurationWizard
     16class PlaybackSettings : public GroupSetting //ConfigurationWizard
    1617{
    1718  public:
    1819    PlaybackSettings();
    1920};
    2021
    21 class OSDSettings: virtual public ConfigurationWizard
     22//TODO check the purpose of virtual here
     23//class OSDSettings: virtual public ConfigurationWizard
     24class OSDSettings: public GroupSetting
    2225{
    2326  public:
    2427    OSDSettings();
    2528};
    2629
    27 class GeneralSettings : public ConfigurationWizard
     30class GeneralSettings : public GroupSetting
    2831{
    2932  public:
    3033    GeneralSettings();
    3134};
    3235
    33 class EPGSettings : public ConfigurationWizard
     36class EPGSettings : public GroupSetting
    3437{
    3538  public:
    3639    EPGSettings();
    3740};
    3841
    39 class AppearanceSettings : public ConfigurationWizard
     42class AppearanceSettings : public GroupSetting
    4043{
    4144  public:
    4245    AppearanceSettings();
     46    virtual void applyChange();
    4347};
    4448
    45 class MainGeneralSettings : public ConfigurationWizard
     49class HostRefreshRateComboBoxSetting : public HostComboBoxSetting
     50{
     51    Q_OBJECT
     52  public:
     53    HostRefreshRateComboBoxSetting(const QString &name) :
     54        HostComboBoxSetting(name) { }
     55    virtual ~HostRefreshRateComboBoxSetting() { ; }
     56
     57  public slots:
     58    virtual void ChangeResolution(StandardSetting *);
     59
     60  private:
     61    static const vector<double> GetRefreshRates(const QString &resolution);
     62};
     63
     64
     65class MainGeneralSettings : public GroupSetting
    4666{
    4767  public:
    4868    MainGeneralSettings();
     69    virtual void applyChange();
    4970};
    5071
    51 class GeneralRecPrioritiesSettings : public ConfigurationWizard
     72class GeneralRecPrioritiesSettings : public GroupSetting
    5273{
    5374  public:
    5475    GeneralRecPrioritiesSettings();
    class XboxSettings : public ConfigurationWizard  
    5980  public:
    6081    XboxSettings();
    6182};
    62 
     83/*
    6384class PlaybackProfileItemConfig : public QObject, public ConfigurationWizard
    6485{
    6586    Q_OBJECT
    class PlaybackProfileConfig : public VerticalConfigurationGroup  
    128149    vector<TransSpinBoxSetting*> priority;
    129150};
    130151
     152
    131153class PlaybackProfileConfigs : public TriggeredConfigurationGroup
    132154{
    133155    Q_OBJECT
    class PlaybackProfileConfigs : public TriggeredConfigurationGroup  
    146168  private:
    147169    QStringList   profiles;
    148170    HostComboBox *grouptrigger;
    149 };
     171};*/
    150172
    151173#endif
  • mythtv/programs/mythfrontend/main.cpp

    diff --git a/mythtv/programs/mythfrontend/main.cpp b/mythtv/programs/mythfrontend/main.cpp
    index 259e020..9a1ec90 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  
    138138
    139139            if (passwordValid)
    140140            {
    141                 VideoGeneralSettings settings;
    142                 settings.exec();
     141                MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
     142                StandardSettingDialog *ssd = new StandardSettingDialog(mainStack, "videogeneralsettings");
     143
     144                if (ssd->Create())
     145                {
     146                    ssd->loadSettings(new VideoGeneralSettings());
     147                    mainStack->AddScreen(ssd);
     148                }
     149                else
     150                    delete ssd;
    143151            }
    144152            else
    145153            {
    static void TVMenuCallback(void *data, QString &selection)  
    838846        startPrevious();
    839847    else if (sel == "settings appearance")
    840848    {
    841         AppearanceSettings *settings = new AppearanceSettings();
    842         DialogCode res = settings->exec();
    843         delete settings;
     849        MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
     850        StandardSettingDialog *ssd = new StandardSettingDialog(mainStack, "videogeneralsettings");
    844851
    845         if (kDialogCodeRejected != res)
     852        if (ssd->Create())
    846853        {
    847             qApp->processEvents();
    848             GetMythMainWindow()->JumpTo("Reload Theme");
     854            ssd->loadSettings(new AppearanceSettings());
     855            mainStack->AddScreen(ssd);
    849856        }
     857        else
     858            delete ssd;
    850859    }
    851860    else if (sel == "settings themechooser")
    852861    {
    static void TVMenuCallback(void *data, QString &selection)  
    898907    }
    899908    else if (sel == "settings general")
    900909    {
    901         GeneralSettings settings;
    902         settings.exec();
     910        MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
     911        StandardSettingDialog *ssd = new StandardSettingDialog(mainStack, "videogeneralsettings");
     912
     913        if (ssd->Create())
     914        {
     915            ssd->loadSettings(new GeneralSettings());
     916            mainStack->AddScreen(ssd);
     917        }
     918        else
     919            delete ssd;
    903920    }
    904921    else if (sel == "settings audiogeneral")
    905922    {
    906         AudioGeneralSettings audiosettings;
    907         audiosettings.exec();
     923        MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
     924        StandardSettingDialog *ssd = new StandardSettingDialog(mainStack, "videogeneralsettings");
     925
     926        if (ssd->Create())
     927        {
     928            ssd->loadSettings(new AudioConfigSettings());
     929            mainStack->AddScreen(ssd);
     930        }
     931        else
     932            delete ssd;
    908933    }
    909934    else if (sel == "settings maingeneral")
    910935    {
    911         MainGeneralSettings mainsettings;
    912         mainsettings.exec();
    913         QStringList strlist( QString("REFRESH_BACKEND") );
    914         gCoreContext->SendReceiveStringList(strlist);
     936        MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
     937        StandardSettingDialog *ssd = new StandardSettingDialog(mainStack, "videogeneralsettings");
     938
     939        if (ssd->Create())
     940        {
     941            ssd->loadSettings(new MainGeneralSettings());
     942            mainStack->AddScreen(ssd);
     943        }
     944        else
     945            delete ssd;
    915946    }
    916947    else if (sel == "settings playback")
    917948    {
    918         PlaybackSettings settings;
    919         settings.exec();
     949/*        PlaybackSettings settings;
     950        settings.exec();*/
     951        MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
     952        StandardSettingDialog *ssd = new StandardSettingDialog(mainStack, "videogeneralsettings");
     953
     954        if (ssd->Create())
     955        {
     956            ssd->loadSettings(new PlaybackSettings());
     957            mainStack->AddScreen(ssd);
     958        }
     959        else
     960            delete ssd;
    920961    }
    921962    else if (sel == "settings osd")
    922963    {
    923         OSDSettings settings;
    924         settings.exec();
     964        MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
     965        StandardSettingDialog *ssd = new StandardSettingDialog(mainStack, "videogeneralsettings");
     966
     967        if (ssd->Create())
     968        {
     969            ssd->loadSettings(new OSDSettings());
     970            mainStack->AddScreen(ssd);
     971        }
     972        else
     973            delete ssd;
    925974    }
    926975    else if (sel == "settings epg")
    927976    {
    928         EPGSettings settings;
    929         settings.exec();
     977        MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
     978        StandardSettingDialog *ssd = new StandardSettingDialog(mainStack, "videogeneralsettings");
     979
     980        if (ssd->Create())
     981        {
     982            ssd->loadSettings(new EPGSettings());
     983            mainStack->AddScreen(ssd);
     984        }
     985        else
     986            delete ssd;
    930987    }
    931988    else if (sel == "settings channelgroups")
    932989    {
    static void TVMenuCallback(void *data, QString &selection)  
    935992    }
    936993    else if (sel == "settings generalrecpriorities")
    937994    {
    938         GeneralRecPrioritiesSettings settings;
    939         settings.exec();
     995        MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
     996        StandardSettingDialog *ssd = new StandardSettingDialog(mainStack, "videogeneralsettings");
     997
     998        if (ssd->Create())
     999        {
     1000            ssd->loadSettings(new GeneralRecPrioritiesSettings());
     1001            mainStack->AddScreen(ssd);
     1002        }
     1003        else
     1004            delete ssd;
    9401005    }
    9411006    else if (sel == "settings channelrecpriorities")
    9421007    {
  • mythtv/programs/mythfrontend/mythfrontend.pro

    diff --git a/mythtv/programs/mythfrontend/mythfrontend.pro b/mythtv/programs/mythfrontend/mythfrontend.pro
    index 7c71469..dde9b2d 100644
    a b HEADERS += videoplayercommand.h videopopups.h  
    3939HEADERS += videofilter.h                videolist.h
    4040HEADERS += videoplayersettings.h        videodlg.h
    4141HEADERS += videoglobalsettings.h        upnpscanner.h
    42 HEADERS += commandlineparser.h
     42HEADERS += commandlineparser.h          standardsettings.h
    4343
    4444SOURCES += main.cpp playbackbox.cpp viewscheduled.cpp audiogeneralsettings.cpp
    4545SOURCES += globalsettings.cpp manualschedule.cpp programrecpriority.cpp
    SOURCES += videoplayercommand.cpp videopopups.cpp  
    6060SOURCES += videofilter.cpp              videolist.cpp
    6161SOURCES += videoplayersettings.cpp      videodlg.cpp
    6262SOURCES += videoglobalsettings.cpp      upnpscanner.cpp
    63 SOURCES += commandlineparser.cpp
     63SOURCES += commandlineparser.cpp        standardsettings.cpp
    6464
    6565HEADERS += serviceHosts/frontendServiceHost.h
    6666HEADERS += services/frontend.h
  • new file mythtv/programs/mythfrontend/standardsettings.cpp

    diff --git a/mythtv/programs/mythfrontend/standardsettings.cpp b/mythtv/programs/mythfrontend/standardsettings.cpp
    new file mode 100755
    index 0000000..9db9a20
    - +  
     1#include "standardsettings.h"
     2#include <QCoreApplication>
     3
     4#include <mythcontext.h>
     5#include <mythmainwindow.h>
     6#include <mythdialogbox.h>
     7#include <mythuispinbox.h>
     8#include <mythuitext.h>
     9#include <mythuibutton.h>
     10#include <mythuifilebrowser.h>
     11#include "mythlogging.h"
     12
     13void MythUIButtonListItemSetting::ShouldUpdate(StandardSetting *setting)
     14{
     15    setting->updateButton(this);
     16}
     17
     18StandardSetting::StandardSetting(Storage *_storage) :
     19    NewConfigurable(_storage),
     20    m_haveChanged(false),
     21    m_parent(0)
     22
     23{
     24}
     25
     26StandardSetting::~StandardSetting()
     27{   
     28    QList<StandardSetting *>::const_iterator i;
     29    for (i = m_children.constBegin(); i != m_children.constEnd(); ++i)
     30        delete *i;
     31    m_children.clear();
     32
     33    QMap<QString, QList<StandardSetting *> >::const_iterator iMap;
     34    for (iMap = m_targets.constBegin(); iMap != m_targets.constEnd(); ++iMap)
     35    {
     36        for (i = (*iMap).constBegin(); i != (*iMap).constEnd(); ++i)
     37            delete *i;
     38    }
     39    m_targets.clear();
     40}
     41
     42MythUIButtonListItem * StandardSetting::createButton(MythUIButtonList * list)
     43{
     44    MythUIButtonListItemSetting *item = new MythUIButtonListItemSetting(list, label);
     45    item->SetData(qVariantFromValue(this));
     46    connect(this, SIGNAL(ShouldRedraw(StandardSetting *)), item, SLOT(ShouldUpdate(StandardSetting *)));
     47    updateButton(item);
     48    return item;
     49}
     50
     51void StandardSetting::setEnabled(bool b)
     52{
     53    LOG(VB_GENERAL, LOG_ERR, QString("StandardSetting::setEnabled(%1) for %2")
     54        .arg(b)
     55        .arg(getLabel()));
     56    NewConfigurable::setEnabled(b);
     57    emit ShouldRedraw(this);
     58}
     59
     60void StandardSetting::setParent(StandardSetting *parent)
     61{
     62    m_parent = parent;
     63}
     64
     65StandardSetting * StandardSetting::getParent()
     66{
     67    return m_parent;
     68}
     69
     70void StandardSetting::addChild(StandardSetting *child)
     71{
     72    if (!child)return;
     73    m_children.append(child);
     74    child->setParent(this);
     75}
     76
     77void StandardSetting::updateButton(MythUIButtonListItem *item)
     78{
     79    item->setEnabled(isEnabled());
     80    item->SetText(label);
     81    item->SetText(settingValue,"value");
     82    item->SetText(getHelpText(),"description");
     83    item->setDrawArrow (haveSubSettings());
     84
     85}
     86
     87void StandardSetting::addTargetedChild(const QString &value, StandardSetting * setting)
     88{
     89    m_targets[value].append(setting);
     90    setting->setParent(this);
     91}
     92
     93
     94QList<StandardSetting *> *StandardSetting::getSubSettings()
     95{
     96    if (m_targets.contains(settingValue) && m_targets[settingValue].size()>0)
     97            return &m_targets[settingValue];
     98    return &m_children;
     99}
     100
     101bool StandardSetting::haveSubSettings()
     102{
     103    QList<StandardSetting *> * subSettings=getSubSettings();
     104    return (subSettings!=NULL && subSettings->size()>0);
     105}
     106
     107void StandardSetting::setValue(const QString &newValue)
     108{
     109    settingValue = newValue;
     110    emit valueChanged(this);
     111    emit ShouldRedraw(this);
     112}
     113
     114bool StandardSetting::haveChanged()
     115{
     116    if (m_haveChanged) return true;
     117
     118    //we check only the relevant children
     119    QList<StandardSetting *> *children = getSubSettings();
     120    if (children==NULL) return false;
     121    QList<StandardSetting *>::const_iterator i;
     122    bool haveChanged = false;
     123    for (i = children->constBegin(); !haveChanged && i != children->constEnd(); ++i)
     124        haveChanged=(*i)->haveChanged();
     125
     126    return haveChanged;
     127}
     128
     129void StandardSetting::Load(void)
     130{
     131
     132    m_haveChanged=false;
     133
     134    LoadChildren();
     135}
     136
     137void StandardSetting::LoadChildren(void)
     138{
     139    QList<StandardSetting *>::const_iterator i;
     140    for (i = m_children.constBegin(); i != m_children.constEnd(); ++i)
     141        (*i)->Load();
     142
     143    QMap<QString, QList<StandardSetting *> >::const_iterator iMap;
     144    for (iMap = m_targets.constBegin(); iMap != m_targets.constEnd(); ++iMap)
     145    {
     146        for (i = (*iMap).constBegin(); i != (*iMap).constEnd(); ++i)
     147            (*i)->Load();
     148    }
     149   
     150}
     151void StandardSetting::Save(void)
     152{
     153/*
     154    Storage *s = GetStorage();
     155    if (s)s->Save();*/
     156
     157    m_haveChanged=false;
     158
     159    SaveChildren();
     160}
     161
     162void StandardSetting::SaveChildren(void)
     163{
     164    //we save only the relevant children
     165    QList<StandardSetting *> *children = getSubSettings();
     166    if (children==NULL) return;
     167    QList<StandardSetting *>::const_iterator i;
     168    for (i = children->constBegin(); i != children->constEnd(); ++i)
     169        (*i)->Save();
     170}
     171
     172/*******************************************************************************
     173                            Group Setting
     174********************************************************************************/
     175GroupSetting::GroupSetting():
     176    StandardSetting(this), TransientStorage()
     177{
     178/*    setLabel("This group need a name");
     179    setHelpText("This group need a description");*/
     180}
     181
     182void GroupSetting::edit(MythScreenType * screen)
     183{
     184    if (!isEnabled())return;
     185    DialogCompletionEvent *dce =
     186            new DialogCompletionEvent("leveldown", 0, "", "");
     187    QCoreApplication::postEvent(screen, dce);
     188}
     189
     190void GroupSetting::updateButton(MythUIButtonListItem *item)
     191{
     192    item->setEnabled(isEnabled());
     193    item->SetText(label);
     194    item->SetText(settingValue,"value");
     195    item->SetText(getHelpText(),"description");
     196    item->setDrawArrow (haveSubSettings());
     197}
     198
     199/*
     200void GroupValueSetting::addChild(StandardSetting *child)
     201{
     202    GroupSetting::addChild(child);
     203    connect(child,SIGNAL(valueChanged(StandardSetting *)),
     204        this, SLOT(childChanged(StandardSetting *)));
     205}*/
     206
     207
     208/*******************************************************************************
     209                            Text Setting
     210********************************************************************************/
     211
     212MythUITextEditSetting::MythUITextEditSetting(Storage *_storage):
     213    StandardSetting(_storage)
     214{
     215}
     216
     217void MythUITextEditSetting::edit(MythScreenType * screen)
     218{
     219    if (!isEnabled())return;
     220    MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
     221
     222    MythTextInputDialog *settingdialog =
     223                                    new MythTextInputDialog(popupStack,
     224                                    getLabel(),FilterNone, false,settingValue);
     225
     226    if (settingdialog->Create())
     227    {
     228        settingdialog->SetReturnEvent(screen, "editsetting");
     229        popupStack->AddScreen(settingdialog);
     230    }
     231};
     232
     233void MythUITextEditSetting::resultEdit(DialogCompletionEvent *dce)
     234{
     235    if (settingValue!=dce->GetResultText())
     236    {
     237        setValue(dce->GetResultText());
     238        m_haveChanged=true;
     239    }
     240}
     241
     242
     243/*******************************************************************************
     244                            Directory Setting
     245********************************************************************************/
     246
     247MythUIFileBrowserSetting::MythUIFileBrowserSetting(Storage *_storage):
     248    StandardSetting(_storage)
     249{
     250    m_typeFilter = (QDir::AllDirs | QDir::Drives | QDir::Files |
     251                    QDir::Readable | QDir::Writable | QDir::Executable);
     252    m_nameFilter.clear();
     253    m_nameFilter << "*";
     254}
     255
     256void MythUIFileBrowserSetting::edit(MythScreenType * screen)
     257{
     258    if (!isEnabled())return;
     259    MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
     260
     261    MythUIFileBrowser *settingdialog =
     262                                    new MythUIFileBrowser(popupStack,
     263                                    settingValue);
     264    settingdialog->SetTypeFilter(m_typeFilter);
     265    settingdialog->SetNameFilter(m_nameFilter);
     266
     267    if (settingdialog->Create())
     268    {
     269        settingdialog->SetReturnEvent(screen, "editsetting");
     270        popupStack->AddScreen(settingdialog);
     271    }
     272};
     273
     274void MythUIFileBrowserSetting::resultEdit(DialogCompletionEvent *dce)
     275{
     276    if (settingValue!=dce->GetResultText())
     277    {
     278        setValue(dce->GetResultText());
     279        m_haveChanged=true;
     280    }
     281}
     282
     283/*******************************************************************************
     284                            ComboBoxSetting
     285********************************************************************************/
     286//TODO do something when rw=true
     287MythUIComboBoxSetting::MythUIComboBoxSetting(Storage *_storage, bool rw):
     288    StandardSetting(_storage),
     289    m_isSet(false)
     290{
     291}
     292
     293MythUIComboBoxSetting::~MythUIComboBoxSetting()
     294{
     295    m_labels.clear();
     296    m_values.clear();
     297}
     298
     299void MythUIComboBoxSetting::setValue(int value)
     300{
     301    if (value>=0 && value < m_values.size())
     302            StandardSetting::setValue(m_values.at(value));
     303}
     304
     305void MythUIComboBoxSetting::addSelection(const QString &label, QString value,
     306                                 bool select)
     307{
     308    value = (value.isEmpty()) ? label : value;
     309    m_labels.push_back(label);
     310    m_values.push_back(value);
     311
     312    if (select || !m_isSet)
     313    {
     314        StandardSetting::setValue(value);
     315        if (!m_isSet) m_isSet = true;
     316    }
     317}
     318
     319void MythUIComboBoxSetting::clearSelections()
     320{
     321    m_labels.clear();
     322    m_values.clear();
     323}
     324
     325void MythUIComboBoxSetting::updateButton(MythUIButtonListItem *item)
     326{
     327    item->setEnabled(isEnabled());
     328    item->SetText(label);
     329    int indexValue = m_values.indexOf(settingValue);
     330    if (indexValue >=0)
     331        item->SetText(m_labels.value(indexValue),"value");
     332    else
     333        item->SetText("","value");
     334    item->SetText(getHelpText(),"description");
     335    item->setDrawArrow (haveSubSettings());
     336}
     337
     338void MythUIComboBoxSetting::edit(MythScreenType * screen)
     339{
     340    if (!isEnabled())return;
     341    MythScreenStack *popupStack =
     342                            GetMythMainWindow()->GetStack("popup stack");
     343
     344    MythDialogBox * m_menuPopup =
     345            new MythDialogBox(getLabel(), popupStack, "optionmenu");
     346
     347    if (m_menuPopup->Create())
     348        popupStack->AddScreen(m_menuPopup);
     349
     350    m_menuPopup->SetReturnEvent(screen, "editsetting");
     351
     352    for (int i = 0; i < m_labels.size() && m_values.size(); ++i)
     353    {
     354        QString value = m_values.at(i);
     355        m_menuPopup->AddButton(m_labels.at(i),value,false,value==settingValue);
     356    }
     357}
     358
     359void MythUIComboBoxSetting::resultEdit(DialogCompletionEvent *dce)
     360{
     361    if (dce->GetResult()!=-1 && settingValue!=dce->GetData().toString())
     362    {
     363        StandardSetting::setValue(dce->GetData().toString());
     364        m_haveChanged=true;
     365    }
     366}
     367
     368
     369/*******************************************************************************
     370                            SpinBox Setting
     371********************************************************************************/
     372MythUISpinBoxSetting::MythUISpinBoxSetting(Storage *_storage, int min, int max, int step, bool allow_single_step):
     373    StandardSetting(_storage),
     374    m_min(min),
     375    m_max(max),
     376    m_step(step),
     377    m_allow_single_step(allow_single_step)
     378{
     379    //we default to 0 unless 0 is out of range
     380    if (m_min >0 || m_max < 0)settingValue=m_min;
     381}
     382
     383void MythUISpinBoxSetting::setValue(int value)
     384{
     385    StandardSetting::setValue(QString::number(value));
     386}
     387
     388int MythUISpinBoxSetting::intValue()
     389{
     390    return settingValue.toInt();
     391}
     392
     393void MythUISpinBoxSetting::edit(MythScreenType * screen)
     394{
     395    if (!isEnabled())return;
     396
     397    MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
     398
     399    MythSpinBoxDialog *settingdialog =
     400                                    new MythSpinBoxDialog(popupStack,
     401                                    getLabel());
     402
     403    if (settingdialog->Create())
     404    {
     405        settingdialog->SetRange(m_min, m_max, m_step);
     406        settingdialog->SetValue(settingValue);
     407        settingdialog->SetReturnEvent(screen, "editsetting");
     408        popupStack->AddScreen(settingdialog);
     409    }
     410};
     411
     412void MythUISpinBoxSetting::resultEdit(DialogCompletionEvent *dce)
     413{
     414    if (settingValue!=dce->GetResultText())
     415    {
     416        bool ok;
     417        int value = dce->GetResultText().toInt(&ok);
     418        ok = ok && (value>=m_min) && (value<=m_max);
     419        if (ok && !m_allow_single_step && m_step>0)
     420        {
     421            ok = ((value-m_min)%m_step)==0;
     422        }
     423        if (ok) //TODO give user some feedback
     424        {
     425            StandardSetting::setValue(dce->GetResultText());
     426            m_haveChanged=true;
     427        }
     428    }
     429}
     430
     431/*******************************************************************************
     432                           MythUICheckBoxSetting
     433********************************************************************************/
     434
     435MythUICheckBoxSetting::MythUICheckBoxSetting(Storage *_storage):
     436    StandardSetting(_storage)
     437{
     438}
     439
     440bool MythUICheckBoxSetting::boolValue()
     441{
     442    return settingValue=="1";
     443}
     444
     445
     446void MythUICheckBoxSetting::setValue(bool value)
     447{
     448    //Why does the polymorphism does not work here
     449    StandardSetting::setValue(value?"1":"0");
     450}
     451
     452void MythUICheckBoxSetting::updateButton(MythUIButtonListItem *item)
     453{
     454    item->SetText(label);
     455    item->setCheckable (true);
     456    item->setEnabled(isEnabled());
     457    item->SetText("","value");
     458    item->SetText(getHelpText(),"description");
     459    if (settingValue=="1")
     460        item->setChecked(MythUIButtonListItem::FullChecked);
     461    else
     462        item->setChecked(MythUIButtonListItem::NotChecked);
     463    item->setDrawArrow(haveSubSettings());
     464}
     465
     466void MythUICheckBoxSetting::edit(MythScreenType * screen)
     467{
     468    if (!isEnabled())return;
     469    DialogCompletionEvent *dce =
     470            new DialogCompletionEvent("editsetting", 0, "", "");
     471    QCoreApplication::postEvent(screen, dce);
     472}
     473
     474void MythUICheckBoxSetting::resultEdit(DialogCompletionEvent *dce)
     475{
     476    setValue(!boolValue());
     477    m_haveChanged=true;
     478}
     479
     480/*******************************************************************************
     481                           Standard setting dialog
     482********************************************************************************/
     483
     484StandardSettingDialog::StandardSettingDialog(MythScreenStack *parent, const char *name) :
     485    MythScreenType(parent, name),
     486    m_buttonList(0),
     487    m_title(0),
     488    m_groupHelp(0),
     489    m_selectedSettingHelp(0),
     490    m_menuPopup(0),
     491    m_settingsTree(0),
     492    m_currentGroupSetting(0)
     493{
     494}
     495
     496StandardSettingDialog::~StandardSettingDialog()
     497{
     498    LOG(VB_GENERAL, LOG_ERR, "StandardSettingDialog::~StandardSettingDialog()");
     499    if (m_settingsTree!=0)
     500        m_settingsTree->deleteLater();
     501}
     502
     503bool StandardSettingDialog::Create(void)
     504{
     505    if (!LoadWindowFromXML("standardsetting-ui.xml", "settingssetup", this))
     506        return false;
     507
     508    bool error=false;
     509    UIUtilE::Assign(this, m_title, "title",&error);
     510    UIUtilW::Assign(this, m_groupHelp, "grouphelp",&error);
     511    UIUtilE::Assign(this, m_buttonList,"settingslist",&error);
     512
     513    UIUtilW::Assign(this, m_selectedSettingHelp, "selectedsettinghelp");
     514
     515    connect(m_buttonList,SIGNAL(itemSelected(MythUIButtonListItem*)),
     516        this,SLOT(settingSelected(MythUIButtonListItem*)));
     517    connect(m_buttonList,SIGNAL(itemClicked(MythUIButtonListItem*)),
     518        this,SLOT(settingClicked(MythUIButtonListItem*)));
     519
     520    if (error)
     521    {
     522        LOG(VB_GENERAL, LOG_ERR, "error.");
     523        return false;
     524    }
     525    BuildFocusList();
     526
     527    return true;
     528}
     529
     530void StandardSettingDialog::settingSelected(MythUIButtonListItem *item)
     531{
     532    if (!item)return;
     533
     534    StandardSetting * setting = qVariantValue<StandardSetting*>(item->GetData());
     535    if (setting && m_selectedSettingHelp)
     536    {
     537        m_selectedSettingHelp->SetText(setting->getHelpText());
     538        if (m_selectedSettingHelp->GetText().isEmpty()) m_selectedSettingHelp->SetText("This setting need a description");
     539    }
     540}
     541
     542void StandardSettingDialog::settingClicked(MythUIButtonListItem *item)
     543{
     544    StandardSetting* setting = item->GetData().value<StandardSetting*>();
     545    if (setting)
     546    {
     547        setting->edit(this);
     548    }
     549}
     550
     551void StandardSettingDialog::customEvent(QEvent *event)
     552{
     553    if (event->type() == DialogCompletionEvent::kEventType)
     554    {
     555        DialogCompletionEvent *dce = (DialogCompletionEvent*)(event);
     556        QString resultid  = dce->GetId();
     557
     558        if (resultid == "leveldown")
     559        {
     560            //a GroupSetting have been clicked
     561            LevelDown();
     562        }
     563        else if (resultid == "editsetting")
     564        {
     565            MythUIButtonListItem * item = m_buttonList->GetItemCurrent();
     566            if (item)
     567            {
     568                StandardSetting * ss = item->GetData().value<StandardSetting*>();
     569                if (ss)
     570                {
     571                    ss->resultEdit(dce);
     572                }
     573            }
     574        }
     575        else if (resultid == "exit")
     576        {
     577            int buttonnum = dce->GetResult();
     578            if (buttonnum == 0)
     579            {
     580                Save();
     581                MythScreenType::Close();
     582                if (m_settingsTree)
     583                    m_settingsTree->applyChange();
     584            }
     585            else if (buttonnum == 1)
     586                MythScreenType::Close();
     587        }
     588    }
     589}
     590
     591void StandardSettingDialog::loadSettings(GroupSetting * groupSettings)
     592{
     593    //TODO I  probably should do this in the background ?
     594    m_settingsTree=groupSettings;
     595    if (m_settingsTree)
     596        m_settingsTree->Load();
     597
     598    setCurrentGroupSetting(m_settingsTree);
     599}
     600
     601void StandardSettingDialog::setCurrentGroupSetting(StandardSetting * groupSettings,
     602        StandardSetting * selectedSetting )
     603{
     604    if (!groupSettings) return;
     605
     606    m_currentGroupSetting=groupSettings;
     607    m_buttonList->Reset();
     608
     609    m_title->SetText(m_currentGroupSetting->getLabel());
     610    if (m_title->GetText().isEmpty()) m_title->SetText("This group need a title");
     611    if (m_groupHelp)
     612    {
     613        m_groupHelp->SetText(m_currentGroupSetting->getHelpText());
     614        if (m_groupHelp->GetText().isEmpty()) m_groupHelp->SetText("This group need a description");
     615    }
     616    if (!m_currentGroupSetting->haveSubSettings())return;
     617    QList<StandardSetting *> * settings = m_currentGroupSetting->getSubSettings();
     618    if (settings==NULL ) return;
     619    QList<StandardSetting *>::const_iterator i;
     620    MythUIButtonListItem *selectedItem=0;
     621    for (i = settings->constBegin(); i != settings->constEnd(); ++i)
     622    {
     623        if (selectedSetting == (*i))
     624            selectedItem =(*i)->createButton(m_buttonList);
     625        else
     626            (*i)->createButton(m_buttonList);
     627    }
     628    if (selectedItem)
     629        m_buttonList->SetItemCurrent(selectedItem);
     630    settingSelected(m_buttonList->GetItemCurrent());
     631
     632}
     633
     634void StandardSettingDialog::Save()
     635{
     636    if (m_settingsTree)
     637        m_settingsTree->Save();
     638}
     639
     640void StandardSettingDialog::LevelUp()
     641{
     642    if (!m_currentGroupSetting) return;
     643    if (m_currentGroupSetting->getParent())
     644    {
     645        setCurrentGroupSetting(m_currentGroupSetting->getParent(),
     646                    m_currentGroupSetting);
     647    }
     648}
     649
     650void StandardSettingDialog::LevelDown()
     651{
     652    MythUIButtonListItem * item = m_buttonList->GetItemCurrent();
     653    if (item)
     654    {
     655        StandardSetting * ss = item->GetData().value<StandardSetting*>();
     656        if (ss && ss->haveSubSettings() && ss->isEnabled())
     657            setCurrentGroupSetting(ss);
     658    }
     659}
     660
     661void StandardSettingDialog::Close(void)
     662{
     663    if (m_settingsTree->haveChanged())
     664    {
     665        QString label = tr("Exit ?");
     666
     667        MythScreenStack *popupStack =
     668                                GetMythMainWindow()->GetStack("popup stack");
     669
     670        MythDialogBox * m_menuPopup =
     671                new MythDialogBox(label, popupStack, "exitmenu");
     672
     673        if (m_menuPopup->Create())
     674            popupStack->AddScreen(m_menuPopup);
     675
     676        m_menuPopup->SetReturnEvent(this, "exit");
     677
     678        m_menuPopup->AddButton(tr("Save then Exit"));
     679        m_menuPopup->AddButton(tr("Exit without saving changes"));
     680        m_menuPopup->AddButton(tr("Cancel"));
     681    }
     682    else
     683        MythScreenType::Close();
     684}
     685
     686
     687bool StandardSettingDialog::keyPressEvent(QKeyEvent *e)
     688{
     689    QStringList actions;
     690    bool handled = m_buttonList->keyPressEvent(e);
     691    if (handled) return true;
     692    handled = GetMythMainWindow()->TranslateKeyPress("Global", e, actions);
     693
     694    for (int i = 0; i < actions.size() && !handled; i++)
     695    {
     696        QString action = actions[i];
     697        handled = true;
     698
     699        if (action == "LEFT")
     700        {
     701            if (m_currentGroupSetting
     702                && m_currentGroupSetting==m_settingsTree)
     703                Close();
     704            else
     705                LevelUp();
     706        }
     707        else if (action == "RIGHT")
     708            LevelDown();
     709        else
     710            handled = MythScreenType::keyPressEvent(e);
     711    }
     712
     713    return handled;
     714}
     715
     716
     717
     718
     719
  • new file mythtv/programs/mythfrontend/standardsettings.h

    diff --git a/mythtv/programs/mythfrontend/standardsettings.h b/mythtv/programs/mythfrontend/standardsettings.h
    new file mode 100755
    index 0000000..740f96f
    - +  
     1#ifndef STANDARDSETTINGS_H_
     2#define STANDARDSETTINGS_H_
     3
     4#include "mythuibuttonlist.h"
     5#include <mythdialogbox.h>
     6#include <mythuibuttontree.h>
     7#include <mythgenerictree.h>
     8#include <QMap>
     9#include "settings.h"
     10
     11#include "mythlogging.h"
     12
     13class StandardSetting;
     14
     15class MythUIButtonListItemSetting : public QObject, public MythUIButtonListItem
     16{
     17    Q_OBJECT
     18  public:
     19        MythUIButtonListItemSetting (MythUIButtonList *lbtype, const QString &text)
     20            :MythUIButtonListItem(lbtype,text){}
     21  public slots:
     22    void ShouldUpdate(StandardSetting *setting);
     23};
     24
     25
     26//TODO drop this class and include it in StandardSetting
     27class MPUBLIC NewConfigurable : public QObject
     28{
     29    Q_OBJECT
     30
     31  public:
     32
     33    virtual void updateButton(MythUIButtonListItem *item)=0;
     34
     35    // A label displayed to the user
     36    virtual void setLabel(QString str) { label = str; }
     37    QString getLabel(void) const { return label; }
     38
     39    virtual void setHelpText(const QString &str)
     40        { helptext = str; }
     41    QString getHelpText(void) const { return helptext; }
     42
     43    void setVisible(bool b) { m_visible = b; };
     44    bool isVisible(void) const { return m_visible; };
     45
     46    virtual void setEnabled(bool b) { m_enabled = b; }
     47    bool isEnabled() { return m_enabled; }
     48
     49    Storage *GetStorage(void) { return storage; }
     50
     51  protected:
     52    NewConfigurable(Storage *_storage) :
     53        m_enabled(true), storage(_storage),
     54        label(""), helptext(""), m_visible(true) { }
     55    virtual ~NewConfigurable() { }
     56
     57  protected:
     58    bool m_enabled;
     59    Storage *storage;
     60    QString configName;
     61    QString label;
     62    QString helptext;
     63    bool m_visible;
     64};
     65
     66//Copy of Setting class
     67class MPUBLIC StandardSetting : public NewConfigurable, public StorageUser
     68{
     69    Q_OBJECT
     70
     71  public:
     72    // Gets
     73    virtual QString getValue(void) const
     74        {return settingValue;}
     75
     76    virtual void updateButton(MythUIButtonListItem *item);
     77
     78    // StorageUser
     79    void SetDBValue(const QString &val) { setValue(val); }
     80    QString GetDBValue(void) const { return getValue(); }
     81
     82    //added by xavier
     83    virtual void setEnabled(bool b);
     84    MythUIButtonListItem * createButton(MythUIButtonList * list);
     85    //subsettings
     86    virtual void addChild(StandardSetting *child);
     87    virtual QList<StandardSetting *> *getSubSettings();
     88    virtual bool haveSubSettings();
     89
     90    StandardSetting * getParent();
     91    virtual void edit(MythScreenType * screen)=0;
     92    virtual void resultEdit(DialogCompletionEvent *dce)=0;
     93    //must be a better way
     94    virtual void Load(void);
     95    virtual void Save(void);
     96
     97
     98    void addTargetedChild(const QString &value, StandardSetting * setting);
     99    bool haveChanged();
     100    //added by xavier end
     101  public slots:
     102    virtual void setValue(const QString &newValue);
     103
     104  signals:
     105    void valueChanged(StandardSetting *);
     106    void ShouldRedraw(StandardSetting *);
     107
     108  protected:
     109    StandardSetting(Storage *_storage);
     110    virtual ~StandardSetting();
     111
     112  protected:
     113    void setParent(StandardSetting *parent);
     114    QString settingValue;
     115    void LoadChildren(void);
     116    void SaveChildren(void);
     117    bool m_haveChanged;
     118  private:
     119    StandardSetting * m_parent;
     120    QList<StandardSetting *> m_children;
     121    QMap<QString, QList<StandardSetting *> > m_targets;
     122};
     123
     124
     125/*******************************************************************************
     126*                           TextEdit Setting                                   *
     127*******************************************************************************/
     128
     129
     130class MPUBLIC MythUITextEditSetting : public StandardSetting
     131{
     132  public:
     133    virtual void resultEdit(DialogCompletionEvent *dce);
     134    virtual void edit(MythScreenType * screen);
     135  protected:
     136    MythUITextEditSetting (Storage *_storage);
     137   
     138};
     139
     140
     141class MPUBLIC TransTextEditSetting: public MythUITextEditSetting, public TransientStorage
     142{
     143  public:
     144    TransTextEditSetting() :
     145        MythUITextEditSetting(this), TransientStorage() { }
     146
     147    //Don't want to have to do that but cannot think of a work around
     148    virtual void Load(){MythUITextEditSetting::Load();}
     149    virtual void Save(){MythUITextEditSetting::Save();}
     150};
     151
     152
     153class MPUBLIC HostTextEditSetting: public MythUITextEditSetting, public HostDBStorage
     154{
     155  public:
     156    HostTextEditSetting(const QString &name) :
     157        MythUITextEditSetting(this), HostDBStorage(this, name) { }
     158
     159    //Don't want to have to do that but cannot think of a work around
     160    virtual void Load(){MythUITextEditSetting::Load();HostDBStorage::Load();}
     161    virtual void Save(){MythUITextEditSetting::Save();HostDBStorage::Save();}
     162};
     163
     164
     165/*******************************************************************************
     166*                           Directory Setting                                  *
     167*******************************************************************************/
     168
     169
     170class MPUBLIC MythUIFileBrowserSetting : public StandardSetting
     171{
     172  public:
     173    virtual void resultEdit(DialogCompletionEvent *dce);
     174    virtual void edit(MythScreenType * screen);
     175    void SetTypeFilter(QDir::Filters filter) { m_typeFilter = filter; };
     176    void SetNameFilter(QStringList filter) { m_nameFilter = filter; };
     177  protected:
     178    MythUIFileBrowserSetting (Storage *_storage);
     179    QDir::Filters      m_typeFilter;
     180    QStringList        m_nameFilter;
     181   
     182};
     183
     184
     185class MPUBLIC HostFileBrowserSetting: public MythUIFileBrowserSetting, public HostDBStorage
     186{
     187  public:
     188    HostFileBrowserSetting(const QString &name) :
     189        MythUIFileBrowserSetting(this), HostDBStorage(this, name) { }
     190
     191    //Don't want to have to do that but cannot think of a work around
     192    virtual void Load(){MythUIFileBrowserSetting::Load();HostDBStorage::Load();}
     193    virtual void Save(){MythUIFileBrowserSetting::Save();HostDBStorage::Save();}
     194};
     195
     196
     197/*******************************************************************************
     198*                           ComboBox Setting                                   *
     199*******************************************************************************/
     200//TODO implement rw=true
     201class MPUBLIC MythUIComboBoxSetting : public StandardSetting
     202{
     203  public:
     204    void setValue(int value);
     205    virtual void resultEdit(DialogCompletionEvent *dce);
     206    virtual void edit(MythScreenType * screen);
     207    void addSelection(const QString &label, QString value = QString::null, bool select = false);
     208    void clearSelections();
     209    virtual void updateButton(MythUIButtonListItem *item);
     210  protected:
     211    MythUIComboBoxSetting (Storage *_storage, bool rw = false);
     212    ~MythUIComboBoxSetting();
     213
     214  private:
     215    QVector<QString> m_labels;
     216    QVector<QString> m_values;
     217    bool m_isSet;
     218   
     219};
     220
     221class MPUBLIC HostComboBoxSetting: public MythUIComboBoxSetting, public HostDBStorage
     222{
     223  public:
     224    HostComboBoxSetting(const QString &name, bool rw = false) :
     225        MythUIComboBoxSetting(this, rw), HostDBStorage(this, name) { }
     226
     227    //Don't want to have to do that but cannot think of a work around
     228    virtual void Load(){MythUIComboBoxSetting::Load();HostDBStorage::Load();}
     229    virtual void Save(){MythUIComboBoxSetting::Save();HostDBStorage::Save();}
     230};
     231
     232
     233class MPUBLIC GlobalComboBoxSetting: public MythUIComboBoxSetting, public GlobalDBStorage
     234{
     235  public:
     236    GlobalComboBoxSetting(const QString &name, bool rw = false) :
     237        MythUIComboBoxSetting(this, rw), GlobalDBStorage(this, name) { }
     238
     239    //Don't want to have to do that but cannot think of a work around
     240    virtual void Load(){MythUIComboBoxSetting::Load();GlobalDBStorage::Load();}
     241    virtual void Save(){MythUIComboBoxSetting::Save();GlobalDBStorage::Save();}
     242};
     243
     244/*******************************************************************************
     245*                           SpinBox Setting                                    *
     246*******************************************************************************/
     247
     248
     249class MPUBLIC MythUISpinBoxSetting : public StandardSetting
     250{
     251  public:
     252    void setValue(int value);
     253    int intValue();
     254    virtual void resultEdit(DialogCompletionEvent *dce);
     255    virtual void edit(MythScreenType * screen);
     256  protected:
     257    MythUISpinBoxSetting (Storage *_storage, int min, int max, int step, bool allow_single_step);
     258  private:
     259    int m_min;
     260    int m_max;
     261    int m_step;
     262    bool m_allow_single_step;
     263   
     264};
     265
     266class MPUBLIC TransMythUISpinBoxSetting: public MythUISpinBoxSetting, public TransientStorage
     267{
     268  public:
     269    TransMythUISpinBoxSetting(int min, int max, int step, bool allow_single_step=false) :
     270        MythUISpinBoxSetting(this, min, max, step, allow_single_step), TransientStorage() { }
     271
     272    //Don't want to have to do that but cannot think of a work around
     273    virtual void Load(){MythUISpinBoxSetting::Load();}
     274    virtual void Save(){MythUISpinBoxSetting::Save();}
     275};
     276
     277class MPUBLIC HostSpinBoxSetting: public MythUISpinBoxSetting, public HostDBStorage
     278{
     279  public:
     280    HostSpinBoxSetting(const QString &name, int min, int max, int step, bool allow_single_step=false) :
     281        MythUISpinBoxSetting(this, min, max, step, allow_single_step), HostDBStorage(this, name) { }
     282
     283    //Don't want to have to do that but cannot think of a work around
     284    virtual void Load(){MythUISpinBoxSetting::Load();HostDBStorage::Load();}
     285    virtual void Save(){MythUISpinBoxSetting::Save();HostDBStorage::Save();}
     286};
     287
     288class MPUBLIC GlobalSpinBoxSetting: public MythUISpinBoxSetting, public GlobalDBStorage
     289{
     290  public:
     291    GlobalSpinBoxSetting(const QString &name, int min, int max, int step, bool allow_single_step=false) :
     292        MythUISpinBoxSetting(this, min, max, step, allow_single_step), GlobalDBStorage(this, name) { }
     293
     294    //Don't want to have to do that but cannot think of a work around
     295    virtual void Load(){MythUISpinBoxSetting::Load();GlobalDBStorage::Load();}
     296    virtual void Save(){MythUISpinBoxSetting::Save();GlobalDBStorage::Save();}
     297};
     298
     299/*******************************************************************************
     300*                           CheckBox Setting                                   *
     301*******************************************************************************/
     302
     303class MPUBLIC MythUICheckBoxSetting : public StandardSetting
     304{
     305  public:
     306    virtual void resultEdit(DialogCompletionEvent *dce);
     307    virtual void edit(MythScreenType * screen);
     308    virtual void updateButton(MythUIButtonListItem *item);
     309    void setValue(bool value);
     310    bool boolValue();
     311  protected:
     312    MythUICheckBoxSetting (Storage *_storage);
     313   
     314};
     315
     316class MPUBLIC TransMythUICheckBoxSetting: public MythUICheckBoxSetting, public TransientStorage
     317{
     318  public:
     319    TransMythUICheckBoxSetting() :
     320        MythUICheckBoxSetting(this), TransientStorage() { }
     321    //Don't want to have to do that but cannot think of a work around
     322    /*virtual void Load(){MythUICheckBoxSetting::Load();HostDBStorage::Load();}
     323    virtual void Save(){MythUICheckBoxSetting::Save();HostDBStorage::Save();}*/
     324};
     325
     326class MPUBLIC HostCheckBoxSetting: public MythUICheckBoxSetting, public HostDBStorage
     327{
     328  public:
     329    HostCheckBoxSetting(const QString &name, bool rw = true) :
     330        MythUICheckBoxSetting(this), HostDBStorage(this, name) { }
     331    //Don't want to have to do that but cannot think of a work around
     332    virtual void Load(){MythUICheckBoxSetting::Load();HostDBStorage::Load();}
     333    virtual void Save(){MythUICheckBoxSetting::Save();HostDBStorage::Save();}
     334};
     335
     336class MPUBLIC GlobalCheckBoxSetting: public MythUICheckBoxSetting, public GlobalDBStorage
     337{
     338  public:
     339    GlobalCheckBoxSetting(const QString &name, bool rw = true) :
     340        MythUICheckBoxSetting(this), GlobalDBStorage(this, name) { }
     341    //Don't want to have to do that but cannot think of a work around
     342    virtual void Load(){MythUICheckBoxSetting::Load();GlobalDBStorage::Load();}
     343    virtual void Save(){MythUICheckBoxSetting::Save();GlobalDBStorage::Save();}
     344};
     345
     346/*******************************************************************************
     347*                              Group Setting                                   *
     348*******************************************************************************/
     349
     350class GroupSetting : public StandardSetting, public TransientStorage
     351{
     352  public:
     353    GroupSetting();
     354
     355    virtual void Load(void){StandardSetting::Load();};
     356    virtual void Save(void){StandardSetting::Save();};
     357    virtual void edit(MythScreenType * screen);
     358    virtual void resultEdit(DialogCompletionEvent *dce){};
     359    virtual void applyChange(){};
     360    virtual void updateButton(MythUIButtonListItem *item);
     361};
     362
     363/**
     364 * Upgate the "Value" of a group when a child value changed
     365 * This class is done so we can use slots/signal while the class remain private
     366 */
     367class GroupValueSetting : public GroupSetting
     368{
     369    Q_OBJECT
     370  public:
     371    GroupValueSetting():GroupSetting(){};
     372  private slots:
     373    virtual void childChanged(StandardSetting *setting) = 0;
     374   
     375};
     376
     377/*******************************************************************************
     378*                            Standard Dialog Setting                            *
     379*******************************************************************************/
     380
     381class StandardSettingDialog : public MythScreenType
     382{
     383    Q_OBJECT
     384
     385  public:
     386
     387    StandardSettingDialog(MythScreenStack *parent, const char *name);
     388    virtual ~StandardSettingDialog();
     389    bool Create(void);
     390    void loadSettings(GroupSetting * groupSettings);
     391    virtual void customEvent(QEvent *event);
     392    virtual bool keyPressEvent(QKeyEvent *);
     393  public slots:
     394    void Close(void);
     395  protected:
     396
     397    MythUIButtonList *m_buttonList;
     398  private slots:
     399    void settingSelected(MythUIButtonListItem *item);
     400    void settingClicked(MythUIButtonListItem *item);
     401  private:
     402    void LevelUp();
     403    void LevelDown();
     404    void setCurrentGroupSetting(StandardSetting * groupSettings,StandardSetting * selectedSetting=0);
     405    void Save();
     406    MythUIText      *m_title;
     407    MythUIText      *m_groupHelp;
     408    MythUIText      *m_selectedSettingHelp;
     409    MythDialogBox   *m_menuPopup;
     410    GroupSetting    *m_settingsTree;
     411    StandardSetting *m_currentGroupSetting;
     412    bool m_loaded;
     413};
     414
     415Q_DECLARE_METATYPE(StandardSetting *);
     416
     417
     418#endif
  • 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();
  • new file mythtv/themes/default-wide/standardsetting-ui.xml

    diff --git a/mythtv/themes/default-wide/standardsetting-ui.xml b/mythtv/themes/default-wide/standardsetting-ui.xml
    new file mode 100644
    index 0000000..03bc4e8
    - +  
     1<?xml version="1.0" encoding="utf-8"?>
     2<!DOCTYPE mythuitheme SYSTEM "http://www.mythtv.org/schema/mythuitheme.dtd">
     3
     4<!-- theme.xml for the MythCenter theme - by Jeroen Brosens -->
     5<mythuitheme>
     6    <window name="settingssetup">
     7
     8        <textarea name="title" from="basetextarea">
     9            <area>30,15,100%-30,30</area>
     10            <font>baselarge</font>
     11            <align>hcenter</align>
     12        </textarea>
     13
     14        <shape name="GroupHelpBackground">
     15            <area>15,80,100%-15,80</area>
     16            <type>roundbox</type>
     17            <cornerradius>10</cornerradius>
     18            <fill color="#FFFFFF" alpha="30" />
     19        </shape>
     20
     21        <!-- optionnal, display the help for the current group of settings -->
     22        <textarea name="grouphelp" from="basetextarea">
     23            <area>30,90-120,100%-30,60</area>
     24            <font>basesmall</font>
     25            <align>lefthcenter</align>
     26            <multiline>yes</multiline>
     27        </textarea>
     28
     29        <buttonlist name="settingslist"  from="basebuttonlist">
     30            <area>100,200,100%-100,100%-160</area>
     31            <layout>grid</layout>
     32            <spacing>4</spacing>
     33            <wrapstyle>selection</wrapstyle>
     34            <arrange>stack</arrange>
     35            <statetype name="buttonitem">
     36                <area>0,0,100%,30</area>
     37                <state name="active">
     38                    <area>0,0,100%,30</area>
     39                    <shape name="buttonbackground">
     40                        <area>0,0,100%,100%</area>
     41                        <fill style="gradient">
     42                            <gradient start="#505050" end="#000000" alpha="200" direction="vertical"  />
     43                        </fill>
     44                    </shape>
     45                    <!--shape name="buttonbackgroundvalue">
     46                        <area>50%,0,100%-23,100%</area>
     47                        <type>roundbox</type>
     48                        <cornerradius>10</cornerradius>
     49                    </shape-->
     50                    <textarea name="buttontext">
     51                        <area>5,0,50%-10,30</area>
     52                        <font>basesmall</font>
     53                        <cutdown>yes</cutdown>
     54                        <align>left,vcenter</align>
     55                    </textarea>
     56                    <textarea name="value">
     57                        <area>50%+5,0,100%-30,30</area>
     58                        <font>basesmall</font>
     59                        <cutdown>yes</cutdown>
     60                        <align>right,vcenter</align>
     61                    </textarea>
     62                    <!--textarea name="description">
     63                        <area>5,50%,100%-40,100%</area>
     64                        <font>basesmall</font>
     65                        <cutdown>yes</cutdown>
     66                        <multiline>yes</multiline>
     67                    </textarea-->
     68                    <statetype name="buttoncheck">
     69                        <position>100%-46,5</position>
     70                        <state type="off">
     71                            <imagetype name="checkoff">
     72                                <filename>lb-check-empty.png</filename>
     73                            </imagetype>
     74                        </state>
     75                        <state type="half">
     76                            <imagetype name="checkhalf">
     77                                <filename>lb-check-half.png</filename>
     78                            </imagetype>
     79                        </state>
     80                        <state type="full">
     81                            <imagetype name="checkfull">
     82                                <filename>lb-check-full.png</filename>
     83                            </imagetype>
     84                        </state>
     85                    </statetype>
     86                    <imagetype name="buttonarrow">
     87                        <position>100%-23,7</position>
     88                        <filename>lb-arrow.png</filename>
     89                    </imagetype>
     90                </state>
     91                <state name="selectedactive" from="active">
     92                    <shape name="buttonbackground">
     93                        <fill style="gradient">
     94                            <gradient start="#52CA38" end="#349838" alpha="255" />
     95                        </fill>
     96                    </shape>
     97                </state>
     98                <state name="disabledactive" from="selectedactive">
     99                    <!--area>0,0,0,0</area-->
     100                    <shape name="buttonbackground">
     101                        <fill style="gradient">
     102                            <gradient start="#888888" end="#777777" alpha="255" />
     103                        </fill>
     104                    </shape>
     105                    <statetype name="buttoncheck">
     106                        <state type="off">
     107                            <imagetype name="checkoff">
     108                                <grayscale>true</grayscale>
     109                                <filename>lb-check-empty-grey.png</filename>
     110                            </imagetype>
     111                        </state>
     112                        <state type="half">
     113                            <imagetype name="checkhalf">
     114                                <grayscale>true</grayscale>
     115                                <filename>lb-check-half.png</filename>
     116                            </imagetype>
     117                        </state>
     118                        <state type="full">
     119                            <imagetype name="checkfull">
     120                                <grayscale>true</grayscale>
     121                                <filename>lb-check-half.png</filename>
     122                            </imagetype>
     123                        </state>
     124                    </statetype>
     125                </state>
     126                <state name="disabledinactive" from="disabledactive">
     127                </state>
     128                <state name="selectedinactive" from="active">
     129                </state>
     130            </statetype>
     131        </buttonlist>
     132
     133        <shape name="HelpBackground">
     134            <!--area>15,600,100%-30,100</area-->
     135            <area>15,100%-140,100%-15,80</area>
     136            <type>roundbox</type>
     137            <cornerradius>10</cornerradius>
     138            <fill color="#000000" alpha="30" />
     139        </shape>
     140
     141        <!-- optionnal, display the help for the currently selected setting -->
     142        <textarea name="selectedsettinghelp" from="basetextarea">
     143            <area>30,100%-120,100%-30,60</area>
     144            <font>basesmall</font>
     145            <multiline>yes</multiline>
     146        </textarea>
     147    </window>
     148</mythuitheme>