File indexing completed on 2025-01-19 03:59:22

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2012-07-08
0007  * Description : Item delegate for import interface items - private container.
0008  *
0009  * SPDX-FileCopyrightText: 2012 by Islam Wazery <wazery at ubuntu dot com>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #ifndef DIGIKAM_ITEM_VIEW_IMPORT_DELEGATE_P_H
0016 #define DIGIKAM_ITEM_VIEW_IMPORT_DELEGATE_P_H
0017 
0018 #include "itemviewimportdelegate.h"
0019 
0020 // Qt includes
0021 
0022 #include <QCache>
0023 #include <QFont>
0024 #include <QWidget>
0025 #include <QPainter>
0026 #include <QPolygon>
0027 #include <QModelIndex>
0028 
0029 // Local includes
0030 
0031 #include "digikam_debug.h"
0032 #include "thumbnailsize.h"
0033 
0034 namespace Digikam
0035 {
0036 
0037 class ItemDelegateOverlay;
0038 class ItemViewImportDelegate;
0039 
0040 class Q_DECL_HIDDEN ItemViewImportDelegatePrivate
0041 {
0042 public:
0043 
0044     explicit ItemViewImportDelegatePrivate();
0045     virtual ~ItemViewImportDelegatePrivate() = default;
0046 
0047     void init(ItemViewImportDelegate* const _q, QWidget* const _widget);
0048 
0049     void makeStarPolygon();
0050 
0051     /// Resets cached rects. Remember to reimplement in subclass for added rects.
0052     virtual void clearRects();
0053 
0054 public:
0055 
0056     int                       spacing;
0057     QSize                     gridSize;
0058 
0059     QRect                     rect;
0060     QRect                     ratingRect;
0061 
0062     QPixmap                   regPixmap;
0063     QPixmap                   selPixmap;
0064     QVector<QPixmap>          ratingPixmaps;
0065 
0066     QFont                     font;
0067     QFont                     fontReg;
0068     QFont                     fontCom;
0069     QFont                     fontXtra;
0070 
0071     QPolygon                  starPolygon;
0072     QSize                     starPolygonSize;
0073 
0074     ThumbnailSize             thumbSize;
0075 
0076     QPersistentModelIndex     editingRating;
0077 
0078     ItemViewImportDelegate*   q;
0079 
0080     QWidget*                  displayWidget;
0081 
0082     QRect                     oneRowRegRect;
0083     QRect                     oneRowComRect;
0084     QRect                     oneRowXtraRect;
0085 
0086     /// constant values for drawing
0087     int                       radius;
0088     int                       margin;
0089 
0090 private:
0091 
0092     Q_DISABLE_COPY(ItemViewImportDelegatePrivate)
0093 };
0094 
0095 } // namespace Digikam
0096 
0097 #endif // DIGIKAM_ITEM_VIEW_IMPORT_DELEGATE_P_H