main.cpp
author Markus Bröker <mbroeker@largo.homelinux.org>
Sat, 13 Dec 2008 15:47:48 +0100
changeset 3 724e07a9f155
parent 0 826dd5531eb0
child 4 fdf04a93faeb
permissions -rw-r--r--
PacketWriter.cpp: cstdlib header added Source Base indented with GNU indent
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
     1
/*
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
     2
 *  $Id: main.cpp 54 2008-01-10 00:24:52Z mbroeker $
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
     3
 * $URL: http://localhost/svn/cpp/qMonitor/trunk/main.cpp $
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
     4
 */
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
     5
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
     6
#include <QApplication>
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
     7
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
     8
#include "include/monitor.h"
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
     9
#include <version.h>
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
    10
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
    11
int main (int argc, char *argv[])
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
    12
{
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
    13
    int i;
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
    14
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
    15
    while ((i = getopt (argc, argv, "hv")) >= 0) {
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
    16
        switch (i) {
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
    17
        case 'h':
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
    18
            std::cout << "Usage: " << argv[0] << " [OPTIONS]" << std::endl;
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
    19
            std::cout << "qMonitor displays the online traffic." << std::endl << std::endl;
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
    20
            std::cout << "Options:" << std::endl << std::endl;
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
    21
            std::cout << "-h: \t\t\tShow this help" << std::endl;
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
    22
            std::cout << "-v: \t\t\tShow Version" << std::endl;
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
    23
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
    24
            exit (0);
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
    25
            break;
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
    26
        case 'v':
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
    27
            std::cout << VERSION_STRING << std::endl;
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
    28
            exit (0);
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
    29
            break;
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
    30
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
    31
        default:
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
    32
            ;
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
    33
        }
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
    34
    }
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
    35
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
    36
    QApplication app (argc, argv);
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
    37
    Monitor *dialog = new Monitor;
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
    38
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
    39
    dialog->show ();
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
    40
    return app.exec ();
826dd5531eb0 svn copy of qmonitor
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff changeset
    41
}