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"
30 #include "XdxfDictDialog.h"
32 class TranslationXdxf;
34 class XdxfPlugin : public CommonDictInterface
37 Q_INTERFACES(CommonDictInterface)
39 XdxfPlugin(QObject *parent=0);
41 //! returns source language code iso 639-2
42 QString langFrom() const;
44 //! returns destination language code iso 639-2
45 QString langTo() const;
47 //! returns dictionary name (like "old english" or so)
50 //! returns dictionary type (xdxf, google translate, etc)
53 //! returns information about dictionary in html (name, authors, etc)
54 QString infoNote() const;
56 /*! returns DictDialog object that creates dialogs
57 for adding new dictionary and change plugin settings
59 DictDialog* dictDialog();
62 //! returns new, clean copy of plugin with setting set as in Settings*
63 CommonDictInterface* getNew(const Settings*) const;
65 //! returns whether plugin can start searching
66 bool isAvailable() const;
68 //! returns a description of a word given by a QString
69 QString search(QString key);
71 //! returns a unique hash for a dictionary
74 //! set unique value (unique for every dictionary not plugin)
77 //! returns current plugin settings
80 //! returns words count in dictionary
84 void setSettings(Settings*);
86 //! returns plugin icon
87 virtual QIcon* icon();
90 /*! performs search in dictionary
91 \param word word to search in dictionary
92 \param limit limit on number of results
94 After finishing search it has to emit
95 \see CommonDictInterface:finalTranslation finalTranslation
97 QList<Translation*> searchWordList(QString word, int limit=0);
99 //! stop current operation
104 QString removeAccents(QString);
107 /*! returns true or false depending on whether the dictionary is cached
108 or not, not implemented yet
112 //! sets the path to dictionary file and adds it to settings
113 void setPath(QString);
115 QList<Translation*> searchWordListCache(QString word, int limit=0);
116 QList<Translation*> searchWordListFile(QString word, int limit=0);
118 //! language from which we translate
120 //! language to which we translate
122 //! name of a dictionary
124 //! type of a dictionary
126 //! information about dictionary
128 QDialog *_loadDialog;
129 QDialog *_settingsDialog;
130 //! path to dictionary file
135 //! number of words in dicrionary
138 //! scan dictionary file to get information about it
139 void getDictionaryInfo();
141 volatile bool stopped;
143 XdxfDictDialog* _dictDialog;
146 #endif // XDXFPLUGIN_H