~ubuntu-branches/ubuntu/jaunty/ktranslator/jaunty

« back to all changes in this revision

Viewing changes to ktranslator/interfaces/dictionary/dictionaryplugin.h

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Mercatante
  • Date: 2006-07-20 23:02:58 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20060720230258-18ijr919ancujnuz
Tags: 0.4-0ubuntu1
* New upstream release
* Added kubuntu_01_kdepot.patch for pot file extraction 
  to rosetta
* Added kubuntu_02_fix_desktop_file.patch to prepare desktop
  file for XDG directory

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/***************************************************************************
2
 
 *   Copyright (C) 2004 by Raul Fernandes                                  *
 
2
 *   Copyright (C) 2004-2006 by Raul Fernandes                             *
3
3
 *   rgfbr@yahoo.com.br                                                    *
4
4
 *                                                                         *
5
5
 *   This program is free software; you can redistribute it and/or modify  *
22
22
#define KTRANSLATOR_PLUGIN_H
23
23
 
24
24
#include <qobject.h>
 
25
#include <kdemacros.h>
25
26
 
26
27
class QWidget;
27
28
 
28
29
/**
29
 
 * @short Dictionary Plugin Abstract Class
30
 
 * @author Raul Fernandes <rgfbr@yahoo.com.br>
31
 
 * @version 0.1
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:
36
 
 *
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>
44
 
 * ...
45
 
 * <pos>Part of Speech</pos>
46
 
 * <definition>Definition of word<link>Link to other words</link></definition>
47
 
 *
48
 
 * There are no obrigatory tag, but you should at least return <dicName>, <headword> and one <definition>.
 
30
 *  Namespace for KTranslator Plugins
49
31
 */
50
32
 
51
 
 
52
33
namespace KTranslator {
53
34
 
54
 
    class DictionaryPlugin : public QObject
 
35
    /**
 
36
     * @short Dictionary Plugin Abstract Class
 
37
     * @author Raul Fernandes <rgfbr@yahoo.com.br>
 
38
     * @version 0.1
 
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:
 
43
     *
 
44
     * \verbatim
 
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>
 
52
     * ...
 
53
     * <pos>Part of Speech</pos>
 
54
     * <definition>Definition of word<link>Link to other words</link></definition>
 
55
     * \endverbatim
 
56
     *
 
57
     * There are no obrigatory tag, but you should at least return <dicName>, <headword> and one <definition>.
 
58
     */
 
59
    class KDE_EXPORT DictionaryPlugin : public QObject
55
60
    {
56
61
 
57
62
    public:
 
63
 
 
64
        /**
 
65
         * Default constructor.
 
66
         */
58
67
        DictionaryPlugin(QObject *parent, const char* name=0);
 
68
 
 
69
        /**
 
70
         * Destructs the plugin.
 
71
         */
59
72
        virtual ~DictionaryPlugin();
60
73
 
 
74
        /**
 
75
         * Function that do the searchs.
 
76
         * @returns the result of search.
 
77
         */
61
78
        virtual QString search( const QString & )=0;
62
79
 
 
80
        /**
 
81
         * @returns if plugin is enabled or not.
 
82
         */
63
83
        bool enabled() { return m_enabled; };
 
84
 
 
85
        /**
 
86
         * Sets if plugin is enabled or not.
 
87
         */
64
88
        void setEnabled( bool enable ) { m_enabled = enable; };
 
89
 
 
90
        /**
 
91
         * @returns if plugin loaded correctly and are ready to use.
 
92
         */
 
93
        bool isOk() { return m_isOk; };
 
94
 
 
95
        /**
 
96
         * Sets if plugin loaded correctly and are ready to use.
 
97
         */
 
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;
 
102
 
 
103
        /**
 
104
         * @returns text with informations about plugin to be shown to user.
 
105
         */
 
106
        QString tooltip() { return m_tooltip; };
 
107
    protected:
 
108
        QString m_tooltip;
67
109
    private:
68
110
        bool m_enabled;
 
111
        bool m_isOk;
69
112
    };
70
113
};
71
114