From b50c681d6fac718f65abf58057889fcbe9b6aa10 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Sat, 5 Mar 2011 20:42:59 +0100 Subject: help fixed, misc cleanups... --- src/fbgui.cpp | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'src/fbgui.cpp') diff --git a/src/fbgui.cpp b/src/fbgui.cpp index 6b70214..3fad734 100644 --- a/src/fbgui.cpp +++ b/src/fbgui.cpp @@ -27,24 +27,37 @@ int main(int argc, char *argv[]) // This is the main object of a QT Application. QApplication a(argc, argv); + // Note: The QT arguments (-qws, -display etc) seems to be gone at this point. + // So we should be able to ignore the QT arguments when calling fbgui, + // and add them "manually" to argc/argv here? Testworthy! + /* SETTINGS TEST */ CommandLineOptions clOptions(argc, argv); + + // Check if help was requested, if so printUsage() and exit. + if (clOptions.contains("help")) + { + qDebug() << "Help requested. Printing usage info. Exiting..."; + printUsage(); + // Not quite sure what the best exit statement is. + // Maybe better a.quit() ? + //exit(0); + // Probably use the EXIT_SUCCESS / EXIT_FAILURE constants as defined in "man exit" + return EXIT_SUCCESS; + } + + // Check if URL was given at cmdline argument, + // if not set default. QUrl url; if (clOptions.contains("url")) - { - qDebug() << "URL from clOptions is: " << clOptions.value("url"); url = clOptions.value("url"); - } else url = QUrl("qrc:/html/errorPage.html"); - // TODO: parse url arg from CommmandLineOptions object. - /* SETTINGS TEST */ // 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. -- cgit v1.2.3-55-g7522