From: ouv Date: Tue, 22 Nov 2005 15:35:34 +0000 (+0000) Subject: Fixed bug GVIEW10573 : time to load sandia file too long X-Git-Tag: BR-D5-38-2003_D2005-24-11~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e060781bc9cec3fde5f3c1677f9333972e69379b;p=modules%2Fvisu.git Fixed bug GVIEW10573 : time to load sandia file too long --- diff --git a/src/VISUGUI/Makefile.in b/src/VISUGUI/Makefile.in index 84579bf2..f787a02d 100644 --- a/src/VISUGUI/Makefile.in +++ b/src/VISUGUI/Makefile.in @@ -70,6 +70,7 @@ LIB_SRC = VisuGUI.cxx \ VisuGUI_CutPlanesDlg.cxx \ VisuGUI_StreamLinesDlg.cxx \ VisuGUI_VectorsDlg.cxx \ + VisuGUI_BuildProgressDlg.cxx \ VisuGUI_Timer.cxx LIB_MOC = VisuGUI.h \ @@ -91,7 +92,8 @@ LIB_MOC = VisuGUI.h \ VisuGUI_CutLinesDlg.h \ VisuGUI_CutPlanesDlg.h \ VisuGUI_StreamLinesDlg.h \ - VisuGUI_VectorsDlg.h + VisuGUI_VectorsDlg.h \ + VisuGUI_BuildProgressDlg.h LIB_CLIENT_IDL = SALOME_Exception.idl \ VISU_Gen.idl \ diff --git a/src/VISUGUI/VISUM_msg_en.po b/src/VISUGUI/VISUM_msg_en.po index 5fc6576b..015083b9 100644 --- a/src/VISUGUI/VISUM_msg_en.po +++ b/src/VISUGUI/VISUM_msg_en.po @@ -232,6 +232,18 @@ msgstr "Gauss Points Preferences" msgid "VisuGUI_GaussPointsDlg::DLG_PROP_TITLE" msgstr "Gauss Points Properties" +msgid "VisuGUI_BuildProgressDlg::DLG_BUILD_PROGRESS_TITLE" +msgstr "Build progress" + +msgid "VisuGUI_BuildProgressDlg::BUILD_FIELDS" +msgstr "Building fields..." + +msgid "VisuGUI_BuildProgressDlg::BUILD_GROUPS" +msgstr "Building groups..." + +msgid "VisuGUI_BuildProgressDlg::BUILD_MINMAX" +msgstr "Building min/max..." + msgid "VVTK_ViewManager::VTK_VIEW_TITLE" msgstr "VISU scene:%1 - viewer:%2" diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index 8a4e36e2..0862abd4 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -102,6 +102,7 @@ #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" @@ -179,10 +180,17 @@ OnImportFromFile() 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(GetServant(aResult).in())) { if (!aRes->IsPossible()) @@ -197,6 +205,9 @@ OnImportFromFile() 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())) { diff --git a/src/VISUGUI/VisuGUI_BuildProgressDlg.cxx b/src/VISUGUI/VisuGUI_BuildProgressDlg.cxx new file mode 100644 index 00000000..cf44bc8e --- /dev/null +++ b/src/VISUGUI/VisuGUI_BuildProgressDlg.cxx @@ -0,0 +1,140 @@ +// 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 +#include +#include +#include +#include + +/*! + * 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 ); +} diff --git a/src/VISUGUI/VisuGUI_BuildProgressDlg.h b/src/VISUGUI/VisuGUI_BuildProgressDlg.h new file mode 100644 index 00000000..9fec674e --- /dev/null +++ b/src/VISUGUI/VisuGUI_BuildProgressDlg.h @@ -0,0 +1,67 @@ +// 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 + +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 diff --git a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx index 478adbd0..5cff94a5 100644 --- a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx +++ b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx @@ -21,8 +21,8 @@ // // // -// File : VisuGUI_MagnitudeDlg.cxx -// Author : Laurent CORNABE & Hubert ROLLAND +// File : VisuGUI_GaussPointsDlg.cxx +// Author : Oleg UVAROV // Module : VISU #include "VisuGUI_GaussPointsDlg.h" diff --git a/src/VISUGUI/VisuGUI_GaussPointsDlg.h b/src/VISUGUI/VisuGUI_GaussPointsDlg.h index 205496cf..ecb97047 100644 --- a/src/VISUGUI/VisuGUI_GaussPointsDlg.h +++ b/src/VISUGUI/VisuGUI_GaussPointsDlg.h @@ -21,8 +21,8 @@ // // // -// File : VisuGUI_MagnitudeDlg.h -// Author : Laurent CORNABE & Hubert ROLLAND +// File : VisuGUI_GaussPointsDlg.h +// Author : Oleg UVAROV // Module : VISU // $Header$