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
34 #include <QSqlDatabase>
37 #include <QXmlStreamReader>
40 #include "../../common/CommonDictInterface.h"
41 #include "../../common/settings.h"
42 #include "XdxfDictDialog.h"
43 #include "XdxfCachingDialog.h"
44 #include "TranslationXdxf.h"
46 class TranslationXdxf;
48 class XdxfPlugin : public CommonDictInterface
51 Q_INTERFACES(CommonDictInterface)
53 XdxfPlugin(QObject *parent=0);
57 //! returns source language code iso 639-2
58 QString langFrom() const;
60 //! returns destination language code iso 639-2
61 QString langTo() const;
63 //! returns dictionary name (like "old English" or so)
66 //! returns dictionary type (xdxf, google translate, etc)
69 //! returns information about dictionary in html (name, authors, etc)
70 QString infoNote() const;
72 /*! returns DictDialog object that creates dialogs
73 for adding new dictionary and changing plugin things
75 DictDialog* dictDialog();
77 //! returns new, clean copy of plugin with settings set as in Settings*
78 CommonDictInterface* getNew(const Settings*) const;
80 //! returns whether plugin can start searching
81 bool isAvailable() const;
83 //! returns a description of a word given by a QString
84 QString search(QString key);
86 //! returns a unique hash for a dictionary
89 //! sets unique value (unique for every dictionary, not plugin)
92 //! returns current plugin settings
95 //! returns words count in dictionary
99 bool setSettings(const Settings*);
101 //! returns plugin icon
104 /*! plugin should delete any files (eg. cache) that have been created and are ready
112 /*! performs search in dictionary
113 \param word word to search in dictionary
114 \param limit limit on number of results
116 After finishing search it has to emit
117 \see CommonDictInterface:finalTranslation finalTranslation
119 QList<Translation*> searchWordList(QString word, int limit=0);
121 //! stop current operation
129 //! emitted with percent count of caching progress, and time elapsed from
131 void updateCachingProgress(int, int);
136 /*! returns true or false depending on whether the dictionary is cached
137 or not, not implemented yet
141 //! sets the path to dictionary file and adds it to settings
142 // void setPath(QString);
144 QList<Translation*> searchWordListCache(QString word, int limit=0);
146 QList<Translation*> searchWordListFile(QString word, int limit=0);
148 QString searchFile(QString key);
150 QString searchCache(QString key);
152 //! scans dictionary file to get information about it
153 bool getDictionaryInfo();
157 bool makeCache(QString dir);
159 //! language from which we translate
161 //! language to which we translate
163 //! name of a dictionary
165 //! information about dictionary
167 //! path to dictionary file
173 //! number of words in dictionary
175 volatile bool stopped;
177 XdxfDictDialog* _dictDialog;
178 XdxfCachingDialog* cachingDialog;
181 #endif // XDXFPLUGIN_H