From 59f744c7255ed51f6c97065b539f42357ac63b6d Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Fri, 13 Mar 2015 15:40:29 +0000 Subject: [PATCH] Two improvements related with PlotSubWindow Fix ModulesHandle to filter PlotSubWinodws Generalize reload to be applied to all kinds of subwindows --- app/ModulesHandle.cpp | 2 +- app/PlotSubWindow.h | 5 +++++ app/SubWindowHandle.h | 5 +++++ app/VideoSubWindow.cpp | 19 +++++++++++++++---- app/VideoSubWindow.h | 3 ++- app/plaYUVerApp.cpp | 24 ++++++++++++++---------- 6 files changed, 42 insertions(+), 16 deletions(-) diff --git a/app/ModulesHandle.cpp b/app/ModulesHandle.cpp index 4e19ce7..7a5be64 100644 --- a/app/ModulesHandle.cpp +++ b/app/ModulesHandle.cpp @@ -256,7 +256,7 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf ) { QStringList selectedWindows = dialogWindowsSelection.getSelectedWindows(); VideoSubWindow *videoSubWindow; - QList subWindowList = m_pcMainWindowManager->findSubWindow(); + QList subWindowList = m_pcMainWindowManager->findSubWindow( SubWindowHandle::VIDEO_SUBWINDOW ); for( Int j = 0; j < selectedWindows.size(); j++ ) { for( Int i = 0; i < subWindowList.size(); i++ ) diff --git a/app/PlotSubWindow.h b/app/PlotSubWindow.h index 090b50b..5be3302 100644 --- a/app/PlotSubWindow.h +++ b/app/PlotSubWindow.h @@ -65,6 +65,11 @@ public: Void definePlotColors(); + Void refreshSubWindow() + { + + } + Void setTool( UInt uiTool ) { } diff --git a/app/SubWindowHandle.h b/app/SubWindowHandle.h index 8b77dc1..f7e01f3 100644 --- a/app/SubWindowHandle.h +++ b/app/SubWindowHandle.h @@ -76,6 +76,11 @@ public: SubWindowHandle( QWidget *, UInt ); ~SubWindowHandle(); + /** + * Show the image at its original size + */ + virtual Void refreshSubWindow() = 0; + /** * Show the image at its original size */ diff --git a/app/VideoSubWindow.cpp b/app/VideoSubWindow.cpp index f3c049b..8f27eec 100644 --- a/app/VideoSubWindow.cpp +++ b/app/VideoSubWindow.cpp @@ -122,11 +122,22 @@ Void VideoSubWindow::loadAll() refreshFrame(); } -Void VideoSubWindow::reloadFile() +Void VideoSubWindow::refreshSubWindow() { - Int currFrameNum = m_pCurrStream->getCurrFrameNum(); - loadFile( m_cFilename, false ); - seekAbsoluteEvent( currFrameNum ); + if( getCategory() == SubWindowHandle::VIDEO_STREAM_SUBWINDOW ) + { + Int currFrameNum = m_pCurrStream->getCurrFrameNum(); + if( !loadFile( m_cFilename, false ) ) + { + close(); + return; + } + seekAbsoluteEvent( currFrameNum ); + } + else + { + refreshFrame(); + } } Bool VideoSubWindow::loadFile( QString cFilename, Bool bForceDialog ) diff --git a/app/VideoSubWindow.h b/app/VideoSubWindow.h index 2208f15..c5ac156 100644 --- a/app/VideoSubWindow.h +++ b/app/VideoSubWindow.h @@ -117,9 +117,10 @@ public: Bool loadFile( QString cFilename, Bool bForceDialog = false ); Bool loadFile( PlaYUVerStreamInfo* streamInfo ); Void loadAll(); - Void reloadFile(); Bool save( QString filename ); + Void refreshSubWindow(); + Bool play(); Void pause(); Bool playEvent(); diff --git a/app/plaYUVerApp.cpp b/app/plaYUVerApp.cpp index 4119ced..b58189c 100644 --- a/app/plaYUVerApp.cpp +++ b/app/plaYUVerApp.cpp @@ -328,9 +328,9 @@ Void plaYUVerApp::format() Void plaYUVerApp::reload() { - if( m_pcCurrentVideoSubWindow ) + if( m_pcCurrentSubWindow ) { - m_pcCurrentVideoSubWindow->reloadFile(); + m_pcCurrentSubWindow->refreshSubWindow(); m_pcCurrentSubWindow = NULL; update(); } @@ -338,14 +338,18 @@ Void plaYUVerApp::reload() Void plaYUVerApp::reloadAll() { - VideoSubWindow *videoSubWindow; - QList subWindowList = m_pcWindowHandle->findSubWindow( SubWindowHandle::VIDEO_SUBWINDOW ); - for( Int i = 0; i < subWindowList.size(); i++ ) + UInt windowCategoryOrder[] = { - videoSubWindow = qobject_cast( subWindowList.at( i ) ); - if( !videoSubWindow->getIsModule() ) + SubWindowHandle::VIDEO_STREAM_SUBWINDOW, + SubWindowHandle::MODULE_SUBWINDOW, + SubWindowHandle::MODULE_SUBWINDOW }; + + for( UInt c = 0; c < 3; c++ ) + { + QList subWindowList = m_pcWindowHandle->findSubWindow( windowCategoryOrder[c] ); + for( Int i = 0; i < subWindowList.size(); i++ ) { - videoSubWindow->reloadFile(); + subWindowList.at( i )->refreshSubWindow(); } } m_pcCurrentSubWindow = NULL; @@ -533,10 +537,10 @@ Void plaYUVerApp::updateMenus() m_arrayActions[SAVE_ACT]->setEnabled( hasSubWindow ); m_arrayActions[CLOSE_ACT]->setEnabled( hasSubWindow ); m_arrayActions[CLOSEALL_ACT]->setEnabled( hasSubWindow ); + m_arrayActions[RELOAD_ACT]->setEnabled( hasSubWindow ); + m_arrayActions[RELOAD_ALL_ACT]->setEnabled( hasSubWindow ); m_arrayActions[FORMAT_ACT]->setEnabled( hasVideoStreamSubWindow ); - m_arrayActions[RELOAD_ACT]->setEnabled( hasVideoStreamSubWindow ); - m_arrayActions[RELOAD_ALL_ACT]->setEnabled( hasVideoStreamSubWindow ); m_arrayActions[LOAD_ALL_ACT]->setEnabled( hasVideoStreamSubWindow ); m_arrayActions[ZOOM_IN_ACT]->setEnabled( hasSubWindow );