main.cpp
author Markus Bröker <mbroeker@largo.homelinux.org>
Tue, 02 Feb 2010 13:26:30 +0100
changeset 8 6097dc1fe2cf
parent 4 fdf04a93faeb
permissions -rw-r--r--
perror is declared in cstdio

/*
 *  $Id: main.cpp 54 2008-01-10 00:24:52Z mbroeker $
 * $URL: http://localhost/svn/cpp/qMonitor/trunk/main.cpp $
 */

#include <QApplication>
#include <cstdlib>

#include "include/monitor.h"
#include <version.h>

int main (int argc, char *argv[])
{
    int i;

    while ((i = getopt (argc, argv, "hv")) >= 0) {
        switch (i) {
        case 'h':
            std::cout << "Usage: " << argv[0] << " [OPTIONS]" << std::endl;
            std::cout << "qMonitor displays the online traffic." << std::endl << std::endl;
            std::cout << "Options:" << std::endl << std::endl;
            std::cout << "-h: \t\t\tShow this help" << std::endl;
            std::cout << "-v: \t\t\tShow Version" << std::endl;

            exit (0);
            break;
        case 'v':
            std::cout << VERSION_STRING << std::endl;
            exit (0);
            break;

        default:
            ;
        }
    }

    QApplication app (argc, argv);
    Monitor *dialog = new Monitor;

    dialog->show ();
    return app.exec ();
}