Salome HOME
Initial commit
authorribes <ribes>
Mon, 9 Nov 2009 09:26:21 +0000 (09:26 +0000)
committerribes <ribes>
Mon, 9 Nov 2009 09:26:21 +0000 (09:26 +0000)
63 files changed:
AUTHORS [new file with mode: 0644]
COPYING [new file with mode: 0644]
ChangeLog [new file with mode: 0644]
Makefile.am [new file with mode: 0644]
NEWS [new file with mode: 0644]
README [new file with mode: 0644]
TO_BE_REMOVED [deleted file]
build_configure [new file with mode: 0755]
configure.ac [new file with mode: 0644]
m4/ac_cxx_option.m4 [new file with mode: 0644]
m4/ac_linker_options.m4 [new file with mode: 0644]
m4/check_omniorb.m4 [new file with mode: 0644]
m4/check_salome.m4 [new file with mode: 0644]
m4/check_sphinx.m4 [new file with mode: 0644]
m4/i2_check_qt4.m4 [new file with mode: 0644]
m4/production.m4 [new file with mode: 0644]
src/Makefile.am [new file with mode: 0644]
src/bases/BL_Exception.cxx [new file with mode: 0644]
src/bases/BL_Exception.hxx [new file with mode: 0644]
src/bases/BL_Traces.hxx [new file with mode: 0644]
src/bases/Makefile.am [new file with mode: 0644]
src/bases/make_begin.am [new file with mode: 0644]
src/engine/BL_Job.cxx [new file with mode: 0644]
src/engine/BL_Job.hxx [new file with mode: 0644]
src/engine/BL_JobsManager.cxx [new file with mode: 0644]
src/engine/BL_JobsManager.hxx [new file with mode: 0644]
src/engine/BL_SALOMEServices.cxx [new file with mode: 0644]
src/engine/BL_SALOMEServices.hxx [new file with mode: 0644]
src/genericgui/BL_Buttons.cxx [new file with mode: 0644]
src/genericgui/BL_Buttons.hxx [new file with mode: 0644]
src/genericgui/BL_CreateJobWizard.cxx [new file with mode: 0644]
src/genericgui/BL_CreateJobWizard.hxx [new file with mode: 0644]
src/genericgui/BL_GenericGui.cxx [new file with mode: 0644]
src/genericgui/BL_GenericGui.hxx [new file with mode: 0644]
src/genericgui/BL_JobTab.cxx [new file with mode: 0644]
src/genericgui/BL_JobTab.hxx [new file with mode: 0644]
src/genericgui/BL_JobsManager_QT.cxx [new file with mode: 0644]
src/genericgui/BL_JobsManager_QT.hxx [new file with mode: 0644]
src/genericgui/BL_JobsTable.cxx [new file with mode: 0644]
src/genericgui/BL_JobsTable.hxx [new file with mode: 0644]
src/genericgui/BL_MachineCatalog.cxx [new file with mode: 0644]
src/genericgui/BL_MachineCatalog.hxx [new file with mode: 0644]
src/genericgui/BL_MainButtons.cxx [new file with mode: 0644]
src/genericgui/BL_MainButtons.hxx [new file with mode: 0644]
src/genericgui/BL_QModelManager.cxx [new file with mode: 0644]
src/genericgui/BL_QModelManager.hxx [new file with mode: 0644]
src/genericgui/BL_Summary.cxx [new file with mode: 0644]
src/genericgui/BL_Summary.hxx [new file with mode: 0644]
src/genericgui/Makefile.am [new file with mode: 0644]
src/salomegui/BL_SalomeGui.cxx [new file with mode: 0644]
src/salomegui/BL_SalomeGui.hxx [new file with mode: 0644]
src/salomegui/Makefile.am [new file with mode: 0644]
src/salomegui/resources/SalomeApp.xml [new file with mode: 0644]
src/salomegui/resources/jobmanager.png [new file with mode: 0644]
src/standalone/Makefile.am [new file with mode: 0644]
src/standalone/main.cxx [new file with mode: 0644]
src/standalone/start_jobmanager.sh.in [new file with mode: 0644]
src/wrappers/BL_MainWindows_Qt.cxx [new file with mode: 0644]
src/wrappers/BL_MainWindows_Qt.hxx [new file with mode: 0644]
src/wrappers/BL_MainWindows_SALOME.cxx [new file with mode: 0644]
src/wrappers/BL_MainWindows_SALOME.hxx [new file with mode: 0644]
src/wrappers/BL_MainWindows_Wrap.hxx [new file with mode: 0644]
src/wrappers/Makefile.am [new file with mode: 0644]

diff --git a/AUTHORS b/AUTHORS
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/COPYING b/COPYING
new file mode 100644 (file)
index 0000000..d60c31a
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,340 @@
+                   GNU GENERAL PUBLIC LICENSE
+                      Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                           Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+\f
+                   GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+\f
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+\f
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+\f
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                           NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                    END OF TERMS AND CONDITIONS
+\f
+           How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year  name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/ChangeLog b/ChangeLog
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/Makefile.am b/Makefile.am
new file mode 100644 (file)
index 0000000..f8238b2
--- /dev/null
@@ -0,0 +1,3 @@
+ACLOCAL_AMFLAGS = -I m4
+
+SUBDIRS = src
diff --git a/NEWS b/NEWS
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..2833438
--- /dev/null
+++ b/README
@@ -0,0 +1 @@
+This module is an interface to use SALOME Launcher services.
diff --git a/TO_BE_REMOVED b/TO_BE_REMOVED
deleted file mode 100644 (file)
index 74cd5ce..0000000
+++ /dev/null
@@ -1 +0,0 @@
-TEst
diff --git a/build_configure b/build_configure
new file mode 100755 (executable)
index 0000000..e3987c4
--- /dev/null
@@ -0,0 +1,39 @@
+#! /bin/sh
+#  Copyright (C) 2009 CEA/DEN, EDF R&D
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+#  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+ORIG_DIR=`pwd`
+run() {
+    local logfile=$ORIG_DIR/build_configure.log
+    printf "%-50s" "$1 ... "
+    eval $1 > $logfile 2>&1
+    if test $? != 0 ; then
+        echo "[FAILED]"
+        echo "see file build_configure.log ..."
+        exit 1
+    fi
+    echo "[  OK  ]"
+}
+
+run "libtoolize --force --copy --automake"
+run "aclocal -I m4"
+run "autoheader -I m4"
+run "autoconf"
+run "automake --add-missing --copy"
+
diff --git a/configure.ac b/configure.ac
new file mode 100644 (file)
index 0000000..da46773
--- /dev/null
@@ -0,0 +1,133 @@
+#  Copyright (C) 2009  CEA/DEN, EDF R&D
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+#  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+# --
+# Author : André RIBES (EDF)
+# --
+# -----------------------------------------------------------------------------
+#
+AC_INIT([JOBMANAGER project], [0.1], [andre.ribes@edf.fr], [JobManager-Module])
+AM_INIT_AUTOMAKE([tar-pax])
+AC_CONFIG_HEADER(jobmanager_config.h)
+
+# set up MODULE_NAME variable for dynamic construction of directories (resources, etc.)
+MODULE_NAME=jobmanager
+AC_SUBST(MODULE_NAME)
+
+XVERSION=0x001
+AC_SUBST(XVERSION)
+
+RELEASE=$VERSION
+AC_SUBST(RELEASE)
+
+# This function return on stdout the absolute path of the filename in
+# argument. Exemple:
+# $ filename="../KERNEL_SRC/configure
+# $ absfilename=`absolute_path $filename`
+function absolute_path {
+    filename=$1
+    here=`pwd`
+    apath=`dirname $filename`
+    cd $apath
+    apath=`pwd`
+    cd $here
+    echo $apath
+}
+
+# Build directory, where the configure script is executed.
+ROOT_BUILDDIR=`pwd`
+# Source directory, where the configure script is located.
+ROOT_SRCDIR=`absolute_path $0`
+
+AC_SUBST(ROOT_SRCDIR)
+AC_SUBST(ROOT_BUILDDIR)
+
+echo
+echo Source root directory : $ROOT_SRCDIR
+echo Build  root directory : $ROOT_BUILDDIR
+
+# -----------------------------------------------------------------------------
+
+AC_ENABLE_DEBUG(yes)
+AC_DISABLE_PRODUCTION
+
+#Linker options
+AC_CANONICAL_BUILD
+AC_LINKER_OPTIONS
+
+#Mandatory products
+AC_PROG_CXX
+AM_PROG_LIBTOOL
+AC_CHECK_LIB(dl,dlopen)
+I2_CHECK_QT4
+AC_CHECK_OMNIORB
+
+# Optional products
+CHECK_SPHINX
+
+AC_CHECK_KERNEL
+CHECK_GUI(SALOME_Session_Server,SALOME_Session_Server)
+
+AM_CONDITIONAL([SALOME_KERNEL], [test "x$KERNEL_ROOT_DIR" != "x"])
+AM_CONDITIONAL([HAS_GUI], [test "x$GUI_ROOT_DIR" != "x"])
+
+echo
+echo
+echo
+echo "------------------------------------------------------------------------"
+echo "$PACKAGE $VERSION"
+echo "------------------------------------------------------------------------"
+echo
+echo "Configuration Options Summary:"
+echo
+echo "Mandatory products:"
+echo "  Qt4 (graphic interface)  : $qt_ok"
+echo "  OmniOrb (CORBA) ........ : $omniORB_ok"
+echo "  SALOME KERNEL .......... : $Kernel_ok"
+echo "  SALOME GUI ............. : $SalomeGUI_ok"
+echo
+echo "Optional products:"
+echo "  Sphinx (user doc) ...... : $sphinx_ok"
+echo
+echo "------------------------------------------------------------------------"
+echo
+
+if test "x$omniORB_ok" = "xno"; then
+  AC_MSG_ERROR([OmniOrb is required],1)
+fi
+if test "x$qt_ok" = "xno"; then
+  AC_MSG_ERROR([Qt4 is required],1)
+fi
+if test "x$Kernel_ok" = "xno"; then
+  AC_MSG_ERROR([SALOME KERNEL is required],1)
+fi
+if test "x$SalomeGui_ok" = "xno"; then
+  AC_MSG_ERROR([SALOME GUI is required],1)
+fi
+
+AC_OUTPUT([ \
+  Makefile \
+  src/Makefile \
+  src/bases/Makefile \
+  src/engine/Makefile \
+  src/genericgui/Makefile \
+  src/wrappers/Makefile \
+  src/standalone/Makefile \
+  src/standalone/start_jobmanager.sh \
+  src/salomegui/Makefile \
+])
diff --git a/m4/ac_cxx_option.m4 b/m4/ac_cxx_option.m4
new file mode 100644 (file)
index 0000000..6f31513
--- /dev/null
@@ -0,0 +1,42 @@
+dnl  Copyright (C) 2006-2008  CEA/DEN, EDF R&D
+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 @synopsis AC_CXX_OPTION(-option,variable where we add option if ok,action if ok; action if not ok)
+dnl Check options for C++ compiler
+dnl @author Bernard Secher - 15/01/2004
+dnl
+AC_DEFUN([AC_CXX_OPTION], [
+  AC_MSG_CHECKING(wether $CXX accepts $1)
+  cat > conftest.cxx <<EOF
+int main() { return 0; }
+EOF
+  $CXX -o a.out $1 conftest.cxx > conftest.log 2>&1
+  rm -f a.out
+  var=`echo $1 | sed -e "s, .*$,," | sed -e "s,^-,,"`
+#CCRT  if ! grep -e $var conftest.log > /dev/null 2>&1 ; then
+  if grep -e $var conftest.log > /dev/null 2>&1 ; then
+    AC_MSG_RESULT(no)
+    eval $4
+  else
+    AC_MSG_RESULT(yes)
+    $2="${$2} $1"
+    eval $3
+  fi
+])
+
+
diff --git a/m4/ac_linker_options.m4 b/m4/ac_linker_options.m4
new file mode 100644 (file)
index 0000000..cec98c4
--- /dev/null
@@ -0,0 +1,47 @@
+dnl  Copyright (C) 2006-2008  CEA/DEN, EDF R&D
+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 @synopsis AC_LINKER_OPTIONS
+dnl Check warning flags for C++ compiler to control warning messages
+dnl
+AC_DEFUN([AC_LINKER_OPTIONS],[
+
+  AC_CHECKING(for LIB_LOCATION_SUFFIX)
+  LIB_LOCATION_SUFFIX=""
+  AC_SUBST(LIB_LOCATION_SUFFIX)
+  AC_MSG_RESULT(LIB_LOCATION_SUFFIX is $LIB_LOCATION_SUFFIX)
+
+  for opt in "-Xlinker -export-dynamic" -transitive_link; do
+    AC_CXX_OPTION($opt,LDEXPDYNFLAGS,flag=yes,flag=no)
+    if test "$flag" = "yes"; then
+      break
+    fi
+  done
+  AC_SUBST(LDEXPDYNFLAGS)
+
+dnl 
+  case $host_os in
+    osf*)
+      STDLIB="-lcxxstd"
+      ;;
+    *)
+      STDLIB="-lstdc++"
+      ;;
+  esac
+  AC_SUBST(STDLIB)
+])
diff --git a/m4/check_omniorb.m4 b/m4/check_omniorb.m4
new file mode 100644 (file)
index 0000000..f2be9a7
--- /dev/null
@@ -0,0 +1,257 @@
+dnl  Copyright (C) 2006-2008  CEA/DEN, EDF R&D
+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
+AC_DEFUN([AC_CHECK_OMNIORB],[
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_CXX])dnl
+AC_REQUIRE([AC_PROG_CPP])dnl
+AC_REQUIRE([AC_PROG_CXXCPP])dnl
+
+AC_CHECKING(for omniORB)
+omniORB_ok=yes
+
+if test "x$PYTHON" = "x" 
+then
+  CHECK_PYTHON
+fi
+
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
+
+AC_PATH_PROG(OMNIORB_IDL, omniidl)
+if test "x$OMNIORB_IDL" = "x"
+then
+  omniORB_ok=no
+  AC_MSG_RESULT(omniORB binaries not in PATH variable)
+else
+  omniORB_ok=yes
+fi
+
+if  test "x$omniORB_ok" = "xyes"
+then
+  AC_SUBST(OMNIORB_IDL)
+
+  OMNIORB_BIN=`echo ${OMNIORB_IDL} | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
+  OMNIORB_ROOT=${OMNIORB_BIN}
+  # one-level up
+  OMNIORB_ROOT=`echo ${OMNIORB_ROOT}  | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
+  #
+  #
+  if test -d $OMNIORB_ROOT/include ; then
+    # if $OMNIORB_ROOT/include exists, there are a lot of chance that
+    # this is omniORB4.x installed via configure && make && make install
+    OMNIORB_LIB=`echo ${OMNIORB_BIN} | sed -e "s,bin\$,lib,"`
+    OMNIORB_VERSION=4
+  else
+    # omniORB has been installed old way
+    OMNIORB_LIB=`echo ${OMNIORB_BIN} | sed -e "s,bin/,lib/,"`
+    # one-level up again
+    OMNIORB_ROOT=`echo ${OMNIORB_ROOT}  | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
+    if test -d $OMNIORB_ROOT/include/omniORB4 ; then
+      OMNIORB_VERSION=4
+    else
+      OMNIORB_VERSION=3
+    fi
+  fi
+  AC_SUBST(OMNIORB_ROOT)
+
+  OMNIORB_INCLUDES="-I$OMNIORB_ROOT/include -I$OMNIORB_ROOT/include/omniORB${OMNIORB_VERSION} -I$OMNIORB_ROOT/include/COS"
+  AC_SUBST(OMNIORB_INCLUDES)
+
+  # ENABLE_PTHREADS
+
+  OMNIORB_CXXFLAGS="-DOMNIORB_VERSION=$OMNIORB_VERSION"
+  case $build_cpu in
+    sparc*)
+      OMNIORB_CXXFLAGS="$OMNIORB_CXXFLAGS -D__sparc__"
+      ;;
+   *86*)
+      OMNIORB_CXXFLAGS="$OMNIORB_CXXFLAGS -D__x86__"
+      ;;
+  esac
+  case $build_os in
+    solaris*)
+      __OSVERSION__=5
+      OMNIORB_CXXFLAGS="$OMNIORB_CXXFLAGS -D__sunos__"
+      ;;
+   linux*)
+      __OSVERSION__=2
+      OMNIORB_CXXFLAGS="$OMNIORB_CXXFLAGS -D__linux__ -D_REENTRANT"
+      ;;
+  esac
+  AC_SUBST(OMNIORB_CXXFLAGS)
+
+  CPPFLAGS_old=$CPPFLAGS
+  CPPFLAGS="$CPPFLAGS $OMNIORB_CXXFLAGS $OMNIORB_INCLUDES"
+
+  AC_LANG_CPLUSPLUS
+  AC_CHECK_HEADER(CORBA.h,omniORB_ok="yes",omniORB_ok="no")
+
+  CPPFLAGS=$CPPFLAGS_old
+
+fi
+
+if test "x$omniORB_ok" = "xyes" 
+then
+  if test "x$OMNIORB_LIB" = "x/usr/lib"
+  then
+    OMNIORB_LDFLAGS=""
+    OMNIORB_RFLAGS=""
+  else
+    OMNIORB_LDFLAGS="-L$OMNIORB_LIB"
+    OMNIORB_RFLAGS="-R$OMNIORB_LIB"
+  fi
+
+  LIBS_old=$LIBS
+  LIBS="$LIBS $OMNIORB_LDFLAGS -lomnithread"
+
+  CXXFLAGS_old=$CXXFLAGS
+  CXXFLAGS="$CXXFLAGS $OMNIORB_CXXFLAGS $OMNIORB_INCLUDES"
+
+  AC_MSG_CHECKING(whether we can link with omnithreads)
+  AC_CACHE_VAL(salome_cv_lib_omnithreads,[
+    AC_TRY_LINK(
+#include <omnithread.h>
+,   omni_mutex my_mutex,
+    eval "salome_cv_lib_omnithreads=yes",eval "salome_cv_lib_omnithreads=no")
+  ])
+
+  omniORB_ok="$salome_cv_lib_omnithreads"
+  if  test "x$omniORB_ok" = "xno"
+  then
+    AC_MSG_RESULT(omnithreads not found)
+  else
+    AC_MSG_RESULT(yes)
+  fi
+
+  LIBS=$LIBS_old
+  CXXFLAGS=$CXXFLAGS_old
+fi
+
+
+dnl omniORB_ok=yes
+if test "x$omniORB_ok" = "xyes" 
+then
+
+  AC_CHECK_LIB(socket,socket, LIBS="-lsocket $LIBS",,)
+  AC_CHECK_LIB(nsl,gethostbyname, LIBS="-lnsl $LIBS",,)
+
+  LIBS_old=$LIBS
+  OMNIORB_LIBS="$OMNIORB_LDFLAGS"
+  OMNIORB_LIBS="$OMNIORB_LIBS -lomniORB${OMNIORB_VERSION}"
+  OMNIORB_LIBS="$OMNIORB_LIBS -lomniDynamic${OMNIORB_VERSION}"
+  OMNIORB_LIBS="$OMNIORB_LIBS -lCOS${OMNIORB_VERSION}"
+  OMNIORB_LIBS="$OMNIORB_LIBS -lCOSDynamic${OMNIORB_VERSION}"
+  OMNIORB_LIBS="$OMNIORB_LIBS -lomnithread"
+  OMNIORB_LIBS="$OMNIORB_LIBS ${OMNIORB_RFLAGS}"
+  if test $OMNIORB_VERSION = 3 ; then
+    OMNIORB_LIBS="$OMNIORB_LIBS -ltcpwrapGK"
+  fi
+  AC_SUBST(OMNIORB_LIBS)
+
+  LIBS="$OMNIORB_LIBS $LIBS"
+  CXXFLAGS_old=$CXXFLAGS
+  CXXFLAGS="$CXXFLAGS $OMNIORB_CXXFLAGS $OMNIORB_INCLUDES"
+
+  AC_MSG_CHECKING(whether we can link with omniORB)
+  AC_CACHE_VAL(salome_cv_lib_omniorb,[
+    AC_TRY_LINK(
+#include <CORBA.h>
+,   CORBA::ORB_var orb,
+    eval "salome_cv_lib_omniorb3=yes",eval "salome_cv_lib_omniorb3=no")
+  ])
+  omniORB_ok="$salome_cv_lib_omniorb3"
+
+  omniORB_ok=yes
+  if test "x$omniORB_ok" = "xno" 
+  then
+    AC_MSG_RESULT(omniORB library linking failed)
+    omniORB_ok=no
+  else
+    AC_MSG_RESULT(yes)
+  fi
+  LIBS="$LIBS_old"
+  CXXFLAGS=$CXXFLAGS_old
+fi
+
+
+if test "x$omniORB_ok" = "xyes" 
+then
+
+  OMNIORB_IDLCXXFLAGS="-nf -I$OMNIORB_ROOT/idl"
+  OMNIORB_IDLPYFLAGS="-bpython -I$OMNIORB_ROOT/idl"
+  AC_SUBST(OMNIORB_IDLCXXFLAGS)
+  AC_SUBST(OMNIORB_IDLPYFLAGS)
+
+  OMNIORB_IDL_CLN_H=.hh
+  OMNIORB_IDL_CLN_CXX=SK.cc
+  OMNIORB_IDL_CLN_OBJ=SK.o 
+  AC_SUBST(OMNIORB_IDL_CLN_H)
+  AC_SUBST(OMNIORB_IDL_CLN_CXX)
+  AC_SUBST(OMNIORB_IDL_CLN_OBJ)
+
+  OMNIORB_IDL_SRV_H=.hh
+  OMNIORB_IDL_SRV_CXX=SK.cc
+  OMNIORB_IDL_SRV_OBJ=SK.o
+  AC_SUBST(OMNIORB_IDL_SRV_H)
+  AC_SUBST(OMNIORB_IDL_SRV_CXX)
+  AC_SUBST(OMNIORB_IDL_SRV_OBJ)
+
+  OMNIORB_IDL_TIE_H=
+  OMNIORB_IDL_TIE_CXX=
+  AC_SUBST(OMNIORB_IDL_TIE_H)
+  AC_SUBST(OMNIORB_IDL_TIE_CXX)
+  
+  AC_DEFINE(OMNIORB,,[Presence de omniORB])
+
+  CORBA_HAVE_POA=1
+  AC_DEFINE(CORBA_HAVE_POA,,[POA presence])
+
+  CORBA_ORB_INIT_HAVE_3_ARGS=1
+  AC_DEFINE(CORBA_ORB_INIT_HAVE_3_ARGS,,[?])
+  CORBA_ORB_INIT_THIRD_ARG='"omniORB"'
+  AC_DEFINE(CORBA_ORB_INIT_THIRD_ARG, "omniORB", [?])
+
+fi
+
+omniORBpy_ok=no
+if  test "x$omniORB_ok" = "xyes"
+then
+  AC_MSG_CHECKING(omniORBpy)
+  $PYTHON -c "import omniORB" &> /dev/null
+  if test $? = 0 ; then
+    AC_MSG_RESULT(yes)
+    omniORBpy_ok=yes
+  else
+    AC_MSG_RESULT(no, check your installation of omniORBpy)
+    omniORBpy_ok=no
+  fi
+fi
+
+dnl AC_LANG_RESTORE
+
+AC_MSG_RESULT(for omniORBpy: $omniORBpy_ok)
+AC_MSG_RESULT(for omniORB: $omniORB_ok)
+
+IDL=${OMNIORB_IDL}
+IDLGENFLAGS="-bcxx "
+AC_SUBST(IDL)  
+AC_SUBST(IDLGENFLAGS)  
+
+])dnl
+dnl
diff --git a/m4/check_salome.m4 b/m4/check_salome.m4
new file mode 100644 (file)
index 0000000..f6bdfa7
--- /dev/null
@@ -0,0 +1,164 @@
+dnl  Copyright (C) 2006-2008  CEA/DEN, EDF R&D
+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
+# Check availability of Salome's KERNEL binary distribution
+#
+# Author : Jerome Roy (CEA, 2003)
+#
+
+AC_DEFUN([AC_CHECK_KERNEL],[
+
+AC_CHECKING(for Kernel)
+
+Kernel_ok=no
+dsc_ok=no
+
+AC_ARG_WITH(kernel,
+           [  --with-kernel=DIR               root directory path of KERNEL build or installation],
+           KERNEL_DIR="$withval",KERNEL_DIR="")
+
+if test "x$KERNEL_DIR" = "x" ; then
+
+# no --with-kernel-dir option used
+
+   if test "x$KERNEL_ROOT_DIR" != "x" ; then
+
+    # KERNEL_ROOT_DIR environment variable defined
+      KERNEL_DIR=$KERNEL_ROOT_DIR
+
+   else
+
+    # search Kernel binaries in PATH variable
+      AC_PATH_PROG(TEMP, runSalome)
+      if test "x$TEMP" != "x" ; then
+         KERNEL_BIN_DIR=`dirname $TEMP`
+         KERNEL_DIR=`dirname $KERNEL_BIN_DIR`
+      fi
+      
+   fi
+# 
+fi
+
+
+if test -f ${KERNEL_DIR}/bin/salome/runSalome ; then
+   Kernel_ok=yes
+   AC_MSG_RESULT(Using Kernel module distribution in ${KERNEL_DIR})
+   AC_DEFINE(SALOME_KERNEL,,[With Salome KERNEL])
+
+   if test "x$KERNEL_ROOT_DIR" = "x" ; then
+      KERNEL_ROOT_DIR=${KERNEL_DIR}
+   fi
+   if test "x$KERNEL_SITE_DIR" = "x" ; then
+      KERNEL_SITE_DIR=${KERNEL_ROOT_DIR}
+   fi
+   SALOME_ROOT_DIR=`AS_DIRNAME(["$KERNEL_ROOT_DIR"])`
+   SALOME_VERSION="`echo $KERNEL_ROOT_DIR | sed s@$SALOME_ROOT_DIR/KERNEL@@`"
+
+   if test -f ${KERNEL_DIR}/idl/salome/DSC_Engines.idl ; then
+      # DSC extension available
+      dsc_ok=yes
+      AC_MSG_RESULT(Using DSC Ports module distribution in ${KERNEL_DIR})
+      AC_DEFINE(DSC_PORTS,,[With DSC ports])
+   else
+      AC_MSG_WARN("Cannot find DSC Ports module distribution")
+   fi
+
+   KERNEL_LDFLAGS=-L${KERNEL_ROOT_DIR}/lib/salome
+   KERNEL_CXXFLAGS=-I${KERNEL_ROOT_DIR}/include/salome
+
+   AC_SUBST(KERNEL_ROOT_DIR)
+   AC_SUBST(KERNEL_SITE_DIR)
+   AC_SUBST(SALOME_ROOT_DIR)
+   AC_SUBST(SALOME_VERSION)
+   AC_SUBST(KERNEL_LDFLAGS)
+   AC_SUBST(KERNEL_CXXFLAGS)
+
+else
+   AC_MSG_WARN("Cannot find compiled Kernel module distribution")
+fi
+
+AC_MSG_RESULT(for Kernel: $Kernel_ok)
+])dnl
+# -----------------------------------------------------------------------------
+# --- from GUI_SRC 3.2.3
+#  Check availability of Salome binary distribution
+#
+#  Author : Marc Tajchman (CEA, 2002)
+#------------------------------------------------------------
+
+AC_DEFUN([CHECK_GUI],[
+AC_REQUIRE([AC_LINKER_OPTIONS])dnl
+
+AC_CHECKING(for $2 $1 )
+
+SalomeGUI_ok=no
+
+GUI_LDFLAGS=""
+GUI_CXXFLAGS=""
+
+AC_ARG_WITH(gui,
+           [  --with-gui=DIR          root directory path of SALOME GUI installation],
+           [SALOME_GUI_DIR="$withval"],[SALOME_GUI_DIR=""])
+
+if test "x${SALOME_GUI_DIR}" = "x" ; then
+  # no --with-gui-dir option used
+  AC_MSG_RESULT(try \${GUI_ROOT_DIR}: ${GUI_ROOT_DIR})
+  if test "x${GUI_ROOT_DIR}" != "x" ; then
+    # SALOME_ROOT_DIR environment variable defined
+    SALOME_GUI_DIR=${GUI_ROOT_DIR}
+  else
+    # search Salome binaries in PATH variable
+    AC_PATH_PROG(TEMP, $1)
+    if test "x${TEMP}" != "x" ; then
+      AC_MSG_RESULT($1 was found at : ${TEMP})
+      SALOME_BIN_DIR=`dirname ${TEMP}`
+      SALOME_GUI_DIR=`cd ${SALOME_BIN_DIR}/../..; pwd`
+    fi
+  fi
+fi
+
+if test -f ${SALOME_GUI_DIR}/bin/salome/$1 ; then
+  SalomeGUI_ok=yes
+  AC_MSG_RESULT(Using SALOME GUI distribution in ${SALOME_GUI_DIR})
+
+  if test "x${GUI_ROOT_DIR}" == "x" ; then
+    GUI_ROOT_DIR=${SALOME_GUI_DIR}
+  fi
+
+  AC_SUBST(GUI_ROOT_DIR)
+
+  GUI_LDFLAGS=-L${SALOME_GUI_DIR}/lib/salome
+  GUI_CXXFLAGS=-I${SALOME_GUI_DIR}/include/salome
+
+  AC_SUBST(GUI_LDFLAGS)
+  AC_SUBST(GUI_CXXFLAGS)
+else
+  AC_MSG_WARN("Cannot find compiled SALOME GUI distribution")
+fi
+  
+AC_MSG_RESULT(for $2: ${SalomeGUI_ok})
+])dnl
+
+AC_DEFUN([CHECK_SALOME_GUI],[
+  CHECK_GUI([SUITApp],
+            [SALOME GUI])
+])dnl
+
diff --git a/m4/check_sphinx.m4 b/m4/check_sphinx.m4
new file mode 100644 (file)
index 0000000..eec1495
--- /dev/null
@@ -0,0 +1,35 @@
+dnl  Copyright (C) 2006-2008  CEA/DEN, EDF R&D
+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
+AC_DEFUN([CHECK_SPHINX],[
+
+AC_CHECKING(for sphinx doc generator)
+
+sphinx_ok=yes
+dnl where is sphinx ?
+AC_PATH_PROG(SPHINX,sphinx-build) 
+if test "x$SPHINX" = "x"
+then
+  AC_MSG_WARN(sphinx not found)
+  sphinx_ok=no
+fi
+
+AM_CONDITIONAL(SPHINX_IS_OK, [test x"$sphinx_ok" = xyes])
+
+])dnl
+dnl
diff --git a/m4/i2_check_qt4.m4 b/m4/i2_check_qt4.m4
new file mode 100644 (file)
index 0000000..355c389
--- /dev/null
@@ -0,0 +1,411 @@
+dnl  Copyright (C) 2006-2008  CEA/DEN, EDF R&D
+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 the following variables are exported:
+dnl  QT_MOC
+dnl  QT_UIC
+dnl  QT_DIR
+dnl  qt4_cppflags
+dnl  qt4_ldflags
+dnl  qt4_libs
+dnl  WITH_QT4
+dnl qt4 is searched in the following order
+dnl   path given with --with-qt4 options
+dnl   presence of QTDIR variable
+dnl   /usr
+dnl usages
+dnl ./configure --prefix=/home/prascle/partage/maquettes/install 
+dnl ./configure --prefix=/home/prascle/partage/maquettes/install --with-qt4
+dnl ./configure --prefix=/home/prascle/partage/maquettes/install --with-qt4=/opt/qt443
+dnl ./configure --prefix=/home/prascle/partage/maquettes/install --with-qt4-includes=/usr/include/qt4
+dnl ./configure --prefix=/home/prascle/partage/maquettes/install --with-qt4-includes=/usr/include/qt4 --with-qt4-libraries=/usr/lib -with-qt4-tools=/usr/bin
+dnl ./configure --prefix=/home/prascle/partage/maquettes/install --without-qt4
+dnl
+AC_DEFUN([I2_CHECK_QT4],
+[
+  AC_REQUIRE([AC_PROG_CXX])
+  AC_REQUIRE([AC_PROG_CPP])
+
+  qt_ok=no
+
+  # --- check if qt4 standard install directory is defined (with subdirectories bin lib include)
+  qt4_install_path=""
+  AC_ARG_WITH([qt4],
+    AC_HELP_STRING([--with-qt4@<:@=DIR@:>@], [where the Qt4 package with a standard install is: default @<:@$QTDIR@:>@ or @<:@/usr@:>@]),
+                 [qt4_install_path=$withval], [withval=notset])
+
+  # --- if qt4 standard install directory is defined but with no path: QTDIR value if defined, or /usr
+  if test x${withval} = xyes
+  then
+    if test -z $QTDIR
+    then
+      qt4_install_path="/usr"
+    else
+      qt4_install_path=$QTDIR
+    fi
+  fi
+
+  # --- if qt4 standard install directory is not defined: QTDIR value if defined, or /usr
+  if test x${withval} = xnotset
+  then
+    if test -z $QTDIR
+    then
+      qt4_install_path="/usr"
+    else
+      if test $QTDIR = /usr/lib/qt3 ; then
+        if test -d /usr/lib/qt4 ; then
+          AC_MSG_RESULT(it is strange for a qt4 installation !)
+          AC_MSG_RESULT(/usr/lib/qt4 is present)
+          AC_MSG_RESULT(replacing QTDIR by /usr/lib/qt4)
+          QTDIR=/usr/lib/qt4
+        fi
+      fi
+      qt4_install_path=$QTDIR
+    fi
+  fi
+  
+  # --- if qt4 standard install directory is not wanted: --without-qt4 or --with-qt4=no
+  if test x${withval} = xno
+  then
+    qt4_install_path=""
+  fi
+
+  QT_DIR=${qt4_install_path}
+  AC_SUBST(QT_DIR)
+
+  # --- check if qt4 includes directory is defined
+  qt4_include_path=""
+  AC_ARG_WITH([qt4-includes],
+    AC_HELP_STRING([--with-qt4-includes@<:@=DIR@:>@], [where the Qt4 includes are: default @<:@$QTDIR/include@:>@ or @<:@/usr/include@:>@]),
+                 [qt4_include_path=$withval], [withval=no])
+  if test x${withval} != xno
+  then
+    # --- qt4 includes directory is defined
+    if test x${qt4_include_path} = xyes
+    then
+      qt4_include_path="/usr/include"
+    fi
+  else
+    if test x${qt4_install_path} != x
+    then
+      qt4_include_path="${qt4_install_path}/include"
+    fi
+  fi
+
+
+  # --- check if qt4 libraries directory is defined
+  qt4_library_path=""
+  AC_ARG_WITH([qt4-libraries],
+    AC_HELP_STRING([--with-qt4-libraries@<:@=DIR@:>@], [where the Qt4 libraries are: default @<:@$QTDIR/lib@:>@ or @<:@/usr/lib@:>@]),
+                 [qt4_library_path=$withval], [withval=no])
+  if test x${withval} != xno
+  then
+    # --- qt4 libraries directory is defined
+    if test x${qt4_library_path} = xyes
+    then
+      qt4_library_path="/usr/lib"
+    fi
+  else
+    if test x${qt4_install_path} != x
+    then
+      qt4_library_path="${qt4_install_path}/lib"
+    fi
+  fi
+
+  # --- check if qt4 tools directory is defined
+  qt4_tools_path=""
+  AC_ARG_WITH([qt4-tools],
+    AC_HELP_STRING([--with-qt4-tools@<:@=DIR@:>@], [where the Qt4 executable tools are: default @<:@$QTDIR/bin@:>@ or @<:@/usr/bin@:>@]),
+                 [qt4_tools_path=$withval], [withval=no])
+  if test x${withval} != xno
+  then
+    # --- qt4 tools directory is defined
+    if test x${qt4_tools_path} = xyes
+    then
+      qt4_tools_path="/usr/bin"
+    fi
+  else
+    if test x${qt4_install_path} != x
+    then
+      qt4_tools_path="${qt4_install_path}/bin"
+    fi
+  fi
+
+  WITH_QT4=0
+
+  AC_MSG_NOTICE(${qt4_include_path})
+  AC_MSG_NOTICE(${qt4_library_path})
+  AC_MSG_NOTICE(${qt4_tools_path})
+
+  # test if qt4 is completely defined
+  qt4_defined=yes
+  if test x${qt4_include_path} = x
+  then
+    qt4_defined=no
+    AC_MSG_NOTICE([No Qt4 include path defined])
+  fi
+  if test x${qt4_library_path} = x
+  then
+    qt4_defined=no
+    AC_MSG_NOTICE([No Qt4 library path defined])
+  fi
+  if test x${qt4_tools_path} = x
+  then
+    qt4_defined=no
+    AC_MSG_NOTICE([No Qt4 tools path defined])
+  fi
+
+  # saving values for compilation variables
+  saved_CPPFLAGS=$CPPFLAGS
+  saved_LDFLAGS=$LDFLAGS
+  saved_LIBS=$LIBS
+
+  if ! test x${qt4_defined} = xno
+  then
+    # ask for qt4 support
+    AC_MSG_NOTICE([checking whether qt4 tools and headers are present])
+
+    # --- we test the presence of moc,first under the form moc-qt4, then moc
+    AC_PATH_PROGS(qt4_moc_found, [moc-qt4 moc], no, ${qt4_tools_path})
+    test x${qt4_moc_found} = xno && AC_MSG_ERROR([Qt4 moc command NOT FOUND])
+    QT_MOC=$qt4_moc_found
+    AC_SUBST(QT_MOC)
+
+    # --- we test the presence of uic,first under the form uic-qt4, then uic
+    AC_PATH_PROGS(qt4_uic_found, [uic-qt4 uic], no, ${qt4_tools_path})
+    test x${qt4_uic_found} = xno && AC_MSG_ERROR([Qt4 uic command NOT FOUND])
+    QT_UIC=$qt4_uic_found
+    AC_SUBST(QT_UIC)
+
+    # --- we test the presence of rcc,first under the form rcc-qt4, then rcc
+    AC_PATH_PROGS(qt4_rcc_found, [rcc-qt4 rcc], no, ${qt4_tools_path})
+    test x${qt4_rcc_found} = xno && AC_MSG_ERROR([Qt4 rcc command NOT FOUND])
+    QT_RCC=$qt4_rcc_found
+    AC_SUBST(QT_RCC)
+
+    # --- we test the header file presence and usability
+    QTINC=""
+    AC_CHECK_FILE($qt4_include_path/qt4/QtCore/qglobal.h,QTINC="/qt4",QTINC="")
+    qt4_include_path="$qt4_include_path${QTINC}"
+    qt4_cppflags=""
+    qt4_cppflags="${qt4_cppflags} -I$qt4_include_path/QtCore"
+    qt4_cppflags="${qt4_cppflags} -I$qt4_include_path/QtGui"
+    qt4_cppflags="${qt4_cppflags} -I$qt4_include_path/Qt"
+    qt4_cppflags="${qt4_cppflags} -I$qt4_include_path"
+    CPPFLAGS="${CPPFLAGS} ${qt4_cppflags}"
+    AC_LANG_PUSH(C++)
+    AC_CHECK_HEADERS([qapplication.h],
+                     [qt4_header_found=yes],
+                     [qt4_header_found=no],
+                     [])
+    AC_LANG_POP(C++)
+    test x${qt4_header_found} = xno && AC_MSG_ERROR([Qt4 include file NOT FOUND])
+    AC_SUBST(qt4_cppflags)
+
+    # --- we test the library file presence and usability
+    if test x${qt4_library_path} = /usr/lib
+    then
+      qt4_ldflags=""
+    else
+      qt4_ldflags="-L$qt4_library_path"
+    fi
+
+    AC_MSG_NOTICE([checking whether link with qt4 is working])
+    qt4_lib_name=QtGui
+    qt4_libs="-l$qt4_lib_name"
+    LDFLAGS="${LDFLAGS} ${qt4_ldflags}"
+    LIBS="${LIBS} ${qt4_libs}"
+    AC_LANG_PUSH(C++)
+
+    AC_LINK_IFELSE([AC_LANG_PROGRAM(
+    [[ #include <QApplication>
+       #include <QPushButton> ]],
+    [[ QApplication app(0, 0);
+       QPushButton hello("Hello world!");
+       hello.resize(100, 30);
+       hello.show(); ]] )],
+    [qt4_lib_found=yes], [qt4_lib_found=no] )
+
+    test x${qt4_lib_found} = xno && AC_MSG_ERROR([Qt4 library NOT FOUND])
+
+    AC_LANG_POP(C++)
+    AC_SUBST(qt4_ldflags)
+    AC_SUBST(qt4_libs)
+
+    # --- after all tests are successful, we support Qt4
+    WITH_QT4=1
+    qt_ok=yes
+    AC_MSG_NOTICE([Qt4 support is OK])
+
+  else
+    # --- no Qt4 support
+    AC_MSG_NOTICE([No Qt4 support])
+  fi
+
+  # Propagate test into atlocal
+  AC_SUBST(WITH_QT4)
+
+  # Propagate test into Makefiles...
+  AM_CONDITIONAL(WITH_QT4, test $WITH_QT4 = 1)
+
+  # ... and into source files
+  AC_DEFINE_UNQUOTED(HAS_QT4, $WITH_QT4, [Qt4 library])
+
+  # restoring saved values
+  CPPFLAGS=$saved_CPPFLAGS
+  LDFLAGS=$saved_LDFLAGS
+  LIBS=$saved_LIBS
+
+])
+
+
+AC_DEFUN([I2_CHECK_QSCINTILLA],
+[
+  AC_REQUIRE([I2_CHECK_QT4])
+
+  qscintilla_ok=no
+  WITH_QSCI4=0
+
+  # --- check if qsci4 includes directory is defined
+  qsci4_include_path=""
+  qsci4_cppflags=""
+
+  AC_ARG_WITH([qsci4-includes],
+    AC_HELP_STRING([--with-qsci4-includes@<:@=DIR@:>@], [where the Qsci4 includes are: default @<:@$QTDIR/include/Qsci@:>@ or @<:@/usr/include/Qsci@:>@]),
+              [qsci4_include_path=$withval])
+
+  if test x${qsci4_include_path} = x ; then
+    # --- "" --- try to use QSCINTILLA_DIR/include/Qsci
+    if test "x${QSCINTILLA_DIR}" != "x" ; then
+      qsci4_include_path="${QSCINTILLA_DIR}/include"
+    else
+      qsci4_include_path=no
+    fi
+  fi
+
+  if test x${qsci4_include_path} = xno ; then
+    # --- "no" --- no native installation, try to find in Qt
+    qsci4_include_path="${QT_DIR}/include${QTINC}/Qsci"
+    qsci4_cppflags=" -I$qsci4_include_path"
+    # " -I${QT_DIR}/include${QTINC}" is included in qt4_cppflags
+  else
+    if test x${qsci4_include_path} = xyes ; then
+      # --- "yes" --- try to find in /usr/include/Qsci
+      qsci4_include_path="/usr/include${QTINC}/Qsci"
+      qsci4_cppflags=" -I$qsci4_include_path"
+      # " -I/usr/include${QTINC}" is included in qt4_cppflags or by default (if QTINC is empty)
+    else
+      # --- "other" --- try to find in given dir
+      qsci4_cppflags=" -I$qsci4_include_path/Qsci -I$qsci4_include_path"
+    fi
+  fi
+
+  AC_MSG_NOTICE($qsci4_cppflags)
+
+  # --- check if qsci4 libraries directory is defined
+  qsci4_library_path=""
+
+  AC_ARG_WITH([qsci4-libraries],
+    AC_HELP_STRING([--with-qsci4-libraries@<:@=DIR@:>@], [where the Qsci4 libraries are: default @<:@$QTDIR/lib@:>@ or @<:@/usr/lib@:>@]),
+              [qsci4_library_path=$withval])
+
+  if test x${qsci4_library_path} = x ; then
+    # --- "" --- try to use QSCINTILLA_DIR/lib
+    if test "x${QSCINTILLA_DIR}" != "x" ; then
+      qsci4_library_path="${QSCINTILLA_DIR}/lib"
+    else
+      qsci4_library_path=no
+    fi
+  fi
+
+  if test x${qsci4_library_path} = xno ; then
+    # --- "no" --- no native installation, try to find in Qt
+    qsci4_library_path="${QT_DIR}/lib"
+  else
+    if test x${qsci4_library_path} = xyes ; then
+      # --- "yes" --- try to find in /usr/lib
+      qsci4_library_path="/usr/lib"
+    fi
+  fi
+
+  AC_MSG_NOTICE($qsci4_library_path)
+
+  # saving values for compilation variables
+  saved_CPPFLAGS=$CPPFLAGS
+  saved_LDFLAGS=$LDFLAGS
+  saved_LIBS=$LIBS
+
+  # ask for qsci4 support
+  AC_MSG_NOTICE([checking whether qscintilla for qt4 headers are present])
+
+  # --- we test the header file presence and usability
+  CPPFLAGS="${CPPFLAGS} ${qsci4_cppflags} ${qt4_cppflags}"
+  AC_LANG_PUSH(C++)
+  AC_CHECK_HEADERS([qsciscintilla.h],
+                   [qsci4_header_found=yes],
+                   [qsci4_header_found=no],
+                   [])
+  AC_LANG_POP(C++)
+  if test x${qsci4_header_found} = xyes
+  then
+    AC_SUBST(qsci4_cppflags)
+
+    # --- we test the library file presence and usability
+    if test x${qsci4_library_path} = x/usr/lib/qt4/lib
+    then
+      qsci4_library_path=/usr/lib
+    fi
+    if test x${qsci4_library_path} = x/usr/lib
+    then
+      qsci4_ldflags=""
+    else
+      qsci4_ldflags="-L$qsci4_library_path"
+    fi
+
+    AC_MSG_NOTICE([checking whether qscintilla2 library is present])
+    qsci4_libs=-lqscintilla2
+    AC_CHECK_FILE([${qsci4_library_path}/libqscintilla2.so],
+                   [qsci4_library_found=yes],
+                   [qsci4_library_found=no])
+    if test x${qsci4_library_found} = xyes
+    then
+      AC_MSG_NOTICE([qscintilla for qt4 support])
+      AC_SUBST(qsci4_ldflags)
+      AC_SUBST(qsci4_libs)
+      WITH_QSCI4=1
+      qscintilla_ok=yes
+      # Propagate test into atlocal
+      AC_SUBST(WITH_QSCI4)
+    fi
+
+  else
+    AC_MSG_NOTICE([no support for qscintilla for qt4])
+  fi
+
+  # Propagate test into Makefiles...
+  AM_CONDITIONAL(WITH_QSCI4, test $WITH_QSCI4 = 1)
+
+  # ... and into source files
+  AC_DEFINE_UNQUOTED(HAS_QSCI4, $WITH_QSCI4, [QsciScintilla library])
+
+  # restoring saved values
+  CPPFLAGS=$saved_CPPFLAGS
+  LDFLAGS=$saved_LDFLAGS
+  LIBS=$saved_LIBS
+
+])
diff --git a/m4/production.m4 b/m4/production.m4
new file mode 100644 (file)
index 0000000..802d37e
--- /dev/null
@@ -0,0 +1,101 @@
+dnl  Copyright (C) 2006-2008  CEA/DEN, EDF R&D
+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 define macros :
+dnl AC_ENABLE_PRODUCTION AC_DISABLE_PRODUCTION
+dnl AC_ENABLE_DEBUG AC_DISABLE_DEBUG
+dnl version $Id$
+dnl author Patrick GOLDBRONN
+dnl
+# AC_ENABLE_PRODUCTION
+AC_DEFUN(AC_ENABLE_PRODUCTION, [dnl
+define([AC_ENABLE_PRODUCTION_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(production,
+changequote(<<, >>)dnl
+<<  --enable-production[=PKGS]  build without debug information [default=>>AC_ENABLE_PRODUCTION_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_production=yes ;;
+no) enable_production=no ;;
+*)
+  enable_production=no
+  # Look at the argument we got.  We use all the common list separators.
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+  for pkg in $enableval; do
+    if test "X$pkg" = "X$p"; then
+      enable_production=yes
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac],
+enable_production=AC_ENABLE_PRODUCTION_DEFAULT)dnl
+if test "X$enable_production" = "Xyes"; then
+  FFLAGS="$FFLAGS -O3 "
+  CFLAGS="$CFLAGS -O3 "
+  CXXFLAGS="$CXXFLAGS -O3 "
+else
+  FFLAGS="$FFLAGS"
+  CFLAGS="$CFLAGS"
+  CXXFLAGS="$CXXFLAGS"
+fi
+])
+
+# AC_DISABLE_PRODUCTION - set the default flag to --disable-production
+AC_DEFUN(AC_DISABLE_PRODUCTION, [AC_ENABLE_PRODUCTION(no)])
+
+# AC_ENABLE_DEBUG
+AC_DEFUN(AC_ENABLE_DEBUG, [dnl
+define([AC_ENABLE_DEBUG_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(debug,
+changequote(<<, >>)dnl
+<<  --enable-debug[=PKGS]  build without debug information [default=>>AC_ENABLE_DEBUG_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_debug=yes ;;
+no) enable_debug=no ;;
+*)
+  enable_debug=no
+  # Look at the argument we got.  We use all the common list separators.
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+  for pkg in $enableval; do
+    if test "X$pkg" = "X$p"; then
+      enable_debug=yes
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac],
+enable_debug=AC_ENABLE_DEBUG_DEFAULT)dnl
+
+if test "X$enable_debug" = "Xyes"; then
+  FFLAGS="$FFLAGS -g "
+  CFLAGS="$CFLAGS -g "
+  CXXFLAGS="$CXXFLAGS -g -D_DEBUG_ "
+else
+  FFLAGS="$FFLAGS"
+  CFLAGS="$CFLAGS"
+  CXXFLAGS="$CXXFLAGS"
+fi
+])
+
+# AC_DISABLE_DEBUG - set the default flag to --disable-debug
+AC_DEFUN(AC_DISABLE_DEBUG, [AC_ENABLE_DEBUG(no)])
+
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644 (file)
index 0000000..0897ae9
--- /dev/null
@@ -0,0 +1,20 @@
+#  Copyright (C) 2009 CEA/DEN, EDF R&D
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+#  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+SUBDIRS = bases engine genericgui wrappers standalone salomegui
diff --git a/src/bases/BL_Exception.cxx b/src/bases/BL_Exception.cxx
new file mode 100644 (file)
index 0000000..087eeb7
--- /dev/null
@@ -0,0 +1,35 @@
+//  Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "BL_Exception.hxx"
+
+BL::Exception::Exception(const std::string& what):_what(what)
+{
+}
+
+BL::Exception::~Exception() throw ()
+{
+}
+
+const char *
+BL::Exception::what( void ) const throw ()
+{
+  return _what.c_str();
+}
+
diff --git a/src/bases/BL_Exception.hxx b/src/bases/BL_Exception.hxx
new file mode 100644 (file)
index 0000000..a03a836
--- /dev/null
@@ -0,0 +1,38 @@
+//  Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#ifndef __BL_EXCEPTION_HXX__
+#define __BL_EXCEPTION_HXX__
+
+#include <string>
+#include <exception>
+
+namespace BL
+{
+  class Exception : public std::exception
+  {
+  protected:
+    std::string _what;
+  public:
+    Exception(const std::string& what);
+    const char *what( void ) const throw ();
+    virtual ~Exception() throw ();
+  };
+}
+
+#endif
diff --git a/src/bases/BL_Traces.hxx b/src/bases/BL_Traces.hxx
new file mode 100644 (file)
index 0000000..74ea636
--- /dev/null
@@ -0,0 +1,38 @@
+//  Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef __BL_TRACES_HXX__
+#define __BL_TRACES_HXX__
+
+#include "BL_Exception.hxx"
+#include <iostream>
+#include <sstream>
+
+#ifdef _DEBUG_
+#define DEBTRACE(msg) {std::cerr<<std::flush<<__FILE__<<" ["<<__LINE__<<"] : "<<msg<<std::endl<<std::flush;}
+#else
+#define DEBTRACE(msg)
+#endif
+
+#define DEBMSG(msg) {std::cerr<<std::flush<<__FILE__<<" ["<<__LINE__<<"] : "<<msg<<std::endl<<std::flush;}
+//! BL_ASSERT macro is always defined, used like assert, but throw a BL::Exception instead of abort
+
+#define BL_ASSERT(val) {if(!(val)){std::stringstream mess; mess<<__FILE__<<" ["<<__LINE__<<"] : assertion "<<#val<<" failed"; throw BL::Exception(mess.str());}}
+
+#endif
diff --git a/src/bases/Makefile.am b/src/bases/Makefile.am
new file mode 100644 (file)
index 0000000..2429972
--- /dev/null
@@ -0,0 +1,26 @@
+#  Copyright (C) 2009 CEA/DEN, EDF R&D
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+#  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+include $(top_srcdir)/src/bases/make_begin.am
+
+lib_LTLIBRARIES = libBL_Bases.la
+
+libBL_Bases_la_SOURCES = BL_Exception.cxx BL_Exception.hxx
+
+salomeinclude_HEADERS = BL_Traces.hxx BL_Exception.hxx
diff --git a/src/bases/make_begin.am b/src/bases/make_begin.am
new file mode 100644 (file)
index 0000000..0e885b9
--- /dev/null
@@ -0,0 +1,38 @@
+#  Copyright (C) 2009 CEA/DEN, EDF R&D
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+#  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+##
+# Here any commonly used variables can be defined
+##
+
+# Standard directory for installation
+salomeincludedir   = $(includedir)/salome
+libdir             = $(prefix)/lib/salome
+bindir             = $(prefix)/bin/salome
+salomescriptdir    = $(bindir)
+
+# Directory for installing resource files
+salomeresdir       = $(prefix)/share/salome/resources/@MODULE_NAME@
+
+# Documentation directory
+docdir             = $(datadir)/doc/salome
+
+# translation (*.qm) files generation (lrelease)
+%.qm: resources/%.ts
+       $(QT_DIR)/bin/lrelease $< -qm $@
+
diff --git a/src/engine/BL_Job.cxx b/src/engine/BL_Job.cxx
new file mode 100644 (file)
index 0000000..85bbb65
--- /dev/null
@@ -0,0 +1,182 @@
+//  Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "BL_Job.hxx"
+
+BL::Job::Job()
+{
+  DEBTRACE("Creating BL::Job");
+  _name = "";
+  _yacs_file = "";
+  _command = "";
+  _batch_params.batch_directory = "";
+  _batch_params.expected_during_time = "";
+  _batch_params.expected_memory = "";
+  _batch_params.nb_proc = 0;
+  _files_params.result_directory = "";
+  _machine_choosed = "";
+  _state = BL::Job::CREATED;
+  _thread_state = BL::Job::NOTHING;
+  _salome_launcher_id = -1;
+}
+
+BL::Job::Job(const std::string & name)
+{
+  DEBTRACE("Creating BL::Job with name : " << name);
+  _name = name;
+  _yacs_file = "";
+  _command = "";
+  _batch_params.batch_directory = "";
+  _batch_params.expected_during_time = "";
+  _batch_params.expected_memory = "";
+  _batch_params.nb_proc = 0;
+  _files_params.result_directory = "";
+  _machine_choosed = "";
+  _state = BL::Job::CREATED;
+  _thread_state = BL::Job::NOTHING;
+  _salome_launcher_id = -1;
+}
+
+BL::Job::~Job()
+{}
+
+void
+BL::Job::setName(const std::string & name)
+{
+  _name = name;
+}
+
+std::string
+BL::Job::getName()
+{
+  return _name;
+}
+
+void 
+BL::Job::setType(BL::Job::JobType type)
+{
+  _type = type;
+}
+
+BL::Job::JobType
+BL::Job::getType()
+{
+  return _type;
+}
+
+void 
+BL::Job::setYACSFile(std::string & yacs_file)
+{
+  _yacs_file = yacs_file;
+}
+
+std::string & 
+BL::Job::getYACSFile()
+{
+  return _yacs_file;
+}
+
+void 
+BL::Job::setCommand(std::string & command)
+{
+  _command = command;
+}
+
+std::string & 
+BL::Job::getCommand()
+{
+  return _command;
+}
+
+void 
+BL::Job::setBatchParameters(BL::Job::BatchParam & param)
+{
+  _batch_params.batch_directory = param.batch_directory;
+  _batch_params.expected_during_time = param.expected_during_time;
+  _batch_params.expected_memory = param.expected_memory;
+  _batch_params.nb_proc = param.nb_proc;
+}
+
+BL::Job::BatchParam & 
+BL::Job::getBatchParameters()
+{
+  return _batch_params;
+}
+
+void 
+BL::Job::setFilesParameters(BL::Job::FilesParam & param)
+{
+  _files_params.result_directory = param.result_directory;
+  _files_params.input_files_list = param.input_files_list;
+  _files_params.output_files_list = param.output_files_list;
+}
+
+BL::Job::FilesParam & 
+BL::Job::getFilesParameters()
+{
+  return _files_params;
+}
+
+void
+BL::Job::setMachine(std::string & machine)
+{
+  _machine_choosed = machine;
+}
+
+std::string &
+BL::Job::getMachine()
+{
+  return _machine_choosed;
+}
+
+void 
+BL::Job::setState(BL::Job::State state)
+{
+  _state = state;
+}
+
+BL::Job::State 
+BL::Job::getState()
+{
+  return _state;
+}
+
+void 
+BL::Job::setThreadState(BL::Job::ThreadState state)
+{
+  _thread_state = state;
+}
+
+BL::Job::ThreadState 
+BL::Job::getThreadState()
+{
+  return _thread_state;
+}
+
+void 
+BL::Job::setSalomeLauncherId(int id)
+{
+  _salome_launcher_id = id;
+}
+
+int 
+BL::Job::getSalomeLauncherId()
+{
+  return _salome_launcher_id;
+}
diff --git a/src/engine/BL_Job.hxx b/src/engine/BL_Job.hxx
new file mode 100644 (file)
index 0000000..6a78e1c
--- /dev/null
@@ -0,0 +1,103 @@
+//  Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _BL_JOB_HXX_
+#define _BL_JOB_HXX_
+
+#include "BL_Traces.hxx"
+
+#include <string>
+#include <list>
+
+namespace BL{
+
+  class Job
+  {
+    public:
+      Job();
+      Job(const std::string & name);
+      virtual ~Job();
+
+      void setName(const std::string & name);
+      std::string getName();
+
+      enum JobType {YACS_SCHEMA, COMMAND};
+      void setType(BL::Job::JobType type);
+      BL::Job::JobType getType();
+
+      void setYACSFile(std::string & yacs_file);
+      std::string & getYACSFile();
+
+      void setCommand(std::string & command);
+      std::string & getCommand();
+
+      struct BatchParam
+      {
+       std::string batch_directory;
+       std::string expected_during_time;
+       std::string expected_memory;
+       int nb_proc;
+      };
+      void setBatchParameters(BL::Job::BatchParam & param);
+      BL::Job::BatchParam & getBatchParameters();
+
+      struct FilesParam
+      {
+       std::string result_directory;
+       std::list<std::string> input_files_list;
+       std::list<std::string> output_files_list;
+      };
+      void setFilesParameters(BL::Job::FilesParam & param);
+      BL::Job::FilesParam & getFilesParameters();
+
+      void setMachine(std::string & machine);
+      std::string & getMachine();
+
+      enum State {CREATED, IN_PROCESS, QUEUED, RUNNING, PAUSED, FINISHED, ERROR};
+      void setState(BL::Job::State state);
+      BL::Job::State getState();
+
+      enum ThreadState {NOTHING, STARTING}; 
+      void setThreadState(BL::Job::ThreadState state);
+      BL::Job::ThreadState getThreadState();
+
+      void setSalomeLauncherId(int id);
+      int getSalomeLauncherId();
+
+
+    private:
+      BL::Job::State _state;
+      BL::Job::ThreadState _thread_state;
+
+      std::string _name;
+
+      BL::Job::JobType _type;
+      std::string _yacs_file;
+      std::string _command;
+  
+      BL::Job::BatchParam _batch_params;
+      BL::Job::FilesParam _files_params;
+      std::string _machine_choosed;
+
+      int _salome_launcher_id;
+  };
+
+}
+
+#endif
diff --git a/src/engine/BL_JobsManager.cxx b/src/engine/BL_JobsManager.cxx
new file mode 100644 (file)
index 0000000..985d280
--- /dev/null
@@ -0,0 +1,327 @@
+//  Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "BL_JobsManager.hxx"
+
+BL::JobsManager::JobsManager(BL::SALOMEServices * salome_services)
+{
+  DEBTRACE("Creating BL::JobsManager");
+  BL_ASSERT(salome_services);
+  _salome_services = salome_services;
+  _observer = NULL;
+}
+
+BL::JobsManager::~JobsManager()
+{
+  DEBTRACE("Destroying BL::JobsManager");
+
+  // Delete All Jobs !
+  _jobs_it = _jobs.begin();
+  for(;_jobs_it != _jobs.end();_jobs_it++)
+    delete _jobs_it->second;
+}
+
+void 
+BL::JobsManager::setObserver(BL::Observer * observer)
+{
+  BL_ASSERT(observer);
+  _observer = observer;
+}
+
+BL::Job *
+BL::JobsManager::addNewJob(const std::string & name)
+{
+  DEBTRACE("addNewJob BL::JobsManager");
+
+  BL::Job * new_job = NULL;
+
+  _jobs_it = _jobs.find(name);
+  if (_jobs_it == _jobs.end())
+  {
+    new_job = new BL::Job(name);
+
+    // Ajout dans la liste
+    _jobs[name] = new_job;
+  }
+  else
+    DEBTRACE("addNewJob Error !!!! Job already exist: " << name);
+
+  return new_job;
+}
+
+void
+BL::JobsManager::removeJob(const std::string & name)
+{
+  DEBTRACE("removeJob BL::JobsManager");
+  _jobs_it = _jobs.find(name);
+  if (_jobs_it != _jobs.end())
+  {
+    std::string result = "";
+    if (_jobs_it->second->getSalomeLauncherId() != -1)
+      result = _salome_services->delete_job(_jobs_it->second);
+
+    delete _jobs_it->second;
+    _jobs.erase(_jobs_it->first);
+
+    if (_observer)
+      if (result != "")
+       _observer->sendEvent("delete_job", "Error", name, result);
+      else
+       _observer->sendEvent("delete_job", "Ok", name, "");
+  }
+  else
+    DEBTRACE("removeJob Error !!!! Job does not exist: " << name);
+}
+
+BL::Job *
+BL::JobsManager::getJob(const std::string & name)
+{
+  DEBTRACE("getJob BL::JobsManager called");
+  return _jobs[name];
+}
+
+std::map<std::string, BL::Job *> & 
+BL::JobsManager::getJobs()
+{
+  return _jobs;
+}
+
+bool 
+BL::JobsManager::job_already_exist(const std::string & name)
+{
+  _jobs_it = _jobs.find(name);
+
+  if (_jobs_it == _jobs.end())
+    return false;
+  else
+    return true;
+
+}
+
+void
+BL::JobsManager::start_job(const std::string & name)
+{
+  DEBTRACE("BL::JobsManager::start_job called for job: " << name);
+
+  // Check job exits
+  _jobs_it = _jobs.find(name);
+  if (_jobs_it == _jobs.end())
+  {
+    DEBTRACE("BL::JobsManager::start_job job unknown: " << name);
+    return;
+  }
+  else
+  {
+    _thread_mutex.lock();
+    BL::Job * job = _jobs_it->second; 
+    // Check Job Exec State - multithread protection
+    if (job->getThreadState() == BL::Job::NOTHING)
+    {
+      // Prepare Info for thread
+      BL::JobsManager::thread_info * ti = new thread_info();
+      ti->object_ptr = this;
+      ti->job_name = name;
+      job->setState(BL::Job::IN_PROCESS);
+      job->setThreadState(BL::Job::STARTING);
+      omni_thread::create(BL::JobsManager::starting_job_thread, ti);
+    }
+    else
+    {
+      DEBTRACE("BL::JobsManager::start_job nothin to do, job already starting, job name: " << name);
+    }
+    _thread_mutex.unlock();
+  }
+}
+
+void 
+BL::JobsManager::starting_job_thread(void * object_ptr)
+{
+  DEBTRACE("starting_job_thread BL::JobsManager called");
+  BL::JobsManager::thread_info * ti = reinterpret_cast<BL::JobsManager::thread_info*>(object_ptr);
+  BL::JobsManager * object = ti->object_ptr;
+  std::string job_name =  ti->job_name;
+  BL::Job * job = object->getJob(job_name);
+
+  std::string result = object->_salome_services->start_job(job);
+
+  object->_thread_mutex.lock();
+  // End
+  if (result == "")
+  {
+    if (object->_observer)
+      object->_observer->sendEvent("start_job", "Ok", job_name, "");
+    job->setState(BL::Job::QUEUED);
+    job->setThreadState(BL::Job::NOTHING);
+  }
+  else
+  {
+    if (object->_observer)
+      object->_observer->sendEvent("start_job", "Error", job_name, result);
+    job->setState(BL::Job::ERROR);
+    job->setThreadState(BL::Job::NOTHING);
+  }
+  object->_thread_mutex.unlock();
+}
+
+void
+BL::JobsManager::refresh_jobs()
+{
+  DEBTRACE("refresh_jobs BL::JobsManager called");
+
+  omni_thread::create(BL::JobsManager::refresh_job, this);
+}
+
+void
+BL::JobsManager::refresh_job(void * object_ptr)
+{
+  DEBTRACE("refresh_job BL::JobsManager called");
+  BL::JobsManager * object = reinterpret_cast<BL::JobsManager*>(object_ptr);
+
+  //iterate on all jobs
+  _jobs_map::iterator jobs_it;
+  jobs_it = object->_jobs.begin();
+  for(;jobs_it != object->_jobs.end();jobs_it++)
+  {
+    BL::Job * job = jobs_it->second;
+    if (job->getSalomeLauncherId() != -1)
+    {
+      object->_thread_mutex.lock();
+      if (job->getThreadState() == BL::Job::NOTHING)
+      {
+       BL::Job::State job_state = job->getState();
+       if (job_state != BL::Job::FINISHED or job_state != BL::Job::ERROR)
+       {
+         std::string result = object->_salome_services->refresh_job(job);
+         if (result == "QUEUED")
+         {
+           if (job_state != BL::Job::QUEUED)
+           {
+             job->setState(BL::Job::QUEUED);
+             if (object->_observer)
+               object->_observer->sendEvent("refresh_job", "Ok", job->getName(), "new state");
+           }
+         }
+         else if (result == "IN_PROCESS")
+         {
+           if (job_state != BL::Job::IN_PROCESS)
+           {
+             job->setState(BL::Job::IN_PROCESS);
+             if (object->_observer)
+               object->_observer->sendEvent("refresh_job", "Ok", job->getName(), "new state");
+           }
+         }
+         else if (result == "RUNNING")
+         {
+           if (job_state != BL::Job::RUNNING)
+           {
+             job->setState(BL::Job::RUNNING);
+             if (object->_observer)
+               object->_observer->sendEvent("refresh_job", "Ok", job->getName(), "new state");
+           }
+         }
+         else if (result == "PAUSED")
+         {
+           if (job_state != BL::Job::PAUSED)
+           {
+             job->setState(BL::Job::PAUSED);
+             if (object->_observer)
+               object->_observer->sendEvent("refresh_job", "Ok", job->getName(), "new state");
+           }
+         }
+         else if (result == "FINISHED")
+         {
+           job->setState(BL::Job::FINISHED);
+           if (object->_observer)
+             object->_observer->sendEvent("refresh_job", "Ok", job->getName(), "new state");
+         }
+         else if (result == "ERROR")
+         {
+           job->setState(BL::Job::ERROR);
+           if (object->_observer)
+             object->_observer->sendEvent("refresh_job", "Ok", job->getName(), "new state");
+         }
+         else
+         {
+           // Error using launcher...
+           if (object->_observer)
+             object->_observer->sendEvent("refresh_job", "Error", job->getName(), result);
+         }
+       }
+      }
+      object->_thread_mutex.unlock();
+    }
+  }
+}
+
+void
+BL::JobsManager::get_results_job(const std::string & name)
+{
+  DEBTRACE("get_results_job BL::JobsManager called");
+   
+  // Check job exits
+  _jobs_it = _jobs.find(name);
+  if (_jobs_it == _jobs.end())
+  {
+    DEBTRACE("BL::JobsManager::get_results_job job unknown: " << name);
+    return;
+  }
+  else
+  {
+    BL::Job * job = _jobs_it->second; 
+    if (job->getState() == BL::Job::FINISHED)
+    {
+      // Prepare Info for thread
+      BL::JobsManager::thread_info * ti = new thread_info();
+      ti->object_ptr = this;
+      ti->job_name = name;
+      omni_thread::create(BL::JobsManager::get_results_job_thread, ti);
+    }
+    else
+    {
+      DEBTRACE("BL::JobsManager::get_results_job job bad job state !");
+      return;
+    }
+  }
+}
+
+void 
+BL::JobsManager::get_results_job_thread(void * object_ptr)
+{
+  DEBTRACE("get_results_job_thread BL::JobsManager called");
+  BL::JobsManager::thread_info * ti = reinterpret_cast<BL::JobsManager::thread_info*>(object_ptr);
+  BL::JobsManager * object = ti->object_ptr;
+  std::string job_name =  ti->job_name;
+  BL::Job * job = object->getJob(job_name);
+
+  object->_thread_mutex_results.lock();
+  std::string result = object->_salome_services->get_results_job(job);
+
+  // End
+  if (result == "")
+  {
+    if (object->_observer)
+      object->_observer->sendEvent("get_results_job", "Ok", job_name, "");
+  }
+  else
+  {
+    if (object->_observer)
+      object->_observer->sendEvent("get_results_job", "Error", job_name, result);
+  }
+  object->_thread_mutex_results.unlock();
+}
diff --git a/src/engine/BL_JobsManager.hxx b/src/engine/BL_JobsManager.hxx
new file mode 100644 (file)
index 0000000..675a5ab
--- /dev/null
@@ -0,0 +1,81 @@
+//  Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _BL_JOBSMANAGER_HXX_
+#define _BL_JOBSMANAGER_HXX_
+
+#include "BL_Job.hxx"
+#include "BL_SALOMEServices.hxx"
+#include "BL_Traces.hxx"
+#include "BL_Observer.hxx"
+
+#include <map>
+#include <string>
+
+#include <omnithread.h>
+
+namespace BL{
+
+  class JobsManager
+  {
+    public:
+      JobsManager(BL::SALOMEServices * salome_services);
+      virtual ~JobsManager();
+
+      void setObserver(BL::Observer * observer);
+
+      BL::Job * addNewJob(const std::string & name);
+      void removeJob(const std::string & name);
+
+      BL::Job * getJob(const std::string & name);
+      std::map<std::string, BL::Job *> & getJobs();
+
+      bool job_already_exist(const std::string & name);
+
+      virtual void start_job(const std::string & name);
+      virtual void refresh_jobs();
+      virtual void get_results_job(const std::string & name);
+
+      static void starting_job_thread(void * object_ptr);
+      static void get_results_job_thread(void * object_ptr);
+      static void refresh_job(void * object_ptr);
+
+      struct thread_info
+      {
+       BL::JobsManager * object_ptr;
+       std::string job_name;
+      };
+
+    protected:
+      BL::SALOMEServices * _salome_services;
+      BL::Observer * _observer;
+
+    private:
+      typedef std::map<std::string, BL::Job *> _jobs_map;
+      _jobs_map _jobs;
+      _jobs_map::iterator _jobs_it;
+
+      omni_mutex _thread_mutex;
+      omni_mutex _thread_mutex_results;
+  };
+
+}
+
+#endif
+
diff --git a/src/engine/BL_SALOMEServices.cxx b/src/engine/BL_SALOMEServices.cxx
new file mode 100644 (file)
index 0000000..8f6a9d0
--- /dev/null
@@ -0,0 +1,214 @@
+//  Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "BL_SALOMEServices.hxx"
+
+BL::SALOMEServices::SALOMEServices()
+{
+  int nbargs = 0; char **args = 0;
+  _orb = CORBA::ORB_init (nbargs, args);
+  _salome_naming_service = NULL;
+  _lcc = NULL;
+  _state = false;
+}
+
+BL::SALOMEServices::~SALOMEServices()
+{
+  if (_salome_naming_service)
+    delete _salome_naming_service;
+  if (_lcc)
+    delete _lcc;
+}
+
+bool
+BL::SALOMEServices::initNS()
+{
+  bool return_value = true;
+  _salome_naming_service = new SALOME_NamingService(_orb);
+  _lcc = new SALOME_LifeCycleCORBA(_salome_naming_service);
+  CORBA::Object_var obj = _salome_naming_service->Resolve("/SalomeLauncher");
+  _salome_launcher = Engines::SalomeLauncher::_narrow(obj);
+
+  if (CORBA::is_nil(_salome_launcher))
+  {
+    DEBTRACE("SALOME Launcher is not reachable!")
+    return_value = false;
+  }
+
+  obj = _salome_naming_service->Resolve("/ResourcesManager");
+  _resources_manager = Engines::ResourcesManager::_narrow(obj);
+  if (CORBA::is_nil(_resources_manager))
+  {
+    DEBTRACE("SALOME Resource Manager is not reachable !");
+    return_value = false;
+  }
+
+  _state = return_value;
+  return return_value;
+}
+
+std::list<std::string> 
+BL::SALOMEServices::getMachineList()
+{
+  std::list<std::string> machine_list;
+  
+  if (_state)
+  {
+    Engines::MachineParameters params;
+    _lcc->preSet(params);
+    Engines::MachineList * machineList = _resources_manager->GetFittingResources(params);
+    for (int i = 0; i < machineList->length(); i++)
+    {
+      const char* aMachine = (*machineList)[i];
+      machine_list.push_back(aMachine);
+    }
+  }
+
+  return machine_list;
+}
+
+std::string
+BL::SALOMEServices::start_job(BL::Job * job)
+{
+  return start_yacs_job(job);
+}
+
+std::string
+BL::SALOMEServices::start_yacs_job(BL::Job * job)
+{
+  std::string ret = "";
+  // Prepare Arguments
+  const char * fileToExecute = job->getYACSFile().c_str();
+
+  BL::Job::FilesParam files = job->getFilesParameters();
+  Engines::FilesList_var filesToExport = new Engines::FilesList;
+  filesToExport->length(files.input_files_list.size());
+  std::list<std::string>::iterator it;
+  int i = 0;
+  for (it=files.input_files_list.begin() ; it != files.input_files_list.end(); it++)
+  {
+    filesToExport[i] = CORBA::string_dup((*it).c_str());
+    i++;
+  }
+  Engines::FilesList_var filesToImport = new Engines::FilesList;
+  filesToImport->length(files.output_files_list.size());
+  i = 0;
+  for (it=files.output_files_list.begin() ; it != files.output_files_list.end(); it++)
+  {
+    filesToImport[i] = CORBA::string_dup((*it).c_str());
+    i++;
+  }
+
+  BL::Job::BatchParam cpp_batch_params =  job->getBatchParameters();
+  Engines::BatchParameters_var batch_params = new Engines::BatchParameters;
+  batch_params->batch_directory = CORBA::string_dup(cpp_batch_params.batch_directory.c_str());
+  batch_params->expected_during_time = CORBA::string_dup(cpp_batch_params.expected_during_time.c_str());
+  batch_params->mem = CORBA::string_dup(cpp_batch_params.expected_memory.c_str());
+  batch_params->nb_proc = cpp_batch_params.nb_proc;
+
+  Engines::MachineParameters_var machine = new Engines::MachineParameters;
+  machine->hostname = CORBA::string_dup(job->getMachine().c_str());
+
+  // Start Job !
+  try
+  {
+    int job_id = _salome_launcher->submitSalomeJob(fileToExecute, filesToExport,
+                                                  filesToImport, batch_params, machine);
+    job->setSalomeLauncherId(job_id);
+  }
+  catch (const SALOME::SALOME_Exception & ex)
+  {
+    DEBTRACE("SALOME Exception in submitSalomeJob !");
+    ret = ex.details.text.in();
+  }
+  return ret;
+}
+
+std::string
+BL::SALOMEServices::refresh_job(BL::Job * job)
+{
+  std::string ret = "";
+
+  Engines::MachineParameters_var machine = new Engines::MachineParameters;
+  machine->hostname = CORBA::string_dup(job->getMachine().c_str());
+
+  // Refresh Job !
+  try
+  {
+    CORBA::String_var result = _salome_launcher->queryJob(job->getSalomeLauncherId(), machine);
+    std::string res = result.in();
+    if (res == "Running")
+      return "RUNNING";
+    else if (res == "Done")
+      return "FINISHED";
+    else
+      return result.in();
+  }
+  catch (const SALOME::SALOME_Exception & ex)
+  {
+    DEBTRACE("SALOME Exception in refresh_job !");
+    ret = ex.details.text.in();
+  }
+  return ret;
+}
+
+std::string
+BL::SALOMEServices::delete_job(BL::Job * job)
+{
+  std::string ret = "";
+
+  Engines::MachineParameters_var machine = new Engines::MachineParameters;
+  machine->hostname = CORBA::string_dup(job->getMachine().c_str());
+
+  // Delete Job !
+  try
+  {
+    _salome_launcher->deleteJob(job->getSalomeLauncherId(), machine);
+  }
+  catch (const SALOME::SALOME_Exception & ex)
+  {
+    DEBTRACE("SALOME Exception in refresh_job !");
+    ret = ex.details.text.in();
+  }
+  return ret;
+}
+
+std::string
+BL::SALOMEServices::get_results_job(BL::Job * job)
+{
+  std::string ret = "";
+
+  Engines::MachineParameters_var machine = new Engines::MachineParameters;
+  machine->hostname = CORBA::string_dup(job->getMachine().c_str());
+
+  BL::Job::FilesParam files = job->getFilesParameters();
+  CORBA::String_var directory = CORBA::string_dup(files.result_directory.c_str());
+
+  // get job results !
+  try
+  {
+    _salome_launcher->getResultsJob(directory, job->getSalomeLauncherId(), machine);
+  }
+  catch (const SALOME::SALOME_Exception & ex)
+  {
+    DEBTRACE("SALOME Exception in refresh_job !");
+    ret = ex.details.text.in();
+  }
+  return ret;
+}
diff --git a/src/engine/BL_SALOMEServices.hxx b/src/engine/BL_SALOMEServices.hxx
new file mode 100644 (file)
index 0000000..f5e597d
--- /dev/null
@@ -0,0 +1,68 @@
+//  Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _BL_SALOMESERVICES_HXX_
+#define _BL_SALOMESERVICES_HXX_
+
+#include "BL_Traces.hxx"
+#include "BL_Job.hxx"
+
+#include "SALOME_NamingService.hxx"
+#include "SALOME_LifeCycleCORBA.hxx"
+#include "SALOME_ContainerManager.hh"
+
+#include <map>
+#include <list>
+#include <string>
+
+namespace BL{
+
+  class SALOMEServices
+  {
+    public:
+      SALOMEServices();
+      virtual ~SALOMEServices();
+
+      bool initNS();
+
+      std::list<std::string> getMachineList();
+
+      std::string start_job(BL::Job * job);
+      std::string refresh_job(BL::Job * job);
+      std::string delete_job(BL::Job * job);
+      std::string get_results_job(BL::Job * job);
+
+    protected:
+      std::string start_yacs_job(BL::Job * job);
+
+    private:
+      CORBA::ORB_var _orb;
+      SALOME_NamingService * _salome_naming_service;
+      SALOME_LifeCycleCORBA * _lcc;
+      Engines::SalomeLauncher_var _salome_launcher;
+      Engines::ResourcesManager_var _resources_manager;
+
+      bool _state;
+  };
+
+}
+
+#endif
+
+
diff --git a/src/genericgui/BL_Buttons.cxx b/src/genericgui/BL_Buttons.cxx
new file mode 100644 (file)
index 0000000..b13f7df
--- /dev/null
@@ -0,0 +1,120 @@
+//  Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "BL_Buttons.hxx"
+
+BL::Buttons::Buttons(QWidget * parent) : QGroupBox(parent)
+{
+  DEBTRACE("Creating BL::Buttons");
+
+  setTitle("Actions");
+
+  _create_button = new QPushButton("Create Job", this);
+  _start_button = new QPushButton("Start Job", this);
+  _delete_button = new QPushButton("Delete Job", this);
+  _get_results_button = new QPushButton("Get Job Results", this);
+  _refresh_button = new QPushButton("Refresh Jobs", this);
+
+  QHBoxLayout *mainLayout = new QHBoxLayout;
+  mainLayout->addWidget(_create_button);
+  mainLayout->addWidget(_start_button);
+  mainLayout->addWidget(_delete_button);
+  mainLayout->addWidget(_get_results_button);
+  mainLayout->addWidget(_refresh_button);
+  mainLayout->setSpacing(0); // Space between buttons
+
+  setLayout(mainLayout);
+
+  //QSizePolicy poli;
+  //poli.setControlType(QSizePolicy::PushButton);
+  //poli.setVerticalPolicy(QSizePolicy::Fixed);
+  //poli.setHorizontalPolicy(QSizePolicy::Fixed);
+  //setSizePolicy(poli);
+}
+
+BL::Buttons::~Buttons()
+{
+  DEBTRACE("Destroying BL::Buttons");
+}
+
+void
+BL::Buttons::setCreateButtonSlot(QObject * receiver, const char * name)
+{
+  connect(_create_button, SIGNAL(clicked()), receiver, name);
+}
+
+void
+BL::Buttons::setStartButtonSlot(QObject * receiver, const char * name)
+{
+  connect(_start_button, SIGNAL(clicked()), receiver, name);
+}
+
+void
+BL::Buttons::setDeleteButtonSlot(QObject * receiver, const char * name)
+{
+  connect(_delete_button, SIGNAL(clicked()), receiver, name);
+}
+
+void
+BL::Buttons::setRefreshButtonSlot(QObject * receiver, const char * name)
+{
+  connect(_refresh_button, SIGNAL(clicked()), receiver, name);
+}
+
+void 
+BL::Buttons::setGetResultsButtonSlot(QObject * receiver, const char * name)
+{
+  connect(_get_results_button, SIGNAL(clicked()), receiver, name);
+}
+
+void 
+BL::Buttons::enable_start_button()
+{
+  _start_button->setEnabled(true);
+}
+
+void 
+BL::Buttons::disable_start_button()
+{
+  _start_button->setEnabled(false);
+}
+
+void 
+BL::Buttons::enable_delete_button()
+{
+  _delete_button->setEnabled(true);
+}
+
+void 
+BL::Buttons::disable_delete_button()
+{
+  _delete_button->setEnabled(false);
+}
+
+void 
+BL::Buttons::enable_get_results_button()
+{
+  _get_results_button->setEnabled(true);
+}
+
+void 
+BL::Buttons::disable_get_results_button()
+{
+  _get_results_button->setEnabled(false);
+}
diff --git a/src/genericgui/BL_Buttons.hxx b/src/genericgui/BL_Buttons.hxx
new file mode 100644 (file)
index 0000000..866e96d
--- /dev/null
@@ -0,0 +1,62 @@
+//  Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _BL_BUTTONS_HXX_
+#define _BL_BUTTONS_HXX_
+
+#include <QtGui>
+
+#include "BL_Traces.hxx"
+
+namespace BL 
+{
+  class Buttons: public QGroupBox
+  {
+    Q_OBJECT
+
+    public:
+      Buttons(QWidget * parent);
+      virtual ~Buttons();
+
+      void setCreateButtonSlot(QObject * receiver, const char * name);
+      void setStartButtonSlot(QObject * receiver, const char * name);
+      void setDeleteButtonSlot(QObject * receiver, const char * name);
+      void setRefreshButtonSlot(QObject * receiver, const char * name);
+      void setGetResultsButtonSlot(QObject * receiver, const char * name);
+
+      void enable_start_button();
+      void disable_start_button();
+
+      void enable_delete_button();
+      void disable_delete_button();
+
+      void enable_get_results_button();
+      void disable_get_results_button();
+
+    protected:  
+      QPushButton * _create_button;
+      QPushButton * _start_button;
+      QPushButton * _delete_button;
+      QPushButton * _get_results_button;
+      QPushButton * _refresh_button;
+  };
+}
+
+#endif
+
diff --git a/src/genericgui/BL_CreateJobWizard.cxx b/src/genericgui/BL_CreateJobWizard.cxx
new file mode 100644 (file)
index 0000000..99ae4ee
--- /dev/null
@@ -0,0 +1,686 @@
+//  Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "BL_CreateJobWizard.hxx"
+
+BL::CreateJobWizard::CreateJobWizard(BL::JobsManager_QT * jobs_manager, BL::SALOMEServices * salome_services)
+{
+  DEBTRACE("Creating BL::CreateJobWizard");
+  BL_ASSERT(jobs_manager);
+  BL_ASSERT(salome_services);
+  _jobs_manager = jobs_manager;
+
+  job_name = "";
+  yacs_file = "";
+  command = "";
+  batch_directory = "";
+  expected_during_time = "";
+  expected_memory = "";
+  nb_proc = 1;
+
+  result_directory = "";
+
+  machine_choosed = "";
+
+  start_job = false;
+
+  setOptions(QWizard::IndependentPages | QWizard::NoBackButtonOnStartPage);
+
+  setPage(Page_JobName, new BL::CreateJobWizard::JobNamePage(this, _jobs_manager));
+  setPage(Page_YACSSchema, new BL::YACSSchemaPage(this));
+  setPage(Page_BatchParameters, new BL::BatchParametersPage(this));
+  setPage(Page_Files, new BL::FilesPage(this));
+  setPage(Page_Command_Main_Definitions, new BL::CreateJobWizard::CommandMainPage(this));
+  setPage(Page_Machine, new BL::MachinePage(this, salome_services));
+  setPage(Page_Conclusion, new BL::CreateJobWizard::ConclusionPage(this));
+
+  setWindowTitle("Create Job Wizard");
+  connect(this, SIGNAL(finished(int)), this, SLOT(end(int)));
+}
+
+BL::CreateJobWizard::~CreateJobWizard()
+{
+  DEBTRACE("Destroying BL::CreateJobWizard");
+}
+
+void
+BL::CreateJobWizard::setFilesList(QListWidget * input_files_list, QListWidget * output_files_list)
+{
+  _input_files_list = input_files_list;
+  _output_files_list = output_files_list;
+}
+
+void
+BL::CreateJobWizard::end(int result)
+{
+  DEBTRACE("End of BL::CreateJobWizard");
+  if (result)
+  {
+    // Job Name Panel
+    QString f_job_name = field("job_name").toString();
+    job_name = f_job_name.toStdString();
+
+    // YACS Schema Panel
+    QString f_yacs_file = field("yacs_file").toString();
+    yacs_file = f_yacs_file.toStdString();
+    
+    // Command Panel
+    QString f_command = field("command").toString();
+    command = f_command.toStdString();
+    
+    // Batch Panel
+    QString f_batch_directory = field("batch_directory").toString();
+    batch_directory = f_batch_directory.toStdString();
+
+    QString time_hour;
+    QString time_min;
+    if (field("during_time_hour").toInt() < 10)
+      time_hour = "0" + field("during_time_hour").toString();
+    else
+      time_hour = field("during_time_hour").toString();
+    if (field("during_time_min").toInt() < 10)
+      time_min = "0" + field("during_time_min").toString();
+    else
+      time_min = field("during_time_min").toString();
+    expected_during_time = time_hour.toStdString() + ":" + time_min.toStdString() + ":00";
+
+    QString mem = field("mem_value").toString();
+    int mem_type_i = field("mem_type").toInt();
+    QString mem_type("gb");
+    if (mem_type_i == 0)
+      mem_type = "mb";
+    expected_memory = mem.toStdString() + mem_type.toStdString();
+
+    nb_proc = field("proc_value").toInt();
+
+    // Files Panel
+    QString f_result_directory = field("result_directory").toString();
+    result_directory = f_result_directory.toStdString();
+    for (int i = 0; i < _input_files_list->count(); ++i)
+    {
+      QListWidgetItem * item = _input_files_list->item(i);
+      QString item_text = item->text();
+      input_files_list.push_back(item_text.toStdString());
+    }
+    for (int i = 0; i < _output_files_list->count(); ++i)
+    {
+      QListWidgetItem * item = _output_files_list->item(i);
+      QString item_text = item->text();
+      output_files_list.push_back(item_text.toStdString());
+    }
+
+    // Machine list
+    QString f_machine_choosed = field("machine_choosed").toString();
+    machine_choosed = f_machine_choosed.toStdString(); 
+
+    start_job = field("start_job").toBool();
+  }
+}
+
+// Job Name Page
+BL::CreateJobWizard::JobNamePage::JobNamePage(QWidget * parent, BL::JobsManager_QT * jobs_manager)
+: QWizardPage(parent)
+{
+  _jobs_manager = jobs_manager;
+  setTitle("Create a new job");
+
+  QLabel *label = new QLabel("Enter Job name, you cannot add two jobs with the same name");
+  label->setWordWrap(true);
+  QLabel * nameLabel = new QLabel("Job Name:");
+  QLineEdit * _nameLineEdit = new QLineEdit(this);
+  registerField("job_name", _nameLineEdit);
+
+  QLabel * label_type = new QLabel("Choose type of batch job:");
+  QGroupBox *groupBox = new QGroupBox();
+  _yacs_schema_button = new QRadioButton(tr("YACS Schema"));
+  _yacs_schema_button->setChecked(true);
+  QRadioButton *radio2 = new QRadioButton(tr("Command"));
+  QVBoxLayout *vbox = new QVBoxLayout;
+  vbox->addWidget(_yacs_schema_button);
+  vbox->addWidget(radio2);
+  vbox->addStretch(1);
+  groupBox->setLayout(vbox);
+
+  // Layouts
+  QVBoxLayout * main_layout = new QVBoxLayout;
+  main_layout->addWidget(label);
+  QGridLayout *layout = new QGridLayout;
+  layout->addWidget(nameLabel, 0, 0);
+  layout->addWidget(_nameLineEdit, 0, 1);
+  main_layout->insertLayout(-1, layout);
+  layout->addWidget(label_type, 2, 0);
+  layout->addWidget(groupBox, 3, 0, 1, -1);
+  setLayout(main_layout);
+}
+
+BL::CreateJobWizard::JobNamePage::~JobNamePage()
+{}
+
+bool
+BL::CreateJobWizard::JobNamePage::validatePage()
+{
+  DEBTRACE("Calling validatePage of BL::CreateJobWizard::JobNamePage");
+  bool return_value;
+  QString job_name = field("job_name").toString();
+
+  // Check if job name is empty
+  if (job_name == "")
+  {
+    QMessageBox::warning(NULL, "Job Name Error", "Job name entered is empty, enter a job name or cancel the wizard");
+    return_value = false;
+  }
+
+  // Check if job name already exists
+  else {
+    if (_jobs_manager->job_already_exist(job_name.toStdString()) == false)
+    {
+      return_value = true;
+    }
+    else
+    {
+      QMessageBox::critical(NULL, "Job Name Error", "Job name entered is already used");
+      QString value("");
+      setField("job_name", value);
+      return_value = false;
+    }
+  }
+
+  return return_value;
+}
+
+int 
+BL::CreateJobWizard::JobNamePage::nextId() const
+{
+  if (_yacs_schema_button->isChecked()) 
+  {
+    return BL::CreateJobWizard::Page_YACSSchema;
+  } 
+  else 
+  {
+    return BL::CreateJobWizard::Page_Command_Main_Definitions;
+  }
+}
+
+BL::YACSSchemaPage::YACSSchemaPage(QWidget * parent)
+: QWizardPage(parent)
+{
+  setTitle("Choose YACS Schema");
+
+  QLabel *label = new QLabel("In this step you have to choose what YACS Schema you want to execute");
+  label->setWordWrap(true);
+
+  _yacs_file_button = new QPushButton(tr("Choose YACS Schema file"));
+  _yacs_file_button->show();
+  connect(_yacs_file_button, SIGNAL(clicked()), this, SLOT(choose_file()));
+
+  _yacs_file_text = new QLineEdit(this);
+  _yacs_file_text->setText("");
+  registerField("yacs_file", _yacs_file_text);
+  _yacs_file_text->setReadOnly(true);
+
+  QVBoxLayout * main_layout = new QVBoxLayout;
+  main_layout->addWidget(label);
+  QGridLayout *layout = new QGridLayout;
+  layout->addWidget(_yacs_file_button, 0, 0);
+  layout->addWidget(_yacs_file_text, 0, 1);
+  main_layout->insertLayout(-1, layout);
+  setLayout(main_layout);
+};
+
+BL::YACSSchemaPage::~YACSSchemaPage()
+{}
+
+bool
+BL::YACSSchemaPage::validatePage()
+{
+  bool return_value;
+  QString yacs_file = field("yacs_file").toString();
+  if (yacs_file != "")
+  {
+    return_value = true;
+  }
+  else
+  {
+    QMessageBox::warning(NULL, "YACS File Error", "Please choose a YACS File");
+    return_value = false;
+  }
+  return return_value;
+}
+
+void
+BL::YACSSchemaPage::choose_file()
+{
+  QString yacs_file = QFileDialog::getOpenFileName(this,
+                                                  tr("Open YACS files"), "",
+                                                  tr("XML (*.xml);;All Files (*)"));
+  _yacs_file_text->setReadOnly(false);
+  _yacs_file_text->setText(yacs_file);
+  _yacs_file_text->setReadOnly(true);
+}
+
+int 
+BL::YACSSchemaPage::nextId() const
+{
+  return BL::CreateJobWizard::Page_BatchParameters;
+}
+
+BL::CreateJobWizard::CommandMainPage::CommandMainPage(QWidget * parent)
+: QWizardPage(parent)
+{
+  setTitle("Define command job");
+  QLabel *label = new QLabel("Enter the command that will be executed into the resource");
+  label->setWordWrap(true);
+
+  // command
+  QLabel * label_command = new QLabel("Command: ");
+  QLineEdit * line_command = new QLineEdit(this);
+  registerField("command", line_command);
+
+  QGridLayout *layout = new QGridLayout;
+  layout->addWidget(label_command, 0, 0);
+  layout->addWidget(line_command, 0, 1);
+
+  QVBoxLayout * main_layout = new QVBoxLayout;
+  main_layout->addWidget(label);
+  main_layout->insertLayout(-1, layout);
+  setLayout(main_layout);
+};
+
+BL::CreateJobWizard::CommandMainPage::~CommandMainPage()
+{}
+
+bool
+BL::CreateJobWizard::CommandMainPage::validatePage()
+{
+  QString command = field("command").toString();
+  if (command == "")
+  {
+    QMessageBox::warning(NULL, "Command Error", "Please enter a command");
+    return false;
+  }
+
+  return true;
+}
+
+int 
+BL::CreateJobWizard::CommandMainPage::nextId() const
+{
+  return BL::CreateJobWizard::Page_BatchParameters;
+}
+
+BL::BatchParametersPage::BatchParametersPage(QWidget * parent)
+: QWizardPage(parent)
+{
+  setTitle("Enter Batch Parameters");
+
+  QLabel *label = new QLabel("In this step you define the parameters of your job");
+  label->setWordWrap(true);
+  QVBoxLayout * main_layout = new QVBoxLayout;
+  main_layout->addWidget(label);
+
+  // batch_directory
+  QLabel * label_directory = new QLabel("Batch directory: ");
+  QLineEdit * line_directory = new QLineEdit(this);
+  registerField("batch_directory", line_directory);
+
+  // exected during time
+  QLabel * label_during_time = new QLabel("Expected during time: ");
+  QSpinBox * spin_during_time_hour = new QSpinBox(this);
+  QLabel * label_during_time_hour = new QLabel("Hours");
+  spin_during_time_hour->setMinimum(0);
+  spin_during_time_hour->setMaximum(1000000);
+  registerField("during_time_hour", spin_during_time_hour);
+  QSpinBox * spin_during_time_min = new QSpinBox(this);
+  QLabel * label_during_time_min = new QLabel("Minutes");
+  spin_during_time_min->setMinimum(0);
+  spin_during_time_min->setMaximum(59);
+  registerField("during_time_min", spin_during_time_min);
+
+  // memory
+  QLabel * label_memory = new QLabel("Memory per nodes expected: ");
+  QSpinBox * spin_memory = new QSpinBox(this);
+  spin_memory->setMinimum(0);
+  spin_memory->setMaximum(1000000);
+  registerField("mem_value", spin_memory);
+  QComboBox * combo_memory = new QComboBox(this);
+  combo_memory->addItem("MB");
+  combo_memory->addItem("GB");
+  combo_memory->setCurrentIndex(1);
+  registerField("mem_type", combo_memory);
+
+  // proc
+  QLabel * label_proc = new QLabel("Number of proc expected: ");
+  QSpinBox * spin_proc = new QSpinBox(this);
+  spin_proc->setMinimum(1);
+  spin_proc->setMaximum(1000000);
+  registerField("proc_value", spin_proc);
+
+  QGridLayout *layout = new QGridLayout;
+  layout->addWidget(label_directory, 0, 0);
+  layout->addWidget(line_directory, 0, 1, 1, -1);
+  layout->addWidget(label_during_time, 1, 0);
+  layout->addWidget(spin_during_time_hour, 1, 1);
+  layout->addWidget(label_during_time_hour, 1, 2);
+  layout->addWidget(spin_during_time_min, 1, 3);
+  layout->addWidget(label_during_time_min, 1, 4);
+  layout->addWidget(label_memory, 2, 0);
+  layout->addWidget(spin_memory, 2, 1);
+  layout->addWidget(combo_memory, 2, 2);
+  layout->addWidget(label_proc, 3, 0);
+  layout->addWidget(spin_proc, 3, 1);
+
+  main_layout->insertLayout(-1, layout);
+
+  setLayout(main_layout);
+};
+
+BL::BatchParametersPage::~BatchParametersPage()
+{}
+
+bool
+BL::BatchParametersPage::validatePage()
+{
+  QString batch_directory = field("batch_directory").toString();
+  if (batch_directory == "")
+  {
+    QMessageBox::warning(NULL, "Batch Directory Error", "Please enter a batch directory");
+    return false;
+  }
+
+  int time_hour = field("during_time_hour").toInt();
+  int time_min = field("during_time_min").toInt();
+  if (time_hour == 0 and time_min == 0)
+  {
+    QMessageBox::warning(NULL, "Time Error", "Please enter an expected during time");
+    return false;
+  }
+
+  int mem = field("mem_value").toInt();
+  if (mem == 0)
+  {
+    QMessageBox::warning(NULL, "Memory Error", "Please enter an expected memory");
+    return false;
+  }
+
+  return true;
+}
+
+int 
+BL::BatchParametersPage::nextId() const
+{
+  return BL::CreateJobWizard::Page_Files;
+}
+
+BL::FilesPage::FilesPage(BL::CreateJobWizard * parent)
+: QWizardPage(parent)
+{
+  setTitle("Enter Input and Output Files");
+
+  QLabel * main_label = new QLabel("In this step you define input and output files of your job");
+  main_label->setWordWrap(true);
+
+  // input_files
+  QGroupBox * input_group_box = new QGroupBox("Input Files");
+  _input_files_button = new QPushButton("Add input files");
+  _input_files_button->show();
+  connect(_input_files_button, SIGNAL(clicked()), this, SLOT(choose_input_files()));
+  _remove_input_files_button = new QPushButton("Remove input files");
+  _remove_input_files_button->show();
+  _remove_input_files_button->setEnabled(false);
+  connect(_remove_input_files_button, SIGNAL(clicked()), this, SLOT(remove_input_files()));
+  _input_files_list = new QListWidget();
+  _input_files_list->setSelectionMode(QAbstractItemView::MultiSelection);
+  connect(_input_files_list, SIGNAL(itemSelectionChanged()), this, SLOT(input_itemSelectionChanged()));
+
+  QGridLayout * input_box = new QGridLayout;
+  input_box->addWidget(_input_files_button, 0, 0);
+  input_box->addWidget(_remove_input_files_button, 0, 1);
+  input_box->addWidget(_input_files_list, 1, 0, 1, -1);
+  input_group_box->setLayout(input_box);
+
+  // output_files
+  QGroupBox * output_group_box = new QGroupBox("Output Files");
+  _output_files_button = new QPushButton("Add output file");
+  _output_files_button->show();
+  connect(_output_files_button, SIGNAL(clicked()), this, SLOT(add_output_file()));
+  _remove_output_files_button = new QPushButton("Remove output files");
+  _remove_output_files_button->show();
+  _remove_output_files_button->setEnabled(false);
+  connect(_remove_output_files_button, SIGNAL(clicked()), this, SLOT(remove_output_files()));
+  _output_files_list = new QListWidget();
+  _output_files_list->setSelectionMode(QAbstractItemView::MultiSelection);
+  _output_files_list->setEditTriggers(QAbstractItemView::DoubleClicked);
+  connect(_output_files_list, SIGNAL(itemSelectionChanged()), this, SLOT(output_itemSelectionChanged()));
+
+  // Results Directory
+  QLabel * label_result_directory = new QLabel("Result directory: ");
+  QLineEdit * result_directory = new QLineEdit(this);
+  registerField("result_directory", result_directory);
+
+  QGridLayout * output_box = new QGridLayout;
+  output_box->addWidget(_output_files_button, 0, 0);
+  output_box->addWidget(_remove_output_files_button, 0, 1);
+  output_box->addWidget(_output_files_list, 1, 0, 1, -1);
+  output_box->addWidget(label_result_directory, 2, 0);
+  output_box->addWidget(result_directory, 2, 1, 1, -1);
+  output_group_box->setLayout(output_box);
+
+  QVBoxLayout * main_layout = new QVBoxLayout;
+  main_layout->addWidget(main_label);
+  main_layout->addWidget(input_group_box);
+  main_layout->addWidget(output_group_box);
+  setLayout(main_layout);
+
+  parent->setFilesList(_input_files_list, _output_files_list);
+};
+
+BL::FilesPage::~FilesPage()
+{}
+
+bool
+BL::FilesPage::validatePage()
+{
+  QString result_directory = field("result_directory").toString();
+  
+  for (int i = 0; i < _output_files_list->count(); ++i)
+  {
+    QListWidgetItem * item = _output_files_list->item(i);
+    if (item->text() == "TO EDIT!")
+    {
+      QMessageBox::warning(NULL, "Ouput Files Error", "Some output files are not defined !");
+      return false;
+    }
+  }
+
+  if (result_directory == "" and _output_files_list->count() != 0)
+  {
+    QMessageBox::warning(NULL, "Result Directory Error", "Please enter a result directory or remove output files");
+    return false;
+  }
+
+  if (result_directory != "" and _output_files_list->count() == 0)
+  {
+    QMessageBox::warning(NULL, "Result Error", "Please add output files or erase result directory");
+    return false;
+  }
+
+  return true;
+}
+
+void
+BL::FilesPage::choose_input_files()
+{
+  QStringList files = QFileDialog::getOpenFileNames(this,
+                                             tr("Add input files"), "",
+                                             tr("All Files (*)"));
+  for (int i = 0; i < files.size(); ++i) 
+  {
+    if (_input_files_list->findItems(files.at(i), Qt::MatchFixedString).size() == 0)
+      _input_files_list->addItem(files.at(i));
+  }
+}
+
+void 
+BL::FilesPage::remove_input_files()
+{
+  QList<QListWidgetItem *> list = _input_files_list->selectedItems();
+  for (int i = 0; i < list.size(); ++i)
+  {
+    int row = _input_files_list->row( list.at(i) );
+    delete _input_files_list->takeItem(row);
+  }
+}
+
+void 
+BL::FilesPage::input_itemSelectionChanged()
+{
+  if (_input_files_list->selectedItems().size() > 0)
+    _remove_input_files_button->setEnabled(true);
+  else
+    _remove_input_files_button->setEnabled(false);
+}
+
+void
+BL::FilesPage::add_output_file()
+{
+  QListWidgetItem * new_item = new QListWidgetItem("TO EDIT!");
+  new_item->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsUserCheckable|Qt::ItemIsEnabled);
+  _output_files_list->addItem(new_item);
+}
+
+void 
+BL::FilesPage::remove_output_files()
+{
+  QList<QListWidgetItem *> list = _output_files_list->selectedItems();
+  for (int i = 0; i < list.size(); ++i)
+  {
+    int row = _output_files_list->row( list.at(i) );
+    delete _output_files_list->takeItem(row);
+  }
+}
+
+void 
+BL::FilesPage::output_itemSelectionChanged()
+{
+  if (_output_files_list->selectedItems().size() > 0)
+    _remove_output_files_button->setEnabled(true);
+  else
+    _remove_output_files_button->setEnabled(false);
+}
+
+int 
+BL::FilesPage::nextId() const
+{
+  return BL::CreateJobWizard::Page_Machine;
+}
+
+BL::CreateJobWizard::ConclusionPage::ConclusionPage(QWidget * parent)
+: QWizardPage(parent)
+{
+  setTitle("Job definition is finished");
+  QCheckBox * check_box =  new QCheckBox("Start job after creation");
+  registerField("start_job", check_box);
+  QVBoxLayout * main_layout = new QVBoxLayout;
+  main_layout->addWidget(check_box);
+  setLayout(main_layout);
+};
+
+BL::CreateJobWizard::ConclusionPage::~ConclusionPage()
+{}
+
+bool
+BL::CreateJobWizard::ConclusionPage::validatePage()
+{
+  return true;
+}
+
+int 
+BL::CreateJobWizard::ConclusionPage::nextId() const
+{
+  return -1;
+}
+
+BL::MachinePage::MachinePage(BL::CreateJobWizard * parent, BL::SALOMEServices * salome_services)
+: QWizardPage(parent)
+{
+  _salome_services = salome_services;
+  setTitle("Select a Machine");
+
+  QLabel * main_label = new QLabel("In this step you select the machine of your job");
+  main_label->setWordWrap(true);
+
+  // input_Machine
+  QGroupBox * machine_group_box = new QGroupBox("Machine List");
+  _machine_list = new QListWidget();
+  _machine_list->setSelectionMode(QAbstractItemView::SingleSelection);
+  std::list<std::string> machine_list = _salome_services->getMachineList();
+  std::list<std::string>::iterator it;
+  for (it = machine_list.begin(); it != machine_list.end(); it++)
+  {
+    std::string machine = *it;
+    _machine_list->addItem(QString(machine.c_str()));
+  }
+  connect(_machine_list, SIGNAL(itemSelectionChanged()), this, SLOT(machine_itemSelectionChanged()));
+  QVBoxLayout * machine_list_layout = new QVBoxLayout();
+  machine_list_layout->addWidget(_machine_list);
+  machine_group_box->setLayout(machine_list_layout);
+
+  QLabel * machine_label = new QLabel("Machine selected: ");
+  _machine_choosed = new QLineEdit();
+  _machine_choosed->setText("");
+  _machine_choosed->setReadOnly(true);
+  registerField("machine_choosed", _machine_choosed);
+
+  QGridLayout * main_layout = new QGridLayout;
+  main_layout->addWidget(machine_group_box, 0, 0, 1, -1);
+  main_layout->addWidget(machine_label, 1, 0);
+  main_layout->addWidget(_machine_choosed, 1, 1);
+  setLayout(main_layout);
+};
+
+BL::MachinePage::~MachinePage()
+{}
+
+bool
+BL::MachinePage::validatePage()
+{
+  QString machine_choosed = field("machine_choosed").toString();
+  if (machine_choosed == "")
+  {
+    QMessageBox::warning(NULL, "Machine Error", "Please choose a machine");
+    return false;
+  }
+  return true;
+}
+
+void 
+BL::MachinePage::machine_itemSelectionChanged()
+{
+  _machine_choosed->setReadOnly(false);
+  QList<QListWidgetItem *> list = _machine_list->selectedItems();
+  QListWidgetItem * item = list.at(0);
+  _machine_choosed->setText(item->text());
+  _machine_choosed->setReadOnly(true);
+}
+
+int 
+BL::MachinePage::nextId() const
+{
+  return BL::CreateJobWizard::Page_Conclusion;
+}
diff --git a/src/genericgui/BL_CreateJobWizard.hxx b/src/genericgui/BL_CreateJobWizard.hxx
new file mode 100644 (file)
index 0000000..ede4b4b
--- /dev/null
@@ -0,0 +1,199 @@
+//  Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _BL_CREATEJOBWIZARD_HXX_
+#define _BL_CREATEJOBWIZARD_HXX_
+
+#include <QtGui>
+
+#include "BL_Traces.hxx"
+#include "BL_JobsManager_QT.hxx"
+#include "BL_SALOMEServices.hxx"
+
+#include <string>
+#include <list>
+
+namespace BL{
+
+  class JobsManager_QT;
+  class CreateJobWizard: virtual public QWizard
+  {
+    Q_OBJECT
+
+    public:
+      CreateJobWizard(BL::JobsManager_QT * jobs_manager, BL::SALOMEServices * salome_services);
+      virtual ~CreateJobWizard();
+
+      void setFilesList(QListWidget * input_files_list, QListWidget * output_files_list);
+
+    public slots:
+      void end(int result);
+
+    private:
+      //Page Name
+      QLineEdit * _nameLineEdit;
+      BL::JobsManager_QT * _jobs_manager;
+      QListWidget * _input_files_list;
+      QListWidget * _output_files_list;
+
+    public:
+      // Results
+      std::string job_name;
+      
+      std::string yacs_file;
+
+      std::string command;
+
+      std::string batch_directory;
+      std::string expected_during_time;
+      std::string expected_memory;
+      int nb_proc;
+
+      std::string result_directory;
+      std::list<std::string> input_files_list;
+      std::list<std::string> output_files_list;
+
+      std::string machine_choosed;
+
+      bool start_job;
+
+    public:
+      enum {Page_JobName, Page_YACSSchema, Page_BatchParameters, Page_Files, 
+       Page_Command_Main_Definitions, Page_Machine, Page_Conclusion};
+
+      class JobNamePage: virtual public QWizardPage
+      {
+       public:
+         JobNamePage(QWidget * parent, BL::JobsManager_QT * jobs_manager);
+         virtual ~JobNamePage();
+
+         virtual bool validatePage();
+         virtual int nextId() const ;
+
+       private:          
+         BL::JobsManager_QT * _jobs_manager;
+         QRadioButton * _yacs_schema_button;
+      };
+
+
+      class CommandMainPage: virtual public QWizardPage
+      {
+       public:
+         CommandMainPage(QWidget * parent);
+         virtual ~CommandMainPage();
+
+         virtual bool validatePage();
+         virtual int nextId() const ;
+      };
+
+      class ConclusionPage: virtual public QWizardPage
+      {
+       public:
+         ConclusionPage(QWidget * parent);
+         virtual ~ConclusionPage();
+
+         virtual bool validatePage();
+         virtual int nextId() const ;
+      };
+  };
+
+  class YACSSchemaPage: virtual public QWizardPage
+  {
+    Q_OBJECT
+
+    public:
+      YACSSchemaPage(QWidget * parent);
+      virtual ~YACSSchemaPage();
+
+      virtual bool validatePage();
+      virtual int nextId() const ;
+
+    public slots:
+      void choose_file();
+
+    private:
+      QPushButton * _yacs_file_button;
+      QLineEdit * _yacs_file_text;
+  };
+
+  class BatchParametersPage: virtual public QWizardPage
+  {
+    Q_OBJECT
+
+    public:
+      BatchParametersPage(QWidget * parent);
+      virtual ~BatchParametersPage();
+
+      virtual bool validatePage();
+      virtual int nextId() const;
+  };
+
+  class FilesPage: virtual public QWizardPage
+  {
+    Q_OBJECT
+
+    public:
+      FilesPage(BL::CreateJobWizard * parent);
+      virtual ~FilesPage();
+
+      virtual int nextId() const;
+      virtual bool validatePage();
+
+    public slots:
+      void choose_input_files();
+      void remove_input_files();
+      void input_itemSelectionChanged();
+
+      void add_output_file();
+      void remove_output_files();
+      void output_itemSelectionChanged();
+
+    private:
+      QPushButton * _input_files_button;
+      QPushButton * _remove_input_files_button;
+      QListWidget * _input_files_list;
+
+      QPushButton * _output_files_button;
+      QPushButton * _remove_output_files_button;
+      QListWidget * _output_files_list;
+  };
+
+  class MachinePage: virtual public QWizardPage
+  {
+    Q_OBJECT
+
+    public:
+      MachinePage(BL::CreateJobWizard * parent, BL::SALOMEServices * salome_services);
+      virtual ~MachinePage();
+
+      virtual int nextId() const;
+      virtual bool validatePage();
+
+    public slots:
+      void machine_itemSelectionChanged();
+
+    private:
+      QListWidget * _machine_list;
+      QLineEdit * _machine_choosed;
+      BL::SALOMEServices * _salome_services;
+  };
+}
+
+#endif
+
diff --git a/src/genericgui/BL_GenericGui.cxx b/src/genericgui/BL_GenericGui.cxx
new file mode 100644 (file)
index 0000000..49d37af
--- /dev/null
@@ -0,0 +1,313 @@
+//  Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "BL_GenericGui.hxx"
+
+BL::GenericGui::GenericGui(BL::MainWindows_Wrap * wrapper) : QObject(wrapper->getDockParent())
+{
+  DEBTRACE("Creating BL::GenericGui");
+  BL_ASSERT(wrapper);
+  _wrapper = wrapper;
+  _row_selected = -1;
+  _job_name_selected = "";
+
+  _dock_parent = _wrapper->getDockParent();
+  _tab_parent  = _wrapper->getTabParent();
+
+  _salome_services = new BL::SALOMEServices();
+  if (_salome_services->initNS() == false)
+    DEBMSG("WARNING !!!!! SALOME IS NOT REACHABLE !!!!");
+  _jobs_manager = new BL::JobsManager_QT(_dock_parent, _salome_services);
+  _model_manager = new BL::QModelManager(this, _jobs_manager);
+
+  _model = _model_manager->getModel();
+
+  // ---- Adding different GUI parts
+
+  /* Buttons */
+  _buttons = new BL::Buttons(_tab_parent);
+  _buttons->setCreateButtonSlot(this, SLOT(create_job()));
+  _buttons->setStartButtonSlot(this, SLOT(start_job()));
+  _buttons->setDeleteButtonSlot(this, SLOT(delete_job()));
+  _buttons->setRefreshButtonSlot(this, SLOT(refresh_job()));
+  _buttons->setGetResultsButtonSlot(this, SLOT(get_results_job()));
+
+  /* Jobs Table */
+  _jobs_table = new BL::JobsTable(_tab_parent);
+  _jobs_table->setModel(_model);
+
+  /* Job Tab */
+  _job_tab = new BL::JobTab(_tab_parent, _jobs_manager);
+  _job_tab->setModel(_model);
+
+  /* Tab Central Widget */
+  QWidget * central_widget = new QWidget(_tab_parent);
+
+  QSplitter * tab_central_widget = new QSplitter(Qt::Vertical, central_widget);
+  tab_central_widget->addWidget(_jobs_table);
+  tab_central_widget->addWidget(_job_tab);
+  tab_central_widget->setChildrenCollapsible(false);
+
+  QVBoxLayout * central_layout = new QVBoxLayout;
+  central_layout->addWidget(_buttons);
+  central_layout->addWidget(tab_central_widget);
+  central_widget->setLayout(central_layout);
+
+  _tab_parent->setCentralWidget(central_widget);
+  // Test tab
+  //QDockWidget * dw_main = new QDockWidget(_tab_parent);
+  //dw_main->setWidget(central_widget);
+  //_tab_parent->addDockWidget(Qt::LeftDockWidgetArea, dw_main);
+
+  /* Summary */
+  _dw_summary = new QDockWidget(_dock_parent);
+  _dw_summary->setWindowTitle("Summary");
+  _summary = new BL::Summary(_dock_parent, _jobs_manager);
+  _summary->setModel(_model);
+  _dw_summary->setWidget(_summary);
+
+  /* MachineCatalog */
+  _dw_machine_catalog = new QDockWidget(_dock_parent);
+  _dw_machine_catalog->setWindowTitle("Machine Catalog");
+  _machine_catalog = new BL::MachineCatalog(_dock_parent, _salome_services);
+  _dw_machine_catalog->setWidget(_machine_catalog);
+
+  /* Main Dock Window */
+  _dock_parent->addDockWidget(Qt::RightDockWidgetArea, _jobs_manager);
+  _dock_parent->addDockWidget(Qt::RightDockWidgetArea, _dw_summary);
+  _dock_parent->addDockWidget(Qt::RightDockWidgetArea, _dw_machine_catalog);
+  _dock_parent->splitDockWidget(_jobs_manager, _dw_summary, Qt::Vertical);
+  _dock_parent->tabifyDockWidget(_dw_summary, _dw_machine_catalog);
+
+  /* Signals and Slots */
+
+  // JobsManager -> Model
+  connect(_jobs_manager, SIGNAL(new_job_added(QString)), _model_manager, SLOT(new_job_added(QString)));
+  connect(_jobs_manager, SIGNAL(job_state_changed(QString)), _model_manager, SLOT(job_state_changed(QString)));
+  connect(_jobs_manager, SIGNAL(job_state_changed(QString)), this, SLOT(job_state_changed(QString)));
+
+  // Model -> X
+  connect(_model, SIGNAL(rowsInserted(QModelIndex, int, int)), _summary, SLOT(rowsInserted(QModelIndex, int, int)));
+  connect(_model, SIGNAL(rowsRemoved(QModelIndex, int, int)), _summary, SLOT(rowsRemoved(QModelIndex, int, int)));
+  connect(_model, SIGNAL(itemChanged(QStandardItem*)), _summary, SLOT(itemChanged(QStandardItem*)));
+  connect(_model, SIGNAL(itemChanged(QStandardItem*)), _job_tab, SLOT(itemChanged(QStandardItem*)));
+
+  // TableView -> X
+  connect(_jobs_table, SIGNAL(clicked(QModelIndex)), _job_tab, SLOT(job_selected(QModelIndex)));
+  connect(_jobs_table, SIGNAL(clicked(QModelIndex)), this, SLOT(job_selected(QModelIndex)));
+  connect(_jobs_table, SIGNAL(clicked(QModelIndex)), _model_manager, SLOT(job_selected(QModelIndex)));
+
+  // Delete Job -> X
+  connect(this, SIGNAL(job_deleted(QString)), _job_tab, SLOT(reset(QString)));
+}
+
+BL::GenericGui::~GenericGui()
+{
+  DEBTRACE("Destroying BL::GenericGui");
+
+  delete _salome_services;
+}
+
+void 
+BL::GenericGui::showDockWidgets(bool isVisible)
+{
+  DEBTRACE("BL::GenericGui::showDockWidgets " << isVisible);
+  if (_jobs_manager) _jobs_manager->setVisible(isVisible);
+  if (_dw_summary) _dw_summary->setVisible(isVisible);
+  if (_dw_machine_catalog) _dw_machine_catalog->setVisible(isVisible);
+}
+
+void
+BL::GenericGui::createActions()
+{
+  DEBTRACE("CreateActions BL::GenericGui");
+  _create_job_action = _wrapper->createAction("Create Job", QIcon(), "Create Job", "Create Job", 0, _dock_parent, false, this, SLOT(create_job()));
+  _start_job_action = _wrapper->createAction("Start Job", QIcon(), "Start Job", "Start Job", 0, _dock_parent, false, this, SLOT(start_job()));
+  _delete_job_action = _wrapper->createAction("Delete Job", QIcon(), "Delete Job", "Delete Job", 0, _dock_parent, false, this, SLOT(delete_job()));
+  _refresh_job_action = _wrapper->createAction("Refresh Job", QIcon(), "Refresh Job", "Refresh Job", 0, _dock_parent, false, this, SLOT(refresh_job()));
+  _get_results_job_action = _wrapper->createAction("Get Job Results", QIcon(), "Get Job Results", "Get Job Results", 0, _dock_parent, false, this, SLOT(refresh_job()));
+}
+
+void
+BL::GenericGui::createMenus()
+{
+  DEBTRACE("CreateMenus BL::GenericGui");
+  int menu_id = _wrapper->createTopMenu("JobManager");
+  _wrapper->addActionToMenu(_create_job_action, menu_id);
+  _wrapper->addActionToMenu(_start_job_action, menu_id);
+  _wrapper->addActionToMenu(_delete_job_action, menu_id);
+  _wrapper->addActionToMenu(_get_results_job_action, menu_id);
+  _wrapper->addActionToMenu(_refresh_job_action, menu_id);
+}
+
+void
+BL::GenericGui::create_job()
+{
+  DEBTRACE("Create Job Slot BL::GenericGui");
+  _jobs_manager->create_job_wizard();
+}
+
+void
+BL::GenericGui::start_job()
+{
+  DEBTRACE("Start Job Slot BL::GenericGui");
+  _jobs_manager->start_job(_job_name_selected.toStdString());
+  updateButtonsStates();
+}
+
+void
+BL::GenericGui::refresh_job()
+{
+  DEBTRACE("Refresh Job Slot BL::GenericGui");
+  _jobs_manager->refresh_jobs();
+}
+
+void
+BL::GenericGui::get_results_job()
+{
+  DEBTRACE("Get Results Job Slot BL::GenericGui");
+  _jobs_manager->get_results_job(_job_name_selected.toStdString());
+}
+
+void
+BL::GenericGui::delete_job()
+{
+  DEBTRACE("Delete Job Slot BL::GenericGui");
+  int ret = QMessageBox::warning(NULL, "Delete a job", "Do you really want to delete this job ?",
+                                QMessageBox::Ok|QMessageBox::Cancel,
+                                QMessageBox::Ok);
+  if (ret == QMessageBox::Ok)
+  {
+    _jobs_manager->delete_job(_job_name_selected);
+    _model_manager->deleteJob(_row_selected);
+    emit job_deleted(_job_name_selected);
+    _row_selected = -1;
+    _job_name_selected = "";
+    updateButtonsStates();
+  }
+}
+
+void
+BL::GenericGui::job_selected(const QModelIndex & index)
+{
+  DEBTRACE("BL::GenericGui::job_selected slot");
+  QStandardItem * item = _model->itemFromIndex(index);
+  QStandardItem * item_name = _model->item(item->row());
+  _row_selected = item->row();
+  _job_name_selected = item_name->text();
+  updateButtonsStates();
+}
+
+void 
+BL::GenericGui::job_state_changed(const QString & name)
+{
+  if (name == _job_name_selected)
+    updateButtonsStates();
+}
+void
+BL::GenericGui::updateButtonsStates()
+{
+  DEBTRACE("BL::GenericGui::updateButtonsStates slot");
+
+  // First case: no job selected
+  if (_job_name_selected == "" and _row_selected == -1)
+  {
+    _start_job_action->setEnabled(false);
+    _delete_job_action->setEnabled(false);
+    _get_results_job_action->setEnabled(false);
+    _buttons->disable_start_button();
+    _buttons->disable_delete_button();
+    _buttons->disable_get_results_button();
+  }
+  else if (_job_name_selected != "" and _row_selected != -1)
+  {
+    BL::Job * job = _jobs_manager->getJob(_job_name_selected.toStdString());
+    BL::Job::State job_state = job->getState();
+
+    switch (job_state)
+    {
+      case BL::Job::CREATED:
+       _start_job_action->setEnabled(true);
+       _delete_job_action->setEnabled(true);
+       _get_results_job_action->setEnabled(false);
+       _buttons->enable_start_button();
+       _buttons->enable_delete_button();
+       _buttons->disable_get_results_button();
+       break;
+
+      case BL::Job::IN_PROCESS:
+       _start_job_action->setEnabled(false);
+       _buttons->disable_start_button();
+       _delete_job_action->setEnabled(false);
+       _buttons->disable_delete_button();
+       _get_results_job_action->setEnabled(false);
+       _buttons->disable_get_results_button();
+       break;
+
+      case BL::Job::QUEUED:
+       _start_job_action->setEnabled(false);
+       _buttons->disable_start_button();
+       _delete_job_action->setEnabled(true);
+       _buttons->enable_delete_button();
+       _get_results_job_action->setEnabled(false);
+       _buttons->disable_get_results_button();
+       break;
+
+      case BL::Job::RUNNING:
+       _start_job_action->setEnabled(false);
+       _buttons->disable_start_button();
+       _delete_job_action->setEnabled(true);
+       _buttons->enable_delete_button();
+       _get_results_job_action->setEnabled(false);
+       _buttons->disable_get_results_button();
+       break;
+
+      case BL::Job::PAUSED:
+       _start_job_action->setEnabled(false);
+       _buttons->disable_start_button();
+       _delete_job_action->setEnabled(true);
+       _buttons->enable_delete_button();
+       _get_results_job_action->setEnabled(false);
+       _buttons->disable_get_results_button();
+       break;
+
+      case BL::Job::ERROR:
+       _start_job_action->setEnabled(false);
+       _buttons->disable_start_button();
+       _delete_job_action->setEnabled(true);
+       _buttons->enable_delete_button();
+       _get_results_job_action->setEnabled(false);
+       _buttons->disable_get_results_button();
+       break;
+
+      case BL::Job::FINISHED:
+       _start_job_action->setEnabled(false);
+       _buttons->disable_start_button();
+       _delete_job_action->setEnabled(true);
+       _buttons->enable_delete_button();
+       _get_results_job_action->setEnabled(true);
+       _buttons->enable_get_results_button();
+       break;
+    }
+  }
+  else
+  {
+    DEBTRACE("ERROR in updateButtonsStates !!!!!!");
+  }
+}
diff --git a/src/genericgui/BL_GenericGui.hxx b/src/genericgui/BL_GenericGui.hxx
new file mode 100644 (file)
index 0000000..161a24e
--- /dev/null
@@ -0,0 +1,98 @@
+//  Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _BL_GENERICGUI_HXX_
+#define _BL_GENERICGUI_HXX_
+
+#include <QtGui>
+
+#include "BL_Traces.hxx"
+
+#include "BL_SALOMEServices.hxx"
+
+#include "BL_MainWindows_Wrap.hxx"
+
+#include "BL_QModelManager.hxx"
+#include "BL_JobsManager_QT.hxx"
+#include "BL_JobsTable.hxx"
+#include "BL_JobTab.hxx"
+#include "BL_Buttons.hxx"
+#include "BL_Summary.hxx"
+#include "BL_MachineCatalog.hxx"
+
+namespace BL 
+{
+  class GenericGui: public QObject
+  {
+    Q_OBJECT
+
+    public:
+      GenericGui(BL::MainWindows_Wrap * wrapper);
+      virtual ~GenericGui();
+
+      void showDockWidgets(bool isVisible);
+      void createActions();
+      void createMenus();
+
+    public slots:
+      void create_job();
+      void start_job();
+      void delete_job();
+      void refresh_job();
+      void get_results_job();
+      void job_selected(const QModelIndex & index);
+      void job_state_changed(const QString & name);
+      void updateButtonsStates();
+
+    signals:
+      void job_deleted(QString job_name);
+
+    protected:
+     
+      BL::MainWindows_Wrap * _wrapper;
+
+      BL::SALOMEServices * _salome_services;
+
+      QMainWindow * _dock_parent;
+      QMainWindow * _tab_parent;
+      QDockWidget * _dw_summary;
+      QDockWidget * _dw_machine_catalog;
+     
+      BL::Buttons * _buttons;
+      BL::JobsTable * _jobs_table;  
+      BL::JobTab * _job_tab;
+      BL::Summary * _summary;
+
+      QAction * _create_job_action;
+      QAction * _start_job_action;
+      QAction * _delete_job_action;
+      QAction * _get_results_job_action;
+      QAction * _refresh_job_action;
+
+      BL::JobsManager_QT * _jobs_manager;
+      BL::QModelManager * _model_manager;
+      QStandardItemModel * _model;
+      BL::MachineCatalog * _machine_catalog;
+
+      int _row_selected;
+      QString _job_name_selected;
+  };
+}
+
+#endif
diff --git a/src/genericgui/BL_JobTab.cxx b/src/genericgui/BL_JobTab.cxx
new file mode 100644 (file)
index 0000000..5f139cc
--- /dev/null
@@ -0,0 +1,259 @@
+//  Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "BL_JobTab.hxx"
+#include "BL_Traces.hxx"
+
+BL::JobTab::JobTab(QWidget *parent, BL::JobsManager_QT * jobs_manager) : QTabWidget(parent)
+{
+  DEBTRACE("Creating BL::JobTab");
+  BL_ASSERT(parent);
+  BL_ASSERT(jobs_manager);
+  _parent = parent;
+  _jobs_manager = jobs_manager;
+  _model = NULL;
+
+  createJobSummaryTab();
+  createJobFilesTab();
+
+  addTab(_summary_tab, "Job Summary");
+  addTab(_files_tab, "Job Files");
+}
+
+BL::JobTab::~JobTab()
+{
+  DEBTRACE("Destroying BL::JobTab");
+}
+
+void
+BL::JobTab::setModel(QStandardItemModel * model)
+{
+  DEBTRACE("Call setModel BL::JobTab");
+  BL_ASSERT(model);
+
+  _model = model;
+}
+
+void
+BL::JobTab::createJobSummaryTab()
+{
+  _summary_tab = new QWidget(this);
+
+  QLabel * job_name_label = new QLabel("Name:");
+  _job_name_label_value = new QLabel("");
+  QLabel * job_type_label = new QLabel("Type:");
+  _job_type_label_value = new QLabel("");
+  QLabel * job_state_label = new QLabel("State:");
+  _job_state_label_value = new QLabel("");
+  QLabel * job_machine_label = new QLabel("Machine:");
+  _job_machine_label_value = new QLabel("");
+  _job_command_label = new QLabel("Schema or Command:");
+  _job_command_label_value = new QLabel("");
+
+  QGroupBox * main_values_box = new QGroupBox("Main values");
+  QFormLayout * values_form = new QFormLayout;
+  values_form->insertRow(0, job_name_label, _job_name_label_value);
+  values_form->insertRow(1, job_type_label, _job_type_label_value);
+  values_form->insertRow(2, job_state_label, _job_state_label_value);
+  values_form->insertRow(3, job_machine_label, _job_machine_label_value);
+  values_form->insertRow(4, _job_command_label, _job_command_label_value);
+  main_values_box->setLayout(values_form);
+
+  QLabel * job_nif_label = new QLabel("Number of Input Files:");
+  _job_nif_label_value = new QLabel("");
+  QLabel * job_nof_label = new QLabel("Number of Output Files:");
+  _job_nof_label_value = new QLabel("");
+  QLabel * job_bd_label = new QLabel("Execution directory:");
+  _job_bd_label_value = new QLabel("");
+  QLabel * job_rd_label = new QLabel("Result directory:");
+  _job_rd_label_value = new QLabel("");
+
+  QLabel * job_edt_label = new QLabel("Expected during time:");
+  _job_edt_label_value = new QLabel("");
+  QLabel * job_em_label = new QLabel("Expected memory:");
+  _job_em_label_value = new QLabel("");
+  QLabel * job_nop_label = new QLabel("Number of processors:");
+  _job_nop_label_value = new QLabel("");
+
+  QGroupBox * run_values_box = new QGroupBox("Run values");
+  QFormLayout * run_values_form = new QFormLayout;
+  run_values_form->insertRow(0, job_nif_label, _job_nif_label_value);
+  run_values_form->insertRow(1, job_nof_label, _job_nof_label_value);
+  run_values_form->insertRow(2, job_bd_label, _job_bd_label_value);
+  run_values_form->insertRow(3, job_rd_label, _job_rd_label_value);
+  QFormLayout * other_run_values_form = new QFormLayout;
+  other_run_values_form->insertRow(0, job_edt_label, _job_edt_label_value);
+  other_run_values_form->insertRow(1, job_em_label, _job_em_label_value);
+  other_run_values_form->insertRow(2, job_nop_label, _job_nop_label_value);
+  QHBoxLayout * box_layout = new QHBoxLayout();
+  box_layout->addLayout(run_values_form);
+  box_layout->addLayout(other_run_values_form);
+  run_values_box->setLayout(box_layout);
+
+  QVBoxLayout * mainLayout = new QVBoxLayout();
+  mainLayout->addWidget(main_values_box);
+  mainLayout->addWidget(run_values_box);
+  _summary_tab->setLayout(mainLayout);
+}
+
+void
+BL::JobTab::createJobFilesTab()
+{
+  _files_tab = new QWidget(this);
+  
+  _input_files_list = new QListWidget(this);
+  _input_files_list->setSelectionMode(QAbstractItemView::NoSelection);
+  QGroupBox * input_files_box = new QGroupBox("Input Files");
+  QVBoxLayout * input_layout = new QVBoxLayout();
+  input_layout->addWidget(_input_files_list);
+  input_files_box->setLayout(input_layout);
+
+  _output_files_list = new QListWidget(this);
+  _output_files_list->setSelectionMode(QAbstractItemView::NoSelection);
+  QGroupBox * output_files_box = new QGroupBox("Output Files");
+  QVBoxLayout * output_layout = new QVBoxLayout();
+  output_layout->addWidget(_output_files_list);
+  output_files_box->setLayout(output_layout);
+
+  QVBoxLayout * mainLayout = new QVBoxLayout();
+  mainLayout->addWidget(input_files_box);
+  mainLayout->addWidget(output_files_box);
+  _files_tab->setLayout(mainLayout);
+}
+
+void
+BL::JobTab::job_selected(const QModelIndex & index)
+{
+  DEBTRACE("BL::JobTab::job_selected slot");
+  QStandardItem * item = _model->itemFromIndex(index);
+  QStandardItem * item_name = _model->item(item->row());
+  if (item)
+  {
+    BL::Job * job = _jobs_manager->getJob(item_name->text().toStdString());
+
+    _job_name_label_value->setText(QString(job->getName().c_str()));
+
+    if (job->getState() == BL::Job::CREATED)
+      _job_state_label_value->setText("Created");
+    else if (job->getState() == BL::Job::IN_PROCESS)
+      _job_state_label_value->setText("In Process");
+    else if (job->getState() == BL::Job::QUEUED)
+      _job_state_label_value->setText("Queued");
+    else if (job->getState() == BL::Job::RUNNING)
+      _job_state_label_value->setText("Running");
+    else if (job->getState() == BL::Job::PAUSED)
+      _job_state_label_value->setText("Paused");
+    else if (job->getState() == BL::Job::ERROR)
+      _job_state_label_value->setText("Error");
+    else 
+      _job_state_label_value->setText("Finished");
+
+    if (job->getType() == BL::Job::YACS_SCHEMA)
+    {
+      _job_command_label->setText("Schema:");
+      _job_command_label_value->setText(QString(job->getYACSFile().c_str()));
+      _job_type_label_value->setText("YACS_Schema");
+    }
+    else
+    {
+      _job_command_label->setText("Command:");
+      _job_command_label_value->setText(QString(job->getCommand().c_str()));
+      _job_type_label_value->setText("Command");
+    }
+
+    _job_machine_label_value->setText(QString(job->getMachine().c_str()));
+
+    BL::Job::BatchParam batch_params = job->getBatchParameters();
+
+    BL::Job::FilesParam files_params = job->getFilesParameters();
+    int nif = files_params.input_files_list.size();
+    _job_nif_label_value->setText(QVariant(nif).toString());
+    int nof = files_params.output_files_list.size();
+    _job_nof_label_value->setText(QVariant(nof).toString());
+    _job_bd_label_value->setText(QString(batch_params.batch_directory.c_str()));
+    _job_rd_label_value->setText(QString(files_params.result_directory.c_str()));
+
+    _job_edt_label_value->setText(QString(batch_params.expected_during_time.c_str()));
+    _job_em_label_value->setText(QString(batch_params.expected_memory.c_str()));
+    _job_nop_label_value->setText(QVariant(batch_params.nb_proc).toString());
+
+    std::list<std::string>::iterator it;
+    for (it = files_params.input_files_list.begin(); it != files_params.input_files_list.end(); it++)
+    {
+      std::string file = *it;
+      _input_files_list->addItem(QString(file.c_str()));
+    }
+    for (it = files_params.output_files_list.begin(); it != files_params.output_files_list.end(); it++)
+    {
+      std::string file = *it;
+      _output_files_list->addItem(QString(file.c_str()));
+    }
+
+  }
+  else
+    DEBTRACE ("itemFromIndex returns 0 !");
+}
+
+void 
+BL::JobTab::itemChanged(QStandardItem * item)
+{
+  DEBTRACE("BL::JobTab::itemChanged slot");
+
+  QStandardItem * item_name = _model->item(item->row());
+  BL::Job * job = _jobs_manager->getJob(item_name->text().toStdString());
+
+  if (_job_name_label_value->text() == QString(job->getName().c_str()))
+  {
+    if (job->getState() == BL::Job::CREATED)
+      _job_state_label_value->setText("Created");
+    else if (job->getState() == BL::Job::IN_PROCESS)
+      _job_state_label_value->setText("In Process");
+    else if (job->getState() == BL::Job::QUEUED)
+      _job_state_label_value->setText("Queued");
+    else if (job->getState() == BL::Job::RUNNING)
+      _job_state_label_value->setText("Running");
+    else if (job->getState() == BL::Job::PAUSED)
+      _job_state_label_value->setText("Paused");
+    else if (job->getState() == BL::Job::ERROR)
+      _job_state_label_value->setText("Error");
+    else 
+      _job_state_label_value->setText("Finished");
+  }
+}
+
+void
+BL::JobTab::reset(QString job_name)
+{
+  _job_name_label_value->setText("");
+  _job_type_label_value->setText("");
+  _job_state_label_value->setText("");
+  _job_machine_label_value->setText("");
+  _job_nif_label_value->setText("");
+  _job_nof_label_value->setText("");
+  _job_bd_label_value->setText("");
+  _job_rd_label_value->setText("");
+  _job_edt_label_value->setText("");
+  _job_em_label_value->setText("");
+  _job_nop_label_value->setText("");
+  _job_command_label->setText("Schema or Command:");
+  _job_command_label_value->setText("");
+
+  _input_files_list->clear();
+  _output_files_list->clear();
+}
diff --git a/src/genericgui/BL_JobTab.hxx b/src/genericgui/BL_JobTab.hxx
new file mode 100644 (file)
index 0000000..2f68cc0
--- /dev/null
@@ -0,0 +1,78 @@
+//  Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _BL_JOBTAB_HXX_
+#define _BL_JOBTAB_HXX_
+
+#include <QtGui>
+
+#include "BL_JobsManager_QT.hxx"
+
+namespace BL 
+{
+  class JobTab: public QTabWidget
+  {
+    Q_OBJECT
+
+    public:
+      JobTab(QWidget *parent, BL::JobsManager_QT * jobs_manager);
+      virtual ~JobTab();
+
+      void setModel(QStandardItemModel * model);
+
+      void createJobSummaryTab();
+      void createJobFilesTab();
+
+    public slots:
+      void job_selected(const QModelIndex & index);
+      void itemChanged(QStandardItem * item);
+      void reset(QString job_name);
+
+    protected:
+      QWidget* _parent;
+      QStandardItemModel * _model;
+      BL::JobsManager_QT * _jobs_manager;
+
+      QWidget * _summary_tab;
+      // Main Values
+      QLabel * _job_name_label_value;
+      QLabel * _job_type_label_value;
+      QLabel * _job_state_label_value;
+      QLabel * _job_machine_label_value;
+      QLabel * _job_command_label;
+      QLabel * _job_command_label_value;
+
+      // Run Values
+      QLabel * _job_nif_label_value;
+      QLabel * _job_nof_label_value;
+      QLabel * _job_bd_label_value;
+      QLabel * _job_rd_label_value;
+      QLabel * _job_edt_label_value;
+      QLabel * _job_em_label_value;
+      QLabel * _job_nop_label_value;
+
+      QWidget * _files_tab;
+
+      QListWidget * _input_files_list;
+      QListWidget * _output_files_list;
+  };
+}
+
+#endif
+
diff --git a/src/genericgui/BL_JobsManager_QT.cxx b/src/genericgui/BL_JobsManager_QT.cxx
new file mode 100644 (file)
index 0000000..04cc1b5
--- /dev/null
@@ -0,0 +1,330 @@
+//  Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "BL_JobsManager_QT.hxx"
+
+BL::JobManagerEvent::JobManagerEvent(const std::string & action_i, 
+                                    const std::string & event_name_i, 
+                                    const std::string & job_name_i, 
+                                    const std::string & data_i) : QEvent(QEvent::User)
+{
+  action = action_i;
+  event_name = event_name_i;
+  job_name = job_name_i;
+  data = data_i;
+}
+
+BL::JobManagerEvent::~JobManagerEvent() {}  
+
+BL::JobsManager_QT::JobsManager_QT(QWidget * parent, BL::SALOMEServices * salome_services) : 
+  QDockWidget(parent), BL::JobsManager(salome_services)
+{
+  DEBTRACE("Creating BL::JobsManager_QT");
+  setObserver(this);
+
+  // Widget Part
+
+  QWidget * main_widget = new QWidget(this);
+
+  _load_jobs = new QPushButton("Load Jobs");
+  _save_jobs = new QPushButton("Save Jobs");
+  _auto_refresh_jobs = new QPushButton("Auto Refresh: no");
+  _timer = new QTimer(this);
+  _timer->stop();
+  connect(_timer, SIGNAL(timeout()), this, SLOT(RefreshJobs()));
+
+  // Menu for auto refresh
+  QMenu * refresh_menu = new QMenu(this);
+  refresh_menu->addAction("No", this, SLOT(no_auto_refresh()));
+  refresh_menu->addAction("10 seconds", this, SLOT(ten_seconds_refresh()));
+  refresh_menu->addAction("30 seconds", this, SLOT(thirty_seconds_refresh()));
+  refresh_menu->addAction("1 minute", this, SLOT(one_minute_refresh()));
+  refresh_menu->addAction("5 minutes", this, SLOT(five_minutes_refresh()));
+  refresh_menu->addAction("30 minutes", this, SLOT(thirty_minutes_refresh()));
+  refresh_menu->addAction("1 hour", this, SLOT(one_hour_refresh()));
+  _auto_refresh_jobs->setMenu(refresh_menu);
+
+  QHBoxLayout * button_layout = new QHBoxLayout();
+  button_layout->addWidget(_load_jobs);
+  button_layout->addWidget(_save_jobs);
+  button_layout->addWidget(_auto_refresh_jobs);
+
+  QGroupBox * message_box = new QGroupBox("Messages");
+  _log = new QTextEdit(this);
+  _log->setReadOnly(true);
+  QVBoxLayout * message_box_layout = new QVBoxLayout(message_box);
+  message_box_layout->addWidget(_log);
+  message_box->setLayout(message_box_layout);
+
+  QVBoxLayout * mainLayout = new QVBoxLayout();
+  mainLayout->addLayout(button_layout);
+  mainLayout->addWidget(message_box);
+  main_widget->setLayout(mainLayout);
+
+  setWidget(main_widget);
+  setWindowTitle("Job Manager");
+}
+
+BL::JobsManager_QT::~JobsManager_QT()
+{
+  DEBTRACE("Destroying BL::JobsManager_QT");
+}
+
+void
+BL::JobsManager_QT::RefreshJobs()
+{
+  refresh_jobs(); 
+}
+
+void
+BL::JobsManager_QT::no_auto_refresh()
+{
+  _auto_refresh_jobs->setText("Auto Refresh: no");
+  _timer->stop();
+}
+
+void
+BL::JobsManager_QT::ten_seconds_refresh()
+{
+  _auto_refresh_jobs->setText("Auto Refresh: 10s");
+  _timer->stop();
+  _timer->start(10 * 1000);
+}
+
+void 
+BL::JobsManager_QT::thirty_seconds_refresh()
+{
+  _auto_refresh_jobs->setText("Auto Refresh: 30s");
+  _timer->stop();
+  _timer->start(30 * 1000);
+}
+
+void 
+BL::JobsManager_QT::one_minute_refresh()
+{
+  _auto_refresh_jobs->setText("Auto Refresh: 1min");
+  _timer->stop();
+  _timer->start(1 * 60 * 1000);
+}
+
+void 
+BL::JobsManager_QT::five_minutes_refresh()
+{
+  _auto_refresh_jobs->setText("Auto Refresh: 5min");
+  _timer->stop();
+  _timer->start(5 * 60 * 1000);
+}
+
+void 
+BL::JobsManager_QT::thirty_minutes_refresh()
+{
+  _auto_refresh_jobs->setText("Auto Refresh: 30min");
+  _timer->stop();
+  _timer->start(30 * 60 * 1000);
+}
+
+void 
+BL::JobsManager_QT::one_hour_refresh()
+{
+  _auto_refresh_jobs->setText("Auto Refresh: 1hour");
+  _timer->stop();
+  _timer->start(1 * 60 * 60 * 1000);
+}
+
+void
+BL::JobsManager_QT::create_job_wizard()
+{
+    BL::CreateJobWizard wizard(this, _salome_services);
+    wizard.exec();
+
+    if (wizard.job_name != "")
+    {
+      BL::Job * new_job = addNewJob(wizard.job_name);
+      if (wizard.yacs_file != "")
+      {
+       // YACS schema job
+       new_job->setType(BL::Job::YACS_SCHEMA);
+       new_job->setYACSFile(wizard.yacs_file);
+       BL::Job::BatchParam param;
+       param.batch_directory = wizard.batch_directory;
+       param.expected_during_time = wizard.expected_during_time;
+       param.expected_memory = wizard.expected_memory;
+       param.nb_proc = wizard.nb_proc;
+       new_job->setBatchParameters(param);
+       BL::Job::FilesParam files_params;
+       files_params.result_directory = wizard.result_directory;
+       files_params.input_files_list = wizard.input_files_list;
+       files_params.output_files_list = wizard.output_files_list;
+       new_job->setFilesParameters(files_params);
+       new_job->setMachine(wizard.machine_choosed);
+      }
+      else
+      {
+       // Command Job
+       new_job->setType(BL::Job::COMMAND);
+       new_job->setCommand(wizard.command);
+       BL::Job::BatchParam param;
+       param.batch_directory = wizard.batch_directory;
+       param.expected_during_time = wizard.expected_during_time;
+       param.expected_memory = wizard.expected_memory;
+       param.nb_proc = wizard.nb_proc;
+       new_job->setBatchParameters(param);
+       BL::Job::FilesParam files_params;
+       files_params.result_directory = wizard.result_directory;
+       files_params.input_files_list = wizard.input_files_list;
+       files_params.output_files_list = wizard.output_files_list;
+       new_job->setFilesParameters(files_params);
+       new_job->setMachine(wizard.machine_choosed);
+      }
+      emit new_job_added(QString::fromStdString(wizard.job_name));
+      if (wizard.start_job)
+       start_job(wizard.job_name);
+    }
+    else
+    {
+       DEBTRACE("User cancel Create Job Wizard");
+    }
+}
+
+void
+BL::JobsManager_QT::delete_job(QString job_name)
+{
+  BL::JobsManager::removeJob(job_name.toStdString());
+}
+
+void 
+BL::JobsManager_QT::sendEvent(const std::string & action, 
+                             const std::string & event_name, 
+                             const std::string & job_name, 
+                             const std::string & data)
+{
+  DEBTRACE("sendEvent BL::JobsManager_QT");
+
+  // Sending a QEvent to go back to main thread
+  BL::JobManagerEvent * event = new JobManagerEvent(action, event_name, job_name, data);
+  QApplication::postEvent(this, event);
+}
+
+bool 
+BL::JobsManager_QT::event(QEvent * e)
+{
+  QDockWidget::event(e);
+  JobManagerEvent * event = dynamic_cast<JobManagerEvent*>(e);
+  if (!event) return false;
+
+  DEBTRACE("BL::JobsManager_QT Receiving event : " 
+          << event->action << " " 
+          << event->event_name << " "
+          << event->job_name << " "
+          << event->data);
+  if (event->action == "start_job")
+  {
+    if (event->event_name == "Ok")
+    {
+      QString str((event->job_name).c_str());
+      write_normal_text("Job " + str + " queued\n");
+    }
+    else
+    {
+      QString str((event->job_name).c_str());
+      write_error_text("Error in starting job: " + str + "\n");
+      write_error_text("*** ");
+      write_error_text((event->data).c_str());
+      write_error_text(" ***\n");
+    }
+    emit job_state_changed(QString((event->job_name).c_str()));
+  }
+  else if (event->action == "refresh_job")
+  {
+    if (event->event_name == "Ok")
+    {
+      QString str((event->job_name).c_str());
+      write_normal_text("Job " + str + " state changed\n");
+      emit job_state_changed(QString((event->job_name).c_str()));
+    }
+    else
+    {
+      QString str((event->job_name).c_str());
+      write_error_text("Error in refreshing job: " + str + "\n");
+      write_error_text("*** ");
+      write_error_text((event->data).c_str());
+      write_error_text(" ***\n");
+    }
+  }
+  else if (event->action == "delete_job")
+  {
+    if (event->event_name == "Ok")
+    {
+      QString str((event->job_name).c_str());
+      write_normal_text("Job " + str + " deleted\n");
+    }
+    else
+    {
+      QString str((event->job_name).c_str());
+      write_error_text("Warning delete job: " + str + " maybe not complete, exception catch in SALOME Launcher service\n");
+      write_error_text("*** ");
+      write_error_text((event->data).c_str());
+      write_error_text(" ***\n");
+    }
+  }
+  else if (event->action == "get_results_job")
+  {
+    if (event->event_name == "Ok")
+    {
+      QString str((event->job_name).c_str());
+      write_normal_text("Results of Job " + str + " are get\n");
+    }
+    else
+    {
+      QString str((event->job_name).c_str());
+      write_error_text("Warning for results of job: " + str + " maybe not complete, exception catch in SALOME Launcher service\n");
+      write_error_text("*** ");
+      write_error_text((event->data).c_str());
+      write_error_text(" ***\n");
+    }
+  }
+  else
+  {
+    QString str((event->action).c_str());
+    write_error_text("Unknown type of event received:" + str + "\n");
+  }
+  return true;
+}
+
+void 
+BL::JobsManager_QT::write_normal_text(const QString & text)
+{
+  _log->setReadOnly(false);
+  QTextCursor cursor = _log->textCursor();
+  QTextCharFormat text_format;
+  text_format.setForeground(Qt::darkBlue);
+  cursor.insertText(text, text_format);
+  _log->setTextCursor(cursor);
+  _log->setReadOnly(true);
+}
+
+void 
+BL::JobsManager_QT::write_error_text(const QString & text)
+{
+  QTextCursor cursor = _log->textCursor();
+  QTextCharFormat text_format;
+  text_format.setForeground(Qt::red);
+  cursor.insertText(text, text_format);
+  _log->setTextCursor(cursor);
+}
diff --git a/src/genericgui/BL_JobsManager_QT.hxx b/src/genericgui/BL_JobsManager_QT.hxx
new file mode 100644 (file)
index 0000000..b1b0980
--- /dev/null
@@ -0,0 +1,97 @@
+//  Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _BL_JOBSMANAGER_QT_HXX_
+#define _BL_JOBSMANAGER_QT_HXX_
+
+#include <QObject>
+
+#include "BL_Traces.hxx"
+#include "BL_JobsManager.hxx"
+#include "BL_CreateJobWizard.hxx"
+
+#include <string>
+
+namespace BL{
+
+  class JobManagerEvent : public QEvent
+  {
+    public:
+      JobManagerEvent(const std::string & action_i, 
+                     const std::string & event_name_i, 
+                     const std::string & job_name_i, 
+                     const std::string & data_i);
+      virtual ~JobManagerEvent();
+
+    public:
+      std::string action;
+      std::string event_name;
+      std::string job_name;
+      std::string data;
+  };
+
+  class JobsManager_QT: virtual public QDockWidget,
+                       virtual public BL::JobsManager,
+                       virtual public BL::Observer
+  {
+    Q_OBJECT
+
+    public:
+      JobsManager_QT(QWidget * parent, BL::SALOMEServices * salome_services);
+      virtual ~JobsManager_QT();
+
+      void delete_job(QString job_name);
+      void create_job_wizard();
+
+      virtual void sendEvent(const std::string & action, 
+                            const std::string & event_name, 
+                            const std::string & job_name, 
+                            const std::string & data);
+      bool event(QEvent * e);
+
+      void write_normal_text(const QString & text);
+      void write_error_text(const QString & text);
+
+    public slots:
+      void RefreshJobs();
+      void no_auto_refresh();
+      void ten_seconds_refresh();
+      void thirty_seconds_refresh();
+      void one_minute_refresh();
+      void five_minutes_refresh();
+      void thirty_minutes_refresh();
+      void one_hour_refresh();
+
+    signals:
+      void new_job_added(const QString & name);
+      void job_state_changed(const QString & name);
+
+    private:
+      QPushButton * _load_jobs;
+      QPushButton * _save_jobs;
+      QPushButton * _auto_refresh_jobs;
+      QTimer * _timer;
+      QTextEdit * _log;
+  };
+
+}
+
+#endif
+
+
diff --git a/src/genericgui/BL_JobsTable.cxx b/src/genericgui/BL_JobsTable.cxx
new file mode 100644 (file)
index 0000000..8a1f3fb
--- /dev/null
@@ -0,0 +1,44 @@
+//  Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "BL_JobsTable.hxx"
+#include "BL_Traces.hxx"
+
+BL::JobsTable::JobsTable(QWidget *parent) : QTableView(parent)
+{
+  DEBTRACE("Creating BL::JobsTable");
+  BL_ASSERT(parent);
+  _parent = parent;
+
+  // Init
+  setShowGrid(false);
+  setCornerButtonEnabled(false);
+  setEditTriggers(QAbstractItemView::NoEditTriggers);
+  setSelectionBehavior(QAbstractItemView::SelectRows);
+  setAlternatingRowColors(true);
+  setSortingEnabled(true);
+
+  QHeaderView * header_view = verticalHeader();
+  header_view->setClickable(false);
+}
+
+BL::JobsTable::~JobsTable()
+{
+  DEBTRACE("Destroying BL::JobsTable");
+}
diff --git a/src/genericgui/BL_JobsTable.hxx b/src/genericgui/BL_JobsTable.hxx
new file mode 100644 (file)
index 0000000..ace8b2f
--- /dev/null
@@ -0,0 +1,42 @@
+//  Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _BL_JOBSTABLE_HXX_
+#define _BL_JOBSTABLE_HXX_
+
+#include <QtGui>
+
+namespace BL 
+{
+  class JobsTable: public QTableView
+  {
+    Q_OBJECT
+
+    public:
+      JobsTable(QWidget *parent);
+      virtual ~JobsTable();
+
+    protected:
+      QWidget* _parent;
+
+  };
+}
+
+#endif
+
diff --git a/src/genericgui/BL_MachineCatalog.cxx b/src/genericgui/BL_MachineCatalog.cxx
new file mode 100644 (file)
index 0000000..eae8ded
--- /dev/null
@@ -0,0 +1,66 @@
+//  Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "BL_MachineCatalog.hxx"
+#include "BL_Traces.hxx"
+
+BL::MachineCatalog::MachineCatalog(QWidget *parent, BL::SALOMEServices * salome_services) : QWidget(parent)
+{
+  DEBTRACE("Creating BL::MachineCatalog");
+  BL_ASSERT(parent);
+  BL_ASSERT(salome_services);
+  _parent = parent;
+  _salome_services = salome_services;
+  
+  _refresh_button = new QPushButton("Refresh Machine List");
+  _refresh_button->show();
+  connect(_refresh_button, SIGNAL(clicked()), this, SLOT(refresh_machine_list()));
+  _machine_files_list = new QListWidget(this);
+  _machine_files_list->setSelectionMode(QAbstractItemView::NoSelection);
+  std::list<std::string> machine_list = _salome_services->getMachineList();
+  std::list<std::string>::iterator it;
+  for (it = machine_list.begin(); it != machine_list.end(); it++)
+  {
+    std::string machine = *it;
+    _machine_files_list->addItem(QString(machine.c_str()));
+  }
+
+  QVBoxLayout * mainLayout = new QVBoxLayout(this);
+  mainLayout->addWidget(_refresh_button);
+  mainLayout->addWidget(_machine_files_list);
+  setLayout(mainLayout);
+}
+
+BL::MachineCatalog::~MachineCatalog()
+{
+  DEBTRACE("Destroying BL::MachineCatalog");
+}
+
+void
+BL::MachineCatalog::refresh_machine_list()
+{
+  _machine_files_list->clear();
+  std::list<std::string> machine_list = _salome_services->getMachineList();
+  std::list<std::string>::iterator it;
+  for (it = machine_list.begin(); it != machine_list.end(); it++)
+  {
+    std::string machine = *it;
+    _machine_files_list->addItem(QString(machine.c_str()));
+  }
+}
diff --git a/src/genericgui/BL_MachineCatalog.hxx b/src/genericgui/BL_MachineCatalog.hxx
new file mode 100644 (file)
index 0000000..95355b4
--- /dev/null
@@ -0,0 +1,54 @@
+//  Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _BL_MACHINECATALOG_HXX_
+#define _BL_MACHINECATALOG_HXX_
+
+#include <QtGui>
+
+#include "BL_SALOMEServices.hxx"
+
+#include <string>
+#include <list>
+
+namespace BL 
+{
+  class MachineCatalog: public QWidget
+  {
+    Q_OBJECT
+
+    public:
+      MachineCatalog(QWidget *parent, BL::SALOMEServices * salome_services);
+      virtual ~MachineCatalog();
+
+    public slots:
+      void refresh_machine_list();
+
+    protected:
+      QWidget* _parent;
+      BL::SALOMEServices * _salome_services;
+
+      QPushButton * _refresh_button;
+      QListWidget * _machine_files_list;
+  };
+}
+
+#endif
+
+
diff --git a/src/genericgui/BL_MainButtons.cxx b/src/genericgui/BL_MainButtons.cxx
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/genericgui/BL_MainButtons.hxx b/src/genericgui/BL_MainButtons.hxx
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/genericgui/BL_QModelManager.cxx b/src/genericgui/BL_QModelManager.cxx
new file mode 100644 (file)
index 0000000..6412dd2
--- /dev/null
@@ -0,0 +1,131 @@
+//  Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "BL_QModelManager.hxx"
+
+BL::QModelManager::QModelManager(QObject * parent, BL::JobsManager_QT * jobs_manager) : QObject(parent)
+{
+  DEBTRACE("Creating BL::QModelManager");
+  BL_ASSERT(jobs_manager);
+  _jobs_manager = jobs_manager;
+
+  _model = new QStandardItemModel(this);
+  QStringList headers;
+  headers << "Job Name" << "Type" << "State" << "Machine";
+  _model->setHorizontalHeaderLabels(headers);
+}
+
+BL::QModelManager::~QModelManager()
+{
+  DEBTRACE("Destroying BL::QModelManager");
+}
+
+QStandardItemModel *
+BL::QModelManager::getModel()
+{
+  DEBTRACE("getModel BL::QModelManager called");
+
+  return _model;
+}
+
+void
+BL::QModelManager::new_job_added(const QString & name)
+{
+  BL::Job * job = _jobs_manager->getJob(name.toStdString());
+  QStandardItem * new_job_name = new QStandardItem(name);
+  
+  QStandardItem * new_job_type;
+  if (job->getType() == BL::Job::YACS_SCHEMA)
+    new_job_type = new QStandardItem("YACS_Schema");
+  else
+    new_job_type = new QStandardItem("Command");
+
+  QStandardItem * new_job_state;
+  if (job->getState() == BL::Job::CREATED)
+    new_job_state = new QStandardItem("Created");
+  else if (job->getState() == BL::Job::QUEUED)
+    new_job_state = new QStandardItem("Queued");
+  else if (job->getState() == BL::Job::RUNNING)
+    new_job_state = new QStandardItem("Running");
+  else if (job->getState() == BL::Job::PAUSED)
+    new_job_state = new QStandardItem("Paused");
+  else if (job->getState() == BL::Job::ERROR)
+    new_job_state = new QStandardItem("Error");
+  else 
+    new_job_state = new QStandardItem("Finished");
+
+  QStandardItem * new_job_machine =  new QStandardItem(job->getMachine().c_str());
+
+  int row = _model->rowCount();
+  _model->setItem(row, 0, new_job_name);
+  _model->setItem(row, 1, new_job_type);
+  _model->setItem(row, 2, new_job_state);
+  _model->setItem(row, 3, new_job_machine);
+}
+
+void
+BL::QModelManager::job_state_changed(const QString & name)
+{
+  DEBTRACE("BL::QModelManager::job_state_changed received");
+
+  BL::Job * job = _jobs_manager->getJob(name.toStdString());
+  QList<QStandardItem *> item_list = _model->findItems(name);
+  QStandardItem * job_state_item = _model->item(item_list.at(0)->row(), 2);
+
+  if (job->getState() == BL::Job::CREATED)
+    job_state_item->setText("Created");
+  else if (job->getState() == BL::Job::QUEUED)
+    job_state_item->setText("Queued");
+  else if (job->getState() == BL::Job::RUNNING)
+    job_state_item->setText("Running");
+  else if (job->getState() == BL::Job::PAUSED)
+    job_state_item->setText("Paused");
+  else if (job->getState() == BL::Job::ERROR)
+    job_state_item->setText("Error");
+  else 
+    job_state_item->setText("Finished");
+}
+
+void
+BL::QModelManager::deleteJob(int row)
+{
+  _model->removeRow(row);
+}
+
+void
+BL::QModelManager::job_selected(const QModelIndex & index)
+{
+  DEBTRACE("BL::QModelManager::job_selected slot");
+  QStandardItem * item = _model->itemFromIndex(index);
+  int row = item->row();
+
+  // Algo un peu bourrin....
+  for (int i = 0; i < _model->rowCount(); i++)
+    for (int j = 0; j < _model->columnCount(); j++)
+    {
+      _model->item(i,j)->setBackground(QBrush(Qt::white));
+      _model->item(i,j)->setForeground(QBrush(Qt::black));
+    }
+
+  for (int j = 0; j < _model->columnCount(); j++)
+  {
+    _model->item(row,j)->setBackground(QBrush(Qt::darkBlue));
+    _model->item(row,j)->setForeground(QBrush(Qt::white));
+  }
+}
diff --git a/src/genericgui/BL_QModelManager.hxx b/src/genericgui/BL_QModelManager.hxx
new file mode 100644 (file)
index 0000000..868d93a
--- /dev/null
@@ -0,0 +1,56 @@
+//  Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _BL_QMODELMANAGER_HXX_
+#define _BL_QMODELMANAGER_HXX_
+
+#include <QtGui>
+
+#include "BL_Job.hxx"
+#include "BL_JobsManager_QT.hxx"
+
+namespace BL{
+
+  class QModelManager: virtual public QObject
+  {
+    Q_OBJECT
+
+    public:
+      QModelManager(QObject * parent, BL::JobsManager_QT * jobs_manager);
+      virtual ~QModelManager();
+      
+      QStandardItemModel * getModel();
+
+      void deleteJob(int row);
+
+    public slots:
+      void new_job_added(const QString & name);
+      void job_state_changed(const QString & name);
+      void job_selected(const QModelIndex & index);
+    
+    private:
+      QStandardItemModel * _model;
+      BL::JobsManager_QT * _jobs_manager;
+      
+  };
+
+}
+
+#endif
+
diff --git a/src/genericgui/BL_Summary.cxx b/src/genericgui/BL_Summary.cxx
new file mode 100644 (file)
index 0000000..4cb67fc
--- /dev/null
@@ -0,0 +1,137 @@
+//  Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "BL_Summary.hxx"
+#include "BL_Traces.hxx"
+
+BL::Summary::Summary(QWidget *parent, BL::JobsManager_QT * jobs_manager) : QWidget(parent)
+{
+  DEBTRACE("Creating BL::Summary");
+  BL_ASSERT(parent);
+  BL_ASSERT(jobs_manager);
+  _parent = parent;
+  _jobs_manager = jobs_manager;
+  _model = NULL;
+
+  
+  QLabel * summary_jobs = new QLabel("Jobs Summary:");
+  QLabel * total_label = new QLabel("Number of jobs:");
+  _total_line = new QLabel;
+  _total_line->setText("0");
+
+  QLabel * created_label = new QLabel("Number of created jobs:");
+  _created_line = new QLabel;
+  _created_line->setText("0");
+
+  QLabel * queued_label = new QLabel("Number of queued jobs:");
+  _queued_line = new QLabel;
+  _queued_line->setText("0");
+
+  QLabel * running_label = new QLabel("Number of running jobs:");
+  _running_line = new QLabel;
+  _running_line->setText("0");
+
+  QLabel * finished_label = new QLabel("Number of finished jobs:");
+  _finished_line = new QLabel;
+  _finished_line->setText("0");
+
+  QFormLayout *mainLayout = new QFormLayout;
+  mainLayout->insertRow(0, summary_jobs);
+  mainLayout->insertRow(1, total_label, _total_line);
+  mainLayout->insertRow(2, created_label, _created_line);
+  mainLayout->insertRow(3, queued_label, _queued_line);
+  mainLayout->insertRow(4, running_label, _running_line);
+  mainLayout->insertRow(5, finished_label, _finished_line);
+  setLayout(mainLayout);
+}
+
+BL::Summary::~Summary()
+{
+  DEBTRACE("Destroying BL::Summary");
+}
+
+void
+BL::Summary::setModel(QStandardItemModel * model)
+{
+  DEBTRACE("Call setModel BL::Summary");
+  BL_ASSERT(model);
+
+  _model = model;
+}
+
+void 
+BL::Summary::rowsInserted(const QModelIndex & parent, int start, int end)
+{
+  DEBTRACE("BL::Summary::rowsInserted slot");
+  updateJobs();
+}
+
+void 
+BL::Summary::rowsRemoved(const QModelIndex & parent, int start, int end)
+{
+  DEBTRACE("BL::Summary::rowsRemoved slot");
+  updateJobs();
+}
+
+void 
+BL::Summary::itemChanged(QStandardItem * item)
+{
+  updateJobs();
+}
+
+void
+BL::Summary::updateJobs()
+{
+  // Total
+  QVariant row_number = _model->rowCount();
+  _total_line->setText(row_number.toString());
+
+  // New count...
+  _created_line->setText("0");
+  _queued_line->setText("0");
+  _running_line->setText("0");
+  _finished_line->setText("0");
+
+  int created_jobs = 0;
+  int queued_jobs = 0;
+  int running_jobs = 0;
+  int finished_jobs = 0;
+  std::map<std::string, BL::Job *> jobs = _jobs_manager->getJobs();
+  std::map<std::string, BL::Job *>::iterator jobs_it;
+  jobs_it = jobs.begin();
+  for(; jobs_it != jobs.end(); jobs_it++)
+  {
+    BL::Job * job = jobs_it->second;
+    BL::Job::State job_state = job->getState();
+    if (job_state == BL::Job::CREATED)
+      created_jobs++;
+    if (job_state == BL::Job::QUEUED)
+      queued_jobs++;
+    if (job_state == BL::Job::RUNNING)
+      running_jobs++;
+    if (job_state == BL::Job::FINISHED)
+      finished_jobs++;
+  }
+
+  // End
+  _created_line->setText(QVariant(created_jobs).toString());
+  _queued_line->setText(QVariant(queued_jobs).toString());
+  _running_line->setText(QVariant(running_jobs).toString());
+  _finished_line->setText(QVariant(finished_jobs).toString());
+}
diff --git a/src/genericgui/BL_Summary.hxx b/src/genericgui/BL_Summary.hxx
new file mode 100644 (file)
index 0000000..b972388
--- /dev/null
@@ -0,0 +1,59 @@
+//  Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _BL_SUMMARY_HXX_
+#define _BL_SUMMARY_HXX_
+
+#include <QtGui>
+#include "BL_JobsManager_QT.hxx"
+
+namespace BL 
+{
+  class Summary: public QWidget
+  {
+    Q_OBJECT
+
+    public:
+      Summary(QWidget *parent, BL::JobsManager_QT * jobs_manager);
+      virtual ~Summary();
+
+      void setModel(QStandardItemModel * model);
+
+      void updateJobs();
+
+    public slots:
+      void rowsInserted(const QModelIndex & parent, int start, int end);
+      void rowsRemoved(const QModelIndex & parent, int start, int end);
+      void itemChanged(QStandardItem * item);
+
+    protected:
+      QWidget* _parent;
+      QStandardItemModel * _model;
+
+      BL::JobsManager_QT * _jobs_manager;
+      QLabel * _total_line;
+      QLabel * _created_line;
+      QLabel * _queued_line;
+      QLabel * _running_line;
+      QLabel * _finished_line;
+  };
+}
+
+#endif
+
diff --git a/src/genericgui/Makefile.am b/src/genericgui/Makefile.am
new file mode 100644 (file)
index 0000000..c039365
--- /dev/null
@@ -0,0 +1,64 @@
+#  Copyright (C) 2009 CEA/DEN, EDF R&D
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+#  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+libdir = $(prefix)/lib/salome
+
+lib_LTLIBRARIES = libBL_GenericGui.la
+
+libBL_GenericGui_la_SOURCES = BL_GenericGui.hxx BL_GenericGui.cxx \
+                             BL_JobsTable.hxx BL_JobsTable.cxx \
+                             BL_JobTab.hxx BL_JobTab.cxx \
+                             BL_Buttons.hxx BL_Buttons.cxx \
+                             BL_JobsManager_QT.hxx BL_JobsManager_QT.cxx \
+                             BL_QModelManager.hxx BL_QModelManager.cxx \
+                             BL_CreateJobWizard.hxx BL_CreateJobWizard.cxx \
+                             BL_Summary.hxx BL_Summary.cxx \
+                             BL_MachineCatalog.hxx BL_MachineCatalog.cxx
+
+nodist_libBL_GenericGui_la_SOURCES = BL_GenericGui_moc.cxx BL_JobsTable_moc.cxx \
+                                    BL_JobTab_moc.cxx  \
+                                    BL_Buttons_moc.cxx BL_JobsManager_QT_moc.cxx \
+                                    BL_QModelManager_moc.cxx BL_CreateJobWizard_moc.cxx \
+                                    BL_Summary_moc.cxx BL_MachineCatalog_moc.cxx
+
+libBL_GenericGui_la_CXXFLAGS = $(qt4_cppflags) \
+                              -I$(top_srcdir)/src/bases \
+                              -I$(top_srcdir)/src/engine \
+                              -I$(KERNEL_ROOT_DIR)/include/salome \
+                              -I$(top_srcdir)/src/wrappers
+
+libBL_GenericGui_la_LDFLAGS = $(qt4_ldflags) 
+
+libBL_GenericGui_la_LIBADD = -lQtGui -lQtCore -lQtWebKit \
+                            $(top_builddir)/src/bases/libBL_Bases.la \
+                            $(top_builddir)/src/engine/libBL_Engine.la
+
+SUFFIXES = .hxx _moc.cxx .qrc _qrc.cxx
+
+.hxx_moc.cxx :
+       $(QT_MOC) -p . -o $@ $<
+
+.qrc_qrc.cxx :
+       $(QT_RCC) -name $(*F)  $< -o $@
+
+clean-local-qt :
+       rm -f *_moc.cxx *_qrc.cxx ui_*.h
+
+clean-local: clean-local-qt
+
diff --git a/src/salomegui/BL_SalomeGui.cxx b/src/salomegui/BL_SalomeGui.cxx
new file mode 100644 (file)
index 0000000..5895d94
--- /dev/null
@@ -0,0 +1,85 @@
+//  Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+#include "BL_SalomeGui.hxx"
+
+BL::SalomeGui::SalomeGui() : MainWindows_SALOME("JobManager"), 
+                            SalomeApp_Module("JobManager"), 
+                            LightApp_Module("JobManager")
+{
+  DEBTRACE("Creating BL::SalomeGui");
+  _gengui = NULL;
+}
+
+BL::SalomeGui::~SalomeGui()
+{
+  DEBTRACE("Destroying BL::SalomeGui");
+}
+
+void 
+BL::SalomeGui::initialize(CAM_Application* app)
+{
+   DEBTRACE("Entering in initialize");
+   SalomeApp_Module::initialize(app); // MANDATORY -> Otherwise SISEGV...
+   BL::MainWindows_SALOME::initialize(getApp());
+
+   _gengui = new BL::GenericGui(this);
+   _gengui->createActions();
+   _gengui->createMenus();
+   _gengui->updateButtonsStates();
+}
+
+bool 
+BL::SalomeGui::activateModule(SUIT_Study* theStudy)
+{
+  DEBTRACE("Entering in BL::SalomeGui::activateModule");
+
+  bool bOk = SalomeApp_Module::activateModule(theStudy);
+  setMenuShown(true);
+
+  _gengui->showDockWidgets(true);
+  return bOk;
+}
+
+void 
+BL::SalomeGui::windows(QMap<int, int>& theMap) const
+{
+  DEBTRACE("Entering in BL::SalomeGui::windows");
+  theMap.clear();
+  theMap.insert(SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea);
+}
+
+bool 
+BL::SalomeGui::deactivateModule(SUIT_Study* theStudy)
+{
+  DEBTRACE("Entering in BL::SalomeGui::deactivateModule");
+
+  setMenuShown(false);
+  _gengui->showDockWidgets(false);
+  bool bOk = SalomeApp_Module::deactivateModule(theStudy);
+  return bOk;
+}
+
+// --- Export the module
+extern "C"
+{
+  CAM_Module* createModule()
+  {
+    return new BL::SalomeGui();
+  }
+}
diff --git a/src/salomegui/BL_SalomeGui.hxx b/src/salomegui/BL_SalomeGui.hxx
new file mode 100644 (file)
index 0000000..c72142d
--- /dev/null
@@ -0,0 +1,54 @@
+//  Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+#ifndef _BL_SALOMEGUI_HXX_
+#define _BL_SALOMEGUI_HXX_
+
+#include <SALOMEconfig.h>
+
+#include <SalomeApp_Module.h>
+#include <SalomeApp_Application.h>
+
+#include "BL_MainWindows_SALOME.hxx"
+#include "BL_GenericGui.hxx"
+#include "BL_Traces.hxx"
+
+namespace BL
+{
+  class SalomeGui: virtual public MainWindows_SALOME
+  {
+    Q_OBJECT
+    
+    public:
+      SalomeGui();
+      virtual ~SalomeGui();
+
+      void initialize( CAM_Application* app); // --- Call only once, at GUI module creation
+      void windows( QMap<int, int>& theMap) const; // --- Default windows, called each time the module is activated
+
+    public slots:
+      bool deactivateModule( SUIT_Study* theStudy);
+      bool activateModule( SUIT_Study* theStudy);
+
+    protected:
+      BL::GenericGui * _gengui;
+  };
+
+}
+
+#endif
diff --git a/src/salomegui/Makefile.am b/src/salomegui/Makefile.am
new file mode 100644 (file)
index 0000000..c916702
--- /dev/null
@@ -0,0 +1,78 @@
+#  Copyright (C) 2009 CEA/DEN, EDF R&D
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+#  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+include $(top_srcdir)/src/bases/make_begin.am
+
+MOC_FILES = BL_SalomeGui_moc.cxx
+
+lib_LTLIBRARIES = libJOBMANAGER.la
+
+dist_libJOBMANAGER_la_SOURCES = BL_SalomeGui.hxx BL_SalomeGui.cxx
+
+nodist_libJOBMANAGER_la_SOURCES = $(MOC_FILES)
+
+libJOBMANAGER_la_CXXFLAGS = $(qt4_cppflags) \
+                               $(OMNIORB_INCLUDES) \
+                               -I$(KERNEL_ROOT_DIR)/include/salome \
+                               -I$(GUI_ROOT_DIR)/include/salome \
+                               -I$(top_srcdir)/src/genericgui \
+                               -I$(top_srcdir)/src/wrappers \
+                               -I$(top_srcdir)/src/engine \
+                               -I$(top_srcdir)/src/bases
+
+libJOBMANAGER_la_LDFLAGS  = -L$(GUI_ROOT_DIR)/lib/salome \
+                               -L$(KERNEL_ROOT_DIR)/lib/salome \
+                               $(qt4_ldflags)
+
+libJOBMANAGER_la_LIBADD  = $(qt4_libs) \
+                              $(top_builddir)/src/bases/libBL_Bases.la \
+                              $(top_builddir)/src/engine/libBL_Engine.la \
+                              $(top_builddir)/src/genericgui/libBL_GenericGui.la \
+                              $(top_builddir)/src/wrappers/libBL_Wrappers_SALOME.la \
+                              -lSalomeApp
+
+salomeinclude_HEADERS = BL_SalomeGui.hxx
+
+# resources files
+LIBICONS = SalomeApp.xml jobmanager.png
+dist_salomeres_DATA = ${ICONS}
+ICONS = $(LIBICONS:%=resources/%)
+
+# --------------------------------------------
+# *.h --> *_moc.cxx
+# --------------------------------------------
+
+SUFFIXES = .hxx _moc.cxx .qrc _qrc.cxx
+
+.hxx_moc.cxx :
+       $(QT_MOC) -p . -o $@ $<
+
+.qrc_qrc.cxx :
+       $(QT_RCC) -name $(*F)  $< -o $@
+
+#.ui.h :
+#      $(QT_UIC) -o $@ $<
+
+
+clean-local-qt :
+       rm -f *_moc.cxx *_qrc.cxx
+
+
+clean-local: clean-local-qt
+       rm -f YACS_msg_en.qm YACS_msg_fr.qm
diff --git a/src/salomegui/resources/SalomeApp.xml b/src/salomegui/resources/SalomeApp.xml
new file mode 100644 (file)
index 0000000..c8e0933
--- /dev/null
@@ -0,0 +1,31 @@
+<!--
+  Copyright (C) 2009  CEA/DEN, EDF R&D
+
+  This library is free software; you can redistribute it and/or
+  modify it under the terms of the GNU Lesser General Public
+  License as published by the Free Software Foundation; either
+  version 2.1 of the License.
+
+  This library is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public
+  License along with this library; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+
+  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+-->
+<document>
+  <section name="JOBMANAGER">
+    <!-- Major module parameters -->
+    <parameter name="name" value="JobManager"/>
+    <parameter name="icon" value="jobmanager.png"/>
+  </section>
+  <section name="resources">
+    <!-- Module resources -->
+    <parameter name="JOBMANAGER" value="${JOBMANAGER_ROOT_DIR}/share/salome/resources/jobmanager"/>
+  </section>
+</document>
diff --git a/src/salomegui/resources/jobmanager.png b/src/salomegui/resources/jobmanager.png
new file mode 100644 (file)
index 0000000..89d43e8
Binary files /dev/null and b/src/salomegui/resources/jobmanager.png differ
diff --git a/src/standalone/Makefile.am b/src/standalone/Makefile.am
new file mode 100644 (file)
index 0000000..e6c5d75
--- /dev/null
@@ -0,0 +1,23 @@
+bin_PROGRAMS = jobmanager_gui
+
+bin_SCRIPTS = start_jobmanager.sh
+
+jobmanager_gui_SOURCES = main.cxx 
+
+jobmanager_gui_CXXFLAGS = $(qt4_cppflags) \
+                             -I$(top_srcdir)/src/bases \
+                             -I$(top_srcdir)/src/engine \
+                             -I$(KERNEL_ROOT_DIR)/include/salome \
+                             -I$(top_srcdir)/src/wrappers \
+                             -I$(top_srcdir)/src/genericgui
+
+jobmanager_gui_LDFLAGS = $(qt4_ldflags)
+
+jobmanager_gui_LDADD = -lQtGui -lQtCore \
+                          $(top_builddir)/src/genericgui/libBL_GenericGui.la \
+                          $(top_builddir)/src/engine/libBL_Engine.la \
+                          $(top_builddir)/src/wrappers/libBL_Wrappers_Qt.la \
+                          @OMNIORB_LIBS@ \
+                          -L$(KERNEL_ROOT_DIR)/lib/salome -lSalomeLifeCycleCORBA -lSalomeIDLKernel -lSalomeNS
+
+EXTRA_DIST = start_jobmanager.sh.in
diff --git a/src/standalone/main.cxx b/src/standalone/main.cxx
new file mode 100644 (file)
index 0000000..baf07c6
--- /dev/null
@@ -0,0 +1,21 @@
+#include <QtGui>
+#include "BL_GenericGui.hxx"
+#include "BL_MainWindows_Qt.hxx"
+
+int main(int argc, char *argv[])
+{
+  QApplication app(argc, argv);
+
+  QMainWindow main_window;
+  BL::MainWindows_Qt wrapper(&main_window);
+  BL::GenericGui * main_widget = new BL::GenericGui(&wrapper);
+  main_widget->createActions();
+  main_widget->createMenus();
+  main_widget->updateButtonsStates();
+
+  main_window.setWindowTitle("Standalone JobManager Gui");
+  main_window.show();
+
+  return app.exec();
+}
+
diff --git a/src/standalone/start_jobmanager.sh.in b/src/standalone/start_jobmanager.sh.in
new file mode 100644 (file)
index 0000000..4b94938
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/bash
+#  Copyright (C) 2009  CEA/DEN, EDF R&D
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+#  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+usage()
+{
+        echo "Start JobManager GUI outside SALOME GUI"
+        echo ""
+        echo "Usage: $(basename $0) -a APPLIPATH [ -h ]"
+        echo ""
+        echo "  -a APPLIPATH       : Application Path where SALOME is launched "
+        echo "  -h                 : Print this message"
+        echo ""
+}
+
+while getopts 'a:h' OPTION
+  do
+    case $OPTION in
+      a)APPLIPATH="$OPTARG" ;;
+      h|?) usage
+          exit 1 ;;
+    esac
+  done
+
+if test "x${APPLIPATH}" == "x"; then
+  usage
+  exit 1
+fi
+
+JOBMANAGER_INSTALL_DIR=@prefix@/bin
+
+${APPLIPATH}/runSession ${JOBMANAGER_INSTALL_DIR}/jobmanager_gui
diff --git a/src/wrappers/BL_MainWindows_Qt.cxx b/src/wrappers/BL_MainWindows_Qt.cxx
new file mode 100644 (file)
index 0000000..ea7e5a2
--- /dev/null
@@ -0,0 +1,77 @@
+//  Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+#include "BL_MainWindows_Qt.hxx"
+
+BL::MainWindows_Qt::MainWindows_Qt(QMainWindow * main_window)
+{
+  DEBTRACE("Creating BL::MainWindows_Qt");
+  BL_ASSERT(main_window);
+  _main_window = main_window;
+  _menuId = 0;
+}
+
+BL::MainWindows_Qt::~MainWindows_Qt()
+{
+  DEBTRACE("Destroying BL::MainWindows_Qt");
+}
+
+QMainWindow * 
+BL::MainWindows_Qt::getDockParent()
+{
+  return _main_window;
+}
+
+QMainWindow * 
+BL::MainWindows_Qt::getTabParent()
+{
+  return _main_window;
+}
+
+QAction* 
+BL::MainWindows_Qt::createAction(const QString& toolTip,
+                                const QIcon& icon,
+                                const QString& menu,
+                                const QString& status,
+                                const int shortCut,
+                                QObject* parent,
+                                bool checkable,
+                                QObject* receiver,
+                                const char* member)
+{
+  QAction * action = new QAction(icon, menu, parent);
+  action->setStatusTip(status);
+  action->setToolTip(toolTip);
+  if (receiver)
+    connect(action, SIGNAL(triggered()), receiver, member);
+  return action;
+}
+
+int
+BL::MainWindows_Qt::createTopMenu(const QString & menu_name)
+{
+  QMenu * new_menu = _main_window->menuBar()->addMenu(menu_name);
+  _menu_map[getMenuId()] = new_menu;
+  return 0;
+}
+
+void
+BL::MainWindows_Qt::addActionToMenu(QAction * action, int menu_id)
+{
+  _menu_map[menu_id]->addAction(action);
+}
diff --git a/src/wrappers/BL_MainWindows_Qt.hxx b/src/wrappers/BL_MainWindows_Qt.hxx
new file mode 100644 (file)
index 0000000..550d6c5
--- /dev/null
@@ -0,0 +1,58 @@
+//  Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+
+#ifndef _BL_MAINWINDOWS_QT_HXX_
+#define _BL_MAINWINDOWS_QT_HXX_
+
+#include "BL_MainWindows_Wrap.hxx"
+#include <map>
+
+namespace BL
+{
+  class MainWindows_Qt : public MainWindows_Wrap, public QObject
+  {
+    public:
+      MainWindows_Qt(QMainWindow * main_window);
+      virtual ~MainWindows_Qt();
+
+      virtual QMainWindow * getDockParent();
+      virtual QMainWindow * getTabParent();
+
+      virtual QAction* createAction(const QString& toolTip,
+                                   const QIcon& icon,
+                                   const QString& menu,
+                                   const QString& status,
+                                   const int shortCut,
+                                   QObject* parent =0,
+                                   bool checkable = false,
+                                   QObject* receiver =0,
+                                   const char* member =0);
+
+      virtual int createTopMenu(const QString & menu_name);
+      virtual void addActionToMenu(QAction * action, int menu_id);
+
+    protected:
+      QMainWindow * _main_window;
+      int _menuId;
+      int getMenuId() { return _menuId++; }
+      std::map<int, QMenu*> _menu_map;
+  };
+}
+
+#endif
diff --git a/src/wrappers/BL_MainWindows_SALOME.cxx b/src/wrappers/BL_MainWindows_SALOME.cxx
new file mode 100644 (file)
index 0000000..6a604b7
--- /dev/null
@@ -0,0 +1,100 @@
+//  Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+#include "BL_MainWindows_SALOME.hxx"
+
+BL::MainWindows_SALOME::MainWindows_SALOME(const QString & module_name) :
+  SalomeApp_Module(module_name),
+  LightApp_Module(module_name)
+{
+  DEBTRACE("Creating BL::MainWindows_SALOME");
+  _actionId = 190;
+}
+
+void 
+BL::MainWindows_SALOME::initialize(SalomeApp_Application * appli)
+{
+  DEBTRACE("Initialize BL::MainWindows_SALOME");
+  BL_ASSERT(appli);
+
+  _appli = appli;
+  _svm = new SUIT_ViewManager(_appli->activeStudy(), _appli->desktop(), new SUIT_ViewModel());
+  _appli->addViewManager(_svm);
+  _viewWin = _svm->createViewWindow();
+
+  if (_viewWin && _appli->desktop())
+    _viewWin->resize((int)(_appli->desktop()->width() * 0.6), (int)(_appli->desktop()->height() * 0.6 ));
+}
+
+QString  
+BL::MainWindows_SALOME::engineIOR() const
+{
+  DEBTRACE("Entering in BL::SalomeGui::engineIOR");
+  return _appli->defaultEngineIOR();
+}
+
+void 
+BL::MainWindows_SALOME::viewManagers(QStringList& list) const
+{
+  DEBTRACE("Entering in BL::SalomeGui::viewManagers");
+  list.append(_svm->getType());
+}
+
+
+BL::MainWindows_SALOME::~MainWindows_SALOME()
+{
+  DEBTRACE("Destroying BL::MainWindows_SALOME");
+}
+
+QMainWindow * 
+BL::MainWindows_SALOME::getDockParent()
+{
+  return _appli->desktop();
+}
+
+QMainWindow * 
+BL::MainWindows_SALOME::getTabParent()
+{
+  return _viewWin;
+}
+
+QAction* 
+BL::MainWindows_SALOME::createAction(const QString& toolTip,
+                                    const QIcon& icon,
+                                    const QString& menu,
+                                    const QString& status,
+                                    const int shortCut,
+                                    QObject* parent,
+                                    bool checkable,
+                                    QObject* receiver,
+                                    const char* member)
+{
+  return SalomeApp_Module::createAction(getActionId(), toolTip, icon, menu, status, shortCut, parent, checkable, receiver, member);
+}
+
+int
+BL::MainWindows_SALOME::createTopMenu(const QString & menu_name)
+{
+  return createMenu(menu_name, -1);
+}
+
+void 
+BL::MainWindows_SALOME::addActionToMenu(QAction * action, int menu_id)
+{
+  createMenu(action, menu_id);
+}
diff --git a/src/wrappers/BL_MainWindows_SALOME.hxx b/src/wrappers/BL_MainWindows_SALOME.hxx
new file mode 100644 (file)
index 0000000..ec2ee35
--- /dev/null
@@ -0,0 +1,80 @@
+//  Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+
+#ifndef _BL_MAINWINDOWS_SALOME_HXX_
+#define _BL_MAINWINDOWS_SALOME_HXX_
+
+#include "BL_MainWindows_Wrap.hxx"
+
+#include <SalomeApp_Application.h>
+#include <SalomeApp_Module.h>
+
+#include <SUIT_ViewManager.h>
+#include <SUIT_ViewModel.h>
+#include <SUIT_ViewWindow.h>
+#include <SUIT_Desktop.h>
+
+namespace BL
+{
+  class MainWindows_SALOME : virtual public MainWindows_Wrap, 
+                            virtual public SalomeApp_Module
+  {
+    public:
+      MainWindows_SALOME(const QString & module_name);
+      virtual ~MainWindows_SALOME();
+
+      // mandatory by SalomeApp_Module
+      virtual QString  engineIOR() const;
+
+      // Usefull methods for good integration in SALOME
+      virtual void viewManagers( QStringList& list) const; // --- On ajoute nos viewManagers et ensuite LigthApp affiche le dernier
+
+      // mandatory by  MainWindows_Wrap
+      virtual QMainWindow * getDockParent();
+      virtual QMainWindow * getTabParent();
+
+      virtual QAction* createAction(const QString& toolTip,
+                                   const QIcon& icon,
+                                   const QString& menu,
+                                   const QString& status,
+                                   const int shortCut,
+                                   QObject* parent =0,
+                                   bool checkable = false,
+                                   QObject* receiver =0,
+                                   const char* member =0);
+
+      virtual int createTopMenu(const QString & menu_name);
+      virtual void addActionToMenu(QAction * action, int menu_id);
+
+      // Usefull methods
+      virtual void initialize(SalomeApp_Application * appli);
+
+    protected:
+      SalomeApp_Application * _appli;
+      SalomeApp_Module * _module;
+      SUIT_ViewManager * _svm;
+      SUIT_ViewWindow  * _viewWin;
+
+      int _actionId;
+      int getActionId() { return _actionId++; }
+  };
+}
+
+#endif
+
diff --git a/src/wrappers/BL_MainWindows_Wrap.hxx b/src/wrappers/BL_MainWindows_Wrap.hxx
new file mode 100644 (file)
index 0000000..3d16e98
--- /dev/null
@@ -0,0 +1,54 @@
+//  Copyright (C) 2009 CEA/DEN, EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+
+#ifndef _BL_MAINWINDOWS_WRAP_HXX_
+#define _BL_MAINWINDOWS_WRAP_HXX_
+
+#include <QtGui>
+#include "BL_Traces.hxx"
+
+namespace BL
+{
+  class MainWindows_Wrap
+  {
+    
+    public:
+      MainWindows_Wrap() {}
+      virtual ~MainWindows_Wrap() {}
+
+      virtual QMainWindow * getDockParent() = 0;
+      virtual QMainWindow * getTabParent()  = 0;
+
+      virtual QAction* createAction(const QString& toolTip,
+                                   const QIcon& icon,
+                                   const QString& menu,
+                                   const QString& status,
+                                   const int shortCut,
+                                   QObject* parent =0,
+                                   bool checkable = false,
+                                   QObject* receiver =0,
+                                   const char* member =0) = 0;
+
+      virtual int createTopMenu(const QString & menu_name) = 0;
+      virtual void addActionToMenu(QAction * action, int menu_id) = 0;
+
+  };
+}
+
+#endif
diff --git a/src/wrappers/Makefile.am b/src/wrappers/Makefile.am
new file mode 100644 (file)
index 0000000..773d02e
--- /dev/null
@@ -0,0 +1,54 @@
+#  Copyright (C) 2009 CEA/DEN, EDF R&D
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+#  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+libdir = $(prefix)/lib/salome
+
+lib_LTLIBRARIES = libBL_Wrappers_Qt.la 
+
+if HAS_GUI
+lib_LTLIBRARIES += libBL_Wrappers_SALOME.la
+endif
+
+libBL_Wrappers_Qt_la_SOURCES = BL_MainWindows_Wrap.hxx \
+                              BL_MainWindows_Qt.cxx  BL_MainWindows_Qt.hxx
+
+nodist_libBL_Wrappers_Qt_la_SOURCES =
+
+libBL_Wrappers_Qt_la_CXXFLAGS = $(qt4_cppflags) -I$(top_srcdir)/src/bases
+
+libBL_Wrappers_Qt_la_LDFLAGS = $(qt4_ldflags) 
+
+libBL_Wrappers_Qt_la_LIBADD = -lQtGui -lQtCore $(top_builddir)/src/bases/libBL_Bases.la
+
+###########
+
+libBL_Wrappers_SALOME_la_SOURCES = BL_MainWindows_Wrap.hxx \
+                                  BL_MainWindows_SALOME.cxx  BL_MainWindows_SALOME.hxx
+
+nodist_libBL_Wrappers_SALOME_la_SOURCES =
+
+libBL_Wrappers_SALOME_la_CXXFLAGS = $(qt4_cppflags) -I$(top_srcdir)/src/bases \
+                                   $(OMNIORB_INCLUDES) \
+                                   -I$(KERNEL_ROOT_DIR)/include/salome \
+                                   -I$(GUI_ROOT_DIR)/include/salome
+
+libBL_Wrappers_SALOME_la_LDFLAGS = $(qt4_ldflags) 
+
+libBL_Wrappers_SALOME_la_LIBADD = -lQtGui -lQtCore $(top_builddir)/src/bases/libBL_Bases.la
+