MythTV  0.28pre
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) :
28  videoSource(new VideoSourceSelector(
29  default_sourceid, CardUtil::GetScanableInputTypes(), false)),
30  input(new InputSelector(default_cardid, default_inputname)),
31  scanType(new ScanTypeSetting()),
32  scanConfig(new ScanOptionalConfig(scanType)),
33  services(new DesiredServices()),
34  ftaOnly(new FreeToAirOnly()),
35  trustEncSI(new TrustEncSISetting())
36 {
37  setLabel(tr("Scan Configuration"));
38 
39  ConfigurationGroup *cfg =
40  new HorizontalConfigurationGroup(false, false, true, true);
41  cfg->addChild(services);
42  cfg->addChild(ftaOnly);
43  cfg->addChild(trustEncSI);
44 
46  addChild(input);
47  addChild(cfg);
50 
51  connect(videoSource, SIGNAL(valueChanged(const QString&)),
52  scanConfig, SLOT( SetSourceID( const QString&)));
53 
54  connect(videoSource, SIGNAL(valueChanged(const QString&)),
55  input, SLOT( SetSourceID( const QString&)));
56 
57  connect(input, SIGNAL(valueChanged(const QString&)),
58  scanType, SLOT( SetInput( const QString&)));
59 
60  connect(input, SIGNAL(valueChanged(const QString&)),
61  _parent, SLOT( SetInput( const QString&)));
62 }
63 
65 {
66  return videoSource->getValue().toUInt();
67 }
68 
70 {
72 }
73 
75 {
76  return ftaOnly->getValue().toInt();
77 }
78 
80 {
81  return trustEncSI->getValue().toInt();
82 }
83 
86 
87 void ScanTypeSetting::SetInput(const QString &cardids_inputname)
88 {
89  uint cardid = 0;
90  QString inputname = QString::null;
91  if (!InputSelector::Parse(cardids_inputname, cardid, inputname))
92  return;
93 
94  // Only refresh if we really have to. If we do it too often
95  // Then we end up fighting the scan routine when we want to
96  // check the type of dvb card :/
97  if (cardid == hw_cardid)
98  return;
99 
100  hw_cardid = cardid;
101  QString subtype = CardUtil::ProbeSubTypeName(hw_cardid);
102  int nCardType = CardUtil::toInputType(subtype);
103  clearSelections();
104 
105  switch (nCardType)
106  {
107  case CardUtil::V4L:
108  case CardUtil::MPEG:
109  addSelection(tr("Full Scan"),
110  QString::number(FullScan_Analog), true);
111  addSelection(tr("Import existing scan"),
112  QString::number(ExistingScanImport));
113  return;
114  case CardUtil::DVBT:
115  addSelection(tr("Full Scan"),
116  QString::number(FullScan_DVBT), true);
117  addSelection(tr("Full Scan (Tuned)"),
118  QString::number(NITAddScan_DVBT));
119 // addSelection(tr("Import channels.conf"),
120 // QString::number(DVBUtilsImport));
121  addSelection(tr("Import existing scan"),
122  QString::number(ExistingScanImport));
123  break;
124  case CardUtil::DVBT2:
125  addSelection(tr("Full Scan"),
126  QString::number(FullScan_DVBT2), true);
127  addSelection(tr("Full Scan (Tuned)"),
128  QString::number(NITAddScan_DVBT2));
129 // addSelection(tr("Import channels.conf"),
130 // QString::number(DVBUtilsImport));
131  addSelection(tr("Import existing scan"),
132  QString::number(ExistingScanImport));
133  break;
134  case CardUtil::DVBS:
135  addSelection(tr("Full Scan (Tuned)"),
136  QString::number(NITAddScan_DVBS));
137 // addSelection(tr("Import channels.conf"),
138 // QString::number(DVBUtilsImport));
139  addSelection(tr("Import existing scan"),
140  QString::number(ExistingScanImport));
141  break;
142  case CardUtil::DVBS2:
143  addSelection(tr("Full Scan (Tuned)"),
144  QString::number(NITAddScan_DVBS2));
145 // addSelection(tr("Import channels.conf"),
146 // QString::number(DVBUtilsImport));
147  addSelection(tr("Import existing scan"),
148  QString::number(ExistingScanImport));
149  break;
150  case CardUtil::QAM:
151  addSelection(tr("Full Scan (Tuned)"),
152  QString::number(NITAddScan_DVBC));
153  addSelection(tr("Full Scan"),
154  QString::number(FullScan_DVBC));
155 // addSelection(tr("Import channels.conf"),
156 // QString::number(DVBUtilsImport));
157  addSelection(tr("Import existing scan"),
158  QString::number(ExistingScanImport));
159  break;
160  case CardUtil::ATSC:
161  addSelection(tr("Full Scan"),
162  QString::number(FullScan_ATSC), true);
163 // addSelection(tr("Import channels.conf"),
164 // QString::number(DVBUtilsImport));
165  addSelection(tr("Import existing scan"),
166  QString::number(ExistingScanImport));
167  break;
168  case CardUtil::HDHOMERUN:
170  {
171  addSelection(tr("Full Scan"),
172  QString::number(FullScan_DVBT), true);
173  addSelection(tr("Full Scan (Tuned)"),
174  QString::number(NITAddScan_DVBT));
175  }
176  else
177  addSelection(tr("Full Scan"),
178  QString::number(FullScan_ATSC), true);
179 // addSelection(tr("Import channels.conf"),
180 // QString::number(DVBUtilsImport));
181  addSelection(tr("Import existing scan"),
182  QString::number(ExistingScanImport));
183  break;
184  case CardUtil::VBOX:
185  addSelection(tr("VBox Channel Import"),
186  QString::number(VBoxImport), true);
187  return;
188  case CardUtil::FREEBOX:
189  addSelection(tr("M3U Import with MPTS"),
190  QString::number(IPTVImportMPTS), true);
191  addSelection(tr("M3U Import"),
192  QString::number(IPTVImport), true);
193  return;
194  case CardUtil::ASI:
195  addSelection(tr("ASI Scan"),
196  QString::number(CurrentTransportScan), true);
197  return;
198  case CardUtil::EXTERNAL:
199  addSelection(tr("MPTS Scan"),
200  QString::number(CurrentTransportScan), true);
201  return;
203  addSelection(tr("Failed to probe the card"),
204  QString::number(Error_Probe), true);
205  return;
206  default:
207  addSelection(tr("Failed to open the card"),
208  QString::number(Error_Open), true);
209  return;
210  }
211 
212  addSelection(tr("Scan of all existing transports"),
213  QString::number(FullTransportScan));
214  addSelection(tr("Scan of single existing transport"),
215  QString::number(TransportScan));
216 }
217 
220 
223  false, false, true, true),
224  scanType(_scan_type),
225  country(new ScanCountry()),
226  network(new ScanNetwork()),
227  paneDVBT(new PaneDVBT()), paneDVBT2(new PaneDVBT2()),
228  paneDVBS(new PaneDVBS()), paneDVBS2(new PaneDVBS2()),
229  paneATSC(new PaneATSC()),
230  paneDVBC(new PaneDVBC()), paneAnalog(new PaneAnalog()),
231  paneSingle(new PaneSingle()), paneAll(new PaneAll()),
232  paneDVBUtilsImport(new PaneDVBUtilsImport()),
233  paneExistingScanImport(new PaneExistingScanImport())
234 
235 {
237 
238  // only save settings for the selected pane
239  setSaveAll(false);
240 
241  addTarget(QString::number(ScanTypeSetting::Error_Open),
242  new PaneError(tr("Failed to open the card")));
243  addTarget(QString::number(ScanTypeSetting::Error_Probe),
244  new PaneError(tr("Failed to probe the card")));
246  paneDVBC);
248  paneDVBS);
250  paneDVBS2);
252  paneDVBT);
254  paneDVBT2);
255  addTarget(QString::number(ScanTypeSetting::FullScan_ATSC),
256  paneATSC);
257  addTarget(QString::number(ScanTypeSetting::FullScan_DVBC),
258  network);
259  addTarget(QString::number(ScanTypeSetting::FullScan_DVBT),
260  country);
262  country);
264  paneAnalog);
265  addTarget(QString::number(ScanTypeSetting::TransportScan),
266  paneSingle);
268  paneAll);
270  new BlankSetting());
271  addTarget(QString::number(ScanTypeSetting::IPTVImport),
272  new BlankSetting());
273  addTarget(QString::number(ScanTypeSetting::VBoxImport),
274  new BlankSetting());
275 // addTarget(QString::number(ScanTypeSetting::DVBUtilsImport),
276 // paneDVBUtilsImport);
279 }
280 
282 {
284 }
285 
286 void ScanOptionalConfig::SetSourceID(const QString &sourceid)
287 {
288  paneAnalog->SetSourceID(sourceid.toUInt());
289  paneSingle->SetSourceID(sourceid.toUInt());
290  paneExistingScanImport->SetSourceID(sourceid.toUInt());
291 }
292 
294 {
295  int st = scanType->getValue().toInt();
296 
297  switch (st)
298  {
300  return "atsc";
302  return "dvbc";
305  return "dvbt";
307  return "analog";
308  default:
309  return "unknown";
310  }
311 }
312 
314 {
315  int st = scanType->getValue().toInt();
316 
317  switch (st)
318  {
320  return paneATSC->GetModulation();
322  return "qam";
325  return "ofdm";
327  return "analog";
328  default:
329  return "unknown";
330  }
331 }
332 
334 {
335  int st = scanType->getValue().toInt();
336 
337  switch (st)
338  {
340  return paneATSC->GetFrequencyTable();
342  return network->getValue();
345  return country->getValue();
347  return paneAnalog->GetFrequencyTable();
348  default:
349  return "unknown";
350  }
351 }
352 
354  QString &start, QString &end) const
355 {
356  start = end = QString::null;
357 
358  int st = scanType->getValue().toInt();
360  return paneATSC->GetFrequencyTableRange(start, end);
361 
362  return false;
363 }
364 
366 {
367  int st = scanType->getValue().toInt();
368 
369  switch (st)
370  {
374  return paneAll->ignoreSignalTimeout();
377  default:
378  return false;
379  }
380 }
381 
383 {
384  int st = scanType->getValue().toInt();
385  switch (st)
386  {
388  return paneSingle->GetFollowNIT();
390  return paneAll->GetFollowNIT();
391  default:
392  return false;
393  }
394 }
395 
397 {
399 }
400 
402 {
403  int mplexid = paneSingle->GetMultiplex();
404  return (mplexid <= 0) ? 0 : mplexid;
405 }
406 
408 {
410 }
411 
412 QMap<QString,QString> ScanOptionalConfig::GetStartChan(void) const
413 {
414  QMap<QString,QString> startChan;
415 
416  int st = scanType->getValue().toInt();
418  {
419  const PaneDVBT *pane = paneDVBT;
420 
421  startChan["std"] = "dvb";
422  startChan["type"] = "OFDM";
423  startChan["frequency"] = pane->frequency();
424  startChan["inversion"] = pane->inversion();
425  startChan["bandwidth"] = pane->bandwidth();
426  startChan["coderate_hp"] = pane->coderate_hp();
427  startChan["coderate_lp"] = pane->coderate_lp();
428  startChan["constellation"] = pane->constellation();
429  startChan["trans_mode"] = pane->trans_mode();
430  startChan["guard_interval"] = pane->guard_interval();
431  startChan["hierarchy"] = pane->hierarchy();
432  }
433  else if (ScanTypeSetting::NITAddScan_DVBT2 == st)
434  {
435  const PaneDVBT2 *pane = paneDVBT2;
436 
437  startChan["std"] = "dvb";
438  startChan["type"] = "DVB_T2";
439  startChan["frequency"] = pane->frequency();
440  startChan["inversion"] = pane->inversion();
441  startChan["bandwidth"] = pane->bandwidth();
442  startChan["coderate_hp"] = pane->coderate_hp();
443  startChan["coderate_lp"] = pane->coderate_lp();
444  startChan["constellation"] = pane->constellation();
445  startChan["trans_mode"] = pane->trans_mode();
446  startChan["guard_interval"] = pane->guard_interval();
447  startChan["hierarchy"] = pane->hierarchy();
448  startChan["mod_sys"] = pane->mod_sys();
449  }
450  else if (ScanTypeSetting::NITAddScan_DVBS == st)
451  {
452  const PaneDVBS *pane = paneDVBS;
453 
454  startChan["std"] = "dvb";
455  startChan["type"] = "QPSK";
456  startChan["modulation"] = "qpsk";
457  startChan["frequency"] = pane->frequency();
458  startChan["inversion"] = pane->inversion();
459  startChan["symbolrate"] = pane->symbolrate();
460  startChan["fec"] = pane->fec();
461  startChan["polarity"] = pane->polarity();
462  }
463  else if (ScanTypeSetting::NITAddScan_DVBC == st)
464  {
465  const PaneDVBC *pane = paneDVBC;
466 
467  startChan["std"] = "dvb";
468  startChan["type"] = "QAM";
469  startChan["frequency"] = pane->frequency();
470  startChan["inversion"] = pane->inversion();
471  startChan["symbolrate"] = pane->symbolrate();
472  startChan["fec"] = pane->fec();
473  startChan["modulation"] = pane->modulation();
474  }
475  else if (ScanTypeSetting::NITAddScan_DVBS2 == st)
476  {
477  const PaneDVBS2 *pane = paneDVBS2;
478 
479  startChan["std"] = "dvb";
480  startChan["type"] = "DVB_S2";
481  startChan["frequency"] = pane->frequency();
482  startChan["inversion"] = pane->inversion();
483  startChan["symbolrate"] = pane->symbolrate();
484  startChan["fec"] = pane->fec();
485  startChan["modulation"] = pane->modulation();
486  startChan["polarity"] = pane->polarity();
487  startChan["mod_sys"] = pane->mod_sys();
488  startChan["rolloff"] = pane->rolloff();
489  }
490 
491  return startChan;
492 }
QString frequency(void) const
Definition: panedvbt.h:59
Collection of helper utilities for input DB use.
Definition: cardutil.h:42
bool GetFollowNIT(void) const
Definition: paneall.h:50
QString GetFrequencyTable(void) const
Definition: paneanalog.cpp:21
QString fec(void) const
Definition: panedvbs.h:58
QString constellation(void) const
Definition: panedvbt.h:62
QString coderate_lp(void) const
Definition: panedvbt.h:63
TrustEncSISetting * trustEncSI
QString inversion(void) const
Definition: panedvbt2.h:63
uint GetMultiplex(void) const
void valueChanged(const QString &)
QString guard_interval(void) const
Definition: panedvbt2.h:68
QString bandwidth(void) const
Definition: panedvbt2.h:62
bool DoIgnoreSignalTimeout(void) const
VERBOSE_PREAMBLE false
Definition: verbosedefs.h:83
bool GetFollowNIT(void) const
Definition: panesingle.h:55
ScanTypeSetting * scanType
QString fec(void) const
Definition: panedvbs2.h:37
QString GetFrequencyStandard(void) const
QString polarity(void) const
Definition: panedvbs.h:59
QString GetModulation(void) const
Definition: paneatsc.h:68
QMap< QString, QString > GetStartChan(void) const
static QString ProbeSubTypeName(uint inputid)
Definition: cardutil.cpp:570
QString hierarchy(void) const
Definition: panedvbt2.h:69
PaneAnalog * paneAnalog
PaneDVBUtilsImport * paneDVBUtilsImport
static enum INPUT_TYPES toInputType(const QString &name)
Definition: cardutil.h:74
QString bandwidth(void) const
Definition: panedvbt.h:60
void SetSourceID(const QString &)
QString frequency(void) const
Definition: panedvbs2.h:34
FreeToAirOnly * ftaOnly
QString inversion(void) const
Definition: panedvbt.h:61
bool DoFollowNIT(void) const
int GetMultiplex(void) const
Definition: panesingle.h:51
ScanCountry * country
unsigned int uint
Definition: compat.h:136
QString symbolrate(void) const
Definition: panedvbs2.h:35
QString symbolrate(void) const
Definition: panedvbc.h:53
QString trans_mode(void) const
Definition: panedvbt.h:65
QString inversion(void) const
Definition: panedvbc.h:54
ScanNetwork * network
static bool Parse(const QString &cardids_inputname, uint &cardid, QString &inputname)
uint GetScanID(void) const
QString guard_interval(void) const
Definition: panedvbt.h:66
ScanWizardConfig(ScanWizard *_parent, uint default_sourceid, uint default_cardid, QString default_inputname)
ScanOptionalConfig * scanConfig
bool ignoreSignalTimeout(void) const
Definition: paneall.h:48
ScanTypeSetting * scanType
ServiceRequirements GetServiceRequirements(void) const
QString modulation(void) const
Definition: panedvbc.h:56
QString frequency(void) const
Definition: panedvbs.h:55
QString inversion(void) const
Definition: panedvbs.h:57
DesiredServices * services
VideoSourceSelector * videoSource
QString polarity(void) const
Definition: panedvbs2.h:38
QString mod_sys(void) const
Definition: panedvbs2.h:40
bool DoIgnoreSignalTimeout(void) const
bool DoFreeToAirOnly(void) const
void SetInput(const QString &cardids_inputname)
QString trans_mode(void) const
Definition: panedvbt2.h:67
bool DoTestDecryption(void) const
static bool HDHRdoesDVB(const QString &device)
If the device is valid, check if the model does DVB.
Definition: cardutil.cpp:2057
void triggerChanged(const QString &)
QString coderate_hp(void) const
Definition: panedvbt.h:64
QString GetFrequencyTable(void) const
Definition: paneatsc.h:66
QString rolloff(void) const
Definition: panedvbs2.h:41
PaneExistingScanImport * paneExistingScanImport
ScanOptionalConfig(ScanTypeSetting *_scan_type)
static QString GetVideoDevice(uint inputid)
Definition: cardutil.h:272
QString frequency(void) const
Definition: panedvbt2.h:61
VERBOSE_PREAMBLE Most Errors or other very important messages true
Definition: verbosedefs.h:91
QString fec(void) const
Definition: panedvbc.h:55
bool GetFrequencyTableRange(QString &start, QString &end) const
Definition: paneatsc.h:70
QString coderate_lp(void) const
Definition: panedvbt2.h:65
virtual void triggerChanged(const QString &value)
QString coderate_hp(void) const
Definition: panedvbt2.h:66
QString GetFrequencyTable(void) const
ServiceRequirements GetServiceRequirements(void) const
QString frequency(void) const
Definition: panedvbc.h:52
virtual void setLabel(QString str)
Definition: settings.h:57
QString GetModulation(void) const
ServiceRequirements
QString GetFilename(void) const
virtual QString getValue(void) const
Definition: settings.cpp:91
bool ignoreSignalTimeout(void) const
Definition: panesingle.h:53
bool GetFrequencyTableRange(QString &, QString &) const
void setTrigger(Configurable *_trigger)
void SetSourceID(uint sourceid)
Definition: paneanalog.cpp:16
virtual void setSaveAll(bool b)
QString modulation(void) const
Definition: panedvbs2.h:39
QString GetFilename(void) const
Scans the transport when there is no tuner (for ASI)
QString mod_sys(void) const
Definition: panedvbt2.h:70
QString symbolrate(void) const
Definition: panedvbs.h:56
PaneSingle * paneSingle
__s32 value
Definition: videodev2.h:1042
QString constellation(void) const
Definition: panedvbt2.h:64
QString inversion(void) const
Definition: panedvbs2.h:36
void SetSourceID(uint _sourceid)
QString hierarchy(void) const
Definition: panedvbt.h:67
uint GetSourceID(void) const
InputSelector * input
void SetSourceID(uint sourceid)
Definition: panesingle.h:58
void addChild(Configurable *child)
void addTarget(QString triggerValue, Configurable *target)