Bug 283417 - Add an option to show image titles [patch]
Summary: Add an option to show image titles [patch]
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Unclassified
Component: Plugin-Generic-SlideShow (show other bugs)
Version: 2.3.0
Platform: Compiled Sources Linux
: NOR wishlist (vote)
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords: junior-jobs
Depends on:
Blocks:
 
Reported: 2011-10-05 20:16 UTC by Michael G. Hansen
Modified: 2012-06-27 09:16 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 2.5.0


Attachments
Add an option to show image titles (11.62 KB, patch)
2011-12-14 17:55 UTC, Islam Wazery
Details
Final Patch (10.49 KB, patch)
2011-12-16 20:58 UTC, Islam Wazery
Details
Sorry for the Comment #14 (10.68 KB, patch)
2011-12-17 19:33 UTC, Islam Wazery
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael G. Hansen 2011-10-05 20:16:21 UTC
Version:           2.3.0 (using KDE 4.6.2) 
OS:                Linux

In the configuration dialog in the slideshow tab, only image captions can be set to be shown during slideshows, but not image titles. I guess this is because image titles have only recently been added to Digikam.

Reproducible: Didn't try



Expected Results:  
Would be nice to have an option to show image titles.
Comment 1 Michael G. Hansen 2011-10-05 20:17:59 UTC
Thinking about legacy: I guess people who used to add captions will add titles and captions to new images, while their old images have only captions. Therefore, an option "Show captions if no title exists" might be helpful to them.
Comment 2 Michael G. Hansen 2011-10-05 20:18:33 UTC
I think this task will be simple enough to make it a junior-job.
Comment 3 Islam Wazery 2011-12-10 17:19:45 UTC
I will take this job
Comment 4 Ananta Palani 2011-12-10 22:32:58 UTC
*** Bug 284652 has been marked as a duplicate of this bug. ***
Comment 5 Islam Wazery 2011-12-14 17:55:31 UTC
Created attachment 66750 [details]
Add an option to show image titles

I don't no if it is true to remove the "Show image captions" option or not, in this patch I removed it and instead I added an option to show the captions if no title exists.
Comment 6 Ananta Palani 2011-12-14 18:13:07 UTC
Personally I think both 'show captions' and 'show title' should be available checkboxes. People will use the fields differently. Some people might have very detailed titles, but some people might have 'Skyrise I', 'Skyrise II' and then write some notes in the captions field. If it's possible, you could have a sub-option under the 'show title' labeled 'show captions if title not available'. This should cover all use cases.
Comment 7 Ananta Palani 2011-12-14 18:31:07 UTC
To clarify, I mean that there would be three check-boxes..

- Show captions
- Show title
  - Show captions if title not visible

If 'Show captions' is checked, captions are always shown regardless of any other settings. If 'Show captions' is unchecked, but 'Show title' and 'Show captions if title not visible' is checked, then captions are visible if there is no title. If only 'Show title' is checked, then the title is the only thing displayed if it is available. Hopefully that makes more sense.
Comment 8 Islam Wazery 2011-12-14 18:45:46 UTC
ok, I will edit the patch.
Comment 9 caulier.gilles 2011-12-14 19:06:49 UTC
I agree with Ananta, both options must be available...

I will review your future patch before 2.5.0 release, planed on 1th January 2012

Gilles Caulier
Comment 10 caulier.gilles 2011-12-16 11:36:01 UTC
Menopia,

What's new about your patch ?

Gilles Caulier
Comment 11 Islam Wazery 2011-12-16 13:40:21 UTC
I will work on it now, sorry I slept more than 24 hours :(
Comment 12 Islam Wazery 2011-12-16 20:58:54 UTC
Created attachment 66818 [details]
Final Patch

Here is the edited patch, but I am think that there is one thing left; what about making the "Show captions" option disable the "Show captions if no title" when it is checked?
Comment 13 Ananta Palani 2011-12-16 21:31:16 UTC
(In reply to comment #12)
> Created an attachment (id=66818) [details]
> Edited Patch
> 
> Here is the edited patch, but I am think that there is one thing left; what
> about making the "Show captions" option disable the "Show captions if no title"
> when it is checked?

Yes, that would be good. Sorry, I thought that was implicit in my description in comment #7.
Comment 14 Islam Wazery 2011-12-17 19:21:03 UTC
Comment on attachment 66818 [details]
Final Patch

>From da24d9f5741ea5f2aae34e4bec23d1775b4daa30 Mon Sep 17 00:00:00 2001
>From: Islam Wazery <wazery@ubuntu.com>
>Date: Fri, 16 Dec 2011 22:47:54 +0200
>Subject: [PATCH] Added an option to show image title
>
>---
> digikam/views/digikamview.cpp             |    1 +
> utilities/setup/setupslideshow.cpp        |   26 +++++++++++++++++++++++---
> utilities/slideshow/slideshow.cpp         |   27 ++++++++++++++++++++++++++-
> utilities/slideshow/slideshowsettings.cpp |    8 ++++++++
> utilities/slideshow/slideshowsettings.h   |   11 +++++++++++
> 5 files changed, 69 insertions(+), 4 deletions(-)
>
>diff --git a/digikam/views/digikamview.cpp b/digikam/views/digikamview.cpp
>index bdf808f..a7b62e7 100644
>--- a/digikam/views/digikamview.cpp
>+++ b/digikam/views/digikamview.cpp
>@@ -1827,6 +1827,7 @@ void DigikamView::slideShow(const ImageInfoList& infoList)
>         settings.fileList.append(info.fileUrl());
>         SlidePictureInfo pictInfo;
>         pictInfo.comment    = info.comment();
>+	  pictInfo.title      = info.title();
>         pictInfo.rating     = info.rating();
>         pictInfo.colorLabel = info.colorLabel();
>         pictInfo.pickLabel  = info.pickLabel();
>diff --git a/utilities/setup/setupslideshow.cpp b/utilities/setup/setupslideshow.cpp
>index 9cb32da..b807eb2 100644
>--- a/utilities/setup/setupslideshow.cpp
>+++ b/utilities/setup/setupslideshow.cpp
>@@ -26,6 +26,7 @@
> // Qt includes
> 
> #include <QCheckBox>
>+#include <QGroupBox>
> #include <QLabel>
> #include <QVBoxLayout>
> 
>@@ -58,6 +59,8 @@ public:
>         showExpoSensitivity(0),
>         showMakeModel(0),
>         showComment(0),
>+        showTitle(0),
>+        showCapIfNoTitle(0),
>         showLabels(0),
>         delayInput(0)
>     {}
>@@ -70,6 +73,8 @@ public:
>     QCheckBox*    showExpoSensitivity;
>     QCheckBox*    showMakeModel;
>     QCheckBox*    showComment;
>+    QGroupBox*    showTitle;
>+    QCheckBox*    showCapIfNoTitle;
>     QCheckBox*    showLabels;
> 
>     KIntNumInput* delayInput;
>@@ -114,11 +119,21 @@ SetupSlideShow::SetupSlideShow(QWidget* parent)
>     d->showMakeModel = new QCheckBox(i18n("Show camera make and model"), panel);
>     d->showMakeModel->setWhatsThis( i18n("Show the camera make and model at the bottom of the screen."));
> 
>+    d->showLabels = new QCheckBox(i18n("Show image labels"), panel);
>+    d->showLabels->setWhatsThis( i18n("Show the digiKam image color label, pick label, and rating at the bottom of the screen."));
>+
>     d->showComment = new QCheckBox(i18n("Show image caption"), panel);
>     d->showComment->setWhatsThis( i18n("Show the image caption at the bottom of the screen."));
> 
>-    d->showLabels = new QCheckBox(i18n("Show image labels"), panel);
>-    d->showLabels->setWhatsThis( i18n("Show the digiKam image color label, pick label, and rating at the bottom of the screen."));
>+    d->showTitle = new QGroupBox(i18n("Show image title"), panel);
>+    d->showTitle->setWhatsThis( i18n("Show the image title at the bottom of the screen."));
>+    d->showTitle->setCheckable(true);
>+
>+    d->showCapIfNoTitle = new QCheckBox(i18n("Show image caption if it hasn't title"), panel);
>+    d->showCapIfNoTitle->setWhatsThis( i18n("Show the image caption at the bottom of the screen if no titles existed."));
>+    QVBoxLayout *vbox = new QVBoxLayout;
>+    vbox->addWidget(d->showCapIfNoTitle);
>+    d->showTitle->setLayout(vbox);
>+
>+    // Disable the "Show captions if no title" checkbox if the "Show comment" checkbox enabled
>+    connect(d->showComment, SIGNAL(toggled(bool)), d->showCapIfNoTitle, SLOT(setDisabled(bool)));
> 
>     // Only digiKam support this feature, showFoto do not support digiKam database information.
>     if (kapp->applicationName() == "showfoto")
>@@ -134,8 +149,9 @@ SetupSlideShow::SetupSlideShow(QWidget* parent)
>     layout->addWidget(d->showApertureFocal);
>     layout->addWidget(d->showExpoSensitivity);
>     layout->addWidget(d->showMakeModel);
>+    layout->addWidget(d->showLabels);
>     layout->addWidget(d->showComment);
>-    layout->addWidget(d->showLabels);
>+    layout->addWidget(d->showTitle);
>     layout->addStretch();
>     layout->setMargin(KDialog::spacingHint());
>     layout->setSpacing(KDialog::spacingHint());
>@@ -166,6 +182,8 @@ void SetupSlideShow::applySettings()
>     settings.printExpoSensitivity = d->showExpoSensitivity->isChecked();
>     settings.printMakeModel       = d->showMakeModel->isChecked();
>     settings.printComment         = d->showComment->isChecked();
>+    settings.printTitle           = d->showTitle->isChecked();
>+    settings.printCapIfNoTitle    = d->showCapIfNoTitle->isChecked();
>     settings.printLabels          = d->showLabels->isChecked();
>     settings.writeToConfig();
> }
>@@ -183,6 +201,8 @@ void SetupSlideShow::readSettings()
>     d->showExpoSensitivity->setChecked(settings.printExpoSensitivity);
>     d->showMakeModel->setChecked(settings.printMakeModel);
>     d->showComment->setChecked(settings.printComment);
>+    d->showTitle->setChecked(settings.printTitle);
>+    d->showCapIfNoTitle->setChecked(settings.printCapIfNoTitle);
>     d->showLabels->setChecked(settings.printLabels);
> }
> 
>diff --git a/utilities/slideshow/slideshow.cpp b/utilities/slideshow/slideshow.cpp
>index 4cdfe43..e279b69 100644
>--- a/utilities/slideshow/slideshow.cpp
>+++ b/utilities/slideshow/slideshow.cpp
>@@ -396,6 +396,8 @@ void SlideShow::updatePixmap()
> 
>             QString str;
>             PhotoInfoContainer photoInfo = d->settings.pictInfoMap[d->currentImage].photoInfo;
>+            QString            comment   = d->settings.pictInfoMap[d->currentImage].comment;
>+            QString            title     = d->settings.pictInfoMap[d->currentImage].title;
>             int offset                   = d->toolBar->height()+30;
> 
>             // Display Labels.
>@@ -414,11 +416,34 @@ void SlideShow::updatePixmap()
>                 offset += d->clWidget->minimumHeight();
>             }
>
>+            // Display Titles.
>+            if (d->settings.printTitle)
>+            {
>+            str.clear();
>+                if (!title.isEmpty())
>+                {
>+                    str += title;
>+                    printInfoText(p, offset, str);
>+                }
>+            }
>+
>+            // Display Captions if no Titles.
>+
>+            if (d->settings.printCapIfNoTitle)
>+            {
>+                str.clear();
>+                if (title.isEmpty())
>+                {
>+                    str += comment;
>+                    printComments(p, offset, str);
>+                }
>+            }
>+
>             // Display Comments.
> 
>             if (d->settings.printComment)
>             {
>-                str = d->settings.pictInfoMap[d->currentImage].comment;
>+                str = comment;
>                 printComments(p, offset, str);
>             }
> 
>diff --git a/utilities/slideshow/slideshowsettings.cpp b/utilities/slideshow/slideshowsettings.cpp
>index 593c32f..d6e4ff6 100644
>--- a/utilities/slideshow/slideshowsettings.cpp
>+++ b/utilities/slideshow/slideshowsettings.cpp
>@@ -43,6 +43,8 @@ const QString SlideShowSettings::configSlideShowDelayEntry("SlideShowDelay");
> const QString SlideShowSettings::configSlideShowLoopEntry("SlideShowLoop");
> const QString SlideShowSettings::configSlideShowPrintApertureFocalEntry("SlideShowPrintApertureFocal");
> const QString SlideShowSettings::configSlideShowPrintCommentEntry("SlideShowPrintComment");
>+const QString SlideShowSettings::configSlideShowPrintTitleEntry("SlideShowPrintTitle");
>+const QString SlideShowSettings::configSlideShowPrintCapIfNoTitleEntry("SlideShowPrintCapIfNoTitle");
> const QString SlideShowSettings::configSlideShowPrintDateEntry("SlideShowPrintDate");
> const QString SlideShowSettings::configSlideShowPrintExpoSensitivityEntry("SlideShowPrintExpoSensitivity");
> const QString SlideShowSettings::configSlideShowPrintMakeModelEntry("SlideShowPrintMakeModel");
>@@ -58,6 +60,8 @@ SlideShowSettings::SlideShowSettings()
>     printName            = true;
>     printDate            = false;
>     printComment         = false;
>+    printTitle           = false;
>+    printCapIfNoTitle    = false;
>     printLabels          = false;
>     printApertureFocal   = false;
>     printMakeModel       = false;
>@@ -81,6 +85,8 @@ void SlideShowSettings::readFromConfig()
>     printExpoSensitivity      = group.readEntry(configSlideShowPrintExpoSensitivityEntry, false);
>     printMakeModel            = group.readEntry(configSlideShowPrintMakeModelEntry, false);
>     printComment              = group.readEntry(configSlideShowPrintCommentEntry, false);
>+    printTitle                = group.readEntry(configSlideShowPrintTitleEntry, false);
>+    printCapIfNoTitle         = group.readEntry(configSlideShowPrintCapIfNoTitleEntry, false);
>     printLabels               = group.readEntry(configSlideShowPrintLabelsEntry, false);
> 
>     exifRotate                = MetadataSettings::instance()->settings().exifRotate;
>@@ -99,6 +105,8 @@ void SlideShowSettings::writeToConfig()
>     group.writeEntry(configSlideShowPrintExpoSensitivityEntry, printExpoSensitivity);
>     group.writeEntry(configSlideShowPrintMakeModelEntry,       printMakeModel);
>     group.writeEntry(configSlideShowPrintCommentEntry,         printComment);
>+    group.writeEntry(configSlideShowPrintTitleEntry,           printTitle);
>+    group.writeEntry(configSlideShowPrintCapIfNoTitleEntry,    printCapIfNoTitle);
>     group.writeEntry(configSlideShowPrintLabelsEntry,          printLabels);
>     group.sync();
> }
>diff --git a/utilities/slideshow/slideshowsettings.h b/utilities/slideshow/slideshowsettings.h
>index 17bea5f..15599a3 100644
>--- a/utilities/slideshow/slideshowsettings.h
>+++ b/utilities/slideshow/slideshowsettings.h
>@@ -66,6 +66,9 @@ public:
>     /** Picture Comment */
>     QString            comment;
> 
>+    /** Picture Title */
>+    QString            title;
>+
>     /** Exif photo info of picture */
>     PhotoInfoContainer photoInfo;
> };
>@@ -112,6 +115,12 @@ public:
>     /** Print picture comment during slide */
>     bool                         printComment;
> 
>+    /** Print image title during slide */
>+    bool                         printTitle;
>+
>+    /** Print image captions if no title available during slide */
>+    bool                         printCapIfNoTitle;
>+
>     /** Print color label, pick label, and rating during slide */
>     bool                         printLabels;
> 
>@@ -138,6 +147,8 @@ private:
>     static const QString         configSlideShowLoopEntry;
>     static const QString         configSlideShowPrintApertureFocalEntry;
>     static const QString         configSlideShowPrintCommentEntry;
>+    static const QString         configSlideShowPrintTitleEntry;
>+    static const QString         configSlideShowPrintCapIfNoTitleEntry;
>     static const QString         configSlideShowPrintDateEntry;
>     static const QString         configSlideShowPrintExpoSensitivityEntry;
>     static const QString         configSlideShowPrintMakeModelEntry;
>-- 
>1.7.5.4
>
Comment 15 Islam Wazery 2011-12-17 19:33:56 UTC
Created attachment 66837 [details]
Sorry for the Comment #14

Sorry for the Comment #14, I posted it by mistake and it was incorrect :(, here is the final one.
Comment 16 caulier.gilles 2011-12-17 22:20:33 UTC
Menopia,

Your patch is malformed :


[gilles@localhost core]$ pwd
/mnt/data/Devel/GIT/2.x/core

[gilles@localhost core]$ patch -p1 < 0001-Added-an-option-to-show-image-title.patch
patching file digikam/views/digikamview.cpp
Hunk #1 succeeded at 1835 (offset 8 lines).
patching file utilities/setup/setupslideshow.cpp
patch: **** malformed patch at line 80:

Please, generate your patch in a standard way, using a git diff against git/master, like this :

http://www.digikam.org/drupal/contrib

Best

Gilles Caulier
Comment 17 Islam Wazery 2011-12-18 06:43:18 UTC
Sorry about the malformed patch, you can download it from here http://bit.ly/rNUlcf
let me know if there is something missing.
Comment 18 caulier.gilles 2011-12-18 09:36:29 UTC
Git commit 2ee41c206239764b0bc866234bfbd1b1ad8d9405 by Gilles Caulier.
Committed on 18/12/2011 at 10:35.
Pushed by cgilles into branch 'master'.

apply patch to show image title on digiKam SlideShow
BUGS: 283417

M  +1    -0    digikam/views/digikamview.cpp
M  +34   -5    utilities/setup/setupslideshow.cpp
M  +4    -0    utilities/setup/setupslideshow.h
M  +28   -2    utilities/slideshow/slideshow.cpp
M  +8    -0    utilities/slideshow/slideshowsettings.cpp
M  +11   -0    utilities/slideshow/slideshowsettings.h

http://commits.kde.org/digikam/2ee41c206239764b0bc866234bfbd1b1ad8d9405
Comment 19 Islam Wazery 2011-12-22 04:46:48 UTC
I think we need to add the same options for showfoto, if I am true I will make a patch for that.
Comment 20 caulier.gilles 2011-12-22 07:42:13 UTC
No. Look on code commited to git/master, option are disabled with showfoto.

Imagetitle (as Tags) is digiKam Database info, not available from showfoto

Gilles Caulier