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  ScanWizard *_parent,
25  uint default_sourceid, uint default_cardid,
26  QString default_inputname) :
27  videoSource(new VideoSourceSelector(
28  default_sourceid, CardUtil::GetScanableInputTypes(), false)),
29  input(new InputSelector(default_cardid, default_inputname)),
30  scanType(new ScanTypeSetting()),
31  scanConfig(new ScanOptionalConfig(scanType)),
32  services(new DesiredServices()),
33  ftaOnly(new FreeToAirOnly()),
34  trustEncSI(new TrustEncSISetting())
35 {
36  setLabel(tr("Scan Configuration"));
37 
41 
43  addChild(input);
46 
47  connect(videoSource, SIGNAL(valueChanged(const QString&)),
48  scanConfig, SLOT( SetSourceID( const QString&)));
49 
50  connect(videoSource, SIGNAL(valueChanged(const QString&)),
51  input, SLOT( SetSourceID( const QString&)));
52 
53  connect(input, SIGNAL(valueChanged(const QString&)),
54  scanType, SLOT( SetInput( const QString&)));
55 
56  connect(input, SIGNAL(valueChanged(const QString&)),
57  _parent, SLOT( SetInput( const QString&)));
58 }
59 
61 {
62  return videoSource->getValue().toUInt();
63 }
64 
66 {
68 }
69 
71 {
72  return ftaOnly->getValue().toInt();
73 }
74 
76 {
77  return trustEncSI->getValue().toInt();
78 }
79 
82 
83 void ScanTypeSetting::SetInput(const QString &cardids_inputname)
84 {
85  uint cardid = 0;
86  QString inputname = QString::null;
87  if (!InputSelector::Parse(cardids_inputname, cardid, inputname))
88  return;
89 
90  // Only refresh if we really have to. If we do it too often
91  // Then we end up fighting the scan routine when we want to
92  // check the type of dvb card :/
93  if (cardid == hw_cardid)
94  return;
95 
96  hw_cardid = cardid;
97  QString subtype = CardUtil::ProbeSubTypeName(hw_cardid);
98  int nCardType = CardUtil::toInputType(subtype);
99  clearSelections();
100 
101  switch (nCardType)
102  {
103  case CardUtil::V4L:
104  case CardUtil::MPEG:
105  addSelection(tr("Full Scan"),
106  QString::number(FullScan_Analog), true);
107  addSelection(tr("Import existing scan"),
108  QString::number(ExistingScanImport));
109  return;
110  case CardUtil::DVBT:
111  addSelection(tr("Full Scan"),
112  QString::number(FullScan_DVBT), true);
113  addSelection(tr("Full Scan (Tuned)"),
114  QString::number(NITAddScan_DVBT));
115 // addSelection(tr("Import channels.conf"),
116 // QString::number(DVBUtilsImport));
117  addSelection(tr("Import existing scan"),
118  QString::number(ExistingScanImport));
119  break;
120  case CardUtil::DVBT2:
121  addSelection(tr("Full Scan"),
122  QString::number(FullScan_DVBT2), true);
123  addSelection(tr("Full Scan (Tuned)"),
124  QString::number(NITAddScan_DVBT2));
125 // addSelection(tr("Import channels.conf"),
126 // QString::number(DVBUtilsImport));
127  addSelection(tr("Import existing scan"),
128  QString::number(ExistingScanImport));
129  break;
130  case CardUtil::DVBS:
131  addSelection(tr("Full Scan (Tuned)"),
132  QString::number(NITAddScan_DVBS));
133 // addSelection(tr("Import channels.conf"),
134 // QString::number(DVBUtilsImport));
135  addSelection(tr("Import existing scan"),
136  QString::number(ExistingScanImport));
137  break;
138  case CardUtil::DVBS2:
139  addSelection(tr("Full Scan (Tuned)"),
140  QString::number(NITAddScan_DVBS2));
141 // addSelection(tr("Import channels.conf"),
142 // QString::number(DVBUtilsImport));
143  addSelection(tr("Import existing scan"),
144  QString::number(ExistingScanImport));
145  break;
146  case CardUtil::QAM:
147  addSelection(tr("Full Scan (Tuned)"),
148  QString::number(NITAddScan_DVBC));
149  addSelection(tr("Full Scan"),
150  QString::number(FullScan_DVBC));
151 // addSelection(tr("Import channels.conf"),
152 // QString::number(DVBUtilsImport));
153  addSelection(tr("Import existing scan"),
154  QString::number(ExistingScanImport));
155  break;
156  case CardUtil::ATSC:
157  addSelection(tr("Full Scan"),
158  QString::number(FullScan_ATSC), true);
159 // addSelection(tr("Import channels.conf"),
160 // QString::number(DVBUtilsImport));
161  addSelection(tr("Import existing scan"),
162  QString::number(ExistingScanImport));
163  break;
164  case CardUtil::HDHOMERUN:
166  {
167  addSelection(tr("Full Scan"),
168  QString::number(FullScan_DVBT), true);
169  addSelection(tr("Full Scan (Tuned)"),
170  QString::number(NITAddScan_DVBT));
171  }
172  else
173  addSelection(tr("Full Scan"),
174  QString::number(FullScan_ATSC), true);
175 // addSelection(tr("Import channels.conf"),
176 // QString::number(DVBUtilsImport));
177  addSelection(tr("Import existing scan"),
178  QString::number(ExistingScanImport));
179  break;
180  case CardUtil::VBOX:
181  addSelection(tr("VBox Channel Import"),
182  QString::number(VBoxImport), true);
183  return;
184  case CardUtil::FREEBOX:
185  addSelection(tr("M3U Import with MPTS"),
186  QString::number(IPTVImportMPTS), true);
187  addSelection(tr("M3U Import"),
188  QString::number(IPTVImport), true);
189  return;
190  case CardUtil::ASI:
191  addSelection(tr("ASI Scan"),
192  QString::number(CurrentTransportScan), true);
193  return;
194  case CardUtil::EXTERNAL:
195  addSelection(tr("MPTS Scan"),
196  QString::number(CurrentTransportScan), true);
197  return;
199  addSelection(tr("Failed to probe the card"),
200  QString::number(Error_Probe), true);
201  return;
202  default:
203  addSelection(tr("Failed to open the card"),
204  QString::number(Error_Open), true);
205  return;
206  }
207 
208  addSelection(tr("Scan of all existing transports"),
209  QString::number(FullTransportScan));
210  addSelection(tr("Scan of single existing transport"),
211  QString::number(TransportScan));
212 }
213 
216 
218  scanType(_scan_type),
219  dvbTCountry(new ScanCountry()),
220  dvbT2Country(new ScanCountry()),
221  network(new ScanNetwork()),
222  paneDVBT(new PaneDVBT(QString::number(ScanTypeSetting::NITAddScan_DVBT), scanType)),
223  paneDVBT2(new PaneDVBT2(QString::number(ScanTypeSetting::NITAddScan_DVBT2), scanType)),
224  paneDVBS(new PaneDVBS(QString::number(ScanTypeSetting::NITAddScan_DVBS), scanType)),
225  paneDVBS2(new PaneDVBS2(QString::number(ScanTypeSetting::NITAddScan_DVBS2), scanType)),
226  paneATSC(new PaneATSC(QString::number(ScanTypeSetting::FullScan_ATSC), scanType)),
227  paneDVBC(new PaneDVBC(QString::number(ScanTypeSetting::NITAddScan_DVBC), scanType)),
228  paneAnalog(new PaneAnalog(QString::number(ScanTypeSetting::FullScan_Analog), scanType)),
229  paneSingle(new PaneSingle(QString::number(ScanTypeSetting::TransportScan), scanType)),
230  paneAll(new PaneAll(QString::number(ScanTypeSetting::FullTransportScan), scanType)),
231  paneDVBUtilsImport(new PaneDVBUtilsImport()),
232  paneExistingScanImport(new PaneExistingScanImport(QString::number(ScanTypeSetting::ExistingScanImport), scanType))
233 
234 {
235  setVisible(false);
236 
238  new PaneError(tr("Failed to open the card")));
240  new PaneError(tr("Failed to probe the card")));
242  network);
244  dvbTCountry);
246  dvbT2Country);
247 // scanType->addTargetedChild(QString::number(ScanTypeSetting::DVBUtilsImport),
248 // paneDVBUtilsImport);
249 }
250 
251 void ScanOptionalConfig::SetSourceID(const QString &sourceid)
252 {
253  paneAnalog->SetSourceID(sourceid.toUInt());
254  paneSingle->SetSourceID(sourceid.toUInt());
255  paneExistingScanImport->SetSourceID(sourceid.toUInt());
256 }
257 
259 {
260  int st = scanType->getValue().toInt();
261 
262  switch (st)
263  {
265  return "atsc";
267  return "dvbc";
270  return "dvbt";
272  return "analog";
273  default:
274  return "unknown";
275  }
276 }
277 
279 {
280  int st = scanType->getValue().toInt();
281 
282  switch (st)
283  {
285  return paneATSC->GetModulation();
287  return "qam";
290  return "ofdm";
292  return "analog";
293  default:
294  return "unknown";
295  }
296 }
297 
299 {
300  int st = scanType->getValue().toInt();
301 
302  switch (st)
303  {
305  return paneATSC->GetFrequencyTable();
307  return network->getValue();
309  return dvbTCountry->getValue();
311  return dvbT2Country->getValue();
313  return paneAnalog->GetFrequencyTable();
314  default:
315  return "unknown";
316  }
317 }
318 
320  QString &start, QString &end) const
321 {
322  start = end = QString::null;
323 
324  int st = scanType->getValue().toInt();
326  return paneATSC->GetFrequencyTableRange(start, end);
327 
328  return false;
329 }
330 
332 {
333  int st = scanType->getValue().toInt();
334 
335  switch (st)
336  {
340  return paneAll->ignoreSignalTimeout();
343  default:
344  return false;
345  }
346 }
347 
349 {
350  int st = scanType->getValue().toInt();
351  switch (st)
352  {
354  return paneSingle->GetFollowNIT();
356  return paneAll->GetFollowNIT();
357  default:
358  return false;
359  }
360 }
361 
363 {
365 }
366 
368 {
369  int mplexid = paneSingle->GetMultiplex();
370  return (mplexid <= 0) ? 0 : mplexid;
371 }
372 
374 {
376 }
377 
378 QMap<QString,QString> ScanOptionalConfig::GetStartChan(void) const
379 {
380  QMap<QString,QString> startChan;
381 
382  int st = scanType->getValue().toInt();
384  {
385  const PaneDVBT *pane = paneDVBT;
386 
387  startChan["std"] = "dvb";
388  startChan["type"] = "OFDM";
389  startChan["frequency"] = pane->frequency();
390  startChan["inversion"] = pane->inversion();
391  startChan["bandwidth"] = pane->bandwidth();
392  startChan["coderate_hp"] = pane->coderate_hp();
393  startChan["coderate_lp"] = pane->coderate_lp();
394  startChan["constellation"] = pane->constellation();
395  startChan["trans_mode"] = pane->trans_mode();
396  startChan["guard_interval"] = pane->guard_interval();
397  startChan["hierarchy"] = pane->hierarchy();
398  }
399  else if (ScanTypeSetting::NITAddScan_DVBT2 == st)
400  {
401  const PaneDVBT2 *pane = paneDVBT2;
402 
403  startChan["std"] = "dvb";
404  startChan["type"] = "DVB_T2";
405  startChan["frequency"] = pane->frequency();
406  startChan["inversion"] = pane->inversion();
407  startChan["bandwidth"] = pane->bandwidth();
408  startChan["coderate_hp"] = pane->coderate_hp();
409  startChan["coderate_lp"] = pane->coderate_lp();
410  startChan["constellation"] = pane->constellation();
411  startChan["trans_mode"] = pane->trans_mode();
412  startChan["guard_interval"] = pane->guard_interval();
413  startChan["hierarchy"] = pane->hierarchy();
414  startChan["mod_sys"] = pane->mod_sys();
415  }
416  else if (ScanTypeSetting::NITAddScan_DVBS == st)
417  {
418  const PaneDVBS *pane = paneDVBS;
419 
420  startChan["std"] = "dvb";
421  startChan["type"] = "QPSK";
422  startChan["modulation"] = "qpsk";
423  startChan["frequency"] = pane->frequency();
424  startChan["inversion"] = pane->inversion();
425  startChan["symbolrate"] = pane->symbolrate();
426  startChan["fec"] = pane->fec();
427  startChan["polarity"] = pane->polarity();
428  }
429  else if (ScanTypeSetting::NITAddScan_DVBC == st)
430  {
431  const PaneDVBC *pane = paneDVBC;
432 
433  startChan["std"] = "dvb";
434  startChan["type"] = "QAM";
435  startChan["frequency"] = pane->frequency();
436  startChan["inversion"] = pane->inversion();
437  startChan["symbolrate"] = pane->symbolrate();
438  startChan["fec"] = pane->fec();
439  startChan["modulation"] = pane->modulation();
440  }
441  else if (ScanTypeSetting::NITAddScan_DVBS2 == st)
442  {
443  const PaneDVBS2 *pane = paneDVBS2;
444 
445  startChan["std"] = "dvb";
446  startChan["type"] = "DVB_S2";
447  startChan["frequency"] = pane->frequency();
448  startChan["inversion"] = pane->inversion();
449  startChan["symbolrate"] = pane->symbolrate();
450  startChan["fec"] = pane->fec();
451  startChan["modulation"] = pane->modulation();
452  startChan["polarity"] = pane->polarity();
453  startChan["mod_sys"] = pane->mod_sys();
454  startChan["rolloff"] = pane->rolloff();
455  }
456 
457  return startChan;
458 }
Collection of helper utilities for input DB use.
Definition: cardutil.h:42
QString GetFilename(void) const
QString inversion(void) const
Definition: panedvbs2.h:32
QString trans_mode(void) const
Definition: panedvbt.h:61
ServiceRequirements GetServiceRequirements(void) const
QString modulation(void) const
Definition: panedvbs2.h:35
TrustEncSISetting * trustEncSI
QString GetModulation(void) const
Definition: paneatsc.h:65
QString fec(void) const
Definition: panedvbc.h:51
VERBOSE_PREAMBLE false
Definition: verbosedefs.h:83
QString coderate_lp(void) const
Definition: panedvbt2.h:61
ScanTypeSetting * scanType
bool DoTestDecryption(void) const
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 &)
FreeToAirOnly * ftaOnly
QString modulation(void) const
Definition: panedvbc.h:52
QString inversion(void) const
Definition: panedvbc.h:50
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
bool DoFreeToAirOnly(void) const
static bool Parse(const QString &cardids_inputname, uint &cardid, QString &inputname)
ScanWizardConfig(ScanWizard *_parent, uint default_sourceid, uint default_cardid, QString default_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
ScanOptionalConfig * scanConfig
ScanTypeSetting * scanType
uint GetSourceID(void) const
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
DesiredServices * services
VideoSourceSelector * videoSource
virtual void setLabel(QString str)
QString frequency(void) const
Definition: panedvbs2.h:30
QString rolloff(void) const
Definition: panedvbs2.h:37
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
void SetInput(const QString &cardids_inputname)
QString inversion(void) const
Definition: panedvbt2.h:59
QString bandwidth(void) const
Definition: panedvbt2.h:58
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
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
QString coderate_hp(void) const
Definition: panedvbt.h:60
QString polarity(void) const
Definition: panedvbs.h:55
void SetSourceID(uint _sourceid)
QString constellation(void) const
Definition: panedvbt2.h:60
QString fec(void) const
Definition: panedvbs2.h:33
InputSelector * input
void SetSourceID(uint sourceid)
Definition: panesingle.h:60
void valueChanged(const QString &)