[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [digikam/development/3.0.0] utilities/cameragui/items: Added the necessary items for import tool
From:       Islam Wazery <wazery () ubuntu ! com>
Date:       2012-07-31 23:11:44
Message-ID: 20120731231144.EE32BA60C6 () git ! kde ! org
[Download RAW message or body]

Git commit 5046d142eb7882d26835411b5913fee0f39aef25 by Islam Wazery.
Committed on 01/08/2012 at 00:42.
Pushed by wazery into branch 'development/3.0.0'.

Added the necessary items for import tool

M  +8    -5    utilities/cameragui/items/importcategorydrawer.cpp
M  +74   -105  utilities/cameragui/items/importdelegate.cpp
M  +6    -3    utilities/cameragui/items/importdelegate.h
M  +7    -1    utilities/cameragui/items/importdelegatepriv.h
M  +81   -51   utilities/cameragui/items/itemviewimportdelegate.cpp
M  +9    -1    utilities/cameragui/items/itemviewimportdelegate.h
M  +5    -0    utilities/cameragui/items/itemviewimportdelegatepriv.h

http://commits.kde.org/digikam/5046d142eb7882d26835411b5913fee0f39aef25

diff --git a/utilities/cameragui/items/importcategorydrawer.cpp \
b/utilities/cameragui/items/importcategorydrawer.cpp index 51aad63..47e6f8d 100644
--- a/utilities/cameragui/items/importcategorydrawer.cpp
+++ b/utilities/cameragui/items/importcategorydrawer.cpp
@@ -22,11 +22,12 @@
  * ============================================================ */
 
 #include "importcategorydrawer.moc"
-#include "importcategorydrawer.h" //TODO: Remove this line
+#include "importcategorydrawer.h"
 
 // Qt includes
 
 #include <QPainter>
+#include <QSharedData>
 
 // KDE includes
 
@@ -48,6 +49,7 @@ public:
     {
         lowerSpacing = 0;
         view         = 0;
+        rect         = QRect(0, -1, 0, -1);//TODO: Remove this line.
     }
 
     QFont                  font;
@@ -99,7 +101,7 @@ void ImportCategoryDrawer::setDefaultViewOptions(const \
QStyleOptionViewItem& opt  
 void ImportCategoryDrawer::invalidatePaintingCache()
 {
-    if (d->rect.isNull())
+    if (d->rect.isEmpty())
     {
         return;
     }
@@ -152,9 +154,10 @@ void ImportCategoryDrawer::drawCategory(const QModelIndex& \
index, int /*sortRole  case CamItemSortSettings::OneCategory:
             viewHeaderText(index, &header, &subLine);
             break;
-        case CamItemSortSettings::CategoryByFormat:
-            textForFormat(index, &header, &subLine);
-            break;
+        //TODO:
+        //case CamItemSortSettings::CategoryByFormat:
+            //textForFormat(index, &header, &subLine);
+            //break;
     }
 
     p->setPen(kapp->palette().color(QPalette::HighlightedText));
diff --git a/utilities/cameragui/items/importdelegate.cpp \
b/utilities/cameragui/items/importdelegate.cpp index 7324f51..8cf10fc 100644
--- a/utilities/cameragui/items/importdelegate.cpp
+++ b/utilities/cameragui/items/importdelegate.cpp
@@ -1,42 +1,22 @@
-/* ============================================================
- *
- * This file is a part of digiKam project
- * http://www.digikam.org
- *
- * Date        : 2012-07-08
- * Description : Qt item view for images - the delegate
- *
- * Copyright (C) 2012 by Islam Wazery <wazery at ubuntu dot com>
- *
- * This program is free software; you can redistribute it
- * and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation;
- * either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * ============================================================ */
-
-#include "importdelegate.moc"
+#include "importdelegate.h"
+#include "importdelegatepriv.h"
 
 // Qt includes
 
-#include "QCache"
+#include <QCache>
+#include <QPainter>
+#include <QRect>
 
 // KDE includes
 
-#include <kapplication.h>
+#include <KApplication>
 #include <KIconLoader>
 
 // Local includes
 
-#include "importdelegatepriv.h"
+#include "importimagemodel.h"
+#include "importfiltermodel.h"
 #include "importsettings.h"
-#include "imagedelegateoverlay.h"
 
 namespace Digikam
 {
@@ -61,23 +41,25 @@ void ImportDelegate::ImportDelegatePrivate::clearRects()
 ImportDelegate::ImportDelegate(QObject* parent)
     : ItemViewImportDelegate(*new ImportDelegatePrivate, parent)
 {
+
 }
 
 ImportDelegate::ImportDelegate(ImportDelegate::ImportDelegatePrivate& dd, QObject* \
parent)  : ItemViewImportDelegate(dd, parent)
 {
+
 }
 
 ImportDelegate::~ImportDelegate()
 {
     Q_D(ImportDelegate);
-    Q_UNUSED(d);
+    Q_UNUSED(d); // To please compiler about warnings.
 }
 
 void ImportDelegate::setView(ImportCategorizedView* view)
 {
     Q_D(ImportDelegate);
-    Digikam::ImageDelegateOverlayContainer::setViewOnAllOverlays(view);
+    setViewOnAllOverlays(view);
 
     if (d->currentView)
     {
@@ -243,14 +225,15 @@ void ImportDelegate::paint(QPainter* p, const \
                QStyleOptionViewItem& option, cons
         const_cast<ImportDelegate*>(this)->updateActualPixmapRect(index, \
actualPixmapRect);  }
 
-    //TODO: Implement Rating
+    //TODO: Implement rating in import tool.
     //if (!d->ratingRect.isNull())
     //{
     //    drawRating(p, index, d->ratingRect, info.rating(), isSelected);
     //}
 
+    //TODO: Implement labels in import tool.
     // Draw Color Label rectangle
-    //TODO: drawColorLabelRect(p, option, isSelected, info.colorLabel());
+    //drawColorLabelRect(p, option, isSelected, info.colorLabel());
 
     p->setPen(isSelected ? kapp->palette().color(QPalette::HighlightedText)
                          : kapp->palette().color(QPalette::Text));
@@ -268,16 +251,6 @@ void ImportDelegate::paint(QPainter* p, const \
QStyleOptionViewItem& option, cons  drawName(p, d->nameRect, info.name);
     }
 
-    //if (!d->titleRect.isNull())
-    //{
-    //    drawTitle(p, d->titleRect, info.title());
-    //}
-
-    //if (!d->commentsRect.isNull())
-    //{
-    //    drawComments(p, d->commentsRect, info.comment());
-    //}
-
     if (!d->dateRect.isNull())
     {
         drawCreationDate(p, d->dateRect, info.photoInfo.dateTime);
@@ -288,46 +261,42 @@ void ImportDelegate::paint(QPainter* p, const \
QStyleOptionViewItem& option, cons  drawModificationDate(p, d->modDateRect, \
info.mtime);  }
 
-    //if (!d->resolutionRect.isNull())
-    //{
-    //    drawImageSize(p, d->resolutionRect, info.dimensions());
-    //}
-
     if (!d->sizeRect.isNull())
     {
-        drawFileSize(p, d->sizeRect, qlonglong(info.size));
+        drawFileSize(p, d->sizeRect, info.size);
     }
 
-    //TOOD: Implement the grouping in import interface
+    if (!d->resolutionRect.isNull())
+    {
+        QSize dimensions(info.width, info.height);
+        drawImageSize(p, d->resolutionRect, dimensions);
+    }
+
+    //TODO: Implement grouping in import tool.
     //if (!d->groupRect.isNull())
     //{
     //    drawGroupIndicator(p, d->groupRect, info.numberOfGroupedImages(),
     //                       \
index.data(ImportFilterModel::GroupIsOpenRole).toBool());  //}
 
-    //TOOD: Implement tagging in import interface
+    //TODO: Implement tags in import tool.
     //if (!d->tagRect.isNull())
     //{
     //    QString tags = AlbumManager::instance()->tagNames(info.tagIds()).join(", \
");  //    drawTags(p, d->tagRect, tags, isSelected);
     //}
 
-    //TOOD: Implement color labels in import interface
+    //TODO: Implement labels in import tool.
     //if (!d->pickLabelRect.isNull())
     //{
     //    drawPickLabelIcon(p, d->pickLabelRect, info.pickLabel());
     //}
 
-    //bool left  = index.data(ImportImageModel::LTLeftPanelRole).toBool();
-    //bool right = index.data(ImportImageModel::LTRightPanelRole).toBool();
-    //drawPanelSideIcon(p, left, right);
-
-    //if (d->drawImageFormat)
-    //{
-    //    QString frm = info.mime;
-    //    if (frm.contains("-")) frm = frm.section('-', -1);   // For RAW format \
                annoted as "RAW-xxx" => "xxx"
-    //    drawImageFormat(p, actualPixmapRect, frm);
-    //}
+    if (d->drawImageFormat)
+    {
+        QString frm = info.mime;
+        drawImageFormat(p, actualPixmapRect, frm);
+    }
 
     if (d->drawFocusFrame)
     {
@@ -440,11 +409,11 @@ void ImportDelegate::updateSizeRectsAndPixmaps()
 
     prepareBackground();
 
-    //TODO:
+    //TODO: Implement rating in import tool.
     //if (!d->ratingRect.isNull())
     //{
-    //    // Normally we prepare the pixmaps over the background of the rating rect.
-    //    // If the rating is drawn over the thumbnail, we can only draw over a \
transparent pixmap. +        // Normally we prepare the pixmaps over the background \
of the rating rect. +        // If the rating is drawn over the thumbnail, we can \
only draw over a transparent pixmap.  //    \
prepareRatingPixmaps(!d->ratingOverThumbnail);  //}
 
@@ -560,7 +529,7 @@ int ImportDelegate::calculatethumbSizeToFit(int ws)
     return (ts1);
 }
 
-// ------ ImportThumbnailDelegate ----------------------------------------
+// --- ImportThumbnailDelegate ---------------------------------------
 
 void ImportThumbnailDelegatePrivate::init(ImportThumbnailDelegate* q)
 {
@@ -596,8 +565,9 @@ void ImportThumbnailDelegate::setDefaultViewOptions(const \
QStyleOptionViewItem&  int ImportThumbnailDelegate::maximumSize() const
 {
     Q_D(const ImportThumbnailDelegate);
-    //FIXME: Need to examine this line and make sure of it return \
                ThumbnailLoadThread::maximumThumbnailPixmapSize(true) + 2*d->radius + \
                2*d->margin;
-    return (2*d->radius + 2*d->margin);
+    //FIXME: Fix thumbnails issues.
+    //return ThumbnailLoadThread::maximumThumbnailPixmapSize(true) + 2*d->radius + \
2*d->margin; +    return 256;// dummy return
 }
 
 int ImportThumbnailDelegate::minimumSize() const
@@ -627,8 +597,8 @@ void ImportThumbnailDelegate::updateContentWidth()
         maxSize = d->viewSize.width();
     }
 
-    //FIXME: Need to examine this line and make sure of it d->thumbSize = \
                ThumbnailLoadThread::thumbnailPixmapSize(true, maxSize - 2*d->radius \
                - 2*d->margin);
-    d->thumbSize = maxSize - 2*d->radius - 2*d->margin;
+    //FIXME: Fix thumbnails issues.
+    //d->thumbSize = ThumbnailLoadThread::thumbnailPixmapSize(true, maxSize - \
2*d->radius - 2*d->margin);  
     ImportDelegate::updateContentWidth();
 }
@@ -641,12 +611,12 @@ void ImportThumbnailDelegate::updateRects()
     d->rect            = QRect(0, 0, d->contentWidth + 2*d->margin, d->contentWidth \
                + 2*d->margin);
     d->drawImageFormat = ImportSettings::instance()->getIconShowImageFormat();
 
-//TODO: Implement rating.
-//    if (ImportSettings::instance()->getIconShowRating())
-//    {
-//        int top       = d->rect.bottom() - d->margin - d->starPolygonSize.height() \
                - 2;
-//        d->ratingRect = QRect(d->margin, top, d->contentWidth, \
                d->starPolygonSize.height());
-//    }
+    //TODO: Implement rating in import tool.
+    //if (ImportSettings::instance()->getIconShowRating())
+    //{
+    //    int top       = d->rect.bottom() - d->margin - d->starPolygonSize.height() \
- 2; +    //    d->ratingRect = QRect(d->margin, top, d->contentWidth, \
d->starPolygonSize.height()); +    //}
 
     if (d->flow == QListView::LeftToRight)
     {
@@ -658,20 +628,23 @@ void ImportThumbnailDelegate::updateRects()
     }
 }
 
-// ------ ImportNormalDelegate ----------------------------------------
+// --- ImportNormalDelegate \
-------------------------------------------------------------------------------------------------------
  
 void ImportNormalDelegatePrivate::init(ImportNormalDelegate* q, \
ImportCategorizedView* parent)  {
+
     categoryDrawer = new ImportCategoryDrawer(parent);
 
     QObject::connect(ImportSettings::instance(), SIGNAL(setupChanged()),
                      q, SLOT(slotSetupChanged()));
 }
 
+// ------------------------------------------------------------------------------------------------
  
 ImportNormalDelegate::ImportNormalDelegate(ImportCategorizedView* parent)
     : ImportDelegate(*new ImportNormalDelegatePrivate, parent)
 {
+
     Q_D(ImportNormalDelegate);
     d->init(this, parent);
 }
@@ -679,6 +652,7 @@ ImportNormalDelegate::ImportNormalDelegate(ImportCategorizedView* \
parent)  ImportNormalDelegate::ImportNormalDelegate(ImportNormalDelegatePrivate& dd, \
ImportCategorizedView* parent)  : ImportDelegate(dd, parent)
 {
+
     Q_D(ImportNormalDelegate);
     d->init(this, parent);
 }
@@ -691,23 +665,23 @@ void ImportNormalDelegate::updateRects()
 {
     Q_D(ImportNormalDelegate);
 
-    int y                              = d->margin;
-    d->pixmapRect                      = QRect(d->margin, y, d->contentWidth, \
                d->contentWidth);
-    y                                  = d->pixmapRect.bottom();
-    d->imageInformationRect            = QRect(d->margin, y, d->contentWidth, 0);
+    int y                                = d->margin;
+    d->pixmapRect                        = QRect(d->margin, y, d->contentWidth, \
d->contentWidth); +    y                                    = d->pixmapRect.bottom();
+    d->imageInformationRect              = QRect(d->margin, y, d->contentWidth, 0);
     const ImportSettings* ImportSettings = ImportSettings::instance();
-    d->drawImageFormat                 = ImportSettings->getIconShowImageFormat();
+    d->drawImageFormat                   = ImportSettings->getIconShowImageFormat();
 
     const int iconSize = KIconLoader::SizeSmallMedium;
-    //FIXME: d->pickLabelRect   = QRect(d->margin, y, iconSize, iconSize);
-    d->groupRect       = QRect(d->contentWidth - iconSize, y, iconSize, iconSize);
+    //TODO: d->pickLabelRect   = QRect(d->margin, y, iconSize, iconSize);
+    //d->groupRect       = QRect(d->contentWidth - iconSize, y, iconSize, iconSize);
 
-//TODO: Implement rating.
-//    if (ImportSettings->getIconShowRating())
-//    {
-//        d->ratingRect = QRect(d->margin, y, d->contentWidth, \
                d->starPolygonSize.height());
-//        y             = d->ratingRect.bottom();
-//    }
+    //TODO: Implement rating in import tool.
+    //if (ImportSettings->getIconShowRating())
+    //{
+    //    d->ratingRect = QRect(d->margin, y, d->contentWidth, \
d->starPolygonSize.height()); +    //    y             = d->ratingRect.bottom();
+    //}
 
     if (ImportSettings->getIconShowName())
     {
@@ -715,12 +689,6 @@ void ImportNormalDelegate::updateRects()
         y           = d->nameRect.bottom();
     }
 
-//    if (ImportSettings->getIconShowTitle())
-//    {
-//        d->titleRect = QRect(d->margin, y, d->contentWidth, \
                d->oneRowRegRect.height());
-//        y = d->titleRect.bottom();
-//    }
-
     if (ImportSettings->getIconShowDate())
     {
         d->dateRect = QRect(d->margin, y, d->contentWidth, \
d->oneRowXtraRect.height()); @@ -733,11 +701,12 @@ void \
ImportNormalDelegate::updateRects()  y              = d->modDateRect.bottom();
     }
 
-//    if (ImportSettings->getIconShowResolution())
-//    {
-//        d->resolutionRect = QRect(d->margin, y, d->contentWidth, \
                d->oneRowXtraRect.height());
-//        y                 = d->resolutionRect.bottom() ;
-//    }
+    //TODO: Add resolution entry in ImportSettings.
+    //if (ImportSettings->getIconShowResolution())
+    //{
+    //    d->resolutionRect = QRect(d->margin, y, d->contentWidth, \
d->oneRowXtraRect.height()); +    //    y                 = \
d->resolutionRect.bottom() ; +    //}
 
     if (ImportSettings->getIconShowSize())
     {
@@ -745,11 +714,11 @@ void ImportNormalDelegate::updateRects()
         y           = d->sizeRect.bottom();
     }
 
-//    if (ImportSettings->getIconShowTags())
-//    {
-//        d->tagRect = QRect(d->margin, y, d->contentWidth, \
                d->oneRowComRect.height());
-//        y          = d->tagRect.bottom();
-//    }
+    //if (ImportSettings->getIconShowTags())
+    //{
+    //    d->tagRect = QRect(d->margin, y, d->contentWidth, \
d->oneRowComRect.height()); +    //    y          = d->tagRect.bottom();
+    //}
 
     d->imageInformationRect.setBottom(y);
 
diff --git a/utilities/cameragui/items/importdelegate.h \
b/utilities/cameragui/items/importdelegate.h index c9e535d..ec71ac3 100644
--- a/utilities/cameragui/items/importdelegate.h
+++ b/utilities/cameragui/items/importdelegate.h
@@ -24,12 +24,14 @@
 #ifndef IMPORTDELEGATE_H
 #define IMPORTDELEGATE_H
 
+#include <qglobal.h>
+
 // Local includes
 
 #include "itemviewimportdelegate.h"
 #include "importthumbnailmodel.h"
-#include "importcategorizedview.h"
 #include "importcategorydrawer.h"
+#include "importcategorizedview.h"
 
 namespace Digikam
 {
@@ -76,13 +78,14 @@ public:
     virtual void prepareThumbnails(ImportThumbnailModel* thumbModel, const \
QList<QModelIndex>& indexes);  
     /**
-     * Retrieve the thumbnail pixmap in given size for the ImageModel::ThumbnailRole \
                for
-     * the given index from the given index, which must adhere to \
ImageThumbnailModel semantics. +     * Retrieve the thumbnail pixmap in given size \
for the ImportImageModel::ThumbnailRole for +     * the given index from the given \
                index, which must adhere to ImportThumbnailModel semantics.
      */
     static QPixmap retrieveThumbnailPixmap(const QModelIndex& index, int \
thumbnailSize);  
 public:
 
+    // Declared as public because of use in ImportNormalDelegate class.
     class ImportDelegatePrivate;
 
 protected:
diff --git a/utilities/cameragui/items/importdelegatepriv.h \
b/utilities/cameragui/items/importdelegatepriv.h index 342a2cc..dfdf774 100644
--- a/utilities/cameragui/items/importdelegatepriv.h
+++ b/utilities/cameragui/items/importdelegatepriv.h
@@ -8,12 +8,14 @@
 
 // Local includes
 
-#include "importdelegate.h"
+#include "importcategorizedview.h"
 #include "itemviewimportdelegatepriv.h"
 
 namespace Digikam
 {
 
+class ImportCategoryDrawer;
+
 class ImportDelegate::ImportDelegatePrivate : public ItemViewImportDelegatePrivate
 {
 public:
@@ -63,6 +65,8 @@ public:
     virtual void clearRects();
 };
 
+// --- ImportThumbnailDelegate ----------------------------------------------------
+
 class ImportThumbnailDelegatePrivate : public ImportDelegate::ImportDelegatePrivate
 {
 public:
@@ -87,6 +91,8 @@ public:
     void init(ImportThumbnailDelegate* q);
 };
 
+// --- ImportNormalDelegate ----------------------------------------------------
+
 class ImportNormalDelegatePrivate : public ImportDelegate::ImportDelegatePrivate
 {
 public:
diff --git a/utilities/cameragui/items/itemviewimportdelegate.cpp \
b/utilities/cameragui/items/itemviewimportdelegate.cpp index e429e98..cd47d32 100644
--- a/utilities/cameragui/items/itemviewimportdelegate.cpp
+++ b/utilities/cameragui/items/itemviewimportdelegate.cpp
@@ -22,73 +22,32 @@
  * ============================================================ */
 
 #include "itemviewimportdelegate.moc"
+#include "itemviewimportdelegatepriv.h"
+#include "itemviewimportdelegate.h" //TODO: Remove this line.
 
 // Qt includes
 
+#include <QCache>
 #include <QPainter>
+#include <QIcon>
 
 // KDE includes
 
+#include <kglobal.h>
 #include <kio/global.h>
 #include <klocale.h>
+#include <kiconloader.h>
+#include <kdebug.h>
 #include <kapplication.h>
 
 // Local includes
 
+#include "imagedelegateoverlay.h"
 #include "thememanager.h"
 
 namespace Digikam
 {
 
-class ItemViewImportDelegatePrivate
-{
-public:
-
-    ItemViewImportDelegatePrivate();
-    virtual ~ItemViewImportDelegatePrivate() {}
-
-    void init(ItemViewImportDelegate* const _q);
-
-    void makeStarPolygon();
-
-    /// Resets cached rects. Remember to reimplement in subclass for added rects.
-    virtual void clearRects();
-
-public:
-
-    int                       spacing;
-    QSize                     gridSize;
-
-    QRect                     rect;
-    QRect                     ratingRect;
-
-    QPixmap                   regPixmap;
-    QPixmap                   selPixmap;
-    QVector<QPixmap>          ratingPixmaps;
-
-    QFont                     font;
-    QFont                     fontReg;
-    QFont                     fontCom;
-    QFont                     fontXtra;
-
-    QPolygon                  starPolygon;
-    QSize                     starPolygonSize;
-
-    ThumbnailSize             thumbSize;
-
-    QPersistentModelIndex     editingRating;
-
-    ItemViewImportDelegate*    q;
-
-    QRect                     oneRowRegRect;
-    QRect                     oneRowComRect;
-    QRect                     oneRowXtraRect;
-
-    // constant values for drawing
-    int                       radius;
-    int                       margin;
-};
-
 ItemViewImportDelegatePrivate::ItemViewImportDelegatePrivate()
 {
     spacing       = 0;
@@ -138,9 +97,15 @@ void ItemViewImportDelegatePrivate::makeStarPolygon()
 // ---- ItemViewImportDelegate -----------------------------------------------
 
 ItemViewImportDelegate::ItemViewImportDelegate(QObject* const parent)
-    : DItemDelegate(parent), d(new ItemViewImportDelegatePrivate)
+    : DItemDelegate(parent), d_ptr(new ItemViewImportDelegatePrivate)
+{
+    d_ptr->init(this);
+}
+
+ItemViewImportDelegate::ItemViewImportDelegate(ItemViewImportDelegatePrivate& dd, \
QObject* parent) +    : DItemDelegate(parent), d_ptr(&dd)
 {
-    d->init(this);
+    d_ptr->init(this);
 }
 
 ItemViewImportDelegate::~ItemViewImportDelegate()
@@ -271,6 +236,7 @@ void ItemViewImportDelegate::invalidatePaintingCache()
 {
     Q_D(ItemViewImportDelegate);
     QSize oldGridSize = d->gridSize;
+    qDebug() << "Width: " << d->gridSize.width() << "Height: " << \
d->gridSize.height();//TODO: Remove this line.  updateSizeRectsAndPixmaps();
 
     if (oldGridSize != d->gridSize)
@@ -332,6 +298,56 @@ void ItemViewImportDelegate::drawModificationDate(QPainter* p, \
                const QRect& date
     p->drawText(dateRect, Qt::AlignCenter, str);//squeezedTextCached(p, \
dateRect.width(), str));  }
 
+void ItemViewImportDelegate::drawImageFormat(QPainter* p, const QRect& r, const \
QString& mime) const +{
+    Q_D(const ItemViewImportDelegate);
+
+    if (!mime.isEmpty() && !r.isNull())
+    {
+        p->save();
+
+        QFont fnt(d->fontReg);
+        fnt.setWeight(QFont::Black);
+        fnt.setItalic(false);
+        p->setFont(fnt);
+        p->setPen(QPen(Qt::gray));
+        p->setOpacity(0.50);
+
+        QRect bRect = p->boundingRect(r, Qt::AlignTop | Qt::AlignHCenter, \
mime.toUpper()); +        bRect.adjust(-1, -1, 1, 1);
+        bRect.translate(0, 1);
+
+        p->fillRect(bRect, Qt::SolidPattern);
+        p->setPen(QPen(Qt::white));
+        p->setOpacity(1.0);
+        p->drawText(bRect, Qt::AlignTop | Qt::AlignHCenter, mime.toUpper());
+
+        p->restore();
+    }
+}
+
+void ItemViewImportDelegate::drawImageSize(QPainter* p, const QRect& dimsRect, const \
QSize& dims) const +{
+    Q_D(const ItemViewImportDelegate);
+
+    if (dims.isValid())
+    {
+        p->setFont(d->fontXtra);
+        QString mpixels, resolution;
+        mpixels.setNum(dims.width()*dims.height()/1000000.0, 'f', 2);
+
+        if (dims.isValid())
+            resolution = i18nc("%1 width, %2 height, %3 mpixels", "%1x%2 (%3Mpx)",
+                               dims.width(), dims.height(), mpixels);
+        else
+        {
+            resolution = i18nc("unknown image resolution", "Unknown");
+        }
+
+        p->drawText(dimsRect, Qt::AlignCenter, resolution);
+    }
+}
+
 void ItemViewImportDelegate::drawFileSize(QPainter* p, const QRect& r, qlonglong \
bytes) const  {
     Q_D(const ItemViewImportDelegate);
@@ -359,6 +375,20 @@ void ItemViewImportDelegate::drawPanelSideIcon(QPainter* p, bool \
left, bool righ  }
 }
 
+void ItemViewImportDelegate::drawFocusRect(QPainter* p, const QStyleOptionViewItem& \
option, +                                          bool isSelected) const
+{
+    Q_D(const ItemViewImportDelegate);
+
+    if (option.state & QStyle::State_HasFocus) //?? is current item
+    {
+        p->setPen(QPen(isSelected ? kapp->palette().color(QPalette::HighlightedText)
+                                  : kapp->palette().color(QPalette::Text),
+                       1, Qt::DotLine));
+        p->drawRect(1, 1, d->rect.width()-3, d->rect.height()-3);
+    }
+}
+
 void ItemViewImportDelegate::drawGroupIndicator(QPainter* p, const QRect& r,
                                                 int numberOfGroupedImages, bool \
open) const  {
diff --git a/utilities/cameragui/items/itemviewimportdelegate.h \
b/utilities/cameragui/items/itemviewimportdelegate.h index 94a6e3e..684762e 100644
--- a/utilities/cameragui/items/itemviewimportdelegate.h
+++ b/utilities/cameragui/items/itemviewimportdelegate.h
@@ -26,6 +26,7 @@
 
 // Local includes
 
+#include "itemviewimportdelegatepriv.h"
 #include "thumbnailsize.h"
 #include "ditemdelegate.h"
 #include "imagedelegateoverlay.h"
@@ -33,6 +34,12 @@
 namespace Digikam
 {
 
+class ImportCategoryDrawer;
+class ImportCategorizedView;
+class ImportFilterModel;
+class ImportImageModel;
+class ItemViewImportDelegatePrivate;
+
 class ItemViewImportDelegate : public DItemDelegate, public \
ImageDelegateOverlayContainer // Some reuse of the existing model-view classes.  {
     Q_OBJECT
@@ -92,6 +99,7 @@ protected:
     void drawCreationDate(QPainter* p, const QRect& dateRect, const QDateTime& date) \
                const;
     void drawModificationDate(QPainter* p, const QRect& dateRect, const QDateTime& \
                date) const;
     void drawImageSize(QPainter* p, const QRect& dimsRect, const QSize& dims) const;
+    void drawImageFormat(QPainter* p, const QRect& dimsRect, const QString& mime) \
                const;
     void drawFileSize(QPainter* p, const QRect& r, qlonglong bytes) const;
     void drawGroupIndicator(QPainter* p, const QRect& r, int numberOfGroupedImages, \
bool open) const;  void drawPanelSideIcon(QPainter* p, bool left, bool right) const;
@@ -109,7 +117,7 @@ protected:
 
 protected:
 
-    class ItemViewImportDelegatePrivate* const d;
+    ItemViewImportDelegatePrivate* const d_ptr;
     ItemViewImportDelegate(ItemViewImportDelegatePrivate& dd, QObject* parent);
 
 private:
diff --git a/utilities/cameragui/items/itemviewimportdelegatepriv.h \
b/utilities/cameragui/items/itemviewimportdelegatepriv.h index e476d45..91f9608 \
                100644
--- a/utilities/cameragui/items/itemviewimportdelegatepriv.h
+++ b/utilities/cameragui/items/itemviewimportdelegatepriv.h
@@ -32,6 +32,11 @@
 #include <QPolygon>
 #include <QModelIndex>
 
+// KDE includes
+
+#include <klocale.h>
+#include <kdebug.h>
+
 // Local includes
 
 #include "thumbnailsize.h"


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic