diff --git a/source/app/SubWindowHandle.cpp b/source/app/SubWindowHandle.cpp index 4617c63..401c596 100644 --- a/source/app/SubWindowHandle.cpp +++ b/source/app/SubWindowHandle.cpp @@ -176,6 +176,11 @@ Bool SubWindowHandle::save() return true; } +Void SubWindowHandle::play() +{ + m_bIsPlaying = true; +} + Int SubWindowHandle::playEvent() { if( m_bIsPlaying ) @@ -209,8 +214,9 @@ Void SubWindowHandle::seekRelativeEvent( Bool bIsFoward ) refreshFrame(); } -Void SubWindowHandle::stopEvent() +Void SubWindowHandle::stop() { + m_bIsPlaying = false; seekAbsoluteEvent( 0 ); return; } @@ -321,7 +327,12 @@ Bool SubWindowHandle::mayClose() void SubWindowHandle::closeEvent( QCloseEvent *event ) { - event->accept(); + Bool bAccept = true; + bAccept = m_bIsPlaying ? false : bAccept; + if( bAccept ) + event->accept(); + else + event->ignore(); } } // NAMESPACE diff --git a/source/app/SubWindowHandle.h b/source/app/SubWindowHandle.h index 3d38701..154a355 100644 --- a/source/app/SubWindowHandle.h +++ b/source/app/SubWindowHandle.h @@ -67,8 +67,9 @@ public: Bool loadFile( const QString &fileName ); Bool save(); + Void play(); Int playEvent(); - Void stopEvent(); + Void stop(); Void seekAbsoluteEvent( UInt new_frame_num ); Void seekRelativeEvent( Bool bIsFoward ); diff --git a/source/app/plaYUVerApp.cpp b/source/app/plaYUVerApp.cpp index 676ce13..3c37f83 100644 --- a/source/app/plaYUVerApp.cpp +++ b/source/app/plaYUVerApp.cpp @@ -235,6 +235,7 @@ void plaYUVerApp::play() { m_acPlayingSubWindows.append( m_pcCurrentSubWindow ); m_pcCurrentSubWindow->seekAbsoluteEvent( m_acPlayingSubWindows.at( 0 )->getInputStream()->getCurrFrameNum() ); + m_pcCurrentSubWindow->play(); m_pcFrameSlider->setMaximum( qMin( m_pcFrameSlider->maximum(), ( Int )m_pcCurrentSubWindow->getInputStream()->getFrameNum() - 1 ) ); } } @@ -243,6 +244,7 @@ void plaYUVerApp::play() playingTimer->stop(); m_acPlayingSubWindows.clear(); m_acPlayingSubWindows.append( m_pcCurrentSubWindow ); + m_pcCurrentSubWindow->play(); m_uiAveragePlayInterval = 0; m_bIsPlaying = false; } @@ -270,7 +272,7 @@ void plaYUVerApp::stop() { for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ ) { - m_acPlayingSubWindows.at( i )->stopEvent(); + m_acPlayingSubWindows.at( i )->stop(); } m_acPlayingSubWindows.clear(); playingTimer->stop(); @@ -284,7 +286,7 @@ void plaYUVerApp::stop() } else { - m_pcCurrentSubWindow->stopEvent(); + m_pcCurrentSubWindow->stop(); playingTimer->stop(); m_pcFrameSlider->setValue( m_pcCurrentSubWindow->getInputStream()->getCurrFrameNum() ); }