Ticket #1945: dvbdevtree_gui_integration.patch
File dvbdevtree_gui_integration.patch, 27.9 KB (added by , 19 years ago) |
---|
-
libs/libmythtv/libmythtv.pro
408 408 409 409 # Channel stuff 410 410 HEADERS += dvbchannel.h dvbsignalmonitor.h 411 HEADERS += dvbdiseqc.h dvbcam.h 411 HEADERS += dvbdevtree.h dvbcam.h 412 HEADERS += dvbdevtree_cfg.h 412 413 SOURCES += dvbchannel.cpp dvbsignalmonitor.cpp 413 SOURCES += dvbdiseqc.cpp dvbcam.cpp 414 SOURCES += dvbdevtree.cpp dvbcam.cpp 415 SOURCES += dvbdevtree_cfg.cpp 414 416 415 417 # DVB Recorder 416 418 HEADERS += dvbrecorder.h -
libs/libmythtv/videosource.cpp
33 33 34 34 #ifdef USING_DVB 35 35 #include <linux/dvb/frontend.h> 36 #include "dvbdevtree_cfg.h" 36 37 #endif 37 38 38 39 #if defined(CONFIG_VIDEO4LINUX) … … 45 46 RecorderOptions(CaptureCard& parent); 46 47 }; 47 48 48 class DVBDiSEqCConfigurationWizard: public ConfigurationWizard49 {50 public:51 DVBDiSEqCConfigurationWizard(CaptureCard &parent);52 };53 54 49 QString VSSetting::whereClause(MSqlBindings& bindings) 55 50 { 56 51 QString sourceidTag(":WHERESOURCEID"); … … 785 780 }; 786 781 }; 787 782 788 class DVBDiSEqCType: public ComboBoxSetting, public CCSetting789 {790 public:791 DVBDiSEqCType(const CaptureCard& parent)792 : CCSetting(parent, "dvb_diseqc_type")793 {794 setLabel(QObject::tr("DiSEqC Input Type: (DVB-S)"));795 addSelection(QObject::tr("Single LNB / Input"),796 QString::number(DISEQC_SINGLE));797 addSelection(QObject::tr("Tone Switch aka Mini DiSEqC (2-Way)"),798 QString::number(DISEQC_MINI_2));799 addSelection(QObject::tr("DiSEqC v1.0 Switch (2-Way)"),800 QString::number(DISEQC_SWITCH_2_1_0));801 addSelection(QObject::tr("DiSEqC v1.1 Switch (2-Way)"),802 QString::number(DISEQC_SWITCH_2_1_1));803 addSelection(QObject::tr("DiSEqC v1.0 Switch (4-Way)"),804 QString::number(DISEQC_SWITCH_4_1_0));805 addSelection(QObject::tr("DiSEqC v1.1 Switch (4-Way)"),806 QString::number(DISEQC_SWITCH_4_1_1));807 addSelection(QObject::tr("DiSEqC v1.2 Positioner"),808 QString::number(DISEQC_POSITIONER_1_2));809 addSelection(QObject::tr("DiSEqC v1.3 Positioner (Goto X)"),810 QString::number(DISEQC_POSITIONER_X));811 addSelection(QObject::tr("DiSEqC v1.1 or 2.1 (10-way method2)"),812 QString::number(DISEQC_POSITIONER_1_2_SWITCH_2));813 addSelection(QObject::tr("SW21 Switch (2-Way)"),814 QString::number(DISEQC_SW21));815 addSelection(QObject::tr("SW64 Switch (3-Way)"),816 QString::number(DISEQC_SW64));817 setHelpText(QObject::tr("Select the input type for DVB-S cards. "818 "Leave as Single LNB/Input for DVB-C or DVB-T. "819 "The inputs are mapped from Input Connections option "820 "on the main menu"));821 };822 };823 824 783 class DVBTuningDelay: public SpinBoxSetting, public CCSetting 825 784 { 826 785 public: … … 1296 1255 } 1297 1256 } 1298 1257 1258 void CaptureCard::save() 1259 { 1260 ConfigurationWizard::save(); 1261 #ifdef USING_DVB 1262 tree.Store(getCardID()); 1263 DVBDev trees; 1264 trees.InvalidateTrees(); 1265 #endif 1266 } 1267 1299 1268 void CaptureCard::loadByID(int cardid) 1300 1269 { 1270 #ifdef USING_DVB 1271 tree.Load(cardid); 1272 #endif 1301 1273 id->setValue(cardid); 1302 1274 load(); 1303 1275 } … … 1431 1403 }; 1432 1404 }; 1433 1405 1434 class LNBLofSwitch: public LineEditSetting, public CISetting {1435 public:1436 LNBLofSwitch(const CardInput& parent):1437 CISetting(parent, "lnb_lof_switch") {1438 setLabel(QObject::tr("LNB LOF Switch"));1439 setValue("11700000");1440 setHelpText(QObject::tr("This defines at what frequency (in Hz) "1441 "the LNB will do a switch from high to low setting, "1442 "and vice versa."));1443 };1444 };1445 1446 class LNBLofHi: public LineEditSetting, public CISetting {1447 public:1448 LNBLofHi(const CardInput& parent):1449 CISetting(parent, "lnb_lof_hi") {1450 setLabel(QObject::tr("LNB LOF High"));1451 setValue("10600000");1452 setHelpText(QObject::tr("This defines the offset (in Hz) the "1453 "frequency coming from the LNB will be in high "1454 "setting."));1455 };1456 };1457 1458 class LNBLofLo: public LineEditSetting, public CISetting {1459 public:1460 LNBLofLo(const CardInput& parent):1461 CISetting(parent, "lnb_lof_lo") {1462 setLabel(QObject::tr("LNB LOF Low"));1463 setValue("9750000");1464 setHelpText(QObject::tr("This defines the offset (in Hz) the "1465 "frequency coming from the LNB will be in low "1466 "setting."));1467 };1468 };1469 1470 class DiSEqCPos: public LineEditSetting, public CISetting1471 {1472 public:1473 DiSEqCPos(const CardInput& parent)1474 : CISetting(parent, "diseqc_pos")1475 {1476 setLabel(QObject::tr("DiSEqC Satellite Location"));1477 setValue("0.0");1478 setHelpText(QObject::tr("The longitude of the satellite "1479 "you are aiming at. For western hemisphere use "1480 "a negative value. Value is in decimal."));1481 // setVisible(false);1482 };1483 // void fillSelections(const QString& pos) {1484 // setValue(pos);1485 // };1486 };1487 1488 1489 class DiSEqCPort: public LabelSetting, public CISetting1490 {1491 public:1492 DiSEqCPort(const CardInput& parent)1493 : CISetting(parent, "diseqc_port")1494 {1495 setVisible(false);1496 };1497 void fillSelections(const QString& port) {1498 setValue(port);1499 };1500 };1501 1502 1503 1406 class FreeToAir: public CheckBoxSetting, public CISetting { 1504 1407 public: 1505 1408 FreeToAir(const CardInput& parent): … … 1614 1517 }; 1615 1518 }; 1616 1519 1617 class DVBLNBChooser: public ComboBoxSetting {1618 public:1619 DVBLNBChooser()1620 {1621 setLabel("LNB Settings: (DVB-S)");1622 addSelection("Universal - 2");1623 addSelection("DBS");1624 addSelection("Universal - 1");1625 addSelection("Custom");1626 setHelpText(1627 QObject::tr("Select the LNB Settings for DVB-S cards.") + " " +1628 QObject::tr("For DVB-C and DVB-T you don't need to "1629 "set these values."));1630 };1631 void save() {};1632 void load() {};1633 1634 private:1635 };1636 1637 1520 class DishNetEIT: public CheckBoxSetting, public CISetting 1638 1521 { 1639 1522 public: … … 1650 1533 }; 1651 1534 }; 1652 1535 1653 CardInput::CardInput(bool isDVBcard )1536 CardInput::CardInput(bool isDVBcard, int _cardid) 1654 1537 { 1655 1538 addChild(id = new ID()); 1656 1539 … … 1672 1555 group->addChild(new PresetTuner(*this)); 1673 1556 } 1674 1557 1558 #ifdef USING_DVB 1559 if (isDVBcard) 1560 { 1561 ConfigurationGroup *dvbgroup = 1562 new HorizontalConfigurationGroup(); 1563 dvbgroup->setLabel(QObject::tr("DVB options")); 1564 1565 ConfigurationGroup *chgroup = 1566 new VerticalConfigurationGroup(false, false, true, true); 1567 1568 TransButtonSetting *diseqc = new TransButtonSetting(); 1569 diseqc->setLabel(tr("DVB-S")); 1570 diseqc->setHelpText(tr("Input and satellite settings.")); 1571 diseqc->setVisible(DTVDeviceNeedsConfiguration(_cardid)); 1572 dvbgroup->addChild(diseqc); 1573 connect(diseqc, SIGNAL(pressed()), SLOT(diseqcConfig())); 1574 1575 chgroup->addChild(new FreeToAir(*this)); 1576 chgroup->addChild(new RadioServices(*this)); 1577 chgroup->addChild(new DishNetEIT(*this)); 1578 dvbgroup->addChild(chgroup); 1579 group->addChild(dvbgroup); 1580 } 1581 #endif 1582 1675 1583 TransButtonSetting *scan = new TransButtonSetting(); 1676 1584 scan->setLabel(tr("Scan for channels")); 1677 1585 scan->setHelpText( … … 1696 1604 1697 1605 addChild(group); 1698 1606 1699 #ifdef USING_DVB1700 if (isDVBcard)1701 {1702 ConfigurationGroup *dvbgroup =1703 new VerticalConfigurationGroup(false, false, true, true);1704 1705 dvbgroup->addChild(diseqcpos = new DiSEqCPos(*this));1706 dvbgroup->addChild(diseqcport = new DiSEqCPort(*this));1707 dvbgroup->addChild(lnblofswitch = new LNBLofSwitch(*this));1708 dvbgroup->addChild(lnblofhi = new LNBLofHi(*this));1709 dvbgroup->addChild(lnbloflo = new LNBLofLo(*this));1710 1711 dvbgroup->addChild(new FreeToAir(*this));1712 dvbgroup->addChild(new RadioServices(*this));1713 dvbgroup->addChild(new DishNetEIT(*this));1714 addChild(dvbgroup);1715 }1716 #endif1717 1718 1607 childid = new ChildID(*this); 1719 1608 addChild(childid); 1720 1609 … … 1778 1667 } 1779 1668 } 1780 1669 1670 void CardInput::diseqcConfig(void) 1671 { 1672 #ifdef USING_DVB 1673 DTVDeviceConfigWizard wizard(settings, cardid->getValue().toUInt()); 1674 wizard.exec(); 1675 #endif // USING_DVB 1676 } 1677 1781 1678 QString CISetting::whereClause(MSqlBindings& bindings) 1782 1679 { 1783 1680 QString cardinputidTag(":WHERECARDINPUTID"); … … 1806 1703 void CardInput::loadByID(int inputid) 1807 1704 { 1808 1705 id->setValue(inputid); 1706 #ifdef USING_DVB 1707 settings.Load(inputid); 1708 #endif 1809 1709 load(); 1810 1710 } 1811 1711 … … 1828 1728 cardid->setValue(QString::number(_cardid)); 1829 1729 inputname->setValue(_inputname); 1830 1730 } 1831 1832 if (CardUtil::IsDVB(_cardid, _inputname))1833 {1834 QString subtype = CardUtil::ProbeSubTypeName(_cardid, _inputname);1835 CardUtil::CARD_TYPES dvbType = CardUtil::toCardType(subtype);1836 1837 if ("QPSK" == subtype)1838 {1839 //Check for DiSEqC type1840 diseqcpos->setVisible(true);1841 lnblofswitch->setVisible(true);1842 lnbloflo->setVisible(true);1843 lnblofhi->setVisible(true);1844 1845 DISEQC_TYPES dt = CardUtil::GetDISEqCType(_cardid);1846 bool pos = (dt == DISEQC_POSITIONER_X);1847 diseqcpos->setEnabled(pos);1848 }1849 else if (dvbType > CardUtil::ERROR_PROBE)1850 {1851 diseqcpos->setVisible(false);1852 lnblofswitch->setVisible(false);1853 lnbloflo->setVisible(false);1854 lnblofhi->setVisible(false);1855 }1856 }1857 1731 } 1858 1732 1859 1733 void CardInput::save() … … 1870 1744 else 1871 1745 { 1872 1746 ConfigurationWizard::save(); 1747 #ifdef USING_DVB 1748 settings.Store(getInputID()); 1749 #endif 1873 1750 } 1874 1751 } 1875 1752 1876 void CardInput::fillDiseqcSettingsInput(QString _pos, QString _port)1877 {1878 if (_port != "")1879 diseqcport->setValue(_port);1880 if (_pos != "")1881 diseqcpos->setValue(_pos);1882 }1883 1884 1753 int CISetting::getInputID(void) const 1885 1754 { 1886 1755 return parent.getInputID(); … … 2140 2009 2141 2010 void CardInputEditor::load() 2142 2011 { 2012 cardinputs.clear(); 2143 2013 clearSelections(); 2144 2014 2145 2015 // We do this manually because we want custom labels. If … … 2327 2197 2328 2198 last_device = device; 2329 2199 QStringList inputs = 2330 CardUtil::probeInputs(device, last_cardtype , last_diseqct);2200 CardUtil::probeInputs(device, last_cardtype); 2331 2201 2332 2202 for (QStringList::iterator i = inputs.begin(); i != inputs.end(); ++i) 2333 2203 addSelection(*i); 2334 2204 } 2335 2205 2336 void TunerCardInput::diseqcType(const QString &diseqcType)2337 {2338 bool ok;2339 int tmp = diseqcType.toInt(&ok);2340 if (ok)2341 {2342 last_diseqct = tmp;2343 fillSelections(last_device);2344 }2345 }2346 2347 2206 DVBConfigurationGroup::DVBConfigurationGroup(CaptureCard& a_parent) : 2348 2207 ConfigurationGroup(false, true, false, false), 2349 2208 VerticalConfigurationGroup(false, true, false, false), … … 2370 2229 addChild(new DVBAudioDevice(parent)); 2371 2230 addChild(new DVBVbiDevice(parent)); 2372 2231 2373 TransButtonSetting *buttonDiSEqC = new TransButtonSetting();2374 buttonDiSEqC->setLabel(tr("DiSEqC"));2375 buttonDiSEqC->setHelpText(tr("Input and satellite settings."));2376 2377 2232 buttonAnalog = new TransButtonSetting(); 2378 2233 buttonAnalog->setLabel(tr("Analog Options")); 2379 2234 buttonAnalog->setVisible(false); … … 2385 2240 "but the DVB drivers do not yet allow us to " 2386 2241 "detect this problem.")); 2387 2242 2243 TransButtonSetting *buttonDiSEqC = new TransButtonSetting(); 2244 buttonDiSEqC->setLabel(tr("DVB-S")); 2245 buttonDiSEqC->setHelpText(tr("Input and satellite settings.")); 2246 2388 2247 TransButtonSetting *buttonRecOpt = new TransButtonSetting(); 2389 2248 buttonRecOpt->setLabel(tr("Recording Options")); 2390 buttonDiSEqC->setHelpText(tr("Various additional settings."));2391 2249 2392 2250 HorizontalConfigurationGroup *advcfg = 2393 2251 new HorizontalConfigurationGroup(false, false, true, true); … … 2396 2254 advcfg->addChild(buttonRecOpt); 2397 2255 addChild(advcfg); 2398 2256 2399 DVBDiSEqCType *diseqctype = new DVBDiSEqCType(parent);2400 addChild(diseqctype);2401 diseqctype->setVisible(false);2402 2403 2257 TunerCardInput *defaultinput = new TunerCardInput(parent, "0", "DVB"); 2404 2258 addChild(defaultinput); 2405 2259 defaultinput->setVisible(false); … … 2418 2272 &parent, SLOT( analogPanel())); 2419 2273 connect(buttonRecOpt, SIGNAL(pressed()), 2420 2274 &parent, SLOT( recorderOptionsPanel())); 2421 connect(diseqctype, SIGNAL(valueChanged(const QString&)),2422 defaultinput, SLOT( diseqcType (const QString&)));2423 2275 2424 defaultinput->diseqcType(diseqctype->getValue());2425 2276 cardnum->setValue(0); 2426 2277 } 2427 2278 … … 2466 2317 2467 2318 void CaptureCard::DiSEqCPanel() 2468 2319 { 2320 #ifdef USING_DVB 2469 2321 reload(); 2470 2322 2471 D VBDiSEqCConfigurationWizard diseqcWiz(*this);2323 DTVDeviceTreeWizard diseqcWiz(tree); 2472 2324 diseqcWiz.exec(); 2473 2325 load(); 2326 #endif // USING_DVB 2474 2327 } 2475 2328 2476 2329 RecorderOptions::RecorderOptions(CaptureCard& parent) … … 2485 2338 2486 2339 addChild(rec); 2487 2340 } 2488 2489 static GlobalLineEdit *DiSEqCLatitude()2490 {2491 GlobalLineEdit *gc = new GlobalLineEdit("latitude");2492 gc->setLabel("Latitude");2493 gc->setHelpText(2494 QObject::tr("The Cartesian latitude for your location.") + " " +2495 QObject::tr("Use negative numbers for southern "2496 "and western coordinates."));2497 return gc;2498 }2499 2500 static GlobalLineEdit *DiSEqCLongitude()2501 {2502 GlobalLineEdit *gc = new GlobalLineEdit("longitude");2503 gc->setLabel("Longitude");2504 gc->setHelpText(2505 QObject::tr("The Cartesian longitude for your location.") + " " +2506 QObject::tr("Use negative numbers for southern "2507 "and western coordinates."));2508 return gc;2509 }2510 2511 DVBDiSEqCConfigurationWizard::DVBDiSEqCConfigurationWizard(CaptureCard &parent)2512 {2513 VerticalConfigurationGroup* rec = new VerticalConfigurationGroup(false);2514 rec->setLabel(QObject::tr("DiSEqC Options"));2515 rec->setUseLabel(false);2516 2517 DVBDiSEqCType *diseqctype = new DVBDiSEqCType(parent);2518 TunerCardInput *defaultinput = new TunerCardInput(parent);2519 2520 rec->addChild(diseqctype);2521 rec->addChild(defaultinput);2522 rec->addChild(DiSEqCLatitude());2523 rec->addChild(DiSEqCLongitude());2524 addChild(rec);2525 2526 connect(diseqctype, SIGNAL(valueChanged(const QString&)),2527 defaultinput, SLOT( diseqcType( const QString&)));2528 2529 defaultinput->diseqcType(diseqctype->getValue());2530 } -
libs/libmythtv/videosource.h
6 6 7 7 #include "settings.h" 8 8 #include "datadirect.h" 9 #ifdef USING_DVB 10 #include "dvbdevtree.h" 11 #include "dvbdevtree_cfg.h" 12 #endif // USING_DVB 9 13 10 14 class SignalTimeout; 11 15 class ChannelTimeout; … … 203 207 204 208 public slots: 205 209 void fillSelections(const QString &device); 206 void diseqcType(const QString &diseqcType);207 210 208 211 private: 209 212 QString last_device; … … 381 384 static void fillSelections(SelectSetting* setting); 382 385 static void fillSelections(SelectSetting* setting, bool no_children); 383 386 384 void load() { 385 ConfigurationWizard::load(); 386 }; 387 387 virtual void save(); 388 388 389 public slots: 389 390 void DiSEqCPanel(); 390 391 void analogPanel(); … … 421 422 private: 422 423 ID *id; 423 424 ParentID *parentid; 425 #ifdef USING_DVB 426 DVBDevTree tree; 427 #endif 424 428 }; 425 429 426 430 class CardInput; … … 525 529 class ChildID; 526 530 class InputName; 527 531 class SourceID; 528 class DVBLNBChooser;529 class DiSEqCPos;530 class DiSEqCPort;531 class LNBLofSwitch;532 class LNBLofLo;533 class LNBLofHi;534 532 535 533 class CardInput: public ConfigurationWizard 536 534 { 537 535 Q_OBJECT 538 536 public: 539 CardInput(bool is_dvb_card );537 CardInput(bool is_dvb_card, int cardid); 540 538 541 539 int getInputID(void) const { return id->intValue(); }; 542 540 … … 544 542 void loadByInput(int cardid, QString input); 545 543 QString getSourceName(void) const; 546 544 547 void fillDiseqcSettingsInput(QString _pos, QString _port);548 545 void SetChildCardID(uint); 549 546 550 547 virtual void save(); … … 553 550 public slots: 554 551 void channelScanner(); 555 552 void sourceFetch(); 553 void diseqcConfig(); 556 554 557 555 private: 558 556 class ID: virtual public IntegerSetting, … … 578 576 ChildID *childid; 579 577 InputName *inputname; 580 578 SourceID *sourceid; 581 DVBLNBChooser *lnbsettings;582 DiSEqCPos *diseqcpos;583 DiSEqCPort *diseqcport;584 LNBLofSwitch *lnblofswitch;585 LNBLofLo *lnbloflo;586 LNBLofHi *lnblofhi;587 579 StartingChannel *startchan; 580 #ifdef USING_DVB 581 DVBDevSettings settings; 582 #endif 588 583 }; 589 584 590 585 #endif -
libs/libmythtv/cardutil.h
15 15 class CardInput; 16 16 typedef QMap<int,QString> InputNames; 17 17 18 class DVBDiSEqCInput19 {20 public:21 DVBDiSEqCInput() { clearValues(); }22 DVBDiSEqCInput(const QString &in, const QString &prt, const QString &pos)23 : input(in), port(prt), position(pos) {}24 25 void clearValues(void) { input = port = position = ""; }26 27 QString input;28 QString port;29 QString position;30 };31 typedef QValueList<DVBDiSEqCInput> DiSEqCList;32 33 /// \brief all the different dvb DiSEqC devices34 enum DISEQC_TYPES35 {36 DISEQC_SINGLE = 0,37 DISEQC_MINI_2 = 1,38 DISEQC_SWITCH_2_1_0 = 2,39 DISEQC_SWITCH_2_1_1 = 3,40 DISEQC_SWITCH_4_1_0 = 4,41 DISEQC_SWITCH_4_1_1 = 5,42 DISEQC_POSITIONER_1_2 = 6,43 DISEQC_POSITIONER_X = 7,44 DISEQC_POSITIONER_1_2_SWITCH_2 = 8,45 DISEQC_POSITIONER_X_SWITCH_2 = 9,46 DISEQC_SW21 = 10,47 DISEQC_SW64 = 11,48 };49 50 18 QString get_on_source(const QString&, uint, uint); 51 19 QString get_on_input(const QString&, uint, const QString&); 52 20 … … 163 131 static QString ProbeSubTypeName(uint cardid, const QString &input); 164 132 165 133 static QStringList probeInputs(QString device, 166 QString cardtype = QString::null, 167 int diseqctype = -1); 134 QString cardtype = QString::null); 168 135 static void GetCardInputs(int cardid, 169 136 QString device, 170 137 QString cardtype, … … 188 155 static QString ProbeDVBType(uint device); 189 156 static bool HasDVBCRCBug(uint device); 190 157 static uint GetMinSignalMonitoringDelay(uint device); 191 static DISEQC_TYPES GetDISEqCType(uint cardid);192 158 static QString GetDeviceName(dvb_dev_type_t, uint cardnum); 159 static InputNames configuredDVBInputs(uint cardid); 193 160 194 161 // V4L info 195 162 static bool hasV4L2(int videofd); … … 198 165 199 166 private: 200 167 static QStringList probeV4LInputs(QString device); 201 static QStringList probeDVBInputs(QString device , int diseqctype = -1);168 static QStringList probeDVBInputs(QString device); 202 169 static QStringList probeChildInputs(QString device); 203 204 static QStringList fillDVBInputs(int dvb_diseqc_type);205 static DiSEqCList fillDVBInputsDiSEqC(int dvb_diseqc_type);206 170 }; 207 171 208 172 #endif //_CARDUTIL_H_ -
libs/libmythtv/cardutil.cpp
332 332 return "DVB" == GetRawCardType(cardid, inputname); 333 333 } 334 334 335 /** \fn CardUtil::GetDISEqCType(uint)336 * \brief Returns the disqec type associated with a DVB card337 * \param nCardID card id to check338 * \return the disqec type339 */340 enum DISEQC_TYPES CardUtil::GetDISEqCType(uint nCardID)341 {342 int iRet = 0;343 MSqlQuery query(MSqlQuery::InitCon());344 query.prepare("SELECT dvb_diseqc_type "345 "FROM capturecard "346 "WHERE capturecard.cardid = :CARDID");347 query.bindValue(":CARDID", nCardID);348 349 if (!query.exec() || !query.isActive())350 MythContext::DBError("CardUtil::GetDISEqCType()", query);351 else if (query.next())352 iRet = query.value(0).toInt();353 354 return (DISEQC_TYPES)iRet;355 }356 357 335 /** \fn CardUtil::GetDefaultInput(uint) 358 336 * \brief Returns the default input for the card 359 337 * \param nCardID card id to check … … 564 542 return list; 565 543 } 566 544 567 QStringList CardUtil::probeInputs(QString device, QString cardtype, 568 int diseqctype) 545 InputNames CardUtil::configuredDVBInputs(uint cardid) 569 546 { 547 InputNames list; 548 MSqlQuery query(MSqlQuery::InitCon()); 549 query.prepare("SELECT cardinputid, inputname" 550 " FROM cardinput" 551 " WHERE cardid = :CARDID"); 552 query.bindValue(":CARDID", cardid); 553 554 if (query.exec() && query.isActive() && query.size() > 0) 555 { 556 while(query.next()) 557 list[query.value(0).toUInt()] = query.value(1).toString(); 558 } 559 return list; 560 } 561 562 QStringList CardUtil::probeInputs(QString device, QString cardtype) 563 { 570 564 QStringList ret; 571 565 572 566 if (("FIREWIRE" == cardtype) || … … 577 571 ret += "MPEG2TS"; 578 572 } 579 573 else if ("DVB" == cardtype) 580 ret += probeDVBInputs(device , diseqctype);574 ret += probeDVBInputs(device); 581 575 else 582 576 ret += probeV4LInputs(device); 583 577 … … 616 610 return ret; 617 611 } 618 612 619 QStringList CardUtil::probeDVBInputs(QString device , int diseqc_type)613 QStringList CardUtil::probeDVBInputs(QString device) 620 614 { 621 615 QStringList ret; 622 616 623 617 #ifdef USING_DVB 624 if (diseqc_type < 0) 618 int cardid = CardUtil::GetCardID(device); 619 if (cardid <= 0) 620 return ret; 621 622 InputNames list = configuredDVBInputs(cardid); 623 InputNames::iterator it; 624 for (it = list.begin(); it != list.end(); ++it) 625 625 { 626 int cardid = CardUtil::GetCardID(device); 627 if (cardid <= 0) 628 return ret; 629 diseqc_type = GetDISEqCType(cardid); 626 if (it.key() >= 0) 627 ret += *it; 630 628 } 631 632 QValueList<DVBDiSEqCInput> dvbinput;633 dvbinput = fillDVBInputsDiSEqC(diseqc_type);634 635 QValueList<DVBDiSEqCInput>::iterator it;636 for (it = dvbinput.begin(); it != dvbinput.end(); ++it)637 ret += (*it).input;638 629 #else 639 630 (void) device; 640 (void) diseqc_type;641 631 ret += QObject::tr("ERROR, Compile with DVB support to query inputs"); 642 632 #endif 643 633 … … 668 658 return ret; 669 659 } 670 660 671 QValueList<DVBDiSEqCInput>672 CardUtil::fillDVBInputsDiSEqC(int dvb_diseqc_type)673 {674 QValueList<DVBDiSEqCInput> list;675 676 QString stxt = "DiSEqC Switch Input %1";677 QString mtxt = "DiSEqC v1.2 Motor Position %1";678 QString itxt = "DiSEqC v1.3 Input %1";679 QString l21txt = "SW21 Input %1";680 QString l64txt = "SW64 Input %1";681 682 switch (dvb_diseqc_type)683 {684 case DISEQC_MINI_2:685 case DISEQC_SWITCH_2_1_0:686 case DISEQC_SWITCH_2_1_1:687 for (uint i = 0; i < 2; ++i)688 list.append(DVBDiSEqCInput(689 stxt.arg(i+1), QString::number(i), ""));690 break;691 case DISEQC_SWITCH_4_1_0:692 case DISEQC_SWITCH_4_1_1:693 for (uint i = 0; i < 4; ++i)694 list.append(DVBDiSEqCInput(695 stxt.arg(i+1), QString::number(i), ""));696 break;697 case DISEQC_POSITIONER_1_2:698 for (uint i = 1; i < 50; ++i)699 list.append(DVBDiSEqCInput(700 mtxt.arg(i), "", QString::number(i)));701 break;702 case DISEQC_POSITIONER_X:703 for (uint i = 1; i < 20; ++i)704 list.append(DVBDiSEqCInput(705 itxt.arg(i), "", QString::number(i)));706 break;707 case DISEQC_POSITIONER_1_2_SWITCH_2:708 for (uint i = 0; i < 10; ++i)709 list.append(DVBDiSEqCInput(710 stxt.arg(i+1,2), QString::number(i), ""));711 break;712 case DISEQC_SW21:713 for (uint i = 0; i < 2; ++i)714 list.append(DVBDiSEqCInput(715 l21txt.arg(i+1,2), QString::number(i), ""));716 break;717 case DISEQC_SW64:718 for (uint i = 0; i < 3; ++i)719 list.append(DVBDiSEqCInput(720 l64txt.arg(i+1,2), QString::number(i), ""));721 break;722 case DISEQC_SINGLE:723 default:724 list.append(DVBDiSEqCInput(725 QString("DVBInput"), QString(""), QString("")));726 }727 728 return list;729 }730 731 661 QString CardUtil::GetDeviceLabel(uint cardid, 732 662 QString cardtype, 733 663 QString videodevice) … … 818 748 QStringList::iterator it = inputs.begin(); 819 749 for (; it != inputs.end(); ++it) 820 750 { 821 CardInput* cardinput = new CardInput(false );751 CardInput* cardinput = new CardInput(false, cardid); 822 752 cardinput->loadByInput(rcardid, (*it)); 823 753 cardinput->SetChildCardID((parentid) ? cardid : 0); 824 754 inputLabels.push_back( … … 827 757 cardInputs.push_back(cardinput); 828 758 } 829 759 760 #ifdef USING_DVB 830 761 if ("DVB" == cardtype) 831 762 { 832 QValueList<DVBDiSEqCInput> dvbinputs; 833 int diseq_type = GetDISEqCType(cardid); 834 dvbinputs = fillDVBInputsDiSEqC(diseq_type); 835 QValueList<DVBDiSEqCInput>::iterator it; 836 for (it = dvbinputs.begin(); it != dvbinputs.end(); ++it) 763 InputNames list; 764 bool needs_conf = DTVDeviceNeedsConfiguration(rcardid); 765 if(needs_conf) 766 list = configuredDVBInputs(rcardid); 767 else 768 list[0] = "DVBInput"; 769 770 InputNames::iterator it; 771 for (it = list.begin(); it != list.end(); ++it) 837 772 { 838 CardInput* cardinput = new CardInput(true); 839 cardinput->loadByInput(rcardid, (*it).input); 840 cardinput->fillDiseqcSettingsInput((*it).position,(*it).port); 841 cardinput->SetChildCardID((parentid) ? cardid : 0); 773 CardInput* cardinput = new CardInput(true, rcardid); 774 cardinput->loadByInput(rcardid, it.data()); 775 cardinput->SetChildCardID(parentid ? cardid : 0); 842 776 inputLabels.push_back( 843 777 dev_label + QString(" (%1) -> %2") 844 .arg( (*it).input).arg(cardinput->getSourceName()));778 .arg(it.data()).arg(cardinput->getSourceName())); 845 779 cardInputs.push_back(cardinput); 846 780 } 781 782 // plus add one "new" input 783 if(needs_conf) 784 { 785 CardInput* newcard = new CardInput(true, rcardid); 786 QString newname = QString("DVBInput #%1").arg(list.size()+1); 787 newcard->loadByInput(rcardid, newname); 788 newcard->SetChildCardID((parentid) ? cardid : 0); 789 inputLabels.push_back( 790 dev_label + QString(" New Input")); 791 cardInputs.push_back(newcard); 792 } 847 793 } 794 #endif // USING_DVB 848 795 849 796 if (parentid) 850 797 return; … … 872 819 if (!cardid) 873 820 return true; 874 821 822 #ifdef USING_DVB 823 // delete device tree 824 DVBDevTree tree; 825 tree.Load(cardid); 826 if(tree.Root() != NULL) 827 { 828 tree.SetRoot(NULL); 829 tree.Store(cardid); 830 } 831 #endif 832 875 833 // delete any children 876 834 MSqlQuery query(MSqlQuery::InitCon()); 877 835 query.prepare(