fix small bug(wildcard), and change some comments
authorjakub <jakub.jaszczynski@comarch.com>
Thu, 18 Nov 2010 15:31:46 +0000 (16:31 +0100)
committerjakub <jakub.jaszczynski@comarch.com>
Thu, 18 Nov 2010 15:31:46 +0000 (16:31 +0100)
37 files changed:
src/mdictionary/backbone/BookmarkTranslations.h
src/mdictionary/backbone/Bookmarks.cpp
src/mdictionary/backbone/Bookmarks.h
src/mdictionary/backbone/ConfigGenerator.cpp
src/mdictionary/backbone/ConfigGenerator.h
src/plugins/stardict/CompressedReader.cpp
src/plugins/stardict/CompressedReader.h
src/plugins/stardict/StarDialog.cpp
src/plugins/stardict/StarDialog.h
src/plugins/stardict/StarDictDialog.cpp
src/plugins/stardict/StarDictDialog.h
src/plugins/stardict/StarDictPlugin.cpp
src/plugins/stardict/StarDictPlugin.h
src/plugins/stardict/StarDictReader.h
src/plugins/stardict/StarDictReaderFactory.cpp
src/plugins/stardict/StarDictReaderFactory.h
src/plugins/stardict/TranslationStarDict.cpp
src/plugins/stardict/TranslationStarDict.h
src/plugins/stardict/UncompressedReader.cpp
src/plugins/stardict/UncompressedReader.h
src/plugins/xdxf/DictsModel.cpp
src/plugins/xdxf/DictsModel.h
src/plugins/xdxf/HttpDownloader.cpp
src/plugins/xdxf/TranslationXdxf.cpp
src/plugins/xdxf/XdxfCachingDialog.cpp
src/plugins/xdxf/XdxfDialog.cpp
src/plugins/xdxf/XdxfDialog.h
src/plugins/xdxf/XdxfDictDialog.cpp
src/plugins/xdxf/XdxfDictDialog.h
src/plugins/xdxf/XdxfDictDownloadProgressDialog.cpp
src/plugins/xdxf/XdxfDictDownloadProgressDialog.h
src/plugins/xdxf/XdxfDictDownloader.cpp
src/plugins/xdxf/XdxfDictDownloader.h
src/plugins/xdxf/XdxfDictSelectDialog.cpp
src/plugins/xdxf/XdxfDictSelectDialog.h
src/plugins/xdxf/xdxfplugin.cpp
src/plugins/xdxf/xdxfplugin.h

index 286a7af..4101e91 100644 (file)
 
 *******************************************************************************/
 
-/*! \file BookmarkTranslation.h
-\brief Bookmarks functionality needs its own translation object - because
+/*!
+    \file BookmarkTranslation.h
+    \brief Bookmarks functionality needs its own translation object - because
     Translation object should use slightly different api of Bookmarks objects
 
-\author Bartosz Szatkowski <bulislaw@linux.com>
+    \author Bartosz Szatkowski <bulislaw@linux.com>
 */
 #ifndef BOOKMARKTRANSLATIONS_H
 #define BOOKMARKTRANSLATIONS_H
@@ -63,8 +64,10 @@ public:
 
     }
 
-    /*! sets the word for which we want to find a translation
-        \param word for which we want to find a translation */
+    /*!
+        sets the word for which we want to find a translation
+        \param word for which we want to find a translation
+    */
     void setKey(QString key) {
         _key = key;
     }
index 56d8020..645e9ad 100644 (file)
@@ -23,7 +23,6 @@ QSqlDatabase Bookmarks::getDbCnx(){
 }
 
 
-
 bool Bookmarks::checkAndCreateDb(QString dbName) {
     QSqlDatabase db = QSqlDatabase::database();
     if(dbName.size())
@@ -37,7 +36,6 @@ bool Bookmarks::checkAndCreateDb(QString dbName) {
 }
 
 
-
 void Bookmarks::clear() {
     checkAndCreateDb();
     QSqlDatabase db = getDbCnx();
@@ -51,7 +49,6 @@ void Bookmarks::clear() {
 }
 
 
-
 void Bookmarks::add(Translation* translation) {
     if (!translation)
         return ;
@@ -70,6 +67,7 @@ void Bookmarks::add(Translation* translation) {
     cur.exec();
 }
 
+
 void Bookmarks::add(QString key,QString removeAccentKey,QString value){
     checkAndCreateDb();
     QSqlDatabase db = getDbCnx();
@@ -102,7 +100,6 @@ void Bookmarks::remove(Translation* translation) {
 }
 
 
-
 QList<Translation*> Bookmarks::list() {
     checkAndCreateDb();
     QList<Translation*> res;
@@ -120,7 +117,6 @@ QList<Translation*> Bookmarks::list() {
 }
 
 
-
 QList<Translation*> Bookmarks::searchWordList(QString word) {
     checkAndCreateDb();
     if(word.indexOf("*")==-1 && word.indexOf("?")== -1)
@@ -148,7 +144,6 @@ QList<Translation*> Bookmarks::searchWordList(QString word) {
 }
 
 
-
 QStringList Bookmarks::search(QString word, QString dbName) {
     QStringList result;
     QSqlDatabase db = QSqlDatabase::database();
@@ -168,8 +163,6 @@ QStringList Bookmarks::search(QString word, QString dbName) {
 }
 
 
-
-
 bool Bookmarks::inBookmarks(QString word) {
     if(!mdb.isOpen() && !mdb.open()) {
         qDebug() << "Database error: " << mdb.lastError().text() << endl;
index 1731499..986f225 100644 (file)
 
 *******************************************************************************/
 
-/*! \file Bookmarks.h
-\brief Bookmarks functionality - marking words as favorite, managing marked
+/*!
+    \file Bookmarks.h
+    \brief Bookmarks functionality - marking words as favorite, managing marked
     words, searching in marked words (with cached translations)
 
-
-\author Bartosz Szatkowski <bulislaw@linux.com>
+    \author Bartosz Szatkowski <bulislaw@linux.com>
 */
 
 #ifndef BOOKMARKS_H
 class BookmarkTranslation;
 
 
-/*! Bookmarks are a way to store words that You think You will need to search
-  for often.
+/*!
+    Bookmarks are a way to store words that You think You will need to search
+    for often.
 
-  When You add a bookmark (by clicking on "star" in words list) You add it to
-  a special list with cached translations from all available dictionaries so
-  You can search for them quickly even when You delete corresponding dict.
-  */
+    When You add a bookmark (by clicking on "star" in words list) You add it to
+    a special list with cached translations from all available dictionaries so
+    You can search for them quickly even when You delete corresponding dict.
+*/
 class Bookmarks : public AccentsNormalizer {
 public:
     Bookmarks();
     ~Bookmarks();
 
-    /*! Adds new word and translation to bookmarks
-      \param translation new translation to be saved and cached as a bookmark
+    /*!
+        Adds new word and translation to bookmarks
+        \param translation new translation to be saved and cached as a bookmark
     */
     void add(Translation* translation);
 
     void add(QString key,QString removeAccentKey,QString value);
 
-    /*! Removes word and corresponding translation cache from bookmarks list
+    /*!
+        Removes word and corresponding translation cache from bookmarks list
         \param translation translation to be removed
     */
     void remove(Translation* translation);
 
-    /*! \return all bookmarks (word and translation as a translation object
-     as a list)
-     */
+    /*!
+        \return all bookmarks (word and translation as a translation object
+        as a list)
+    */
     QList<Translation*> list();
 
-    /*! Searches in bookmarks for a given word (wildcards may apply '*' and '?')
-      \param word word to search for
-      \return list of matching Translation objects
-      */
+    /*!
+        Searches in bookmarks for a given word (wildcards may apply '*' and '?')
+        \param word word to search for
+        \return list of matching Translation objects
+    */
     QList<Translation*> searchWordList(QString word);
 
-    /*! Searches for final translation of a given word
-      \return word translation list in text format xml to be formatted
+    /*!
+        Searches for final translation of a given word
+        \return word translation list in text format xml to be formatted
         and displayed
-      \param word word to search for
-      */
+        \param word word to search for
+    */
     QStringList search(QString word, QString dbname);
 
-
-    /*! Clears bookmarks database */
+    /*!
+        Clears bookmarks database
+    */
     void clear();
 
-
-    /*! \return true if a given word is already in bookmarks
-      \param word word to check
-      */
+    /*!
+        \return true if a given word is already in bookmarks
+        \param word word to check
+    */
     bool inBookmarks(QString word);
 
 private:
index 704a6ba..f095616 100644 (file)
 
 *******************************************************************************/
 
-/*! \file ConfigGenerator.cpp
-\brief Generating default config files, css stylesheet etc
+/*!
+    \file ConfigGenerator.cpp
+    \brief Generating default config files, css stylesheet etc
 
-\author Bartosz Szatkowski <bulislaw@linux.com>
+    \author Bartosz Szatkowski <bulislaw@linux.com>
 */
 
 #include "ConfigGenerator.h"
 #include <QDebug>
 
+
 bool ConfigGenerator::generateCss(QString file) {
     generateFile(":/xsl/style.css", file);
 }
 
 
-
 bool ConfigGenerator::generateDefaultConfig(QString file) {
     return generateFile(":/config/mdictionary.config", file);
 }
 
 
-
 bool ConfigGenerator::generateFile(QString source, QString file) {
     QFile _file(file);
     if(_file.exists())
index caeda4c..7edabfe 100644 (file)
 
 *******************************************************************************/
 
-/*! \file ConfigGenerator.h
-\brief Generating default config files, css stylesheet etc
+/*!
+    \file ConfigGenerator.h
+    \brief Generating default config files, css stylesheet etc
 
-\author Bartosz Szatkowski <bulislaw@linux.com>
+    \author Bartosz Szatkowski <bulislaw@linux.com>
 */
 
 #ifndef CONFIGGENERATOR_H
 #include <QString>
 #include <QDebug>
 
-/*! ConfigGenerator generates configuration files (with default values),
-if a given file doesn't exist.
+/*!
+    ConfigGenerator generates configuration files (with default values),
+    if a given file doesn't exist.
 */
 class ConfigGenerator {
 
 public:
-    /*! Generates default css stylesheet for xslt transformations
+    /*!
+        Generates default css stylesheet for xslt transformations
         \param file file to be generated
         \return if file was generated - returns true; if file alredy exists
-            returns true; if file doesn't exist but cannot be generated returns false
+        returns true; if file doesn't exist but cannot be generated returns false
     */
     bool generateCss(QString file);
 
-
     /*! Generates default configuration files
         \param file file to be generated
         \return if file was generated - returns true; if file already exists
-            returns true; if file doesn't exist but cannot be generated returns false
+        returns true; if file doesn't exist but cannot be generated returns false
     */
     bool generateDefaultConfig(QString file);
 
index dae4b2e..a8db470 100644 (file)
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-
-//Created by Mateusz Półrola
+/*!
+    \file CompressedReader.cpp
+    \author Mateusz Półrola
+*/
 
 #include "CompressedReader.h"
 #include <QtEndian>
@@ -61,29 +63,17 @@ QChar CompressedReader::readChar() {
     QString cha;
 
     gzread(_file, c, 1);
-    if(((unsigned char)c[0])>240)
+    if(((unsigned char)c[0])>239)
         gzread(_file, c+1, 3);
-    else if(((unsigned char)c[0])>224)
+    else if(((unsigned char)c[0])>223)
         gzread(_file, c+1, 2);
-    else if(((unsigned char)c[0])>192)
+    else if(((unsigned char)c[0])>191)
         gzread(_file, c+1, 1);
     else if(((unsigned char)c[0])>127){
         qDebug()<<"error - starDict - read wordList from UTF-8";
         c[0]=0;
     }
 
-
- /*   gzread(_file, c, 1);
-    if(((unsigned char)c[0])>127){
-        gzread(_file, c+1, 1);
-        if(((unsigned char)c[1])>127 && ((unsigned char)c[1])<192){
-            gzread(_file, c+2, 1);
-            if(((unsigned char)c[2])>127 && ((unsigned char)c[2])<192)
-                gzread(_file, c+3, 1);
-        }
-    }
-*/
-
     cha=QString::fromUtf8(c);
     return cha.at(0);
 }
index 56aaf0b..32bc459 100644 (file)
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-
-//Created by Mateusz Półrola
+/*!
+    \file CompressedReader.cpp
+    \author Mateusz Półrola
+*/
 
 #ifndef COMPRESSEDREADER_H
 #define COMPRESSEDREADER_H
@@ -39,13 +41,11 @@ class CompressedReader : public StarDictReader
     Q_OBJECT
 public:
     CompressedReader(QObject *parent = 0);
-    /*!
-        Creates new compressed reader and open file with passed filename
-    */
+
+    //! Creates new compressed reader and open file with passed filename
     CompressedReader(QString filename, QObject *parent = 0);
-    /*!
-        Destructs object and closing file
-    */
+
+    //! Destructs object and closing file
     ~CompressedReader();
 
     /*!
@@ -75,9 +75,7 @@ public:
     QString readKeyword();
 
 
-    /*!
-        Closing file;
-    */
+    //! Closing file;
     void close();
 
 protected:
@@ -87,9 +85,7 @@ protected:
     */
     bool open(QString file);
 
-    /*!
-        Reads single char from compressed.
-    */
+    //! Reads single char from compressed.
     QChar readChar();
 
 private:
index da50275..79018fd 100644 (file)
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-
-//Created by Mateusz Półrola
+/*!
+    \file StarDialog.cpp
+    \author Mateusz Półrola <mateusz.polrola@gmail.com>
+*/
 
 #include "StarDialog.h"
 #include <QDebug>
@@ -91,8 +93,8 @@ void StarDialog::initializeUI() {
     #else
         if(type==New) {
             infoLabel->setMinimumWidth(200);
-            setMinimumSize(sizeHint().width()*1.5, sizeHint().height()*1.2);
-            setMaximumSize(sizeHint().width()*1.7, sizeHint().height()*1.5);
+//            setMinimumSize(sizeHint().width()*1.5, sizeHint().height()*1.2);
+//            setMaximumSize(sizeHint().width()*1.7, sizeHint().height()*1.5);
             scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
         }
     #endif
@@ -187,7 +189,6 @@ bool StarDialog::checkFiles() {
             _dictName = _dictionaryFilePath.left(_dictionaryFilePath.lastIndexOf("."));
         }
 
-
         if (QFile::exists(_dictName + ".idx") == false
                 && QFile::exists(_dictName + ".idx.gz") == false) {
             return false;
index babd8c0..aef9986 100644 (file)
@@ -18,9 +18,8 @@
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-
 /*!
-    \file XdxfDialog.cpp
+    \file StarDialog.h
     \author Mateusz Półrola <mateusz.polrola@gmail.com>
 */
 
@@ -79,9 +78,11 @@ Q_SIGNALS:
     void notify(Notify::NotifyType, QString);
 
 public Q_SLOTS:
-    //! Reimplemented accept method, to check if all necessary fields in
-    //! dialog are correct e. g. dictionary file path
-    //! and saves new settings
+    /*!
+        Reimplemented accept method, to check if all necessary fields in
+        dialog are correct e. g. dictionary file path
+        and saves new settings
+    */
     void accept();
 
 private Q_SLOTS:
@@ -89,10 +90,13 @@ private Q_SLOTS:
     void selectFile();
 
 private:
+    //! create a user interface
     void initializeUI();
 
     //! saves new settings after acceptance of dialog
     void saveSettings();
+
+    //! check that files is compressed
     bool checkFiles();
 
     QLabel* infoLabel;
index a032c8e..9e16f61 100644 (file)
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-
-/*! \file XdxfDictDialog.cpp
+/*!
+    \file StarDictDialog.cpp
+    \author Mateusz Półrola
 */
-//Created by Mateusz Półrola
 
 #include "StarDictDialog.h"
 #include "StarDictPlugin.h"
index 645c01f..2f0ab7f 100644 (file)
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-/*! \file XdxfDictDialog.h
+/*!
+    \file StarDictDialog.h
+    \author Mateusz Półrola
 */
-//Created by Mateusz Półrola
 
 #ifndef STARDICTDIALOG_H
 #define STARDICTDIALOG_H
@@ -47,8 +48,10 @@ public:
     */
     void changeSettings(QWidget *parent);
 
+    //! return a pointer to parent Dialog
     QWidget* lastDialogParent();
 
+    //! set a pointer to parent Dialog
     void setLastDialogParent(QWidget*);
 
 private:
index c7a2557..b2de6bb 100644 (file)
@@ -18,8 +18,9 @@
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-
-/*! \file stardictplugin.cpp
+/*!
+     \file StarDictPlugin.cpp
+     \author Jakub Jaszczynski
 */
 
 #include "StarDictPlugin.h"
@@ -98,12 +99,13 @@ QList<Translation*> StarDictPlugin::searchWordList(QString word, int limit) {
     QString idxPath = settings()->value("idxFileName");
     StarDictReader * reader = StarDictReaderFactory::createReader(idxPath);
     QString fkey;
-    qint64 offset = 0, len = 0;
-    QRegExp keyword(word, Qt::CaseInsensitive, QRegExp::Wildcard);
+    qint64 offset = 0,
+    len = 0;
 
     if( word.indexOf("*")==-1 && word.indexOf("?")==-1 &&
         word.indexOf("_")==-1 && word.indexOf("%")==-1)
         word+="*";
+    QRegExp keyword(word, Qt::CaseInsensitive, QRegExp::Wildcard);
 
     if((settings()->value("idxoffsetbits") == "32") ||
                          (settings()->value("idxoffsetbits") == ""))
@@ -124,7 +126,7 @@ QList<Translation*> StarDictPlugin::searchWordList(QString word, int limit) {
 
         if(keyword.exactMatch(fkey)) {
             TranslationStarDict tran(fkey, infoNote(), this);
-            qDebug() << "off/len" << offset << len;
+  //          qDebug() << "off/len" << offset << len;
             int id = translations.indexOf(tran);
             if(id == -1) {
                 tran.add(offset, len);
@@ -196,7 +198,7 @@ QString StarDictPlugin::interpret(QByteArray::iterator it,
             result+="</t>";
     }
 
-// Dont know whether mDictionary would ever handle binary stardict format
+// W & P Dont know whether mDictionary would ever handle binary stardict format
 // to be honest dont see any kind of adventages (can't find any binary dict)
  /*
     }
@@ -339,15 +341,4 @@ QIcon* StarDictPlugin::icon() {
     return &_icon;
 }
 
-
-int StarDictPlugin::countWords() {
-    return 0;
-}
-
-
-void StarDictPlugin::clean() {
-
-}
-
-
 Q_EXPORT_PLUGIN2(stardict, StarDictPlugin)
index 48bba05..6fd5d03 100644 (file)
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-
-
-/*! \file xdxfplugin.h
+/*!
+     \file StarDictPlugin.h
+     \author Jakub Jaszczynski
 */
+
 #ifndef STARDICTPLUGIN_H
 #define STARDICTPLUGIN_H
 
@@ -94,9 +95,6 @@ public:
     //! \returns current plugin settings
     Settings* settings();
 
-    //! \returns words count in a dictionary
-    long wordsCount();
-
     //! Sets new settings
     bool setSettings(const Settings*);
 
@@ -107,7 +105,7 @@ public:
         plugin should delete any files (eg. cache) that have been created and are ready
         to be deleted
     */
-    void clean();
+    void clean() {;}
 
 
 
@@ -158,28 +156,6 @@ private:
     //! scans dictionary file to get information about it
     bool getDictionaryInfo();
 
-    //! counts the keys in a starDict file
-    int countWords();
-
-
-    //! language from which we translate
-    QString _langFrom;
-    //! language to which we translate
-    QString _langTo;
-    //! name of a dictionary
-    QString _name;
-    //! information about dictionary
-    QString _infoNote;
-
-    //! icon displayed during translations and when a dictionary is chosen
-    QIcon _icon;
-
-    //! indicates if search is stopped
-    volatile bool stopped;
-    Settings *_settings;
-    StarDictDialog* _dictDialog;
-    Settings* _ifoFileSettings;
-
     /*!
         Reads and process (converting to qstring) data from StarDict dictionary
         file (*.dict[.dz])
@@ -211,6 +187,16 @@ private:
     QString interpret(QByteArray::iterator it, QByteArray::iterator end,
             QChar mode,QString key, bool last = false);
 
+    QString _langFrom;
+    QString _langTo;
+    QString _name;
+    QString _infoNote;
+    QIcon _icon;
+    volatile bool stopped;
+    Settings *_settings;
+    StarDictDialog* _dictDialog;
+    Settings* _ifoFileSettings;
+
     friend class StarDictTests;
 };
 
index c2c67b2..cb267a4 100644 (file)
@@ -18,8 +18,8 @@
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-
 /*!
+    \file StarDictReader.h
     \author Mateusz Półrola <mateusz.polrola@comarch.pl>
  */
 
@@ -57,15 +57,11 @@ public:
     */
     virtual qint64 readInt64BigEndian()=0;
 
-    /*!
-        Reads single string from file, end of string is marked as '\0' in file.
-    */
+    //! Reads single string from file, end of string is marked as '\0' in file.
     virtual QString readKeyword()=0;
 
 
-    /*!
-        Closing file;
-    */
+    //! Closing file;
     virtual void close()=0;
 
 protected:
@@ -75,9 +71,7 @@ protected:
     */
     virtual bool open(QString file)=0;
 
-    /*!
-        Reads single char from file.
-    */
+    //! Reads single char from file.
     virtual QChar readChar()=0;
 
 };
index fc32175..4e3d5ed 100644 (file)
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-
-//Created by Mateusz Półrola
+/*!
+    \file StarDictReaderFactory.cpp
+    \author Mateusz Półrola <mateusz.polrola@comarch.pl>
+ */
 
 #include "StarDictReaderFactory.h"
 #include "CompressedReader.h"
index 31013c6..f052c59 100644 (file)
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-
-//Created by Mateusz Półrola
+/*!
+    \file StarDictReaderFactory.h
+    \author Mateusz Półrola <mateusz.polrola@comarch.pl>
+ */
 
 #ifndef STARDICTREADERFACTORY_H
 #define STARDICTREADERFACTORY_H
index d5fcf87..0867e2c 100644 (file)
@@ -18,7 +18,8 @@
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-/*! \file TranslationStarDict.cpp
+/*!
+    \file TranslationStarDict.cpp
     \author Jakub Jaszczynski <j.j.jaszczynski@gmail.com>
 */
 
index 5c68df9..95309ff 100644 (file)
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-/*! \file TranslationXdxf.h
-*/
+/*!
+    \file TranslationStarDict.h
+    \author Mateusz Półrola <mateusz.polrola@comarch.pl>
+ */
+
 #ifndef TRANSLATIONSTARDICT_H
 #define TRANSLATIONSTARDICT_H
 
@@ -76,8 +79,6 @@ public:
     */
     void add(qint64 offset, qint32 len);
 
-
-
     bool operator==(const TranslationStarDict &key) {
         if (this->key() == key.key())
             return true;
index 5cc4b0e..6c79b9b 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 UncompressedReader.cpp
+    \author Mateusz Półrola <mateusz.polrola@comarch.pl>
+ */
+
 #include "UncompressedReader.h"
 #include "QDebug"
 
@@ -37,25 +62,15 @@ QChar UncompressedReader::readChar() {
     QString cha;
 
     _stream.readRawData(c,1);
-    if(((unsigned char)c[0])>240)
+    if(((unsigned char)c[0])>239)
         _stream.readRawData(c+1,3);
-    else if(((unsigned char)c[0])>224)
+    else if(((unsigned char)c[0])>223)
         _stream.readRawData(c+1,2);
-    else if(((unsigned char)c[0])>192)
+    else if(((unsigned char)c[0])>191)
         _stream.readRawData(c+1,1);
     else if(((unsigned char)c[0])>127)
         qDebug()<<"error - starDict - read wordList from UTF-8";
 
-
- /*   if(((unsigned char)c[0])>127){
-        _stream.readRawData(c+1,1);
-        if(((unsigned char)c[1])>127 && ((unsigned char)c[1])<192){
-            _stream.readRawData(c+2,1);
-            if(((unsigned char)c[2])>127 && ((unsigned char)c[2])<192)
-                _stream.readRawData(c+3,1);
-        }
-    }
- */
     cha=QString::fromUtf8(c);
 
     return cha.at(0);
index af9014f..d247cdb 100644 (file)
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-
-//Created by Mateusz Półrola
+/*!
+    \file UncompressedReader.h
+    \author Mateusz Półrola <mateusz.polrola@comarch.pl>
+ */
 
 #ifndef UNCOMPRESSEDREADER_H
 #define UNCOMPRESSEDREADER_H
@@ -32,7 +34,8 @@
 
 
 /*!
-  Class implementing StarDictReader interface and handling rading from uncompressed files
+  Class implementing StarDictReader interface and handling
+  rading from uncompressed files
 */
 class UncompressedReader : public StarDictReader
 {
@@ -40,14 +43,10 @@ class UncompressedReader : public StarDictReader
 public:
     UncompressedReader(QObject *parent = 0);
 
-    /*!
-        Creates new reader and open file with passed filename
-    */
+    //! Creates new reader and open file with passed filename
     UncompressedReader(QString filename, QObject *parent = 0);
 
-    /*!
-        Destructs object and closing file
-    */
+    //! Destructs object and closing file
     ~UncompressedReader();
 
     /*!
@@ -76,10 +75,7 @@ public:
     */
     QString readKeyword();
 
-
-    /*!
-        Closing file;
-    */
+    //! Closing file;
     void close();
 
 protected:
@@ -89,9 +85,7 @@ protected:
     */
     bool open(QString file);
 
-    /*!
-        Reads single char from compressed.
-    */
+    //! Reads single char from compressed.
     QChar readChar();
 
 private:
index 68987d0..998cdc0 100644 (file)
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-
 /*!
- \file DictsModel.cpp
- \author Mateusz Półrola <mateusz.polrola@comarch.pl>
+    \file DictsModel.cpp
+    \author Mateusz Półrola <mateusz.polrola@comarch.pl>
 */
 
 #include "DictsModel.h"
 
-
 DictsModel::DictsModel(QList<DownloadDict> dicts, QObject *parent) :
-    QAbstractItemModel(parent)
-{
+                       QAbstractItemModel(parent) {
     this->dicts = dicts;
-
     qSort(this->dicts);
 }
 
@@ -40,12 +36,13 @@ int DictsModel::rowCount(const QModelIndex &) const {
     return dicts.count();
 }
 
+
 int DictsModel::columnCount(const QModelIndex &) const {
     return 4;
 }
 
-QVariant DictsModel::data(const QModelIndex &index, int role) const
-{
+
+QVariant DictsModel::data(const QModelIndex &index, int role) const {
     if (!index.isValid())
         return QVariant();
 
@@ -72,9 +69,9 @@ QVariant DictsModel::data(const QModelIndex &index, int role) const
     return QVariant();
 }
 
+
 QVariant DictsModel::headerData(int section, Qt::Orientation orientation,
-                                      int role) const
-{
+                                      int role) const {
     if (role != Qt::DisplayRole)
         return QVariant();
 
@@ -93,10 +90,12 @@ QVariant DictsModel::headerData(int section, Qt::Orientation orientation,
     return QVariant();
 }
 
+
 QModelIndex DictsModel::index(int row, int column, const QModelIndex &) const {
     return createIndex(row, column, row);
 }
 
+
 QModelIndex DictsModel::parent(const QModelIndex &) const {
     return QModelIndex();
 }
index ad83848..cbe3a0e 100644 (file)
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-
 /*!
- \file DictsModel.h
- \author Mateusz Półrola <mateusz.polrola@comarch.pl>
+   \file DictsModel.h
+   \author Mateusz Półrola <mateusz.polrola@comarch.pl>
 */
 
 #ifndef DICTSMODEL_H
index 54f8273..7e6644d 100644 (file)
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-
 /*!
-  \file HttpDownloader.h
-  \author Bartosz Szatkowski <bulislaw@linux.com>
+    \file HttpDownloader.h
+    \author Bartosz Szatkowski <bulislaw@linux.com>
  */
 
-
 #include "HttpDownloader.h"
 
 HttpDownloader::HttpDownloader(QObject *parent) {
@@ -48,12 +46,11 @@ void HttpDownloader::download(QUrl url, QString file) {
     request.setRawHeader("User-Agent", "Wget/1.12 (linux-gnu)");
     currentReply = manager->get(request);
     connect(currentReply, SIGNAL(downloadProgress(qint64,qint64)),
-               this, SIGNAL(progress(qint64,qint64)));
-
+            this, SIGNAL(progress(qint64,qint64)));
 }
 
-void HttpDownloader::downloadFinished(QNetworkReply *reply) {
 
+void HttpDownloader::downloadFinished(QNetworkReply *reply) {
     disconnect(reply, SIGNAL(downloadProgress(qint64,qint64)),
                this, SIGNAL(progress(qint64,qint64)));
     if(reply->error() != QNetworkReply::NoError) {
@@ -71,7 +68,7 @@ void HttpDownloader::downloadFinished(QNetworkReply *reply) {
        req.setUrl(r);
        currentReply = manager->get(req);
        connect(currentReply, SIGNAL(downloadProgress(qint64,qint64)),
-                  this, SIGNAL(progress(qint64,qint64)));
+               this, SIGNAL(progress(qint64,qint64)));
     }
     else {
         QFile resultFile(destFile);
index fe228b5..584114f 100644 (file)
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-/*! \file TranslationXdxf.cpp
+/*!
+    \file TranslationXdxf.cpp
     \author Jakub Jaszczynski <j.j.jaszczynski@gmail.com>
 */
 
-
 #include "TranslationXdxf.h"
 #include <QDebug>
 
@@ -30,6 +30,7 @@ TranslationXdxf::TranslationXdxf():_key(""),_dictionaryInfo("") {
     xdxfPlugin=0;
 }
 
+
 TranslationXdxf::TranslationXdxf(QString _key, QString _dictionaryInfo,
          XdxfPlugin *xdxfPlugin): _key(_key),_dictionaryInfo(_dictionaryInfo) {
     this->xdxfPlugin=xdxfPlugin;
@@ -43,6 +44,7 @@ QString TranslationXdxf::key() const {
     return _key;
 }
 
+
 QString TranslationXdxf::toXml() const { 
     QString result("");
     if(!xdxfPlugin)
@@ -57,11 +59,12 @@ QString TranslationXdxf::toXml() const {
     return result.replace("&","&amp;");
 }
 
+
 void TranslationXdxf::setKey(QString _key) {
     this->_key=_key;
 }
 
+
 void TranslationXdxf::setDictionaryInfo(QString _dictionaryInfo) {
     this->_dictionaryInfo=_dictionaryInfo;
 }
-
index d26e1b5..fce967e 100644 (file)
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-
-/*! \file XdxfCachingDialog.cpp
+/*!
+    \file XdxfCachingDialog.cpp
+    \author Mateusz Półrola
 */
-//Created by Mateusz Półrola
 
 #include "XdxfCachingDialog.h"
 #include "xdxfplugin.h"
@@ -39,8 +39,6 @@ XdxfCachingDialog::XdxfCachingDialog(QWidget *parent): QDialog(parent) {
     cachingProgressBar->setTextVisible(true);
 
     cancelButton = new QPushButton(tr("Cancel"),this);
-
-
     cachingTimeLabel = new QLabel(this);
     cachingTimeLabel->hide();
 
@@ -50,7 +48,6 @@ XdxfCachingDialog::XdxfCachingDialog(QWidget *parent): QDialog(parent) {
             verticalLayout->addWidget(cachingLabel, 0, Qt::AlignCenter);
     #endif
 
-
     verticalLayout->addWidget(cachingTimeLabel);
     verticalLayout->addWidget(cachingProgressBar);
     verticalLayout->addWidget(cancelButton);
@@ -59,7 +56,6 @@ XdxfCachingDialog::XdxfCachingDialog(QWidget *parent): QDialog(parent) {
             this, SIGNAL(cancelCaching()));
 
     time.start();
-
     setModal(true);
 }
 
@@ -68,6 +64,7 @@ void XdxfCachingDialog::reject() {
     return;
 }
 
+
 void XdxfCachingDialog::updateCachingProgress(int progress, int time) {
     cachingProgressBar->setValue(progress);
 
index b92206f..dbe5ab2 100644 (file)
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-
-//Created by Mateusz Półrola
+/*!
+    \file XdxfDialog.cpp
+    \author Mateusz Półrola <mateusz.polrola@gmail.com>
+*/
 
 #include "XdxfDialog.h"
 #include <QDebug>
 XdxfDialog::XdxfDialog(XdxfPlugin *plugin,
                        XdxfDialogType type,
                        QWidget *parent) :
-    QDialog(parent) {
+                QDialog(parent) {
     this->plugin = plugin;
     this->type = type;
 
-
     cacheToolTip = tr("Optimize for quicker searches (may take some time)");
     accentsToolTip = tr("Strip accents (searching takes more time, but spelling doesn't have to be exact)");
 
@@ -39,14 +40,12 @@ XdxfDialog::XdxfDialog(XdxfPlugin *plugin,
 
     connect(cacheCheckBox, SIGNAL(toggled(bool)),
             this, SLOT(setGenerateCache(bool)));
-
     connect(accentsCheckBox, SIGNAL(toggled(bool)),
             this, SLOT(setAccents(bool)));
 
     #ifdef Q_WS_MAEMO_5
         connect(accentsInfoToolButton, SIGNAL(clicked()),
                  this, SLOT(showAccentsInfo()));
-
         connect(cacheInfoToolButton, SIGNAL(clicked()),
                  this, SLOT(showCacheInfo()));
     #endif
@@ -54,19 +53,17 @@ XdxfDialog::XdxfDialog(XdxfPlugin *plugin,
     if(type == New) {
         connect(browseButton, SIGNAL(clicked()),
                 this, SLOT(selectFile()));
-
         connect(downloadButton, SIGNAL(clicked()),
                 this, SLOT(downloadFile()));
-
         connect(&XdxfPlugin::dictDownloader, SIGNAL(fileDownloaded(QString)),
                 this, SLOT(fileDownloaded(QString)));
     }
 
     connect(confirmButton, SIGNAL(clicked()),
             this, SLOT(accept()));
-
 }
 
+
 void XdxfDialog::fileDownloaded(QString name) {
     infoLabel->setText(tr("Dictionary file: %1").arg(XdxfPlugin::dictDownloader.downloadedFile()));
     _dictionaryFilePath = XdxfPlugin::dictDownloader.downloadedFile();
@@ -139,7 +136,6 @@ void XdxfDialog::initializeUI() {
     mainVerticalLayout->addLayout(cacheLayout);
     mainVerticalLayout->addLayout(accentsLayout);
 
-
     //load old setting if exists
     if(!plugin) {
         cacheCheckBox->setChecked(true);
@@ -172,16 +168,15 @@ void XdxfDialog::initializeUI() {
 
     confirmButton = new QPushButton;
     mainVerticalLayout->addWidget(confirmButton);
-    if(type == New) {
+    if(type == New)
         confirmButton->setText(tr("Add"));
-    }
-    else {
+    else
         confirmButton->setText(tr("Save settings"));
-    }
 
     scrollArea = new QScrollArea;
     scrollArea->setWidget(widget);
     scrollArea->setWidgetResizable(true);
+
     #ifdef Q_WS_MAEMO_5
         scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
     #else
@@ -206,8 +201,6 @@ void XdxfDialog::initializeUI() {
     scrollArea->setLineWidth(0);
     scrollArea->setMidLineWidth(0);
     scrollArea->setFrameStyle(QFrame::NoFrame);
-
-
 }
 
 
@@ -215,6 +208,7 @@ void XdxfDialog::setAccents(bool accents) {
     _accents = accents;
 }
 
+
 void XdxfDialog::setGenerateCache(bool generate) {
     _generateCache = generate;
 
@@ -224,10 +218,10 @@ void XdxfDialog::setGenerateCache(bool generate) {
     }
     else
         accentsCheckBox->setChecked(_lastAccents);
-
     accentsCheckBox->setEnabled(!generate);
 }
 
+
 void XdxfDialog::selectFile() {
     QString fileName = QFileDialog::getOpenFileName(this,
                                      tr("Select dictionary file"),
@@ -235,7 +229,6 @@ void XdxfDialog::selectFile() {
                                      tr("XDXF Files (*.xdxf)"),
                                      NULL,
                                      NULL);
-
     if (!fileName.isEmpty()) {
         infoLabel->setText(tr("Dictionary file: %1").arg(fileName));
         _dictionaryFilePath = fileName;
@@ -243,19 +236,20 @@ void XdxfDialog::selectFile() {
     }
 }
 
+
 void XdxfDialog::downloadFile() {
    XdxfPlugin::dictDownloader.download(this);
 }
 
+
 void XdxfDialog::saveSettings() {
     _settings = new Settings;
     if(plugin) {
         foreach(QString key, plugin->settings()->keys())
             _settings->setValue(key, plugin->settings()->value(key));
     }
-    else {
+    else
         _settings->setValue("path", _dictionaryFilePath);
-    }
 
     if(_generateCache)
         _settings->setValue("generateCache", "true");
@@ -268,10 +262,10 @@ void XdxfDialog::saveSettings() {
         _settings->setValue("strip_accents", "false");
 }
 
+
 void XdxfDialog::accept() {
     if(type == New && _dictionaryFilePath.isEmpty()) {
         Q_EMIT notify(Notify::Warning, tr("File path is not set"));
-
         return;
     }
 
@@ -279,15 +273,18 @@ void XdxfDialog::accept() {
     QDialog::accept();
 }
 
+
 Settings* XdxfDialog::getSettings() {
     return _settings;
 }
 
+
 #ifdef Q_WS_MAEMO_5
     void XdxfDialog::showCacheInfo() {
         Q_EMIT notify(Notify::Warning, cacheToolTip);
     }
 
+
     void XdxfDialog::showAccentsInfo() {
         Q_EMIT notify(Notify::Warning, accentsToolTip);
     }
index deb3c76..be241de 100644 (file)
@@ -20,7 +20,7 @@
 *******************************************************************************/
 
 /*!
-    \file XdxfDialog.cpp
+    \file XdxfDialog.h
     \author Mateusz Półrola <mateusz.polrola@gmail.com>
 */
 
index 6ba1e27..6557d85 100644 (file)
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-
-/*! \file XdxfDictDialog.cpp
-  \author Mateusz Półrola <mateusz.polrola@comarch.pl>
+/*!
+    \file XdxfDictDialog.cpp
+    \author Mateusz Półrola <mateusz.polrola@comarch.pl>
 */
 
-
 #include "XdxfDictDialog.h"
 #include "xdxfplugin.h"
 #include "XdxfDialog.h"
@@ -35,14 +34,17 @@ XdxfDictDialog::XdxfDictDialog(XdxfPlugin *plugin, QObject *parent) :
     _lastDialogParent=0;
 }
 
+
 QWidget* XdxfDictDialog::lastDialogParent() {
     return _lastDialogParent;
 }
 
+
 void XdxfDictDialog::setLastDialogParent(QWidget *w) {
     _lastDialogParent = w;
 }
 
+
 Settings* XdxfDictDialog::addNewDictionary(QWidget *parent) {
     XdxfDialog d(0, XdxfDialog::New, parent);
 
index 92c30cc..6719d9e 100644 (file)
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-/*! \file XdxfDictDialog.h
+/*!
+    \file XdxfDictDialog.h
+    \author Mateusz Półrola <mateusz.polrola@comarch.pl>
 */
 
-
 #ifndef XDXFDICTDIALOG_H
 #define XDXFDICTDIALOG_H
 
 
 class XdxfPlugin;
 
-
 //! Implementation of DictDialog interface for xdxf plugin
 class XdxfDictDialog : public DictDialog {
     Q_OBJECT
 public:
     explicit XdxfDictDialog(XdxfPlugin* plugin, QObject *parent = 0);
     /*!
-      Shows "add new xdxf dictionary" dialog and returns settings of a new dict
-      \param parent parent widget on which dialog will be displayed
+        Shows "add new xdxf dictionary" dialog and returns settings of a new dict
+        \param parent parent widget on which dialog will be displayed
       */
     Settings* addNewDictionary(QWidget *parent);
 
     /*!
-      Shows settings dialog and saves new settings in plugin
-      \param parent parent widget on which dialog will be displayed
-      */
+        Shows settings dialog and saves new settings in plugin
+        \param parent parent widget on which dialog will be displayed
+    */
     void changeSettings(QWidget *parent);
 
-    /*!
-      Returns last parent of this dialog
-      */
+    //! Returns last parent of this dialog
     QWidget* lastDialogParent();
 
-    /*!
-      Sets last parent of this dialog
-      */
+    //! Sets last parent of this dialog
     void setLastDialogParent(QWidget*);
 
 private:
index 9d730bf..c969f03 100644 (file)
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-
 /*!
-  \file XdxfDictDownloadProgressDialog.cpp
-  \author Mateusz Półrola <mateusz.polrola@comarch.com>
-  */
+    \file XdxfDictDownloadProgressDialog.cpp
+    \author Mateusz Półrola <mateusz.polrola@comarch.com>
+*/
 
 #include "XdxfDictDownloadProgressDialog.h"
 
@@ -41,7 +40,6 @@ XdxfDictDownloadProgressDialog::XdxfDictDownloadProgressDialog(QWidget*parent):
     connect(cancelButton, SIGNAL(clicked()),
             this, SIGNAL(cancelDownloading()));
 
-
     #ifndef Q_WS_MAEMO_5
             downloadLabel = new QLabel(this);
             verticalLayout->addWidget(downloadLabel, 0, Qt::AlignCenter);
@@ -49,7 +47,6 @@ XdxfDictDownloadProgressDialog::XdxfDictDownloadProgressDialog(QWidget*parent):
 
     verticalLayout->addWidget(downloadProgressBar);
     verticalLayout->addWidget(cancelButton);
-
     setModal(true);
 
     #ifndef Q_WS_MAEMO_5
@@ -57,11 +54,13 @@ XdxfDictDownloadProgressDialog::XdxfDictDownloadProgressDialog(QWidget*parent):
     #endif
 }
 
+
 void XdxfDictDownloadProgressDialog::show() {
     downloadProgressBar->setMaximum(0);
     QDialog::show();
 }
 
+
 void XdxfDictDownloadProgressDialog::setText(QString text) {
     setWindowTitle(text);
     #ifndef Q_WS_MAEMO_5
@@ -69,6 +68,7 @@ void XdxfDictDownloadProgressDialog::setText(QString text) {
     #endif
 }
 
+
 void XdxfDictDownloadProgressDialog::updateProgress(float progress) {
     if(downloadProgressBar->maximum() == 0) {
         downloadProgressBar->setMaximum(100);
@@ -76,6 +76,7 @@ void XdxfDictDownloadProgressDialog::updateProgress(float progress) {
     downloadProgressBar->setValue(progress*100);
 }
 
+
 void XdxfDictDownloadProgressDialog::reject() {
     #ifndef Q_WS_MAEMO_5
         Q_EMIT cancelDownloading();
index 9238901..9e715d3 100644 (file)
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-
 /*!
-  \file XdxfDictDownloadProgressDialog.h
-  \author Mateusz Półrola <mateusz.polrola@comarch.com>
-  */
+    \file XdxfDictDownloadProgressDialog.h
+    \author Mateusz Półrola <mateusz.polrola@comarch.com>
+*/
 
 #ifndef XDXFDICTDOWNLOADPROGRESSDIALOG_H
 #define XDXFDICTDOWNLOADPROGRESSDIALOG_H
@@ -31,9 +30,9 @@
 #include <QtGui>
 
 /*!
-  Shows downloading progress bar. Currently it displays "busy bar".
-  User can cancel current download by pressing cancel button
-  */
+    Shows downloading progress bar. Currently it displays "busy bar".
+    User can cancel current download by pressing cancel button
+*/
 class XdxfDictDownloadProgressDialog : public QDialog {
     Q_OBJECT
 public:
@@ -46,6 +45,10 @@ public Q_SLOTS:
     //! Set text which will be displayed to user as info about current download
     void setText(QString);
 
+    /*!
+        set parameters of prograsBar(wher "prograss"*100 is value,
+        and maxValue=100
+    */
     void updateProgress(float progress);
 
     void show();
@@ -54,7 +57,6 @@ Q_SIGNALS:
     //! signal emitted when user cancels downloading of a dictionary
     void cancelDownloading();
 
-
 private:
     QLabel* downloadLabel;
     QProgressBar* downloadProgressBar;
index 6ae05a6..1542e32 100644 (file)
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-
 /*!
-  \file XdxfDictDownloader.cpp
-  \author Mateusz Półrola <mateusz.polrola@comarch.com>
-  */
+    \file XdxfDictDownloader.cpp
+    \author Mateusz Półrola <mateusz.polrola@comarch.com>
+*/
 
 #include "XdxfDictDownloader.h"
 #include "XdxfDictDownloadProgressDialog.h"
 #include <QDebug>
 #include <QProcess>
-
-
 #include <bzlib.h>
 #include <libtar.h>
 #include <stdio.h>
 
 typedef void BZFILE;
 
-
-
 XdxfDictDownloader::XdxfDictDownloader(QObject *parent) :
     QObject(parent) {
     parentDialog = 0;
+    progressDialog = 0;
     manager = new QNetworkAccessManager(this);
 
     connect(manager, SIGNAL(finished(QNetworkReply*)),
             this, SLOT(dictListReceived(QNetworkReply*)));
-
-
-    progressDialog = 0;
-    connect(&http, SIGNAL(finished()), this, SLOT(processFinished()));
+    connect(&http, SIGNAL(finished()),
+            this, SLOT(processFinished()));
     connect(&http, SIGNAL(error(QString)),
             this, SLOT(downloadingError(QString)));
     connect(&http, SIGNAL(progress(qint64,qint64)),
             this, SLOT(updateDownloadProgress(qint64,qint64)));
-
 }
 
+
 void XdxfDictDownloader::download(QWidget *parent) {
     parentDialog = parent;
     aborted = false;
@@ -74,20 +68,24 @@ void XdxfDictDownloader::download(QWidget *parent) {
     progressDialog->show();
 }
 
+
 QString XdxfDictDownloader::downloadedFile() {
     return _downloadedFile;
 }
 
+
 void XdxfDictDownloader::updateDownloadProgress(qint64 downloaded,
                                                 qint64 total)   {
     Q_EMIT downloadProgress(float(downloaded) / float(total));
 }
 
+
 void XdxfDictDownloader::downloadingError(QString error) {
     breakDownloading();
     Q_EMIT notify(Notify::Error, error);
 }
 
+
 void XdxfDictDownloader::breakDownloading() {
     //if user cancel downloading we kill all running processes, hide progress dialog and set flag that user cancel downloading.
     aborted = true;
@@ -96,9 +94,9 @@ void XdxfDictDownloader::breakDownloading() {
     if(progressDialog && progressDialog->isVisible()) {
         progressDialog->accept();
     }
-
 }
 
+
 void XdxfDictDownloader::processFinished() {
     //first check if user cancel downloading
     if(aborted) return;
@@ -111,6 +109,7 @@ void XdxfDictDownloader::processFinished() {
     downloadComplete();
 }
 
+
 void XdxfDictDownloader::downloadComplete() {
     if(aborted) return;
     // Downloaded tar file name is different than extracted folder so we need
@@ -133,11 +132,11 @@ void XdxfDictDownloader::downloadComplete() {
     emit fileDownloaded(_downloadedFile);
 }
 
+
 void XdxfDictDownloader::dictListReceived(QNetworkReply *reply) {
     progressDialog->accept();
-    if(aborted) return;
-
-
+    if(aborted)
+        return;
     if(reply->error() != QNetworkReply::NoError) {
         Q_EMIT notify(Notify::Error, reply->errorString());
         return;
index 6d14407..7b12e80 100644 (file)
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-
 /*!
-  \file XdxfDictDownloader.h
-  \author Mateusz Półrola <mateusz.polrola@comarch.pl>
- */
+    \file XdxfDictDownloader.h
+    \author Mateusz Półrola <mateusz.polrola@comarch.pl>
+*/
 
 #ifndef XDXFDICTDOWNLOADER_H
 #define XDXFDICTDOWNLOADER_H
@@ -39,7 +38,8 @@
 #include <string.h>
 #include <errno.h>
 
-/** XdxfDictDownloader is responsible for getting dict list from XDXF website
+/*!
+    XdxfDictDownloader is responsible for getting dict list from XDXF website
     and other actions necessary to download and add dictionary
 
     When user want to add dictionary he may choose "browse" or "download",
@@ -51,6 +51,7 @@ class XdxfDictDownloader : public QObject {
     Q_OBJECT
 public:
     XdxfDictDownloader(QObject *parent = 0);
+
     //! \return name of downloaded file
     QString downloadedFile();
 
@@ -61,9 +62,11 @@ public Q_SLOTS:
 Q_SIGNALS:
     //! emmited when file download precess is complete
     void fileDownloaded(QString);
+
     //! emitted to inform user about errors and warnings
     void notify(Notify::NotifyType, QString);
 
+    //! emmited what is update Download Progress
     void downloadProgress(float);
 
 private Q_SLOTS:
@@ -76,13 +79,19 @@ private Q_SLOTS:
     //! user cancel downloading
     void breakDownloading();
 
+    //! handling a download error
     void downloadingError(QString);
 
+    /*!
+        function divide two qint64 and result emmit in
+        signals downloadProgress(float)
+    */
     void updateDownloadProgress(qint64, qint64);
 
 private:
     //! dict is downloaded and unpacked
     void downloadComplete();
+
     QList<DownloadDict> dicts;
     QWidget* parentDialog;
     QString _downloadedFile;
index 0ef30f2..8abb1f6 100644 (file)
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-
 /*!
-  \file XdxfDictSelectDialog.cpp
-  \author Mateusz Półrola <mateusz.polrola@comarch.com>
-  */
+    \file XdxfDictSelectDialog.cpp
+    \author Mateusz Półrola <mateusz.polrola@comarch.com>
+*/
 
 #include "XdxfDictSelectDialog.h"
 
 XdxfDictSelectDialog::XdxfDictSelectDialog(QList<DownloadDict> dicts,
                                            QWidget *parent) :
-    QDialog(parent) {
-
-
+                    QDialog(parent) {
     setWindowTitle(tr("Select dictionary"));
 
     layout = new QVBoxLayout;
@@ -59,7 +56,6 @@ XdxfDictSelectDialog::XdxfDictSelectDialog(QList<DownloadDict> dicts,
     proxyModel->setDynamicSortFilter(true);
     proxyModel->setSourceModel(model);
 
-
     treeView = new QTreeView;
     treeView->setModel(proxyModel);
     treeView->setRootIsDecorated(false);
@@ -82,10 +78,8 @@ XdxfDictSelectDialog::XdxfDictSelectDialog(QList<DownloadDict> dicts,
         treeView->setColumnWidth(3, 150);
     #endif
 
-
     layout->addWidget(treeView);
 
-
     connect(langFrom, SIGNAL(currentIndexChanged(int)),
             this, SLOT(refreshDictList()));
 
@@ -106,7 +100,6 @@ XdxfDictSelectDialog::XdxfDictSelectDialog(QList<DownloadDict> dicts,
 
 
 void XdxfDictSelectDialog::initializeDicts() {
-
     //scan of all languages of dictionaries, using QSet to get only distinct languages
     QSet<QString> languagesFrom;
     QSet<QString> languagesTo;
@@ -142,6 +135,7 @@ void XdxfDictSelectDialog::initializeDicts() {
     }
 }
 
+
 void XdxfDictSelectDialog::refreshDictList() {
     //if selected language is "Any"(index 0), from filter string is set to empty string, proxy model uses empty string as special case and don't filter by this field.
     if(langTo->currentIndex() == 0)
@@ -155,6 +149,7 @@ void XdxfDictSelectDialog::refreshDictList() {
         proxyModel->setFrom(langFrom->currentText());
 }
 
+
 void XdxfDictSelectDialog::itemClicked(QModelIndex index) {
     _link = index.model()->data(index, Qt::UserRole).toString();
     accept();
index 996cee8..9cecb39 100644 (file)
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-
 /*!
-  \file XdxfDictSelectDialog.h
-  \author Mateusz Półrola <mateusz.polrola@comarch.com>
-  */
+    \file XdxfDictSelectDialog.h
+    \author Mateusz Półrola <mateusz.polrola@comarch.com>
+ */
 
 #ifndef XDXFDICTSELECTDIALOG_H
 #define XDXFDICTSELECTDIALOG_H
 
 
 /*!
-  Shows dialog with list of dictionaries and informations about them, allowing user to filter data based on dictionaries languages, and to select one of them.
-  */
+  Shows dialog with list of dictionaries and informations about them,
+  allowing user to filter data based on dictionaries languages,
+  and to select one of them.
+*/
 class XdxfDictSelectDialog : public QDialog {
     Q_OBJECT
 public:
     /*!
-      Constructor
-      \param dicts list of DownloadDict objects describing dictionaries.
-      */
+        Constructor
+        \param dicts list of DownloadDict objects describing dictionaries.
+    */
     XdxfDictSelectDialog(QList<DownloadDict> dicts,
                                   QWidget *parent = 0);
 
     /*!
-      Returns download link of dictionary selected by user. This string is set
-      only when user select any dictionary (dialog was accepted), otherwise it
-     is empty.
-      */
+        Returns download link of dictionary selected by user. This string is set
+        only when user select any dictionary (dialog was accepted), otherwise it
+        is empty.
+    */
     QString link() { return _link;}
 
+private Q_SLOTS:
+    //! creates items for comboboxes and creates model with dicts info
+    void initializeDicts();
+
+    //! filters dicts after filtering settings change
+    void refreshDictList();
+
+    //! accept dialog and sets download link of clicked dictionary
+    void itemClicked(QModelIndex);
+
 private:
     QTreeView* treeView;
     DictsModel* model;
-    //used by treeView to allow filtering and sorting
-    DictsProxyModel *proxyModel;
+    DictsProxyModel *proxyModel; //used by treeView to allow filtering and sorti
     QVBoxLayout* layout;
     QHBoxLayout* checkBoxLayout;
     QComboBox* langFrom;
     QComboBox* langTo;
     QLabel* langFromLabel;
     QLabel* langToLabel;
-
-private Q_SLOTS:
-    //creates items for comboboxes and creates model with dicts info
-    void initializeDicts();
-
-    //filters dicts after filtering settings change
-    void refreshDictList();
-
-    //accept dialog and sets download link of clicked dictionary
-    void itemClicked(QModelIndex);
-
-private:
     QList<DownloadDict>* dictList;
     QString _link;
 };
index 6a79bb1..d571d9e 100644 (file)
@@ -18,9 +18,9 @@
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-
-/*! \file xdxfplugin.cpp
-\author Jakub Jaszczynski <j.j.jaszczynski@gmail.com>
+/*!
+    \file xdxfplugin.cpp
+    \author Jakub Jaszczynski <j.j.jaszczynski@gmail.com>
 */
 
 #include "xdxfplugin.h"
 
 XdxfDictDownloader XdxfPlugin::dictDownloader;
 
+
 bool XdxfPlugin::dictDownloaderInitialized = false;
 
 
 XdxfPlugin::XdxfPlugin(QObject *parent) : CommonDictInterface(parent),
                     _langFrom(""), _langTo(""),_name(""), _infoNote("") {
-
-    //DownloadDict a("<tr><td><img src=\"buf/comn_sdict05_bulg_comp/icon16.png\" alt=\"icon\" /></td><td align=\"center\">English-Bulgarian computer dictionary</td><td align=\"center\"><a href=\"http://downloads.sourceforge.net/xdxf/comn_sdict05_bulg_comp.tar.bz2\" target=\"_blank\">comn_sdict05_bulg_comp.tar.bz2</a></td><td align=\"right\">13,889</td><td align=\"right\">55,094</td><td align=\"right\">523</td><td align=\"center\">English</td><td align=\"center\">Bulgarian</td><td align=\"center\"><a href=\"http://xdxf.revdanica.com/\">Common XDXF</a></td><td align=\"center\">2006-04-23 23:34:40</td></tr>");
-    //dictDownloader.download(0);
-
-
     _settings = new Settings();
     _dictDialog = new XdxfDictDialog(this, this);
 
     connect(_dictDialog, SIGNAL(notify(Notify::NotifyType,QString)),
             this, SIGNAL(notify(Notify::NotifyType,QString)));
 
-
     if(!dictDownloaderInitialized) {
         connect(&dictDownloader, SIGNAL(notify(Notify::NotifyType,QString)),
                 this, SIGNAL(notify(Notify::NotifyType,QString)));
         dictDownloaderInitialized = true;
     }
 
-
     _settings->setValue("type","xdxf");
     _icon = QIcon("/usr/share/mdictionary/xdxf.png");
     _wordsCount = -1;
@@ -63,9 +57,9 @@ XdxfPlugin::XdxfPlugin(QObject *parent) : CommonDictInterface(parent),
     initAccents();
 }
 
+
 void XdxfPlugin::retranslate() {
     QString locale = QLocale::system().name();
-
     QTranslator *translator = new QTranslator(this);
 
     if(!translator->load(":/xdxf/translations/" + locale)) {
@@ -192,7 +186,6 @@ QList<Translation*> XdxfPlugin::searchWordListFile(QString word, int limit) {
             if((regWord.exactMatch(readKey)
                     || regWord.exactMatch(removeAccents(readKey)))
                     && (i<limit || limit==0) && !reader.atEnd())  {
- //               qDebug()<<readKey;
                 translations<<(new TranslationXdxf(readKey.toLower(),
                                _dictionaryInfo,this));
                 if(translations.size()==limit && limit!=0)
@@ -236,11 +229,9 @@ QString XdxfPlugin::searchCache(QString key) {
     cur.exec();
     while(cur.next())
         result += cur.value(0).toString();
-
     db.close();
 
     return result;
-
 }
 
 
@@ -307,7 +298,6 @@ QString XdxfPlugin::searchFile(QString key) {
 
 
 void XdxfPlugin::stop() {
-   //qDebug()<<"stop";
     stopped=true;
 }
 
@@ -325,10 +315,7 @@ CommonDictInterface* XdxfPlugin::getNew(const Settings *settings) const {
 
     ((XdxfDictDialog*)plugin->dictDialog())->setLastDialogParent(_dictDialog->lastDialogParent());
 
-
-
     if(settings && plugin->setSettings(settings)) {
-
         disconnect(plugin, SIGNAL(notify(Notify::NotifyType,QString)),
                 this, SIGNAL(notify(Notify::NotifyType,QString)));
         return plugin;
@@ -374,10 +361,9 @@ bool XdxfPlugin::setSettings(const Settings *settings) {
         foreach(QString key, _settings->keys())
             oldSettings->setValue(key, _settings->value(key));
 
-        foreach(QString key, settings->keys()) {
+        foreach(QString key, settings->keys())
            if(key != "generateCache")
                _settings->setValue(key, settings->value(key));
-        }
 
         if(!getDictionaryInfo()) {
             Q_EMIT notify(Notify::Warning,
@@ -478,7 +464,6 @@ int XdxfPlugin::countWords() {
     }
 
     dictionaryFile.seek(0);
-
     long wordsCount = 0;
 
     QString line;
@@ -495,18 +480,14 @@ int XdxfPlugin::countWords() {
 
 
 bool XdxfPlugin::makeCache(QString) {
-
     XdxfCachingDialog d(_dictDialog->lastDialogParent());
 
-//    qDebug()<<_dictDialog->lastDialogParent();
-
     connect(&d, SIGNAL(cancelCaching()),
             this, SLOT(stop()));
     connect(this, SIGNAL(updateCachingProgress(int,int)),
             &d, SLOT(updateCachingProgress(int,int)));
 
     d.show();
-
     QCoreApplication::processEvents();
     QFileInfo dictFileN(_settings->value("path"));
     QString cachePathN;
@@ -566,7 +547,6 @@ bool XdxfPlugin::makeCache(QString) {
 
     /*add all words to db*/
     while (!reader.atEnd() && !stopped) {
-
         QCoreApplication::processEvents();
         reader.readNext();
         if(reader.tokenType() == QXmlStreamReader::StartElement) {
@@ -641,6 +621,7 @@ bool XdxfPlugin::makeCache(QString) {
     return true;
 }
 
+
 void XdxfPlugin::clean() {
     if(QFile::exists(_settings->value("cache_path"))) {
         QFile(_settings->value("cache_path")).remove();
index ebdcf8d..03babce 100644 (file)
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-
-
-/*! \file xdxfplugin.h
+/*!
+    \file xdxfplugin.h
+    \author Jakub Jaszczynski <j.j.jaszczynski@gmail.com>
 */
+
 #ifndef XDXFPLUGIN_H
 #define XDXFPLUGIN_H
 
-
 #include <QObject>
 #include <QDialog>
 #include <QRegExp>
@@ -53,7 +53,6 @@ class XdxfPlugin : public CommonDictInterface
     Q_INTERFACES(CommonDictInterface)
 public:
     XdxfPlugin(QObject *parent=0);
-
     ~XdxfPlugin();
 
     //! \returns source language code iso 639-2
@@ -68,12 +67,13 @@ public:
     //! \returns dictionary type (xdxf, google translate, etc)
     QString type() const;
 
-    //! returns information about dictionary in xml (name, authors, etc)
+    //! \returns information about dictionary in xml (name, authors, etc)
     QString infoNote() const;
 
-    /*! \returns DictDialog object that creates dialogs
+    /*!
+        \returns DictDialog object that creates dialogs
         for adding a new dictionary and changing plugin settings
-      */
+    */
     DictDialog* dictDialog();
 
     //! \returns new, clean copy of plugin with settings set as in Settings*
@@ -97,20 +97,22 @@ public:
     //! \returns plugin icon
     QIcon* icon();
 
-    /*! plugin should delete any files (eg. cache) that have been created and are ready
+    /*!
+        plugin should delete any files (eg. cache) that have been created and are ready
         to be deleted
-        */
+    */
     void clean();
 
     static XdxfDictDownloader dictDownloader;
 
 public Q_SLOTS:
-    /*! performs search in a dictionary
-      \param  word word to search for in a dictionary
-      \param limit limit on number of results
+    /*!
+        performs search in a dictionary
+        \param  word word to search for in a dictionary
+        \param limit limit on number of results
 
-      After finishing search it has to emit
-      \see CommonDictInterface:finalTranslation  finalTranslation
+        After finishing search it has to emit
+        \see CommonDictInterface:finalTranslation  finalTranslation
     */
     QList<Translation*> searchWordList(QString word, int limit=0);
 
@@ -125,38 +127,40 @@ Q_SIGNALS:
     //! last signal emit
     void updateCachingProgress(int, int);
 
-
 private:
-
-    static bool dictDownloaderInitialized;
-
-
-    /*! \returns true or false depending on whether the dictionary is cached
+    /*!
+        \returns true or false depending on whether the dictionary is cached
         or not
-     */
+    */
     bool isCached();
-    /*! searches for a list of words similar to a word in a database file
-    \param word key compared with keys in a database
-    \param limit limits the number of translations in returned list,
-           0 means unlimited
-    \returns list of translations
+    /*!
+        searches for a list of words similar to a word in a database file
+        \param word key compared with keys in a database
+        \param limit limits the number of translations in returned list,
+        0 means unlimited
+        \returns list of translations
     */
     QList<Translation*> searchWordListCache(QString word, int limit=0);
 
-    /*! searches for a list of words similar to a word in a xdxf file
-    \param word key compared with keys in a xdxf file
-    \param limit limits the number of translations in returned list,
-           0 means unlimited
-    \returns list of translations
+    /*!
+        searches for a list of words similar to a word in a xdxf file
+        \param word key compared with keys in a xdxf file
+        \param limit limits the number of translations in returned list,
+        0 means unlimited
+        \returns list of translations
     */
     QList<Translation*> searchWordListFile(QString word, int limit=0);
 
-    /*! searches for a translation of a word which is exactly like a key
-        in a xdxf file */
+    /*!
+        searches for a translation of a word which is exactly like a key
+        in a xdxf file
+    */
     QString searchFile(QString key);
 
-    /*! searches for a translation of a word which is exactly like a key
-        in a database file */
+    /*!
+        searches for a translation of a word which is exactly like a key
+        in a database file
+    */
     QString searchCache(QString key);
 
     //! scans dictionary file to get information about it
@@ -165,28 +169,23 @@ private:
     //! counts the keys in a xdxf file
     int countWords();
 
-    /*! transforms xdxf files to database files (caching operation)
-        \returns true on success, false on failure */
+    /*!
+        transforms xdxf files to database files (caching operation)
+        \returns true on success, false on failure
+    */
     bool makeCache(QString dir);
 
-    //! language from which we translate
+    static bool dictDownloaderInitialized;
+
     QString _langFrom;
-    //! language to which we translate
     QString _langTo;
-    //! name of a dictionary
     QString _name;
-    //! information about dictionary
     QString _infoNote;
-
     QString _dictionaryInfo;
-
-    //! icon displayed during translations and when a dictionary is chosen
     QIcon _icon;
     QSqlDatabase db;
     QString db_name;
-    //! number of words in a dictionary
     long _wordsCount;
-    //! indicates if search is stopped
     volatile bool stopped;
     Settings *_settings;
     XdxfDictDialog* _dictDialog;