Salome HOME
Fix a bug of config file for RedHat 9 - correct binaries distribution path
[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   QString xmlFileName( argc == 2 ? argv[1] : "config.xml" );
47   
48   int result = -1;
49   QFile xmlfile(xmlFileName);
50   if ( xmlfile.exists() ) {
51     SALOME_InstallWizard wizard(xmlFileName);
52     a.setMainWidget( &wizard );
53     wizard.show();
54     result = a.exec();
55   }
56   else {
57     QMessageBox::critical( 0, 
58                            QObject::tr( "Error" ), 
59                            QObject::tr( "Can't open config file:\n%1\n\nQuitting...").arg( xmlFileName ), 
60                            QMessageBox::Ok,
61                            QMessageBox::NoButton, 
62                            QMessageBox::NoButton );
63   }
64   return result;
65 }
66