File indexing completed on 2024-04-28 17:05:45

0001 /***************************************************************************
0002                       taglibplugin.h  -  description
0003                              -------------------
0004     begin                : Tue Jul 1st 2008
0005     copyright            : (C) 2008 by Dominik Seichter
0006     email                : domseichter@web.de
0007  ***************************************************************************/
0008 
0009 /***************************************************************************
0010  *                                                                         *
0011  *   This program is free software; you can redistribute it and/or modify  *
0012  *   it under the terms of the GNU General Public License as published by  *
0013  *   the Free Software Foundation; either version 2 of the License, or     *
0014  *   (at your option) any later version.                                   *
0015  *                                                                         *
0016  ***************************************************************************/
0017 
0018 #ifndef TAG_LIB_PLUGIN_H
0019 #define TAG_LIB_PLUGIN_H
0020 
0021 #include "fileplugin.h"
0022 
0023 class TagLibPlugin : public FilePlugin
0024 {
0025 public:
0026     explicit TagLibPlugin(PluginLoader *loader);
0027 
0028     /**
0029      * This function is the core of your plugin.
0030      *
0031      * It does the actual processing of a file, filename or token depending of the type
0032      * of your plugin.
0033      *
0034      * \see type()
0035      *
0036      * @param b the parent BatchRenamer instance calling this plugin
0037      * @param index the index of the current file (i.e. the first file has index 0,
0038      *              the second file to be renamed has index 1 ....)
0039      * @param filenameOrToken this parameter depends on the type of your plugin.
0040      *                        If type is ePluginType_File, this is the absolute path
0041      *                        or URL to the renamed file.
0042      *                        If type is ePluginType_Filename, this is the filename
0043      *                        (without path) as created by KRename.
0044      *                        If type is ePluginType_Token, this is the contents of a token
0045      *                        in brackets. If your plugin supports the token [example],
0046      *                        KRename will pass the strign "example" to your method.
0047      * @param eCurrentType the current type of plugin that is requested (for plugins that support more than one type)
0048      *
0049      * @returns the result of the function, depending on type().
0050      * @returns QString::null if this plugin has nothing to do.
0051      * @returns A new filename if type is ePluginType_Filename
0052      * @returns the value of the token if type is ePluginType_Token
0053      * @returns an error message or QString::null if type is ePluginType_File
0054      */
0055     virtual QString processFile(BatchRenamer *b, int index, const QString &filenameOrToken, EPluginType eCurrentType);
0056 
0057     /** Returns help descriptions for the supported tokens
0058      *
0059      *  The returned stringlist contains strings that are the tokens
0060      *  and the description separated by ;;
0061      *
0062      *  @returns a stringlist containing help on the supported tokens
0063      */
0064     inline virtual const QStringList &help() const;
0065 
0066 private:
0067     QStringList m_help;
0068 };
0069 
0070 inline const QStringList &TagLibPlugin::help() const
0071 {
0072     return m_help;
0073 }
0074 
0075 #endif // TAG_LIB_PLUGIN_H