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