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

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2015-06-05
0007  * Description : DB Jobs Info
0008  *
0009  * SPDX-FileCopyrightText: 2015 by Mohamed_Anwer <m_dot_anwer at gmx dot com>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #ifndef DIGIKAM_DB_JOB_INFO_H
0016 #define DIGIKAM_DB_JOB_INFO_H
0017 
0018 // Qt includes
0019 
0020 #include <QString>
0021 #include <QSet>
0022 
0023 // Local includes
0024 
0025 #include "coredburl.h"
0026 #include "digikam_export.h"
0027 #include "haariface.h"
0028 
0029 namespace Digikam
0030 {
0031 
0032 class DIGIKAM_DATABASE_EXPORT DBJobInfo
0033 {
0034 public:
0035 
0036     void setFoldersJob();
0037     bool isFoldersJob()                 const;
0038 
0039     void setListAvailableImagesOnly();
0040     bool isListAvailableImagesOnly()    const;
0041 
0042     void setRecursive();
0043     bool isRecursive()                  const;
0044 
0045 protected:
0046 
0047     explicit DBJobInfo();
0048 
0049 private:
0050 
0051     bool m_folders;
0052     bool m_listAvailableImagesOnly;
0053     bool m_recursive;
0054 };
0055 
0056 // ---------------------------------------------
0057 
0058 class DIGIKAM_DATABASE_EXPORT AlbumsDBJobInfo : public DBJobInfo
0059 {
0060 public:
0061 
0062     explicit AlbumsDBJobInfo();
0063 
0064     void setAlbumRootId(int id);
0065     int  albumRootId();
0066 
0067     void setAlbum(const QString& album);
0068     QString album();
0069 
0070 private:
0071 
0072     int     m_albumRootId;
0073     QString m_album;
0074 };
0075 
0076 // ---------------------------------------------
0077 
0078 class DIGIKAM_DATABASE_EXPORT TagsDBJobInfo : public DBJobInfo
0079 {
0080 public:
0081 
0082     explicit TagsDBJobInfo();
0083 
0084     void setFaceFoldersJob();
0085     bool isFaceFoldersJob()         const;
0086 
0087     void setSpecialTag(const QString& tag);
0088     QString specialTag()            const;
0089 
0090     void setTagsIds(const QList<int>& tagsIds);
0091     QList<int> tagsIds()            const;
0092 
0093 private:
0094 
0095     bool       m_faceFolders;
0096     QString    m_specialTag;
0097     QList<int> m_tagsIds;
0098 };
0099 
0100 // ---------------------------------------------
0101 
0102 class DIGIKAM_DATABASE_EXPORT GPSDBJobInfo : public DBJobInfo
0103 {
0104 public:
0105 
0106     explicit GPSDBJobInfo();
0107 
0108     void setDirectQuery();
0109     bool isDirectQuery()            const;
0110 
0111     void setLat1(qreal lat);
0112     qreal lat1()                    const;
0113 
0114     void setLng1(qreal lng);
0115     qreal lng1()                    const;
0116 
0117     void setLat2(qreal lat);
0118     qreal lat2()                    const;
0119 
0120     void setLng2(qreal lng);
0121     qreal lng2()                    const;
0122 
0123 private:
0124 
0125     bool  m_directQuery;
0126     qreal m_lat1;
0127     qreal m_lng1;
0128     qreal m_lat2;
0129     qreal m_lng2;
0130 };
0131 
0132 // ---------------------------------------------
0133 
0134 class DIGIKAM_DATABASE_EXPORT SearchesDBJobInfo : public DBJobInfo
0135 {
0136 public:
0137 
0138     explicit SearchesDBJobInfo(QList<int>&& searchIds);
0139     SearchesDBJobInfo(QSet<qlonglong>&& imageIds,
0140                       bool isAlbumUpdate,
0141                       HaarIface::RefImageSelMethod referenceSelectionMethod,
0142                       QSet<qlonglong>&& refImageIds);
0143 
0144     bool isDuplicatesJob()                                 const;
0145     bool isAlbumUpdate()                                   const;
0146 
0147     const QList<int>& searchIds()                          const;
0148     const QSet<qlonglong>& imageIds()                      const;
0149 
0150     HaarIface::RefImageSelMethod refImageSelectionMethod() const;
0151     const QSet<qlonglong>& refImageIds()                   const;
0152 
0153     void setMinThreshold(double t);
0154     double minThreshold()                                  const;
0155 
0156     void setMaxThreshold(double t);
0157     double maxThreshold()                                  const;
0158 
0159     void setSearchResultRestriction(int type);
0160     int searchResultRestriction()                          const;
0161 
0162 public:
0163 
0164     bool                         m_duplicates;
0165     bool                         m_albumUpdate;
0166     int                          m_searchResultRestriction;
0167     QList<int>                   m_searchIds;
0168     QSet<qlonglong>              m_imageIds;
0169     double                       m_minThreshold;
0170     double                       m_maxThreshold;
0171     QSet<qlonglong>              m_refImageIds; // Image ids of the reference images if duplicates are available
0172     HaarIface::RefImageSelMethod m_refImageSelectionMethod;
0173 };
0174 
0175 // ---------------------------------------------
0176 
0177 class DIGIKAM_DATABASE_EXPORT DatesDBJobInfo : public DBJobInfo
0178 {
0179 public:
0180 
0181     explicit DatesDBJobInfo();
0182 
0183     void setStartDate(const QDate& date);
0184     QDate startDate()   const;
0185 
0186     void setEndDate(const QDate& date);
0187     QDate endDate()     const;
0188 
0189 private:
0190 
0191     QDate m_startDate;
0192     QDate m_endDate;
0193 };
0194 
0195 } // namespace Digikam
0196 
0197 #endif // DIGIKAM_DB_JOB_INFO_H