From 87e0666816cd069341041a6bc04bfb71bfcb0493 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Mon, 2 Feb 2015 22:47:49 +0000 Subject: [PATCH] Fix invalid slots in the module sub window --- app/ModulesHandle.cpp | 9 +++------ app/PlaYUVerSubWindowHandle.cpp | 32 +++++++++++++++++++------------- app/VideoSubWindow.cpp | 7 +++++++ app/plaYUVerApp.cpp | 8 ++++---- app/plaYUVerApp.h | 7 ++++--- 5 files changed, 37 insertions(+), 26 deletions(-) diff --git a/app/ModulesHandle.cpp b/app/ModulesHandle.cpp index b2ac447..a96cbf5 100644 --- a/app/ModulesHandle.cpp +++ b/app/ModulesHandle.cpp @@ -304,16 +304,12 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf ) pcModuleSubWindow->setWindowName( windowName ); connect( pcModuleSubWindow->getViewArea(), SIGNAL( selectionChanged( QRect ) ), m_appModuleVideo, SLOT( updateSelectionArea( QRect ) ) ); - connect( pcModuleSubWindow, SIGNAL( zoomFactorChanged_SWindow( const double, const QPoint ) ), m_appModuleVideo, - SLOT( zoomToFactorAll( double, QPoint ) ) ); + connect( pcModuleSubWindow, SIGNAL( zoomFactorChanged_SWindow( const double, const QPoint ) ), m_appModuleVideo, SLOT( zoomToFactorAll( double, QPoint ) ) ); connect( pcModuleSubWindow, SIGNAL( scrollBarMoved_SWindow( const QPoint ) ), m_appModuleVideo, SLOT( moveAllScrollBars( const QPoint ) ) ); - //connect( pcModuleSubWindow, SIGNAL( updateStatusBar( const QString& ) ), this, SLOT( updateStatusBar( const QString& ) ) ); - //connect( pcModuleSubWindow, SIGNAL( zoomFactorChanged_SWindow( const double, const QPoint ) ), this, SLOT( updateZoomFactorSBox() ) ); + pcCurrModuleIf->m_pcDisplaySubWindow = pcModuleSubWindow; - - //m_pcMdiArea->addSubWindow( pcModuleSubWindow ); } } @@ -351,6 +347,7 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf ) pcCurrModuleIf->m_pcSubWindow[i]->associateModule( pcCurrModuleIf ); } } + applyModuleIf( pcCurrModuleIf, false ); QCoreApplication::processEvents(); diff --git a/app/PlaYUVerSubWindowHandle.cpp b/app/PlaYUVerSubWindowHandle.cpp index 51ef31b..b407222 100644 --- a/app/PlaYUVerSubWindowHandle.cpp +++ b/app/PlaYUVerSubWindowHandle.cpp @@ -22,6 +22,7 @@ * \brief Handle multiple sub-windows */ +#include "plaYUVerApp.h" #include "PlaYUVerSubWindowHandle.h" #include "PlaYUVerMdiSubWindow.h" #include "SubWindowHandle.h" @@ -131,21 +132,26 @@ Void PlaYUVerSubWindowHandle::updateActiveSubWindow( SubWindowHandle *window ) Void PlaYUVerSubWindowHandle::addSubWindow( SubWindowHandle *window, Qt::WindowFlags flags ) { - if( m_uiWindowMode == NormalSubWindows ) + if( window ) { - connect( window, SIGNAL( aboutToActivate( SubWindowHandle* ) ), this, SLOT( updateActiveSubWindow( SubWindowHandle* ) ) ); - connect( window, SIGNAL( aboutToClose( SubWindowHandle* ) ), this, SLOT( removeSubWindow( SubWindowHandle* ) ) ); + connect( window, SIGNAL( updateStatusBar( const QString& ) ), qobject_cast( parent() ), SLOT( updateStatusBar( const QString& ) ) ); + connect( window, SIGNAL( zoomFactorChanged_SWindow( const double, const QPoint ) ), qobject_cast( parent() ), SLOT( updateZoomFactorSBox() ) ); + if( m_uiWindowMode == NormalSubWindows ) + { + connect( window, SIGNAL( aboutToActivate( SubWindowHandle* ) ), this, SLOT( updateActiveSubWindow( SubWindowHandle* ) ) ); + connect( window, SIGNAL( aboutToClose( SubWindowHandle* ) ), this, SLOT( removeSubWindow( SubWindowHandle* ) ) ); + } + if( m_uiWindowMode == MdiWSubWindows ) + { + PlaYUVerMdiSubWindow* mdiSubWindow = new PlaYUVerMdiSubWindow; + mdiSubWindow->setWidget( window ); + m_pcMdiArea->addSubWindow( mdiSubWindow ); + m_apcMdiSubWindowList.append( mdiSubWindow ); + window->setSubWindow( mdiSubWindow ); + connect( mdiSubWindow, SIGNAL( aboutToClose( PlaYUVerMdiSubWindow* ) ), this, SLOT( removeMdiSubWindow( PlaYUVerMdiSubWindow* ) ) ); + } + m_apcSubWindowList.append( window ); } - if( m_uiWindowMode == MdiWSubWindows ) - { - PlaYUVerMdiSubWindow* mdiSubWindow = new PlaYUVerMdiSubWindow; - mdiSubWindow->setWidget( window ); - m_pcMdiArea->addSubWindow( mdiSubWindow ); - m_apcMdiSubWindowList.append( mdiSubWindow ); - window->setSubWindow( mdiSubWindow ); - connect( mdiSubWindow, SIGNAL( aboutToClose( PlaYUVerMdiSubWindow* ) ), this, SLOT( removeMdiSubWindow( PlaYUVerMdiSubWindow* ) ) ); - } - m_apcSubWindowList.append( window ); } Void PlaYUVerSubWindowHandle::removeSubWindow( Int windowIdx ) diff --git a/app/VideoSubWindow.cpp b/app/VideoSubWindow.cpp index 63ff88c..e32c301 100644 --- a/app/VideoSubWindow.cpp +++ b/app/VideoSubWindow.cpp @@ -349,6 +349,13 @@ Void VideoSubWindow::disableModule( PlaYUVerAppModuleIf* pcModule ) ModulesHandle::destroyModuleIf( pcModule ); bRefresh |= true; } + if( pcModule == m_pcCurrentDisplayModule ) + { + pcModule = m_pcCurrentDisplayModule; + m_pcCurrentDisplayModule = 0; + ModulesHandle::destroyModuleIf( pcModule ); + bRefresh |= true; + } } else { diff --git a/app/plaYUVerApp.cpp b/app/plaYUVerApp.cpp index 014a448..e727674 100644 --- a/app/plaYUVerApp.cpp +++ b/app/plaYUVerApp.cpp @@ -28,6 +28,10 @@ #endif #include "plaYUVerApp.h" #include "PlaYUVerSubWindowHandle.h" +#include "VideoHandle.h" +#include "QualityHandle.h" +#include "ModulesHandle.h" + #include "DialogSubWindowSelector.h" #define SYNCHRONISED_ZOON 1 @@ -183,10 +187,6 @@ Void plaYUVerApp::loadFile( QString fileName, PlaYUVerStreamInfo* pStreamInfo ) connect( subWindow, SIGNAL( zoomFactorChanged_SWindow( const double, const QPoint ) ), m_appModuleVideo, SLOT( zoomToFactorAll( double, QPoint ) ) ); connect( subWindow, SIGNAL( scrollBarMoved_SWindow( const QPoint ) ), m_appModuleVideo, SLOT( moveAllScrollBars( const QPoint ) ) ); - connect( subWindow, SIGNAL( updateStatusBar( const QString& ) ), this, SLOT( updateStatusBar( const QString& ) ) ); - connect( subWindow, SIGNAL( zoomFactorChanged_SWindow( const double, const QPoint ) ), this, SLOT( updateZoomFactorSBox() ) ); - - videoSubWindow->zoomToFit(); videoSubWindow->getViewArea()->setTool( ( ViewArea::eTool )m_uiViewTool ); updateZoomFactorSBox(); diff --git a/app/plaYUVerApp.h b/app/plaYUVerApp.h index fe52a82..95e4f22 100644 --- a/app/plaYUVerApp.h +++ b/app/plaYUVerApp.h @@ -36,9 +36,7 @@ #include "PlaYUVerAppAdaptor.h" #endif #include -#include "VideoHandle.h" -#include "QualityHandle.h" -#include "ModulesHandle.h" + #include "SubWindowHandle.h" #include "AboutDialog.h" #include "VideoSubWindow.h" @@ -48,6 +46,9 @@ namespace plaYUVer class PlaYUVerStream; class PlaYUVerSubWindowHandle; +class VideoHandle; +class QualityHandle; +class ModulesHandle; class PlaYUVerAppAdaptor; class plaYUVerApp: public QMainWindow