summaryrefslogtreecommitdiffstats
path: root/fbbrowser/main.cpp
blob: b6c6dacc944bdbc3f17d6bfc249889237bf1b01d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "fbbrowser.h"

#include <QtGui>
#include <QApplication>

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 URL to load
                url = QUrl("http://132.230.4.3/webkitTest.html");
    // Check if the URL is valid.
    // TODO(joe): also check for correct host
    //            handle the case of a non-valid URL properly.
    if (!url.isValid())
    	qDebug() << "Invalid URL.";
    else
    {
	qDebug() << "Valid URL.";
        // 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();
}