XdxfDictDownloadProgressDialog::XdxfDictDownloadProgressDialog(QWidget*parent):
QDialog(parent) {
+#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, SIGNAL(cancelDownloading()));
+
+#else
verticalLayout = new QVBoxLayout(this);
setLayout(verticalLayout);
#ifndef Q_WS_MAEMO_5
setMinimumWidth(350);
#endif
+#endif
}
void XdxfDictDownloadProgressDialog::show() {
+#ifndef Q_WS_MAEMO_5
+ emit setMaximumValue(0);
+ maximumValue=0;
+#else
downloadProgressBar->setMaximum(0);
QDialog::show();
+#endif
+ QDialog::show();
}
void XdxfDictDownloadProgressDialog::setText(QString text) {
+#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) {
+#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
}