File indexing completed on 2025-01-19 03:53:38

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2007-03-20
0007  * Description : Container for image info objects
0008  *
0009  * SPDX-FileCopyrightText: 2007-2013 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
0010  * SPDX-FileCopyrightText: 2007-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_ITEM_INFO_LIST_H
0017 #define DIGIKAM_ITEM_INFO_LIST_H
0018 
0019 // Qt includes
0020 
0021 #include <QList>
0022 
0023 // Local includes
0024 
0025 #include "iteminfo.h"
0026 #include "digikam_export.h"
0027 #include "digikam_config.h"
0028 
0029 namespace Digikam
0030 {
0031 
0032 class ItemInfo;
0033 
0034 // NOTE: implementations of batch loading methods:
0035 // See imageinfo.cpp (next to the corresponding single-item implementation)
0036 
0037 class DIGIKAM_DATABASE_EXPORT ItemInfoList : public QList<ItemInfo>
0038 {
0039 public:
0040 
0041     ItemInfoList();
0042     explicit ItemInfoList(const QList<ItemInfo>& list);
0043     explicit ItemInfoList(const QList<qlonglong>& idList);
0044 
0045     QList<qlonglong> toImageIdList()  const;
0046     QList<QUrl>      toImageUrlList() const;
0047 
0048     void loadGroupImageIds()          const;
0049     void loadTagIds()                 const;
0050 
0051     bool static namefileLessThan(const ItemInfo& d1, const ItemInfo& d2);
0052 
0053     /**
0054      * @brief singleGroupMainItem
0055      * @return If the list contains of items of only one group including the
0056      * main item, this main item is returned, otherwise a null ItemInfo.
0057      */
0058     ItemInfo singleGroupMainItem()    const;
0059 };
0060 
0061 typedef ItemInfoList::iterator ItemInfoListIterator;
0062 
0063 } // namespace Digikam
0064 
0065 Q_DECLARE_METATYPE(Digikam::ItemInfoList)
0066 
0067 #endif // DIGIKAM_ITEM_INFO_LIST_H