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 #include <vector>
34 using namespace std;
35 
36 #include "transporteditor.h"
37 #include "videosource.h"
38 #include "mythcorecontext.h"
39 #include "mythdb.h"
40 
41 #define LOC QString("DTVMux: ")
42 
44 {
45  public:
46  MultiplexID() : AutoIncrementSetting("dtv_multiplex", "mplexid")
47  {
48  setVisible(false);
49  setName("MPLEXID");
50  }
51 
52  public:
53  QString GetColumnName(void) const { return m_column; }
54 };
55 
56 static QString pp_modulation(const QString& mod)
57 {
58  if (mod.endsWith("vsb"))
59  return mod.left(mod.length() - 3) + "-VSB";
60 
61  if (mod.startsWith("qam_"))
62  return "QAM-" + mod.mid(4, mod.length());
63 
64  if (mod == "analog")
65  return QObject::tr("Analog");
66 
67  return mod.toUpper();
68 }
69 
71 {
72  vector<uint> cardids;
73 
74  // Work out what card we have.. (doesn't always work well)
76  query.prepare(
77  "SELECT capturecard.cardid "
78  "FROM capturecard "
79  "WHERE capturecard.sourceid = :SOURCEID AND "
80  " capturecard.parentid = 0 AND "
81  " capturecard.hostname = :HOSTNAME");
82  query.bindValue(":SOURCEID", sourceid);
83  query.bindValue(":HOSTNAME", gCoreContext->GetHostName());
84 
85  if (!query.exec() || !query.isActive())
86  {
87  MythDB::DBError("TransportWizard()", query);
88  return CardUtil::ERROR_PROBE;
89  }
90  while (query.next())
91  cardids.push_back(query.value(0).toUInt());
92 
93  if (cardids.empty())
94  {
95  ShowOkPopup(QObject::tr(
96  "Sorry, the Transport Editor can only edit transports "
97  "of a video source that is connected to a capture card."));
98 
99  return CardUtil::ERROR_PROBE;
100  }
101 
102  vector<CardUtil::INPUT_TYPES> cardtypes;
103 
104  vector<uint>::const_iterator it = cardids.begin();
105  for (; it != cardids.end(); ++it)
106  {
108  QString cardtype = CardUtil::GetRawInputType(*it);
109  if (cardtype == "DVB")
110  cardtype = CardUtil::ProbeSubTypeName(*it);
111  nType = CardUtil::toInputType(cardtype);
112 
113  if ((CardUtil::ERROR_OPEN == nType) ||
114  (CardUtil::ERROR_UNKNOWN == nType) ||
115  (CardUtil::ERROR_PROBE == nType))
116  {
117  ShowOkPopup(
118  QObject::tr(
119  "Failed to probe a capture card connected to this "
120  "transport's video source. Please make sure the "
121  "backend is not running."));
122 
123  return CardUtil::ERROR_PROBE;
124  }
125 
126  cardtypes.push_back(nType);
127  }
128 
129  // This should never happen... (unless DB has changed under us)
130  if (cardtypes.empty())
131  return CardUtil::ERROR_PROBE;
132 
133  // If there are multiple cards connected to this video source
134  // check if they are the same type or compatible.
135  for (size_t i = 1; i < cardtypes.size(); i++)
136  {
137  CardUtil::INPUT_TYPES typeA = cardtypes[i - 1];
138  CardUtil::INPUT_TYPES typeB = cardtypes[i + 0];
139 
140  // MPEG devices are seen as V4L (historical)
141  typeA = (CardUtil::MPEG == typeA) ? CardUtil::V4L : typeA;
142  typeB = (CardUtil::MPEG == typeB) ? CardUtil::V4L : typeB;
143 
144  // HDHOMERUN devices can be DVBC, DVBT/T2, ATSC or a combination of those.
145  // If there are other non-HDHR devices connected to this videosource that
146  // have an explicit type then assume that the HDHOMERUN is also of that type.
147  typeA = (CardUtil::HDHOMERUN == typeA) ? typeB : typeA;
148  typeB = (CardUtil::HDHOMERUN == typeB) ? typeA : typeB;
149 
150  if (typeA == typeB)
151  continue;
152 
153  ShowOkPopup(
154  QObject::tr(
155  "The capture cards connected to this transport's video source "
156  "are incompatible. Please create separate video sources "
157  "per capture card type."));
158 
159  return CardUtil::ERROR_PROBE;
160  }
161 
162  return cardtypes[0];
163 }
164 
166 {
167  for (auto setting : m_list)
168  removeChild(setting);
169  m_list.clear();
170 
171 #if 0
172  LOG(VB_GENERAL, LOG_DEBUG, QString("TransportList::SetSourceID(%1)")
173  .arg(_sourceid));
174 #endif
175 
176  if (!_sourceid)
177  {
178  m_sourceid = 0;
179  }
180  else
181  {
182  m_cardtype = get_cardtype(_sourceid);
183  m_sourceid = ((CardUtil::ERROR_OPEN == m_cardtype) ||
184  (CardUtil::ERROR_UNKNOWN == m_cardtype) ||
185  (CardUtil::ERROR_PROBE == m_cardtype)) ? 0 : _sourceid;
186  }
187 }
188 
190  m_videosource(new VideoSourceShow(sourceid))
191 {
192  setLabel(tr("Transport Editor"));
193 
195 
196  auto *newTransport =
197  new ButtonStandardSetting("(" + tr("New Transport") + ")");
198  connect(newTransport, SIGNAL(clicked()), SLOT(NewTransport(void)));
199 
200  addChild(newTransport);
201 
202  connect(m_videosource, SIGNAL(valueChanged(const QString&)),
203  this, SLOT(SetSourceID(const QString&)));
204 
205  SetSourceID(sourceid);
206 }
207 
208 void TransportListEditor::SetSourceID(const QString& sourceid)
209 {
210  if (m_isLoading)
211  return;
212  SetSourceID(sourceid.toUInt());
213  Load();
214 }
215 
217 {
218  if (m_isLoading)
219  return;
220  m_isLoading = true;
221  if (m_sourceid)
222  {
223  MSqlQuery query(MSqlQuery::InitCon());
224  query.prepare(
225  "SELECT mplexid, modulation, frequency, "
226  " symbolrate, networkid, transportid, "
227  " constellation, mod_sys "
228  "FROM dtv_multiplex, videosource "
229  "WHERE dtv_multiplex.sourceid = :SOURCEID AND "
230  " dtv_multiplex.sourceid = videosource.sourceid "
231  "ORDER by networkid, transportid, frequency, mplexid");
232  query.bindValue(":SOURCEID", m_sourceid);
233 
234  if (!query.exec() || !query.isActive())
235  {
236  MythDB::DBError("TransportList::fillSelections", query);
237  m_isLoading = false;
238  return;
239  }
240 
241  while (query.next())
242  {
243  QString rawmod = ((CardUtil::OFDM == m_cardtype) ||
245  query.value(6).toString() : query.value(1).toString();
246 
247  QString mod = pp_modulation(rawmod);
248  while (mod.length() < 7)
249  mod += " ";
250 
251  QString rate = query.value(3).toString();
252  rate = (rate == "0") ? "" : QString("rate %1").arg(rate);
253 
254  QString netid = query.value(4).toUInt() ?
255  QString("netid %1").arg(query.value(4).toUInt(), 5) : "";
256 
257  QString tid = query.value(5).toUInt() ?
258  QString("tid %1").arg(query.value(5).toUInt(), 5) : "";
259 
260  QString hz = (CardUtil::QPSK == m_cardtype) ? "kHz" : "Hz";
261 
262  QString type = "";
263  if (CardUtil::OFDM == m_cardtype)
264  type = "(DVB-T)";
266  type = QString("(%1)").arg(query.value(7).toString());
267  if (CardUtil::QPSK == m_cardtype)
268  type = "(DVB-S)";
269  if (CardUtil::QAM == m_cardtype)
270  type = "(DVB-C)";
272  type = "(DVB-S2)";
273 
274  QString txt = QString("%1 %2 %3 %4 %5 %6 %7")
275  .arg(mod).arg(query.value(2).toString())
276  .arg(hz).arg(rate).arg(netid).arg(tid).arg(type);
277 
278  auto *transport = new TransportSetting(txt, query.value(0).toUInt(),
280  connect(transport, &TransportSetting::deletePressed,
281  this, [transport, this] () { Delete(transport); });
282  connect(transport, &TransportSetting::openMenu,
283  this, [transport, this] () { Menu(transport); });
284  addChild(transport);
285  m_list.push_back(transport);
286  }
287  }
288 
290  m_isLoading = false;
291 }
292 
294 {
295  auto *transport = new TransportSetting(QString("New Transport"), 0,
297  addChild(transport);
298  m_list.push_back(transport);
299  emit settingsChanged(this);
300 }
301 
302 
304 {
305  if (m_isLoading)
306  return;
307 
308  ShowOkPopup(
309  tr("Are you sure you would like to delete this transport?"),
310  this,
311  [transport, this](bool result)
312  {
313  if (!result)
314  return;
315 
316  uint mplexid = transport->getMplexId();
317 
318  MSqlQuery query(MSqlQuery::InitCon());
319  query.prepare("DELETE FROM dtv_multiplex WHERE mplexid = :MPLEXID");
320  query.bindValue(":MPLEXID", mplexid);
321 
322  if (!query.exec() || !query.isActive())
323  MythDB::DBError("TransportEditor -- delete multiplex", query);
324 
325  query.prepare("UPDATE channel SET deleted = NOW() "
326  "WHERE deleted IS NULL AND mplexid = :MPLEXID");
327  query.bindValue(":MPLEXID", mplexid);
328 
329  if (!query.exec() || !query.isActive())
330  MythDB::DBError("TransportEditor -- delete channels", query);
331 
332  removeChild(transport);
333  m_list.removeAll(transport);
334  },
335  true);
336 }
337 
339 {
340  if (m_isLoading)
341  return;
342 
343  auto *menu = new MythMenu(tr("Transport Menu"), this, "transportmenu");
344  menu->AddItem(tr("Delete..."), [transport, this] () { Delete(transport); });
345 
346  MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
347 
348  auto *menuPopup = new MythDialogBox(menu, popupStack, "menudialog");
349  menuPopup->SetReturnEvent(this, "transportmenu");
350 
351  if (menuPopup->Create())
352  popupStack->AddScreen(menuPopup);
353  else
354  delete menuPopup;
355 }
356 
358 {
359  protected:
360  MuxDBStorage(StorageUser *_setting, const MultiplexID *_id, const QString& _name) :
361  SimpleDBStorage(_setting, "dtv_multiplex", _name), m_mplexId(_id)
362  {
363  }
364 
365  QString GetSetClause(MSqlBindings &bindings) const override; // SimpleDBStorage
366  QString GetWhereClause(MSqlBindings &bindings) const override; // SimpleDBStorage
367 
369 };
370 
372 {
373  QString muxTag = ":WHERE" + m_mplexId->GetColumnName().toUpper();
374 
375  bindings.insert(muxTag, m_mplexId->getValue());
376 
377  // return query
378  return m_mplexId->GetColumnName() + " = " + muxTag;
379 }
380 
381 QString MuxDBStorage::GetSetClause(MSqlBindings &bindings) const
382 {
383  QString muxTag = ":SET" + m_mplexId->GetColumnName().toUpper();
384  QString nameTag = ":SET" + GetColumnName().toUpper();
385 
386  bindings.insert(muxTag, m_mplexId->getValue());
387  bindings.insert(nameTag, m_user->GetDBValue());
388 
389  // return query
390  return (m_mplexId->GetColumnName() + " = " + muxTag + ", " +
391  GetColumnName() + " = " + nameTag);
392 }
393 
395 {
396  public:
397  VideoSourceID(const MultiplexID *id, uint _sourceid) :
398  StandardSetting(this),
399  MuxDBStorage(this, id, "sourceid")
400  {
401  setVisible(false);
402  setValue(_sourceid);
403  }
404  void edit(MythScreenType * /*screen*/) override { } // StandardSetting
405  void resultEdit(DialogCompletionEvent * /*dce*/) override { } // StandardSetting
406 };
407 
409 {
410  public:
412  bool is_dvb_country,
413  bool is_atsc_country) :
414  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "sistandard")
415  {
416  setLabel(QObject::tr("Digital TV Standard"));
417  setHelpText(QObject::tr(
418  "Guiding standard to use for making sense of the "
419  "data streams after they have been demodulated, "
420  "error corrected and demultiplexed."));
421  if (is_dvb_country)
422  addSelection(QObject::tr("DVB"), "dvb");
423 
424  if (is_atsc_country)
425  {
426  addSelection(QObject::tr("ATSC"), "atsc");
427  addSelection(QObject::tr("OpenCable"), "opencable");
428  }
429 
430  addSelection(QObject::tr("MPEG"), "mpeg");
431  };
432 };
433 
435 {
436  public:
437  explicit Frequency(const MultiplexID *id, bool in_kHz = false) :
438  MythUITextEditSetting(this), MuxDBStorage(this, id, "frequency")
439  {
440  QString hz = (in_kHz) ? "kHz" : "Hz";
441  setLabel(QObject::tr("Frequency") + " (" + hz + ")");
442  setHelpText(QObject::tr(
443  "Frequency (Option has no default).\n"
444  "The frequency for this transport (multiplex) in") + " " + hz + ".");
445  };
446 };
447 
449 {
450  public:
451  explicit DVBSymbolRate(const MultiplexID *id) :
452  MythUIComboBoxSetting(this, true), MuxDBStorage(this, id, "symbolrate")
453  {
454  setLabel(QObject::tr("Symbol Rate"));
455  setHelpText(
456  QObject::tr(
457  "Symbol Rate (symbols/sec).\n"
458  "Most DVB-S transponders transmit at 27.5 "
459  "million symbols per second."));
460  addSelection("3333000");
461  addSelection("22000000");
462  addSelection("22500000");
463  addSelection("23000000");
464  addSelection("27500000", "27500000", true);
465  addSelection("28000000");
466  addSelection("28500000");
467  addSelection("29500000");
468  addSelection("29700000");
469  addSelection("29900000");
470  };
471 };
472 
474 {
475  public:
476  explicit SignalPolarity(const MultiplexID *id) :
477  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "polarity")
478  {
479  setLabel(QObject::tr("Polarity"));
480  setHelpText(QObject::tr("Polarity (Option has no default)"));
481  addSelection(QObject::tr("Horizontal"), "h");
482  addSelection(QObject::tr("Vertical"), "v");
483  addSelection(QObject::tr("Right Circular"), "r");
484  addSelection(QObject::tr("Left Circular"), "l");
485  };
486 };
487 
489 {
490  public:
491  Modulation(const MultiplexID *id, uint nType);
492 };
493 
495  MythUIComboBoxSetting(this),
496  MuxDBStorage(this, id, ((CardUtil::OFDM == nType) ||
497  (CardUtil::DVBT2 == nType)) ?
498  "constellation" : "modulation")
499 {
500  setLabel(QObject::tr("Modulation"));
501  setHelpText(QObject::tr("Modulation, aka Constellation"));
502 
503  if (CardUtil::QPSK == nType)
504  {
505  // no modulation options
506  setVisible(false);
507  }
508  else if (CardUtil::DVBS2 == nType)
509  {
510  addSelection("QPSK", "qpsk");
511  addSelection("8PSK", "8psk");
512  addSelection("16APSK", "16apsk");
513  addSelection("32APSK", "32apsk");
514  }
515  else if ((CardUtil::QAM == nType) || (CardUtil::OFDM == nType) ||
516  (CardUtil::DVBT2 == nType))
517  {
518  addSelection(QObject::tr("QAM Auto"), "auto");
519  addSelection("QAM-16", "qam_16");
520  addSelection("QAM-32", "qam_32");
521  addSelection("QAM-64", "qam_64");
522  addSelection("QAM-128", "qam_128");
523  addSelection("QAM-256", "qam_256");
524 
525  if ((CardUtil::OFDM == nType) || (CardUtil::DVBT2 == nType))
526  {
527  addSelection("QPSK", "qpsk");
528  }
529  }
530  else if ((CardUtil::ATSC == nType) ||
531  (CardUtil::HDHOMERUN == nType))
532  {
533  addSelection("8-VSB", "8vsb");
534  addSelection("QAM-64", "qam_64");
535  addSelection("QAM-256", "qam_256");
536  }
537  else
538  {
539  addSelection(QObject::tr("Analog"), "analog");
540  setVisible(false);
541  }
542 };
543 
545 {
546  public:
547  explicit DVBInversion(const MultiplexID *id) :
548  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "inversion")
549  {
550  setLabel(QObject::tr("Inversion"));
551  setHelpText(QObject::tr("Inversion (Default: Auto):\n"
552  "Most cards can autodetect this now, so leave it at Auto"
553  " unless it won't work."));
554  addSelection(QObject::tr("Auto"), "a");
555  addSelection(QObject::tr("On"), "1");
556  addSelection(QObject::tr("Off"), "0");
557  };
558 };
559 
561 {
562  public:
563  explicit DVBTBandwidth(const MultiplexID *id) :
564  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "bandwidth")
565  {
566  setLabel(QObject::tr("Bandwidth"));
567  setHelpText(QObject::tr("Bandwidth (Default: Auto)"));
568  addSelection(QObject::tr("Auto"), "a");
569  addSelection(QObject::tr("6 MHz"), "6");
570  addSelection(QObject::tr("7 MHz"), "7");
571  addSelection(QObject::tr("8 MHz"), "8");
572  };
573 };
574 
576 {
577  public:
579  MythUIComboBoxSetting(_storage)
580  {
581  addSelection(QObject::tr("Auto"), "auto");
582  addSelection(QObject::tr("None"), "none");
583  addSelection("1/2");
584  addSelection("2/3");
585  addSelection("3/4");
586  addSelection("4/5");
587  addSelection("5/6");
588  addSelection("6/7");
589  addSelection("7/8");
590  addSelection("8/9");
591  };
592 };
593 
596 {
597  public:
600  MuxDBStorage(this, id, "fec")
601  {
602  setLabel(QObject::tr("FEC"));
603  setHelpText(QObject::tr("Forward Error Correction (Default: Auto)"));
604  };
605 };
606 
609 {
610  public:
611  explicit DVBTCoderateLP(const MultiplexID *id) :
613  MuxDBStorage(this, id, "lp_code_rate")
614  {
615  setLabel(QObject::tr("LP Coderate"));
616  setHelpText(QObject::tr("Low Priority Code Rate (Default: Auto)"));
617  };
618 };
619 
622 {
623  public:
624  explicit DVBTCoderateHP(const MultiplexID *id) :
626  MuxDBStorage(this, id, "hp_code_rate")
627  {
628  setLabel(QObject::tr("HP Coderate"));
629  setHelpText(QObject::tr("High Priority Code Rate (Default: Auto)"));
630  };
631 };
632 
634 {
635  public:
636  explicit DVBTGuardInterval(const MultiplexID *id) :
637  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "guard_interval")
638  {
639  setLabel(QObject::tr("Guard Interval"));
640  setHelpText(QObject::tr("Guard Interval (Default: Auto)"));
641  addSelection(QObject::tr("Auto"), "auto");
642  addSelection("1/4");
643  addSelection("1/8");
644  addSelection("1/16");
645  addSelection("1/32");
646  };
647 };
648 
650 {
651  public:
652  explicit DVBTTransmissionMode(const MultiplexID *id) :
653  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "transmission_mode")
654  {
655  setLabel(QObject::tr("Trans. Mode"));
656  setHelpText(QObject::tr("Transmission Mode (Default: Auto)"));
657  addSelection(QObject::tr("Auto"), "a");
658  addSelection("2K", "2");
659  addSelection("8K", "8");
660  };
661 };
662 
664 {
665  public:
666  explicit DVBTHierarchy(const MultiplexID *id) :
667  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "hierarchy")
668  {
669  setLabel(QObject::tr("Hierarchy"));
670  setHelpText(QObject::tr("Hierarchy (Default: Auto)"));
671  addSelection(QObject::tr("Auto"), "a");
672  addSelection(QObject::tr("None"), "n");
673  addSelection("1");
674  addSelection("2");
675  addSelection("4");
676  }
677 };
678 
680 {
681  public:
682  explicit DVBTModulationSystem(const MultiplexID *id) :
683  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "mod_sys")
684  {
685  setLabel(QObject::tr("Modulation System"));
686  setHelpText(QObject::tr("Modulation System (Default: DVB-T)"));
687  addSelection(QObject::tr("DVB-T"), "DVB-T");
688  addSelection(QObject::tr("DVB-T2"), "DVB-T2");
689  };
690 };
691 
693 {
694  public:
695  explicit DVBSModulationSystem(const MultiplexID *id) :
696  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "mod_sys")
697  {
698  setLabel(QObject::tr("Modulation System"));
699  setHelpText(QObject::tr("Modulation System (Default: DVB-S)"));
700  addSelection(QObject::tr("DVB-S"), "DVB-S");
701  addSelection(QObject::tr("DVB-S2"), "DVB-S2");
702  }
703 };
704 
706 {
707  public:
708  explicit RollOff(const MultiplexID *id) :
709  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "rolloff")
710  {
711  setLabel(QObject::tr("Roll-off"));
712  setHelpText(QObject::tr("Roll-off factor (Default: 0.35)"));
713  addSelection("0.35");
714  addSelection("0.20");
715  addSelection("0.25");
716  addSelection(QObject::tr("Auto"), "auto");
717  }
718 };
719 
720 TransportSetting::TransportSetting(const QString &label, uint mplexid,
721  uint sourceid, uint cardtype)
722  : m_mplexid(new MultiplexID())
723 {
724  setLabel(label);
725 
726  // Must be first.
727  m_mplexid->setValue(mplexid);
729  addChild(new VideoSourceID(m_mplexid, sourceid));
730 
731  if (CardUtil::OFDM == cardtype)
732  {
733  addChild(new DTVStandard(m_mplexid, true, false));
737  addChild(new Modulation(m_mplexid, cardtype));
738 
744  }
745  else if (CardUtil::DVBT2 == cardtype)
746  {
747  addChild(new DTVStandard(m_mplexid, true, false));
751  addChild(new Modulation(m_mplexid, cardtype));
753 
759  }
760  else if (CardUtil::QPSK == cardtype ||
761  CardUtil::DVBS2 == cardtype)
762  {
763  addChild(new DTVStandard(m_mplexid, true, false));
764  addChild(new Frequency(m_mplexid, true));
766 
768  addChild(new Modulation(m_mplexid, cardtype));
772 
773  if (CardUtil::DVBS2 == cardtype)
774  addChild(new RollOff(m_mplexid));
775  }
776  else if (CardUtil::QAM == cardtype)
777  {
778  addChild(new DTVStandard(m_mplexid, true, false));
781 
782  addChild(new Modulation(m_mplexid, cardtype));
785  }
786  else if (CardUtil::ATSC == cardtype ||
787  CardUtil::HDHOMERUN == cardtype)
788  {
789  addChild(new DTVStandard(m_mplexid, false, true));
791  addChild(new Modulation(m_mplexid, cardtype));
792  }
793  else if ((CardUtil::FIREWIRE == cardtype) ||
794  (CardUtil::FREEBOX == cardtype))
795  {
796  addChild(new DTVStandard(m_mplexid, true, true));
797  }
798  else if ((CardUtil::V4L == cardtype) ||
799  (CardUtil::MPEG == cardtype))
800  {
802  addChild(new Modulation(m_mplexid, cardtype));
803  }
804 }
805 
806 bool TransportSetting::keyPressEvent(QKeyEvent *event)
807 {
808  QStringList actions;
809  bool handled =
810  GetMythMainWindow()->TranslateKeyPress("Global", event, actions);
811 
812  for (int i = 0; i < actions.size() && !handled; i++)
813  {
814  QString action = actions[i];
815 
816  if (action == "DELETE")
817  {
818  handled = true;
819  emit deletePressed();
820  }
821  else if (action == "MENU")
822  {
823  handled = true;
824  emit openMenu();
825  }
826  }
827 
828  return handled;
829 }
830 
832 {
833  return m_mplexid->getValue().toUInt();
834 }
Collection of helper utilities for input DB use.
Definition: cardutil.h:40
void Delete(TransportSetting *transport)
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
Definition: mythdbcon.cpp:782
uint getMplexId() const
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
Definition: mythdbcon.cpp:863
VERBOSE_PREAMBLE Most true
Definition: verbosedefs.h:91
QString GetColumnName(void) const
Definition: mythstorage.h:43
bool TranslateKeyPress(const QString &context, QKeyEvent *e, QStringList &actions, bool allowJumps=true)
Get a list of actions for a keypress in the given context.
MuxDBStorage(StorageUser *_setting, const MultiplexID *_id, const QString &_name)
DVBForwardErrorCorrectionSelector(Storage *_storage)
MythConfirmationDialog * ShowOkPopup(const QString &message, QObject *parent, const char *slot, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
static QString ProbeSubTypeName(uint inputid)
Definition: cardutil.cpp:934
static QString pp_modulation(const QString &mod)
static enum INPUT_TYPES toInputType(const QString &name)
Definition: cardutil.h:72
void settingsChanged(StandardSetting *selectedSetting=nullptr)
QSqlQuery wrapper that fetches a DB connection from the connection pool.
Definition: mythdbcon.h:125
TransportListEditor(uint initial_sourceid)
virtual void Load(void)
Basic menu dialog, message and a list of options.
void addSelection(const QString &label, QString value=QString(), bool select=false)
virtual void setHelpText(const QString &str)
DVBTHierarchy(const MultiplexID *id)
VideoSourceShow * m_videosource
DVBForwardErrorCorrection(const MultiplexID *id)
MythScreenStack * GetStack(const QString &stackname)
bool keyPressEvent(QKeyEvent *event) override
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
virtual QString GetDBValue(void) const =0
static MythThemedMenu * menu
void edit(MythScreenType *) override
QString GetWhereClause(MSqlBindings &bindings) const override
QString GetColumnName(void) const
virtual QString getValue(void) const
void Menu(TransportSetting *transport)
void SetSourceID(uint _sourceid)
DVBSModulationSystem(const MultiplexID *id)
QVariant value(int i) const
Definition: mythdbcon.h:198
DVBTBandwidth(const MultiplexID *id)
void resultEdit(DialogCompletionEvent *) override
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
SignalPolarity(const MultiplexID *id)
QMap< QString, QVariant > MSqlBindings
typedef for a map of string -> string bindings for generic queries.
Definition: mythdbcon.h:98
VideoSourceID(const MultiplexID *id, uint _sourceid)
virtual void setLabel(QString str)
DVBTTransmissionMode(const MultiplexID *id)
DVBInversion(const MultiplexID *id)
StorageUser * m_user
Definition: mythstorage.h:46
bool isActive(void) const
Definition: mythdbcon.h:204
DVBTModulationSystem(const MultiplexID *id)
unsigned int uint
Definition: compat.h:140
static MSqlQueryInfo InitCon(ConnectionReuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
Definition: mythdbcon.cpp:535
QString GetSetClause(MSqlBindings &bindings) const override
virtual void addChild(StandardSetting *child)
DVBTCoderateHP(const MultiplexID *id)
DVBTGuardInterval(const MultiplexID *id)
MythMainWindow * GetMythMainWindow(void)
DTVStandard(const MultiplexID *id, bool is_dvb_country, bool is_atsc_country)
void setVisible(bool visible)
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
Definition: mythdbcon.cpp:807
#define LOG(_MASK_, _LEVEL_, _STRING_)
Definition: mythlogging.h:41
QVector< StandardSetting * > m_list
Modulation(const MultiplexID *id, uint nType)
Frequency(const MultiplexID *id, bool in_kHz=false)
TransportSetting(const QString &label, uint mplexid, uint sourceid, uint cardtype)
static QString GetRawInputType(uint inputid)
Definition: cardutil.h:271
RollOff(const MultiplexID *id)
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
Definition: mythdbcon.cpp:603
MultiplexID * m_mplexid
const MultiplexID * m_mplexId
static CardUtil::INPUT_TYPES get_cardtype(uint sourceid)
static void DBError(const QString &where, const MSqlQuery &query)
Definition: mythdb.cpp:179
Screen in which all other widgets are contained and rendered.
QString GetHostName(void)
Event dispatched from MythUI modal dialogs to a listening class containing a result of some form.
Definition: mythdialogbox.h:37
INPUT_TYPES
all the different inputs
Definition: cardutil.h:46
virtual void setValue(const QString &newValue)
virtual void removeChild(StandardSetting *child)
void Load(void) override
DVBSymbolRate(const MultiplexID *id)
DVBTCoderateLP(const MultiplexID *id)
void valueChanged(const QString &)