File indexing completed on 2024-04-14 05:44:33

0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 // SPDX-FileCopyrightText: 2010 Dominik Seichter <domseichter@web.de>
0003 
0004 #ifndef PODOFO_PLUGIN_H
0005 #define PODOFO_PLUGIN_H
0006 
0007 #include "fileplugin.h"
0008 
0009 #include <QMap>
0010 
0011 class PodofoPlugin : public FilePlugin
0012 {
0013 public:
0014     explicit PodofoPlugin(PluginLoader *loader);
0015 
0016     /**
0017      * This function is the core of your plugin.
0018      *
0019      * It does the actual processing of a file, filename or token depending of the type
0020      * of your plugin.
0021      *
0022      * \see type()
0023      *
0024      * @param b the parent BatchRenamer instance calling this plugin
0025      * @param index the index of the current file (i.e. the first file has index 0,
0026      *              the second file to be renamed has index 1 ....)
0027      * @param filenameOrToken this parameter depends on the type of your plugin.
0028      *                        If type is ePluginType_File, this is the absolute path
0029      *                        or URL to the renamed file.
0030      *                        If type is ePluginType_Filename, this is the filename
0031      *                        (without path) as created by KRename.
0032      *                        If type is ePluginType_Token, this is the contents of a token
0033      *                        in brackets. If your plugin supports the token [example],
0034      *                        KRename will pass the strign "example" to your method.
0035      * @param eCurrentType the current type of plugin that is requested (for plugins that support more than one type)
0036      *
0037      * @returns the result of the function, depending on type().
0038      * @returns an empty QString if this plugin has nothing to do.
0039      * @returns A new filename if type is ePluginType_Filename
0040      * @returns the value of the token if type is ePluginType_Token
0041      * @returns an error message or an empty QString if type is ePluginType_File
0042      */
0043     QString processFile(BatchRenamer *b, int index, const QString &filenameOrToken, EPluginType eCurrentType) override;
0044 
0045     /** Returns help descriptions for the supported tokens
0046      *
0047      *  The returned stringlist contains strings that are the tokens
0048      *  and the description separated by ;;
0049      *
0050      *  @returns a stringlist containing help on the supported tokens
0051      */
0052     inline const QStringList &help() const override;
0053 
0054 private:
0055     QStringList           m_help;
0056 };
0057 
0058 inline const QStringList &PodofoPlugin::help() const
0059 {
0060     return m_help;
0061 }
0062 
0063 #endif // PODOFO_PLUGIN_H