File indexing completed on 2025-01-05 03:51:27
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2018-07-30 0007 * Description : a BQM plugin to run user script. 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 "userscriptplugin.h" 0016 0017 // Qt includes 0018 0019 #include <QPointer> 0020 #include <QString> 0021 #include <QApplication> 0022 0023 // KDE includes 0024 0025 #include <klocalizedstring.h> 0026 0027 // Local includes 0028 0029 #include "digikam_debug.h" 0030 #include "userscript.h" 0031 0032 namespace DigikamBqmUserScriptPlugin 0033 { 0034 0035 UserScriptPlugin::UserScriptPlugin(QObject* const parent) 0036 : DPluginBqm(parent) 0037 { 0038 } 0039 0040 UserScriptPlugin::~UserScriptPlugin() 0041 { 0042 } 0043 0044 QString UserScriptPlugin::name() const 0045 { 0046 return i18nc("@title", "User Shell Script"); 0047 } 0048 0049 QString UserScriptPlugin::iid() const 0050 { 0051 return QLatin1String(DPLUGIN_IID); 0052 } 0053 0054 QIcon UserScriptPlugin::icon() const 0055 { 0056 return QIcon::fromTheme(QLatin1String("text-x-script")); 0057 } 0058 0059 QString UserScriptPlugin::description() const 0060 { 0061 return i18nc("@info", "A tool to execute a custom shell script"); 0062 } 0063 0064 QString UserScriptPlugin::details() const 0065 { 0066 return xi18nc("@info", "<para>This Batch Queue Manager tool can run user shell script as workflow stage.</para>" 0067 "<para>Script variables:</para>" 0068 "<para>Uses <b>$INPUT</b> and <b>$OUTPUT</b> for input / output filenames (with special characters escaped). " 0069 "These would be substituted before shell execution.</para>" 0070 "<para>Uses <b>$TITLE</b>, <b>$COMMENTS</b>, <b>$COLORLABEL</b>, <b>$PICKLABEL</b>, <b>$RATING</b> " 0071 "and <b>$TAGSPATH</b> to handle digiKam properties.</para>"); 0072 } 0073 0074 QString UserScriptPlugin::handbookSection() const 0075 { 0076 return QLatin1String("batch_queue"); 0077 } 0078 0079 QString UserScriptPlugin::handbookChapter() const 0080 { 0081 return QLatin1String("custom_script"); 0082 } 0083 0084 QList<DPluginAuthor> UserScriptPlugin::authors() const 0085 { 0086 return QList<DPluginAuthor>() 0087 << DPluginAuthor(QString::fromUtf8("Hubert Law"), 0088 QString::fromUtf8("hhclaw dot eb at gmail dot com"), 0089 QString::fromUtf8("(C) 2014")) 0090 ; 0091 } 0092 0093 void UserScriptPlugin::setup(QObject* const parent) 0094 { 0095 UserScript* const tool = new UserScript(parent); 0096 tool->setPlugin(this); 0097 0098 addTool(tool); 0099 } 0100 0101 } // namespace DigikamBqmUserScriptPlugin 0102 0103 #include "moc_userscriptplugin.cpp"