From c240194cd0c400ac313c2e909e68e07c8980d290 Mon Sep 17 00:00:00 2001 From: vsr Date: Wed, 27 Jun 2007 11:26:22 +0000 Subject: [PATCH] Merge from BR_QT4 branch --- salome_adm/unix/config_files/check_qt.m4 | 216 +++++++++++++----- src/Container/Makefile.am | 2 +- src/LifeCycleCORBA/Makefile.am | 4 +- src/ModuleCatalog/Makefile.am | 4 +- .../SALOME_ModuleCatalog_Handler.cxx | 12 +- .../SALOME_ModuleCatalog_impl.cxx | 18 +- src/ResourcesManager/Makefile.am | 4 +- .../SALOME_ResourcesCatalog_Handler.cxx | 6 +- .../SALOME_ResourcesManager.cxx | 4 +- 9 files changed, 185 insertions(+), 85 deletions(-) diff --git a/salome_adm/unix/config_files/check_qt.m4 b/salome_adm/unix/config_files/check_qt.m4 index 0472d93dd..61cd1895c 100644 --- a/salome_adm/unix/config_files/check_qt.m4 +++ b/salome_adm/unix/config_files/check_qt.m4 @@ -39,20 +39,53 @@ qt_ok=yes AC_LANG_SAVE AC_LANG_CPLUSPLUS +# +# check QTDIR environment variable +# if test "x$QTDIR" = "x" then AC_MSG_RESULT(please define QTDIR variable) qt_ok=no else AC_MSG_RESULT(QTDIR is $QTDIR) +fi + +# +# check Qt version +# +if test "x$qt_ok" = "xyes" +then qt_inc_ok=no QTINC="" - AC_CHECK_FILE(${QTDIR}/include/qt3/qglobal.h,QTINC="/qt3",QTINC="") - QT_VERS=`grep "QT_VERSION_STR" ${QTDIR}/include${QTINC}/qglobal.h | sed -e 's%^#define QT_VERSION_STR\([[:space:]]*\)%%g' -e 's%\"%%g'` - AC_MSG_RESULT(Qt version is $QT_VERS) - QT_VERS="Qt_"`echo $QT_VERS | sed -e 's%\"%%g' -e 's%\.%_%g'` + AC_CHECK_FILE(${QTDIR}/include/qt4/QtCore/qglobal.h,QTINC="/qt4",QTINC="") + if test "x$QTINC" = "x" + then + AC_CHECK_FILE(${QTDIR}/include${QTINC}/QtCore/qglobal.h,qt_inc_ok=yes,qt_inc_ok=no) + else + qt_inc_ok=yes + fi + if test "x$qt_inc_ok" = "xyes" + then + AC_MSG_CHECKING(whether Qt version >= 4.0) + QT_VERSION=`grep "QT_VERSION_STR" ${QTDIR}/include${QTINC}/QtCore/qglobal.h | sed -e 's%^#define QT_VERSION_STR[[:space:]]*\"\([[:digit:]\.]*\)\"%\1%g'` + QT_VERSION_ID=`echo $QT_VERSION | awk -F. '{v=$[1]*10000+$[2]*100+$[3];print v}'` + if test $QT_VERSION_ID -ge 40000 + then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + qt_ok=no + fi + AC_MSG_CHECKING(Qt version) + AC_MSG_RESULT($QT_VERSION) + else + qt_ok=no + fi fi +# +# check moc presence (meta-object compiler) +# if test "x$qt_ok" = "xyes" then if test -f ${QTDIR}/bin/moc @@ -64,13 +97,16 @@ then if test "x$MOC" = "x" then qt_ok=no - AC_MSG_RESULT(moc qt-compiler not in PATH variable) + AC_MSG_RESULT(moc (Qt meta-object compiler) is not in the PATH variable) else qt_ok=yes - AC_MSG_RESULT(moc found) + AC_MSG_RESULT(moc (Qt meta-object compiler) is found) fi fi +# +# check uic presence (user interface compiler) +# if test "x$qt_ok" = "xyes" then if test -f ${QTDIR}/bin/uic @@ -82,118 +118,186 @@ then if test "x$UIC" = "x" then qt_ok=no - AC_MSG_RESULT(uic qt-interface compiler not in PATH variable) + AC_MSG_RESULT(uic (Qt user interface compiler) is not in the PATH variable) else qt_ok=yes - AC_MSG_RESULT(uic found) + AC_MSG_RESULT(uic (Qt user interface compiler) is found) fi fi -AC_SUBST(QTDIR) -QT_ROOT=$QTDIR +# +# check rcc presence (resources compiler) +# +if test "x$qt_ok" = "xyes" +then + if test -f ${QTDIR}/bin/rcc + then + QRCC=${QTDIR}/bin/rcc + else + AC_PATH_PROG(QRCC, rcc) + fi + if test "x$QRCC" = "x" + then + qt_ok=no + AC_MSG_RESULT(rcc (Qt resources compiler) is not in the PATH variable) + else + qt_ok=yes + AC_MSG_RESULT(rcc (Qt resources compiler) is found) + fi +fi +# +# check lrelease presence (translation files compiler) +# if test "x$qt_ok" = "xyes" then - CPPFLAGS_old=$CPPFLAGS - CPPFLAGS="$CPPFLAGS -I$QTDIR/include${QTINC}" + if test -f ${QTDIR}/bin/lrelease + then + LRELEASE=${QTDIR}/bin/lrelease + else + AC_PATH_PROG(LRELEASE, lrelease) + fi + if test "x$LRELEASE" = "x" + then + qt_ok=no + AC_MSG_RESULT(lrelease (Qt translation files compiler) is not in the PATH variable) + else + qt_ok=yes + AC_MSG_RESULT(lrelease (Qt translation files compiler) is found) + fi +fi - AC_LANG_CPLUSPLUS - AC_CHECK_HEADER(qaction.h,qt_ok=yes ,qt_ok=no) +QT_ROOT=$QTDIR - CPPFLAGS=$CPPFLAGS_old +# +# check Qt header files +# +if test "x$qt_ok" = "xyes" +then + AC_CHECKING(include Qt header files) - AC_MSG_CHECKING(include of qt headers) + CPPFLAGS_old=$CPPFLAGS + CPPFLAGS="$CPPFLAGS -I${QTDIR}/include${QTINC} -I${QTDIR}/include${QTINC}/QtCore" + AC_CHECK_HEADER(QObject,qt_ok=yes,qt_ok=no) + CPPFLAGS=$CPPFLAGS_old if test "x$qt_ok" = "xno" then - AC_MSG_RESULT(qt headers not found, or too old qt version, in $QTDIR/include) - AC_MSG_RESULT(QTDIR environment variable may be wrong) + AC_MSG_RESULT(qt header files are not found in $QTDIR/include${QTINC}/QtCore) + AC_MSG_RESULT(QTDIR environment variable may be wrong (probably too old Qt version)) else - AC_MSG_RESULT(yes) - QT_INCLUDES="-I${QT_ROOT}/include${QTINC} -DQT_THREAD_SUPPORT -DQT_CLEAN_NAMESPACE" - QT_MT_INCLUDES="-I${QT_ROOT}/include${QTINC} -DQT_THREAD_SUPPORT -DQT_CLEAN_NAMESPACE" + AC_MSG_RESULT(qt header files seem to be OK) + QT_INCLUDES="-I${QTDIR}/include${QTINC}" + # user header files + QT_INCLUDES="${QT_INCLUDES} -I${QTDIR}/include${QTINC}/QtCore" + QT_INCLUDES="${QT_INCLUDES} -I${QTDIR}/include${QTINC}/QtGui" + QT_INCLUDES="${QT_INCLUDES} -I${QTDIR}/include${QTINC}/QtOpenGL" + QT_INCLUDES="${QT_INCLUDES} -I${QTDIR}/include${QTINC}/QtXml" + # not used currently header files (uncomment if required) + #QT_INCLUDES="${QT_INCLUDES} -I$(QTDIR)/include${QTINC}/QtAssistant" + #QT_INCLUDES="${QT_INCLUDES} -I$(QTDIR)/include${QTINC}/QtDBus" + #QT_INCLUDES="${QT_INCLUDES} -I$(QTDIR)/include${QTINC}/QtDesigner" + #QT_INCLUDES="${QT_INCLUDES} -I$(QTDIR)/include${QTINC}/QtNetwork" + #QT_INCLUDES="${QT_INCLUDES} -I$(QTDIR)/include${QTINC}/QtSql" + #QT_INCLUDES="${QT_INCLUDES} -I$(QTDIR)/include${QTINC}/QtSvg" + #QT_INCLUDES="${QT_INCLUDES} -I$(QTDIR)/include${QTINC}/QtTest" + #QT_INCLUDES="${QT_INCLUDES} -I$(QTDIR)/include${QTINC}/QtUiTools" + + # this flag is obsolete with Qt 4 + QT_MT_INCLUDES="$QT_INCLUDES" fi fi +# +# test Qt libraries +# if test "x$qt_ok" = "xyes" then - AC_MSG_CHECKING(linking qt library) + AC_MSG_CHECKING(linking against Qt library) + + CXXFLAGS_old=$CXXFLAGS + CXXFLAGS="$CXXFLAGS $QT_INCLUDES" + LIBS_old=$LIBS if test "x$QTDIR" = "x/usr" then - LIBS="$LIBS -lqt-mt $OGL_LIBS" + QT_LIB_DIR="" else - LIBS="$LIBS -L$QTDIR/lib${LIB_LOCATION_SUFFIX} -lqt-mt $OGL_LIBS" + QT_LIB_DIR="-L$QTDIR/lib${LIB_LOCATION_SUFFIX}" fi - - CXXFLAGS_old=$CXXFLAGS - CXXFLAGS="$CXXFLAGS $QT_INCLUDES" + LIBS="$LIBS $QT_LIB_DIR -lQtCore" AC_CACHE_VAL(salome_cv_lib_qt,[ AC_TRY_LINK( -#include +#include , int n; char **s; - QApplication a(n, s); + QCoreApplication a(n, s); a.exec();, eval "salome_cv_lib_qt=yes",eval "salome_cv_lib_qt=no") ]) qt_ok="$salome_cv_lib_qt" + # BEGIN: for CCRT (installation of qt have only a "lib" directory) if test "x$qt_ok" = "xno" then - #AC_MSG_RESULT(unable to link with qt library) - #AC_MSG_RESULT(QTDIR environment variable may be wrong) - # BEGIN: for CCRT (installation of qt have only a "lib" directory) - LIBS="$LIBS_old -L$QTDIR/lib -lqt-mt $OGL_LIBS" + QT_LIB_DIR="-L$QTDIR/lib" + LIBS="$LIBS_old $QT_LIB_DIR -lQtCore" AC_CACHE_VAL(salome_cv_lib_qt,[ AC_TRY_LINK( -#include +#include , int n; char **s; - QApplication a(n, s); + QCoreApplication a(n, s); a.exec();, eval "salome_cv_lib_qt=yes",eval "salome_cv_lib_qt=no") ]) qt_ok="$salome_cv_lib_qt" + fi + # END: for CCRT - if test "x$qt_ok" = "xno" - then - AC_MSG_RESULT(unable to link with qt library) - AC_MSG_RESULT(QTDIR environment variable may be wrong) - else - AC_MSG_RESULT(yes) - QT_LIBS="-L$QTDIR/lib -lqt-mt" - QT_MT_LIBS="-L$QTDIR/lib -lqt-mt" - fi - # END: for CCRT + if test "x$qt_ok" = "xno" + then + AC_MSG_RESULT(no) + AC_MSG_RESULT(unable to link with qt library) + AC_MSG_RESULT(QTDIR environment variable may be wrong (probably too old Qt version)) else AC_MSG_RESULT(yes) - if test "x$QTDIR" = "x/usr" - then - QT_LIBS=" -lqt-mt" - QT_MT_LIBS=" -lqt-mt" - else - QT_LIBS="-L$QTDIR/lib${LIB_LOCATION_SUFFIX} -lqt-mt" - QT_MT_LIBS="-L$QTDIR/lib${LIB_LOCATION_SUFFIX} -lqt-mt" - fi + # core libs + QT_CORE_LIBS="$QT_LIB_DIR -lQtCore -lQtXml" + # gui libs + QT_GUI_LIBS="$QT_LIB_DIR -lQtGui -lQtOpenGL" + # other libs (currently not used) + QT_OTHER_LIBS="$QT_LIB_DIR" + # other libs (can be used if necessary) + #QT_OTHER_LIBS="$QT_LIB_DIR -lQt3Support -lQtAssistantClient -lQtDesigner -lQtNetwork -lQtSql -lQtSvg -lQtTest -ltQtUiTools" + # all libs + QT_LIBS="$QT_CORE_LIBS $QT_GUI_LIBS $QT_OTHER_LIBS" + # this flag is obsolete with Qt 4 + QT_MT_LIBS="$QT_LIBS" fi - LIBS=$LIBS_old CXXFLAGS=$CXXFLAGS_old - fi +AC_SUBST(QTDIR) AC_SUBST(MOC) AC_SUBST(UIC) +AC_SUBST(QRCC) +AC_SUBST(LRELEASE) AC_SUBST(QT_ROOT) AC_SUBST(QT_INCLUDES) AC_SUBST(QT_MT_INCLUDES) +AC_SUBST(QT_LIB_DIR) +AC_SUBST(QT_CORE_LIBS) +AC_SUBST(QT_GUI_LIBS) +AC_SUBST(QT_OTHER_LIBS) AC_SUBST(QT_LIBS) AC_SUBST(QT_MT_LIBS) -AC_SUBST(QT_VERS) +AC_SUBST(QT_VERSION) +AC_SUBST(QT_VERSION_ID) AC_LANG_RESTORE diff --git a/src/Container/Makefile.am b/src/Container/Makefile.am index 4e7c0d619..1f1a6debb 100644 --- a/src/Container/Makefile.am +++ b/src/Container/Makefile.am @@ -64,7 +64,7 @@ COMMON_CPPFLAGS=\ @PYTHON_INCLUDES@ \ @MPI_INCLUDES@ \ @CAS_CPPFLAGS@ @CAS_CXXFLAGS@ \ - @QT_MT_INCLUDES@ \ + @QT_INCLUDES@ \ -I$(srcdir)/../Basics \ -I$(srcdir)/../SALOMELocalTrace \ -I$(srcdir)/../NamingService \ diff --git a/src/LifeCycleCORBA/Makefile.am b/src/LifeCycleCORBA/Makefile.am index 6bee2cf3c..53f89d73d 100644 --- a/src/LifeCycleCORBA/Makefile.am +++ b/src/LifeCycleCORBA/Makefile.am @@ -82,7 +82,7 @@ libSalomeLifeCycleCORBA_la_SOURCES = \ libSalomeLifeCycleCORBA_la_CPPFLAGS = \ $(COMMON_CPPFLAGS) \ @PYTHON_INCLUDES@ \ - @QT_MT_INCLUDES@ \ + @QT_INCLUDES@ \ -I$(srcdir)/../Container \ -I$(srcdir)/../Notification @@ -112,7 +112,7 @@ Test_LifeCycleCORBA_LDADD = \ $(COMMON_LIBS) \ @CORBA_LIBS@ -#CPPFLAGS += $(PYTHON_INCLUDES) $(QT_MT_INCLUDES) +#CPPFLAGS += $(PYTHON_INCLUDES) $(QT_INCLUDES) #LDFLAGS += -lSalomeNS -lOpUtil -lSALOMELocalTrace -lSalomeContainer -lSalomeResourcesManager #LDFLAGSFORBIN= $(LDFLAGS) -lRegistry -lSalomeNotification -lSALOMEBasics diff --git a/src/ModuleCatalog/Makefile.am b/src/ModuleCatalog/Makefile.am index a29139fd2..dcfb7ded6 100644 --- a/src/ModuleCatalog/Makefile.am +++ b/src/ModuleCatalog/Makefile.am @@ -63,7 +63,7 @@ COMMON_CPPFLAGS=\ -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ \ - @QT_MT_INCLUDES@ + @QT_INCLUDES@ # This local variable defines the list of dependant libraries common to all target in this package. COMMON_LIBS =\ @@ -86,7 +86,7 @@ libSalomeCatalog_la_LDFLAGS = -no-undefined -version-info=0:0:0 libSalomeCatalog_la_LIBADD =\ $(COMMON_LIBS) \ - @QT_MT_LIBS@ + @QT_LIBS@ # diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx index 82f1710b8..30cbaaa14 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx @@ -327,8 +327,8 @@ bool SALOME_ModuleCatalog_Handler::endElement(const QString&, //tag test_inParameter_name if ((qName.compare(test_inParameter_name)==0)) { - if(MYDEBUG) SCRUTE(parent); - if(MYDEBUG) SCRUTE(grandparent); + if(MYDEBUG) SCRUTE(parent.toLatin1().data()); + if(MYDEBUG) SCRUTE(grandparent.toLatin1().data()); if (grandparent.compare(test_inDataStreamParameter_list) == 0) _inDataStreamParam.name = content ; else @@ -395,7 +395,7 @@ bool SALOME_ModuleCatalog_Handler::endElement(const QString&, // Parameter out - if(MYDEBUG) SCRUTE(qName); + if(MYDEBUG) SCRUTE(qName.toLatin1().data()); // tag test_outParameter_type if ((qName.compare(test_outParameter_type)==0)) { @@ -426,8 +426,8 @@ bool SALOME_ModuleCatalog_Handler::endElement(const QString&, //tag test_outDataStreamParameter_name if ((qName.compare(test_outDataStreamParameter_name)==0)) { - if(MYDEBUG) SCRUTE(grandparent); - if(MYDEBUG) SCRUTE(test_outDataStreamParameter_list); + if(MYDEBUG) SCRUTE(grandparent.toLatin1().data()); + if(MYDEBUG) SCRUTE(test_outDataStreamParameter_list.toLatin1().data()); if (grandparent.compare(test_outDataStreamParameter_list) == 0) _outDataStreamParam.name = content ; else @@ -534,7 +534,7 @@ bool SALOME_ModuleCatalog_Handler::endElement(const QString&, //---------------------------------------------------------------------- bool SALOME_ModuleCatalog_Handler::characters(const QString& chars) { - content = (const char*)chars ; + content = chars.toLatin1().data() ; return true; } diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx index 55dd3cede..7bdf7d559 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx @@ -113,19 +113,15 @@ SALOME_ModuleCatalogImpl::SALOME_ModuleCatalogImpl(int argc, char** argv, CORBA: QStringList dirList; #ifdef WNT - dirList = QStringList::split( SEPARATOR, _general_path, - false ); // skip empty entries + dirList = QString( _general_path ).split( SEPARATOR, QString::SkipEmptyParts ); // skip empty entries #else //check for new format - int isNew = QString( _general_path ).contains(SEPARATOR); - if ( isNew > 0 ) { + if ( QString( _general_path ).contains(SEPARATOR) ) { //using new format - dirList = QStringList::split( SEPARATOR, _general_path, - false ); // skip empty entries + dirList = QString( _general_path ).split( SEPARATOR, QString::SkipEmptyParts ); // skip empty entries } else { //support old format - dirList = QStringList::split( OLD_SEPARATOR, _general_path, - false ); // skip empty entries + dirList = QString( _general_path ).split( OLD_SEPARATOR, QString::SkipEmptyParts ); // skip empty entries } #endif @@ -133,7 +129,7 @@ SALOME_ModuleCatalogImpl::SALOME_ModuleCatalogImpl(int argc, char** argv, CORBA: //QFileInfo fileInfo( dirList[ i ] ); QFileInfo fileInfo( dirList[ i ].replace( '\"', "" ) ); //remove inverted commas from filename if ( fileInfo.isFile() && fileInfo.exists() ) { - _parse_xml_file(fileInfo.filePath(), + _parse_xml_file(fileInfo.filePath().toLatin1().data(), _general_module_list, _general_path_list); } @@ -484,7 +480,7 @@ SALOME_ModuleCatalogImpl::GetComponent(const char* name) std::string s(name); ParserComponent *C_parser = NULL; - ParserPathPrefixes *pp = NULL; + //ParserPathPrefixes *pp = NULL; // VSR : commented : unused variable SALOME_ModuleCatalog::Acomponent_ptr compo = SALOME_ModuleCatalog::Acomponent::_nil(); @@ -577,7 +573,7 @@ SALOME_ModuleCatalogImpl::_parse_xml_file(const char* file, SALOME_ModuleCatalog_Handler* handler = new SALOME_ModuleCatalog_Handler(); QFile xmlFile(file); - QXmlInputSource source(xmlFile); + QXmlInputSource source(&xmlFile); QXmlSimpleReader reader; reader.setContentHandler( handler ); diff --git a/src/ResourcesManager/Makefile.am b/src/ResourcesManager/Makefile.am index eaa49f92a..7770d4272 100755 --- a/src/ResourcesManager/Makefile.am +++ b/src/ResourcesManager/Makefile.am @@ -76,9 +76,9 @@ libSalomeResourcesManager_la_SOURCES =\ libSalomeResourcesManager_la_CPPFLAGS =\ $(COMMON_CPPFLAGS) \ - @QT_MT_INCLUDES@ + @QT_INCLUDES@ libSalomeResourcesManager_la_LDFLAGS = -no-undefined -version-info=0:0:0 libSalomeResourcesManager_la_LIBADD =\ $(COMMON_LIBS) \ - @QT_MT_LIBS@ + @QT_LIBS@ diff --git a/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx b/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx index 53162f87c..e6c68b858 100755 --- a/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx +++ b/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx @@ -130,7 +130,7 @@ startElement( const QString&, for (int i = 0;i < attrs.count();i++) { QString qName(attrs.localName(i)); - std::string content(attrs.value(i).latin1()); + std::string content(attrs.value(i).toLatin1().data()); if ((qName.compare(QString(test_hostname)) == 0)) _resource.DataForSort._hostName = content; @@ -265,7 +265,7 @@ endElement(const QString&, bool SALOME_ResourcesCatalog_Handler::characters(const QString& chars) { - content = (const char *)chars ; + content = chars.toLatin1().data() ; return true; } @@ -328,7 +328,7 @@ SALOME_ResourcesCatalog_Handler::fatalError .arg( exception.message() ) .arg( exception.lineNumber() ) .arg( exception.columnNumber() ); - INFOS("parser error: " << errorProt.latin1()); + INFOS("parser error: " << errorProt.toLatin1().data()); return QXmlDefaultHandler::fatalError( exception ); } diff --git a/src/ResourcesManager/SALOME_ResourcesManager.cxx b/src/ResourcesManager/SALOME_ResourcesManager.cxx index 3552c1128..c99a37b7e 100644 --- a/src/ResourcesManager/SALOME_ResourcesManager.cxx +++ b/src/ResourcesManager/SALOME_ResourcesManager.cxx @@ -290,7 +290,7 @@ void SALOME_ResourcesManager::WriteInXmlFile() QFile file( _path_resources ); - if ( !file.open( IO_WriteOnly ) ) + if ( !file.open( QIODevice::WriteOnly ) ) INFOS("WRITING ERROR !"); QTextStream ts( &file ); @@ -314,7 +314,7 @@ const MapOfParserResourcesType& SALOME_ResourcesManager::ParseXmlFile() new SALOME_ResourcesCatalog_Handler(_resourcesList); QFile xmlFile(_path_resources); - QXmlInputSource source(xmlFile); + QXmlInputSource source(&xmlFile); QXmlSimpleReader reader; reader.setContentHandler( handler ); -- 2.39.2