Ticket #7795: mythgallery-mythui-settings.patch

File mythgallery-mythui-settings.patch, 34.4 KB (added by Robert S, 16 years ago)
Line 
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">å…
319šèˆ¬èš­å®š</text>
320+ <text lang="FI">Yleiset Asetukset</text>
321+ <text lang="SL">Splošne nastavitve</text>
322+ <text lang="ET">Üldised sÀtted</text>
323+ <text lang="RU">ОбщОе МастрПйкО</text>
324+ <text lang="PL">Ustawienia ogólne</text>
325+ <text lang="NB">Generelle innstillinger</text>
326+ <action>SETTINGS_GENERAL</action>
327+ <description>Gallery folders and general options</description>
328+ </button>
329+
330+ <button>
331+ <type>MUSIC_SETTINGS_SLIDESHOW</type>
332+ <text>Slideshow Settings</text>
333+ <text lang="DE">Diashow Einstellungen</text>
334+ <action>SETTINGS_SLIDESHOW</action>
335+ <description>Slideshow apperance and OpenGL options</description>
336+ <description lang="DE">Diashow-Aussehen und OpenGL Optionen</description>
337+ </button>
338+
339+</mythmenu>
340--- mythgallery/mythgallery/iconview.h 2009-12-23 12:58:25.802402991 +0100
341+++ mythgallery/mythgallery/iconview.h 2009-12-23 14:41:25.313400668 +0100
342@@ -77,6 +77,11 @@
343 void HandleSubMenuMetadata(void);
344 void HandleSubMenuMark(void);
345 void HandleSubMenuFile(void);
346+ void HandleSubMenuSettings(void);
347+
348+ void HandleGeneralSettings(void);
349+ void HandleSlideshowSettings(void);
350+ void ReloadSettings(void);
351
352 private slots:
353 void HandleRotateCW(void);
354@@ -84,7 +89,6 @@
355 void HandleDeleteCurrent(void);
356 void HandleSlideShow(void);
357 void HandleRandomShow(void);
358- void HandleSettings(void);
359 void HandleEject(void);
360 void HandleImport(void);
361 void HandleShowDevices(void);
362--- mythgallery/mythgallery/iconview.cpp 2009-12-23 12:58:25.709400144 +0100
363+++ mythgallery/mythgallery/iconview.cpp 2009-12-23 17:33:09.063402319 +0100
364@@ -45,7 +45,8 @@
365
366 // MythGallery headers
367 #include "galleryutil.h"
368-#include "gallerysettings.h"
369+#include "generalsettings.h"
370+#include "slideshowsettings.h"
371 #include "thumbgenerator.h"
372 #include "iconview.h"
373 #include "singleview.h"
374@@ -757,7 +758,19 @@
375 HandleSubMenuFile();
376 break;
377 case 5:
378- HandleSettings();
379+ HandleSubMenuSettings();
380+ break;
381+ }
382+ }
383+ else if (resultid == "settingsmenu")
384+ {
385+ switch (buttonnum)
386+ {
387+ case 0:
388+ HandleGeneralSettings();
389+ break;
390+ case 1:
391+ HandleSlideshowSettings();
392 break;
393 }
394 }
395@@ -915,6 +928,21 @@
396 m_menuPopup->AddButton(tr("Rename"));
397 }
398
399+void IconView::HandleSubMenuSettings(void)
400+{
401+ QString label = tr("Settings Options");
402+
403+ m_menuPopup = new MythDialogBox(label, m_popupStack, "mythgallerymenupopup");
404+
405+ if (m_menuPopup->Create())
406+ m_popupStack->AddScreen(m_menuPopup);
407+
408+ m_menuPopup->SetReturnEvent(this, "settingsmenu");
409+
410+ m_menuPopup->AddButton(tr("General Options"));
411+ m_menuPopup->AddButton(tr("Slideshow Options"));
412+}
413+
414 void IconView::HandleRotateCW(void)
415 {
416 ThumbItem *thumbitem = GetCurrentThumb();
417@@ -987,10 +1015,30 @@
418 }
419 }
420
421-void IconView::HandleSettings(void)
422+void IconView::HandleGeneralSettings(void)
423+{
424+ MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
425+ GeneralSettings *gs = new GeneralSettings(mainStack, "general settings");
426+
427+ if (gs->Create())
428+ mainStack->AddScreen(gs);
429+
430+ ReloadSettings();
431+}
432+
433+void IconView::HandleSlideshowSettings(void)
434+{
435+ MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
436+ SlideshowSettings *ss = new SlideshowSettings(mainStack, "slideshow settings");
437+
438+ if (ss->Create())
439+ mainStack->AddScreen(ss);
440+
441+ ReloadSettings();
442+}
443+
444+void IconView::ReloadSettings(void)
445 {
446- GallerySettings settings;
447- settings.exec();
448 gContext->ClearSettingsCache();
449
450 // reload settings
451--- mythgallery/mythgallery/generalsettings.cpp 1970-01-01 01:00:00.000000000 +0100
452+++ mythgallery/mythgallery/generalsettings.cpp 2009-12-23 18:03:23.837788522 +0100
453@@ -0,0 +1,169 @@
454+#include <iostream>
455+using namespace std;
456+
457+// Qt
458+#include <QString>
459+
460+// MythTV
461+#include <mythtv/mythcontext.h>
462+#include <mythtv/mythdbcon.h>
463+#include <mythtv/mythdirs.h>
464+
465+#include "generalsettings.h"
466+
467+
468+GeneralSettings::GeneralSettings(MythScreenStack *parent, const char *name)
469+ : MythScreenType(parent, name),
470+ m_galleryDir(NULL),
471+ m_galleryDirFilter(NULL),
472+ m_useDefaultThumbnailDir(NULL),
473+ m_scaleMax(NULL),
474+ m_fileSortOrder(NULL),
475+ m_importDirs(NULL),
476+ m_moviePlayerCmd(NULL),
477+ m_helpText(NULL),
478+ m_saveButton(NULL),
479+ m_cancelButton(NULL)
480+{
481+}
482+
483+GeneralSettings::~GeneralSettings()
484+{
485+
486+}
487+
488+bool GeneralSettings::Create()
489+{
490+ bool foundtheme = false;
491+
492+ // Load the theme for this screen
493+ foundtheme = LoadWindowFromXML("gallery-ui.xml", "generalsettings", this);
494+
495+ if (!foundtheme)
496+ return false;
497+
498+ m_galleryDir = dynamic_cast<MythUITextEdit *> (GetChild("gallerydir"));
499+ m_galleryDirFilter = dynamic_cast<MythUITextEdit *> (GetChild("gallerydirfilter"));
500+ m_useDefaultThumbnailDir = dynamic_cast<MythUICheckBox *> (GetChild("defaultthumbnaildir"));
501+ m_scaleMax = dynamic_cast<MythUICheckBox *> (GetChild("scalemax"));
502+ m_fileSortOrder = dynamic_cast<MythUIButtonList *> (GetChild("filesortorder"));
503+ m_importDirs = dynamic_cast<MythUITextEdit *> (GetChild("importdirs"));
504+ m_moviePlayerCmd = dynamic_cast<MythUITextEdit *> (GetChild("movieplayercmd"));
505+ m_helpText = dynamic_cast<MythUIText *> (GetChild("helptext"));
506+ m_saveButton = dynamic_cast<MythUIButton *> (GetChild("save"));
507+ m_cancelButton = dynamic_cast<MythUIButton *> (GetChild("cancel"));
508+
509+ if (!m_galleryDir || !m_useDefaultThumbnailDir || !m_scaleMax ||
510+ !m_importDirs || !m_moviePlayerCmd ||
511+ !m_saveButton || !m_cancelButton)
512+ {
513+ VERBOSE(VB_IMPORTANT, "Theme is missing critical theme elements.");
514+ return false;
515+ }
516+
517+ m_galleryDir->SetText(gContext->GetSetting("GalleryDir"));
518+ m_galleryDirFilter->SetText(gContext->GetSetting("GalleryDirFilter"));
519+
520+ int loadUseDefaultThumbnailDir = gContext->GetNumSetting("GalleryThumbnailLocation", 0);
521+ if (loadUseDefaultThumbnailDir == 1)
522+ m_useDefaultThumbnailDir->SetCheckState(MythUIStateType::Full);
523+
524+ int loadScaleMax = gContext->GetNumSetting("GalleryScaleMax", 0);
525+ if (loadScaleMax == 1)
526+ m_scaleMax->SetCheckState(MythUIStateType::Full);
527+
528+ new MythUIButtonListItem(m_fileSortOrder, tr("Name (A-Z alpha)"), qVariantFromValue( QString::number(QDir::Name | QDir::DirsFirst | QDir::IgnoreCase) ));
529+ new MythUIButtonListItem(m_fileSortOrder, tr("Reverse Name (Z-A alpha)"), qVariantFromValue( QString::number(QDir::Name | QDir::DirsFirst | QDir::IgnoreCase | QDir::Reversed) ));
530+ new MythUIButtonListItem(m_fileSortOrder, tr("Mod Time (earliest first)"), qVariantFromValue( QString::number(QDir::Time | QDir::DirsFirst | QDir::IgnoreCase | QDir::Reversed) ));
531+ new MythUIButtonListItem(m_fileSortOrder, tr("Reverse Mod Time (most recent first)"), qVariantFromValue( QString::number(QDir::Time | QDir::DirsFirst | QDir::IgnoreCase) ));
532+ new MythUIButtonListItem(m_fileSortOrder, tr("Creation Time (earliest first)"), qVariantFromValue( QString::number( 0x1000 | QDir::Reversed) ));
533+ new MythUIButtonListItem(m_fileSortOrder, tr("Reverse Creation Time (most recent first)"), qVariantFromValue( QString::number( 0x1000 ) ));
534+ m_fileSortOrder->SetValueByData(gContext->GetSetting("GallerySortOrder"));
535+
536+ m_importDirs->SetText(gContext->GetSetting("GalleryImportDirs"));
537+ m_moviePlayerCmd->SetText(gContext->GetSetting("GalleryMoviePlayerCmd"));
538+
539+ connect(m_galleryDir, SIGNAL(TakingFocus()), SLOT(slotFocusChanged()));
540+ connect(m_useDefaultThumbnailDir, SIGNAL(TakingFocus()), SLOT(slotFocusChanged()));
541+ connect(m_scaleMax, SIGNAL(TakingFocus()), SLOT(slotFocusChanged()));
542+ connect(m_fileSortOrder, SIGNAL(TakingFocus()), SLOT(slotFocusChanged()));
543+ connect(m_importDirs, SIGNAL(TakingFocus()), SLOT(slotFocusChanged()));
544+ connect(m_moviePlayerCmd, SIGNAL(TakingFocus()), SLOT(slotFocusChanged()));
545+
546+ connect(m_saveButton, SIGNAL(Clicked()), this, SLOT(slotSave()));
547+ connect(m_cancelButton, SIGNAL(Clicked()), this, SLOT(Close()));
548+
549+ if (!BuildFocusList())
550+ VERBOSE(VB_IMPORTANT, "Failed to build a focuslist. Something is wrong");
551+
552+ SetFocusWidget(m_galleryDir);
553+
554+ return true;
555+}
556+
557+bool GeneralSettings::keyPressEvent(QKeyEvent *event)
558+{
559+ if (GetFocusWidget()->keyPressEvent(event))
560+ return true;
561+
562+ bool handled = false;
563+
564+ if (!handled && MythScreenType::keyPressEvent(event))
565+ handled = true;
566+
567+ return handled;
568+}
569+
570+void GeneralSettings::slotSave(void)
571+{
572+ gContext->SaveSetting("GalleryDir", m_galleryDir->GetText());
573+ gContext->SaveSetting("GalleryDirFilter", m_galleryDirFilter->GetText());
574+ gContext->SaveSetting("GalleryImportDirs", m_importDirs->GetText());
575+ gContext->SaveSetting("GalleryMoviePlayerCmd", m_moviePlayerCmd->GetText());
576+
577+ int saveUseDefaultThumbnailDir = (m_useDefaultThumbnailDir->GetCheckState() == MythUIStateType::Full) ? 1 : 0;
578+ gContext->SaveSetting("GalleryThumbnailLocation", saveUseDefaultThumbnailDir);
579+
580+ int saveScaleMax = (m_scaleMax->GetCheckState() == MythUIStateType::Full) ? 1 : 0;
581+ gContext->SaveSetting("GalleryScaleMax", saveScaleMax);
582+
583+ gContext->SaveSetting("GallerySortOrder", m_fileSortOrder->GetDataValue().toString());
584+ Close();
585+}
586+
587+void GeneralSettings::slotFocusChanged(void)
588+{
589+ if (!m_helpText)
590+ return;
591+
592+ QString msg = "";
593+ if (GetFocusWidget() == m_galleryDir)
594+ msg = tr("This directory must exist and "
595+ "MythGallery needs to have read permission");
596+ else if (GetFocusWidget() == m_galleryDirFilter)
597+ msg = tr("Enter direcory names to be excluded in the gallery browser. "
598+ "(multiple entries are delimited with a colon)");
599+ else if (GetFocusWidget() == m_useDefaultThumbnailDir)
600+ msg = tr("If set, thumbnails are stored in '.thumbcache' directories "
601+ "within the above directory. If cleared, "
602+ "they are stored in your home directory.");
603+ else if (GetFocusWidget() == m_scaleMax)
604+ msg = tr("Check this to scale the image to the maximum "
605+ "No black borders will be visible.");
606+ else if (GetFocusWidget() == m_fileSortOrder)
607+ msg = tr("This is the sort order for the displayed "
608+ "picture thumbnails.");
609+ else if (GetFocusWidget() == m_importDirs)
610+ msg = tr("This is a colon separated list of paths. "
611+ "If the path in the list is a directory, its contents will "
612+ "be copied. If it is an executable, it will be run.");
613+ else if (GetFocusWidget() == m_moviePlayerCmd)
614+ msg = tr("This command is executed whenever a movie "
615+ "file is selected.");
616+ else if (GetFocusWidget() == m_cancelButton)
617+ msg = tr("Exit without saving settings");
618+ else if (GetFocusWidget() == m_saveButton)
619+ msg = tr("Save settings and Exit");
620+
621+ m_helpText->SetText(msg);
622+}
623--- mythgallery/mythgallery/generalsettings.h 1970-01-01 01:00:00.000000000 +0100
624+++ mythgallery/mythgallery/generalsettings.h 2009-12-23 14:50:26.147503191 +0100
625@@ -0,0 +1,45 @@
626+#ifndef GENERALSETTINGS_H
627+#define GENERALSETTINGS_H
628+
629+#include <mythtv/mythwidgets.h>
630+#include <mythtv/mythdialogs.h>
631+
632+#include <mythtv/libmythui/mythuispinbox.h>
633+#include <mythtv/libmythui/mythuibutton.h>
634+#include <mythtv/libmythui/mythuibuttonlist.h>
635+#include <mythtv/libmythui/mythuicheckbox.h>
636+#include <mythtv/libmythui/mythscreentype.h>
637+#include <mythtv/libmythui/mythdialogbox.h>
638+
639+
640+class GeneralSettings : public MythScreenType
641+{
642+ Q_OBJECT
643+public:
644+ GeneralSettings(MythScreenStack *parent, const char *name = 0);
645+ ~GeneralSettings();
646+
647+ bool Create();
648+ bool keyPressEvent(QKeyEvent *event);
649+
650+ private:
651+ MythUITextEdit *m_galleryDir;
652+ MythUITextEdit *m_galleryDirFilter;
653+ MythUICheckBox *m_useDefaultThumbnailDir;
654+ MythUICheckBox *m_scaleMax;
655+ MythUIButtonList *m_fileSortOrder;
656+ MythUITextEdit *m_importDirs;
657+ MythUITextEdit *m_moviePlayerCmd;
658+
659+ MythUIText *m_helpText;
660+ MythUIButton *m_saveButton;
661+ MythUIButton *m_cancelButton;
662+
663+private slots:
664+ void slotSave(void);
665+ void slotFocusChanged(void);
666+
667+};
668+
669+#endif // GENERALSETTINGS_H
670+
671--- mythgallery/mythgallery/slideshowsettings.h 1970-01-01 01:00:00.000000000 +0100
672+++ mythgallery/mythgallery/slideshowsettings.h 2009-12-23 18:28:10.478526774 +0100
673@@ -0,0 +1,46 @@
674+#ifndef SLIDESHOWSETTINGS_H
675+#define SLIDESHOWSETTINGS_H
676+
677+#include <mythtv/mythwidgets.h>
678+#include <mythtv/mythdialogs.h>
679+
680+#include <mythtv/libmythui/mythuispinbox.h>
681+#include <mythtv/libmythui/mythuibutton.h>
682+#include <mythtv/libmythui/mythuibuttonlist.h>
683+#include <mythtv/libmythui/mythuicheckbox.h>
684+#include <mythtv/libmythui/mythscreentype.h>
685+#include <mythtv/libmythui/mythdialogbox.h>
686+
687+
688+class SlideshowSettings : public MythScreenType
689+{
690+ Q_OBJECT
691+public:
692+ SlideshowSettings(MythScreenStack *parent, const char *name = 0);
693+ ~SlideshowSettings();
694+
695+ bool Create();
696+ bool keyPressEvent(QKeyEvent *event);
697+
698+private:
699+ MythUICheckBox *m_useOpenGL;
700+ MythUISpinBox *m_slideShowDelay;
701+ MythUICheckBox *m_recursiveSlideshow;
702+ MythUIButtonList *m_openGLTransition;
703+ MythUISpinBox *m_openGLTransitionLength;
704+ MythUISpinBox *m_showCaption;
705+ MythUIButtonList *m_slideShowTransition;
706+ MythUIButtonList *m_slideShowBackground;
707+
708+ MythUIText *m_helpText;
709+ MythUIButton *m_saveButton;
710+ MythUIButton *m_cancelButton;
711+
712+private slots:
713+ void slotSave(void);
714+ void slotFocusChanged(void);
715+ void toggleUseOpenGL(void);
716+
717+};
718+
719+#endif // SLIDESHOWSETTINGS_H
720--- mythgallery/mythgallery/slideshowsettings.cpp 1970-01-01 01:00:00.000000000 +0100
721+++ mythgallery/mythgallery/slideshowsettings.cpp 2009-12-23 18:41:22.488774524 +0100
722@@ -0,0 +1,233 @@
723+#include <iostream>
724+using namespace std;
725+
726+// Qt
727+#include <QString>
728+
729+// MythTV
730+#include <mythtv/mythcontext.h>
731+#include <mythtv/mythdbcon.h>
732+#include <mythtv/mythdirs.h>
733+
734+#include "slideshowsettings.h"
735+
736+
737+SlideshowSettings::SlideshowSettings(MythScreenStack *parent, const char *name)
738+ : MythScreenType(parent, name),
739+ m_slideShowDelay(NULL),
740+ m_recursiveSlideshow(NULL),
741+ m_openGLTransition(NULL),
742+ m_openGLTransitionLength(NULL),
743+ m_showCaption(NULL),
744+ m_slideShowTransition(NULL),
745+ m_slideShowBackground(NULL),
746+ m_helpText(NULL),
747+ m_saveButton(NULL),
748+ m_cancelButton(NULL)
749+{
750+}
751+
752+SlideshowSettings::~SlideshowSettings()
753+{
754+
755+}
756+
757+bool SlideshowSettings::Create()
758+{
759+ bool foundtheme = false;
760+
761+ // Load the theme for this screen
762+ foundtheme = LoadWindowFromXML("gallery-ui.xml", "slideshowsettings", this);
763+
764+ if (!foundtheme)
765+ return false;
766+
767+ m_useOpenGL = dynamic_cast<MythUICheckBox *> (GetChild("useopengl"));
768+ m_slideShowDelay = dynamic_cast<MythUISpinBox *> (GetChild("slideshowdelay"));
769+ m_recursiveSlideshow = dynamic_cast<MythUICheckBox *> (GetChild("recursiveslideshow"));
770+ m_openGLTransition = dynamic_cast<MythUIButtonList *> (GetChild("opengltransition"));
771+ m_openGLTransitionLength = dynamic_cast<MythUISpinBox *> (GetChild("opengltransitionlength"));
772+ m_showCaption = dynamic_cast<MythUISpinBox *> (GetChild("showcaption"));
773+ m_slideShowTransition = dynamic_cast<MythUIButtonList *> (GetChild("slideshowtransition"));
774+ m_slideShowBackground = dynamic_cast<MythUIButtonList *> (GetChild("slideshowbackground"));
775+ m_helpText = dynamic_cast<MythUIText *> (GetChild("helptext"));
776+ m_saveButton = dynamic_cast<MythUIButton *> (GetChild("save"));
777+ m_cancelButton = dynamic_cast<MythUIButton *> (GetChild("cancel"));
778+
779+ if (!m_useOpenGL || !m_slideShowDelay || !m_recursiveSlideshow ||
780+ !m_openGLTransition || !m_openGLTransitionLength ||
781+ !m_showCaption || !m_slideShowTransition || !m_slideShowBackground ||
782+ !m_saveButton || !m_cancelButton)
783+ {
784+ VERBOSE(VB_IMPORTANT, "Theme is missing critical theme elements.");
785+ return false;
786+ }
787+
788+ int loadUseOpenGL = gContext->GetNumSetting("SlideshowUseOpenGL", 0);
789+ if (loadUseOpenGL == 1)
790+ m_useOpenGL->SetCheckState(MythUIStateType::Full);
791+
792+ int loadRecursiveSlideshow = gContext->GetNumSetting("GalleryRecursiveSlideshow", 0);
793+ if (loadRecursiveSlideshow == 1)
794+ m_recursiveSlideshow->SetCheckState(MythUIStateType::Full);
795+
796+ m_slideShowDelay->SetRange(1,600,1);
797+ m_slideShowDelay->SetValue(gContext->GetNumSetting("SlideshowDelay"));
798+
799+ new MythUIButtonListItem(m_openGLTransition, tr("None"), qVariantFromValue( QString("none")));
800+ new MythUIButtonListItem(m_openGLTransition, tr("Blend"), qVariantFromValue( QString("blend (gl)")));
801+ new MythUIButtonListItem(m_openGLTransition, tr("Zoom Blend"), qVariantFromValue( QString("zoom blend (gl)")));
802+ new MythUIButtonListItem(m_openGLTransition, tr("Fade"), qVariantFromValue( QString("fade (gl)")));
803+ new MythUIButtonListItem(m_openGLTransition, tr("Rotate"), qVariantFromValue( QString("rotate (gl)")));
804+ new MythUIButtonListItem(m_openGLTransition, tr("Bend"), qVariantFromValue( QString("bend (gl)")));
805+ new MythUIButtonListItem(m_openGLTransition, tr("In & Out"), qVariantFromValue( QString("inout (gl)")));
806+ new MythUIButtonListItem(m_openGLTransition, tr("Slide"), qVariantFromValue( QString("slide (gl)")));
807+ new MythUIButtonListItem(m_openGLTransition, tr("Flutter"), qVariantFromValue( QString("flutter (gl)")));
808+ new MythUIButtonListItem(m_openGLTransition, tr("Cube"), qVariantFromValue( QString("cube (gl)")));
809+ new MythUIButtonListItem(m_openGLTransition, tr("Random"), qVariantFromValue( QString("random (gl)")));
810+ m_openGLTransition->SetValueByData(gContext->GetSetting("SlideshowOpenGLTransition"));
811+
812+ m_openGLTransitionLength->SetRange(1000, 10000, 200);
813+ m_openGLTransitionLength->SetValue(gContext->GetNumSetting("SlideshowOpenGLTransitionLength"));
814+
815+ m_showCaption->SetRange(0,600,1);
816+ m_showCaption->SetValue(gContext->GetNumSetting("GalleryOverlayCaption"));
817+
818+ new MythUIButtonListItem(m_slideShowTransition, tr("None"), qVariantFromValue( QString("none")));
819+ new MythUIButtonListItem(m_slideShowTransition, tr("Chess board"), qVariantFromValue( QString("chess board")));
820+ new MythUIButtonListItem(m_slideShowTransition, tr("Melt down"), qVariantFromValue( QString("melt down")));
821+ new MythUIButtonListItem(m_slideShowTransition, tr("Sweep"), qVariantFromValue( QString("sweep")));
822+ new MythUIButtonListItem(m_slideShowTransition, tr("Noise"), qVariantFromValue( QString("noise")));
823+ new MythUIButtonListItem(m_slideShowTransition, tr("Growing"), qVariantFromValue( QString("growing")));
824+ new MythUIButtonListItem(m_slideShowTransition, tr("Incoming edges"), qVariantFromValue( QString("incoming edges")));
825+ new MythUIButtonListItem(m_slideShowTransition, tr("Horizontal lines"), qVariantFromValue( QString("horizontal lines")));
826+ new MythUIButtonListItem(m_slideShowTransition, tr("Vertical lines"), qVariantFromValue( QString("vertical lines")));
827+ new MythUIButtonListItem(m_slideShowTransition, tr("Circle out"), qVariantFromValue( QString("circle out")));
828+ new MythUIButtonListItem(m_slideShowTransition, tr("Multicircle out"), qVariantFromValue( QString("multicircle out")));
829+ new MythUIButtonListItem(m_slideShowTransition, tr("Spiral in"), qVariantFromValue( QString("spiral in")));
830+ new MythUIButtonListItem(m_slideShowTransition, tr("Blobs"), qVariantFromValue( QString("blobs")));
831+ new MythUIButtonListItem(m_slideShowTransition, tr("Random"), qVariantFromValue( QString("random")));
832+ m_slideShowTransition->SetValueByData(gContext->GetSetting("SlideshowTransition"));
833+
834+ new MythUIButtonListItem(m_slideShowBackground, tr("Theme background"), qVariantFromValue( QString("theme")));
835+ new MythUIButtonListItem(m_slideShowBackground, tr("Black background"), qVariantFromValue( QString("black")));
836+ new MythUIButtonListItem(m_slideShowBackground, tr("White background"), qVariantFromValue( QString("white")));
837+ m_slideShowBackground->SetValueByData(gContext->GetSetting("SlideshowBackground"));
838+
839+ toggleUseOpenGL();
840+
841+ connect(m_useOpenGL, SIGNAL(TakingFocus()), SLOT(slotFocusChanged()));
842+ connect(m_slideShowDelay, SIGNAL(TakingFocus()), SLOT(slotFocusChanged()));
843+ connect(m_recursiveSlideshow, SIGNAL(TakingFocus()), SLOT(slotFocusChanged()));
844+ connect(m_openGLTransition, SIGNAL(TakingFocus()), SLOT(slotFocusChanged()));
845+ connect(m_openGLTransitionLength, SIGNAL(TakingFocus()), SLOT(slotFocusChanged()));
846+ connect(m_showCaption, SIGNAL(TakingFocus()), SLOT(slotFocusChanged()));
847+ connect(m_slideShowTransition, SIGNAL(TakingFocus()), SLOT(slotFocusChanged()));
848+ connect(m_slideShowBackground, SIGNAL(TakingFocus()), SLOT(slotFocusChanged()));
849+ connect(m_useOpenGL, SIGNAL(valueChanged()), SLOT(toggleUseOpenGL()));
850+
851+ connect(m_saveButton, SIGNAL(Clicked()), this, SLOT(slotSave()));
852+ connect(m_cancelButton, SIGNAL(Clicked()), this, SLOT(Close()));
853+
854+
855+ if (!BuildFocusList())
856+ VERBOSE(VB_IMPORTANT, "Failed to build a focuslist. Something is wrong");
857+
858+ SetFocusWidget(m_slideShowDelay);
859+
860+ return true;
861+}
862+
863+bool SlideshowSettings::keyPressEvent(QKeyEvent *event)
864+{
865+ if (GetFocusWidget()->keyPressEvent(event))
866+ return true;
867+
868+ bool handled = false;
869+
870+ if (!handled && MythScreenType::keyPressEvent(event))
871+ handled = true;
872+
873+ return handled;
874+}
875+
876+void SlideshowSettings::slotSave(void)
877+{
878+ int saveUseOpenGL = (m_useOpenGL->GetCheckState() == MythUIStateType::Full) ? 1 : 0;
879+ gContext->SaveSetting("SlideshowUseOpenGL", saveUseOpenGL);
880+
881+ int saveRecursiveSlideshow = (m_recursiveSlideshow->GetCheckState() == MythUIStateType::Full) ? 1 : 0;
882+ gContext->SaveSetting("GalleryRecursiveSlideshow", saveRecursiveSlideshow);
883+
884+ gContext->SaveSetting("SlideshowDelay", m_slideShowDelay->GetValue());
885+
886+ if (m_useOpenGL->GetCheckState() == MythUIStateType::Full)
887+ {
888+ m_openGLTransition->SetVisible(true);
889+ m_openGLTransitionLength->SetVisible(true);
890+ }
891+ else
892+ {
893+ gContext->SaveSetting("GalleryOverlayCaption", m_showCaption->GetValue());
894+ gContext->SaveSetting("SlideshowTransition", m_slideShowTransition->GetDataValue().toString());
895+ gContext->SaveSetting("SlideshowBackground", m_slideShowBackground->GetDataValue().toString());
896+ }
897+
898+ Close();
899+}
900+
901+void SlideshowSettings::slotFocusChanged(void)
902+{
903+ if (!m_helpText)
904+ return;
905+
906+ QString msg = "";
907+ if (GetFocusWidget() == m_useOpenGL)
908+ msg = tr("Check this to enable OpenGL "
909+ "based slideshow transitions");
910+ else if (GetFocusWidget() == m_slideShowDelay)
911+ msg = tr("This is the number of seconds to display each picture.");
912+ else if (GetFocusWidget() == m_recursiveSlideshow)
913+ msg = tr("Check this to let the slideshow recurse into "
914+ "sub-directories.");
915+ else if (GetFocusWidget() == m_openGLTransition)
916+ msg = tr("This is the type of OpenGL transition used "
917+ "between pictures in slideshow mode.");
918+ else if (GetFocusWidget() == m_openGLTransitionLength)
919+ msg = tr("Duration of OpenGL Transition (milliseconds)");
920+ else if (GetFocusWidget() == m_showCaption)
921+ msg = tr("This is the number of seconds to show a caption "
922+ "on top of a full size picture.");
923+ else if (GetFocusWidget() == m_slideShowTransition)
924+ msg = tr("This is the type of transition used "
925+ "between pictures in slideshow mode.");
926+ else if (GetFocusWidget() == m_slideShowBackground)
927+ msg = tr("This is the type of background for each "
928+ "picture in single view mode.");
929+ else if (GetFocusWidget() == m_cancelButton)
930+ msg = tr("Exit without saving settings");
931+ else if (GetFocusWidget() == m_saveButton)
932+ msg = tr("Save settings and Exit");
933+
934+ m_helpText->SetText(msg);
935+}
936+
937+void SlideshowSettings::toggleUseOpenGL()
938+{
939+ if (m_useOpenGL->GetCheckState() == MythUIStateType::Full)
940+ {
941+ m_openGLTransition->SetVisible(true);
942+ m_openGLTransitionLength->SetVisible(true);
943+ m_showCaption->SetVisible(false);
944+ m_slideShowTransition->SetVisible(false);
945+ m_slideShowBackground->SetVisible(false);
946+ }
947+ else
948+ {
949+ m_openGLTransition->SetVisible(false);
950+ m_openGLTransitionLength->SetVisible(false);
951+ m_showCaption->SetVisible(true);
952+ m_slideShowTransition->SetVisible(true);
953+ m_slideShowBackground->SetVisible(true);
954+ }
955+}