#include <vtkActorCollection.h>
#include <vtkRenderer.h>
-#include <qcheckbox.h>
#include <qcombobox.h>
+#include <qfont.h>
#include <qlabel.h>
#include <qlayout.h>
-#include <qhbox.h>
-#include <qhbuttongroup.h>
-#include <qpushbutton.h>
+#include <qlineedit.h>
#include <qtoolbutton.h>
+#include <qtooltip.h>
#include <qslider.h>
#include <qspinbox.h>
#include <qtimer.h>
-#include <qfont.h>
-
-#define SHOW_MEMORY_STATE
/*!
Constructor
QWidget* aWidget = new QWidget( this );
setWidget( aWidget );
- QVBoxLayout* aBasicLayout = new QVBoxLayout( aWidget, 11, 6 );
+ QGridLayout* aLayout = new QGridLayout( aWidget, 2, 13, 11, 6 );
// Slider and time stamps
- QHBoxLayout* aSliderLayout = new QHBoxLayout( 0, 0, 6 );
-
myFirstTimeStamp = new QLabel( aWidget );
myFirstTimeStamp->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
- myFirstTimeStamp->setText( "" );
- aSliderLayout->addWidget( myFirstTimeStamp );
+ aLayout->addWidget( myFirstTimeStamp, 0, 0, Qt::AlignHCenter );
mySlider = new QSlider( aWidget );
mySlider->setMinValue( 0 );
mySlider->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
mySlider->setOrientation( QSlider::Horizontal );
mySlider->setTracking( false );
- aSliderLayout->addWidget( mySlider );
+ aLayout->addMultiCellWidget( mySlider, 0, 0, 1, 8 );
myLastTimeStamp = new QLabel( aWidget );
myLastTimeStamp->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
- myLastTimeStamp->setText( "" );
- aSliderLayout->addWidget( myLastTimeStamp );
+ aLayout->addWidget( myLastTimeStamp, 0, 9, Qt::AlignHCenter );
myTimeStampsNumber = new QLabel( aWidget );
myTimeStampsNumber->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
- myTimeStampsNumber->setText( "" );
- aSliderLayout->addWidget( myTimeStampsNumber );
+ aLayout->addWidget( myTimeStampsNumber, 0, 10, Qt::AlignHCenter );
- myTimeStampStrings = new QComboBox( aWidget );
- myTimeStampStrings->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
- aSliderLayout->addWidget( myTimeStampStrings );
+ QLabel* aCacheMemoryLabel = new QLabel( tr( "CACHE_MEMORY" ), aWidget );
+ aCacheMemoryLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
+ aLayout->addWidget( aCacheMemoryLabel, 0, 11 );
- myTimeStampIndices = new QComboBox( aWidget );
- myTimeStampIndices->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
- aSliderLayout->addWidget( myTimeStampIndices );
- aBasicLayout->addLayout( aSliderLayout );
+ myCacheMemory = new QLabel( aWidget );
+ myCacheMemory->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
+ QFontMetrics fm( myCacheMemory->font() );
+ myCacheMemory->setFixedWidth( fm.width( "9.99E+99 Mb" ) );
- // Buttons
- QHBoxLayout* aButtonsLayout = new QHBoxLayout( 0, 0, 6 );
+ aLayout->addWidget( myCacheMemory, 0, 12 );
- myMoreButton = new QPushButton( tr( "MORE" ), aWidget );
+ // Buttons
+ myMoreButton = new QToolButton( aWidget );
myMoreButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
- myMoreButton->setToggleButton( true );
myMoreButton->setEnabled( false );
- aButtonsLayout->addWidget( myMoreButton );
+ myMoreButton->setToggleButton( true );
+ myMoreButton->setIconSet( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_MORE" ) ) );
+ QToolTip::add( myMoreButton, tr( "MORE" ) );
+ aLayout->addWidget( myMoreButton, 1, 0 );
+
+ myAVIButton = new QToolButton( aWidget );
+ myAVIButton->setEnabled( false );
+ myAVIButton->setToggleButton( true );
+ myAVIButton->setIconSet( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_AVI" ) ) );
+ QToolTip::add( myAVIButton, tr( "AVI" ) );
+ aLayout->addWidget( myAVIButton, 1, 1 );
- aButtonsLayout->addItem( new QSpacerItem( 24, 24, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
+ aLayout->addItem( new QSpacerItem( 24, 24, QSizePolicy::Expanding, QSizePolicy::Minimum ), 1, 2 );
myFirstButton = new QToolButton( aWidget );
myFirstButton->setIconSet( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_FIRST" ) ) );
- aButtonsLayout->addWidget( myFirstButton );
+ aLayout->addWidget( myFirstButton, 1, 3 );
myPreviousButton = new QToolButton( aWidget );
myPreviousButton->setIconSet( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PREVIOUS" ) ) );
- aButtonsLayout->addWidget( myPreviousButton );
+ aLayout->addWidget( myPreviousButton, 1, 4 );
myPlayButton = new QToolButton( aWidget );
myPlayButton->setIconSet( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PLAY" ) ) );
myPlayButton->setToggleButton( true );
- aButtonsLayout->addWidget( myPlayButton );
+ aLayout->addWidget( myPlayButton, 1, 5 );
myNextButton = new QToolButton( aWidget );
myNextButton->setIconSet( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_NEXT" ) ) );
- aButtonsLayout->addWidget( myNextButton );
+ aLayout->addWidget( myNextButton, 1, 6 );
myLastButton = new QToolButton( aWidget );
myLastButton->setIconSet( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_LAST" ) ) );
- aButtonsLayout->addWidget( myLastButton );
-
- aButtonsLayout->addItem( new QSpacerItem( 24, 24, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
-
-#ifdef SHOW_MEMORY_STATE
- // Memory state
- QLabel* aCacheMemoryLabel = new QLabel( tr( "CACHE_MEMORY" ), aWidget );
- aCacheMemoryLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
- aButtonsLayout->addWidget( aCacheMemoryLabel );
+ aLayout->addWidget( myLastButton, 1, 7 );
- myCacheMemory = new QLabel( aWidget );
- myCacheMemory->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
- aButtonsLayout->addWidget( myCacheMemory );
+ aLayout->addItem( new QSpacerItem( 24, 24, QSizePolicy::Expanding, QSizePolicy::Minimum ), 1, 8 );
- QLabel* aFreeMemoryLabel = new QLabel( tr( "FREE_MEMORY" ), aWidget );
- aFreeMemoryLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
- aButtonsLayout->addWidget( aFreeMemoryLabel );
-
- myFreeMemory = new QLabel( aWidget );
- myFreeMemory->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
- aButtonsLayout->addWidget( myFreeMemory );
+ myTimeStampStrings = new QComboBox( aWidget );
+ myTimeStampStrings->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
+ aLayout->addWidget( myTimeStampStrings, 1, 9 );
- aButtonsLayout->addItem( new QSpacerItem( 24, 24, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
-#endif
+ myTimeStampIndices = new QComboBox( aWidget );
+ myTimeStampIndices->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
+ aLayout->addWidget( myTimeStampIndices, 1, 10 );
// Speed
QLabel* aSpeedLabel = new QLabel( tr( "SPEED" ), aWidget );
aSpeedLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
- aButtonsLayout->addWidget( aSpeedLabel );
+ aLayout->addWidget( aSpeedLabel, 1, 11 );
mySpeedBox = new QSpinBox( 1, 100, 1, aWidget );
mySpeedBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
mySpeedBox->setValue( 50 );
- aButtonsLayout->addWidget( mySpeedBox );
-
- // AVI
- myAVIBox = new QCheckBox( tr( "AVI" ), aWidget );
- myAVIBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
- myAVIBox->setEnabled( false );
- aButtonsLayout->addWidget( myAVIBox );
- aBasicLayout->addLayout( aButtonsLayout );
+ aLayout->addWidget( mySpeedBox, 1, 12 );
myTimer = new QTimer( this );
void VisuGUI_Slider::updateMemoryState()
{
-#ifdef SHOW_MEMORY_STATE
if( checkHolderList() )
return;
VISU::ColoredPrs3dCache_var aCache = aHolder->GetCache();
CORBA::Float aCacheMemory = aCache->GetMemorySize();
- myCacheMemory->setText( QString::number( aCacheMemory ) + " Mb" );
-
- long aMb = 1024 * 1024;
- double aFreeMemory = (double)VISU_PipeLine::GetAvailableMemory( 2048 * aMb ) / (double)aMb;
- myFreeMemory->setText( QString::number( aFreeMemory ) + " Mb" );
-#endif
+ myCacheMemory->setText( QString::number( double( aCacheMemory ), 'E', 2 ) + " Mb" );
}
void VisuGUI_Slider::onSelectionChanged()