blob: 72302f7a3f314504478c01abaae4eb584fc0552f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
/***************************************************************************
pluginloader.h - description
-------------------
begin : Sun Dec 30 2001
copyright : (C) 2001 by Dominik Seichter
email : domseichter@web.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef PLUGINLOADER_H
#define PLUGINLOADER_H
// Own includes
#include "batchrenamer.h"
#include "plugin.h"
#include <tqmap.h>
#include <tqptrlist.h>
class TQCheckBox;
class TQVBoxLayout;
class TQString;
class TQWidget;
#define NUM_INTERNAL_PLUGINS 8
enum pluginType {
TYPE_BRACKET = 2, // Plugin argument is in brackets like [artist] or [1-2]
TYPE_TOKEN = 4, // Plugin has its own reserved token like ,& or /
TYPE_FINAL_FILE = 8, // Plugin does something with the final file
// i.e. that is not changing its name but its permission or similar!
TYPE_FINAL_FILENAME = 16 // Plugin changes the final filename before renaming
};
class PluginLoader {
public:
// For RedHat :)
struct PluginLibrary {
Plugin *plugin;
bool usePlugin;
/* access this member only
* from within KRenameImpl
* when the GUI is already constructed!
*/
TQCheckBox* check;
};
static PluginLoader* instance();
void loadPlugins( bool fileplugins );
TQPtrList<PluginLoader::PluginLibrary> libs;
Plugin* findPlugin( const TQString & token );
inline bool filePluginsLoaded() const;
void clearCache();
private:
PluginLoader();
~PluginLoader();
void addPlugin( Plugin* plugin );
void loadFilePlugins();
private:
Plugin* m_internal_plugins[NUM_INTERNAL_PLUGINS];
static PluginLoader* m_plugin;
TQMap<TQString,Plugin*> m_bracket_map;
TQMap<TQString,Plugin*> m_bracket_cache;
bool m_loaded;
bool m_file;
};
bool PluginLoader::filePluginsLoaded() const
{
return m_file;
}
#endif
|