From 8b645f521e38dedf374122e23f28450e05399405 Mon Sep 17 00:00:00 2001 From: mkr Date: Thu, 5 Jul 2007 08:28:11 +0000 Subject: [PATCH] Porting to Qt4. --- src/GEOMBase/GEOMBase.cxx | 126 +++++++++++------------- src/GEOMBase/GEOMBase.h | 3 +- src/GEOMBase/GEOMBase.pro | 55 +++++++++++ src/GEOMBase/GEOMBase_Helper.cxx | 58 ++++++----- src/GEOMBase/GEOMBase_Helper.h | 5 +- src/GEOMBase/GEOMBase_Skeleton.cxx | 57 ++++++++--- src/GEOMBase/GEOMBase_Skeleton.h | 17 +--- src/GEOMBase/GEOMBase_aParameterDlg.cxx | 60 +++++------ src/GEOMBase/GEOMBase_aParameterDlg.h | 8 +- src/GEOMGUI/GEOMGUI.pro | 4 +- src/src.pro | 2 +- 11 files changed, 227 insertions(+), 168 deletions(-) create mode 100644 src/GEOMBase/GEOMBase.pro diff --git a/src/GEOMBase/GEOMBase.cxx b/src/GEOMBase/GEOMBase.cxx index 230515df9..757f212d7 100644 --- a/src/GEOMBase/GEOMBase.cxx +++ b/src/GEOMBase/GEOMBase.cxx @@ -33,14 +33,7 @@ #include "GEOM_Client.hxx" //// SALOME Includes -#include "Utils_ORB_INIT.hxx" -#include "Utils_SINGLETON.hxx" - -#include "SALOME_LifeCycleCORBA.hxx" - -#include "GEOM_AssemblyBuilder.h" #include "GEOM_Actor.h" -#include "SVTK_RenderWindowInteractor.h" #include "SVTK_ViewModel.h" #include "SVTK_ViewWindow.h" #include "OCCViewer_ViewPort3d.h" @@ -49,9 +42,10 @@ #include "SALOME_ListIO.hxx" #include "SALOME_ListIteratorOfListIO.hxx" -#include "GEOM_AISTrihedron.hxx" +#include "SUIT_Desktop.h" #include "SUIT_Session.h" +#include "SUIT_ViewManager.h" #include "SUIT_ViewWindow.h" #include "SUIT_MessageBox.h" #include "SalomeApp_Application.h" @@ -63,33 +57,21 @@ #include #include -#include #include #include #include #include -#include -#include -#include -#include -#include #include #include #include -#include -#include #include -#include "GEOMImpl_Types.hxx" - using namespace std; -#include "SALOMEDSClient.hxx" - //===================================================================================== // function : GetShapeFromIOR() @@ -98,10 +80,10 @@ using namespace std; TopoDS_Shape GEOMBase::GetShapeFromIOR(QString IOR) { TopoDS_Shape result; - if(IOR.stripWhiteSpace().isEmpty()) + if(IOR.trimmed().isEmpty()) return result; - CORBA::Object_var obj = SalomeApp_Application::orb()->string_to_object((char*)(IOR.latin1())); + CORBA::Object_var obj = SalomeApp_Application::orb()->string_to_object(IOR.toLatin1().data()); if(CORBA::is_nil(obj)) return result; GEOM::GEOM_Object_var GeomObject = GEOM::GEOM_Object::_narrow( obj ); @@ -227,55 +209,55 @@ bool GEOMBase::GetShapeTypeString(const TopoDS_Shape& aShape, Standard_CString& { case TopAbs_COMPOUND: { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_COMPOUND")); + aTypeString = CORBA::string_dup(QObject::tr("GEOM_COMPOUND").toStdString().c_str()); return true; } case TopAbs_COMPSOLID: { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_COMPOUNDSOLID")) ; + aTypeString = CORBA::string_dup(QObject::tr("GEOM_COMPOUNDSOLID").toStdString().c_str()) ; return true ; } case TopAbs_SOLID: { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_SOLID")) ; + aTypeString = CORBA::string_dup(QObject::tr("GEOM_SOLID").toStdString().c_str()) ; return true ; } case TopAbs_SHELL: { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_SHELL")) ; + aTypeString = CORBA::string_dup(QObject::tr("GEOM_SHELL").toStdString().c_str()) ; return true ; } case TopAbs_FACE: { BRepAdaptor_Surface surf(TopoDS::Face(aShape)); if(surf.GetType() == GeomAbs_Plane) { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_PLANE")); + aTypeString = CORBA::string_dup(QObject::tr("GEOM_PLANE").toStdString().c_str()); return true; } else if(surf.GetType() == GeomAbs_Cylinder) { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_SURFCYLINDER")); + aTypeString = CORBA::string_dup(QObject::tr("GEOM_SURFCYLINDER").toStdString().c_str()); return true; } else if(surf.GetType() == GeomAbs_Sphere) { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_SURFSPHERE")); + aTypeString = CORBA::string_dup(QObject::tr("GEOM_SURFSPHERE").toStdString().c_str()); return true ; } else if(surf.GetType() == GeomAbs_Torus) { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_SURFTORUS")); + aTypeString = CORBA::string_dup(QObject::tr("GEOM_SURFTORUS").toStdString().c_str()); return true ; } else if(surf.GetType() == GeomAbs_Cone) { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_SURFCONE")); + aTypeString = CORBA::string_dup(QObject::tr("GEOM_SURFCONE").toStdString().c_str()); return true ; } else { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_FACE")); + aTypeString = CORBA::string_dup(QObject::tr("GEOM_FACE").toStdString().c_str()); return true; } } case TopAbs_WIRE: { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_WIRE")); + aTypeString = CORBA::string_dup(QObject::tr("GEOM_WIRE").toStdString().c_str()); return true; } case TopAbs_EDGE: @@ -283,31 +265,31 @@ bool GEOMBase::GetShapeTypeString(const TopoDS_Shape& aShape, Standard_CString& BRepAdaptor_Curve curv(TopoDS::Edge(aShape)); if(curv.GetType() == GeomAbs_Line) { if((Abs(curv.FirstParameter()) >= 1E6) || (Abs(curv.LastParameter()) >= 1E6)) - aTypeString = CORBA::string_dup(QObject::tr("GEOM_LINE")); + aTypeString = CORBA::string_dup(QObject::tr("GEOM_LINE").toStdString().c_str()); else - aTypeString = CORBA::string_dup(QObject::tr("GEOM_EDGE")); + aTypeString = CORBA::string_dup(QObject::tr("GEOM_EDGE").toStdString().c_str()); return true; } else if(curv.GetType() == GeomAbs_Circle) { if(curv.IsClosed()) - aTypeString = CORBA::string_dup(QObject::tr("GEOM_CIRCLE")); + aTypeString = CORBA::string_dup(QObject::tr("GEOM_CIRCLE").toStdString().c_str()); else - aTypeString = CORBA::string_dup(QObject::tr("GEOM_ARC")); + aTypeString = CORBA::string_dup(QObject::tr("GEOM_ARC").toStdString().c_str()); return true; } else { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_EDGE")); + aTypeString = CORBA::string_dup(QObject::tr("GEOM_EDGE").toStdString().c_str()); return true; } } case TopAbs_VERTEX: { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_VERTEX")); + aTypeString = CORBA::string_dup(QObject::tr("GEOM_VERTEX").toStdString().c_str()); return true; } case TopAbs_SHAPE: { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_SHAPE")); + aTypeString = CORBA::string_dup(QObject::tr("GEOM_SHAPE").toStdString().c_str()); return true; } } @@ -332,11 +314,13 @@ Handle(GEOM_AISShape) GEOMBase::ConvertIORinGEOMAISShape(const char * IOR, Stand if ( !anObj ) return resultShape; - QPtrList aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows(); + QList aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows(); - for ( QPtrListIterator it( aViewWindowsList ); it.current(); ++it ) { - if (it.current()->getViewManager()->getType() == OCCViewer_Viewer::Type()) { - Handle (AIS_InteractiveContext) ic = ((OCCViewer_Viewer*)it.current()->getViewManager()->getViewModel())->getAISContext(); + QListIterator it( aViewWindowsList ); + while ( it.hasNext() ) { + SUIT_ViewWindow* aVW = it.next(); + if (aVW && aVW->getViewManager()->getType() == OCCViewer_Viewer::Type()) { + Handle (AIS_InteractiveContext) ic = ((OCCViewer_Viewer*)aVW->getViewManager()->getViewModel())->getAISContext(); AIS_ListOfInteractive List; ic->DisplayedObjects(List); @@ -352,7 +336,7 @@ Handle(GEOM_AISShape) GEOMBase::ConvertIORinGEOMAISShape(const char * IOR, Stand Handle(SALOME_InteractiveObject) GIO = Handle(SALOME_InteractiveObject)::DownCast(aSh->getIO()); if(GIO->hasEntry() && strcmp(GIO->getEntry(), anObj->GetID().c_str()) == 0) { if(!onlyInActiveView || - it.current() == SUIT_Session::session()->activeApplication()->desktop()->activeWindow()) { + aVW == SUIT_Session::session()->activeApplication()->desktop()->activeWindow()) { testResult = true; resultShape = aSh; return resultShape; @@ -384,11 +368,13 @@ GEOM_Actor* GEOMBase::ConvertIORinGEOMActor(const char* IOR, Standard_Boolean& t if ( !anObj ) return GEOM_Actor::New(); - QPtrList aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows(); + QList aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows(); - for ( QPtrListIterator it( aViewWindowsList ); it.current(); ++it ) { - if (it.current()->getViewManager()->getType() == SVTK_Viewer::Type()) { - SVTK_ViewWindow* aVTKViewWindow = dynamic_cast( it.current() ); + QListIterator it( aViewWindowsList ); + while ( it.hasNext() ) { + SUIT_ViewWindow* aVW = it.next(); + if (aVW && aVW->getViewManager()->getType() == SVTK_Viewer::Type()) { + SVTK_ViewWindow* aVTKViewWindow = dynamic_cast( aVW ); if( !aVTKViewWindow ) continue; vtkRenderer* Renderer = aVTKViewWindow->getRenderer(); @@ -402,7 +388,7 @@ GEOM_Actor* GEOMBase::ConvertIORinGEOMActor(const char* IOR, Standard_Boolean& t Handle(SALOME_InteractiveObject) GIO = Handle(SALOME_InteractiveObject)::DownCast(anActor->getIO()); if(GIO->hasEntry() && strcmp(GIO->getEntry(), anObj->GetID().c_str()) == 0) { if(!onlyInActiveView || - it.current() == SUIT_Session::session()->activeApplication()->desktop()->activeWindow()) { + aVW == SUIT_Session::session()->activeApplication()->desktop()->activeWindow()) { testResult = true; return anActor; } @@ -427,12 +413,14 @@ Handle(AIS_InteractiveObject) GEOMBase::GetAIS( const Handle(SALOME_InteractiveO if ( theIO.IsNull() || !theIO->hasEntry() ) return Handle(AIS_InteractiveObject)(); - QPtrList aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows(); + QList aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows(); - for ( QPtrListIterator it( aViewWindowsList ); it.current(); ++it ) { - if (it.current()->getViewManager()->getType() != OCCViewer_Viewer::Type()) + QListIterator it( aViewWindowsList ); + while ( it.hasNext() ) { + SUIT_ViewWindow* aVW = it.next(); + if (!aVW || aVW->getViewManager()->getType() != OCCViewer_Viewer::Type()) continue; - Handle (AIS_InteractiveContext) anIC = ((OCCViewer_Viewer*)it.current()->getViewManager()->getViewModel())->getAISContext(); + Handle (AIS_InteractiveContext) anIC = ((OCCViewer_Viewer*)aVW->getViewManager()->getViewModel())->getAISContext(); AIS_ListOfInteractive aList; anIC->DisplayedObjects( aList ); @@ -448,7 +436,7 @@ Handle(AIS_InteractiveObject) GEOMBase::GetAIS( const Handle(SALOME_InteractiveO { if( isOnlyInActiveView ) { - if ( it.current() == SUIT_Session::session()->activeApplication()->desktop()->activeWindow() ) + if ( aVW == SUIT_Session::session()->activeApplication()->desktop()->activeWindow() ) return anIter.Value(); } else @@ -475,11 +463,13 @@ Handle(GEOM_AISShape) GEOMBase::ConvertIOinGEOMAISShape(const Handle(SALOME_Inte return res; } - QPtrList aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows(); + QList aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows(); - for ( QPtrListIterator it( aViewWindowsList ); it.current(); ++it ) { - if (it.current()->getViewManager()->getType() == OCCViewer_Viewer::Type()) { - Handle (AIS_InteractiveContext) ic = ((OCCViewer_Viewer*)it.current()->getViewManager()->getViewModel())->getAISContext(); + QListIterator it( aViewWindowsList ); + while ( it.hasNext() ) { + SUIT_ViewWindow* aVW = it.next(); + if (aVW && aVW->getViewManager()->getType() == OCCViewer_Viewer::Type()) { + Handle (AIS_InteractiveContext) ic = ((OCCViewer_Viewer*)aVW->getViewManager()->getViewModel())->getAISContext(); AIS_ListOfInteractive List; ic->DisplayedObjects(List); @@ -499,7 +489,7 @@ Handle(GEOM_AISShape) GEOMBase::ConvertIOinGEOMAISShape(const Handle(SALOME_Inte { if(onlyInActiveView) { - if(it.current() == SUIT_Session::session()->activeApplication()->desktop()->activeWindow()) + if(aVW == SUIT_Session::session()->activeApplication()->desktop()->activeWindow()) { testResult = true; return aSh; @@ -795,13 +785,13 @@ bool GEOMBase::SelectionByNameInDialogs(QWidget* aWidget, const QString& objectU _PTR(Study) ST = appStudy->studyDS(); std::vector<_PTR(SObject)> listSO; - listSO = ST->FindObjectByName(objectUserName.latin1(), "GEOM"); + listSO = ST->FindObjectByName(objectUserName.toStdString(), "GEOM"); if(listSO.size() < 1) { const QString caption = QObject::tr("GEOM_WRN_WARNING"); const QString text = QObject::tr("GEOM_NAME_INCORRECT"); const QString button0 = QObject::tr("GEOM_BUT_OK"); - SUIT_MessageBox::error1(aWidget, caption, text, button0); + SUIT_MessageBox::critical(aWidget, caption, text, button0); return false; } /* More than one object with same name */ @@ -809,14 +799,14 @@ bool GEOMBase::SelectionByNameInDialogs(QWidget* aWidget, const QString& objectU const QString caption = QObject::tr("GEOM_WRN_WARNING"); const QString text = QObject::tr("GEOM_IDENTICAL_NAMES_SELECT_BY_MOUSE"); const QString button0 = QObject::tr("GEOM_BUT_OK") ; - SUIT_MessageBox::error1(aWidget, caption, text, button0) ; + SUIT_MessageBox::critical(aWidget, caption, text, button0) ; listSO.clear(); return false; } _PTR(SObject) theObj ( listSO[0] ); /* Create a SALOME_InteractiveObject with a SALOME::SObject */ - char* aCopyobjectUserName = CORBA::string_dup(objectUserName); + char* aCopyobjectUserName = CORBA::string_dup(objectUserName.toStdString().c_str()); Handle(SALOME_InteractiveObject) SI = new SALOME_InteractiveObject(theObj->GetID().c_str(), "GEOM", aCopyobjectUserName); delete(aCopyobjectUserName); @@ -873,7 +863,7 @@ QString GEOMBase::GetDefaultName(const QString& theOperation) bool isUnique = false; while (!isUnique) { aName = theOperation + "_" + QString::number(++aNumber); - isUnique = (aSet.count(aName.latin1()) == 0); + isUnique = (aSet.count(aName.toStdString()) == 0); } return aName; @@ -891,12 +881,12 @@ void GEOMBase::ShowErrorMessage(const char* theErrorCode, const char* theComment QString aText = ""; if (!anErrorCode.isEmpty()) - aText.append("\n" + QObject::tr(anErrorCode)); + aText.append("\n" + QObject::tr(anErrorCode.toStdString().c_str())); if (!aComment.isEmpty()) aText.append("\n" + QString(theComment)); - SUIT_MessageBox::error1( SUIT_Session::session()->activeApplication()->desktop(), QObject::tr( "GEOM_ERROR" ), - QObject::tr("GEOM_PRP_ABORT") + aText, "OK" ); + SUIT_MessageBox::critical( SUIT_Session::session()->activeApplication()->desktop(), QObject::tr( "GEOM_ERROR" ), + QObject::tr("GEOM_PRP_ABORT") + aText, "OK" ); } diff --git a/src/GEOMBase/GEOMBase.h b/src/GEOMBase/GEOMBase.h index ff3feecbb..400db37bb 100644 --- a/src/GEOMBase/GEOMBase.h +++ b/src/GEOMBase/GEOMBase.h @@ -40,11 +40,10 @@ #include CORBA_SERVER_HEADER(GEOM_Gen) // QT Includes -#include +#include class GEOM_Actor; class SALOME_ListIO; -class TColStd_MapOfInteger; class QWidget; diff --git a/src/GEOMBase/GEOMBase.pro b/src/GEOMBase/GEOMBase.pro new file mode 100644 index 000000000..7adf75897 --- /dev/null +++ b/src/GEOMBase/GEOMBase.pro @@ -0,0 +1,55 @@ +TEMPLATE = lib +TARGET = GEOMBase +DESTDIR = ../../lib +MOC_DIR = ../../moc +OBJECTS_DIR = ../../obj/$$TARGET + +QT_INCLUDES = $$(QTDIR)/include $$(QTDIR)/include/QtCore $$(QTDIR)/include/QtGui $$(QTDIR)/include/QtOpenGL $$(QTDIR)/include/QtXml + +VTK_INCLUDES = $$(VTKHOME)/include/vtk + +CASROOT = $$(CASROOT) +CAS_CPPFLAGS = $${CASROOT}/inc + +PYTHON_INCLUDES = $$(PYTHONHOME)/include/python2.4 + +BOOST_CPPFLAGS = $$(BOOSTDIR)/include + +KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome + +GUI_CXXFLAGS = $$(GUI_ROOT_DIR)/include/salome + +CORBA_INCLUDES = $$(OMNIORBDIR)/include $$(OMNIORBDIR)/include/omniORB4 $$(OMNIORBDIR)/include/COS + +KERNEL_LDFLAGS = -L$$(KERNEL_ROOT_DIR)/lib/salome + +GUI_LDFLAGS = -L$$(GUI_ROOT_DIR)/lib/salome + +CAS_LDPATH = -L$${CASROOT}/Linux/lib + +INCLUDEPATH += $${QT_INCLUDES} $${VTK_INCLUDES} $${CAS_CPPFLAGS} $${PYTHON_INCLUDES} $${BOOST_CPPFLAGS} $${KERNEL_CXXFLAGS} $${GUI_CXXFLAGS} $${CORBA_INCLUDES} ../OBJECT ../GEOMClient ../GEOMImpl ../GEOMGUI ../DlgRef $$(GEOM_ROOT_DIR)/idl $$(GEOM_ROOT_DIR)/salome_adm/unix + +LIBS += -L$$(GEOM_ROOT_DIR)/idl -lSalomeIDLGEOM -L$$(GEOM_ROOT_DIR)/lib -lGEOM -lDlgRef $${KERNEL_LDFLAGS} -lOpUtil $${GUI_LDFLAGS} -lsuit -lOCCViewer -lVTKViewer -lSVTK -lSalomePrs -lSalomeApp -lCAM $${CAS_LDPATH} -lTKPrim + +CONFIG -= debug release debug_and_release +CONFIG += qt thread debug dll shared + +win32:DEFINES += WIN32 +DEFINES += GEOMBASE_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS OMNIORB_VERSION=4 __x86__ __linux__ COMP_CORBA_DOUBLE COMP_CORBA_LONG + +HEADERS = GEOMBase.h +HEADERS += GEOMBase_Skeleton.h +HEADERS += GEOMBase_Helper.h +HEADERS += GEOM_Operation.h +HEADERS += GEOM_GEOMBase.hxx + +SOURCES = GEOMBase.cxx +SOURCES += GEOMBase_Skeleton.cxx +SOURCES += GEOMBase_aParameterDlg.cxx +SOURCES += GEOMBase_Helper.cxx +SOURCES += GEOM_Operation.cxx + +includes.files = $$HEADERS +includes.path = ../../include + +INSTALLS += includes diff --git a/src/GEOMBase/GEOMBase_Helper.cxx b/src/GEOMBase/GEOMBase_Helper.cxx index efa81ac91..89117dceb 100755 --- a/src/GEOMBase/GEOMBase_Helper.cxx +++ b/src/GEOMBase/GEOMBase_Helper.cxx @@ -32,10 +32,10 @@ #include "GEOMBase.h" #include "GEOM_Operation.h" #include "GeometryGUI.h" -#include "GEOM_Displayer.h" -#include "GEOMImpl_Types.hxx" +#include #include +#include #include #include #include @@ -46,21 +46,17 @@ #include #include #include -#include + +#include "SALOME_Prs.h" #include #include -#include - #include #include using namespace std; -#include - - //================================================================ // Function : getActiveView // Purpose : Get active view window, returns 0 if no open study frame @@ -173,7 +169,7 @@ void GEOMBase_Helper::erase( GEOM::GEOM_Object_ptr object, const bool updateView if ( !object->_is_nil() ) { string entry = getEntry( object ); getDisplayer()->Erase( new SALOME_InteractiveObject( - entry.c_str(), "GEOM", strdup( GEOMBase::GetName( object ) ) ), true, updateView ); + entry.c_str(), "GEOM", strdup( GEOMBase::GetName( object ).toStdString().c_str() ) ), true, updateView ); } } @@ -212,7 +208,7 @@ void GEOMBase_Helper::redisplay( GEOM::GEOM_Object_ptr object, string entry = getEntry( object ); getDisplayer()->Redisplay(new SALOME_InteractiveObject - (entry.c_str(), "GEOM", strdup(GEOMBase::GetName(object))), false); + (entry.c_str(), "GEOM", strdup(GEOMBase::GetName(object).toStdString().c_str())), false); } if ( withChildren ) { @@ -230,7 +226,7 @@ void GEOMBase_Helper::redisplay( GEOM::GEOM_Object_ptr object, if ( !aChild->_is_nil() ) { string entry = getEntry( aChild ); getDisplayer()->Redisplay( new SALOME_InteractiveObject( - entry.c_str(), "GEOM", strdup( GEOMBase::GetName( aChild ) ) ), false ); + entry.c_str(), "GEOM", strdup( GEOMBase::GetName( aChild ).toStdString().c_str() ) ), false ); } } } @@ -452,7 +448,7 @@ void GEOMBase_Helper::localSelection( const ObjectList& theObjs, const int theMo string aEntry = getEntry( anObj ); if ( aEntry != "" ) aListOfIO.Append( new SALOME_InteractiveObject( - aEntry.c_str(), "GEOM", strdup( GEOMBase::GetName( anObj ) ) ) ); + aEntry.c_str(), "GEOM", strdup( GEOMBase::GetName( anObj ).toStdString().c_str() ) ) ); } getDisplayer()->LocalSelection( aListOfIO, theMode ); @@ -565,13 +561,14 @@ SalomeApp_Study* GEOMBase_Helper::getStudy() const if (!aDesktop) return 0; - QPtrList anAppList = SUIT_Session::session()->applications(); + QList anAppList = SUIT_Session::session()->applications(); SUIT_Application* anApp = 0; - for ( QPtrListIterator it( anAppList ); it.current() ; ++it ) + QListIterator it( anAppList ); + while ( it.hasNext() ) { - anApp = it.current(); - if ( anApp->desktop() == aDesktop ) + anApp = it.next(); + if ( anApp && anApp->desktop() == aDesktop ) break; } @@ -722,10 +719,11 @@ GEOM::GEOM_IOperations_ptr GEOMBase_Helper::getOperation() bool GEOMBase_Helper::checkViewWindow() { if ( myViewWindow ){ - QPtrList aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows(); - for ( QPtrListIterator it( aViewWindowsList ); it.current(); ++it ) + QList aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows(); + QListIterator it( aViewWindowsList ); + while ( it.hasNext() ) { - if ( myViewWindow == it.current() ) + if ( myViewWindow == it.next() ) return true; } } @@ -748,10 +746,10 @@ bool GEOMBase_Helper::onAccept( const bool publish, const bool useTransaction ) bool aLocked = (_PTR(AttributeStudyProperties) (aStudy->GetProperties()))->IsLocked(); if ( aLocked ) { MESSAGE("GEOMBase_Helper::onAccept - ActiveStudy is locked"); - SUIT_MessageBox::warn1 ( (QWidget*)SUIT_Session::session()->activeApplication()->desktop(), - QObject::tr("WRN_WARNING"), - QObject::tr("WRN_STUDY_LOCKED"), - QObject::tr("BUT_OK") ); + SUIT_MessageBox::warning ( (QWidget*)SUIT_Session::session()->activeApplication()->desktop(), + QObject::tr("WRN_WARNING"), + QObject::tr("WRN_STUDY_LOCKED"), + QObject::tr("BUT_OK") ); return false; } @@ -794,7 +792,7 @@ bool GEOMBase_Helper::onAccept( const bool publish, const bool useTransaction ) if ( aName.isEmpty() ) aName = GEOMBase::GetDefaultName( getPrefix( *it ) ); } - addInStudy( *it, aName.latin1() ); + addInStudy( *it, aName.toLatin1() ); // updateView=false display( *it, false ); } @@ -841,10 +839,10 @@ void GEOMBase_Helper::showError() if ( msg.isEmpty() ) msg = QObject::tr( "GEOM_PRP_ABORT" ); - SUIT_MessageBox::error1( SUIT_Session::session()->activeApplication()->desktop(), - QObject::tr( "GEOM_ERROR_STATUS" ), - msg, - QObject::tr( "BUT_OK" ) ); + SUIT_MessageBox::critical( SUIT_Session::session()->activeApplication()->desktop(), + QObject::tr( "GEOM_ERROR_STATUS" ), + msg, + QObject::tr( "BUT_OK" ) ); } //================================================================ @@ -856,7 +854,7 @@ void GEOMBase_Helper::showError( const QString& msg ) QString str( QObject::tr( "GEOM_INCORRECT_INPUT" ) ); if ( !msg.isEmpty() ) str += "\n" + msg; - SUIT_MessageBox::error1(SUIT_Session::session()->activeApplication()->desktop(), QObject::tr( "GEOM_ERROR" ), str, QObject::tr( "BUT_OK" ) ); + SUIT_MessageBox::critical(SUIT_Session::session()->activeApplication()->desktop(), QObject::tr( "GEOM_ERROR" ), str, QObject::tr( "BUT_OK" ) ); } ////////////////////////////////////////////////////////////////// @@ -1033,4 +1031,4 @@ bool GEOMBase_Helper::selectObjects( ObjectList& objects ) - \ No newline at end of file + diff --git a/src/GEOMBase/GEOMBase_Helper.h b/src/GEOMBase/GEOMBase_Helper.h index e8c689864..9dace227f 100755 --- a/src/GEOMBase/GEOMBase_Helper.h +++ b/src/GEOMBase/GEOMBase_Helper.h @@ -32,12 +32,11 @@ #include "GEOM_GEOMBase.hxx" #include "GEOM_Displayer.h" -#include "SALOME_Prs.h" #include "SALOME_ListIO.hxx" #include #include CORBA_CLIENT_HEADER(GEOM_Gen) -#include +#include #include @@ -46,8 +45,8 @@ typedef std::list ObjectList; class SalomeApp_Study; class SUIT_Desktop; class SUIT_ViewWindow; +class SALOME_Prs; class GEOM_Operation; -class TopoDS_Shape; class TColStd_MapOfInteger; //================================================================ diff --git a/src/GEOMBase/GEOMBase_Skeleton.cxx b/src/GEOMBase/GEOMBase_Skeleton.cxx index 33a6fe5ac..87ff614d4 100644 --- a/src/GEOMBase/GEOMBase_Skeleton.cxx +++ b/src/GEOMBase/GEOMBase_Skeleton.cxx @@ -27,16 +27,19 @@ // $Header$ #include "GEOMBase_Skeleton.h" +#include "GEOMBase.h" #include "GeometryGUI.h" #include "SalomeApp_Application.h" #include "LightApp_Application.h" #include "LightApp_SelectionMgr.h" +#include "SUIT_Desktop.h" +#include "SUIT_ResourceMgr.h" #include "SUIT_Session.h" #include "SUIT_MessageBox.h" -#include +#include using namespace std; @@ -48,23 +51,43 @@ using namespace std; // TRUE to construct a modal dialog. //================================================================================= GEOMBase_Skeleton::GEOMBase_Skeleton(GeometryGUI* theGeometryGUI, QWidget* parent, - const char* name, bool modal, WFlags fl) - : DlgRef_Skeleton_QTD( parent, name, modal, WStyle_Customize | WStyle_NormalBorder - | WStyle_Title | WStyle_SysMenu | WDestructiveClose ), - GEOMBase_Helper( dynamic_cast( parent ) ), - myGeomGUI( theGeometryGUI ) + const char* name, bool modal, Qt::WindowFlags fl) + : QDialog( parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint ), + GEOMBase_Helper( dynamic_cast( parent ) ), + myGeomGUI( theGeometryGUI ), + myRBGroup( 0 ) { + setupUi(this); + if (!name) - setName("GEOMBase_Skeleton"); + setObjectName("GEOMBase_Skeleton"); + else + setObjectName(name); + + setModal( modal ); + setAttribute( Qt::WA_DeleteOnClose ); buttonCancel->setText(tr("GEOM_BUT_CLOSE")); buttonOk->setText(tr("GEOM_BUT_OK")); buttonApply->setText(tr("GEOM_BUT_APPLY")); buttonHelp->setText(tr("GEOM_BUT_HELP")); - GroupMedium->close(TRUE); + GroupMedium->setAttribute( Qt::WA_DeleteOnClose ); + GroupMedium->close(); resize(0, 0); + if ( GroupConstructors != NULL ) { + myRBGroup = new QButtonGroup(GroupConstructors); + QList aRadioButtons = GroupConstructors->children(); + QListIterator it( aRadioButtons ); + int anId = 0; + while ( it.hasNext() ) + if ( QRadioButton* aRB = ::qobject_cast( it.next() ) ) { + myRBGroup->addButton( aRB, anId ); + anId++; + } + } + Init(); } @@ -204,7 +227,7 @@ void GEOMBase_Skeleton::initName( const char* thePrefix ) //================================================================================= const char* GEOMBase_Skeleton::getNewObjectName() const { - return ResultName->text(); + return ResultName->text().toStdString().c_str(); } //================================================================================= @@ -213,8 +236,12 @@ const char* GEOMBase_Skeleton::getNewObjectName() const //================================================================================= int GEOMBase_Skeleton::getConstructorId() const { - if ( GroupConstructors != NULL && GroupConstructors->selected() != NULL ) + /*if ( GroupConstructors != NULL && GroupConstructors->selected() != NULL ) return GroupConstructors->id( GroupConstructors->selected() ); + return -1;*/ + + if ( myRBGroup != NULL ) + return myRBGroup->checkedId(); return -1; } @@ -234,10 +261,10 @@ void GEOMBase_Skeleton::ClickOnHelp() #else platform = "application"; #endif - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning(0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), + QObject::tr("BUT_OK")); } } //================================================================================= @@ -260,7 +287,7 @@ void GEOMBase_Skeleton::keyPressEvent( QKeyEvent* e ) if ( e->isAccepted() ) return; - if ( e->key() == Key_F1 ) + if ( e->key() == Qt::Key_F1 ) { e->accept(); ClickOnHelp(); diff --git a/src/GEOMBase/GEOMBase_Skeleton.h b/src/GEOMBase/GEOMBase_Skeleton.h index fdd00155b..f6022d001 100644 --- a/src/GEOMBase/GEOMBase_Skeleton.h +++ b/src/GEOMBase/GEOMBase_Skeleton.h @@ -31,26 +31,17 @@ #include "GEOM_GEOMBase.hxx" #include "DlgRef_Skeleton_QTD.h" - -#include "GEOMBase.h" #include "GEOMBase_Helper.h" -#include "GeometryGUI.h" -#include -#include -#include -#include -#include -#include -#include +class GeometryGUI; -class GEOMBASE_EXPORT GEOMBase_Skeleton : public DlgRef_Skeleton_QTD, public GEOMBase_Helper +class GEOMBASE_EXPORT GEOMBase_Skeleton : public QDialog, public Ui::DlgRef_Skeleton_QTD, public GEOMBase_Helper { Q_OBJECT public: GEOMBase_Skeleton(GeometryGUI* theGeometryGUI, QWidget* parent = 0, - const char* name = 0, bool modal = FALSE, WFlags fl = 0); + const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); ~GEOMBase_Skeleton(); private: @@ -77,6 +68,8 @@ protected: QLineEdit* myEditCurrentArgument; //!< Current LineEdit GeometryGUI* myGeomGUI; //!< reference GEOM GUI QString myHelpFileName; + + QButtonGroup* myRBGroup; protected slots: virtual void ClickOnCancel(); diff --git a/src/GEOMBase/GEOMBase_aParameterDlg.cxx b/src/GEOMBase/GEOMBase_aParameterDlg.cxx index ef6097e18..66391833d 100644 --- a/src/GEOMBase/GEOMBase_aParameterDlg.cxx +++ b/src/GEOMBase/GEOMBase_aParameterDlg.cxx @@ -27,16 +27,12 @@ // $Header$ #include "GEOMBase_aParameterDlg.h" -#include "QtxDblSpinBox.h" +#include "QtxDoubleSpinBox.h" -#include - -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include #ifndef WNT using namespace std; @@ -60,53 +56,56 @@ using namespace std; // TRUE to construct a modal dialog. // //====================================================================================== -GEOMBase_aParameterDlg::GEOMBase_aParameterDlg(const char *aValue1, const char *aTitle1, QWidget* parent, const char* name, bool modal, WFlags fl, const double bottom, const double top, const int decimals) - :QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +GEOMBase_aParameterDlg::GEOMBase_aParameterDlg(const char *aValue1, const char *aTitle1, QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl, const double bottom, const double top, const int decimals) + :QDialog( parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint ) { if(!name) - setName( "MyParameterDialog" ); + setObjectName( "MyParameterDialog" ); + else + setObjectName( name ); + + setModal( modal ); + resize(288, 81); - setCaption(name); /* appears on the title bar */ + setWindowTitle(name); /* appears on the title bar */ setSizeGripEnabled(TRUE); QGridLayout* topLayout = new QGridLayout(this); topLayout->setSpacing(6); topLayout->setMargin(11); - QGroupBox* mainGrp = new QGroupBox(this, "mainGrp"); - mainGrp->setColumnLayout(0, Qt::Vertical); - mainGrp->layout()->setSpacing(0); - mainGrp->layout()->setMargin(0); - QGridLayout* mainGrpLayout = new QGridLayout(mainGrp->layout()); + QGroupBox* mainGrp = new QGroupBox(this); + mainGrp->setObjectName("mainGrp"); + QGridLayout* mainGrpLayout = new QGridLayout(mainGrp); mainGrpLayout->setAlignment(Qt::AlignTop); - mainGrpLayout ->setSpacing(6); + mainGrpLayout->setSpacing(6); mainGrpLayout->setMargin(11); topLayout->addWidget(mainGrp, 0, 0); /* aTitle1 : text prompt on left of edit line */ - QLabel* TextLabel1 = new QLabel(mainGrp, "TextLabel1"); + QLabel* TextLabel1 = new QLabel(mainGrp); + TextLabel1->setObjectName("TextLabel1"); TextLabel1->setText(tr(aTitle1)); mainGrpLayout->addWidget(TextLabel1, 0, 0); - mySpinBox = new QtxDblSpinBox(mainGrp, "mySpinBox"); - mySpinBox->setPrecision(12); + mySpinBox = new QtxDoubleSpinBox(mainGrp); + mySpinBox->setObjectName("mySpinBox"); + mySpinBox->setDecimals(decimals); mySpinBox->setRange(bottom, top); - ((QDoubleValidator*)(mySpinBox->validator()))->setRange(bottom, top, decimals); mySpinBox->setValue(QString(aValue1).toDouble()); mainGrpLayout->addWidget(mySpinBox, 0, 1); - QGroupBox* btnGrp = new QGroupBox(this, "btnGrp"); - btnGrp->setColumnLayout(0, Qt::Vertical); - btnGrp->layout()->setSpacing(0); - btnGrp->layout()->setMargin(0); - QGridLayout* btnGrpLayout = new QGridLayout(btnGrp->layout()); + QGroupBox* btnGrp = new QGroupBox(this); + btnGrp->setObjectName("btnGrp"); + QGridLayout* btnGrpLayout = new QGridLayout(btnGrp); btnGrpLayout->setAlignment(Qt::AlignTop); btnGrpLayout->setSpacing(6); btnGrpLayout->setMargin(11); topLayout->addWidget(btnGrp, 1, 0); /* Ok button */ - myButtonOk = new QPushButton(btnGrp, "buttonOk"); + myButtonOk = new QPushButton(btnGrp); + myButtonOk->setObjectName("buttonOk"); myButtonOk->setText(tr("GEOM_BUT_OK")); myButtonOk->setAutoDefault(TRUE); myButtonOk->setDefault(TRUE); @@ -115,7 +114,8 @@ GEOMBase_aParameterDlg::GEOMBase_aParameterDlg(const char *aValue1, const char * btnGrpLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1); /* Cancel button */ - myButtonCancel = new QPushButton(btnGrp, "buttonCancel"); + myButtonCancel = new QPushButton(btnGrp); + myButtonCancel->setObjectName("buttonCancel"); myButtonCancel->setText(tr("GEOM_BUT_CANCEL")); myButtonCancel->setAutoDefault(TRUE); btnGrpLayout->addWidget(myButtonCancel, 0, 2); diff --git a/src/GEOMBase/GEOMBase_aParameterDlg.h b/src/GEOMBase/GEOMBase_aParameterDlg.h index 8dc1773f7..1f27f6fb8 100644 --- a/src/GEOMBase/GEOMBase_aParameterDlg.h +++ b/src/GEOMBase/GEOMBase_aParameterDlg.h @@ -31,10 +31,10 @@ #include "GEOM_GEOMBase.hxx" -#include +#include class QPushButton; -class QtxDblSpinBox; +class QtxDoubleSpinBox; //================================================================================= // class : GEOMBase_aParameterDlg @@ -45,7 +45,7 @@ class GEOMBASE_EXPORT GEOMBase_aParameterDlg : public QDialog Q_OBJECT public: - GEOMBase_aParameterDlg(const char* aValue1 = "25", const char* aTitle1 = "Value :", QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0, const double bottom = -1E6, const double top = +1E6, const int decimals = 6); + GEOMBase_aParameterDlg(const char* aValue1 = "25", const char* aTitle1 = "Value :", QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0, const double bottom = -1E6, const double top = +1E6, const int decimals = 6); ~GEOMBase_aParameterDlg(); void setValue(double val); @@ -54,7 +54,7 @@ public: private: QPushButton* myButtonOk; QPushButton* myButtonCancel; - QtxDblSpinBox* mySpinBox; + QtxDoubleSpinBox* mySpinBox; }; diff --git a/src/GEOMGUI/GEOMGUI.pro b/src/GEOMGUI/GEOMGUI.pro index 50e17fb0a..62a2fe897 100644 --- a/src/GEOMGUI/GEOMGUI.pro +++ b/src/GEOMGUI/GEOMGUI.pro @@ -21,13 +21,11 @@ GUI_CXXFLAGS = $$(GUI_ROOT_DIR)/include/salome CORBA_INCLUDES = $$(OMNIORBDIR)/include $$(OMNIORBDIR)/include/omniORB4 $$(OMNIORBDIR)/include/COS -QWT_INCLUDES = $$(QWTHOME)/include - KERNEL_LDFLAGS = -L$$(KERNEL_ROOT_DIR)/lib/salome GUI_LDFLAGS = -L$$(GUI_ROOT_DIR)/lib/salome -INCLUDEPATH += $${QT_INCLUDES} $${VTK_INCLUDES} $${CAS_CPPFLAGS} $${PYTHON_INCLUDES} $${BOOST_CPPFLAGS} $${KERNEL_CXXFLAGS} $${GUI_CXXFLAGS} $${CORBA_CXXFLAGS} $${CORBA_INCLUDES} ../OBJECT ../GEOMFiltersSelection ../GEOMClient ../GEOMImpl $$(GEOM_ROOT_DIR)/idl $$(GEOM_ROOT_DIR)/salome_adm/unix +INCLUDEPATH += $${QT_INCLUDES} $${VTK_INCLUDES} $${CAS_CPPFLAGS} $${PYTHON_INCLUDES} $${BOOST_CPPFLAGS} $${KERNEL_CXXFLAGS} $${GUI_CXXFLAGS} $${CORBA_INCLUDES} ../OBJECT ../GEOMFiltersSelection ../GEOMClient ../GEOMImpl $$(GEOM_ROOT_DIR)/idl $$(GEOM_ROOT_DIR)/salome_adm/unix LIBS += -L$$(GEOM_ROOT_DIR)/lib -lGEOMFiltersSelection -lGEOMClient -lGEOMObject $${KERNEL_LDFLAGS} -lSalomeLifeCycleCORBA $${GUI_LDFLAGS} -lOCCViewer -lVTKViewer -lCAM -lSOCC -lSVTK -lEvent diff --git a/src/src.pro b/src/src.pro index 0827a9f99..56f213c16 100644 --- a/src/src.pro +++ b/src/src.pro @@ -23,7 +23,7 @@ SUBDIRS += GEOMClient SUBDIRS += DlgRef SUBDIRS += GEOMFiltersSelection SUBDIRS += GEOMGUI -#SUBDIRS += GEOMBase +SUBDIRS += GEOMBase #SUBDIRS += GEOMToolsGUI #SUBDIRS += DisplayGUI #SUBDIRS += BasicGUI -- 2.39.2