// Qt Viewer for libVRML97
//
// Copyright (C) 1999 by Kenneth Bentley <bentley@nuc.net>
//
// This software may be distributed under the terms of the Q
// Public License, version 1.0 or later. Please see the file LICENSE for 
// terms. 

// based on libVRML97 by Chris Morley. and gtkLookat, by Erik Andersen

// libVRML97 is Copyright (C) 1998,1999 Chris Morley (cmorley@vermontel.com)

// gtkLookat is Copyright (C) 1998 by Erik Andersen <andersee@debian.org> under
// the terms of the GNU Public License. Erik Anderson has granted permission to 
// license this derivative work under QPL.


#include <stdio.h>
#include <qgl.h>
#include <qapplication.h>
#include <mainwgt.h>
#include "qSystem.h"

qSystem qtSystem;
static int PLUGIN_MODE = 0;

int main( int argc, char **argv )
{
    QApplication::setColorSpec( QApplication::ManyColor );
    QApplication a( argc, argv );

    if ( !QGLFormat::hasOpenGL() ) {
	warning( "This system has no Qt OpenGL support. Exiting." );
	return -1;
    }

    mainWgt w;
    a.setMainWidget( &w );
    w.show();
	//theSystem.set_receiver( &w );
    qtSystem.set_receiver( &w );
    //theSystem =  &qtSystem;
	System *theSystem =  &qtSystem;
	//// The global System object
	//System *theSystem = &defaultSystem;

    if ( a.argc() > 0 ){
        // should only be one argv. extras are ignored
        w.load( a.argv()[1]);
    }
    return a.exec();
}

