Merge branch 'xdxf'
[mdictionary] / trunk / src / plugins / xdxf / src / XdxfPlugin / 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
10 class TranslationXdxf;
11
12 class XdxfPlugin : public CommonDictInterface
13 {
14     Q_OBJECT
15     Q_INTERFACES(CommonDictInterface)
16 public:
17     XdxfPlugin(QObject *parent=0);
18
19     //! returns source language code iso 639-2
20     QString langFrom() const;
21
22     //! returns destination language code iso 639-2
23     QString langTo() const;
24
25     //! returns dictionary name (like "old english" or so)
26     QString name() const;
27
28     //! returns dictionary type (xdxf, google translate, etc)
29     QString type() const;
30
31     //! returns information about dictionary in html (name, authors, etc)
32     QString infoNote() const;
33
34     //! returns dialog that creates new dictionary and fills necessary options
35     //! QDialog should return Setting* object after being shown
36     QDialog* loadDialog();
37
38     //! returns dialog with dictionary settings
39     QDialog* settingsDialog();
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 public Q_SLOTS:
57     /*! performs search in dictionary
58       \param  word word to search in dictionary
59       \param limit limit on number of results
60
61       After finishing search it has to emit
62       \see CommonDictInterface:finalTranslation  finalTranslation
63     */
64     QList<Translation*> searchWordList(QString word, int limit);
65
66     //! stop current operation
67     void stop();
68
69 private:
70     bool isCached();
71     QString _langFrom;
72     QString _langTo;
73     QString _name;
74     QString _type;
75     QString _infoNote;
76     QDialog *_loadDialog;
77     QDialog *_settingsDialog;
78     QString path;
79     uint _hash;
80     bool stopped;   /*volatile*/
81 };
82
83 #endif // XDXFPLUGIN_H
84
85