/*******************************************/
/*                                         */
/*           viewer application            */
/*             beta test v 1.0             */
/*                                         */
/*******************************************/

#include "window.h"

using namespace morpheo::tools::viewer::parser;
using namespace morpheo::tools::viewer::bdd;
using namespace morpheo::tools::viewer::graphics;

using namespace std;

int main (int argc, char* argv[])
{
  if(argc>2){
    cout << "error : argument must be a file name or nothing" << endl;
    return 0;
  }

  Parse *par = new Parse();

  
   QApplication *a=new QApplication (argc,argv);  
   
   if(argc == 2){
     if(par->open_file(argv[1])==-1){
	cout << "file doesn't exist or is not a valid format" << endl;  
	exit(1);
     }
     Window *win = new Window(QString(argv[1]));
     win->_setParse(par);
     win->_init_file();
     win->show();
   }

   else{
     
     Window *win = new Window(NULL);
     win->_setParse(par);
     win->show();
   }
    

  a->setStyle(new QPlastiqueStyle);

  return a->exec();
  
}
