From 32c224a49d4e07008f8aece99dc7b4d96cf92069 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Tue, 31 Mar 2015 17:23:06 +0100 Subject: [PATCH] ../app/DialogSubWindowSelector.cpp Fix duplicate call of select sub window function --- app/DialogSubWindowSelector.cpp | 2 +- app/PlaYUVerApp.cpp | 4 +++- app/VideoHandle.cpp | 10 ++++++---- app/VideoHandle.h | 3 +-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/DialogSubWindowSelector.cpp b/app/DialogSubWindowSelector.cpp index b2a13df..3d6fe20 100644 --- a/app/DialogSubWindowSelector.cpp +++ b/app/DialogSubWindowSelector.cpp @@ -146,7 +146,7 @@ Void DialogSubWindowSelector::selectSubWindow( SubWindowHandle * subWindow ) if( iIdx >= 0 ) { m_apcWindowsListCheckBox.at( iIdx )->setChecked( true ); - m_apcSelectedSubWindowList.append( m_apcSubWindowList.at( iIdx ) ); + //m_apcSelectedSubWindowList.append( m_apcSubWindowList.at( iIdx ) ); } } diff --git a/app/PlaYUVerApp.cpp b/app/PlaYUVerApp.cpp index 8fb0e3a..e618a47 100644 --- a/app/PlaYUVerApp.cpp +++ b/app/PlaYUVerApp.cpp @@ -215,6 +215,8 @@ Void plaYUVerApp::loadFile( QString fileName, PlaYUVerStreamInfo* pStreamInfo ) videoSubWindow->show(); connect( videoSubWindow->getViewArea(), SIGNAL( selectionChanged( QRect ) ), m_appModuleVideo, SLOT( updateSelectionArea( QRect ) ) ); + + connect( subWindow, SIGNAL( aboutToClose( SubWindowHandle* ) ), m_appModuleVideo, SLOT( closeSubWindow( SubWindowHandle* ) ) ); 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 ) ) ); @@ -643,7 +645,7 @@ Void plaYUVerApp::createActions() m_arrayActions[CLOSEALL_ACT] = new QAction( tr( "Close &All" ), this ); m_arrayActions[CLOSEALL_ACT]->setStatusTip( tr( "Close all the windows" ) ); - connect( m_arrayActions[CLOSEALL_ACT], SIGNAL( triggered() ), this, SLOT( closeAll() ) ); + connect( m_arrayActions[CLOSEALL_ACT], SIGNAL( triggered() ), m_pcWindowHandle, SLOT( removeAllSubWindow() ) ); m_arrayActions[EXIT_ACT] = new QAction( tr( "E&xit" ), this ); m_arrayActions[EXIT_ACT]->setShortcuts( QKeySequence::Quit ); diff --git a/app/VideoHandle.cpp b/app/VideoHandle.cpp index 91d0a4b..6ba3c33 100644 --- a/app/VideoHandle.cpp +++ b/app/VideoHandle.cpp @@ -276,11 +276,13 @@ Void VideoHandle::updateSelectionArea( QRect area ) } } -Void VideoHandle::closeSubWindow( VideoSubWindow* currSubWindow ) +Void VideoHandle::closeSubWindow( SubWindowHandle* subWindow ) { - if( m_acPlayingSubWindows.contains( currSubWindow ) ) + VideoSubWindow* videoSubWindow = qobject_cast( subWindow ); + + if( m_acPlayingSubWindows.contains( videoSubWindow ) ) { - Int pos = m_acPlayingSubWindows.indexOf( currSubWindow ); + Int pos = m_acPlayingSubWindows.indexOf( videoSubWindow ); m_acPlayingSubWindows.at( pos )->stop(); m_acPlayingSubWindows.remove( pos ); if( m_acPlayingSubWindows.size() < 2 ) @@ -401,7 +403,7 @@ Void VideoHandle::setTimerStatus() else { #if( _CONTROL_PLAYING_TIME_ == 1 ) - if( m_pcPlayControlTimer ) + if( m_pcPlayControlTimer && m_pcPlayingTimer->interval() > 0 ) { qDebug( ) << "Desired Fps: " << 1000 / m_pcPlayingTimer->interval() diff --git a/app/VideoHandle.h b/app/VideoHandle.h index 1dc13e0..7a92a75 100644 --- a/app/VideoHandle.h +++ b/app/VideoHandle.h @@ -66,8 +66,6 @@ public: Void update( VideoSubWindow* currSubWindow ); - Void closeSubWindow( VideoSubWindow* currSubWindow ); - private: QWidget* m_pcParet; PlaYUVerSubWindowHandle* m_pcMainWindowManager; @@ -119,6 +117,7 @@ Q_SIGNALS: private Q_SLOTS: void update(); void updateSelectionArea( QRect area ); + void closeSubWindow( SubWindowHandle* subWindow ); void zoomToFactorAll( const double factor, const QPoint center = QPoint() ); void moveAllScrollBars( const QPoint offset ); void play();