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  const QString& default_inputname)
26 {
28  default_sourceid, CardUtil::GetScanableInputTypes(), false);
29  m_input = new InputSelector(default_cardid, default_inputname);
33  m_ftaOnly = new FreeToAirOnly();
37  m_addFullTS = new AddFullTS();
39 
40  setLabel(tr("Channel Scan"));
41 
49 
54 
55  connect(m_videoSource, SIGNAL(valueChanged(const QString&)),
56  m_scanConfig, SLOT( SetSourceID( const QString&)));
57 
58  connect(m_videoSource, SIGNAL(valueChanged(const QString&)),
59  m_input, SLOT( SetSourceID( const QString&)));
60 
61  connect(m_input, SIGNAL(valueChanged(const QString&)),
62  m_scanType, SLOT( SetInput( const QString&)));
63 
64  connect(m_input, SIGNAL(valueChanged(const QString&)),
65  this, SLOT( SetInput( const QString&)));
66 }
67 
69 {
70  return m_videoSource->getValue().toUInt();
71 }
72 
74 {
76 }
77 
79 {
80  return m_ftaOnly->boolValue();
81 }
82 
84 {
85  return m_lcnOnly->boolValue();
86 }
87 
89 {
90  return m_completeOnly->boolValue();
91 }
92 
94 {
95  return m_fullSearch->boolValue();
96 }
97 
98 bool ScanWizard::DoAddFullTS(void) const
99 {
100  return m_addFullTS->boolValue();
101 }
102 
104 {
105  return m_trustEncSI->boolValue();
106 }
107 
110 
111 void ScanTypeSetting::SetInput(const QString &cardids_inputname)
112 {
113  uint cardid = 0;
114  QString inputname;
115  if (!InputSelector::Parse(cardids_inputname, cardid, inputname))
116  return;
117 
118  // Only refresh if we really have to. If we do it too often
119  // Then we end up fighting the scan routine when we want to
120  // check the type of dvb card :/
121  if (cardid == m_hw_cardid)
122  return;
123 
124  m_hw_cardid = cardid;
125  QString subtype = CardUtil::ProbeSubTypeName(m_hw_cardid);
126  int nCardType = CardUtil::toInputType(subtype);
127  clearSelections();
128 
129  switch (nCardType)
130  {
131  case CardUtil::V4L:
132  case CardUtil::MPEG:
133  addSelection(tr("Full Scan"),
134  QString::number(FullScan_Analog), true);
135  addSelection(tr("Import existing scan"),
136  QString::number(ExistingScanImport));
137  return;
138  case CardUtil::DVBT:
139  addSelection(tr("Full Scan"),
140  QString::number(FullScan_DVBT), true);
141  addSelection(tr("Full Scan (Tuned)"),
142  QString::number(NITAddScan_DVBT));
143 // addSelection(tr("Import channels.conf"),
144 // QString::number(DVBUtilsImport));
145  addSelection(tr("Import existing scan"),
146  QString::number(ExistingScanImport));
147  break;
148  case CardUtil::DVBT2:
149  addSelection(tr("Full Scan"),
150  QString::number(FullScan_DVBT2), true);
151  addSelection(tr("Full Scan (Tuned)"),
152  QString::number(NITAddScan_DVBT2));
153 // addSelection(tr("Import channels.conf"),
154 // QString::number(DVBUtilsImport));
155  addSelection(tr("Import existing scan"),
156  QString::number(ExistingScanImport));
157  break;
158  case CardUtil::DVBS:
159  addSelection(tr("Full Scan (Tuned)"),
160  QString::number(NITAddScan_DVBS));
161 // addSelection(tr("Import channels.conf"),
162 // QString::number(DVBUtilsImport));
163  addSelection(tr("Import existing scan"),
164  QString::number(ExistingScanImport));
165  break;
166  case CardUtil::DVBS2:
167  addSelection(tr("Full Scan (Tuned)"),
168  QString::number(NITAddScan_DVBS2));
169 // addSelection(tr("Import channels.conf"),
170 // QString::number(DVBUtilsImport));
171  addSelection(tr("Import existing scan"),
172  QString::number(ExistingScanImport));
173  break;
174  case CardUtil::QAM:
175  addSelection(tr("Full Scan (Tuned)"),
176  QString::number(NITAddScan_DVBC));
177  addSelection(tr("Full Scan"),
178  QString::number(FullScan_DVBC));
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::ATSC:
185  addSelection(tr("Full Scan"),
186  QString::number(FullScan_ATSC), true);
187 // addSelection(tr("Import channels.conf"),
188 // QString::number(DVBUtilsImport));
189  addSelection(tr("Import existing scan"),
190  QString::number(ExistingScanImport));
191  break;
192  case CardUtil::HDHOMERUN:
194  {
195  addSelection(tr("Full Scan"),
196  QString::number(FullScan_DVBT), true);
197  addSelection(tr("Full Scan (Tuned)"),
198  QString::number(NITAddScan_DVBT));
199  }
200  else
201  addSelection(tr("Full Scan"),
202  QString::number(FullScan_ATSC), true);
203 // addSelection(tr("Import channels.conf"),
204 // QString::number(DVBUtilsImport));
205  addSelection(tr("Import existing scan"),
206  QString::number(ExistingScanImport));
207  break;
208  case CardUtil::VBOX:
209  addSelection(tr("VBox Channel Import"),
210  QString::number(VBoxImport), true);
211  return;
212  case CardUtil::FREEBOX:
213  addSelection(tr("M3U Import with MPTS"),
214  QString::number(IPTVImportMPTS), true);
215  addSelection(tr("M3U Import"),
216  QString::number(IPTVImport), true);
217  return;
218  case CardUtil::ASI:
219  addSelection(tr("ASI Scan"),
220  QString::number(CurrentTransportScan), true);
221  return;
222  case CardUtil::EXTERNAL:
223  addSelection(tr("MPTS Scan"),
224  QString::number(CurrentTransportScan), true);
225  addSelection(tr("Import from ExternalRecorder"),
226  QString::number(ExternRecImport), true);
227  return;
229  addSelection(tr("Failed to probe the card"),
230  QString::number(Error_Probe), true);
231  return;
232  default:
233  addSelection(tr("Failed to open the card"),
234  QString::number(Error_Open), true);
235  return;
236  }
237 
238  addSelection(tr("Scan of all existing transports"),
239  QString::number(FullTransportScan));
240  addSelection(tr("Scan of single existing transport"),
241  QString::number(TransportScan));
242 }
243 
246 
248  m_scanType(_scan_type),
249  m_dvbTCountry(new ScanCountry()),
250  m_dvbT2Country(new ScanCountry()),
251  m_network(new ScanNetwork()),
252  m_paneDVBT(new PaneDVBT(QString::number(ScanTypeSetting::NITAddScan_DVBT), m_scanType)),
253  m_paneDVBT2(new PaneDVBT2(QString::number(ScanTypeSetting::NITAddScan_DVBT2), m_scanType)),
254  m_paneDVBS(new PaneDVBS(QString::number(ScanTypeSetting::NITAddScan_DVBS), m_scanType)),
255  m_paneDVBS2(new PaneDVBS2(QString::number(ScanTypeSetting::NITAddScan_DVBS2), m_scanType)),
256  m_paneATSC(new PaneATSC(QString::number(ScanTypeSetting::FullScan_ATSC), m_scanType)),
257  m_paneDVBC(new PaneDVBC(QString::number(ScanTypeSetting::NITAddScan_DVBC), m_scanType)),
258  m_paneAnalog(new PaneAnalog(QString::number(ScanTypeSetting::FullScan_Analog), m_scanType)),
259  m_paneSingle(new PaneSingle(QString::number(ScanTypeSetting::TransportScan), m_scanType)),
260  m_paneAll(new PaneAll(QString::number(ScanTypeSetting::FullTransportScan), m_scanType)),
261  m_paneDVBUtilsImport(new PaneDVBUtilsImport()),
262  m_paneExistingScanImport(new PaneExistingScanImport(QString::number(ScanTypeSetting::ExistingScanImport), m_scanType))
263 {
264  setVisible(false);
265 
267  new PaneError(tr("Failed to open the card")));
269  new PaneError(tr("Failed to probe the card")));
271  m_network);
273  m_dvbTCountry);
276 // m_scanType->addTargetedChild(QString::number(ScanTypeSetting::DVBUtilsImport),
277 // paneDVBUtilsImport);
278 }
279 
280 void ScanOptionalConfig::SetSourceID(const QString &sourceid)
281 {
282  m_paneAnalog->SetSourceID(sourceid.toUInt());
283  m_paneSingle->SetSourceID(sourceid.toUInt());
284  m_paneExistingScanImport->SetSourceID(sourceid.toUInt());
285 }
286 
288 {
289  int st = m_scanType->getValue().toInt();
290 
291  switch (st)
292  {
294  return "atsc";
296  return "dvbc";
299  return "dvbt";
301  return "analog";
302  default:
303  return "unknown";
304  }
305 }
306 
308 {
309  int st = m_scanType->getValue().toInt();
310 
311  switch (st)
312  {
314  return m_paneATSC->GetModulation();
316  return "qam";
319  return "ofdm";
321  return "analog";
322  default:
323  return "unknown";
324  }
325 }
326 
328 {
329  int st = m_scanType->getValue().toInt();
330 
331  switch (st)
332  {
334  return m_paneATSC->GetFrequencyTable();
336  return m_network->getValue();
338  return m_dvbTCountry->getValue();
340  return m_dvbT2Country->getValue();
343  default:
344  return "unknown";
345  }
346 }
347 
349  QString &start, QString &end) const
350 {
351  start.clear();
352  end.clear();
353 
354  int st = m_scanType->getValue().toInt();
356  return m_paneATSC->GetFrequencyTableRange(start, end);
357 
358  return false;
359 }
360 
362 {
363  int st = m_scanType->getValue().toInt();
364 
365  switch (st)
366  {
370  return m_paneAll->ignoreSignalTimeout();
373  default:
374  return false;
375  }
376 }
377 
379 {
380  int st = m_scanType->getValue().toInt();
381  switch (st)
382  {
384  return m_paneSingle->GetFollowNIT();
386  return m_paneAll->GetFollowNIT();
387  default:
388  return false;
389  }
390 }
391 
393 {
395 }
396 
398 {
399  int mplexid = m_paneSingle->GetMultiplex();
400  return (mplexid <= 0) ? 0 : mplexid;
401 }
402 
404 {
406 }
407 
408 QMap<QString,QString> ScanOptionalConfig::GetStartChan(void) const
409 {
410  QMap<QString,QString> startChan;
411 
412  int st = m_scanType->getValue().toInt();
414  {
415  const PaneDVBT *pane = m_paneDVBT;
416 
417  startChan["std"] = "dvb";
418  startChan["type"] = "OFDM";
419  startChan["frequency"] = pane->frequency();
420  startChan["inversion"] = pane->inversion();
421  startChan["bandwidth"] = pane->bandwidth();
422  startChan["coderate_hp"] = pane->coderate_hp();
423  startChan["coderate_lp"] = pane->coderate_lp();
424  startChan["constellation"] = pane->constellation();
425  startChan["trans_mode"] = pane->trans_mode();
426  startChan["guard_interval"] = pane->guard_interval();
427  startChan["hierarchy"] = pane->hierarchy();
428  }
429  else if (ScanTypeSetting::NITAddScan_DVBT2 == st)
430  {
431  const PaneDVBT2 *pane = m_paneDVBT2;
432 
433  startChan["std"] = "dvb";
434  startChan["type"] = "DVB_T2";
435  startChan["frequency"] = pane->frequency();
436  startChan["inversion"] = pane->inversion();
437  startChan["bandwidth"] = pane->bandwidth();
438  startChan["coderate_hp"] = pane->coderate_hp();
439  startChan["coderate_lp"] = pane->coderate_lp();
440  startChan["constellation"] = pane->constellation();
441  startChan["trans_mode"] = pane->trans_mode();
442  startChan["guard_interval"] = pane->guard_interval();
443  startChan["hierarchy"] = pane->hierarchy();
444  startChan["mod_sys"] = pane->mod_sys();
445  }
446  else if (ScanTypeSetting::NITAddScan_DVBS == st)
447  {
448  const PaneDVBS *pane = m_paneDVBS;
449 
450  startChan["std"] = "dvb";
451  startChan["type"] = "QPSK";
452  startChan["modulation"] = "qpsk";
453  startChan["frequency"] = pane->frequency();
454  startChan["inversion"] = pane->inversion();
455  startChan["symbolrate"] = pane->symbolrate();
456  startChan["fec"] = pane->fec();
457  startChan["polarity"] = pane->polarity();
458  }
459  else if (ScanTypeSetting::NITAddScan_DVBC == st)
460  {
461  const PaneDVBC *pane = m_paneDVBC;
462 
463  startChan["std"] = "dvb";
464  startChan["type"] = "QAM";
465  startChan["frequency"] = pane->frequency();
466  startChan["inversion"] = pane->inversion();
467  startChan["symbolrate"] = pane->symbolrate();
468  startChan["fec"] = pane->fec();
469  startChan["modulation"] = pane->modulation();
470  }
471  else if (ScanTypeSetting::NITAddScan_DVBS2 == st)
472  {
473  const PaneDVBS2 *pane = m_paneDVBS2;
474 
475  startChan["std"] = "dvb";
476  startChan["type"] = "DVB_S2";
477  startChan["frequency"] = pane->frequency();
478  startChan["inversion"] = pane->inversion();
479  startChan["symbolrate"] = pane->symbolrate();
480  startChan["fec"] = pane->fec();
481  startChan["modulation"] = pane->modulation();
482  startChan["polarity"] = pane->polarity();
483  startChan["mod_sys"] = pane->mod_sys();
484  startChan["rolloff"] = pane->rolloff();
485  }
486 
487  return startChan;
488 }
AddFullTS * m_addFullTS
Definition: scanwizard.h:107
QString GetFilename(void) const
PaneSingle * m_paneSingle
QString inversion(void) const
Definition: panedvbs2.h:32
QString trans_mode(void) const
Definition: panedvbt.h:61
bool DoFullChannelSearch(void) const
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
void SetupConfig(uint default_sourceid, uint default_cardid, const QString &default_inputname)
bool DoFreeToAirOnly(void) const
int GetMultiplex(void) const
Definition: panesingle.h:53
static QString ProbeSubTypeName(uint inputid)
Definition: cardutil.cpp:901
static enum INPUT_TYPES toInputType(const QString &name)
Definition: cardutil.h:72
void SetSourceID(const QString &)
PaneDVBUtilsImport * m_paneDVBUtilsImport
void addSelection(const QString &label, QString value=QString(), bool select=false)
QString modulation(void) const
Definition: panedvbc.h:52
QString inversion(void) const
Definition: panedvbc.h:50
bool DoCompleteChannelsOnly(void) const
uint GetSourceID(void) const
QString frequency(void) const
Definition: panedvbc.h:48
CompleteChannelsOnly * m_completeOnly
Definition: scanwizard.h:105
QString GetFrequencyTable(void) const
Definition: paneanalog.cpp:21
unsigned int uint
Definition: compat.h:140
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
VideoSourceSelector * m_videoSource
Definition: scanwizard.h:98
DesiredServices * m_services
Definition: scanwizard.h:102
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
ScanTypeSetting * m_scanType
Definition: scanwizard.h:100
static bool Parse(const QString &cardid_inputname, uint &cardid, QString &inputname)
static bool HDHRdoesDVB(const QString &device)
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
TrustEncSISetting * m_trustEncSI
Definition: scanwizard.h:108
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
bool DoTestDecryption(void) const
bool DoIgnoreSignalTimeout(void) const
ChannelNumbersOnly * m_lcnOnly
Definition: scanwizard.h:104
ScanOptionalConfig(ScanTypeSetting *_scan_type)
virtual void addChild(StandardSetting *child)
QMap< QString, QString > GetStartChan(void) const
static QString GetVideoDevice(uint inputid)
Definition: cardutil.h:273
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)
bool DoChannelNumbersOnly(void) const
QString fec(void) const
Definition: panedvbs.h:54
ScanCountry * m_dvbT2Country
QString guard_interval(void) const
Definition: panedvbt2.h:64
ScanCountry * m_dvbTCountry
bool GetFrequencyTableRange(QString &, QString &) const
QString frequency(void) const
Definition: panedvbs.h:51
ScanTypeSetting * m_scanType
bool ignoreSignalTimeout(void) const
Definition: panesingle.h:55
FreeToAirOnly * m_ftaOnly
Definition: scanwizard.h:103
QString frequency(void) const
Definition: panedvbt2.h:57
PaneExistingScanImport * m_paneExistingScanImport
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
FullChannelSearch * m_fullSearch
Definition: scanwizard.h:106
QString mod_sys(void) const
Definition: panedvbs2.h:36
bool DoAddFullTS(void) const
ServiceRequirements GetServiceRequirements(void) const
Scans the transport when there is no tuner (for ASI)
void SetInput(const QString &cardid_inputname)
Definition: scanwizard.cpp:196
QString symbolrate(void) const
Definition: panedvbs.h:52
QString mod_sys(void) const
Definition: panedvbt2.h:66
ScanOptionalConfig * m_scanConfig
Definition: scanwizard.h:101
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
QString symbolrate(void) const
Definition: panedvbs2.h:31
ServiceRequirements GetServiceRequirements(void) const
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
InputSelector * m_input
Definition: scanwizard.h:99
PaneAnalog * m_paneAnalog
ScanNetwork * m_network
QString fec(void) const
Definition: panedvbs2.h:33
static QString GetScanableInputTypes(void)
Definition: cardutil.cpp:58
void SetSourceID(uint sourceid)
Definition: panesingle.h:60
void valueChanged(const QString &)