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
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
58static 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);
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
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
115 {
120 }
121#if CONFIG_SATIP
122 if (nType == CardUtil::INPUT_TYPES::SATIP)
123 {
124 QString deviceid = CardUtil::GetVideoDevice(cardid);
125 nType = SatIP::toDVBInputType(deviceid);
126 }
127#endif // CONFIG_SATIP
128
129 if ((CardUtil::INPUT_TYPES::ERROR_OPEN == nType) ||
132 {
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
140 }
141
142 cardtypes.push_back(nType);
143 }
144
145 // This should never happen... (unless DB has changed under us)
146 if (cardtypes.empty())
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::INPUT_TYPES::MPEG == typeA) ? CardUtil::INPUT_TYPES::V4L : typeA;
158 typeB = (CardUtil::INPUT_TYPES::MPEG == typeB) ? CardUtil::INPUT_TYPES::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::INPUT_TYPES::HDHOMERUN == typeA) ? typeB : typeA;
164 typeB = (CardUtil::INPUT_TYPES::HDHOMERUN == typeB) ? typeA : typeB;
165
166 if (typeA == typeB)
167 continue;
168
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
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::INPUT_TYPES::DVBS ) ||
183 (cardtypes[i] == CardUtil::INPUT_TYPES::DVBC ) ||
184 (cardtypes[i] == CardUtil::INPUT_TYPES::DVBT ) ||
185 (cardtypes[i] == CardUtil::INPUT_TYPES::ATSC ) ||
186 (cardtypes[i] == CardUtil::INPUT_TYPES::DVBS2) ||
187 (cardtypes[i] == CardUtil::INPUT_TYPES::DVBT2) )
188 {
189 retval = cardtypes[i];
190 }
191 }
192
193 return retval;
194}
195
197{
198 for (auto *setting : std::as_const(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);
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
234void 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 {
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::INPUT_TYPES::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";
292 hz = "kHz";
293
294 QString type = "";
296 type = "(DVB-T)";
298 type = QString("(%1)").arg(query.value(7).toString());
300 type = "(DVB-S)";
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
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
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
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"));
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"));
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:
545};
546
549 MuxDBStorage(this, id, ((CardUtil::INPUT_TYPES::OFDM == nType) ||
550 (CardUtil::INPUT_TYPES::DVBT2 == nType)) ?
551 "constellation" : "modulation")
552{
553 setLabel(QObject::tr("Modulation"));
554 setHelpText(QObject::tr("Modulation, aka Constellation"));
555
556 if (CardUtil::INPUT_TYPES::QPSK == nType)
557 {
558 // no modulation options
559 setVisible(false);
560 }
561 else if (CardUtil::INPUT_TYPES::DVBS2 == nType)
562 {
563 addSelection("QPSK", "qpsk");
564 addSelection("8PSK", "8psk");
565 addSelection("16APSK", "16apsk");
566 addSelection("32APSK", "32apsk");
567 }
568 else if ((CardUtil::INPUT_TYPES::QAM == nType) ||
569 (CardUtil::INPUT_TYPES::OFDM == nType) ||
571 {
572 addSelection(QObject::tr("QAM Auto"), "auto");
573 addSelection("QAM-16", "qam_16");
574 addSelection("QAM-32", "qam_32");
575 addSelection("QAM-64", "qam_64");
576 addSelection("QAM-128", "qam_128");
577 addSelection("QAM-256", "qam_256");
578
579 if ((CardUtil::INPUT_TYPES::OFDM == nType) ||
581 {
582 addSelection("QPSK", "qpsk");
583 }
584 }
585 else if ((CardUtil::INPUT_TYPES::ATSC == nType) ||
587 {
588 addSelection("8-VSB", "8vsb");
589 addSelection("QAM-64", "qam_64");
590 addSelection("QAM-256", "qam_256");
591 }
592 else
593 {
594 addSelection(QObject::tr("Analog"), "analog");
595 setVisible(false);
596 }
597};
598
600{
601 public:
602 explicit DVBInversion(const MultiplexID *id) :
603 MythUIComboBoxSetting(this), MuxDBStorage(this, id, "inversion")
604 {
605 setLabel(QObject::tr("Inversion"));
606 setHelpText(QObject::tr("Inversion (Default: Auto):\n"
607 "Most cards can autodetect this now, so leave it at Auto"
608 " unless it won't work."));
609 addSelection(QObject::tr("Auto"), "a");
610 addSelection(QObject::tr("On"), "1");
611 addSelection(QObject::tr("Off"), "0");
612 };
613};
614
616{
617 public:
618 explicit DVBTBandwidth(const MultiplexID *id) :
619 MythUIComboBoxSetting(this), MuxDBStorage(this, id, "bandwidth")
620 {
621 setLabel(QObject::tr("Bandwidth"));
622 setHelpText(QObject::tr("Bandwidth (Default: Auto)"));
623 addSelection(QObject::tr("Auto"), "a");
624 addSelection(QObject::tr("6 MHz"), "6");
625 addSelection(QObject::tr("7 MHz"), "7");
626 addSelection(QObject::tr("8 MHz"), "8");
627 };
628};
629
631{
632 public:
633 explicit DVBT2Bandwidth(const MultiplexID *id) :
634 MythUIComboBoxSetting(this), MuxDBStorage(this, id, "bandwidth")
635 {
636 setLabel(QObject::tr("Bandwidth"));
637 setHelpText(QObject::tr("Bandwidth for DVB-T2 (Default: Auto)"));
638 addSelection(QObject::tr("Auto"), "a");
639 addSelection(QObject::tr("5 MHz"), "5");
640 addSelection(QObject::tr("6 MHz"), "6");
641 addSelection(QObject::tr("7 MHz"), "7");
642 addSelection(QObject::tr("8 MHz"), "8");
643 // addSelection(QObject::tr("10 MHz"), "10");
644 // addSelection(QObject::tr("1.712 MHz"), "1712");
645 };
646};
647
649{
650 public:
652 MythUIComboBoxSetting(_storage)
653 {
654 addSelection(QObject::tr("Auto"), "auto");
655 addSelection(QObject::tr("None"), "none");
656 addSelection("1/2");
657 addSelection("2/3");
658 addSelection("3/4");
659 addSelection("3/5");
660 addSelection("4/5");
661 addSelection("5/6");
662 addSelection("6/7");
663 addSelection("7/8");
664 addSelection("8/9");
665 addSelection("9/10");
666 };
667};
668
671{
672 public:
675 MuxDBStorage(this, id, "fec")
676 {
677 setLabel(QObject::tr("FEC"));
678 setHelpText(QObject::tr("Forward Error Correction (Default: Auto)"));
679 };
680};
681
684{
685 public:
686 explicit DVBTCoderateLP(const MultiplexID *id) :
688 MuxDBStorage(this, id, "lp_code_rate")
689 {
690 setLabel(QObject::tr("LP Coderate"));
691 setHelpText(QObject::tr("Low Priority Code Rate (Default: Auto)"));
692 };
693};
694
697{
698 public:
699 explicit DVBTCoderateHP(const MultiplexID *id) :
701 MuxDBStorage(this, id, "hp_code_rate")
702 {
703 setLabel(QObject::tr("HP Coderate"));
704 setHelpText(QObject::tr("High Priority Code Rate (Default: Auto)"));
705 };
706};
707
709{
710 public:
711 explicit DVBTGuardInterval(const MultiplexID *id) :
712 MythUIComboBoxSetting(this), MuxDBStorage(this, id, "guard_interval")
713 {
714 setLabel(QObject::tr("Guard Interval"));
715 setHelpText(QObject::tr("Guard Interval for DVB-T (Default: Auto)"));
716 addSelection(QObject::tr("Auto"), "auto");
717 addSelection("1/4");
718 addSelection("1/8");
719 addSelection("1/16");
720 addSelection("1/32");
721 };
722};
723
725{
726 public:
727 explicit DVBT2GuardInterval(const MultiplexID *id) :
728 MythUIComboBoxSetting(this), MuxDBStorage(this, id, "guard_interval")
729 {
730 setLabel(QObject::tr("Guard Interval"));
731 setHelpText(QObject::tr("Guard Interval for DVB-T2 (Default: Auto)"));
732 addSelection(QObject::tr("Auto"), "auto");
733 addSelection("1/4");
734 addSelection("1/8");
735 addSelection("1/16");
736 addSelection("1/32");
737 addSelection("1/128");
738 addSelection("19/128");
739 addSelection("19/256");
740 };
741};
742
744{
745 public:
746 explicit DVBTTransmissionMode(const MultiplexID *id) :
747 MythUIComboBoxSetting(this), MuxDBStorage(this, id, "transmission_mode")
748 {
749 setLabel(QObject::tr("Transmission Mode"));
750 setHelpText(QObject::tr("Transmission Mode for DVB-T (Default: Auto)"));
751 addSelection(QObject::tr("Auto"), "a");
752 addSelection("2K", "2");
753 addSelection("8K", "8");
754 };
755};
756
757// The 16k and 32k modes do require a database schema update because
758// field dtv_multiplex:transmission_mode is now only one character.
759//
761{
762 public:
763 explicit DVBT2TransmissionMode(const MultiplexID *id) :
764 MythUIComboBoxSetting(this), MuxDBStorage(this, id, "transmission_mode")
765 {
766 setLabel(QObject::tr("Transmission Mode"));
767 setHelpText(QObject::tr("Transmission Mode for DVB-T2 (Default: Auto)"));
768 addSelection(QObject::tr("Auto"), "a");
769 addSelection("1K", "1");
770 addSelection("2K", "2");
771 addSelection("4K", "4");
772 addSelection("8K", "8");
773 // addSelection("16K", "16");
774 // addSelection("32K", "32");
775 };
776};
777
779{
780 public:
781 explicit DVBTHierarchy(const MultiplexID *id) :
782 MythUIComboBoxSetting(this), MuxDBStorage(this, id, "hierarchy")
783 {
784 setLabel(QObject::tr("Hierarchy"));
785 setHelpText(QObject::tr("Hierarchy (Default: Auto)"));
786 addSelection(QObject::tr("Auto"), "a");
787 addSelection(QObject::tr("None"), "n");
788 addSelection("1");
789 addSelection("2");
790 addSelection("4");
791 }
792};
793
795{
796 public:
797 explicit DVBTModulationSystem(const MultiplexID *id) :
798 MythUIComboBoxSetting(this), MuxDBStorage(this, id, "mod_sys")
799 {
800 setLabel(QObject::tr("Modulation System"));
801 setHelpText(QObject::tr("Modulation System (Default: DVB-T2)"));
802 addSelection("DVB-T", "DVB-T");
803 addSelection("DVB-T2", "DVB-T2", true);
804 };
805};
806
808{
809 public:
810 explicit DVBSModulationSystem(const MultiplexID *id) :
811 MythUIComboBoxSetting(this), MuxDBStorage(this, id, "mod_sys")
812 {
813 setLabel(QObject::tr("Modulation System"));
814 setHelpText(QObject::tr("Modulation System (Default: DVB-S2)"));
815 addSelection("DVB-S", "DVB-S");
816 addSelection("DVB-S2", "DVB-S2", true);
817 }
818};
819
821{
822 public:
823 explicit DVBCModulationSystem(const MultiplexID *id) :
824 MythUIComboBoxSetting(this), MuxDBStorage(this, id, "mod_sys")
825 {
826 setLabel(QObject::tr("Modulation System"));
827 setHelpText(QObject::tr("Modulation System (Default: DVB-C/A)"));
828 addSelection("DVB-C/A", "DVB-C/A", true);
829 addSelection("DVB-C/B", "DVB-C/B");
830 addSelection("DVB-C/C", "DVB-C/C");
831 }
832};
833
835{
836 public:
837 explicit RollOff(const MultiplexID *id) :
838 MythUIComboBoxSetting(this), MuxDBStorage(this, id, "rolloff")
839 {
840 setLabel(QObject::tr("Roll-off"));
841 setHelpText(QObject::tr("Roll-off factor (Default: 0.35)"));
842 addSelection("0.35");
843 addSelection("0.20");
844 addSelection("0.25");
845 addSelection(QObject::tr("Auto"), "auto");
846 }
847};
848
849TransportSetting::TransportSetting(const QString &label, uint mplexid,
850 uint sourceid, CardUtil::INPUT_TYPES cardtype)
851 : m_mplexid(new MultiplexID())
852{
853 setLabel(label);
854
855 // Must be first.
856 m_mplexid->setValue(mplexid);
858 addChild(new VideoSourceID(m_mplexid, sourceid));
859
860 if (CardUtil::INPUT_TYPES::OFDM == cardtype)
861 {
862 addChild(new DTVStandard(m_mplexid, true, false));
866 addChild(new Modulation(m_mplexid, cardtype));
867
873 }
874 else if (CardUtil::INPUT_TYPES::DVBT2 == cardtype)
875 {
876 addChild(new DTVStandard(m_mplexid, true, false));
880 addChild(new Modulation(m_mplexid, cardtype));
882
888 }
889 else if (CardUtil::INPUT_TYPES::QPSK == cardtype ||
891 {
892 addChild(new DTVStandard(m_mplexid, true, false));
893 addChild(new Frequency(m_mplexid, true));
896 addChild(new Modulation(m_mplexid, cardtype));
900
901 if (CardUtil::INPUT_TYPES::DVBS2 == cardtype)
903 }
904 else if (CardUtil::INPUT_TYPES::QAM == cardtype)
905 {
906 addChild(new DTVStandard(m_mplexid, true, false));
909 addChild(new Modulation(m_mplexid, cardtype));
913 }
914 else if (CardUtil::INPUT_TYPES::ATSC == cardtype ||
916 {
917 addChild(new DTVStandard(m_mplexid, false, true));
919 addChild(new Modulation(m_mplexid, cardtype));
920 }
921 else if ((CardUtil::INPUT_TYPES::FIREWIRE == cardtype) ||
922 (CardUtil::INPUT_TYPES::FREEBOX == cardtype))
923 {
924 addChild(new DTVStandard(m_mplexid, true, true));
925 }
926 else if ((CardUtil::INPUT_TYPES::V4L == cardtype) ||
927 (CardUtil::INPUT_TYPES::MPEG == cardtype))
928 {
930 addChild(new Modulation(m_mplexid, cardtype));
931 }
932}
933
935{
936 QStringList actions;
937 bool handled =
938 GetMythMainWindow()->TranslateKeyPress("Global", event, actions);
939
940 for (int i = 0; i < actions.size() && !handled; i++)
941 {
942 const QString& action = actions[i];
943
944 if (action == "DELETE")
945 {
946 handled = true;
947 emit deletePressed();
948 }
949 else if (action == "MENU")
950 {
951 handled = true;
952 emit openMenu();
953 }
954 }
955
956 return handled;
957}
958
960{
961 return m_mplexid->getValue().toUInt();
962}
Collection of helper utilities for input DB use.
Definition: cardutil.h:42
static INPUT_TYPES toInputType(const QString &name)
Definition: cardutil.h:78
static QString GetRawInputType(uint inputid)
Definition: cardutil.h:292
static bool HDHRdoesDVB(const QString &device)
If the device is valid, check if the model does DVB.
Definition: cardutil.cpp:3080
INPUT_TYPES
all the different inputs
Definition: cardutil.h:50
static QString GetVideoDevice(uint inputid)
Definition: cardutil.h:294
static bool HDHRdoesDVBC(const QString &device)
If the device is valid, check if the model does DVB-C.
Definition: cardutil.cpp:3106
static QString ProbeSubTypeName(uint inputid)
Definition: cardutil.cpp:983
QString GetColumnName(void) const
Definition: mythstorage.h:47
StorageUser * m_user
Definition: mythstorage.h:50
DTVStandard(const MultiplexID *id, bool is_dvb_country, bool is_atsc_country)
DVBCModulationSystem(const MultiplexID *id)
DVBCSymbolRate(const MultiplexID *id)
DVBForwardErrorCorrectionSelector(Storage *_storage)
DVBForwardErrorCorrection(const MultiplexID *id)
DVBInversion(const MultiplexID *id)
DVBSModulationSystem(const MultiplexID *id)
DVBSSymbolRate(const MultiplexID *id)
DVBT2Bandwidth(const MultiplexID *id)
DVBT2GuardInterval(const MultiplexID *id)
DVBT2TransmissionMode(const MultiplexID *id)
DVBTBandwidth(const MultiplexID *id)
DVBTCoderateHP(const MultiplexID *id)
DVBTCoderateLP(const MultiplexID *id)
DVBTGuardInterval(const MultiplexID *id)
DVBTHierarchy(const MultiplexID *id)
DVBTModulationSystem(const MultiplexID *id)
DVBTTransmissionMode(const MultiplexID *id)
Event dispatched from MythUI modal dialogs to a listening class containing a result of some form.
Definition: mythdialogbox.h:41
Frequency(const MultiplexID *id, bool in_kHz=false)
QSqlQuery wrapper that fetches a DB connection from the connection pool.
Definition: mythdbcon.h:128
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
Definition: mythdbcon.cpp:837
QVariant value(int i) const
Definition: mythdbcon.h:204
bool isActive(void) const
Definition: mythdbcon.h:215
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
Definition: mythdbcon.cpp:618
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
Definition: mythdbcon.cpp:888
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
Definition: mythdbcon.cpp:812
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
Definition: mythdbcon.cpp:550
Modulation(const MultiplexID *id, CardUtil::INPUT_TYPES nType)
QString GetColumnName(void) const
QString GetSetClause(MSqlBindings &bindings) const override
const MultiplexID * m_mplexId
MuxDBStorage(StorageUser *_setting, const MultiplexID *_id, const QString &_name)
QString GetWhereClause(MSqlBindings &bindings) const override
QString GetHostName(void)
static void DBError(const QString &where, const MSqlQuery &query)
Definition: mythdb.cpp:226
Basic menu dialog, message and a list of options.
bool TranslateKeyPress(const QString &Context, QKeyEvent *Event, QStringList &Actions, bool AllowJumps=true)
Get a list of actions for a keypress in the given context.
MythScreenStack * GetStack(const QString &Stackname)
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
Screen in which all other widgets are contained and rendered.
void addSelection(const QString &label, QString value=QString(), bool select=false)
RollOff(const MultiplexID *id)
static CardUtil::INPUT_TYPES toDVBInputType(const QString &deviceid)
Definition: satiputils.cpp:172
SignalPolarity(const MultiplexID *id)
static uint GetSourceID(const QString &name)
Definition: sourceutil.cpp:70
virtual void addChild(StandardSetting *child)
virtual void Load(void)
virtual void setName(const QString &name)
void settingsChanged(StandardSetting *selectedSetting=nullptr)
virtual void setHelpText(const QString &str)
virtual void removeChild(StandardSetting *child)
void setVisible(bool visible)
virtual void setValue(const QString &newValue)
void valueChanged(const QString &newValue)
virtual QString getValue(void) const
virtual void setLabel(QString str)
virtual QString GetDBValue(void) const =0
CardUtil::INPUT_TYPES m_cardtype
void Load(void) override
void SetSourceID(uint sourceid)
QVector< StandardSetting * > m_list
TransportListEditor(uint initial_sourceid)
void Delete(TransportSetting *transport)
void Menu(TransportSetting *transport)
VideoSourceShow * m_videosource
MultiplexID * m_mplexid
bool keyPressEvent(QKeyEvent *event) override
TransportSetting(const QString &label, uint mplexid, uint sourceid, CardUtil::INPUT_TYPES cardtype)
uint getMplexId() const
void resultEdit(DialogCompletionEvent *) override
void edit(MythScreenType *) override
VideoSourceID(const MultiplexID *id, uint _sourceid)
unsigned int uint
Definition: compat.h:68
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
QMap< QString, QVariant > MSqlBindings
typedef for a map of string -> string bindings for generic queries.
Definition: mythdbcon.h:100
MythConfirmationDialog * ShowOkPopup(const QString &message, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
MythMainWindow * GetMythMainWindow(void)
static MythThemedMenu * menu
static CardUtil::INPUT_TYPES get_cardtype(uint sourceid)
static QString pp_modulation(const QString &mod)
VERBOSE_PREAMBLE Most true
Definition: verbosedefs.h:95