#include <QButtonGroup>
#include <QCloseEvent>
#include <QTimerEvent>
+#include <QProgressBar>
// VTK includes
#include <vtkProperty.h>
#define COLONIZE(str) (QString(str).contains(":") > 0 ? QString(str) : QString(str) + " :" )
-/* OBSOLETE
-static void addSeparator( QWidget* parent )
-{
- QGridLayout* l = qobject_cast<QGridLayout*>( parent->layout() );
- int row = l->rowCount();
- int cols = l->columnCount();
- for ( int i = 0; i < cols; i++ ) {
- QFrame* hline = new QFrame( parent );
- hline->setFrameStyle( QFrame::HLine | QFrame::Sunken );
- l->addWidget( hline, row, i );
- }
-}
-*/
-
enum TCol {
COL_ALGO = 0, COL_SHAPE, COL_ERROR, COL_SHAPEID, COL_PUBLISHED, COL_BAD_MESH, NB_COLUMNS
};
qthread(gen, mesh, mainShape)
{
// --
- setWindowTitle(tr("Compute"));
+ setWindowTitle(tr("TITLE"));
setMinimumWidth( 200 );
- cancelButton = new QPushButton(tr("Cancel"));
+ cancelButton = new QPushButton(tr("CANCEL"));
cancelButton->setDefault(true);
QLabel * nbNodesName = new QLabel(tr("SMESH_MESHINFO_NODES"), this );
nbNodesLabel = new QLabel("0", this );
nbElemsLabel = new QLabel("0", this );
freeRAMLabel = new QLabel("", this );
+ progressBar = new QProgressBar(this);
+ progressBar->setMinimum( 0 );
+ progressBar->setMaximum( 1000 );
QGridLayout* layout = new QGridLayout(this);
layout->setMargin( MARGIN );
layout->addWidget(freeRAMName, row, 0);
layout->addWidget(freeRAMLabel, row++, 1);
#endif
- layout->addWidget(cancelButton, row, 0, 1, 2);
+ layout->addWidget(progressBar, row++, 0, 1, 2);
+ layout->addWidget(cancelButton, row++, 0, 1, 2);
adjustSize();
update();
void SMESHGUI_ComputeDlg_QThreadQDialog::onCancel()
{
qthread.cancel();
-}
+ cancelButton->setDown( true );
+ cancelButton->setText( tr("CANCELING"));
+}
void SMESHGUI_ComputeDlg_QThreadQDialog::timerEvent(QTimerEvent *event)
{
+ if ( !cancelButton->isDown() ) // not yet cancelled
+ progressBar->setValue( progressBar->maximum() * qthread.getMesh()->GetComputeProgress() );
+
if(qthread.isFinished())
{
close();
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
OCC_CATCH_SIGNALS;
#endif
- bool res;
SMESHGUI_ComputeDlg_QThreadQDialog qthreaddialog(desktop(), gen, myMesh, myMainShape);
qthreaddialog.exec();
- res = qthreaddialog.result();
- res = gen->Compute(myMesh, myMainShape);
- if (res)
- computeFailed = false;
+ computeFailed = !qthreaddialog.result();
}
catch(const SALOME::SALOME_Exception & S_ex) {
memoryLack = true;
int entities = SMESH_Actor::eAllEntity;
if ( !memoryLack )
{
- if ( getSMESHGUI()->automaticUpdate( myMesh, &entities, &limitExceeded ) )
+ if ( getSMESHGUI()->automaticUpdate( myMesh, &entities, &limitExceeded ) )
{
try {
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
OCC_CATCH_SIGNALS;
#endif
- SMESH_Actor *anActor = SMESH::FindActorByObject( myMesh );
- if ( !anActor ) anActor = SMESH::CreateActor( aMeshSObj->GetStudy(), aMeshSObj->GetID().c_str(), true );
+ SMESH_Actor *anActor = SMESH::FindActorByObject( myMesh );
+ if ( !anActor ) anActor = SMESH::CreateActor( aMeshSObj->GetStudy(), aMeshSObj->GetID().c_str(), true );
- anActor->SetEntityMode( entities );
- SMESH::DisplayActor( SMESH::GetActiveWindow(), anActor );
+ anActor->SetEntityMode( entities );
+ SMESH::DisplayActor( SMESH::GetActiveWindow(), anActor );
- SMESH::Update(myIObject, true);
+ SMESH::Update(myIObject, true);
- if ( limitExceeded )
- {
- SUIT_MessageBox::warning( desktop(),
- tr( "SMESH_WRN_WARNING" ),
- tr( "SMESH_WRN_SIZE_INC_LIMIT_EXCEEDED" ).arg( myMesh->NbElements() ).arg( limitSize ) );
- }
+ if ( limitExceeded )
+ {
+ SUIT_MessageBox::warning( desktop(),
+ tr( "SMESH_WRN_WARNING" ),
+ tr( "SMESH_WRN_SIZE_INC_LIMIT_EXCEEDED" ).arg( myMesh->NbElements() ).arg( limitSize ) );
+ }
}
catch (...) {
#ifdef _DEBUG_
}
}
}
- else if ( limitExceeded )
+ else if ( limitExceeded )
{
SUIT_MessageBox::warning( desktop(),
tr( "SMESH_WRN_WARNING" ),