in CommonDictionaryInterface in searchWordList added default limit value
[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
24 #ifndef COMMONDICTINTERFACE_H
25 #define COMMONDICTINTERFACE_H
26
27 #include <QString>
28 #include <QDialog>
29 #include <QObject>
30 #include <QList>
31 #include "translation.h"
32
33 class DictDialog;
34 class Settings;
35
36
37 //! Interface for dict engines plugins
38 class CommonDictInterface : public QObject {
39   Q_OBJECT
40   public:
41     CommonDictInterface(QObject *parent = 0):QObject(parent) {}
42
43     //! returns source language code iso 639-2
44     virtual QString langFrom() const = 0;
45
46     //! returns destination language code iso 639-2
47     virtual QString langTo() const = 0;
48
49     //! returns dictionary name (like "old english" or so
50     virtual QString name() const = 0;
51
52     //! returns dictionary type (xdxf, google translate, etc)
53     virtual QString type() const = 0;
54
55     //! returns information about dictionary in html (name, authors, etc)
56     virtual QString infoNote() const = 0;
57
58     /*! returns DictDialog object that creates dialogs
59         for adding new dictionary and change plugin settings*/
60     virtual DictDialog* dictDialog() = 0;
61
62
63     //! return new, clean copy of plugin with setting set as in Settings*
64     virtual CommonDictInterface* getNew(const Settings*) const = 0;
65
66     //! returns whether plugin can start searching
67     virtual bool isAvailable() const = 0;
68
69     //! returns the actual translation of a word given in key
70     virtual QString search(QString key) = 0;
71
72     //! \returns unique value (unique for every dictionary not plugin
73     virtual uint hash() const = 0;
74
75     //! set unique value (unique for every dictionary not plugin)
76     virtual void setHash(uint) = 0;
77
78     //! returns current plugin settings
79     virtual Settings* settings() = 0;
80
81  public Q_SLOTS:
82     /*! performs search in dictionary
83         \param  word word to search in dictionary
84         \param  limit limit on number of results,
85                 if limit=0 all matching words are returned
86
87         After finishing search it have to emit
88         \see CommonDictInterface:finalTranslation  finalTranslation
89     */
90     virtual QList<Translation*> searchWordList(QString word, int limit=0) = 0;
91
92     //! stop current operation
93     virtual void stop() = 0;
94
95   Q_SIGNALS:
96
97     //! emited after dictionary is ready to use afer being loaded
98     void loaded(CommonDictInterface*);
99 };
100
101 Q_DECLARE_INTERFACE(CommonDictInterface, "CommonDictInterface/0.1");
102
103 #endif