Clean and order documentation in source files. Source ready to beta 2 release
[mdictionary] / src / plugins / xdxf / DownloadDict.h
index 4b74d67..bf50c17 100644 (file)
 
 *******************************************************************************/
 
-/*! \file DownloadDict.h
-\brief Represenation of dictionary html entry on XDXF webpage
+/*!
+    \file DownloadDict.h
+    \brief Represenation of dictionary html entry on XDXF webpage
 
-\author Bartosz Szatkowski <bulislaw@linux.com>
+    \author Bartosz Szatkowski <bulislaw@linux.com>
 */
 
 #ifndef DOWNLOADDICT_H
@@ -30,8 +31,9 @@
 
 #include <QRegExp>
 #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
@@ -41,12 +43,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>");
@@ -60,7 +60,11 @@ public:
         _from = tmp.at(6);
         _to = tmp.at(7);
         _title = tmp.at(1);
-        _size = tmp.at(3);
+        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);
@@ -76,14 +80,17 @@ public:
 
     //! \return dictionary title
     QString title() const {return _title;}
-
     //! \return dictionary archive size
-    QString size() const {return _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;
@@ -92,7 +99,8 @@ public:
     }
 
 private:
-    QString _from, _to, _title, _link, _size;
+    QString _from, _to, _title, _link;
+    float _size;
 };