MythTV  master
archivesettings.cpp
Go to the documentation of this file.
1 /*
2  archivesettings.cpp
3 */
4 
5 #include <unistd.h>
6 
7 // myth
8 #include <mythcontext.h>
9 #include <mythdirs.h>
10 #include <mythdate.h>
11 
12 // mytharchive
13 #include "archivesettings.h"
14 
15 
17 {
18  HostFileBrowserSetting *gc = new HostFileBrowserSetting("MythArchiveTempDir");
19 
20  gc->setLabel(ArchiveSettings::tr("MythArchive Temp Directory"));
21  gc->setValue("");
22 
23  gc->setHelpText(ArchiveSettings::tr("Location where MythArchive should "
24  "create its temporary work files. "
25  "LOTS of free space required here."));
26  gc->SetTypeFilter(QDir::AllDirs | QDir::Hidden);
27 
28  return gc;
29 };
30 
32 {
33  HostFileBrowserSetting *gc = new HostFileBrowserSetting("MythArchiveShareDir");
34 
35  gc->setLabel(ArchiveSettings::tr("MythArchive Share Directory"));
36  gc->setValue(GetShareDir() + "mytharchive/");
37 
38  gc->setHelpText(ArchiveSettings::tr("Location where MythArchive stores its "
39  "scripts, intro movies and theme "
40  "files"));
41  gc->SetTypeFilter(QDir::AllDirs | QDir::Hidden);
42 
43  return gc;
44 };
45 
47 {
48  HostComboBoxSetting *gc = new HostComboBoxSetting("MythArchiveVideoFormat");
49 
50  gc->setLabel(ArchiveSettings::tr("Video format"));
51 
52  gc->addSelection("PAL");
53  gc->addSelection("NTSC");
54 
55  gc->setHelpText(ArchiveSettings::tr("Video format for DVD recordings, PAL "
56  "or NTSC."));
57  return gc;
58 };
59 
61 {
62  HostTextEditSetting *gc = new HostTextEditSetting("MythArchiveFileFilter");
63 
64  gc->setLabel(ArchiveSettings::tr("File Selector Filter"));
65  gc->setValue("*.mpg *.mov *.avi *.mpeg *.nuv");
66 
67  gc->setHelpText(ArchiveSettings::tr("The file name filter to use in the "
68  "file selector."));
69  return gc;
70 };
71 
73 {
74  HostFileBrowserSetting *gc = new HostFileBrowserSetting("MythArchiveDVDLocation");
75 
76  gc->setLabel(ArchiveSettings::tr("Location of DVD"));
77  gc->setValue("/dev/dvd");
78 
79  gc->setHelpText(ArchiveSettings::tr("Which DVD drive to use when burning "
80  "discs."));
81  gc->SetTypeFilter(QDir::AllDirs | QDir::Hidden);
82  return gc;
83 };
84 
86 {
87  HostSpinBoxSetting *gc = new HostSpinBoxSetting("MythArchiveDriveSpeed", 0, 48, 1);
88 
89  gc->setLabel(ArchiveSettings::tr("DVD Drive Write Speed"));
90  gc->setValue(0);
91 
92  gc->setHelpText(ArchiveSettings::tr("This is the write speed to use when "
93  "burning a DVD. Set to 0 to allow "
94  "growisofs to choose the fastest "
95  "available speed."));
96  return gc;
97 };
98 
100 {
101  HostTextEditSetting *gc = new HostTextEditSetting("MythArchiveDVDPlayerCmd");
102 
103  gc->setLabel(ArchiveSettings::tr("Command to play DVD"));
104  gc->setValue("Internal");
105 
106  gc->setHelpText(ArchiveSettings::tr("Command to run when test playing a "
107  "created DVD. 'Internal' will use the "
108  "internal MythTV player. %f will be "
109  "replaced with the path to the created "
110  "DVD structure eg. 'xine -pfhq "
111  "--no-splash dvd:/%f'."));
112  return gc;
113 };
114 
116 {
117  HostCheckBoxSetting *gc = new HostCheckBoxSetting("MythArchiveCopyRemoteFiles");
118 
119  gc->setLabel(ArchiveSettings::tr("Copy remote files"));
120  gc->setValue(false);
121 
122  gc->setHelpText(ArchiveSettings::tr("If set files on remote filesystems "
123  "will be copied over to the local "
124  "filesystem before processing. Speeds "
125  "processing and reduces bandwidth on "
126  "the network"));
127  return gc;
128 };
129 
131 {
132  HostCheckBoxSetting *gc = new HostCheckBoxSetting("MythArchiveAlwaysUseMythTranscode");
133 
134  gc->setLabel(ArchiveSettings::tr("Always Use Mythtranscode"));
135  gc->setValue(true);
136 
137  gc->setHelpText(ArchiveSettings::tr("If set mpeg2 files will always be "
138  "passed though mythtranscode to clean "
139  "up any errors. May help to fix some "
140  "audio problems. Ignored if 'Use "
141  "ProjectX' is set."));
142  return gc;
143 };
144 
146 {
147  HostCheckBoxSetting *gc = new HostCheckBoxSetting("MythArchiveUseProjectX");
148 
149  gc->setLabel(ArchiveSettings::tr("Use ProjectX"));
150  gc->setValue(false);
151 
152  gc->setHelpText(ArchiveSettings::tr("If set ProjectX will be used to cut "
153  "commercials and split mpeg2 files "
154  "instead of mythtranscode and "
155  "mythreplex."));
156  return gc;
157 };
158 
160 {
161  HostCheckBoxSetting *gc = new HostCheckBoxSetting("MythArchiveUseFIFO");
162 
163  gc->setLabel(ArchiveSettings::tr("Use FIFOs"));
164  gc->setValue(true);
165 
166  gc->setHelpText(ArchiveSettings::tr("The script will use FIFOs to pass the "
167  "output of mplex into dvdauthor rather "
168  "than creating intermediate files. "
169  "Saves time and disk space during "
170  "multiplex operations but not "
171  "supported on Windows platform"));
172  return gc;
173 };
174 
176 {
177  HostCheckBoxSetting *gc = new HostCheckBoxSetting("MythArchiveAddSubtitles");
178 
179  gc->setLabel(ArchiveSettings::tr("Add Subtitles"));
180  gc->setValue(false);
181 
182  gc->setHelpText(ArchiveSettings::tr("If available this option will add "
183  "subtitles to the final DVD. Requires "
184  "'Use ProjectX' to be on."));
185  return gc;
186 };
187 
189 {
190  HostComboBoxSetting *gc = new HostComboBoxSetting("MythArchiveMainMenuAR");
191 
192  gc->setLabel(ArchiveSettings::tr("Main Menu Aspect Ratio"));
193 
194  gc->addSelection(ArchiveSettings::tr("4:3", "Aspect ratio"), "4:3");
195  gc->addSelection(ArchiveSettings::tr("16:9", "Aspect ratio"), "16:9");
196 
197  gc->setValue(1);
198 
199  gc->setHelpText(ArchiveSettings::tr("Aspect ratio to use when creating the "
200  "main menu."));
201  return gc;
202 };
203 
205 {
206  HostComboBoxSetting *gc = new HostComboBoxSetting("MythArchiveChapterMenuAR");
207 
208  gc->setLabel(ArchiveSettings::tr("Chapter Menu Aspect Ratio"));
209 
210  gc->addSelection(ArchiveSettings::tr("4:3", "Aspect ratio"), "4:3");
211  gc->addSelection(ArchiveSettings::tr("16:9", "Aspect ratio"), "16:9");
212  gc->addSelection(ArchiveSettings::tr("Video"), "Video");
213 
214  gc->setValue(2);
215 
216  //: %1 is the translation of the "Video" combo box choice
217  gc->setHelpText(ArchiveSettings::tr("Aspect ratio to use when creating the "
218  "chapter menu. '%1' means use the "
219  "same aspect ratio as the associated "
220  "video.")
221  .arg(ArchiveSettings::tr("Video")));
222  return gc;
223 };
224 
226 {
227  HostComboBoxSetting *gc = new HostComboBoxSetting("MythArchiveDateFormat");
228  gc->setLabel(ArchiveSettings::tr("Date format"));
229 
230  QDate sampdate = MythDate::current().toLocalTime().date();
231  QString sampleStr = ArchiveSettings::tr("Samples are shown using today's "
232  "date.");
233 
234  if (sampdate.month() == sampdate.day())
235  {
236  sampdate = sampdate.addDays(1);
237  sampleStr = ArchiveSettings::tr("Samples are shown using tomorrow's "
238  "date.");
239  }
240 
241  gc->addSelection(sampdate.toString("ddd MMM d"), "%a %b %d");
242  gc->addSelection(sampdate.toString("ddd MMMM d"), "%a %B %d");
243  gc->addSelection(sampdate.toString("MMM d"), "%b %d");
244  gc->addSelection(sampdate.toString("MM/dd"), "%m/%d");
245  gc->addSelection(sampdate.toString("MM.dd"), "%m.%d");
246  gc->addSelection(sampdate.toString("ddd d MMM"), "%a %d %b");
247  gc->addSelection(sampdate.toString("M/d/yyyy"), "%m/%d/%Y");
248  gc->addSelection(sampdate.toString("dd.MM.yyyy"), "%d.%m.%Y");
249  gc->addSelection(sampdate.toString("yyyy-MM-dd"), "%Y-%m-%d");
250  gc->addSelection(sampdate.toString("ddd MMM d yyyy"), "%a %b %d %Y");
251  gc->addSelection(sampdate.toString("ddd yyyy-MM-dd"), "%a %Y-%m-%d");
252  gc->addSelection(sampdate.toString("ddd dd MMM yyyy"), "%a %d %b %Y");
253 
254  //: %1 gives additional info on the date used
255  gc->setHelpText(ArchiveSettings::tr("Your preferred date format to use on "
256  "DVD menus. %1")
257  .arg(sampleStr));
258  return gc;
259 }
260 
262 {
263  HostComboBoxSetting *gc = new HostComboBoxSetting("MythArchiveTimeFormat");
264  gc->setLabel(ArchiveSettings::tr("Time format"));
265 
266  QTime samptime = QTime::currentTime();
267 
268  gc->addSelection(samptime.toString("hh:mm AP"), "%I:%M %p");
269  gc->addSelection(samptime.toString("hh:mm"), "%H:%M");
270 
271  gc->setHelpText(ArchiveSettings::tr("Your preferred time format to display "
272  "on DVD menus. You must choose a "
273  "format with \"AM\" or \"PM\" in it, "
274  "otherwise your time display will be "
275  "24-hour or \"military\" time."));
276  return gc;
277 }
278 
280 {
281  HostComboBoxSetting *gc = new HostComboBoxSetting("MythArchiveDefaultEncProfile");
282  gc->setLabel(ArchiveSettings::tr("Default Encoder Profile"));
283 
284  gc->addSelection(ArchiveSettings::tr("HQ", "Encoder profile"), "HQ");
285  gc->addSelection(ArchiveSettings::tr("SP", "Encoder profile"), "SP");
286  gc->addSelection(ArchiveSettings::tr("LP", "Encoder profile"), "LP");
287  gc->addSelection(ArchiveSettings::tr("EP", "Encoder profile"), "EP");
288 
289  gc->setValue(1);
290 
291  gc->setHelpText(ArchiveSettings::tr("Default encoding profile to use if a "
292  "file needs re-encoding."));
293  return gc;
294 }
295 
297 {
298  HostTextEditSetting *gc = new HostTextEditSetting("MythArchiveMplexCmd");
299 
300  gc->setLabel(ArchiveSettings::tr("mplex Command"));
301 
302  gc->setValue("mplex");
303 
304  gc->setHelpText(ArchiveSettings::tr("Command to run mplex"));
305 
306  return gc;
307 };
308 
310 {
311  HostTextEditSetting *gc = new HostTextEditSetting("MythArchiveDvdauthorCmd");
312 
313  gc->setLabel(ArchiveSettings::tr("dvdauthor command"));
314 
315  gc->setValue("dvdauthor");
316 
317  gc->setHelpText(ArchiveSettings::tr("Command to run dvdauthor."));
318 
319  return gc;
320 };
321 
323 {
324  HostTextEditSetting *gc = new HostTextEditSetting("MythArchiveMkisofsCmd");
325 
326  gc->setLabel(ArchiveSettings::tr("mkisofs command"));
327 
328  gc->setValue("mkisofs");
329 
330  gc->setHelpText(ArchiveSettings::tr("Command to run mkisofs. (Used to "
331  "create ISO images)"));
332  return gc;
333 };
334 
336 {
337  HostTextEditSetting *gc = new HostTextEditSetting("MythArchiveGrowisofsCmd");
338 
339  gc->setLabel(ArchiveSettings::tr("growisofs command"));
340 
341  gc->setValue("growisofs");
342 
343  gc->setHelpText(ArchiveSettings::tr("Command to run growisofs. (Used to "
344  "burn DVDs)"));
345  return gc;
346 };
347 
349 {
350  HostTextEditSetting *gc = new HostTextEditSetting("MythArchiveM2VRequantiserCmd");
351 
352  gc->setLabel(ArchiveSettings::tr("M2VRequantiser command"));
353 
354  gc->setValue("M2VRequantiser");
355 
356  gc->setHelpText(ArchiveSettings::tr("Command to run M2VRequantiser. "
357  "Optional - leave blank if you don't "
358  "have M2VRequantiser installed."));
359  return gc;
360 };
361 
363 {
364  HostTextEditSetting *gc = new HostTextEditSetting("MythArchiveJpeg2yuvCmd");
365 
366  gc->setLabel(ArchiveSettings::tr("jpeg2yuv command"));
367 
368  gc->setValue("jpeg2yuv");
369 
370  gc->setHelpText(ArchiveSettings::tr("Command to run jpeg2yuv. Part of "
371  "mjpegtools package"));
372  return gc;
373 };
374 
376 {
377  HostTextEditSetting *gc = new HostTextEditSetting("MythArchiveSpumuxCmd");
378 
379  gc->setLabel(ArchiveSettings::tr("spumux command"));
380 
381  gc->setValue("spumux");
382 
383  gc->setHelpText(ArchiveSettings::tr("Command to run spumux. Part of "
384  "dvdauthor package"));
385  return gc;
386 };
387 
389 {
390  HostTextEditSetting *gc = new HostTextEditSetting("MythArchiveMpeg2encCmd");
391 
392  gc->setLabel(ArchiveSettings::tr("mpeg2enc command"));
393 
394  gc->setValue("mpeg2enc");
395 
396  gc->setHelpText(ArchiveSettings::tr("Command to run mpeg2enc. Part of "
397  "mjpegtools package"));
398  return gc;
399 };
400 
402 {
403  HostTextEditSetting *gc = new HostTextEditSetting("MythArchiveProjectXCmd");
404 
405  gc->setLabel(ArchiveSettings::tr("projectx command"));
406 
407  gc->setValue("projectx");
408 
409  gc->setHelpText(ArchiveSettings::tr("Command to run ProjectX. Will be used "
410  "to cut commercials and split mpegs "
411  "files instead of mythtranscode and "
412  "mythreplex."));
413  return gc;
414 };
415 
417 {
418  setLabel(ArchiveSettings::tr("MythArchive Settings"));
421  addChild(PALNTSC());
432 
433  GroupSetting* DVDSettings = new GroupSetting();
434  DVDSettings->setLabel(ArchiveSettings::tr("DVD Menu Settings"));
435  DVDSettings->addChild(MainMenuAspectRatio());
436  DVDSettings->addChild(ChapterMenuAspectRatio());
437  DVDSettings->addChild(MythArchiveDateFormat());
438  DVDSettings->addChild(MythArchiveTimeFormat());
439  addChild(DVDSettings);
440 
441  GroupSetting* externalCmdSettings = new GroupSetting();
442  externalCmdSettings->setLabel(ArchiveSettings::tr("MythArchive External Commands"));
443  externalCmdSettings->addChild(MythArchiveMplexCmd());
444  externalCmdSettings->addChild(MythArchiveDvdauthorCmd());
445  externalCmdSettings->addChild(MythArchiveSpumuxCmd());
446  externalCmdSettings->addChild(MythArchiveMpeg2encCmd());
447  externalCmdSettings->addChild(MythArchiveMkisofsCmd());
448  externalCmdSettings->addChild(MythArchiveGrowisofsCmd());
449  externalCmdSettings->addChild(MythArchiveM2VRequantiserCmd());
450  externalCmdSettings->addChild(MythArchiveJpeg2yuvCmd());
451  externalCmdSettings->addChild(MythArchiveProjectXCmd());
452  addChild(externalCmdSettings);
453 }
static HostTextEditSetting * MythArchiveMkisofsCmd()
static HostFileBrowserSetting * MythArchiveShareDir()
void addSelection(const QString &label, QString value=QString::null, bool select=false)
static HostTextEditSetting * MythArchiveMplexCmd()
static HostTextEditSetting * MythArchiveFileFilter()
static HostTextEditSetting * MythArchiveDvdauthorCmd()
virtual void setHelpText(const QString &str)
static HostCheckBoxSetting * MythArchiveCopyRemoteFiles()
virtual void setValue(const QString &)
static HostTextEditSetting * MythArchiveM2VRequantiserCmd()
static HostComboBoxSetting * MainMenuAspectRatio()
static HostTextEditSetting * MythArchiveGrowisofsCmd()
virtual void setLabel(QString str)
static HostTextEditSetting * MythArchiveProjectXCmd()
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
Definition: mythdate.cpp:10
QString GetShareDir(void)
Definition: mythdirs.cpp:222
static HostComboBoxSetting * MythArchiveDateFormat()
static HostCheckBoxSetting * MythArchiveAlwaysUseMythTranscode()
static HostTextEditSetting * MythArchiveJpeg2yuvCmd()
static HostTextEditSetting * MythArchiveMpeg2encCmd()
static HostComboBoxSetting * ChapterMenuAspectRatio()
virtual void addChild(StandardSetting *child)
static HostTextEditSetting * MythArchiveSpumuxCmd()
static HostComboBoxSetting * PALNTSC()
static HostComboBoxSetting * MythArchiveTimeFormat()
static HostSpinBoxSetting * MythArchiveDriveSpeed()
void SetTypeFilter(QDir::Filters filter)
static HostComboBoxSetting * MythArchiveDefaultEncProfile()
static HostFileBrowserSetting * MythArchiveDVDLocation()
static HostCheckBoxSetting * MythArchiveUseFIFO()
static HostTextEditSetting * MythArchiveDVDPlayerCmd()
virtual void setValue(const QString &newValue)
static HostFileBrowserSetting * MythArchiveTempDir()
static HostCheckBoxSetting * MythArchiveAddSubtitles()
static HostCheckBoxSetting * MythArchiveUseProjectX()