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

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

More setting converted to MythUI: General, TV Settings General, TV Settings Program Guide, TV Settings PlayBack OSD, General Video Setting

  • mythtv/programs/mythfrontend/globalsettings.cpp

    diff --git a/mythtv/programs/mythfrontend/globalsettings.cpp b/mythtv/programs/mythfrontend/globalsettings.cpp
    index 7e6fad3..aa01e7a 100644
    a b static HostCheckBox *ExactSeeking()  
    167167    return gc;
    168168}
    169169
    170 static GlobalComboBox *CommercialSkipMethod()
     170static GlobalComboBoxSetting *CommercialSkipMethod()
    171171{
    172     GlobalComboBox *bc = new GlobalComboBox("CommercialSkipMethod");
     172    GlobalComboBoxSetting *bc = new GlobalComboBoxSetting("CommercialSkipMethod");
    173173    bc->setLabel(QObject::tr("Commercial detection method"));
    174174    bc->setHelpText(QObject::tr(
    175175                        "This determines the method used by MythTV to "
    static GlobalComboBox *CommercialSkipMethod()  
    182182    return bc;
    183183}
    184184
    185 static GlobalCheckBox *CommFlagFast()
     185static GlobalCheckBoxSetting *CommFlagFast()
    186186{
    187     GlobalCheckBox *gc = new GlobalCheckBox("CommFlagFast");
     187    GlobalCheckBoxSetting *gc = new GlobalCheckBoxSetting("CommFlagFast");
    188188    gc->setLabel(QObject::tr("Enable experimental speedup of commercial detection"));
    189189    gc->setValue(false);
    190190    gc->setHelpText(QObject::tr("If enabled, experimental commercial detection "
    static HostComboBox *AutoCommercialSkip()  
    206206    return gc;
    207207}
    208208
    209 static GlobalCheckBox *AutoMetadataLookup()
     209static GlobalCheckBoxSetting *AutoMetadataLookup()
    210210{
    211     GlobalCheckBox *bc = new GlobalCheckBox("AutoMetadataLookup");
     211    GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("AutoMetadataLookup");
    212212    bc->setLabel(QObject::tr("Run metadata lookup"));
    213213    bc->setValue(true);
    214214    bc->setHelpText(QObject::tr("This is the default value used for the "
    static GlobalCheckBox *AutoMetadataLookup()  
    217217    return bc;
    218218}
    219219
    220 static GlobalCheckBox *AutoCommercialFlag()
     220static GlobalCheckBoxSetting *AutoCommercialFlag()
    221221{
    222     GlobalCheckBox *bc = new GlobalCheckBox("AutoCommercialFlag");
     222    GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("AutoCommercialFlag");
    223223    bc->setLabel(QObject::tr("Run commercial detection"));
    224224    bc->setValue(true);
    225225    bc->setHelpText(QObject::tr("This is the default value used for the "
    static GlobalCheckBox *AutoCommercialFlag()  
    228228    return bc;
    229229}
    230230
    231 static GlobalCheckBox *AutoTranscode()
     231static GlobalCheckBoxSetting *AutoTranscode()
    232232{
    233     GlobalCheckBox *bc = new GlobalCheckBox("AutoTranscode");
     233    GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("AutoTranscode");
    234234    bc->setLabel(QObject::tr("Run transcoder"));
    235235    bc->setValue(false);
    236236    bc->setHelpText(QObject::tr("This is the default value used for the "
    static GlobalCheckBox *AutoTranscode()  
    239239    return bc;
    240240}
    241241
    242 static GlobalComboBox *DefaultTranscoder()
     242/*TODO This function is borrowed from RecordingProfile::fillSelections and sligthly modified
     243I will need to change the original to use a pure abstract class instead of SelectSetting
     244*/
     245void RecordingProfile_fillSelections(MythUIComboBoxSetting *setting, int group,
     246                                      bool foldautodetect)
    243247{
    244     GlobalComboBox *bc = new GlobalComboBox("DefaultTranscoder");
     248    if (!group)
     249    {
     250       for (uint i = 0; !availProfiles[i].isEmpty(); i++)
     251           setting->addSelection(availProfiles[i], availProfiles[i]);
     252       return;
     253    }
     254
     255    MSqlQuery result(MSqlQuery::InitCon());
     256    result.prepare(
     257        "SELECT name, id "
     258        "FROM recordingprofiles "
     259        "WHERE profilegroup = :GROUP "
     260        "ORDER BY id");
     261    result.bindValue(":GROUP", group);
     262
     263    if (!result.exec())
     264    {
     265        MythDB::DBError("RecordingProfile::fillSelections 1", result);
     266        return;
     267    }
     268    else if (!result.next())
     269    {
     270        return;
     271    }
     272
     273    if (group == RecordingProfile::TranscoderGroup && foldautodetect)
     274    {
     275        QString id = QString::number(RecordingProfile::TranscoderAutodetect);
     276        setting->addSelection(QObject::tr("Autodetect"), id);
     277    }
     278
     279    do
     280    {
     281        QString name = result.value(0).toString();
     282        QString id   = result.value(1).toString();
     283
     284        if (group == RecordingProfile::TranscoderGroup)
     285        {
     286            if (name == "RTjpeg/MPEG4" || name == "MPEG2")
     287            {
     288                if (!foldautodetect)
     289                {
     290                    setting->addSelection(
     291                        QObject::tr("Autodetect from %1").arg(name), id);
     292                }
     293            }
     294            else
     295            {
     296                setting->addSelection(name, id);
     297            }
     298            continue;
     299        }
     300
     301        setting->addSelection(name, id);
     302    }
     303    while (result.next());
     304}
     305
     306static GlobalComboBoxSetting *DefaultTranscoder()
     307{
     308    GlobalComboBoxSetting *bc = new GlobalComboBoxSetting("DefaultTranscoder");
    245309    bc->setLabel(QObject::tr("Default transcoder"));
    246     RecordingProfile::fillSelections(bc, RecordingProfile::TranscoderGroup,
     310    RecordingProfile_fillSelections(bc, RecordingProfile::TranscoderGroup,
    247311                                     true);
     312
    248313    bc->setHelpText(QObject::tr("This is the default value used for the "
    249314                    "transcoder setting when a new scheduled "
    250315                    "recording is created."));
    251316    return bc;
    252317}
    253318
    254 static GlobalSpinBox *DeferAutoTranscodeDays()
     319static GlobalSpinBoxSetting *DeferAutoTranscodeDays()
    255320{
    256     GlobalSpinBox *gs = new GlobalSpinBox("DeferAutoTranscodeDays", 0, 365, 1);
     321    GlobalSpinBoxSetting *gs = new GlobalSpinBoxSetting("DeferAutoTranscodeDays", 0, 365, 1);
    257322    gs->setLabel(QObject::tr("Deferral days for auto transcode jobs"));
    258323    gs->setHelpText(QObject::tr("If non-zero, automatic transcode jobs will "
    259324                    "be scheduled to run this many days after a recording "
    static GlobalSpinBox *DeferAutoTranscodeDays()  
    262327    return gs;
    263328}
    264329
    265 static GlobalCheckBox *AutoRunUserJob(uint job_num)
     330static GlobalCheckBoxSetting *AutoRunUserJob(uint job_num)
    266331{
    267332    QString dbStr = QString("AutoRunUserJob%1").arg(job_num);
    268333    QString label = QObject::tr("Run user job #%1")
    269334        .arg(job_num);
    270     GlobalCheckBox *bc = new GlobalCheckBox(dbStr);
     335    GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting(dbStr);
    271336    bc->setLabel(label);
    272337    bc->setValue(false);
    273338    bc->setHelpText(QObject::tr("This is the default value used for the "
    static GlobalCheckBox *AutoRunUserJob(uint job_num)  
    278343    return bc;
    279344}
    280345
    281 static GlobalCheckBox *AggressiveCommDetect()
     346static GlobalCheckBoxSetting *AggressiveCommDetect()
    282347{
    283     GlobalCheckBox *bc = new GlobalCheckBox("AggressiveCommDetect");
     348    GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("AggressiveCommDetect");
    284349    bc->setLabel(QObject::tr("Strict commercial detection"));
    285350    bc->setValue(true);
    286351    bc->setHelpText(QObject::tr("Enable stricter commercial detection code. "
    static GlobalSpinBox *MergeShortCommBreaks()  
    334399    return bs;
    335400}
    336401
    337 static GlobalSpinBox *AutoExpireExtraSpace()
     402static GlobalSpinBoxSetting *AutoExpireExtraSpace()
    338403{
    339     GlobalSpinBox *bs = new GlobalSpinBox("AutoExpireExtraSpace", 0, 200, 1);
     404    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("AutoExpireExtraSpace", 0, 200, 1);
    340405    bs->setLabel(QObject::tr("Extra disk space (GB)"));
    341406    bs->setHelpText(QObject::tr("Extra disk space (in gigabytes) beyond what "
    342407                    "MythTV requires that you want to keep free on the "
    static GlobalSpinBox *AutoExpireExtraSpace()  
    345410    return bs;
    346411};
    347412
    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()
     413static GlobalSpinBoxSetting *DeletedMaxAge()
    360414{
    361     GlobalSpinBox *bs = new GlobalSpinBox("DeletedMaxAge", 0, 365, 1);
     415    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("DeletedMaxAge", 0, 365, 1);
    362416    bs->setLabel(QObject::tr("Deleted max age (days)"));
    363417    bs->setHelpText(QObject::tr("When set to a number greater than zero, "
    364418                    "Auto-Expire will force expiration of Deleted recordings "
    static GlobalSpinBox *DeletedMaxAge()  
    367421    return bs;
    368422};
    369423
    370 static GlobalCheckBox *DeletedFifoOrder()
     424static GlobalCheckBoxSetting *DeletedFifoOrder()
    371425{
    372     GlobalCheckBox *cb = new GlobalCheckBox("DeletedFifoOrder");
     426    GlobalCheckBoxSetting *cb = new GlobalCheckBoxSetting("DeletedFifoOrder");
    373427    cb->setLabel(QObject::tr("Expire in deleted order"));
    374428    cb->setValue(false);
    375429    cb->setHelpText(QObject::tr(
    static GlobalCheckBox *DeletedFifoOrder()  
    378432    return cb;
    379433};
    380434
    381 class DeletedExpireOptions : public TriggeredConfigurationGroup
     435static GlobalCheckBoxSetting *AutoExpireInsteadOfDelete()
     436{
     437    GlobalCheckBoxSetting *cb = new GlobalCheckBoxSetting("AutoExpireInsteadOfDelete");
     438    cb->setLabel(QObject::tr("Auto-Expire instead of delete recording"));
     439    cb->setValue(false);
     440    cb->setHelpText(QObject::tr("If enabled, move deleted recordings to the "
     441                    "'Deleted' recgroup and turn on autoexpire "
     442                    "instead of deleting immediately."));
     443
     444    cb->addTargetedChild("1",DeletedFifoOrder());
     445    cb->addTargetedChild("1",DeletedMaxAge());
     446    return cb;
     447}
     448/*
     449
     450static DeletedExpireOptions : public TriggeredConfigurationGroup
    382451{
    383452    public:
    384453     DeletedExpireOptions() :
    class DeletedExpireOptions : public TriggeredConfigurationGroup  
    399468             addTarget("0", new HorizontalConfigurationGroup(true));
    400469         };
    401470};
     471*/
    402472
    403 static GlobalComboBox *AutoExpireMethod()
     473static GlobalComboBoxSetting *AutoExpireMethod()
    404474{
    405     GlobalComboBox *bc = new GlobalComboBox("AutoExpireMethod");
     475    GlobalComboBoxSetting *bc = new GlobalComboBoxSetting("AutoExpireMethod");
    406476    bc->setLabel(QObject::tr("Auto-Expire method"));
    407477    bc->addSelection(QObject::tr("Oldest show first"), "1");
    408478    bc->addSelection(QObject::tr("Lowest priority first"), "2");
    static GlobalComboBox *AutoExpireMethod()  
    414484    return bc;
    415485}
    416486
    417 static GlobalCheckBox *AutoExpireWatchedPriority()
     487static GlobalCheckBoxSetting *AutoExpireWatchedPriority()
    418488{
    419     GlobalCheckBox *bc = new GlobalCheckBox("AutoExpireWatchedPriority");
     489    GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("AutoExpireWatchedPriority");
    420490    bc->setLabel(QObject::tr("Watched before unwatched"));
    421491    bc->setValue(false);
    422492    bc->setHelpText(QObject::tr("If enabled, programs that have been marked as "
    static GlobalCheckBox *AutoExpireWatchedPriority()  
    425495    return bc;
    426496}
    427497
    428 static GlobalSpinBox *AutoExpireDayPriority()
     498static GlobalSpinBoxSetting *AutoExpireDayPriority()
    429499{
    430     GlobalSpinBox *bs = new GlobalSpinBox("AutoExpireDayPriority", 1, 400, 1);
     500    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("AutoExpireDayPriority", 1, 400, 1);
    431501    bs->setLabel(QObject::tr("Priority weight"));
    432502    bs->setHelpText(QObject::tr("The number of days bonus a program gets for "
    433503                    "each priority point. This is only used when the Weighted "
    static GlobalSpinBox *AutoExpireDayPriority()  
    436506    return bs;
    437507};
    438508
    439 static GlobalCheckBox *AutoExpireDefault()
     509static GlobalCheckBoxSetting *AutoExpireDefault()
    440510{
    441     GlobalCheckBox *bc = new GlobalCheckBox("AutoExpireDefault");
     511    GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("AutoExpireDefault");
    442512    bc->setLabel(QObject::tr("Auto-Expire default"));
    443513    bc->setValue(true);
    444514    bc->setHelpText(QObject::tr("If enabled, any new recording schedules "
    static GlobalCheckBox *AutoExpireDefault()  
    447517    return bc;
    448518}
    449519
    450 static GlobalSpinBox *AutoExpireLiveTVMaxAge()
     520static GlobalSpinBoxSetting *AutoExpireLiveTVMaxAge()
    451521{
    452     GlobalSpinBox *bs = new GlobalSpinBox("AutoExpireLiveTVMaxAge", 1, 365, 1);
     522    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("AutoExpireLiveTVMaxAge", 1, 365, 1);
    453523    bs->setLabel(QObject::tr("Live TV max age (days)"));
    454524    bs->setHelpText(QObject::tr("Auto-Expire will force expiration of Live "
    455525                    "TV recordings when they are this many days old. Live TV "
    456526                    "recordings may also be expired early if necessary to "
    457527                    "free up disk space."));
    458     bs->setValue(1);
     528    bs->setValue((int)1);
    459529    return bs;
    460530};
    461531
    static GlobalSpinBox *MinRecordDiskThreshold()  
    474544}
    475545#endif
    476546
    477 static GlobalCheckBox *RerecordWatched()
     547static GlobalCheckBoxSetting *RerecordWatched()
    478548{
    479     GlobalCheckBox *bc = new GlobalCheckBox("RerecordWatched");
     549    GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("RerecordWatched");
    480550    bc->setLabel(QObject::tr("Re-record watched"));
    481551    bc->setValue(false);
    482552    bc->setHelpText(QObject::tr("If enabled, programs that have been marked as "
    static GlobalCheckBox *RerecordWatched()  
    485555    return bc;
    486556}
    487557
    488 static GlobalSpinBox *RecordPreRoll()
     558static GlobalSpinBoxSetting *RecordPreRoll()
    489559{
    490     GlobalSpinBox *bs = new GlobalSpinBox("RecordPreRoll", 0, 600, 60, true);
     560    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("RecordPreRoll", 0, 600, 60, true);
    491561    bs->setLabel(QObject::tr("Time to record before start of show "
    492562                 "(secs)"));
    493563    bs->setHelpText(QObject::tr("This global setting allows the recorder "
    static GlobalSpinBox *RecordPreRoll()  
    498568    return bs;
    499569}
    500570
    501 static GlobalSpinBox *RecordOverTime()
     571static GlobalSpinBoxSetting *RecordOverTime()
    502572{
    503     GlobalSpinBox *bs = new GlobalSpinBox("RecordOverTime", 0, 1800, 60, true);
     573    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("RecordOverTime", 0, 1800, 60, true);
    504574    bs->setLabel(QObject::tr("Time to record past end of show (secs)"));
    505575    bs->setValue(0);
    506576    bs->setHelpText(QObject::tr("This global setting allows the recorder "
    static GlobalSpinBox *RecordOverTime()  
    510580    return bs;
    511581}
    512582
    513 static GlobalComboBox *OverTimeCategory()
     583static GlobalComboBoxSetting *OverTimeCategory()
    514584{
    515     GlobalComboBox *gc = new GlobalComboBox("OverTimeCategory");
     585    GlobalComboBoxSetting *gc = new GlobalComboBoxSetting("OverTimeCategory");
    516586    gc->setLabel(QObject::tr("Category of shows to be extended"));
    517587    gc->setHelpText(QObject::tr("For a special category (e.g. "
    518588                    "\"Sports event\"), request that shows be autoextended. "
    519589                    "Only works if a show's category can be determined."));
    520590
    521591    MSqlQuery query(MSqlQuery::InitCon());
     592    //TODO We should not have any SQL here
    522593    query.prepare("SELECT DISTINCT category FROM program GROUP BY category;");
    523594
    524595    gc->addSelection("", "");
     596
    525597    if (query.exec())
    526598    {
    527599        while (query.next())
    static GlobalComboBox *OverTimeCategory()  
    535607    return gc;
    536608}
    537609
    538 static GlobalSpinBox *CategoryOverTime()
     610static GlobalSpinBoxSetting *CategoryOverTime()
    539611{
    540     GlobalSpinBox *bs = new GlobalSpinBox("CategoryOverTime",
     612    GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("CategoryOverTime",
    541613                                          0, 180, 60, true);
    542614    bs->setLabel(QObject::tr("Record past end of show (mins)"));
    543615    bs->setValue(30);
    static GlobalSpinBox *CategoryOverTime()  
    548620    return bs;
    549621}
    550622
    551 static VerticalConfigurationGroup *CategoryOverTimeSettings()
     623static GroupSetting *CategoryOverTimeSettings()
    552624{
    553     VerticalConfigurationGroup *vcg =
    554         new VerticalConfigurationGroup(false, false);
    555 
     625    GroupSetting *vcg = new GroupSetting();
    556626    vcg->setLabel(QObject::tr("Category record over-time"));
    557     vcg->setUseLabel(true);
    558627    vcg->addChild(OverTimeCategory());
    559628    vcg->addChild(CategoryOverTime());
    560629    return vcg;
    static HostComboBox MUNUSED *DecodeVBIFormat()  
    13481417    return gc;
    13491418}
    13501419
    1351 static HostSpinBox *OSDCC708TextZoomPercentage(void)
     1420static HostSpinBoxSetting *OSDCC708TextZoomPercentage(void)
    13521421{
    1353     HostSpinBox *gs = new HostSpinBox("OSDCC708TextZoom", 50, 200, 5);
     1422    HostSpinBoxSetting *gs = new HostSpinBoxSetting("OSDCC708TextZoom", 50, 200, 5);
    13541423    gs->setLabel(QObject::tr("Subtitle text zoom percentage"));
    13551424    gs->setValue(100);
    13561425    gs->setHelpText(QObject::tr("Use this to enlarge or shrink text based subtitles."));
    static HostSpinBox *OSDCC708TextZoomPercentage(void)  
    13581427    return gs;
    13591428}
    13601429
    1361 static HostComboBox *SubtitleFont()
     1430static HostComboBoxSetting *SubtitleFont()
    13621431{
    1363     HostComboBox *hcb = new HostComboBox("OSDSubFont");
     1432    HostComboBoxSetting *hcb = new HostComboBoxSetting("OSDSubFont");
    13641433    QFontDatabase db;
    13651434    QStringList fonts = db.families();
    13661435    QStringList hide  = db.families(QFontDatabase::Symbol);
    static HostComboBox *SubtitleFont()  
    13751444    return hcb;
    13761445}
    13771446
    1378 static HostComboBox *SubtitleCodec()
     1447static HostComboBoxSetting *SubtitleCodec()
    13791448{
    1380     HostComboBox *gc = new HostComboBox("SubtitleCodec");
     1449    HostComboBoxSetting *gc = new HostComboBoxSetting("SubtitleCodec");
    13811450
    13821451    gc->setLabel(QObject::tr("Subtitle Codec"));
    13831452    QList<QByteArray> list = QTextCodec::availableCodecs();
    static HostComboBox *SubtitleCodec()  
    13901459    return gc;
    13911460}
    13921461
    1393 static HostComboBox *ChannelOrdering()
     1462static HostComboBoxSetting *ChannelOrdering()
    13941463{
    1395     HostComboBox *gc = new HostComboBox("ChannelOrdering");
     1464    HostComboBoxSetting *gc = new HostComboBoxSetting("ChannelOrdering");
    13961465    gc->setLabel(QObject::tr("Channel ordering"));
    13971466    gc->addSelection(QObject::tr("channel number"), "channum");
    13981467    gc->addSelection(QObject::tr("callsign"),       "callsign");
    static HostSpinBox *YScanDisplacement()  
    14391508    return gs;
    14401509};
    14411510
    1442 static HostCheckBox *CCBackground()
     1511static HostCheckBoxSetting *CCBackground()
    14431512{
    1444     HostCheckBox *gc = new HostCheckBox("CCBackground");
     1513    HostCheckBoxSetting *gc = new HostCheckBoxSetting("CCBackground");
    14451514    gc->setLabel(QObject::tr("Black background for closed captioning"));
    14461515    gc->setValue(false);
    14471516    gc->setHelpText(QObject::tr(
    static HostCheckBox *CCBackground()  
    14511520    return gc;
    14521521}
    14531522
    1454 static HostCheckBox *DefaultCCMode()
     1523static HostCheckBoxSetting *DefaultCCMode()
    14551524{
    1456     HostCheckBox *gc = new HostCheckBox("DefaultCCMode");
     1525    HostCheckBoxSetting *gc = new HostCheckBoxSetting("DefaultCCMode");
    14571526    gc->setLabel(QObject::tr("Always display closed captioning or subtitles"));
    14581527    gc->setValue(false);
    14591528    gc->setHelpText(QObject::tr(
    static HostCheckBox *DefaultCCMode()  
    14641533    return gc;
    14651534}
    14661535
    1467 static HostCheckBox *PreferCC708()
     1536static HostCheckBoxSetting *PreferCC708()
    14681537{
    1469     HostCheckBox *gc = new HostCheckBox("Prefer708Captions");
     1538    HostCheckBoxSetting *gc = new HostCheckBoxSetting("Prefer708Captions");
    14701539    gc->setLabel(QObject::tr("Prefer EIA-708 over EIA-608 captions"));
    14711540    gc->setValue(true);
    14721541    gc->setHelpText(
    static HostCheckBox *PreferCC708()  
    14771546    return gc;
    14781547}
    14791548
    1480 static HostCheckBox *EnableMHEG()
     1549static HostCheckBoxSetting *EnableMHEG()
    14811550{
    1482     HostCheckBox *gc = new HostCheckBox("EnableMHEG");
     1551    HostCheckBoxSetting *gc = new HostCheckBoxSetting("EnableMHEG");
    14831552    gc->setLabel(QObject::tr("Enable interactive TV"));
    14841553    gc->setValue(false);
    14851554    gc->setHelpText(QObject::tr(
    static HostCheckBox *EnableMHEG()  
    14891558    return gc;
    14901559}
    14911560
    1492 static HostCheckBox *PersistentBrowseMode()
     1561static HostCheckBoxSetting *PersistentBrowseMode()
    14931562{
    1494     HostCheckBox *gc = new HostCheckBox("PersistentBrowseMode");
     1563    HostCheckBoxSetting *gc = new HostCheckBoxSetting("PersistentBrowseMode");
    14951564    gc->setLabel(QObject::tr("Always use browse mode in Live TV"));
    14961565    gc->setValue(true);
    14971566    gc->setHelpText(
    static HostCheckBox *PersistentBrowseMode()  
    15011570    return gc;
    15021571}
    15031572
    1504 static HostCheckBox *BrowseAllTuners()
     1573static HostCheckBoxSetting *BrowseAllTuners()
    15051574{
    1506     HostCheckBox *gc = new HostCheckBox("BrowseAllTuners");
     1575    HostCheckBoxSetting *gc = new HostCheckBoxSetting("BrowseAllTuners");
    15071576    gc->setLabel(QObject::tr("Browse all channels"));
    15081577    gc->setValue(false);
    15091578    gc->setHelpText(
    static HostSpinBox *LiveTVIdleTimeout()  
    16431712//     return gc;
    16441713// }
    16451714
    1646 static HostCheckBox *UseVirtualKeyboard()
     1715static HostCheckBoxSetting *UseVirtualKeyboard()
    16471716{
    1648     HostCheckBox *gc = new HostCheckBox("UseVirtualKeyboard");
     1717    HostCheckBoxSetting *gc = new HostCheckBoxSetting("UseVirtualKeyboard");
    16491718    gc->setLabel(QObject::tr("Use line edit virtual keyboards"));
    16501719    gc->setValue(true);
    16511720    gc->setHelpText(QObject::tr("If enabled, you can use a virtual keyboard "
    static HostCheckBox *UseVirtualKeyboard()  
    16541723    return gc;
    16551724}
    16561725
    1657 static HostComboBox *OverrideExitMenu()
     1726static HostComboBoxSetting *OverrideExitMenu()
    16581727{
    1659     HostComboBox *gc = new HostComboBox("OverrideExitMenu");
     1728    HostComboBoxSetting *gc = new HostComboBoxSetting("OverrideExitMenu");
    16601729    gc->setLabel(QObject::tr("Customize exit menu options"));
    16611730    gc->addSelection(QObject::tr("Default"), "0");
    16621731    gc->addSelection(QObject::tr("Show quit"), "1");
    static HostComboBox *OverrideExitMenu()  
    16711740    return gc;
    16721741}
    16731742
    1674 static HostLineEdit *RebootCommand()
     1743static HostTextEditSetting *RebootCommand()
    16751744{
    1676     HostLineEdit *ge = new HostLineEdit("RebootCommand");
     1745    HostTextEditSetting *ge = new HostTextEditSetting("RebootCommand");
    16771746    ge->setLabel(QObject::tr("Reboot command"));
    16781747    ge->setValue("");
    16791748    ge->setHelpText(QObject::tr("Optional. Script to run if you select "
    static HostLineEdit *RebootCommand()  
    16831752    return ge;
    16841753}
    16851754
    1686 static HostLineEdit *HaltCommand()
     1755static HostTextEditSetting *HaltCommand()
    16871756{
    1688     HostLineEdit *ge = new HostLineEdit("HaltCommand");
     1757    HostTextEditSetting *ge = new HostTextEditSetting("HaltCommand");
    16891758    ge->setLabel(QObject::tr("Halt command"));
    16901759    ge->setValue("");
    16911760    ge->setHelpText(QObject::tr("Optional. Script to run if you select "
    static HostLineEdit *HaltCommand()  
    16951764    return ge;
    16961765}
    16971766
    1698 static HostLineEdit *LircDaemonDevice()
     1767static HostTextEditSetting *LircDaemonDevice()
    16991768{
    1700     HostLineEdit *ge = new HostLineEdit("LircSocket");
     1769    HostTextEditSetting *ge = new HostTextEditSetting("LircSocket");
    17011770    ge->setLabel(QObject::tr("LIRC daemon socket"));
    17021771
    17031772    /* lircd socket moved from /dev/ to /var/run/lirc/ in lirc 0.8.6 */
    static HostLineEdit *LircDaemonDevice()  
    17121781    return ge;
    17131782}
    17141783
    1715 static HostLineEdit *ScreenShotPath()
     1784static HostTextEditSetting *ScreenShotPath()
    17161785{
    1717     HostLineEdit *ge = new HostLineEdit("ScreenShotPath");
     1786    HostTextEditSetting *ge = new HostTextEditSetting("ScreenShotPath");
    17181787    ge->setLabel(QObject::tr("Screen shot path"));
    17191788    ge->setValue("/tmp/");
    17201789    ge->setHelpText(QObject::tr("Path to screenshot storage location. Should be writable by the frontend"));
    17211790    return ge;
    17221791}
    17231792
    1724 static HostLineEdit *SetupPinCode()
     1793static HostTextEditSetting *SetupPinCode()
    17251794{
    1726     HostLineEdit *ge = new HostLineEdit("SetupPinCode");
     1795    HostTextEditSetting *ge = new HostTextEditSetting("SetupPinCode");
    17271796    ge->setLabel(QObject::tr("Setup PIN code"));
    17281797    ge->setHelpText(QObject::tr("This PIN is used to control access to the "
    17291798                    "setup menus. If you want to use this feature, then "
    static HostLineEdit *SetupPinCode()  
    17321801    return ge;
    17331802}
    17341803
    1735 static HostCheckBox *SetupPinCodeRequired()
     1804static HostCheckBoxSetting *SetupPinCodeRequired()
    17361805{
    1737     HostCheckBox *gc = new HostCheckBox("SetupPinCodeRequired");
     1806    HostCheckBoxSetting *gc = new HostCheckBoxSetting("SetupPinCodeRequired");
    17381807    gc->setLabel(QObject::tr("Require setup PIN") + "    ");
    17391808    gc->setValue(false);
    17401809    gc->setHelpText(QObject::tr("If enabled, you will not be able to return "
    static HostComboBox *MythTimeFormat()  
    22192288    return gc;
    22202289}
    22212290
    2222 static HostComboBox *ChannelFormat()
     2291static HostComboBoxSetting *ChannelFormat()
    22232292{
    2224     HostComboBox *gc = new HostComboBox("ChannelFormat");
     2293    HostComboBoxSetting *gc = new HostComboBoxSetting("ChannelFormat");
    22252294    gc->setLabel(QObject::tr("Channel format"));
    22262295    gc->addSelection(QObject::tr("number"), "<num>");
    22272296    gc->addSelection(QObject::tr("number callsign"), "<num> <sign>");
    static HostComboBox *ChannelFormat()  
    22332302    return gc;
    22342303}
    22352304
    2236 static HostComboBox *LongChannelFormat()
     2305static HostComboBoxSetting *LongChannelFormat()
    22372306{
    2238     HostComboBox *gc = new HostComboBox("LongChannelFormat");
     2307    HostComboBoxSetting *gc = new HostComboBoxSetting("LongChannelFormat");
    22392308    gc->setLabel(QObject::tr("Long channel format"));
    22402309    gc->addSelection(QObject::tr("number"), "<num>");
    22412310    gc->addSelection(QObject::tr("number callsign"), "<num> <sign>");
    static HostComboBox *LongChannelFormat()  
    22472316    return gc;
    22482317}
    22492318
    2250 static GlobalCheckBox *LiveTVPriority()
     2319static GlobalCheckBoxSetting *LiveTVPriority()
    22512320{
    2252     GlobalCheckBox *bc = new GlobalCheckBox("LiveTVPriority");
     2321    GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("LiveTVPriority");
    22532322    bc->setLabel(QObject::tr("Allow Live TV to move scheduled shows"));
    22542323    bc->setValue(false);
    22552324    bc->setHelpText(QObject::tr("If enabled, scheduled recordings will "
    static GlobalCheckBox *LiveTVPriority()  
    22582327    return bc;
    22592328}
    22602329
    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 }
    22712330
    2272 static HostComboBox *ChannelGroupDefault()
     2331
     2332static HostComboBoxSetting *ChannelGroupDefault()
    22732333{
    2274     HostComboBox *gc = new HostComboBox("ChannelGroupDefault");
     2334    HostComboBoxSetting *gc = new HostComboBoxSetting("ChannelGroupDefault");
    22752335    gc->setLabel(QObject::tr("Default channel group"));
    22762336
    22772337    ChannelGroupList changrplist;
    static HostComboBox *ChannelGroupDefault()  
    22912351    return gc;
    22922352}
    22932353
    2294 static HostCheckBox *BrowseChannelGroup()
     2354static HostCheckBoxSetting *ChannelGroupRememberLast()
    22952355{
    2296     HostCheckBox *gc = new HostCheckBox("BrowseChannelGroup");
     2356    HostCheckBoxSetting *gc = new HostCheckBoxSetting("ChannelGroupRememberLast");
     2357    gc->setLabel(QObject::tr("Remember last channel group"));
     2358    gc->setHelpText(QObject::tr("If enabled, the EPG will initially display "
     2359                    "only the channels from the last channel group selected. Pressing "
     2360                    "\"4\" will toggle channel group."));
     2361    gc->setValue(false);
     2362    gc->addTargetedChild("0", ChannelGroupDefault());
     2363    return gc;
     2364}
     2365
     2366static HostCheckBoxSetting *BrowseChannelGroup()
     2367{
     2368    HostCheckBoxSetting *gc = new HostCheckBoxSetting("BrowseChannelGroup");
    22972369    gc->setLabel(QObject::tr("Browse/change channels from Channel Group"));
    22982370    gc->setHelpText(QObject::tr("If enabled, Live TV will browse or change "
    22992371                    "channels from the selected channel group. The \"All "
    static HostCheckBox *BrowseChannelGroup()  
    23032375    return gc;
    23042376}
    23052377
    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 
    23282378// General RecPriorities settings
    23292379
    23302380static GlobalCheckBox *GRSchedMoveHigher()
    static GlobalSpinBox *GROverrideRecordRecPriority()  
    25632613    return bs;
    25642614}
    25652615
    2566 static HostLineEdit *DefaultTVChannel()
     2616static HostTextEditSetting *DefaultTVChannel()
    25672617{
    2568     HostLineEdit *ge = new HostLineEdit("DefaultTVChannel");
     2618    HostTextEditSetting *ge = new HostTextEditSetting("DefaultTVChannel");
    25692619    ge->setLabel(QObject::tr("Guide starts at channel"));
    25702620    ge->setValue("3");
    25712621    ge->setHelpText(QObject::tr("The program guide starts on this channel if "
    static HostLineEdit *DefaultTVChannel()  
    25732623    return ge;
    25742624}
    25752625
    2576 static HostSpinBox *EPGRecThreshold()
     2626static HostSpinBoxSetting *EPGRecThreshold()
    25772627{
    2578     HostSpinBox *gs = new HostSpinBox("SelChangeRecThreshold", 1, 600, 1);
     2628    HostSpinBoxSetting *gs = new HostSpinBoxSetting("SelChangeRecThreshold", 1, 600, 1);
    25792629    gs->setLabel(QObject::tr("Record threshold"));
    25802630    gs->setValue(16);
    25812631    gs->setHelpText(QObject::tr("Pressing SELECT on a show that is at least "
    static GlobalComboBox *ISO639PreferredLanguage(uint i)  
    26482698    return gc;
    26492699}
    26502700
    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 }
    26602701
    2661 static HostSpinBox *NetworkControlPort()
     2702static HostSpinBoxSetting *NetworkControlPort()
    26622703{
    2663     HostSpinBox *gs = new HostSpinBox("NetworkControlPort", 1025, 65535, 1);
     2704    HostSpinBoxSetting *gs = new HostSpinBoxSetting("NetworkControlPort", 1025, 65535, 1);
    26642705    gs->setLabel(QObject::tr("Network Remote Control port"));
    26652706    gs->setValue(6546);
    26662707    gs->setHelpText(QObject::tr("This specifies what port the network remote "
    static HostSpinBox *NetworkControlPort()  
    26682709    return gs;
    26692710}
    26702711
    2671 static HostLineEdit *UDPNotifyPort()
     2712static HostTextEditSetting *UDPNotifyPort()
    26722713{
    2673     HostLineEdit *ge = new HostLineEdit("UDPNotifyPort");
     2714    HostTextEditSetting *ge = new HostTextEditSetting("UDPNotifyPort");
    26742715    ge->setLabel(QObject::tr("UDP notify port"));
    26752716    ge->setValue("6948");
    26762717    ge->setHelpText(QObject::tr("MythTV will listen for "
    static HostLineEdit *UDPNotifyPort()  
    26802721    return ge;
    26812722}
    26822723
     2724static HostCheckBoxSetting *NetworkControlEnabled()
     2725{
     2726    HostCheckBoxSetting *gc = new HostCheckBoxSetting("NetworkControlEnabled");
     2727    gc->setLabel(QObject::tr("Enable Network Remote Control interface"));
     2728    gc->setHelpText(QObject::tr("This enables support for controlling "
     2729                    "mythfrontend over the network."));
     2730    gc->setValue(false);
     2731
     2732    gc->addTargetedChild("1",NetworkControlPort());
     2733    gc->addTargetedChild("1",UDPNotifyPort());
     2734    return gc;
     2735}
     2736
    26832737static HostCheckBox *RealtimePriority()
    26842738{
    26852739    HostCheckBox *gc = new HostCheckBox("RealtimePriority");
    static HostCheckBox *RealtimePriority()  
    26922746    return gc;
    26932747}
    26942748
    2695 static HostCheckBox *EnableMediaMon()
     2749static HostTextEditSetting *IgnoreMedia()
    26962750{
    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()
    2708 {
    2709     HostLineEdit *ge = new HostLineEdit("IgnoreDevices");
     2751    HostTextEditSetting *ge = new HostTextEditSetting("IgnoreDevices");
    27102752    ge->setLabel(QObject::tr("Ignore devices"));
    27112753    ge->setValue("");
    27122754    ge->setHelpText(QObject::tr("If there are any devices that you do not want "
    static HostLineEdit *IgnoreMedia()  
    27152757    return ge;
    27162758}
    27172759
    2718 class MythMediaSettings : public TriggeredConfigurationGroup
     2760static HostCheckBoxSetting *EnableMediaMon()
    27192761{
    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 
     2762    HostCheckBoxSetting *gc = new HostCheckBoxSetting("MonitorDrives");
     2763    gc->setLabel(QObject::tr("Monitor CD/DVD") +
     2764                 QObject::tr(" (and other removable devices)"));
     2765    gc->setHelpText(QObject::tr("This enables support for monitoring "
     2766                    "your CD/DVD drives for new disks and launching "
     2767                    "the proper plugin to handle them."));
     2768    gc->setValue(false);
     2769    gc->addTargetedChild("1", IgnoreMedia());
     2770    return gc;
     2771}
    27402772
    27412773static HostComboBox *DisplayGroupTitleSort()
    27422774{
    class MacDesktopSettings : public TriggeredConfigurationGroup  
    32453277};
    32463278#endif
    32473279
    3248 static HostCheckBox *WatchTVGuide()
     3280static HostCheckBoxSetting *WatchTVGuide()
    32493281{
    3250     HostCheckBox *gc = new HostCheckBox("WatchTVGuide");
     3282    HostCheckBoxSetting *gc = new HostCheckBoxSetting("WatchTVGuide");
    32513283    gc->setLabel(QObject::tr("Show the program guide when starting Live TV"));
    32523284    gc->setHelpText(QObject::tr("This starts the program guide immediately "
    32533285             "upon starting to watch Live TV."));
    static HostCheckBox *WatchTVGuide()  
    32553287    return gc;
    32563288}
    32573289
     3290
     3291/* This code is a duplication the clas DatabaseSettings. As it it also use bymythbackend I rewrote here for the time being */
     3292
     3293class DatabaseGroupSetting : public GroupSetting
     3294{
     3295  public:
     3296    DatabaseGroupSetting(const QString &DBhostOverride = QString::null):GroupSetting()
     3297    {
     3298        m_DBhostOverride = DBhostOverride;
     3299
     3300        setLabel(QObject::tr("Database Configuration"));
     3301
     3302        MSqlQuery query(MSqlQuery::InitCon());
     3303        if (query.isConnected())
     3304            setHelpText(QObject::tr("All database settings take effect when "
     3305                                       "you restart this program."));
     3306        else
     3307            setHelpText(QObject::tr("MythTV could not connect to the database. "
     3308                                       "Please verify your database settings "
     3309                                       "below."));
     3310
     3311        dbHostName = new TransTextEditSetting();
     3312        dbHostName->setLabel(QObject::tr("Hostname"));
     3313        dbHostName->setHelpText(QObject::tr("The host name or IP address of "
     3314                                        "the machine hosting the database. "
     3315                                        "This information is required."));
     3316        addChild(dbHostName);
     3317
     3318        dbHostPing = new TransMythUICheckBoxSetting();
     3319        dbHostPing->setLabel(QObject::tr("Ping test server?"));
     3320        dbHostPing->setHelpText(QObject::tr("Test basic host connectivity using "
     3321                                            "the ping command. Turn off if your "
     3322                                            "host or network don't support ping "
     3323                                            "(ICMP ECHO) packets"));
     3324        addChild(dbHostPing);
     3325
     3326        dbPort = new TransTextEditSetting();
     3327        dbPort->setLabel(QObject::tr("Port"));
     3328        dbPort->setHelpText(QObject::tr("The port number the database is running "
     3329                                        "on.  Leave blank if using the default "
     3330                                        "port (3306)."));
     3331        addChild(dbPort);
     3332
     3333        dbName = new TransTextEditSetting();
     3334        dbName->setLabel(QObject::tr("Database name"));
     3335        dbName->setHelpText(QObject::tr("The name of the database. "
     3336                                        "This information is required."));
     3337        addChild(dbName);
     3338
     3339        dbUserName = new TransTextEditSetting();
     3340        dbUserName->setLabel(QObject::tr("User"));
     3341        dbUserName->setHelpText(QObject::tr("The user name to use while "
     3342                                            "connecting to the database. "
     3343                                            "This information is required."));
     3344        addChild(dbUserName);
     3345
     3346        dbPassword = new TransTextEditSetting();
     3347        dbPassword->setLabel(QObject::tr("Password"));
     3348        dbPassword->setHelpText(QObject::tr("The password to use while "
     3349                                            "connecting to the database. "
     3350                                            "This information is required."));
     3351        addChild(dbPassword);
     3352
     3353        localEnabled = new TransMythUICheckBoxSetting();
     3354        localEnabled->setLabel(QObject::tr("Use custom identifier for frontend "
     3355                                           "preferences"));
     3356        localEnabled->setHelpText(QObject::tr("If this frontend's host name "
     3357                                              "changes often, check this box "
     3358                                              "and provide a network-unique "
     3359                                              "name to identify it. "
     3360                                              "If unchecked, the frontend "
     3361                                              "machine's local host name will "
     3362                                              "be used to save preferences in "
     3363                                              "the database."));
     3364        addChild(localEnabled);
     3365
     3366
     3367        localHostName = new TransTextEditSetting();
     3368        localHostName->setLabel(QObject::tr("Custom identifier"));
     3369        localHostName->setHelpText(QObject::tr("An identifier to use while "
     3370                                               "saving the settings for this "
     3371                                               "frontend."));
     3372        localEnabled->addTargetedChild("1", localHostName);
     3373
     3374
     3375        wolEnabled = new TransMythUICheckBoxSetting();
     3376        wolEnabled->setLabel(QObject::tr("Enable database server wakeup"));
     3377        wolEnabled->setHelpText(QObject::tr("If enabled, the frontend will use "
     3378                                            "database wakeup parameters to "
     3379                                            "reconnect to the database server."));
     3380        addChild(wolEnabled);
     3381
     3382        wolReconnect = new TransMythUISpinBoxSetting(0, 60, 1, true);
     3383        wolReconnect->setLabel(QObject::tr("Reconnect time"));
     3384        wolReconnect->setHelpText(QObject::tr("The time in seconds to wait for "
     3385                                          "the server to wake up."));
     3386        wolEnabled->addTargetedChild("1",wolReconnect);
     3387
     3388        wolRetry = new TransMythUISpinBoxSetting(1, 10, 1, true);
     3389        wolRetry->setLabel(QObject::tr("Retry attempts"));
     3390        wolRetry->setHelpText(QObject::tr("The number of retries to wake the "
     3391                                      "server before the frontend gives "
     3392                                      "up."));
     3393        wolEnabled->addTargetedChild("1",wolRetry);
     3394
     3395        wolCommand = new TransTextEditSetting();
     3396        wolCommand->setLabel(QObject::tr("Wake command"));
     3397        wolCommand->setHelpText(QObject::tr("The command executed on this "
     3398                                        "frontend to wake up the database "
     3399                                        "server (eg. sudo /etc/init.d/mysql "
     3400                                        "restart)."));
     3401        wolEnabled->addTargetedChild("1",wolCommand);
     3402    }
     3403
     3404    void Load(void)
     3405    {
     3406
     3407        DatabaseParams params = gContext->GetDatabaseParams();
     3408
     3409        if (params.dbHostName.isEmpty() ||
     3410            params.dbUserName.isEmpty() ||
     3411            params.dbPassword.isEmpty() ||
     3412            params.dbName.isEmpty())
     3413            setHelpText(getHelpText() + "\n" +
     3414                           QObject::tr("Required fields are"
     3415                                       " marked with an asterisk (*)."));
     3416
     3417        if (params.dbHostName.isEmpty())
     3418        {
     3419            dbHostName->setLabel("* " + dbHostName->getLabel());
     3420            dbHostName->setValue(m_DBhostOverride);
     3421        }
     3422        else
     3423            dbHostName->setValue(params.dbHostName);
     3424
     3425        dbHostPing->setValue(params.dbHostPing);
     3426
     3427        if (params.dbPort)
     3428            dbPort->setValue(QString::number(params.dbPort));
     3429
     3430        dbUserName->setValue(params.dbUserName);
     3431        if (params.dbUserName.isEmpty())
     3432            dbUserName->setLabel("* " + dbUserName->getLabel());
     3433        dbPassword->setValue(params.dbPassword);
     3434        if (params.dbPassword.isEmpty())
     3435            dbPassword->setLabel("* " + dbPassword->getLabel());
     3436        dbName->setValue(params.dbName);
     3437        if (params.dbName.isEmpty())
     3438            dbName->setLabel("* " + dbName->getLabel());
     3439
     3440        localEnabled->setValue(params.localEnabled);
     3441        localHostName->setValue(params.localHostName);
     3442
     3443        wolEnabled->setValue(params.wolEnabled);
     3444        wolReconnect->setValue(params.wolReconnect);
     3445        wolRetry->setValue(params.wolRetry);
     3446        wolCommand->setValue(params.wolCommand);
     3447        //TODO set all the children's m_haveChanged to false
     3448    };
     3449    void Save(void)
     3450    {
     3451        DatabaseParams params = gContext->GetDatabaseParams();
     3452
     3453        params.dbHostName    = dbHostName->getValue();
     3454        params.dbHostPing    = dbHostPing->boolValue();
     3455        params.dbPort        = dbPort->getValue().toInt();
     3456        params.dbUserName    = dbUserName->getValue();
     3457        params.dbPassword    = dbPassword->getValue();
     3458        params.dbName        = dbName->getValue();
     3459        params.dbType        = "QMYSQL";
     3460
     3461        params.localEnabled  = localEnabled->boolValue();
     3462        params.localHostName = localHostName->getValue();
     3463
     3464        params.wolEnabled    = wolEnabled->boolValue();
     3465        params.wolReconnect  = wolReconnect->intValue();
     3466        params.wolRetry      = wolRetry->intValue();
     3467        params.wolCommand    = wolCommand->getValue();
     3468
     3469        gContext->SaveDatabaseParams(params);
     3470        //TODO set all the children's m_haveChanged to false
     3471    };
     3472
     3473  protected:
     3474    TransTextEditSetting       *dbHostName;
     3475    TransMythUICheckBoxSetting *dbHostPing;
     3476    TransTextEditSetting       *dbPort;
     3477    TransTextEditSetting       *dbName;
     3478    TransTextEditSetting       *dbUserName;
     3479    TransTextEditSetting       *dbPassword;
     3480    TransMythUICheckBoxSetting *localEnabled;
     3481    TransTextEditSetting       *localHostName;
     3482    TransMythUICheckBoxSetting *wolEnabled;
     3483    TransMythUISpinBoxSetting  *wolReconnect;
     3484    TransMythUISpinBoxSetting  *wolRetry;
     3485    TransTextEditSetting       *wolCommand;
     3486
     3487    QString              m_DBhostOverride;
     3488};
     3489
     3490/* end of duplicated code form DatabaseSettings */
     3491
    32583492MainGeneralSettings::MainGeneralSettings()
    32593493{
    3260     DatabaseSettings::addDatabaseSettings(this);
     3494    //DatabaseSettings::addDatabaseSettings(this);
     3495    setLabel(QObject::tr("Main Settings"));
    32613496
    3262     VerticalConfigurationGroup *pin =
    3263         new VerticalConfigurationGroup(false, true, false, false);
     3497    addChild(new DatabaseGroupSetting());
     3498
     3499    GroupSetting *pin = new GroupSetting();
    32643500    pin->setLabel(QObject::tr("Settings Access"));
    32653501    pin->addChild(SetupPinCodeRequired());
    32663502    pin->addChild(SetupPinCode());
    32673503    addChild(pin);
    32683504
    3269     VerticalConfigurationGroup *general =
    3270         new VerticalConfigurationGroup(false, true, false, false);
     3505    GroupSetting *general = new GroupSetting();
    32713506    general->setLabel(QObject::tr("General"));
    32723507    general->addChild(UseVirtualKeyboard());
    32733508    general->addChild(ScreenShotPath());
    32743509    addChild(general);
    32753510
    3276     VerticalConfigurationGroup *media =
    3277         new VerticalConfigurationGroup(false, true, false, false);
     3511    GroupSetting *media = new GroupSetting();
    32783512    media->setLabel(QObject::tr("Media Monitor"));
    3279     MythMediaSettings *mediaMon = new MythMediaSettings();
    3280     media->addChild(mediaMon);
     3513    media->addChild(EnableMediaMon());
    32813514    addChild(media);
    32823515
    3283     VerticalConfigurationGroup *shutdownSettings =
    3284         new VerticalConfigurationGroup(true, true, false, false);
     3516    GroupSetting *shutdownSettings = new GroupSetting();
    32853517    shutdownSettings->setLabel(QObject::tr("Shutdown/Reboot Settings"));
    32863518    shutdownSettings->addChild(OverrideExitMenu());
    32873519    shutdownSettings->addChild(HaltCommand());
    32883520    shutdownSettings->addChild(RebootCommand());
    32893521    addChild(shutdownSettings);
    32903522
    3291     VerticalConfigurationGroup *remotecontrol =
    3292         new VerticalConfigurationGroup(false, true, false, false);
     3523    GroupSetting *remotecontrol = new GroupSetting();
    32933524    remotecontrol->setLabel(QObject::tr("Remote Control"));
    32943525    remotecontrol->addChild(LircDaemonDevice());
    32953526    remotecontrol->addChild(NetworkControlEnabled());
    3296     remotecontrol->addChild(NetworkControlPort());
    3297     remotecontrol->addChild(UDPNotifyPort());
    32983527    addChild(remotecontrol);
    32993528}
    33003529
    PlaybackSettings::PlaybackSettings()  
    34403669
    34413670OSDSettings::OSDSettings()
    34423671{
    3443     VerticalConfigurationGroup* osd = new VerticalConfigurationGroup(false);
    3444     osd->setLabel(QObject::tr("On-screen Display"));
     3672    setLabel(QObject::tr("On-screen Display"));
    34453673
    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);
     3674    addChild(EnableMHEG());
     3675    addChild(PersistentBrowseMode());
     3676    addChild(BrowseAllTuners());
     3677    addChild(CCBackground());
     3678    addChild(DefaultCCMode());
     3679    addChild(PreferCC708());
     3680    addChild(SubtitleFont());
     3681    addChild(OSDCC708TextZoomPercentage());
     3682    addChild(SubtitleCodec());
    34563683
    34573684    //VerticalConfigurationGroup *cc = new VerticalConfigurationGroup(false);
    34583685    //cc->setLabel(QObject::tr("Closed Captions"));
    OSDSettings::OSDSettings()  
    34673694
    34683695GeneralSettings::GeneralSettings()
    34693696{
    3470     VerticalConfigurationGroup* general = new VerticalConfigurationGroup(false);
     3697    GroupSetting* general = new GroupSetting();
    34713698    general->setLabel(QObject::tr("General (Basic)"));
    34723699    general->addChild(ChannelOrdering());
    34733700    general->addChild(ChannelFormat());
    34743701    general->addChild(LongChannelFormat());
     3702    //LiveTVPriority (backend setting) should probably not be mixed with frontend settings
    34753703    general->addChild(LiveTVPriority());
    34763704    addChild(general);
    34773705
    3478     VerticalConfigurationGroup* autoexp = new VerticalConfigurationGroup(false);
     3706    GroupSetting* autoexp = new GroupSetting();
    34793707    autoexp->setLabel(QObject::tr("General (Auto-Expire)"));
    34803708    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 
     3709    autoexp->addChild(AutoExpireDefault());
     3710    autoexp->addChild(RerecordWatched());
     3711    autoexp->addChild(AutoExpireWatchedPriority());
     3712    autoexp->addChild(AutoExpireLiveTVMaxAge());
     3713    autoexp->addChild(AutoExpireDayPriority());
     3714    autoexp->addChild(AutoExpireExtraSpace());
     3715    autoexp->addChild(AutoExpireInsteadOfDelete());
    35023716    addChild(autoexp);
    35033717
    3504     VerticalConfigurationGroup* jobs = new VerticalConfigurationGroup(false);
     3718    GroupSetting* jobs = new GroupSetting();
    35053719    jobs->setLabel(QObject::tr("General (Jobs)"));
    35063720    jobs->addChild(CommercialSkipMethod());
    35073721    jobs->addChild(CommFlagFast());
    GeneralSettings::GeneralSettings()  
    35093723    jobs->addChild(DefaultTranscoder());
    35103724    jobs->addChild(DeferAutoTranscodeDays());
    35113725
    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);
     3726    GroupSetting *autogrp = new GroupSetting();
    35273727    autogrp->setLabel(
    35283728        QObject::tr("Default Job Queue Settings for New Scheduled Recordings"));
    3529     autogrp->addChild(autogrp0);
    3530     autogrp->addChild(autogrp1);
     3729    autogrp->addChild(AutoMetadataLookup());
     3730    autogrp->addChild(AutoCommercialFlag());
     3731    autogrp->addChild(AutoTranscode());
     3732    autogrp->addChild(AutoRunUserJob(1));
     3733    autogrp->addChild(AutoRunUserJob(2));
     3734    autogrp->addChild(AutoRunUserJob(3));
     3735    autogrp->addChild(AutoRunUserJob(4));
     3736
    35313737    jobs->addChild(autogrp);
    35323738
    35333739    addChild(jobs);
    35343740
    3535     VerticalConfigurationGroup* general2 = new VerticalConfigurationGroup(false);
     3741    GroupSetting* general2 = new GroupSetting();
    35363742    general2->setLabel(QObject::tr("General (Advanced)"));
    35373743    general2->addChild(RecordPreRoll());
    35383744    general2->addChild(RecordOverTime());
    35393745    general2->addChild(CategoryOverTimeSettings());
    35403746    addChild(general2);
    35413747
    3542     VerticalConfigurationGroup* changrp = new VerticalConfigurationGroup(false);
     3748    GroupSetting* changrp = new GroupSetting();
    35433749    changrp->setLabel(QObject::tr("General (Channel Groups)"));
    3544     ChannelGroupSettings *changroupsettings = new ChannelGroupSettings();
    3545     changrp->addChild(changroupsettings);
     3750    changrp->addChild(ChannelGroupRememberLast());
    35463751    changrp->addChild(BrowseChannelGroup());
    35473752    addChild(changrp);
    35483753}
    35493754
    35503755EPGSettings::EPGSettings()
    35513756{
    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);
     3757    setLabel(QObject::tr("Program Guide"));
     3758    addChild(WatchTVGuide());
     3759    addChild(DefaultTVChannel());
     3760    addChild(EPGRecThreshold());
    35583761}
    35593762
    35603763GeneralRecPrioritiesSettings::GeneralRecPrioritiesSettings()
  • mythtv/programs/mythfrontend/globalsettings.h

    diff --git a/mythtv/programs/mythfrontend/globalsettings.h b/mythtv/programs/mythfrontend/globalsettings.h
    index 93e774a..efdd110 100644
    a b  
    77#include "settings.h"
    88#include "mythcontext.h"
    99#include "videodisplayprofile.h"
     10#include "standardsettings.h"
    1011
    1112#include <QMutex>
    1213
    class PlaybackSettings : public ConfigurationWizard  
    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();
    class AppearanceSettings : public ConfigurationWizard  
    4245    AppearanceSettings();
    4346};
    4447
    45 class MainGeneralSettings : public ConfigurationWizard
     48class MainGeneralSettings : public GroupSetting
    4649{
    4750  public:
    4851    MainGeneralSettings();
  • mythtv/programs/mythfrontend/main.cpp

    diff --git a/mythtv/programs/mythfrontend/main.cpp b/mythtv/programs/mythfrontend/main.cpp
    index 259e020..173ddec 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)  
    898906    }
    899907    else if (sel == "settings general")
    900908    {
    901         GeneralSettings settings;
    902         settings.exec();
     909        MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
     910        StandardSettingDialog *ssd = new StandardSettingDialog(mainStack, "videogeneralsettings");
     911
     912        if (ssd->Create())
     913        {
     914            ssd->loadSettings(new GeneralSettings());
     915            mainStack->AddScreen(ssd);
     916        }
     917        else
     918            delete ssd;
    903919    }
    904920    else if (sel == "settings audiogeneral")
    905921    {
    static void TVMenuCallback(void *data, QString &selection)  
    908924    }
    909925    else if (sel == "settings maingeneral")
    910926    {
    911         MainGeneralSettings mainsettings;
    912         mainsettings.exec();
    913         QStringList strlist( QString("REFRESH_BACKEND") );
    914         gCoreContext->SendReceiveStringList(strlist);
     927        MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
     928        StandardSettingDialog *ssd = new StandardSettingDialog(mainStack, "videogeneralsettings");
     929
     930        if (ssd->Create())
     931        {
     932            ssd->loadSettings(new MainGeneralSettings());
     933            mainStack->AddScreen(ssd);
     934        }
     935        else
     936            delete ssd;
     937        /*TODO QStringList strlist( QString("REFRESH_BACKEND") );
     938        gCoreContext->SendReceiveStringList(strlist);*/
    915939    }
    916940    else if (sel == "settings playback")
    917941    {
    static void TVMenuCallback(void *data, QString &selection)  
    920944    }
    921945    else if (sel == "settings osd")
    922946    {
    923         OSDSettings settings;
    924         settings.exec();
     947        MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
     948        StandardSettingDialog *ssd = new StandardSettingDialog(mainStack, "videogeneralsettings");
     949
     950        if (ssd->Create())
     951        {
     952            ssd->loadSettings(new OSDSettings());
     953            mainStack->AddScreen(ssd);
     954        }
     955        else
     956            delete ssd;
    925957    }
    926958    else if (sel == "settings epg")
    927959    {
    928         EPGSettings settings;
    929         settings.exec();
     960        MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
     961        StandardSettingDialog *ssd = new StandardSettingDialog(mainStack, "videogeneralsettings");
     962
     963        if (ssd->Create())
     964        {
     965            ssd->loadSettings(new EPGSettings());
     966            mainStack->AddScreen(ssd);
     967        }
     968        else
     969            delete ssd;
    930970    }
    931971    else if (sel == "settings channelgroups")
    932972    {
  • 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..d4e61a3
    - +  
     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 "mythlogging.h"
     11
     12
     13MythUIButtonListItem * NewConfigurable::createButton(MythUIButtonList * list)
     14{
     15    MythUIButtonListItem *item = new MythUIButtonListItem(list, label);
     16    updateButton(item);
     17    return item;
     18}
     19
     20StandardSetting::StandardSetting(Storage *_storage) :
     21    NewConfigurable(_storage),
     22    m_haveChanged(false),
     23    m_parent(0)
     24
     25{
     26}
     27
     28StandardSetting::~StandardSetting()
     29{   
     30    QList<StandardSetting *>::const_iterator i;
     31    for (i = m_children.constBegin(); i != m_children.constEnd(); ++i)
     32        delete *i;
     33    m_children.clear();
     34
     35    QMap<QString, QList<StandardSetting *> >::const_iterator iMap;
     36    for (iMap = m_targets.constBegin(); iMap != m_targets.constEnd(); ++iMap)
     37    {
     38        for (i = (*iMap).constBegin(); i != (*iMap).constEnd(); ++i)
     39            delete *i;
     40    }
     41    m_targets.clear();
     42}
     43
     44void StandardSetting::setParent(StandardSetting *parent)
     45{
     46    m_parent = parent;
     47}
     48
     49StandardSetting * StandardSetting::getParent()
     50{
     51    return m_parent;
     52}
     53
     54void StandardSetting::addChild(StandardSetting *child)
     55{
     56    if (!child)return;
     57    m_children.append(child);
     58    child->setParent(this);
     59}
     60
     61void StandardSetting::updateButton(MythUIButtonListItem *item)
     62{
     63    item->SetText(label);
     64    item->SetText(settingValue,"value");
     65    item->setDrawArrow (haveSubSettings());
     66    item->SetData(qVariantFromValue(this));
     67
     68}
     69
     70void StandardSetting::addTargetedChild(const QString &value, StandardSetting * setting)
     71{
     72    m_targets[value].append(setting);
     73    setting->setParent(this);
     74}
     75
     76
     77QList<StandardSetting *> *StandardSetting::getSubSettings()
     78{
     79    if (settingValue.isEmpty())
     80        return &m_children;
     81    else if (m_targets.contains(settingValue))
     82        return &m_targets[settingValue];
     83    return NULL;
     84}
     85
     86bool StandardSetting::haveSubSettings()
     87{
     88    QList<StandardSetting *> * subSettings=getSubSettings();
     89    return (subSettings!=NULL && subSettings->size()>0);
     90}
     91
     92void StandardSetting::setValue(const QString &newValue)
     93{
     94    settingValue = newValue;
     95    emit valueChanged(settingValue);
     96}
     97
     98bool StandardSetting::haveChanged()
     99{
     100    if (m_haveChanged) return true;
     101
     102    //we check only the relevant children
     103    QList<StandardSetting *> *children = getSubSettings();
     104    if (children==NULL) return false;
     105    QList<StandardSetting *>::const_iterator i;
     106    bool haveChanged = false;
     107    for (i = children->constBegin(); !haveChanged && i != children->constEnd(); ++i)
     108        haveChanged=(*i)->haveChanged();
     109
     110    return haveChanged;
     111}
     112
     113void StandardSetting::Load(void)
     114{
     115
     116/*    Storage *s = GetStorage();
     117    if (s)s->Load();*/
     118
     119    m_haveChanged=false;
     120
     121    LoadChildren();
     122}
     123
     124void StandardSetting::LoadChildren(void)
     125{
     126    QList<StandardSetting *>::const_iterator i;
     127    for (i = m_children.constBegin(); i != m_children.constEnd(); ++i)
     128        (*i)->Load();
     129
     130    QMap<QString, QList<StandardSetting *> >::const_iterator iMap;
     131    for (iMap = m_targets.constBegin(); iMap != m_targets.constEnd(); ++iMap)
     132    {
     133        for (i = (*iMap).constBegin(); i != (*iMap).constEnd(); ++i)
     134            (*i)->Load();
     135    }
     136   
     137}
     138void StandardSetting::Save(void)
     139{
     140/*
     141    Storage *s = GetStorage();
     142    if (s)s->Save();*/
     143
     144    m_haveChanged=false;
     145
     146    SaveChildren();
     147}
     148
     149void StandardSetting::SaveChildren(void)
     150{
     151    //we save only the relevant children
     152    QList<StandardSetting *> *children = getSubSettings();
     153    if (children==NULL) return;
     154    QList<StandardSetting *>::const_iterator i;
     155    for (i = children->constBegin(); i != children->constEnd(); ++i)
     156        (*i)->Save();
     157}
     158
     159/*******************************************************************************
     160                            Group Setting
     161********************************************************************************/
     162GroupSetting::GroupSetting():
     163    StandardSetting(this), TransientStorage()
     164{
     165}
     166
     167bool GroupSetting::edit(MythScreenType * screen)
     168{
     169    DialogCompletionEvent *dce =
     170            new DialogCompletionEvent("leveldown", 0, "", "");
     171    QCoreApplication::postEvent(screen, dce);
     172    return true;
     173}
     174
     175
     176/*******************************************************************************
     177                            Text Setting
     178********************************************************************************/
     179
     180MythUITextEditSetting::MythUITextEditSetting(Storage *_storage):
     181    StandardSetting(_storage)
     182{
     183}
     184
     185bool MythUITextEditSetting::edit(MythScreenType * screen)
     186{
     187
     188    MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
     189
     190    MythTextInputDialog *settingdialog =
     191                                    new MythTextInputDialog(popupStack,
     192                                    getLabel(),FilterNone, false,settingValue);
     193
     194    if (settingdialog->Create())
     195    {
     196        settingdialog->SetReturnEvent(screen, "editsetting");
     197        popupStack->AddScreen(settingdialog);
     198        return true;
     199    }
     200    return false;
     201};
     202
     203void MythUITextEditSetting::resultEdit(DialogCompletionEvent *dce, MythUIButtonListItem *item)
     204{
     205    if (settingValue!=dce->GetResultText())
     206    {
     207        setValue(dce->GetResultText());
     208        m_haveChanged=true;
     209        this->updateButton(item);
     210    }
     211}
     212
     213/*******************************************************************************
     214                            ComboBoxSetting
     215********************************************************************************/
     216
     217MythUIComboBoxSetting::MythUIComboBoxSetting(Storage *_storage):
     218    StandardSetting(_storage)
     219{
     220}
     221
     222MythUIComboBoxSetting::~MythUIComboBoxSetting()
     223{
     224    m_labels.clear();
     225    m_values.clear();
     226}
     227
     228void MythUIComboBoxSetting::setValue(int value)
     229{
     230    if (value>=0 && value < m_values.size())
     231            //Why does the polymorphism does not work here
     232            StandardSetting::setValue(m_values.at(value));
     233}
     234
     235void MythUIComboBoxSetting::addSelection(const QString &label, QString value,
     236                                 bool select)
     237{
     238    value = (value.isEmpty()) ? label : value;
     239    m_labels.push_back(label);
     240    m_values.push_back(value);
     241
     242    if (select || !m_isSet)
     243    {
     244        //Why does the polymorphism does not work here
     245        StandardSetting::setValue(value);
     246        if (!m_isSet) m_isSet = true;
     247    }
     248}
     249
     250void MythUIComboBoxSetting::updateButton(MythUIButtonListItem *item)
     251{
     252    item->SetText(label);
     253    int indexValue = m_values.indexOf(settingValue);
     254    if (indexValue >=0)
     255        item->SetText(m_labels.value(indexValue),"value");
     256    else
     257        item->SetText("","value");
     258    item->setDrawArrow (haveSubSettings());
     259    item->SetData(qVariantFromValue((StandardSetting*)this));
     260
     261}
     262
     263bool MythUIComboBoxSetting::edit(MythScreenType * screen)
     264{
     265    MythScreenStack *popupStack =
     266                            GetMythMainWindow()->GetStack("popup stack");
     267
     268    MythDialogBox * m_menuPopup =
     269            new MythDialogBox(getLabel(), popupStack, "optionmenu");
     270
     271    if (m_menuPopup->Create())
     272        popupStack->AddScreen(m_menuPopup);
     273
     274    m_menuPopup->SetReturnEvent(screen, "editsetting");
     275
     276    for (int i = 0; i < m_labels.size() && m_values.size(); ++i)
     277    {
     278        QString value = m_values.at(i);
     279        m_menuPopup->AddButton(m_labels.at(i),value,false,value==settingValue);
     280    }
     281
     282    return true;
     283}
     284
     285void MythUIComboBoxSetting::resultEdit(DialogCompletionEvent *dce, MythUIButtonListItem *item)
     286{
     287    if (dce->GetResult()!=-1 && settingValue!=dce->GetData().toString())
     288    {
     289        //Why does the polymorphism does not work here
     290        StandardSetting::setValue(dce->GetData().toString());
     291        m_haveChanged=true;
     292        updateButton(item);
     293    }
     294}
     295
     296
     297/*******************************************************************************
     298                            SpinBox Setting
     299********************************************************************************/
     300
     301MythUISpinBoxSetting::MythUISpinBoxSetting(Storage *_storage, int min, int max, int step, bool allow_single_step):
     302    StandardSetting(_storage),
     303    m_min(min),
     304    m_max(max),
     305    m_step(step),
     306    m_allow_single_step(allow_single_step)
     307{
     308}
     309
     310void MythUISpinBoxSetting::setValue(int value)
     311{
     312    StandardSetting::setValue(QString::number(value));
     313}
     314
     315int MythUISpinBoxSetting::intValue()
     316{
     317    return settingValue.toInt();
     318}
     319
     320bool MythUISpinBoxSetting::edit(MythScreenType * screen)
     321{
     322    //TODO use a correct dialog with a spin box
     323    MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
     324
     325    MythTextInputDialog *settingdialog =
     326                                    new MythTextInputDialog(popupStack,
     327                                    getLabel(),FilterNone, false,settingValue);
     328
     329
     330    if (settingdialog->Create())
     331    {
     332        settingdialog->SetReturnEvent(screen, "editsetting");
     333        popupStack->AddScreen(settingdialog);
     334        return true;
     335    }
     336    return false;
     337};
     338
     339void MythUISpinBoxSetting::resultEdit(DialogCompletionEvent *dce, MythUIButtonListItem *item)
     340{
     341    if (settingValue!=dce->GetResultText())
     342    {
     343        bool ok;
     344        int value = dce->GetResultText().toInt(&ok);
     345        ok = ok && (value>=m_min) && (value<=m_max);
     346        if (ok && !m_allow_single_step && m_step>0)
     347        {
     348            ok = ((value-m_min)%m_step)==0;
     349        }
     350        if (ok) //TODO give user some feedback
     351        {
     352            StandardSetting::setValue(dce->GetResultText());
     353            m_haveChanged=true;
     354            this->updateButton(item);
     355        }
     356    }
     357}
     358
     359/*******************************************************************************
     360                           MythUICheckBoxSetting
     361********************************************************************************/
     362
     363MythUICheckBoxSetting::MythUICheckBoxSetting(Storage *_storage):
     364    StandardSetting(_storage)
     365{
     366}
     367
     368bool MythUICheckBoxSetting::boolValue()
     369{
     370    return settingValue=="1";
     371}
     372
     373
     374void MythUICheckBoxSetting::setValue(bool value)
     375{
     376    //Why does the polymorphism does not work here
     377    StandardSetting::setValue(value?"1":"0");
     378}
     379
     380void MythUICheckBoxSetting::updateButton(MythUIButtonListItem *item)
     381{
     382    item->SetText(label);
     383    item->setCheckable (true);
     384    if (settingValue=="1")
     385        item->setChecked(MythUIButtonListItem::FullChecked);
     386    else
     387        item->setChecked(MythUIButtonListItem::NotChecked);
     388    item->setDrawArrow(haveSubSettings());
     389    item->SetData(qVariantFromValue((StandardSetting*)this));
     390
     391}
     392
     393bool MythUICheckBoxSetting::edit(MythScreenType * screen)
     394{
     395    DialogCompletionEvent *dce =
     396            new DialogCompletionEvent("editsetting", 0, "", "");
     397    QCoreApplication::postEvent(screen, dce);
     398    return true;
     399
     400}
     401
     402void MythUICheckBoxSetting::resultEdit(DialogCompletionEvent *dce,
     403    MythUIButtonListItem *item)
     404{
     405    setValue(!boolValue());
     406    m_haveChanged=true;
     407    updateButton(item);
     408}
     409
     410/*******************************************************************************
     411                           Standard setting dialog
     412********************************************************************************/
     413
     414StandardSettingDialog::StandardSettingDialog(MythScreenStack *parent, const char *name) :
     415    MythScreenType(parent, name),
     416    m_buttonList(0),
     417    m_title(0),
     418    m_groupHelp(0),
     419    m_selectedSettingHelp(0),
     420    m_menuPopup(0),
     421    m_settingsTree(0),
     422    m_currentGroupSetting(0)
     423{
     424}
     425
     426StandardSettingDialog::~StandardSettingDialog()
     427{
     428    LOG(VB_GENERAL, LOG_ERR, "StandardSettingDialog::~StandardSettingDialog()");
     429    if (m_settingsTree!=0)
     430        m_settingsTree->deleteLater();
     431}
     432
     433bool StandardSettingDialog::Create(void)
     434{
     435    if (!LoadWindowFromXML("standardsetting-ui.xml", "settingssetup", this))
     436        return false;
     437
     438    bool error=false;
     439    UIUtilE::Assign(this, m_title, "title",&error);
     440    UIUtilW::Assign(this, m_groupHelp, "grouphelp",&error);
     441    UIUtilE::Assign(this, m_buttonList,"settingslist",&error);
     442
     443    UIUtilW::Assign(this, m_selectedSettingHelp, "selectedsettinghelp");
     444
     445    connect(m_buttonList,SIGNAL(itemSelected(MythUIButtonListItem*)),
     446        this,SLOT(settingSelected(MythUIButtonListItem*)));
     447    connect(m_buttonList,SIGNAL(itemClicked(MythUIButtonListItem*)),
     448        this,SLOT(settingClicked(MythUIButtonListItem*)));
     449
     450    if (error)
     451    {
     452        LOG(VB_GENERAL, LOG_ERR, "error.");
     453        return false;
     454    }
     455    BuildFocusList();
     456
     457    return true;
     458}
     459
     460void StandardSettingDialog::settingSelected(MythUIButtonListItem *item)
     461{
     462    if (!item)return;
     463
     464    StandardSetting * setting = qVariantValue<StandardSetting*>(item->GetData());
     465    if (setting)
     466    {
     467        if (m_selectedSettingHelp)
     468            m_selectedSettingHelp->SetText(setting->getHelpText());
     469    }
     470}
     471
     472void StandardSettingDialog::settingClicked(MythUIButtonListItem *item)
     473{
     474    StandardSetting* setting = item->GetData().value<StandardSetting*>();
     475    if (setting)
     476    {
     477        setting->edit(this);
     478    }
     479}
     480
     481void StandardSettingDialog::customEvent(QEvent *event)
     482{
     483    if (event->type() == DialogCompletionEvent::kEventType)
     484    {
     485        DialogCompletionEvent *dce = (DialogCompletionEvent*)(event);
     486        QString resultid  = dce->GetId();
     487
     488        if (resultid == "leveldown")
     489        {
     490            //a GroupSetting have been clicked
     491            LevelDown();
     492        }
     493        else if (resultid == "editsetting")
     494        {
     495            MythUIButtonListItem * item = m_buttonList->GetItemCurrent();
     496            if (item)
     497            {
     498                StandardSetting * ss = item->GetData().value<StandardSetting*>();
     499                if (ss)
     500                {
     501                    ss->resultEdit(dce, item);
     502                    ss->updateButton(item);
     503                }
     504            }
     505        }
     506        else if (resultid == "exit")
     507        {
     508            int buttonnum = dce->GetResult();
     509            if (buttonnum == 0)
     510            {
     511                Save();
     512                MythScreenType::Close();
     513            }
     514            else if (buttonnum == 1)
     515                MythScreenType::Close();
     516        }
     517    }
     518}
     519
     520void StandardSettingDialog::loadSettings(GroupSetting * groupSettings)
     521{
     522
     523    m_settingsTree=groupSettings;
     524    if (m_settingsTree)
     525        m_settingsTree->Load();
     526
     527    setCurrentGroupSetting(m_settingsTree);
     528}
     529
     530void StandardSettingDialog::setCurrentGroupSetting(StandardSetting * groupSettings,
     531        StandardSetting * selectedSetting )
     532{
     533    if (!groupSettings) return;
     534
     535    m_currentGroupSetting=groupSettings;
     536    m_buttonList->Reset();
     537
     538    m_title->SetText(m_currentGroupSetting->getLabel());
     539    if (m_groupHelp) m_groupHelp->SetText(m_currentGroupSetting->getHelpText());
     540    if (!m_currentGroupSetting->haveSubSettings())return;
     541    QList<StandardSetting *> * settings = m_currentGroupSetting->getSubSettings();
     542    if (settings==NULL ) return;
     543    QList<StandardSetting *>::const_iterator i;
     544    MythUIButtonListItem *selectedItem=0;
     545    for (i = settings->constBegin(); i != settings->constEnd(); ++i)
     546    {
     547        if (selectedSetting == (*i))
     548            selectedItem =(*i)->createButton(m_buttonList);
     549        else
     550            (*i)->createButton(m_buttonList);
     551    }
     552    if (selectedItem)
     553        m_buttonList->SetItemCurrent(selectedItem);
     554    settingSelected(m_buttonList->GetItemCurrent());
     555
     556}
     557
     558void StandardSettingDialog::Save()
     559{
     560    if (m_settingsTree)
     561        m_settingsTree->Save();
     562}
     563
     564void StandardSettingDialog::LevelUp()
     565{
     566    if (!m_currentGroupSetting) return;
     567    if (m_currentGroupSetting->getParent())
     568    {
     569        setCurrentGroupSetting(m_currentGroupSetting->getParent(),
     570                    m_currentGroupSetting);
     571    }
     572}
     573
     574void StandardSettingDialog::LevelDown()
     575{
     576    MythUIButtonListItem * item = m_buttonList->GetItemCurrent();
     577    if (item)
     578    {
     579        StandardSetting * ss = item->GetData().value<StandardSetting*>();
     580        if (ss && ss->haveSubSettings())
     581            setCurrentGroupSetting(ss);
     582    }
     583}
     584
     585void StandardSettingDialog::Close(void)
     586{
     587    if (m_settingsTree->haveChanged())
     588    {
     589        QString label = tr("Exit ?");
     590
     591        MythScreenStack *popupStack =
     592                                GetMythMainWindow()->GetStack("popup stack");
     593
     594        MythDialogBox * m_menuPopup =
     595                new MythDialogBox(label, popupStack, "exitmenu");
     596
     597        if (m_menuPopup->Create())
     598            popupStack->AddScreen(m_menuPopup);
     599
     600        m_menuPopup->SetReturnEvent(this, "exit");
     601
     602        m_menuPopup->AddButton(tr("Save then Exit"));
     603        m_menuPopup->AddButton(tr("Exit without saving changes"));
     604        m_menuPopup->AddButton(tr("Cancel"));
     605    }
     606    else
     607        MythScreenType::Close();
     608}
     609
     610
     611bool StandardSettingDialog::keyPressEvent(QKeyEvent *e)
     612{
     613    QStringList actions;
     614    bool handled = m_buttonList->keyPressEvent(e);
     615    if (handled) return true;
     616    handled = GetMythMainWindow()->TranslateKeyPress("Global", e, actions);
     617
     618    for (int i = 0; i < actions.size() && !handled; i++)
     619    {
     620        QString action = actions[i];
     621        handled = true;
     622
     623        if (action == "LEFT")
     624        {
     625            LevelUp();
     626        }
     627        else if (action == "RIGHT")
     628            LevelDown();
     629        else
     630            handled = MythScreenType::keyPressEvent(e);
     631    }
     632
     633    return handled;
     634}
     635
     636
     637
     638
     639
  • 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..83aaba3
    - +  
     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 MPUBLIC NewConfigurable : public QObject
     16{
     17    Q_OBJECT
     18
     19  public:
     20    MythUIButtonListItem * createButton(MythUIButtonList * list);
     21
     22    virtual void updateButton(MythUIButtonListItem *item)=0;
     23/*
     24    virtual QWidget* configWidget(ConfigurationGroup *cg, QWidget* parent,
     25                                  const char* widgetName = 0);
     26    virtual void widgetInvalid(QObject*) { }*/
     27
     28    // A name for looking up the setting
     29    /*void setName(QString str) {
     30        configName = str;
     31        if (label == QString::null)
     32            setLabel(str);
     33    };
     34    QString getName(void) const { return configName; };
     35    virtual StandardSetting* byName(const QString &name) = 0;*/
     36
     37    // A label displayed to the user
     38    virtual void setLabel(QString str) { label = str; }
     39    QString getLabel(void) const { return label; }
     40
     41    virtual void setHelpText(const QString &str)
     42        { helptext = str; }
     43    QString getHelpText(void) const { return helptext; }
     44
     45   /* void setVisible(bool b) { visible = b; };
     46    bool isVisible(void) const { return visible; };
     47
     48    virtual void setEnabled(bool b) { enabled = b; }
     49    bool isEnabled() { return enabled; }*/
     50
     51    Storage *GetStorage(void) { return storage; }
     52
     53  public slots:
     54    /*virtual void enableOnSet(const QString &val);
     55    virtual void enableOnUnset(const QString &val);
     56    virtual void widgetDeleted(QObject *obj);*/
     57
     58  protected:
     59    NewConfigurable(Storage *_storage) :
     60        /*enabled(true), */storage(_storage),
     61        /*configName(""), */label(""), helptext("")/*, visible(true)*/ { }
     62    virtual ~NewConfigurable() { }
     63
     64  protected:
     65    /*bool enabled;*/
     66    Storage *storage;
     67    /*QString configName;*/
     68    QString label;
     69    QString helptext;
     70    /*bool visible;*/
     71};
     72
     73//Copy of Setting class
     74class MPUBLIC StandardSetting : public NewConfigurable, public StorageUser
     75{
     76    Q_OBJECT
     77
     78  public:
     79    // Gets
     80    virtual QString getValue(void) const
     81        {return settingValue;}
     82
     83    virtual void updateButton(MythUIButtonListItem *item);
     84
     85    // non-const Gets
     86    /*virtual StandardSetting *byName(const QString &name)
     87        { return (name == configName) ? this : NULL; }*/
     88
     89    // StorageUser
     90    void SetDBValue(const QString &val) { setValue(val); }
     91    QString GetDBValue(void) const { return getValue(); }
     92
     93    //added by xavier
     94    //subsettings
     95    void addChild(StandardSetting *child);
     96    virtual QList<StandardSetting *> *getSubSettings();
     97    virtual bool haveSubSettings();
     98
     99    StandardSetting * getParent();
     100    virtual bool edit(MythScreenType * screen)=0;
     101    virtual void resultEdit(DialogCompletionEvent *dce, MythUIButtonListItem *item)=0;
     102    //must be a better way
     103    virtual void Load(void);
     104    virtual void Save(void);
     105
     106
     107    void addTargetedChild(const QString &value, StandardSetting * setting);
     108    bool haveChanged();
     109    //added by xavier end
     110  public slots:
     111    virtual void setValue(const QString &newValue);
     112
     113  signals:
     114    void valueChanged(const QString&);
     115
     116  protected:
     117    StandardSetting(Storage *_storage);
     118    virtual ~StandardSetting();
     119
     120  protected:
     121    void setParent(StandardSetting *parent);
     122    QString settingValue;
     123    void LoadChildren(void);
     124    void SaveChildren(void);
     125    bool m_haveChanged;
     126  private:
     127    //added by xavier
     128    StandardSetting * m_parent;
     129
     130    QList<StandardSetting *> m_children;
     131    QMap<QString, QList<StandardSetting *> > m_targets;
     132    //added by xavier end
     133};
     134
     135Q_DECLARE_METATYPE(StandardSetting *);
     136
     137
     138/*******************************************************************************
     139*                           TextEdit Setting                                   *
     140*******************************************************************************/
     141
     142
     143class MPUBLIC MythUITextEditSetting : public StandardSetting
     144{
     145  public:
     146    virtual void resultEdit(DialogCompletionEvent *dce, MythUIButtonListItem *item);
     147    virtual bool edit(MythScreenType * screen);
     148  protected:
     149    MythUITextEditSetting (Storage *_storage);
     150   
     151};
     152
     153
     154class MPUBLIC TransTextEditSetting: public MythUITextEditSetting, public TransientStorage
     155{
     156  public:
     157    TransTextEditSetting() :
     158        MythUITextEditSetting(this), TransientStorage() { }
     159
     160    //Don't want to have to do that but cannont think of a work around
     161    virtual void Load(){MythUITextEditSetting::Load();}
     162    virtual void Save(){MythUITextEditSetting::Save();}
     163};
     164
     165
     166class MPUBLIC HostTextEditSetting: public MythUITextEditSetting, public HostDBStorage
     167{
     168  public:
     169    HostTextEditSetting(const QString &name) :
     170        MythUITextEditSetting(this), HostDBStorage(this, name) { }
     171
     172    //Don't want to have to do that but cannont think of a work around
     173    virtual void Load(){MythUITextEditSetting::Load();HostDBStorage::Load();}
     174    virtual void Save(){MythUITextEditSetting::Save();HostDBStorage::Save();}
     175};
     176
     177
     178/*******************************************************************************
     179*                           ComboBox Setting                                   *
     180*******************************************************************************/
     181
     182class MPUBLIC MythUIComboBoxSetting : public StandardSetting
     183{
     184  public:
     185    void setValue(int value);
     186    virtual void resultEdit(DialogCompletionEvent *dce, MythUIButtonListItem *item);
     187    virtual bool edit(MythScreenType * screen);
     188    void addSelection(const QString &label, QString value = QString::null, bool select = false);
     189    virtual void updateButton(MythUIButtonListItem *item);
     190  protected:
     191    MythUIComboBoxSetting (Storage *_storage);
     192    ~MythUIComboBoxSetting();
     193  private:
     194    QVector<QString> m_labels;
     195    QVector<QString> m_values;
     196    bool m_isSet;
     197   
     198};
     199
     200class MPUBLIC HostComboBoxSetting: public MythUIComboBoxSetting, public HostDBStorage
     201{
     202  public:
     203    HostComboBoxSetting(const QString &name) :
     204        MythUIComboBoxSetting(this), HostDBStorage(this, name) { }
     205
     206    //Don't want to have to do that but cannot think of a work around
     207    virtual void Load(){MythUIComboBoxSetting::Load();HostDBStorage::Load();}
     208    virtual void Save(){MythUIComboBoxSetting::Save();HostDBStorage::Save();}
     209};
     210
     211
     212class MPUBLIC GlobalComboBoxSetting: public MythUIComboBoxSetting, public GlobalDBStorage
     213{
     214  public:
     215    GlobalComboBoxSetting(const QString &name) :
     216        MythUIComboBoxSetting(this), GlobalDBStorage(this, name) { }
     217
     218    //Don't want to have to do that but cannot think of a work around
     219    virtual void Load(){MythUIComboBoxSetting::Load();GlobalDBStorage::Load();}
     220    virtual void Save(){MythUIComboBoxSetting::Save();GlobalDBStorage::Save();}
     221};
     222
     223/*******************************************************************************
     224*                           SpinBox Setting                                    *
     225*******************************************************************************/
     226
     227
     228class MPUBLIC MythUISpinBoxSetting : public StandardSetting
     229{
     230  public:
     231    void setValue(int value);
     232    int intValue();
     233    virtual void resultEdit(DialogCompletionEvent *dce, MythUIButtonListItem *item);
     234    virtual bool edit(MythScreenType * screen);
     235  protected:
     236    MythUISpinBoxSetting (Storage *_storage, int min, int max, int step, bool allow_single_step);
     237  private:
     238    int m_min;
     239    int m_max;
     240    int m_step;
     241    bool m_allow_single_step;
     242   
     243};
     244
     245class MPUBLIC TransMythUISpinBoxSetting: public MythUISpinBoxSetting, public TransientStorage
     246{
     247  public:
     248    TransMythUISpinBoxSetting(int min, int max, int step, bool allow_single_step=false) :
     249        MythUISpinBoxSetting(this, min, max, step, allow_single_step), TransientStorage() { }
     250
     251    //Don't want to have to do that but cannont think of a work around
     252    virtual void Load(){MythUISpinBoxSetting::Load();}
     253    virtual void Save(){MythUISpinBoxSetting::Save();}
     254};
     255
     256class MPUBLIC HostSpinBoxSetting: public MythUISpinBoxSetting, public HostDBStorage
     257{
     258  public:
     259    HostSpinBoxSetting(const QString &name, int min, int max, int step, bool allow_single_step=false) :
     260        MythUISpinBoxSetting(this, min, max, step, allow_single_step), HostDBStorage(this, name) { }
     261
     262    //Don't want to have to do that but cannont think of a work around
     263    virtual void Load(){MythUISpinBoxSetting::Load();HostDBStorage::Load();}
     264    virtual void Save(){MythUISpinBoxSetting::Save();HostDBStorage::Save();}
     265};
     266
     267class MPUBLIC GlobalSpinBoxSetting: public MythUISpinBoxSetting, public GlobalDBStorage
     268{
     269  public:
     270    GlobalSpinBoxSetting(const QString &name, int min, int max, int step, bool allow_single_step=false) :
     271        MythUISpinBoxSetting(this, min, max, step, allow_single_step), GlobalDBStorage(this, name) { }
     272
     273    //Don't want to have to do that but cannont think of a work around
     274    virtual void Load(){MythUISpinBoxSetting::Load();GlobalDBStorage::Load();}
     275    virtual void Save(){MythUISpinBoxSetting::Save();GlobalDBStorage::Save();}
     276};
     277
     278/*******************************************************************************
     279*                           CheckBox Setting                                   *
     280*******************************************************************************/
     281
     282class MPUBLIC MythUICheckBoxSetting : public StandardSetting
     283{
     284  public:
     285    virtual void resultEdit(DialogCompletionEvent *dce, MythUIButtonListItem *item);
     286    virtual bool edit(MythScreenType * screen);
     287    virtual void updateButton(MythUIButtonListItem *item);
     288    void setValue(bool value);
     289    bool boolValue();
     290  protected:
     291    MythUICheckBoxSetting (Storage *_storage);
     292   
     293};
     294
     295class MPUBLIC TransMythUICheckBoxSetting: public MythUICheckBoxSetting, public TransientStorage
     296{
     297  public:
     298    TransMythUICheckBoxSetting() :
     299        MythUICheckBoxSetting(this), TransientStorage() { }
     300    //Don't want to have to do that but cannont think of a work around
     301    /*virtual void Load(){MythUICheckBoxSetting::Load();HostDBStorage::Load();}
     302    virtual void Save(){MythUICheckBoxSetting::Save();HostDBStorage::Save();}*/
     303};
     304
     305class MPUBLIC HostCheckBoxSetting: public MythUICheckBoxSetting, public HostDBStorage
     306{
     307  public:
     308    HostCheckBoxSetting(const QString &name, bool rw = true) :
     309        MythUICheckBoxSetting(this), HostDBStorage(this, name) { }
     310    //Don't want to have to do that but cannont think of a work around
     311    virtual void Load(){MythUICheckBoxSetting::Load();HostDBStorage::Load();}
     312    virtual void Save(){MythUICheckBoxSetting::Save();HostDBStorage::Save();}
     313};
     314
     315class MPUBLIC GlobalCheckBoxSetting: public MythUICheckBoxSetting, public GlobalDBStorage
     316{
     317  public:
     318    GlobalCheckBoxSetting(const QString &name, bool rw = true) :
     319        MythUICheckBoxSetting(this), GlobalDBStorage(this, name) { }
     320    //Don't want to have to do that but cannont think of a work around
     321    virtual void Load(){MythUICheckBoxSetting::Load();GlobalDBStorage::Load();}
     322    virtual void Save(){MythUICheckBoxSetting::Save();GlobalDBStorage::Save();}
     323};
     324
     325/*******************************************************************************
     326*                              Group Setting                                   *
     327*******************************************************************************/
     328
     329class GroupSetting : public StandardSetting, public TransientStorage
     330{
     331  public:
     332    GroupSetting();/*:StandardSetting(this), NoStorage(){};*/
     333
     334    virtual void Load(void){StandardSetting::Load();};
     335    virtual void Save(void){StandardSetting::Save();};
     336    virtual bool edit(MythScreenType * screen);
     337    virtual void resultEdit(DialogCompletionEvent *dce, MythUIButtonListItem *item){};
     338};
     339
     340/*******************************************************************************
     341*                            Standard Dialog Setting                            *
     342*******************************************************************************/
     343
     344class StandardSettingDialog : public MythScreenType
     345{
     346    Q_OBJECT
     347
     348  public:
     349
     350    StandardSettingDialog(MythScreenStack *parent, const char *name);
     351    virtual ~StandardSettingDialog();
     352    bool Create(void);
     353    void loadSettings(GroupSetting * groupSettings);
     354    virtual void customEvent(QEvent *event);
     355    virtual bool keyPressEvent(QKeyEvent *);
     356  public slots:
     357    void Close(void);
     358  protected:
     359
     360    MythUIButtonList *m_buttonList;
     361  private slots:
     362    void settingSelected(MythUIButtonListItem *item);
     363    void settingClicked(MythUIButtonListItem *item);
     364  private:
     365    void LevelUp();
     366    void LevelDown();
     367    void setCurrentGroupSetting(StandardSetting * groupSettings,StandardSetting * selectedSetting=0);
     368    void Save();
     369    MythUIText      *m_title;
     370    MythUIText      *m_groupHelp;
     371    MythUIText      *m_selectedSettingHelp;
     372    MythDialogBox   *m_menuPopup;
     373    GroupSetting    *m_settingsTree;
     374    StandardSetting *m_currentGroupSetting;
     375    bool m_loaded;
     376};
     377
     378
     379
     380#endif
  • mythtv/programs/mythfrontend/videoglobalsettings.cpp

    diff --git a/mythtv/programs/mythfrontend/videoglobalsettings.cpp b/mythtv/programs/mythfrontend/videoglobalsettings.cpp
    index 0365bfc..55bd18d 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()
     81HostTextEditSetting *VideoStartupDirectory()
    8082{
    81     HostLineEdit *gc = new HostLineEdit("VideoStartupDir");
     83    HostTextEditSetting *gc = new HostTextEditSetting("VideoStartupDir");
    8284    gc->setLabel(QObject::tr("Directories that hold videos"));
    8385    gc->setValue(DEFAULT_VIDEOSTARTUP_DIR);
    8486    gc->setHelpText(QObject::tr("Multiple directories can be separated by ':'. "
    HostLineEdit *VideoStartupDirectory()  
    8789    return gc;
    8890}
    8991
    90 HostLineEdit *VideoArtworkDirectory()
     92HostTextEditSetting *VideoArtworkDirectory()
    9193{
    92     HostLineEdit *gc = new HostLineEdit("VideoArtworkDir");
     94    HostTextEditSetting *gc = new HostTextEditSetting("VideoArtworkDir");
    9395    gc->setLabel(QObject::tr("Directory that holds movie posters"));
    9496    gc->setValue(GetConfDir() + "/Video/Artwork");
    9597    gc->setHelpText(QObject::tr("This directory must exist, and the user "
    HostLineEdit *VideoArtworkDirectory()  
    98100    return gc;
    99101}
    100102
    101 HostLineEdit *VideoScreenshotDirectory()
     103HostTextEditSetting *VideoScreenshotDirectory()
    102104{
    103     HostLineEdit *gc = new HostLineEdit("mythvideo.screenshotDir");
     105    HostTextEditSetting *gc = new HostTextEditSetting("mythvideo.screenshotDir");
    104106    gc->setLabel(QObject::tr("Directory that holds movie screenshots"));
    105107    gc->setValue(GetConfDir() + "/Video/Screenshots");
    106108    gc->setHelpText(QObject::tr("This directory must exist, and the user "
    HostLineEdit *VideoScreenshotDirectory()  
    109111    return gc;
    110112}
    111113
    112 HostLineEdit *VideoBannerDirectory()
     114HostTextEditSetting *VideoBannerDirectory()
    113115{
    114     HostLineEdit *gc = new HostLineEdit("mythvideo.bannerDir");
     116    HostTextEditSetting *gc = new HostTextEditSetting("mythvideo.bannerDir");
    115117    gc->setLabel(QObject::tr("Directory that holds movie/TV Banners"));
    116118    gc->setValue(GetConfDir() + "/Video/Banners");
    117119    gc->setHelpText(QObject::tr("This directory must exist, and the user "
    HostLineEdit *VideoBannerDirectory()  
    120122    return gc;
    121123}
    122124
    123 HostLineEdit *VideoFanartDirectory()
     125HostTextEditSetting *VideoFanartDirectory()
    124126{
    125     HostLineEdit *gc = new HostLineEdit("mythvideo.fanartDir");
     127    HostTextEditSetting *gc = new HostTextEditSetting("mythvideo.fanartDir");
    126128    gc->setLabel(QObject::tr("Directory that holds movie fanart"));
    127129    gc->setValue(GetConfDir() + "/Video/Fanart");
    128130    gc->setHelpText(QObject::tr("This directory must exist, and the user "
    HostLineEdit *VideoFanartDirectory()  
    131133    return gc;
    132134}
    133135
    134 HostLineEdit *TrailerDirectory()
     136HostTextEditSetting *TrailerDirectory()
    135137{
    136     HostLineEdit *gc = new HostLineEdit("mythvideo.TrailersDir");
     138    HostTextEditSetting *gc = new HostTextEditSetting("mythvideo.TrailersDir");
    137139    gc->setLabel(QObject::tr("Directory that holds movie trailers"));
    138140    gc->setValue(GetConfDir() + "/Video/Trailers");
    139141    gc->setHelpText(QObject::tr("This directory must exist, and the user "
    HostLineEdit *TrailerDirectory()  
    148150
    149151// General Settings
    150152
    151 HostComboBox *SetOnInsertDVD()
     153HostComboBoxSetting *SetOnInsertDVD()
    152154{
    153     HostComboBox *gc = new HostComboBox("DVDOnInsertDVD");
     155    HostComboBoxSetting *gc = new HostComboBoxSetting("DVDOnInsertDVD");
    154156    gc->setLabel(QObject::tr("On DVD insertion"));
    155157    gc->addSelection(QObject::tr("Display mythdvd menu"),"1");
    156158    gc->addSelection(QObject::tr("Do nothing"),"0");
    HostComboBox *SetOnInsertDVD()  
    160162    return gc;
    161163}
    162164
    163 HostCheckBox *VideoTreeRemember()
     165HostCheckBoxSetting *VideoTreeRemember()
    164166{
    165     HostCheckBox *gc = new HostCheckBox("mythvideo.VideoTreeRemember");
     167    HostCheckBoxSetting *gc = new HostCheckBoxSetting("mythvideo.VideoTreeRemember");
    166168    gc->setLabel(QObject::tr("Video Tree remembers last selected position"));
    167169    gc->setValue(false);
    168170    gc->setHelpText(QObject::tr("If set, the current position in the Video "
    HostCheckBox *VideoTreeRemember()  
    170172    return gc;
    171173}
    172174
    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     }
    186 
    187   private:
    188     ConfigPage(const ConfigPage &);
    189     ConfigPage &operator=(const ConfigPage &);
    190 
    191   private:
    192     PageList &m_pl;
    193 };
    194 
    195 struct VConfigPage : public ConfigPage
    196 {
    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     }
    205175
    206     VerticalConfigurationGroup *operator->()
    207     {
    208         return m_vc_page;
    209     }
    210176
    211   private:
    212     VerticalConfigurationGroup *m_vc_page;
    213 };
    214177
    215 class RatingsToPL : public TriggeredConfigurationGroup
     178HostCheckBoxSetting *RatingsToPL()
    216179{
    217   public:
    218     RatingsToPL() : TriggeredConfigurationGroup(false)
     180    HostCheckBoxSetting *r2pl =
     181            new HostCheckBoxSetting("mythvideo.ParentalLevelFromRating");
     182    r2pl->setLabel(QObject::tr("Enable automatic Parental Level from "
     183                               "rating"));
     184    r2pl->setValue(false);
     185    r2pl->setHelpText(QObject::tr("If enabled, searches will automatically "
     186                                  "set the Parental Level to the one "
     187                                  "matching the rating below."));
     188
     189    typedef std::map<ParentalLevel::Level, QString> r2pl_map;
     190    r2pl_map r2pl_defaults;
     191    r2pl_defaults.insert(r2pl_map::value_type(ParentalLevel::plLowest,
     192            QObject::tr("G", "PL 1 default search string.")));
     193    r2pl_defaults.insert(r2pl_map::value_type(ParentalLevel::plLow,
     194            QObject::tr("PG", "PL 2 default search string.")));
     195    r2pl_defaults.insert(r2pl_map::value_type(ParentalLevel::plMedium,
     196            QObject::tr("PG-13", "PL3 default search string.")));
     197    r2pl_defaults.insert(r2pl_map::value_type(ParentalLevel::plHigh,
     198            QObject::tr("R:NC-17", "PL4 default search string.")));
     199
     200    for (ParentalLevel pl(ParentalLevel::plLowest);
     201         pl.GetLevel() <= ParentalLevel::plHigh && pl.good(); ++pl)
    219202    {
    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)
     203        HostTextEditSetting *hle = new HostTextEditSetting(QString("mythvideo.AutoR2PL%1")
     204                                             .arg(pl.GetLevel()));
     205        hle->setLabel(QObject::tr("Level %1").arg(pl.GetLevel()));
     206        hle->setHelpText(QObject::tr("Ratings containing these strings "
     207                                     "(separated by :) will be assigned "
     208                                     "to Parental Level %1.")
     209                         .arg(pl.GetLevel()));
     210
     211        r2pl_map::const_iterator def_setting =
     212                r2pl_defaults.find(pl.GetLevel());
     213        if (def_setting != r2pl_defaults.end())
    246214        {
    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);
     215            hle->setValue(def_setting->second);
    263216        }
    264217
    265         addTarget("0", new VerticalConfigurationGroup(true));
    266         addTarget("1", vcg);
     218        r2pl->addTargetedChild("1", hle);
    267219    }
    268 };
    269220
    270 } // namespace
     221    return r2pl;
     222}
     223
     224}
    271225
    272226VideoGeneralSettings::VideoGeneralSettings()
     227    :GroupSetting()
    273228{
    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);
     229    setLabel(QObject::tr("General settings"));
     230
     231    setHelpText(QObject::tr("TODO add a descrition for this group of settings"));
     232   
     233
     234    addChild(VideoStartupDirectory());
     235    addChild(TrailerDirectory());
     236    addChild(VideoArtworkDirectory());
     237    addChild(VideoScreenshotDirectory());
     238    addChild(VideoBannerDirectory());
     239    addChild(VideoFanartDirectory());
     240
     241    addChild(SetOnInsertDVD());
     242    addChild(VideoTreeRemember());
     243
     244    GroupSetting *pctrl =
     245            new GroupSetting();
    291246    pctrl->setLabel(QObject::tr("Parental Control Settings"));
     247
     248    pctrl->setHelpText(QObject::tr("TODO add a description for this group of setting"));
    292249    pctrl->addChild(VideoDefaultParentalLevel());
    293250    pctrl->addChild(VideoAdminPassword());
    294251    pctrl->addChild(VideoAdminPasswordThree());
    295252    pctrl->addChild(VideoAdminPasswordTwo());
    296253    pctrl->addChild(VideoAggressivePC());
    297     VConfigPage page3(pages, false);
    298     page3->addChild(pctrl);
    299254
    300     VConfigPage page4(pages, false);
    301     page4->addChild(new RatingsToPL());
     255    addChild(pctrl);
     256
     257    addChild(RatingsToPL());
    302258
    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     }
    311259}
     260
  • 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..f683cfe
    - +  
     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>vertical</layout>
     32            <spacing>4</spacing>
     33            <wrapstyle>selection</wrapstyle>
     34            <statetype name="buttonitem">
     35                <area>0,0,100%,25</area>
     36                <state name="active">
     37                    <area>0,0,100%,30</area>
     38                    <shape name="buttonbackground">
     39                        <area>0,0,100%,100%</area>
     40                        <fill style="gradient">
     41                            <gradient start="#505050" end="#000000" alpha="200" direction="vertical"  />
     42                        </fill>
     43                    </shape>
     44                    <textarea name="buttontext">
     45                        <area>5,0,50%-10,30</area>
     46                        <font>basesmall</font>
     47                        <cutdown>yes</cutdown>
     48                        <align>left,vcenter</align>
     49                    </textarea>
     50                    <textarea name="value">
     51                        <area>50%+5,0,100%-40,30</area>
     52                        <font>basesmall</font>
     53                        <cutdown>yes</cutdown>
     54                        <align>right,vcenter</align>
     55                    </textarea>
     56                    <imagetype name="buttonarrow">
     57                        <position>100%-23,7</position>
     58                        <filename>lb-arrow.png</filename>
     59                    </imagetype>
     60                </state>
     61                <state name="selectedactive" from="active">
     62                    <shape name="buttonbackground">
     63                        <fill style="gradient">
     64                            <gradient start="#52CA38" end="#349838" alpha="255" />
     65                        </fill>
     66                    </shape>
     67                </state>
     68                <state name="selectedinactive" from="active">
     69                </state>
     70            </statetype>
     71        </buttonlist>
     72
     73        <shape name="HelpBackground">
     74            <!--area>15,600,100%-30,100</area-->
     75            <area>15,100%-140,100%-15,80</area>
     76            <type>roundbox</type>
     77            <cornerradius>10</cornerradius>
     78            <fill color="#000000" alpha="30" />
     79        </shape>
     80
     81        <!-- optionnal, display the help for the currently selected setting -->
     82        <textarea name="selectedsettinghelp" from="basetextarea">
     83            <area>30,100%-120,100%-30,60</area>
     84            <font>basesmall</font>
     85            <multiline>yes</multiline>
     86        </textarea>
     87    </window>
     88</mythuitheme>