From: ouv Date: Mon, 4 Dec 2006 11:52:11 +0000 (+0000) Subject: To improve the slider's layout X-Git-Tag: WP1_2_3_05-12-2006_cache_system~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7f8ce1915e0906cc3eda853e4d70017227ba95ef;p=modules%2Fvisu.git To improve the slider's layout --- diff --git a/src/VISUGUI/VISU_images.po b/src/VISUGUI/VISU_images.po index 8efe098c..5f65758f 100644 --- a/src/VISUGUI/VISU_images.po +++ b/src/VISUGUI/VISU_images.po @@ -133,6 +133,12 @@ msgstr "Visu_recording_stop.png" msgid "ICON_LOAD_TEXTURE" msgstr "Visu_load_texture.png" +msgid "ICON_SLIDER_MORE" +msgstr "Visu_slider_more.png" + +msgid "ICON_SLIDER_AVI" +msgstr "Visu_slider_avi.png" + msgid "ICON_SLIDER_FIRST" msgstr "Visu_slider_first.png" diff --git a/src/VISUGUI/VisuGUI_Slider.cxx b/src/VISUGUI/VisuGUI_Slider.cxx index d89b0611..d32bfa5f 100644 --- a/src/VISUGUI/VisuGUI_Slider.cxx +++ b/src/VISUGUI/VisuGUI_Slider.cxx @@ -55,20 +55,16 @@ #include #include -#include #include +#include #include #include -#include -#include -#include +#include #include +#include #include #include #include -#include - -#define SHOW_MEMORY_STATE /*! Constructor @@ -93,113 +89,97 @@ VisuGUI_Slider::VisuGUI_Slider( VisuGUI_Module* theModule, 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 ); @@ -310,7 +290,6 @@ void VisuGUI_Slider::enableControls( bool on ) void VisuGUI_Slider::updateMemoryState() { -#ifdef SHOW_MEMORY_STATE if( checkHolderList() ) return; @@ -318,12 +297,7 @@ void VisuGUI_Slider::updateMemoryState() 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() diff --git a/src/VISUGUI/VisuGUI_Slider.h b/src/VISUGUI/VisuGUI_Slider.h index 652236ea..80e4ab09 100644 --- a/src/VISUGUI/VisuGUI_Slider.h +++ b/src/VISUGUI/VisuGUI_Slider.h @@ -39,10 +39,9 @@ namespace VISU class ColoredPrs3dHolder_i; } -class QCheckBox; class QComboBox; class QLabel; -class QPushButton; +class QLineEdit; class QToolButton; class QSlider; class QSpinBox; @@ -98,21 +97,21 @@ private: QLabel* myLastTimeStamp; QLabel* myTimeStampsNumber; - QComboBox* myTimeStampStrings; - QComboBox* myTimeStampIndices; + QLabel* myCacheMemory; + + QToolButton* myMoreButton; + QToolButton* myAVIButton; - QPushButton* myMoreButton; QToolButton* myFirstButton; QToolButton* myPreviousButton; QToolButton* myPlayButton; QToolButton* myNextButton; QToolButton* myLastButton; - QLabel* myCacheMemory; - QLabel* myFreeMemory; + QComboBox* myTimeStampStrings; + QComboBox* myTimeStampIndices; QSpinBox* mySpeedBox; - QCheckBox* myAVIBox; QTimer* myTimer;