[Digikam-devel] [PATCH] Add option to hide icons and text in preview

Bruno Randolf br1 at einfach.org
Sat Aug 13 19:22:06 BST 2011


I like to review my photos without disturbing elements in my photos. Therefore
I have added an option "Show icons in preview" to disable the icons (toolbar)
and text ("Reduced Size Preview", ...) in the preview.

---

(This is my first contribution to a KDE/Qt project, so please let me know if I
got something wrong. Also I'm not subscribed to your mailinglist, so please
CC: me.)
---
 digikam/utils/albumsettings.cpp                |   17 +++++++++++++++++
 digikam/utils/albumsettings.h                  |    3 +++
 digikam/views/imagepreviewview.cpp             |    3 +++
 libs/widgets/graphicsview/graphicsdimgview.cpp |    9 ++++++++-
 libs/widgets/graphicsview/graphicsdimgview.h   |    2 ++
 utilities/setup/setupalbumview.cpp             |    8 ++++++++
 6 files changed, 41 insertions(+), 1 deletions(-)

diff --git a/digikam/utils/albumsettings.cpp b/digikam/utils/albumsettings.cpp
index 7c80d54..8fdc4c0 100644
--- a/digikam/utils/albumsettings.cpp
+++ b/digikam/utils/albumsettings.cpp
@@ -106,6 +106,7 @@ public:
         tooltipShowAlbumCategory(false),
         tooltipShowAlbumCaption(false),
         previewLoadFullImageSize(false),
+        previewShowIcons(true),
         showThumbbar(false),
         showFolderTreeViewItemsCount(false),
         treeThumbnailSize(0),
@@ -177,6 +178,7 @@ public:
     static const QString                configToolTipsShowAlbumCategoryEntry;
     static const QString                configToolTipsShowAlbumCaptionEntry;
     static const QString                configPreviewLoadFullImageSizeEntry;
+    static const QString                configPreviewShowIconsEntry;
     static const QString                configShowThumbbarEntry;
     static const QString                configShowFolderTreeViewItemsCountEntry;
     static const QString                configEXIFRotateEntry;
@@ -256,6 +258,7 @@ public:
 
     // preview settings
     bool                                previewLoadFullImageSize;
+    bool                                previewShowIcons;
     bool                                showThumbbar;
 
     bool                                showFolderTreeViewItemsCount;
@@ -365,6 +368,7 @@ const QString AlbumSettings::AlbumSettingsPrivate::configToolTipsShowAlbumCollec
 const QString AlbumSettings::AlbumSettingsPrivate::configToolTipsShowAlbumCategoryEntry("ToolTips Show Album Category");
 const QString AlbumSettings::AlbumSettingsPrivate::configToolTipsShowAlbumCaptionEntry("ToolTips Show Album Caption");
 const QString AlbumSettings::AlbumSettingsPrivate::configPreviewLoadFullImageSizeEntry("Preview Load Full Image Size");
+const QString AlbumSettings::AlbumSettingsPrivate::configPreviewShowIconsEntry("Preview Show Icons");
 const QString AlbumSettings::AlbumSettingsPrivate::configShowThumbbarEntry("Show Thumbbar");
 const QString AlbumSettings::AlbumSettingsPrivate::configShowFolderTreeViewItemsCountEntry("Show Folder Tree View Items Count");
 const QString AlbumSettings::AlbumSettingsPrivate::configEXIFRotateEntry("EXIF Rotate");
@@ -490,6 +494,7 @@ void AlbumSettings::init()
     d->tooltipShowAlbumCaption      = true;
 
     d->previewLoadFullImageSize     = false;
+    d->previewShowIcons             = true;
     d->showThumbbar                 = true;
 
     d->recursiveAlbums              = false;
@@ -589,6 +594,7 @@ void AlbumSettings::readSettings()
     d->tooltipShowAlbumCaption      = group.readEntry(d->configToolTipsShowAlbumCaptionEntry,     true);
 
     d->previewLoadFullImageSize     = group.readEntry(d->configPreviewLoadFullImageSizeEntry,     false);
+    d->previewShowIcons             = group.readEntry(d->configPreviewShowIconsEntry,             true);
     d->showThumbbar                 = group.readEntry(d->configShowThumbbarEntry,                 true);
 
     d->showFolderTreeViewItemsCount = group.readEntry(d->configShowFolderTreeViewItemsCountEntry, false);
@@ -698,6 +704,7 @@ void AlbumSettings::saveSettings()
     group.writeEntry(d->configToolTipsShowAlbumCaptionEntry,     d->tooltipShowAlbumCaption);
 
     group.writeEntry(d->configPreviewLoadFullImageSizeEntry,     d->previewLoadFullImageSize);
+    group.writeEntry(d->configPreviewShowIconsEntry,             d->previewShowIcons);
     group.writeEntry(d->configShowThumbbarEntry,                 d->showThumbbar);
 
     group.writeEntry(d->configShowFolderTreeViewItemsCountEntry, d->showFolderTreeViewItemsCount);
@@ -1450,6 +1457,16 @@ bool AlbumSettings::getPreviewLoadFullImageSize() const
     return d->previewLoadFullImageSize;
 }
 
+void AlbumSettings::setPreviewShowIcons(bool val)
+{
+    d->previewShowIcons = val;
+}
+
+bool AlbumSettings::getPreviewShowIcons() const
+{
+    return d->previewShowIcons;
+}
+
 void AlbumSettings::setRecurseAlbums(bool val)
 {
     d->recursiveAlbums = val;
diff --git a/digikam/utils/albumsettings.h b/digikam/utils/albumsettings.h
index 26196ac..1b90359 100644
--- a/digikam/utils/albumsettings.h
+++ b/digikam/utils/albumsettings.h
@@ -290,6 +290,9 @@ public:
     void setPreviewLoadFullImageSize(bool val);
     bool getPreviewLoadFullImageSize() const;
 
+    void setPreviewShowIcons(bool val);
+    bool getPreviewShowIcons() const;
+
     void setShowFolderTreeViewItemsCount(bool val);
     bool getShowFolderTreeViewItemsCount() const;
 
diff --git a/digikam/views/imagepreviewview.cpp b/digikam/views/imagepreviewview.cpp
index 081f06c..1a25557 100644
--- a/digikam/views/imagepreviewview.cpp
+++ b/digikam/views/imagepreviewview.cpp
@@ -477,6 +477,9 @@ void ImagePreviewView::slotSetupChanged()
     previewItem()->setLoadFullImageSize(AlbumSettings::instance()->getPreviewLoadFullImageSize());
     previewItem()->setExifRotate(MetadataSettings::instance()->settings().exifRotate);
 
+    d->toolBar->setVisible(AlbumSettings::instance()->getPreviewShowIcons());
+    setShowText(AlbumSettings::instance()->getPreviewShowIcons());
+
     // pass auto-suggest?
 }
 
diff --git a/libs/widgets/graphicsview/graphicsdimgview.cpp b/libs/widgets/graphicsview/graphicsdimgview.cpp
index dd5bbea..e0b885f 100644
--- a/libs/widgets/graphicsview/graphicsdimgview.cpp
+++ b/libs/widgets/graphicsview/graphicsdimgview.cpp
@@ -60,6 +60,7 @@ public:
         cornerButton     = 0;
         panIconPopup     = 0;
         movingInProgress = false;
+        showText         = true;
     }
 
     QGraphicsScene*           scene;
@@ -72,6 +73,7 @@ public:
     QPoint                    mousePressPos;
     QPoint                    panningScrollPos;
     bool                      movingInProgress;
+    bool                      showText;
 };
 
 GraphicsDImgView::GraphicsDImgView(QWidget* parent)
@@ -142,7 +144,7 @@ void GraphicsDImgView::drawForeground(QPainter* p, const QRectF& rect)
     {
         QString text = d->item->userLoadingHint();
 
-        if (text.isNull())
+        if (text.isNull() || !d->showText)
         {
             return;
         }
@@ -486,4 +488,9 @@ void GraphicsDImgView::setContentsPos(int x, int y)
     verticalScrollBar()->setValue(y);
 }
 
+void GraphicsDImgView::setShowText(bool val)
+{
+    d->showText = val;
+}
+
 } // namespace Digikam
diff --git a/libs/widgets/graphicsview/graphicsdimgview.h b/libs/widgets/graphicsview/graphicsdimgview.h
index 1d8ca6b..844c201 100644
--- a/libs/widgets/graphicsview/graphicsdimgview.h
+++ b/libs/widgets/graphicsview/graphicsdimgview.h
@@ -110,6 +110,8 @@ protected:
 
     virtual void scrollContentsBy(int dx, int dy);
 
+    void setShowText(bool value);
+
 protected Q_SLOTS:
 
     void         slotContentsMoved();
diff --git a/utilities/setup/setupalbumview.cpp b/utilities/setup/setupalbumview.cpp
index 9ab1aaf..47424d4 100644
--- a/utilities/setup/setupalbumview.cpp
+++ b/utilities/setup/setupalbumview.cpp
@@ -66,6 +66,7 @@ public:
         iconShowRatingBox(0),
         iconShowFormatBox(0),
         previewLoadFullImageSize(0),
+        previewShowIcons(0),
         showFolderTreeViewItemsCount(0),
         iconTreeThumbSize(0),
         leftClickActionComboBox(0),
@@ -87,6 +88,7 @@ public:
     QCheckBox*   iconShowRatingBox;
     QCheckBox*   iconShowFormatBox;
     QCheckBox*   previewLoadFullImageSize;
+    QCheckBox*   previewShowIcons;
     QCheckBox*   showFolderTreeViewItemsCount;
 
     KComboBox*   iconTreeThumbSize;
@@ -211,9 +213,13 @@ SetupAlbumView::SetupAlbumView(QWidget* parent)
                                                    "<p><b>Note:</b> for Raw images, a half size version of the Raw data "
                                                    "is used instead of the embedded JPEG preview.</p>"));
 
+    d->previewShowIcons              = new QCheckBox(i18n("Show icons in preview"), interfaceOptionsGroup);
+    d->previewShowIcons->setWhatsThis(i18n("Uncheck this if you don't want to see icons and text in the image preview."));
+
     grid3->setMargin(KDialog::spacingHint());
     grid3->setSpacing(KDialog::spacingHint());
     grid3->addWidget(d->previewLoadFullImageSize, 0, 0, 1, 2);
+    grid3->addWidget(d->previewShowIcons, 1, 0, 1, 2);
 
     // --------------------------------------------------------
 
@@ -268,6 +274,7 @@ void SetupAlbumView::applySettings()
                                      d->leftClickActionComboBox->currentIndex());
 
     settings->setPreviewLoadFullImageSize(d->previewLoadFullImageSize->isChecked());
+    settings->setPreviewShowIcons(d->previewShowIcons->isChecked());
     settings->setShowFolderTreeViewItemsCount(d->showFolderTreeViewItemsCount->isChecked());
     settings->saveSettings();
 }
@@ -314,6 +321,7 @@ void SetupAlbumView::readSettings()
     d->leftClickActionComboBox->setCurrentIndex((int)settings->getItemLeftClickAction());
 
     d->previewLoadFullImageSize->setChecked(settings->getPreviewLoadFullImageSize());
+    d->previewShowIcons->setChecked(settings->getPreviewShowIcons());
     d->showFolderTreeViewItemsCount->setChecked(settings->getShowFolderTreeViewItemsCount());
 }
 





More information about the Digikam-devel mailing list