detect a disconect error in GooglePlugin
[mdictionary] / trunk / src / plugins / google / src / GooglePlugin.h
index a5e325e..bb74daf 100644 (file)
 
 *******************************************************************************/
 
-
 /*! \file GooglePlugin.h
+
+    \author Jakub Jaszczynski <j.j.jaszczynski@gmail.com>
 */
+
 #ifndef GOOGLEPLUGIN_H
 #define GOOGLEPLUGIN_H
 
 #include <QDialog>
 #include <QtPlugin>
 #include <QIcon>
+#include <QtNetwork>
 
 #include "../../../includes/CommonDictInterface.h"
 #include "../../../includes/settings.h"
+#include "../../../includes/DictDialog.h"
+#include "TranslationGoogle.h"
+#include "GoogleDictDialog.h"
 
+class GoogleDictDialog;
 
 class GooglePlugin : public CommonDictInterface
 {
@@ -58,6 +65,10 @@ public:
     //! returns information about dictionary in html (name, authors, etc)
     QString infoNote() const;
 
+    void setLangTo(QString langTo);
+
+    void setLangFrom(QString langFrom);
+
     /*! returns DictDialog object that creates dialogs
         for adding new dictionary and change plugin tings
       */
@@ -87,7 +98,11 @@ public:
     //! returns plugin icon
     QIcon* icon();
 
-public Q_SLOTS:
+    Translation* getTranslationFor(QString key);
+
+    static QMap<QString, QString> initLanguages();
+
+public slots:
     /*! performs search in dictionary
       \param  word word to search in dictionary
       \param limit limit on number of results
@@ -100,7 +115,13 @@ public Q_SLOTS:
     //! stop current operation
     void stop();
 
+    void done();
+
 private:
+    QString jsonParse(QString result);
+    void getDictionaryInfo();
+
+    QMap<QString, QString> languages;
     //! language from which we translate
     QString _langFrom;
     //! language to which we translate
@@ -117,6 +138,9 @@ private:
     QIcon _icon;
     Settings *_settings;
     bool stopped;
+    volatile bool wait;
+    QHttp *http;
+    GoogleDictDialog *_dictDialog;
 };
 
 #endif // GOOGLEPLUGIN_H