From b6b3f3e7192a42ce0b0e4fbb9a73febd35de834f Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Wed, 8 Apr 2015 01:37:48 +0100 Subject: [PATCH] Minor fixes in progress bar --- app/ProgressBar.cpp | 12 ++++++++---- app/ProgressBar.h | 1 + app/QualityHandle.cpp | 34 ++++++++++++++++++++++++++++------ 3 files changed, 37 insertions(+), 10 deletions(-) diff --git a/app/ProgressBar.cpp b/app/ProgressBar.cpp index c264599..6f0104f 100644 --- a/app/ProgressBar.cpp +++ b/app/ProgressBar.cpp @@ -45,10 +45,13 @@ ProgressBar::ProgressBar( QWidget *parent, UInt maxValue ) : setLayout( mainLayout ); setWindowTitle( QStringLiteral( "Progress" ) ); - QSize screenSize = QApplication::desktop()->availableGeometry().size(); - QPoint screenCenter = QApplication::desktop()->availableGeometry().center(); - resize( screenSize.width() / 4, screenSize.height() / 10 ); - move( screenCenter.x() - screenSize.width() / 8, screenCenter.y() - screenSize.height() / 10 ); +// QSize appSize = QApplication::desktop()->availableGeometry().size(); +// QPoint appCenter = QApplication::desktop()->availableGeometry().center(); + QSize appSize = parent->size(); + QPoint appPos = parent->pos(); + QPoint appCenter = QPoint( appPos.x() + appSize.width() / 2, appPos.y() + appSize.height() / 2 ); + resize( appSize.width() / 4, appSize.height() / 10 ); + move( appCenter.x() - appSize.width() / 8, appCenter.y() - appSize.height() / 20 ); show(); } @@ -56,5 +59,6 @@ Void ProgressBar::incrementProgress( UInt increment ) { m_uiProgress += increment; m_pcProgressBar->setValue( m_uiProgress ); + update(); } } // NAMESPACE diff --git a/app/ProgressBar.h b/app/ProgressBar.h index fffa430..8cba896 100644 --- a/app/ProgressBar.h +++ b/app/ProgressBar.h @@ -27,6 +27,7 @@ #include "PlaYUVerAppDefs.h" #include +#include class QProgressBar; diff --git a/app/QualityHandle.cpp b/app/QualityHandle.cpp index ba4f630..9eb7719 100644 --- a/app/QualityHandle.cpp +++ b/app/QualityHandle.cpp @@ -106,14 +106,35 @@ QDockWidget* QualityHandle::createDock() Void QualityHandle::updateMenus() { - VideoSubWindow* pcSubWindow = qobject_cast( m_pcMainWindowManager->activeSubWindow() ); - Bool hasSubWindow = pcSubWindow ? true : false; + VideoSubWindow* pcCurrentVideoSubWindow = qobject_cast( m_pcMainWindowManager->activeSubWindow() ); + Bool hasSubWindow = pcCurrentVideoSubWindow ? true : false; + Bool hasReference = false; + Bool isReference = false; + + if( hasSubWindow ) + { + hasReference = pcCurrentVideoSubWindow->getRefSubWindow() != NULL ? true : false; + if( hasSubWindow && !hasReference ) + { + VideoSubWindow* pcVideoSubWindow; + QList subWindowList = m_pcMainWindowManager->findSubWindow( SubWindowHandle::VIDEO_STREAM_SUBWINDOW ); + for( Int i = 0; i < subWindowList.size(); i++ ) + { + pcVideoSubWindow = qobject_cast( subWindowList.at( i ) ); + if( pcVideoSubWindow->getRefSubWindow() == pcCurrentVideoSubWindow ) + { + isReference = true; + break; + } + } + } + } m_pcSubMenuQualityMetrics->setEnabled( hasSubWindow ); m_arrayActions[SELECT_CURR_REF_ACT]->setEnabled( hasSubWindow ); - m_arrayActions[PLOT_QUALITY]->setEnabled( hasSubWindow ); - m_arrayActions[PLOT_SEVERAL_QUALITY]->setEnabled( hasSubWindow ); + m_arrayActions[PLOT_QUALITY]->setEnabled( hasReference ); + m_arrayActions[PLOT_SEVERAL_QUALITY]->setEnabled( hasReference | isReference ); m_pcQualityHandleSideBar->updateSideBar( hasSubWindow ); } @@ -243,6 +264,7 @@ Void QualityHandle::slotSelectCurrentAsReference() } m_pcQualityHandleSideBar->updateSidebarData(); m_pcQualityHandleDock->show(); + emit changed(); } } @@ -264,7 +286,7 @@ Void QualityHandle::slotPlotQualitySingle() measureQuality( apcWindowList ); QApplication::restoreOverrideCursor(); //#endif - + emit changed(); } } } @@ -303,7 +325,7 @@ Void QualityHandle::slotPlotQualitySeveral() measureQuality( apcWindowList ); QApplication::restoreOverrideCursor(); //#endif - + emit changed(); } } }