summaryrefslogtreecommitdiffstats
path: root/src/fbbrowser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/fbbrowser.cpp')
-rw-r--r--src/fbbrowser.cpp42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/fbbrowser.cpp b/src/fbbrowser.cpp
index 262c68f..4deca61 100644
--- a/src/fbbrowser.cpp
+++ b/src/fbbrowser.cpp
@@ -1,4 +1,5 @@
#include "fbbrowser.h"
+#include "DownloadManager.h"
#include <QFile>
#include <QFileInfo>
@@ -32,15 +33,10 @@ fbbrowser::fbbrowser(const QUrl & url)
qDebug() << "Error occured, loading error page...";
view->load(QUrl("qrc:/html/errorPage.html"));
}
- // **** TEST ****
- DownloadManager* dm = new DownloadManager(baseUrl);
- QObject::connect(this, SIGNAL(downloadFile(QString)), dm, SLOT(downloadFile(QString)));
- //emit downloadFile(QString("test.php"));
- //emit downloadFile(QString("blacklist.txt"));
- //emit downloadFile(QString("whitelist.tar.gz"));
- qDebug() << "DM blocking app?";
- // **** TEST ****
+ // Initialize Download Manager.
+ dm = new DownloadManager(baseUrl);
+ QObject::connect(this, SIGNAL(downloadFile(QString)), dm, SLOT(downloadFile(QString)));
//remove the window decoration
this->setWindowFlags(Qt::SplashScreen);
@@ -72,7 +68,7 @@ void fbbrowser::addJSObject()
void fbbrowser::connectJsSignalsToSlots()
{
QObject::connect(jso, SIGNAL(closeBrowser()), this, SLOT(quitAll()));
- QObject::connect(jso, SIGNAL(startDownload()), this, SLOT(startDownload_Slot()));
+ QObject::connect(jso, SIGNAL(startDownload(QString)), this, SLOT(startDownload_Slot(QString)));
QObject::connect(jso, SIGNAL(getMacAddress()), this, SLOT(getMacAddress_Slot()));
QObject::connect(jso, SIGNAL(getIpAddress()), this, SLOT(getIpAddress_Slot()));
QObject::connect(jso, SIGNAL(getIntegratedHardwareDevices()), this, SLOT(getIntegratedHardwareDevices_Slot()));
@@ -83,8 +79,15 @@ void fbbrowser::connectJsSignalsToSlots()
QObject::connect(jso, SIGNAL(showTime()), this, SLOT(showTime_Slot()));
QObject::connect(jso, SIGNAL(showDate()), this, SLOT(showDate_Slot()));
QObject::connect(jso, SIGNAL(showHelloWorld()), this, SLOT(showHelloWorld_Slot()));
+ // further tests
+ QObject::connect(dm, SIGNAL(updateProgress(int)), this, SLOT(updateProgressSlot(int)));
+}
+//
+void fbbrowser::updateProgressSlot(int i)
+{
+ QString code = QString("updateProgress(\%1\)").arg(i);
+ view->page()->mainFrame()->evaluateJavaScript(code);
}
-
void fbbrowser::writeText(QString text)
{
QFile file("out.txt");
@@ -101,16 +104,14 @@ void fbbrowser::quitAll()
emit signalQuitAll();
}
-void fbbrowser::startDownload_Slot()
+
+void fbbrowser::startDownload_Slot(QString filename)
{
- QString code;
- code = QString("downloadFile()");
- QVariant returnValue;
- returnValue = view->page()->mainFrame()->evaluateJavaScript("downloadFile()");
- QString tmp = returnValue.toString();
- qDebug() << "Returned from JS: " << returnValue.toString();
+
+ qDebug() << "Returned from JS: " << filename;
// Start download.
- emit downloadFile(returnValue.toString());
+ emit downloadFile(filename);
+
}
void fbbrowser::getMacAddress_Slot()
@@ -178,9 +179,8 @@ void fbbrowser::showHelloWorld_Slot()
view->page()->mainFrame()->evaluateJavaScript("alert(\"Hello World\")");
}
-void fbbrowser::getSysInfo()
-{
- /*
+void fbbrowser::getSysInfo(){
+/*
QString time = QTime::currentTime().toString("hh:mm:ss");
QString date = QDate::currentDate().toString("dd.MM.yyyy");
QList<QHostAddress> ipList = QNetworkInterface::allAddresses();