add history widget
[mdictionary] / src / plugins / xdxf / XdxfDictDownloadProgressDialog.cpp
index 8f89199..5bf2ca7 100644 (file)
 
 XdxfDictDownloadProgressDialog::XdxfDictDownloadProgressDialog(QWidget*parent):
     QDialog(parent) {
+qDebug()<<"etap 01";
+#ifndef Q_WS_MAEMO_5
+    view= new QDeclarativeView();
+    view->setSource(QUrl::fromLocalFile("/usr/share/mdictionary/qml/XdxfDictDownloader.qml"));
+    view->setResizeMode(QDeclarativeView::SizeRootObjectToView);
+    view->setAlignment(Qt::AlignCenter);
+    view->show();
+
+    mainLayout = new QVBoxLayout;
+    mainLayout->addWidget(view);
+    setLayout(mainLayout);
+    view->setWindowTitle(tr("Progres Dialog"));
+
+    QGraphicsObject *rootObject = view->rootObject();
+
+    connect(this, SIGNAL(setValue(QVariant)),
+           rootObject, SLOT(setValue(QVariant)));
+    connect(this, SIGNAL(setTextt(QVariant)),
+           rootObject, SLOT(setText(QVariant)));
+    connect(this, SIGNAL(setMaximumValue(QVariant)),
+           rootObject, SLOT(setMaximumValue(QVariant)));
+
+    connect(rootObject, SIGNAL(cancelDownloading()),
+           this, SLOT(reject()));
+
+#else
     verticalLayout = new QVBoxLayout(this);
     setLayout(verticalLayout);
 
@@ -54,32 +80,52 @@ XdxfDictDownloadProgressDialog::XdxfDictDownloadProgressDialog(QWidget*parent):
     #ifndef Q_WS_MAEMO_5
         setMinimumWidth(350);
     #endif
+#endif
 }
 
 
 void XdxfDictDownloadProgressDialog::show() {
+qDebug()<<"etap 02";
+#ifndef Q_WS_MAEMO_5
+    emit setMaximumValue(0);
+    maximumValue=0;
+#else
     downloadProgressBar->setMaximum(0);
     QDialog::show();
+#endif
+    QDialog::show();
 }
 
 
 void XdxfDictDownloadProgressDialog::setText(QString text) {
+qDebug()<<"etap 03";
+
+#ifndef Q_WS_MAEMO_5
+    emit setTextt(text);
+#else
     setWindowTitle(text);
-    #ifndef Q_WS_MAEMO_5
-        downloadLabel->setText(text);
-    #endif
+#endif
 }
 
 
 void XdxfDictDownloadProgressDialog::updateProgress(float progress) {
+qDebug()<<"etap 04";
+#ifndef Q_WS_MAEMO_5
+    if(maximumValue == 0) {
+        emit setMaximumValue(100);
+    }
+    emit setValue((int)(progress*100));
+#else
     if(downloadProgressBar->maximum() == 0) {
         downloadProgressBar->setMaximum(100);
     }
     downloadProgressBar->setValue(progress*100);
+#endif
 }
 
 
 void XdxfDictDownloadProgressDialog::reject() {
+qDebug()<<"etap 05";
     #ifndef Q_WS_MAEMO_5
         Q_EMIT cancelDownloading();
     #else