]> SALOME platform Git repositories - tools/hxx2salome.git/commitdiff
Salome HOME
Merge from BR_QT4 17Feb09 V5_1_1a1 V5_1_1a2 V5_1_1rc1
authorvsr <vsr@opencascade.com>
Tue, 17 Feb 2009 09:50:05 +0000 (09:50 +0000)
committervsr <vsr@opencascade.com>
Tue, 17 Feb 2009 09:50:05 +0000 (09:50 +0000)
19 files changed:
config_files/check_qt.m4
scripts/Makefile.am
scripts/SA_build
scripts/SA_new_cpp_component
scripts/cpp_compo_template.tgz
scripts/hxx2salome
scripts/parse0.awk
scripts/parse01.awk
scripts/parse1.awk
scripts/parse2.awk
scripts/parse3.awk
scripts/renameSalomeModule
scripts/template_src.tgz
src/Makefile.am
src/hxx2salome.cpp [new file with mode: 0644]
src/hxx2salome.h [new file with mode: 0644]
src/hxx2salome.ui
src/hxx2salome.ui.h [deleted file]
src/main.cpp

index ab5348319f74ebd2bcf6e7cfd168e4f63b5791bd..5859b6afce7671fdbb82edea677fbff19921a807 100644 (file)
@@ -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 <qapplication.h>
+#include <QCoreApplication>
 ,   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 <QCoreApplication>
+,     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
 
index 85f034fbe0dd42e3ae76f17e495fc21223cd3cd1..e0665d596b373254099d10cf71ad5f22406ec3a0 100644 (file)
@@ -1,4 +1,7 @@
-
+# --
+# Copyright (C) CEA, EDF
+# Author : Nicolas Crouzet (CEA)
+# --
 bin_SCRIPTS = hxx2salome \
               parse01.awk \
               parse0.awk \
index f4238faf5463d949b3203028b7e4bdb848214196..84d8b2bc2e44af4a6cf9ff4f22710094e507b507 100755 (executable)
@@ -1,4 +1,8 @@
 #!/bin/bash
+# --
+# Copyright (C) CEA, EDF
+# Author : Nicolas Crouzet (CEA)
+# --
 #
 # Utility for building Salome Modules
 #
index e8ef4e085f108bf645b1d742e5589038c21d4bb0..09d13fab60964c860792c7e6e5af87f12fc86520 100755 (executable)
@@ -1,4 +1,8 @@
 #!/bin/bash
+# --
+# Copyright (C) CEA, EDF
+# Author : Nicolas Crouzet (CEA)
+# --
 
 usage()
 {
index 01d729e9642a3f6ba0ae3006f40732c4cf90f292..9dc7659493e7f32d4986c51d20d74b67e89d4fd8 100644 (file)
Binary files a/scripts/cpp_compo_template.tgz and b/scripts/cpp_compo_template.tgz differ
index c8a7507948f176869a17236a30c05b55a69942f7..0dce7f8dd5cbe577e68e1c2d1c9121fc2edcd50a 100755 (executable)
@@ -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
index ae194f4e7a37599ec8de903b55d4916fa79e83c9..d2738146f3ea58da0ad11524b0fb9a2890384e21 100644 (file)
@@ -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 }
index 8bec01785f19515a9bc643fab390ac7d95f42b09..ca4dbb9301e02c6c7ad490ac0098f46433c987bc 100644 (file)
@@ -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)
index 8d688d25f08b5e48b17a91165bf72901ba703dea..455ab957365349bf118b038edee163550ba280a1 100644 (file)
@@ -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 }
 
index 2ecc2c785fb2dd601a34363b7013827dccb59e0a..82c07a6945eda1c9394eaa67d207bf8256b357eb 100644 (file)
@@ -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 }
index 620587b0286092b276fef9a800f680b28b2923e0..6bd586756ab669503a595ebf8b0f5bbe38add52f 100644 (file)
@@ -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 
 }
 
index 8e9ab33102ce89ab2b9b73372b9793134b68772b..63c90b7c0af6ca68c7372631ee7fe7f297abd004 100755 (executable)
@@ -1,4 +1,8 @@
 #!/bin/bash
+# --
+# Copyright (C) CEA, EDF
+# Author : Nicolas Crouzet (CEA)
+# --
 
 usage()
 {
index be9dd35b209d831e5691aec08c0147793112c65a..f83486577c733ac1eef321832d8c23d3d0d9b62a 100644 (file)
Binary files a/scripts/template_src.tgz and b/scripts/template_src.tgz differ
index a8d1c836e46243edd01b79e3bcdbde3e0d5177c0..5d11edd1307d68369db1a1757d9789c78a281ee3 100644 (file)
@@ -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 (file)
index 0000000..1640666
--- /dev/null
@@ -0,0 +1,249 @@
+#include <QtCore/QDir>
+#include <QtCore/QFile>
+#include <QtCore/QFileInfo>
+#include <QtCore/QTextStream>
+#include <QtGui/QApplication>
+#include <QtGui/QFileDialog>
+#include <QtGui/QMessageBox>
+
+#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 (file)
index 0000000..8a56deb
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef __HXX2SALOME_H
+#define __HXX2SALOME_H
+
+#include <QtGui/QDialog>
+#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
index b9f4a54f7beca4df1ac90a6f36e53a54b3d66071..ebc362e8ba5404a2e89445ae43369a292f74303b 100644 (file)
-<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
-<class>HXX2Salome</class>
-<widget class="QWidget">
-    <property name="name">
-        <cstring>HXX2Salome</cstring>
-    </property>
-    <property name="geometry">
-        <rect>
-            <x>0</x>
-            <y>0</y>
-            <width>520</width>
-            <height>429</height>
-        </rect>
-    </property>
-    <property name="caption">
-        <string>Form1</string>
-    </property>
-    <widget class="QGroupBox">
-        <property name="name">
-            <cstring>Input</cstring>
-        </property>
-        <property name="geometry">
-            <rect>
-                <x>10</x>
-                <y>10</y>
-                <width>500</width>
-                <height>190</height>
-            </rect>
-        </property>
-        <property name="title">
-            <string>Input</string>
-        </property>
-        <widget class="QPushButton">
-            <property name="name">
-                <cstring>EnvFileButton</cstring>
-            </property>
-            <property name="geometry">
-                <rect>
-                    <x>380</x>
-                    <y>150</y>
-                    <width>80</width>
-                    <height>30</height>
-                </rect>
-            </property>
-            <property name="text">
-                <string>Browse ...</string>
-            </property>
-        </widget>
-        <widget class="QLabel">
-            <property name="name">
-                <cstring>IncludeFileLabel</cstring>
-            </property>
-            <property name="geometry">
-                <rect>
-                    <x>60</x>
-                    <y>70</y>
-                    <width>110</width>
-                    <height>30</height>
-                </rect>
-            </property>
-            <property name="text">
-                <string>&lt;p align="right"&gt;C++ include file&lt;/p&gt;</string>
-            </property>
-            <property name="toolTip" stdset="0">
-                <string>File containing the main C++ component class declaration</string>
-            </property>
-        </widget>
-        <widget class="QLabel">
-            <property name="name">
-                <cstring>EnvFileLabel</cstring>
-            </property>
-            <property name="geometry">
-                <rect>
-                    <x>30</x>
-                    <y>150</y>
-                    <width>140</width>
-                    <height>30</height>
-                </rect>
-            </property>
-            <property name="text">
-                <string>&lt;p align="right"&gt;Environment file&lt;/p&gt;</string>
-            </property>
-            <property name="toolTip" stdset="0">
-                <string>shell script where specific environment variable can be initialized for the component</string>
-            </property>
-        </widget>
-        <widget class="QLabel">
-            <property name="name">
-                <cstring>SourceTree</cstring>
-            </property>
-            <property name="geometry">
-                <rect>
-                    <x>30</x>
-                    <y>30</y>
-                    <width>140</width>
-                    <height>40</height>
-                </rect>
-            </property>
-            <property name="text">
-                <string>&lt;p align="right"&gt;C++ component tree&lt;br&gt;(absolute path)&lt;/p&gt;</string>
-            </property>
-            <property name="toolTip" stdset="0">
-                <string>This directory (or one ot its subdirectories) contains the main C++ include file and the main shared library of the component</string>
-            </property>
-        </widget>
-        <widget class="QLineEdit">
-            <property name="name">
-                <cstring>LibraryText</cstring>
-            </property>
-            <property name="geometry">
-                <rect>
-                    <x>180</x>
-                    <y>110</y>
-                    <width>190</width>
-                    <height>30</height>
-                </rect>
-            </property>
-        </widget>
-        <widget class="QLineEdit">
-            <property name="name">
-                <cstring>SourceTreeText</cstring>
-            </property>
-            <property name="geometry">
-                <rect>
-                    <x>180</x>
-                    <y>30</y>
-                    <width>190</width>
-                    <height>30</height>
-                </rect>
-            </property>
-        </widget>
-        <widget class="QLineEdit">
-            <property name="name">
-                <cstring>IncludeText</cstring>
-            </property>
-            <property name="geometry">
-                <rect>
-                    <x>180</x>
-                    <y>70</y>
-                    <width>190</width>
-                    <height>30</height>
-                </rect>
-            </property>
-        </widget>
-        <widget class="QPushButton">
-            <property name="name">
-                <cstring>SourceTreeButton</cstring>
-            </property>
-            <property name="geometry">
-                <rect>
-                    <x>380</x>
-                    <y>30</y>
-                    <width>80</width>
-                    <height>30</height>
-                </rect>
-            </property>
-            <property name="text">
-                <string>Browse ...</string>
-            </property>
-        </widget>
-        <widget class="QPushButton">
-            <property name="name">
-                <cstring>IncludeButton</cstring>
-            </property>
-            <property name="geometry">
-                <rect>
-                    <x>380</x>
-                    <y>70</y>
-                    <width>80</width>
-                    <height>30</height>
-                </rect>
-            </property>
-            <property name="text">
-                <string>Browse ...</string>
-            </property>
-        </widget>
-        <widget class="QPushButton">
-            <property name="name">
-                <cstring>LibraryButton</cstring>
-            </property>
-            <property name="geometry">
-                <rect>
-                    <x>380</x>
-                    <y>110</y>
-                    <width>80</width>
-                    <height>30</height>
-                </rect>
-            </property>
-            <property name="text">
-                <string>Browse ...</string>
-            </property>
-        </widget>
-        <widget class="QLabel">
-            <property name="name">
-                <cstring>LibraryLabel</cstring>
-            </property>
-            <property name="geometry">
-                <rect>
-                    <x>30</x>
-                    <y>110</y>
-                    <width>140</width>
-                    <height>30</height>
-                </rect>
-            </property>
-            <property name="text">
-                <string>&lt;p align="right"&gt;Shared library&lt;/p&gt;</string>
-            </property>
-            <property name="toolTip" stdset="0">
-                <string>Shared library (.so file) containing the compiled C++ component</string>
-            </property>
-        </widget>
-        <widget class="QLineEdit">
-            <property name="name">
-                <cstring>EnvFileText</cstring>
-            </property>
-            <property name="geometry">
-                <rect>
-                    <x>180</x>
-                    <y>150</y>
-                    <width>190</width>
-                    <height>30</height>
-                </rect>
-            </property>
-        </widget>
-    </widget>
-    <widget class="QPushButton">
-        <property name="name">
-            <cstring>GenButton</cstring>
+<ui version="4.0" >
+ <class>HXX2Salome</class>
+ <widget class="QDialog" name="HXX2Salome" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>517</width>
+    <height>400</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Salome interface to C++ component generator</string>
+  </property>
+  <layout class="QGridLayout" name="gridLayout_3" >
+   <item row="0" column="0" colspan="3" >
+    <widget class="QGroupBox" name="Input" >
+     <property name="title" >
+      <string>Input</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout" >
+      <item row="0" column="0" >
+       <widget class="QLabel" name="SourceTree" >
+        <property name="minimumSize" >
+         <size>
+          <width>160</width>
+          <height>0</height>
+         </size>
+        </property>
+        <property name="toolTip" >
+         <string>This directory (or one ot its subdirectories) contains the main C++ include file and the main shared library of the component</string>
+        </property>
+        <property name="text" >
+         <string>&lt;p align="right">C++ component tree&lt;br>(absolute path)&lt;/p></string>
+        </property>
+        <property name="alignment" >
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+        <property name="wordWrap" >
+         <bool>false</bool>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1" >
+       <widget class="QLineEdit" name="SourceTreeText" />
+      </item>
+      <item row="0" column="2" >
+       <widget class="QPushButton" name="SourceTreeButton" >
+        <property name="text" >
+         <string>Browse ...</string>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="0" >
+       <widget class="QLabel" name="IncludeFileLabel" >
+        <property name="minimumSize" >
+         <size>
+          <width>160</width>
+          <height>0</height>
+         </size>
+        </property>
+        <property name="toolTip" >
+         <string>File containing the main C++ component class declaration</string>
+        </property>
+        <property name="text" >
+         <string>&lt;p align="right">C++ include file&lt;/p></string>
+        </property>
+        <property name="alignment" >
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+        <property name="wordWrap" >
+         <bool>false</bool>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1" >
+       <widget class="QLineEdit" name="IncludeText" />
+      </item>
+      <item row="1" column="2" >
+       <widget class="QPushButton" name="IncludeButton" >
+        <property name="text" >
+         <string>Browse ...</string>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="0" >
+       <widget class="QLabel" name="LibraryLabel" >
+        <property name="minimumSize" >
+         <size>
+          <width>160</width>
+          <height>0</height>
+         </size>
+        </property>
+        <property name="toolTip" >
+         <string>Shared library (.so file) containing the compiled C++ component</string>
+        </property>
+        <property name="text" >
+         <string>&lt;p align="right">Shared library&lt;/p></string>
+        </property>
+        <property name="alignment" >
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+        <property name="wordWrap" >
+         <bool>false</bool>
         </property>
-        <property name="geometry">
-            <rect>
-                <x>30</x>
-                <y>380</y>
-                <width>86</width>
-                <height>28</height>
-            </rect>
+       </widget>
+      </item>
+      <item row="2" column="1" >
+       <widget class="QLineEdit" name="LibraryText" />
+      </item>
+      <item row="2" column="2" >
+       <widget class="QPushButton" name="LibraryButton" >
+        <property name="text" >
+         <string>Browse ...</string>
         </property>
-        <property name="text">
-            <string>Generate</string>
+       </widget>
+      </item>
+      <item row="3" column="0" >
+       <widget class="QLabel" name="EnvFileLabel" >
+        <property name="minimumSize" >
+         <size>
+          <width>160</width>
+          <height>0</height>
+         </size>
         </property>
+        <property name="toolTip" >
+         <string>shell script where specific environment variable can be initialized for the component</string>
+        </property>
+        <property name="text" >
+         <string>&lt;p align="right">Environment file&lt;/p></string>
+        </property>
+        <property name="alignment" >
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+        <property name="wordWrap" >
+         <bool>false</bool>
+        </property>
+       </widget>
+      </item>
+      <item row="3" column="1" >
+       <widget class="QLineEdit" name="EnvFileText" />
+      </item>
+      <item row="3" column="2" >
+       <widget class="QPushButton" name="EnvFileButton" >
+        <property name="text" >
+         <string>Browse ...</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
     </widget>
-    <widget class="QPushButton">
-        <property name="name">
-            <cstring>CloseButton</cstring>
+   </item>
+   <item row="1" column="0" colspan="3" >
+    <widget class="QGroupBox" name="Output" >
+     <property name="title" >
+      <string>Output</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout_2" >
+      <item row="0" column="0" >
+       <widget class="QLabel" name="OutputTreeLabel" >
+        <property name="minimumSize" >
+         <size>
+          <width>160</width>
+          <height>0</height>
+         </size>
+        </property>
+        <property name="text" >
+         <string>Salome component tree</string>
+        </property>
+        <property name="alignment" >
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+        <property name="wordWrap" >
+         <bool>false</bool>
         </property>
-        <property name="geometry">
-            <rect>
-                <x>390</x>
-                <y>380</y>
-                <width>86</width>
-                <height>28</height>
-            </rect>
+       </widget>
+      </item>
+      <item row="0" column="1" colspan="2" >
+       <widget class="QLineEdit" name="OutputTreeText" />
+      </item>
+      <item row="0" column="3" >
+       <widget class="QPushButton" name="OutputTreeButton" >
+        <property name="text" >
+         <string>Browse ...</string>
         </property>
-        <property name="text">
-            <string>Close</string>
+       </widget>
+      </item>
+      <item row="1" column="0" >
+       <widget class="QLabel" name="ShellText" >
+        <property name="text" >
+         <string>Shell</string>
         </property>
+        <property name="alignment" >
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+        <property name="wordWrap" >
+         <bool>false</bool>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1" >
+       <widget class="QComboBox" name="ShellChoice" >
+        <property name="sizePolicy" >
+         <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <item>
+         <property name="text" >
+          <string>bash</string>
+         </property>
+        </item>
+        <item>
+         <property name="text" >
+          <string>csh</string>
+         </property>
+        </item>
+       </widget>
+      </item>
+      <item row="1" column="2" >
+       <spacer name="horizontalSpacer_2" >
+        <property name="orientation" >
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeHint" stdset="0" >
+         <size>
+          <width>107</width>
+          <height>20</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+      <item row="2" column="0" colspan="3" >
+       <widget class="QCheckBox" name="MakeGUI" >
+        <property name="text" >
+         <string>Generate file structure for GUI</string>
+        </property>
+       </widget>
+      </item>
+      <item row="3" column="0" colspan="4" >
+       <widget class="QCheckBox" name="Compile" >
+        <property name="text" >
+         <string>Compile Salome Component (if checked, generation can take a long time)</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item row="2" column="0" >
+    <widget class="QPushButton" name="GenerateButton" >
+     <property name="text" >
+      <string>Generate</string>
+     </property>
     </widget>
-    <widget class="QGroupBox">
-        <property name="name">
-            <cstring>Output</cstring>
-        </property>
-        <property name="geometry">
-            <rect>
-                <x>10</x>
-                <y>200</y>
-                <width>500</width>
-                <height>160</height>
-            </rect>
-        </property>
-        <property name="title">
-            <string>Output</string>
-        </property>
-        <widget class="QLabel">
-            <property name="name">
-                <cstring>OutputTreeLabel</cstring>
-            </property>
-            <property name="geometry">
-                <rect>
-                    <x>30</x>
-                    <y>30</y>
-                    <width>140</width>
-                    <height>30</height>
-                </rect>
-            </property>
-            <property name="text">
-                <string>Salome component tree</string>
-            </property>
-        </widget>
-        <widget class="QLineEdit">
-            <property name="name">
-                <cstring>OutputTreeText</cstring>
-            </property>
-            <property name="geometry">
-                <rect>
-                    <x>180</x>
-                    <y>30</y>
-                    <width>190</width>
-                    <height>30</height>
-                </rect>
-            </property>
-        </widget>
-        <widget class="QLabel">
-            <property name="name">
-                <cstring>textLabel1</cstring>
-            </property>
-            <property name="geometry">
-                <rect>
-                    <x>230</x>
-                    <y>120</y>
-                    <width>259</width>
-                    <height>30</height>
-                </rect>
-            </property>
-            <property name="text">
-                <string>(if checked, generation can take a long time)</string>
-            </property>
-        </widget>
-        <widget class="QPushButton">
-            <property name="name">
-                <cstring>OutputTreeButton</cstring>
-            </property>
-            <property name="geometry">
-                <rect>
-                    <x>380</x>
-                    <y>30</y>
-                    <width>80</width>
-                    <height>30</height>
-                </rect>
-            </property>
-            <property name="text">
-                <string>Browse ...</string>
-            </property>
-        </widget>
-        <widget class="QComboBox">
-            <item>
-                <property name="text">
-                    <string>bash</string>
-                </property>
-            </item>
-            <item>
-                <property name="text">
-                    <string>csh</string>
-                </property>
-            </item>
-            <property name="name">
-                <cstring>ShellChoice</cstring>
-            </property>
-            <property name="geometry">
-                <rect>
-                    <x>90</x>
-                    <y>69</y>
-                    <width>90</width>
-                    <height>30</height>
-                </rect>
-            </property>
-        </widget>
-        <widget class="QLabel">
-            <property name="name">
-                <cstring>ShellText</cstring>
-            </property>
-            <property name="geometry">
-                <rect>
-                    <x>40</x>
-                    <y>69</y>
-                    <width>40</width>
-                    <height>30</height>
-                </rect>
-            </property>
-            <property name="text">
-                <string>Shell</string>
-            </property>
-        </widget>
-        <widget class="QCheckBox">
-            <property name="name">
-                <cstring>makeGUI</cstring>
-            </property>
-            <property name="geometry">
-                <rect>
-                    <x>200</x>
-                    <y>70</y>
-                    <width>241</width>
-                    <height>31</height>
-                </rect>
-            </property>
-            <property name="text">
-                <string>Generate file structure for GUI</string>
-            </property>
-        </widget>
-        <widget class="QCheckBox">
-            <property name="name">
-                <cstring>Compile</cstring>
-            </property>
-            <property name="geometry">
-                <rect>
-                    <x>200</x>
-                    <y>100</y>
-                    <width>210</width>
-                    <height>30</height>
-                </rect>
-            </property>
-            <property name="text">
-                <string>Compile Salome Component</string>
-            </property>
-        </widget>
+   </item>
+   <item row="2" column="1" >
+    <spacer name="horizontalSpacer" >
+     <property name="orientation" >
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="sizeHint" stdset="0" >
+      <size>
+       <width>326</width>
+       <height>20</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="2" column="2" >
+    <widget class="QPushButton" name="CloseButton" >
+     <property name="text" >
+      <string>Close</string>
+     </property>
     </widget>
-</widget>
-<connections>
-    <connection>
-        <sender>CloseButton</sender>
-        <signal>pressed()</signal>
-        <receiver>HXX2Salome</receiver>
-        <slot>CloseButton_pressed()</slot>
-    </connection>
-    <connection>
-        <sender>SourceTreeButton</sender>
-        <signal>pressed()</signal>
-        <receiver>HXX2Salome</receiver>
-        <slot>SourceTreeButton_pressed()</slot>
-    </connection>
-    <connection>
-        <sender>SourceTreeText</sender>
-        <signal>textChanged(const QString&amp;)</signal>
-        <receiver>HXX2Salome</receiver>
-        <slot>newComponentTree()</slot>
-    </connection>
-    <connection>
-        <sender>IncludeText</sender>
-        <signal>textChanged(const QString&amp;)</signal>
-        <receiver>HXX2Salome</receiver>
-        <slot>newIncludeFile()</slot>
-    </connection>
-    <connection>
-        <sender>LibraryText</sender>
-        <signal>textChanged(const QString&amp;)</signal>
-        <receiver>HXX2Salome</receiver>
-        <slot>newSharedLibrary()</slot>
-    </connection>
-    <connection>
-        <sender>EnvFileText</sender>
-        <signal>textChanged(const QString&amp;)</signal>
-        <receiver>HXX2Salome</receiver>
-        <slot>newEnvFile()</slot>
-    </connection>
-    <connection>
-        <sender>OutputTreeButton</sender>
-        <signal>pressed()</signal>
-        <receiver>HXX2Salome</receiver>
-        <slot>newOutputTree()</slot>
-    </connection>
-    <connection>
-        <sender>OutputTreeText</sender>
-        <signal>textChanged(const QString&amp;)</signal>
-        <receiver>HXX2Salome</receiver>
-        <slot>newOutputTree()</slot>
-    </connection>
-    <connection>
-        <sender>IncludeButton</sender>
-        <signal>pressed()</signal>
-        <receiver>HXX2Salome</receiver>
-        <slot>IncludeButton_pressed()</slot>
-    </connection>
-    <connection>
-        <sender>LibraryButton</sender>
-        <signal>pressed()</signal>
-        <receiver>HXX2Salome</receiver>
-        <slot>LibraryButton_pressed()</slot>
-    </connection>
-    <connection>
-        <sender>EnvFileButton</sender>
-        <signal>pressed()</signal>
-        <receiver>HXX2Salome</receiver>
-        <slot>EnvFileButton_pressed()</slot>
-    </connection>
-    <connection>
-        <sender>OutputTreeButton</sender>
-        <signal>pressed()</signal>
-        <receiver>HXX2Salome</receiver>
-        <slot>OutputTreeButton_pressed()</slot>
-    </connection>
-    <connection>
-        <sender>GenButton</sender>
-        <signal>pressed()</signal>
-        <receiver>HXX2Salome</receiver>
-        <slot>GenerateButton_pressed()</slot>
-    </connection>
-    <connection>
-        <sender>ShellChoice</sender>
-        <signal>activated(int)</signal>
-        <receiver>HXX2Salome</receiver>
-        <slot>ShellChoice_activated(int)</slot>
-    </connection>
-</connections>
-<variables>
-    <variable>QString CppLibDir;</variable>
-    <variable>QString SalomeDir;</variable>
-    <variable>QString CppDir;</variable>
-    <variable>QString CppInc;</variable>
-    <variable>QString CppLib;</variable>
-    <variable>QString EnvFile;</variable>
-    <variable>QString CppIncDir;</variable>
-    <variable>int shell;</variable>
-</variables>
-<slots>
-    <slot>CloseButton_pressed()</slot>
-    <slot>SourceTreeButton_pressed()</slot>
-    <slot>newComponentTree()</slot>
-    <slot>newIncludeFile()</slot>
-    <slot>newSharedLibrary()</slot>
-    <slot>newEnvFile()</slot>
-    <slot>newOutputTree()</slot>
-    <slot>OutputTreeButton_pressed()</slot>
-    <slot>IncludeButton_pressed()</slot>
-    <slot>LibraryButton_pressed()</slot>
-    <slot>EnvFileButton_pressed()</slot>
-    <slot>shellChanged( int n )</slot>
-    <slot>GenerateButton_pressed()</slot>
-    <slot>ShellChoice_activated( int n )</slot>
-    <slot>init()</slot>
-    <slot>destroy()</slot>
-</slots>
-<layoutdefaults spacing="6" margin="11"/>
-</UI>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/hxx2salome.ui.h b/src/hxx2salome.ui.h
deleted file mode 100644 (file)
index 5d1cccd..0000000
+++ /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 <iostream>
-#include <fstream>
-#include <string>
-#include <cstdlib>
-#include <libgen.h>
-#include <qfiledialog.h>
-
-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();
-}
-
index d6809f95a11d83bf472953815daf25bdc5ef1ae6..0840c60d9e0e9c1c510dbab299553cbc0e6789fd 100644 (file)
@@ -1,20 +1,13 @@
+#include <QtGui/QApplication>
 
-
-#include <qapplication.h>
 #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();
 }
-