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

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2008-06-17
0007  * Description : Find Duplicates tree-view search album item.
0008  *
0009  * SPDX-FileCopyrightText: 2008-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #ifndef DIGIKAM_FIND_DUPLICATES_ALBUM_ITEM_H
0016 #define DIGIKAM_FIND_DUPLICATES_ALBUM_ITEM_H
0017 
0018 // Qt includes
0019 
0020 #include <QTreeWidget>
0021 #include <QUrl>
0022 #include <QList>
0023 
0024 // Local includes
0025 
0026 #include "album.h"
0027 #include "iteminfo.h"
0028 #include "thumbnailloadthread.h"
0029 
0030 namespace Digikam
0031 {
0032 
0033 class DIGIKAM_GUI_EXPORT FindDuplicatesAlbumItem : public QTreeWidgetItem
0034 {
0035 
0036 public:
0037 
0038     enum Column
0039     {
0040       REFERENCE_IMAGE = 0,
0041       REFERENCE_DATE  = 1,
0042       REFERENCE_ALBUM = 2,
0043       RESULT_COUNT    = 3,
0044       AVG_SIMILARITY  = 4
0045     };
0046 
0047 public:
0048 
0049     explicit FindDuplicatesAlbumItem(QTreeWidget* const parent, SAlbum* const album);
0050     ~FindDuplicatesAlbumItem()                        override;
0051 
0052     bool hasValidThumbnail()                     const;
0053 
0054     /**
0055      * Calculates the duplicates count and average similarity.
0056      **/
0057     void calculateInfos(const QList<qlonglong>& deletedImages = QList<qlonglong>());
0058 
0059     /**
0060      * Returns the item count.
0061      **/
0062     int itemCount()                              const;
0063 
0064     SAlbum* album()                              const;
0065     QUrl    refUrl()                             const;
0066 
0067     void setThumb(const QPixmap& pix,
0068                   bool hasThumb = true);
0069 
0070     bool operator<(const QTreeWidgetItem& other) const override;
0071     QList<ItemInfo> duplicatedItems();
0072 
0073 private:
0074 
0075     class Private;
0076     Private* const d;
0077 
0078 private:
0079 
0080     Q_DISABLE_COPY(FindDuplicatesAlbumItem)
0081 };
0082 
0083 } // namespace Digikam
0084 
0085 #endif // DIGIKAM_FIND_DUPLICATES_ALBUM_ITEM_H