From d97fe4e197afed67e55710f0035d90e3514883cf Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Wed, 16 Apr 2014 23:02:15 +0100 Subject: [PATCH] Disable histogram if the dock is not visible --- source/app/PropertiesSidebar.cpp | 37 +++++++++++++++++++------------- source/app/PropertiesSidebar.h | 2 ++ 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/source/app/PropertiesSidebar.cpp b/source/app/PropertiesSidebar.cpp index 5dfdcc9..43fffd7 100755 --- a/source/app/PropertiesSidebar.cpp +++ b/source/app/PropertiesSidebar.cpp @@ -355,6 +355,8 @@ FramePropertiesSideBar::FramePropertiesSideBar( QWidget* parent ) : setLayout( mainLayout ); setEnabled( false ); + + connect( this, SIGNAL( visibilityChanged(bool) ), this, SLOT( slotUpdateHistogram() ) ); connect( channelCB, SIGNAL( activated(int) ), this, SLOT( slotChannelChanged(int) ) ); connect( scaleButtonGroup, SIGNAL( buttonClicked(int) ), this, SLOT( slotScaleChanged(int) ) ); connect( colorsCB, SIGNAL( activated(int) ), this, SLOT( slotColorsChanged(int) ) ); @@ -384,6 +386,25 @@ QSize FramePropertiesSideBar::sizeHint() const return bestSize( size() ); } +void FramePropertiesSideBar::slotUpdateHistogram() +{ + if( m_pcFrame->isValid() && isVisible() ) + { + // If a selection area is done in Image Editor and if the current + // image is the same in Image Viewer, then compute too the histogram + // for this selection. + histogramWidget->updateData( *m_pcFrame, PlaYUVerFrame() ); + fullImageButton->hide(); + selectionImageButton->hide(); + updateInformations(); + } + else + { + histogramWidget->setLoadingFailed(); + slotHistogramComputationFailed(); + } +} + Void FramePropertiesSideBar::setData( PlaYUVerFrame* pcFrame ) { // Clear information. @@ -463,21 +484,7 @@ Void FramePropertiesSideBar::setData( PlaYUVerFrame* pcFrame ) m_pcFrame = pcFrame; - if( m_pcFrame->isValid() ) - { - // If a selection area is done in Image Editor and if the current - // image is the same in Image Viewer, then compute too the histogram - // for this selection. - histogramWidget->updateData( *m_pcFrame, PlaYUVerFrame() ); - fullImageButton->hide(); - selectionImageButton->hide(); - updateInformations(); - } - else - { - histogramWidget->setLoadingFailed(); - slotHistogramComputationFailed(); - } + slotUpdateHistogram(); } } diff --git a/source/app/PropertiesSidebar.h b/source/app/PropertiesSidebar.h index d494764..c6aac6c 100755 --- a/source/app/PropertiesSidebar.h +++ b/source/app/PropertiesSidebar.h @@ -52,6 +52,7 @@ public: private: InputStream* m_pcStream; + Bool m_bIsVisible; QLabel* labelFormatValue; QLabel* labelCodecValue; QLabel* labelDurationValueTime; @@ -134,6 +135,7 @@ private: void updateStatistiques(); private Q_SLOTS: + void slotUpdateHistogram(); void slotRefreshOptions( bool sixteenBit ); void slotHistogramComputationFailed( void ); void slotChannelChanged( int channel );