File indexing completed on 2025-03-09 03:58:51
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2012-12-17 0007 * Description : workflow manager. 0008 * 0009 * SPDX-FileCopyrightText: 2012-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_WORKFLOW_MANAGER_H 0016 #define DIGIKAM_BQM_WORKFLOW_MANAGER_H 0017 0018 // Qt includes 0019 0020 #include <QList> 0021 #include <QObject> 0022 #include <QString> 0023 #include <QStringList> 0024 0025 // Local includes 0026 0027 #include "queuesettings.h" 0028 #include "batchtoolutils.h" 0029 0030 namespace Digikam 0031 { 0032 0033 /** 0034 * This container group all queue common settings plus all assigned batch tools. 0035 */ 0036 class Workflow 0037 { 0038 public: 0039 0040 explicit Workflow() {}; 0041 ~Workflow() {}; 0042 0043 public: 0044 0045 QString title; 0046 QString desc; 0047 0048 QueueSettings qSettings; 0049 BatchSetList aTools; 0050 }; 0051 0052 // ----------------------------------------------------------------------------------------------------------- 0053 0054 class WorkflowManager : public QObject 0055 { 0056 Q_OBJECT 0057 0058 public: 0059 0060 static WorkflowManager* instance(); 0061 0062 public: 0063 0064 /** 0065 * Load all Workflow from XML settings file. Fill 'failed' list with incompatible Workflow 0066 * title/description not loaded. 0067 */ 0068 bool load(QStringList& failed); 0069 0070 /** 0071 * Save all Workflow to XML settings file. 0072 */ 0073 bool save(); 0074 void clear(); 0075 0076 void insert(const Workflow& q); 0077 void remove(const Workflow& q); 0078 0079 Workflow findByTitle(const QString& title) const; 0080 QList<Workflow> queueSettingsList() const; 0081 0082 Q_SIGNALS: 0083 0084 void signalQueueSettingsAdded(const QString&); 0085 void signalQueueSettingsRemoved(const QString&); 0086 0087 private: 0088 0089 void insertPrivate(const Workflow& q); 0090 void removePrivate(const Workflow& q); 0091 0092 private: 0093 0094 // Disable 0095 WorkflowManager(); 0096 WorkflowManager(QObject*) = delete; 0097 ~WorkflowManager() override; 0098 0099 private: 0100 0101 friend class WorkflowManagerCreator; 0102 0103 class Private; 0104 Private* const d; 0105 }; 0106 0107 } // namespace Digikam 0108 0109 #endif // DIGIKAM_BQM_WORKFLOW_MANAGER_H