Ticket #2793: 2793-v1.patch
| File 2793-v1.patch, 28.0 KB (added by , 19 years ago) |
|---|
-
libs/libmythtv/cardutil.h
163 163 uint &channel_timeout); 164 164 static bool IgnoreEncrypted(uint cardid, const QString &inputname); 165 165 static bool TVOnly(uint cardid, const QString &inputname); 166 static bool IsInNeedOfExternalInputConf(uint cardid); 166 167 167 168 // DVB info 168 169 static bool IsDVB(uint cardid, const QString &_inputname); -
libs/libmythtv/videosource.h
6 6 7 7 #include "settings.h" 8 8 #include "datadirect.h" 9 #include "diseqcsettings.h"10 9 11 10 class SignalTimeout; 12 11 class ChannelTimeout; … … 19 18 class ChildID; 20 19 class InputName; 21 20 class SourceID; 21 class DiSEqCDevTree; 22 class DiSEqCDevSettings; 22 23 23 24 class VideoSourceDBStorage : public SimpleDBStorage 24 25 { … … 412 413 ChannelTimeout *channel_timeout; 413 414 TransButtonSetting *buttonAnalog; 414 415 DVBTuningDelay *tuning_delay; 415 DiSEqCDevTree tree;416 DiSEqCDevTree *diseqc_tree; 416 417 }; 417 418 418 419 class CaptureCardGroup : public TriggeredConfigurationGroup … … 502 503 const CardInput& parent; 503 504 }; 504 505 505 class MPUBLIC CaptureCardEditor : 506 public QObject, public ConfigurationDialog, public Storage 506 class MPUBLIC CaptureCardEditor : public QObject, public ConfigurationDialog 507 507 { 508 508 Q_OBJECT 509 509 … … 525 525 ListBoxSetting *listbox; 526 526 }; 527 527 528 class MPUBLIC VideoSourceEditor : 529 public QObject, public ConfigurationDialog, public Storage 528 class MPUBLIC VideoSourceEditor : public QObject, public ConfigurationDialog 530 529 { 531 530 Q_OBJECT 532 531 … … 552 551 ListBoxSetting *listbox; 553 552 }; 554 553 555 class MPUBLIC CardInputEditor : 556 public QObject, public ConfigurationDialog, public Storage 554 class MPUBLIC CardInputEditor : public QObject, public ConfigurationDialog 557 555 { 558 556 public: 559 557 CardInputEditor(); … … 589 587 { 590 588 Q_OBJECT 591 589 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); 593 592 594 593 int getInputID(void) const { return id->intValue(); }; 595 594 … … 605 604 public slots: 606 605 void channelScanner(); 607 606 void sourceFetch(); 608 void diseqcConfig();609 607 void SetSourceID(const QString &sourceid); 610 608 611 609 private: … … 627 625 StartingChannel *startchan; 628 626 TransButtonSetting *scan; 629 627 TransButtonSetting *srcfetch; 630 DiSEqCDevSettings settings;628 DiSEqCDevSettings *externalInputSettings; 631 629 }; 632 630 633 631 #endif -
libs/libmythtv/playgroup.h
23 23 QString name; 24 24 }; 25 25 26 class MPUBLIC PlayGroupEditor : 27 public QObject, public ConfigurationDialog, public Storage 26 class MPUBLIC PlayGroupEditor : public QObject, public ConfigurationDialog 28 27 { 29 28 Q_OBJECT 30 public: 29 30 public: 31 31 PlayGroupEditor(void); 32 32 virtual int exec(void); 33 33 virtual void load(void); -
libs/libmythtv/diseqc.h
107 107 108 108 // Gets 109 109 uint GetVoltage(void) const { return m_last_voltage; } 110 bool IsInNeedOfConf(void) const; 110 111 111 112 // tree management 112 113 void AddDeferredDelete(uint dev_id) { m_delete.push_back(dev_id); } -
libs/libmythtv/profilegroup.h
110 110 }; 111 111 112 112 class MPUBLIC ProfileGroupEditor : 113 public QObject, public ConfigurationDialog , public Storage113 public QObject, public ConfigurationDialog 114 114 { 115 115 Q_OBJECT 116 116 public: -
libs/libmythtv/scheduledrecording.h
262 262 }; 263 263 264 264 class ScheduledRecordingEditor : 265 public QObject, public ConfigurationDialog , public Storage265 public QObject, public ConfigurationDialog 266 266 { 267 267 Q_OBJECT 268 268 -
libs/libmythtv/recordingprofile.h
128 128 }; 129 129 130 130 class RecordingProfileEditor : 131 public QObject, public ConfigurationDialog , public Storage131 public QObject, public ConfigurationDialog 132 132 { 133 133 Q_OBJECT 134 134 -
libs/libmythtv/cardutil.cpp
9 9 #include "mythcontext.h" 10 10 #include "mythdbcon.h" 11 11 #include "dvbchannel.h" 12 #include "diseqcsettings.h" 12 13 13 14 #ifdef USING_DVB 14 15 #include "dvbtypes.h" … … 435 436 return !radioservices; 436 437 } 437 438 439 bool 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 438 451 bool CardUtil::hasV4L2(int videofd) 439 452 { 440 453 (void) videofd; … … 753 766 QStringList::iterator it = inputs.begin(); 754 767 for (; it != inputs.end(); ++it) 755 768 { 756 CardInput* cardinput = new CardInput(is_dtv, false, cardid);769 CardInput* cardinput = new CardInput(is_dtv, false, false, cardid); 757 770 cardinput->loadByInput(rcardid, (*it)); 758 771 cardinput->SetChildCardID((parentid) ? cardid : 0); 759 772 inputLabels.push_back( … … 767 780 { 768 781 InputNames list; 769 782 list[0] = "DVBInput"; 770 bool needs_conf = DTVDeviceNeedsConfiguration(rcardid);783 bool needs_conf = IsInNeedOfExternalInputConf(rcardid); 771 784 if (needs_conf) 772 785 list = GetConfiguredDVBInputs(rcardid); 773 786 774 787 InputNames::const_iterator it; 775 788 for (it = list.begin(); it != list.end(); ++it) 776 789 { 777 CardInput *cardinput = new CardInput(is_dtv, true, rcardid);790 CardInput *cardinput = new CardInput(is_dtv, true, false, rcardid); 778 791 cardinput->loadByInput(rcardid, *it); 779 792 cardinput->SetChildCardID(parentid ? cardid : 0); 780 793 inputLabels.push_back( … … 786 799 // plus add one "new" input 787 800 if (needs_conf) 788 801 { 789 CardInput *newcard = new CardInput(is_dtv, true, rcardid);802 CardInput *newcard = new CardInput(is_dtv, true, true, rcardid); 790 803 QString newname = QString("DVBInput #%1").arg(list.size() + 1); 791 804 newcard->loadByInput(rcardid, newname); 792 805 newcard->SetChildCardID((parentid) ? cardid : 0); -
libs/libmythtv/videosource.cpp
1736 1736 }; 1737 1737 }; 1738 1738 1739 CardInput::CardInput(bool isDTVcard, bool isDVBcard, int _cardid) 1739 CardInput::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()) 1740 1750 { 1741 (void) _cardid;1751 addChild(id); 1742 1752 1743 addChild(id = new ID()); 1753 if (CardUtil::IsInNeedOfExternalInputConf(_cardid)) 1754 { 1755 addChild(new DTVDeviceConfigGroup(*externalInputSettings, 1756 _cardid, isNewInput)); 1757 } 1744 1758 1745 1759 ConfigurationGroup *group = 1746 1760 new VerticalConfigurationGroup(false, false, true, true); … … 1749 1763 1750 1764 HorizontalConfigurationGroup *ci; 1751 1765 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); 1754 1768 group->addChild(ci); 1755 1769 group->addChild(new InputDisplayName(*this)); 1756 group->addChild(sourceid = new SourceID(*this));1770 group->addChild(sourceid); 1757 1771 if (!isDVBcard) 1758 1772 { 1759 1773 group->addChild(new ExternalChannelCommand(*this)); … … 1769 1783 group->addChild(chgroup); 1770 1784 } 1771 1785 1772 #ifdef USING_DVB1773 1786 if (isDVBcard) 1774 1787 { 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 1782 1788 ConfigurationGroup *chgroup = 1783 1789 new HorizontalConfigurationGroup(false, false, true, true); 1784 1790 chgroup->addChild(new RadioServices(*this)); 1785 1791 chgroup->addChild(new DishNetEIT(*this)); 1786 1792 group->addChild(chgroup); 1787 1793 } 1788 #endif1789 1794 1790 scan = new TransButtonSetting();1791 1795 scan->setLabel(tr("Scan for channels")); 1792 1796 scan->setHelpText( 1793 1797 tr("Use channel scanner to find channels for this input.")); 1794 1798 1795 srcfetch = new TransButtonSetting();1796 1799 srcfetch->setLabel(tr("Fetch channels from listings source")); 1797 1800 srcfetch->setHelpText( 1798 1801 tr("This uses the listings data source to " … … 1805 1808 sgrp->addChild(srcfetch); 1806 1809 group->addChild(sgrp); 1807 1810 1808 startchan = new StartingChannel(*this);1809 1811 group->addChild(startchan); 1810 1812 group->addChild(new InputPriority(*this)); 1811 1813 … … 1912 1914 } 1913 1915 } 1914 1916 1915 void CardInput::diseqcConfig(void)1916 {1917 #ifdef USING_DVB1918 DTVDeviceConfigWizard wizard(settings, cardid->getValue().toUInt());1919 wizard.exec();1920 #endif // USING_DVB1921 }1922 1923 1917 QString CardInputDBStorage::whereClause(MSqlBindings& bindings) 1924 1918 { 1925 1919 QString cardinputidTag(":WHERECARDINPUTID"); … … 1947 1941 1948 1942 void CardInput::loadByID(int inputid) 1949 1943 { 1944 VERBOSE(VB_IMPORTANT, "CardInput::loadByID("<<inputid<<")"); 1945 externalInputSettings->Load(inputid); 1950 1946 id->setValue(inputid); 1951 #ifdef USING_DVB 1952 settings.Load(inputid); 1953 #endif 1954 cfgGrp->load(); 1947 load(); 1955 1948 } 1956 1949 1957 1950 void CardInput::loadByInput(int _cardid, QString _inputname) … … 1962 1955 query.bindValue(":CARDID", _cardid); 1963 1956 query.bindValue(":INPUTNAME", _inputname); 1964 1957 1965 if (query.exec() && query.isActive() && query. size() > 0)1958 if (query.exec() && query.isActive() && query.next()) 1966 1959 { 1967 query.next();1968 1960 loadByID(query.value(0).toInt()); 1969 1961 } 1970 1962 else 1971 { 1972 cfgGrp->load(); // new1963 { // create new input connection 1964 load(); 1973 1965 cardid->setValue(QString::number(_cardid)); 1974 1966 inputname->setValue(_inputname); 1975 1967 } 1976 1968 } 1977 1969 1978 void CardInput::save( )1970 void CardInput::save(void) 1979 1971 { 1972 VERBOSE(VB_IMPORTANT, "CardInput::save()"); 1980 1973 1981 1974 if (sourceid->getValue() == "0") 1982 1975 { … … 1988 1981 } 1989 1982 else 1990 1983 { 1991 cfgGrp->save(); 1992 #ifdef USING_DVB 1993 settings.Store(getInputID()); 1994 #endif 1984 ConfigurationWizard::save(); 1985 externalInputSettings->Store(getInputID()); 1995 1986 } 1996 1987 } 1997 1988 … … 2502 2493 2503 2494 DVBConfigurationGroup::DVBConfigurationGroup(CaptureCard& a_parent) : 2504 2495 VerticalConfigurationGroup(false, true, false, false), 2505 parent(a_parent) 2496 parent(a_parent), 2497 diseqc_tree(new DiSEqCDevTree()) 2506 2498 { 2507 2499 DVBCardNum* cardnum = new DVBCardNum(parent); 2508 2500 cardname = new DVBCardName(); … … 2572 2564 2573 2565 void DVBConfigurationGroup::DiSEqCPanel() 2574 2566 { 2575 #ifdef USING_DVB2576 2567 parent.reload(); // ensure card id is valid 2577 2568 2578 DTVDeviceTreeWizard diseqcWiz( tree);2569 DTVDeviceTreeWizard diseqcWiz(*diseqc_tree); 2579 2570 diseqcWiz.exec(); 2580 defaultinput->fillSelections(DTVDeviceNeedsConfiguration(tree)); 2581 #endif // USING_DVB 2571 defaultinput->fillSelections(diseqc_tree->IsInNeedOfConf()); 2582 2572 } 2583 2573 2584 2574 void DVBConfigurationGroup::load() 2585 2575 { 2586 2576 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()); 2591 2579 } 2592 2580 2593 2581 void DVBConfigurationGroup::save() 2594 2582 { 2595 2583 VerticalConfigurationGroup::save(); 2596 #ifdef USING_DVB 2597 tree.Store(parent.getCardID()); 2584 diseqc_tree->Store(parent.getCardID()); 2598 2585 DiSEqCDev trees; 2599 2586 trees.InvalidateTrees(); 2600 #endif2601 2587 } 2602 2588 2603 2589 void CaptureCard::reload(void) -
libs/libmythtv/diseqcsettings.cpp
356 356 return str; 357 357 } 358 358 359 static double AngleTo Float(const QString &angle)359 static double AngleToEdit(double angle, QString &hemi) 360 360 { 361 if (angle > 0.0) 362 { 363 hemi = "E"; 364 return angle; 365 } 366 367 hemi = "W"; 368 return -angle; 369 } 370 371 static double AngleToFloat(const QString &angle, bool translated = true) 372 { 361 373 if (angle.length() < 2) 362 374 return 0.0; 363 375 … … 366 378 if (postfix.isLetter()) 367 379 { 368 380 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 { 370 385 pos = -pos; 386 } 371 387 } 372 388 else 373 389 pos = angle.toDouble(); … … 1165 1181 1166 1182 //////////////////////////////////////// USALSRotorSetting 1167 1183 1168 class USALSRotorSetting : public LineEditSetting, public Storage1184 class USALSRotorSetting : public HorizontalConfigurationGroup 1169 1185 { 1170 1186 public: 1171 1187 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) 1173 1192 { 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); 1180 1208 } 1181 1209 1182 1210 virtual void load(void) 1183 1211 { 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)); 1185 1217 } 1186 1218 1187 1219 virtual void save(void) 1188 1220 { 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)); 1190 1224 } 1191 1225 1192 1226 virtual void save(QString /*destination*/) { } 1193 1227 1194 1228 private: 1195 DiSEqCDevDevice &m_node; 1196 DiSEqCDevSettings &m_settings; 1229 TransLineEditSetting *numeric; 1230 TransComboBoxSetting *hemisphere; 1231 DiSEqCDevDevice &m_node; 1232 DiSEqCDevSettings &m_settings; 1197 1233 }; 1198 1234 1199 //////////////////////////////////////// DTVDevice NeedsConfiguration1235 //////////////////////////////////////// DTVDeviceConfigGroup 1200 1236 1201 bool DTVDeviceNeedsConfiguration(uint cardid) 1237 DTVDeviceConfigGroup::DTVDeviceConfigGroup( 1238 DiSEqCDevSettings &settings, uint cardid, bool switches_enabled) : 1239 VerticalConfigurationGroup(false, false, true, true), 1240 m_settings(settings), m_switches_enabled(switches_enabled) 1202 1241 { 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")); 1207 1243 1208 bool DTVDeviceNeedsConfiguration(DiSEqCDevTree& tree)1209 {1210 DiSEqCDevDevice *root = tree.Root();1211 return (root && root->GetDeviceType() != DiSEqCDevDevice::kTypeLNB);1212 }1213 1214 //////////////////////////////////////// DTVDeviceConfigWizard1215 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 1224 1244 // load 1225 1245 m_tree.Load(cardid); 1226 1246 1227 1247 // initial UI setup 1228 AddNodes(*group, m_tree.Root()); 1229 SelectNodes(); 1230 1231 addChild(group); 1248 AddNodes(this, QString::null, m_tree.Root()); 1232 1249 } 1233 1250 1234 DTVDeviceConfig Wizard::~DTVDeviceConfigWizard(void)1251 DTVDeviceConfigGroup::~DTVDeviceConfigGroup(void) 1235 1252 { 1236 1253 } 1237 1254 1238 void DTVDeviceConfig Wizard::AddNodes(ConfigurationGroup &group,1239 DiSEqCDevDevice*node)1255 void DTVDeviceConfigGroup::AddNodes( 1256 ConfigurationGroup *group, const QString &trigger, DiSEqCDevDevice *node) 1240 1257 { 1241 1258 if (!node) 1242 1259 return; … … 1246 1263 { 1247 1264 case DiSEqCDevDevice::kTypeSwitch: 1248 1265 setting = new SwitchSetting(*node, m_settings); 1249 connect(setting, SIGNAL(valueChanged(const QString&)), 1250 SLOT(SelectNodes())); 1266 setting->setEnabled(m_switches_enabled); 1251 1267 break; 1252 1268 case DiSEqCDevDevice::kTypeRotor: 1253 1269 { … … 1262 1278 break; 1263 1279 } 1264 1280 1265 if ( setting)1281 if (!setting) 1266 1282 { 1267 // add this node 1268 m_devs[node->GetDeviceID()] = setting; 1269 group.addChild(setting); 1283 AddChild(group, trigger, new TransLabelSetting()); 1284 return; 1270 1285 } 1271 1286 1272 // add children 1287 m_devs[node->GetDeviceID()] = setting; 1288 1273 1289 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); 1277 1296 1278 void DTVDeviceConfigWizard::SelectNodes(void) 1279 { 1280 cfgGrp->save(); 1297 cgrp->addChild(setting); 1298 cgrp->setTrigger(setting); 1281 1299 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) 1285 1308 { 1286 active[node->GetDeviceID()] = true;1287 node = node->GetSelectedChild(m_settings);1309 AddChild(group, trigger, setting); 1310 return; 1288 1311 } 1289 1312 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); 1293 1321 } 1294 1322 1323 void 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 1295 1335 //////////////////////////////////////// Database Upgrade 1296 1336 1297 1337 enum OLD_DISEQC_TYPES -
libs/libmythtv/storagegroup.h
31 31 }; 32 32 33 33 class MPUBLIC StorageGroupEditor : 34 public QObject, public ConfigurationDialog , public Storage34 public QObject, public ConfigurationDialog 35 35 { 36 36 Q_OBJECT 37 37 public: … … 54 54 }; 55 55 56 56 class MPUBLIC StorageGroupListEditor : 57 public QObject, public ConfigurationDialog , public Storage57 public QObject, public ConfigurationDialog 58 58 { 59 59 Q_OBJECT 60 60 public: -
libs/libmythtv/diseqcsettings.h
12 12 13 13 typedef QMap<uint, Setting*> devid_to_setting_t; 14 14 15 bool DTVDeviceNeedsConfiguration(uint cardid);16 bool DTVDeviceNeedsConfiguration(DiSEqCDevTree& tree);17 18 15 class SwitchTypeSetting; 19 16 class SwitchPortsSetting; 20 17 … … 136 133 virtual int exec(void); 137 134 }; 138 135 139 class DTVDeviceConfig Wizard : public QObject, public ConfigurationWizard136 class DTVDeviceConfigGroup : public VerticalConfigurationGroup 140 137 { 141 Q_OBJECT142 143 138 public: 144 DTVDeviceConfigWizard(DiSEqCDevSettings &settings, uint cardid); 145 ~DTVDeviceConfigWizard(void); 139 DTVDeviceConfigGroup(DiSEqCDevSettings &settings, uint cardid, 140 bool switches_enabled); 141 ~DTVDeviceConfigGroup(void); 146 142 147 public slots:148 void SelectNodes(void);149 150 143 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); 152 149 153 150 private: 154 151 DiSEqCDevTree m_tree; 155 152 DiSEqCDevSettings &m_settings; 156 153 devid_to_setting_t m_devs; 154 bool m_switches_enabled; 157 155 }; 158 156 159 157 #endif // _DISEQCSETTINGS_H_ -
libs/libmythtv/diseqc.cpp
114 114 DiSEqCDevSettings::DiSEqCDevSettings() 115 115 : m_input_id((uint) -1) 116 116 { 117 VERBOSE(VB_IMPORTANT, "DiSEqCDevSettings("<< this << ") ctor"); 117 118 } 118 119 119 120 /** \fn DiSEqCDevSettings::Load(uint) … … 123 124 */ 124 125 bool DiSEqCDevSettings::Load(uint card_input_id) 125 126 { 127 VERBOSE(VB_IMPORTANT, "DiSEqCDevSettings(" 128 << this << QString(")::Load(%1)").arg(card_input_id)); 129 126 130 if (card_input_id == m_input_id) 127 131 return true; 128 132 … … 143 147 } 144 148 145 149 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 146 156 m_config[query.value(0).toUInt()] = query.value(1).toDouble(); 157 } 147 158 148 159 m_input_id = card_input_id; 149 160 … … 157 168 */ 158 169 bool DiSEqCDevSettings::Store(uint card_input_id) const 159 170 { 171 VERBOSE(VB_IMPORTANT, "DiSEqCDevSettings(" 172 << this << QString(")::Store(%1)").arg(card_input_id)); 173 160 174 MSqlQuery query(MSqlQuery::InitCon()); 161 175 162 176 // clear out previous settings … … 180 194 uint_to_dbl_t::const_iterator it = m_config.begin(); 181 195 for (; it != m_config.end(); ++it) 182 196 { 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 183 203 query.bindValue(":INPUTID", card_input_id); 184 204 query.bindValue(":DEVID", it.key()); 185 205 query.bindValue(":VALUE", *it); … … 200 220 */ 201 221 double DiSEqCDevSettings::GetValue(uint devid) const 202 222 { 223 double val = 0.0; 203 224 uint_to_dbl_t::const_iterator it = m_config.find(devid); 204 205 225 if (it != m_config.end()) 206 226 return *it; 207 227 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; 209 243 } 210 244 211 245 /** … … 715 749 return true; 716 750 } 717 751 752 bool DiSEqCDevTree::IsInNeedOfConf(void) const 753 { 754 if (m_root) 755 return m_root->GetDeviceType() != DiSEqCDevDevice::kTypeLNB; 756 757 return false; 758 } 759 718 760 bool DiSEqCDevTree::ApplyVoltage(const DiSEqCDevSettings &settings, 719 761 const DTVMultiplex &tuning) 720 762 { -
libs/libmyth/settings.cpp
1071 1071 int ConfigurationDialog::exec(bool saveOnAccept, bool doLoad) 1072 1072 { 1073 1073 if (doLoad) 1074 cfgGrp->load();1074 load(); 1075 1075 1076 1076 MythDialog *dialog = dialogWidget( 1077 1077 gContext->GetMainWindow(), "Configuration Dialog"); … … 1081 1081 int ret = dialog->exec(); 1082 1082 1083 1083 if ((QDialog::Accepted == ret) && saveOnAccept) 1084 cfgGrp->save();1084 save(); 1085 1085 1086 1086 dialog->deleteLater(); 1087 1087 dialog = NULL; -
libs/libmyth/settings.h
1119 1119 * \brief A ConfigurationDialog that uses a ConfigurationGroup 1120 1120 * all children on one page in a vertical layout. 1121 1121 */ 1122 class MPUBLIC ConfigurationDialog 1122 class MPUBLIC ConfigurationDialog : public Storage 1123 1123 { 1124 1124 public: 1125 1125 ConfigurationDialog() : dialog(NULL), cfgGrp(new ConfigurationGroup()) { } … … 1132 1132 // Show a dialogWidget, and save if accepted 1133 1133 virtual int exec(bool saveOnExec = true, bool doLoad = true); 1134 1134 1135 virtual void load(void) { cfgGrp->load(); } 1136 virtual void save(void) { cfgGrp->save(); } 1137 virtual void save(QString destination) { cfgGrp->save(destination); } 1138 1135 1139 virtual void addChild(Configurable *child); 1136 1140 1137 1141 virtual Setting *byName(const QString &settingName) … … 1149 1153 * \brief A ConfigurationDialog that uses a ConfigurationGroup 1150 1154 * with one child per page. 1151 1155 */ 1152 class MPUBLIC ConfigurationWizard : public ConfigurationDialog , public Storage1156 class MPUBLIC ConfigurationWizard : public ConfigurationDialog 1153 1157 { 1154 1158 public: 1155 1159 ConfigurationWizard() : ConfigurationDialog() {} 1156 1160 1157 1161 virtual MythDialog *dialogWidget(MythMainWindow *parent, 1158 1162 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); }1163 1163 }; 1164 1164 1165 1165 /** \class JumpConfigurationWizard
