Moved files from old XdxfPlugin directory
[mdictionary] / trunk / src / plugins / xdxf / src / xdxfplugin.h
1 #ifndef XDXFPLUGIN_H
2 #define XDXFPLUGIN_H
3
4 #include "../../../includes/CommonDictInterface.h"
5 #include <QObject>
6 #include <QDialog>
7 #include <QRegExp>
8 #include <QTime>
9 #include "XdxfDictDialog.h"
10
11 class TranslationXdxf;
12
13 class XdxfPlugin : public CommonDictInterface
14 {
15     Q_OBJECT
16     Q_INTERFACES(CommonDictInterface)
17 public:
18     XdxfPlugin(QObject *parent=0);
19
20     //! returns source language code iso 639-2
21     QString langFrom() const;
22
23     //! returns destination language code iso 639-2
24     QString langTo() const;
25
26     //! returns dictionary name (like "old english" or so)
27     QString name() const;
28
29     //! returns dictionary type (xdxf, google translate, etc)
30     QString type() const;
31
32     //! returns information about dictionary in html (name, authors, etc)
33     QString infoNote() const;
34
35     /*! returns DictDialog object that creates dialogs
36         for adding new dictionary and change plugin settings
37       */
38     DictDialog* dictDialog();
39
40
41     //! returns new, clean copy of plugin with setting set as in Settings*
42     CommonDictInterface* getNew(const Settings*) const;
43
44     //! returns whether plugin can start searching
45     bool isAvailable() const;
46
47     //! returns a description of a word given by a QString
48     QString search(QString key);
49
50     //! returns a unique hash for a dictionary
51     uint hash() const;
52
53     //! set unique value (unique for every dictionary not plugin)
54     void setHash(uint);
55
56     //! returns current plugin settings
57     Settings* settings();
58
59 public Q_SLOTS:
60     /*! performs search in dictionary
61       \param  word word to search in dictionary
62       \param limit limit on number of results
63
64       After finishing search it has to emit
65       \see CommonDictInterface:finalTranslation  finalTranslation
66     */
67     QList<Translation*> searchWordList(QString word, int limit);
68
69     //! stop current operation
70     void stop();
71
72 private:
73     bool isCached();
74     QString _langFrom;
75     QString _langTo;
76     QString _name;
77     QString _type;
78     QString _infoNote;
79     QDialog *_loadDialog;
80     QDialog *_settingsDialog;
81     QString path;
82     uint _hash;
83     bool stopped;   /*volatile*/
84     Settings *_settings;
85     XdxfDictDialog* _dictDialog;
86 };
87
88 #endif // XDXFPLUGIN_H
89
90