MythTV  0.28pre
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
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::GetScanableCardTypes(), 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::toCardType(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::FREEBOX:
174  addSelection(tr("M3U Import with MPTS"),
175  QString::number(IPTVImportMPTS), true);
176  addSelection(tr("M3U Import"),
177  QString::number(IPTVImport), true);
178  return;
179  case CardUtil::ASI:
180  addSelection(tr("ASI Scan"),
181  QString::number(CurrentTransportScan), true);
182  return;
183  case CardUtil::EXTERNAL:
184  addSelection(tr("MPTS Scan"),
185  QString::number(CurrentTransportScan), true);
186  return;
188  addSelection(tr("Failed to probe the card"),
189  QString::number(Error_Probe), true);
190  return;
191  default:
192  addSelection(tr("Failed to open the card"),
193  QString::number(Error_Open), true);
194  return;
195  }
196 
197  addSelection(tr("Scan of all existing transports"),
198  QString::number(FullTransportScan));
199  addSelection(tr("Scan of single existing transport"),
200  QString::number(TransportScan));
201 }
202 
205 
208  false, false, true, true),
209  scanType(_scan_type),
210  country(new ScanCountry()),
211  network(new ScanNetwork()),
212  paneDVBT(new PaneDVBT()), paneDVBS(new PaneDVBS()),
213  paneDVBS2(new PaneDVBS2()), paneATSC(new PaneATSC()),
214  paneDVBC(new PaneDVBC()), paneAnalog(new PaneAnalog()),
215  paneSingle(new PaneSingle()), paneAll(new PaneAll()),
216  paneDVBUtilsImport(new PaneDVBUtilsImport()),
217  paneExistingScanImport(new PaneExistingScanImport())
218 {
220 
221  // only save settings for the selected pane
222  setSaveAll(false);
223 
224  addTarget(QString::number(ScanTypeSetting::Error_Open),
225  new PaneError(tr("Failed to open the card")));
226  addTarget(QString::number(ScanTypeSetting::Error_Probe),
227  new PaneError(tr("Failed to probe the card")));
229  paneDVBC);
231  paneDVBS);
233  paneDVBS2);
235  paneDVBT);
236  addTarget(QString::number(ScanTypeSetting::FullScan_ATSC),
237  paneATSC);
238  addTarget(QString::number(ScanTypeSetting::FullScan_DVBC),
239  network);
240  addTarget(QString::number(ScanTypeSetting::FullScan_DVBT),
241  country);
243  paneAnalog);
244  addTarget(QString::number(ScanTypeSetting::TransportScan),
245  paneSingle);
247  paneAll);
249  new BlankSetting());
250  addTarget(QString::number(ScanTypeSetting::IPTVImport),
251  new BlankSetting());
252 // addTarget(QString::number(ScanTypeSetting::DVBUtilsImport),
253 // paneDVBUtilsImport);
256 }
257 
258 void ScanOptionalConfig::triggerChanged(const QString& value)
259 {
261 }
262 
263 void ScanOptionalConfig::SetSourceID(const QString &sourceid)
264 {
265  paneAnalog->SetSourceID(sourceid.toUInt());
266  paneSingle->SetSourceID(sourceid.toUInt());
267  paneExistingScanImport->SetSourceID(sourceid.toUInt());
268 }
269 
271 {
272  int st = scanType->getValue().toInt();
273 
274  switch (st)
275  {
277  return "atsc";
279  return "dvbc";
281  return "dvbt";
283  return "analog";
284  default:
285  return "unknown";
286  }
287 }
288 
290 {
291  int st = scanType->getValue().toInt();
292 
293  switch (st)
294  {
296  return paneATSC->GetModulation();
298  return "qam";
300  return "ofdm";
302  return "analog";
303  default:
304  return "unknown";
305  }
306 }
307 
309 {
310  int st = scanType->getValue().toInt();
311 
312  switch (st)
313  {
315  return paneATSC->GetFrequencyTable();
317  return network->getValue();
319  return country->getValue();
321  return paneAnalog->GetFrequencyTable();
322  default:
323  return "unknown";
324  }
325 }
326 
328  QString &start, QString &end) const
329 {
330  start = end = QString::null;
331 
332  int st = scanType->getValue().toInt();
334  return paneATSC->GetFrequencyTableRange(start, end);
335 
336  return false;
337 }
338 
340 {
341  int st = scanType->getValue().toInt();
342 
343  switch (st)
344  {
348  return paneAll->ignoreSignalTimeout();
351  default:
352  return false;
353  }
354 }
355 
357 {
358  int st = scanType->getValue().toInt();
359  switch (st)
360  {
362  return paneSingle->GetFollowNIT();
364  return paneAll->GetFollowNIT();
365  default:
366  return false;
367  }
368 }
369 
371 {
373 }
374 
376 {
377  int mplexid = paneSingle->GetMultiplex();
378  return (mplexid <= 0) ? 0 : mplexid;
379 }
380 
382 {
384 }
385 
386 QMap<QString,QString> ScanOptionalConfig::GetStartChan(void) const
387 {
388  QMap<QString,QString> startChan;
389 
390  int st = scanType->getValue().toInt();
392  {
393  const PaneDVBT *pane = paneDVBT;
394 
395  startChan["std"] = "dvb";
396  startChan["type"] = "OFDM";
397  startChan["frequency"] = pane->frequency();
398  startChan["inversion"] = pane->inversion();
399  startChan["bandwidth"] = pane->bandwidth();
400  startChan["coderate_hp"] = pane->coderate_hp();
401  startChan["coderate_lp"] = pane->coderate_lp();
402  startChan["constellation"] = pane->constellation();
403  startChan["trans_mode"] = pane->trans_mode();
404  startChan["guard_interval"] = pane->guard_interval();
405  startChan["hierarchy"] = pane->hierarchy();
406  }
407  else if (ScanTypeSetting::NITAddScan_DVBS == st)
408  {
409  const PaneDVBS *pane = paneDVBS;
410 
411  startChan["std"] = "dvb";
412  startChan["type"] = "QPSK";
413  startChan["modulation"] = "qpsk";
414  startChan["frequency"] = pane->frequency();
415  startChan["inversion"] = pane->inversion();
416  startChan["symbolrate"] = pane->symbolrate();
417  startChan["fec"] = pane->fec();
418  startChan["polarity"] = pane->polarity();
419  }
420  else if (ScanTypeSetting::NITAddScan_DVBC == st)
421  {
422  const PaneDVBC *pane = paneDVBC;
423 
424  startChan["std"] = "dvb";
425  startChan["type"] = "QAM";
426  startChan["frequency"] = pane->frequency();
427  startChan["inversion"] = pane->inversion();
428  startChan["symbolrate"] = pane->symbolrate();
429  startChan["fec"] = pane->fec();
430  startChan["modulation"] = pane->modulation();
431  }
432  else if (ScanTypeSetting::NITAddScan_DVBS2 == st)
433  {
434  const PaneDVBS2 *pane = paneDVBS2;
435 
436  startChan["std"] = "dvb";
437  startChan["type"] = "DVB_S2";
438  startChan["frequency"] = pane->frequency();
439  startChan["inversion"] = pane->inversion();
440  startChan["symbolrate"] = pane->symbolrate();
441  startChan["fec"] = pane->fec();
442  startChan["modulation"] = pane->modulation();
443  startChan["polarity"] = pane->polarity();
444  startChan["mod_sys"] = pane->mod_sys();
445  startChan["rolloff"] = pane->rolloff();
446  }
447 
448  return startChan;
449 }
QString frequency(void) const
Definition: panedvbt.h:59
Collection of helper utilities for capture card DB use.
Definition: cardutil.h:46
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
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
PaneAnalog * paneAnalog
PaneDVBUtilsImport * paneDVBUtilsImport
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:135
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
VERBOSE_PREAMBLE false
Definition: verbosedefs.h:83
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
VERBOSE_PREAMBLE Most Errors or other very important messages true
Definition: verbosedefs.h:91
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:2419
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
static QString ProbeSubTypeName(uint cardid)
Definition: cardutil.cpp:510
void addSelection(const QString &label, QString value=QString::null, bool select=false)
Definition: settings.cpp:733
PaneExistingScanImport * paneExistingScanImport
ScanOptionalConfig(ScanTypeSetting *_scan_type)
QString fec(void) const
Definition: panedvbc.h:55
static QString GetVideoDevice(uint cardid)
Definition: cardutil.h:256
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:58
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
static enum CARD_TYPES toCardType(const QString &name)
Definition: cardutil.h:73
uint GetSourceID(void) const
InputSelector * input
void SetSourceID(uint sourceid)
Definition: panesingle.h:58
void addChild(Configurable *child)
void addTarget(QString triggerValue, Configurable *target)