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-2012 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 bool single_dir = false;
60 for( int i = 1; i < argc; i++ ) {
61 QString a = QString( argv[i] );
62 if ( a == "--version" || a == "-v" ) {
63 printf("SALOME Installation Wizard version %d.%d.%d (Qt version %d.%d.%d)\n",
64 ( __IW_VERSION__ / 10000 ),
65 ( __IW_VERSION__ / 100 % 100 ),
66 ( __IW_VERSION__ % 100 ) ,
67 ( QT_VERSION >> 16 ) & 0xFF,
68 ( QT_VERSION >> 8 ) & 0xFF,
69 ( QT_VERSION ) & 0xFF );
70 printf("Copyright (C) 2002-2012 CEA\n");
73 else if ( a == "--target" || a == "-d" ) {
75 if ( i < argc-1 && !QString( argv[i+1] ).startsWith("-") ) {
76 targetDirPath = argv[i+1];
80 targetDirPath = QString::null;
83 else if ( a == "--tmp" || a == "-t" ) {
85 if ( i < argc-1 && !QString( argv[i+1] ).startsWith("-") ) {
86 tmpDirPath = argv[i+1];
90 tmpDirPath = QString::null;
93 else if ( a == "--file" || a == "-f" ) {
95 if ( i < argc-1 && !QString( argv[i+1] ).startsWith("-") ) {
96 xmlFileName = argv[i+1];
100 xmlFileName = QString::null;
103 else if ( a == "--all-from-sources" || a == "-a" ) {
106 else if ( a == "--single-directory" || a == "-s" ) {
110 if ( has_xml && xmlFileName.isEmpty() ) {
111 printf("Please specify the configuration XML file!\n");
114 if ( has_target && targetDirPath.isEmpty() ) {
115 printf("Please specify the target directory path!\n");
118 if ( has_tmp && tmpDirPath.isEmpty() ) {
119 printf("Please specify the temprary directory path!\n");
123 QApplication a( argc, argv );
124 a.setFont( QFont( "Sans", 12 ) );
127 QFile xmlfile(xmlFileName);
128 if ( !xmlfile.exists() ) {
129 QMessageBox::critical( 0,
130 QObject::tr( "Error" ),
131 QObject::tr( "Can't open config file:\n%1\n\nQuitting...").arg( xmlFileName ),
133 QMessageBox::NoButton,
134 QMessageBox::NoButton );
138 SALOME_InstallWizard wizard(xmlFileName, targetDirPath, tmpDirPath, force_src, single_dir);
139 a.setMainWidget( &wizard );