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