#include <qbuttongroup.h>
#include <qgroupbox.h>
+#include <qlabel.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qpushbutton.h>
aTopLayout->setMargin( 6 );
aTopLayout->setAutoAdd( true );
+ long aMb = 1024 * 1024;
bool isLimitedMemory = myCache->GetMemoryMode() == VISU::ColoredPrs3dCache::LIMITED;
double aLimitedMemory = myCache->GetLimitedMemory();
- double aLimitedMemoryMax = ( double )( VISU_PipeLine::GetAvailableMemory( 2048 * 1024 * 1024.0 ) / ( 1024 * 1024.0 ) );
+ double aLimitedMemoryMax = (double)VISU_PipeLine::GetAvailableMemory( 2048 * aMb ) / (double)aMb;
// Settings
QButtonGroup* aMemoryGroup = new QButtonGroup( 2, Qt::Vertical, tr( "MEMORY_MODE" ), this );
myMimimalMemoryButton = new QRadioButton( tr( "MINIMAL_MEMORY" ), aMemoryGroup );
myMimimalMemoryButton->setChecked( !isLimitedMemory );
- myLimitedMemory = new QtxDblSpinBox( 1.0, aLimitedMemoryMax, 10.0, aMemoryGroup );
+ myLimitedMemory = new QtxDblSpinBox( 1.0, std::max( aLimitedMemory, aLimitedMemoryMax ), 10.0, aMemoryGroup );
myLimitedMemory->setSuffix( " Mb" );
myLimitedMemory->setValue( aLimitedMemory );
myLimitedMemory->setEnabled( isLimitedMemory );
connect( myLimitedMemoryButton, SIGNAL( toggled( bool ) ), myLimitedMemory, SLOT( setEnabled( bool ) ) );
+ // Current state
+ QGroupBox* aStateGroup = new QGroupBox( tr( "MEMORY STATE" ), this );
+ aStateGroup->setColumnLayout( 0, Qt::Vertical );
+ aStateGroup->layout()->setSpacing( 0 );
+ aStateGroup->layout()->setMargin( 0 );
+
+ QGridLayout* aStateLayout = new QGridLayout( aStateGroup->layout(), 2, 2 );
+ aStateLayout->setSpacing(6);
+ aStateLayout->setMargin(6);
+
+ QLabel* aUsedMemoryLabel = new QLabel( tr( "USED_BY_CACHE" ), aStateGroup );
+ myUsedMemory = new QLineEdit( aStateGroup );
+ myUsedMemory->setText( QString::number( (double)myCache->GetMemorySize() ) + " 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->setReadOnly( true );
+ myFreeMemory->setEnabled( false );
+ myFreeMemory->setPaletteForegroundColor( Qt::black );
+
+ aStateLayout->addWidget( aUsedMemoryLabel, 0, 0 );
+ aStateLayout->addWidget( myUsedMemory, 0, 1 );
+ aStateLayout->addWidget( aFreeMemoryLabel, 1, 0 );
+ aStateLayout->addWidget( myFreeMemory, 1, 1 );
+
// Ok / Cancel
QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
GroupButtons->setColumnLayout(0, Qt::Vertical );