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 "translation.h"
35 //! Interface for dict engines plugins
36 class CommonDictInterface : public QObject {
39 CommonDictInterface(QObject *parent = 0):QObject(parent) {}
41 //! returns source language code iso 639-2
42 virtual QString langFrom() const = 0;
44 //! returns destination language code iso 639-2
45 virtual QString langTo() const = 0;
47 //! returns dictionary name (like "old english" or so
48 virtual QString name() const = 0;
50 //! returns dictionary type (xdxf, google translate, etc)
51 virtual QString type() const = 0;
53 //! returns information about dictionary in html (name, authors, etc)
54 virtual QString infoNote() const = 0;
56 //! return dialog that creates new dictionary and fills necesary options
57 //! QDialog should returns Setting* object after being showed
58 virtual QDialog* loadDialog() = 0;
60 //! return dialog with dictionary settings
61 virtual QDialog* settingsDialog() = 0;
63 //! return new, clean copy of plugin with setting set as in Settings*
64 virtual CommonDictInterface* getNew(const Settings*) const = 0;
66 //! returns whether plugin can start searching
67 virtual bool isAvailable() const = 0;
69 //! returns the actual translation of a word given in key
70 virtual QString search(QString key) = 0;
72 //! \returns unique value (unique for every dictionary not plugin
73 virtual uint hash() const = 0;
76 /*! performs search in dictionary
77 \param word word to search in dictionary
78 \param limit limit on number of results
80 After finishing search it have to emit
81 \see CommonDictInterface:finalTranslation finalTranslation
84 virtual QList<Translation*> searchWordList(QString word, int limit) = 0;
86 //! stop current operation
87 virtual void stop() = 0;
91 //! emited after dictionary is ready to use afer being loaded
92 void loaded(CommonDictInterface*);
95 Q_DECLARE_INTERFACE(CommonDictInterface, "CommonDictInterface/0.1");