added XdxfPlugin::hash() draft
[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 "TranslationXdxf.h"
9
10 class XdxfPlugin : public CommonDictInterface
11 {
12     Q_OBJECT
13     Q_INTERFACES(CommonDictInterface)
14 public:
15     XdxfPlugin(QObject *parent=0);
16
17     //! returns source language code iso 639-2
18     QString langFrom() const;
19
20     //! returns destination language code iso 639-2
21     QString langTo() const;
22
23     //! returns dictionary name (like "old english" or so
24     QString name() const;
25
26     //! returns dictionary type (xdxf, google translate, etc)
27     QString type() const;
28
29     //! returns information about dictionary in html (name, authors, etc)
30     QString infoNote() const;
31
32     //! return dialog that creates new dictionary and fills necesary options
33     //! QDialog should returns Setting* object after being showed
34     QDialog* loadDialog();
35
36     //! return dialog with dictionary settings
37     QDialog* settingsDialog();
38
39     //! return new, clean copy of plugin with setting set as in Settings*
40     CommonDictInterface* getNew(const Settings*) const;
41
42     //! returns whether plugin can start searching
43     bool isAvailable() const;
44
45     QString search(QString key);
46
47     uint hash() const;
48
49 public Q_SLOTS:
50     /*! performs search in dictionary
51       \param  word word to search in dictionary
52       \param limit limit on number of results
53
54       After finishing search it have to emit
55       \see CommonDictInterface:finalTranslation  finalTranslation
56     */
57
58     void searchWordList(QString word, int limit);
59
60     //! stop current operation
61     void stop();
62
63 private:
64     bool isCached();
65     QString _langFrom;
66     QString _langTo;
67     QString _name;
68     QString _type;
69     QString _infoNote;
70     QDialog *_loadDialog;
71     QDialog *_settingsDialog;
72     QString path;
73     bool stopped;   /*volatile*/
74 };
75
76 #endif // XDXFPLUGIN_H
77
78