Salome HOME
Move icons to the cxx file
[tools/install.git] / src / main.cxx
1 //  File      : main.cxx 
2 //  Created   : Thu Dec 18 12:01:00 2002
3 //  Author    : Vadim SANDLER
4 //  Project   : SALOME
5 //  Module    : Installation Wizard
6 //  Copyright : 2004-2005 CEA
7
8 #include "globals.h"
9
10 #include "SALOME_InstallWizard.hxx"
11 #include <qapplication.h>
12 #include <qfile.h>
13 #include <qmessagebox.h>
14
15 // ================================================================
16 /*!
17  *  MessageOutput
18  *  Qt's messages handler funcion
19  */
20 // ================================================================
21 void MessageOutput( QtMsgType type, const char *msg )
22 {
23   switch ( type ) {
24   case QtDebugMsg:
25     ___DEBUG___( msg );
26     break;
27   case QtWarningMsg:
28     ___WARNING___( msg );
29     break;
30   case QtFatalMsg:
31     ___FATAL___( msg );
32     break;
33   }
34 }
35
36 // ================================================================
37 /*!
38  *  main
39  *  Program starts here
40  */
41 // ================================================================
42 int main( int argc, char **argv )
43 {
44   qInstallMsgHandler( MessageOutput );
45   QApplication a( argc, argv );
46   a.setFont( QFont("Helvetica", 9 ) );
47   QString xmlFileName( argc == 2 ? argv[1] : "config.xml" );
48   
49   int result = -1;
50   QFile xmlfile(xmlFileName);
51   if ( xmlfile.exists() ) {
52     SALOME_InstallWizard wizard(xmlFileName);
53     a.setMainWidget( &wizard );
54     wizard.show();
55     result = a.exec();
56   }
57   else {
58     QMessageBox::critical( 0, 
59                            QObject::tr( "Error" ), 
60                            QObject::tr( "Can't open config file:\n%1\n\nQuitting...").arg( xmlFileName ), 
61                            QMessageBox::Ok,
62                            QMessageBox::NoButton, 
63                            QMessageBox::NoButton );
64   }
65   return result;
66 }
67