Permalink
Browse files

Create key binding to jump directly to random gallery slideshow

Fixes #9530.  Patch from the ticket.

Signed-off-by: Gavin Hurlbut <ghurlbut@mythtv.org>
  • Loading branch information...
1 parent 6ef7b6e commit 35b8a5312a9f105f381826f5af91f5cda93242c3 @chadparry chadparry committed with Beirdo Jan 29, 2011
Showing with 17 additions and 3 deletions.
  1. +1 −1 mythplugins/mythgallery/mythgallery/iconview.h
  2. +16 −2 mythplugins/mythgallery/mythgallery/main.cpp
@@ -58,6 +58,7 @@ class IconView : public MythScreenType
bool Create(void);
bool keyPressEvent(QKeyEvent *);
void customEvent(QEvent*);
+ void HandleRandomShow(void);
QString GetError(void) { return m_errorStr; }
@@ -83,7 +84,6 @@ class IconView : public MythScreenType
void HandleRotateCCW(void);
void HandleDeleteCurrent(void);
void HandleSlideShow(void);
- void HandleRandomShow(void);
void HandleSettings(void);
void HandleEject(void);
void HandleImport(void);
@@ -21,7 +21,7 @@
Q_IMPORT_PLUGIN(dcrawplugin)
#endif // DCRAW_SUPPORT
-static int run(MythMediaDevice *dev = NULL)
+static int run(MythMediaDevice *dev = NULL, bool startRandomShow = false)
{
QDir startdir(gCoreContext->GetSetting("GalleryDir"));
if (startdir.exists() && startdir.isReadable())
@@ -33,7 +33,14 @@ static int run(MythMediaDevice *dev = NULL)
if (iconview->Create())
{
- mainStack->AddScreen(iconview);
+ if (startRandomShow)
+ {
+ iconview->HandleRandomShow();
+ }
+ else
+ {
+ mainStack->AddScreen(iconview);
+ }
return 0;
}
else
@@ -57,6 +64,11 @@ static void runGallery(void)
run();
}
+void runRandomSlideshow(void)
+{
+ run(NULL, true);
+}
+
static void handleMedia(MythMediaDevice *dev)
{
if (! gCoreContext->GetNumSetting("GalleryAutoLoad", 0))
@@ -73,6 +85,8 @@ static void setupKeys(void)
{
REG_JUMP("MythGallery", QT_TRANSLATE_NOOP("MythControls",
"Image viewer / slideshow"), "", runGallery);
+ REG_JUMP("Random Slideshow", QT_TRANSLATE_NOOP("MythControls",
+ "Start Random Slideshow in thumbnail view"), "", runRandomSlideshow);
REG_KEY("Gallery", "PLAY", QT_TRANSLATE_NOOP("MythControls",
"Start/Stop Slideshow"), "P");

0 comments on commit 35b8a53

Please sign in to comment.