/*******************************************************************************
*                                                                              *
* Société de Transports de Montréal.                                    	   *
* 2012                                                                         *
*                                                                              *
* Projet Zones Tests                                                           *
*                                                                              *
*                                                                              *
*                                                                              *
*******************************************************************************/
/*
    Description:
    Le main.

*/

/* ************************************************************************** */
/* Revision:
### 20121210 JFM
    Verision d'origine.

### YYYYMMDD Description du besoin ou du bug
    Description du changement.
 */

/* ************************************************************************** */
#include <QApplication>
#include "Zonetest.h"
#include "MainPanel.h"
#include "ZTVersion.h"
#include <qobject.h>

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

	QApplication::setGraphicsSystem("raster");
	//Qt Mainframe application instance.
	QApplication a(argc, argv);

	QFont serifFont("Times", 10, QFont::Bold);
	QApplication::setFont(serifFont);




	bool FullScreen = true;
	bool SimulLazerProbes = false;
	bool IgnoreStationKey = false;
	bool DisablePassword = false;
    bool UseWatchdog = true;
    bool NoReboot = false;

	for ( int i = 1 ; i < argc ; i ++ )
	{
		// qDebug("%d %s",i,argv[i]);
		if ( strcmp(argv[i],"-windowed") == 0 )
		{
			FullScreen = false;
		}
		else if ( strcmp(argv[i],"-simullazer") == 0 )
		{
			SimulLazerProbes = true;
		}
		else if ( strcmp(argv[i],"-ignorekey") == 0 )
		{
			IgnoreStationKey = true;
		}
		else if ( strcmp(argv[i],"-disablepassword") == 0 )
		{
			DisablePassword = true;
		}
        else if ( strcmp(argv[i],"-disablewatchdog") == 0 )
        {
            UseWatchdog = false;
        }
        else if ( strcmp(argv[i],"-noreboot") == 0 )
        {
            NoReboot = true;
        }
        else if ( strcmp(argv[i],"-version") == 0 )
        {
            qDebug("ZoneTest version: %s",ZT_SOFT_VERSION);
            return 99;
        }
	}
    //Create program instance
    CZoneTest ZoneTest;

	ZoneTest.mFullScreen = FullScreen;
	ZoneTest.mSimulateLazerProbes = SimulLazerProbes;
	ZoneTest.mIgnoreStationPhysicalKey = IgnoreStationKey;
	ZoneTest.mDisablePassword = DisablePassword;
    ZoneTest.mUseWatchdog = UseWatchdog;
    ZoneTest.mDoNotReboot = NoReboot;


	//setup stdout for screen printing.
    setvbuf(stdout, NULL, _IONBF, 0 );

    //Run Zone Tests
    ZoneTest.Start();


    return a.exec();


}
