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 "cardutil.h"
39 #include "mythcorecontext.h"
40 #include "mythdb.h"
41 
42 #define LOC QString("DTVMux: ")
43 
45 {
46  public:
47  MultiplexID() : AutoIncrementSetting("dtv_multiplex", "mplexid")
48  {
49  setVisible(false);
50  setName("MPLEXID");
51  }
52 
53  public:
54  QString GetColumnName(void) const { return m_column; }
55 };
56 
57 static QString pp_modulation(const QString& mod)
58 {
59  if (mod.endsWith("vsb"))
60  return mod.left(mod.length() - 3) + "-VSB";
61 
62  if (mod.startsWith("qam_"))
63  return "QAM-" + mod.mid(4, mod.length());
64 
65  if (mod == "analog")
66  return QObject::tr("Analog");
67 
68  return mod.toUpper();
69 }
70 
72 {
73  vector<uint> cardids;
74 
75  // Work out what card we have.. (doesn't always work well)
77  query.prepare(
78  "SELECT capturecard.cardid "
79  "FROM capturecard "
80  "WHERE capturecard.sourceid = :SOURCEID AND "
81  " capturecard.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 be used to "
97  "edit transports which are connected to a card input."));
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  for (size_t i = 1; i < cardtypes.size(); i++)
134  {
135  CardUtil::INPUT_TYPES typeA = cardtypes[i - 1];
136  typeA = (CardUtil::HDHOMERUN == typeA) ? CardUtil::ATSC : typeA;
137  typeA = (CardUtil::MPEG == typeA) ? CardUtil::V4L : typeA;
138 
139  CardUtil::INPUT_TYPES typeB = cardtypes[i + 0];
140  typeB = (CardUtil::HDHOMERUN == typeB) ? CardUtil::ATSC : typeB;
141  typeB = (CardUtil::MPEG == typeB) ? CardUtil::V4L : typeB;
142 
143  if (typeA == typeB)
144  continue;
145 
146  ShowOkPopup(
147  QObject::tr(
148  "The Video Sources to which this Transport is connected "
149  "are incompatible, please create separate video sources "
150  "for these cards. "));
151 
152  return CardUtil::ERROR_PROBE;
153  }
154 
155  return cardtypes[0];
156 }
157 
159 {
160  for (auto setting : m_list)
161  removeChild(setting);
162  m_list.clear();
163 
164 #if 0
165  LOG(VB_GENERAL, LOG_DEBUG, QString("TransportList::SetSourceID(%1)")
166  .arg(_sourceid));
167 #endif
168 
169  if (!_sourceid)
170  {
171  m_sourceid = 0;
172  }
173  else
174  {
175  m_cardtype = get_cardtype(_sourceid);
176  m_sourceid = ((CardUtil::ERROR_OPEN == m_cardtype) ||
177  (CardUtil::ERROR_UNKNOWN == m_cardtype) ||
178  (CardUtil::ERROR_PROBE == m_cardtype)) ? 0 : _sourceid;
179  }
180 }
181 
183  m_videosource(new VideoSourceSelector(sourceid, QString(), false))
184 {
185  setLabel(tr("Transport Editor"));
186 
188  ButtonStandardSetting *newTransport =
189  new ButtonStandardSetting("(" + tr("New Transport") + ")");
190  connect(newTransport, SIGNAL(clicked()), SLOT(NewTransport(void)));
191 
192  addChild(newTransport);
193 
194  connect(m_videosource, SIGNAL(valueChanged(const QString&)),
195  this, SLOT(SetSourceID(const QString&)));
196 
197  SetSourceID(sourceid);
198 }
199 
200 void TransportListEditor::SetSourceID(const QString& sourceid)
201 {
202  if (m_isLoading)
203  return;
204  SetSourceID(sourceid.toUInt());
205  Load();
206 }
207 
209 {
210  if (m_isLoading)
211  return;
212  m_isLoading = true;
213  if (m_sourceid)
214  {
215  MSqlQuery query(MSqlQuery::InitCon());
216  query.prepare(
217  "SELECT mplexid, modulation, frequency, "
218  " symbolrate, networkid, transportid, "
219  " constellation, mod_sys "
220  "FROM dtv_multiplex, videosource "
221  "WHERE dtv_multiplex.sourceid = :SOURCEID AND "
222  " dtv_multiplex.sourceid = videosource.sourceid "
223  "ORDER by networkid, transportid, frequency, mplexid");
224  query.bindValue(":SOURCEID", m_sourceid);
225 
226  if (!query.exec() || !query.isActive())
227  {
228  MythDB::DBError("TransportList::fillSelections", query);
229  m_isLoading = false;
230  return;
231  }
232 
233  while (query.next())
234  {
235  QString rawmod = ((CardUtil::OFDM == m_cardtype) ||
237  query.value(6).toString() : query.value(1).toString();
238 
239  QString mod = pp_modulation(rawmod);
240  while (mod.length() < 7)
241  mod += " ";
242 
243  QString rate = query.value(3).toString();
244  rate = (rate == "0") ? "" : QString("rate %1").arg(rate);
245 
246  QString netid = query.value(4).toUInt() ?
247  QString("netid %1").arg(query.value(4).toUInt(), 5) : "";
248 
249  QString tid = query.value(5).toUInt() ?
250  QString("tid %1").arg(query.value(5).toUInt(), 5) : "";
251 
252  QString hz = (CardUtil::QPSK == m_cardtype) ? "kHz" : "Hz";
253 
254  QString type = "";
255  if (CardUtil::OFDM == m_cardtype)
256  type = "(DVB-T)";
258  type = QString("(%1)").arg(query.value(7).toString());
259  if (CardUtil::QPSK == m_cardtype)
260  type = "(DVB-S)";
261  if (CardUtil::QAM == m_cardtype)
262  type = "(DVB-C)";
264  type = "(DVB-S2)";
265 
266  QString txt = QString("%1 %2 %3 %4 %5 %6 %7")
267  .arg(mod).arg(query.value(2).toString())
268  .arg(hz).arg(rate).arg(netid).arg(tid).arg(type);
269 
270  TransportSetting *transport =
271  new TransportSetting(txt, query.value(0).toUInt(), m_sourceid,
272  m_cardtype);
273  connect(transport, &TransportSetting::deletePressed,
274  this, [transport, this] () { Delete(transport); });
275  connect(transport, &TransportSetting::openMenu,
276  this, [transport, this] () { Menu(transport); });
277  addChild(transport);
278  m_list.push_back(transport);
279  }
280  }
281 
283  m_isLoading = false;
284 }
285 
287 {
288  TransportSetting *transport =
289  new TransportSetting(QString("New Transport"), 0,
291  addChild(transport);
292  m_list.push_back(transport);
293  emit settingsChanged(this);
294 }
295 
296 
298 {
299  if (m_isLoading)
300  return;
301 
302  ShowOkPopup(
303  tr("Are you sure you would like to delete this transport?"),
304  this,
305  [transport, this](bool result)
306  {
307  if (!result)
308  return;
309 
310  uint mplexid = transport->getMplexId();
311 
312  MSqlQuery query(MSqlQuery::InitCon());
313  query.prepare("DELETE FROM dtv_multiplex WHERE mplexid = :MPLEXID");
314  query.bindValue(":MPLEXID", mplexid);
315 
316  if (!query.exec() || !query.isActive())
317  MythDB::DBError("TransportEditor -- delete multiplex", query);
318 
319  query.prepare("DELETE FROM channel WHERE mplexid = :MPLEXID");
320  query.bindValue(":MPLEXID", mplexid);
321 
322  if (!query.exec() || !query.isActive())
323  MythDB::DBError("TransportEditor -- delete channels", query);
324 
325  removeChild(transport);
326  // m_list.removeAll(transport);
327  // Following for QT 5.3 which does not have the removeAll
328  // method in QVector
329  int ix;
330  do
331  {
332  ix = m_list.indexOf(transport);
333  if (ix != -1)
334  m_list.remove(ix);
335  } while (ix != -1);
336  },
337  true);
338 }
339 
341 {
342  if (m_isLoading)
343  return;
344 
345  MythMenu *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  MythDialogBox *menuPopup = new MythDialogBox(menu, popupStack,
351  "menudialog");
352  menuPopup->SetReturnEvent(this, "transportmenu");
353 
354  if (menuPopup->Create())
355  popupStack->AddScreen(menuPopup);
356  else
357  delete menuPopup;
358 }
359 
361 {
362  protected:
363  MuxDBStorage(StorageUser *_setting, const MultiplexID *_id, const QString& _name) :
364  SimpleDBStorage(_setting, "dtv_multiplex", _name), mplexid(_id)
365  {
366  }
367 
368  QString GetSetClause(MSqlBindings &bindings) const override; // SimpleDBStorage
369  QString GetWhereClause(MSqlBindings &bindings) const override; // SimpleDBStorage
370 
372 };
373 
375 {
376  QString muxTag = ":WHERE" + mplexid->GetColumnName().toUpper();
377 
378  bindings.insert(muxTag, mplexid->getValue());
379 
380  // return query
381  return mplexid->GetColumnName() + " = " + muxTag;
382 }
383 
384 QString MuxDBStorage::GetSetClause(MSqlBindings &bindings) const
385 {
386  QString muxTag = ":SET" + mplexid->GetColumnName().toUpper();
387  QString nameTag = ":SET" + GetColumnName().toUpper();
388 
389  bindings.insert(muxTag, mplexid->getValue());
390  bindings.insert(nameTag, m_user->GetDBValue());
391 
392  // return query
393  return (mplexid->GetColumnName() + " = " + muxTag + ", " +
394  GetColumnName() + " = " + nameTag);
395 }
396 
398 {
399  public:
400  VideoSourceID(const MultiplexID *id, uint _sourceid) :
401  StandardSetting(this),
402  MuxDBStorage(this, id, "sourceid")
403  {
404  setVisible(false);
405  setValue(_sourceid);
406  }
407  void edit(MythScreenType * /*screen*/) override { } // StandardSetting
408  void resultEdit(DialogCompletionEvent * /*dce*/) override { } // StandardSetting
409 };
410 
412 {
413  public:
415  bool is_dvb_country,
416  bool is_atsc_country) :
417  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "sistandard")
418  {
419  setLabel(QObject::tr("Digital TV Standard"));
420  setHelpText(QObject::tr(
421  "Guiding standard to use for making sense of the "
422  "data streams after they have been demodulated, "
423  "error corrected and demultiplexed."));
424  if (is_dvb_country)
425  addSelection(QObject::tr("DVB"), "dvb");
426 
427  if (is_atsc_country)
428  {
429  addSelection(QObject::tr("ATSC"), "atsc");
430  addSelection(QObject::tr("OpenCable"), "opencable");
431  }
432 
433  addSelection(QObject::tr("MPEG"), "mpeg");
434  };
435 };
436 
438 {
439  public:
440  Frequency(const MultiplexID *id, bool in_kHz = false) :
441  MythUITextEditSetting(this), MuxDBStorage(this, id, "frequency")
442  {
443  QString hz = (in_kHz) ? "kHz" : "Hz";
444  setLabel(QObject::tr("Frequency") + " (" + hz + ")");
445  setHelpText(QObject::tr(
446  "Frequency (Option has no default).\n"
447  "The frequency for this channel in") + " " + hz + ".");
448  };
449 };
450 
452 {
453  public:
454  explicit DVBSymbolRate(const MultiplexID *id) :
455  MythUIComboBoxSetting(this, true), MuxDBStorage(this, id, "symbolrate")
456  {
457  setLabel(QObject::tr("Symbol Rate"));
458  setHelpText(
459  QObject::tr(
460  "Symbol Rate (symbols/sec).\n"
461  "Most DVB-S transponders transmit at 27.5 "
462  "million symbols per second."));
463  addSelection("3333000");
464  addSelection("22000000");
465  addSelection("22500000");
466  addSelection("23000000");
467  addSelection("27500000", "27500000", true);
468  addSelection("28000000");
469  addSelection("28500000");
470  addSelection("29500000");
471  addSelection("29700000");
472  addSelection("29900000");
473  };
474 };
475 
477 {
478  public:
479  explicit SignalPolarity(const MultiplexID *id) :
480  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "polarity")
481  {
482  setLabel(QObject::tr("Polarity"));
483  setHelpText(QObject::tr("Polarity (Option has no default)"));
484  addSelection(QObject::tr("Horizontal"), "h");
485  addSelection(QObject::tr("Vertical"), "v");
486  addSelection(QObject::tr("Right Circular"), "r");
487  addSelection(QObject::tr("Left Circular"), "l");
488  };
489 };
490 
492 {
493  public:
494  Modulation(const MultiplexID *id, uint nType);
495 };
496 
498  MythUIComboBoxSetting(this),
499  MuxDBStorage(this, id, ((CardUtil::OFDM == nType) ||
500  (CardUtil::DVBT2 == nType)) ?
501  "constellation" : "modulation")
502 {
503  setLabel(QObject::tr("Modulation"));
504  setHelpText(QObject::tr("Modulation, aka Constellation"));
505 
506  if (CardUtil::QPSK == nType)
507  {
508  // no modulation options
509  setVisible(false);
510  }
511  else if (CardUtil::DVBS2 == nType)
512  {
513  addSelection("QPSK", "qpsk");
514  addSelection("8PSK", "8psk");
515  addSelection("16APSK", "16apsk");
516  addSelection("32APSK", "32apsk");
517  }
518  else if ((CardUtil::QAM == nType) || (CardUtil::OFDM == nType) ||
519  (CardUtil::DVBT2 == nType))
520  {
521  addSelection(QObject::tr("QAM Auto"), "auto");
522  addSelection("QAM-16", "qam_16");
523  addSelection("QAM-32", "qam_32");
524  addSelection("QAM-64", "qam_64");
525  addSelection("QAM-128", "qam_128");
526  addSelection("QAM-256", "qam_256");
527 
528  if ((CardUtil::OFDM == nType) || (CardUtil::DVBT2 == nType))
529  {
530  addSelection("QPSK", "qpsk");
531  }
532  }
533  else if ((CardUtil::ATSC == nType) ||
534  (CardUtil::HDHOMERUN == nType))
535  {
536  addSelection("8-VSB", "8vsb");
537  addSelection("QAM-64", "qam_64");
538  addSelection("QAM-256", "qam_256");
539  }
540  else
541  {
542  addSelection(QObject::tr("Analog"), "analog");
543  setVisible(false);
544  }
545 };
546 
548 {
549  public:
550  explicit DVBInversion(const MultiplexID *id) :
551  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "inversion")
552  {
553  setLabel(QObject::tr("Inversion"));
554  setHelpText(QObject::tr("Inversion (Default: Auto):\n"
555  "Most cards can autodetect this now, so leave it at Auto"
556  " unless it won't work."));
557  addSelection(QObject::tr("Auto"), "a");
558  addSelection(QObject::tr("On"), "1");
559  addSelection(QObject::tr("Off"), "0");
560  };
561 };
562 
564 {
565  public:
566  explicit DVBTBandwidth(const MultiplexID *id) :
567  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "bandwidth")
568  {
569  setLabel(QObject::tr("Bandwidth"));
570  setHelpText(QObject::tr("Bandwidth (Default: Auto)"));
571  addSelection(QObject::tr("Auto"), "a");
572  addSelection(QObject::tr("6 MHz"), "6");
573  addSelection(QObject::tr("7 MHz"), "7");
574  addSelection(QObject::tr("8 MHz"), "8");
575  };
576 };
577 
579 {
580  public:
582  MythUIComboBoxSetting(_storage)
583  {
584  addSelection(QObject::tr("Auto"), "auto");
585  addSelection(QObject::tr("None"), "none");
586  addSelection("1/2");
587  addSelection("2/3");
588  addSelection("3/4");
589  addSelection("4/5");
590  addSelection("5/6");
591  addSelection("6/7");
592  addSelection("7/8");
593  addSelection("8/9");
594  };
595 };
596 
599 {
600  public:
603  MuxDBStorage(this, id, "fec")
604  {
605  setLabel(QObject::tr("FEC"));
606  setHelpText(QObject::tr("Forward Error Correction (Default: Auto)"));
607  };
608 };
609 
612 {
613  public:
614  explicit DVBTCoderateLP(const MultiplexID *id) :
616  MuxDBStorage(this, id, "lp_code_rate")
617  {
618  setLabel(QObject::tr("LP Coderate"));
619  setHelpText(QObject::tr("Low Priority Code Rate (Default: Auto)"));
620  };
621 };
622 
625 {
626  public:
627  explicit DVBTCoderateHP(const MultiplexID *id) :
629  MuxDBStorage(this, id, "hp_code_rate")
630  {
631  setLabel(QObject::tr("HP Coderate"));
632  setHelpText(QObject::tr("High Priority Code Rate (Default: Auto)"));
633  };
634 };
635 
637 {
638  public:
639  explicit DVBTGuardInterval(const MultiplexID *id) :
640  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "guard_interval")
641  {
642  setLabel(QObject::tr("Guard Interval"));
643  setHelpText(QObject::tr("Guard Interval (Default: Auto)"));
644  addSelection(QObject::tr("Auto"), "auto");
645  addSelection("1/4");
646  addSelection("1/8");
647  addSelection("1/16");
648  addSelection("1/32");
649  };
650 };
651 
653 {
654  public:
655  explicit DVBTTransmissionMode(const MultiplexID *id) :
656  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "transmission_mode")
657  {
658  setLabel(QObject::tr("Trans. Mode"));
659  setHelpText(QObject::tr("Transmission Mode (Default: Auto)"));
660  addSelection(QObject::tr("Auto"), "a");
661  addSelection("2K", "2");
662  addSelection("8K", "8");
663  };
664 };
665 
667 {
668  public:
669  explicit DVBTHierarchy(const MultiplexID *id) :
670  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "hierarchy")
671  {
672  setLabel(QObject::tr("Hierarchy"));
673  setHelpText(QObject::tr("Hierarchy (Default: Auto)"));
674  addSelection(QObject::tr("Auto"), "a");
675  addSelection(QObject::tr("None"), "n");
676  addSelection("1");
677  addSelection("2");
678  addSelection("4");
679  }
680 };
681 
683 {
684  public:
685  explicit DVBTModulationSystem(const MultiplexID *id) :
686  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "mod_sys")
687  {
688  setLabel(QObject::tr("Modulation System"));
689  setHelpText(QObject::tr("Modulation System (Default: DVB-T)"));
690  addSelection(QObject::tr("DVB-T"), "DVB-T");
691  addSelection(QObject::tr("DVB-T2"), "DVB-T2");
692  };
693 };
694 
696 {
697  public:
698  explicit DVBSModulationSystem(const MultiplexID *id) :
699  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "mod_sys")
700  {
701  setLabel(QObject::tr("Modulation System"));
702  setHelpText(QObject::tr("Modulation System (Default: DVB-S)"));
703  addSelection(QObject::tr("DVB-S"), "DVB-S");
704  addSelection(QObject::tr("DVB-S2"), "DVB-S2");
705  }
706 };
707 
709 {
710  public:
711  explicit RollOff(const MultiplexID *id) :
712  MythUIComboBoxSetting(this), MuxDBStorage(this, id, "rolloff")
713  {
714  setLabel(QObject::tr("Roll-off"));
715  setHelpText(QObject::tr("Roll-off factor (Default: 0.35)"));
716  addSelection("0.35");
717  addSelection("0.20");
718  addSelection("0.25");
719  addSelection(QObject::tr("Auto"), "auto");
720  }
721 };
722 
723 TransportSetting::TransportSetting(const QString &label, uint mplexid,
724  uint sourceid, uint cardtype)
725  : m_mplexid(new MultiplexID())
726 {
727  setLabel(label);
728 
729  // Must be first.
730  m_mplexid->setValue(mplexid);
732  addChild(new VideoSourceID(m_mplexid, sourceid));
733 
734  if (CardUtil::OFDM == cardtype)
735  {
736  addChild(new DTVStandard(m_mplexid, true, false));
740  addChild(new Modulation(m_mplexid, cardtype));
741 
747  }
748  else if (CardUtil::DVBT2 == cardtype)
749  {
750  addChild(new DTVStandard(m_mplexid, true, false));
754  addChild(new Modulation(m_mplexid, cardtype));
756 
762  }
763  else if (CardUtil::QPSK == cardtype ||
764  CardUtil::DVBS2 == cardtype)
765  {
766  addChild(new DTVStandard(m_mplexid, true, false));
767  addChild(new Frequency(m_mplexid, true));
769 
771  addChild(new Modulation(m_mplexid, cardtype));
775 
776  if (CardUtil::DVBS2 == cardtype)
777  addChild(new RollOff(m_mplexid));
778  }
779  else if (CardUtil::QAM == cardtype)
780  {
781  addChild(new DTVStandard(m_mplexid, true, false));
784 
785  addChild(new Modulation(m_mplexid, cardtype));
788  }
789  else if (CardUtil::ATSC == cardtype ||
790  CardUtil::HDHOMERUN == cardtype)
791  {
792  addChild(new DTVStandard(m_mplexid, false, true));
794  addChild(new Modulation(m_mplexid, cardtype));
795  }
796  else if ((CardUtil::FIREWIRE == cardtype) ||
797  (CardUtil::FREEBOX == cardtype))
798  {
799  addChild(new DTVStandard(m_mplexid, true, true));
800  }
801  else if ((CardUtil::V4L == cardtype) ||
802  (CardUtil::MPEG == cardtype))
803  {
805  addChild(new Modulation(m_mplexid, cardtype));
806  }
807 }
808 
809 bool TransportSetting::keyPressEvent(QKeyEvent *event)
810 {
811  QStringList actions;
812  bool handled =
813  GetMythMainWindow()->TranslateKeyPress("Global", event, actions);
814 
815  for (int i = 0; i < actions.size() && !handled; i++)
816  {
817  QString action = actions[i];
818 
819  if (action == "DELETE")
820  {
821  handled = true;
822  emit deletePressed();
823  }
824  else if (action == "MENU")
825  {
826  handled = true;
827  emit openMenu();
828  }
829  }
830 
831  return handled;
832 }
833 
835 {
836  return m_mplexid->getValue().toUInt();
837 }
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:901
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)
DVBForwardErrorCorrection(const MultiplexID *id)
MythScreenStack * GetStack(const QString &stackname)
bool keyPressEvent(QKeyEvent *event) override
unsigned int uint
Definition: compat.h:140
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)
VideoSourceID(const MultiplexID *id, uint _sourceid)
VERBOSE_PREAMBLE false
Definition: verbosedefs.h:85
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)
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)
VideoSourceSelector * m_videosource
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
void SetReturnEvent(QObject *retobject, const QString &resultid)
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)
QMap< QString, QVariant > MSqlBindings
typedef for a map of string -> string bindings for generic queries.
Definition: mythdbcon.h:98
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
Definition: mythdbcon.cpp:603
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.
const MultiplexID * mplexid
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
bool Create(void) override
DVBSymbolRate(const MultiplexID *id)
DVBTCoderateLP(const MultiplexID *id)
void valueChanged(const QString &)