From 719dfb6505c54fa1d2c0b36af792dae6c1ac3dc8 Mon Sep 17 00:00:00 2001 From: apo Date: Mon, 19 May 2008 08:02:49 +0000 Subject: [PATCH] To improve "slider" functionality --- src/VISUGUI/VisuGUI.cxx | 2 -- src/VISUGUI/VisuGUI_Slider.cxx | 33 +++++++++++++++++++++++++++++---- src/VISUGUI/VisuGUI_Slider.h | 6 +++++- 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index f705568e..3ce326cd 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -2873,8 +2873,6 @@ VisuGUI bool aResult = SalomeApp_Module::activateModule( theStudy ); if ( !mySlider ) { - SALOMEDS::Study_var aStudy = GetDSStudy( GetCStudy( GetAppStudy( this ) ) ); - VISU::ColoredPrs3dCache_var aCache = GetVisuGen( this )->GetColoredPrs3dCache( aStudy ); mySlider = new VisuGUI_Slider( this, getApp()->desktop(), getApp()->selectionMgr() ); } diff --git a/src/VISUGUI/VisuGUI_Slider.cxx b/src/VISUGUI/VisuGUI_Slider.cxx index 1c06a069..61460891 100644 --- a/src/VISUGUI/VisuGUI_Slider.cxx +++ b/src/VISUGUI/VisuGUI_Slider.cxx @@ -76,9 +76,10 @@ VisuGUI_Slider::VisuGUI_Slider( VisuGUI* theModule, QMainWindow* theParent, LightApp_SelectionMgr* theSelectionMgr ) - : QWidget( theParent ), - myViewManager( VISU::GetVisuGen( theModule )->GetViewManager() ), - mySelectionMgr( theSelectionMgr ) + : QWidget( theParent ) + , myViewManager( VISU::GetVisuGen( theModule )->GetViewManager() ) + , mySelectionMgr( theSelectionMgr ) + , myModule( theModule ) { setWindowTitle( tr("TITLE") ); @@ -278,7 +279,8 @@ VisuGUI_Slider::VisuGUI_Slider( VisuGUI* theModule, connect( myTimer, SIGNAL( timeout() ), SLOT( onTimeout() ) ); //---------------------------------------------------------------------------- - connect( myLimitedMemoryButton, SIGNAL( toggled( bool ) ), myLimitedMemory, SLOT( setEnabled( bool ) ) ); + connect( myLimitedMemoryButton, SIGNAL( toggled( bool ) ), this, SLOT( onMemoryModeChanged( bool ) ) ); + connect( myLimitedMemory, SIGNAL( valueChanged( double ) ), this, SLOT( onMemorySizeChanged( double ) ) ); //---------------------------------------------------------------------------- enableControls( false ); @@ -306,6 +308,29 @@ void VisuGUI_Slider::onModuleActivated() setHidden( false ); } + +void VisuGUI_Slider::onMemoryModeChanged( bool ) +{ + using namespace VISU; + SALOMEDS::Study_var aStudy = GetDSStudy( GetCStudy( GetAppStudy( myModule ) ) ); + VISU::ColoredPrs3dCache_var aCache = GetVisuGen( myModule )->GetColoredPrs3dCache( aStudy ); + + if ( myLimitedMemoryButton->isChecked() ) { + aCache->SetMemoryMode( VISU::ColoredPrs3dCache::LIMITED ); + aCache->SetLimitedMemory( myLimitedMemory->value() ); + } else + aCache->SetMemoryMode( VISU::ColoredPrs3dCache::MINIMAL ); + + myLimitedMemory->setEnabled( myLimitedMemoryButton->isChecked() ); +} + + +void VisuGUI_Slider::onMemorySizeChanged( double ) +{ + onMemoryModeChanged( myLimitedMemoryButton->isChecked() ); +} + + bool VisuGUI_Slider::checkHolderList() { THolderList aHolderList; diff --git a/src/VISUGUI/VisuGUI_Slider.h b/src/VISUGUI/VisuGUI_Slider.h index ecd4f5e1..97397c5b 100644 --- a/src/VISUGUI/VisuGUI_Slider.h +++ b/src/VISUGUI/VisuGUI_Slider.h @@ -83,6 +83,9 @@ public slots: virtual void onTimeout(); + void onMemoryModeChanged( bool ); + void onMemorySizeChanged( double ); + protected slots: void onModuleDeactivated(); void onModuleActivated(); @@ -94,7 +97,8 @@ protected: private: LightApp_SelectionMgr* mySelectionMgr; - VISU::ViewManager_var myViewManager; + VISU::ViewManager_var myViewManager; + VisuGUI* myModule; QSlider* mySlider; QLabel* myFirstTimeStamp; -- 2.39.2