summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Bauer2011-03-09 20:28:17 +0100
committerJonathan Bauer2011-03-09 20:28:17 +0100
commite830cfcdee7f0ecb6d2b9a0d52ab19b28402eec2 (patch)
tree4e182931a584c5d4c00c426fd8bf4502d5de5e76
parentjavascriptInterface can be accessed by "fbgui" now (jsObject also for now..) (diff)
downloadfbgui-e830cfcdee7f0ecb6d2b9a0d52ab19b28402eec2.tar.gz
fbgui-e830cfcdee7f0ecb6d2b9a0d52ab19b28402eec2.tar.xz
fbgui-e830cfcdee7f0ecb6d2b9a0d52ab19b28402eec2.zip
DM also provides current file on update
-rw-r--r--src/DownloadManager.cpp2
-rw-r--r--src/DownloadManager.h2
-rw-r--r--src/fbgui.cpp4
-rw-r--r--src/javascriptInterface.cpp5
-rw-r--r--src/javascriptInterface.h2
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();
};