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