Clean and order documentation in source files. Source ready to beta 2 release
[mdictionary] / src / plugins / xdxf / XdxfDictDownloadProgressDialog.cpp
index 2e95783..8f89199 100644 (file)
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-
 /*!
-  \file XdxfDictDownloadProgressDialog.cpp
-  \author Mateusz Półrola <mateusz.polrola@comarch.com>
-  */
+    \file XdxfDictDownloadProgressDialog.cpp
+    \brief Shows downloading progress bar.
+
+    \author Mateusz Półrola <mateusz.polrola@comarch.com>
+*/
 
 #include "XdxfDictDownloadProgressDialog.h"
 
@@ -41,7 +42,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 +49,6 @@ XdxfDictDownloadProgressDialog::XdxfDictDownloadProgressDialog(QWidget*parent):
 
     verticalLayout->addWidget(downloadProgressBar);
     verticalLayout->addWidget(cancelButton);
-
     setModal(true);
 
     #ifndef Q_WS_MAEMO_5
@@ -58,6 +57,12 @@ XdxfDictDownloadProgressDialog::XdxfDictDownloadProgressDialog(QWidget*parent):
 }
 
 
+void XdxfDictDownloadProgressDialog::show() {
+    downloadProgressBar->setMaximum(0);
+    QDialog::show();
+}
+
+
 void XdxfDictDownloadProgressDialog::setText(QString text) {
     setWindowTitle(text);
     #ifndef Q_WS_MAEMO_5
@@ -65,6 +70,15 @@ void XdxfDictDownloadProgressDialog::setText(QString text) {
     #endif
 }
 
+
+void XdxfDictDownloadProgressDialog::updateProgress(float progress) {
+    if(downloadProgressBar->maximum() == 0) {
+        downloadProgressBar->setMaximum(100);
+    }
+    downloadProgressBar->setValue(progress*100);
+}
+
+
 void XdxfDictDownloadProgressDialog::reject() {
     #ifndef Q_WS_MAEMO_5
         Q_EMIT cancelDownloading();