2 // Created : Thu Dec 18 12:01:00 2002
3 // Author : Vadim SANDLER, Open CASCADE SAS (vadim.sandler@opencascade.com)
5 // Module : Installation Wizard
6 // Copyright : 2002-2007 CEA
10 #include "SALOME_InstallWizard.hxx"
11 #include <qapplication.h>
13 #include <qmessagebox.h>
15 // ================================================================
18 * Qt's messages handler funcion
20 // ================================================================
21 void MessageOutput( QtMsgType type,
42 // ================================================================
47 // ================================================================
48 int main( int argc, char **argv )
50 qInstallMsgHandler( MessageOutput );
53 QString targetDirPath;
56 bool has_target = false;
58 for( int i = 1; i < argc; i++ ) {
59 QString a = QString( argv[i] );
60 if ( a == "--version" || a == "-v" ) {
61 printf("SALOME Installation Wizard version %d.%d.%d ",
62 ( __IW_VERSION__ / 10000 ),
63 ( __IW_VERSION__ / 100 % 100 ),
64 ( __IW_VERSION__ % 100 ) );
65 printf("(Qt version %d.%d.%d)\n",
66 ( QT_VERSION >> 16 ) & 0xFF,
67 ( QT_VERSION >> 8 ) & 0xFF,
68 ( QT_VERSION ) & 0xFF );
71 else if ( a == "--target" || a == "-d" ) {
73 if ( i < argc-1 && !QString( argv[i+1] ).startsWith("-") ) {
74 targetDirPath = argv[i+1];
78 targetDirPath = QString::null;
81 else if ( a == "--tmp" || a == "-t" ) {
83 if ( i < argc-1 && !QString( argv[i+1] ).startsWith("-") ) {
84 tmpDirPath = argv[i+1];
88 tmpDirPath = QString::null;
91 else if ( a == "--file" || a == "-f" ) {
93 if ( i < argc-1 && !QString( argv[i+1] ).startsWith("-") ) {
94 xmlFileName = argv[i+1];
98 xmlFileName = QString::null;
102 if ( has_xml && xmlFileName.isEmpty() ) {
103 printf("Please specify the configuration XML file!\n");
106 if ( has_target && targetDirPath.isEmpty() ) {
107 printf("Please specify the target directory path!\n");
110 if ( has_tmp && tmpDirPath.isEmpty() ) {
111 printf("Please specify the temprary directory path!\n");
115 QApplication a( argc, argv );
116 a.setFont( QFont( "Sans", 12 ) );
119 QFile xmlfile(xmlFileName);
120 if ( !xmlfile.exists() ) {
121 QMessageBox::critical( 0,
122 QObject::tr( "Error" ),
123 QObject::tr( "Can't open config file:\n%1\n\nQuitting...").arg( xmlFileName ),
125 QMessageBox::NoButton,
126 QMessageBox::NoButton );
130 SALOME_InstallWizard wizard(xmlFileName, targetDirPath, tmpDirPath);
131 a.setMainWidget( &wizard );