MythTV  master
videoglobalsettings.cpp
Go to the documentation of this file.
1 // C++
2 #include <map>
3 #include <vector>
4 
5 // Qt
6 #include <QDir>
7 
8 // MythTV
9 #include "libmythbase/mythdirs.h"
11 
12 // MythFrontend
13 #include "videodlg.h"
14 #include "videoglobalsettings.h"
15 
16 namespace
17 {
18 // General Settings
20 {
21  auto *gc = new HostComboBoxSetting("VideoDefaultParentalLevel");
22 
23  gc->setLabel(VideoGeneralSettings::tr("Starting Parental Level"));
24 
25  gc->addSelection(VideoGeneralSettings::tr("4 - Highest"),
26  QString::number(ParentalLevel::plHigh));
27  gc->addSelection(VideoGeneralSettings::tr("1 - Lowest"),
28  QString::number(ParentalLevel::plLowest));
29  gc->addSelection(QString::number(ParentalLevel::plLow));
30  gc->addSelection(QString::number(ParentalLevel::plMedium));
31 
32  gc->setHelpText(VideoGeneralSettings::tr("This is the 'level' that Video "
33  "starts at. Any videos with a "
34  "level at or below this will be "
35  "shown in the list or while "
36  "browsing by default. The "
37  "Parental PIN should be set to "
38  "limit changing of the default "
39  "level."));
40  return gc;
41 }
42 
43 const char *password_clue =
44  QT_TRANSLATE_NOOP("VideoGeneralSettings", "Setting this value to all "
45  "numbers will make your life "
46  "much easier.");
47 
49 {
50  auto *gc = new HostTextEditSetting("VideoAdminPassword");
51 
52  gc->setLabel(VideoGeneralSettings::tr("Parental Level 4 PIN"));
53 
54  gc->setHelpText(QString("%1 %2")
55  .arg(VideoGeneralSettings::tr("This PIN is used to enter Parental "
56  "Control Level 4 as well as the Video "
57  "Manager."),
58  VideoGeneralSettings::tr(password_clue)));
59 
60  return gc;
61 }
62 
64 {
65  auto *gc = new HostTextEditSetting("VideoAdminPasswordThree");
66 
67  gc->setLabel(VideoGeneralSettings::tr("Parental Level 3 PIN"));
68 
69  gc->setHelpText(QString("%1 %2")
70  .arg(VideoGeneralSettings::tr("This PIN is used to enter Parental "
71  "Control Level 3."),
72  VideoGeneralSettings::tr(password_clue)));
73 
74  return gc;
75 }
76 
78 {
79  auto *gc = new HostTextEditSetting("VideoAdminPasswordTwo");
80 
81  gc->setLabel(VideoGeneralSettings::tr("Parental Level 2 PIN"));
82 
83  gc->setHelpText(QString("%1 %2")
84  .arg(VideoGeneralSettings::tr("This PIN is used to enter Parental "
85  "Control Level 2."),
86  VideoGeneralSettings::tr(password_clue)));
87 
88  return gc;
89 }
90 
92 {
93  auto *gc = new HostCheckBoxSetting("VideoAggressivePC");
94 
95  gc->setLabel(VideoGeneralSettings::tr("Aggressive Parental Control"));
96  gc->setValue(false);
97 
98  gc->setHelpText(VideoGeneralSettings::tr("If set, you will not be able to "
99  "return to this screen and reset "
100  "the Parental PIN without first "
101  "entering the current PIN. You "
102  "have been warned."));
103  return gc;
104 }
105 
107 {
108  auto *gc = new HostTextEditSetting("VideoStartupDir");
109 
110  gc->setLabel(VideoGeneralSettings::tr("Directories that hold videos"));
111 
112  gc->setValue(DEFAULT_VIDEOSTARTUP_DIR);
113 
114  gc->setHelpText(VideoGeneralSettings::tr("Multiple directories can be "
115  "separated by ':'. Each "
116  "directory must exist and be "
117  "readable by the user running "
118  "the frontend."));
119  return gc;
120 }
121 
123 {
124  auto *gc = new HostTextEditSetting("VideoArtworkDir");
125 
126  gc->setLabel(VideoGeneralSettings::tr("Directory that holds movie "
127  "posters"));
128 
129  gc->setValue(GetConfDir() + "/Video/Artwork");
130 
131  gc->setHelpText(VideoGeneralSettings::tr("This directory must exist, and "
132  "the user running the frontend "
133  "needs to have read/write "
134  "permission to the directory."));
135  return gc;
136 }
137 
139 {
140  auto *gc = new HostTextEditSetting("mythvideo.screenshotDir");
141 
142  gc->setLabel(VideoGeneralSettings::tr("Directory that holds movie "
143  "screenshots"));
144 
145  gc->setValue(GetConfDir() + "/Video/Screenshots");
146 
147  gc->setHelpText(VideoGeneralSettings::tr("This directory must exist, and "
148  "the user running the frontend "
149  "needs to have read/write "
150  "permission to the directory."));
151  return gc;
152 }
153 
155 {
156  auto *gc = new HostTextEditSetting("mythvideo.bannerDir");
157 
158  gc->setLabel(VideoGeneralSettings::tr("Directory that holds movie/TV "
159  "Banners"));
160 
161  gc->setValue(GetConfDir() + "/Video/Banners");
162 
163  gc->setHelpText(VideoGeneralSettings::tr("This directory must exist, and "
164  "the user running the frontend "
165  "needs to have read/write "
166  "permission to the directory."));
167  return gc;
168 }
169 
171 {
172  auto *gc = new HostTextEditSetting("mythvideo.fanartDir");
173 
174  gc->setLabel(VideoGeneralSettings::tr("Directory that holds movie fanart"));
175 
176  gc->setValue(GetConfDir() + "/Video/Fanart");
177 
178  gc->setHelpText(VideoGeneralSettings::tr("This directory must exist, and "
179  "the user running the frontend "
180  "needs to have read/write "
181  "permission to the directory."));
182  return gc;
183 }
184 
186 {
187  auto *gc = new HostTextEditSetting("mythvideo.TrailersDir");
188 
189  gc->setLabel(VideoGeneralSettings::tr("Directory that holds movie "
190  "trailers"));
191 
192  gc->setValue(GetConfDir() + "/Video/Trailers");
193 
194  gc->setHelpText(VideoGeneralSettings::tr("This directory must exist, and "
195  "the user running the frontend "
196  "needs to have read/write "
197  "permission to the directory."));
198  return gc;
199 }
200 
204 
205 // General Settings
206 
208 {
209  auto *gc = new HostComboBoxSetting("DVDOnInsertDVD");
210 
211  gc->setLabel(VideoGeneralSettings::tr("On DVD insertion"));
212 
213  gc->addSelection(VideoGeneralSettings::tr("Display mythdvd menu"),"1");
214  gc->addSelection(VideoGeneralSettings::tr("Do nothing"),"0");
215  gc->addSelection(VideoGeneralSettings::tr("Play DVD"),"2");
216 
217  gc->setHelpText(VideoGeneralSettings::tr("Media Monitoring should be "
218  "turned on to allow this feature "
219  "(Setup -> General -> CD/DVD "
220  "Monitor)."));
221  return gc;
222 }
223 
225 {
226  auto *gc = new HostCheckBoxSetting("mythvideo.VideoTreeRemember");
227 
228  gc->setLabel(VideoGeneralSettings::tr("Video Tree remembers last selected "
229  "position"));
230 
231  gc->setValue(false);
232 
233  gc->setHelpText(VideoGeneralSettings::tr("If set, the current position in "
234  "the Video Tree is persistent."));
235  return gc;
236 }
237 
239 {
240  auto *r2pl = new HostCheckBoxSetting("mythvideo.ParentalLevelFromRating");
241 
242  r2pl->setLabel(VideoGeneralSettings::tr("Enable automatic Parental "
243  "Level from rating"));
244  r2pl->setValue(false);
245 
246  r2pl->setHelpText(VideoGeneralSettings::tr("If enabled, searches will "
247  "automatically set the "
248  "Parental Level to the one "
249  "matching the rating "
250  "below."));
251 
252  using r2pl_map = std::map<ParentalLevel::Level, QString>;
253 
254  r2pl_map r2pl_defaults;
255 
256  r2pl_defaults.insert(r2pl_map::value_type(ParentalLevel::plLowest,
257  VideoGeneralSettings::tr("G", "PL 1 default search string.")));
258  r2pl_defaults.insert(r2pl_map::value_type(ParentalLevel::plLow,
259  VideoGeneralSettings::tr("PG", "PL 2 default search string.")));
260  r2pl_defaults.insert(r2pl_map::value_type(ParentalLevel::plMedium,
261  VideoGeneralSettings::tr("PG-13", "PL3 default search "
262  "string.")));
263  r2pl_defaults.insert(r2pl_map::value_type(ParentalLevel::plHigh,
264  VideoGeneralSettings::tr("R:NC-17", "PL4 default search "
265  "string.")));
266 
268  pl.GetLevel() <= ParentalLevel::plHigh && pl.good(); ++pl)
269  {
270  auto *hle = new HostTextEditSetting(QString("mythvideo.AutoR2PL%1")
271  .arg(pl.GetLevel()));
272 
273  hle->setLabel(VideoGeneralSettings::tr("Level %1")
274  .arg(pl.GetLevel()));
275 
276  hle->setHelpText(VideoGeneralSettings::tr("Ratings containing "
277  "these strings "
278  "(separated by :) will "
279  "be assigned to Parental "
280  "Level %1.")
281  .arg(pl.GetLevel()));
282 
283  auto def_setting = r2pl_defaults.find(pl.GetLevel());
284  if (def_setting != r2pl_defaults.end())
285  {
286  hle->setValue(def_setting->second);
287  }
288 
289  r2pl->addTargetedChild("1", hle);
290  }
291 
292  return r2pl;
293 }
294 
295 } // namespace
296 
298 {
299  setLabel(tr("General Settings"));
300 
307 
310 
311  auto *pctrl = new GroupSetting();
312  pctrl->setLabel(tr("Parental Control Settings"));
313  pctrl->addChild(VideoDefaultParentalLevel());
314  pctrl->addChild(VideoAdminPassword());
315  pctrl->addChild(VideoAdminPasswordThree());
316  pctrl->addChild(VideoAdminPasswordTwo());
317  pctrl->addChild(VideoAggressivePC());
318  pctrl->addChild(RatingsToPL());
319 
320  addChild(pctrl);
321 }
anonymous_namespace{videoglobalsettings.cpp}::VideoAggressivePC
HostCheckBoxSetting * VideoAggressivePC()
Definition: videoglobalsettings.cpp:91
anonymous_namespace{videoglobalsettings.cpp}::VideoTreeRemember
HostCheckBoxSetting * VideoTreeRemember()
Definition: videoglobalsettings.cpp:224
anonymous_namespace{videoglobalsettings.cpp}::password_clue
const char * password_clue
Definition: videoglobalsettings.cpp:43
anonymous_namespace{videoglobalsettings.cpp}::VideoFanartDirectory
HostTextEditSetting * VideoFanartDirectory()
Definition: videoglobalsettings.cpp:170
anonymous_namespace{videoglobalsettings.cpp}::VideoAdminPasswordThree
HostTextEditSetting * VideoAdminPasswordThree()
Definition: videoglobalsettings.cpp:63
HostTextEditSetting
Definition: standardsettings.h:168
anonymous_namespace{videoglobalsettings.cpp}::RatingsToPL
HostCheckBoxSetting * RatingsToPL()
Definition: videoglobalsettings.cpp:238
GroupSetting::GroupSetting
GroupSetting()=default
mythdirs.h
HostCheckBoxSetting
Definition: standardsettings.h:417
anonymous_namespace{videoglobalsettings.cpp}::VideoAdminPassword
HostTextEditSetting * VideoAdminPassword()
Definition: videoglobalsettings.cpp:48
StandardSetting::addChild
virtual void addChild(StandardSetting *child)
Definition: standardsettings.cpp:70
ParentalLevel::plLowest
@ plLowest
Definition: parentalcontrols.h:13
GetConfDir
QString GetConfDir(void)
Definition: mythdirs.cpp:263
VideoGeneralSettings::VideoGeneralSettings
VideoGeneralSettings()
Definition: videoglobalsettings.cpp:297
globals.h
ParentalLevel::plLow
@ plLow
Definition: parentalcontrols.h:13
anonymous_namespace{videoglobalsettings.cpp}::VideoScreenshotDirectory
HostTextEditSetting * VideoScreenshotDirectory()
Definition: videoglobalsettings.cpp:138
anonymous_namespace{videoglobalsettings.cpp}::VideoBannerDirectory
HostTextEditSetting * VideoBannerDirectory()
Definition: videoglobalsettings.cpp:154
videoglobalsettings.h
anonymous_namespace{videoglobalsettings.cpp}::TrailerDirectory
HostTextEditSetting * TrailerDirectory()
Definition: videoglobalsettings.cpp:185
ParentalLevel::plMedium
@ plMedium
Definition: parentalcontrols.h:13
DEFAULT_VIDEOSTARTUP_DIR
const QString DEFAULT_VIDEOSTARTUP_DIR
Definition: globals.cpp:47
StandardSetting::setLabel
virtual void setLabel(QString str)
Definition: standardsettings.h:34
anonymous_namespace{videoglobalsettings.cpp}::VideoDefaultParentalLevel
HostComboBoxSetting * VideoDefaultParentalLevel()
Definition: videoglobalsettings.cpp:19
ParentalLevel::plHigh
@ plHigh
Definition: parentalcontrols.h:14
anonymous_namespace{videoglobalsettings.cpp}::VideoStartupDirectory
HostTextEditSetting * VideoStartupDirectory()
Definition: videoglobalsettings.cpp:106
anonymous_namespace{videoglobalsettings.cpp}::VideoArtworkDirectory
HostTextEditSetting * VideoArtworkDirectory()
Definition: videoglobalsettings.cpp:122
ParentalLevel
Definition: parentalcontrols.h:9
HostComboBoxSetting
Definition: standardsettings.h:257
anonymous_namespace{videoglobalsettings.cpp}::SetOnInsertDVD
HostComboBoxSetting * SetOnInsertDVD()
Definition: videoglobalsettings.cpp:207
anonymous_namespace{videoglobalsettings.cpp}::VideoAdminPasswordTwo
HostTextEditSetting * VideoAdminPasswordTwo()
Definition: videoglobalsettings.cpp:77
ParentalLevel::GetLevel
Level GetLevel() const
Definition: parentalcontrols.cpp:129
videodlg.h