From 339502da5c49b049ca3ce58198f6f20710c0a3b6 Mon Sep 17 00:00:00 2001
From: Chad Parry <github@chad.parry.org>
Date: Sat, 29 Jan 2011 09:55:33 -0700
Subject: [PATCH] Create a key binding that jumps directly to a random slideshow of the entire gallery
---
mythplugins/mythgallery/mythgallery/iconview.h | 2 +-
mythplugins/mythgallery/mythgallery/main.cpp | 18 ++++++++++++++++--
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/mythplugins/mythgallery/mythgallery/iconview.h b/mythplugins/mythgallery/mythgallery/iconview.h
index 1b57e63..e447bb6 100644
a
|
b
|
class IconView : public MythScreenType |
58 | 58 | bool Create(void); |
59 | 59 | bool keyPressEvent(QKeyEvent *); |
60 | 60 | void customEvent(QEvent*); |
| 61 | void HandleRandomShow(void); |
61 | 62 | |
62 | 63 | QString GetError(void) { return m_errorStr; } |
63 | 64 | |
… |
… |
class IconView : public MythScreenType |
83 | 84 | void HandleRotateCCW(void); |
84 | 85 | void HandleDeleteCurrent(void); |
85 | 86 | void HandleSlideShow(void); |
86 | | void HandleRandomShow(void); |
87 | 87 | void HandleSettings(void); |
88 | 88 | void HandleEject(void); |
89 | 89 | void HandleImport(void); |
diff --git a/mythplugins/mythgallery/mythgallery/main.cpp b/mythplugins/mythgallery/mythgallery/main.cpp
index 82146ef..f1362f7 100644
a
|
b
|
|
21 | 21 | Q_IMPORT_PLUGIN(dcrawplugin) |
22 | 22 | #endif // DCRAW_SUPPORT |
23 | 23 | |
24 | | static int run(MythMediaDevice *dev = NULL) |
| 24 | static int run(MythMediaDevice *dev = NULL, bool startRandomShow = false) |
25 | 25 | { |
26 | 26 | QDir startdir(gCoreContext->GetSetting("GalleryDir")); |
27 | 27 | if (startdir.exists() && startdir.isReadable()) |
… |
… |
static int run(MythMediaDevice *dev = NULL) |
33 | 33 | |
34 | 34 | if (iconview->Create()) |
35 | 35 | { |
36 | | mainStack->AddScreen(iconview); |
| 36 | if (startRandomShow) |
| 37 | { |
| 38 | iconview->HandleRandomShow(); |
| 39 | } |
| 40 | else |
| 41 | { |
| 42 | mainStack->AddScreen(iconview); |
| 43 | } |
37 | 44 | return 0; |
38 | 45 | } |
39 | 46 | else |
… |
… |
static void runGallery(void) |
57 | 64 | run(); |
58 | 65 | } |
59 | 66 | |
| 67 | void runRandomSlideshow(void) |
| 68 | { |
| 69 | run(NULL, true); |
| 70 | } |
| 71 | |
60 | 72 | static void handleMedia(MythMediaDevice *dev) |
61 | 73 | { |
62 | 74 | if (dev && dev->isUsable()) |
… |
… |
static void setupKeys(void) |
67 | 79 | { |
68 | 80 | REG_JUMP("MythGallery", QT_TRANSLATE_NOOP("MythControls", |
69 | 81 | "Image viewer / slideshow"), "", runGallery); |
| 82 | REG_JUMP("Random Slideshow", QT_TRANSLATE_NOOP("MythControls", |
| 83 | "Start Random Slideshow in thumbnail view"), "", runRandomSlideshow); |
70 | 84 | |
71 | 85 | REG_KEY("Gallery", "PLAY", QT_TRANSLATE_NOOP("MythControls", |
72 | 86 | "Start/Stop Slideshow"), "P"); |