From 1ca94b3e0480aa432eac4189e46318344e0f604b Mon Sep 17 00:00:00 2001 From: Jakub Jaszczynski Date: Thu, 26 Aug 2010 08:35:37 +0200 Subject: [PATCH] detect a disconect error in GooglePlugin --- trunk/src/base/gui/TranslationWidget.cpp | 2 +- trunk/src/base/gui/WordListWidget.cpp | 2 +- trunk/src/plugins/google/src/GoogleDictDialog.cpp | 26 +++++++++++- trunk/src/plugins/google/src/GoogleDictDialog.h | 29 +++++++++++++- trunk/src/plugins/google/src/GooglePlugin.cpp | 10 +++-- trunk/src/plugins/google/src/GooglePlugin.h | 4 +- .../plugins/google/src/GoogleSettingsDialog.cpp | 28 +++++++++++-- .../src/plugins/google/src/GoogleSettingsDialog.h | 42 ++++++++++++++++++++ trunk/src/plugins/google/src/TranslationGoogle.cpp | 25 ++++++++++++ trunk/src/plugins/google/src/TranslationGoogle.h | 25 ++++++++++++ trunk/src/plugins/xdxf/src/TranslationXdxf.cpp | 1 + trunk/src/plugins/xdxf/src/xdxfplugin.cpp | 1 + 12 files changed, 184 insertions(+), 11 deletions(-) diff --git a/trunk/src/base/gui/TranslationWidget.cpp b/trunk/src/base/gui/TranslationWidget.cpp index 5281197..5699587 100644 --- a/trunk/src/base/gui/TranslationWidget.cpp +++ b/trunk/src/base/gui/TranslationWidget.cpp @@ -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(); } diff --git a/trunk/src/base/gui/WordListWidget.cpp b/trunk/src/base/gui/WordListWidget.cpp index 02aba20..59f4724 100644 --- a/trunk/src/base/gui/WordListWidget.cpp +++ b/trunk/src/base/gui/WordListWidget.cpp @@ -111,7 +111,7 @@ void WordListWidget::showSearchResults( void WordListWidget::wordClicked(QModelIndex index) { //we're getting translation based on data in index - qDebug()<dictionaryInfo(); + //qDebug()<dictionaryInfo(); Q_EMIT showTranslation( searchResult[index.data().toString()]); } diff --git a/trunk/src/plugins/google/src/GoogleDictDialog.cpp b/trunk/src/plugins/google/src/GoogleDictDialog.cpp index 87667b8..a4125c4 100644 --- a/trunk/src/plugins/google/src/GoogleDictDialog.cpp +++ b/trunk/src/plugins/google/src/GoogleDictDialog.cpp @@ -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 . + + Copyright 2010 Comarch S.A. + +*******************************************************************************/ + +/*! \file GoogleDictDialog.cpp + \author Jakub Jaszczynski +*/ + #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); } diff --git a/trunk/src/plugins/google/src/GoogleDictDialog.h b/trunk/src/plugins/google/src/GoogleDictDialog.h index 0562848..d62e1f1 100644 --- a/trunk/src/plugins/google/src/GoogleDictDialog.h +++ b/trunk/src/plugins/google/src/GoogleDictDialog.h @@ -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 . + + Copyright 2010 Comarch S.A. + +*******************************************************************************/ + +/*! \file GoogleDictDialog.h + \brief Class launch a dialogs witch generete new dictionary, or change + settings + \author Jakub Jaszczynski +*/ + #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); diff --git a/trunk/src/plugins/google/src/GooglePlugin.cpp b/trunk/src/plugins/google/src/GooglePlugin.cpp index b07c48f..bc6995c 100644 --- a/trunk/src/plugins/google/src/GooglePlugin.cpp +++ b/trunk/src/plugins/google/src/GooglePlugin.cpp @@ -20,6 +20,7 @@ *******************************************************************************/ /*! \file GooglePlugin.cpp + \author Jakub Jaszczynski */ #include "GooglePlugin.h" @@ -155,7 +156,11 @@ QList 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()<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()< */ + #ifndef GOOGLEPLUGIN_H #define GOOGLEPLUGIN_H diff --git a/trunk/src/plugins/google/src/GoogleSettingsDialog.cpp b/trunk/src/plugins/google/src/GoogleSettingsDialog.cpp index fa91324..2ec2a14 100644 --- a/trunk/src/plugins/google/src/GoogleSettingsDialog.cpp +++ b/trunk/src/plugins/google/src/GoogleSettingsDialog.cpp @@ -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 . + + Copyright 2010 Comarch S.A. + +*******************************************************************************/ + +/*! \file GoogleSettingsDialog.cpp + \author Jakub Jaszczynski +*/ + #include "GoogleSettingsDialog.h" #include @@ -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") <value("langFrom"); return settings; } return 0; diff --git a/trunk/src/plugins/google/src/GoogleSettingsDialog.h b/trunk/src/plugins/google/src/GoogleSettingsDialog.h index 7344427..1113904 100644 --- a/trunk/src/plugins/google/src/GoogleSettingsDialog.h +++ b/trunk/src/plugins/google/src/GoogleSettingsDialog.h @@ -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 . + + Copyright 2010 Comarch S.A. + +*******************************************************************************/ + +/*! \file GoogleSettingsDialog.h + \brief Class create dialog to get or change settings for Google Plagin + \author Jakub Jaszczynski +*/ + #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: diff --git a/trunk/src/plugins/google/src/TranslationGoogle.cpp b/trunk/src/plugins/google/src/TranslationGoogle.cpp index d8c33dc..2ee8a63 100644 --- a/trunk/src/plugins/google/src/TranslationGoogle.cpp +++ b/trunk/src/plugins/google/src/TranslationGoogle.cpp @@ -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 . + + Copyright 2010 Comarch S.A. + +*******************************************************************************/ + +/*! \file TranslationGoogle.cpp + \author Jakub Jaszczynski +*/ + #include "TranslationGoogle.h" TranslationGoogle::TranslationGoogle():_key(""),_trans(""),_dictionaryInfo("") { diff --git a/trunk/src/plugins/google/src/TranslationGoogle.h b/trunk/src/plugins/google/src/TranslationGoogle.h index 0ce3a90..08b5530 100644 --- a/trunk/src/plugins/google/src/TranslationGoogle.h +++ b/trunk/src/plugins/google/src/TranslationGoogle.h @@ -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 . + + Copyright 2010 Comarch S.A. + +*******************************************************************************/ + +/*! \file TranslationGoogle.h + \author Jakub Jaszczynski +*/ + #ifndef TRANSLATIONGOOGLE_H #define TRANSLATIONGOOGLE_H diff --git a/trunk/src/plugins/xdxf/src/TranslationXdxf.cpp b/trunk/src/plugins/xdxf/src/TranslationXdxf.cpp index 10b3a66..b220398 100644 --- a/trunk/src/plugins/xdxf/src/TranslationXdxf.cpp +++ b/trunk/src/plugins/xdxf/src/TranslationXdxf.cpp @@ -19,6 +19,7 @@ *******************************************************************************/ /*! \file TranslationXdxf.cpp + \author Jakub Jaszczynski */ diff --git a/trunk/src/plugins/xdxf/src/xdxfplugin.cpp b/trunk/src/plugins/xdxf/src/xdxfplugin.cpp index 450d209..0cc32e7 100644 --- a/trunk/src/plugins/xdxf/src/xdxfplugin.cpp +++ b/trunk/src/plugins/xdxf/src/xdxfplugin.cpp @@ -20,6 +20,7 @@ *******************************************************************************/ /*! \file xdxfplugin.cpp +\author Jakub Jaszczynski */ #include "xdxfplugin.h" -- 1.7.9.5