From: mkr Date: Tue, 26 Jun 2007 10:58:37 +0000 (+0000) Subject: Porting to Qt4. X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e61653549a11250419cff6680f5907d28b85aef4;p=modules%2Fgui.git Porting to Qt4. --- diff --git a/src/Makefile.am b/src/Makefile.am index bb9403f44..10d3e60b5 100755 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -67,5 +67,5 @@ if GUI_ENABLE_CORBA # VSR: this is the original packages list # SUBDIRS += TOOLSGUI Session SalomeApp SALOME_SWIG SALOME_PY SALOME_PYQT # VSR: already migrated to Qt4 packages - SUBDIRS += TOOLSGUI SalomeApp + SUBDIRS += TOOLSGUI Session SalomeApp endif diff --git a/src/Session/SALOME_Session_Server.cxx b/src/Session/SALOME_Session_Server.cxx index 8520c96d2..acfb2ebfb 100755 --- a/src/Session/SALOME_Session_Server.cxx +++ b/src/Session/SALOME_Session_Server.cxx @@ -29,29 +29,23 @@ #include "Utils_ORB_INIT.hxx" #include "Utils_SINGLETON.hxx" #include "SALOME_NamingService.hxx" -#include "SALOMETraceCollector.hxx" -#include -#ifndef WIN32 -#include -#endif - -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include "Utils_SALOME_Exception.hxx" #include "Utils_CorbaException.hxx" -#include "SALOME_Event.hxx" +#include "SALOME_Event.h" #include #include CORBA_SERVER_HEADER(SALOME_Session) #include CORBA_SERVER_HEADER(SALOMEDS) #include -#include "Session_Session_i.hxx" #include "Session_ServerLauncher.hxx" #include "Session_ServerCheck.hxx" @@ -60,7 +54,6 @@ #include "SUIT_Session.h" #include "SUIT_Application.h" #include "SUIT_Desktop.h" -#include "SUIT_MessageBox.h" #include "SUIT_ResourceMgr.h" #include "SUIT_ExceptionHandler.h" @@ -131,11 +124,11 @@ QString salomeVersion() path += QString( "bin/salome/VERSION" ); QFile vf( path ); - if ( !vf.open( IO_ReadOnly ) ) + if ( !vf.open( QIODevice::ReadOnly ) ) return QString::null; - QString line; - vf.readLine( line, 1024 ); + QString line( vf.readLine( 1024 ) ); + vf.close(); if ( line.isEmpty() ) @@ -145,9 +138,9 @@ QString salomeVersion() line.remove( line.length() - 1, 1 ); QString ver; - int idx = line.findRev( ":" ); + int idx = line.lastIndexOf( ":" ); if ( idx != -1 ) - ver = line.mid( idx + 1 ).stripWhiteSpace(); + ver = line.mid( idx + 1 ).trimmed(); return ver; } @@ -168,8 +161,8 @@ public: resMgr.loadLanguage( "LightApp", "en" ); resMgr.loadLanguage( "SalomeApp", "en" ); - myExtAppName = QObject::tr( "APP_NAME" ).stripWhiteSpace(); - if ( myExtAppName == "APP_NAME" || myExtAppName.lower() == "salome" ) + myExtAppName = QObject::tr( "APP_NAME" ).trimmed(); + if ( myExtAppName == "APP_NAME" || myExtAppName.toLower() == "salome" ) myExtAppName = "SalomeApp"; myExtAppVersion = QObject::tr( "APP_VERSION" ); if ( myExtAppVersion == "APP_VERSION" ) { @@ -196,15 +189,15 @@ protected: QString fname = QFileInfo( _fname ).fileName(); if( exp.exactMatch( fname ) ) { - QStringList vers = QStringList::split( ".", exp.cap( 1 ) ); + QStringList vers = exp.cap( 1 ).split( ".", QString::SkipEmptyParts ); int major=0, minor=0; major = vers[0].toInt(); minor = vers[1].toInt(); - if( vers_exp.search( vers[2] )==-1 ) + if( vers_exp.indexIn( vers[2] )==-1 ) return -1; int release = 0, dev1 = 0, dev2 = 0; release = vers_exp.cap( 1 ).toInt(); - dev1 = vers_exp.cap( 2 )[ 0 ].latin1(); + dev1 = vers_exp.cap( 2 )[ 0 ].toLatin1(); dev2 = vers_exp.cap( 3 ).toInt(); int dev = dev1*100+dev2, id = major; @@ -344,7 +337,7 @@ int main( int argc, char **argv ) splash = QtxSplash::splash( px ); // ...set splash text colors if ( !splashTextColors.isEmpty() ) { - QStringList colors = QStringList::split( "|", splashTextColors ); + QStringList colors = splashTextColors.split( "|", QString::SkipEmptyParts ); QColor c1, c2; if ( colors.count() > 0 ) c1 = QColor( colors[0] ); if ( colors.count() > 1 ) c2 = QColor( colors[1] ); @@ -355,12 +348,12 @@ int main( int argc, char **argv ) } // ...set splash progress colors if ( !splashProgressColors.isEmpty() ) { - QStringList colors = QStringList::split( "|", splashProgressColors ); + QStringList colors = splashProgressColors.split( "|", QString::SkipEmptyParts ); QColor c1, c2; - int gradType = QtxSplash::Vertical; + QtxSplash::GradientType gradType = QtxSplash::Vertical; if ( colors.count() > 0 ) c1 = QColor( colors[0] ); if ( colors.count() > 1 ) c2 = QColor( colors[1] ); - if ( colors.count() > 2 ) gradType = colors[2].toInt(); + if ( colors.count() > 2 ) gradType = QtxSplash::GradientType( colors[2].toInt() ); splash->setProgressColors( c1, c2, gradType ); } // ...set splash text font diff --git a/src/Session/SalomeApp_Engine_i.cxx b/src/Session/SalomeApp_Engine_i.cxx index 813270515..855cb8cf7 100644 --- a/src/Session/SalomeApp_Engine_i.cxx +++ b/src/Session/SalomeApp_Engine_i.cxx @@ -30,8 +30,6 @@ #include "SALOMEDS_Tool.hxx" -#include "utilities.h" - #include using namespace std; diff --git a/src/Session/Session_ServerCheck.cxx b/src/Session/Session_ServerCheck.cxx index 3642f0407..7a27b1f2a 100644 --- a/src/Session/Session_ServerCheck.cxx +++ b/src/Session/Session_ServerCheck.cxx @@ -32,8 +32,12 @@ #include "Utils_ORB_INIT.hxx" #include "Utils_SINGLETON.hxx" #include "SALOME_NamingService.hxx" -#include "utilities.h" #include "OpUtil.hxx" +#include "utilities.h" + +#include +#include +#include // Default settings const int __DEFAULT__ATTEMPTS__ = 300; // number of checks attemtps @@ -363,10 +367,10 @@ void Session_ServerCheck::run() ASSERT( SINGLETON_::IsAlreadyExisting() ); NS.init_orb( orb ); QString containerName = QString( "/Containers/%1/FactoryServer" ).arg( GetHostname().c_str() ); - CORBA::Object_var obj = NS.Resolve( containerName.latin1() ); + CORBA::Object_var obj = NS.Resolve( containerName.toLatin1() ); Engines::Container_var FScontainer = Engines::Container::_narrow( obj ); if ( !CORBA::is_nil( FScontainer ) ) { - MESSAGE( containerName.latin1() << " is found" ); + MESSAGE( containerName.toLatin1().constData() << " is found" ); FScontainer->ping(); MESSAGE( "FactoryServer container was activated" ); bOk = true; @@ -414,10 +418,10 @@ void Session_ServerCheck::run() ASSERT( SINGLETON_::IsAlreadyExisting() ); NS.init_orb( orb ); QString containerName = QString( "/Containers/%1/FactoryServerPy" ).arg( GetHostname().c_str() ); - CORBA::Object_var obj = NS.Resolve( containerName.latin1() ); + CORBA::Object_var obj = NS.Resolve( containerName.toLatin1() ); Engines::Container_var FSPcontainer = Engines::Container::_narrow( obj ); if ( !CORBA::is_nil( FSPcontainer ) ) { - MESSAGE( containerName.latin1() << " is found" ); + MESSAGE( containerName.toLatin1().constData() << " is found" ); FSPcontainer->ping(); MESSAGE("FactoryServerPy container was activated"); bOk = true; @@ -465,10 +469,10 @@ void Session_ServerCheck::run() ASSERT( SINGLETON_::IsAlreadyExisting() ); NS.init_orb( orb ); QString containerName = QString( "/Containers/%1/SuperVisionContainer" ).arg( GetHostname().c_str() ); - CORBA::Object_var obj = NS.Resolve( containerName.latin1() ); + CORBA::Object_var obj = NS.Resolve( containerName.toLatin1() ); Engines::Container_var SVcontainer = Engines::Container::_narrow( obj ); if ( !CORBA::is_nil( SVcontainer ) ) { - MESSAGE( containerName.latin1() << " is found" ); + MESSAGE( containerName.toLatin1().constData() << " is found" ); SVcontainer->ping(); MESSAGE("SuperVisionContainer container was activated"); bOk = true; diff --git a/src/Session/Session_ServerCheck.hxx b/src/Session/Session_ServerCheck.hxx index 8de6a6d41..9a65f436c 100644 --- a/src/Session/Session_ServerCheck.hxx +++ b/src/Session/Session_ServerCheck.hxx @@ -24,8 +24,7 @@ #include -#include -#include +#include class QMutex; class QWaitCondition; diff --git a/src/Session/Session_ServerLauncher.cxx b/src/Session/Session_ServerLauncher.cxx index 3909efc01..bdf10d747 100755 --- a/src/Session/Session_ServerLauncher.cxx +++ b/src/Session/Session_ServerLauncher.cxx @@ -27,9 +27,14 @@ // $Header$ #include "Session_ServerLauncher.hxx" +#include "Session_ServerThread.hxx" #include "Utils_SALOME_Exception.hxx" #include "utilities.h" + +#include +#include + using namespace std; /*! default constructor not for use diff --git a/src/Session/Session_ServerLauncher.hxx b/src/Session/Session_ServerLauncher.hxx index b3773adf1..6f0fede88 100755 --- a/src/Session/Session_ServerLauncher.hxx +++ b/src/Session/Session_ServerLauncher.hxx @@ -31,14 +31,11 @@ #include -#include "Session_ServerThread.hxx" - #include #include #include #include -#include -#include +#include using namespace std; @@ -55,6 +52,11 @@ inline ServArg::ServArg(int servType, int firstArg, int lastArg): _servType(servType),_firstArg(firstArg),_lastArg(lastArg) {} +class Session_ServerThread; + +class QMutex; +class QWaitCondition; + class SESSION_EXPORT Session_ServerLauncher: public QThread { public: diff --git a/src/Session/Session_ServerThread.cxx b/src/Session/Session_ServerThread.cxx index d5b5a6437..5bf7be156 100755 --- a/src/Session/Session_ServerThread.cxx +++ b/src/Session/Session_ServerThread.cxx @@ -32,9 +32,9 @@ #include "Session_ServerThread.hxx" +#include "SALOME_NamingService.hxx" #include "SALOME_Container_i.hxx" #include "SALOME_ContainerManager.hxx" -#include #include #include "SALOME_ModuleCatalog_impl.hxx" #include "RegistryService.hxx" @@ -51,6 +51,9 @@ #include #include +#include +#include + using namespace std; const int Session_ServerThread::NB_SRV_TYP = 7; diff --git a/src/Session/Session_ServerThread.hxx b/src/Session/Session_ServerThread.hxx index 04ded4d2e..146183da7 100755 --- a/src/Session/Session_ServerThread.hxx +++ b/src/Session/Session_ServerThread.hxx @@ -34,13 +34,11 @@ #include #include -#include "SALOME_NamingService.hxx" -#include - using namespace std; void WaitForServerReadiness(string serverName); +class SALOME_NamingService; class SESSION_EXPORT Session_ServerThread { @@ -72,6 +70,8 @@ protected: SALOME_NamingService * _NS; }; +class QMutex; +class QWaitCondition; class SESSION_EXPORT Session_SessionThread : public Session_ServerThread { diff --git a/src/Session/Session_Session_i.cxx b/src/Session/Session_Session_i.cxx index 81787737e..92ba94c40 100755 --- a/src/Session/Session_Session_i.cxx +++ b/src/Session/Session_Session_i.cxx @@ -31,17 +31,19 @@ #include "Session_Session_i.hxx" #include "SALOME_NamingService.hxx" -#include "SALOME_Event.hxx" +#include "SALOME_Event.h" #include "SUIT_Session.h" -#include "SUIT_Application.h" +//#include "SUIT_Application.h" #include "SUIT_Desktop.h" +#include "SUIT_Study.h" -#include +//#include +#include +#include // Open CASCADE Includes #include -#include #include using namespace std; @@ -155,12 +157,12 @@ void SALOME_Session_i::StopSession() Send a SALOME::StatSession structure (see idl) to the client (number of running studies and presence of GUI) */ -class QtLock +/*class QtLock { public: QtLock() { if ( qApp ) qApp->lock(); } ~QtLock() { if ( qApp ) qApp->unlock(); } -}; +};*/ SALOME::StatSession SALOME_Session_i::GetStatSession() @@ -170,7 +172,7 @@ SALOME::StatSession SALOME_Session_i::GetStatSession() _runningStudies = 0; { - QtLock lock; + //QtLock lock; _isGUI = SUIT_Session::session(); if ( _isGUI && SUIT_Session::session()->activeApplication() ) _runningStudies = SUIT_Session::session()->activeApplication()->getNbStudies(); diff --git a/src/Session/Session_Session_i.hxx b/src/Session/Session_Session_i.hxx index bfdee09a5..fa7a224e4 100755 --- a/src/Session/Session_Session_i.hxx +++ b/src/Session/Session_Session_i.hxx @@ -31,13 +31,14 @@ #include -#include - #include #include CORBA_SERVER_HEADER(SALOME_Component) #include CORBA_SERVER_HEADER(SALOME_Session) class SALOME_NamingService; +class QMutex; +class QWaitCondition; + class SESSION_EXPORT SALOME_Session_i: public virtual POA_SALOME::Session, public virtual PortableServer::ServantBase { diff --git a/src/src.pro b/src/src.pro index a621136a9..9ef25127c 100644 --- a/src/src.pro +++ b/src/src.pro @@ -25,6 +25,6 @@ SUBDIRS += SUPERVGraph SUBDIRS += Event SUBDIRS += LightApp SUBDIRS += ResExporter -SUBDIRS += RegistryDisplay SUBDIRS += TOOLSGUI +SUBDIRS += Session SUBDIRS += SalomeApp