change and add some comments, remove some warning
authorjakub <jakub.jaszczynski@comarch.com>
Fri, 19 Nov 2010 09:55:03 +0000 (10:55 +0100)
committerjakub <jakub.jaszczynski@comarch.com>
Fri, 19 Nov 2010 09:55:03 +0000 (10:55 +0100)
12 files changed:
src/plugins/xdxf/DictsModel.cpp
src/plugins/xdxf/DictsModel.h
src/plugins/xdxf/DictsProxyModel.h
src/plugins/xdxf/DownloadDict.h
src/plugins/xdxf/HttpDownloader.cpp
src/plugins/xdxf/HttpDownloader.h
src/plugins/xdxf/TranslationXdxf.h
src/plugins/xdxf/XdxfCachingDialog.cpp
src/plugins/xdxf/XdxfCachingDialog.h
src/plugins/xdxf/XdxfDialog.cpp
src/plugins/xdxf/XdxfDialog.h
src/plugins/xdxf/XdxfDictDownloader.cpp

index 998cdc0..4841a83 100644 (file)
@@ -51,15 +51,15 @@ QVariant DictsModel::data(const QModelIndex &index, int role) const {
 
     if (role == Qt::DisplayRole) {
         switch(index.column()) {
-        case 0:
-            return dicts.at(index.row()).fromLang();
-        case 1:
-            return dicts.at(index.row()).toLang();
-        case 2:
-            return dicts.at(index.row()).title();
-        case 3:
-            return QString::number(dicts.at(index.row()).size(), 'g', 2) +
-                    QString (" MB");
+            case 0:
+                return dicts.at(index.row()).fromLang();
+            case 1:
+                return dicts.at(index.row()).toLang();
+            case 2:
+                return dicts.at(index.row()).title();
+            case 3:
+                return QString::number(dicts.at(index.row()).size(), 'g', 2) +
+                       QString (" MB");
         }
     }
 
@@ -77,14 +77,14 @@ QVariant DictsModel::headerData(int section, Qt::Orientation orientation,
 
     if (orientation == Qt::Horizontal) {
         switch(section) {
-        case 0:
-            return tr("From");
-        case 1:
-            return tr("To");
-        case 2:
-            return tr("Name");
-        case 3:
-            return tr("Size");
+            case 0:
+                return tr("From");
+            case 1:
+                return tr("To");
+            case 2:
+                return tr("Name");
+            case 3:
+                return tr("Size");
         }
     }
     return QVariant();
index cbe3a0e..93757c0 100644 (file)
@@ -42,19 +42,31 @@ class DictsModel : public QAbstractItemModel
     Q_OBJECT
 public:
     /*!
-      Constructor
-      \param dicts list of DownloadDict objects, each such object describes
+        Constructor
+        \param dicts list of DownloadDict objects, each such object describes
         one dictionary
-      */
+    */
     DictsModel(QList<DownloadDict> dicts, QObject *parent);
 
+    //! \return return numner of rows
     int rowCount(const QModelIndex &parent = QModelIndex()) const;
+
+    //! \return return numner of columns
     int columnCount(const QModelIndex &parent = QModelIndex()) const;
 
+    //!  create Index,  createIndex(row,column,row)
     QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
+
+    //! return new QModelIndex;
     QModelIndex parent(const QModelIndex &child) const;
 
+    /*!
+        \return return empty QVariant when role is't DisplayRole,
+        else return QVariant (QString with _from,_to,_title)
+    */
     QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+
+    //! \return return a QVariant with header QString.
     QVariant headerData(int section, Qt::Orientation orientation, int role) const;
 
 private:
index 7f99271..06a35c8 100644 (file)
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-
 /*!
-  \file DictsProxyModel.h
-  \author Mateusz Półrola <mateusz.polrola@gmail.com>
-  */
+    \file DictsProxyModel.h
+    \author Mateusz Półrola <mateusz.polrola@gmail.com>
+*/
 
 #ifndef DICTSPROXYMODEL_H
 #define DICTSPROXYMODEL_H
@@ -32,8 +31,8 @@
 
 
 /*!
-  Proxy model used for filtering and sorting informations about xdxf dictionaries.
-It allow to filter dictionaries based on their langages
+    Proxy model used for filtering and sorting informations about xdxf dictionaries.
+    It allow to filter dictionaries based on their langages
 */
 class DictsProxyModel : public QSortFilterProxyModel
 {
@@ -43,21 +42,33 @@ public:
 
     }
 
-    /*! Returns currently setted language used to filter dictionaries based on dictionarie's language from*/
+    /*!
+        Returns currently setted language used to filter dictionaries
+        based on dictionarie's language from
+    */
     QString from() { return _from;}
 
-        /*! Returns currently setted language used to filter dictionaries based on dictionarie's language to*/
+    /*!
+        Returns currently setted language used to filter dictionaries
+        based on dictionarie's language to
+    */
     QString to() {return _to;}
 
 
-        /*! Sets currently setted language used to filter dictionaries based on dictionarie's language from*/
+    /*!
+        Sets currently setted language used to filter dictionaries based
+        on dictionarie's language from
+    */
     void setFrom(QString from) { _from = from; invalidateFilter(); }
 
-        /*! Sets currently setted language used to filter dictionaries based on dictionarie's language to*/
+    /*!
+        Sets currently setted language used to filter dictionaries
+        based on dictionarie's language to
+    */
     void setTo(QString to) {_to = to; invalidateFilter();}
 
 protected:
-        /*! Filtering passed row*/
+    //! Filtering passed row
     bool filterAcceptsRow(int source_row, const QModelIndex&) const {
         QString sourceFrom = sourceModel()->data(
                 sourceModel()->index(source_row, 0)).toString();
@@ -68,7 +79,11 @@ protected:
                 (_to.isEmpty() || sourceTo == _to));
     }
 
-        /*! Sorting, if sort column is set to column containing size of dictionary, string containing size of it is converted to fload and compared to other dict size*/
+    /*!
+        Sorting, if sort column is set to column containing size of dictionary,
+        string containing size of it is converted to fload and compared to
+        other dict size
+    */
     bool lessThan(const QModelIndex &left, const QModelIndex &right) const {
         if(sortColumn() == 3) {
             QString l = left.model()->data(left).toString();
index cf6ff57..172d71b 100644 (file)
 
 *******************************************************************************/
 
-/*! \file DownloadDict.h
-\brief Represenation of dictionary html entry on XDXF webpage
-
-\author Bartosz Szatkowski <bulislaw@linux.com>
+/*!
+    \file DownloadDict.h
+    \brief Represenation of dictionary html entry on XDXF webpage
+    \author Bartosz Szatkowski <bulislaw@linux.com>
 */
 
 #ifndef DOWNLOADDICT_H
@@ -32,7 +32,7 @@
 #include <QStringList>
 #include <math.h>
 
-/**
+/*!
     Each dictionary is representing as one html line at XDXF webpage,
     each entry contains lang from, lang to, file name, file size, link, etc info
     about dictionary. DownloadDict cut this description and then it may be
@@ -42,12 +42,10 @@ class DownloadDict
 {
 public:
 
-    /** Cuts html entry to class
-
-    Html entry looks like <tr><td>...</td><td>...</tr> some of the fields
-    dosn't matters for now so Iam ignoring it.
-
-    \param html html entry (line describing a dict) to be cut
+    /*! Cuts html entry to class
+        Html entry looks like <tr><td>...</td><td>...</tr> some of the fields
+        dosn't matters for now so Iam ignoring it.
+        \param html html entry (line describing a dict) to be cut
     */
     DownloadDict(QString html) {
         QRegExp reg("<td.*>(.*)</td>");
@@ -64,12 +62,9 @@ public:
         QString sizeStr = tmp.at(3);
 
         _size = sizeStr.remove(',').toInt();
-
         _size = _size / 1024 / 1024;
-
         _size = round(_size*1000) / 1000;
 
-
         QRegExp lreg("href=\"(.*)\""); // Cutting link to file
         lreg.setMinimal(true);
         lreg.indexIn(tmp.at(2));
@@ -88,11 +83,13 @@ public:
     //! \return dictionary archive size
     float size() const {return _size;}
 
-
     //! \return link to dictionary archive
     QString link() const {return _link;}
 
-    //! Compares dict by from lang then to lang \return 1 if this is before other
+    /*!
+        Compares dict by from lang then to lang
+        \return 1 if this is before other
+    */
     bool operator <(DownloadDict other) const {
         if(_from < other.fromLang()) return true;
         if(_from > other.fromLang()) return false;
index 7e6644d..753124f 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "HttpDownloader.h"
 
-HttpDownloader::HttpDownloader(QObject *parent) {
+HttpDownloader::HttpDownloader(QObject *parent): QObject(parent) {
     http = new QHttp();
     //connect(http, SIGNAL(requestFinished(int, bool)), this,
      //       SLOT(getPageFinished()));
index 76f27d1..ac52acf 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>
  */
 
 #ifndef HTTPDOWNLOADER_H
index e438bbc..3bb6d0b 100644 (file)
@@ -18,7 +18,9 @@
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-/*! \file TranslationXdxf.h
+/*!
+    \file TranslationXdxf.h
+    \author Jakub Jaszczynski <j.j.jaszczynski@gmail.com>
 */
 #ifndef TRANSLATIONXDXF_H
 #define TRANSLATIONXDXF_H
@@ -53,7 +55,7 @@ public:
         return _bookmark;
    }
 
-    //! returns corresponding dict object
+    //! \return corresponding dict object
     uint dict() const {return _dictHash;}
 
 private:
index fce967e..a0db9a3 100644 (file)
@@ -60,11 +60,6 @@ XdxfCachingDialog::XdxfCachingDialog(QWidget *parent): QDialog(parent) {
 }
 
 
-void XdxfCachingDialog::reject() {
-    return;
-}
-
-
 void XdxfCachingDialog::updateCachingProgress(int progress, int time) {
     cachingProgressBar->setValue(progress);
 
index 4b39953..b519291 100644 (file)
@@ -44,7 +44,10 @@ public:
     explicit XdxfCachingDialog(QWidget *parent = 0);
 
 public Q_SLOTS:
-    void reject();
+    //! Overload function from QDialog, this function does nothing
+    void reject() { return;}
+
+    //! update progresBar and print text with time to end caching
     void updateCachingProgress(int, int);
 
 Q_SIGNALS:
index dbe5ab2..1a4c986 100644 (file)
@@ -64,7 +64,7 @@ XdxfDialog::XdxfDialog(XdxfPlugin *plugin,
 }
 
 
-void XdxfDialog::fileDownloaded(QString name) {
+void XdxfDialog::fileDownloaded(QString) {
     infoLabel->setText(tr("Dictionary file: %1").arg(XdxfPlugin::dictDownloader.downloadedFile()));
     _dictionaryFilePath = XdxfPlugin::dictDownloader.downloadedFile();
     updateGeometry();
index be241de..aa63a1e 100644 (file)
@@ -51,19 +51,18 @@ class XdxfDialog : public QDialog
     Q_OBJECT
 public:
     /*!
-      Describes type of dialog. New means that dialog contains widgets to browse
+        Describes type of dialog. New means that dialog contains widgets to browse
         file system and select dictionary file. Change means that dialog displays
-     information about dictionary.
-      In both types dialog provides widgets to create or delete cache and remove
-     or keep accents.
+        information about dictionary.
+        In both types dialog provides widgets to create or delete cache and remove
+        or keep accents.
     */
     enum XdxfDialogType {New, Change};
 
-    //! Constructor
     /*!
         Creates new xdxf dialog
         \param plugin if created dialog is of type Change it must be set to
-            point to plugin whose settings will be changed
+        point to plugin whose settings will be changed
         \param type describes type of created dialog
         \param parent parent widget of created dialog
     */
@@ -71,10 +70,10 @@ public:
                         XdxfDialogType type = New,
                         QWidget* parent = 0);
 
-    //! \returns settings of plugin
     /*!
         After acceptance of dialog this method returns plugin's settings based on
-         user's choices in dialog.
+        user's choices in dialog.
+        \returns settings of plugin
     */
     Settings* getSettings();
 
@@ -83,22 +82,33 @@ 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:
     //! displays dialog to browse and select file
     void selectFile();
+
+    //! download dictionaries list
     void downloadFile();
+
+    //! set properti _generateCache
     void setGenerateCache(bool);
+
+    //! set properti _accents
     void setAccents(bool);
+
     void fileDownloaded(QString);
 
     #ifdef Q_WS_MAEMO_5
         //! on maemo shows information about checkboxes
         void showCacheInfo();
+
+        //! on maemo shows information about checkboxes
         void showAccentsInfo();
     #endif
 
index 1b65408..9a1ecbd 100644 (file)
@@ -205,7 +205,7 @@ bool XdxfDictDownloader::extract(QString file) {
     int bufflen = 100;
     char buff[bufflen];
     while(err == BZ_OK) {
-        int len = BZ2_bzRead(&err, afterbzFile, buff, bufflen);
+        unsigned int len = BZ2_bzRead(&err, afterbzFile, buff, bufflen);
         if(fwrite(buff, 1, len, tarfile) != len)
             return false;
     }
@@ -223,7 +223,7 @@ bool XdxfDictDownloader::extract(QString file) {
     if(err == -1)
         return false;
 
-    err = tar_extract_all(t, "/tmp/mdict/");
+    err = tar_extract_all(t,"/tmp/mdict/");
     if(err == -1) {
         return false;
     }