File indexing completed on 2025-03-09 03:58:50
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2008-11-24 0007 * Description : Batch Tool utils. 0008 * 0009 * SPDX-FileCopyrightText: 2008-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * 0011 * SPDX-License-Identifier: GPL-2.0-or-later 0012 * 0013 * ============================================================ */ 0014 0015 #ifndef DIGIKAM_BQM_BATCH_TOOL_UTILS_H 0016 #define DIGIKAM_BQM_BATCH_TOOL_UTILS_H 0017 0018 // Qt includes 0019 0020 #include <QString> 0021 #include <QVariant> 0022 #include <QMap> 0023 #include <QList> 0024 #include <QUrl> 0025 0026 // Local includes 0027 0028 #include "batchtool.h" 0029 0030 namespace Digikam 0031 { 0032 0033 /** 0034 * A list of batch tool instances. 0035 */ 0036 typedef QList<BatchTool*> BatchToolsList; 0037 0038 // ------------------------------------------------------------------------------------------------------------- 0039 0040 /** 0041 * A container of associated batch tool and settings. 0042 */ 0043 class BatchToolSet 0044 { 0045 public: 0046 0047 explicit BatchToolSet(); 0048 ~BatchToolSet() = default; 0049 0050 /** 0051 * Equality operator which check index, version, name, and group data. Settings member is ignored. 0052 */ 0053 bool operator==(const BatchToolSet& set) const; 0054 0055 /// Tool identifier data. Index is tool ID from assigned list. 0056 int index; 0057 int version; 0058 QString name; 0059 BatchTool::BatchToolGroup group; 0060 0061 /// Settings hosted in this container. 0062 BatchToolSettings settings; 0063 }; 0064 0065 //! qDebug() stream operator. Writes property @a t to the debug output in a nicely formatted way. 0066 QDebug operator<<(QDebug dbg, const BatchToolSet& s); 0067 0068 // ------------------------------------------------------------------------------------------------------------- 0069 0070 /** 0071 * An indexed map of batch tools with settings. 0072 */ 0073 typedef QList<BatchToolSet> BatchSetList; 0074 0075 // ------------------------------------------------------------------------------------------------------------- 0076 0077 /** 0078 * Container to assign Batch tools and settings to an item by Url. 0079 * Url is used only with ActionThread class. 0080 */ 0081 class AssignedBatchTools 0082 { 0083 public: 0084 0085 explicit AssignedBatchTools() = default; 0086 ~AssignedBatchTools() = default; 0087 0088 QString targetSuffix(bool* const extSet = nullptr) const; 0089 0090 public: 0091 0092 QString m_destFileName; 0093 QUrl m_itemUrl; 0094 BatchSetList m_toolsList; 0095 }; 0096 0097 } // namespace Digikam 0098 0099 #endif // DIGIKAM_BQM_BATCH_TOOL_UTILS_H