File indexing completed on 2025-01-05 03:53:58

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2007-04-21
0007  * Description : Structures to define Albums used in CoreDb
0008  *
0009  * SPDX-FileCopyrightText: 2007-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
0010  * SPDX-FileCopyrightText: 2005      by Renchi Raju <renchi dot raju at gmail dot com>
0011  * SPDX-FileCopyrightText: 2006-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0012  *
0013  * SPDX-License-Identifier: GPL-2.0-or-later
0014  *
0015  * ============================================================ */
0016 
0017 #ifndef DIGIKAM_CORE_DB_ALBUM_INFO_H
0018 #define DIGIKAM_CORE_DB_ALBUM_INFO_H
0019 
0020 // Qt includes
0021 
0022 #include <QString>
0023 #include <QList>
0024 #include <QDateTime>
0025 
0026 // Local includes
0027 
0028 #include "coredbconstants.h"
0029 
0030 namespace Digikam
0031 {
0032 
0033 typedef QPair<int, int> YearMonth;
0034 
0035 /**
0036  * \class AlbumRootInfo
0037  */
0038 class AlbumRootInfo
0039 {
0040 public:
0041 
0042     explicit AlbumRootInfo()
0043       : id             (0),
0044         status         (0),
0045         type           (0),
0046         caseSensitivity(0)
0047     {
0048     };
0049 
0050 public:
0051 
0052     int     id;
0053     QString label;
0054     int     status;
0055     int     type;
0056     QString identifier;
0057     QString specificPath;
0058     int     caseSensitivity;
0059 };
0060 
0061 // --------------------------------------------------------------------------
0062 
0063 /**
0064  * \class AlbumInfo
0065  * A container class for transporting album information
0066  * from the database to AlbumManager
0067  */
0068 class AlbumInfo
0069 {
0070 public:
0071 
0072     typedef QList<AlbumInfo> List;
0073 
0074 public:
0075 
0076     explicit AlbumInfo()
0077       : id         (0),
0078         albumRootId(0),
0079         iconId     (0)
0080     {
0081     };
0082 
0083     bool isNull() const
0084     {
0085         return (id == 0);
0086     }
0087 
0088     /**
0089      * needed for sorting
0090      */
0091     bool operator<(const AlbumInfo& info) const
0092     {
0093         // include album root id?
0094 
0095         return (relativePath < info.relativePath);
0096     }
0097 
0098 public:
0099 
0100     int       id;
0101     int       albumRootId;
0102     QString   relativePath;
0103     QString   caption;
0104     QString   category;
0105     QDate     date;
0106     qlonglong iconId;
0107 };
0108 
0109 // --------------------------------------------------------------------------
0110 
0111 /**
0112  * \class TagInfo
0113  * A container class for transporting tag information
0114  * from the database to AlbumManager
0115  */
0116 class TagInfo
0117 {
0118 public:
0119 
0120     typedef QList<TagInfo> List;
0121 
0122 public:
0123 
0124     explicit TagInfo()
0125       : id    (0),
0126         pid   (0),
0127         iconId(0)
0128     {
0129     };
0130 
0131     bool isNull() const
0132     {
0133         return (id == 0);
0134     }
0135 
0136     bool operator<(const TagInfo& info) const
0137     {
0138         return (name < info.name);
0139     }
0140 
0141 public:
0142 
0143     int       id;
0144     int       pid;
0145     QString   name;
0146     QString   icon;
0147     qlonglong iconId;
0148 };
0149 
0150 // --------------------------------------------------------------------------
0151 
0152 /**
0153  * \class SearchInfo
0154  * A container class for transporting search information
0155  * from the database to AlbumManager
0156  */
0157 class SearchInfo
0158 {
0159 public:
0160 
0161     typedef QList<SearchInfo> List;
0162 
0163 public:
0164 
0165     explicit SearchInfo()
0166       : id  (0),
0167         type(DatabaseSearch::UndefinedType)
0168     {
0169     };
0170 
0171     bool isNull() const
0172     {
0173         return (id == 0);
0174     }
0175 
0176     /**
0177      * needed for sorting
0178      */
0179     bool operator<(const SearchInfo& info) const
0180     {
0181         return (id < info.id);
0182     }
0183 
0184 public:
0185 
0186     int                  id;
0187     QString              name;
0188     DatabaseSearch::Type type;
0189     QString              query;
0190 };
0191 
0192 // --------------------------------------------------------------------------
0193 
0194 class AlbumShortInfo
0195 {
0196 public:
0197 
0198     explicit AlbumShortInfo()
0199       : id         (0),
0200         albumRootId(0)
0201     {
0202     };
0203 
0204     bool isNull() const
0205     {
0206         return (id == 0);
0207     }
0208 
0209 public:
0210 
0211     int     id;
0212     QString relativePath;
0213     int     albumRootId;
0214 };
0215 
0216 // --------------------------------------------------------------------------
0217 
0218 class TagShortInfo
0219 {
0220 public:
0221 
0222     explicit TagShortInfo()
0223       : id (0),
0224         pid(0)
0225     {
0226     };
0227 
0228     bool isNull() const
0229     {
0230         return (id == 0);
0231     }
0232 
0233 public:
0234 
0235     int     id;
0236     int     pid;
0237     QString name;
0238 };
0239 
0240 // --------------------------------------------------------------------------
0241 
0242 class ItemShortInfo
0243 {
0244 public:
0245 
0246     explicit ItemShortInfo()
0247       : id         (0),
0248         albumID    (0),
0249         albumRootID(0)
0250     {
0251     };
0252 
0253     bool isNull() const
0254     {
0255         return (id == 0);
0256     }
0257 
0258 public:
0259 
0260     qlonglong id;
0261     QString   itemName;
0262     int       albumID;
0263     int       albumRootID;
0264     QString   album;
0265 };
0266 
0267 // --------------------------------------------------------------------------
0268 
0269 class ItemScanInfo
0270 {
0271 public:
0272 
0273     explicit ItemScanInfo()
0274       : id      (0),
0275         albumID (0),
0276         status  (DatabaseItem::UndefinedStatus),
0277         category(DatabaseItem::UndefinedCategory),
0278         fileSize(0)
0279     {
0280     };
0281 
0282     bool isNull() const
0283     {
0284         return (id == 0);
0285     }
0286 
0287 public:
0288 
0289     qlonglong              id;
0290     int                    albumID;
0291     QString                itemName;
0292     DatabaseItem::Status   status;
0293     DatabaseItem::Category category;
0294     QDateTime              modificationDate;
0295     qlonglong              fileSize;
0296     QString                uniqueHash;
0297 };
0298 
0299 // --------------------------------------------------------------------------
0300 
0301 class CommentInfo
0302 {
0303 public:
0304 
0305     explicit CommentInfo()
0306       : id     (-1),
0307         imageId(-1),
0308         type   (DatabaseComment::UndefinedType)
0309     {
0310     };
0311 
0312     bool isNull() const
0313     {
0314         return (id == -1);
0315     }
0316 
0317 public:
0318 
0319     int                   id;
0320     qlonglong             imageId;
0321     DatabaseComment::Type type;
0322     QString               author;
0323     QString               language;
0324     QDateTime             date;
0325     QString               comment;
0326 };
0327 
0328 // --------------------------------------------------------------------------
0329 
0330 class CopyrightInfo
0331 {
0332 public:
0333 
0334     explicit CopyrightInfo()
0335       : id(-1)
0336     {
0337     };
0338 
0339     bool isNull() const
0340     {
0341         return (id == -1);
0342     }
0343 
0344 public:
0345 
0346     qlonglong id;
0347     QString   property;
0348     QString   value;
0349     QString   extraValue;
0350 };
0351 
0352 // --------------------------------------------------------------------------
0353 
0354 class ImageHistoryEntry
0355 {
0356 public:
0357 
0358     explicit ImageHistoryEntry()
0359       : imageId(0)
0360     {
0361     };
0362 
0363     bool isNull() const
0364     {
0365         return (imageId == 0);
0366     }
0367 
0368 public:
0369 
0370     qlonglong imageId;
0371     QString   uuid;
0372     QString   history;
0373 };
0374 
0375 // --------------------------------------------------------------------------
0376 
0377 class ImageRelation
0378 {
0379 public:
0380 
0381     explicit ImageRelation()
0382       : subjectId(0),
0383         objectId (0),
0384         type     (DatabaseRelation::UndefinedType)
0385     {
0386     }
0387 
0388 public:
0389 
0390     qlonglong              subjectId;
0391     qlonglong              objectId;
0392     DatabaseRelation::Type type;
0393 };
0394 
0395 // --------------------------------------------------------------------------
0396 
0397 class TagProperty
0398 {
0399 public:
0400 
0401     explicit TagProperty()
0402       : tagId(-1)
0403     {
0404     };
0405 
0406     bool isNull() const
0407     {
0408         return (tagId == -1);
0409     }
0410 
0411 public:
0412 
0413     int     tagId;
0414     QString property;
0415     QString value;
0416 };
0417 
0418 // --------------------------------------------------------------------------
0419 
0420 class ImageTagProperty
0421 {
0422 public:
0423 
0424     explicit ImageTagProperty()
0425       : imageId(-1),
0426         tagId  (-1)
0427     {
0428     };
0429 
0430     bool isNull() const
0431     {
0432         return (imageId == -1);
0433     }
0434 
0435 public:
0436 
0437     qlonglong imageId;
0438     int       tagId;
0439     QString   property;
0440     QString   value;
0441 };
0442 
0443 } // namespace Digikam
0444 
0445 #endif // DIGIKAM_CORE_DB_ALBUM_INFO_H