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 bool force_src = false;
59 for( int i = 1; i < argc; i++ ) {
60 QString a = QString( argv[i] );
61 if ( a == "--version" || a == "-v" ) {
62 printf("SALOME Installation Wizard version %d.%d.%d ",
63 ( __IW_VERSION__ / 10000 ),
64 ( __IW_VERSION__ / 100 % 100 ),
65 ( __IW_VERSION__ % 100 ) );
66 printf("(Qt version %d.%d.%d)\n",
67 ( QT_VERSION >> 16 ) & 0xFF,
68 ( QT_VERSION >> 8 ) & 0xFF,
69 ( QT_VERSION ) & 0xFF );
72 else if ( a == "--target" || a == "-d" ) {
74 if ( i < argc-1 && !QString( argv[i+1] ).startsWith("-") ) {
75 targetDirPath = argv[i+1];
79 tmpDirPath = QString::null;
82 else if ( a == "--tmp" || a == "-t" ) {
84 if ( i < argc-1 && !QString( argv[i+1] ).startsWith("-") ) {
85 tmpDirPath = argv[i+1];
89 tmpDirPath = QString::null;
92 else if ( a == "--file" || a == "-f" ) {
94 if ( i < argc-1 && !QString( argv[i+1] ).startsWith("-") ) {
95 xmlFileName = argv[i+1];
99 xmlFileName = QString::null;
102 else if ( a == "--all-from-sources" || a == "-a" ) {
106 if ( has_xml && xmlFileName.isEmpty() ) {
107 printf("Please specify the configuration XML file!\n");
110 if ( has_target && targetDirPath.isEmpty() ) {
111 printf("Please specify the target directory path!\n");
114 if ( has_tmp && tmpDirPath.isEmpty() ) {
115 printf("Please specify the temprary directory path!\n");
119 if ( xmlFileName.isEmpty() )
120 xmlFileName = "config.xml";
122 QApplication a( argc, argv );
123 a.setFont( QFont( "Sans", 12 ) );
126 QFile xmlfile(xmlFileName);
127 if ( xmlfile.exists() ) {
128 SALOME_InstallWizard wizard(xmlFileName, targetDirPath, tmpDirPath, force_src);
129 a.setMainWidget( &wizard );
134 QMessageBox::critical( 0,
135 QObject::tr( "Error" ),
136 QObject::tr( "Can't open config file:\n%1\n\nQuitting...").arg( xmlFileName ),
138 QMessageBox::NoButton,
139 QMessageBox::NoButton );