22
22
#define KTRANSLATOR_PLUGIN_H
24
24
#include <qobject.h>
25
#include <kdemacros.h>
29
* @short Dictionary Plugin Abstract Class
30
* @author Raul Fernandes <rgfbr@yahoo.com.br>
32
* This is the base class to make dictionary plugins for KTranslator. The dictionary plugins are the
33
* code that do the real search of word in dictionaries.
34
* When KTranslator wants to translate a word, it calls the search function of each plugin passing the
35
* word as argument. The plugin should return the result in this way:
37
* <dicName>Dictionary Name</dicName>
38
* <headword>Headword</headword>
39
* <inflection>Inflections</inflection>
40
* <pos>Part of Speech</pos>
41
* <definition>Definition of word<link>Link to other words</link></definition>
42
* <pos>Part of Speech</pos>
43
* <definition>Definition of word<link>Link to other words</link></definition>
45
* <pos>Part of Speech</pos>
46
* <definition>Definition of word<link>Link to other words</link></definition>
48
* There are no obrigatory tag, but you should at least return <dicName>, <headword> and one <definition>.
30
* Namespace for KTranslator Plugins
52
33
namespace KTranslator {
54
class DictionaryPlugin : public QObject
36
* @short Dictionary Plugin Abstract Class
37
* @author Raul Fernandes <rgfbr@yahoo.com.br>
39
* This is the base class to make dictionary plugins for KTranslator. The dictionary plugins are the
40
* code that do the real search of word in dictionaries.
41
* When KTranslator wants to translate a word, it calls the search function of each plugin passing the
42
* word as argument. The plugin should return the result in this way:
45
* <dicName>Dictionary Name</dicName>
46
* <headword>Headword</headword>
47
* <inflection>Inflections</inflection>
48
* <pos>Part of Speech</pos>
49
* <definition>Definition of word<link>Link to other words</link></definition>
50
* <pos>Part of Speech</pos>
51
* <definition>Definition of word<link>Link to other words</link></definition>
53
* <pos>Part of Speech</pos>
54
* <definition>Definition of word<link>Link to other words</link></definition>
57
* There are no obrigatory tag, but you should at least return <dicName>, <headword> and one <definition>.
59
class KDE_EXPORT DictionaryPlugin : public QObject
65
* Default constructor.
58
67
DictionaryPlugin(QObject *parent, const char* name=0);
70
* Destructs the plugin.
59
72
virtual ~DictionaryPlugin();
75
* Function that do the searchs.
76
* @returns the result of search.
61
78
virtual QString search( const QString & )=0;
81
* @returns if plugin is enabled or not.
63
83
bool enabled() { return m_enabled; };
86
* Sets if plugin is enabled or not.
64
88
void setEnabled( bool enable ) { m_enabled = enable; };
91
* @returns if plugin loaded correctly and are ready to use.
93
bool isOk() { return m_isOk; };
96
* Sets if plugin loaded correctly and are ready to use.
98
void setOk( bool isOk ) { m_isOk = isOk; };
65
99
virtual QWidget *confPage()=0;
66
100
virtual void applyConf( QWidget * )=0;
101
virtual int size()=0;
104
* @returns text with informations about plugin to be shown to user.
106
QString tooltip() { return m_tooltip; };