From: apo Date: Tue, 19 Dec 2006 14:56:14 +0000 (+0000) Subject: To improve calculation of "aLimitedMemoryMax" X-Git-Tag: WP1_2_3_20-12-2006_bug_fixing~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=99b34f199f705dbd5738e609bdb0a2088a260c69;p=modules%2Fvisu.git To improve calculation of "aLimitedMemoryMax" --- diff --git a/src/VISUGUI/VisuGUI_CacheDlg.cxx b/src/VISUGUI/VisuGUI_CacheDlg.cxx index a17535f2..70007bb2 100644 --- a/src/VISUGUI/VisuGUI_CacheDlg.cxx +++ b/src/VISUGUI/VisuGUI_CacheDlg.cxx @@ -65,7 +65,9 @@ VisuGUI_CacheDlg::VisuGUI_CacheDlg( VISU::ColoredPrs3dCache_var theCache, long aMb = 1024 * 1024; bool isLimitedMemory = myCache->GetMemoryMode() == VISU::ColoredPrs3dCache::LIMITED; double aLimitedMemory = myCache->GetLimitedMemory(); - double aLimitedMemoryMax = (double)VISU_PipeLine::GetAvailableMemory( 2048 * aMb ) / (double)aMb; + double aFreeMemory = (double)VISU_PipeLine::GetAvailableMemory( 2048 * aMb ) / (double)aMb; + double anUsedMemory = myCache->GetMemorySize(); + double aLimitedMemoryMax = std::max(anUsedMemory + aFreeMemory, aLimitedMemory); // Settings QButtonGroup* aMemoryGroup = new QButtonGroup( 2, Qt::Vertical, tr( "MEMORY_MODE" ), this ); @@ -77,7 +79,7 @@ VisuGUI_CacheDlg::VisuGUI_CacheDlg( VISU::ColoredPrs3dCache_var theCache, myMimimalMemoryButton = new QRadioButton( tr( "MINIMAL_MEMORY" ), aMemoryGroup ); myMimimalMemoryButton->setChecked( !isLimitedMemory ); - myLimitedMemory = new QtxDblSpinBox( 1.0, std::max( aLimitedMemory, aLimitedMemoryMax ), 10.0, aMemoryGroup ); + myLimitedMemory = new QtxDblSpinBox( 1.0, aLimitedMemoryMax, 10.0, aMemoryGroup ); myLimitedMemory->setSuffix( " Mb" ); myLimitedMemory->setValue( aLimitedMemory ); myLimitedMemory->setEnabled( isLimitedMemory ); @@ -96,14 +98,14 @@ VisuGUI_CacheDlg::VisuGUI_CacheDlg( VISU::ColoredPrs3dCache_var theCache, QLabel* aUsedMemoryLabel = new QLabel( tr( "USED_BY_CACHE" ), aStateGroup ); myUsedMemory = new QLineEdit( aStateGroup ); - myUsedMemory->setText( QString::number( (double)myCache->GetMemorySize() ) + " Mb" ); + myUsedMemory->setText( QString::number( anUsedMemory ) + " Mb" ); myUsedMemory->setReadOnly( true ); myUsedMemory->setEnabled( false ); myUsedMemory->setPaletteForegroundColor( Qt::black ); QLabel* aFreeMemoryLabel = new QLabel( tr( "FREE" ), aStateGroup ); myFreeMemory = new QLineEdit( aStateGroup ); - myFreeMemory->setText( QString::number( aLimitedMemoryMax ) + " Mb" ); + myFreeMemory->setText( QString::number( aFreeMemory ) + " Mb" ); myFreeMemory->setReadOnly( true ); myFreeMemory->setEnabled( false ); myFreeMemory->setPaletteForegroundColor( Qt::black );