/
globalsettings.cpp
4974 lines (4325 loc) · 171 KB
/
globalsettings.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// -*- Mode: c++ -*-
// Standard UNIX C headers
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
// Qt headers
#include <QApplication>
#include <QEvent>
#include <qnamespace.h>
#include <QFile>
#include <QDialog>
#include <QCursor>
#include <QDir>
#include <QImage>
#include <QTextCodec>
// MythTV headers
#include "mythconfig.h"
#include "mythcontext.h"
#include "mythdbcon.h"
#include "mythverbose.h"
#include "dbsettings.h"
#include "langsettings.h"
#include "libmythtv/mpeg/iso639.h"
#include "playbackbox.h"
#include "globalsettings.h"
#include "libmythtv/recordingprofile.h"
#include "mythxdisplay.h"
#include "DisplayRes.h"
#include "uitypes.h"
#include "libmythtv/cardutil.h"
#include "themeinfo.h"
#include "mythconfig.h"
#include "mythdirs.h"
#include "mythuihelper.h"
static HostComboBox *AudioOutputDevice()
{
HostComboBox *gc = new HostComboBox("AudioOutputDevice", true);
gc->setLabel(QObject::tr("Audio output device"));
#ifdef USING_ALSA
gc->addSelection("ALSA:default", "ALSA:default");
gc->addSelection("ALSA:spdif", "ALSA:spdif");
gc->addSelection("ALSA:surround51", "ALSA:surround51");
gc->addSelection("ALSA:analog", "ALSA:analog");
gc->addSelection("ALSA:digital", "ALSA:digital");
gc->addSelection("ALSA:mixed-analog", "ALSA:mixed-analog");
gc->addSelection("ALSA:mixed-digital", "ALSA:mixed-digital");
gc->addSelection("ALSA:hdmi", "ALSA:hdmi");
gc->addSelection("ALSA:plughw:0,3", "ALSA:plughw:0,3");
#endif
#ifdef USING_OSS
QDir dev("/dev", "dsp*", QDir::Name, QDir::System);
gc->fillSelectionsFromDir(dev);
dev.setNameFilters(QStringList("adsp*"));
gc->fillSelectionsFromDir(dev);
dev.setPath("/dev/sound");
if (dev.exists())
{
dev.setNameFilters(QStringList("dsp*"));
gc->fillSelectionsFromDir(dev);
dev.setNameFilters(QStringList("adsp*"));
gc->fillSelectionsFromDir(dev);
}
#endif
#ifdef USING_ARTS
gc->addSelection("ARTS:", "ARTS:");
#endif
#ifdef USING_JACK
gc->addSelection("JACK:output", "JACK:output");
#endif
#ifdef USING_COREAUDIO
gc->addSelection("CoreAudio:", "CoreAudio:");
#endif
#ifdef USING_MINGW
gc->addSelection("Windows:");
gc->addSelection("DirectX:");
#endif
gc->addSelection("NULL", "NULL");
return gc;
}
static HostComboBox *MaxAudioChannels()
{
HostComboBox *gc = new HostComboBox("MaxChannels",false);
gc->setLabel(QObject::tr("Speakers configuration"));
gc->addSelection(QObject::tr("Stereo"), "2", true); // default
gc->addSelection(QObject::tr("5.1"), "6");
gc->setHelpText(
QObject::tr(
"Set your audio configuration: Stereo or Surround."));
return gc;
}
static HostCheckBox *AudioUpmix()
{
HostCheckBox *gc = new HostCheckBox("AudioDefaultUpmix");
gc->setLabel(QObject::tr("Upconvert stereo to 5.1 surround"));
gc->setValue(true);
gc->setHelpText(QObject::tr("MythTV can upconvert stereo to 5.1 audio. "
"Set this option to enable it by default. "
"You can enable or disable the upconversion during playback at anytime."));
return gc;
}
static HostComboBox *AudioUpmixType()
{
HostComboBox *gc = new HostComboBox("AudioUpmixType",false);
gc->setLabel(QObject::tr("Upmix"));
gc->addSelection(QObject::tr("Fastest"), "0", true); // default
gc->addSelection(QObject::tr("Good"), "1");
gc->addSelection(QObject::tr("Best"), "2");
gc->setHelpText(
QObject::tr(
"Set the audio surround upconversion quality. "
"'Fastest' is the least demanding on the CPU at the expense of quality."));
return gc;
}
static HostCheckBox *AdvancedAudioSettings()
{
HostCheckBox *gc = new HostCheckBox("AdvancedAudioSettings");
gc->setLabel(QObject::tr("Advanced Audio Configuration"));
gc->setValue(false);
gc->setHelpText(QObject::tr("Enable extra audio settings."));
return gc;
}
static HostCheckBox *SRCQualityOverride()
{
HostCheckBox *gc = new HostCheckBox("SRCQualityOverride");
gc->setLabel(QObject::tr("Override SRC quality"));
gc->setValue(false);
gc->setHelpText(QObject::tr("Override audio sample rate conversion quality"));
return gc;
}
static HostComboBox *SRCQuality()
{
HostComboBox *gc = new HostComboBox("SRCQuality", false);
gc->setLabel(QObject::tr("Sample Rate Conversion"));
gc->addSelection(QObject::tr("Disabled"), "-1");
gc->addSelection(QObject::tr("Fastest"), "0");
gc->addSelection(QObject::tr("Good"), "1", true); // default
gc->addSelection(QObject::tr("Best"), "2");
gc->setHelpText(QObject::tr("Set the quality of audio sample rate conversion. "
"\"Good\" (default) provides the best compromise between CPU usage "
"and quality. \"Disabled\" let the audio card handle sample rate conversion. "
"This only affects non 48kHz PCM audio."));
return gc;
}
static HostComboBox *PassThroughOutputDevice()
{
HostComboBox *gc = new HostComboBox("PassThruOutputDevice", true);
gc->setLabel(QObject::tr("Digital output device"));
gc->addSelection(QObject::tr("Default"), "Default");
#ifndef USING_MINGW
gc->addSelection("ALSA:iec958:{ AES0 0x02 }", "ALSA:iec958:{ AES0 0x02 }");
gc->addSelection("ALSA:hdmi", "ALSA:hdmi");
gc->addSelection("ALSA:plughw:0,3", "ALSA:plughw:0,3");
#endif
gc->setHelpText(QObject::tr("Audio output device to use for digital audio. Default is the same as Audio output "
"device. This value is currently only used with ALSA "
"sound output."));
return gc;
}
static HostCheckBox *MythControlsVolume()
{
HostCheckBox *gc = new HostCheckBox("MythControlsVolume");
gc->setLabel(QObject::tr("Use internal volume controls"));
gc->setValue(true);
gc->setHelpText(QObject::tr("MythTV can control the PCM and master "
"mixer volume. If you prefer to control the volume externally "
"(like your amplifier) or use an external mixer "
"program, disable this option."));
return gc;
}
static HostComboBox *MixerDevice()
{
HostComboBox *gc = new HostComboBox("MixerDevice", true);
gc->setLabel(QObject::tr("Mixer Device"));
#ifdef USING_OSS
QDir dev("/dev", "mixer*", QDir::Name, QDir::System);
gc->fillSelectionsFromDir(dev);
dev.setPath("/dev/sound");
if (dev.exists())
{
gc->fillSelectionsFromDir(dev);
}
#endif
#ifdef USING_ALSA
gc->addSelection("ALSA:default", "ALSA:default");
#endif
#ifdef USING_MINGW
gc->addSelection("DirectX:", "DirectX:");
gc->addSelection("Windows:", "Windows:");
#endif
#if !defined(USING_MINGW)
gc->addSelection("software", "software");
gc->setHelpText(QObject::tr("Setting the mixer device to \"software\" lets MythTV control "
"the volume of all audio at the expense of a slight quality loss."));
#endif
return gc;
}
static const char* MixerControlControls[] = { "PCM",
"Master" };
static HostComboBox *MixerControl()
{
HostComboBox *gc = new HostComboBox("MixerControl", true);
gc->setLabel(QObject::tr("Mixer Controls"));
for (unsigned int i = 0; i < sizeof(MixerControlControls) / sizeof(char*);
++i)
{
gc->addSelection(QObject::tr(MixerControlControls[i]),
MixerControlControls[i]);
}
gc->setHelpText(QObject::tr("Changing the volume adjusts the selected mixer."));
return gc;
}
static HostSlider *MixerVolume()
{
HostSlider *gs = new HostSlider("MasterMixerVolume", 0, 100, 1);
gs->setLabel(QObject::tr("Master Mixer Volume"));
gs->setValue(70);
gs->setHelpText(QObject::tr("Initial volume for the Master Mixer. "
"This affects all sound created by the sound card. "
"Note: Do not set this too low."));
return gs;
}
static HostSlider *PCMVolume()
{
HostSlider *gs = new HostSlider("PCMMixerVolume", 0, 100, 1);
gs->setLabel(QObject::tr("PCM Mixer Volume"));
gs->setValue(70);
gs->setHelpText(QObject::tr("Initial volume for PCM output. Using the "
"volume keys in MythTV will adjust this parameter."));
return gs;
}
static HostCheckBox *IndividualMuteControl()
{
HostCheckBox *gc = new HostCheckBox("IndividualMuteControl");
gc->setLabel(QObject::tr("Independent Muting of Left and Right Audio "
"Channels"));
gc->setValue(false);
gc->setHelpText(QObject::tr("Enable muting of just the left or right "
"channel. Useful if your broadcaster puts the "
"original language on one channel, and a dubbed "
"version of the program on the other one. This "
"modifies the behavior of the Mute key."));
return gc;
}
static HostCheckBox *AC3PassThrough()
{
HostCheckBox *gc = new HostCheckBox("AC3PassThru");
gc->setLabel(QObject::tr("Dolby Digital"));
gc->setValue(false);
gc->setHelpText(QObject::tr("Enable if your amplifier or sound decoder supports AC3/Dolby Digital. "
"You must use a digital connection. Uncheck if using an analog connection."));
return gc;
}
static HostCheckBox *DTSPassThrough()
{
HostCheckBox *gc = new HostCheckBox("DTSPassThru");
gc->setLabel(QObject::tr("DTS"));
gc->setValue(false);
gc->setHelpText(QObject::tr("Enable if your amplifier or sound decoder supports DTS. "
"You must use a digital connection. Uncheck if using an analog connection"));
return gc;
}
static HostCheckBox *AggressiveBuffer()
{
HostCheckBox *gc = new HostCheckBox("AggressiveSoundcardBuffer");
gc->setLabel(QObject::tr("Aggressive Sound card Buffering"));
gc->setValue(false);
gc->setHelpText(QObject::tr("If enabled, MythTV will pretend to have "
"a smaller sound card buffer than is really present. "
"Should be unchecked in most cases. "
"Enable only if you have playback issues."));
return gc;
}
static HostCheckBox *DecodeExtraAudio()
{
HostCheckBox *gc = new HostCheckBox("DecodeExtraAudio");
gc->setLabel(QObject::tr("Extra audio buffering"));
gc->setValue(true);
gc->setHelpText(QObject::tr("Enable this setting if MythTV is playing "
"\"crackly\" audio. This setting affects digital tuners "
"(QAM/DVB/ATSC) and hardware encoders. It will have no "
"effect on framegrabbers (MPEG-4/RTJPEG). MythTV will "
"keep extra audio data in its internal buffers to workaround "
"this bug."));
return gc;
}
static HostComboBox *PIPLocationComboBox()
{
HostComboBox *gc = new HostComboBox("PIPLocation");
gc->setLabel(QObject::tr("PIP Video Location"));
for (uint loc = 0; loc < kPIP_END; ++loc)
gc->addSelection(toString((PIPLocation) loc), QString::number(loc));
gc->setHelpText(QObject::tr("Location of PIP Video window."));
return gc;
}
static GlobalLineEdit *AllRecGroupPassword()
{
GlobalLineEdit *be = new GlobalLineEdit("AllRecGroupPassword");
be->setLabel(QObject::tr("Password required to view all recordings"));
be->setValue("");
be->setHelpText(QObject::tr("If given, a password must be entered to "
"view the complete list of all recordings."));
return be;
}
static HostComboBox *DisplayRecGroup()
{
HostComboBox *gc = new HostComboBox("DisplayRecGroup");
gc->setLabel(QObject::tr("Default group filter to apply"));
gc->addSelection(QObject::tr("All Programs"), QString("All Programs"));
gc->addSelection(QObject::tr("Default"), QString("Default"));
MSqlQuery query(MSqlQuery::InitCon());
query.prepare("SELECT DISTINCT recgroup from recorded;");
if (query.exec())
{
while (query.next())
{
if (query.value(0).toString() != "Default")
{
QString recgroup = query.value(0).toString();
gc->addSelection(recgroup, recgroup);
}
}
}
query.prepare("SELECT DISTINCT category from recorded;");
if (query.exec())
{
while (query.next())
{
QString key = query.value(0).toString();
gc->addSelection(key, key);
}
}
gc->setHelpText(QObject::tr("Default group filter to apply "
"on the View Recordings screen."));
return gc;
}
static HostCheckBox *QueryInitialFilter()
{
HostCheckBox *gc = new HostCheckBox("QueryInitialFilter");
gc->setLabel(QObject::tr("Always prompt for initial group filter"));
gc->setValue(false);
gc->setHelpText(QObject::tr("Always prompt the user for the initial filter "
"to apply when entering the Watch Recordings screen."));
return gc;
}
static HostCheckBox *RememberRecGroup()
{
HostCheckBox *gc = new HostCheckBox("RememberRecGroup");
gc->setLabel(QObject::tr("Save current group filter when changed"));
gc->setValue(true);
gc->setHelpText(QObject::tr("Remember the last selected filter "
"instead of displaying the default filter "
"whenever you enter the playback screen."));
return gc;
}
static HostCheckBox *UseGroupNameAsAllPrograms()
{
HostCheckBox *gc = new HostCheckBox("DispRecGroupAsAllProg");
gc->setLabel(QObject::tr("Show filter name instead of \"All Programs\""));
gc->setValue(false);
gc->setHelpText(QObject::tr("Use the name of the display filter currently "
"applied in place of the term \"All Programs\" in the "
"playback screen."));
return gc;
}
static HostCheckBox *PBBStartInTitle()
{
HostCheckBox *gc = new HostCheckBox("PlaybackBoxStartInTitle");
gc->setLabel(QObject::tr("Start in group list"));
gc->setValue(true);
gc->setHelpText(QObject::tr("If enabled, the focus will "
"start on the group list, otherwise the "
"focus will default to the recordings."));
return gc;
}
static HostCheckBox *PBBShowGroupSummary()
{
HostCheckBox *gc = new HostCheckBox("ShowGroupInfo");
gc->setLabel(QObject::tr("Show group summary"));
gc->setValue(false);
gc->setHelpText(QObject::tr("While selecting a group, show a group "
"summary instead of showing info about the first episode "
"in that group."));
return gc;
}
static HostCheckBox *SmartForward()
{
HostCheckBox *gc = new HostCheckBox("SmartForward");
gc->setLabel(QObject::tr("Smart Fast Forwarding"));
gc->setValue(false);
gc->setHelpText(QObject::tr("If enabled, then immediately after "
"rewinding, only skip forward the same amount as "
"skipping backwards."));
return gc;
}
static HostCheckBox *ExactSeeking()
{
HostCheckBox *gc = new HostCheckBox("ExactSeeking");
gc->setLabel(QObject::tr("Seek to exact frame"));
gc->setValue(false);
gc->setHelpText(QObject::tr("If enabled, seeking is frame exact, but "
"slower."));
return gc;
}
static GlobalComboBox *CommercialSkipMethod()
{
GlobalComboBox *bc = new GlobalComboBox("CommercialSkipMethod");
bc->setLabel(QObject::tr("Commercial Flagging Method"));
bc->setHelpText(QObject::tr(
"This determines the method used by MythTV to "
"detect when commercials start and end."));
deque<int> tmp = GetPreferredSkipTypeCombinations();
for (uint i = 0; i < tmp.size(); ++i)
bc->addSelection(SkipTypeToString(tmp[i]), QString::number(tmp[i]));
return bc;
}
static HostComboBox *AutoCommercialSkip()
{
HostComboBox *gc = new HostComboBox("AutoCommercialSkip");
gc->setLabel(QObject::tr("Automatically Skip Commercials"));
gc->addSelection(QObject::tr("Off"), "0");
gc->addSelection(QObject::tr("Notify, but do not skip"), "2");
gc->addSelection(QObject::tr("Automatically Skip"), "1");
gc->setHelpText(QObject::tr("Automatically skip commercial breaks that "
"have been flagged during Automatic Commercial Flagging "
"or by the mythcommflag program, or just notify that a "
"commercial has been detected."));
return gc;
}
static GlobalCheckBox *AutoCommercialFlag()
{
GlobalCheckBox *bc = new GlobalCheckBox("AutoCommercialFlag");
bc->setLabel(QObject::tr("Run commercial flagger"));
bc->setValue(true);
bc->setHelpText(QObject::tr("This is the default value used for the Auto-"
"Commercial Flagging setting when a new scheduled "
"recording is created."));
return bc;
}
static GlobalCheckBox *AutoTranscode()
{
GlobalCheckBox *bc = new GlobalCheckBox("AutoTranscode");
bc->setLabel(QObject::tr("Run transcoder"));
bc->setValue(false);
bc->setHelpText(QObject::tr("This is the default value used for the Auto-"
"Transcode setting when a new scheduled "
"recording is created."));
return bc;
}
static GlobalComboBox *DefaultTranscoder()
{
GlobalComboBox *bc = new GlobalComboBox("DefaultTranscoder");
bc->setLabel(QObject::tr("Default Transcoder"));
RecordingProfile::fillSelections(bc, RecordingProfile::TranscoderGroup,
true);
bc->setHelpText(QObject::tr("This is the default value used for the "
"transcoder setting when a new scheduled "
"recording is created."));
return bc;
}
static GlobalSpinBox *DeferAutoTranscodeDays()
{
GlobalSpinBox *gs = new GlobalSpinBox("DeferAutoTranscodeDays", 0, 365, 1);
gs->setLabel(QObject::tr("Deferral days for Auto-Transcode jobs"));
gs->setHelpText(QObject::tr("If non-zero, Auto-Transcode jobs will be "
"scheduled to run this many days after a recording "
"completes instead of immediately afterwards."));
gs->setValue(0);
return gs;
}
static GlobalCheckBox *AutoRunUserJob(uint job_num)
{
QString dbStr = QString("AutoRunUserJob%1").arg(job_num);
QString label = QObject::tr("Run User Job #%1")
.arg(job_num);
GlobalCheckBox *bc = new GlobalCheckBox(dbStr);
bc->setLabel(label);
bc->setValue(false);
bc->setHelpText(QObject::tr("This is the default value used for the "
"'Run %1' setting when a new scheduled "
"recording is created.")
.arg(gContext->GetSetting(QString("UserJobDesc%1")
.arg(job_num))));
return bc;
}
static GlobalCheckBox *AggressiveCommDetect()
{
GlobalCheckBox *bc = new GlobalCheckBox("AggressiveCommDetect");
bc->setLabel(QObject::tr("Strict Commercial Detection"));
bc->setValue(true);
bc->setHelpText(QObject::tr("Enable stricter Commercial Detection code. "
"Disable if some commercials are not being detected."));
return bc;
}
static GlobalCheckBox *CommSkipAllBlanks()
{
GlobalCheckBox *bc = new GlobalCheckBox("CommSkipAllBlanks");
bc->setLabel(QObject::tr("Skip blank frames after commercials"));
bc->setValue(true);
bc->setHelpText(QObject::tr("When using Blank Frame Detection and "
"Auto-Flagging, include blank frames following commercial "
"breaks as part of the commercial break."));
return bc;
}
static HostSpinBox *CommRewindAmount()
{
HostSpinBox *gs = new HostSpinBox("CommRewindAmount", 0, 10, 1);
gs->setLabel(QObject::tr("Commercial Skip Auto-Rewind Amount"));
gs->setHelpText(QObject::tr("If set, MythTV will automatically rewind "
"this many seconds after performing a commercial skip."));
gs->setValue(0);
return gs;
}
static HostSpinBox *CommNotifyAmount()
{
HostSpinBox *gs = new HostSpinBox("CommNotifyAmount", 0, 10, 1);
gs->setLabel(QObject::tr("Commercial Skip Notify Amount"));
gs->setHelpText(QObject::tr("If set, MythTV will act like a commercial "
"begins this many seconds early. This can be useful "
"when commercial notification is used in place of "
"automatic skipping."));
gs->setValue(0);
return gs;
}
static GlobalSpinBox *MaximumCommercialSkip()
{
GlobalSpinBox *bs = new GlobalSpinBox("MaximumCommercialSkip", 0, 3600, 10);
bs->setLabel(QObject::tr("Maximum commercial skip (in seconds)"));
bs->setHelpText(QObject::tr("MythTV will discourage long manual commercial "
"skips. Skips which are longer than this will require the "
"user to hit the SKIP key twice. Automatic commercial "
"skipping is not affected by this limit."));
bs->setValue(3600);
return bs;
}
static GlobalSpinBox *MergeShortCommBreaks()
{
GlobalSpinBox *bs = new GlobalSpinBox("MergeShortCommBreaks", 0, 3600, 5);
bs->setLabel(QObject::tr("Merge short commercial breaks (in seconds)"));
bs->setHelpText(QObject::tr("Treat consecutive commercial breaks shorter "
"than this as one break when skipping forward. Useful if "
"you have to skip a few times during breaks. Applies to "
"automatic skipping as well. Set to 0 to disable."));
bs->setValue(0);
return bs;
}
static GlobalSpinBox *AutoExpireExtraSpace()
{
GlobalSpinBox *bs = new GlobalSpinBox("AutoExpireExtraSpace", 0, 200, 1);
bs->setLabel(QObject::tr("Extra Disk Space"));
bs->setHelpText(QObject::tr("Extra disk space (in Gigabytes) that you want "
"to keep free on the recording file systems beyond what "
"MythTV requires."));
bs->setValue(1);
return bs;
};
static GlobalCheckBox *AutoExpireInsteadOfDelete()
{
GlobalCheckBox *cb = new GlobalCheckBox("AutoExpireInsteadOfDelete");
cb->setLabel(QObject::tr("Auto Expire Instead of Delete Recording"));
cb->setValue(false);
cb->setHelpText(QObject::tr("Instead of deleting a recording, "
"move recording to the 'Deleted' recgroup and turn on "
"autoexpire."));
return cb;
}
static GlobalSpinBox *DeletedMaxAge()
{
GlobalSpinBox *bs = new GlobalSpinBox("DeletedMaxAge", 0, 365, 1);
bs->setLabel(QObject::tr("Deleted Max Age"));
bs->setHelpText(QObject::tr("When set to a number greater than zero, "
"AutoExpire will force expiration of Deleted recordings "
"when they are this many days old."));
bs->setValue(0);
return bs;
};
static GlobalCheckBox *DeletedFifoOrder()
{
GlobalCheckBox *cb = new GlobalCheckBox("DeletedFifoOrder");
cb->setLabel(QObject::tr("Expire in deleted order"));
cb->setValue(false);
cb->setHelpText(QObject::tr(
"Expire Deleted recordings in the order which they were "
"originally deleted."));
return cb;
};
class DeletedExpireOptions : public TriggeredConfigurationGroup
{
public:
DeletedExpireOptions() :
TriggeredConfigurationGroup(false, false, false, false)
{
setLabel(QObject::tr("DeletedExpireOptions"));
Setting* enabled = AutoExpireInsteadOfDelete();
addChild(enabled);
setTrigger(enabled);
HorizontalConfigurationGroup* settings =
new HorizontalConfigurationGroup(false);
settings->addChild(DeletedFifoOrder());
settings->addChild(DeletedMaxAge());
addTarget("1", settings);
// show nothing if fillEnabled is off
addTarget("0", new HorizontalConfigurationGroup(true));
};
};
static GlobalComboBox *AutoExpireMethod()
{
GlobalComboBox *bc = new GlobalComboBox("AutoExpireMethod");
bc->setLabel(QObject::tr("Auto Expire Method"));
bc->addSelection(QObject::tr("Oldest Show First"), "1");
bc->addSelection(QObject::tr("Lowest Priority First"), "2");
bc->addSelection(QObject::tr("Weighted Time/Priority Combination"), "3");
bc->setHelpText(QObject::tr("Method used to determine which recorded "
"shows to delete first. LiveTV recordings will always "
"expire before normal recordings."));
bc->setValue(1);
return bc;
}
static GlobalCheckBox *AutoExpireWatchedPriority()
{
GlobalCheckBox *bc = new GlobalCheckBox("AutoExpireWatchedPriority");
bc->setLabel(QObject::tr("Watched before UNwatched"));
bc->setValue(false);
bc->setHelpText(QObject::tr("If set, programs that have been marked as "
"watched will be expired before programs that have not "
"been watched."));
return bc;
}
static GlobalSpinBox *AutoExpireDayPriority()
{
GlobalSpinBox *bs = new GlobalSpinBox("AutoExpireDayPriority", 1, 400, 1);
bs->setLabel(QObject::tr("Priority Weight"));
bs->setHelpText(QObject::tr("The number of days bonus a program gets for "
"each priority point. This is only used when the Weighted "
"Time/Priority Auto Expire Method is selected."));
bs->setValue(3);
return bs;
};
static GlobalCheckBox *AutoExpireDefault()
{
GlobalCheckBox *bc = new GlobalCheckBox("AutoExpireDefault");
bc->setLabel(QObject::tr("Auto Expire Default"));
bc->setValue(true);
bc->setHelpText(QObject::tr("When enabled, any new recording schedules "
"will be marked as eligible for Auto-Expiration. "
"Existing schedules will keep their current value."));
return bc;
}
static GlobalSpinBox *AutoExpireLiveTVMaxAge()
{
GlobalSpinBox *bs = new GlobalSpinBox("AutoExpireLiveTVMaxAge", 1, 365, 1);
bs->setLabel(QObject::tr("LiveTV Max Age"));
bs->setHelpText(QObject::tr("AutoExpire will force expiration of LiveTV "
"recordings when they are this many days old. LiveTV "
"recordings may also be expired early if necessary to "
"free up disk space."));
bs->setValue(1);
return bs;
};
#if 0
static GlobalSpinBox *MinRecordDiskThreshold()
{
GlobalSpinBox *bs = new GlobalSpinBox("MinRecordDiskThreshold",
0, 1000000, 100);
bs->setLabel(QObject::tr("New Recording Free Disk Space Threshold "
"(in Megabytes)"));
bs->setHelpText(QObject::tr("MythTV will stop scheduling new recordings on "
"a backend when its free disk space falls below this "
"value."));
bs->setValue(300);
return bs;
}
#endif
static GlobalCheckBox *RerecordWatched()
{
GlobalCheckBox *bc = new GlobalCheckBox("RerecordWatched");
bc->setLabel(QObject::tr("Re-record Watched"));
bc->setValue(true);
bc->setHelpText(QObject::tr("If set, programs that have been marked as "
"watched and are auto-expired will be re-recorded if "
"they are shown again."));
return bc;
}
static GlobalSpinBox *RecordPreRoll()
{
GlobalSpinBox *bs = new GlobalSpinBox("RecordPreRoll", 0, 600, 60, true);
bs->setLabel(QObject::tr("Time to record before start of show "
"(in seconds)"));
bs->setHelpText(QObject::tr("This global setting allows the recorder "
"to start before the scheduled start time. It does "
"not affect the scheduler. It is ignored when two shows "
"have been scheduled without enough time in between."));
bs->setValue(0);
return bs;
}
static GlobalSpinBox *RecordOverTime()
{
GlobalSpinBox *bs = new GlobalSpinBox("RecordOverTime", 0, 1800, 60, true);
bs->setLabel(QObject::tr("Time to record past end of show (in seconds)"));
bs->setValue(0);
bs->setHelpText(QObject::tr("This global setting allows the recorder "
"to record beyond the scheduled end time. It does "
"not affect the scheduler. It is ignored when two shows "
"have been scheduled without enough time in between."));
return bs;
}
static GlobalComboBox *OverTimeCategory()
{
GlobalComboBox *gc = new GlobalComboBox("OverTimeCategory");
gc->setLabel(QObject::tr("Category of shows to be extended"));
gc->setHelpText(QObject::tr("For a special category (e.g. "
"\"Sports event\"), request that shows be autoextended. "
"Only works if a show's category can be determined."));
MSqlQuery query(MSqlQuery::InitCon());
query.prepare("SELECT DISTINCT category FROM program GROUP BY category;");
gc->addSelection("", "");
if (query.exec())
{
while (query.next())
{
QString key = query.value(0).toString();
if (!key.trimmed().isEmpty())
gc->addSelection(key, key);
}
}
return gc;
}
static GlobalSpinBox *CategoryOverTime()
{
GlobalSpinBox *bs = new GlobalSpinBox("CategoryOverTime",
0, 180, 60, true);
bs->setLabel(QObject::tr("Record past end of show (in minutes)"));
bs->setValue(30);
bs->setHelpText(QObject::tr("For the specified category, an attempt "
"will be made to extend the recording by the specified "
"time. It is ignored when two shows have been scheduled "
"without enough time in between."));
return bs;
}
static VerticalConfigurationGroup *CategoryOverTimeSettings()
{
VerticalConfigurationGroup *vcg =
new VerticalConfigurationGroup(false, false);
vcg->setLabel(QObject::tr("Category record over-time"));
vcg->setUseLabel(true);
vcg->addChild(OverTimeCategory());
vcg->addChild(CategoryOverTime());
return vcg;
}
static QString trunc(const QString &str, int len)
{
if (str.length() > len)
return str.mid(0, len - 5) + " . . . ";
return str;
}
static QString pad(const QString &str, int len)
{
QString tmp = str;
while (tmp.length() + 4 < len)
tmp += " ";
while (tmp.length() < len)
tmp += " ";
return tmp;
}
PlaybackProfileItemConfig::PlaybackProfileItemConfig(ProfileItem &_item) :
item(_item)
{
setLabel(QObject::tr("Profile Item"));
HorizontalConfigurationGroup *row[2];
row[0] = new HorizontalConfigurationGroup(false, false, true, true);
cmp[0] = new TransComboBoxSetting();
width[0] = new TransSpinBoxSetting(0, 1920, 64, true);
height[0] = new TransSpinBoxSetting(0, 1088, 64, true);
row[1] = new HorizontalConfigurationGroup(false, false, true, true);
cmp[1] = new TransComboBoxSetting();
width[1] = new TransSpinBoxSetting(0, 1920, 64, true);
height[1] = new TransSpinBoxSetting(0, 1088, 64, true);
decoder = new TransComboBoxSetting();
max_cpus = new TransSpinBoxSetting(1, HAVE_THREADS ? 4 : 1, 1, true);
vidrend = new TransComboBoxSetting();
osdrend = new TransComboBoxSetting();
osdfade = new TransCheckBoxSetting();
deint0 = new TransComboBoxSetting();
deint1 = new TransComboBoxSetting();
filters = new TransLineEditSetting(true);
for (uint i = 0; i < 2; ++i)
{
const QString kCMP[6] = { "", "<", "<=", "==", ">=", ">" };
for (uint j = 0; j < 6; ++j)
cmp[i]->addSelection(kCMP[j]);
cmp[i]->setLabel(tr("Match Criteria"));
width[i]->setName(QString("w%1").arg(i));
width[i]->setLabel(tr("W", "Width"));
height[i]->setName(QString("h%1").arg(i));
height[i]->setLabel(tr("H", "Height"));
row[i]->addChild(cmp[i]);
row[i]->addChild(width[i]);
row[i]->addChild(height[i]);
}
HorizontalConfigurationGroup *vid_row =
new HorizontalConfigurationGroup(false, false, true, true);
HorizontalConfigurationGroup *osd_row =
new HorizontalConfigurationGroup(false, false, true, true);
decoder->setLabel(tr("Decoder"));
max_cpus->setLabel(tr("Max CPUs"));
vidrend->setLabel(tr("Video Renderer"));
osdrend->setLabel(tr("OSD Renderer"));
osdfade->setLabel(tr("OSD Fade"));
deint0->setLabel(tr("Primary Deinterlacer"));
deint1->setLabel(tr("Fallback Deinterlacer"));
filters->setLabel(tr("Custom Filters"));
max_cpus->setHelpText(
tr("Maximum number of CPU cores used for video decoding and filtering.") +
(HAVE_THREADS ? "" :
tr(" Multithreaded decoding disabled-only one CPU "
"will be used, please recompile with "
"--enable-ffmpeg-pthreads to enable.")));
filters->setHelpText(
QObject::tr("Example Custom filter list: 'ivtc,denoise3d'"));
osdfade->setHelpText(
tr("When unchecked the OSD will not fade away but instead "
"will disappear abruptly.") + "\n" +
tr("Uncheck this if the video studders while the OSD is "
"fading away."));
vid_row->addChild(decoder);
vid_row->addChild(max_cpus);
osd_row->addChild(vidrend);
osd_row->addChild(osdrend);
osd_row->addChild(osdfade);
VerticalConfigurationGroup *grp =
new VerticalConfigurationGroup(false, false, true, true);
grp->addChild(row[0]);
grp->addChild(row[1]);
grp->addChild(vid_row);
grp->addChild(osd_row);
addChild(grp);
VerticalConfigurationGroup *page2 =
new VerticalConfigurationGroup(false, false, true, true);
page2->addChild(deint0);
page2->addChild(deint1);
page2->addChild(filters);
addChild(page2);
connect(decoder, SIGNAL(valueChanged(const QString&)),
this, SLOT(decoderChanged(const QString&)));\
connect(vidrend, SIGNAL(valueChanged(const QString&)),
this, SLOT(vrenderChanged(const QString&)));
connect(osdrend, SIGNAL(valueChanged(const QString&)),
this, SLOT(orenderChanged(const QString&)));
connect(deint0, SIGNAL(valueChanged(const QString&)),
this, SLOT(deint0Changed(const QString&)));
connect(deint1, SIGNAL(valueChanged(const QString&)),
this, SLOT(deint1Changed(const QString&)));
}
void PlaybackProfileItemConfig::Load(void)
{
for (uint i = 0; i < 2; ++i)
{
QString pcmp = item.Get(QString("pref_cmp%1").arg(i));
QStringList clist = pcmp.split(" ");
if (clist.size() == 0)
clist<<((i) ? "" : ">");
if (clist.size() == 1)
clist<<"0";
if (clist.size() == 2)
clist<<"0";
cmp[i]->setValue(clist[0]);
width[i]->setValue(clist[1].toInt());
height[i]->setValue(clist[2].toInt());
}
QString pdecoder = item.Get("pref_decoder");
QString pmax_cpus = item.Get("pref_max_cpus");
QString prenderer = item.Get("pref_videorenderer");
QString posd = item.Get("pref_osdrenderer");
QString posdfade = item.Get("pref_osdfade");
QString pdeint0 = item.Get("pref_deint0");
QString pdeint1 = item.Get("pref_deint1");
QString pfilter = item.Get("pref_filters");
bool found = false;
QString dech = VideoDisplayProfile::GetDecoderHelp();
QStringList decr = VideoDisplayProfile::GetDecoders();
QStringList decn = VideoDisplayProfile::GetDecoderNames();
QStringList::const_iterator itr = decr.begin();
QStringList::const_iterator itn = decn.begin();
for (; (itr != decr.end()) && (itn != decn.end()); ++itr, ++itn)
{
decoder->addSelection(*itn, *itr, (*itr == pdecoder));