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