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>
33 #include "XdxfDictDialog.h"
34 #include "XdxfCachingDialog.h"
36 class TranslationXdxf;
38 class XdxfPlugin : public CommonDictInterface
41 Q_INTERFACES(CommonDictInterface)
43 XdxfPlugin(QObject *parent=0);
45 //! returns source language code iso 639-2
46 QString langFrom() const;
48 //! returns destination language code iso 639-2
49 QString langTo() const;
51 //! returns dictionary name (like "old english" or so)
54 //! returns dictionary type (xdxf, google translate, etc)
57 //! returns information about dictionary in html (name, authors, etc)
58 QString infoNote() const;
60 /*! returns DictDialog object that creates dialogs
61 for adding new dictionary and change plugin settings
63 DictDialog* dictDialog();
66 //! returns new, clean copy of plugin with setting set as in Settings*
67 CommonDictInterface* getNew(const Settings*) const;
69 //! returns whether plugin can start searching
70 bool isAvailable() const;
72 //! returns a description of a word given by a QString
73 QString search(QString key);
75 //! returns a unique hash for a dictionary
78 //! set unique value (unique for every dictionary not plugin)
81 //! returns current plugin settings
84 //! returns words count in dictionary
88 void setSettings(Settings*);
90 //! returns plugin icon
91 virtual QIcon* icon();
94 /*! performs search in dictionary
95 \param word word to search in dictionary
96 \param limit limit on number of results
98 After finishing search it has to emit
99 \see CommonDictInterface:finalTranslation finalTranslation
101 QList<Translation*> searchWordList(QString word, int limit=0);
103 //! stop current operation
107 //! emited with percent count of caching progress, and time elapsed from
109 void updateCachingProgress(int, int);
113 QString removeAccents(QString);
116 /*! returns true or false depending on whether the dictionary is cached
117 or not, not implemented yet
121 //! sets the path to dictionary file and adds it to settings
122 void setPath(QString);
124 QList<Translation*> searchWordListCache(QString word, int limit=0);
125 QList<Translation*> searchWordListFile(QString word, int limit=0);
126 QString searchFile(QString key);
127 QString searchCache(QString key);
129 bool makeCache(QString dir);
131 //! language from which we translate
133 //! language to which we translate
135 //! name of a dictionary
137 //! type of a dictionary
139 //! information about dictionary
141 QDialog *_loadDialog;
142 QDialog *_settingsDialog;
143 //! path to dictionary file
150 //! number of words in dicrionary
153 //! scan dictionary file to get information about it
154 void getDictionaryInfo();
156 volatile bool stopped;
158 XdxfDictDialog* _dictDialog;
159 XdxfCachingDialog* cachingDialog;
162 #endif // XDXFPLUGIN_H