Subversion Repositories svn1-original

Rev

Rev 324 | Blame | Compare with Previous | Last modification | View Log | RSS feed

/*************************************************************************
*           Copyright (C) 1992 Embedded Solutions.
*                       All rights reserved
*
* file:         mara.c
*
* purpose:      Main entry point
*               Marathon program  program
*
* functions:
*       main                    - Main entry point
*       usage                   - Display general usage message
*       ms_system               - Temp escape to DOS
*       test_legal_version      - Test program version
*
*
* programmer: David Purdie (DDP)
*
* revision  date        by      reason
*           13-May-91   DDP     Added a nasty.
*                               This program will produce funny results if
*                               the system date is after 1-Jan-92.
*
*           25-Oct-91   DDP     Version 2.01 will not produce funny results
*
*   00.0    6-Nov-92    DDP     Ansified existing code
*   00.0    27/01/95    DDP     Tidies up the program and formatted the file
*
**************************************************************************/
#include    <QtGui/QApplication>
#include    <QMessageBox>

#include    <time.h>
#include    "consts.h"
#include    "structs.h"
#include    "proto.h"

#include    "qmconfteams.h"
#include    "mainwindow.h"
#include    "qmconfig.h"
#include    "qmteamdata.h"

#undef      DISPLAY_STRUCTURES

/*============================================================================
 *  Main entry point
 *
 *  Purpose:
 *      Main enrty point
 *      Load configuration file
 *      Locate data base
 *      Perform copyright stuff
 *      Process top level menu
 *
 *  Parameters:
 *      argc    - number of arguments
 *      argv    - pointer to first argument pointer
 *      
 *      
 *  Returns:
 *      program exit code
 *          0 - All is well
 *          1 -
 *          2 - 
 *
 *===========================================================================*/

int main( int argc, char *argv[] )
{
    QString       eventFile;
    QApplication a(argc, argv);

    /*
    **  Verify command arguments
    */
//    if( argc < 2 )
//        usage();

    /*
    **  Walk the user arguments and extract switches and file names
    */
    while( --argc )
    {
        argv++;
        if( argv[0][0] == '-' )
        {
            switch( argv[0][1] )
            {
                /*
                **  Unknown switch
                */
              default:
                usage();
            }
        }
        else
        {
            /*
            **  Parameter without a switch
            **  Must be the input file name
            */
            if( !eventFile.isEmpty() )                   /* Already defined */
            {
                qWarning("Mutiple input files found");
            }
            eventFile = argv[0];
        }
    }

    config.load(eventFile);
    QmTeamData  teamDataReader;
    teamDataReader.initTeamData(NULL);

    MainWindow w;
    w.show();

    MainWindow::showMessage ("Mara Started", 5000);
    return a.exec();
  }

/*============================================================================
 *
 *  Display general usage message
 *
 *  Purpose:
 *      Display general usage message
 *      Used on command line syntax error
 *      
 *  Parameters:
 *      None
 *      
 *  Returns:
 *      exit code 3
 *      
 *===========================================================================*/

void usage(void)
{
    QMessageBox::question ( 0, "Usage",
                           "mara [options] config_file\n"
                           "Options are:\n"
                           "    No options yet",
                           QMessageBox::Ok
                           );
    exit( 3 );
}



/********************************* EOF ***********************************/