summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fbbrowser/fbbrowser.cpp11
-rw-r--r--fbbrowser/main.cpp10
-rwxr-xr-xfbbrowser/testApp.sh16
3 files changed, 32 insertions, 5 deletions
diff --git a/fbbrowser/fbbrowser.cpp b/fbbrowser/fbbrowser.cpp
index 813b14e..b53134c 100644
--- a/fbbrowser/fbbrowser.cpp
+++ b/fbbrowser/fbbrowser.cpp
@@ -8,18 +8,21 @@ fbbrowser::fbbrowser(const QUrl & url)
{
-
view = new QWebView(this);
- // check Internet connection
+ // Check Internet connection
+ // Create QNetworkAccessManager which is needed to send/receive requests.
manager = new QNetworkAccessManager(this);
+ // Create a QNetworkRequest object and set its URL.
QNetworkRequest request;
request.setUrl(url);
+ // Let the manager send the request and receive the reply.
QNetworkReply *reply = manager->get(request);
//connect(reply, SIGNAL(error()), this, SLOT());
//connect(reply, SIGNAL(finished()), this, SLOT());
+ // Check if the reply is an error message (?)
qDebug() << reply->error();
//TODO: error differentiation
@@ -46,11 +49,12 @@ fbbrowser::fbbrowser(const QUrl & url)
setCentralWidget(view);
}
+// Destructor
fbbrowser::~fbbrowser()
{
-
}
+//
void fbbrowser::addJSObject()
{
view->page()->mainFrame()->addToJavaScriptWindowObject(QString("webkitTest"), this);
@@ -66,6 +70,7 @@ void fbbrowser::writeText(QString text)
out << text << "\n";
}
+// This function needed now ?
void fbbrowser::quitAll()
{
//emit lastWindowClosed();
diff --git a/fbbrowser/main.cpp b/fbbrowser/main.cpp
index e0210f5..fc333fb 100644
--- a/fbbrowser/main.cpp
+++ b/fbbrowser/main.cpp
@@ -5,17 +5,23 @@
int main(int argc, char *argv[])
{
+ // This is the main object of a QT Application.
QApplication a(argc, argv);
+ // Is this really needed, since we kill the app through the fbbrowser object?
QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
+ // This part reads the URL to load from the arguments given through the commandline.
QUrl url;
if (argc > 1)
url = QUrl(argv[1]);
- else //Default
+ else //Default URL to load
url = QUrl("http://132.230.4.3/webkitTest.html");
-
+ // Create a new Framebuffer-Browser object for displaying the given URL.
fbbrowser *fbb = new fbbrowser(url);
+ // Listen to the signalQuitAll() Signal to kill the app from within the browser.
QObject::connect(fbb, SIGNAL(signalQuitAll()), &a, SLOT(quit()));
+ // Display the browser.
fbb->show();
+ // Exit the application.
return a.exec();
}
diff --git a/fbbrowser/testApp.sh b/fbbrowser/testApp.sh
new file mode 100755
index 0000000..57f37b7
--- /dev/null
+++ b/fbbrowser/testApp.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+# Start QT's virtual framebuffer
+/usr/local/Trolltech/Qt-4.7.1/bin/qvfb -width 800 -height 600 &
+# Wait for it to load (needed?)
+sleep 1
+# Start the fbbrowser app.
+# This requires the fbgui git repository to be in the user's home directory.
+~/fbgui/fbbrowser/fbbrowser -qws
+# Check if fbbrowser is not running, if so kill the qvfb.
+if ps aux | grep -v grep | grep fbbrowser > /dev/null
+then
+ echo "fbbrowser is still running ..."
+else
+ echo "fbbrowser stopped running, killing qvfb ..."
+ killall qvfb
+fi