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 *******************************************************************************/
23 /*! \file xdxfplugin.h
28 #include "../../../includes/CommonDictInterface.h"
34 #include <QSqlDatabase>
36 #include "XdxfDictDialog.h"
37 #include "XdxfCachingDialog.h"
39 class TranslationXdxf;
41 class XdxfPlugin : public CommonDictInterface
44 Q_INTERFACES(CommonDictInterface)
46 XdxfPlugin(QObject *parent=0);
48 virtual ~XdxfPlugin();
50 //! returns source language code iso 639-2
51 QString langFrom() const;
53 //! returns destination language code iso 639-2
54 QString langTo() const;
56 //! returns dictionary name (like "old English" or so)
59 //! returns dictionary type (xdxf, google translate, etc)
62 //! returns information about dictionary in html (name, authors, etc)
63 QString infoNote() const;
65 /*! returns DictDialog object that creates dialogs
66 for adding new dictionary and changing plugin things
68 DictDialog* dictDialog();
71 //! returns new, clean copy of plugin with setting set as in Settings*
72 CommonDictInterface* getNew(const Settings*) const;
74 //! returns whether plugin can start searching
75 bool isAvailable() const;
77 //! returns a description of a word given by a QString
78 QString search(QString key);
80 //! returns a unique hash for a dictionary
83 //! sets unique value (unique for every dictionary not plugin)
86 //! returns current plugin settings
89 //! returns words count in dictionary
93 void setSettings(Settings*);
95 //! returns plugin icon
96 virtual QIcon* icon();
99 /*! performs search in dictionary
100 \param word word to search in dictionary
101 \param limit limit on number of results
103 After finishing search it has to emit
104 \see CommonDictInterface:finalTranslation finalTranslation
106 QList<Translation*> searchWordList(QString word, int limit=0);
108 //! stop current operation
112 //! emitted with percent count of caching progress, and time elapsed from
114 void updateCachingProgress(int, int);
118 QString removeAccents(QString);
121 /*! returns true or false depending on whether the dictionary is cached
122 or not, not implemented yet
126 //! sets the path to dictionary file and adds it to settings
127 void setPath(QString);
129 QList<Translation*> searchWordListCache(QString word, int limit=0);
130 QList<Translation*> searchWordListFile(QString word, int limit=0);
131 QString searchFile(QString key);
132 QString searchCache(QString key);
134 bool makeCache(QString dir);
136 //! language from which we translate
138 //! language to which we translate
140 //! name of a dictionary
142 //! type of a dictionary
144 //! information about dictionary
146 QDialog *_loadDialog;
147 QDialog *_settingsDialog;
148 //! path to dictionary file
155 //! number of words in dictionary
158 //! scans dictionary file to get information about it
159 void getDictionaryInfo();
161 volatile bool stopped;
163 XdxfDictDialog* _dictDialog;
164 XdxfCachingDialog* cachingDialog;
167 #endif // XDXFPLUGIN_H