Added hash() method to CommonDictInterface
[mdictionary] / trunk / src / includes / CommonDictInterface.h
1 /*******************************************************************************
2
3     This file is part of mDictionary.
4
5     mDictionary is free software: you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation, either version 3 of the License, or
8     (at your option) any later version.
9
10     mDictionary is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14
15     You should have received a copy of the GNU General Public License
16     along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
17
18     Copyright 2010 Comarch S.A.
19
20 *******************************************************************************/
21
22 // Created by Bartosz Szatkowski
23 #include <QString>
24 #include <QDialog>
25 #include <QObject>
26 #include <QList>
27 #include "CommonDictInterface.h"
28 #include "translation.h"
29 #include "settings.h"
30
31
32
33 //! Interface for dict engines plugins
34 class CommonDictInterface : public QObject {
35   Q_OBJECT
36   public:
37     CommonDictInterface(const QObject *parent = 0) = 0;
38
39     //! returns source language code iso 639-2
40     virtual QString langFrom() const = 0; 
41
42     //! returns destination language code iso 639-2
43     virtual QString langTo() const = 0;
44
45     //! returns dictionary name (like "old english" or so
46     virtual QString name() const = 0;
47
48     //! returns dictionary type (xdxf, google translate, etc)
49     virtual QString type() const = 0;        
50
51     //! returns information about dictionary in html (name, authors, etc)
52     virtual QString infoNote() const = 0; 
53
54     //! return dialog that creates new dictionary and fills necesary options
55     //! QDialog should returns Setting* object after being showed
56     virtual QDialog* loadDialog() = 0;  
57
58     //! return dialog with dictionary settings
59     virtual QDialog* settingsDialog() = 0;
60
61     //! return new, clean copy of plugin with setting set as in Settings*
62     virtual CommonDictInterface* getNew(const Settings*) const = 0;
63
64     //! returns whether plugin can start searching 
65     virtual bool isAvailable() const = 0;
66
67     //! \returns unique value (unique for every dictionary not plugin
68     virtual uint hash() const = 0;
69
70
71
72  public Q_SLOTS:
73     /*! performes search in dictionary
74         \param  word word to search in dictionary
75         \param limit limit on number of results
76
77         After finishing search it have to emit 
78         \see CommonDictInterface:finalTranslation  finalTranslation
79
80     */
81     virtual void search(QString word, int limit) = 0;                         
82
83     //! stop current operation
84     virtual void stop() = 0;                        
85
86   Q_SIGNALS:
87     //! emit list of finded Translations
88     void finalTranslation(QList<Translation*>);
89
90     //! emited after dictionary is ready to use afer being loaded
91     void loaded(CommonDictInterface*);
92 }