Skip to content

Commit

Permalink
Create key binding to jump directly to random gallery slideshow
Browse files Browse the repository at this point in the history
Fixes #9530.  Patch from the ticket.

Signed-off-by: Gavin Hurlbut <ghurlbut@mythtv.org>
  • Loading branch information
chadparry authored and Beirdo committed Jul 27, 2011
1 parent 6ef7b6e commit 35b8a53
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mythplugins/mythgallery/mythgallery/iconview.h
Expand Up @@ -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; }

Expand All @@ -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);
Expand Down
18 changes: 16 additions & 2 deletions mythplugins/mythgallery/mythgallery/main.cpp
Expand Up @@ -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())
Expand All @@ -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
Expand All @@ -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))
Expand All @@ -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");
Expand Down

0 comments on commit 35b8a53

Please sign in to comment.