home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / qt3_emx.zip / examples / life / main.cpp < prev    next >
C/C++ Source or Header  |  2001-10-11  |  1KB  |  46 lines

  1. /****************************************************************************
  2. ** $Id:  qt/main.cpp   3.0.0   edited Jun 22 13:24 $
  3. **
  4. ** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
  5. **
  6. ** This file is part of an example program for Qt.  This example
  7. ** program may be used, distributed and modified without limitation.
  8. **
  9. *****************************************************************************/
  10.  
  11. #include "lifedlg.h"
  12. #include <qapplication.h>
  13. #include <stdlib.h>
  14.  
  15. void usage()
  16. {
  17.     qWarning( "Usage: life [-scale scale]" );
  18. }
  19.  
  20. int main( int argc, char **argv )
  21. {
  22.     QApplication a( argc, argv );
  23.  
  24.     int scale = 10;
  25.  
  26.     for ( int i = 1; i < argc; i++ ){
  27.         QString arg = argv[i];
  28.     if ( arg == "-scale" )
  29.         scale = atoi( argv[++i] );
  30.     else {
  31.         usage();
  32.         exit(1);
  33.     }
  34.     }
  35.  
  36.     if ( scale < 2 )
  37.     scale = 2;
  38.  
  39.     LifeDialog *life = new LifeDialog( scale );
  40.     a.setMainWidget( life );
  41.     life->setCaption("Qt Example - Life");
  42.     life->show();
  43.  
  44.     return a.exec();
  45. }
  46.