detect a disconect error in GooglePlugin
authorJakub Jaszczynski <j.j.jaszczynski@gmail.com>
Thu, 26 Aug 2010 06:35:37 +0000 (08:35 +0200)
committerJakub Jaszczynski <j.j.jaszczynski@gmail.com>
Thu, 26 Aug 2010 06:35:37 +0000 (08:35 +0200)
12 files changed:
trunk/src/base/gui/TranslationWidget.cpp
trunk/src/base/gui/WordListWidget.cpp
trunk/src/plugins/google/src/GoogleDictDialog.cpp
trunk/src/plugins/google/src/GoogleDictDialog.h
trunk/src/plugins/google/src/GooglePlugin.cpp
trunk/src/plugins/google/src/GooglePlugin.h
trunk/src/plugins/google/src/GoogleSettingsDialog.cpp
trunk/src/plugins/google/src/GoogleSettingsDialog.h
trunk/src/plugins/google/src/TranslationGoogle.cpp
trunk/src/plugins/google/src/TranslationGoogle.h
trunk/src/plugins/xdxf/src/TranslationXdxf.cpp
trunk/src/plugins/xdxf/src/xdxfplugin.cpp

index 5281197..5699587 100644 (file)
@@ -48,7 +48,7 @@ TranslationWidget::TranslationWidget(QWidget *parent):
 
     QFile file(":/xsl/xsl.xsl");
     if(!file.open(QFile::ReadOnly))
-        qDebug()<<"can't open a xslt file";
+        qDebug()<<"error can't open a xslt file";
     else
         xslt=file.readAll();
 }
index 02aba20..59f4724 100644 (file)
@@ -111,7 +111,7 @@ void WordListWidget::showSearchResults(
 
 void WordListWidget::wordClicked(QModelIndex index) {
     //we're getting translation based on data in index
-    qDebug()<<searchResult[index.data().toString()].at(0)->dictionaryInfo();
+    //qDebug()<<searchResult[index.data().toString()].at(0)->dictionaryInfo();
     Q_EMIT showTranslation(
             searchResult[index.data().toString()]);
 }
index 87667b8..a4125c4 100644 (file)
@@ -1,3 +1,28 @@
+/*******************************************************************************
+
+    This file is part of mDictionary.
+
+    mDictionary is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    mDictionary is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+
+    Copyright 2010 Comarch S.A.
+
+*******************************************************************************/
+
+/*! \file GoogleDictDialog.cpp
+    \author Jakub Jaszczynski <j.j.jaszczynski@gmail.com>
+*/
+
 #include "GoogleDictDialog.h"
 
 GoogleDictDialog::GoogleDictDialog(GooglePlugin *plugin, QObject *parent) :
@@ -10,7 +35,6 @@ Settings* GoogleDictDialog::addNewDictionary(QWidget *parent) {
 }
 
 void GoogleDictDialog::changeSettings(QWidget * parent) {
-    qDebug()<<"tu";
     GoogleSettingsDialog::changeSettings(plugin,parent);
 }
 
index 0562848..d62e1f1 100644 (file)
@@ -1,3 +1,30 @@
+/*******************************************************************************
+
+    This file is part of mDictionary.
+
+    mDictionary is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    mDictionary is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+
+    Copyright 2010 Comarch S.A.
+
+*******************************************************************************/
+
+/*! \file GoogleDictDialog.h
+    \brief Class launch a dialogs witch generete new dictionary, or change
+    settings
+    \author Jakub Jaszczynski <j.j.jaszczynski@gmail.com>
+*/
+
 #ifndef GOOGLEDICTDIALOG_H
 #define GOOGLEDICTDIALOG_H
 
@@ -14,7 +41,7 @@ class GoogleDictDialog : public DictDialog
 public:
     explicit GoogleDictDialog(GooglePlugin* plugin, QObject *parent = 0);
     /*!
-      Shows add new xdxf dictionary dialog and returns settings of new dict
+      Shows add new google dictionary dialog and returns settings of new dict
       \param parent parent widget on which will be displayed dialog
       */
     Settings* addNewDictionary(QWidget *parent);
index b07c48f..bc6995c 100644 (file)
@@ -20,6 +20,7 @@
 *******************************************************************************/
 
 /*! \file GooglePlugin.cpp
+    \author Jakub Jaszczynski <j.j.jaszczynski@gmail.com>
 */
 
 #include "GooglePlugin.h"
@@ -155,7 +156,11 @@ QList<Translation*> GooglePlugin::searchWordList(QString word, int limit) {
     http->setHost("www.google.pl");
     wait=true;
     http->request(head, data);
-    while(wait);
+    QString error("");
+    while(wait && (error=="" || error=="Unknown error"))
+        error=http->errorString();
+    if(error!="" && error!="Unknown error")
+        qDebug()<<error;
 
     QString text = QString::fromUtf8(http->readAll());
     text=jsonParse(text);
@@ -170,7 +175,6 @@ QString GooglePlugin::jsonParse(QString result) {
     int pos=0,pos2=0;
     int index=0;
     int size=0;
-    qDebug()<<result;
     QString returnLang;
     QString translation;
     QString original;
@@ -218,7 +222,7 @@ QString GooglePlugin::jsonParse(QString result) {
     returnLang=list1.at(index*2+1);
     if(partOfSpeach.size()==0){
         if(translation==original){
-            qDebug()<<"This word don't exist";
+ //           qDebug()<<"This word don't exist";
             return QString("");
         }
         else
index c5e4105..bb74daf 100644 (file)
 
 *******************************************************************************/
 
-
 /*! \file GooglePlugin.h
+
+    \author Jakub Jaszczynski <j.j.jaszczynski@gmail.com>
 */
+
 #ifndef GOOGLEPLUGIN_H
 #define GOOGLEPLUGIN_H
 
index fa91324..2ec2a14 100644 (file)
@@ -1,3 +1,28 @@
+/*******************************************************************************
+
+    This file is part of mDictionary.
+
+    mDictionary is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    mDictionary is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+
+    Copyright 2010 Comarch S.A.
+
+*******************************************************************************/
+
+/*! \file GoogleSettingsDialog.cpp
+    \author Jakub Jaszczynski <j.j.jaszczynski@gmail.com>
+*/
+
 #include "GoogleSettingsDialog.h"
 #include <QDebug>
 
@@ -110,12 +135,10 @@ void GoogleSettingsDialog::changeLangButtonClicked() {
 }
 
 QString GoogleSettingsDialog::langFrom() {
-    qDebug()<<_langFrom;
     return _langFrom;
 }
 
 QString GoogleSettingsDialog::langTo() {
-    qDebug()<<_langTo;
     return _langTo;
 }
 
@@ -127,7 +150,6 @@ Settings* GoogleSettingsDialog::getSettings(QWidget *parent,QString langTo,QStri
         Settings *settings = new Settings();
         settings->setValue("langTo",languages.value(settingsDialog.langTo()));
         settings->setValue("langFrom",languages.value(settingsDialog.langFrom()));
-         qDebug()<<"gosc" << settings->value("langTo") <<settings->value("langFrom");
         return settings;
     }
     return 0;
index 7344427..1113904 100644 (file)
@@ -1,3 +1,29 @@
+/*******************************************************************************
+
+    This file is part of mDictionary.
+
+    mDictionary is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    mDictionary is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+
+    Copyright 2010 Comarch S.A.
+
+*******************************************************************************/
+
+/*! \file GoogleSettingsDialog.h
+    \brief Class create dialog to get or change settings for Google Plagin
+    \author Jakub Jaszczynski <j.j.jaszczynski@gmail.com>
+*/
+
 #ifndef GOOGLESETTINGSDIALOG_H
 #define GOOGLESETTINGSDIALOG_H
 
@@ -14,9 +40,25 @@ class GoogleSettingsDialog : public QDialog
 public:
     explicit GoogleSettingsDialog(QWidget *parent = 0,QString langTo ="",QString langFrom ="");
 
+    /*!
+        \param parent parent widget on which will be displayed dialog
+        \param langTo language witch is display in the comboBox as a startup item
+        \param langFrom language witch is display in the comboBox as a startup item
+        \returns function return settings to GooglePlugin
+    */
     static Settings* getSettings(QWidget *parent,QString langTo ="",QString langFrom ="");
+
+    /*!
+        function set a new settings in plugin;
+        \param plugin plugin whose settings you will change
+        \param parent parent widget on which will be displayed dialog
+    */
     static void changeSettings(GooglePlugin* plugin, QWidget *parent);
+
+    //! \return source language code iso 639-2
     QString langFrom();
+
+    //! \return destination language code iso 639-2
     QString langTo();
 
 public slots:
index d8c33dc..2ee8a63 100644 (file)
@@ -1,3 +1,28 @@
+/*******************************************************************************
+
+    This file is part of mDictionary.
+
+    mDictionary is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    mDictionary is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+
+    Copyright 2010 Comarch S.A.
+
+*******************************************************************************/
+
+/*! \file TranslationGoogle.cpp
+    \author Jakub Jaszczynski <j.j.jaszczynski@gmail.com>
+*/
+
 #include "TranslationGoogle.h"
 
 TranslationGoogle::TranslationGoogle():_key(""),_trans(""),_dictionaryInfo("") {
index 0ce3a90..08b5530 100644 (file)
@@ -1,3 +1,28 @@
+/*******************************************************************************
+
+    This file is part of mDictionary.
+
+    mDictionary is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    mDictionary is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+
+    Copyright 2010 Comarch S.A.
+
+*******************************************************************************/
+
+/*! \file TranslationGoogle.h
+    \author Jakub Jaszczynski <j.j.jaszczynski@gmail.com>
+*/
+
 #ifndef TRANSLATIONGOOGLE_H
 #define TRANSLATIONGOOGLE_H
 
index 10b3a66..b220398 100644 (file)
@@ -19,6 +19,7 @@
 
 *******************************************************************************/
 /*! \file TranslationXdxf.cpp
+    \author Jakub Jaszczynski <j.j.jaszczynski@gmail.com>
 */
 
 
index 450d209..0cc32e7 100644 (file)
@@ -20,6 +20,7 @@
 *******************************************************************************/
 
 /*! \file xdxfplugin.cpp
+\author Jakub Jaszczynski <j.j.jaszczynski@gmail.com>
 */
 
 #include "xdxfplugin.h"