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 /*! /file CommonDictInterface.h
23 \brief Common interface for all dicts and plugins \see CommonDictInterface
25 \author Bartosz Szatkowski <bulislaw@linux.com>
28 #ifndef COMMONDICTINTERFACE_H
29 #define COMMONDICTINTERFACE_H
35 #include "translation.h"
42 //! Interface for dict engines plugins
43 class CommonDictInterface : public QObject {
46 CommonDictInterface(QObject *parent = 0):QObject(parent) {}
48 //! returns source language code iso 639-2
49 virtual QString langFrom() const = 0;
51 //! returns destination language code iso 639-2
52 virtual QString langTo() const = 0;
54 //! returns dictionary name (like "old english" or so
55 virtual QString name() const = 0;
57 //! returns dictionary type (xdxf, google translate, etc)
58 virtual QString type() const = 0;
60 //! returns information about dictionary in html (name, authors, etc)
61 virtual QString infoNote() const = 0;
63 /*! returns DictDialog object that creates dialogs
64 for adding new dictionary and change plugin settings*/
65 virtual DictDialog* dictDialog() = 0;
68 //! returns new, clean copy of plugin with setting set as in Settings*
69 virtual CommonDictInterface* getNew(const Settings*) const = 0;
71 //! returns whether plugin can start searching
72 virtual bool isAvailable() const = 0;
74 //! returns the actual translation of a word given in key
75 virtual QString search(QString key) = 0;
77 //! \returns unique value (unique for every dictionary not plugin
78 virtual uint hash() const = 0;
80 //! sets unique value (unique for every dictionary not plugin)
81 virtual void setHash(uint) = 0;
83 //! returns current plugin settings
84 virtual Settings* settings() = 0;
86 //! returns plugin icon
87 virtual QIcon* icon() = 0;
90 /*! performs search in dictionary
91 \param word word to search in dictionary
92 \param limit limit on number of results,
93 if limit=0 all matching words are returned
95 After finishing search it have to emit
96 \see CommonDictInterface:finalTranslation finalTranslation
98 virtual QList<Translation*> searchWordList(QString word, int limit=0) = 0;
100 //! stops current operation
101 virtual void stop() = 0;
105 //! emited after dictionary is ready to use afer being loaded
106 void loaded(CommonDictInterface*);
108 //! emited after change dictionary settings
109 void settingsChanged();
111 /*! emmited to backbone when needed to inform user about something
112 \param Backbone::NotifyType gui my dacide to show different typet in
114 \param QString text of the notification
116 void notify(Notify::NotifyType, QString);
119 Q_DECLARE_INTERFACE(CommonDictInterface, "CommonDictInterface/0.1");