File indexing completed on 2022-11-29 20:25:17

0001 /***************************************************************************
0002                       podofplugin.h  -  description
0003                              -------------------
0004     begin                : Wed May 26th 2010
0005     copyright            : (C) 2010 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 PODOFO_PLUGIN_H
0019 #define PODOFO_PLUGIN_H
0020 
0021 #include "fileplugin.h"
0022 
0023 #include <QMap>
0024 
0025 class PodofoPlugin : public FilePlugin
0026 {
0027 public:
0028     explicit PodofoPlugin(PluginLoader *loader);
0029 
0030     /**
0031      * This function is the core of your plugin.
0032      *
0033      * It does the actual processing of a file, filename or token depending of the type
0034      * of your plugin.
0035      *
0036      * \see type()
0037      *
0038      * @param b the parent BatchRenamer instance calling this plugin
0039      * @param index the index of the current file (i.e. the first file has index 0,
0040      *              the second file to be renamed has index 1 ....)
0041      * @param filenameOrToken this parameter depends on the type of your plugin.
0042      *                        If type is ePluginType_File, this is the absolute path
0043      *                        or URL to the renamed file.
0044      *                        If type is ePluginType_Filename, this is the filename
0045      *                        (without path) as created by KRename.
0046      *                        If type is ePluginType_Token, this is the contents of a token
0047      *                        in brackets. If your plugin supports the token [example],
0048      *                        KRename will pass the strign "example" to your method.
0049      * @param eCurrentType the current type of plugin that is requested (for plugins that support more than one type)
0050      *
0051      * @returns the result of the function, depending on type().
0052      * @returns QString::null if this plugin has nothing to do.
0053      * @returns A new filename if type is ePluginType_Filename
0054      * @returns the value of the token if type is ePluginType_Token
0055      * @returns an error message or QString::null if type is ePluginType_File
0056      */
0057     virtual QString processFile(BatchRenamer *b, int index, const QString &filenameOrToken, EPluginType eCurrentType);
0058 
0059     /** Returns help descriptions for the supported tokens
0060      *
0061      *  The returned stringlist contains strings that are the tokens
0062      *  and the description separated by ;;
0063      *
0064      *  @returns a stringlist containing help on the supported tokens
0065      */
0066     inline virtual const QStringList &help() const;
0067 
0068 private:
0069     QStringList           m_help;
0070     QMap<QString, QString> m_mapRealKeys;
0071 };
0072 
0073 inline const QStringList &PodofoPlugin::help() const
0074 {
0075     return m_help;
0076 }
0077 
0078 #endif // PODOFO_PLUGIN_H