Ticket #10092: mythfrontendsetup-07-02-2012.2.diff

File mythfrontendsetup-07-02-2012.2.diff, 43.5 KB (added by Xavier Hervy <xavier.hervy@…>, 12 years ago)

Correct previous patch which was missing file

  • mythtv/programs/mythfrontend/main.cpp

    diff --git a/mythtv/programs/mythfrontend/main.cpp b/mythtv/programs/mythfrontend/main.cpp
    index 259e020..1af2f9f 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            {
  • 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..1bb7429
    - +  
     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_parent(0)
     23{
     24}
     25
     26StandardSetting::~StandardSetting()
     27{   
     28    QList<StandardSetting *>::const_iterator i;
     29    for (i = m_children.constBegin(); i != m_children.constEnd(); ++i)
     30        delete *i;
     31    m_children.clear();
     32
     33    QMap<QString, QList<StandardSetting *> >::const_iterator iMap;
     34    for (iMap = m_targets.constBegin(); iMap != m_targets.constEnd(); ++iMap)
     35    {
     36        for (i = (*iMap).constBegin(); i != (*iMap).constEnd(); ++i)
     37            delete *i;
     38    }
     39    m_targets.clear();
     40}
     41
     42void StandardSetting::setParent(StandardSetting *parent)
     43{
     44    m_parent = parent;
     45}
     46
     47StandardSetting * StandardSetting::getParent()
     48{
     49    return m_parent;
     50}
     51
     52void StandardSetting::addChild(StandardSetting *child)
     53{
     54    if (!child)return;
     55    m_children.append(child);
     56    child->setParent(this);
     57}
     58
     59void StandardSetting::updateButton(MythUIButtonListItem *item)
     60{
     61    item->SetText(label);
     62    item->SetText(settingValue,"value");
     63    item->setDrawArrow (haveSubSettings());
     64    item->SetData(qVariantFromValue(this));
     65
     66}
     67
     68void StandardSetting::addTargetedChild(const QString &value, StandardSetting * setting)
     69{
     70    m_targets[value].append(setting);
     71    setting->setParent(this);
     72}
     73
     74
     75QList<StandardSetting *> *StandardSetting::getSubSettings()
     76{
     77    if (settingValue.isEmpty())
     78        return &m_children;
     79    else if (m_targets.contains(settingValue))
     80        return &m_targets[settingValue];
     81    return NULL;
     82}
     83
     84bool StandardSetting::haveSubSettings()
     85{
     86    QList<StandardSetting *> * subSettings=getSubSettings();
     87    return (subSettings!=NULL && subSettings->size()>0);
     88}
     89
     90void StandardSetting::setValue(const QString &newValue)
     91{
     92    settingValue = newValue;
     93    emit valueChanged(settingValue);
     94}
     95
     96bool StandardSetting::haveChanged()
     97{
     98    if (m_haveChanged) return true;
     99
     100    //we check only the relevant children
     101    QList<StandardSetting *> *children = getSubSettings();
     102    if (children==NULL) return false;
     103    QList<StandardSetting *>::const_iterator i;
     104    bool haveChanged = false;
     105    for (i = children->constBegin(); !haveChanged && i != children->constEnd(); ++i)
     106        haveChanged=(*i)->haveChanged();
     107
     108    return haveChanged;
     109}
     110
     111void StandardSetting::Load(void)
     112{
     113    m_haveChanged=false;
     114
     115    LoadChildren();
     116}
     117
     118void StandardSetting::LoadChildren(void)
     119{
     120    QList<StandardSetting *>::const_iterator i;
     121    for (i = m_children.constBegin(); i != m_children.constEnd(); ++i)
     122        (*i)->Load();
     123
     124    QMap<QString, QList<StandardSetting *> >::const_iterator iMap;
     125    for (iMap = m_targets.constBegin(); iMap != m_targets.constEnd(); ++iMap)
     126    {
     127        for (i = (*iMap).constBegin(); i != (*iMap).constEnd(); ++i)
     128            (*i)->Load();
     129    }
     130   
     131}
     132void StandardSetting::Save(void)
     133{
     134    m_haveChanged=false;
     135    SaveChildren();
     136}
     137
     138void StandardSetting::SaveChildren(void)
     139{
     140    //we save only the relevant children
     141    QList<StandardSetting *> *children = getSubSettings();
     142    if (children==NULL) return;
     143    QList<StandardSetting *>::const_iterator i;
     144    for (i = children->constBegin(); i != children->constEnd(); ++i)
     145        (*i)->Save();
     146}
     147
     148/*******************************************************************************
     149                            Group Setting
     150********************************************************************************/
     151GroupSetting::GroupSetting():
     152    StandardSetting(this)
     153{
     154}
     155
     156bool GroupSetting::edit(MythScreenType * screen)
     157{
     158    DialogCompletionEvent *dce =
     159            new DialogCompletionEvent("leveldown", 0, "", "");
     160    QCoreApplication::postEvent(screen, dce);
     161    return true;
     162}
     163
     164
     165/*******************************************************************************
     166                            Text Setting
     167********************************************************************************/
     168
     169MythUITextEditSetting::MythUITextEditSetting(Storage *_storage):
     170    StandardSetting(_storage)
     171{
     172}
     173
     174bool MythUITextEditSetting::edit(MythScreenType * screen)
     175{
     176
     177    MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
     178
     179    MythTextInputDialog *settingdialog =
     180                                    new MythTextInputDialog(popupStack,
     181                                    getLabel(),FilterNone, false,settingValue);
     182
     183    if (settingdialog->Create())
     184    {
     185        settingdialog->SetReturnEvent(screen, "editsetting");
     186        popupStack->AddScreen(settingdialog);
     187        return true;
     188    }
     189    return false;
     190};
     191
     192void MythUITextEditSetting::resultEdit(DialogCompletionEvent *dce, MythUIButtonListItem *item)
     193{
     194    if (settingValue!=dce->GetResultText())
     195    {
     196        setValue(dce->GetResultText());
     197        m_haveChanged=true;
     198        this->updateButton(item);
     199    }
     200}
     201
     202/*******************************************************************************
     203                            ComboBoxSetting
     204********************************************************************************/
     205
     206MythUIComboBoxSetting::MythUIComboBoxSetting(Storage *_storage):
     207    StandardSetting(_storage)
     208{
     209}
     210
     211MythUIComboBoxSetting::~MythUIComboBoxSetting()
     212{
     213    m_labels.clear();
     214    m_values.clear();
     215}
     216
     217void MythUIComboBoxSetting::addSelection(const QString &label, QString value,
     218                                 bool select)
     219{
     220    value = (value.isEmpty()) ? label : value;
     221    m_labels.push_back(label);
     222    m_values.push_back(value);
     223
     224    if (select || !m_isSet)
     225    {
     226        setValue(value);
     227        if (!m_isSet) m_isSet = true;
     228    }
     229}
     230
     231void MythUIComboBoxSetting::updateButton(MythUIButtonListItem *item)
     232{
     233    item->SetText(label);
     234    int indexValue = m_values.indexOf(settingValue);
     235    if (indexValue >=0)
     236        item->SetText(m_labels.value(indexValue),"value");
     237    else
     238        item->SetText("","value");
     239    item->setDrawArrow (haveSubSettings());
     240    item->SetData(qVariantFromValue((StandardSetting*)this));
     241
     242}
     243
     244bool MythUIComboBoxSetting::edit(MythScreenType * screen)
     245{
     246    MythScreenStack *popupStack =
     247                            GetMythMainWindow()->GetStack("popup stack");
     248
     249    MythDialogBox * m_menuPopup =
     250            new MythDialogBox(getLabel(), popupStack, "optionmenu");
     251
     252    if (m_menuPopup->Create())
     253        popupStack->AddScreen(m_menuPopup);
     254
     255    m_menuPopup->SetReturnEvent(screen, "editsetting");
     256
     257    for (int i = 0; i < m_labels.size() && m_values.size(); ++i)
     258    {
     259        QString value = m_values.at(i);
     260        m_menuPopup->AddButton(m_labels.at(i),value,false,value==settingValue);
     261    }
     262
     263    return true;
     264}
     265
     266void MythUIComboBoxSetting::resultEdit(DialogCompletionEvent *dce, MythUIButtonListItem *item)
     267{
     268    if (dce->GetResult()!=-1 && settingValue!=dce->GetData().toString())
     269    {
     270        setValue(dce->GetData().toString());
     271        m_haveChanged=true;
     272        updateButton(item);
     273    }
     274}
     275
     276/*******************************************************************************
     277                           MythUICheckBoxSetting
     278********************************************************************************/
     279
     280MythUICheckBoxSetting::MythUICheckBoxSetting(Storage *_storage):
     281    StandardSetting(_storage)
     282{
     283}
     284
     285bool MythUICheckBoxSetting::boolValue()
     286{
     287    return settingValue=="1";
     288}
     289
     290
     291void MythUICheckBoxSetting::setValue(bool value)
     292{
     293    StandardSetting::setValue(value?"1":"0");
     294}
     295
     296void MythUICheckBoxSetting::updateButton(MythUIButtonListItem *item)
     297{
     298    item->SetText(label);
     299    item->setCheckable (true);
     300    if (settingValue=="1")
     301        item->setChecked(MythUIButtonListItem::FullChecked);
     302    else
     303        item->setChecked(MythUIButtonListItem::NotChecked);
     304    item->setDrawArrow(haveSubSettings());
     305    item->SetData(qVariantFromValue((StandardSetting*)this));
     306
     307}
     308
     309bool MythUICheckBoxSetting::edit(MythScreenType * screen)
     310{
     311    DialogCompletionEvent *dce =
     312            new DialogCompletionEvent("editsetting", 0, "", "");
     313    QCoreApplication::postEvent(screen, dce);
     314    return true;
     315
     316}
     317
     318void MythUICheckBoxSetting::resultEdit(DialogCompletionEvent *dce,
     319    MythUIButtonListItem *item)
     320{
     321    setValue(!boolValue());
     322    m_haveChanged=true;
     323    updateButton(item);
     324}
     325
     326/*******************************************************************************
     327                           Standard setting dialog
     328********************************************************************************/
     329
     330StandardSettingDialog::StandardSettingDialog(MythScreenStack *parent, const char *name) :
     331    MythScreenType(parent, name),
     332    m_buttonList(0),
     333    m_title(0),
     334    m_groupHelp(0),
     335    m_selectedSettingHelp(0),
     336    m_menuPopup(0),
     337    m_settingsTree(0),
     338    m_currentGroupSetting(0)
     339{
     340}
     341
     342StandardSettingDialog::~StandardSettingDialog()
     343{
     344    LOG(VB_GENERAL, LOG_ERR, "StandardSettingDialog::~StandardSettingDialog()");
     345    if (m_settingsTree!=0)
     346        m_settingsTree->deleteLater();
     347}
     348
     349bool StandardSettingDialog::Create(void)
     350{
     351    if (!LoadWindowFromXML("standardsetting-ui.xml", "settingssetup", this))
     352        return false;
     353
     354    bool error=false;
     355    UIUtilE::Assign(this, m_title, "title",&error);
     356    UIUtilW::Assign(this, m_groupHelp, "grouphelp",&error);
     357    UIUtilE::Assign(this, m_buttonList,"settingslist",&error);
     358
     359    UIUtilW::Assign(this, m_selectedSettingHelp, "selectedsettinghelp");
     360
     361    connect(m_buttonList,SIGNAL(itemSelected(MythUIButtonListItem*)),
     362        this,SLOT(settingSelected(MythUIButtonListItem*)));
     363    connect(m_buttonList,SIGNAL(itemClicked(MythUIButtonListItem*)),
     364        this,SLOT(settingClicked(MythUIButtonListItem*)));
     365
     366    if (error)
     367    {
     368        LOG(VB_GENERAL, LOG_ERR, "error.");
     369        return false;
     370    }
     371    BuildFocusList();
     372
     373    return true;
     374}
     375
     376void StandardSettingDialog::settingSelected(MythUIButtonListItem *item)
     377{
     378    if (!item)return;
     379
     380    StandardSetting * setting = qVariantValue<StandardSetting*>(item->GetData());
     381    if (setting)
     382    {
     383        if (m_selectedSettingHelp)
     384            m_selectedSettingHelp->SetText(setting->getHelpText());
     385    }
     386}
     387
     388void StandardSettingDialog::settingClicked(MythUIButtonListItem *item)
     389{
     390    StandardSetting* setting = item->GetData().value<StandardSetting*>();
     391    if (setting)
     392    {
     393        setting->edit(this);
     394    }
     395}
     396
     397void StandardSettingDialog::customEvent(QEvent *event)
     398{
     399    if (event->type() == DialogCompletionEvent::kEventType)
     400    {
     401        DialogCompletionEvent *dce = (DialogCompletionEvent*)(event);
     402        QString resultid  = dce->GetId();
     403
     404        if (resultid == "leveldown")
     405        {
     406            //a GroupSetting have been clicked
     407            LevelDown();
     408        }
     409        else if (resultid == "editsetting")
     410        {
     411            MythUIButtonListItem * item = m_buttonList->GetItemCurrent();
     412            if (item)
     413            {
     414                StandardSetting * ss = item->GetData().value<StandardSetting*>();
     415                if (ss)
     416                {
     417                    ss->resultEdit(dce, item);
     418                    ss->updateButton(item);
     419                }
     420            }
     421        }
     422        else if (resultid == "exit")
     423        {
     424            int buttonnum = dce->GetResult();
     425            if (buttonnum == 0)
     426            {
     427                Save();
     428                MythScreenType::Close();
     429            }
     430            else if (buttonnum == 1)
     431                MythScreenType::Close();
     432        }
     433    }
     434}
     435
     436void StandardSettingDialog::loadSettings(GroupSetting * groupSettings)
     437{
     438
     439    m_settingsTree=groupSettings;
     440    if (m_settingsTree)
     441        m_settingsTree->Load();
     442
     443    setCurrentGroupSetting(m_settingsTree);
     444}
     445
     446void StandardSettingDialog::setCurrentGroupSetting(StandardSetting * groupSettings,
     447        StandardSetting * selectedSetting )
     448{
     449    if (!groupSettings) return;
     450
     451    m_currentGroupSetting=groupSettings;
     452    m_buttonList->Reset();
     453
     454    m_title->SetText(m_currentGroupSetting->getLabel());
     455    if (m_groupHelp) m_groupHelp->SetText(m_currentGroupSetting->getHelpText());
     456    if (!m_currentGroupSetting->haveSubSettings())return;
     457    QList<StandardSetting *> * settings = m_currentGroupSetting->getSubSettings();
     458    if (settings==NULL ) return;
     459    QList<StandardSetting *>::const_iterator i;
     460    MythUIButtonListItem *selectedItem=0;
     461    for (i = settings->constBegin(); i != settings->constEnd(); ++i)
     462    {
     463        if (selectedSetting == (*i))
     464            selectedItem =(*i)->createButton(m_buttonList);
     465        else
     466            (*i)->createButton(m_buttonList);
     467    }
     468    if (selectedItem)
     469        m_buttonList->SetItemCurrent(selectedItem);
     470    settingSelected(m_buttonList->GetItemCurrent());
     471
     472}
     473
     474void StandardSettingDialog::Save()
     475{
     476    if (m_settingsTree)
     477        m_settingsTree->Save();
     478}
     479
     480void StandardSettingDialog::LevelUp()
     481{
     482    if (!m_currentGroupSetting) return;
     483    if (m_currentGroupSetting->getParent())
     484    {
     485        setCurrentGroupSetting(m_currentGroupSetting->getParent(),
     486                    m_currentGroupSetting);
     487    }
     488}
     489
     490void StandardSettingDialog::LevelDown()
     491{
     492    MythUIButtonListItem * item = m_buttonList->GetItemCurrent();
     493    if (item)
     494    {
     495        StandardSetting * ss = item->GetData().value<StandardSetting*>();
     496        if (ss && ss->haveSubSettings())
     497            setCurrentGroupSetting(ss);
     498    }
     499}
     500
     501void StandardSettingDialog::Close(void)
     502{
     503    if (m_settingsTree->haveChanged())
     504    {
     505        QString label = tr("Exit ?");
     506
     507        MythScreenStack *popupStack =
     508                                GetMythMainWindow()->GetStack("popup stack");
     509
     510        MythDialogBox * m_menuPopup =
     511                new MythDialogBox(label, popupStack, "exitmenu");
     512
     513        if (m_menuPopup->Create())
     514            popupStack->AddScreen(m_menuPopup);
     515
     516        m_menuPopup->SetReturnEvent(this, "exit");
     517
     518        m_menuPopup->AddButton(tr("Save then Exit"));
     519        m_menuPopup->AddButton(tr("Exit without saving changes"));
     520        m_menuPopup->AddButton(tr("Cancel"));
     521    }
     522    else
     523        MythScreenType::Close();
     524}
     525
     526
     527bool StandardSettingDialog::keyPressEvent(QKeyEvent *e)
     528{
     529    QStringList actions;
     530    bool handled = m_buttonList->keyPressEvent(e);
     531    if (handled) return true;
     532    handled = GetMythMainWindow()->TranslateKeyPress("Global", e, actions);
     533
     534    for (int i = 0; i < actions.size() && !handled; i++)
     535    {
     536        QString action = actions[i];
     537        handled = true;
     538
     539        if (action == "LEFT")
     540        {
     541            LevelUp();
     542        }
     543        else if (action == "RIGHT")
     544            LevelDown();
     545        else
     546            handled = MythScreenType::keyPressEvent(e);
     547    }
     548
     549    return handled;
     550}
     551
     552
     553
     554
     555
  • 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..1a6d5b0
    - +  
     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
     140
     141class MPUBLIC MythUITextEditSetting : public StandardSetting
     142{
     143  public:
     144    virtual void resultEdit(DialogCompletionEvent *dce, MythUIButtonListItem *item);
     145    virtual bool edit(MythScreenType * screen);
     146  protected:
     147    MythUITextEditSetting (Storage *_storage);
     148   
     149};
     150
     151class MPUBLIC HostTextEditSetting: public MythUITextEditSetting, public HostDBStorage
     152{
     153  public:
     154    HostTextEditSetting(const QString &name) :
     155        MythUITextEditSetting(this), HostDBStorage(this, name) { }
     156
     157    //Don't want to have to do that but cannont think of a work around
     158    virtual void Load(){MythUITextEditSetting::Load();HostDBStorage::Load();}
     159    virtual void Save(){MythUITextEditSetting::Save();HostDBStorage::Save();}
     160};
     161
     162
     163
     164class MPUBLIC MythUIComboBoxSetting : public StandardSetting
     165{
     166  public:
     167
     168    virtual void resultEdit(DialogCompletionEvent *dce, MythUIButtonListItem *item);
     169    virtual bool edit(MythScreenType * screen);
     170    void addSelection(const QString &label, QString value = QString::null, bool select = false);
     171    virtual void updateButton(MythUIButtonListItem *item);
     172  protected:
     173    MythUIComboBoxSetting (Storage *_storage);
     174    ~MythUIComboBoxSetting();
     175  private:
     176    QVector<QString> m_labels;
     177    QVector<QString> m_values;
     178    bool m_isSet;
     179   
     180};
     181
     182class MPUBLIC HostComboBoxSetting: public MythUIComboBoxSetting, public HostDBStorage
     183{
     184  public:
     185    HostComboBoxSetting(const QString &name) :
     186        MythUIComboBoxSetting(this), HostDBStorage(this, name) { }
     187
     188    //Don't want to have to do that but cannot think of a work around
     189    virtual void Load(){MythUIComboBoxSetting::Load();HostDBStorage::Load();}
     190    virtual void Save(){MythUIComboBoxSetting::Save();HostDBStorage::Save();}
     191};
     192
     193
     194
     195class MPUBLIC MythUICheckBoxSetting : public StandardSetting
     196{
     197  public:
     198    virtual void resultEdit(DialogCompletionEvent *dce, MythUIButtonListItem *item);
     199    virtual bool edit(MythScreenType * screen);
     200    virtual void updateButton(MythUIButtonListItem *item);
     201    void setValue(bool value);
     202    bool boolValue();
     203  protected:
     204    MythUICheckBoxSetting (Storage *_storage);
     205   
     206};
     207
     208class MPUBLIC HostCheckBoxSetting: public MythUICheckBoxSetting, public HostDBStorage
     209{
     210  public:
     211    HostCheckBoxSetting(const QString &name, bool rw = true) :
     212        MythUICheckBoxSetting(this), HostDBStorage(this, name) { }
     213};
     214
     215
     216class GroupSetting : public StandardSetting, public Storage
     217{
     218  public:
     219    GroupSetting();
     220
     221    virtual void Load(void){StandardSetting::Load();};
     222    virtual void Save(void){StandardSetting::Save();};
     223    virtual bool edit(MythScreenType * screen);
     224    virtual void resultEdit(DialogCompletionEvent *dce, MythUIButtonListItem *item){};
     225
     226 private:
     227
     228};
     229
     230
     231
     232class StandardSettingDialog : public MythScreenType
     233{
     234    Q_OBJECT
     235
     236  public:
     237
     238    StandardSettingDialog(MythScreenStack *parent, const char *name);
     239    virtual ~StandardSettingDialog();
     240    bool Create(void);
     241    void loadSettings(GroupSetting * groupSettings);
     242    virtual void customEvent(QEvent *event);
     243    virtual bool keyPressEvent(QKeyEvent *);
     244  public slots:
     245    void Close(void);
     246  protected:
     247
     248    MythUIButtonList *m_buttonList;
     249  private slots:
     250    void settingSelected(MythUIButtonListItem *item);
     251    void settingClicked(MythUIButtonListItem *item);
     252  private:
     253    void LevelUp();
     254    void LevelDown();
     255    void setCurrentGroupSetting(StandardSetting * groupSettings,StandardSetting * selectedSetting=0);
     256    void Save();
     257    MythUIText      *m_title;
     258    MythUIText      *m_groupHelp;
     259    MythUIText      *m_selectedSettingHelp;
     260    MythDialogBox   *m_menuPopup;
     261    GroupSetting    *m_settingsTree;
     262    StandardSetting *m_currentGroupSetting;
     263    bool m_loaded;
     264};
     265
     266
     267
     268#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>