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 GooglePlugin.h
25 #ifndef GOOGLEPLUGIN_H
26 #define GOOGLEPLUGIN_H
35 #include "../../../includes/CommonDictInterface.h"
36 #include "../../../includes/settings.h"
37 #include "../../../includes/DictDialog.h"
38 #include "TranslationGoogle.h"
39 #include "GoogleDictDialog.h"
41 class GoogleDictDialog;
43 class GooglePlugin : public CommonDictInterface
46 Q_INTERFACES(CommonDictInterface)
48 GooglePlugin(QObject *parent=0);
51 //! returns source language code iso 639-2
52 QString langFrom() const;
54 //! returns destination language code iso 639-2
55 QString langTo() const;
57 //! returns dictionary name (like "old english" or so)
60 //! returns dictionary type (xdxf, google translate, etc)
63 //! returns information about dictionary in html (name, authors, etc)
64 QString infoNote() const;
66 void setLangTo(QString langTo);
68 void setLangFrom(QString langFrom);
70 /*! returns DictDialog object that creates dialogs
71 for adding new dictionary and change plugin tings
73 DictDialog* dictDialog();
75 //! returns new, clean copy of plugin with setting set as in Settings*
76 CommonDictInterface* getNew(const Settings*) const;
78 //! returns whether plugin can start searching
79 bool isAvailable() const;
81 //! returns a description of a word given by a QString
82 QString search(QString key);
84 //! returns a unique hash for a dictionary
87 //! set unique value (unique for every dictionary not plugin)
90 //! returns current plugin settings
94 void setSettings(Settings*);
96 //! returns plugin icon
99 Translation* getTranslationFor(QString key);
101 static QMap<QString, QString> initLanguages();
104 /*! performs search in dictionary
105 \param word word to search in dictionary
106 \param limit limit on number of results
108 After finishing search it has to emit
109 \see CommonDictInterface:finalTranslation finalTranslation
111 QList<Translation*> searchWordList(QString word, int limit=0);
113 //! stop current operation
119 QString jsonParse(QString result);
120 void getDictionaryInfo();
122 QMap<QString, QString> languages;
123 //! language from which we translate
125 //! language to which we translate
127 //! name of a dictionary
129 //! type of a dictionary
131 //! information about dictionary
133 //! path to dictionary file
141 GoogleDictDialog *_dictDialog;
144 #endif // GOOGLEPLUGIN_H