For-loop clenups

This commit is contained in:
2021-05-30 21:36:49 +01:00
parent e1e5c4eb3c
commit a1b44895b8
2 changed files with 27 additions and 21 deletions
+25 -19
View File
@@ -639,9 +639,9 @@ void VideoHandle::stop()
{ {
if( m_acPlayingSubWindows.size() > 0 ) if( m_acPlayingSubWindows.size() > 0 )
{ {
for( int i = 0; i < m_acPlayingSubWindows.size(); i++ ) for( auto playingSubWindow : m_acPlayingSubWindows )
{ {
m_acPlayingSubWindows.at( i )->stop(); playingSubWindow->stop();
} }
m_acPlayingSubWindows.clear(); m_acPlayingSubWindows.clear();
setTimerStatus(); setTimerStatus();
@@ -673,17 +673,23 @@ void VideoHandle::playEvent()
calculateRealFrameRate(); calculateRealFrameRate();
try try
{ {
for( int i = 0; i < m_acPlayingSubWindows.size(); i++ ) for( auto playingSubWindow : m_acPlayingSubWindows )
{ {
bEndOfSequence |= m_acPlayingSubWindows.at( i )->playEvent(); bEndOfSequence |= playingSubWindow->playEvent();
} }
if( bEndOfSequence ) if( bEndOfSequence )
{ {
if( !m_arrayActions[VIDEO_REPEAT_ACT]->isChecked() ) if( !m_arrayActions[VIDEO_REPEAT_ACT]->isChecked() )
{
stop(); stop();
}
else else
for( int i = 0; i < m_acPlayingSubWindows.size(); i++ ) {
m_acPlayingSubWindows.at( i )->seekAbsoluteEvent( 0 ); for( auto playingSubWindow : m_acPlayingSubWindows )
{
playingSubWindow->seekAbsoluteEvent( 0 );
}
}
} }
} }
catch( const char* msg ) catch( const char* msg )
@@ -708,9 +714,9 @@ void VideoHandle::seekEvent( int direction )
if( !( (unsigned int)( m_pcCurrentVideoSubWindow->getInputStream()->getCurrFrameNum() + 1 ) >= getMaxFrameNumber() && if( !( (unsigned int)( m_pcCurrentVideoSubWindow->getInputStream()->getCurrFrameNum() + 1 ) >= getMaxFrameNumber() &&
direction > 0 ) ) direction > 0 ) )
{ {
for( int i = 0; i < m_acPlayingSubWindows.size(); i++ ) for( auto playingSubWindow : m_acPlayingSubWindows )
{ {
m_acPlayingSubWindows.at( i )->seekRelativeEvent( direction > 0 ? true : false ); playingSubWindow->seekRelativeEvent( direction > 0 ? true : false );
} }
} }
} }
@@ -735,9 +741,9 @@ void VideoHandle::seekVideo()
{ {
if( m_acPlayingSubWindows.contains( m_pcCurrentVideoSubWindow ) ) if( m_acPlayingSubWindows.contains( m_pcCurrentVideoSubWindow ) )
{ {
for( int i = 0; i < m_acPlayingSubWindows.size(); i++ ) for( auto playingSubWindow : m_acPlayingSubWindows )
{ {
m_acPlayingSubWindows.at( i )->seekAbsoluteEvent( (unsigned int)newFrameNum ); playingSubWindow->seekAbsoluteEvent( (unsigned int)newFrameNum );
} }
} }
else else
@@ -756,9 +762,9 @@ void VideoHandle::seekSliderEvent( int new_frame_num )
{ {
if( m_acPlayingSubWindows.contains( m_pcCurrentVideoSubWindow ) ) if( m_acPlayingSubWindows.contains( m_pcCurrentVideoSubWindow ) )
{ {
for( int i = 0; i < m_acPlayingSubWindows.size(); i++ ) for( auto playingSubWindow : m_acPlayingSubWindows )
{ {
m_acPlayingSubWindows.at( i )->seekAbsoluteEvent( (unsigned int)new_frame_num ); playingSubWindow->seekAbsoluteEvent( (unsigned int)new_frame_num );
} }
} }
else else
@@ -778,9 +784,9 @@ void VideoHandle::videoSelectionButtonEvent()
{ {
QList<SubWindowAbstract*> subWindowList = QList<SubWindowAbstract*> subWindowList =
m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_STREAM_SUBWINDOW ); m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_STREAM_SUBWINDOW );
for( int i = 0; i < subWindowList.size(); i++ ) for( auto subWindow : subWindowList )
{ {
videoSubWindow = qobject_cast<VideoSubWindow*>( subWindowList.at( i ) ); videoSubWindow = qobject_cast<VideoSubWindow*>( subWindow );
m_acPlayingSubWindows.append( videoSubWindow ); m_acPlayingSubWindows.append( videoSubWindow );
} }
} }
@@ -789,18 +795,18 @@ void VideoHandle::videoSelectionButtonEvent()
SubWindowSelectorDialog dialogWindowsSelection( m_pcParet, m_pcMainWindowManager, SubWindowSelectorDialog dialogWindowsSelection( m_pcParet, m_pcMainWindowManager,
SubWindowAbstract::VIDEO_STREAM_SUBWINDOW ); SubWindowAbstract::VIDEO_STREAM_SUBWINDOW );
QStringList cWindowListNames; QStringList cWindowListNames;
for( int i = 0; i < m_acPlayingSubWindows.size(); i++ ) for( auto playingSubWindow : m_acPlayingSubWindows )
{ {
dialogWindowsSelection.selectSubWindow( m_acPlayingSubWindows.at( i ) ); dialogWindowsSelection.selectSubWindow( playingSubWindow );
} }
if( dialogWindowsSelection.exec() == QDialog::Accepted ) if( dialogWindowsSelection.exec() == QDialog::Accepted )
{ {
m_acPlayingSubWindows.clear(); m_acPlayingSubWindows.clear();
QList<SubWindowAbstract*> selectedSubWindowList = dialogWindowsSelection.getSelectedWindows(); QList<SubWindowAbstract*> selectedSubWindowList = dialogWindowsSelection.getSelectedWindows();
for( int i = 0; i < selectedSubWindowList.size(); i++ ) for( auto window : selectedSubWindowList )
{ {
videoSubWindow = qobject_cast<VideoSubWindow*>( selectedSubWindowList.at( i ) ); videoSubWindow = qobject_cast<VideoSubWindow*>( window );
m_acPlayingSubWindows.append( videoSubWindow ); m_acPlayingSubWindows.append( videoSubWindow );
} }
} }
@@ -812,7 +818,7 @@ void VideoHandle::videoSelectionButtonEvent()
if( m_acPlayingSubWindows.size() > 0 ) if( m_acPlayingSubWindows.size() > 0 )
{ {
m_acPlayingSubWindows.at( 0 )->activateWindow(); m_acPlayingSubWindows.front()->activateWindow();
if( m_acPlayingSubWindows.size() > 1 ) if( m_acPlayingSubWindows.size() > 1 )
{ {
m_arrayActions[VIDEO_LOCK_ACT]->setVisible( true ); m_arrayActions[VIDEO_LOCK_ACT]->setVisible( true );
+2 -2
View File
@@ -34,7 +34,7 @@
#include "QtConcurrent/qtconcurrentrun.h" #include "QtConcurrent/qtconcurrentrun.h"
#include "SubWindowAbstract.h" #include "SubWindowAbstract.h"
#define QT_NO_CONCURRENT //#define QT_NO_CONCURRENT
/** /**
* \brief Functions to control data stream from stream information * \brief Functions to control data stream from stream information
@@ -765,8 +765,8 @@ bool VideoSubWindow::goToNextFrame( bool bThreaded )
m_cRefreshResult.waitForFinished(); m_cRefreshResult.waitForFinished();
if( bThreaded ) if( bThreaded )
{ {
refreshFrame();
m_cReadResult = QtConcurrent::run( m_pCurrStream, &CalypStream::readNextFrameFillRGBBuffer ); m_cReadResult = QtConcurrent::run( m_pCurrStream, &CalypStream::readNextFrameFillRGBBuffer );
refreshFrame();
} }
else else
#endif #endif