Salome HOME
Merge relevant changes from V8_0_0_BR branch
[modules/gui.git] / src / SalomeApp / SalomeApp_Application.cxx
index 11d041cb7b1d981046b13b446671176f0af93d85..8927c1630cf14d4cf724dcadc81b72dc44988c7e 100644 (file)
@@ -84,6 +84,7 @@
 #include <SALOME_LifeCycleCORBA.hxx>
 
 #include <QApplication>
+#include <QWidget>
 #include <QAction>
 #include <QRegExp>
 #include <QCheckBox>
@@ -206,9 +207,9 @@ void SalomeApp_Application::start()
     QStringList pyfiles;
     QString loadStudy;
 
-    for (int i = 1; i < qApp->argc(); i++) {
+    for (int i = 1; i < qApp->arguments().size(); i++) {
       QRegExp rxs ("--study-hdf=(.+)");
-      if ( rxs.indexIn( QString(qApp->argv()[i]) ) >= 0 && rxs.capturedTexts().count() > 1 ) {
+      if ( rxs.indexIn( qApp->arguments()[i] ) >= 0 && rxs.capturedTexts().count() > 1 ) {
         QString file = rxs.capturedTexts()[1];
         QFileInfo fi ( file );
         QString extension = fi.suffix().toLower();
@@ -217,7 +218,7 @@ void SalomeApp_Application::start()
       }
       else {
         QRegExp rxp ("--pyscript=\\[(.+)\\]");
-        if ( rxp.indexIn( QString(qApp->argv()[i]) ) >= 0 && rxp.capturedTexts().count() > 1 ) {
+        if ( rxp.indexIn( qApp->arguments()[i] ) >= 0 && rxp.capturedTexts().count() > 1 ) {
           // pyscript
           QStringList dictList = rxp.capturedTexts()[1].split("},", QString::SkipEmptyParts);
           for (int k = 0; k < dictList.count(); ++k) {
@@ -895,7 +896,7 @@ void SalomeApp_Application::onDumpStudy( )
   DumpStudyFileDlg fd( desktop() );
   fd.setValidator( new DumpStudyFileValidator( &fd ) );
   fd.setWindowTitle( tr( "TOT_DESK_FILE_DUMP_STUDY" ) );
-  fd.setFilters( aFilters );
+  fd.setNameFilters( aFilters );
   fd.myPublishChk->setChecked( anIsPublish );
   fd.myMultiFileChk->setChecked( anIsMultiFile );
   fd.mySaveGUIChk->setChecked( anIsSaveGUI );
@@ -1314,8 +1315,24 @@ void SalomeApp_Application::moduleActionSelected( const int id )
 /*!Gets CORBA::ORB_var*/
 CORBA::ORB_var SalomeApp_Application::orb()
 {
-  ORB_INIT& init = *SINGLETON_<ORB_INIT>::Instance();
-  static CORBA::ORB_var _orb = init( qApp->argc(), qApp->argv() );
+  static CORBA::ORB_var _orb;
+
+  if ( CORBA::is_nil( _orb ) ) {
+    QStringList args = QApplication::arguments();
+    int argc = args.size();
+    std::vector<std::string> args1(argc);
+    char** argv = new char*[argc];
+    for ( int i = 0; i < argc; ++i ) {
+      args1[i] = args[i].toStdString();
+      argv[i]  = const_cast<char*>( args1[i].c_str() );
+    }
+
+    ORB_INIT& init = *SINGLETON_<ORB_INIT>::Instance();
+    _orb = init( argc, argv );
+
+    delete [] argv;
+  }
+
   return _orb;
 }