change and add some comments, remove some warning
[mdictionary] / src / plugins / xdxf / XdxfCachingDialog.cpp
index 7471f15..a0db9a3 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"
 #include <QDebug>
 
 
-XdxfCachingDialog::XdxfCachingDialog(XdxfPlugin *parent) {
+XdxfCachingDialog::XdxfCachingDialog(QWidget *parent): QDialog(parent) {
     verticalLayout = new QVBoxLayout(this);
     setLayout(verticalLayout);
 
@@ -39,38 +39,36 @@ XdxfCachingDialog::XdxfCachingDialog(XdxfPlugin *parent) {
     cachingProgressBar->setTextVisible(true);
 
     cancelButton = new QPushButton(tr("Cancel"),this);
+    cachingTimeLabel = new QLabel(this);
+    cachingTimeLabel->hide();
 
+    #ifndef Q_WS_MAEMO_5
+            cachingLabel = new QLabel(this);
+            cachingLabel->setText(tr("Caching dictionary, please wait"));
+            verticalLayout->addWidget(cachingLabel, 0, Qt::AlignCenter);
+    #endif
 
-    cachingLabel = new QLabel(this);
-    cachingLabel->hide();
-
-
-    verticalLayout->addWidget(cachingLabel);
+    verticalLayout->addWidget(cachingTimeLabel);
     verticalLayout->addWidget(cachingProgressBar);
     verticalLayout->addWidget(cancelButton);
 
     connect(cancelButton, SIGNAL(clicked()),
             this, SIGNAL(cancelCaching()));
 
-    connect(parent, SIGNAL(updateCachingProgress(int, int)),
-       this, SLOT(updateCachingProgress(int, int)));
     time.start();
+    setModal(true);
 }
 
 
-void XdxfCachingDialog::reject() {
-    return;
-}
-
 void XdxfCachingDialog::updateCachingProgress(int progress, int time) {
     cachingProgressBar->setValue(progress);
 
-    if(!cachingLabel->isVisible())
-        cachingLabel->show();
+    if(!cachingTimeLabel->isVisible())
+        cachingTimeLabel->show();
 
     int seconds = float((100 - progress)*time) / (5*1000);
 
-    cachingLabel->setText(tr("Estimated time left: ") +
+    cachingTimeLabel->setText(tr("Estimated time left: ") +
                           tr("%n second(s)", "", seconds));
     if(progress >= 100)
         this->accept();