-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <SUIT_ResourceMgr.h>
#include <SUIT_MessageBox.h>
#include <SALOME_ListIO.hxx>
+#include "utilities.h"
#include <Basics_Utils.hxx>
+#include "utilities.h"
#include <TCollection_AsciiString.hxx>
#include <TColStd_MapOfInteger.hxx>
// layout the two group boxes in the middle, add a list of operations
QGroupBox* anOperGr = new QGroupBox( tr( "GEOM_OPERATIONS" ), centralWidget() );
+ // "select all" button
+ mySelectAll = new QCheckBox( tr( "SELECT_ALL" ), anOperGr );
+ mySelectAll->setTristate( true );
+
// operations list widget
myOpList = new QListWidget( anOperGr );
myOpList->setSortingEnabled( false );
QVBoxLayout* aOperLay = new QVBoxLayout( anOperGr );
aOperLay->setMargin( 9 );
+ aOperLay->addWidget( mySelectAll );
aOperLay->addWidget( myOpList );
QGroupBox* aParamsGr = new QGroupBox( tr( "GEOM_PARAMETERS" ), centralWidget() );
myBSplineDegree = new SalomeApp_IntSpinBox( w );
myBSplineSegments = new SalomeApp_IntSpinBox( w );
+ initSpinBox( myBSplineSegments, 1, 1000, 1);
myBSpline2DCont = new QComboBox( w );
myBSpline2DCont->addItems( aContinueties );
myBSpline3DCont = new QComboBox( w );
connect( myOpList, SIGNAL( currentRowChanged( int )), myStack, SLOT( setCurrentIndex( int )));
connect( myOpList, SIGNAL( itemChanged( QListWidgetItem* )), this, SLOT( operatorChecked( QListWidgetItem* )));
+ connect( mySelectAll, SIGNAL( stateChanged( int ) ), this, SLOT( onSelectAll( int )));
adjustSize();
loadDefaults(); // init dialog fields with values from resource file
//myOpList->setCurrentRow( myOpList->findItem( 0 );
reset();
- myStack->setCurrentIndex( 0 );
+ myOpList->setCurrentRow(0);
initName( tr( "PROCESS_SHAPE_NEW_OBJ_NAME" ));
selectionChanged();
+ updateSelectAll();
}
//=================================================================================
}
if ( !anErrorObjNames.empty() )
- MESSAGE( "ERRORS occured while processing the following objects: " << anErrorObjNames.join( " " ).toLatin1().data() );
+ MESSAGE( "ERRORS occurred while processing the following objects: " << anErrorObjNames.join( " " ).toLatin1().data() );
return anErrorObjNames.size() < myObjects->length(); // true if at least one object was OK, false if ALL objects were nil after Healing.
}
{
if ( item && item->checkState() == Qt::Checked )
{
+ item->setSelected(true);
myStack->setCurrentIndex( myOpList->row( item ));
}
+ updateSelectAll();
+}
+
+void RepairGUI_ShapeProcessDlg::updateSelectAll()
+{
+ Qt::CheckState state = myOpList->count() > 0 ? myOpList->item(0)->checkState() : Qt::Unchecked;
+ for ( int i = 1; i < myOpList->count(); i++ ) {
+ if ( myOpList->item(i)->checkState() != state ) {
+ state = Qt::PartiallyChecked;
+ break;
+ }
+ }
+ mySelectAll->blockSignals( true );
+ mySelectAll->setCheckState( state );
+ mySelectAll->blockSignals( false );
+}
+
+void RepairGUI_ShapeProcessDlg::onSelectAll( int state )
+{
+ if ( state == Qt::PartiallyChecked ) {
+ mySelectAll->setCheckState( Qt::Checked );
+ return;
+ }
+ myOpList->blockSignals( true );
+ for ( int i = 0; i < myOpList->count(); i++ ) {
+ myOpList->item(i)->setCheckState( (Qt::CheckState)state );
+ }
+ myOpList->blockSignals( false );
+}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> RepairGUI_ShapeProcessDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ GEOM::ListOfGO aListPtr(myObjects);
+ for (int i = 0; i < aListPtr.length(); i++) {
+ GEOM::GeomObjPtr aGeomObjPtr(aListPtr[i]);
+ res << aGeomObjPtr;
+ }
+ return res;
}