diff --git a/source/app/ModulesHandle.cpp b/source/app/ModulesHandle.cpp index af56d0a..900a044 100644 --- a/source/app/ModulesHandle.cpp +++ b/source/app/ModulesHandle.cpp @@ -99,6 +99,7 @@ SubWindowHandle* ModulesHandle::toggleSelectedModuleIf() connect( interfaceChild->getViewArea(), SIGNAL( positionChanged(const QPoint &, PlaYUVerFrame *) ), this, SLOT( updatePixelValueStatusBar(const QPoint &, PlaYUVerFrame *) ) ); currModuleIf->m_pcDisplaySubWindow = interfaceChild; + currModuleIf->m_pcDisplaySubWindow->setModule( currModuleIf ); } else { @@ -117,15 +118,11 @@ Void ModulesHandle::destroyModuleIf( PlaYUVerModuleIf *pcCurrModuleIf ) { pcCurrModuleIf->m_pcAction->setChecked( false ); if( pcCurrModuleIf->m_pcDisplaySubWindow ) - { pcCurrModuleIf->m_pcDisplaySubWindow->close(); - pcCurrModuleIf->m_pcDisplaySubWindow = NULL; - } - else - { + if( pcCurrModuleIf->m_pcSubWindow ) pcCurrModuleIf->m_pcSubWindow->disableModule(); - } - pcCurrModuleIf->m_pcSubWindow->refreshFrame(); + + pcCurrModuleIf->m_pcDisplaySubWindow = NULL; pcCurrModuleIf->m_pcSubWindow = NULL; pcCurrModuleIf->destroy(); } diff --git a/source/app/ModulesHandle.h b/source/app/ModulesHandle.h index a9a6ec1..826a9f1 100644 --- a/source/app/ModulesHandle.h +++ b/source/app/ModulesHandle.h @@ -55,6 +55,8 @@ public: Void updateMenus( Bool hasSubWindow ); SubWindowHandle* toggleSelectedModuleIf(); + static Void destroyModuleIf( PlaYUVerModuleIf* pcCurrModuleIf ); + private: QWidget *m_pcParent; QMdiArea *m_pcMdiArea; @@ -77,7 +79,6 @@ private: Void appendModule( PlaYUVerModuleIf* ); Void ModulesList( Bool bCreate ); - Void destroyModuleIf( PlaYUVerModuleIf* pcCurrModuleIf ); private Q_SLOTS: void selectModule( int index ); diff --git a/source/app/SubWindowHandle.cpp b/source/app/SubWindowHandle.cpp index 89b8811..6b25a1c 100644 --- a/source/app/SubWindowHandle.cpp +++ b/source/app/SubWindowHandle.cpp @@ -124,11 +124,14 @@ Void SubWindowHandle::enableModule( PlaYUVerModuleIf* select_module ) Void SubWindowHandle::disableModule() { - if( !m_pcCurrentModule ) - return; - m_pcCurrentModule = NULL; - m_pcModuleSubWindow = NULL; - refreshFrame(); + if( m_pcCurrentModule ) + { + PlaYUVerModuleIf* pcCurrentModule = m_pcCurrentModule; + m_pcCurrentModule = NULL; + m_pcModuleSubWindow = NULL; + ModulesHandle::destroyModuleIf( pcCurrentModule ); + refreshFrame(); + } } Void SubWindowHandle::setCurrFrame( PlaYUVerFrame* pcCurrFrame ) @@ -139,19 +142,16 @@ Void SubWindowHandle::setCurrFrame( PlaYUVerFrame* pcCurrFrame ) Void SubWindowHandle::refreshFrame() { - m_pcCurrFrame = m_pCurrStream->getCurrFrame(); - if( m_pcCurrentModule ) + if( m_pCurrStream ) { - if( m_pcModuleSubWindow ) - { - m_pcModuleSubWindow->setCurrFrame( m_pcCurrentModule->process( m_pCurrStream->getCurrFrame() ) ); - } - else - { - m_pcCurrFrame = m_pcCurrentModule->process( m_pCurrStream->getCurrFrame() ); - } + m_pcCurrFrame = m_pCurrStream->getCurrFrame(); + if( m_pcCurrentModule ) + if( m_pcModuleSubWindow ) + m_pcModuleSubWindow->setCurrFrame( m_pcCurrentModule->process( m_pCurrStream->getCurrFrame() ) ); + else + m_pcCurrFrame = m_pcCurrentModule->process( m_pCurrStream->getCurrFrame() ); + m_cViewArea->setImage( m_pcCurrFrame ); } - m_cViewArea->setImage( m_pcCurrFrame ); } Bool SubWindowHandle::save() diff --git a/source/app/SubWindowHandle.h b/source/app/SubWindowHandle.h index 4ed8df4..1383e29 100644 --- a/source/app/SubWindowHandle.h +++ b/source/app/SubWindowHandle.h @@ -1,21 +1,21 @@ /* This file is a part of plaYUVer project -* Copyright (C) 2014 by Luis Lucas (luisfrlucas@gmail.com) -* Joao Carreira (jfmcarreira@gmail.com) -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ + * Copyright (C) 2014 by Luis Lucas (luisfrlucas@gmail.com) + * Joao Carreira (jfmcarreira@gmail.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ /** * \file SubWindowHandle.h @@ -107,6 +107,10 @@ public: { m_pcModuleSubWindow = pcWindow; } + Void setModule( PlaYUVerModuleIf* pcCurrentModule ) + { + m_pcCurrentModule = pcCurrentModule; + } /** * Functions to enable a module in the @@ -175,9 +179,9 @@ protected: void closeEvent( QCloseEvent *event ); public Q_SLOTS: - void adjustScrollBarByZoom( double factor , QPoint center ); + void adjustScrollBarByZoom( double factor, QPoint center ); void adjustScrollBarByOffset( QPoint Offset ); - void updateLastScrollValue( ); + void updateLastScrollValue(); }; } // NAMESPACE