Restore threads to apply modules

This commit is contained in:
2015-04-17 21:09:55 +01:00
parent ca31e9e933
commit e47d0df889
7 changed files with 87 additions and 73 deletions
+53 -9
View File
@@ -30,6 +30,7 @@ namespace plaYUVer
{
PlaYUVerAppModuleIf::PlaYUVerAppModuleIf( QObject* parent, QAction* action, PlaYUVerModuleIf* module ) :
m_bIsRunning( false ),
m_pcModuleAction( action ),
m_pcModule( module ),
m_pcDisplaySubWindow( NULL ),
@@ -46,11 +47,11 @@ PlaYUVerAppModuleIf::PlaYUVerAppModuleIf( QObject* parent, QAction* action, PlaY
}
}
void PlaYUVerAppModuleIf::run()
Void PlaYUVerAppModuleIf::run()
{
m_pcProcessedFrame = NULL;
m_dMeasurementResult = 0;
m_bIsRunning = true;
// m_pcProcessedFrame = NULL;
// m_dMeasurementResult = 0;
std::vector<PlaYUVerFrame*> apcFrameList;
for( UInt i = 0; i < m_pcModule->m_uiNumberOfFrames; i++ )
@@ -84,15 +85,58 @@ void PlaYUVerAppModuleIf::run()
{
return;
}
postProgress( true );
m_bIsRunning = false;
EventData *eventData = new EventData( true, this );
if( parent() )
QCoreApplication::postEvent( parent(), eventData );
return;
}
Void PlaYUVerAppModuleIf::postProgress( Bool success )
Void PlaYUVerAppModuleIf::destroy()
{
EventData *eventData = new EventData( success, this );
if( parent() )
QCoreApplication::postEvent( parent(), eventData );
if( m_bIsRunning )
{
QApplication::setOverrideCursor( Qt::WaitCursor );
while( m_bIsRunning )
{
}
QApplication::restoreOverrideCursor();
}
if( m_pcModuleDock )
{
m_pcModuleDock->close();
m_pcModuleDock = NULL;
}
if( m_pcDockWidget )
{
m_pcDockWidget->close();
m_pcDockWidget = NULL;
}
if( m_pcDisplaySubWindow )
m_pcDisplaySubWindow->closeSubWindow();
m_pcDisplaySubWindow = NULL;
for( Int i = 0; i < MAX_NUMBER_FRAMES; i++ )
{
if( m_pcSubWindow[i] )
{
m_pcSubWindow[i]->disableModule( this );
m_pcSubWindow[i] = NULL;
}
}
if( m_pcModuleStream )
{
m_pcModuleStream->close();
delete m_pcModuleStream;
m_pcModuleStream = NULL;
}
if( m_pcModule )
{
m_pcModule->destroy();
m_pcModule->Delete();
m_pcModule = NULL;
}
}
} // NAMESPACE