MythTV  master
scanwizardconfig.cpp
Go to the documentation of this file.
1 #include "scanwizardconfig.h"
2 
3 #include "videosource.h"
4 #include "cardutil.h"
6 
8 #include "inputselectorsetting.h"
9 #include "scanwizard.h"
10 
11 #include "panedvbs.h"
12 #include "panedvbs2.h"
13 #include "panedvbc.h"
14 #include "panedvbt.h"
15 #include "panedvbt2.h"
16 #include "paneatsc.h"
17 #include "paneanalog.h"
18 #include "panesingle.h"
19 #include "paneall.h"
20 #include "panedvbutilsimport.h"
21 #include "paneexistingscanimport.h"
22 
24  uint default_sourceid, uint default_cardid,
25  QString default_inputname)
26 {
28  default_sourceid, CardUtil::GetScanableInputTypes(), false);
29  input = new InputSelector(default_cardid, default_inputname);
30  scanType = new ScanTypeSetting(),
32  services = new DesiredServices();
33  ftaOnly = new FreeToAirOnly();
35 
39 
41  addChild(input);
44 
45  connect(videoSource, SIGNAL(valueChanged(const QString&)),
46  scanConfig, SLOT( SetSourceID( const QString&)));
47 
48  connect(videoSource, SIGNAL(valueChanged(const QString&)),
49  input, SLOT( SetSourceID( const QString&)));
50 
51  connect(input, SIGNAL(valueChanged(const QString&)),
52  scanType, SLOT( SetInput( const QString&)));
53 
54  connect(input, SIGNAL(valueChanged(const QString&)),
55  this, SLOT( SetInput( const QString&)));
56 }
57 
59 {
60  return videoSource->getValue().toUInt();
61 }
62 
64 {
66 }
67 
69 {
70  return ftaOnly->getValue().toInt();
71 }
72 
74 {
75  return trustEncSI->getValue().toInt();
76 }
77 
80 
81 void ScanTypeSetting::SetInput(const QString &cardids_inputname)
82 {
83  uint cardid = 0;
84  QString inputname = QString::null;
85  if (!InputSelector::Parse(cardids_inputname, cardid, inputname))
86  return;
87 
88  // Only refresh if we really have to. If we do it too often
89  // Then we end up fighting the scan routine when we want to
90  // check the type of dvb card :/
91  if (cardid == hw_cardid)
92  return;
93 
94  hw_cardid = cardid;
95  QString subtype = CardUtil::ProbeSubTypeName(hw_cardid);
96  int nCardType = CardUtil::toInputType(subtype);
97  clearSelections();
98 
99  switch (nCardType)
100  {
101  case CardUtil::V4L:
102  case CardUtil::MPEG:
103  addSelection(tr("Full Scan"),
104  QString::number(FullScan_Analog), true);
105  addSelection(tr("Import existing scan"),
106  QString::number(ExistingScanImport));
107  return;
108  case CardUtil::DVBT:
109  addSelection(tr("Full Scan"),
110  QString::number(FullScan_DVBT), true);
111  addSelection(tr("Full Scan (Tuned)"),
112  QString::number(NITAddScan_DVBT));
113 // addSelection(tr("Import channels.conf"),
114 // QString::number(DVBUtilsImport));
115  addSelection(tr("Import existing scan"),
116  QString::number(ExistingScanImport));
117  break;
118  case CardUtil::DVBT2:
119  addSelection(tr("Full Scan"),
120  QString::number(FullScan_DVBT2), true);
121  addSelection(tr("Full Scan (Tuned)"),
122  QString::number(NITAddScan_DVBT2));
123 // addSelection(tr("Import channels.conf"),
124 // QString::number(DVBUtilsImport));
125  addSelection(tr("Import existing scan"),
126  QString::number(ExistingScanImport));
127  break;
128  case CardUtil::DVBS:
129  addSelection(tr("Full Scan (Tuned)"),
130  QString::number(NITAddScan_DVBS));
131 // addSelection(tr("Import channels.conf"),
132 // QString::number(DVBUtilsImport));
133  addSelection(tr("Import existing scan"),
134  QString::number(ExistingScanImport));
135  break;
136  case CardUtil::DVBS2:
137  addSelection(tr("Full Scan (Tuned)"),
138  QString::number(NITAddScan_DVBS2));
139 // addSelection(tr("Import channels.conf"),
140 // QString::number(DVBUtilsImport));
141  addSelection(tr("Import existing scan"),
142  QString::number(ExistingScanImport));
143  break;
144  case CardUtil::QAM:
145  addSelection(tr("Full Scan (Tuned)"),
146  QString::number(NITAddScan_DVBC));
147  addSelection(tr("Full Scan"),
148  QString::number(FullScan_DVBC));
149 // addSelection(tr("Import channels.conf"),
150 // QString::number(DVBUtilsImport));
151  addSelection(tr("Import existing scan"),
152  QString::number(ExistingScanImport));
153  break;
154  case CardUtil::ATSC:
155  addSelection(tr("Full Scan"),
156  QString::number(FullScan_ATSC), true);
157 // addSelection(tr("Import channels.conf"),
158 // QString::number(DVBUtilsImport));
159  addSelection(tr("Import existing scan"),
160  QString::number(ExistingScanImport));
161  break;
162  case CardUtil::HDHOMERUN:
164  {
165  addSelection(tr("Full Scan"),
166  QString::number(FullScan_DVBT), true);
167  addSelection(tr("Full Scan (Tuned)"),
168  QString::number(NITAddScan_DVBT));
169  }
170  else
171  addSelection(tr("Full Scan"),
172  QString::number(FullScan_ATSC), true);
173 // addSelection(tr("Import channels.conf"),
174 // QString::number(DVBUtilsImport));
175  addSelection(tr("Import existing scan"),
176  QString::number(ExistingScanImport));
177  break;
178  case CardUtil::VBOX:
179  addSelection(tr("VBox Channel Import"),
180  QString::number(VBoxImport), true);
181  return;
182  case CardUtil::FREEBOX:
183  addSelection(tr("M3U Import with MPTS"),
184  QString::number(IPTVImportMPTS), true);
185  addSelection(tr("M3U Import"),
186  QString::number(IPTVImport), true);
187  return;
188  case CardUtil::ASI:
189  addSelection(tr("ASI Scan"),
190  QString::number(CurrentTransportScan), true);
191  return;
192  case CardUtil::EXTERNAL:
193  addSelection(tr("MPTS Scan"),
194  QString::number(CurrentTransportScan), true);
195  return;
197  addSelection(tr("Failed to probe the card"),
198  QString::number(Error_Probe), true);
199  return;
200  default:
201  addSelection(tr("Failed to open the card"),
202  QString::number(Error_Open), true);
203  return;
204  }
205 
206  addSelection(tr("Scan of all existing transports"),
207  QString::number(FullTransportScan));
208  addSelection(tr("Scan of single existing transport"),
209  QString::number(TransportScan));
210 }
211 
214 
216  scanType(_scan_type),
217  dvbTCountry(new ScanCountry()),
218  dvbT2Country(new ScanCountry()),
219  network(new ScanNetwork()),
220  paneDVBT(new PaneDVBT(QString::number(ScanTypeSetting::NITAddScan_DVBT), scanType)),
221  paneDVBT2(new PaneDVBT2(QString::number(ScanTypeSetting::NITAddScan_DVBT2), scanType)),
222  paneDVBS(new PaneDVBS(QString::number(ScanTypeSetting::NITAddScan_DVBS), scanType)),
223  paneDVBS2(new PaneDVBS2(QString::number(ScanTypeSetting::NITAddScan_DVBS2), scanType)),
224  paneATSC(new PaneATSC(QString::number(ScanTypeSetting::FullScan_ATSC), scanType)),
225  paneDVBC(new PaneDVBC(QString::number(ScanTypeSetting::NITAddScan_DVBC), scanType)),
226  paneAnalog(new PaneAnalog(QString::number(ScanTypeSetting::FullScan_Analog), scanType)),
227  paneSingle(new PaneSingle(QString::number(ScanTypeSetting::TransportScan), scanType)),
228  paneAll(new PaneAll(QString::number(ScanTypeSetting::FullTransportScan), scanType)),
229  paneDVBUtilsImport(new PaneDVBUtilsImport()),
230  paneExistingScanImport(new PaneExistingScanImport(QString::number(ScanTypeSetting::ExistingScanImport), scanType))
231 
232 {
233  setVisible(false);
234 
236  new PaneError(tr("Failed to open the card")));
238  new PaneError(tr("Failed to probe the card")));
240  network);
242  dvbTCountry);
244  dvbT2Country);
245 // scanType->addTargetedChild(QString::number(ScanTypeSetting::DVBUtilsImport),
246 // paneDVBUtilsImport);
247 }
248 
249 void ScanOptionalConfig::SetSourceID(const QString &sourceid)
250 {
251  paneAnalog->SetSourceID(sourceid.toUInt());
252  paneSingle->SetSourceID(sourceid.toUInt());
253  paneExistingScanImport->SetSourceID(sourceid.toUInt());
254 }
255 
257 {
258  int st = scanType->getValue().toInt();
259 
260  switch (st)
261  {
263  return "atsc";
265  return "dvbc";
268  return "dvbt";
270  return "analog";
271  default:
272  return "unknown";
273  }
274 }
275 
277 {
278  int st = scanType->getValue().toInt();
279 
280  switch (st)
281  {
283  return paneATSC->GetModulation();
285  return "qam";
288  return "ofdm";
290  return "analog";
291  default:
292  return "unknown";
293  }
294 }
295 
297 {
298  int st = scanType->getValue().toInt();
299 
300  switch (st)
301  {
303  return paneATSC->GetFrequencyTable();
305  return network->getValue();
307  return dvbTCountry->getValue();
309  return dvbT2Country->getValue();
311  return paneAnalog->GetFrequencyTable();
312  default:
313  return "unknown";
314  }
315 }
316 
318  QString &start, QString &end) const
319 {
320  start = end = QString::null;
321 
322  int st = scanType->getValue().toInt();
324  return paneATSC->GetFrequencyTableRange(start, end);
325 
326  return false;
327 }
328 
330 {
331  int st = scanType->getValue().toInt();
332 
333  switch (st)
334  {
338  return paneAll->ignoreSignalTimeout();
341  default:
342  return false;
343  }
344 }
345 
347 {
348  int st = scanType->getValue().toInt();
349  switch (st)
350  {
352  return paneSingle->GetFollowNIT();
354  return paneAll->GetFollowNIT();
355  default:
356  return false;
357  }
358 }
359 
361 {
363 }
364 
366 {
367  int mplexid = paneSingle->GetMultiplex();
368  return (mplexid <= 0) ? 0 : mplexid;
369 }
370 
372 {
374 }
375 
376 QMap<QString,QString> ScanOptionalConfig::GetStartChan(void) const
377 {
378  QMap<QString,QString> startChan;
379 
380  int st = scanType->getValue().toInt();
382  {
383  const PaneDVBT *pane = paneDVBT;
384 
385  startChan["std"] = "dvb";
386  startChan["type"] = "OFDM";
387  startChan["frequency"] = pane->frequency();
388  startChan["inversion"] = pane->inversion();
389  startChan["bandwidth"] = pane->bandwidth();
390  startChan["coderate_hp"] = pane->coderate_hp();
391  startChan["coderate_lp"] = pane->coderate_lp();
392  startChan["constellation"] = pane->constellation();
393  startChan["trans_mode"] = pane->trans_mode();
394  startChan["guard_interval"] = pane->guard_interval();
395  startChan["hierarchy"] = pane->hierarchy();
396  }
397  else if (ScanTypeSetting::NITAddScan_DVBT2 == st)
398  {
399  const PaneDVBT2 *pane = paneDVBT2;
400 
401  startChan["std"] = "dvb";
402  startChan["type"] = "DVB_T2";
403  startChan["frequency"] = pane->frequency();
404  startChan["inversion"] = pane->inversion();
405  startChan["bandwidth"] = pane->bandwidth();
406  startChan["coderate_hp"] = pane->coderate_hp();
407  startChan["coderate_lp"] = pane->coderate_lp();
408  startChan["constellation"] = pane->constellation();
409  startChan["trans_mode"] = pane->trans_mode();
410  startChan["guard_interval"] = pane->guard_interval();
411  startChan["hierarchy"] = pane->hierarchy();
412  startChan["mod_sys"] = pane->mod_sys();
413  }
414  else if (ScanTypeSetting::NITAddScan_DVBS == st)
415  {
416  const PaneDVBS *pane = paneDVBS;
417 
418  startChan["std"] = "dvb";
419  startChan["type"] = "QPSK";
420  startChan["modulation"] = "qpsk";
421  startChan["frequency"] = pane->frequency();
422  startChan["inversion"] = pane->inversion();
423  startChan["symbolrate"] = pane->symbolrate();
424  startChan["fec"] = pane->fec();
425  startChan["polarity"] = pane->polarity();
426  }
427  else if (ScanTypeSetting::NITAddScan_DVBC == st)
428  {
429  const PaneDVBC *pane = paneDVBC;
430 
431  startChan["std"] = "dvb";
432  startChan["type"] = "QAM";
433  startChan["frequency"] = pane->frequency();
434  startChan["inversion"] = pane->inversion();
435  startChan["symbolrate"] = pane->symbolrate();
436  startChan["fec"] = pane->fec();
437  startChan["modulation"] = pane->modulation();
438  }
439  else if (ScanTypeSetting::NITAddScan_DVBS2 == st)
440  {
441  const PaneDVBS2 *pane = paneDVBS2;
442 
443  startChan["std"] = "dvb";
444  startChan["type"] = "DVB_S2";
445  startChan["frequency"] = pane->frequency();
446  startChan["inversion"] = pane->inversion();
447  startChan["symbolrate"] = pane->symbolrate();
448  startChan["fec"] = pane->fec();
449  startChan["modulation"] = pane->modulation();
450  startChan["polarity"] = pane->polarity();
451  startChan["mod_sys"] = pane->mod_sys();
452  startChan["rolloff"] = pane->rolloff();
453  }
454 
455  return startChan;
456 }
QString GetFilename(void) const
QString inversion(void) const
Definition: panedvbs2.h:32
QString trans_mode(void) const
Definition: panedvbt.h:61
FreeToAirOnly * ftaOnly
Definition: scanwizard.h:100
QString modulation(void) const
Definition: panedvbs2.h:35
QString GetModulation(void) const
Definition: paneatsc.h:65
QString fec(void) const
Definition: panedvbc.h:51
QString coderate_lp(void) const
Definition: panedvbt2.h:61
bool DoFreeToAirOnly(void) const
DesiredServices * services
Definition: scanwizard.h:99
int GetMultiplex(void) const
Definition: panesingle.h:53
static QString ProbeSubTypeName(uint inputid)
Definition: cardutil.cpp:602
PaneAnalog * paneAnalog
PaneDVBUtilsImport * paneDVBUtilsImport
static enum INPUT_TYPES toInputType(const QString &name)
Definition: cardutil.h:74
void SetSourceID(const QString &)
QString modulation(void) const
Definition: panedvbc.h:52
QString inversion(void) const
Definition: panedvbc.h:50
uint GetSourceID(void) const
QString frequency(void) const
Definition: panedvbc.h:48
QString GetFrequencyTable(void) const
Definition: paneanalog.cpp:21
unsigned int uint
Definition: compat.h:136
ScanNetwork * network
static bool Parse(const QString &cardids_inputname, uint &cardid, QString &inputname)
ScanCountry * dvbT2Country
uint GetScanID(void) const
virtual QString getValue(void) const
QString hierarchy(void) const
Definition: panedvbt.h:63
QString inversion(void) const
Definition: panedvbt.h:57
ScanTypeSetting * scanType
QString constellation(void) const
Definition: panedvbt.h:58
QString GetFilename(void) const
bool DoIgnoreSignalTimeout(void) const
QString frequency(void) const
Definition: panedvbt.h:55
QString polarity(void) const
Definition: panedvbs2.h:34
uint GetMultiplex(void) const
QString GetFrequencyStandard(void) const
VideoSourceSelector * videoSource
Definition: scanwizard.h:95
QString frequency(void) const
Definition: panedvbs2.h:30
QString rolloff(void) const
Definition: panedvbs2.h:37
TrustEncSISetting * trustEncSI
Definition: scanwizard.h:101
bool GetFrequencyTableRange(QString &start, QString &end) const
Definition: paneatsc.h:67
bool GetFollowNIT(void) const
Definition: paneall.h:52
QString trans_mode(void) const
Definition: panedvbt2.h:63
InputSelector * input
Definition: scanwizard.h:96
void SetInput(const QString &cardids_inputname)
QString inversion(void) const
Definition: panedvbt2.h:59
QString bandwidth(void) const
Definition: panedvbt2.h:58
bool DoTestDecryption(void) const
static bool HDHRdoesDVB(const QString &device)
If the device is valid, check if the model does DVB.
Definition: cardutil.cpp:2139
bool DoIgnoreSignalTimeout(void) const
PaneExistingScanImport * paneExistingScanImport
ScanOptionalConfig(ScanTypeSetting *_scan_type)
virtual void addChild(StandardSetting *child)
QMap< QString, QString > GetStartChan(void) const
static QString GetVideoDevice(uint inputid)
Definition: cardutil.h:274
QString bandwidth(void) const
Definition: panedvbt.h:56
QString hierarchy(void) const
Definition: panedvbt2.h:65
QString GetFrequencyTable(void) const
Definition: paneatsc.h:63
QString coderate_hp(void) const
Definition: panedvbt2.h:62
void setVisible(bool visible)
QString fec(void) const
Definition: panedvbs.h:54
QString guard_interval(void) const
Definition: panedvbt2.h:64
bool GetFrequencyTableRange(QString &, QString &) const
QString frequency(void) const
Definition: panedvbs.h:51
bool ignoreSignalTimeout(void) const
Definition: panesingle.h:55
QString frequency(void) const
Definition: panedvbt2.h:57
bool ignoreSignalTimeout(void) const
Definition: paneall.h:50
QString symbolrate(void) const
Definition: panedvbc.h:49
ServiceRequirements
QString GetModulation(void) const
bool DoFollowNIT(void) const
void SetSourceID(uint sourceid)
Definition: paneanalog.cpp:16
QString GetFrequencyTable(void) const
QString mod_sys(void) const
Definition: panedvbs2.h:36
ServiceRequirements GetServiceRequirements(void) const
void SetInput(const QString &cardid_inputname)
Definition: scanwizard.cpp:187
QString symbolrate(void) const
Definition: panedvbs.h:52
QString mod_sys(void) const
Definition: panedvbt2.h:66
PaneSingle * paneSingle
QString inversion(void) const
Definition: panedvbs.h:53
QString guard_interval(void) const
Definition: panedvbt.h:62
void addTargetedChild(const QString &value, StandardSetting *setting)
bool GetFollowNIT(void) const
Definition: panesingle.h:57
QString coderate_lp(void) const
Definition: panedvbt.h:59
ScanCountry * dvbTCountry
QString symbolrate(void) const
Definition: panedvbs2.h:31
ServiceRequirements GetServiceRequirements(void) const
QString coderate_hp(void) const
Definition: panedvbt.h:60
ScanOptionalConfig * scanConfig
Definition: scanwizard.h:98
QString polarity(void) const
Definition: panedvbs.h:55
void SetupConfig(uint default_sourceid, uint default_cardid, QString default_inputname)
void SetSourceID(uint _sourceid)
QString constellation(void) const
Definition: panedvbt2.h:60
ScanTypeSetting * scanType
Definition: scanwizard.h:97
QString fec(void) const
Definition: panedvbs2.h:33
static QString GetScanableInputTypes(void)
Definition: cardutil.cpp:57
void SetSourceID(uint sourceid)
Definition: panesingle.h:60
void valueChanged(const QString &)