From e830cfcdee7f0ecb6d2b9a0d52ab19b28402eec2 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Wed, 9 Mar 2011 20:28:17 +0100 Subject: DM also provides current file on update --- src/DownloadManager.cpp | 2 +- src/DownloadManager.h | 2 +- src/fbgui.cpp | 4 +--- src/javascriptInterface.cpp | 5 +++-- src/javascriptInterface.h | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/DownloadManager.cpp b/src/DownloadManager.cpp index eb9832b..9f59010 100644 --- a/src/DownloadManager.cpp +++ b/src/DownloadManager.cpp @@ -119,7 +119,7 @@ void DownloadManager::downloadProgress(qint64 bytesIn, qint64 bytesTotal) if (debug) qDebug() << "Download progress of " << currentDownload->url().toString() << ": " << bytesIn << "/" << bytesTotal; qint64 tmp = ((bytesIn * 100) / bytesTotal); - emit updateProgress((int)tmp); + emit updateProgress(currentDownload->url().toString(), (int)tmp); } // ---------------------------------------------------------------------------------------- // This slot listens to the finished() which is emmited diff --git a/src/DownloadManager.h b/src/DownloadManager.h index 136437b..363b426 100644 --- a/src/DownloadManager.h +++ b/src/DownloadManager.h @@ -35,7 +35,7 @@ private: signals: void finished(); - void updateProgress(int i); + void updateProgress(QString current, int i); public slots: void downloadFile(QUrl& fileUrl); diff --git a/src/fbgui.cpp b/src/fbgui.cpp index 5209ad1..cd3153c 100644 --- a/src/fbgui.cpp +++ b/src/fbgui.cpp @@ -35,13 +35,11 @@ fbgui::fbgui() /* Init Download Manager */ DownloadManager* dm = new DownloadManager(); QObject::connect(jsi, SIGNAL(requestFile(QString&)), dm, SLOT(downloadFile(QString&))); - QObject::connect(dm, SIGNAL(updateProgress(int)), jsi, SLOT(updateProgressBar(int))); + QObject::connect(dm, SIGNAL(updateProgress(QString, int)), jsi, SLOT(updateProgressBar(QString, int))); //setWindowFlags(Qt::Window); showFullScreen(); qDebug() << "Width: " << width() << " // Height: " << height(); - QSize size(800, 600); - resize(size); setCentralWidget(webView); show(); diff --git a/src/javascriptInterface.cpp b/src/javascriptInterface.cpp index fc7203a..955ff4e 100644 --- a/src/javascriptInterface.cpp +++ b/src/javascriptInterface.cpp @@ -45,11 +45,12 @@ void javascriptInterface::startDownload(QString filename) } //------------------------------------------------------------------------------------------------------- -void javascriptInterface::updateProgressBar(int i) +void javascriptInterface::updateProgressBar(QString current, int i) { if (i == 0) return; - QString code = QString("updateProgress(\%1)").arg(i); + QString code = QString("updateProgress(\%1 \%2)").arg(current).arg(i); + qDebug() << "To JS: " << code; _parent->evaluateJavaScript(code); } //------------------------------------------------------------------------------------------------------- diff --git a/src/javascriptInterface.h b/src/javascriptInterface.h index 21f994a..0e71572 100644 --- a/src/javascriptInterface.h +++ b/src/javascriptInterface.h @@ -31,7 +31,7 @@ public slots: void attachToDOM(); QString getSysInfo(QString info); void startDownload(QString filename); - void updateProgressBar(int i); + void updateProgressBar(QString current, int i); void quitAll(); }; -- cgit v1.2.3-55-g7522