1 | --- mythgallery/mythgallery/mythgallery.pro 2009-12-23 12:58:25.660399643 +0100 |
---|
2 | +++ mythgallery/mythgallery/mythgallery.pro 2009-12-23 18:55:51.803104000 +0100 |
---|
3 | @@ -19,15 +19,19 @@ |
---|
4 | # Input |
---|
5 | HEADERS += iconview.h singleview.h |
---|
6 | HEADERS += imageview.h |
---|
7 | -HEADERS += gallerysettings.h dbcheck.h |
---|
8 | +HEADERS += dbcheck.h |
---|
9 | HEADERS += galleryutil.h |
---|
10 | HEADERS += thumbgenerator.h thumbview.h |
---|
11 | +HEADERS += generalsettings.h |
---|
12 | +HEADERS += slideshowsettings.h |
---|
13 | SOURCES += iconview.cpp singleview.cpp |
---|
14 | SOURCES += imageview.cpp |
---|
15 | -SOURCES += gallerysettings.cpp dbcheck.cpp |
---|
16 | +SOURCES += dbcheck.cpp |
---|
17 | SOURCES += galleryutil.cpp |
---|
18 | SOURCES += thumbgenerator.cpp thumbview.cpp |
---|
19 | SOURCES += main.cpp |
---|
20 | +SOURCES += generalsettings.cpp |
---|
21 | +SOURCES += slideshowsettings.cpp |
---|
22 | |
---|
23 | opengl { |
---|
24 | SOURCES *= glsingleview.cpp gltexture.cpp |
---|
25 | --- mythgallery/mythgallery/main.cpp 2009-12-23 12:58:25.794777151 +0100 |
---|
26 | +++ mythgallery/mythgallery/main.cpp 2009-12-23 17:55:12.218400228 +0100 |
---|
27 | @@ -10,11 +10,16 @@ |
---|
28 | #include <mythtv/mythdialogs.h> |
---|
29 | #include <mythtv/mythmediamonitor.h> |
---|
30 | #include <mythtv/mythpluginapi.h> |
---|
31 | +#include <mythtv/libmythui/myththemedmenu.h> |
---|
32 | +#include <mythtv/libmythui/mythuihelper.h> |
---|
33 | +#include <mythtv/libmythui/mythmainwindow.h> |
---|
34 | |
---|
35 | // mythgallery |
---|
36 | #include "iconview.h" |
---|
37 | -#include "gallerysettings.h" |
---|
38 | #include "dbcheck.h" |
---|
39 | +#include "generalsettings.h" |
---|
40 | +#include "slideshowsettings.h" |
---|
41 | + |
---|
42 | |
---|
43 | static int run(MythMediaDevice *dev = NULL) |
---|
44 | { |
---|
45 | @@ -110,6 +115,56 @@ |
---|
46 | MEDIATYPE_MGALLERY, "gif,jpg,png"); |
---|
47 | } |
---|
48 | |
---|
49 | +void GalleryCallback(void *data, QString &selection) |
---|
50 | +{ |
---|
51 | + (void) data; |
---|
52 | + |
---|
53 | + QString sel = selection.toLower(); |
---|
54 | + |
---|
55 | + if (sel == "settings_general") |
---|
56 | + { |
---|
57 | + MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); |
---|
58 | + GeneralSettings *gs = new GeneralSettings(mainStack, "general settings"); |
---|
59 | + |
---|
60 | + if (gs->Create()) |
---|
61 | + mainStack->AddScreen(gs); |
---|
62 | + } |
---|
63 | + else if (sel == "settings_slideshow") |
---|
64 | + { |
---|
65 | + MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); |
---|
66 | + SlideshowSettings *ss = new SlideshowSettings(mainStack, "slideshow settings"); |
---|
67 | + |
---|
68 | + if (ss->Create()) |
---|
69 | + mainStack->AddScreen(ss); |
---|
70 | + } |
---|
71 | +} |
---|
72 | + |
---|
73 | +int runMenu(const QString &menuname) |
---|
74 | +{ |
---|
75 | + QString themedir = GetMythUI()->GetThemeDir(); |
---|
76 | + |
---|
77 | + MythThemedMenu *menu = |
---|
78 | + new MythThemedMenu(themedir, menuname, |
---|
79 | + GetMythMainWindow()->GetMainStack(), |
---|
80 | + "music menu"); |
---|
81 | + |
---|
82 | + menu->setCallback(GalleryCallback, NULL); |
---|
83 | + menu->setKillable(); |
---|
84 | + |
---|
85 | + if (menu->foundTheme()) |
---|
86 | + { |
---|
87 | + GetMythMainWindow()->GetMainStack()->AddScreen(menu); |
---|
88 | + return 0; |
---|
89 | + } |
---|
90 | + else |
---|
91 | + { |
---|
92 | + VERBOSE(VB_IMPORTANT, QString("Couldn't find menu %1 or theme %2") |
---|
93 | + .arg(menuname).arg(themedir)); |
---|
94 | + delete menu; |
---|
95 | + return -1; |
---|
96 | + } |
---|
97 | +} |
---|
98 | + |
---|
99 | int mythplugin_init(const char *libversion) |
---|
100 | { |
---|
101 | if (!gContext->TestPopupVersion("mythgallery", libversion, |
---|
102 | @@ -120,10 +175,6 @@ |
---|
103 | UpgradeGalleryDatabaseSchema(); |
---|
104 | gContext->ActivateSettingsCache(true); |
---|
105 | |
---|
106 | - GallerySettings settings; |
---|
107 | - settings.Load(); |
---|
108 | - settings.Save(); |
---|
109 | - |
---|
110 | setupKeys(); |
---|
111 | |
---|
112 | return 0; |
---|
113 | @@ -136,9 +187,6 @@ |
---|
114 | |
---|
115 | int mythplugin_config(void) |
---|
116 | { |
---|
117 | - GallerySettings settings; |
---|
118 | - settings.exec(); |
---|
119 | - |
---|
120 | - return 0; |
---|
121 | + return runMenu("gallery_settings.xml"); |
---|
122 | } |
---|
123 | |
---|
124 | --- mythgallery/theme/default-wide/gallery-ui.xml 2009-12-23 12:58:28.607450061 +0100 |
---|
125 | +++ mythgallery/theme/default-wide/gallery-ui.xml 2009-12-23 18:52:42.289432000 +0100 |
---|
126 | @@ -114,4 +114,175 @@ |
---|
127 | |
---|
128 | </window> |
---|
129 | |
---|
130 | + |
---|
131 | + <window name="generalsettings"> |
---|
132 | + |
---|
133 | + <textarea name="gallerydir_label" from="basetextarea"> |
---|
134 | + <area>200,140,440,40</area> |
---|
135 | + <align>right,vcenter</align> |
---|
136 | + <value>Directory that holds images:</value> |
---|
137 | + </textarea> |
---|
138 | + <textarea name="gallerydirfilter_label" from="basetextarea"> |
---|
139 | + <area>200,190,440,40</area> |
---|
140 | + <align>right,vcenter</align> |
---|
141 | + <value>Directory filter:</value> |
---|
142 | + </textarea> |
---|
143 | + <textarea name="defaultthumbnaildir_label" from="basetextarea"> |
---|
144 | + <area>200,240,440,40</area> |
---|
145 | + <align>right,vcenter</align> |
---|
146 | + <value>Store thumbnails in image directory:</value> |
---|
147 | + </textarea> |
---|
148 | + <textarea name="scalemax_label" from="basetextarea"> |
---|
149 | + <area>200,290,440,40</area> |
---|
150 | + <align>right,vcenter</align> |
---|
151 | + <value>Scale image to the maximum screen size:</value> |
---|
152 | + </textarea> |
---|
153 | + <textarea name="filesortorder_label" from="basetextarea"> |
---|
154 | + <area>200,340,440,40</area> |
---|
155 | + <align>right,vcenter</align> |
---|
156 | + <value>Sort order when browsing:</value> |
---|
157 | + </textarea> |
---|
158 | + <textarea name="importdirs_label" from="basetextarea"> |
---|
159 | + <area>200,390,440,40</area> |
---|
160 | + <align>right,vcenter</align> |
---|
161 | + <value>Paths to import images from:</value> |
---|
162 | + </textarea> |
---|
163 | + <textarea name="movieplayercmd_label" from="basetextarea"> |
---|
164 | + <area>200,440,440,40</area> |
---|
165 | + <align>right,vcenter</align> |
---|
166 | + <value>Command run to display movie files:</value> |
---|
167 | + </textarea> |
---|
168 | + |
---|
169 | + <textedit name="gallerydir" from="basetextedit"> |
---|
170 | + <position>650,140</position> |
---|
171 | + </textedit> |
---|
172 | + <textedit name="gallerydirfilter" from="basetextedit"> |
---|
173 | + <position>650,190</position> |
---|
174 | + </textedit> |
---|
175 | + <checkbox name="defaultthumbnaildir" from="basecheckbox"> |
---|
176 | + <position>650,245</position> |
---|
177 | + </checkbox> |
---|
178 | + <checkbox name="scalemax" from="basecheckbox"> |
---|
179 | + <position>650,295</position> |
---|
180 | + </checkbox> |
---|
181 | + <buttonlist name="filesortorder" from="baseselector"> |
---|
182 | + <position>650,340</position> |
---|
183 | + </buttonlist> |
---|
184 | + <textedit name="importdirs" from="basetextedit"> |
---|
185 | + <position>650,390</position> |
---|
186 | + </textedit> |
---|
187 | + <textedit name="movieplayercmd" from="basetextedit"> |
---|
188 | + <position>650,440</position> |
---|
189 | + </textedit> |
---|
190 | + |
---|
191 | + <textarea name="helptext" from="basetextarea"> |
---|
192 | + <area>215,500,850,80</area> |
---|
193 | + <cutdown>yes</cutdown> |
---|
194 | + <align>allcenter</align> |
---|
195 | + <multiline>yes</multiline> |
---|
196 | + </textarea> |
---|
197 | + |
---|
198 | + <button name="save" from="basebutton"> |
---|
199 | + <position>480,600</position> |
---|
200 | + <value>Save</value> |
---|
201 | + </button> |
---|
202 | + <button name="cancel" from="basebutton"> |
---|
203 | + <position>650,600</position> |
---|
204 | + <value>Cancel</value> |
---|
205 | + </button> |
---|
206 | + |
---|
207 | + </window> |
---|
208 | + |
---|
209 | + |
---|
210 | + <window name="slideshowsettings"> |
---|
211 | + |
---|
212 | + <textarea name="slideshowdelay_label" from="basetextarea"> |
---|
213 | + <area>240,90,400,40</area> |
---|
214 | + <align>right,vcenter</align> |
---|
215 | + <value>Slideshow Delay:</value> |
---|
216 | + </textarea> |
---|
217 | + <textarea name="recursiveslideshow_label" from="basetextarea"> |
---|
218 | + <area>240,140,400,40</area> |
---|
219 | + <align>right,vcenter</align> |
---|
220 | + <value>Recurse into directories:</value> |
---|
221 | + </textarea> |
---|
222 | + <textarea name="useopengl_label" from="basetextarea"> |
---|
223 | + <area>240,190,400,40</area> |
---|
224 | + <align>right,vcenter</align> |
---|
225 | + <value>Use OpenGL transitions:</value> |
---|
226 | + </textarea> |
---|
227 | + |
---|
228 | + <textarea name="opengltransition_label" from="basetextarea"> |
---|
229 | + <area>240,255,400,40</area> |
---|
230 | + <align>right,vcenter</align> |
---|
231 | + <value>Type of OpenGL transition:</value> |
---|
232 | + </textarea> |
---|
233 | + <textarea name="opengltransitionlength_label" from="basetextarea"> |
---|
234 | + <area>240,310,400,40</area> |
---|
235 | + <align>right,vcenter</align> |
---|
236 | + <value>Duration of OpenGL Transition (milliseconds):</value> |
---|
237 | + </textarea> |
---|
238 | + |
---|
239 | + <textarea name="showcaption_label" from="basetextarea"> |
---|
240 | + <area>240,380,400,40</area> |
---|
241 | + <align>right,vcenter</align> |
---|
242 | + <value>Overlay caption:</value> |
---|
243 | + </textarea> |
---|
244 | + <textarea name="slideshowtransition_label" from="basetextarea"> |
---|
245 | + <area>240,430,400,40</area> |
---|
246 | + <align>right,vcenter</align> |
---|
247 | + <value>Type of transition:</value> |
---|
248 | + </textarea> |
---|
249 | + <textarea name="slideshowbackground_label" from="basetextarea"> |
---|
250 | + <area>240,480,400,40</area> |
---|
251 | + <align>right,vcenter</align> |
---|
252 | + <value>Type of background:</value> |
---|
253 | + </textarea> |
---|
254 | + |
---|
255 | + <spinbox name="slideshowdelay" from="basespinbox"> |
---|
256 | + <position>650,90</position> |
---|
257 | + </spinbox> |
---|
258 | + <checkbox name="recursiveslideshow" from="basecheckbox"> |
---|
259 | + <position>650,145</position> |
---|
260 | + </checkbox> |
---|
261 | + <checkbox name="useopengl" from="basecheckbox"> |
---|
262 | + <position>650,195</position> |
---|
263 | + </checkbox> |
---|
264 | + |
---|
265 | + <buttonlist name="opengltransition" from="baseselector"> |
---|
266 | + <position>650,255</position> |
---|
267 | + </buttonlist> |
---|
268 | + <spinbox name="opengltransitionlength" from="basespinbox"> |
---|
269 | + <position>650,310</position> |
---|
270 | + </spinbox> |
---|
271 | + |
---|
272 | + <spinbox name="showcaption" from="basespinbox"> |
---|
273 | + <position>650,380</position> |
---|
274 | + </spinbox> |
---|
275 | + <buttonlist name="slideshowtransition" from="baseselector"> |
---|
276 | + <position>650,430</position> |
---|
277 | + </buttonlist> |
---|
278 | + <buttonlist name="slideshowbackground" from="baseselector"> |
---|
279 | + <position>650,480</position> |
---|
280 | + </buttonlist> |
---|
281 | + |
---|
282 | + <textarea name="helptext" from="basetextarea"> |
---|
283 | + <area>255,540,770,80</area> |
---|
284 | + <cutdown>yes</cutdown> |
---|
285 | + <align>allcenter</align> |
---|
286 | + <multiline>yes</multiline> |
---|
287 | + </textarea> |
---|
288 | + |
---|
289 | + <button name="save" from="basebutton"> |
---|
290 | + <position>480,640</position> |
---|
291 | + <value>Save</value> |
---|
292 | + </button> |
---|
293 | + <button name="cancel" from="basebutton"> |
---|
294 | + <position>650,640</position> |
---|
295 | + <value>Cancel</value> |
---|
296 | + </button> |
---|
297 | + |
---|
298 | + </window> |
---|
299 | + |
---|
300 | + |
---|
301 | </mythuitheme> |
---|
302 | --- mythgallery/theme/menus/gallery_settings.xml 1970-01-01 01:00:00.000000000 +0100 |
---|
303 | +++ mythgallery/theme/menus/gallery_settings.xml 2009-12-23 17:31:34.894321000 +0100 |
---|
304 | @@ -0,0 +1,34 @@ |
---|
305 | +<mythmenu name="GALLERY_SETTINGS"> |
---|
306 | + |
---|
307 | + <button> |
---|
308 | + <type>GALLERY_SETTINGS_GENERAL</type> |
---|
309 | + <text>General Settings</text> |
---|
310 | + <text lang="IT">Impostazioni generali</text> |
---|
311 | + <text lang="ES">Opciones Generales</text> |
---|
312 | + <text lang="CA">Opcions Generals</text> |
---|
313 | + <text lang="DE">Grundeinstellungen</text> |
---|
314 | + <text lang="DA">Generelle indstillinger</text> |
---|
315 | + <text lang="NL">Algemeen</text> |
---|
316 | + <text lang="PT">Configurações Gerais</text> |
---|
317 | + <text lang="SV">Generellt</text> |
---|
318 | + <text lang="JA">å
šè¬èšå®</text> |
---|
319 | + <text lang="FI">Yleiset Asetukset</text> |
---|
320 | + <text lang="SL">Splošne nastavitve</text> |
---|
321 | + <text lang="ET">Ãldised sÀtted</text> |
---|
322 | + <text lang="RU">ÐбÑОе МаÑÑÑПйкО</text> |
---|
323 | + <text lang="PL">Ustawienia ogólne</text> |
---|
324 | + <text lang="NB">Generelle innstillinger</text> |
---|
325 | + <action>SETTINGS_GENERAL</action> |
---|
326 | + <description>Gallery folders and general options</description> |
---|
327 | + </button> |
---|
328 | + |
---|
329 | + <button> |
---|
330 | + <type>MUSIC_SETTINGS_SLIDESHOW</type> |
---|
331 | + <text>Slideshow Settings</text> |
---|
332 | + <text lang="DE">Diashow Einstellungen</text> |
---|
333 | + <action>SETTINGS_SLIDESHOW</action> |
---|
334 | + <description>Slideshow apperance and OpenGL options</description> |
---|
335 | + <description lang="DE">Diashow-Aussehen und OpenGL Optionen</description> |
---|
336 | + </button> |
---|
337 | + |
---|
338 | +</mythmenu> |
---|
339 | --- mythgallery/mythgallery/iconview.h 2009-12-23 12:58:25.802402991 +0100 |
---|
340 | +++ mythgallery/mythgallery/iconview.h 2009-12-23 14:41:25.313400668 +0100 |
---|
341 | @@ -77,6 +77,11 @@ |
---|
342 | void HandleSubMenuMetadata(void); |
---|
343 | void HandleSubMenuMark(void); |
---|
344 | void HandleSubMenuFile(void); |
---|
345 | + void HandleSubMenuSettings(void); |
---|
346 | + |
---|
347 | + void HandleGeneralSettings(void); |
---|
348 | + void HandleSlideshowSettings(void); |
---|
349 | + void ReloadSettings(void); |
---|
350 | |
---|
351 | private slots: |
---|
352 | void HandleRotateCW(void); |
---|
353 | @@ -84,7 +89,6 @@ |
---|
354 | void HandleDeleteCurrent(void); |
---|
355 | void HandleSlideShow(void); |
---|
356 | void HandleRandomShow(void); |
---|
357 | - void HandleSettings(void); |
---|
358 | void HandleEject(void); |
---|
359 | void HandleImport(void); |
---|
360 | void HandleShowDevices(void); |
---|
361 | --- mythgallery/mythgallery/iconview.cpp 2009-12-23 12:58:25.709400144 +0100 |
---|
362 | +++ mythgallery/mythgallery/iconview.cpp 2009-12-23 17:33:09.063402319 +0100 |
---|
363 | @@ -45,7 +45,8 @@ |
---|
364 | |
---|
365 | // MythGallery headers |
---|
366 | #include "galleryutil.h" |
---|
367 | -#include "gallerysettings.h" |
---|
368 | +#include "generalsettings.h" |
---|
369 | +#include "slideshowsettings.h" |
---|
370 | #include "thumbgenerator.h" |
---|
371 | #include "iconview.h" |
---|
372 | #include "singleview.h" |
---|
373 | @@ -757,7 +758,19 @@ |
---|
374 | HandleSubMenuFile(); |
---|
375 | break; |
---|
376 | case 5: |
---|
377 | - HandleSettings(); |
---|
378 | + HandleSubMenuSettings(); |
---|
379 | + break; |
---|
380 | + } |
---|
381 | + } |
---|
382 | + else if (resultid == "settingsmenu") |
---|
383 | + { |
---|
384 | + switch (buttonnum) |
---|
385 | + { |
---|
386 | + case 0: |
---|
387 | + HandleGeneralSettings(); |
---|
388 | + break; |
---|
389 | + case 1: |
---|
390 | + HandleSlideshowSettings(); |
---|
391 | break; |
---|
392 | } |
---|
393 | } |
---|
394 | @@ -915,6 +928,21 @@ |
---|
395 | m_menuPopup->AddButton(tr("Rename")); |
---|
396 | } |
---|
397 | |
---|
398 | +void IconView::HandleSubMenuSettings(void) |
---|
399 | +{ |
---|
400 | + QString label = tr("Settings Options"); |
---|
401 | + |
---|
402 | + m_menuPopup = new MythDialogBox(label, m_popupStack, "mythgallerymenupopup"); |
---|
403 | + |
---|
404 | + if (m_menuPopup->Create()) |
---|
405 | + m_popupStack->AddScreen(m_menuPopup); |
---|
406 | + |
---|
407 | + m_menuPopup->SetReturnEvent(this, "settingsmenu"); |
---|
408 | + |
---|
409 | + m_menuPopup->AddButton(tr("General Options")); |
---|
410 | + m_menuPopup->AddButton(tr("Slideshow Options")); |
---|
411 | +} |
---|
412 | + |
---|
413 | void IconView::HandleRotateCW(void) |
---|
414 | { |
---|
415 | ThumbItem *thumbitem = GetCurrentThumb(); |
---|
416 | @@ -987,10 +1015,30 @@ |
---|
417 | } |
---|
418 | } |
---|
419 | |
---|
420 | -void IconView::HandleSettings(void) |
---|
421 | +void IconView::HandleGeneralSettings(void) |
---|
422 | +{ |
---|
423 | + MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); |
---|
424 | + GeneralSettings *gs = new GeneralSettings(mainStack, "general settings"); |
---|
425 | + |
---|
426 | + if (gs->Create()) |
---|
427 | + mainStack->AddScreen(gs); |
---|
428 | + |
---|
429 | + ReloadSettings(); |
---|
430 | +} |
---|
431 | + |
---|
432 | +void IconView::HandleSlideshowSettings(void) |
---|
433 | +{ |
---|
434 | + MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); |
---|
435 | + SlideshowSettings *ss = new SlideshowSettings(mainStack, "slideshow settings"); |
---|
436 | + |
---|
437 | + if (ss->Create()) |
---|
438 | + mainStack->AddScreen(ss); |
---|
439 | + |
---|
440 | + ReloadSettings(); |
---|
441 | +} |
---|
442 | + |
---|
443 | +void IconView::ReloadSettings(void) |
---|
444 | { |
---|
445 | - GallerySettings settings; |
---|
446 | - settings.exec(); |
---|
447 | gContext->ClearSettingsCache(); |
---|
448 | |
---|
449 | // reload settings |
---|
450 | --- mythgallery/mythgallery/generalsettings.cpp 1970-01-01 01:00:00.000000000 +0100 |
---|
451 | +++ mythgallery/mythgallery/generalsettings.cpp 2009-12-23 18:03:23.837788522 +0100 |
---|
452 | @@ -0,0 +1,169 @@ |
---|
453 | +#include <iostream> |
---|
454 | +using namespace std; |
---|
455 | + |
---|
456 | +// Qt |
---|
457 | +#include <QString> |
---|
458 | + |
---|
459 | +// MythTV |
---|
460 | +#include <mythtv/mythcontext.h> |
---|
461 | +#include <mythtv/mythdbcon.h> |
---|
462 | +#include <mythtv/mythdirs.h> |
---|
463 | + |
---|
464 | +#include "generalsettings.h" |
---|
465 | + |
---|
466 | + |
---|
467 | +GeneralSettings::GeneralSettings(MythScreenStack *parent, const char *name) |
---|
468 | + : MythScreenType(parent, name), |
---|
469 | + m_galleryDir(NULL), |
---|
470 | + m_galleryDirFilter(NULL), |
---|
471 | + m_useDefaultThumbnailDir(NULL), |
---|
472 | + m_scaleMax(NULL), |
---|
473 | + m_fileSortOrder(NULL), |
---|
474 | + m_importDirs(NULL), |
---|
475 | + m_moviePlayerCmd(NULL), |
---|
476 | + m_helpText(NULL), |
---|
477 | + m_saveButton(NULL), |
---|
478 | + m_cancelButton(NULL) |
---|
479 | +{ |
---|
480 | +} |
---|
481 | + |
---|
482 | +GeneralSettings::~GeneralSettings() |
---|
483 | +{ |
---|
484 | + |
---|
485 | +} |
---|
486 | + |
---|
487 | +bool GeneralSettings::Create() |
---|
488 | +{ |
---|
489 | + bool foundtheme = false; |
---|
490 | + |
---|
491 | + // Load the theme for this screen |
---|
492 | + foundtheme = LoadWindowFromXML("gallery-ui.xml", "generalsettings", this); |
---|
493 | + |
---|
494 | + if (!foundtheme) |
---|
495 | + return false; |
---|
496 | + |
---|
497 | + m_galleryDir = dynamic_cast<MythUITextEdit *> (GetChild("gallerydir")); |
---|
498 | + m_galleryDirFilter = dynamic_cast<MythUITextEdit *> (GetChild("gallerydirfilter")); |
---|
499 | + m_useDefaultThumbnailDir = dynamic_cast<MythUICheckBox *> (GetChild("defaultthumbnaildir")); |
---|
500 | + m_scaleMax = dynamic_cast<MythUICheckBox *> (GetChild("scalemax")); |
---|
501 | + m_fileSortOrder = dynamic_cast<MythUIButtonList *> (GetChild("filesortorder")); |
---|
502 | + m_importDirs = dynamic_cast<MythUITextEdit *> (GetChild("importdirs")); |
---|
503 | + m_moviePlayerCmd = dynamic_cast<MythUITextEdit *> (GetChild("movieplayercmd")); |
---|
504 | + m_helpText = dynamic_cast<MythUIText *> (GetChild("helptext")); |
---|
505 | + m_saveButton = dynamic_cast<MythUIButton *> (GetChild("save")); |
---|
506 | + m_cancelButton = dynamic_cast<MythUIButton *> (GetChild("cancel")); |
---|
507 | + |
---|
508 | + if (!m_galleryDir || !m_useDefaultThumbnailDir || !m_scaleMax || |
---|
509 | + !m_importDirs || !m_moviePlayerCmd || |
---|
510 | + !m_saveButton || !m_cancelButton) |
---|
511 | + { |
---|
512 | + VERBOSE(VB_IMPORTANT, "Theme is missing critical theme elements."); |
---|
513 | + return false; |
---|
514 | + } |
---|
515 | + |
---|
516 | + m_galleryDir->SetText(gContext->GetSetting("GalleryDir")); |
---|
517 | + m_galleryDirFilter->SetText(gContext->GetSetting("GalleryDirFilter")); |
---|
518 | + |
---|
519 | + int loadUseDefaultThumbnailDir = gContext->GetNumSetting("GalleryThumbnailLocation", 0); |
---|
520 | + if (loadUseDefaultThumbnailDir == 1) |
---|
521 | + m_useDefaultThumbnailDir->SetCheckState(MythUIStateType::Full); |
---|
522 | + |
---|
523 | + int loadScaleMax = gContext->GetNumSetting("GalleryScaleMax", 0); |
---|
524 | + if (loadScaleMax == 1) |
---|
525 | + m_scaleMax->SetCheckState(MythUIStateType::Full); |
---|
526 | + |
---|
527 | + new MythUIButtonListItem(m_fileSortOrder, tr("Name (A-Z alpha)"), qVariantFromValue( QString::number(QDir::Name | QDir::DirsFirst | QDir::IgnoreCase) )); |
---|
528 | + new MythUIButtonListItem(m_fileSortOrder, tr("Reverse Name (Z-A alpha)"), qVariantFromValue( QString::number(QDir::Name | QDir::DirsFirst | QDir::IgnoreCase | QDir::Reversed) )); |
---|
529 | + new MythUIButtonListItem(m_fileSortOrder, tr("Mod Time (earliest first)"), qVariantFromValue( QString::number(QDir::Time | QDir::DirsFirst | QDir::IgnoreCase | QDir::Reversed) )); |
---|
530 | + new MythUIButtonListItem(m_fileSortOrder, tr("Reverse Mod Time (most recent first)"), qVariantFromValue( QString::number(QDir::Time | QDir::DirsFirst | QDir::IgnoreCase) )); |
---|
531 | + new MythUIButtonListItem(m_fileSortOrder, tr("Creation Time (earliest first)"), qVariantFromValue( QString::number( 0x1000 | QDir::Reversed) )); |
---|
532 | + new MythUIButtonListItem(m_fileSortOrder, tr("Reverse Creation Time (most recent first)"), qVariantFromValue( QString::number( 0x1000 ) )); |
---|
533 | + m_fileSortOrder->SetValueByData(gContext->GetSetting("GallerySortOrder")); |
---|
534 | + |
---|
535 | + m_importDirs->SetText(gContext->GetSetting("GalleryImportDirs")); |
---|
536 | + m_moviePlayerCmd->SetText(gContext->GetSetting("GalleryMoviePlayerCmd")); |
---|
537 | + |
---|
538 | + connect(m_galleryDir, SIGNAL(TakingFocus()), SLOT(slotFocusChanged())); |
---|
539 | + connect(m_useDefaultThumbnailDir, SIGNAL(TakingFocus()), SLOT(slotFocusChanged())); |
---|
540 | + connect(m_scaleMax, SIGNAL(TakingFocus()), SLOT(slotFocusChanged())); |
---|
541 | + connect(m_fileSortOrder, SIGNAL(TakingFocus()), SLOT(slotFocusChanged())); |
---|
542 | + connect(m_importDirs, SIGNAL(TakingFocus()), SLOT(slotFocusChanged())); |
---|
543 | + connect(m_moviePlayerCmd, SIGNAL(TakingFocus()), SLOT(slotFocusChanged())); |
---|
544 | + |
---|
545 | + connect(m_saveButton, SIGNAL(Clicked()), this, SLOT(slotSave())); |
---|
546 | + connect(m_cancelButton, SIGNAL(Clicked()), this, SLOT(Close())); |
---|
547 | + |
---|
548 | + if (!BuildFocusList()) |
---|
549 | + VERBOSE(VB_IMPORTANT, "Failed to build a focuslist. Something is wrong"); |
---|
550 | + |
---|
551 | + SetFocusWidget(m_galleryDir); |
---|
552 | + |
---|
553 | + return true; |
---|
554 | +} |
---|
555 | + |
---|
556 | +bool GeneralSettings::keyPressEvent(QKeyEvent *event) |
---|
557 | +{ |
---|
558 | + if (GetFocusWidget()->keyPressEvent(event)) |
---|
559 | + return true; |
---|
560 | + |
---|
561 | + bool handled = false; |
---|
562 | + |
---|
563 | + if (!handled && MythScreenType::keyPressEvent(event)) |
---|
564 | + handled = true; |
---|
565 | + |
---|
566 | + return handled; |
---|
567 | +} |
---|
568 | + |
---|
569 | +void GeneralSettings::slotSave(void) |
---|
570 | +{ |
---|
571 | + gContext->SaveSetting("GalleryDir", m_galleryDir->GetText()); |
---|
572 | + gContext->SaveSetting("GalleryDirFilter", m_galleryDirFilter->GetText()); |
---|
573 | + gContext->SaveSetting("GalleryImportDirs", m_importDirs->GetText()); |
---|
574 | + gContext->SaveSetting("GalleryMoviePlayerCmd", m_moviePlayerCmd->GetText()); |
---|
575 | + |
---|
576 | + int saveUseDefaultThumbnailDir = (m_useDefaultThumbnailDir->GetCheckState() == MythUIStateType::Full) ? 1 : 0; |
---|
577 | + gContext->SaveSetting("GalleryThumbnailLocation", saveUseDefaultThumbnailDir); |
---|
578 | + |
---|
579 | + int saveScaleMax = (m_scaleMax->GetCheckState() == MythUIStateType::Full) ? 1 : 0; |
---|
580 | + gContext->SaveSetting("GalleryScaleMax", saveScaleMax); |
---|
581 | + |
---|
582 | + gContext->SaveSetting("GallerySortOrder", m_fileSortOrder->GetDataValue().toString()); |
---|
583 | + Close(); |
---|
584 | +} |
---|
585 | + |
---|
586 | +void GeneralSettings::slotFocusChanged(void) |
---|
587 | +{ |
---|
588 | + if (!m_helpText) |
---|
589 | + return; |
---|
590 | + |
---|
591 | + QString msg = ""; |
---|
592 | + if (GetFocusWidget() == m_galleryDir) |
---|
593 | + msg = tr("This directory must exist and " |
---|
594 | + "MythGallery needs to have read permission"); |
---|
595 | + else if (GetFocusWidget() == m_galleryDirFilter) |
---|
596 | + msg = tr("Enter direcory names to be excluded in the gallery browser. " |
---|
597 | + "(multiple entries are delimited with a colon)"); |
---|
598 | + else if (GetFocusWidget() == m_useDefaultThumbnailDir) |
---|
599 | + msg = tr("If set, thumbnails are stored in '.thumbcache' directories " |
---|
600 | + "within the above directory. If cleared, " |
---|
601 | + "they are stored in your home directory."); |
---|
602 | + else if (GetFocusWidget() == m_scaleMax) |
---|
603 | + msg = tr("Check this to scale the image to the maximum " |
---|
604 | + "No black borders will be visible."); |
---|
605 | + else if (GetFocusWidget() == m_fileSortOrder) |
---|
606 | + msg = tr("This is the sort order for the displayed " |
---|
607 | + "picture thumbnails."); |
---|
608 | + else if (GetFocusWidget() == m_importDirs) |
---|
609 | + msg = tr("This is a colon separated list of paths. " |
---|
610 | + "If the path in the list is a directory, its contents will " |
---|
611 | + "be copied. If it is an executable, it will be run."); |
---|
612 | + else if (GetFocusWidget() == m_moviePlayerCmd) |
---|
613 | + msg = tr("This command is executed whenever a movie " |
---|
614 | + "file is selected."); |
---|
615 | + else if (GetFocusWidget() == m_cancelButton) |
---|
616 | + msg = tr("Exit without saving settings"); |
---|
617 | + else if (GetFocusWidget() == m_saveButton) |
---|
618 | + msg = tr("Save settings and Exit"); |
---|
619 | + |
---|
620 | + m_helpText->SetText(msg); |
---|
621 | +} |
---|
622 | --- mythgallery/mythgallery/generalsettings.h 1970-01-01 01:00:00.000000000 +0100 |
---|
623 | +++ mythgallery/mythgallery/generalsettings.h 2009-12-23 14:50:26.147503191 +0100 |
---|
624 | @@ -0,0 +1,45 @@ |
---|
625 | +#ifndef GENERALSETTINGS_H |
---|
626 | +#define GENERALSETTINGS_H |
---|
627 | + |
---|
628 | +#include <mythtv/mythwidgets.h> |
---|
629 | +#include <mythtv/mythdialogs.h> |
---|
630 | + |
---|
631 | +#include <mythtv/libmythui/mythuispinbox.h> |
---|
632 | +#include <mythtv/libmythui/mythuibutton.h> |
---|
633 | +#include <mythtv/libmythui/mythuibuttonlist.h> |
---|
634 | +#include <mythtv/libmythui/mythuicheckbox.h> |
---|
635 | +#include <mythtv/libmythui/mythscreentype.h> |
---|
636 | +#include <mythtv/libmythui/mythdialogbox.h> |
---|
637 | + |
---|
638 | + |
---|
639 | +class GeneralSettings : public MythScreenType |
---|
640 | +{ |
---|
641 | + Q_OBJECT |
---|
642 | +public: |
---|
643 | + GeneralSettings(MythScreenStack *parent, const char *name = 0); |
---|
644 | + ~GeneralSettings(); |
---|
645 | + |
---|
646 | + bool Create(); |
---|
647 | + bool keyPressEvent(QKeyEvent *event); |
---|
648 | + |
---|
649 | + private: |
---|
650 | + MythUITextEdit *m_galleryDir; |
---|
651 | + MythUITextEdit *m_galleryDirFilter; |
---|
652 | + MythUICheckBox *m_useDefaultThumbnailDir; |
---|
653 | + MythUICheckBox *m_scaleMax; |
---|
654 | + MythUIButtonList *m_fileSortOrder; |
---|
655 | + MythUITextEdit *m_importDirs; |
---|
656 | + MythUITextEdit *m_moviePlayerCmd; |
---|
657 | + |
---|
658 | + MythUIText *m_helpText; |
---|
659 | + MythUIButton *m_saveButton; |
---|
660 | + MythUIButton *m_cancelButton; |
---|
661 | + |
---|
662 | +private slots: |
---|
663 | + void slotSave(void); |
---|
664 | + void slotFocusChanged(void); |
---|
665 | + |
---|
666 | +}; |
---|
667 | + |
---|
668 | +#endif // GENERALSETTINGS_H |
---|
669 | + |
---|
670 | --- mythgallery/mythgallery/slideshowsettings.h 1970-01-01 01:00:00.000000000 +0100 |
---|
671 | +++ mythgallery/mythgallery/slideshowsettings.h 2009-12-23 18:28:10.478526774 +0100 |
---|
672 | @@ -0,0 +1,46 @@ |
---|
673 | +#ifndef SLIDESHOWSETTINGS_H |
---|
674 | +#define SLIDESHOWSETTINGS_H |
---|
675 | + |
---|
676 | +#include <mythtv/mythwidgets.h> |
---|
677 | +#include <mythtv/mythdialogs.h> |
---|
678 | + |
---|
679 | +#include <mythtv/libmythui/mythuispinbox.h> |
---|
680 | +#include <mythtv/libmythui/mythuibutton.h> |
---|
681 | +#include <mythtv/libmythui/mythuibuttonlist.h> |
---|
682 | +#include <mythtv/libmythui/mythuicheckbox.h> |
---|
683 | +#include <mythtv/libmythui/mythscreentype.h> |
---|
684 | +#include <mythtv/libmythui/mythdialogbox.h> |
---|
685 | + |
---|
686 | + |
---|
687 | +class SlideshowSettings : public MythScreenType |
---|
688 | +{ |
---|
689 | + Q_OBJECT |
---|
690 | +public: |
---|
691 | + SlideshowSettings(MythScreenStack *parent, const char *name = 0); |
---|
692 | + ~SlideshowSettings(); |
---|
693 | + |
---|
694 | + bool Create(); |
---|
695 | + bool keyPressEvent(QKeyEvent *event); |
---|
696 | + |
---|
697 | +private: |
---|
698 | + MythUICheckBox *m_useOpenGL; |
---|
699 | + MythUISpinBox *m_slideShowDelay; |
---|
700 | + MythUICheckBox *m_recursiveSlideshow; |
---|
701 | + MythUIButtonList *m_openGLTransition; |
---|
702 | + MythUISpinBox *m_openGLTransitionLength; |
---|
703 | + MythUISpinBox *m_showCaption; |
---|
704 | + MythUIButtonList *m_slideShowTransition; |
---|
705 | + MythUIButtonList *m_slideShowBackground; |
---|
706 | + |
---|
707 | + MythUIText *m_helpText; |
---|
708 | + MythUIButton *m_saveButton; |
---|
709 | + MythUIButton *m_cancelButton; |
---|
710 | + |
---|
711 | +private slots: |
---|
712 | + void slotSave(void); |
---|
713 | + void slotFocusChanged(void); |
---|
714 | + void toggleUseOpenGL(void); |
---|
715 | + |
---|
716 | +}; |
---|
717 | + |
---|
718 | +#endif // SLIDESHOWSETTINGS_H |
---|
719 | --- mythgallery/mythgallery/slideshowsettings.cpp 1970-01-01 01:00:00.000000000 +0100 |
---|
720 | +++ mythgallery/mythgallery/slideshowsettings.cpp 2009-12-23 18:41:22.488774524 +0100 |
---|
721 | @@ -0,0 +1,233 @@ |
---|
722 | +#include <iostream> |
---|
723 | +using namespace std; |
---|
724 | + |
---|
725 | +// Qt |
---|
726 | +#include <QString> |
---|
727 | + |
---|
728 | +// MythTV |
---|
729 | +#include <mythtv/mythcontext.h> |
---|
730 | +#include <mythtv/mythdbcon.h> |
---|
731 | +#include <mythtv/mythdirs.h> |
---|
732 | + |
---|
733 | +#include "slideshowsettings.h" |
---|
734 | + |
---|
735 | + |
---|
736 | +SlideshowSettings::SlideshowSettings(MythScreenStack *parent, const char *name) |
---|
737 | + : MythScreenType(parent, name), |
---|
738 | + m_slideShowDelay(NULL), |
---|
739 | + m_recursiveSlideshow(NULL), |
---|
740 | + m_openGLTransition(NULL), |
---|
741 | + m_openGLTransitionLength(NULL), |
---|
742 | + m_showCaption(NULL), |
---|
743 | + m_slideShowTransition(NULL), |
---|
744 | + m_slideShowBackground(NULL), |
---|
745 | + m_helpText(NULL), |
---|
746 | + m_saveButton(NULL), |
---|
747 | + m_cancelButton(NULL) |
---|
748 | +{ |
---|
749 | +} |
---|
750 | + |
---|
751 | +SlideshowSettings::~SlideshowSettings() |
---|
752 | +{ |
---|
753 | + |
---|
754 | +} |
---|
755 | + |
---|
756 | +bool SlideshowSettings::Create() |
---|
757 | +{ |
---|
758 | + bool foundtheme = false; |
---|
759 | + |
---|
760 | + // Load the theme for this screen |
---|
761 | + foundtheme = LoadWindowFromXML("gallery-ui.xml", "slideshowsettings", this); |
---|
762 | + |
---|
763 | + if (!foundtheme) |
---|
764 | + return false; |
---|
765 | + |
---|
766 | + m_useOpenGL = dynamic_cast<MythUICheckBox *> (GetChild("useopengl")); |
---|
767 | + m_slideShowDelay = dynamic_cast<MythUISpinBox *> (GetChild("slideshowdelay")); |
---|
768 | + m_recursiveSlideshow = dynamic_cast<MythUICheckBox *> (GetChild("recursiveslideshow")); |
---|
769 | + m_openGLTransition = dynamic_cast<MythUIButtonList *> (GetChild("opengltransition")); |
---|
770 | + m_openGLTransitionLength = dynamic_cast<MythUISpinBox *> (GetChild("opengltransitionlength")); |
---|
771 | + m_showCaption = dynamic_cast<MythUISpinBox *> (GetChild("showcaption")); |
---|
772 | + m_slideShowTransition = dynamic_cast<MythUIButtonList *> (GetChild("slideshowtransition")); |
---|
773 | + m_slideShowBackground = dynamic_cast<MythUIButtonList *> (GetChild("slideshowbackground")); |
---|
774 | + m_helpText = dynamic_cast<MythUIText *> (GetChild("helptext")); |
---|
775 | + m_saveButton = dynamic_cast<MythUIButton *> (GetChild("save")); |
---|
776 | + m_cancelButton = dynamic_cast<MythUIButton *> (GetChild("cancel")); |
---|
777 | + |
---|
778 | + if (!m_useOpenGL || !m_slideShowDelay || !m_recursiveSlideshow || |
---|
779 | + !m_openGLTransition || !m_openGLTransitionLength || |
---|
780 | + !m_showCaption || !m_slideShowTransition || !m_slideShowBackground || |
---|
781 | + !m_saveButton || !m_cancelButton) |
---|
782 | + { |
---|
783 | + VERBOSE(VB_IMPORTANT, "Theme is missing critical theme elements."); |
---|
784 | + return false; |
---|
785 | + } |
---|
786 | + |
---|
787 | + int loadUseOpenGL = gContext->GetNumSetting("SlideshowUseOpenGL", 0); |
---|
788 | + if (loadUseOpenGL == 1) |
---|
789 | + m_useOpenGL->SetCheckState(MythUIStateType::Full); |
---|
790 | + |
---|
791 | + int loadRecursiveSlideshow = gContext->GetNumSetting("GalleryRecursiveSlideshow", 0); |
---|
792 | + if (loadRecursiveSlideshow == 1) |
---|
793 | + m_recursiveSlideshow->SetCheckState(MythUIStateType::Full); |
---|
794 | + |
---|
795 | + m_slideShowDelay->SetRange(1,600,1); |
---|
796 | + m_slideShowDelay->SetValue(gContext->GetNumSetting("SlideshowDelay")); |
---|
797 | + |
---|
798 | + new MythUIButtonListItem(m_openGLTransition, tr("None"), qVariantFromValue( QString("none"))); |
---|
799 | + new MythUIButtonListItem(m_openGLTransition, tr("Blend"), qVariantFromValue( QString("blend (gl)"))); |
---|
800 | + new MythUIButtonListItem(m_openGLTransition, tr("Zoom Blend"), qVariantFromValue( QString("zoom blend (gl)"))); |
---|
801 | + new MythUIButtonListItem(m_openGLTransition, tr("Fade"), qVariantFromValue( QString("fade (gl)"))); |
---|
802 | + new MythUIButtonListItem(m_openGLTransition, tr("Rotate"), qVariantFromValue( QString("rotate (gl)"))); |
---|
803 | + new MythUIButtonListItem(m_openGLTransition, tr("Bend"), qVariantFromValue( QString("bend (gl)"))); |
---|
804 | + new MythUIButtonListItem(m_openGLTransition, tr("In & Out"), qVariantFromValue( QString("inout (gl)"))); |
---|
805 | + new MythUIButtonListItem(m_openGLTransition, tr("Slide"), qVariantFromValue( QString("slide (gl)"))); |
---|
806 | + new MythUIButtonListItem(m_openGLTransition, tr("Flutter"), qVariantFromValue( QString("flutter (gl)"))); |
---|
807 | + new MythUIButtonListItem(m_openGLTransition, tr("Cube"), qVariantFromValue( QString("cube (gl)"))); |
---|
808 | + new MythUIButtonListItem(m_openGLTransition, tr("Random"), qVariantFromValue( QString("random (gl)"))); |
---|
809 | + m_openGLTransition->SetValueByData(gContext->GetSetting("SlideshowOpenGLTransition")); |
---|
810 | + |
---|
811 | + m_openGLTransitionLength->SetRange(1000, 10000, 200); |
---|
812 | + m_openGLTransitionLength->SetValue(gContext->GetNumSetting("SlideshowOpenGLTransitionLength")); |
---|
813 | + |
---|
814 | + m_showCaption->SetRange(0,600,1); |
---|
815 | + m_showCaption->SetValue(gContext->GetNumSetting("GalleryOverlayCaption")); |
---|
816 | + |
---|
817 | + new MythUIButtonListItem(m_slideShowTransition, tr("None"), qVariantFromValue( QString("none"))); |
---|
818 | + new MythUIButtonListItem(m_slideShowTransition, tr("Chess board"), qVariantFromValue( QString("chess board"))); |
---|
819 | + new MythUIButtonListItem(m_slideShowTransition, tr("Melt down"), qVariantFromValue( QString("melt down"))); |
---|
820 | + new MythUIButtonListItem(m_slideShowTransition, tr("Sweep"), qVariantFromValue( QString("sweep"))); |
---|
821 | + new MythUIButtonListItem(m_slideShowTransition, tr("Noise"), qVariantFromValue( QString("noise"))); |
---|
822 | + new MythUIButtonListItem(m_slideShowTransition, tr("Growing"), qVariantFromValue( QString("growing"))); |
---|
823 | + new MythUIButtonListItem(m_slideShowTransition, tr("Incoming edges"), qVariantFromValue( QString("incoming edges"))); |
---|
824 | + new MythUIButtonListItem(m_slideShowTransition, tr("Horizontal lines"), qVariantFromValue( QString("horizontal lines"))); |
---|
825 | + new MythUIButtonListItem(m_slideShowTransition, tr("Vertical lines"), qVariantFromValue( QString("vertical lines"))); |
---|
826 | + new MythUIButtonListItem(m_slideShowTransition, tr("Circle out"), qVariantFromValue( QString("circle out"))); |
---|
827 | + new MythUIButtonListItem(m_slideShowTransition, tr("Multicircle out"), qVariantFromValue( QString("multicircle out"))); |
---|
828 | + new MythUIButtonListItem(m_slideShowTransition, tr("Spiral in"), qVariantFromValue( QString("spiral in"))); |
---|
829 | + new MythUIButtonListItem(m_slideShowTransition, tr("Blobs"), qVariantFromValue( QString("blobs"))); |
---|
830 | + new MythUIButtonListItem(m_slideShowTransition, tr("Random"), qVariantFromValue( QString("random"))); |
---|
831 | + m_slideShowTransition->SetValueByData(gContext->GetSetting("SlideshowTransition")); |
---|
832 | + |
---|
833 | + new MythUIButtonListItem(m_slideShowBackground, tr("Theme background"), qVariantFromValue( QString("theme"))); |
---|
834 | + new MythUIButtonListItem(m_slideShowBackground, tr("Black background"), qVariantFromValue( QString("black"))); |
---|
835 | + new MythUIButtonListItem(m_slideShowBackground, tr("White background"), qVariantFromValue( QString("white"))); |
---|
836 | + m_slideShowBackground->SetValueByData(gContext->GetSetting("SlideshowBackground")); |
---|
837 | + |
---|
838 | + toggleUseOpenGL(); |
---|
839 | + |
---|
840 | + connect(m_useOpenGL, SIGNAL(TakingFocus()), SLOT(slotFocusChanged())); |
---|
841 | + connect(m_slideShowDelay, SIGNAL(TakingFocus()), SLOT(slotFocusChanged())); |
---|
842 | + connect(m_recursiveSlideshow, SIGNAL(TakingFocus()), SLOT(slotFocusChanged())); |
---|
843 | + connect(m_openGLTransition, SIGNAL(TakingFocus()), SLOT(slotFocusChanged())); |
---|
844 | + connect(m_openGLTransitionLength, SIGNAL(TakingFocus()), SLOT(slotFocusChanged())); |
---|
845 | + connect(m_showCaption, SIGNAL(TakingFocus()), SLOT(slotFocusChanged())); |
---|
846 | + connect(m_slideShowTransition, SIGNAL(TakingFocus()), SLOT(slotFocusChanged())); |
---|
847 | + connect(m_slideShowBackground, SIGNAL(TakingFocus()), SLOT(slotFocusChanged())); |
---|
848 | + connect(m_useOpenGL, SIGNAL(valueChanged()), SLOT(toggleUseOpenGL())); |
---|
849 | + |
---|
850 | + connect(m_saveButton, SIGNAL(Clicked()), this, SLOT(slotSave())); |
---|
851 | + connect(m_cancelButton, SIGNAL(Clicked()), this, SLOT(Close())); |
---|
852 | + |
---|
853 | + |
---|
854 | + if (!BuildFocusList()) |
---|
855 | + VERBOSE(VB_IMPORTANT, "Failed to build a focuslist. Something is wrong"); |
---|
856 | + |
---|
857 | + SetFocusWidget(m_slideShowDelay); |
---|
858 | + |
---|
859 | + return true; |
---|
860 | +} |
---|
861 | + |
---|
862 | +bool SlideshowSettings::keyPressEvent(QKeyEvent *event) |
---|
863 | +{ |
---|
864 | + if (GetFocusWidget()->keyPressEvent(event)) |
---|
865 | + return true; |
---|
866 | + |
---|
867 | + bool handled = false; |
---|
868 | + |
---|
869 | + if (!handled && MythScreenType::keyPressEvent(event)) |
---|
870 | + handled = true; |
---|
871 | + |
---|
872 | + return handled; |
---|
873 | +} |
---|
874 | + |
---|
875 | +void SlideshowSettings::slotSave(void) |
---|
876 | +{ |
---|
877 | + int saveUseOpenGL = (m_useOpenGL->GetCheckState() == MythUIStateType::Full) ? 1 : 0; |
---|
878 | + gContext->SaveSetting("SlideshowUseOpenGL", saveUseOpenGL); |
---|
879 | + |
---|
880 | + int saveRecursiveSlideshow = (m_recursiveSlideshow->GetCheckState() == MythUIStateType::Full) ? 1 : 0; |
---|
881 | + gContext->SaveSetting("GalleryRecursiveSlideshow", saveRecursiveSlideshow); |
---|
882 | + |
---|
883 | + gContext->SaveSetting("SlideshowDelay", m_slideShowDelay->GetValue()); |
---|
884 | + |
---|
885 | + if (m_useOpenGL->GetCheckState() == MythUIStateType::Full) |
---|
886 | + { |
---|
887 | + m_openGLTransition->SetVisible(true); |
---|
888 | + m_openGLTransitionLength->SetVisible(true); |
---|
889 | + } |
---|
890 | + else |
---|
891 | + { |
---|
892 | + gContext->SaveSetting("GalleryOverlayCaption", m_showCaption->GetValue()); |
---|
893 | + gContext->SaveSetting("SlideshowTransition", m_slideShowTransition->GetDataValue().toString()); |
---|
894 | + gContext->SaveSetting("SlideshowBackground", m_slideShowBackground->GetDataValue().toString()); |
---|
895 | + } |
---|
896 | + |
---|
897 | + Close(); |
---|
898 | +} |
---|
899 | + |
---|
900 | +void SlideshowSettings::slotFocusChanged(void) |
---|
901 | +{ |
---|
902 | + if (!m_helpText) |
---|
903 | + return; |
---|
904 | + |
---|
905 | + QString msg = ""; |
---|
906 | + if (GetFocusWidget() == m_useOpenGL) |
---|
907 | + msg = tr("Check this to enable OpenGL " |
---|
908 | + "based slideshow transitions"); |
---|
909 | + else if (GetFocusWidget() == m_slideShowDelay) |
---|
910 | + msg = tr("This is the number of seconds to display each picture."); |
---|
911 | + else if (GetFocusWidget() == m_recursiveSlideshow) |
---|
912 | + msg = tr("Check this to let the slideshow recurse into " |
---|
913 | + "sub-directories."); |
---|
914 | + else if (GetFocusWidget() == m_openGLTransition) |
---|
915 | + msg = tr("This is the type of OpenGL transition used " |
---|
916 | + "between pictures in slideshow mode."); |
---|
917 | + else if (GetFocusWidget() == m_openGLTransitionLength) |
---|
918 | + msg = tr("Duration of OpenGL Transition (milliseconds)"); |
---|
919 | + else if (GetFocusWidget() == m_showCaption) |
---|
920 | + msg = tr("This is the number of seconds to show a caption " |
---|
921 | + "on top of a full size picture."); |
---|
922 | + else if (GetFocusWidget() == m_slideShowTransition) |
---|
923 | + msg = tr("This is the type of transition used " |
---|
924 | + "between pictures in slideshow mode."); |
---|
925 | + else if (GetFocusWidget() == m_slideShowBackground) |
---|
926 | + msg = tr("This is the type of background for each " |
---|
927 | + "picture in single view mode."); |
---|
928 | + else if (GetFocusWidget() == m_cancelButton) |
---|
929 | + msg = tr("Exit without saving settings"); |
---|
930 | + else if (GetFocusWidget() == m_saveButton) |
---|
931 | + msg = tr("Save settings and Exit"); |
---|
932 | + |
---|
933 | + m_helpText->SetText(msg); |
---|
934 | +} |
---|
935 | + |
---|
936 | +void SlideshowSettings::toggleUseOpenGL() |
---|
937 | +{ |
---|
938 | + if (m_useOpenGL->GetCheckState() == MythUIStateType::Full) |
---|
939 | + { |
---|
940 | + m_openGLTransition->SetVisible(true); |
---|
941 | + m_openGLTransitionLength->SetVisible(true); |
---|
942 | + m_showCaption->SetVisible(false); |
---|
943 | + m_slideShowTransition->SetVisible(false); |
---|
944 | + m_slideShowBackground->SetVisible(false); |
---|
945 | + } |
---|
946 | + else |
---|
947 | + { |
---|
948 | + m_openGLTransition->SetVisible(false); |
---|
949 | + m_openGLTransitionLength->SetVisible(false); |
---|
950 | + m_showCaption->SetVisible(true); |
---|
951 | + m_slideShowTransition->SetVisible(true); |
---|
952 | + m_slideShowBackground->SetVisible(true); |
---|
953 | + } |
---|
954 | +} |
---|