File indexing completed on 2025-01-19 03:55:48

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2012-01-18
0007  * Description : database worker interface
0008  *
0009  * SPDX-FileCopyrightText: 2012 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #ifndef DIGIKAM_DATABASE_WORKER_IFACE_H
0016 #define DIGIKAM_DATABASE_WORKER_IFACE_H
0017 
0018 // Qt includes
0019 
0020 #include <QList>
0021 
0022 // Local includes
0023 
0024 #include "fileactionmngr.h"
0025 #include "fileactionimageinfolist.h"
0026 #include "iteminfo.h"
0027 #include "workerobject.h"
0028 
0029 namespace Digikam
0030 {
0031 
0032 class MetadataHub;
0033 
0034 class DatabaseWorkerInterface : public WorkerObject      // clazy:exclude=ctor-missing-parent-argument
0035 {
0036     Q_OBJECT
0037 
0038 public Q_SLOTS:
0039 
0040     virtual void assignTags(const FileActionItemInfoList&, const QList<int>&)          {};
0041     virtual void removeTags(const FileActionItemInfoList&, const QList<int>&)          {};
0042     virtual void assignPickLabel(const FileActionItemInfoList&, int)                   {};
0043     virtual void assignColorLabel(const FileActionItemInfoList&, int)                  {};
0044     virtual void assignRating(const FileActionItemInfoList&, int)                      {};
0045     virtual void editGroup(int, const ItemInfo&, const FileActionItemInfoList&)        {};
0046     virtual void setExifOrientation(const FileActionItemInfoList&, int)                {};
0047     virtual void applyMetadata(const FileActionItemInfoList&, DisjointMetadata*)       {};
0048     virtual void copyAttributes(const FileActionItemInfoList&, const QStringList&)     {};
0049 
0050 Q_SIGNALS:
0051 
0052     void writeMetadataToFiles(FileActionItemInfoList infos);
0053     void writeOrientationToFiles(FileActionItemInfoList infos, int orientation);
0054     void writeMetadata(FileActionItemInfoList infos, int flag);
0055 };
0056 
0057 // ------------------------------------------------------------------------------------
0058 
0059 class FileActionMngrDatabaseWorker : public DatabaseWorkerInterface
0060 {
0061     Q_OBJECT
0062 
0063 public:
0064 
0065     explicit FileActionMngrDatabaseWorker(FileActionMngr::Private* const dd)
0066         : d(dd)
0067     {
0068     }
0069 
0070 public:
0071 
0072     void assignTags(const FileActionItemInfoList& infos, const QList<int>& tagIDs)             override;
0073     void removeTags(const FileActionItemInfoList& infos, const QList<int>& tagIDs)             override;
0074     void assignPickLabel(const FileActionItemInfoList& infos, int pickId)                      override;
0075     void assignColorLabel(const FileActionItemInfoList& infos, int colorId)                    override;
0076     void assignRating(const FileActionItemInfoList& infos, int rating)                         override;
0077     void editGroup(int groupAction, const ItemInfo& pick, const FileActionItemInfoList& infos) override;
0078     void setExifOrientation(const FileActionItemInfoList& infos, int orientation)              override;
0079     void applyMetadata(const FileActionItemInfoList& infos, DisjointMetadata* hub)             override;
0080     void copyAttributes(const FileActionItemInfoList& infos, const QStringList& derivedPaths)  override;
0081 
0082 private:
0083 
0084     void changeTags(const FileActionItemInfoList& infos, const QList<int>& tagIDs, bool addOrRemove);
0085 
0086 private:
0087 
0088     FileActionMngr::Private* const d;
0089 };
0090 
0091 } // namespace Digikam
0092 
0093 #endif // DIGIKAM_DATABASE_WORKER_IFACE_H