00001 #include <mythtv/mythcontext.h>
00002
00003 #include "gallerysettings.h"
00004 #include <qfile.h>
00005 #include <qdialog.h>
00006 #include <qcursor.h>
00007 #include <qdir.h>
00008 #include <qimage.h>
00009
00010 #include "config.h"
00011
00012
00013
00014 static HostLineEdit *MythGalleryDir()
00015 {
00016 HostLineEdit *gc = new HostLineEdit("GalleryDir");
00017 gc->setLabel(QObject::tr("Directory that holds images"));
00018 #ifdef Q_WS_MACX
00019 gc->setValue(QDir::homeDirPath() + "/Pictures");
00020 #else
00021 gc->setValue("/var/lib/pictures");
00022 #endif
00023 gc->setHelpText(QObject::tr("This directory must exist and "
00024 "MythGallery needs to have read permission."));
00025 return gc;
00026 };
00027
00028 static HostCheckBox *MythGalleryThumbnailLocation()
00029 {
00030 HostCheckBox *gc = new HostCheckBox("GalleryThumbnailLocation");
00031 gc->setLabel(QObject::tr("Store thumbnails in image directory"));
00032 gc->setValue(true);
00033 gc->setHelpText(QObject::tr("If set, thumbnails are stored in '.thumbcache' directories within the above directory. If cleared, they are stored in your home directory."));
00034 return gc;
00035 };
00036
00037 static HostComboBox *MythGallerySortOrder()
00038 {
00039 HostComboBox *gc = new HostComboBox("GallerySortOrder");
00040 gc->setLabel(QObject::tr("Sort order when browsing"));
00041 gc->addSelection("Name (A-Z alpha)", QString::number(QDir::Name | QDir::DirsFirst | QDir::IgnoreCase));
00042 gc->addSelection("Reverse Name (Z-A alpha)", QString::number(QDir::Name | QDir::DirsFirst | QDir::IgnoreCase | QDir::Reversed));
00043 gc->addSelection("Mod Time (earliest first)", QString::number(QDir::Time | QDir::DirsFirst | QDir::IgnoreCase | QDir::Reversed));
00044 gc->addSelection("Reverse Mod Time (most recent first)", QString::number(QDir::Time | QDir::DirsFirst | QDir::IgnoreCase));
00045 gc->setHelpText(QObject::tr("This is the sort order for the displayed "
00046 "picture thumbnails."));
00047 return gc;
00048 };
00049
00050 static HostLineEdit *MythGalleryMoviePlayerCmd()
00051 {
00052 HostLineEdit *gc = new HostLineEdit("GalleryMoviePlayerCmd");
00053 gc->setLabel(QObject::tr("Command run to display movie files"));
00054 gc->setValue("mplayer -fs %s");
00055 gc->setHelpText(QObject::tr("This command is executed whenever a movie "
00056 "file is selected"));
00057 return gc;
00058 };
00059
00060 static HostSpinBox *MythGalleryOverlayCaption()
00061 {
00062 HostSpinBox *gc = new HostSpinBox("GalleryOverlayCaption", 0, 600, 1);
00063 gc->setLabel(QObject::tr("Overlay caption"));
00064 gc->setValue(0);
00065 gc->setHelpText(QObject::tr("This is the number of seconds to show a caption "
00066 "on top of a full size picture."));
00067 return gc;
00068 };
00069
00070 static HostLineEdit *MythGalleryImportDirs()
00071 {
00072 HostLineEdit *gc = new HostLineEdit("GalleryImportDirs");
00073 gc->setLabel(QObject::tr("Paths to import images from"));
00074 gc->setValue("/mnt/cdrom:/mnt/camera");
00075 gc->setHelpText(QObject::tr("This is a colon separated list of paths. "
00076 "If the path in the list is a directory, its contents will "
00077 "be copied. If it is an executable, it will be run."));
00078 return gc;
00079 };
00080
00081 #ifdef USING_OPENGL
00082
00083 static HostCheckBox *SlideshowUseOpenGL()
00084 {
00085 HostCheckBox *gc = new HostCheckBox("SlideshowUseOpenGL");
00086 gc->setLabel(QObject::tr("Use OpenGL transitions"));
00087 gc->setValue(false);
00088 gc->setHelpText(QObject::tr("Check this to enable OpenGL "
00089 "based slideshow transitions"));
00090 return gc;
00091 };
00092
00093 static HostComboBox *SlideshowOpenGLTransition()
00094 {
00095 HostComboBox *gc = new HostComboBox("SlideshowOpenGLTransition");
00096 gc->setLabel(QObject::tr("Type of OpenGL transition"));
00097 gc->addSelection("none");
00098 gc->addSelection("blend (gl)");
00099 gc->addSelection("zoom blend (gl)");
00100 gc->addSelection("fade (gl)");
00101 gc->addSelection("rotate (gl)");
00102 gc->addSelection("bend (gl)");
00103 gc->addSelection("inout (gl)");
00104 gc->addSelection("slide (gl)");
00105 gc->addSelection("flutter (gl)");
00106 gc->addSelection("cube (gl)");
00107 gc->addSelection("random (gl)");
00108 gc->setHelpText(QObject::tr("This is the type of OpenGL transition used "
00109 "between pictures in slideshow mode."));
00110 return gc;
00111 };
00112
00113 static HostSpinBox *SlideshowOpenGLTransitionLength()
00114 {
00115 HostSpinBox *gc = new HostSpinBox(
00116 "SlideshowOpenGLTransitionLength", 500, 10000, 500);
00117 gc->setLabel(QObject::tr("Duration of OpenGL Transition (milliseconds)"));
00118 gc->setValue(2000);
00119 return gc;
00120 };
00121
00122 #endif
00123
00124 static HostComboBox *SlideshowTransition()
00125 {
00126 HostComboBox *gc = new HostComboBox("SlideshowTransition");
00127 gc->setLabel(QObject::tr("Type of transition"));
00128 gc->addSelection("none");
00129 gc->addSelection("chess board");
00130 gc->addSelection("melt down");
00131 gc->addSelection("sweep");
00132 gc->addSelection("noise");
00133 gc->addSelection("growing");
00134 gc->addSelection("incoming edges");
00135 gc->addSelection("horizontal lines");
00136 gc->addSelection("vertical lines");
00137 gc->addSelection("circle out");
00138 gc->addSelection("multicircle out");
00139 gc->addSelection("spiral in");
00140 gc->addSelection("blobs");
00141 gc->addSelection("random");
00142 gc->setHelpText(QObject::tr("This is the type of transition used "
00143 "between pictures in slideshow mode."));
00144 return gc;
00145 };
00146
00147 static HostComboBox *SlideshowBackground()
00148 {
00149 HostComboBox *gc = new HostComboBox("SlideshowBackground");
00150 gc->setLabel(QObject::tr("Type of background"));
00151
00152 gc->addSelection("theme","");
00153 gc->addSelection("black");
00154 gc->addSelection("white");
00155 gc->setHelpText(QObject::tr("This is the type of background for each "
00156 "picture in single view mode."));
00157 return gc;
00158 };
00159
00160 static HostSpinBox *SlideshowDelay()
00161 {
00162 HostSpinBox *gc = new HostSpinBox("SlideshowDelay", 1, 600, 1);
00163 gc->setLabel(QObject::tr("Slideshow Delay"));
00164 gc->setValue(5);
00165 gc->setHelpText(QObject::tr("This is the number of seconds to display each "
00166 "picture."));
00167 return gc;
00168 };
00169
00170 static HostCheckBox *SlideshowRecursive()
00171 {
00172 HostCheckBox *gc = new HostCheckBox("GalleryRecursiveSlideshow");
00173 gc->setLabel(QObject::tr("Recurse into directories"));
00174 gc->setHelpText(QObject::tr("Check this to let the slideshow recurse into "
00175 "sub-directories."));
00176 return gc;
00177 };
00178
00179 class GalleryConfigurationGroup : public TriggeredConfigurationGroup
00180 {
00181 public:
00182 GalleryConfigurationGroup() :
00183 TriggeredConfigurationGroup(false, true, false, false)
00184 {
00185 setLabel(QObject::tr("MythGallery Settings (Slideshow)"));
00186 setUseLabel(false);
00187
00188 #ifdef USING_OPENGL
00189 HostCheckBox* useOpenGL = SlideshowUseOpenGL();
00190 addChild(useOpenGL);
00191 setTrigger(useOpenGL);
00192
00193 ConfigurationGroup* openGLConfig = new VerticalConfigurationGroup(false);
00194 openGLConfig->addChild(SlideshowOpenGLTransition());
00195 openGLConfig->addChild(SlideshowOpenGLTransitionLength());
00196 addTarget("1", openGLConfig);
00197 #endif
00198
00199 ConfigurationGroup* regularConfig = new VerticalConfigurationGroup(false);
00200 regularConfig->addChild(MythGalleryOverlayCaption());
00201 regularConfig->addChild(SlideshowTransition());
00202 regularConfig->addChild(SlideshowBackground());
00203 addTarget("0", regularConfig);
00204
00205 addChild(SlideshowDelay());
00206 addChild(SlideshowRecursive());
00207 }
00208
00209 };
00210
00211
00212 GallerySettings::GallerySettings()
00213 {
00214 VerticalConfigurationGroup* general = new VerticalConfigurationGroup(false);
00215 general->setLabel(QObject::tr("MythGallery Settings (General)"));
00216 general->addChild(MythGalleryDir());
00217 general->addChild(MythGalleryThumbnailLocation());
00218 general->addChild(MythGallerySortOrder());
00219 general->addChild(MythGalleryImportDirs());
00220 general->addChild(MythGalleryMoviePlayerCmd());
00221 addChild(general);
00222
00223 GalleryConfigurationGroup* config = new GalleryConfigurationGroup();
00224 addChild(config);
00225 }
00226