summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/DownloadManager.cpp3
-rw-r--r--src/JSObject.cpp18
-rw-r--r--src/JSObject.h5
-rw-r--r--src/fbbrowser.cpp9
4 files changed, 14 insertions, 21 deletions
diff --git a/src/DownloadManager.cpp b/src/DownloadManager.cpp
index 3314055..bb43b04 100644
--- a/src/DownloadManager.cpp
+++ b/src/DownloadManager.cpp
@@ -78,12 +78,11 @@ void DownloadManager::downloadReady()
// which provides information on the download progress of the file.
void DownloadManager::downloadProgress(qint64 bytesIn, qint64 bytesTotal)
{
+
qDebug() << "Download progress of " << currentDownload->url().toString()
<< ": " << bytesIn << "/" << bytesTotal;
-
qint64 tmp = ((bytesIn * 100) / bytesTotal);
emit updateProgress((int)tmp);
- qDebug() << "progress in is: " << tmp << "(" << (int)tmp << ")";
}
// ----------------------------------------------------------------------------------------
// This slot listens to the finished() which is emmited
diff --git a/src/JSObject.cpp b/src/JSObject.cpp
index 110f200..57fa984 100644
--- a/src/JSObject.cpp
+++ b/src/JSObject.cpp
@@ -10,7 +10,7 @@
#include <QNetworkInterface>
//-------------------------------------------------------------------------------------------------------
JSObject::JSObject(QWebFrame* qwf) {
- target = qwf;
+ owner = qwf;
}
//-------------------------------------------------------------------------------------------------------
JSObject::~JSObject() {}
@@ -18,7 +18,7 @@ JSObject::~JSObject() {}
void JSObject::enableJavascriptAccess()
{
// Attaches itself to the DOM
- target->addToJavaScriptWindowObject(QString("jsObject"), this);
+ owner->addToJavaScriptWindowObject(QString("jsObject"), this);
// connect the signals of the jsObject to the slots of the fbbrowser
QObject::connect(this, SIGNAL(closeBrowser()), this, SLOT(quitAll()));
@@ -40,14 +40,13 @@ void JSObject::enableJavascriptAccess()
//-------------------------------------------------------------------------------------------------------
void JSObject::startDownload_Slot(QString filename)
{
- qDebug() << "Returned from JS: " << filename;
emit downloadFile(filename);
}
//-------------------------------------------------------------------------------------------------------
void JSObject::updateProgressSlot(int i)
{
QString code = QString("updateProgress(\%1)").arg(i);
- target->evaluateJavaScript(code);
+ owner->evaluateJavaScript(code);
}
//-------------------------------------------------------------------------------------------------------
void JSObject::getMacAddress_Slot()
@@ -65,9 +64,8 @@ void JSObject::getMacAddress_Slot()
}
//TODO:: edit jsFunction name
- QString code;
- code = QString("printMacAddress(\"%1\")").arg(macAddress);
- target->evaluateJavaScript(code);
+ QString code = QString("printMacAddress(\"%1\")").arg(macAddress);
+ owner->evaluateJavaScript(code);
}
//-------------------------------------------------------------------------------------------------------
void JSObject::showTime_Slot()
@@ -78,19 +76,19 @@ void JSObject::showTime_Slot()
//TODO:: edit jsFunction name
QString code;
code = QString("printTime(\"%1\")").arg(time);
- target->evaluateJavaScript(code);
+ owner->evaluateJavaScript(code);
}
//-------------------------------------------------------------------------------------------------------
void JSObject::showDate_Slot()
{
QString date = QDate::currentDate().toString("dd.MM.yyyy");
//TODO:: edit jsFunction name
- target->evaluateJavaScript("");
+ owner->evaluateJavaScript("");
}
//-------------------------------------------------------------------------------------------------------
void JSObject::showHelloWorld_Slot()
{
- target->evaluateJavaScript("alert(\"Hello World\")");
+ owner->evaluateJavaScript("alert(\"Hello World\")");
}
//-------------------------------------------------------------------------------------------------------
diff --git a/src/JSObject.h b/src/JSObject.h
index 58ce633..5d543e0 100644
--- a/src/JSObject.h
+++ b/src/JSObject.h
@@ -30,14 +30,11 @@ class JSObject : public QObject
{
Q_OBJECT
private:
- QWebFrame* target;
- fbbrowser* browser;
+ QWebFrame* owner;
public:
JSObject(QWebFrame* qwf);
virtual ~JSObject();
-//private:
-// fbbrowser browser;
// no slots needed. class provides only signals
// private slots:
diff --git a/src/fbbrowser.cpp b/src/fbbrowser.cpp
index 535907e..6c7f642 100644
--- a/src/fbbrowser.cpp
+++ b/src/fbbrowser.cpp
@@ -23,9 +23,9 @@ fbbrowser::fbbrowser(const QUrl & url)
// Let the manager send the request and receive the reply.
reply = manager->get(request);
// TODO: error differentiation
- // reply->error() returns 0 even for invalid URL.
- // A possibility to check for validity, is to listen to readyRead()
- // signal, haven't found a better way yet ...
+ // reply->error() returns 0 even for invalid URL.
+ // A possibility to check for validity, is to listen to readyRead()
+ // signal, haven't found a better way yet ...
if(reply->error() == QNetworkReply::NoError)
{
//qDebug() << "No error, loading given URL...";
@@ -50,9 +50,8 @@ fbbrowser::fbbrowser(const QUrl & url)
QObject::connect(jso, SIGNAL(downloadFile(QString)), dm, SLOT(downloadFile(QString)));
QObject::connect(dm, SIGNAL(updateProgress(int)), jso, SLOT(updateProgressSlot(int)));
- //remove the window decoration
+ // Remove the window decoration, form to fullscreen, central view?
this->setWindowFlags(Qt::SplashScreen);
- //set form to fullscreen
this->showFullScreen();
setCentralWidget(view);
}