Index: mythgallery/gallerysettings.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythplugins/mythgallery/mythgallery/gallerysettings.cpp,v
retrieving revision 1.12
diff -u -d -r1.12 gallerysettings.cpp
--- mythgallery/gallerysettings.cpp	30 Jan 2005 16:11:49 -0000	1.12
+++ mythgallery/gallerysettings.cpp	8 May 2005 15:24:19 -0000
@@ -27,7 +27,27 @@
     gc->setLabel(QObject::tr("Command run to display movie files"));
     gc->setValue("mplayer -fs %s");
     gc->setHelpText(QObject::tr("This command is executed whenever a movie "
-				            "file is selected"));
+                            "file is selected"));
+    return gc;
+};
+
+static HostLineEdit *MythGalleryCaptionCmd()
+{
+    HostLineEdit *gc = new HostLineEdit("GalleryCaptionCmd");
+    gc->setLabel(QObject::tr("Command to run to retrieve image caption"));
+    gc->setValue("");
+    gc->setHelpText(QObject::tr("If set, this command is executed for each image to "
+                                "retrieve a caption for the images."));
+    return gc;
+};
+
+static HostSpinBox *MythGalleryOverlayCaption()
+{
+    HostSpinBox *gc = new HostSpinBox("GalleryOverlayCaption", 0, 600, 1);
+    gc->setLabel(QObject::tr("Overlay caption"));
+    gc->setValue(0);
+    gc->setHelpText(QObject::tr("This is the number of seconds to show a caption "
+                    "on top of a full size picture."));
     return gc;
 };
 
@@ -135,6 +155,7 @@
         addChild(MythGalleryImportDirs());
         addChild(MythGalleryMoviePlayerCmd());
 
+        addChild(MythGalleryCaptionCmd());
 #ifdef OPENGL_SUPPORT
         
         HostCheckBox* useOpenGL = SlideshowUseOpenGL();
@@ -151,7 +172,7 @@
         addTarget("0", regularConfig);
 
 #else
-        
+        addChild(MythGalleryOverlayCaption());
         addChild(SlideshowTransition());
         addChild(SlideshowBackground());
         
Index: mythgallery/galleryutil.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythplugins/mythgallery/mythgallery/galleryutil.cpp,v
retrieving revision 1.2
diff -u -d -r1.2 galleryutil.cpp
--- mythgallery/galleryutil.cpp	10 Feb 2005 22:21:31 -0000	1.2
+++ mythgallery/galleryutil.cpp	8 May 2005 15:24:19 -0000
@@ -18,6 +18,8 @@
 
 #include <iostream>
 #include <qfileinfo.h>
+#include <qprocess.h>
+#include <qapplication.h>
 
 #include "config.h"
 #include "constants.h"
@@ -119,3 +121,30 @@
 
     return rotateAngle;
 }
+QString GalleryUtil::getCaption(const QString& cmd, const QString& filepath, MythDialog *owner)
+{
+    QString caption("");
+
+    if(cmd != "") {
+
+        QProcess proc(owner);
+        proc.clearArguments();
+        proc.addArgument(cmd);
+        proc.addArgument(filepath);
+
+        if( proc.start() ) {
+            while (true) {
+                while (proc.canReadLineStdout()) {
+                    caption += QString::fromLocal8Bit(proc.readLineStdout(),-1);
+                }
+                if (proc.isRunning()) {
+                    qApp->processEvents();
+                    usleep(10000);
+                } else
+                    break;
+            }
+        }
+    }
+
+    return caption;
+}
Index: mythgallery/galleryutil.h
===================================================================
RCS file: /var/lib/mythcvs/mythplugins/mythgallery/mythgallery/galleryutil.h,v
retrieving revision 1.1
diff -u -d -r1.1 galleryutil.h
--- mythgallery/galleryutil.h	8 Dec 2004 13:23:55 -0000	1.1
+++ mythgallery/galleryutil.h	8 May 2005 15:24:19 -0000
@@ -19,14 +19,16 @@
 #ifndef EXIFUTIL_H
 #define EXIFUTIL_H
 
+#include "iconview.h"
 class GalleryUtil
 {
 
  public:
-	static bool isImage(const char* filePath);
-	static bool isMovie(const char* filePath);
-	static long getNaturalRotation(const char* filePath);
+    static bool isImage(const char* filePath);
+    static bool isMovie(const char* filePath);
+    static long getNaturalRotation(const char* filePath);
 
+    static QString getCaption(const QString& cmd, const QString &filepath, MythDialog *owner);
 };
 
 #endif /* EXIFUTIL_H */
Index: mythgallery/iconview.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythplugins/mythgallery/mythgallery/iconview.cpp,v
retrieving revision 1.39
diff -u -d -r1.39 iconview.cpp
--- mythgallery/iconview.cpp	24 Feb 2005 21:21:35 -0000	1.39
+++ mythgallery/iconview.cpp	8 May 2005 15:24:19 -0000
@@ -158,7 +158,13 @@
         if (ttype) {
             ThumbItem* item = m_itemList.at(m_currRow * m_nCols +
                                             m_currCol);
-            ttype->SetText(item ? item->name : QString(""));
+
+            if(item->caption == "")
+                item->caption = GalleryUtil::getCaption(gContext->GetSetting("GalleryCaptionCmd"), item->path, this);
+            if(item->caption == "")
+                item->caption = item->name;
+
+            ttype->SetText(item ? item->caption : QString(""));
         }
         
         container->Draw(&p, 0, 0);
Index: mythgallery/iconview.h
===================================================================
RCS file: /var/lib/mythcvs/mythplugins/mythgallery/mythgallery/iconview.h,v
retrieving revision 1.22
diff -u -d -r1.22 iconview.h
--- mythgallery/iconview.h	24 Feb 2005 21:21:35 -0000	1.22
+++ mythgallery/iconview.h	8 May 2005 15:24:19 -0000
@@ -39,6 +39,7 @@
     ThumbItem() {
         pixmap = 0;
         name   = "";
+        caption= "";
         path   = "";
         isDir  = false;
     }
@@ -53,6 +54,7 @@
 
     QPixmap *pixmap;
     QString  name;
+    QString  caption;
     QString  path;
     bool     isDir;
 };
Index: mythgallery/singleview.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythplugins/mythgallery/mythgallery/singleview.cpp,v
retrieving revision 1.32
diff -u -d -r1.32 singleview.cpp
--- mythgallery/singleview.cpp	24 Feb 2005 21:21:36 -0000	1.32
+++ mythgallery/singleview.cpp	8 May 2005 15:24:19 -0000
@@ -79,6 +79,18 @@
     if (!m_delay)
         m_delay = 2;
 
+    // ----------------------------------------------------------------
+
+    m_showcaption = gContext->GetNumSetting("GalleryOverlayCaption", 0);
+    if(m_showcaption > m_delay)
+        m_showcaption = m_delay;
+
+    if(m_showcaption)
+    {
+        m_captionBgPix = createBg(screenwidth, 100);
+        m_captionbackup = new QPixmap(screenwidth, 100);
+    }
+
     // --------------------------------------------------------------------
 
     setNoErase();
@@ -108,8 +120,11 @@
     m_painter = 0;
     mIntArray = 0;
 
-    m_timer = new QTimer(this);
-    connect(m_timer, SIGNAL(timeout()), SLOT(slotTimeOut()));
+    m_sstimer = new QTimer(this);
+    connect(m_sstimer, SIGNAL(timeout()), SLOT(slotSlideTimeOut()));
+
+    m_ctimer = new QTimer(this);
+    connect(m_ctimer, SIGNAL(timeout()), SLOT(slotCaptionTimeOut()));
 
     // --------------------------------------------------------------------
 
@@ -118,7 +133,7 @@
     loadImage();
     if (slideShow) {
         m_running = true;
-        m_timer->start(m_tmout, true);
+        m_sstimer->start(m_tmout, true);
         gContext->DisableScreensaver();
     }
 }
@@ -177,6 +192,33 @@
                 bitBlt(&pix, 0, 0, m_pixmap, m_sx, m_sy,
                        pix.width(), pix.height());
 
+            if(m_showcaption && !m_ctimer->isActive())
+            {
+                ThumbItem* item = m_itemList.at(m_pos);
+                if(item->caption == "")
+                    item->caption = GalleryUtil::getCaption(gContext->GetSetting("GalleryCaptionCmd"), item->path, this);
+
+                if(item->caption != "") {
+
+                    // Store actual background to restore later
+                    bitBlt(m_captionbackup, 0, 0, &pix,
+                           0, screenheight - 100, screenwidth, 100);
+
+                    // Blit semi-transparent background into place
+                    bitBlt(&pix, 0, screenheight - 100, m_captionBgPix,
+                           0, 0, screenwidth, 100);
+
+                    // Draw caption
+                    QPainter p(&pix, this);
+                    p.drawText(0, screenheight - 100,
+                               screenwidth, 100,
+                               Qt::AlignCenter, item->caption);
+                    p.end();
+
+                    m_ctimer->start(m_showcaption * 1000, true);
+                }
+            }
+
             if (m_zoom != 1) {
                 QPainter p(&pix, this);
                 p.drawText(screenwidth / 10, screenheight / 10,
@@ -187,7 +229,8 @@
             if (m_info) {
 
                 if (!m_infoBgPix)
-                    createInfoBg();
+                    m_infoBgPix = createBg(screenwidth-2*screenwidth/10,
+                                           screenheight-2*screenheight/10);
 
                 bitBlt(&pix, screenwidth/10, screenheight/10,
                        m_infoBgPix,0,0,-1,-1,Qt::CopyROP);
@@ -234,7 +277,8 @@
     bool handled = false;
 
     bool wasRunning = m_running;
-    m_timer->stop();
+    m_sstimer->stop();
+    m_ctimer->stop();
     m_running = false;
     gContext->RestoreScreensaver();
     m_effectRunning = false;
@@ -400,7 +444,7 @@
     }
 
     if (m_running) {
-        m_timer->start(m_tmout, true);
+        m_sstimer->start(m_tmout, true);
         gContext->DisableScreensaver();
     }
 
@@ -519,11 +563,9 @@
     }
 }
 
-
-void SingleView::createInfoBg()
+QPixmap *SingleView::createBg(int width, int height)
 {
-    QImage img(screenwidth-2*screenwidth/10,
-               screenheight-2*screenheight/10,32);
+    QImage img(width, height, 32);
     img.setAlphaBuffer(true);
 
     for (int y = 0; y < img.height(); y++) 
@@ -531,11 +573,11 @@
         for (int x = 0; x < img.width(); x++) 
         {
             uint *p = (uint *)img.scanLine(y) + x;
-            *p = qRgba(0, 0, 0, 120);
+            *p = qRgba(0, 0, 0, 150);
         }
     }
 
-    m_infoBgPix = new QPixmap(img);
+    return new QPixmap(img);
 }
 
 void SingleView::registerEffects()
@@ -1156,7 +1198,7 @@
 
 
 
-void SingleView::slotTimeOut()
+void SingleView::slotSlideTimeOut()
 {
     if (!m_effectMethod) {
         std::cerr << "SingleView: No transition method"
@@ -1204,5 +1246,11 @@
     }
 
     update();
-    m_timer->start(m_tmout, true);
+    m_sstimer->start(m_tmout, true);
+}
+
+void SingleView::slotCaptionTimeOut()
+{
+    m_ctimer->stop();
+    bitBlt(this,0,screenheight - 100,m_captionbackup,0,0,-1,-1,Qt::CopyROP);
 }
Index: mythgallery/singleview.h
===================================================================
RCS file: /var/lib/mythcvs/mythplugins/mythgallery/mythgallery/singleview.h,v
retrieving revision 1.17
diff -u -d -r1.17 singleview.h
--- mythgallery/singleview.h	24 Feb 2005 21:21:36 -0000	1.17
+++ mythgallery/singleview.h	8 May 2005 15:24:19 -0000
@@ -57,12 +57,17 @@
     bool          m_info;
     QPixmap      *m_infoBgPix;
 
+    int           m_showcaption;
+    QPixmap      *m_captionBgPix;
+    QPixmap      *m_captionbackup;
+    QTimer       *m_ctimer;
+
     int           m_tmout;
     int           m_delay;
     bool          m_effectRunning;
     bool          m_running;
     int           m_slideShow;
-    QTimer       *m_timer;
+    QTimer       *m_sstimer;
     QPixmap      *m_effectPix;
     QPainter     *m_painter;
     
@@ -86,7 +91,7 @@
     void  loadImage();
     void  rotate(int angle);
     void  zoom();
-    void  createInfoBg();
+    QPixmap *createBg(int width, int height);
 
     void  registerEffects();
     EffectMethod getRandomEffect();
@@ -109,7 +114,8 @@
 
 private slots:
 
-     void  slotTimeOut();
+    void  slotSlideTimeOut();
+    void  slotCaptionTimeOut();
 };
 
 #endif /* SINGLEVIEW_H */
