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 #include "dbjobinfo.h"
0016 
0017 namespace Digikam
0018 {
0019 
0020 DBJobInfo::DBJobInfo()
0021     : m_folders                (false),
0022       m_listAvailableImagesOnly(false),
0023       m_recursive              (false)
0024 {
0025 }
0026 
0027 void DBJobInfo::setFoldersJob()
0028 {
0029     m_folders = true;
0030 }
0031 
0032 bool DBJobInfo::isFoldersJob() const
0033 {
0034     return m_folders;
0035 }
0036 
0037 void DBJobInfo::setListAvailableImagesOnly()
0038 {
0039     m_listAvailableImagesOnly = true;
0040 }
0041 
0042 bool DBJobInfo::isListAvailableImagesOnly() const
0043 {
0044     return m_listAvailableImagesOnly;
0045 }
0046 
0047 void DBJobInfo::setRecursive()
0048 {
0049     m_recursive = true;
0050 }
0051 
0052 bool DBJobInfo::isRecursive() const
0053 {
0054     return m_recursive;
0055 }
0056 
0057 // ---------------------------------------------
0058 
0059 AlbumsDBJobInfo::AlbumsDBJobInfo()
0060     : DBJobInfo    (),
0061       m_albumRootId(-1)
0062 {
0063 }
0064 
0065 void AlbumsDBJobInfo::setAlbumRootId(int id)
0066 {
0067     m_albumRootId = id;
0068 }
0069 
0070 int AlbumsDBJobInfo::albumRootId()
0071 {
0072     return m_albumRootId;
0073 }
0074 
0075 void AlbumsDBJobInfo::setAlbum(const QString& album)
0076 {
0077     m_album = album;
0078 }
0079 
0080 QString AlbumsDBJobInfo::album()
0081 {
0082     return m_album;
0083 }
0084 
0085 // ---------------------------------------------
0086 
0087 TagsDBJobInfo::TagsDBJobInfo()
0088     : DBJobInfo    (),
0089       m_faceFolders(false)
0090 {
0091 }
0092 
0093 void TagsDBJobInfo::setFaceFoldersJob()
0094 {
0095     m_faceFolders = true;
0096 }
0097 
0098 bool TagsDBJobInfo::isFaceFoldersJob() const
0099 {
0100     return m_faceFolders;
0101 }
0102 
0103 void TagsDBJobInfo::setSpecialTag(const QString& tag)
0104 {
0105     m_specialTag = tag;
0106 }
0107 
0108 QString TagsDBJobInfo::specialTag() const
0109 {
0110     return m_specialTag;
0111 }
0112 
0113 void TagsDBJobInfo::setTagsIds(const QList<int>& tagsIds)
0114 {
0115     m_tagsIds = tagsIds;
0116 }
0117 
0118 QList<int> TagsDBJobInfo::tagsIds() const
0119 {
0120     return m_tagsIds;
0121 }
0122 
0123 // ---------------------------------------------
0124 
0125 GPSDBJobInfo::GPSDBJobInfo()
0126     : DBJobInfo    (),
0127       m_directQuery(false),
0128       m_lat1       (0),
0129       m_lng1       (0),
0130       m_lat2       (0),
0131       m_lng2       (0)
0132 {
0133 }
0134 
0135 void GPSDBJobInfo::setDirectQuery()
0136 {
0137     m_directQuery = true;
0138 }
0139 
0140 bool GPSDBJobInfo::isDirectQuery() const
0141 {
0142     return m_directQuery;
0143 }
0144 
0145 void GPSDBJobInfo::setLat1(qreal lat)
0146 {
0147     m_lat1 = lat;
0148 }
0149 
0150 qreal GPSDBJobInfo::lat1() const
0151 {
0152     return m_lat1;
0153 }
0154 
0155 void GPSDBJobInfo::setLng1(qreal lng)
0156 {
0157     m_lng1 = lng;
0158 }
0159 
0160 qreal GPSDBJobInfo::lng1() const
0161 {
0162     return m_lng1;
0163 }
0164 
0165 void GPSDBJobInfo::setLat2(qreal lat)
0166 {
0167     m_lat2 = lat;
0168 }
0169 
0170 qreal GPSDBJobInfo::lat2() const
0171 {
0172     return m_lat2;
0173 }
0174 
0175 void GPSDBJobInfo::setLng2(qreal lng)
0176 {
0177     m_lng2 = lng;
0178 }
0179 
0180 qreal GPSDBJobInfo::lng2() const
0181 {
0182     return m_lng2;
0183 }
0184 
0185 // ---------------------------------------------
0186 
0187 SearchesDBJobInfo::SearchesDBJobInfo(QList<int>&& searchIds)
0188     : DBJobInfo                 (),
0189       m_duplicates              (false),
0190       m_albumUpdate             (false),
0191       m_searchResultRestriction (0),
0192       m_searchIds               (std::move(searchIds)),
0193       m_minThreshold            (0.4),
0194       m_maxThreshold            (1),
0195       m_refImageSelectionMethod (HaarIface::RefImageSelMethod::OlderOrLarger)
0196 {
0197 }
0198 
0199 SearchesDBJobInfo::SearchesDBJobInfo(QSet<qlonglong>&& imageIds,
0200                                      bool isAlbumUpdate,
0201                                      HaarIface::RefImageSelMethod referenceSelectionMethod,
0202                                      QSet<qlonglong>&& refImageIds)
0203     : DBJobInfo                 (),
0204       m_duplicates              (true),
0205       m_albumUpdate             (isAlbumUpdate),
0206       m_searchResultRestriction (0),
0207       m_imageIds                (std::move(imageIds)),
0208       m_minThreshold            (0.4),
0209       m_maxThreshold            (1),
0210       m_refImageIds             (std::move(refImageIds)),
0211       m_refImageSelectionMethod (referenceSelectionMethod)
0212 {
0213 }
0214 
0215 bool SearchesDBJobInfo::isDuplicatesJob() const
0216 {
0217     return m_duplicates;
0218 }
0219 
0220 bool SearchesDBJobInfo::isAlbumUpdate() const
0221 {
0222     return m_albumUpdate;
0223 }
0224 
0225 void SearchesDBJobInfo::setSearchResultRestriction(int type)
0226 {
0227     m_searchResultRestriction = type;
0228 }
0229 
0230 int SearchesDBJobInfo::searchResultRestriction() const
0231 {
0232     return m_searchResultRestriction;
0233 }
0234 
0235 const QList<int>& SearchesDBJobInfo::searchIds() const
0236 {
0237     return m_searchIds;
0238 }
0239 
0240 const QSet<qlonglong>& SearchesDBJobInfo::imageIds() const
0241 {
0242     return m_imageIds;
0243 }
0244 
0245 const QSet<qlonglong>& SearchesDBJobInfo::refImageIds() const
0246 {
0247     return m_refImageIds;
0248 }
0249 
0250 HaarIface::RefImageSelMethod SearchesDBJobInfo::refImageSelectionMethod() const
0251 {
0252     return m_refImageSelectionMethod;
0253 }
0254 
0255 void SearchesDBJobInfo::setMinThreshold(double t)
0256 {
0257     m_minThreshold = qBound(0.4, t, 1.0);
0258 }
0259 
0260 double SearchesDBJobInfo::minThreshold() const
0261 {
0262     return m_minThreshold;
0263 }
0264 
0265 void SearchesDBJobInfo::setMaxThreshold(double t)
0266 {
0267     m_maxThreshold = qBound(0.4, t, 1.0);
0268 }
0269 
0270 double SearchesDBJobInfo::maxThreshold() const
0271 {
0272     return m_maxThreshold;
0273 }
0274 
0275 // ---------------------------------------------
0276 
0277 DatesDBJobInfo::DatesDBJobInfo()
0278     : DBJobInfo()
0279 {
0280 }
0281 
0282 void DatesDBJobInfo::setStartDate(const QDate& date)
0283 {
0284     m_startDate = date;
0285 }
0286 
0287 QDate DatesDBJobInfo::startDate() const
0288 {
0289     return m_startDate;
0290 }
0291 
0292 void DatesDBJobInfo::setEndDate(const QDate& date)
0293 {
0294     m_endDate = date;
0295 }
0296 
0297 QDate DatesDBJobInfo::endDate() const
0298 {
0299     return m_endDate;
0300 }
0301 
0302 } // namespace Digikam