Bugfix #5.
Playing of several sequences are improved and close. is supported without crashing the playuver
This commit is contained in:
1 parent
30509dd64b
commit
4e9ba204e5
4 files changed
+112
-35
No files matched your search
@@ -55,7 +55,7 @@ SubWindowHandle::SubWindowHandle( QWidget * parent ) :
|
|||||||
m_pcCurrentModule = NULL;
|
m_pcCurrentModule = NULL;
|
||||||
|
|
||||||
m_cWindowName = QString( " " );
|
m_cWindowName = QString( " " );
|
||||||
m_bIsPlaying = true;
|
m_bIsPlaying = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SubWindowHandle::~SubWindowHandle()
|
SubWindowHandle::~SubWindowHandle()
|
||||||
@@ -199,7 +199,7 @@ Int SubWindowHandle::playEvent()
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return -1;
|
return -4;
|
||||||
}
|
}
|
||||||
|
|
||||||
Void SubWindowHandle::pause()
|
Void SubWindowHandle::pause()
|
||||||
@@ -328,12 +328,16 @@ Bool SubWindowHandle::mayClose()
|
|||||||
|
|
||||||
void SubWindowHandle::closeEvent( QCloseEvent *event )
|
void SubWindowHandle::closeEvent( QCloseEvent *event )
|
||||||
{
|
{
|
||||||
Bool bAccept = true;
|
Bool bAccept = mayClose();
|
||||||
bAccept = m_bIsPlaying ? false : bAccept;
|
bAccept = m_bIsPlaying ? false : bAccept;
|
||||||
if( bAccept )
|
if( bAccept )
|
||||||
|
{
|
||||||
event->accept();
|
event->accept();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
event->ignore();
|
event->ignore();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // NAMESPACE
|
} // NAMESPACE
|
||||||
@@ -72,6 +72,11 @@ public:
|
|||||||
Int playEvent();
|
Int playEvent();
|
||||||
Void stop();
|
Void stop();
|
||||||
|
|
||||||
|
Bool isPlaying()
|
||||||
|
{
|
||||||
|
return m_bIsPlaying;
|
||||||
|
}
|
||||||
|
|
||||||
Void seekAbsoluteEvent( UInt new_frame_num );
|
Void seekAbsoluteEvent( UInt new_frame_num );
|
||||||
Void seekRelativeEvent( Bool bIsFoward );
|
Void seekRelativeEvent( Bool bIsFoward );
|
||||||
|
|
||||||
|
|||||||
+96
-32
@@ -99,8 +99,6 @@ Void plaYUVerApp::closeEvent( QCloseEvent *event )
|
|||||||
{
|
{
|
||||||
case QMessageBox::Yes:
|
case QMessageBox::Yes:
|
||||||
|
|
||||||
closeAll();
|
|
||||||
|
|
||||||
mayCloseAll = true;
|
mayCloseAll = true;
|
||||||
for( Int i = 0; i < mdiArea->subWindowList().size(); i++ )
|
for( Int i = 0; i < mdiArea->subWindowList().size(); i++ )
|
||||||
{
|
{
|
||||||
@@ -110,6 +108,8 @@ Void plaYUVerApp::closeEvent( QCloseEvent *event )
|
|||||||
|
|
||||||
if( mayCloseAll )
|
if( mayCloseAll )
|
||||||
{
|
{
|
||||||
|
playingTimer->stop();
|
||||||
|
closeAll();
|
||||||
writeSettings();
|
writeSettings();
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
@@ -181,6 +181,21 @@ void plaYUVerApp::format()
|
|||||||
m_pcCurrentSubWindow->loadFile( m_pcCurrentSubWindow->currentFile() );
|
m_pcCurrentSubWindow->loadFile( m_pcCurrentSubWindow->currentFile() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void plaYUVerApp::closeActiveWindow()
|
||||||
|
{
|
||||||
|
SubWindowHandle *currSubWindow = activeSubWindow();
|
||||||
|
if( currSubWindow )
|
||||||
|
{
|
||||||
|
if( m_acPlayingSubWindows.contains( currSubWindow ) )
|
||||||
|
{
|
||||||
|
Int pos = m_acPlayingSubWindows.indexOf( currSubWindow );
|
||||||
|
m_acPlayingSubWindows.at( pos )->stop();
|
||||||
|
m_acPlayingSubWindows.remove( pos );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mdiArea->closeActiveSubWindow();
|
||||||
|
}
|
||||||
|
|
||||||
void plaYUVerApp::closeAll()
|
void plaYUVerApp::closeAll()
|
||||||
{
|
{
|
||||||
mdiArea->closeAllSubWindows();
|
mdiArea->closeAllSubWindows();
|
||||||
@@ -216,6 +231,23 @@ void plaYUVerApp::updateProperties()
|
|||||||
|
|
||||||
// ----------------------- Playing Functions --------------------
|
// ----------------------- Playing Functions --------------------
|
||||||
|
|
||||||
|
Void plaYUVerApp::setTimerStatus()
|
||||||
|
{
|
||||||
|
Bool status = false;
|
||||||
|
for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||||
|
{
|
||||||
|
status |= m_acPlayingSubWindows.at( i )->isPlaying();
|
||||||
|
}
|
||||||
|
if( status )
|
||||||
|
{
|
||||||
|
m_cTimer.start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
playingTimer->stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void plaYUVerApp::play()
|
void plaYUVerApp::play()
|
||||||
{
|
{
|
||||||
if( m_pcCurrentSubWindow )
|
if( m_pcCurrentSubWindow )
|
||||||
@@ -263,11 +295,22 @@ void plaYUVerApp::play()
|
|||||||
|
|
||||||
void plaYUVerApp::pause()
|
void plaYUVerApp::pause()
|
||||||
{
|
{
|
||||||
for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
if( m_pcCurrentSubWindow )
|
||||||
{
|
{
|
||||||
m_acPlayingSubWindows.at( i )->pause();
|
if( m_acPlayingSubWindows.contains( m_pcCurrentSubWindow ) )
|
||||||
|
{
|
||||||
|
for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||||
|
{
|
||||||
|
m_acPlayingSubWindows.at( i )->pause();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_pcCurrentSubWindow->pause();
|
||||||
|
}
|
||||||
|
m_pcFrameSlider->setValue( m_pcCurrentSubWindow->getInputStream()->getCurrFrameNum() );
|
||||||
}
|
}
|
||||||
playingTimer->stop();
|
setTimerStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void plaYUVerApp::stop()
|
void plaYUVerApp::stop()
|
||||||
@@ -277,7 +320,7 @@ void plaYUVerApp::stop()
|
|||||||
m_acPlayingSubWindows.at( i )->stop();
|
m_acPlayingSubWindows.at( i )->stop();
|
||||||
}
|
}
|
||||||
m_acPlayingSubWindows.clear();
|
m_acPlayingSubWindows.clear();
|
||||||
playingTimer->stop();
|
setTimerStatus();
|
||||||
m_pcFrameSlider->setValue( m_pcCurrentSubWindow->getInputStream()->getCurrFrameNum() );
|
m_pcFrameSlider->setValue( m_pcCurrentSubWindow->getInputStream()->getCurrFrameNum() );
|
||||||
|
|
||||||
if( m_uiAveragePlayInterval )
|
if( m_uiAveragePlayInterval )
|
||||||
@@ -285,8 +328,6 @@ void plaYUVerApp::stop()
|
|||||||
<< QString::number( 1000 / m_uiAveragePlayInterval )
|
<< QString::number( 1000 / m_uiAveragePlayInterval )
|
||||||
<< " fps";
|
<< " fps";
|
||||||
m_uiAveragePlayInterval = 0;
|
m_uiAveragePlayInterval = 0;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void plaYUVerApp::playEvent()
|
void plaYUVerApp::playEvent()
|
||||||
@@ -312,43 +353,54 @@ void plaYUVerApp::playEvent()
|
|||||||
case -3:
|
case -3:
|
||||||
m_acPlayingSubWindows.at( i )->close();
|
m_acPlayingSubWindows.at( i )->close();
|
||||||
break;
|
break;
|
||||||
|
case -4:
|
||||||
|
m_acPlayingSubWindows.remove( i );
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_pcFrameSlider->setValue( m_acPlayingSubWindows.at( 0 )->getInputStream()->getCurrFrameNum() );
|
if( m_pcCurrentSubWindow )
|
||||||
|
m_pcFrameSlider->setValue( m_pcCurrentSubWindow->getInputStream()->getCurrFrameNum() );
|
||||||
|
|
||||||
m_uiAveragePlayInterval = ( m_uiAveragePlayInterval + time ) / 2;
|
m_uiAveragePlayInterval = ( m_uiAveragePlayInterval + time ) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void plaYUVerApp::seekEvent( int direction )
|
void plaYUVerApp::seekEvent( int direction )
|
||||||
{
|
{
|
||||||
if( m_acPlayingSubWindows.size() )
|
if( m_pcCurrentSubWindow )
|
||||||
{
|
{
|
||||||
for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
if( m_acPlayingSubWindows.contains( m_pcCurrentSubWindow ) )
|
||||||
{
|
{
|
||||||
m_acPlayingSubWindows.at( i )->seekRelativeEvent( direction > 0 ? true : false );
|
for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||||
|
{
|
||||||
|
m_acPlayingSubWindows.at( i )->seekRelativeEvent( direction > 0 ? true : false );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
|
||||||
if( m_pcCurrentSubWindow )
|
|
||||||
m_pcCurrentSubWindow->seekRelativeEvent( direction > 0 ? true : false );
|
m_pcCurrentSubWindow->seekRelativeEvent( direction > 0 ? true : false );
|
||||||
|
m_pcFrameSlider->setValue( m_pcCurrentSubWindow->getInputStream()->getCurrFrameNum() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void plaYUVerApp::seekSliderEvent( int new_frame_num )
|
void plaYUVerApp::seekSliderEvent( int new_frame_num )
|
||||||
{
|
{
|
||||||
if( m_acPlayingSubWindows.size() )
|
if( m_pcCurrentSubWindow )
|
||||||
{
|
{
|
||||||
for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
if( m_acPlayingSubWindows.contains( m_pcCurrentSubWindow ) )
|
||||||
{
|
{
|
||||||
m_acPlayingSubWindows.at( i )->seekAbsoluteEvent( ( UInt )new_frame_num );
|
for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||||
|
{
|
||||||
|
m_acPlayingSubWindows.at( i )->seekAbsoluteEvent( ( UInt )new_frame_num );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
|
||||||
if( m_pcCurrentSubWindow )
|
|
||||||
m_pcCurrentSubWindow->seekAbsoluteEvent( ( UInt )new_frame_num );
|
m_pcCurrentSubWindow->seekAbsoluteEvent( ( UInt )new_frame_num );
|
||||||
|
m_pcFrameSlider->setValue( m_pcCurrentSubWindow->getInputStream()->getCurrFrameNum() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -356,8 +408,15 @@ void plaYUVerApp::lockButtonEvent()
|
|||||||
{
|
{
|
||||||
if( !actionVideoLock->isChecked() )
|
if( !actionVideoLock->isChecked() )
|
||||||
{
|
{
|
||||||
stop();
|
if( m_acPlayingSubWindows.contains( m_pcCurrentSubWindow ) )
|
||||||
m_acPlayingSubWindows.clear();
|
{
|
||||||
|
stop();
|
||||||
|
play();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -399,12 +458,12 @@ void plaYUVerApp::chageSubWindowSelection()
|
|||||||
{
|
{
|
||||||
if( m_pcCurrentSubWindow )
|
if( m_pcCurrentSubWindow )
|
||||||
m_pcCurrentSubWindow->disableModule();
|
m_pcCurrentSubWindow->disableModule();
|
||||||
if( m_acPlayingSubWindows.size() < 2 )
|
// if( m_acPlayingSubWindows.size() < 2 )
|
||||||
{
|
// {
|
||||||
playingTimer->stop();
|
// playingTimer->stop();
|
||||||
m_pcFrameSlider->setMaximum( activeSubWindow()->getInputStream()->getFrameNum() - 1 );
|
// }
|
||||||
m_pcFrameSlider->setValue( activeSubWindow()->getInputStream()->getCurrFrameNum() );
|
m_pcFrameSlider->setMaximum( activeSubWindow()->getInputStream()->getFrameNum() - 1 );
|
||||||
}
|
m_pcFrameSlider->setValue( activeSubWindow()->getInputStream()->getCurrFrameNum() );
|
||||||
m_pcCurrentSubWindow = activeSubWindow();
|
m_pcCurrentSubWindow = activeSubWindow();
|
||||||
updateProperties();
|
updateProperties();
|
||||||
}
|
}
|
||||||
@@ -535,6 +594,10 @@ Void plaYUVerApp::updateMenus()
|
|||||||
actionVideoForward->setEnabled( hasSubWindow );
|
actionVideoForward->setEnabled( hasSubWindow );
|
||||||
actionVideoLoop->setEnabled( hasSubWindow );
|
actionVideoLoop->setEnabled( hasSubWindow );
|
||||||
m_pcFrameSlider->setEnabled( hasSubWindow );
|
m_pcFrameSlider->setEnabled( hasSubWindow );
|
||||||
|
if( !hasSubWindow )
|
||||||
|
{
|
||||||
|
m_pcFrameSlider->setValue( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
m_pcModulesHandle->updateMenus( hasSubWindow );
|
m_pcModulesHandle->updateMenus( hasSubWindow );
|
||||||
}
|
}
|
||||||
@@ -613,7 +676,7 @@ Void plaYUVerApp::createActions()
|
|||||||
m_arrayActions[CLOSE_ACT] = new QAction( tr( "Cl&ose" ), this );
|
m_arrayActions[CLOSE_ACT] = new QAction( tr( "Cl&ose" ), this );
|
||||||
m_arrayActions[CLOSE_ACT]->setIcon( QIcon( ":/images/close.png" ) );
|
m_arrayActions[CLOSE_ACT]->setIcon( QIcon( ":/images/close.png" ) );
|
||||||
m_arrayActions[CLOSE_ACT]->setStatusTip( tr( "Close the active window" ) );
|
m_arrayActions[CLOSE_ACT]->setStatusTip( tr( "Close the active window" ) );
|
||||||
connect( m_arrayActions[CLOSE_ACT], SIGNAL( triggered() ), mdiArea, SLOT( closeActiveSubWindow() ) );
|
connect( m_arrayActions[CLOSE_ACT], SIGNAL( triggered() ), this, SLOT( closeActiveWindow() ) );
|
||||||
|
|
||||||
m_arrayActions[CLOSEALL_ACT] = new QAction( tr( "Close &All" ), this );
|
m_arrayActions[CLOSEALL_ACT] = new QAction( tr( "Close &All" ), this );
|
||||||
m_arrayActions[CLOSEALL_ACT]->setStatusTip( tr( "Close all the windows" ) );
|
m_arrayActions[CLOSEALL_ACT]->setStatusTip( tr( "Close all the windows" ) );
|
||||||
@@ -687,6 +750,7 @@ Void plaYUVerApp::createActions()
|
|||||||
actionVideoLock = new QAction( "VideoLock", this );
|
actionVideoLock = new QAction( "VideoLock", this );
|
||||||
actionVideoLock->setCheckable( true );
|
actionVideoLock->setCheckable( true );
|
||||||
actionVideoLock->setChecked( false );
|
actionVideoLock->setChecked( false );
|
||||||
|
connect( actionVideoLock, SIGNAL( triggered() ), this, SLOT( lockButtonEvent() ) );
|
||||||
|
|
||||||
actionVideoInterlace = new QAction( "VideoInterlace", this );
|
actionVideoInterlace = new QAction( "VideoInterlace", this );
|
||||||
actionVideoCenter = new QAction( "VideoCenter", this );
|
actionVideoCenter = new QAction( "VideoCenter", this );
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ private Q_SLOTS:
|
|||||||
void open();
|
void open();
|
||||||
void save();
|
void save();
|
||||||
void format();
|
void format();
|
||||||
|
void closeActiveWindow();
|
||||||
void closeAll();
|
void closeAll();
|
||||||
|
|
||||||
//! Playing functions
|
//! Playing functions
|
||||||
@@ -107,6 +108,9 @@ private:
|
|||||||
QTime m_cTimer;
|
QTime m_cTimer;
|
||||||
UInt m_uiAveragePlayInterval;
|
UInt m_uiAveragePlayInterval;
|
||||||
|
|
||||||
|
//! Playing functions
|
||||||
|
Void setTimerStatus();
|
||||||
|
|
||||||
Void updateMenus();
|
Void updateMenus();
|
||||||
Void updateProperties();
|
Void updateProperties();
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user