X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FHYDROGUI%2FHYDROGUI_CalculationOp.cxx;h=f43261a3465ae8571b594e530a3129d0d5d12264;hb=6d592627e88a395398a02d7b884796e85331c1c1;hp=79a9611092b81d4b3a1fe2d5c9ebce17470ffc74;hpb=bae3f70c4e95c5bff78d7994d04b1cc4dddbc407;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_CalculationOp.cxx b/src/HYDROGUI/HYDROGUI_CalculationOp.cxx index 79a96110..f43261a3 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationOp.cxx +++ b/src/HYDROGUI/HYDROGUI_CalculationOp.cxx @@ -543,6 +543,35 @@ bool HYDROGUI_CalculationOp::confirmModeChange() const return isConfirmed; } +bool HYDROGUI_CalculationOp::confirmContinueWithWarning( const HYDROData_Warning& theWarning ) const +{ + HYDROData_WarningType aType = theWarning.Type; + if ( aType == WARN_OK ) { + return true; + } + + QString aTitle; + QString aMsg; + switch ( aType ) + { + case WARN_EMPTY_REGIONS: + aTitle = tr( "EMPTY_REGIONS" ); + aMsg = tr( "CONFIRM_CONTINUE_WITH_OBJECTS_NOT_INCLUDED_TO_REGION" ).arg( theWarning.Data ); + break; + default: + aTitle = tr( "WARNING" ); + aMsg = theWarning.Data; + } + + + int anAnswer = SUIT_MessageBox::warning( module()->getApp()->desktop(), + aTitle, aMsg, + QMessageBox::Yes | QMessageBox::No, + QMessageBox::No ); + + return ( anAnswer == QMessageBox::Yes ); +} + bool HYDROGUI_CalculationOp::processApply( int& theUpdateFlags, QString& theErrorMsg, QStringList& theBrowseObjectsEntries ) @@ -565,6 +594,20 @@ bool HYDROGUI_CalculationOp::processApply( int& theUpdateFlags, void HYDROGUI_CalculationOp::onApply() { + // Check warnings + HYDROData_Warning aWarning = myEditedObject->GetLastWarning(); + if ( aWarning.Type != WARN_OK ) { + if ( !confirmContinueWithWarning( aWarning ) ) { + // Go back to the first page + HYDROGUI_CalculationDlg* aPanel = + ::qobject_cast( inputPanel() ); + if ( aPanel ) { + aPanel->onFirstPage(); + } + return; + } + } + QApplication::setOverrideCursor( Qt::WaitCursor ); int anUpdateFlags = 0; @@ -632,6 +675,9 @@ void HYDROGUI_CalculationOp::onNext( const int theIndex ) // automatic names generation for regions and zones myEditedObject->SetName( aNewCaseName ); + // Clear rules + myEditedObject->ClearRules(); + // Set parameters for automatic mode int aMode = aPanel->getMode(); if ( aMode == HYDROData_CalculationCase::AUTOMATIC ) { @@ -648,7 +694,6 @@ void HYDROGUI_CalculationOp::onNext( const int theIndex ) } // Set priority rules - myEditedObject->ClearRules(); foreach ( const HYDROData_CustomRule& aRule, aPanel->getRules() ) { myEditedObject->AddRule( aRule.Object1, aRule.Priority, aRule.Object2, aRule.MergeType );