IDLDIR =
endif
-SUBDIRS = $(IDLDIR) adm_local resources src doc bin
+SUBDIRS = $(IDLDIR) adm_local resources src doc bin tools/dlgfactory
DIST_SUBDIRS = idl adm_local resources src doc bin
src/GUI_PY/Makefile \
resources/Makefile \
idl/Makefile \
+ tools/dlgfactory/Makefile \
Makefile
])
--- /dev/null
+#include "GenericDialog.hxx"
+
+GenericDialog::GenericDialog(QDialog *parent) : QDialog(parent)
+{
+ ui.setupUi(this); // A faire en premier
+
+ /*
+ Personnalisez vos widgets ici si nécessaire
+ Réalisez des connexions supplémentaires entre signaux et slots
+ */
+
+ // The slots accept() and reject() are already connected to the
+ // buttonbox (inherited features)
+}
+
+QFrame * GenericDialog::getPanel() {
+ return ui.centralPanel;
+}
+
+QDialogButtonBox * GenericDialog::getButtonBox() {
+ return ui.buttonBox;
+}
+
+
+#include <QDebug>
+void GenericDialog::accept() {
+ qDebug() << "accept() is not implemented yet";
+ QDialog::accept();
+}
--- /dev/null
+#ifndef _GenericDialog_HXX
+#define _GenericDialog_HXX
+
+#include <QtGui>
+#include "ui_GenericDialog.hxx"
+
+class GenericDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ GenericDialog(QDialog *parent = 0);
+
+ protected:
+ QFrame * getPanel();
+ QDialogButtonBox * getButtonBox();
+
+ protected slots:
+ void accept();
+ //void reject();
+
+ private:
+ Ui_GenericDialog ui; // instance of the class defined in ui_GenericDialog.h
+};
+
+
+#endif // _GenericDialog_HXX
--- /dev/null
+<ui version="4.0" >
+ <class>GenericDialog</class>
+ <widget class="QDialog" name="GenericDialog" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Dialog</string>
+ </property>
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>9</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QFrame" name="centralPanel" >
+ <property name="frameShape" >
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow" >
+ <enum>QFrame::Raised</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons" >
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>GenericDialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>GenericDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
--- /dev/null
+# Copyright (C) 2010 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# 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
+#
+# -* Makefile *-
+#
+# Author : Guillaume Boulant (EDF/R&D)
+
+include $(top_srcdir)/adm_local/unix/make_common_starter.am
+
+# moc-files generation
+%_moc.cxx: %.hxx
+ $(MOC) $< -o $@
+
+# Qt form files generation (using UIC)
+ui_%.hxx: %.ui
+ $(UIC) -o $@ $<
+
+UIC_FILES_QDIALOG = \
+ ui_QDialogTest.hxx
+
+# MOC pre-processing
+MOC_FILES_QDIALOG = \
+ QDialogTest_moc.cxx
+
+BUILT_SOURCES = $(UIC_FILES_QDIALOG) $(UIC_FILES_GDIALOG)
+
+mostlyclean-local:
+ rm -f @builddir@/*_moc.cxx @builddir@/ui_*.hxx
+ rm @builddir@/QDialogTest*
+ rm @builddir@/GDialogTest*
+
+QDialogTest.ui: __QDIALOG__.ui __QDIALOG__.hxx __QDIALOG__.cxx dlgfactory.sh
+ $(srcdir)/dlgfactory.sh -n QDialogTest -t qdialog
+
+GDialogTest.ui: __GDIALOG__.ui __GDIALOG__.hxx __GDIALOG__.cxx dlgfactory.sh
+ $(srcdir)/dlgfactory.sh -n GDialogTest -t gdialog
+
+
+QT_CXXFLAGS=@QT_INCLUDES@ @QT_MT_INCLUDES@
+QT_LIBS=@QT_LIBS@
+
+# Program targets
+bin_PROGRAMS = qtester gtester
+
+# QDialog tester
+qtester_SOURCES = \
+ qtester.cxx \
+ QDialogTest.cxx \
+ $(MOC_FILES_QDIALOG) $(UIC_FILES_QDIALOG)
+
+qtester_CPPFLAGS = \
+ $(QT_CXXFLAGS)
+
+qtester_LDFLAGS = \
+ $(QT_LIBS)
+
+
+# GDialog tester
+MOC_FILES_GDIALOG= \
+ GenericDialog_moc.cxx \
+ GDialogTest_moc.cxx
+
+UIC_FILES_GDIALOG= \
+ ui_GenericDialog.hxx \
+ ui_GDialogTest.hxx
+
+gtester_SOURCES = \
+ gtester.cxx \
+ GenericDialog.cxx \
+ GDialogTest.cxx \
+ $(MOC_FILES_GDIALOG) $(UIC_FILES_GDIALOG)
+
+gtester_CPPFLAGS = \
+ $(QT_CXXFLAGS)
+
+gtester_LDFLAGS = \
+ $(QT_LIBS)
--- /dev/null
+This package provides a simple tool to generates the bootstrap files
+of a standard Qt dialog. Nothing original neither very smart, but just
+help to initiate all this stuff the good way.
+
+See the header of the script dlgfactory.sh for details.
+
+Some use cases (basic unit test) are given in the files qtester.cxx
+and gtester.cxx. The build procedure (when you type make) create test
+classes called QDialogTest and GDialogTest and used respectively in
+qtester and gtester.
+
+(gboulant - 26 oct. 2011)
--- /dev/null
+#include "__CLASSNAME__.hxx"
+
+__CLASSNAME__::__CLASSNAME__(QDialog *parent) : GenericDialog(parent)
+{
+ ui.setupUi(this->getPanel());
+}
--- /dev/null
+#ifndef ___CLASSNAME___HXX
+#define ___CLASSNAME___HXX
+
+#include <QtGui>
+#include "ui___CLASSNAME__.hxx"
+#include "GenericDialog.hxx"
+
+class __CLASSNAME__ : public GenericDialog
+{
+ Q_OBJECT
+
+ public:
+ __CLASSNAME__(QDialog *parent = 0);
+
+ private:
+ Ui___CLASSNAME__ ui; // instance of the class defined in ui___CLASSNAME__.hxx
+};
+
+
+#endif // ___CLASSNAME___HXX
--- /dev/null
+<ui version="4.0" >
+ <class>__CLASSNAME__</class>
+ <widget class="QWidget" name="__CLASSNAME__" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>340</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Form</string>
+ </property>
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>9</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string>Pression :</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_2" >
+ <property name="text" >
+ <string>Température :</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QLineEdit" name="lineEdit" />
+ </item>
+ <item>
+ <widget class="QLineEdit" name="lineEdit_2" />
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>121</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
--- /dev/null
+#include "__CLASSNAME__.hxx"
+
+__CLASSNAME__::__CLASSNAME__(QDialog *parent) : QDialog(parent)
+{
+ ui.setupUi(this); // A faire en premier
+
+ /*
+ Personnalisez vos widgets ici si nécessaire
+ Réalisez des connexions supplémentaires entre signaux et slots
+ */
+
+ // The slots accept() and reject() are already connected to the
+ // buttonbox (inherited features)
+}
+
+#include <QDebug>
+void __CLASSNAME__::accept() {
+ qDebug() << "accept() is not implemented yet";
+ QDialog::accept();
+}
--- /dev/null
+#ifndef ___CLASSNAME___HXX
+#define ___CLASSNAME___HXX
+
+#include <QtGui>
+#include "ui___CLASSNAME__.hxx"
+
+class __CLASSNAME__ : public QDialog
+{
+ Q_OBJECT
+
+ public:
+ __CLASSNAME__(QDialog *parent = 0);
+
+ protected slots:
+ void accept();
+ //void reject();
+
+ private:
+ Ui___CLASSNAME__ ui; // instance of the class defined in ui___CLASSNAME__.hxx
+};
+
+
+#endif // ___CLASSNAME___HXX
--- /dev/null
+<ui version="4.0" >
+ <class>__CLASSNAME__</class>
+ <widget class="QDialog" name="__CLASSNAME__" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Dialog</string>
+ </property>
+ <widget class="QDialogButtonBox" name="buttonBox" >
+ <property name="geometry" >
+ <rect>
+ <x>30</x>
+ <y>240</y>
+ <width>341</width>
+ <height>32</height>
+ </rect>
+ </property>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons" >
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>__CLASSNAME__</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>__CLASSNAME__</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
--- /dev/null
+#!/bin/sh
+#
+# ==================================================================
+#_debut_usage
+#
+# USAGE:
+#
+# dlgfactory.sh -n className [-t classType]
+#
+#
+# DESCRIPTION:
+#
+# This script generates a set of files to initiate a dialog qt window
+# (i.e. MyDialog.ui, MyDialog.hxx and MyDialog.cxx files).
+#
+# The dialog window can be a self-consistent class (i.e. depends only
+# on Qt classes) or a classe that inherits from the class
+# GenericDialog whose implementation is provided in this package and
+# whose design is defined by the GenericDialog.ui file (editable using
+# the qt designer).
+#
+# The -t option let you choose between the two possibilities (specify
+# "-t qdialog" for the first case, "-t gdialog" otherwise).
+#
+# OPTION:
+# -n : specify the name of the class (default is TestDialog)
+#
+# -t : specify the type of the class (default is qdialog)
+#
+#_fin_usage
+# ==================================================================
+#
+
+thisScript=$(which $0)
+TOOLDIRNAME=$(dirname $0)
+
+displayUsage()
+{
+ cat $thisScript | sed -e '/^#_debut_usage/,/^#_fin_usage/!d' \
+ -e '/^#_debut_usage/d' \
+ -e '/^#_fin_usage/d' \
+ -e 's/^#//g'
+}
+
+#
+# Read the options on the command line
+#
+className=TestDialog
+classType=dialog
+if [ $# -eq 0 ]; then
+ displayUsage
+ exit 1
+else
+ while [ $# -ne 0 ]; do
+ case $1 in
+ -n)
+ shift; className=$1; shift ;;
+ -t)
+ shift; classType=$1; shift ;;
+ *)
+ displayUsage;;
+ esac
+ done
+fi
+
+if [ "$classType" == "qdialog" ]; then
+ sed s/__CLASSNAME__/$className/g $TOOLDIRNAME/__QDIALOG__.ui > $className.ui
+ sed s/__CLASSNAME__/$className/g $TOOLDIRNAME/__QDIALOG__.hxx > $className.hxx
+ sed s/__CLASSNAME__/$className/g $TOOLDIRNAME/__QDIALOG__.cxx > $className.cxx
+else
+ sed s/__CLASSNAME__/$className/g $TOOLDIRNAME/__GDIALOG__.ui > $className.ui
+ sed s/__CLASSNAME__/$className/g $TOOLDIRNAME/__GDIALOG__.hxx > $className.hxx
+ sed s/__CLASSNAME__/$className/g $TOOLDIRNAME/__GDIALOG__.cxx > $className.cxx
+fi
+
+displayMessage()
+{
+ cat $thisScript | sed -e '/^#_debut_message/,/^#_fin_message/!d' \
+ -e '/^#_debut_message/d' \
+ -e '/^#_fin_message/d' \
+ -e 's/^#//g' \
+ -e "s/__CLASSNAME__/$className/g"
+}
+
+#_debut_message
+##
+## ---------------------------------------------------------
+## Generation rules to create moc files from QObject headers
+## and form source files from ui files
+## ---------------------------------------------------------
+##
+#%_moc.cxx: %.hxx
+# $(MOC) $< -o $@
+#
+#ui_%.hxx: %.ui
+# $(UIC) -o $@ $<
+#
+##
+## ---------------------------------------------------------
+## Declaration of form files generated by UIC and MOC files
+## as BUILT_SOURCES to be used in the building process.
+## ---------------------------------------------------------
+##
+#UIC_FILES = \
+# ui___CLASSNAME__.hxx
+##
+#MOC_FILES = \
+# __CLASSNAME___moc.cxx
+#
+#BUILT_SOURCES = $(UIC_FILES)
+#
+##
+## ---------------------------------------------------------
+## Declaration of sources files to the building process
+## ---------------------------------------------------------
+## MOC files and UIC files should be added to the list of undistributed
+## source files with something like (where <MyLibrary> should be
+## replaced by the name of the product declared by the directive
+## lib_LTLIBRARIES):
+##
+#nodist_<MyLibrary>_la_SOURCES += $(MOC_FILES) $(UIC_FILES)
+#
+#dist_<MyLibrary>_la_SOURCES += __CLASSNAME__.cxx
+#salomeinclude_HEADERS += __CLASSNAME__.hxx
+#
+#<MyLibrary>_la_CPPFLAGS = \
+# $(QT_CXXFLAGS)
+#
+#<MyLibrary>_la_LDFLAGS = \
+# $(QT_LIBS)
+
+#_fin_message
+
+echo "Note that the following directives should be present in your Makefile.am (or something like that):"
+echo ""
+displayMessage
+
--- /dev/null
+//
+// This program can be used for unit test of dialog box.
+// You just have to include the interface file (*.h) and
+// use the dialog class as illustrated in the functions TEST_*.
+// (gboulant - 12/10/2010)
+//
+#include <QApplication>
+#include <QtGui>
+#include "GDialogTest.hxx"
+
+void TEST_show() {
+ GDialogTest * dialog = new GDialogTest();
+ dialog->show();
+}
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ TEST_show();
+ return app.exec();
+}
--- /dev/null
+//
+// This program can be used for unit test of dialog box.
+// You just have to include the interface file (*.h) and
+// use the dialog class as illustrated in the functions TEST_*.
+// (gboulant - 12/10/2010)
+//
+#include <QApplication>
+#include <QtGui>
+#include "QDialogTest.hxx"
+
+void TEST_show() {
+ QDialogTest * dialog = new QDialogTest();
+ dialog->show();
+}
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ TEST_show();
+ return app.exec();
+}