Ticket #2793: 2793-v1.patch

File 2793-v1.patch, 28.0 KB (added by danielk, 15 years ago)

DiSEqC setup changes

  • libs/libmythtv/cardutil.h

     
    163163                                    uint &channel_timeout);
    164164    static bool         IgnoreEncrypted(uint cardid, const QString &inputname);
    165165    static bool         TVOnly(uint cardid, const QString &inputname);
     166    static bool         IsInNeedOfExternalInputConf(uint cardid);
    166167
    167168    // DVB info
    168169    static bool         IsDVB(uint cardid, const QString &_inputname);
  • libs/libmythtv/videosource.h

     
    66
    77#include "settings.h"
    88#include "datadirect.h"
    9 #include "diseqcsettings.h"
    109
    1110class SignalTimeout;
    1211class ChannelTimeout;
     
    1918class ChildID;
    2019class InputName;
    2120class SourceID;
     21class DiSEqCDevTree;
     22class DiSEqCDevSettings;
    2223
    2324class VideoSourceDBStorage : public SimpleDBStorage
    2425{
     
    412413    ChannelTimeout     *channel_timeout;
    413414    TransButtonSetting *buttonAnalog;
    414415    DVBTuningDelay     *tuning_delay;
    415     DiSEqCDevTree       tree;
     416    DiSEqCDevTree      *diseqc_tree;
    416417};
    417418
    418419class CaptureCardGroup : public TriggeredConfigurationGroup
     
    502503    const CardInput& parent;
    503504};
    504505
    505 class MPUBLIC CaptureCardEditor :
    506     public QObject, public ConfigurationDialog, public Storage
     506class MPUBLIC CaptureCardEditor : public QObject, public ConfigurationDialog
    507507{
    508508    Q_OBJECT
    509509
     
    525525    ListBoxSetting *listbox;
    526526};
    527527
    528 class MPUBLIC VideoSourceEditor :
    529     public QObject, public ConfigurationDialog, public Storage
     528class MPUBLIC VideoSourceEditor : public QObject, public ConfigurationDialog
    530529{
    531530    Q_OBJECT
    532531
     
    552551    ListBoxSetting *listbox;
    553552};
    554553
    555 class MPUBLIC CardInputEditor :
    556     public QObject, public ConfigurationDialog, public Storage
     554class MPUBLIC CardInputEditor : public QObject, public ConfigurationDialog
    557555{
    558556  public:
    559557    CardInputEditor();
     
    589587{
    590588    Q_OBJECT
    591589  public:
    592     CardInput(bool is_dtv_card, bool is_dvb_card, int cardid);
     590    CardInput(bool is_dtv_card, bool is_dvb_card,
     591              bool is_new_input, int cardid);
    593592
    594593    int getInputID(void) const { return id->intValue(); };
    595594
     
    605604  public slots:
    606605    void channelScanner();
    607606    void sourceFetch();
    608     void diseqcConfig();
    609607    void SetSourceID(const QString &sourceid);
    610608
    611609  private:
     
    627625    StartingChannel *startchan;
    628626    TransButtonSetting *scan;
    629627    TransButtonSetting *srcfetch;
    630     DiSEqCDevSettings  settings;
     628    DiSEqCDevSettings  *externalInputSettings;
    631629};
    632630
    633631#endif
  • libs/libmythtv/playgroup.h

     
    2323    QString name;
    2424};
    2525
    26 class MPUBLIC PlayGroupEditor :
    27     public QObject, public ConfigurationDialog, public Storage
     26class MPUBLIC PlayGroupEditor : public QObject, public ConfigurationDialog
    2827{
    2928    Q_OBJECT
    30  public:
     29
     30  public:
    3131    PlayGroupEditor(void);
    3232    virtual int exec(void);
    3333    virtual void load(void);
  • libs/libmythtv/diseqc.h

     
    107107
    108108    // Gets
    109109    uint GetVoltage(void) const { return m_last_voltage; }
     110    bool IsInNeedOfConf(void) const;
    110111
    111112    // tree management
    112113    void AddDeferredDelete(uint dev_id) { m_delete.push_back(dev_id); }
  • libs/libmythtv/profilegroup.h

     
    110110};
    111111
    112112class MPUBLIC ProfileGroupEditor :
    113     public QObject, public ConfigurationDialog, public Storage
     113    public QObject, public ConfigurationDialog
    114114{
    115115    Q_OBJECT
    116116  public:
  • libs/libmythtv/scheduledrecording.h

     
    262262};
    263263
    264264class ScheduledRecordingEditor :
    265     public QObject, public ConfigurationDialog, public Storage
     265    public QObject, public ConfigurationDialog
    266266{
    267267    Q_OBJECT
    268268
  • libs/libmythtv/recordingprofile.h

     
    128128};
    129129
    130130class RecordingProfileEditor :
    131     public QObject, public ConfigurationDialog, public Storage
     131    public QObject, public ConfigurationDialog
    132132{
    133133    Q_OBJECT
    134134
  • libs/libmythtv/cardutil.cpp

     
    99#include "mythcontext.h"
    1010#include "mythdbcon.h"
    1111#include "dvbchannel.h"
     12#include "diseqcsettings.h"
    1213
    1314#ifdef USING_DVB
    1415#include "dvbtypes.h"
     
    435436    return !radioservices;
    436437}
    437438
     439bool CardUtil::IsInNeedOfExternalInputConf(uint cardid)
     440{
     441    DiSEqCDev dev;
     442    DiSEqCDevTree *diseqc_tree = dev.FindTree(cardid);
     443
     444    bool needsConf = false;
     445    if (diseqc_tree)
     446        return diseqc_tree->IsInNeedOfConf();
     447
     448    return needsConf;
     449}
     450
    438451bool CardUtil::hasV4L2(int videofd)
    439452{
    440453    (void) videofd;
     
    753766    QStringList::iterator it = inputs.begin();
    754767    for (; it != inputs.end(); ++it)
    755768    {
    756         CardInput* cardinput = new CardInput(is_dtv, false, cardid);
     769        CardInput* cardinput = new CardInput(is_dtv, false, false, cardid);
    757770        cardinput->loadByInput(rcardid, (*it));
    758771        cardinput->SetChildCardID((parentid) ? cardid : 0);
    759772        inputLabels.push_back(
     
    767780    {
    768781        InputNames list;
    769782        list[0] = "DVBInput";
    770         bool needs_conf = DTVDeviceNeedsConfiguration(rcardid);
     783        bool needs_conf = IsInNeedOfExternalInputConf(rcardid);
    771784        if (needs_conf)
    772785            list = GetConfiguredDVBInputs(rcardid);
    773786
    774787        InputNames::const_iterator it;
    775788        for (it = list.begin(); it != list.end(); ++it)
    776789        {
    777             CardInput *cardinput = new CardInput(is_dtv, true, rcardid);
     790            CardInput *cardinput = new CardInput(is_dtv, true, false, rcardid);
    778791            cardinput->loadByInput(rcardid, *it);
    779792            cardinput->SetChildCardID(parentid ? cardid : 0);
    780793            inputLabels.push_back(
     
    786799        // plus add one "new" input
    787800        if (needs_conf)
    788801        {
    789             CardInput *newcard = new CardInput(is_dtv, true, rcardid);
     802            CardInput *newcard = new CardInput(is_dtv, true, true, rcardid);
    790803            QString newname = QString("DVBInput #%1").arg(list.size() + 1);
    791804            newcard->loadByInput(rcardid, newname);
    792805            newcard->SetChildCardID((parentid) ? cardid : 0);
  • libs/libmythtv/videosource.cpp

     
    17361736    };
    17371737};
    17381738
    1739 CardInput::CardInput(bool isDTVcard, bool isDVBcard, int _cardid)
     1739CardInput::CardInput(bool isDTVcard,     bool isDVBcard,
     1740                     bool isNewInput, int _cardid) :
     1741    id(new ID()),
     1742    cardid(new CardID(*this)),
     1743    childid(),
     1744    inputname(new InputName(*this)),
     1745    sourceid(new SourceID(*this)),
     1746    startchan(new StartingChannel(*this)),
     1747    scan(new TransButtonSetting()),
     1748    srcfetch(new TransButtonSetting()),
     1749    externalInputSettings(new DiSEqCDevSettings())
    17401750{
    1741     (void) _cardid;
     1751    addChild(id);
    17421752
    1743     addChild(id = new ID());
     1753    if (CardUtil::IsInNeedOfExternalInputConf(_cardid))
     1754    {
     1755        addChild(new DTVDeviceConfigGroup(*externalInputSettings,
     1756                                          _cardid, isNewInput));
     1757    }
    17441758
    17451759    ConfigurationGroup *group =
    17461760        new VerticalConfigurationGroup(false, false, true, true);
     
    17491763
    17501764    HorizontalConfigurationGroup *ci;
    17511765    ci = new HorizontalConfigurationGroup(false, false);
    1752     ci->addChild(cardid = new CardID(*this));
    1753     ci->addChild(inputname = new InputName(*this));
     1766    ci->addChild(cardid);
     1767    ci->addChild(inputname);
    17541768    group->addChild(ci);
    17551769    group->addChild(new InputDisplayName(*this));
    1756     group->addChild(sourceid = new SourceID(*this));
     1770    group->addChild(sourceid);
    17571771    if (!isDVBcard)
    17581772    {
    17591773        group->addChild(new ExternalChannelCommand(*this));
     
    17691783        group->addChild(chgroup);
    17701784    }
    17711785
    1772 #ifdef USING_DVB
    17731786    if (isDVBcard)
    17741787    {
    1775         TransButtonSetting *diseqc = new TransButtonSetting();
    1776         diseqc->setLabel(tr("DVB-S"));
    1777         diseqc->setHelpText(tr("Input and satellite settings."));
    1778         diseqc->setVisible(DTVDeviceNeedsConfiguration(_cardid));
    1779         group->addChild(diseqc);
    1780         connect(diseqc, SIGNAL(pressed()), SLOT(diseqcConfig()));
    1781    
    17821788        ConfigurationGroup *chgroup =
    17831789            new HorizontalConfigurationGroup(false, false, true, true);
    17841790        chgroup->addChild(new RadioServices(*this));
    17851791        chgroup->addChild(new DishNetEIT(*this));
    17861792        group->addChild(chgroup);
    17871793    }
    1788 #endif
    17891794
    1790     scan = new TransButtonSetting();
    17911795    scan->setLabel(tr("Scan for channels"));
    17921796    scan->setHelpText(
    17931797        tr("Use channel scanner to find channels for this input."));
    17941798
    1795     srcfetch = new TransButtonSetting();
    17961799    srcfetch->setLabel(tr("Fetch channels from listings source"));
    17971800    srcfetch->setHelpText(
    17981801        tr("This uses the listings data source to "
     
    18051808    sgrp->addChild(srcfetch);
    18061809    group->addChild(sgrp);
    18071810
    1808     startchan = new StartingChannel(*this);
    18091811    group->addChild(startchan);
    18101812    group->addChild(new InputPriority(*this));
    18111813
     
    19121914    }
    19131915}
    19141916
    1915 void CardInput::diseqcConfig(void)
    1916 {
    1917 #ifdef USING_DVB
    1918     DTVDeviceConfigWizard wizard(settings, cardid->getValue().toUInt());
    1919     wizard.exec();
    1920 #endif // USING_DVB
    1921 }
    1922 
    19231917QString CardInputDBStorage::whereClause(MSqlBindings& bindings)
    19241918{
    19251919    QString cardinputidTag(":WHERECARDINPUTID");
     
    19471941
    19481942void CardInput::loadByID(int inputid)
    19491943{
     1944    VERBOSE(VB_IMPORTANT, "CardInput::loadByID("<<inputid<<")");
     1945    externalInputSettings->Load(inputid);
    19501946    id->setValue(inputid);
    1951 #ifdef USING_DVB
    1952     settings.Load(inputid);
    1953 #endif
    1954     cfgGrp->load();
     1947    load();
    19551948}
    19561949
    19571950void CardInput::loadByInput(int _cardid, QString _inputname)
     
    19621955    query.bindValue(":CARDID", _cardid);
    19631956    query.bindValue(":INPUTNAME", _inputname);
    19641957
    1965     if (query.exec() && query.isActive() && query.size() > 0)
     1958    if (query.exec() && query.isActive() && query.next())
    19661959    {
    1967         query.next();
    19681960        loadByID(query.value(0).toInt());
    19691961    }
    19701962    else
    1971     {
    1972         cfgGrp->load(); // new
     1963    { // create new input connection
     1964        load();
    19731965        cardid->setValue(QString::number(_cardid));
    19741966        inputname->setValue(_inputname);
    19751967    }
    19761968}
    19771969
    1978 void CardInput::save()
     1970void CardInput::save(void)
    19791971{
     1972    VERBOSE(VB_IMPORTANT, "CardInput::save()");
    19801973
    19811974    if (sourceid->getValue() == "0")
    19821975    {
     
    19881981    }
    19891982    else
    19901983    {
    1991         cfgGrp->save();
    1992 #ifdef USING_DVB
    1993         settings.Store(getInputID());
    1994 #endif
     1984        ConfigurationWizard::save();
     1985        externalInputSettings->Store(getInputID());
    19951986    }
    19961987}
    19971988
     
    25022493
    25032494DVBConfigurationGroup::DVBConfigurationGroup(CaptureCard& a_parent) :
    25042495    VerticalConfigurationGroup(false, true, false, false),
    2505     parent(a_parent)
     2496    parent(a_parent),
     2497    diseqc_tree(new DiSEqCDevTree())
    25062498{
    25072499    DVBCardNum* cardnum = new DVBCardNum(parent);
    25082500    cardname = new DVBCardName();
     
    25722564
    25732565void DVBConfigurationGroup::DiSEqCPanel()
    25742566{
    2575 #ifdef USING_DVB
    25762567    parent.reload(); // ensure card id is valid
    25772568
    2578     DTVDeviceTreeWizard diseqcWiz(tree);
     2569    DTVDeviceTreeWizard diseqcWiz(*diseqc_tree);
    25792570    diseqcWiz.exec();
    2580     defaultinput->fillSelections(DTVDeviceNeedsConfiguration(tree));
    2581 #endif // USING_DVB
     2571    defaultinput->fillSelections(diseqc_tree->IsInNeedOfConf());
    25822572}
    25832573
    25842574void DVBConfigurationGroup::load()
    25852575{
    25862576    VerticalConfigurationGroup::load();
    2587 #ifdef USING_DVB
    2588     tree.Load(parent.getCardID());
    2589     defaultinput->fillSelections(DTVDeviceNeedsConfiguration(tree));
    2590 #endif
     2577    diseqc_tree->Load(parent.getCardID());
     2578    defaultinput->fillSelections(diseqc_tree->IsInNeedOfConf());
    25912579}
    25922580
    25932581void DVBConfigurationGroup::save()
    25942582{
    25952583    VerticalConfigurationGroup::save();
    2596 #ifdef USING_DVB
    2597     tree.Store(parent.getCardID());
     2584    diseqc_tree->Store(parent.getCardID());
    25982585    DiSEqCDev trees;
    25992586    trees.InvalidateTrees();
    2600 #endif
    26012587}
    26022588
    26032589void CaptureCard::reload(void)
  • libs/libmythtv/diseqcsettings.cpp

     
    356356    return str;
    357357}
    358358
    359 static double AngleToFloat(const QString &angle)
     359static double AngleToEdit(double angle, QString &hemi)
    360360{
     361    if (angle > 0.0)
     362    {
     363        hemi = "E";
     364        return angle;
     365    }
     366
     367    hemi = "W";
     368    return -angle;
     369}
     370
     371static double AngleToFloat(const QString &angle, bool translated = true)
     372{
    361373    if (angle.length() < 2)
    362374        return 0.0;
    363375
     
    366378    if (postfix.isLetter())
    367379    {
    368380        pos = angle.left(angle.length() - 1).toDouble();
    369         if (postfix.upper() == DeviceTree::tr("W", "Western Hemisphere"))
     381        if ((translated &&
     382             (postfix.upper() == DeviceTree::tr("W", "Western Hemisphere"))) ||
     383            (!translated && (postfix.upper() == "W")))
     384        {
    370385            pos = -pos;
     386        }
    371387    }
    372388    else
    373389        pos = angle.toDouble();
     
    11651181
    11661182//////////////////////////////////////// USALSRotorSetting
    11671183
    1168 class USALSRotorSetting : public LineEditSetting, public Storage
     1184class USALSRotorSetting : public HorizontalConfigurationGroup
    11691185{
    11701186  public:
    11711187    USALSRotorSetting(DiSEqCDevDevice &node, DiSEqCDevSettings &settings) :
    1172         LineEditSetting(this), m_node(node), m_settings(settings)
     1188        HorizontalConfigurationGroup(false, false, true, true),
     1189        numeric(new TransLineEditSetting()),
     1190        hemisphere(new TransComboBoxSetting(false)),
     1191        m_node(node), m_settings(settings)
    11731192    {
    1174         setLabel(node.GetDescription());
    1175         QString help = DeviceTree::tr(
    1176             "The longitude of the satellite you are aiming at, in degrees. "
    1177             "In the Western hemisphere use 'W' as the suffix. "
    1178             "In the Eastern hemisphere use 'E' as the suffix. ");
    1179         setHelpText(help);
     1193        QString help =
     1194            DeviceTree::tr(
     1195                "Locates the satelite you wish to point to "
     1196                "with the longitude along the Clarke Belt of"
     1197                "the satellite [-180..180] and its hemisphere.");
     1198
     1199        numeric->setLabel(DeviceTree::tr("Longitude (degrees)"));
     1200        numeric->setHelpText(help);
     1201        hemisphere->setLabel(DeviceTree::tr("Hemisphere"));
     1202        hemisphere->addSelection(DeviceTree::tr("Eastern"), "E", false);
     1203        hemisphere->addSelection(DeviceTree::tr("Western"), "W", true);
     1204        hemisphere->setHelpText(help);
     1205
     1206        addChild(numeric);
     1207        addChild(hemisphere);
    11801208    }
    11811209
    11821210    virtual void load(void)
    11831211    {
    1184         setValue(AngleToString(m_settings.GetValue(m_node.GetDeviceID())));
     1212        double  val  = m_settings.GetValue(m_node.GetDeviceID());
     1213        QString hemi = QString::null;
     1214        double  eval = AngleToEdit(val, hemi);
     1215        numeric->setValue(QString::number(eval));
     1216        hemisphere->setValue(hemisphere->getValueIndex(hemi));
    11851217    }
    11861218
    11871219    virtual void save(void)
    11881220    {
    1189         m_settings.SetValue(m_node.GetDeviceID(), AngleToFloat(getValue()));
     1221        QString val = QString::number(numeric->getValue().toDouble());
     1222        val += hemisphere->getValue();
     1223        m_settings.SetValue(m_node.GetDeviceID(), AngleToFloat(val, false));
    11901224    }
    11911225
    11921226    virtual void save(QString /*destination*/) { }
    11931227
    11941228  private:
    1195     DiSEqCDevDevice   &m_node;
    1196     DiSEqCDevSettings &m_settings;
     1229    TransLineEditSetting *numeric;
     1230    TransComboBoxSetting *hemisphere;
     1231    DiSEqCDevDevice      &m_node;
     1232    DiSEqCDevSettings    &m_settings;
    11971233};
    11981234
    1199 //////////////////////////////////////// DTVDeviceNeedsConfiguration
     1235//////////////////////////////////////// DTVDeviceConfigGroup
    12001236
    1201 bool DTVDeviceNeedsConfiguration(uint cardid)
     1237DTVDeviceConfigGroup::DTVDeviceConfigGroup(
     1238    DiSEqCDevSettings &settings, uint cardid, bool switches_enabled) :
     1239    VerticalConfigurationGroup(false, false, true, true),
     1240    m_settings(settings), m_switches_enabled(switches_enabled)
    12021241{
    1203     DiSEqCDev dev;
    1204     DiSEqCDevTree *diseqc_tree = dev.FindTree(cardid);
    1205     return diseqc_tree ? DTVDeviceNeedsConfiguration(*diseqc_tree) : false;
    1206 }
     1242    setLabel(DeviceTree::tr("DTV Device Configuration"));
    12071243
    1208 bool DTVDeviceNeedsConfiguration(DiSEqCDevTree& tree)
    1209 {
    1210     DiSEqCDevDevice *root = tree.Root();
    1211     return (root && root->GetDeviceType() != DiSEqCDevDevice::kTypeLNB);
    1212 }
    1213 
    1214 //////////////////////////////////////// DTVDeviceConfigWizard
    1215 
    1216 DTVDeviceConfigWizard::DTVDeviceConfigWizard(DiSEqCDevSettings &settings,
    1217                                              uint cardid)
    1218     : m_settings(settings)
    1219 {
    1220     ConfigurationGroup *group =
    1221         new VerticalConfigurationGroup(false, false);
    1222     group->setLabel(DeviceTree::tr("DTV Device Configuration"));
    1223 
    12241244    // load
    12251245    m_tree.Load(cardid);
    12261246
    12271247    // initial UI setup
    1228     AddNodes(*group, m_tree.Root());
    1229     SelectNodes();
    1230 
    1231     addChild(group);
     1248    AddNodes(this, QString::null, m_tree.Root());
    12321249}
    12331250
    1234 DTVDeviceConfigWizard::~DTVDeviceConfigWizard(void)
     1251DTVDeviceConfigGroup::~DTVDeviceConfigGroup(void)
    12351252{
    12361253}
    12371254
    1238 void DTVDeviceConfigWizard::AddNodes(ConfigurationGroup &group,
    1239                                      DiSEqCDevDevice    *node)
     1255void DTVDeviceConfigGroup::AddNodes(
     1256    ConfigurationGroup *group, const QString &trigger, DiSEqCDevDevice *node)
    12401257{
    12411258    if (!node)
    12421259        return;
     
    12461263    {
    12471264        case DiSEqCDevDevice::kTypeSwitch:
    12481265            setting = new SwitchSetting(*node, m_settings);
    1249             connect(setting, SIGNAL(valueChanged(const QString&)),
    1250                     SLOT(SelectNodes()));
     1266            setting->setEnabled(m_switches_enabled);
    12511267            break;
    12521268        case DiSEqCDevDevice::kTypeRotor:
    12531269        {
     
    12621278            break;
    12631279    }
    12641280
    1265     if (setting)
     1281    if (!setting)
    12661282    {
    1267         // add this node
    1268         m_devs[node->GetDeviceID()] = setting;
    1269         group.addChild(setting);
     1283        AddChild(group, trigger, new TransLabelSetting());
     1284        return;
    12701285    }
    12711286
    1272     // add children
     1287    m_devs[node->GetDeviceID()] = setting;
     1288
    12731289    uint num_ch = node->GetChildCount();
    1274     for (uint ch = 0; ch < num_ch; ch++)
    1275         AddNodes(group, node->GetChild(ch));
    1276 }
     1290    if (DiSEqCDevDevice::kTypeSwitch == node->GetDeviceType())
     1291    {
     1292        bool useframe = (node != m_tree.Root());
     1293        bool zerospace = !useframe;
     1294        TriggeredConfigurationGroup *cgrp = new TriggeredConfigurationGroup(
     1295            false, useframe, true, true, false, false, true, zerospace);
    12771296
    1278 void DTVDeviceConfigWizard::SelectNodes(void)
    1279 {
    1280     cfgGrp->save();
     1297        cgrp->addChild(setting);
     1298        cgrp->setTrigger(setting);
    12811299
    1282     QMap<uint,bool> active;
    1283     DiSEqCDevDevice *node = m_tree.Root();
    1284     while (node)
     1300        for (uint i = 0; i < num_ch; i++)
     1301            AddNodes(cgrp, QString::number(i), node->GetChild(i));
     1302
     1303        AddChild(group, trigger, cgrp);
     1304        return;
     1305    }
     1306
     1307    if (!num_ch)
    12851308    {
    1286         active[node->GetDeviceID()] = true;
    1287         node = node->GetSelectedChild(m_settings);
     1309        AddChild(group, trigger, setting);
     1310        return;
    12881311    }
    12891312
    1290     devid_to_setting_t::iterator it = m_devs.begin();
    1291     for (; it != m_devs.end(); ++it)
    1292         (*it)->setEnabled(active[it.key()]);
     1313    VerticalConfigurationGroup *cgrp =
     1314        new VerticalConfigurationGroup(false, false, true, true);
     1315           
     1316    AddChild(cgrp, QString::null, setting);
     1317    for (uint i = 0; i < num_ch; i++)
     1318        AddNodes(cgrp, QString::null, node->GetChild(i));
     1319
     1320    AddChild(group, trigger, cgrp);
    12931321}
    12941322
     1323void DTVDeviceConfigGroup::AddChild(
     1324    ConfigurationGroup *group, const QString &trigger, Setting *setting)
     1325{
     1326    TriggeredConfigurationGroup *grp =
     1327        dynamic_cast<TriggeredConfigurationGroup*>(group);
     1328
     1329    if (grp && !trigger.isEmpty())
     1330        grp->addTarget(trigger, setting);
     1331    else
     1332        group->addChild(setting);
     1333}
     1334
    12951335//////////////////////////////////////// Database Upgrade
    12961336
    12971337enum OLD_DISEQC_TYPES
  • libs/libmythtv/storagegroup.h

     
    3131};
    3232
    3333class MPUBLIC StorageGroupEditor :
    34     public QObject, public ConfigurationDialog, public Storage
     34    public QObject, public ConfigurationDialog
    3535{
    3636    Q_OBJECT
    3737  public:
     
    5454};
    5555
    5656class MPUBLIC StorageGroupListEditor :
    57     public QObject, public ConfigurationDialog, public Storage
     57    public QObject, public ConfigurationDialog
    5858{
    5959    Q_OBJECT
    6060  public:
  • libs/libmythtv/diseqcsettings.h

     
    1212
    1313typedef QMap<uint, Setting*> devid_to_setting_t;
    1414
    15 bool DTVDeviceNeedsConfiguration(uint cardid);
    16 bool DTVDeviceNeedsConfiguration(DiSEqCDevTree& tree);
    17 
    1815class SwitchTypeSetting;
    1916class SwitchPortsSetting;
    2017
     
    136133    virtual int exec(void);
    137134};
    138135
    139 class DTVDeviceConfigWizard : public QObject, public ConfigurationWizard
     136class DTVDeviceConfigGroup : public VerticalConfigurationGroup
    140137{
    141     Q_OBJECT
    142 
    143138  public:
    144     DTVDeviceConfigWizard(DiSEqCDevSettings &settings, uint cardid);
    145     ~DTVDeviceConfigWizard(void);
     139    DTVDeviceConfigGroup(DiSEqCDevSettings &settings, uint cardid,
     140                         bool switches_enabled);
     141    ~DTVDeviceConfigGroup(void);
    146142   
    147   public slots:
    148     void SelectNodes(void);
    149  
    150143  protected:
    151     void AddNodes(ConfigurationGroup &group, DiSEqCDevDevice *node);
     144    void AddNodes(ConfigurationGroup *group, const QString &trigger,
     145                  DiSEqCDevDevice *node);
     146
     147    void AddChild(ConfigurationGroup *group, const QString &trigger,
     148                  Setting *setting);
    152149   
    153150  private:
    154151    DiSEqCDevTree       m_tree;
    155152    DiSEqCDevSettings  &m_settings;
    156153    devid_to_setting_t  m_devs;
     154    bool                m_switches_enabled;
    157155};
    158156
    159157#endif // _DISEQCSETTINGS_H_
  • libs/libmythtv/diseqc.cpp

     
    114114DiSEqCDevSettings::DiSEqCDevSettings()
    115115    : m_input_id((uint) -1)
    116116{
     117    VERBOSE(VB_IMPORTANT, "DiSEqCDevSettings("<< this << ") ctor");
    117118}
    118119
    119120/** \fn DiSEqCDevSettings::Load(uint)
     
    123124 */
    124125bool DiSEqCDevSettings::Load(uint card_input_id)
    125126{
     127    VERBOSE(VB_IMPORTANT, "DiSEqCDevSettings("
     128            << this << QString(")::Load(%1)").arg(card_input_id));
     129
    126130    if (card_input_id == m_input_id)
    127131        return true;
    128132
     
    143147    }
    144148
    145149    while (query.next())
     150    {
     151        VERBOSE(VB_IMPORTANT,
     152                QString("DiSEqCDevSettings::Load(%1)")
     153                .arg(card_input_id) + QString(" id: %1 val: %2")
     154                .arg(query.value(0).toUInt()).arg(query.value(1).toDouble()));
     155
    146156        m_config[query.value(0).toUInt()] = query.value(1).toDouble();
     157    }
    147158
    148159    m_input_id = card_input_id;
    149160
     
    157168 */
    158169bool DiSEqCDevSettings::Store(uint card_input_id) const
    159170{
     171    VERBOSE(VB_IMPORTANT, "DiSEqCDevSettings("
     172            << this << QString(")::Store(%1)").arg(card_input_id));
     173
    160174    MSqlQuery query(MSqlQuery::InitCon());
    161175
    162176    // clear out previous settings
     
    180194    uint_to_dbl_t::const_iterator it = m_config.begin();
    181195    for (; it != m_config.end(); ++it)
    182196    {
     197        VERBOSE(VB_IMPORTANT,
     198                QString("INSERT INTO diseqc_config "
     199                        "(cardinputid, diseqcid, value) "
     200                        "VALUES (%1, %2, %3)")
     201                .arg(card_input_id).arg(it.key()).arg(*it));
     202
    183203        query.bindValue(":INPUTID", card_input_id);
    184204        query.bindValue(":DEVID",   it.key());
    185205        query.bindValue(":VALUE",   *it);
     
    200220 */
    201221double DiSEqCDevSettings::GetValue(uint devid) const
    202222{
     223    double val = 0.0;
    203224    uint_to_dbl_t::const_iterator it = m_config.find(devid);
    204 
    205225    if (it != m_config.end())
    206226        return *it;
    207227
    208     return 0.0;
     228    bool found = it != m_config.end();
     229    VERBOSE(VB_IMPORTANT,
     230            "DiSEqCDevSettings(" << this << QString(")::GetValue(%1) -> %2")
     231            .arg(devid).arg((found) ? QString::number(val) : "not found"));
     232
     233    if (!found)
     234    {
     235        for (it = m_config.begin(); it != m_config.end(); ++it)
     236        {
     237            VERBOSE(VB_IMPORTANT, QString("id %1 val %2")
     238                    .arg(it.key()).arg(*it));
     239        }
     240    }
     241
     242    return val;
    209243}
    210244
    211245/**
     
    715749    return true;
    716750}
    717751
     752bool DiSEqCDevTree::IsInNeedOfConf(void) const
     753{
     754    if (m_root)
     755        return m_root->GetDeviceType() != DiSEqCDevDevice::kTypeLNB;
     756
     757    return false;
     758}
     759
    718760bool DiSEqCDevTree::ApplyVoltage(const DiSEqCDevSettings &settings,
    719761                                 const DTVMultiplex      &tuning)
    720762{
  • libs/libmyth/settings.cpp

     
    10711071int ConfigurationDialog::exec(bool saveOnAccept, bool doLoad)
    10721072{
    10731073    if (doLoad)
    1074         cfgGrp->load();
     1074        load();
    10751075
    10761076    MythDialog *dialog = dialogWidget(
    10771077        gContext->GetMainWindow(), "Configuration Dialog");
     
    10811081    int ret = dialog->exec();
    10821082
    10831083    if ((QDialog::Accepted == ret) && saveOnAccept)
    1084         cfgGrp->save();
     1084        save();
    10851085
    10861086    dialog->deleteLater();
    10871087    dialog = NULL;
  • libs/libmyth/settings.h

     
    11191119 *  \brief A ConfigurationDialog that uses a ConfigurationGroup
    11201120 *         all children on one page in a vertical layout.
    11211121 */
    1122 class MPUBLIC ConfigurationDialog
     1122class MPUBLIC ConfigurationDialog : public Storage
    11231123{
    11241124  public:
    11251125    ConfigurationDialog() : dialog(NULL), cfgGrp(new ConfigurationGroup()) { }
     
    11321132    // Show a dialogWidget, and save if accepted
    11331133    virtual int exec(bool saveOnExec = true, bool doLoad = true);
    11341134
     1135    virtual void load(void) { cfgGrp->load(); }
     1136    virtual void save(void) { cfgGrp->save(); }
     1137    virtual void save(QString destination) { cfgGrp->save(destination); }
     1138
    11351139    virtual void addChild(Configurable *child);
    11361140
    11371141    virtual Setting *byName(const QString &settingName)
     
    11491153 *  \brief A ConfigurationDialog that uses a ConfigurationGroup
    11501154 *         with one child per page.
    11511155 */
    1152 class MPUBLIC ConfigurationWizard : public ConfigurationDialog, public Storage
     1156class MPUBLIC ConfigurationWizard : public ConfigurationDialog
    11531157{
    11541158  public:
    11551159    ConfigurationWizard() : ConfigurationDialog() {}
    11561160
    11571161    virtual MythDialog *dialogWidget(MythMainWindow *parent,
    11581162                                     const char *widgetName);
    1159 
    1160     virtual void load(void) { cfgGrp->load(); }
    1161     virtual void save(void) { cfgGrp->save(); }
    1162     virtual void save(QString destination) { cfgGrp->save(destination); }
    11631163};
    11641164
    11651165/** \class JumpConfigurationWizard