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

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2012-07-08
0007  * Description : Qt item view to import items - the delegate (private container)
0008  *
0009  * SPDX-FileCopyrightText: 2012      by Islam Wazery <wazery at ubuntu dot com>
0010  * SPDX-FileCopyrightText: 2012-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #ifndef DIGIKAM_IMPORT_DELEGATE_P_H
0017 #define DIGIKAM_IMPORT_DELEGATE_P_H
0018 
0019 #include "importdelegate.h"
0020 
0021 // Qt includes
0022 
0023 #include <QRect>
0024 #include <QCache>
0025 
0026 // Local includes
0027 
0028 #include "importcategorizedview.h"
0029 #include "itemviewimportdelegate_p.h"
0030 
0031 namespace Digikam
0032 {
0033 
0034 class ImportCategoryDrawer;
0035 
0036 class Q_DECL_HIDDEN ImportDelegate::ImportDelegatePrivate : public ItemViewImportDelegatePrivate
0037 {
0038 public:
0039 
0040     explicit ImportDelegatePrivate()
0041       : contentWidth        (0),
0042         drawImageFormat     (false),
0043         drawCoordinates     (false),
0044         drawFocusFrame      (true),
0045         drawMouseOverFrame  (true),
0046         ratingOverThumbnail (false),
0047         categoryDrawer      (nullptr),
0048         currentView         (nullptr),
0049         currentModel        (nullptr)
0050     {
0051         actualPixmapRectCache.setMaxCost(250);
0052     }
0053 
0054     int                    contentWidth;
0055 
0056     QRect                  dateRect;
0057     QRect                  pixmapRect;
0058     QRect                  nameRect;
0059 /*
0060     QRect                  titleRect;
0061     QRect                  commentsRect;
0062 */
0063     QRect                  resolutionRect;
0064     QRect                  sizeRect;
0065     QRect                  downloadRect;
0066     QRect                  lockRect;
0067     QRect                  coordinatesRect;
0068     QRect                  tagRect;
0069     QRect                  imageInformationRect;
0070     QRect                  pickLabelRect;
0071     QRect                  groupRect;
0072 
0073     bool                   drawImageFormat;
0074     bool                   drawCoordinates;
0075     bool                   drawFocusFrame;
0076     bool                   drawMouseOverFrame;
0077     bool                   ratingOverThumbnail;
0078 
0079     QCache<int, QRect>     actualPixmapRectCache;
0080     ImportCategoryDrawer*  categoryDrawer;
0081 
0082     ImportCategorizedView* currentView;
0083     QAbstractItemModel*    currentModel;
0084 
0085 public:
0086 
0087     void clearRects() override;
0088 };
0089 
0090 // --- ImportThumbnailDelegate ----------------------------------------------------
0091 
0092 class Q_DECL_HIDDEN ImportThumbnailDelegatePrivate : public ImportDelegate::ImportDelegatePrivate
0093 {
0094 public:
0095 
0096     explicit ImportThumbnailDelegatePrivate()
0097        : flow(QListView::LeftToRight)
0098     {
0099         drawFocusFrame      = false;       // switch off drawing of frames
0100         drawMouseOverFrame  = false;
0101         ratingOverThumbnail = true;        // switch off composing rating over background
0102     }
0103 
0104     void init(ImportThumbnailDelegate* const q);
0105 
0106 public:
0107 
0108     QListView::Flow flow;
0109     QRect           viewSize;
0110 };
0111 
0112 // --- ImportNormalDelegate ----------------------------------------------------
0113 
0114 class Q_DECL_HIDDEN ImportNormalDelegatePrivate : public ImportDelegate::ImportDelegatePrivate
0115 {
0116 public:
0117 
0118     explicit ImportNormalDelegatePrivate() {};
0119     ~ImportNormalDelegatePrivate() override;
0120 
0121     void init(ImportNormalDelegate* const q, ImportCategorizedView* const parent);
0122 };
0123 
0124 } // namespace Digikam
0125 
0126 #endif // DIGIKAM_IMPORT_DELEGATE_P_H