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

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