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 "paneatsc.h"
16 #include "paneanalog.h"
17 #include "panesingle.h"
18 #include "paneall.h"
19 #include "panedvbutilsimport.h"
20 #include "paneexistingscanimport.h"
21 
23  ScanWizard *_parent,
24  uint default_sourceid, uint default_cardid,
25  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 
38  ConfigurationGroup *cfg =
39  new HorizontalConfigurationGroup(false, false, true, true);
40  cfg->addChild(services);
41  cfg->addChild(ftaOnly);
42  cfg->addChild(trustEncSI);
43 
45  addChild(input);
46  addChild(cfg);
49 
50  connect(videoSource, SIGNAL(valueChanged(const QString&)),
51  scanConfig, SLOT( SetSourceID( const QString&)));
52 
53  connect(videoSource, SIGNAL(valueChanged(const QString&)),
54  input, SLOT( SetSourceID( const QString&)));
55 
56  connect(input, SIGNAL(valueChanged(const QString&)),
57  scanType, SLOT( SetInput( const QString&)));
58 
59  connect(input, SIGNAL(valueChanged(const QString&)),
60  _parent, SLOT( SetInput( const QString&)));
61 }
62 
64 {
65  return videoSource->getValue().toUInt();
66 }
67 
69 {
71 }
72 
74 {
75  return ftaOnly->getValue().toInt();
76 }
77 
79 {
80  return trustEncSI->getValue().toInt();
81 }
82 
85 
86 void ScanTypeSetting::SetInput(const QString &cardids_inputname)
87 {
88  uint cardid = 0;
89  QString inputname = QString::null;
90  if (!InputSelector::Parse(cardids_inputname, cardid, inputname))
91  return;
92 
93  // Only refresh if we really have to. If we do it too often
94  // Then we end up fighting the scan routine when we want to
95  // check the type of dvb card :/
96  if (cardid == hw_cardid)
97  return;
98 
99  hw_cardid = cardid;
100  QString subtype = CardUtil::ProbeSubTypeName(hw_cardid);
101  int nCardType = CardUtil::toInputType(subtype);
102  clearSelections();
103 
104  switch (nCardType)
105  {
106  case CardUtil::V4L:
107  case CardUtil::MPEG:
108  addSelection(tr("Full Scan"),
109  QString::number(FullScan_Analog), true);
110  addSelection(tr("Import existing scan"),
111  QString::number(ExistingScanImport));
112  return;
113  case CardUtil::DVBT:
114  addSelection(tr("Full Scan"),
115  QString::number(FullScan_DVBT), true);
116  addSelection(tr("Full Scan (Tuned)"),
117  QString::number(NITAddScan_DVBT));
118 // addSelection(tr("Import channels.conf"),
119 // QString::number(DVBUtilsImport));
120  addSelection(tr("Import existing scan"),
121  QString::number(ExistingScanImport));
122  break;
123  case CardUtil::DVBS:
124  addSelection(tr("Full Scan (Tuned)"),
125  QString::number(NITAddScan_DVBS));
126 // addSelection(tr("Import channels.conf"),
127 // QString::number(DVBUtilsImport));
128  addSelection(tr("Import existing scan"),
129  QString::number(ExistingScanImport));
130  break;
131  case CardUtil::DVBS2:
132  addSelection(tr("Full Scan (Tuned)"),
133  QString::number(NITAddScan_DVBS2));
134 // addSelection(tr("Import channels.conf"),
135 // QString::number(DVBUtilsImport));
136  addSelection(tr("Import existing scan"),
137  QString::number(ExistingScanImport));
138  break;
139  case CardUtil::QAM:
140  addSelection(tr("Full Scan (Tuned)"),
141  QString::number(NITAddScan_DVBC));
142  addSelection(tr("Full Scan"),
143  QString::number(FullScan_DVBC));
144 // addSelection(tr("Import channels.conf"),
145 // QString::number(DVBUtilsImport));
146  addSelection(tr("Import existing scan"),
147  QString::number(ExistingScanImport));
148  break;
149  case CardUtil::ATSC:
150  addSelection(tr("Full Scan"),
151  QString::number(FullScan_ATSC), true);
152 // addSelection(tr("Import channels.conf"),
153 // QString::number(DVBUtilsImport));
154  addSelection(tr("Import existing scan"),
155  QString::number(ExistingScanImport));
156  break;
157  case CardUtil::HDHOMERUN:
159  {
160  addSelection(tr("Full Scan"),
161  QString::number(FullScan_DVBT), true);
162  addSelection(tr("Full Scan (Tuned)"),
163  QString::number(NITAddScan_DVBT));
164  }
165  else
166  addSelection(tr("Full Scan"),
167  QString::number(FullScan_ATSC), true);
168 // addSelection(tr("Import channels.conf"),
169 // QString::number(DVBUtilsImport));
170  addSelection(tr("Import existing scan"),
171  QString::number(ExistingScanImport));
172  break;
173  case CardUtil::VBOX:
174  addSelection(tr("VBox Channel Import"),
175  QString::number(VBoxImport), true);
176  return;
177  case CardUtil::FREEBOX:
178  addSelection(tr("M3U Import with MPTS"),
179  QString::number(IPTVImportMPTS), true);
180  addSelection(tr("M3U Import"),
181  QString::number(IPTVImport), true);
182  return;
183  case CardUtil::ASI:
184  addSelection(tr("ASI Scan"),
185  QString::number(CurrentTransportScan), true);
186  return;
187  case CardUtil::EXTERNAL:
188  addSelection(tr("MPTS Scan"),
189  QString::number(CurrentTransportScan), true);
190  return;
192  addSelection(tr("Failed to probe the card"),
193  QString::number(Error_Probe), true);
194  return;
195  default:
196  addSelection(tr("Failed to open the card"),
197  QString::number(Error_Open), true);
198  return;
199  }
200 
201  addSelection(tr("Scan of all existing transports"),
202  QString::number(FullTransportScan));
203  addSelection(tr("Scan of single existing transport"),
204  QString::number(TransportScan));
205 }
206 
209 
212  false, false, true, true),
213  scanType(_scan_type),
214  country(new ScanCountry()),
215  network(new ScanNetwork()),
216  paneDVBT(new PaneDVBT()), paneDVBS(new PaneDVBS()),
217  paneDVBS2(new PaneDVBS2()), paneATSC(new PaneATSC()),
218  paneDVBC(new PaneDVBC()), paneAnalog(new PaneAnalog()),
219  paneSingle(new PaneSingle()), paneAll(new PaneAll()),
220  paneDVBUtilsImport(new PaneDVBUtilsImport()),
221  paneExistingScanImport(new PaneExistingScanImport())
222 {
224 
225  // only save settings for the selected pane
226  setSaveAll(false);
227 
228  addTarget(QString::number(ScanTypeSetting::Error_Open),
229  new PaneError(tr("Failed to open the card")));
230  addTarget(QString::number(ScanTypeSetting::Error_Probe),
231  new PaneError(tr("Failed to probe the card")));
233  paneDVBC);
235  paneDVBS);
237  paneDVBS2);
239  paneDVBT);
240  addTarget(QString::number(ScanTypeSetting::FullScan_ATSC),
241  paneATSC);
242  addTarget(QString::number(ScanTypeSetting::FullScan_DVBC),
243  network);
244  addTarget(QString::number(ScanTypeSetting::FullScan_DVBT),
245  country);
247  paneAnalog);
248  addTarget(QString::number(ScanTypeSetting::TransportScan),
249  paneSingle);
251  paneAll);
253  new BlankSetting());
254  addTarget(QString::number(ScanTypeSetting::IPTVImport),
255  new BlankSetting());
256  addTarget(QString::number(ScanTypeSetting::VBoxImport),
257  new BlankSetting());
258 // addTarget(QString::number(ScanTypeSetting::DVBUtilsImport),
259 // paneDVBUtilsImport);
262 }
263 
264 void ScanOptionalConfig::triggerChanged(const QString& value)
265 {
267 }
268 
269 void ScanOptionalConfig::SetSourceID(const QString &sourceid)
270 {
271  paneAnalog->SetSourceID(sourceid.toUInt());
272  paneSingle->SetSourceID(sourceid.toUInt());
273  paneExistingScanImport->SetSourceID(sourceid.toUInt());
274 }
275 
277 {
278  int st = scanType->getValue().toInt();
279 
280  switch (st)
281  {
283  return "atsc";
285  return "dvbc";
287  return "dvbt";
289  return "analog";
290  default:
291  return "unknown";
292  }
293 }
294 
296 {
297  int st = scanType->getValue().toInt();
298 
299  switch (st)
300  {
302  return paneATSC->GetModulation();
304  return "qam";
306  return "ofdm";
308  return "analog";
309  default:
310  return "unknown";
311  }
312 }
313 
315 {
316  int st = scanType->getValue().toInt();
317 
318  switch (st)
319  {
321  return paneATSC->GetFrequencyTable();
323  return network->getValue();
325  return country->getValue();
327  return paneAnalog->GetFrequencyTable();
328  default:
329  return "unknown";
330  }
331 }
332 
334  QString &start, QString &end) const
335 {
336  start = end = QString::null;
337 
338  int st = scanType->getValue().toInt();
340  return paneATSC->GetFrequencyTableRange(start, end);
341 
342  return false;
343 }
344 
346 {
347  int st = scanType->getValue().toInt();
348 
349  switch (st)
350  {
354  return paneAll->ignoreSignalTimeout();
357  default:
358  return false;
359  }
360 }
361 
363 {
364  int st = scanType->getValue().toInt();
365  switch (st)
366  {
368  return paneSingle->GetFollowNIT();
370  return paneAll->GetFollowNIT();
371  default:
372  return false;
373  }
374 }
375 
377 {
379 }
380 
382 {
383  int mplexid = paneSingle->GetMultiplex();
384  return (mplexid <= 0) ? 0 : mplexid;
385 }
386 
388 {
390 }
391 
392 QMap<QString,QString> ScanOptionalConfig::GetStartChan(void) const
393 {
394  QMap<QString,QString> startChan;
395 
396  int st = scanType->getValue().toInt();
398  {
399  const PaneDVBT *pane = paneDVBT;
400 
401  startChan["std"] = "dvb";
402  startChan["type"] = "OFDM";
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  }
413  else if (ScanTypeSetting::NITAddScan_DVBS == st)
414  {
415  const PaneDVBS *pane = paneDVBS;
416 
417  startChan["std"] = "dvb";
418  startChan["type"] = "QPSK";
419  startChan["modulation"] = "qpsk";
420  startChan["frequency"] = pane->frequency();
421  startChan["inversion"] = pane->inversion();
422  startChan["symbolrate"] = pane->symbolrate();
423  startChan["fec"] = pane->fec();
424  startChan["polarity"] = pane->polarity();
425  }
426  else if (ScanTypeSetting::NITAddScan_DVBC == st)
427  {
428  const PaneDVBC *pane = paneDVBC;
429 
430  startChan["std"] = "dvb";
431  startChan["type"] = "QAM";
432  startChan["frequency"] = pane->frequency();
433  startChan["inversion"] = pane->inversion();
434  startChan["symbolrate"] = pane->symbolrate();
435  startChan["fec"] = pane->fec();
436  startChan["modulation"] = pane->modulation();
437  }
438  else if (ScanTypeSetting::NITAddScan_DVBS2 == st)
439  {
440  const PaneDVBS2 *pane = paneDVBS2;
441 
442  startChan["std"] = "dvb";
443  startChan["type"] = "DVB_S2";
444  startChan["frequency"] = pane->frequency();
445  startChan["inversion"] = pane->inversion();
446  startChan["symbolrate"] = pane->symbolrate();
447  startChan["fec"] = pane->fec();
448  startChan["modulation"] = pane->modulation();
449  startChan["polarity"] = pane->polarity();
450  startChan["mod_sys"] = pane->mod_sys();
451  startChan["rolloff"] = pane->rolloff();
452  }
453 
454  return startChan;
455 }
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
virtual void clearSelections(void)
Definition: settings.cpp:175
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
uint GetMultiplex(void) const
void valueChanged(const QString &)
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:526
PaneAnalog * paneAnalog
PaneDVBUtilsImport * paneDVBUtilsImport
static enum INPUT_TYPES toInputType(const QString &name)
Definition: cardutil.h:70
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)
bool DoTestDecryption(void) const
static bool HDHRdoesDVB(const QString &device)
If the device is valid, check if the model does DVB.
Definition: cardutil.cpp:2013
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
void addSelection(const QString &label, QString value=QString::null, bool select=false)
Definition: settings.cpp:733
PaneExistingScanImport * paneExistingScanImport
ScanOptionalConfig(ScanTypeSetting *_scan_type)
static QString GetVideoDevice(uint inputid)
Definition: cardutil.h:261
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
virtual void triggerChanged(const QString &value)
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 symbolrate(void) const
Definition: panedvbs.h:56
PaneSingle * paneSingle
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)