MythTV  master
gallerysettings.cpp
Go to the documentation of this file.
1 
2 // qt
3 #include <QDir>
4 
5 // myth
6 #include <mythcontext.h>
7 
8 // mythgallery
9 #include "config.h"
10 #include "gallerysettings.h"
11 #include "galleryfilter.h"
12 
13 // General Settings
14 
16 {
17  HostTextEditSetting *gc = new HostTextEditSetting("GalleryFilterDirectory");
18  gc->setLabel(GallerySettings::tr("Directory filter"));
19  gc->setValue("");
20  gc->setHelpText(GallerySettings::tr("Enter directory names to be excluded "
21  "in browser. (multiple entries "
22  "delimited with ':')"));
23  return gc;
24 };
25 
27 {
28  HostComboBoxSetting *gc = new HostComboBoxSetting("GalleryFilterType");
29  gc->setLabel(GallerySettings::tr("Type filter"));
30  gc->addSelection(GallerySettings::tr("All"),
31  QString::number(kTypeFilterAll));
32  gc->addSelection(GallerySettings::tr("Images only"),
33  QString::number(kTypeFilterImagesOnly));
34  gc->addSelection(GallerySettings::tr("Movies only"),
35  QString::number(kTypeFilterMoviesOnly));
36  gc->setHelpText(GallerySettings::tr("This is the type filter for the "
37  "displayed thumbnails."));
38  return gc;
39 };
40 
42 {
43  HostFileBrowserSetting *gc = new HostFileBrowserSetting("GalleryDir");
44  gc->setLabel(GallerySettings::tr("Directory that holds images"));
45 #ifdef Q_OS_MAC
46  gc->setValue(QDir::homePath() + "/Pictures");
47 #else
48  gc->setValue("/var/lib/pictures");
49 #endif
50  gc->setHelpText(GallerySettings::tr("This directory must exist and "
51  "MythGallery needs to have read "
52  "permission."));
53  return gc;
54 };
55 
57 {
58  HostCheckBoxSetting *gc = new HostCheckBoxSetting("GalleryThumbnailLocation");
59  gc->setLabel(GallerySettings::tr("Store thumbnails in image directory"));
60  gc->setValue(true);
61  gc->setHelpText(GallerySettings::tr("If set, thumbnails are stored in "
62  "'.thumbcache' directories within "
63  "the above directory. If cleared, "
64  "they are stored in your home "
65  "directory."));
66  return gc;
67 };
68 
70 {
71  HostComboBoxSetting *gc = new HostComboBoxSetting("GallerySortOrder");
72  gc->setLabel(GallerySettings::tr("Sort order when browsing"));
73  gc->addSelection(GallerySettings::tr("Unsorted"),
74  QString::number(kSortOrderUnsorted));
75  gc->addSelection(GallerySettings::tr("Name (A-Z alpha)"),
76  QString::number(kSortOrderNameAsc));
77  gc->addSelection(GallerySettings::tr("Reverse Name (Z-A alpha)"),
78  QString::number(kSortOrderNameDesc));
79  gc->addSelection(GallerySettings::tr("Mod Time (oldest first)"),
80  QString::number(kSortOrderModTimeAsc));
81  gc->addSelection(GallerySettings::tr("Reverse Mod Time (newest first)"),
82  QString::number(kSortOrderModTimeDesc));
83  gc->addSelection(GallerySettings::tr("Extension (A-Z alpha)"),
84  QString::number(kSortOrderExtAsc));
85  gc->addSelection(GallerySettings::tr("Reverse Extension (Z-A alpha)"),
86  QString::number(kSortOrderExtDesc));
87  gc->addSelection(GallerySettings::tr("Filesize (smallest first)"),
88  QString::number(kSortOrderSizeAsc));
89  gc->addSelection(GallerySettings::tr("Reverse Filesize (largest first)"),
90  QString::number(kSortOrderSizeDesc));
91  gc->setHelpText(GallerySettings::tr("This is the sort order for the "
92  "displayed picture thumbnails."));
93  return gc;
94 };
95 
97 {
98  HostSpinBoxSetting *gc = new HostSpinBoxSetting("GalleryOverlayCaption", 0, 600, 1);
99  gc->setLabel(GallerySettings::tr("Overlay caption"));
100  gc->setValue(0);
101  gc->setHelpText(GallerySettings::tr("This is the number of seconds to show "
102  "a caption on top of a full size picture."));
103  return gc;
104 };
105 
107 {
108  HostTextEditSetting *gc = new HostTextEditSetting("GalleryImportDirs");
109  gc->setLabel(GallerySettings::tr("Paths to import images from"));
110  gc->setValue("/mnt/cdrom:/mnt/camera");
111  gc->setHelpText(GallerySettings::tr("This is a colon separated list of "
112  "paths. If the path in the list is a directory, its "
113  "contents will be copied. If it is an executable, "
114  "it will be run."));
115  return gc;
116 };
117 
119 {
120  HostCheckBoxSetting *gc = new HostCheckBoxSetting("GalleryAllowImportScripts");
121  gc->setLabel(GallerySettings::tr("Allow the import to run external scripts"));
122  gc->setValue(false);
123  gc->setHelpText(GallerySettings::tr("If set, you can use an external script to "
124  "import images from your camera. Only enable "
125  "this if you are sure your system is secure."));
126  return gc;
127 };
128 
130 {
131  HostCheckBoxSetting *gc = new HostCheckBoxSetting("GalleryAutoLoad");
132  gc->setLabel(GallerySettings::tr("Automatically load MythGallery to "
133  "display pictures"));
134  gc->setValue(false);
135  gc->setHelpText(GallerySettings::tr("When a new CD-Rom or removable "
136  "storage device containing pictures is "
137  "detected then load MythGallery to "
138  "display the content."));
139  return gc;
140 }
141 
143 {
144  //use to be a checkbox
145  HostComboBoxSetting *gc = new HostComboBoxSetting("SlideshowUseOpenGL");
146  gc->setLabel(GallerySettings::tr("Transition mode"));
147  gc->setHelpText(GallerySettings::tr("Select which kind of slideshow "
148  "transition to use."));
149  gc->addSelection(GallerySettings::tr("Standard"), "0");
150 #ifdef USING_OPENGL
151  gc->addSelection(GallerySettings::tr("OpenGL"), "1");
152 #endif
153  return gc;
154 }
155 
156 #ifdef USING_OPENGL
157 
159 {
160  HostComboBoxSetting *gc = new HostComboBoxSetting("SlideshowOpenGLTransition");
161  gc->setLabel(GallerySettings::tr("Type of OpenGL transition"));
162 
163  //: No OpenGL transition
164  gc->addSelection(GallerySettings::tr("none"), "none");
165  //: Blend OpenGL transition
166  gc->addSelection(GallerySettings::tr("blend (gl)"), "blend (gl)");
167  //: Room blend OpenGL transition
168  gc->addSelection(GallerySettings::tr("zoom blend (gl)"), "zoom blend (gl)");
169  //: Fade OpenGL transition
170  gc->addSelection(GallerySettings::tr("fade (gl)"), "fade (gl)");
171  //: Rotate OpenGL transition
172  gc->addSelection(GallerySettings::tr("rotate (gl)"), "rotate (gl)");
173  //: Bend OpenGL transition
174  gc->addSelection(GallerySettings::tr("bend (gl)"), "bend (gl)");
175  //: Inout OpenGL transition
176  gc->addSelection(GallerySettings::tr("inout (gl)"), "inout (gl)");
177  //: Slide OpenGL transition
178  gc->addSelection(GallerySettings::tr("slide (gl)"), "slide (gl)");
179  //: Flutter OpenGL transition
180  gc->addSelection(GallerySettings::tr("flutter (gl)"), "flutter (gl)");
181  //: Cube OpenGL transition
182  gc->addSelection(GallerySettings::tr("cube (gl)"), "cube (gl)");
183  //: Ken Burns OpenGL transition
184  gc->addSelection(GallerySettings::tr("Ken Burns (gl)"), "Ken Burns (gl)");
185  //: Random OpenGL transition
186  gc->addSelection(GallerySettings::tr("random (gl)"), "random (gl)");
187 
188  gc->setHelpText(GallerySettings::tr("This is the type of OpenGL transition "
189  "used between pictures in slideshow "
190  "mode."));
191  return gc;
192 };
193 
195 {
197  "SlideshowOpenGLTransitionLength", 500, 120000, 500);
198  gc->setLabel(GallerySettings::tr("Duration of OpenGL Transition "
199  "(milliseconds)"));
200  gc->setValue(2000);
201  return gc;
202 };
203 
204 #endif /* USING_OPENGL */
205 
207 {
208  HostComboBoxSetting *gc = new HostComboBoxSetting("SlideshowTransition");
209  gc->setLabel(GallerySettings::tr("Type of transition"));
210 
211  gc->addSelection(GallerySettings::tr("none",
212  "Slideshow transition"),
213  "none");
214  gc->addSelection(GallerySettings::tr("chess board",
215  "Slideshow transition"),
216  "chess board");
217  gc->addSelection(GallerySettings::tr("melt down",
218  "Slideshow transition"),
219  "melt down");
220  gc->addSelection(GallerySettings::tr("sweep",
221  "Slideshow transition"),
222  "sweep");
223  gc->addSelection(GallerySettings::tr("noise",
224  "Slideshow transition"),
225  "noise");
226  gc->addSelection(GallerySettings::tr("growing",
227  "Slideshow transition"),
228  "growing");
229  gc->addSelection(GallerySettings::tr("incoming edges",
230  "Slideshow transition"),
231  "incoming edges");
232  gc->addSelection(GallerySettings::tr("horizontal lines",
233  "Slideshow transition"),
234  "horizontal lines");
235  gc->addSelection(GallerySettings::tr("vertical lines",
236  "Slideshow transition"),
237  "vertical lines");
238  gc->addSelection(GallerySettings::tr("circle out", "Slideshow transition"),
239  "circle out");
240  gc->addSelection(GallerySettings::tr("multicircle out",
241  "Slideshow transition"),
242  "multicircle out");
243  gc->addSelection(GallerySettings::tr("spiral in",
244  "Slideshow transition"),
245  "spiral in");
246  gc->addSelection(GallerySettings::tr("blobs",
247  "Slideshow transition"),
248  "blobs");
249  gc->addSelection(GallerySettings::tr("random",
250  "Slideshow transition"),
251  "random");
252 
253  gc->setHelpText(GallerySettings::tr("This is the type of transition used "
254  "between pictures in slideshow mode."));
255  return gc;
256 };
257 
259 {
260  HostComboBoxSetting *gc = new HostComboBoxSetting("SlideshowBackground");
261  gc->setLabel(GallerySettings::tr("Type of background"));
262  // use names from /etc/X11/rgb.txt
263  gc->addSelection(GallerySettings::tr("theme",
264  "Slideshow background"),
265  "");
266  gc->addSelection(GallerySettings::tr("black",
267  "Slideshow background"),
268  "black");
269  gc->addSelection(GallerySettings::tr("white",
270  "Slideshow background"),
271  "white");
272  gc->setHelpText(GallerySettings::tr("This is the type of background for "
273  "each picture in single view mode."));
274  return gc;
275 };
276 
278 {
279  HostSpinBoxSetting *gc = new HostSpinBoxSetting("SlideshowDelay", 0, 86400, 1);
280  gc->setLabel(GallerySettings::tr("Slideshow Delay"));
281  gc->setValue(5);
282  gc->setHelpText(GallerySettings::tr("This is the number of seconds to "
283  "display each picture."));
284  return gc;
285 };
286 
288 {
289  HostCheckBoxSetting *gc = new HostCheckBoxSetting("GalleryRecursiveSlideshow");
290  gc->setLabel(GallerySettings::tr("Recurse into directories"));
291  gc->setHelpText(GallerySettings::tr("Check this to let the slideshow "
292  "recurse into sub-directories."));
293  return gc;
294 };
295 
297 {
298  setLabel(GallerySettings::tr("MythGallery Settings (General)"));
307 
308  HostComboBoxSetting* transitionMode = SlideShowTransitionMode();
309  addChild(transitionMode);
310  //no opengl
311  transitionMode->addTargetedChild("0", MythGalleryOverlayCaption());
312  transitionMode->addTargetedChild("0", SlideshowTransition());
313  transitionMode->addTargetedChild("0", SlideshowBackground());
314 
315 #ifdef USING_OPENGL
316  transitionMode->addTargetedChild("1", SlideshowOpenGLTransition());
317  transitionMode->addTargetedChild("1", SlideshowOpenGLTransitionLength());
318 #endif
319 
322 }
323 
static HostTextEditSetting * MythGalleryFilter()
static HostCheckBoxSetting * MythGalleryThumbnailLocation()
static HostSpinBoxSetting * SlideshowOpenGLTransitionLength()
static HostCheckBoxSetting * SlideshowRecursive()
void addSelection(const QString &label, QString value=QString(), bool select=false)
virtual void setHelpText(const QString &str)
static HostCheckBoxSetting * MythGalleryAutoLoad()
static HostSpinBoxSetting * MythGalleryOverlayCaption()
static HostSpinBoxSetting * SlideshowDelay()
virtual void setLabel(QString str)
static HostComboBoxSetting * SlideshowTransition()
static HostComboBoxSetting * SlideshowOpenGLTransition()
static HostComboBoxSetting * MythGalleryFilterType()
static HostFileBrowserSetting * MythGalleryDir()
virtual void addChild(StandardSetting *child)
static HostComboBoxSetting * MythGallerySortOrder()
static HostComboBoxSetting * SlideShowTransitionMode()
static HostCheckBoxSetting * MythGalleryAllowImportScripts()
void setValue(const QString &) override
static HostTextEditSetting * MythGalleryImportDirs()
void addTargetedChild(const QString &value, StandardSetting *setting)
virtual void setValue(const QString &newValue)
static HostComboBoxSetting * SlideshowBackground()