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 virtual ~XdxfPlugin();
47 //! returns source language code iso 639-2
48 QString langFrom() const;
50 //! returns destination language code iso 639-2
51 QString langTo() const;
53 //! returns dictionary name (like "old english" or so)
56 //! returns dictionary type (xdxf, google translate, etc)
59 //! returns information about dictionary in html (name, authors, etc)
60 QString infoNote() const;
62 /*! returns DictDialog object that creates dialogs
63 for adding new dictionary and change plugin tings
65 DictDialog* dictDialog();
68 //! returns new, clean copy of plugin with setting set as in Settings*
69 CommonDictInterface* getNew(const Settings*) const;
71 //! returns whether plugin can start searching
72 bool isAvailable() const;
74 //! returns a description of a word given by a QString
75 QString search(QString key);
77 //! returns a unique hash for a dictionary
80 //! set unique value (unique for every dictionary not plugin)
83 //! returns current plugin settings
86 //! returns words count in dictionary
90 void setSettings(Settings*);
92 //! returns plugin icon
93 virtual QIcon* icon();
96 /*! performs search in dictionary
97 \param word word to search in dictionary
98 \param limit limit on number of results
100 After finishing search it has to emit
101 \see CommonDictInterface:finalTranslation finalTranslation
103 QList<Translation*> searchWordList(QString word, int limit=0);
105 //! stop current operation
109 //! emited with percent count of caching progress, and time elapsed from
111 void updateCachingProgress(int, int);
115 QString removeAccents(QString);
118 /*! returns true or false depending on whether the dictionary is cached
119 or not, not implemented yet
123 //! sets the path to dictionary file and adds it to settings
124 void setPath(QString);
126 QList<Translation*> searchWordListCache(QString word, int limit=0);
127 QList<Translation*> searchWordListFile(QString word, int limit=0);
128 QString searchFile(QString key);
129 QString searchCache(QString key);
131 bool makeCache(QString dir);
133 //! language from which we translate
135 //! language to which we translate
137 //! name of a dictionary
139 //! type of a dictionary
141 //! information about dictionary
143 QDialog *_loadDialog;
144 QDialog *_settingsDialog;
145 //! path to dictionary file
152 //! number of words in dicrionary
155 //! scan dictionary file to get information about it
156 void getDictionaryInfo();
158 volatile bool stopped;
160 XdxfDictDialog* _dictDialog;
161 XdxfCachingDialog* cachingDialog;
164 #endif // XDXFPLUGIN_H