]> SALOME platform Git repositories - modules/hydro.git/blobdiff - src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx
Salome HOME
Name validator is added to the Calculation Case dialog.
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ImportImageDlg.cxx
index 288e0a6051815f1ee7088c07566e4689646d798c..f326790d17f0ed1de013aab808ba1fa03554bed3 100644 (file)
@@ -45,6 +45,7 @@
 #include <QPushButton>
 #include <QRadioButton>
 #include <QToolButton>
+#include <QCheckBox>
 
 HYDROGUI_ImportImageDlg::HYDROGUI_ImportImageDlg( HYDROGUI_Module* theModule, const QString& theTitle )
 : HYDROGUI_InputPanel( theModule, theTitle ),
@@ -53,7 +54,7 @@ HYDROGUI_ImportImageDlg::HYDROGUI_ImportImageDlg( HYDROGUI_Module* theModule, co
   SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
 
   // Import image from file
-  myFileNameGroup = new QGroupBox( tr( "IMPORT_IMAGE_FROM_FILE" ) );
+  myFileNameGroup = new QGroupBox( tr( "IMPORT_IMAGE_FROM_FILE" ), this );
 
   QLabel* aFileNameLabel = new QLabel( tr( "FILE_NAME" ), myFileNameGroup );
 
@@ -71,7 +72,7 @@ HYDROGUI_ImportImageDlg::HYDROGUI_ImportImageDlg( HYDROGUI_Module* theModule, co
   aFileNameLayout->addWidget( aBrowseBtn );
 
   // Image name
-  myImageNameGroup = new QGroupBox( tr( "IMAGE_NAME" ) );
+  myImageNameGroup = new QGroupBox( tr( "IMAGE_NAME" ), this );
 
   QLabel* anImageNameLabel = new QLabel( tr( "NAME" ), myImageNameGroup );
   myImageName = new QLineEdit( myImageNameGroup );
@@ -83,7 +84,7 @@ HYDROGUI_ImportImageDlg::HYDROGUI_ImportImageDlg( HYDROGUI_Module* theModule, co
   anImageNameLayout->addWidget( myImageName );
 
   // Transform image
-  myTransformGroup = new QGroupBox( tr( "TRANSFORM_IMAGE" ) );
+  myTransformGroup = new QGroupBox( tr( "TRANSFORM_IMAGE" ), this );
 
   // Make a pixmap for arrow
   QPixmap anArrowPixmap = aResMgr->loadPixmap( "HYDRO", tr( "ARROW_RIGHT_ICO" ) );
@@ -107,7 +108,11 @@ HYDROGUI_ImportImageDlg::HYDROGUI_ImportImageDlg( HYDROGUI_Module* theModule, co
 
   myRefImage = new QComboBox( myTransformGroup );
 
-  QGridLayout* aModeLayout = new QGridLayout();
+  QGridLayout* aTransformLayout = new QGridLayout( myTransformGroup );
+  aTransformLayout->setMargin( 5 );
+  aTransformLayout->setSpacing( 5 );
+
+  QGridLayout* aModeLayout = new QGridLayout( myTransformGroup );
   aModeLayout->setMargin( 0 );
   aModeLayout->setSpacing( 5 );
   aModeLayout->addWidget( aManualCartesianBtn, 0, 0 );
@@ -116,15 +121,12 @@ HYDROGUI_ImportImageDlg::HYDROGUI_ImportImageDlg( HYDROGUI_Module* theModule, co
   aModeLayout->addWidget( myRefImage,          2, 1 );
   aModeLayout->setColumnStretch( 1, 1 );
 
-  QGridLayout* aTransformLayout = new QGridLayout( myTransformGroup );
-  aTransformLayout->setMargin( 5 );
-  aTransformLayout->setSpacing( 5 );
   aTransformLayout->addLayout( aModeLayout, 0, 0, 1, 9 );
 
   QLabel* aImageCSLabel = new QLabel( tr( "IMAGE_CS" ), myTransformGroup );
-  QLabel* aGeodesicLabel = new QLabel( "GEODESIC", myTransformGroup );
-  QLabel* aLambertLabel = new QLabel( "LAMBERT93", myTransformGroup );
-  QLabel* aRefImageLabel = new QLabel( "REFERENCE_IMAGE_CS", myTransformGroup );
+  QLabel* aGeodesicLabel = new QLabel( tr( "GEODESIC" ), myTransformGroup );
+  QLabel* aLambertLabel = new QLabel( tr( "LAMBERT93" ), myTransformGroup );
+  QLabel* aRefImageLabel = new QLabel( tr( "REFERENCE_IMAGE_CS" ), myTransformGroup );
 
   aTransformLayout->addWidget( aImageCSLabel,  2, 1 );
   aTransformLayout->addWidget( aGeodesicLabel, 2, 3, 1, 6 );
@@ -187,7 +189,16 @@ HYDROGUI_ImportImageDlg::HYDROGUI_ImportImageDlg( HYDROGUI_Module* theModule, co
     QtxIntSpinBox* aRefPointY = new QtxIntSpinBox( 0, 0, 1, myTransformGroup ); // max is updated later
 
     int aRow = 4 * aPointType + 3;
-    aTransformLayout->addWidget( aPointBtn,        aRow,     0, 1, 9 );
+    if ( aPointType == HYDROGUI_PrsImage::PointC )
+    {
+      myPointCEnabler = new QCheckBox( myTransformGroup );
+      aTransformLayout->addWidget( myPointCEnabler, aRow,    0, 1, 2, Qt::AlignHCenter );
+      aTransformLayout->addWidget( aPointBtn,      aRow,     2, 1, 7 );
+    }
+    else
+    {
+      aTransformLayout->addWidget( aPointBtn,      aRow,     0, 1, 9 );
+    }
 
     aTransformLayout->addWidget( aPointXLabel,     aRow + 1, 0 );
     aTransformLayout->addWidget( aPointX,          aRow + 1, 1 );
@@ -256,6 +267,22 @@ HYDROGUI_ImportImageDlg::HYDROGUI_ImportImageDlg( HYDROGUI_Module* theModule, co
     connect( aRefPointX, SIGNAL( valueChanged( int ) ), this, SLOT( onPointCoordChanged( int ) ) );
     connect( aRefPointY, SIGNAL( valueChanged( int ) ), this, SLOT( onPointCoordChanged( int ) ) );
   }
+
+  // Connect checkbox enabling point C
+  connect( myPointCEnabler, SIGNAL( toggled( bool ) ), myPointBtnMap[ HYDROGUI_PrsImage::PointC ], SLOT( setEnabled( bool ) ) );
+  connect( myPointCEnabler, SIGNAL( toggled( bool ) ), myPointXMap[ HYDROGUI_PrsImage::PointC ], SLOT( setEnabled( bool ) ) );
+  connect( myPointCEnabler, SIGNAL( toggled( bool ) ), myPointYMap[ HYDROGUI_PrsImage::PointC ], SLOT( setEnabled( bool ) ) );
+  connect( myPointCEnabler, SIGNAL( toggled( bool ) ), myPointXDegMap[ HYDROGUI_PrsImage::PointC ], SLOT( setEnabled( bool ) ) );
+  connect( myPointCEnabler, SIGNAL( toggled( bool ) ), myPointYDegMap[ HYDROGUI_PrsImage::PointC ], SLOT( setEnabled( bool ) ) );
+  connect( myPointCEnabler, SIGNAL( toggled( bool ) ), myPointXMinMap[ HYDROGUI_PrsImage::PointC ], SLOT( setEnabled( bool ) ) );
+  connect( myPointCEnabler, SIGNAL( toggled( bool ) ), myPointYMinMap[ HYDROGUI_PrsImage::PointC ], SLOT( setEnabled( bool ) ) );
+  connect( myPointCEnabler, SIGNAL( toggled( bool ) ), myPointXSecMap[ HYDROGUI_PrsImage::PointC ], SLOT( setEnabled( bool ) ) );
+  connect( myPointCEnabler, SIGNAL( toggled( bool ) ), myPointYSecMap[ HYDROGUI_PrsImage::PointC ], SLOT( setEnabled( bool ) ) );
+  connect( myPointCEnabler, SIGNAL( toggled( bool ) ), myCartPointXMap[ HYDROGUI_PrsImage::PointC ], SLOT( setEnabled( bool ) ) );
+  connect( myPointCEnabler, SIGNAL( toggled( bool ) ), myCartPointYMap[ HYDROGUI_PrsImage::PointC ], SLOT( setEnabled( bool ) ) );
+  connect( myPointCEnabler, SIGNAL( toggled( bool ) ), myRefPointXMap[ HYDROGUI_PrsImage::PointC ], SLOT( setEnabled( bool ) ) );
+  connect( myPointCEnabler, SIGNAL( toggled( bool ) ), myRefPointYMap[ HYDROGUI_PrsImage::PointC ], SLOT( setEnabled( bool ) ) );
+
   aTransformLayout->setColumnStretch( 1, 1 ); // double
   aTransformLayout->setColumnStretch( 3, 1 ); // degrees
   aTransformLayout->setColumnStretch( 5, 1 ); // minutes
@@ -282,9 +309,6 @@ HYDROGUI_ImportImageDlg::HYDROGUI_ImportImageDlg( HYDROGUI_Module* theModule, co
 
 HYDROGUI_ImportImageDlg::~HYDROGUI_ImportImageDlg()
 {
-  delete myFileNameGroup;
-  delete myImageNameGroup;
-  delete myTransformGroup;
 }
 
 void HYDROGUI_ImportImageDlg::setIsEdit( const bool theIsEdit )
@@ -322,6 +346,8 @@ void HYDROGUI_ImportImageDlg::reset()
     myCartPointXMap[ aPointType ]->clear();
     myCartPointYMap[ aPointType ]->clear();
   }
+  myPointCEnabler->setChecked( true );
+  myPointCEnabler->toggle();
   myTransformGroup->setEnabled( false );
   myRefImage->clear();