Salome HOME
Fix for the bug #45: check and warning when the same image is used in 2 arguments.
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_CalculationDlg.cxx
index 7694feb6bf154fc6e2a9587c05c093fe1b691729..5d39423bb634636b4b64654d6e34e9ffeaeb51fa 100644 (file)
@@ -65,8 +65,6 @@ HYDROGUI_CalculationDlg::HYDROGUI_CalculationDlg( HYDROGUI_Module* theModule, co
 {
   addPage( createObjectsPage() );
   addPage( createZonesPage() );
-  connect( button( QWizard::NextButton ), SIGNAL( clicked() ), SIGNAL( splitZones() ) );
-  connect( button( QWizard::BackButton ), SIGNAL( clicked() ), SIGNAL( hideZones() ) );
 }
 
 HYDROGUI_CalculationDlg::~HYDROGUI_CalculationDlg()
@@ -164,20 +162,6 @@ QWizardPage* HYDROGUI_CalculationDlg::createObjectsPage() {
   return aPage;
 }
 
-void HYDROGUI_CalculationDlg::onEmptyName()
-{
-  QString aTitle = QObject::tr( "INSUFFICIENT_INPUT_DATA" );
-  QString aMessage = QObject::tr( "INCORRECT_OBJECT_NAME" );
-  SUIT_MessageBox::critical( module()->getApp()->desktop(), aTitle, aMessage );
-}
-
-void HYDROGUI_CalculationDlg::onAlreadyExists( QString theName )
-{
-  QString aTitle = QObject::tr( "INSUFFICIENT_INPUT_DATA" );
-  QString aMessage = QObject::tr( "OBJECT_EXISTS_IN_DOCUMENT" ).arg( theName );
-  SUIT_MessageBox::critical( module()->getApp()->desktop(), aTitle, aMessage );
-}
-
 QWizardPage* HYDROGUI_CalculationDlg::createZonesPage() {
   QWizardPage* aPage = new QWizardPage( mainFrame() );
   QFrame* aFrame = new QFrame( aPage );
@@ -212,6 +196,42 @@ QWizardPage* HYDROGUI_CalculationDlg::createZonesPage() {
   return aPage;
 }
 
+
+bool HYDROGUI_CalculationDlg::acceptCurrent() const
+{
+  QString anErrorMsg;
+
+  if ( myGeomObjects->count() == 0 )
+  {
+    anErrorMsg = tr( "EMPTY_GEOMETRY_OBJECTS" );
+  }
+
+  if ( !anErrorMsg.isEmpty() )
+  {
+    anErrorMsg += "\n" + tr( "INPUT_VALID_DATA" );
+    
+    QString aTitle = tr( "INSUFFICIENT_INPUT_DATA" );
+    SUIT_MessageBox::critical( module()->getApp()->desktop(), aTitle, anErrorMsg );
+  }
+
+  return anErrorMsg.isEmpty();
+}
+
+void HYDROGUI_CalculationDlg::onEmptyName()
+{
+  QString aTitle = tr( "INSUFFICIENT_INPUT_DATA" );
+  QString aMessage = tr( "INCORRECT_OBJECT_NAME" ) + "\n" + tr( "INPUT_VALID_DATA" );
+  SUIT_MessageBox::critical( module()->getApp()->desktop(), aTitle, aMessage );
+}
+
+void HYDROGUI_CalculationDlg::onAlreadyExists( QString theName )
+{
+  QString aTitle = tr( "INSUFFICIENT_INPUT_DATA" );
+  QString aMessage = QObject::tr( "OBJECT_EXISTS_IN_DOCUMENT" ).arg( theName ) +
+                     "\n" + tr( "INPUT_VALID_DATA" );
+  SUIT_MessageBox::critical( module()->getApp()->desktop(), aTitle, aMessage );
+}
+
 void HYDROGUI_CalculationDlg::onZonesDropped( const QList<SUIT_DataObject*>& theList, 
     SUIT_DataObject* theTargetParent, int theTargetRow, Qt::DropAction theDropAction )
 {
@@ -352,7 +372,7 @@ void HYDROGUI_CalculationDlg::excludeGeomObjects( const QStringList& theObjects
   }
 }
 
-void HYDROGUI_CalculationDlg::setBoundary( QString& theObjName )
+void HYDROGUI_CalculationDlg::setBoundary( const QString& theObjName )
 {
   bool isBlocked = myPolylineName->blockSignals( true );
   myPolylineName->setCurrentIndex( myPolylineName->findText( theObjName ) );