From 7458685cffd3529d28382fd42c5ad66d5348445c Mon Sep 17 00:00:00 2001 From: mzn Date: Wed, 11 Dec 2013 14:25:01 +0000 Subject: [PATCH] Bug #61: title of group box create/edit section group box is always "Add element". --- src/HYDROCurveCreator/CurveCreator_Widget.cxx | 4 ++-- src/HYDROCurveCreator/CurveCreator_Widget.h | 2 +- src/HYDROGUI/HYDROGUI_PolylineDlg.cxx | 5 +++-- src/HYDROGUI/HYDROGUI_PolylineDlg.h | 2 +- src/HYDROGUI/HYDROGUI_ProfileDlg.cxx | 5 +++-- src/HYDROGUI/HYDROGUI_ProfileDlg.h | 2 +- src/HYDROGUI/resources/HYDROGUI_msg_en.ts | 8 ++++++++ 7 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/HYDROCurveCreator/CurveCreator_Widget.cxx b/src/HYDROCurveCreator/CurveCreator_Widget.cxx index 343b1c24..c97f87c4 100644 --- a/src/HYDROCurveCreator/CurveCreator_Widget.cxx +++ b/src/HYDROCurveCreator/CurveCreator_Widget.cxx @@ -513,7 +513,7 @@ void CurveCreator_Widget::onNewSection() myNewSectionEditor->setEditMode(false); QString aSectName = QString( CurveCreator_UtilsICurve::getUniqSectionName( myCurve ).c_str() ); myNewSectionEditor->setSectionParameters(aSectName, true, CurveCreator::Polyline ); - emit subOperationStarted( myNewSectionEditor ); + emit subOperationStarted( myNewSectionEditor, false ); } void CurveCreator_Widget::onAddNewSection() @@ -635,7 +635,7 @@ void CurveCreator_Widget::onEditSection( int theSection ) myNewSectionEditor->setEditMode(true); myNewSectionEditor->setSectionParameters( aSectName, isClosed, aType ); - emit subOperationStarted( myNewSectionEditor ); + emit subOperationStarted( myNewSectionEditor, true ); } void CurveCreator_Widget::onModifySection() diff --git a/src/HYDROCurveCreator/CurveCreator_Widget.h b/src/HYDROCurveCreator/CurveCreator_Widget.h index 57d0d907..ae382682 100644 --- a/src/HYDROCurveCreator/CurveCreator_Widget.h +++ b/src/HYDROCurveCreator/CurveCreator_Widget.h @@ -85,7 +85,7 @@ public: signals: void selectionChanged(); - void subOperationStarted( QWidget* ); + void subOperationStarted( QWidget*, bool ); void subOperationFinished( QWidget* ); public slots: diff --git a/src/HYDROGUI/HYDROGUI_PolylineDlg.cxx b/src/HYDROGUI/HYDROGUI_PolylineDlg.cxx index a643eb34..6e5f2b89 100755 --- a/src/HYDROGUI/HYDROGUI_PolylineDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_PolylineDlg.cxx @@ -55,7 +55,7 @@ HYDROGUI_PolylineDlg::HYDROGUI_PolylineDlg( HYDROGUI_Module* theModule, const QS anAddElementLayout->setSpacing( 5 ); connect( myEditorWidget, SIGNAL( selectionChanged() ), this, SIGNAL( selectionChanged() ) ); - connect( myEditorWidget, SIGNAL( subOperationStarted(QWidget*) ), this, SLOT( processStartedSubOperation(QWidget*) ) ); + connect( myEditorWidget, SIGNAL( subOperationStarted(QWidget*, bool) ), this, SLOT( processStartedSubOperation(QWidget*, bool) ) ); connect( myEditorWidget, SIGNAL( subOperationFinished(QWidget*) ), this, SLOT( processFinishedSubOperation(QWidget*) ) ); myAddElementBox->hide(); @@ -70,10 +70,11 @@ void HYDROGUI_PolylineDlg::setOCCViewer( OCCViewer_Viewer* theViewer ) myEditorWidget->setOCCViewer( theViewer ); } -void HYDROGUI_PolylineDlg::processStartedSubOperation( QWidget* theWidget ) +void HYDROGUI_PolylineDlg::processStartedSubOperation( QWidget* theWidget, bool theIsEdit ) { myEditorWidget->setEnabled( false ); + myAddElementBox->setTitle( theIsEdit ? tr( "EDIT_ELEMENT" ) : tr( "ADD_ELEMENT" ) ); QBoxLayout* anAddElementLayout = dynamic_cast( myAddElementBox->layout() ); anAddElementLayout->addWidget( theWidget ); diff --git a/src/HYDROGUI/HYDROGUI_PolylineDlg.h b/src/HYDROGUI/HYDROGUI_PolylineDlg.h index cc19c3bf..aa78a5c6 100755 --- a/src/HYDROGUI/HYDROGUI_PolylineDlg.h +++ b/src/HYDROGUI/HYDROGUI_PolylineDlg.h @@ -55,7 +55,7 @@ public: bool deleteEnabled(); protected slots: - void processStartedSubOperation( QWidget* ); + void processStartedSubOperation( QWidget*, bool ); void processFinishedSubOperation( QWidget* ); signals: diff --git a/src/HYDROGUI/HYDROGUI_ProfileDlg.cxx b/src/HYDROGUI/HYDROGUI_ProfileDlg.cxx index f4ee9b73..1dc3901f 100644 --- a/src/HYDROGUI/HYDROGUI_ProfileDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_ProfileDlg.cxx @@ -95,7 +95,7 @@ HYDROGUI_ProfileDlg::HYDROGUI_ProfileDlg( HYDROGUI_Module* theModule, const QStr myEditorWidget->setOCCViewer( aViewer ); connect( myEditorWidget, SIGNAL( selectionChanged() ), this, SIGNAL( selectionChanged() ) ); - connect( myEditorWidget, SIGNAL( subOperationStarted(QWidget*) ), this, SLOT( processStartedSubOperation(QWidget*) ) ); + connect( myEditorWidget, SIGNAL( subOperationStarted(QWidget*, bool) ), this, SLOT( processStartedSubOperation(QWidget*, bool) ) ); connect( myEditorWidget, SIGNAL( subOperationFinished(QWidget*) ), this, SLOT( processFinishedSubOperation(QWidget*) ) ); myAddElementBox->hide(); @@ -175,10 +175,11 @@ bool HYDROGUI_ProfileDlg::deleteEnabled() return myEditorWidget->removeEnabled(); } -void HYDROGUI_ProfileDlg::processStartedSubOperation( QWidget* theWidget ) +void HYDROGUI_ProfileDlg::processStartedSubOperation( QWidget* theWidget, bool theIsEdit ) { myEditorWidget->setEnabled( false ); + myAddElementBox->setTitle( theIsEdit ? tr( "EDIT_ELEMENT" ) : tr( "ADD_ELEMENT" ) ); QBoxLayout* anAddElementLayout = dynamic_cast( myAddElementBox->layout() ); anAddElementLayout->addWidget( theWidget ); diff --git a/src/HYDROGUI/HYDROGUI_ProfileDlg.h b/src/HYDROGUI/HYDROGUI_ProfileDlg.h index 5459a5a6..253e26eb 100644 --- a/src/HYDROGUI/HYDROGUI_ProfileDlg.h +++ b/src/HYDROGUI/HYDROGUI_ProfileDlg.h @@ -62,7 +62,7 @@ protected: virtual bool eventFilter( QObject*, QEvent* ); protected slots: - void processStartedSubOperation( QWidget* ); + void processStartedSubOperation( QWidget*, bool ); void processFinishedSubOperation( QWidget* ); void onMouseMove( SUIT_ViewWindow*, QMouseEvent* ); diff --git a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts index c4fb0ed5..4e9afd67 100644 --- a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts +++ b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts @@ -1204,6 +1204,10 @@ file cannot be correctly imported for a Bathymetry definition. ADD_ELEMENT Add element + + EDIT_ELEMENT + Edit element + POLYLINE_NAME_TLT Name @@ -1240,6 +1244,10 @@ file cannot be correctly imported for a Bathymetry definition. ADD_ELEMENT Add element + + EDIT_ELEMENT + Edit element + PROFILE_NAME_TLT Name -- 2.39.2