#include "VisuGUI_ClippingDlg.h"
#include "VisuGUI_Plot3DDlg.h"
#include "VisuGUI_OffsetDlg.h"
+#include "VisuGUI_BuildProgressDlg.h"
#include "VISU_ScalarMap_i.hh"
#include "VisuGUI_ScalarBarDlg.h"
application()->putInfo( "Importing From File " + aFileInfo.filePath() + "...", -1 );
double initialTime = vtkTimerLog::GetCPUTime();
+ VisuGUI_BuildProgressDlg* aBuildProgressDlg;
+ QString aFileName = aFileInfo.fileName();
+
VISU::Result_var aResult;
bool anIsBuild = aResourceMgr->booleanValue("VISU", "full_med_loading", false);
if (VisuGUI_FileDlg::IsBuild) {
aResult = GetVisuGen(this)->ImportFile(aFileInfo.filePath());
+
+ aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this), aResult, aFileName );
+ aBuildProgressDlg->start();
+
if (!CORBA::is_nil(aResult.in()))
if (Result_i* aRes = dynamic_cast<Result_i*>(GetServant(aResult).in())) {
if (!aRes->IsPossible())
aResourceMgr->setValue("VISU", "full_med_loading", false);
aResult = GetVisuGen(this)->ImportFile(aFileInfo.filePath());
aResourceMgr->setValue("VISU", "full_med_loading", anIsBuild);
+
+ aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this), aResult, aFileName );
+ aBuildProgressDlg->start();
}
if (CORBA::is_nil(aResult.in())) {
--- /dev/null
+// VISU VISUGUI : GUI of VISU component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : VisuGUI_BuildProgressDlg.cxx
+// Author : Oleg UVAROV
+// Module : VISU
+
+#include "VisuGUI_BuildProgressDlg.h"
+
+#include "VisuGUI_Tools.h"
+
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qpushbutton.h>
+#include <qtimer.h>
+
+/*!
+ * Constructor
+ */
+VisuGUI_BuildProgressDlg::VisuGUI_BuildProgressDlg( QWidget* theParent,
+ VISU::Result_var theResult,
+ const QString& theFileName ):
+ QDialog( theParent ),
+ myResult( theResult )
+{
+ setName( "VisuGUI_BuildProgressBar" );
+ setCaption( tr( "DLG_BUILD_PROGRESS_TITLE" ) );
+ setSizeGripEnabled( true );
+
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+
+ QVBoxLayout* aTopLayout = new QVBoxLayout( this );
+ //aTopLayout->setSpacing( 6 );
+ aTopLayout->setMargin( 6 );
+ aTopLayout->setAutoAdd( true );
+
+ QString aCaption = QString( "Importing " ) + theFileName;
+ QGroupBox* aBox = new QGroupBox( aCaption, this );
+ aBox->setColumnLayout(0, Qt::Vertical );
+ aBox->layout()->setSpacing( 0 );
+ aBox->layout()->setMargin( 0 );
+
+ QGridLayout* aGridLayout = new QGridLayout( aBox->layout() );
+ aGridLayout->setSpacing( 6 );
+ aGridLayout->setMargin( 11 );
+
+ QLabel* BuildFieldsLabel = new QLabel( tr( "BUILD_FIELDS" ), aBox );
+ myBuildFieldsButton = new QPushButton( aBox );
+ myBuildFieldsButton->setEnabled( false );
+ myBuildFieldsButton->setFixedSize( 30, 30 );
+ myBuildFieldsButton->setPaletteBackgroundColor( Qt::red );
+
+ QLabel* BuildGroupsLabel = new QLabel( tr( "BUILD_GROUPS" ), aBox );
+ myBuildGroupsButton = new QPushButton( aBox );
+ myBuildGroupsButton->setEnabled( false );
+ myBuildGroupsButton->setFixedSize( 30, 30 );
+ myBuildGroupsButton->setPaletteBackgroundColor( Qt::red );
+
+ QLabel* BuildMinMaxLabel = new QLabel( tr( "BUILD_MINMAX" ), aBox );
+ myBuildMinMaxButton = new QPushButton( aBox );
+ myBuildMinMaxButton->setEnabled( false );
+ myBuildMinMaxButton->setFixedSize( 30, 30 );
+ myBuildMinMaxButton->setPaletteBackgroundColor( Qt::red );
+
+ aGridLayout->addWidget( BuildFieldsLabel, 0, 0 );
+ aGridLayout->addWidget( myBuildFieldsButton, 0, 1 );
+ aGridLayout->addWidget( BuildGroupsLabel, 1, 0 );
+ aGridLayout->addWidget( myBuildGroupsButton, 1, 1 );
+ aGridLayout->addWidget( BuildMinMaxLabel, 2, 0 );
+ aGridLayout->addWidget( myBuildMinMaxButton, 2, 1 );
+
+ myTimer = new QTimer( this );
+ connect( myTimer, SIGNAL( timeout() ), this, SLOT( onTimer() ) );
+}
+
+VisuGUI_BuildProgressDlg::~VisuGUI_BuildProgressDlg()
+{
+}
+
+void VisuGUI_BuildProgressDlg::start()
+{
+ myTimer->start( 100 );
+ show();
+}
+
+void VisuGUI_BuildProgressDlg::onTimer()
+{
+ bool isFieldsDone = myResult->IsFieldsDone();
+ bool isGroupsDone = myResult->IsGroupsDone();
+ bool isMinMaxDone = myResult->IsMinMaxDone();
+
+ updateButton( myBuildFieldsButton, isFieldsDone );
+ updateButton( myBuildGroupsButton, isGroupsDone );
+ updateButton( myBuildMinMaxButton, isMinMaxDone );
+
+ if( isFieldsDone && isGroupsDone && isMinMaxDone )
+ done( 0 );
+}
+
+void VisuGUI_BuildProgressDlg::updateButton( QPushButton* theButton, bool theIsDone )
+{
+ QColor aCurrentColor = theButton->paletteBackgroundColor();
+ QColor aNewColor = Qt::green;
+
+ if( !theIsDone )
+ {
+ aNewColor = Qt::red;
+ if( aCurrentColor == Qt::red )
+ aNewColor = Qt::yellow;
+ }
+
+ theButton->setPaletteBackgroundColor( aNewColor );
+}
+
+void VisuGUI_BuildProgressDlg::done( int r )
+{
+ myTimer->stop();
+ QDialog::done( r );
+}
--- /dev/null
+// VISU VISUGUI : GUI of VISU component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : VisuGUI_BuildProgressDlg.h
+// Author : Oleg UVAROV
+// Module : VISU
+// $Header$
+
+#ifndef VISUGUI_BUILDPROGRESSDLG_H
+#define VISUGUI_BUILDPROGRESSDLG_H
+
+#include "VISU_Gen_i.hh"
+
+#include <qdialog.h>
+
+class QPushButton;
+class QTimer;
+
+//! Build Progress Dialog.
+class VisuGUI_BuildProgressDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ VisuGUI_BuildProgressDlg( QWidget*, VISU::Result_var, const QString& );
+ ~VisuGUI_BuildProgressDlg();
+
+ void start();
+
+protected slots:
+ void done( int );
+ void onTimer();
+
+private:
+ void updateButton( QPushButton*, bool );
+
+private:
+ VISU::Result_var myResult;
+
+ QTimer* myTimer;
+
+ QPushButton* myBuildFieldsButton;
+ QPushButton* myBuildGroupsButton;
+ QPushButton* myBuildMinMaxButton;
+};
+
+#endif