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 *******************************************************************************/
25 #include "../../../includes/CommonDictInterface.h"
31 #include <QSqlDatabase>
32 #include "XdxfDictDialog.h"
34 class TranslationXdxf;
36 class XdxfPlugin : public CommonDictInterface
39 Q_INTERFACES(CommonDictInterface)
41 XdxfPlugin(QObject *parent=0);
43 //! returns source language code iso 639-2
44 QString langFrom() const;
46 //! returns destination language code iso 639-2
47 QString langTo() const;
49 //! returns dictionary name (like "old english" or so)
52 //! returns dictionary type (xdxf, google translate, etc)
55 //! returns information about dictionary in html (name, authors, etc)
56 QString infoNote() const;
58 /*! returns DictDialog object that creates dialogs
59 for adding new dictionary and change plugin settings
61 DictDialog* dictDialog();
64 //! returns new, clean copy of plugin with setting set as in Settings*
65 CommonDictInterface* getNew(const Settings*) const;
67 //! returns whether plugin can start searching
68 bool isAvailable() const;
70 //! returns a description of a word given by a QString
71 QString search(QString key);
73 //! returns a unique hash for a dictionary
76 //! set unique value (unique for every dictionary not plugin)
79 //! returns current plugin settings
82 //! returns words count in dictionary
86 void setSettings(Settings*);
88 //! returns plugin icon
89 virtual QIcon* icon();
92 /*! performs search in dictionary
93 \param word word to search in dictionary
94 \param limit limit on number of results
96 After finishing search it has to emit
97 \see CommonDictInterface:finalTranslation finalTranslation
99 QList<Translation*> searchWordList(QString word, int limit=0);
101 //! stop current operation
105 //! emited with percent count of caching progress
110 QString removeAccents(QString);
113 /*! returns true or false depending on whether the dictionary is cached
114 or not, not implemented yet
118 //! sets the path to dictionary file and adds it to settings
119 void setPath(QString);
121 QList<Translation*> searchWordListCache(QString word, int limit=0);
122 QList<Translation*> searchWordListFile(QString word, int limit=0);
124 bool makeCache(QString dir);
126 //! language from which we translate
128 //! language to which we translate
130 //! name of a dictionary
132 //! type of a dictionary
134 //! information about dictionary
136 QDialog *_loadDialog;
137 QDialog *_settingsDialog;
138 //! path to dictionary file
143 //! number of words in dicrionary
146 //! scan dictionary file to get information about it
147 void getDictionaryInfo();
149 volatile bool stopped;
151 XdxfDictDialog* _dictDialog;
154 #endif // XDXFPLUGIN_H