Salome HOME
refs #1501 p.2
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_StreamDlg.cxx
index 208b483f0496f05a8bbaf644baa0483182e5ada4..a07c5fe7e79b5e5a178bfead856e8a6a2bf7e62c 100644 (file)
@@ -36,6 +36,7 @@
 #include <QListWidget>
 #include <QPushButton>
 #include <QDoubleSpinBox>
+#include <QTextEdit>
 
 HYDROGUI_StreamDlg::HYDROGUI_StreamDlg( HYDROGUI_Module* theModule, const QString& theTitle )
 : HYDROGUI_InputPanel( theModule, theTitle )
@@ -57,13 +58,13 @@ HYDROGUI_StreamDlg::HYDROGUI_StreamDlg( HYDROGUI_Module* theModule, const QStrin
   myAxes = new QComboBox( aParamGroup );
   myAxes->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   myDDZ = new QDoubleSpinBox( aParamGroup );
-  myDDZ->setRange( 1E-2, 100 );
-  myDDZ->setSingleStep( 1E-2 );
+  myDDZ->setRange( 0.01, 100 );
+  myDDZ->setSingleStep( 0.1 );
   myDDZ->setValue( 0.1 );
   myDDZ->setDecimals( 2 );
   mySpatialStep = new QDoubleSpinBox( aParamGroup );
-  mySpatialStep->setRange( 1E-2, 100 );
-  mySpatialStep->setSingleStep( 1.0 );
+  mySpatialStep->setRange( 0.1, 100 );
+  mySpatialStep->setSingleStep( 0.1 );
   mySpatialStep->setValue( 1 );
   mySpatialStep->setDecimals( 2 );
 
@@ -97,14 +98,21 @@ HYDROGUI_StreamDlg::HYDROGUI_StreamDlg( HYDROGUI_Module* theModule, const QStrin
   aParamLayout->addLayout( aParam1Layout );
   aParamLayout->addWidget( myProfiles );
   aParamLayout->addLayout( aButtonsLayout );
-
-
-
+  
   aParamGroup->setLayout( aParamLayout );
 
+  // Warnings
+  QGroupBox* aWarnGroup = new QGroupBox( tr( "STREAM_WARNINGS" ), mainFrame() );
+  myWarnText = new QTextEdit(); 
+  myWarnText->setReadOnly(true);
+  QBoxLayout* aWarnLayout = new QVBoxLayout();
+  aWarnLayout->addWidget( myWarnText );  
+  aWarnGroup->setLayout( aWarnLayout );
+
   // Common
   addWidget( myObjectNameGroup );
   addWidget( aParamGroup );
+  addWidget( aWarnGroup );
   addStretch();
 
   // Create selector
@@ -119,10 +127,11 @@ HYDROGUI_StreamDlg::HYDROGUI_StreamDlg( HYDROGUI_Module* theModule, const QStrin
   }
 
   // Connect signals and slots
-  connect( myAxes, SIGNAL( currentIndexChanged( const QString & ) ), 
-           this, SIGNAL( AxisChanged( const QString& ) ) );
+  connect( myAxes, SIGNAL( currentIndexChanged( const QString & ) ), this, SIGNAL( AxisChanged( const QString& ) ) );
   connect( myAddButton, SIGNAL( clicked() ), this, SIGNAL( AddProfiles() ) );
   connect( myRemoveButton, SIGNAL( clicked() ), this, SLOT( onRemoveProfiles() ) );
+  connect( myDDZ, SIGNAL( valueChanged (double) ), this, SLOT (onDDZValueChanged(double)));
+  connect( mySpatialStep, SIGNAL( valueChanged (double) ), this, SLOT (onSSValueChanged(double)));
 }
 
 HYDROGUI_StreamDlg::~HYDROGUI_StreamDlg()
@@ -137,8 +146,8 @@ void HYDROGUI_StreamDlg::reset()
 
   myAxes->clear();
   myProfiles->setObjects( HYDROGUI_ListModel::Object2VisibleList() );
-  myAddButton->setEnabled( false );
-  myRemoveButton->setEnabled( false );
+  myAddButton->setEnabled( true );
+  myRemoveButton->setEnabled( true );
 
   blockSignals( isBlocked );
 }
@@ -171,7 +180,7 @@ void HYDROGUI_StreamDlg::setAxisName( const QString& theName )
   if ( aNewId != myAxes->currentIndex() ) {
     myAxes->setCurrentIndex( aNewId );
   }
-  myAddButton->setEnabled( myAxes->currentIndex() > -1 );
+  //myAddButton->setEnabled( myAxes->currentIndex() > -1 );
 
   blockSignals( isBlocked );
 }
@@ -202,6 +211,7 @@ void HYDROGUI_StreamDlg::setProfiles( const QStringList& theProfiles )
 
   myProfiles->setObjects( aProfiles );
 
+
   myRemoveButton->setEnabled( myProfiles->getObjects().count() > 0 );
 
   myProfiles->setUpdatesEnabled( true );
@@ -216,6 +226,17 @@ void HYDROGUI_StreamDlg::onRemoveProfiles()
   emit RemoveProfiles( aSelectedProfiles );
 }
 
+void HYDROGUI_StreamDlg::onDDZValueChanged(double d)
+{
+  emit DDZValueChanged( d );
+}
+
+void HYDROGUI_StreamDlg::onSSValueChanged(double d)
+{
+  emit SSValueChanged( d );
+}
+
+
 void HYDROGUI_StreamDlg::setDDZ( const double theDDZ )
 {
   myDDZ->setValue( theDDZ );
@@ -236,3 +257,28 @@ double HYDROGUI_StreamDlg::getSpatialStep() const
   return mySpatialStep->value();
 }
 
+void HYDROGUI_StreamDlg::setBackgroundColorForProfileList (int theInd, QColor theColor)
+{
+  myProfiles->setBackgroundColor(theInd, theColor);
+}
+
+QColor HYDROGUI_StreamDlg::getBackgroundColorForProfileList (int theInd) const
+{
+  return myProfiles->getBackgroundColor(theInd);
+}
+
+void HYDROGUI_StreamDlg::clearAllBackgroundColorsForProfileList ()
+{
+  myProfiles->clearAllBackgroundColors();
+}
+
+void HYDROGUI_StreamDlg::addWarning( const QString& theWarnMess )
+{
+  myWarnText->append( theWarnMess );
+}
+
+void HYDROGUI_StreamDlg::clearWarnings()
+{
+  myWarnText->clear();
+}
+