1 /*******************************************************************************
3 This file is part of mDictionary.
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.
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.
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/>.
18 Copyright 2010 Comarch S.A.
20 *******************************************************************************/
22 // Created by Bartosz Szatkowski
24 #ifndef COMMONDICTINTERFACE_H
25 #define COMMONDICTINTERFACE_H
31 #include "CommonDictInterface.h"
32 #include "translation.h"
35 Q_DECLARE_INTERFACE (CommonDictInterface, "xdxfInterface")
37 //! Interface for dict engines plugins
38 class CommonDictInterface : public QObject {
41 CommonDictInterface(QObject *parent = 0):QObject(parent) {}
43 //! returns source language code iso 639-2
44 virtual QString langFrom() const = 0;
46 //! returns destination language code iso 639-2
47 virtual QString langTo() const = 0;
49 //! returns dictionary name (like "old english" or so
50 virtual QString name() const = 0;
52 //! returns dictionary type (xdxf, google translate, etc)
53 virtual QString type() const = 0;
55 //! returns information about dictionary in html (name, authors, etc)
56 virtual QString infoNote() const = 0;
58 //! return dialog that creates new dictionary and fills necesary options
59 //! QDialog should returns Setting* object after being showed
60 virtual QDialog* loadDialog() = 0;
62 //! return dialog with dictionary settings
63 virtual QDialog* settingsDialog() = 0;
65 //! return new, clean copy of plugin with setting set as in Settings*
66 virtual CommonDictInterface* getNew(const Settings*) const = 0;
68 //! returns whether plugin can start searching
69 virtual bool isAvailable() const = 0;
71 virtual QString search(QString key) = 0;
74 /*! performes search in dictionary
75 \param word word to search in dictionary
76 \param limit limit on number of results
78 After finishing search it have to emit
79 \see CommonDictInterface:finalTranslation finalTranslation
82 virtual void searchWordList(QString word, int limit) = 0;
84 //! stop current operation
85 virtual void stop() = 0;
88 //! emit list of found Translations
89 void finalTranslation(QList<Translation*>);
91 //! emited after dictionary is ready to use afer being loaded
92 void loaded(CommonDictInterface*);
95 #endif // COMMONDICTINTERFACE_H