MythTV  master
transporteditor.cpp
Go to the documentation of this file.
1 /*
2  * $Id$
3  * vim: set expandtab tabstop=4 shiftwidth=4:
4  *
5  * Original Project
6  * MythTV http://www.mythtv.org
7  *
8  * Author(s):
9  * John Pullan <john@pullan.org>
10  * Taylor Jacob <rtjacob@earthlink.net>
11  * Daniel Kristjansson <danielk@cuymedia.net>
12  *
13  * Description:
14  * Collection of classes to provide dvb a transport editor
15  *
16  * This program is free software; you can redistribute it and/or
17  * modify it under the terms of the GNU General Public License
18  * as published by the Free Software Foundation; either version 2
19  * of the License, or (at your option) any later version.
20  *
21  * This program is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24  * GNU General Public License for more details.
25  *
26  * You should have received a copy of the GNU General Public License
27  * along with this program; if not, write to the Free Software
28  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
29  * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
30  *
31  */
32 
33 // C++ includes
34 #include <vector>
35 
36 // MythTV includes
37 #include "transporteditor.h"
38 #include "videosource.h"
39 #include "sourceutil.h"
40 #include "mythcorecontext.h"
41 #include "mythdb.h"
42 #include "satiputils.h"
43 
45 {
46  public:
47  MultiplexID() : AutoIncrementSetting("dtv_multiplex", "mplexid")
48  {
49  setVisible(false);
50  setName("MPLEXID");
51  }
52 
53  public:
54  QString GetColumnName(void) const { return m_column; }
55 };
56 
57 static QString pp_modulation(const QString& mod)
58 {
59  if (mod.endsWith("vsb"))
60  return mod.left(mod.length() - 3) + "-VSB";
61 
62  if (mod.startsWith("qam_"))
63  return "QAM-" + mod.mid(4, mod.length());
64 
65  if (mod == "analog")
66  return QObject::tr("Analog");
67 
68  return mod.toUpper();
69 }
70 
72 {
73  std::vector<uint> cardids;
74 
75  // Work out what card we have.. (doesn't always work well)
77  query.prepare(
78  "SELECT capturecard.cardid "
79  "FROM capturecard "
80  "WHERE capturecard.sourceid = :SOURCEID AND "
81  " capturecard.parentid = 0 AND "
82  " capturecard.hostname = :HOSTNAME");
83  query.bindValue(":SOURCEID", sourceid);
84  query.bindValue(":HOSTNAME", gCoreContext->GetHostName());
85 
86  if (!query.exec() || !query.isActive())
87  {
88  MythDB::DBError("TransportWizard()", query);
89  return CardUtil::ERROR_PROBE;
90  }
91  while (query.next())
92  cardids.push_back(query.value(0).toUInt());
93 
94  if (cardids.empty())
95  {
96  ShowOkPopup(QObject::tr(
97  "Sorry, the Transport Editor can only edit transports "
98  "of a video source that is connected to a capture card."));
99 
100  return CardUtil::ERROR_PROBE;
101  }
102 
103  std::vector<CardUtil::INPUT_TYPES> cardtypes;
104 
105  for (uint cardid : cardids)
106  {
108  QString cardtype = CardUtil::GetRawInputType(cardid);
109  if (cardtype == "DVB")
110  cardtype = CardUtil::ProbeSubTypeName(cardid);
111  nType = CardUtil::toInputType(cardtype);
112 
113  if (nType == CardUtil::HDHOMERUN)
114  {
116  nType = CardUtil::DVBC;
118  nType = CardUtil::DVBT2;
119  }
120 
121  if (nType == CardUtil::SATIP)
122  {
123  QString deviceid = CardUtil::GetVideoDevice(cardid);
124  nType = SatIP::toDVBInputType(deviceid);
125  }
126 
127  if ((CardUtil::ERROR_OPEN == nType) ||
128  (CardUtil::ERROR_UNKNOWN == nType) ||
129  (CardUtil::ERROR_PROBE == nType))
130  {
131  ShowOkPopup(
132  QObject::tr(
133  "Failed to probe a capture card connected to this "
134  "transport's video source. Please make sure the "
135  "backend is not running."));
136 
137  return CardUtil::ERROR_PROBE;
138  }
139 
140  cardtypes.push_back(nType);
141  }
142 
143  // This should never happen... (unless DB has changed under us)
144  if (cardtypes.empty())
145  return CardUtil::ERROR_PROBE;
146 
147  // If there are multiple cards connected to this video source
148  // check if they are the same type or compatible.
149  for (size_t i = 1; i < cardtypes.size(); i++)
150  {
151  CardUtil::INPUT_TYPES typeA = cardtypes[i - 1];
152  CardUtil::INPUT_TYPES typeB = cardtypes[i + 0];
153 
154  // MPEG devices are seen as V4L (historical)
155  typeA = (CardUtil::MPEG == typeA) ? CardUtil::V4L : typeA;
156  typeB = (CardUtil::MPEG == typeB) ? CardUtil::V4L : typeB;
157 
158  // HDHOMERUN devices can be DVBC, DVBT/T2, ATSC or a combination of those.
159  // If there are other non-HDHR devices connected to this videosource that
160  // have an explicit type then assume that the HDHOMERUN is also of that type.
161  typeA = (CardUtil::HDHOMERUN == typeA) ? typeB : typeA;
162  typeB = (CardUtil::HDHOMERUN == typeB) ? typeA : typeB;
163 
164  if (typeA == typeB)
165  continue;
166 
167  ShowOkPopup(
168  QObject::tr(
169  "The capture cards connected to this transport's video source "
170  "are incompatible. Please create separate video sources "
171  "per capture card type."));
172 
173  return CardUtil::ERROR_PROBE;
174  }
175 
176  // Look for tuner type to decide on transport editor list format
177  CardUtil::INPUT_TYPES retval = cardtypes[0];
178  for (size_t i = 1; i < cardtypes.size(); i++)
179  {
180  if ((cardtypes[i] == CardUtil::DVBS ) ||
181  (cardtypes[i] == CardUtil::DVBC ) ||
182  (cardtypes[i] == CardUtil::DVBT ) ||
183  (cardtypes[i] == CardUtil::ATSC ) ||
184  (cardtypes[i] == CardUtil::DVBS2) ||
185  (cardtypes[i] == CardUtil::DVBT2) )
186  {
187  retval = cardtypes[i];
188  }
189  }
190 
191  return retval;
192 }
193 
195 {
196  for (auto *setting : qAsConst(m_list))
197  removeChild(setting);
198  m_list.clear();
199 
200  if (!sourceid)
201  {
202  m_sourceid = 0;
203  }
204  else
205  {
206  m_cardtype = get_cardtype(sourceid);
209  (CardUtil::ERROR_PROBE == m_cardtype)) ? 0 : sourceid;
210  }
211 }
212 
214  m_videosource(new VideoSourceShow(sourceid))
215 {
216  setLabel(tr("Transport Editor"));
217 
219 
220  auto *newTransport =
221  new ButtonStandardSetting("(" + tr("New Transport") + ")");
223 
224  addChild(newTransport);
225 
226  connect(m_videosource, qOverload<const QString&>(&StandardSetting::valueChanged),
227  this, qOverload<const QString&>(&TransportListEditor::SetSourceID));
228 
229  SetSourceID(sourceid);
230 }
231 
232 void TransportListEditor::SetSourceID(const QString& name)
233 {
234  if (m_isLoading)
235  return;
236 
237  uint sourceid = SourceUtil::GetSourceID(name);
238 
239  SetSourceID(sourceid);
240  Load();
241 }
242 
244 {
245  if (m_isLoading)
246  return;
247  m_isLoading = true;
248  if (m_sourceid)
249  {
251  query.prepare(
252  "SELECT mplexid, modulation, frequency, "
253  " symbolrate, networkid, transportid, "
254  " constellation, mod_sys "
255  "FROM dtv_multiplex, videosource "
256  "WHERE dtv_multiplex.sourceid = :SOURCEID AND "
257  " dtv_multiplex.sourceid = videosource.sourceid "
258  "ORDER by networkid, transportid, frequency, mplexid");
259  query.bindValue(":SOURCEID", m_sourceid);
260 
261  if (!query.exec() || !query.isActive())
262  {
263  MythDB::DBError("TransportList::fillSelections", query);
264  m_isLoading = false;
265  return;
266  }
267 
268  while (query.next())
269  {
270  QString rawmod = ((CardUtil::OFDM == m_cardtype) ||
272  query.value(6).toString() : query.value(1).toString();
273 
274  QString mod = pp_modulation(rawmod);
275  while (mod.length() < 7)
276  mod += " ";
277 
278  QString rate = query.value(3).toString();
279  rate = (rate == "0") ? "" : QString("rate %1").arg(rate);
280 
281  QString netid = query.value(4).toUInt() ?
282  QString("netid %1").arg(query.value(4).toUInt(), 5) : "";
283 
284  QString tid = query.value(5).toUInt() ?
285  QString("tid %1").arg(query.value(5).toUInt(), 5) : "";
286 
287  QString hz = "Hz";
288  if (CardUtil::QPSK == m_cardtype ||
290  hz = "kHz";
291 
292  QString type = "";
293  if (CardUtil::OFDM == m_cardtype)
294  type = "(DVB-T)";
296  type = QString("(%1)").arg(query.value(7).toString());
297  if (CardUtil::QPSK == m_cardtype)
298  type = "(DVB-S)";
299  if (CardUtil::QAM == m_cardtype)
300  type = "(DVB-C)";
302  type = "(DVB-S2)";
303 
304  QString txt = QString("%1 %2 %3 %4 %5 %6 %7")
305  .arg(mod).arg(query.value(2).toString())
306  .arg(hz).arg(rate).arg(netid).arg(tid).arg(type);
307 
308  auto *transport = new TransportSetting(txt, query.value(0).toUInt(),
310  connect(transport, &TransportSetting::deletePressed,
311  this, [transport, this] () { Delete(transport); });
312  connect(transport, &TransportSetting::openMenu,
313  this, [transport, this] () { Menu(transport); });
314  addChild(transport);
315  m_list.push_back(transport);
316  }
317  }
318 
320  m_isLoading = false;
321 }
322 
324 {
325  auto *transport = new TransportSetting(QString("New Transport"), 0,
327  addChild(transport);
328  m_list.push_back(transport);
329  emit settingsChanged(this);
330 }
331 
332 
334 {
335  if (m_isLoading)
336  return;
337 
338  ShowOkPopup(
339  tr("Are you sure you would like to delete this transport?"),
340  this,
341  [transport, this](bool result)
342  {
343  if (!result)
344  return;
345 
346  uint mplexid = transport->getMplexId();
347 
349  query.prepare("DELETE FROM dtv_multiplex WHERE mplexid = :MPLEXID");
350  query.bindValue(":MPLEXID", mplexid);
351 
352  if (!query.exec() || !query.isActive())
353  MythDB::DBError("TransportEditor -- delete multiplex", query);
354 
355  query.prepare("UPDATE channel SET deleted = NOW() "
356  "WHERE deleted IS NULL AND mplexid = :MPLEXID");
357  query.bindValue(":MPLEXID", mplexid);
358 
359  if (!query.exec() || !query.isActive())
360  MythDB::DBError("TransportEditor -- delete channels", query);
361 
362  removeChild(transport);
363  m_list.removeAll(transport);
364  },
365  true);
366 }
367 
369 {
370  if (m_isLoading)
371  return;
372 
373  auto *menu = new MythMenu(tr("Transport Menu"), this, "transportmenu");
374  menu->AddItem(tr("Delete..."), [transport, this] () { Delete(transport); });
375 
376  MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
377 
378  auto *menuPopup = new MythDialogBox(menu, popupStack, "menudialog");
379  menuPopup->SetReturnEvent(this, "transportmenu");
380 
381  if (menuPopup->Create())
382  popupStack->AddScreen(menuPopup);
383  else
384  delete menuPopup;
385 }
386 
388 {
389  protected:
390  MuxDBStorage(StorageUser *_setting, const MultiplexID *_id, const QString& _name) :
391  SimpleDBStorage(_setting, "dtv_multiplex", _name), m_mplexId(_id)
392  {
393  }
394 
395  QString GetSetClause(MSqlBindings &bindings) const override; // SimpleDBStorage
396  QString GetWhereClause(MSqlBindings &bindings) const override; // SimpleDBStorage
397 
399 };
400 
402 {
403  QString muxTag = ":WHERE" + m_mplexId->GetColumnName().toUpper();
404 
405  bindings.insert(muxTag, m_mplexId->getValue());
406 
407  // return query
408  return m_mplexId->GetColumnName() + " = " + muxTag;
409 }
410 
411 QString MuxDBStorage::GetSetClause(MSqlBindings &bindings) const
412 {
413  QString muxTag = ":SET" + m_mplexId->GetColumnName().toUpper();
414  QString nameTag = ":SET" + GetColumnName().toUpper();
415 
416  bindings.insert(muxTag, m_mplexId->getValue());
417  bindings.insert(nameTag, m_user->GetDBValue());
418 
419  // return query
420  return (m_mplexId->GetColumnName() + " = " + muxTag + ", " +
421  GetColumnName() + " = " + nameTag);
422 }
423 
425 {
426  public:
427  VideoSourceID(const MultiplexID *id, uint _sourceid) :
428  StandardSetting(this),
429  MuxDBStorage(this, id, "sourceid")
430  {
431  setVisible(false);
432  setValue(_sourceid);
433  }
434  void edit(MythScreenType * /*screen*/) override { } // StandardSetting
435  void resultEdit(DialogCompletionEvent * /*dce*/) override { } // StandardSetting
436 };
437 
439 {
440  public:
442  bool is_dvb_country,
443  bool is_atsc_country) :
444  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "sistandard")
445  {
446  setLabel(QObject::tr("Digital TV Standard"));
447  setHelpText(QObject::tr(
448  "Guiding standard to use for making sense of the "
449  "data streams after they have been demodulated, "
450  "error corrected and demultiplexed."));
451  if (is_dvb_country)
452  addSelection(QObject::tr("DVB"), "dvb");
453 
454  if (is_atsc_country)
455  {
456  addSelection(QObject::tr("ATSC"), "atsc");
457  addSelection(QObject::tr("OpenCable"), "opencable");
458  }
459 
460  addSelection(QObject::tr("MPEG"), "mpeg");
461  };
462 };
463 
465 {
466  public:
467  explicit Frequency(const MultiplexID *id, bool in_kHz = false) :
468  MythUITextEditSetting(this), MuxDBStorage(this, id, "frequency")
469  {
470  QString hz = (in_kHz) ? "kHz" : "Hz";
471  setLabel(QObject::tr("Frequency") + " (" + hz + ")");
472  setHelpText(QObject::tr(
473  "Frequency (Option has no default).\n"
474  "The frequency for this transport (multiplex) in") + " " + hz + ".");
475  };
476 };
477 
479 {
480  public:
481  explicit DVBSSymbolRate(const MultiplexID *id) :
482  MythUIComboBoxSetting(this, true), MuxDBStorage(this, id, "symbolrate")
483  {
484  setLabel(QObject::tr("Symbol Rate"));
485  setHelpText(
486  QObject::tr(
487  "Symbol Rate (symbols/sec).\n"
488  "Most DVB-S transponders transmit at 27.5 "
489  "million symbols per second."));
490  addSelection("3333000");
491  addSelection("22000000");
492  addSelection("22500000");
493  addSelection("23000000");
494  addSelection("27500000", "27500000", true);
495  addSelection("28000000");
496  addSelection("28500000");
497  addSelection("29500000");
498  addSelection("29700000");
499  addSelection("29900000");
500  };
501 };
502 
504 {
505  public:
506  explicit DVBCSymbolRate(const MultiplexID *id) :
507  MythUIComboBoxSetting(this, true), MuxDBStorage(this, id, "symbolrate")
508  {
509  setLabel(QObject::tr("Symbol Rate"));
510  setHelpText(
511  QObject::tr(
512  "Symbol Rate (symbols/second).\n"
513  "Most DVB-C transports transmit at 6.9 or 6.875 "
514  "million symbols per second."));
515  addSelection("3450000");
516  addSelection("5000000");
517  addSelection("5900000");
518  addSelection("6875000");
519  addSelection("6900000", "6900000", true);
520  addSelection("6950000");
521  };
522 };
523 
525 {
526  public:
527  explicit SignalPolarity(const MultiplexID *id) :
528  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "polarity")
529  {
530  setLabel(QObject::tr("Polarity"));
531  setHelpText(QObject::tr("Polarity (Option has no default)"));
532  addSelection(QObject::tr("Horizontal"), "h");
533  addSelection(QObject::tr("Vertical"), "v");
534  addSelection(QObject::tr("Right Circular"), "r");
535  addSelection(QObject::tr("Left Circular"), "l");
536  };
537 };
538 
540 {
541  public:
542  Modulation(const MultiplexID *id, uint nType);
543 };
544 
546  MythUIComboBoxSetting(this),
547  MuxDBStorage(this, id, ((CardUtil::OFDM == nType) ||
548  (CardUtil::DVBT2 == nType)) ?
549  "constellation" : "modulation")
550 {
551  setLabel(QObject::tr("Modulation"));
552  setHelpText(QObject::tr("Modulation, aka Constellation"));
553 
554  if (CardUtil::QPSK == nType)
555  {
556  // no modulation options
557  setVisible(false);
558  }
559  else if (CardUtil::DVBS2 == nType)
560  {
561  addSelection("QPSK", "qpsk");
562  addSelection("8PSK", "8psk");
563  addSelection("16APSK", "16apsk");
564  addSelection("32APSK", "32apsk");
565  }
566  else if ((CardUtil::QAM == nType) || (CardUtil::OFDM == nType) ||
567  (CardUtil::DVBT2 == nType))
568  {
569  addSelection(QObject::tr("QAM Auto"), "auto");
570  addSelection("QAM-16", "qam_16");
571  addSelection("QAM-32", "qam_32");
572  addSelection("QAM-64", "qam_64");
573  addSelection("QAM-128", "qam_128");
574  addSelection("QAM-256", "qam_256");
575 
576  if ((CardUtil::OFDM == nType) || (CardUtil::DVBT2 == nType))
577  {
578  addSelection("QPSK", "qpsk");
579  }
580  }
581  else if ((CardUtil::ATSC == nType) ||
582  (CardUtil::HDHOMERUN == nType))
583  {
584  addSelection("8-VSB", "8vsb");
585  addSelection("QAM-64", "qam_64");
586  addSelection("QAM-256", "qam_256");
587  }
588  else
589  {
590  addSelection(QObject::tr("Analog"), "analog");
591  setVisible(false);
592  }
593 };
594 
596 {
597  public:
598  explicit DVBInversion(const MultiplexID *id) :
599  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "inversion")
600  {
601  setLabel(QObject::tr("Inversion"));
602  setHelpText(QObject::tr("Inversion (Default: Auto):\n"
603  "Most cards can autodetect this now, so leave it at Auto"
604  " unless it won't work."));
605  addSelection(QObject::tr("Auto"), "a");
606  addSelection(QObject::tr("On"), "1");
607  addSelection(QObject::tr("Off"), "0");
608  };
609 };
610 
612 {
613  public:
614  explicit DVBTBandwidth(const MultiplexID *id) :
615  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "bandwidth")
616  {
617  setLabel(QObject::tr("Bandwidth"));
618  setHelpText(QObject::tr("Bandwidth (Default: Auto)"));
619  addSelection(QObject::tr("Auto"), "a");
620  addSelection(QObject::tr("6 MHz"), "6");
621  addSelection(QObject::tr("7 MHz"), "7");
622  addSelection(QObject::tr("8 MHz"), "8");
623  };
624 };
625 
627 {
628  public:
629  explicit DVBT2Bandwidth(const MultiplexID *id) :
630  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "bandwidth")
631  {
632  setLabel(QObject::tr("Bandwidth"));
633  setHelpText(QObject::tr("Bandwidth for DVB-T2 (Default: Auto)"));
634  addSelection(QObject::tr("Auto"), "a");
635  addSelection(QObject::tr("5 MHz"), "5");
636  addSelection(QObject::tr("6 MHz"), "6");
637  addSelection(QObject::tr("7 MHz"), "7");
638  addSelection(QObject::tr("8 MHz"), "8");
639  // addSelection(QObject::tr("10 MHz"), "10");
640  // addSelection(QObject::tr("1.712 MHz"), "1712");
641  };
642 };
643 
645 {
646  public:
648  MythUIComboBoxSetting(_storage)
649  {
650  addSelection(QObject::tr("Auto"), "auto");
651  addSelection(QObject::tr("None"), "none");
652  addSelection("1/2");
653  addSelection("2/3");
654  addSelection("3/4");
655  addSelection("3/5");
656  addSelection("4/5");
657  addSelection("5/6");
658  addSelection("6/7");
659  addSelection("7/8");
660  addSelection("8/9");
661  addSelection("9/10");
662  };
663 };
664 
667 {
668  public:
671  MuxDBStorage(this, id, "fec")
672  {
673  setLabel(QObject::tr("FEC"));
674  setHelpText(QObject::tr("Forward Error Correction (Default: Auto)"));
675  };
676 };
677 
680 {
681  public:
682  explicit DVBTCoderateLP(const MultiplexID *id) :
684  MuxDBStorage(this, id, "lp_code_rate")
685  {
686  setLabel(QObject::tr("LP Coderate"));
687  setHelpText(QObject::tr("Low Priority Code Rate (Default: Auto)"));
688  };
689 };
690 
693 {
694  public:
695  explicit DVBTCoderateHP(const MultiplexID *id) :
697  MuxDBStorage(this, id, "hp_code_rate")
698  {
699  setLabel(QObject::tr("HP Coderate"));
700  setHelpText(QObject::tr("High Priority Code Rate (Default: Auto)"));
701  };
702 };
703 
705 {
706  public:
707  explicit DVBTGuardInterval(const MultiplexID *id) :
708  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "guard_interval")
709  {
710  setLabel(QObject::tr("Guard Interval"));
711  setHelpText(QObject::tr("Guard Interval for DVB-T (Default: Auto)"));
712  addSelection(QObject::tr("Auto"), "auto");
713  addSelection("1/4");
714  addSelection("1/8");
715  addSelection("1/16");
716  addSelection("1/32");
717  };
718 };
719 
721 {
722  public:
723  explicit DVBT2GuardInterval(const MultiplexID *id) :
724  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "guard_interval")
725  {
726  setLabel(QObject::tr("Guard Interval"));
727  setHelpText(QObject::tr("Guard Interval for DVB-T2 (Default: Auto)"));
728  addSelection(QObject::tr("Auto"), "auto");
729  addSelection("1/4");
730  addSelection("1/8");
731  addSelection("1/16");
732  addSelection("1/32");
733  addSelection("1/128");
734  addSelection("19/128");
735  addSelection("19/256");
736  };
737 };
738 
740 {
741  public:
742  explicit DVBTTransmissionMode(const MultiplexID *id) :
743  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "transmission_mode")
744  {
745  setLabel(QObject::tr("Transmission Mode"));
746  setHelpText(QObject::tr("Transmission Mode for DVB-T (Default: Auto)"));
747  addSelection(QObject::tr("Auto"), "a");
748  addSelection("2K", "2");
749  addSelection("8K", "8");
750  };
751 };
752 
753 // The 16k and 32k modes do require a database schema update because
754 // field dtv_multiplex:transmission_mode is now only one character.
755 //
757 {
758  public:
759  explicit DVBT2TransmissionMode(const MultiplexID *id) :
760  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "transmission_mode")
761  {
762  setLabel(QObject::tr("Transmission Mode"));
763  setHelpText(QObject::tr("Transmission Mode for DVB-T2 (Default: Auto)"));
764  addSelection(QObject::tr("Auto"), "a");
765  addSelection("1K", "1");
766  addSelection("2K", "2");
767  addSelection("4K", "4");
768  addSelection("8K", "8");
769  // addSelection("16K", "16");
770  // addSelection("32K", "32");
771  };
772 };
773 
775 {
776  public:
777  explicit DVBTHierarchy(const MultiplexID *id) :
778  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "hierarchy")
779  {
780  setLabel(QObject::tr("Hierarchy"));
781  setHelpText(QObject::tr("Hierarchy (Default: Auto)"));
782  addSelection(QObject::tr("Auto"), "a");
783  addSelection(QObject::tr("None"), "n");
784  addSelection("1");
785  addSelection("2");
786  addSelection("4");
787  }
788 };
789 
791 {
792  public:
793  explicit DVBTModulationSystem(const MultiplexID *id) :
794  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "mod_sys")
795  {
796  setLabel(QObject::tr("Modulation System"));
797  setHelpText(QObject::tr("Modulation System (Default: DVB-T2)"));
798  addSelection("DVB-T", "DVB-T");
799  addSelection("DVB-T2", "DVB-T2", true);
800  };
801 };
802 
804 {
805  public:
806  explicit DVBSModulationSystem(const MultiplexID *id) :
807  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "mod_sys")
808  {
809  setLabel(QObject::tr("Modulation System"));
810  setHelpText(QObject::tr("Modulation System (Default: DVB-S2)"));
811  addSelection("DVB-S", "DVB-S");
812  addSelection("DVB-S2", "DVB-S2", true);
813  }
814 };
815 
817 {
818  public:
819  explicit DVBCModulationSystem(const MultiplexID *id) :
820  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "mod_sys")
821  {
822  setLabel(QObject::tr("Modulation System"));
823  setHelpText(QObject::tr("Modulation System (Default: DVB-C/A)"));
824  addSelection("DVB-C/A", "DVB-C/A", true);
825  addSelection("DVB-C/B", "DVB-C/B");
826  addSelection("DVB-C/C", "DVB-C/C");
827  }
828 };
829 
831 {
832  public:
833  explicit RollOff(const MultiplexID *id) :
834  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "rolloff")
835  {
836  setLabel(QObject::tr("Roll-off"));
837  setHelpText(QObject::tr("Roll-off factor (Default: 0.35)"));
838  addSelection("0.35");
839  addSelection("0.20");
840  addSelection("0.25");
841  addSelection(QObject::tr("Auto"), "auto");
842  }
843 };
844 
845 TransportSetting::TransportSetting(const QString &label, uint mplexid,
846  uint sourceid, uint cardtype)
847  : m_mplexid(new MultiplexID())
848 {
849  setLabel(label);
850 
851  // Must be first.
852  m_mplexid->setValue(mplexid);
854  addChild(new VideoSourceID(m_mplexid, sourceid));
855 
856  if (CardUtil::OFDM == cardtype)
857  {
858  addChild(new DTVStandard(m_mplexid, true, false));
862  addChild(new Modulation(m_mplexid, cardtype));
863 
869  }
870  else if (CardUtil::DVBT2 == cardtype)
871  {
872  addChild(new DTVStandard(m_mplexid, true, false));
876  addChild(new Modulation(m_mplexid, cardtype));
878 
884  }
885  else if (CardUtil::QPSK == cardtype ||
886  CardUtil::DVBS2 == cardtype)
887  {
888  addChild(new DTVStandard(m_mplexid, true, false));
889  addChild(new Frequency(m_mplexid, true));
892  addChild(new Modulation(m_mplexid, cardtype));
896 
897  if (CardUtil::DVBS2 == cardtype)
898  addChild(new RollOff(m_mplexid));
899  }
900  else if (CardUtil::QAM == cardtype)
901  {
902  addChild(new DTVStandard(m_mplexid, true, false));
905  addChild(new Modulation(m_mplexid, cardtype));
909  }
910  else if (CardUtil::ATSC == cardtype ||
911  CardUtil::HDHOMERUN == cardtype)
912  {
913  addChild(new DTVStandard(m_mplexid, false, true));
915  addChild(new Modulation(m_mplexid, cardtype));
916  }
917  else if ((CardUtil::FIREWIRE == cardtype) ||
918  (CardUtil::FREEBOX == cardtype))
919  {
920  addChild(new DTVStandard(m_mplexid, true, true));
921  }
922  else if ((CardUtil::V4L == cardtype) ||
923  (CardUtil::MPEG == cardtype))
924  {
926  addChild(new Modulation(m_mplexid, cardtype));
927  }
928 }
929 
930 bool TransportSetting::keyPressEvent(QKeyEvent *event)
931 {
932  QStringList actions;
933  bool handled =
934  GetMythMainWindow()->TranslateKeyPress("Global", event, actions);
935 
936  for (int i = 0; i < actions.size() && !handled; i++)
937  {
938  QString action = actions[i];
939 
940  if (action == "DELETE")
941  {
942  handled = true;
943  emit deletePressed();
944  }
945  else if (action == "MENU")
946  {
947  handled = true;
948  emit openMenu();
949  }
950  }
951 
952  return handled;
953 }
954 
956 {
957  return m_mplexid->getValue().toUInt();
958 }
CardUtil::HDHRdoesDVBC
static bool HDHRdoesDVBC(const QString &device)
If the device is valid, check if the model does DVB-C.
Definition: cardutil.cpp:2813
DVBInversion::DVBInversion
DVBInversion(const MultiplexID *id)
Definition: transporteditor.cpp:598
CardUtil::DVBS
@ DVBS
Definition: cardutil.h:50
CardUtil::FREEBOX
@ FREEBOX
Definition: cardutil.h:58
MSqlBindings
QMap< QString, QVariant > MSqlBindings
typedef for a map of string -> string bindings for generic queries.
Definition: mythdbcon.h:98
MSqlQuery::isActive
bool isActive(void) const
Definition: mythdbcon.h:204
TransportSetting::deletePressed
void deletePressed()
MSqlQuery::next
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
Definition: mythdbcon.cpp:783
MSqlQuery
QSqlQuery wrapper that fetches a DB connection from the connection pool.
Definition: mythdbcon.h:126
TransportSetting::m_mplexid
MultiplexID * m_mplexid
Definition: transporteditor.h:64
StandardSetting::setName
virtual void setName(const QString &name)
Definition: standardsettings.cpp:247
transporteditor.h
SignalPolarity::SignalPolarity
SignalPolarity(const MultiplexID *id)
Definition: transporteditor.cpp:527
MuxDBStorage
Definition: transporteditor.cpp:388
StandardSetting::setValue
virtual void setValue(const QString &newValue)
Definition: standardsettings.cpp:163
ShowOkPopup
MythConfirmationDialog * ShowOkPopup(const QString &message, QObject *parent, const char *slot, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
Definition: mythdialogbox.cpp:551
MultiplexID::GetColumnName
QString GetColumnName(void) const
Definition: transporteditor.cpp:54
mythdb.h
RollOff::RollOff
RollOff(const MultiplexID *id)
Definition: transporteditor.cpp:833
CardUtil::SATIP
@ SATIP
Definition: cardutil.h:69
DVBCModulationSystem::DVBCModulationSystem
DVBCModulationSystem(const MultiplexID *id)
Definition: transporteditor.cpp:819
CardUtil::toInputType
static enum INPUT_TYPES toInputType(const QString &name)
Definition: cardutil.h:72
DBStorage::m_user
StorageUser * m_user
Definition: mythstorage.h:50
CardUtil::ERROR_UNKNOWN
@ ERROR_UNKNOWN
Definition: cardutil.h:48
CardUtil::DVBT2
@ DVBT2
Definition: cardutil.h:67
DVBTModulationSystem::DVBTModulationSystem
DVBTModulationSystem(const MultiplexID *id)
Definition: transporteditor.cpp:793
DVBTBandwidth
Definition: transporteditor.cpp:612
DVBForwardErrorCorrectionSelector::DVBForwardErrorCorrectionSelector
DVBForwardErrorCorrectionSelector(Storage *_storage)
Definition: transporteditor.cpp:647
ButtonStandardSetting
Definition: standardsettings.h:448
MythMainWindow::TranslateKeyPress
bool TranslateKeyPress(const QString &context, QKeyEvent *e, QStringList &actions, bool allowJumps=true)
Get a list of actions for a keypress in the given context.
Definition: mythmainwindow.cpp:1139
MuxDBStorage::GetWhereClause
QString GetWhereClause(MSqlBindings &bindings) const override
Definition: transporteditor.cpp:401
DVBTCoderateHP
Definition: transporteditor.cpp:693
TransportSetting::TransportSetting
TransportSetting(const QString &label, uint mplexid, uint sourceid, uint cardtype)
Definition: transporteditor.cpp:845
MSqlQuery::value
QVariant value(int i) const
Definition: mythdbcon.h:198
MythScreenStack
Definition: mythscreenstack.h:16
DBStorage::GetColumnName
QString GetColumnName(void) const
Definition: mythstorage.h:47
TransportListEditor::m_list
QVector< StandardSetting * > m_list
Definition: transporteditor.h:89
MSqlQuery::exec
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
Definition: mythdbcon.cpp:603
TransportListEditor::m_cardtype
uint m_cardtype
Definition: transporteditor.h:91
StorageUser::GetDBValue
virtual QString GetDBValue(void) const =0
TransportListEditor::TransportListEditor
TransportListEditor(uint initial_sourceid)
Definition: transporteditor.cpp:213
MythScreenType
Screen in which all other widgets are contained and rendered.
Definition: mythscreentype.h:45
DVBForwardErrorCorrection
Definition: transporteditor.cpp:667
DVBTBandwidth::DVBTBandwidth
DVBTBandwidth(const MultiplexID *id)
Definition: transporteditor.cpp:614
DVBTGuardInterval
Definition: transporteditor.cpp:705
SimpleDBStorage
Definition: mythstorage.h:56
TransportListEditor::SetSourceID
void SetSourceID(uint _sourceid)
Definition: transporteditor.cpp:194
TransportListEditor::m_isLoading
bool m_isLoading
Definition: transporteditor.h:92
menu
static MythThemedMenu * menu
Definition: mythtv/programs/mythtv-setup/main.cpp:53
MythMainWindow::GetStack
MythScreenStack * GetStack(const QString &stackname)
Definition: mythmainwindow.cpp:326
TransportListEditor::Load
void Load(void) override
Definition: transporteditor.cpp:243
TransportListEditor::Delete
void Delete(TransportSetting *transport)
Definition: transporteditor.cpp:333
VideoSourceID::resultEdit
void resultEdit(DialogCompletionEvent *) override
Definition: transporteditor.cpp:435
AutoIncrementSetting::m_column
QString m_column
Definition: standardsettings.h:135
DVBInversion
Definition: transporteditor.cpp:596
true
VERBOSE_PREAMBLE Most true
Definition: verbosedefs.h:91
CardUtil::ProbeSubTypeName
static QString ProbeSubTypeName(uint inputid)
Definition: cardutil.cpp:935
DVBSSymbolRate::DVBSSymbolRate
DVBSSymbolRate(const MultiplexID *id)
Definition: transporteditor.cpp:481
ButtonStandardSetting::clicked
void clicked()
TransportListEditor::m_videosource
VideoSourceShow * m_videosource
Definition: transporteditor.h:88
satiputils.h
TransportListEditor::m_sourceid
uint m_sourceid
Definition: transporteditor.h:90
Modulation::Modulation
Modulation(const MultiplexID *id, uint nType)
Definition: transporteditor.cpp:545
StandardSetting::settingsChanged
void settingsChanged(StandardSetting *selectedSetting=nullptr)
StandardSetting::addChild
virtual void addChild(StandardSetting *child)
Definition: standardsettings.cpp:64
VideoSourceID::edit
void edit(MythScreenType *) override
Definition: transporteditor.cpp:434
CardUtil::DVBS2
@ DVBS2
Definition: cardutil.h:60
DVBTCoderateHP::DVBTCoderateHP
DVBTCoderateHP(const MultiplexID *id)
Definition: transporteditor.cpp:695
sourceutil.h
TransportSetting::getMplexId
uint getMplexId() const
Definition: transporteditor.cpp:955
CardUtil::QPSK
@ QPSK
Definition: cardutil.h:50
DVBSModulationSystem
Definition: transporteditor.cpp:804
MythUIComboBoxSetting
Definition: standardsettings.h:216
DVBForwardErrorCorrectionSelector
Definition: transporteditor.cpp:645
SignalPolarity
Definition: transporteditor.cpp:525
MythDialogBox
Basic menu dialog, message and a list of options.
Definition: mythdialogbox.h:138
MSqlQuery::InitCon
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
Definition: mythdbcon.cpp:535
DVBT2Bandwidth
Definition: transporteditor.cpp:627
MythDB::DBError
static void DBError(const QString &where, const MSqlQuery &query)
Definition: mythdb.cpp:178
CardUtil::QAM
@ QAM
Definition: cardutil.h:51
get_cardtype
static CardUtil::INPUT_TYPES get_cardtype(uint sourceid)
Definition: transporteditor.cpp:71
StandardSetting::Load
virtual void Load(void)
Definition: standardsettings.cpp:208
DVBCSymbolRate::DVBCSymbolRate
DVBCSymbolRate(const MultiplexID *id)
Definition: transporteditor.cpp:506
MuxDBStorage::m_mplexId
const MultiplexID * m_mplexId
Definition: transporteditor.cpp:398
CardUtil::HDHOMERUN
@ HDHOMERUN
Definition: cardutil.h:57
StandardSetting::setHelpText
virtual void setHelpText(const QString &str)
Definition: standardsettings.h:37
SatIP::toDVBInputType
static CardUtil::INPUT_TYPES toDVBInputType(const QString &deviceid)
Definition: satiputils.cpp:142
DVBSModulationSystem::DVBSModulationSystem
DVBSModulationSystem(const MultiplexID *id)
Definition: transporteditor.cpp:806
DVBT2TransmissionMode::DVBT2TransmissionMode
DVBT2TransmissionMode(const MultiplexID *id)
Definition: transporteditor.cpp:759
DVBTModulationSystem
Definition: transporteditor.cpp:791
CardUtil
Collection of helper utilities for input DB use.
Definition: cardutil.h:40
DVBTTransmissionMode::DVBTTransmissionMode
DVBTTransmissionMode(const MultiplexID *id)
Definition: transporteditor.cpp:742
CardUtil::V4L
@ V4L
Definition: cardutil.h:54
StandardSetting::getValue
virtual QString getValue(void) const
Definition: standardsettings.h:51
DTVStandard
Definition: transporteditor.cpp:439
uint
unsigned int uint
Definition: compat.h:140
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:56
DVBTGuardInterval::DVBTGuardInterval
DVBTGuardInterval(const MultiplexID *id)
Definition: transporteditor.cpp:707
CardUtil::DVBC
@ DVBC
Definition: cardutil.h:51
VideoSourceID
Definition: transporteditor.cpp:425
AutoIncrementSetting
Definition: standardsettings.h:125
StandardSetting::setLabel
virtual void setLabel(QString str)
Definition: standardsettings.h:34
VideoSourceShow
Definition: videosource.h:77
DVBCSymbolRate
Definition: transporteditor.cpp:504
TransportSetting
Definition: transporteditor.h:48
TransportSetting::openMenu
void openMenu()
DVBT2GuardInterval::DVBT2GuardInterval
DVBT2GuardInterval(const MultiplexID *id)
Definition: transporteditor.cpp:723
CardUtil::GetRawInputType
static QString GetRawInputType(uint inputid)
Definition: cardutil.h:281
StandardSetting::valueChanged
void valueChanged(const QString &newValue)
DVBTTransmissionMode
Definition: transporteditor.cpp:740
MythMenu
Definition: mythdialogbox.h:93
MythUIComboBoxSetting::addSelection
void addSelection(const QString &label, QString value=QString(), bool select=false)
Definition: standardsettings.cpp:479
TransportListEditor::Menu
void Menu(TransportSetting *transport)
Definition: transporteditor.cpp:368
MultiplexID
Definition: transporteditor.cpp:45
CardUtil::FIREWIRE
@ FIREWIRE
Definition: cardutil.h:56
MythUITextEditSetting
Definition: standardsettings.h:144
DTVStandard::DTVStandard
DTVStandard(const MultiplexID *id, bool is_dvb_country, bool is_atsc_country)
Definition: transporteditor.cpp:441
mythcorecontext.h
VideoSourceID::VideoSourceID
VideoSourceID(const MultiplexID *id, uint _sourceid)
Definition: transporteditor.cpp:427
Frequency
Definition: transporteditor.cpp:465
StandardSetting::removeChild
virtual void removeChild(StandardSetting *child)
Definition: standardsettings.cpp:73
Modulation
Definition: transporteditor.cpp:540
MSqlQuery::bindValue
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
Definition: mythdbcon.cpp:864
DialogCompletionEvent
Event dispatched from MythUI modal dialogs to a listening class containing a result of some form.
Definition: mythdialogbox.h:42
DVBT2TransmissionMode
Definition: transporteditor.cpp:757
Frequency::Frequency
Frequency(const MultiplexID *id, bool in_kHz=false)
Definition: transporteditor.cpp:467
CardUtil::HDHRdoesDVB
static bool HDHRdoesDVB(const QString &device)
If the device is valid, check if the model does DVB.
Definition: cardutil.cpp:2785
GetMythMainWindow
MythMainWindow * GetMythMainWindow(void)
Definition: mythmainwindow.cpp:105
DVBTHierarchy
Definition: transporteditor.cpp:775
build_compdb.action
action
Definition: build_compdb.py:9
CardUtil::OFDM
@ OFDM
Definition: cardutil.h:52
StandardSetting::setVisible
void setVisible(bool visible)
Definition: standardsettings.cpp:53
StandardSetting
Definition: standardsettings.h:30
MythCoreContext::GetHostName
QString GetHostName(void)
Definition: mythcorecontext.cpp:855
RollOff
Definition: transporteditor.cpp:831
DVBTHierarchy::DVBTHierarchy
DVBTHierarchy(const MultiplexID *id)
Definition: transporteditor.cpp:777
CardUtil::MPEG
@ MPEG
Definition: cardutil.h:55
CardUtil::ATSC
@ ATSC
Definition: cardutil.h:53
TransportSetting::keyPressEvent
bool keyPressEvent(QKeyEvent *event) override
Definition: transporteditor.cpp:930
SourceUtil::GetSourceID
static uint GetSourceID(const QString &name)
Definition: sourceutil.cpp:69
TransportListEditor::NewTransport
void NewTransport(void)
Definition: transporteditor.cpp:323
Storage
Definition: mythstorage.h:24
MythScreenStack::AddScreen
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
Definition: mythscreenstack.cpp:49
query
MSqlQuery query(MSqlQuery::InitCon())
MuxDBStorage::MuxDBStorage
MuxDBStorage(StorageUser *_setting, const MultiplexID *_id, const QString &_name)
Definition: transporteditor.cpp:390
DVBCModulationSystem
Definition: transporteditor.cpp:817
videosource.h
DVBTCoderateLP::DVBTCoderateLP
DVBTCoderateLP(const MultiplexID *id)
Definition: transporteditor.cpp:682
CardUtil::DVBT
@ DVBT
Definition: cardutil.h:52
DVBT2Bandwidth::DVBT2Bandwidth
DVBT2Bandwidth(const MultiplexID *id)
Definition: transporteditor.cpp:629
CardUtil::ERROR_OPEN
@ ERROR_OPEN
Definition: cardutil.h:47
CardUtil::GetVideoDevice
static QString GetVideoDevice(uint inputid)
Definition: cardutil.h:283
DVBForwardErrorCorrection::DVBForwardErrorCorrection
DVBForwardErrorCorrection(const MultiplexID *id)
Definition: transporteditor.cpp:669
pp_modulation
static QString pp_modulation(const QString &mod)
Definition: transporteditor.cpp:57
DVBSSymbolRate
Definition: transporteditor.cpp:479
CardUtil::INPUT_TYPES
INPUT_TYPES
all the different inputs
Definition: cardutil.h:46
MSqlQuery::prepare
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
Definition: mythdbcon.cpp:808
DVBTCoderateLP
Definition: transporteditor.cpp:680
CardUtil::ERROR_PROBE
@ ERROR_PROBE
Definition: cardutil.h:49
MuxDBStorage::GetSetClause
QString GetSetClause(MSqlBindings &bindings) const override
Definition: transporteditor.cpp:411
MultiplexID::MultiplexID
MultiplexID()
Definition: transporteditor.cpp:47
DVBT2GuardInterval
Definition: transporteditor.cpp:721
StorageUser
Definition: mythstorage.h:16