File indexing completed on 2025-03-09 03:58:49
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2018-07-30 0007 * Description : Batch Queue Manager digiKam plugin definition. 0008 * 0009 * SPDX-FileCopyrightText: 2018-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 #include "dpluginbqm.h" 0016 0017 // Qt includes 0018 0019 #include <QApplication> 0020 0021 // Local includes 0022 0023 #include "digikam_version.h" 0024 #include "digikam_debug.h" 0025 #include "batchtoolsfactory.h" 0026 0027 namespace Digikam 0028 { 0029 0030 class Q_DECL_HIDDEN DPluginBqm::Private 0031 { 0032 public: 0033 0034 explicit Private() 0035 { 0036 } 0037 0038 QList<BatchTool*> tools; 0039 }; 0040 0041 DPluginBqm::DPluginBqm(QObject* const parent) 0042 : DPlugin(parent), 0043 d (new Private) 0044 { 0045 } 0046 0047 DPluginBqm::~DPluginBqm() 0048 { 0049 delete d; 0050 } 0051 0052 void DPluginBqm::setVisible(bool b) 0053 { 0054 Q_EMIT signalVisible(b); 0055 } 0056 0057 int DPluginBqm::count() const 0058 { 0059 return d->tools.count(); 0060 } 0061 0062 QList<BatchTool*> DPluginBqm::tools(QObject* const parent) const 0063 { 0064 QList<BatchTool*> list; 0065 0066 Q_FOREACH (BatchTool* const t, d->tools) 0067 { 0068 if (t && (t->parent() == parent)) 0069 { 0070 list << t; 0071 } 0072 } 0073 0074 return list; 0075 } 0076 0077 BatchTool* DPluginBqm::findToolByName(const QString& name, QObject* const parent) const 0078 { 0079 Q_FOREACH (BatchTool* const t, tools(parent)) 0080 { 0081 if (t && (t->objectName() == name)) 0082 { // cppcheck-suppress useStlAlgorithm 0083 return t; 0084 } 0085 } 0086 0087 return nullptr; 0088 } 0089 0090 void DPluginBqm::addTool(BatchTool* const t) 0091 { 0092 t->setProperty("DPluginIId", iid()); 0093 t->setProperty("DPluginIfaceIId", ifaceIid()); 0094 d->tools.append(t); 0095 } 0096 0097 DInfoInterface* DPluginBqm::infoIface() const 0098 { 0099 DInfoInterface* const iface = BatchToolsFactory::instance()->infoIface(); 0100 0101 if (iface) 0102 { 0103 return iface; 0104 } 0105 0106 return nullptr; 0107 } 0108 0109 QStringList DPluginBqm::categories() const 0110 { 0111 QStringList list; 0112 0113 Q_FOREACH (BatchTool* const t, d->tools) 0114 { 0115 QString cat = t->toolGroupToString(); 0116 0117 if (!list.contains(cat)) 0118 { 0119 list << cat; 0120 } 0121 } 0122 0123 list.sort(); 0124 0125 return list; 0126 } 0127 0128 bool DPluginBqm::hasVisibilityProperty() const 0129 { 0130 // NOTE: all BQM plugins are not yet configurable. 0131 // Code is missing in BQM to check workflow tools list validity if a plugin is disabled from setup dialog. 0132 0133 return false; 0134 } 0135 0136 } // namespace Digikam 0137 0138 #include "moc_dpluginbqm.cpp"