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  for (uint cardid : cardids)
105  {
107  QString cardtype = CardUtil::GetRawInputType(cardid);
108  if (cardtype == "DVB")
109  cardtype = CardUtil::ProbeSubTypeName(cardid);
110  nType = CardUtil::toInputType(cardtype);
111 
112  if ((CardUtil::ERROR_OPEN == nType) ||
113  (CardUtil::ERROR_UNKNOWN == nType) ||
114  (CardUtil::ERROR_PROBE == nType))
115  {
116  ShowOkPopup(
117  QObject::tr(
118  "Failed to probe a capture card connected to this "
119  "transport's video source. Please make sure the "
120  "backend is not running."));
121 
122  return CardUtil::ERROR_PROBE;
123  }
124 
125  cardtypes.push_back(nType);
126  }
127 
128  // This should never happen... (unless DB has changed under us)
129  if (cardtypes.empty())
130  return CardUtil::ERROR_PROBE;
131 
132  // If there are multiple cards connected to this video source
133  // check if they are the same type or compatible.
134  for (size_t i = 1; i < cardtypes.size(); i++)
135  {
136  CardUtil::INPUT_TYPES typeA = cardtypes[i - 1];
137  CardUtil::INPUT_TYPES typeB = cardtypes[i + 0];
138 
139  // MPEG devices are seen as V4L (historical)
140  typeA = (CardUtil::MPEG == typeA) ? CardUtil::V4L : typeA;
141  typeB = (CardUtil::MPEG == typeB) ? CardUtil::V4L : typeB;
142 
143  // HDHOMERUN devices can be DVBC, DVBT/T2, ATSC or a combination of those.
144  // If there are other non-HDHR devices connected to this videosource that
145  // have an explicit type then assume that the HDHOMERUN is also of that type.
146  typeA = (CardUtil::HDHOMERUN == typeA) ? typeB : typeA;
147  typeB = (CardUtil::HDHOMERUN == typeB) ? typeA : typeB;
148 
149  if (typeA == typeB)
150  continue;
151 
152  ShowOkPopup(
153  QObject::tr(
154  "The capture cards connected to this transport's video source "
155  "are incompatible. Please create separate video sources "
156  "per capture card type."));
157 
158  return CardUtil::ERROR_PROBE;
159  }
160 
161  return cardtypes[0];
162 }
163 
165 {
166  for (auto *setting : m_list)
167  removeChild(setting);
168  m_list.clear();
169 
170 #if 0
171  LOG(VB_GENERAL, LOG_DEBUG, QString("TransportList::SetSourceID(%1)")
172  .arg(_sourceid));
173 #endif
174 
175  if (!_sourceid)
176  {
177  m_sourceid = 0;
178  }
179  else
180  {
181  m_cardtype = get_cardtype(_sourceid);
182  m_sourceid = ((CardUtil::ERROR_OPEN == m_cardtype) ||
183  (CardUtil::ERROR_UNKNOWN == m_cardtype) ||
184  (CardUtil::ERROR_PROBE == m_cardtype)) ? 0 : _sourceid;
185  }
186 }
187 
189  m_videosource(new VideoSourceShow(sourceid))
190 {
191  setLabel(tr("Transport Editor"));
192 
194 
195  auto *newTransport =
196  new ButtonStandardSetting("(" + tr("New Transport") + ")");
197  connect(newTransport, SIGNAL(clicked()), SLOT(NewTransport(void)));
198 
199  addChild(newTransport);
200 
201  connect(m_videosource, SIGNAL(valueChanged(const QString&)),
202  this, SLOT(SetSourceID(const QString&)));
203 
204  SetSourceID(sourceid);
205 }
206 
207 void TransportListEditor::SetSourceID(const QString& sourceid)
208 {
209  if (m_isLoading)
210  return;
211  SetSourceID(sourceid.toUInt());
212  Load();
213 }
214 
216 {
217  if (m_isLoading)
218  return;
219  m_isLoading = true;
220  if (m_sourceid)
221  {
222  MSqlQuery query(MSqlQuery::InitCon());
223  query.prepare(
224  "SELECT mplexid, modulation, frequency, "
225  " symbolrate, networkid, transportid, "
226  " constellation, mod_sys "
227  "FROM dtv_multiplex, videosource "
228  "WHERE dtv_multiplex.sourceid = :SOURCEID AND "
229  " dtv_multiplex.sourceid = videosource.sourceid "
230  "ORDER by networkid, transportid, frequency, mplexid");
231  query.bindValue(":SOURCEID", m_sourceid);
232 
233  if (!query.exec() || !query.isActive())
234  {
235  MythDB::DBError("TransportList::fillSelections", query);
236  m_isLoading = false;
237  return;
238  }
239 
240  while (query.next())
241  {
242  QString rawmod = ((CardUtil::OFDM == m_cardtype) ||
244  query.value(6).toString() : query.value(1).toString();
245 
246  QString mod = pp_modulation(rawmod);
247  while (mod.length() < 7)
248  mod += " ";
249 
250  QString rate = query.value(3).toString();
251  rate = (rate == "0") ? "" : QString("rate %1").arg(rate);
252 
253  QString netid = query.value(4).toUInt() ?
254  QString("netid %1").arg(query.value(4).toUInt(), 5) : "";
255 
256  QString tid = query.value(5).toUInt() ?
257  QString("tid %1").arg(query.value(5).toUInt(), 5) : "";
258 
259  QString hz = "Hz";
260  if (CardUtil::QPSK == m_cardtype ||
262  hz = "kHz";
263 
264  QString type = "";
265  if (CardUtil::OFDM == m_cardtype)
266  type = "(DVB-T)";
268  type = QString("(%1)").arg(query.value(7).toString());
269  if (CardUtil::QPSK == m_cardtype)
270  type = "(DVB-S)";
271  if (CardUtil::QAM == m_cardtype)
272  type = "(DVB-C)";
274  type = "(DVB-S2)";
275 
276  QString txt = QString("%1 %2 %3 %4 %5 %6 %7")
277  .arg(mod).arg(query.value(2).toString())
278  .arg(hz).arg(rate).arg(netid).arg(tid).arg(type);
279 
280  auto *transport = new TransportSetting(txt, query.value(0).toUInt(),
282  connect(transport, &TransportSetting::deletePressed,
283  this, [transport, this] () { Delete(transport); });
284  connect(transport, &TransportSetting::openMenu,
285  this, [transport, this] () { Menu(transport); });
286  addChild(transport);
287  m_list.push_back(transport);
288  }
289  }
290 
292  m_isLoading = false;
293 }
294 
296 {
297  auto *transport = new TransportSetting(QString("New Transport"), 0,
299  addChild(transport);
300  m_list.push_back(transport);
301  emit settingsChanged(this);
302 }
303 
304 
306 {
307  if (m_isLoading)
308  return;
309 
310  ShowOkPopup(
311  tr("Are you sure you would like to delete this transport?"),
312  this,
313  [transport, this](bool result)
314  {
315  if (!result)
316  return;
317 
318  uint mplexid = transport->getMplexId();
319 
320  MSqlQuery query(MSqlQuery::InitCon());
321  query.prepare("DELETE FROM dtv_multiplex WHERE mplexid = :MPLEXID");
322  query.bindValue(":MPLEXID", mplexid);
323 
324  if (!query.exec() || !query.isActive())
325  MythDB::DBError("TransportEditor -- delete multiplex", query);
326 
327  query.prepare("UPDATE channel SET deleted = NOW() "
328  "WHERE deleted IS NULL AND mplexid = :MPLEXID");
329  query.bindValue(":MPLEXID", mplexid);
330 
331  if (!query.exec() || !query.isActive())
332  MythDB::DBError("TransportEditor -- delete channels", query);
333 
334  removeChild(transport);
335  m_list.removeAll(transport);
336  },
337  true);
338 }
339 
341 {
342  if (m_isLoading)
343  return;
344 
345  auto *menu = new MythMenu(tr("Transport Menu"), this, "transportmenu");
346  menu->AddItem(tr("Delete..."), [transport, this] () { Delete(transport); });
347 
348  MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
349 
350  auto *menuPopup = new MythDialogBox(menu, popupStack, "menudialog");
351  menuPopup->SetReturnEvent(this, "transportmenu");
352 
353  if (menuPopup->Create())
354  popupStack->AddScreen(menuPopup);
355  else
356  delete menuPopup;
357 }
358 
360 {
361  protected:
362  MuxDBStorage(StorageUser *_setting, const MultiplexID *_id, const QString& _name) :
363  SimpleDBStorage(_setting, "dtv_multiplex", _name), m_mplexId(_id)
364  {
365  }
366 
367  QString GetSetClause(MSqlBindings &bindings) const override; // SimpleDBStorage
368  QString GetWhereClause(MSqlBindings &bindings) const override; // SimpleDBStorage
369 
371 };
372 
374 {
375  QString muxTag = ":WHERE" + m_mplexId->GetColumnName().toUpper();
376 
377  bindings.insert(muxTag, m_mplexId->getValue());
378 
379  // return query
380  return m_mplexId->GetColumnName() + " = " + muxTag;
381 }
382 
383 QString MuxDBStorage::GetSetClause(MSqlBindings &bindings) const
384 {
385  QString muxTag = ":SET" + m_mplexId->GetColumnName().toUpper();
386  QString nameTag = ":SET" + GetColumnName().toUpper();
387 
388  bindings.insert(muxTag, m_mplexId->getValue());
389  bindings.insert(nameTag, m_user->GetDBValue());
390 
391  // return query
392  return (m_mplexId->GetColumnName() + " = " + muxTag + ", " +
393  GetColumnName() + " = " + nameTag);
394 }
395 
397 {
398  public:
399  VideoSourceID(const MultiplexID *id, uint _sourceid) :
400  StandardSetting(this),
401  MuxDBStorage(this, id, "sourceid")
402  {
403  setVisible(false);
404  setValue(_sourceid);
405  }
406  void edit(MythScreenType * /*screen*/) override { } // StandardSetting
407  void resultEdit(DialogCompletionEvent * /*dce*/) override { } // StandardSetting
408 };
409 
411 {
412  public:
414  bool is_dvb_country,
415  bool is_atsc_country) :
416  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "sistandard")
417  {
418  setLabel(QObject::tr("Digital TV Standard"));
419  setHelpText(QObject::tr(
420  "Guiding standard to use for making sense of the "
421  "data streams after they have been demodulated, "
422  "error corrected and demultiplexed."));
423  if (is_dvb_country)
424  addSelection(QObject::tr("DVB"), "dvb");
425 
426  if (is_atsc_country)
427  {
428  addSelection(QObject::tr("ATSC"), "atsc");
429  addSelection(QObject::tr("OpenCable"), "opencable");
430  }
431 
432  addSelection(QObject::tr("MPEG"), "mpeg");
433  };
434 };
435 
437 {
438  public:
439  explicit Frequency(const MultiplexID *id, bool in_kHz = false) :
440  MythUITextEditSetting(this), MuxDBStorage(this, id, "frequency")
441  {
442  QString hz = (in_kHz) ? "kHz" : "Hz";
443  setLabel(QObject::tr("Frequency") + " (" + hz + ")");
444  setHelpText(QObject::tr(
445  "Frequency (Option has no default).\n"
446  "The frequency for this transport (multiplex) in") + " " + hz + ".");
447  };
448 };
449 
451 {
452  public:
453  explicit DVBSymbolRate(const MultiplexID *id) :
454  MythUIComboBoxSetting(this, true), MuxDBStorage(this, id, "symbolrate")
455  {
456  setLabel(QObject::tr("Symbol Rate"));
457  setHelpText(
458  QObject::tr(
459  "Symbol Rate (symbols/sec).\n"
460  "Most DVB-S transponders transmit at 27.5 "
461  "million symbols per second."));
462  addSelection("3333000");
463  addSelection("22000000");
464  addSelection("22500000");
465  addSelection("23000000");
466  addSelection("27500000", "27500000", true);
467  addSelection("28000000");
468  addSelection("28500000");
469  addSelection("29500000");
470  addSelection("29700000");
471  addSelection("29900000");
472  };
473 };
474 
476 {
477  public:
478  explicit SignalPolarity(const MultiplexID *id) :
479  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "polarity")
480  {
481  setLabel(QObject::tr("Polarity"));
482  setHelpText(QObject::tr("Polarity (Option has no default)"));
483  addSelection(QObject::tr("Horizontal"), "h");
484  addSelection(QObject::tr("Vertical"), "v");
485  addSelection(QObject::tr("Right Circular"), "r");
486  addSelection(QObject::tr("Left Circular"), "l");
487  };
488 };
489 
491 {
492  public:
493  Modulation(const MultiplexID *id, uint nType);
494 };
495 
497  MythUIComboBoxSetting(this),
498  MuxDBStorage(this, id, ((CardUtil::OFDM == nType) ||
499  (CardUtil::DVBT2 == nType)) ?
500  "constellation" : "modulation")
501 {
502  setLabel(QObject::tr("Modulation"));
503  setHelpText(QObject::tr("Modulation, aka Constellation"));
504 
505  if (CardUtil::QPSK == nType)
506  {
507  // no modulation options
508  setVisible(false);
509  }
510  else if (CardUtil::DVBS2 == nType)
511  {
512  addSelection("QPSK", "qpsk");
513  addSelection("8PSK", "8psk");
514  addSelection("16APSK", "16apsk");
515  addSelection("32APSK", "32apsk");
516  }
517  else if ((CardUtil::QAM == nType) || (CardUtil::OFDM == nType) ||
518  (CardUtil::DVBT2 == nType))
519  {
520  addSelection(QObject::tr("QAM Auto"), "auto");
521  addSelection("QAM-16", "qam_16");
522  addSelection("QAM-32", "qam_32");
523  addSelection("QAM-64", "qam_64");
524  addSelection("QAM-128", "qam_128");
525  addSelection("QAM-256", "qam_256");
526 
527  if ((CardUtil::OFDM == nType) || (CardUtil::DVBT2 == nType))
528  {
529  addSelection("QPSK", "qpsk");
530  }
531  }
532  else if ((CardUtil::ATSC == nType) ||
533  (CardUtil::HDHOMERUN == nType))
534  {
535  addSelection("8-VSB", "8vsb");
536  addSelection("QAM-64", "qam_64");
537  addSelection("QAM-256", "qam_256");
538  }
539  else
540  {
541  addSelection(QObject::tr("Analog"), "analog");
542  setVisible(false);
543  }
544 };
545 
547 {
548  public:
549  explicit DVBInversion(const MultiplexID *id) :
550  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "inversion")
551  {
552  setLabel(QObject::tr("Inversion"));
553  setHelpText(QObject::tr("Inversion (Default: Auto):\n"
554  "Most cards can autodetect this now, so leave it at Auto"
555  " unless it won't work."));
556  addSelection(QObject::tr("Auto"), "a");
557  addSelection(QObject::tr("On"), "1");
558  addSelection(QObject::tr("Off"), "0");
559  };
560 };
561 
563 {
564  public:
565  explicit DVBTBandwidth(const MultiplexID *id) :
566  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "bandwidth")
567  {
568  setLabel(QObject::tr("Bandwidth"));
569  setHelpText(QObject::tr("Bandwidth (Default: Auto)"));
570  addSelection(QObject::tr("Auto"), "a");
571  addSelection(QObject::tr("6 MHz"), "6");
572  addSelection(QObject::tr("7 MHz"), "7");
573  addSelection(QObject::tr("8 MHz"), "8");
574  };
575 };
576 
578 {
579  public:
581  MythUIComboBoxSetting(_storage)
582  {
583  addSelection(QObject::tr("Auto"), "auto");
584  addSelection(QObject::tr("None"), "none");
585  addSelection("1/2");
586  addSelection("2/3");
587  addSelection("3/4");
588  addSelection("4/5");
589  addSelection("5/6");
590  addSelection("6/7");
591  addSelection("7/8");
592  addSelection("8/9");
593  };
594 };
595 
598 {
599  public:
602  MuxDBStorage(this, id, "fec")
603  {
604  setLabel(QObject::tr("FEC"));
605  setHelpText(QObject::tr("Forward Error Correction (Default: Auto)"));
606  };
607 };
608 
611 {
612  public:
613  explicit DVBTCoderateLP(const MultiplexID *id) :
615  MuxDBStorage(this, id, "lp_code_rate")
616  {
617  setLabel(QObject::tr("LP Coderate"));
618  setHelpText(QObject::tr("Low Priority Code Rate (Default: Auto)"));
619  };
620 };
621 
624 {
625  public:
626  explicit DVBTCoderateHP(const MultiplexID *id) :
628  MuxDBStorage(this, id, "hp_code_rate")
629  {
630  setLabel(QObject::tr("HP Coderate"));
631  setHelpText(QObject::tr("High Priority Code Rate (Default: Auto)"));
632  };
633 };
634 
636 {
637  public:
638  explicit DVBTGuardInterval(const MultiplexID *id) :
639  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "guard_interval")
640  {
641  setLabel(QObject::tr("Guard Interval"));
642  setHelpText(QObject::tr("Guard Interval (Default: Auto)"));
643  addSelection(QObject::tr("Auto"), "auto");
644  addSelection("1/4");
645  addSelection("1/8");
646  addSelection("1/16");
647  addSelection("1/32");
648  };
649 };
650 
652 {
653  public:
654  explicit DVBTTransmissionMode(const MultiplexID *id) :
655  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "transmission_mode")
656  {
657  setLabel(QObject::tr("Trans. Mode"));
658  setHelpText(QObject::tr("Transmission Mode (Default: Auto)"));
659  addSelection(QObject::tr("Auto"), "a");
660  addSelection("2K", "2");
661  addSelection("8K", "8");
662  };
663 };
664 
666 {
667  public:
668  explicit DVBTHierarchy(const MultiplexID *id) :
669  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "hierarchy")
670  {
671  setLabel(QObject::tr("Hierarchy"));
672  setHelpText(QObject::tr("Hierarchy (Default: Auto)"));
673  addSelection(QObject::tr("Auto"), "a");
674  addSelection(QObject::tr("None"), "n");
675  addSelection("1");
676  addSelection("2");
677  addSelection("4");
678  }
679 };
680 
682 {
683  public:
684  explicit DVBTModulationSystem(const MultiplexID *id) :
685  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "mod_sys")
686  {
687  setLabel(QObject::tr("Modulation System"));
688  setHelpText(QObject::tr("Modulation System (Default: DVB-T2)"));
689  addSelection(QObject::tr("DVB-T"), "DVB-T");
690  addSelection(QObject::tr("DVB-T2"), "DVB-T2", true);
691  };
692 };
693 
695 {
696  public:
697  explicit DVBSModulationSystem(const MultiplexID *id) :
698  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "mod_sys")
699  {
700  setLabel(QObject::tr("Modulation System"));
701  setHelpText(QObject::tr("Modulation System (Default: DVB-S2)"));
702  addSelection(QObject::tr("DVB-S"), "DVB-S");
703  addSelection(QObject::tr("DVB-S2"), "DVB-S2", true);
704  }
705 };
706 
708 {
709  public:
710  explicit RollOff(const MultiplexID *id) :
711  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "rolloff")
712  {
713  setLabel(QObject::tr("Roll-off"));
714  setHelpText(QObject::tr("Roll-off factor (Default: 0.35)"));
715  addSelection("0.35");
716  addSelection("0.20");
717  addSelection("0.25");
718  addSelection(QObject::tr("Auto"), "auto");
719  }
720 };
721 
722 TransportSetting::TransportSetting(const QString &label, uint mplexid,
723  uint sourceid, uint cardtype)
724  : m_mplexid(new MultiplexID())
725 {
726  setLabel(label);
727 
728  // Must be first.
729  m_mplexid->setValue(mplexid);
731  addChild(new VideoSourceID(m_mplexid, sourceid));
732 
733  if (CardUtil::OFDM == cardtype)
734  {
735  addChild(new DTVStandard(m_mplexid, true, false));
739  addChild(new Modulation(m_mplexid, cardtype));
740 
746  }
747  else if (CardUtil::DVBT2 == cardtype)
748  {
749  addChild(new DTVStandard(m_mplexid, true, false));
753  addChild(new Modulation(m_mplexid, cardtype));
755 
761  }
762  else if (CardUtil::QPSK == cardtype ||
763  CardUtil::DVBS2 == cardtype)
764  {
765  addChild(new DTVStandard(m_mplexid, true, false));
766  addChild(new Frequency(m_mplexid, true));
768 
770  addChild(new Modulation(m_mplexid, cardtype));
774 
775  if (CardUtil::DVBS2 == cardtype)
776  addChild(new RollOff(m_mplexid));
777  }
778  else if (CardUtil::QAM == cardtype)
779  {
780  addChild(new DTVStandard(m_mplexid, true, false));
783 
784  addChild(new Modulation(m_mplexid, cardtype));
787  }
788  else if (CardUtil::ATSC == cardtype ||
789  CardUtil::HDHOMERUN == cardtype)
790  {
791  addChild(new DTVStandard(m_mplexid, false, true));
793  addChild(new Modulation(m_mplexid, cardtype));
794  }
795  else if ((CardUtil::FIREWIRE == cardtype) ||
796  (CardUtil::FREEBOX == cardtype))
797  {
798  addChild(new DTVStandard(m_mplexid, true, true));
799  }
800  else if ((CardUtil::V4L == cardtype) ||
801  (CardUtil::MPEG == cardtype))
802  {
804  addChild(new Modulation(m_mplexid, cardtype));
805  }
806 }
807 
808 bool TransportSetting::keyPressEvent(QKeyEvent *event)
809 {
810  QStringList actions;
811  bool handled =
812  GetMythMainWindow()->TranslateKeyPress("Global", event, actions);
813 
814  for (int i = 0; i < actions.size() && !handled; i++)
815  {
816  QString action = actions[i];
817 
818  if (action == "DELETE")
819  {
820  handled = true;
821  emit deletePressed();
822  }
823  else if (action == "MENU")
824  {
825  handled = true;
826  emit openMenu();
827  }
828  }
829 
830  return handled;
831 }
832 
834 {
835  return m_mplexid->getValue().toUInt();
836 }
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:783
uint getMplexId() const
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
Definition: mythdbcon.cpp:864
VERBOSE_PREAMBLE Most true
Definition: verbosedefs.h:91
QString GetColumnName(void) const
Definition: mythstorage.h:47
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:927
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:50
void valueChanged(const QString &newValue)
bool isActive(void) const
Definition: mythdbcon.h:204
DVBTModulationSystem(const MultiplexID *id)
unsigned int uint
Definition: compat.h:140
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=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:808
#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:41
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)