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 )
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<HYDROGUI_CalculationDlg*>( inputPanel() );
+ if ( aPanel ) {
+ aPanel->onFirstPage();
+ }
+ return;
+ }
+ }
+
QApplication::setOverrideCursor( Qt::WaitCursor );
int anUpdateFlags = 0;
// 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 ) {
}
// Set priority rules
- myEditedObject->ClearRules();
foreach ( const HYDROData_CustomRule& aRule, aPanel->getRules() ) {
myEditedObject->AddRule( aRule.Object1, aRule.Priority,
aRule.Object2, aRule.MergeType );
emit Back( aCurIdx );
}
+void HYDROGUI_Wizard::onFirstPage()
+{
+ if ( myWizard->count() > 1 ) {
+ myNext->setVisible( true );
+ myFinish->setVisible( false );
+ myWizard->setCurrentIndex( 0 );
+ myBack->setEnabled( false );
+ emit Back( myWizard->currentIndex() );
+ }
+}
+
bool HYDROGUI_Wizard::acceptCurrent() const
{
return true;
<source>CONFIRM_SPLITTING_ZONES_RECALCULATION_MODE</source>
<translation>Case splitting zones already exist and will be recalculated after mode change. Do you confirm the recalculation?</translation>
</message>
+ <message>
+ <source>EMPTY_REGIONS</source>
+ <translation>Empty regions</translation>
+ </message>
+ <message>
+ <source>CONFIRM_CONTINUE_WITH_OBJECTS_NOT_INCLUDED_TO_REGION</source>
+ <translation>Some objects are not included to any region:
+%1.
+Do you want to continue?</translation>
+ </message>
</context>
<context>