Ticket #8664: caption-fallback.dif

File caption-fallback.dif, 4.3 KB (added by Dave Badia <dbadia@…>, 14 years ago)
Line 
1Index: mythplugins/mythgallery/mythgallery/gallerysettings.cpp
2===================================================================
3--- mythplugins/mythgallery/mythgallery/gallerysettings.cpp     (revision 25331)
4+++ mythplugins/mythgallery/mythgallery/gallerysettings.cpp     (working copy)
5@@ -67,6 +67,15 @@
6     return gc;
7 };
8 
9+static HostCheckBox *MythGalleryCaptionFallbackFilename()
10+{
11+    HostCheckBox *gc = new HostCheckBox("GalleryCaptionFilename");
12+    gc->setLabel(QObject::tr("Use image file name as caption if no embedded data exists"));
13+    gc->setValue(true);
14+    gc->setHelpText(QObject::tr("If set, when there is no embedded caption data in the image file, the name of the file is presented as the caption."));
15+    return gc;
16+};
17+
18 static HostLineEdit *MythGalleryImportDirs()
19 {
20     HostLineEdit *gc = new HostLineEdit("GalleryImportDirs");
21@@ -198,6 +207,7 @@
22 
23         ConfigurationGroup* regularConfig = new VerticalConfigurationGroup(false);
24         regularConfig->addChild(MythGalleryOverlayCaption());
25+        regularConfig->addChild(MythGalleryCaptionFallbackFilename());
26         regularConfig->addChild(SlideshowTransition());
27         regularConfig->addChild(SlideshowBackground());
28         addTarget("0", regularConfig);
29Index: mythplugins/mythgallery/mythgallery/iconview.cpp
30===================================================================
31--- mythplugins/mythgallery/mythgallery/iconview.cpp    (revision 25331)
32+++ mythplugins/mythgallery/mythgallery/iconview.cpp    (working copy)
33@@ -113,6 +113,7 @@
34     m_childCountThread = new ChildCountThread(this);
35 
36     m_showcaption = gCoreContext->GetNumSetting("GalleryOverlayCaption", 0);
37+    m_captionfallbackname = gCoreContext->GetNumSetting("GalleryCaptionFilename", 1);
38     m_sortorder = gCoreContext->GetNumSetting("GallerySortOrder", 0);
39     m_useOpenGL = gCoreContext->GetNumSetting("SlideshowUseOpenGL", 0);
40     m_recurse = gCoreContext->GetNumSetting("GalleryRecursiveSlideshow", 0);
41@@ -239,7 +240,7 @@
42     {
43         thumbitem = m_itemList.at(x);
44 
45-        thumbitem->InitCaption(m_showcaption);
46+        thumbitem->InitCaption(m_showcaption, m_captionfallbackname);
47         MythUIButtonListItem* item =
48             new MythUIButtonListItem(m_imageList, thumbitem->GetCaption(), 0,
49                                      true, MythUIButtonListItem::NotChecked);
50@@ -1007,6 +1008,7 @@
51 
52     // reload settings
53     m_showcaption = gCoreContext->GetNumSetting("GalleryOverlayCaption", 0);
54+    m_captionfallbackname = gCoreContext->GetNumSetting("GalleryCaptionFilename", 1);
55     m_sortorder   = gCoreContext->GetNumSetting("GallerySortOrder", 0);
56     m_useOpenGL   = gCoreContext->GetNumSetting("SlideshowUseOpenGL", 0);
57     m_recurse     = gCoreContext->GetNumSetting("GalleryRecursiveSlideshow", 0);
58Index: mythplugins/mythgallery/mythgallery/iconview.h
59===================================================================
60--- mythplugins/mythgallery/mythgallery/iconview.h      (revision 25331)
61+++ mythplugins/mythgallery/mythgallery/iconview.h      (working copy)
62@@ -135,6 +135,7 @@
63     ChildCountThread   *m_childCountThread;
64 
65     int                 m_showcaption;
66+    int                 m_captionfallbackname;
67     int                 m_sortorder;
68     bool                m_useOpenGL;
69     bool                m_recurse;
70Index: mythplugins/mythgallery/mythgallery/thumbview.cpp
71===================================================================
72--- mythplugins/mythgallery/mythgallery/thumbview.cpp   (revision 25331)
73+++ mythplugins/mythgallery/mythgallery/thumbview.cpp   (working copy)
74@@ -51,11 +51,11 @@
75     return true;
76 }
77 
78-void ThumbItem::InitCaption(bool get_caption)
79+void ThumbItem::InitCaption(bool get_caption, bool use_name_if_none)
80 {
81     if (!HasCaption() && get_caption)
82         SetCaption(GalleryUtil::GetCaption(m_path));
83-    if (!HasCaption())
84+    if (!HasCaption() && use_name_if_none)
85         SetCaption(m_name);
86 }
87 
88Index: mythplugins/mythgallery/mythgallery/thumbview.h
89===================================================================
90--- mythplugins/mythgallery/mythgallery/thumbview.h     (revision 25331)
91+++ mythplugins/mythgallery/mythgallery/thumbview.h     (working copy)
92@@ -25,7 +25,7 @@
93 
94     // commands
95     bool Remove(void);
96-    void InitCaption(bool get_caption);
97+    void InitCaption(bool get_caption, bool use_name_if_none);
98 
99     // sets
100     void SetRotationAngle(int angle);