Improve module to handle more than one for each window

This commit is contained in:
2015-01-05 17:05:36 +00:00
parent 0365a82955
commit b629356c0c
3 changed files with 49 additions and 43 deletions
+15 -10
View File
@@ -158,10 +158,14 @@ Void ModulesHandle::updateMenus()
m_arrayActions[FORCE_NEW_WINDOW_ACT]->setEnabled( hasSubWindow );
if( pcSubWindow )
{
if( pcSubWindow->getModule() )
QVector<PlaYUVerAppModuleIf*> apcCurrentModule = pcSubWindow->getModuleArray();
for( Int i = 0; i < apcCurrentModule.size(); i++ )
{
currModuleAction = pcSubWindow->getModule()->m_pcModuleAction;
currModuleAction = apcCurrentModule.at( i )->m_pcModuleAction;
currModuleAction->setChecked( true );
}
if( apcCurrentModule.size() )
{
m_arrayActions[APPLY_ALL_ACT]->setEnabled( true );
m_arrayActions[SWAP_FRAMES_ACT]->setEnabled( true );
}
@@ -183,9 +187,10 @@ Void ModulesHandle::processOpt( Int index )
VideoSubWindow* pcSubWindow = qobject_cast<VideoSubWindow *>( m_pcMdiArea->activeSubWindow() );
if( pcSubWindow )
{
PlaYUVerAppModuleIf* pcCurrModule = pcSubWindow->getModule();
if( pcCurrModule )
QVector<PlaYUVerAppModuleIf*> apcCurrentModule = pcSubWindow->getModuleArray();
if( apcCurrentModule.size() > 1 )
{
PlaYUVerAppModuleIf* pcCurrModule = apcCurrentModule.at( 0 );
switch( index )
{
case INVALID_OPT:
@@ -286,7 +291,6 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
for( Int i = 0; i < subWindowList.size(); i++ )
{
pcCurrModuleIf->m_pcSubWindow[i] = subWindowList.at( i );
pcCurrModuleIf->m_pcSubWindow[i]->disableModule();
}
pcCurrModuleIf->m_pcDisplaySubWindow = NULL;
@@ -302,7 +306,7 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
connect( interfaceChild, SIGNAL( zoomChanged() ), m_pcParent, SLOT( updateZoomFactorSBox() ) );
pcCurrModuleIf->m_pcDisplaySubWindow = interfaceChild;
pcCurrModuleIf->m_pcDisplaySubWindow->setModule( pcCurrModuleIf );
pcCurrModuleIf->m_pcDisplaySubWindow->enableModule( pcCurrModuleIf, true );
m_pcMdiArea->addSubWindow( interfaceChild );
}
}
@@ -322,14 +326,15 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
}
}
// Create Module
pcCurrModuleIf->m_pcModule->create( pcCurrModuleIf->m_pcSubWindow[0]->getCurrFrame() );
// Associate module with subwindows
for( UInt i = 0; i < numberOfFrames; i++ )
{
pcCurrModuleIf->m_pcSubWindow[i]->enableModule( pcCurrModuleIf );
}
// Create Module
pcCurrModuleIf->m_pcModule->create( pcCurrModuleIf->m_pcSubWindow[0]->getCurrFrame() );
applyModuleIf( pcCurrModuleIf, false );
return;
@@ -357,7 +362,7 @@ Void ModulesHandle::destroyModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
{
if( pcCurrModuleIf->m_pcSubWindow[i] )
{
pcCurrModuleIf->m_pcSubWindow[i]->disableModule();
pcCurrModuleIf->m_pcSubWindow[i]->disableModule( pcCurrModuleIf );
pcCurrModuleIf->m_pcSubWindow[i] = NULL;
}
}
+26 -21
View File
@@ -75,7 +75,6 @@ VideoSubWindow::VideoSubWindow( QWidget * parent, Bool isModule ) :
SubWindowHandle( parent, SubWindowHandle::VIDEO_SUBWINDOW ),
m_pCurrStream( NULL ),
m_pcCurrFrame( NULL ),
m_pcCurrentModule( NULL ),
m_pcReferenceSubWindow( NULL ),
m_bIsPlaying( false ),
m_bIsModule( isModule )
@@ -104,6 +103,8 @@ VideoSubWindow::VideoSubWindow( QWidget * parent, Bool isModule ) :
m_cScrollArea->setWidget( m_cViewArea );
m_cScrollArea->setWidgetResizable( true );
m_apcCurrentModule.clear();
m_cLastScroll = QPoint();
}
@@ -206,25 +207,37 @@ Void VideoSubWindow::updateSelectedArea( QRect area )
* Functions to enable a module in the
* current SubWindow
*/
Void VideoSubWindow::enableModule( PlaYUVerAppModuleIf* select_module )
Void VideoSubWindow::enableModule( PlaYUVerAppModuleIf* pcModule, Bool bThisWindow )
{
if( m_pcCurrentModule )
if( bThisWindow )
{
m_apcCurrentModule.clear();
disableModule();
}
m_pcCurrentModule = select_module;
// refreshFrame();
m_apcCurrentModule.append( pcModule );
}
Void VideoSubWindow::disableModule()
Void VideoSubWindow::disableModule( PlaYUVerAppModuleIf* pcModule )
{
if( m_pcCurrentModule )
if( pcModule )
{
PlaYUVerAppModuleIf* pcCurrentModule = m_pcCurrentModule;
m_pcCurrentModule = NULL;
ModulesHandle::destroyModuleIf( pcCurrentModule );
refreshFrame();
Int modIdx = m_apcCurrentModule.indexOf( pcModule );
if( modIdx != -1 )
{
m_apcCurrentModule.remove( modIdx );
ModulesHandle::destroyModuleIf( pcModule );
}
}
else
{
QVector<PlaYUVerAppModuleIf*> apcCurrentModule = m_apcCurrentModule;
for( Int i = 0; i < apcCurrentModule.size(); i++ )
{
ModulesHandle::destroyModuleIf( apcCurrentModule.at( i ) );
}
assert( m_apcCurrentModule.size() == 0 );
}
refreshFrame();
}
Void VideoSubWindow::setCurrFrame( PlaYUVerFrame* pcCurrFrame )
@@ -236,7 +249,6 @@ Void VideoSubWindow::setCurrFrame( PlaYUVerFrame* pcCurrFrame )
show();
resize( sizeHint() );
zoomToFit();
}
}
@@ -247,17 +259,10 @@ Void VideoSubWindow::refreshFrame()
{
m_pcCurrFrame = m_pCurrStream->getCurrFrame();
bSetFrame = true;
if( m_pcCurrentModule )
{
bSetFrame = ModulesHandle::applyModuleIf( m_pcCurrentModule, m_bIsPlaying );
}
}
else
for( Int i = 0; i < m_apcCurrentModule.size(); i++ )
{
if( m_pcCurrentModule )
{
bSetFrame = ModulesHandle::applyModuleIf( m_pcCurrentModule, m_bIsPlaying );
}
bSetFrame = ModulesHandle::applyModuleIf( m_apcCurrentModule.at( i ), m_bIsPlaying );
}
if( bSetFrame )
{
+8 -12
View File
@@ -72,7 +72,8 @@ private:
QRect m_cSelectedArea;
QString m_cFilename;
PlaYUVerAppModuleIf* m_pcCurrentModule;
//PlaYUVerAppModuleIf* m_pcCurrentModule;
QVector<PlaYUVerAppModuleIf*> m_apcCurrentModule;
VideoSubWindow* m_pcReferenceSubWindow;
@@ -131,15 +132,6 @@ public:
return m_cViewArea;
}
Void setModule( PlaYUVerAppModuleIf* pcCurrentModule )
{
m_pcCurrentModule = pcCurrentModule;
}
PlaYUVerAppModuleIf* getModule()
{
return m_pcCurrentModule;
}
Void setRefSubWindow( VideoSubWindow* subWindow )
{
m_pcReferenceSubWindow = NULL;
@@ -156,8 +148,12 @@ public:
* Functions to enable a module in the
* current SubWindow
*/
Void enableModule( PlaYUVerAppModuleIf* select_module );
Void disableModule();
Void enableModule( PlaYUVerAppModuleIf* pcModule, Bool bThisWindow = true );
Void disableModule( PlaYUVerAppModuleIf* pcModule = NULL );
QVector<PlaYUVerAppModuleIf*> getModuleArray()
{
return m_apcCurrentModule;
}
/**
* Virtual functions from SubWindowHandle