From: vsr Date: Tue, 17 Feb 2009 09:50:05 +0000 (+0000) Subject: Merge from BR_QT4 17Feb09 X-Git-Tag: V5_1_1a1 X-Git-Url: http://git.salome-platform.org/gitweb/?p=tools%2Fhxx2salome.git;a=commitdiff_plain;h=202e9749e0a4f42f18f561be5ed7f4f14d52ddf9 Merge from BR_QT4 17Feb09 --- diff --git a/config_files/check_qt.m4 b/config_files/check_qt.m4 index ab53483..5859b6a 100644 --- a/config_files/check_qt.m4 +++ b/config_files/check_qt.m4 @@ -1,24 +1,37 @@ -dnl Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -dnl -dnl This library is free software; you can redistribute it and/or -dnl modify it under the terms of the GNU Lesser General Public -dnl License as published by the Free Software Foundation; either -dnl version 2.1 of the License. -dnl -dnl This library is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -dnl Lesser General Public License for more details. -dnl -dnl You should have received a copy of the GNU Lesser General Public -dnl License along with this library; if not, write to the Free Software -dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -dnl -dnl See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +dnl Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE dnl +dnl Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS dnl +dnl This library is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Lesser General Public +dnl License as published by the Free Software Foundation; either +dnl version 2.1 of the License. dnl +dnl This library is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl Lesser General Public License for more details. +dnl +dnl You should have received a copy of the GNU Lesser General Public +dnl License along with this library; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +dnl +dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +dnl +dnl OPTIONS_QT +dnl ------------------------------------------------------------------------ +dnl Adds the --with-qt=path +dnl +AC_DEFUN([OPTIONS_QT], [ + AC_ARG_WITH([qt], + [AC_HELP_STRING([--with-qt], [Possible usage: + "Qt_Install_Path" - prefix to path where Qt was installd; + "" or "yes" or "auto" - means seaching installed Qt product in the system (checking $QTDIR and then - standard system paths ); + "no" - not use Qt product (is not supported) + By default "" option is used)])], + [with_qt=$withval], [with_qt=""]) +]) AC_DEFUN([CHECK_QT],[ AC_REQUIRE([AC_PROG_CC])dnl @@ -28,6 +41,8 @@ AC_REQUIRE([AC_PROG_CXXCPP])dnl AC_REQUIRE([CHECK_OPENGL])dnl AC_REQUIRE([AC_LINKER_OPTIONS])dnl +AC_REQUIRE([OPTIONS_QT])dnl + AC_CHECKING(for Qt) if test "x$OpenGL_ok" != "xyes" ; then @@ -39,20 +54,94 @@ qt_ok=yes AC_LANG_SAVE AC_LANG_CPLUSPLUS +dnl QT install dir +if test -z $with_qt ; then + with_qt="" +fi +if test "x$with_qt" = "xyes" ; then + dnl in case user wrote --with-qt=yes + with_qt="" +fi +if test "x$with_qt" = "xauto" ; then + dnl in case user wrote --with-qt=auto + with_qt="" +fi +if test "x$with_qt" = "xno" ; then + dnl in case user wrote --with-qt=no + with_qt="" + AC_MSG_WARN(Value no, specified for option --with-qt, is not supported) +fi + +if test "x$with_qt" != "x" ; then + dnl Using "--with-qt" prefix path + QTDIR="$with_qt" +else + if test -z $QTDIR ; then + AC_MSG_WARN(undefined QTDIR variable which specify where Qt product was installed) + for d in /usr/local/lib/qt4 /usr/lib/qt4 ; do + if test -f ${d}/include/Qt/qconfig.h ; then + AC_MSG_RESULT(trying ${d}) + QTDIR="${d}" + break + else + if test -f ${d}/include/qconfig.h ; then + AC_MSG_RESULT(trying ${d}) + QTDIR="${d}" + break + fi + fi + done + else + dnl Using QTDIR environment variable + AC_MSG_RESULT(QTDIR is $QTDIR) + fi +fi + +# +# check QTDIR environment variable +# if test "x$QTDIR" = "x" then - AC_MSG_RESULT(please define QTDIR variable) + AC_MSG_RESULT(Please define correct path in "--with-qt" option or use correct $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 +153,31 @@ 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 + + if test "x$qt_ok" = "xyes" + then + dnl check moc version + AC_MSG_CHECKING(cheching equality Qt and moc tool version) + MOC_VERSION=`$MOC -v 2>&1 | awk 'BEGIN{FS="[[ ()]]"};{print $(NF-1)}'` + if test "x$QT_VERSION" = "x$MOC_VERSION" + then + AC_MSG_RESULT(yes) + qt_ok=yes + else + AC_MSG_RESULT(moc tool and Qt product are inpompatible $MOC_VERSION) + qt_ok=no + fi fi fi +# +# check uic presence (user interface compiler) +# if test "x$qt_ok" = "xyes" then if test -f ${QTDIR}/bin/uic @@ -82,94 +189,227 @@ 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 + + if test "x$qt_ok" = "xyes" + then + dnl check rcc version + AC_MSG_CHECKING(cheching equality Qt and rcc tool version) + QRCC_VERSION=`$QRCC -v 2>&1 | awk '{print $NF}'` + if test "x$QT_VERSION" = "x$QRCC_VERSION" + then + AC_MSG_RESULT(yes) + qt_ok=yes + else + AC_MSG_RESULT(rcc tool and Qt product are inpompatible) + qt_ok=no + fi + 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 + + if test "x$qt_ok" = "xyes" + then + dnl check lrelease version + AC_MSG_CHECKING( equality of Qt and lrelease tool version) + LRELEASE_VERSION=`$LRELEASE -version 2>&1 | awk '{print $NF}'` + if test "x$QT_VERSION" = "x$LRELEASE_VERSION" + then + AC_MSG_RESULT(yes) + qt_ok=yes + else + AC_MSG_RESULT(lrelease tool and Qt product are inpompatible) + qt_ok=no + fi + 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" + + QT_ASSISTANT_INCLUDES="${QT_ASSISTANT_INCLUDES} -I${QTDIR}/include${QTINC}/QtAssistant" + QT_ASSISTANT_INCLUDES="${QT_ASSISTANT_INCLUDES} -I${QTDIR}/include${QTINC}/QtNetwork" + + # 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="" + elif test -d ${QTDIR}/lib; then + QT_LIB_DIR="-L$QTDIR/lib" + elif test -d ${QTDIR}/lib64; then + QT_LIB_DIR="-L$QTDIR/lib64" else - LIBS="$LIBS -L$QTDIR/lib${LIB_LOCATION_SUFFIX} -lqt-mt $OGL_LIBS" + AC_MSG_ERROR(Can't detect of Qt library directory ) + qt_ok=no 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 + QT_LIB_DIR="-L$QTDIR/lib" + LIBS="$LIBS_old $QT_LIB_DIR -lQtCore" + + AC_CACHE_VAL(salome_cv_lib_qt,[ + AC_TRY_LINK( +#include +, int n; + char **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(no) AC_MSG_RESULT(unable to link with qt library) - AC_MSG_RESULT(QTDIR environment variable may be wrong) + 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" + QT_ASSISTANT_LIBS="$QT_LIB_DIR -lQtAssistantClient -lQtNetwork" + # 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_ASSISTANT_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_ASSISTANT_LIBS) +AC_SUBST(QT_VERSION) +AC_SUBST(QT_VERSION_ID) AC_LANG_RESTORE diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 85f034f..e0665d5 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -1,4 +1,7 @@ - +# -- +# Copyright (C) CEA, EDF +# Author : Nicolas Crouzet (CEA) +# -- bin_SCRIPTS = hxx2salome \ parse01.awk \ parse0.awk \ diff --git a/scripts/SA_build b/scripts/SA_build index f4238fa..84d8b2b 100755 --- a/scripts/SA_build +++ b/scripts/SA_build @@ -1,4 +1,8 @@ #!/bin/bash +# -- +# Copyright (C) CEA, EDF +# Author : Nicolas Crouzet (CEA) +# -- # # Utility for building Salome Modules # diff --git a/scripts/SA_new_cpp_component b/scripts/SA_new_cpp_component index e8ef4e0..09d13fa 100755 --- a/scripts/SA_new_cpp_component +++ b/scripts/SA_new_cpp_component @@ -1,4 +1,8 @@ #!/bin/bash +# -- +# Copyright (C) CEA, EDF +# Author : Nicolas Crouzet (CEA) +# -- usage() { diff --git a/scripts/cpp_compo_template.tgz b/scripts/cpp_compo_template.tgz index 01d729e..9dc7659 100644 Binary files a/scripts/cpp_compo_template.tgz and b/scripts/cpp_compo_template.tgz differ diff --git a/scripts/hxx2salome b/scripts/hxx2salome index c8a7507..0dce7f8 100755 --- a/scripts/hxx2salome +++ b/scripts/hxx2salome @@ -1,4 +1,8 @@ #!/bin/bash +# -- +# Copyright (C) CEA, EDF +# Author : Nicolas Crouzet (CEA) +# -- # # # salome2 environment file (.bash or .sh) - can also be specified with -e option diff --git a/scripts/parse0.awk b/scripts/parse0.awk index ae194f4..d273814 100644 --- a/scripts/parse0.awk +++ b/scripts/parse0.awk @@ -1,4 +1,8 @@ # This awk program suppresses inline functions - but it doen't work if there is no inline function... Not used yet. +# -- +# Copyright (C) CEA, EDF +# Author : Nicolas Crouzet (CEA) +# -- BEGIN { RS="\f"} { gsub(/{[^{}]*}[ \t]*;?/,";");print } diff --git a/scripts/parse01.awk b/scripts/parse01.awk index 8bec017..ca4dbb9 100644 --- a/scripts/parse01.awk +++ b/scripts/parse01.awk @@ -1,4 +1,8 @@ # This awk program deletes C like comments '*/ ... /*' +# -- +# Copyright (C) CEA, EDF +# Author : Nicolas Crouzet (CEA) +# -- { if (t = index($0, "/*")) { if (t > 1) diff --git a/scripts/parse1.awk b/scripts/parse1.awk index 8d688d2..455ab95 100644 --- a/scripts/parse1.awk +++ b/scripts/parse1.awk @@ -1,4 +1,8 @@ # This awk program extract public functions of the class definition present in hxx interface +# -- +# Copyright (C) CEA, EDF +# Author : Nicolas Crouzet (CEA) +# -- BEGIN { public=0 } diff --git a/scripts/parse2.awk b/scripts/parse2.awk index 2ecc2c7..82c07a6 100644 --- a/scripts/parse2.awk +++ b/scripts/parse2.awk @@ -1,4 +1,8 @@ # suppress blanks between type and indirection or reference operators (* and &) +# -- +# Copyright (C) CEA, EDF +# Author : Nicolas Crouzet (CEA) +# -- { gsub(/[ \t]+&/,"\\& ") gsub(/[ \t]+\*/,"* ") print $0 } diff --git a/scripts/parse3.awk b/scripts/parse3.awk index 620587b..6bd5867 100644 --- a/scripts/parse3.awk +++ b/scripts/parse3.awk @@ -1,4 +1,8 @@ # This awk program contains the type mapping tables - and the treatments +# -- +# Copyright (C) CEA, EDF +# Author : Nicolas Crouzet (CEA) +# -- # for code generation # BEGIN { @@ -248,7 +252,7 @@ BEGIN { # # # record sep is ");\n" whith blanks all around, and optional "(" at the beginning - RS="[(]?[ \t]*[)][ \t]*[;][ \t]*[\n]" + RS="[(]?[ \t]*[)][ \t]*(const)?[ \t]*[;][ \t]*[\n]" FS="[ \t]*[(,][ \t]*" # field sep is either "(" or "," surrounded by blanks } diff --git a/scripts/renameSalomeModule b/scripts/renameSalomeModule index 8e9ab33..63c90b7 100755 --- a/scripts/renameSalomeModule +++ b/scripts/renameSalomeModule @@ -1,4 +1,8 @@ #!/bin/bash +# -- +# Copyright (C) CEA, EDF +# Author : Nicolas Crouzet (CEA) +# -- usage() { diff --git a/scripts/template_src.tgz b/scripts/template_src.tgz index be9dd35..f834865 100644 Binary files a/scripts/template_src.tgz and b/scripts/template_src.tgz differ diff --git a/src/Makefile.am b/src/Makefile.am index a8d1c83..5d11edd 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,19 +1,16 @@ bin_PROGRAMS = ghxx2salome AM_CPPFLAGS = @QT_MT_INCLUDES@ -DBINDIR="\"${bindir}\"" -LDADD = -L${QTDIR}/lib${LIB_LOCATION_SUFFIX} -lqt-mt +LDADD = ${QT_LIB_DIR} -lQtCore -lQtGui CLEANFILES = hxx2salome_moc.cpp hxx2salome.h hxx2salome.cpp -ghxx2salome_SOURCES = main.cpp hxx2salome.cpp hxx2salome_moc.cpp -BUILT_SOURCES = hxx2salome.h +ghxx2salome_SOURCES = main.cpp hxx2salome.h hxx2salome.cpp hxx2salome_ui.h hxx2salome_moc.cpp +BUILT_SOURCES = hxx2salome_ui.h hxx2salome_moc.cpp -%.h: %.ui - ${UIC} $< -o $@ - -%.cpp: %.ui - ${UIC} -impl $*.h $< -o $@ +%_ui.h: %.ui + $(UIC) -o $@ $< %_moc.cpp: %.h ${MOC} $< -o $@ -main.cpp: hxx2salome.h +main.cpp: hxx2salome_ui.h hxx2salome_moc.cpp diff --git a/src/hxx2salome.cpp b/src/hxx2salome.cpp new file mode 100644 index 0000000..1640666 --- /dev/null +++ b/src/hxx2salome.cpp @@ -0,0 +1,249 @@ +#include +#include +#include +#include +#include +#include +#include + +#include "hxx2salome.h" + +// VSR: uncomment for debug mode +// #define __DEBUG__ + +static QString quote( const QString& val ) +{ + QString v = val; + if ( !v.startsWith( "\"" ) ) v.prepend( "\"" ); + if ( !v.endsWith( "\"" ) ) v.append( "\"" ); + return v; +} + +static QString unquote( const QString& val ) +{ + QString v = val; + if ( v.startsWith( "\"" ) ) v = v.remove( 0, 1 ); + if ( v.endsWith( "\"" ) ) v = v.remove( v.length()-1, 1 ); + return v; +} + +static QString relFileNameFromDir( const QString& dir, const QString& filename ) +{ +#ifdef __DEBUG__ + printf( "0. dir: %s, filename: %s\n", qPrintable( dir ), qPrintable( filename ) ); +#endif + if ( !filename.isEmpty() ) { + QString dirpath = QFileInfo( dir.isEmpty() ? QDir::currentPath() : dir ).absoluteFilePath(); + QString filepath = QFileInfo( filename ).absoluteFilePath(); +#ifdef __DEBUG__ + printf( "1. dirpath: %s, filepath: %s\n", qPrintable( dirpath ), qPrintable( filepath ) ); +#endif + if ( filepath.startsWith( dirpath ) ) { + QString fpath = filepath.mid( dirpath.length() ); + if ( fpath.startsWith( "/" ) ) fpath.remove( 0, 1 ); +#ifdef __DEBUG__ + printf( "2. fpath: %s\n", qPrintable( fpath ) ); +#endif + return fpath; + } + } + return filename; +} + +HXX2Salome::HXX2Salome() : QDialog() +{ + setupUi( this ); + retrieve(); +} + +HXX2Salome::~HXX2Salome() +{ + dump(); +} + +void HXX2Salome::retrieve() +{ + QFile file( QDir::home().absoluteFilePath( ".hxx2salome" ) ); + if ( file.open( QIODevice::ReadOnly | QIODevice::Text ) ) { + QTextStream in( &file ); + while ( !in.atEnd() ) { + QString line = in.readLine(); + QRegExp re( "^(.*)\\s+(.*)$" ); + if ( re.exactMatch( line ) ) { + QString var = re.cap( 1 ).trimmed(); + QString val = unquote( re.cap( 2 ).trimmed() ); + if ( !var.isEmpty() && !val.isEmpty() ) { + if ( var == "CppDir" ) + SourceTreeText->setText( val ); + else if ( var == "CppInc" ) + IncludeText->setText( val ); + else if ( var == "CppLib" ) + LibraryText->setText( val ); + else if ( var == "EnvFile" ) + EnvFileText->setText( val ); + else if ( var == "SalomeDir" ) + OutputTreeText->setText( val ); + else if ( var == "Shell" ) + ShellChoice->setCurrentIndex( val == "csh" ? 1 : 0 ); + } + } + } + file.close(); + } +} + +void HXX2Salome::dump() +{ + QFile file( QDir::home().absoluteFilePath( ".hxx2salome" ) ); + if ( file.open( QIODevice::WriteOnly | QIODevice::Text ) ) { + file.write( QString( "CppDir %1\n" ).arg( quote( SourceTreeText->text() ) ).toLatin1() ); + file.write( QString( "CppInc %1\n" ).arg( quote( IncludeText->text() ) ).toLatin1() ); + file.write( QString( "CppLib %1\n" ).arg( quote( LibraryText->text() ) ).toLatin1() ); + file.write( QString( "SalomeDir %1\n" ).arg( quote( OutputTreeText->text() ) ).toLatin1() ); + file.write( QString( "EnvFile %1\n" ).arg( quote( EnvFileText->text() ) ).toLatin1() ); + file.write( QString( "Shell %1\n" ).arg( ShellChoice->currentIndex() == 1 ? "csh" : "bash" ).toLatin1() ); + } + file.close(); +} + +void HXX2Salome::on_CloseButton_clicked() +{ + close(); +} + +void HXX2Salome::on_SourceTreeButton_clicked() +{ + QString s = QFileDialog::getExistingDirectory( this, + tr( "Get Existing directory" ), + SourceTreeText->text() ); + if ( !s.isEmpty() ) SourceTreeText->setText( s ); +} + +void HXX2Salome::on_IncludeButton_clicked() +{ + QString s = QFileDialog::getOpenFileName( this, + tr( "Choose a file to open" ), + IncludeText->text(), + tr( "Include files (*.h *.hh *.hxx *.hpp)" ) ); + if ( !s.isEmpty() ) { + IncludeText->setText( relFileNameFromDir( SourceTreeText->text().trimmed(), s ) ); + } +} + +void HXX2Salome::on_LibraryButton_clicked() +{ + QString s = QFileDialog::getOpenFileName( this, + tr( "Choose a file to open" ), + LibraryText->text(), + tr( "Shared Libraries (*.so *.dll)" ) ); + if ( !s.isEmpty() ) { + LibraryText->setText( relFileNameFromDir( SourceTreeText->text().trimmed(), s ) ); + } +} + +void HXX2Salome::on_EnvFileButton_clicked() +{ + QString s = QFileDialog::getOpenFileName( this, + tr( "Choose a script file to open" ), + EnvFileText->text(), + tr( "Environment files (*.csh *.sh)" ) ); + if ( !s.isEmpty() ) EnvFileText->setText( s ); +} + +void HXX2Salome::on_OutputTreeButton_clicked() +{ + QString s = QFileDialog::getExistingDirectory( this, + tr( "Choose a directory" ), + OutputTreeText->text() ); + if ( !s.isEmpty() ) OutputTreeText->setText( s ); +} + +void HXX2Salome::on_GenerateButton_clicked() +{ + // check input validity + QString CppDir = SourceTreeText->text().trimmed(); + QFileInfo fid( CppDir.isEmpty() ? QString( "." ) : CppDir ); + + if ( CppDir.isEmpty() ) { + QMessageBox::StandardButton btn = + QMessageBox::warning( this, + tr( "Warning" ), + tr( "You are about to use the current directory for the C++ component tree!\nContinue?" ), + QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes ); + if ( btn != QMessageBox::Yes ) return; + } + + QString CppInc = IncludeText->text().trimmed(); + if ( CppInc.isEmpty() ) { + QMessageBox::critical( this, + tr( "Error" ), + tr( "Component C++ include file is not specified!" ) ); + return; + } + if ( QFileInfo( CppInc ).isAbsolute() ) CppInc = relFileNameFromDir( CppDir, CppInc ); + if ( QFileInfo( CppInc ).isAbsolute() ) { + QMessageBox::critical( this, + tr( "Error" ), + tr( "Component C++ include file is specified in directory other than\n%1!" ).arg( CppDir ) ); + return; + } + CppInc = QFileInfo( CppInc ).fileName(); + + QString CppLib = LibraryText->text().trimmed(); + if ( CppLib.isEmpty() ) { + QMessageBox::critical( this, + tr( "Error" ), + tr( "Component shared library is not specified!" ) ); + return; + } + if ( QFileInfo( CppLib ).isAbsolute() ) CppLib = relFileNameFromDir( CppDir, CppLib ); + if ( QFileInfo( CppLib ).isAbsolute() ) { + QMessageBox::critical( this, + tr( "Error" ), + tr( "Component shared library is specified in directory other than\n%1!" ).arg( CppDir ) ); + return; + } + CppLib = QFileInfo( CppLib ).fileName(); + + QString SalomeDir = OutputTreeText->text().trimmed(); + QFileInfo fis( SalomeDir.isEmpty() ? QString( "." ) : SalomeDir ); + + if ( SalomeDir.isEmpty() ) { + QMessageBox::StandardButton btn = + QMessageBox::warning( this, + tr( "Warning" ), + tr( "You are about to use the current directory as the Salome component tree!\nContinue?" ), + QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes ); + if ( btn != QMessageBox::Yes ) return; + } + + QString EnvFile = EnvFileText->text().trimmed(); + QFileInfo fienv( EnvFile ); + + // generate command line + QStringList cmdlist; + cmdlist << "${HXX2SALOME_ROOT_DIR}/hxx2salome"; + if ( MakeGUI->isChecked() ) + cmdlist << "-g"; + if ( Compile->isChecked() ) + cmdlist << "-c"; + if ( ShellChoice->currentIndex() == 1 ) + cmdlist << "-s csh"; + if ( !EnvFile.isEmpty() ) { + cmdlist << "-e"; + cmdlist << quote( fienv.absoluteFilePath() ); + } + cmdlist << quote( fid.absoluteFilePath() ); + cmdlist << quote( CppInc ); + cmdlist << quote( CppLib ); + cmdlist << quote( fis.absoluteFilePath() ); + QString command = cmdlist.join( " " ); + + // execute command +#ifdef __DEBUG__ + printf( "command: %s\n", qPrintable( command ) ); +#endif + QApplication::setOverrideCursor( Qt::WaitCursor ); + std::system( command.toLatin1().constData() ); + QApplication::restoreOverrideCursor(); +} diff --git a/src/hxx2salome.h b/src/hxx2salome.h new file mode 100644 index 0000000..8a56deb --- /dev/null +++ b/src/hxx2salome.h @@ -0,0 +1,29 @@ +#ifndef __HXX2SALOME_H +#define __HXX2SALOME_H + +#include +#include "hxx2salome_ui.h" + +class HXX2Salome : public QDialog, private Ui::HXX2Salome +{ + Q_OBJECT + +public: + HXX2Salome(); + ~HXX2Salome(); + +private: + void retrieve(); + void dump(); + +private slots: + void on_CloseButton_clicked(); + void on_SourceTreeButton_clicked(); + void on_IncludeButton_clicked(); + void on_LibraryButton_clicked(); + void on_EnvFileButton_clicked(); + void on_OutputTreeButton_clicked(); + void on_GenerateButton_clicked(); +}; + +#endif // __HXX2SALOME_H diff --git a/src/hxx2salome.ui b/src/hxx2salome.ui index b9f4a54..ebc362e 100644 --- a/src/hxx2salome.ui +++ b/src/hxx2salome.ui @@ -1,522 +1,282 @@ - -HXX2Salome - - - HXX2Salome - - - - 0 - 0 - 520 - 429 - - - - Form1 - - - - Input - - - - 10 - 10 - 500 - 190 - - - - Input - - - - EnvFileButton - - - - 380 - 150 - 80 - 30 - - - - Browse ... - - - - - IncludeFileLabel - - - - 60 - 70 - 110 - 30 - - - - <p align="right">C++ include file</p> - - - File containing the main C++ component class declaration - - - - - EnvFileLabel - - - - 30 - 150 - 140 - 30 - - - - <p align="right">Environment file</p> - - - shell script where specific environment variable can be initialized for the component - - - - - SourceTree - - - - 30 - 30 - 140 - 40 - - - - <p align="right">C++ component tree<br>(absolute path)</p> - - - This directory (or one ot its subdirectories) contains the main C++ include file and the main shared library of the component - - - - - LibraryText - - - - 180 - 110 - 190 - 30 - - - - - - SourceTreeText - - - - 180 - 30 - 190 - 30 - - - - - - IncludeText - - - - 180 - 70 - 190 - 30 - - - - - - SourceTreeButton - - - - 380 - 30 - 80 - 30 - - - - Browse ... - - - - - IncludeButton - - - - 380 - 70 - 80 - 30 - - - - Browse ... - - - - - LibraryButton - - - - 380 - 110 - 80 - 30 - - - - Browse ... - - - - - LibraryLabel - - - - 30 - 110 - 140 - 30 - - - - <p align="right">Shared library</p> - - - Shared library (.so file) containing the compiled C++ component - - - - - EnvFileText - - - - 180 - 150 - 190 - 30 - - - - - - - GenButton + + HXX2Salome + + + + 0 + 0 + 517 + 400 + + + + Salome interface to C++ component generator + + + + + + Input + + + + + + + 160 + 0 + + + + This directory (or one ot its subdirectories) contains the main C++ include file and the main shared library of the component + + + <p align="right">C++ component tree<br>(absolute path)</p> + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + false + + + + + + + + + + Browse ... + + + + + + + + 160 + 0 + + + + File containing the main C++ component class declaration + + + <p align="right">C++ include file</p> + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + false + + + + + + + + + + Browse ... + + + + + + + + 160 + 0 + + + + Shared library (.so file) containing the compiled C++ component + + + <p align="right">Shared library</p> + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + false - - - 30 - 380 - 86 - 28 - + + + + + + + + + Browse ... - - Generate + + + + + + + 160 + 0 + + + shell script where specific environment variable can be initialized for the component + + + <p align="right">Environment file</p> + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + false + + + + + + + + + + Browse ... + + + + - - - CloseButton + + + + + Output + + + + + + + 160 + 0 + + + + Salome component tree + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + false - - - 390 - 380 - 86 - 28 - + + + + + + + + + Browse ... - - Close + + + + + + Shell + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + false + + + + + + + + 0 + 0 + + + + + bash + + + + + csh + + + + + + + + Qt::Horizontal + + + + 107 + 20 + + + + + + + + Generate file structure for GUI + + + + + + + Compile Salome Component (if checked, generation can take a long time) + + + + + + + + + + Generate + - - - Output - - - - 10 - 200 - 500 - 160 - - - - Output - - - - OutputTreeLabel - - - - 30 - 30 - 140 - 30 - - - - Salome component tree - - - - - OutputTreeText - - - - 180 - 30 - 190 - 30 - - - - - - textLabel1 - - - - 230 - 120 - 259 - 30 - - - - (if checked, generation can take a long time) - - - - - OutputTreeButton - - - - 380 - 30 - 80 - 30 - - - - Browse ... - - - - - - bash - - - - - csh - - - - ShellChoice - - - - 90 - 69 - 90 - 30 - - - - - - ShellText - - - - 40 - 69 - 40 - 30 - - - - Shell - - - - - makeGUI - - - - 200 - 70 - 241 - 31 - - - - Generate file structure for GUI - - - - - Compile - - - - 200 - 100 - 210 - 30 - - - - Compile Salome Component - - + + + + + Qt::Horizontal + + + + 326 + 20 + + + + + + + + Close + - - - - CloseButton - pressed() - HXX2Salome - CloseButton_pressed() - - - SourceTreeButton - pressed() - HXX2Salome - SourceTreeButton_pressed() - - - SourceTreeText - textChanged(const QString&) - HXX2Salome - newComponentTree() - - - IncludeText - textChanged(const QString&) - HXX2Salome - newIncludeFile() - - - LibraryText - textChanged(const QString&) - HXX2Salome - newSharedLibrary() - - - EnvFileText - textChanged(const QString&) - HXX2Salome - newEnvFile() - - - OutputTreeButton - pressed() - HXX2Salome - newOutputTree() - - - OutputTreeText - textChanged(const QString&) - HXX2Salome - newOutputTree() - - - IncludeButton - pressed() - HXX2Salome - IncludeButton_pressed() - - - LibraryButton - pressed() - HXX2Salome - LibraryButton_pressed() - - - EnvFileButton - pressed() - HXX2Salome - EnvFileButton_pressed() - - - OutputTreeButton - pressed() - HXX2Salome - OutputTreeButton_pressed() - - - GenButton - pressed() - HXX2Salome - GenerateButton_pressed() - - - ShellChoice - activated(int) - HXX2Salome - ShellChoice_activated(int) - - - - QString CppLibDir; - QString SalomeDir; - QString CppDir; - QString CppInc; - QString CppLib; - QString EnvFile; - QString CppIncDir; - int shell; - - - CloseButton_pressed() - SourceTreeButton_pressed() - newComponentTree() - newIncludeFile() - newSharedLibrary() - newEnvFile() - newOutputTree() - OutputTreeButton_pressed() - IncludeButton_pressed() - LibraryButton_pressed() - EnvFileButton_pressed() - shellChanged( int n ) - GenerateButton_pressed() - ShellChoice_activated( int n ) - init() - destroy() - - - + + + + + + diff --git a/src/hxx2salome.ui.h b/src/hxx2salome.ui.h deleted file mode 100644 index 5d1cccd..0000000 --- a/src/hxx2salome.ui.h +++ /dev/null @@ -1,318 +0,0 @@ -/**************************************************************************** -** ui.h extension file, included from the uic-generated form implementation. -** -** If you want to add, delete, or rename functions or slots, use -** Qt Designer to update this file, preserving your code. -** -** You should not define a constructor or destructor in this file. -** Instead, write your code in functions called init() and destroy(). -** These will automatically be called by the form's constructor and -** destructor. -*****************************************************************************/ - -#include -#include -#include -#include -#include -#include - -static -inline void extractDirNameBaseName(const QString & name, - QString & dir, QString & base ) -{ - if (name != "") { - char *s; - s = strdup(name.latin1()); - dir = dirname(s); - dir += "/"; - strcpy(s, name.latin1()); - base = basename(s); - free(s); - } - else { - base = ""; - dir = ""; - } -} - -static -inline void extract_value( QString & Tq) -{ - std::string t = Tq.latin1(); - std::string::size_type p1, p2; - std::string spaces = " \t\n\r"; - - p1 = t.find_first_of('"'); - if (p1 == std::string::npos) p1 = 0; - else p1++; - while ((p1 < t.length()) && - (spaces.find(t[p1]) != std::string::npos)) - p1++; - - p2 = t.find_last_of('"'); - if (p2 == std::string::npos) p2 = t.length(); - else p2--; - while ((p2 >= 0) && - (spaces.find(t[p2]) != std::string::npos)) - p2--; - - if (p1 <= p2) - t = t.substr(p1, p2-p1+1); - else - t = ""; - Tq = t.c_str(); -} - -void HXX2Salome::CloseButton_pressed() -{ - close(); -} - - -void HXX2Salome::SourceTreeButton_pressed() -{ - QString s = QFileDialog::getExistingDirectory( - CppDir, - this, - "get existing directory", - "Choose a directory", - TRUE ); - if (!s.isEmpty()) { - CppDir = s; - SourceTreeText->setText(s); - } -} - - -void HXX2Salome::newComponentTree() -{ - QString s = SourceTreeText->text(); - if (!s.isEmpty()) CppDir = s; -} - - -void HXX2Salome::newIncludeFile() -{ - QString s = IncludeText->text(); - QString dir, base; - - if (!s.isEmpty()) { - extractDirNameBaseName(s, dir, base); - CppInc = base; - if (dir != "./") - CppIncDir = dir; - } -} - - -void HXX2Salome::newSharedLibrary() -{ - QString s = LibraryText->text(); - QString dir, base; - - if (!s.isEmpty()) { - extractDirNameBaseName(s, dir, base); - CppLib = base; - if (dir != "./") - CppLibDir = dir; - } -} - - -void HXX2Salome::newEnvFile() -{ - QString s = EnvFileText->text(); - if (!s.isEmpty()) EnvFile = s; -} - - -void HXX2Salome::newOutputTree() -{ - QString s = OutputTreeText->text(); - if (!s.isEmpty()) SalomeDir = s; - -} - - -void HXX2Salome::OutputTreeButton_pressed() -{ - QString s = QFileDialog::getExistingDirectory( - SalomeDir, - this, - "get directory", - "Choose a directory", - TRUE ); - if (!s.isEmpty()) { - SalomeDir = s; - OutputTreeText->setText(s); - } -} - -void HXX2Salome::IncludeButton_pressed() -{ - QString s = QFileDialog::getOpenFileName( - CppIncDir + CppInc, - "Include files (*.h *.hh *.hxx *.hpp)", - this, - "C++ include file", - "Choose a file to open" ); - if (!s.isEmpty()) { - extractDirNameBaseName(s, CppIncDir, CppInc); - IncludeText->setText(CppInc); - } -} - - -void HXX2Salome::LibraryButton_pressed() -{ - QString s = QFileDialog::getOpenFileName( - CppLibDir + CppLib, - "Shared Libraries (*.so *.dll)", - this, - "Library file", - "Choose a file to open" ); - if (!s.isEmpty()) { - extractDirNameBaseName(s, CppLibDir, CppLib); - LibraryText->setText(CppLib); - } -} - - -void HXX2Salome::EnvFileButton_pressed() -{ - QString s = QFileDialog::getSaveFileName( - EnvFile, - "Environment files (*.csh *.sh)", - this, - "Environment file", - "Choose a script file to open" ); - if (!s.isEmpty()) { - EnvFile = s; - EnvFileText->setText(s); - } - -} - - -void HXX2Salome::shellChanged(int n) -{ -} - - -void HXX2Salome::GenerateButton_pressed() -{ - QString command; - command = "$HXX2SALOME_ROOT_DIR/hxx2salome "; - if (makeGUI->isChecked()) - command += " \"-g\" "; - if (Compile->isChecked()) - command += " \"-c\" "; - if (shell == 1) - command += " -s csh "; - if (!EnvFile.isEmpty()) { - command += " -e "; - command += EnvFile; - command += " "; - } - command += CppDir; - command += " \""; - command += CppInc; - command += "\" \""; - command += CppLib; - command += "\" \""; - command += SalomeDir; - command += "\""; - - std::cerr << "command = " << command << std::endl; - QCursor QOld(Qt::ArrowCursor), QNew(Qt::WaitCursor); - this->setCursor(QNew); - std::system(command); - this->setCursor(QOld); -} - -void HXX2Salome::init() -{ - std::cerr << "HXX2Salome::init" << std::endl; - shell = 0; - CppDir = ""; - CppInc = ""; - CppLib = ""; - EnvFile = ""; - SalomeDir = ""; - - char *home = getenv("HOME"); - std::string s(home), t; - QString Tq; - s += "/.hxx2salome"; - std::ifstream f(s.c_str()); - while (f.good()) { - - f >> s; - getline(f, t); - Tq = t.c_str(); - extract_value(Tq); - if (s == "CppDir") { - CppDir = Tq; - SourceTreeText->setText(CppDir); - } - else if (s == "CppInc") { - extractDirNameBaseName(Tq, CppIncDir, CppInc); - IncludeText->setText(CppInc); - } - else if (s == "CppLib") { - extractDirNameBaseName(Tq, CppLibDir, CppLib); - LibraryText->setText(CppLib); - } - else if (s == "EnvFile") { - EnvFile = Tq; - EnvFileText->setText(EnvFile); - } - else if (s == "SalomeDir") { - SalomeDir = Tq; - OutputTreeText->setText(SalomeDir); - } - else if (s == "Shell") { - if (Tq == "bash") shell = 0; - else if (Tq == "csh") shell = 1; - ShellChoice->setCurrentItem(shell); - ShellChoice->setCurrentText(Tq); - } - if (f.eof()) break; - } - - f.close(); -} - - -void HXX2Salome::ShellChoice_activated( int n) -{ - shell = ShellChoice->currentItem(); -} - - -void HXX2Salome::destroy() -{ - std::cerr << "HXX2Salome::destroy" << std::endl; - char *home = getenv("HOME"); - std::string s(home); - s += "/.hxx2salome"; - std::ofstream f(s.c_str()); - f << "CppDir " << "\"" << CppDir << "\"" << std::endl; - f << "CppInc " << "\"" << CppIncDir << CppInc << "\"" << std::endl; - f << "CppLib " << "\"" << CppLibDir << CppLib << "\"" << std::endl; - f << "SalomeDir " << "\"" << SalomeDir << "\"" << std::endl; - f << "EnvFile " << "\"" << EnvFile << "\"" << std::endl; - f << "Shell "; - switch (shell) { - case 0 : f<< "bash"; - break; - case 1: f << "csh"; - break; - default: f << "bash"; - break; - } - f << std::endl; - f.close(); -} - diff --git a/src/main.cpp b/src/main.cpp index d6809f9..0840c60 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,20 +1,13 @@ +#include - -#include #include "hxx2salome.h" int main( int argc, char ** argv ) { - QApplication a( argc, argv ); - - HXX2Salome *mw = new HXX2Salome(); - mw->setCaption( "Salome interface to C++ component generator" ); - a.setMainWidget( mw ); - mw->show(); + QApplication a( argc, argv ); - a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) ); - int result = a.exec(); - delete mw; - return result; + HXX2Salome mw; + mw.show(); + + return a.exec(); } -