summaryrefslogblamecommitdiffstats
path: root/src/fbgui.cpp
blob: cc10f206bd19ca9b1a39abe3776145d23a973baa (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                  
                               
                      
                            
 
                       

                    

                 

                                     
                              
                                                                  






                                                                                                               

                                
                             
                                                 


                                                               
                             




                                                                 

                                                   

                                                               

                                                                                 
 
                                                                            

                                        
                                                                                    
                                                               
 


                           
                               

                    
#include "fbgui.h"
#include "CommandLineOptions.h"
#include "fbbrowser.h"
#include "DownloadManager.h"

#include <QApplication>
#include <QSettings>

void printUsage()
{
    // Prints usage information.
	// TODO: Complete usage info.
    QTextStream qout(stdout); 
    qout << QObject::tr("Usage: ./fbgui [OPTIONS] <URL>") << endl;
    qout << QObject::tr("Options:") << endl;
    qout << "-h or --help " << QObject::tr("Prints usage information.") << endl;
    qout << "-qws         " << QObject::tr("Set this application to also be the server application.")  << endl;
    qout << "             " << QObject::tr("Skip this option if you have a QT server application") << endl;
    exit(1);
}

int main(int argc, char *argv[])
{
	/*  SETTINGS TEST  */
	CommandLineOptions clOptions(argc, argv);

	// TODO: parse url arg from CommmandLineOptions object.
	// hackfix for now...
    QUrl url = QUrl(argv[4]);
    QUrl defaultUrl = QUrl("http://132.230.4.3/webkitTest.html");
    qDebug() << "URL given: " << url.toString();

	/*  SETTINGS TEST  */

    // This is the main object of a QT Application.
    QApplication a(argc, argv);
    // Get the application path and prints on screen.
    qDebug() << "Application Path: " << a.applicationDirPath();
    // Is this really needed, since we kill the app through the fbbrowser object?
    QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));

    // 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(killApp()), &a, SLOT(quit()));

    // Display the browser.
    fbb->show();

    // Execute the application.
    return a.exec();
}