Ticket #9530: Create-a-key-binding-that-jumps-directly-to-a-random.patch

File Create-a-key-binding-that-jumps-directly-to-a-random.patch, 2.7 KB (added by spam@…, 13 years ago)

GIT patch cdcc3ab368974f52f0cf19f8084f75ee74993683

  • mythplugins/mythgallery/mythgallery/iconview.h

    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 
    5858    bool Create(void);
    5959    bool keyPressEvent(QKeyEvent *);
    6060    void customEvent(QEvent*);
     61    void HandleRandomShow(void);
    6162
    6263    QString GetError(void) { return m_errorStr; }
    6364
    class IconView : public MythScreenType 
    8384    void HandleRotateCCW(void);
    8485    void HandleDeleteCurrent(void);
    8586    void HandleSlideShow(void);
    86     void HandleRandomShow(void);
    8787    void HandleSettings(void);
    8888    void HandleEject(void);
    8989    void HandleImport(void);
  • mythplugins/mythgallery/mythgallery/main.cpp

    diff --git a/mythplugins/mythgallery/mythgallery/main.cpp b/mythplugins/mythgallery/mythgallery/main.cpp
    index 82146ef..f1362f7 100644
    a b  
    2121Q_IMPORT_PLUGIN(dcrawplugin)
    2222#endif // DCRAW_SUPPORT
    2323
    24 static int run(MythMediaDevice *dev = NULL)
     24static int run(MythMediaDevice *dev = NULL, bool startRandomShow = false)
    2525{
    2626    QDir startdir(gCoreContext->GetSetting("GalleryDir"));
    2727    if (startdir.exists() && startdir.isReadable())
    static int run(MythMediaDevice *dev = NULL) 
    3333
    3434        if (iconview->Create())
    3535        {
    36             mainStack->AddScreen(iconview);
     36            if (startRandomShow)
     37            {
     38                iconview->HandleRandomShow();
     39            }
     40            else
     41            {
     42                mainStack->AddScreen(iconview);
     43            }
    3744            return 0;
    3845        }
    3946        else
    static void runGallery(void) 
    5764    run();
    5865}
    5966
     67void runRandomSlideshow(void)
     68{
     69    run(NULL, true);
     70}
     71
    6072static void handleMedia(MythMediaDevice *dev)
    6173{
    6274    if (dev && dev->isUsable())
    static void setupKeys(void) 
    6779{
    6880    REG_JUMP("MythGallery", QT_TRANSLATE_NOOP("MythControls",
    6981        "Image viewer / slideshow"), "", runGallery);
     82    REG_JUMP("Random Slideshow", QT_TRANSLATE_NOOP("MythControls",
     83        "Start Random Slideshow in thumbnail view"), "", runRandomSlideshow);
    7084
    7185    REG_KEY("Gallery", "PLAY", QT_TRANSLATE_NOOP("MythControls",
    7286        "Start/Stop Slideshow"), "P");