Finish modules menu actions
This commit is contained in:
1 parent
0f805beacb
commit
9d31939d29
4 files changed
+61
-75
No files matched your search
+55
-49
@@ -64,12 +64,12 @@ Void ModulesHandle::createActions()
|
||||
m_arrayActions[APPLY_ALL_ACT] = new QAction( "Apply to All", parent() );
|
||||
m_arrayActions[APPLY_ALL_ACT]->setStatusTip( "Apply module to all frames and save the result" );
|
||||
connect( m_arrayActions[APPLY_ALL_ACT], SIGNAL( triggered() ), m_pcActionMapper, SLOT( map() ) );
|
||||
m_pcActionMapper->setMapping( m_arrayActions[APPLY_ALL_ACT], APPLY_ALL_OPT );
|
||||
m_pcActionMapper->setMapping( m_arrayActions[APPLY_ALL_ACT], APPLY_ALL_ACT );
|
||||
|
||||
m_arrayActions[SWAP_FRAMES_ACT] = new QAction( "Swap frames", parent() );
|
||||
m_arrayActions[SWAP_FRAMES_ACT]->setStatusTip( "Swap Sub Window order" );
|
||||
connect( m_arrayActions[SWAP_FRAMES_ACT], SIGNAL( triggered() ), m_pcActionMapper, SLOT( map() ) );
|
||||
m_pcActionMapper->setMapping( m_arrayActions[SWAP_FRAMES_ACT], SWAP_FRAMES_OPT );
|
||||
m_pcActionMapper->setMapping( m_arrayActions[SWAP_FRAMES_ACT], SWAP_FRAMES_ACT );
|
||||
|
||||
m_arrayActions[DISABLE_ALL_ACT] = new QAction( "Disable All Modules", parent() );
|
||||
connect( m_arrayActions[DISABLE_ALL_ACT], SIGNAL( triggered() ), this, SLOT( destroyAllModulesIf() ) );
|
||||
@@ -154,14 +154,18 @@ Void ModulesHandle::updateMenus()
|
||||
}
|
||||
for( Int i = 0; i < m_arrayActions.size(); i++ )
|
||||
{
|
||||
m_arrayActions.at( i )->setEnabled( hasSubWindow );
|
||||
m_arrayActions.at( i )->setEnabled( false );
|
||||
}
|
||||
m_arrayActions[DISABLE_ALL_ACT]->setEnabled( hasSubWindow );
|
||||
m_arrayActions[FORCE_NEW_WINDOW_ACT]->setEnabled( hasSubWindow );
|
||||
if( pcSubWindow )
|
||||
{
|
||||
if( pcSubWindow->getModule() )
|
||||
{
|
||||
currModuleAction = pcSubWindow->getModule()->m_pcModuleAction;
|
||||
currModuleAction->setChecked( true );
|
||||
m_arrayActions[APPLY_ALL_ACT]->setEnabled( true );
|
||||
m_arrayActions[SWAP_FRAMES_ACT]->setEnabled( true );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -171,19 +175,24 @@ Void ModulesHandle::processOpt( Int index )
|
||||
VideoSubWindow* pcSubWindow = qobject_cast<VideoSubWindow *>( m_pcMdiArea->activeSubWindow() );
|
||||
if( pcSubWindow )
|
||||
{
|
||||
switch( m_iOptionSelected )
|
||||
PlaYUVerAppModuleIf* pcCurrModule = pcSubWindow->getModule();
|
||||
if( pcCurrModule )
|
||||
{
|
||||
case INVALID_OPT:
|
||||
break;
|
||||
case SWAP_FRAMES_OPT:
|
||||
pcSubWindow->swapModuleFrames();
|
||||
break;
|
||||
case APPLY_ALL_OPT:
|
||||
openModuleIfStream( pcSubWindow->getModule() );
|
||||
pcSubWindow->applyModuleAllFrames();
|
||||
break;
|
||||
default:
|
||||
Q_ASSERT( 0 );
|
||||
switch( index )
|
||||
{
|
||||
case INVALID_OPT:
|
||||
break;
|
||||
case SWAP_FRAMES_ACT:
|
||||
swapModulesWindowsIf( pcCurrModule );
|
||||
//pcSubWindow->swapModuleFrames();
|
||||
break;
|
||||
case APPLY_ALL_ACT:
|
||||
applyAllModuleIf( pcCurrModule );
|
||||
//pcSubWindow->applyModuleAllFrames();
|
||||
break;
|
||||
default:
|
||||
Q_ASSERT( 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -396,40 +405,6 @@ Bool ModulesHandle::applyModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf, Bool isP
|
||||
}
|
||||
|
||||
Void ModulesHandle::applyAllModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
|
||||
{
|
||||
if( pcCurrModuleIf->m_pcModuleStream )
|
||||
{
|
||||
UInt numberOfWindows = pcCurrModuleIf->m_pcModule->m_cModuleDef.m_uiNumberOfFrames;
|
||||
UInt64 currFrames = 0;
|
||||
UInt64 numberOfFrames = INT_MAX;
|
||||
for( UInt i = 0; i < numberOfWindows; i++ )
|
||||
{
|
||||
currFrames = pcCurrModuleIf->m_pcSubWindow[i]->getInputStream()->getFrameNum();
|
||||
if( currFrames < numberOfFrames )
|
||||
numberOfFrames = currFrames;
|
||||
pcCurrModuleIf->m_pcSubWindow[i]->stop();
|
||||
}
|
||||
QApplication::setOverrideCursor( Qt::WaitCursor );
|
||||
for( UInt f = 1; f < numberOfFrames; f++ )
|
||||
{
|
||||
applyModuleIf( pcCurrModuleIf, false, true );
|
||||
QCoreApplication::processEvents();
|
||||
pcCurrModuleIf->m_pcModuleStream->writeFrame( pcCurrModuleIf->m_pcProcessedFrame );
|
||||
for( UInt i = 0; i < numberOfWindows; i++ )
|
||||
{
|
||||
pcCurrModuleIf->m_pcSubWindow[i]->play();
|
||||
pcCurrModuleIf->m_pcSubWindow[i]->playEvent();
|
||||
}
|
||||
}
|
||||
for( UInt i = 0; i < numberOfWindows; i++ )
|
||||
{
|
||||
pcCurrModuleIf->m_pcSubWindow[i]->stop();
|
||||
}
|
||||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
}
|
||||
|
||||
Void ModulesHandle::openModuleIfStream( PlaYUVerAppModuleIf *pcCurrModuleIf )
|
||||
{
|
||||
if( pcCurrModuleIf )
|
||||
{
|
||||
@@ -477,6 +452,36 @@ Void ModulesHandle::openModuleIfStream( PlaYUVerAppModuleIf *pcCurrModuleIf )
|
||||
}
|
||||
}
|
||||
}
|
||||
if( pcCurrModuleIf->m_pcModuleStream )
|
||||
{
|
||||
UInt numberOfWindows = pcCurrModuleIf->m_pcModule->m_cModuleDef.m_uiNumberOfFrames;
|
||||
UInt64 currFrames = 0;
|
||||
UInt64 numberOfFrames = INT_MAX;
|
||||
for( UInt i = 0; i < numberOfWindows; i++ )
|
||||
{
|
||||
currFrames = pcCurrModuleIf->m_pcSubWindow[i]->getInputStream()->getFrameNum();
|
||||
if( currFrames < numberOfFrames )
|
||||
numberOfFrames = currFrames;
|
||||
pcCurrModuleIf->m_pcSubWindow[i]->stop();
|
||||
}
|
||||
QApplication::setOverrideCursor( Qt::WaitCursor );
|
||||
for( UInt f = 1; f < numberOfFrames; f++ )
|
||||
{
|
||||
applyModuleIf( pcCurrModuleIf, false, true );
|
||||
QCoreApplication::processEvents();
|
||||
pcCurrModuleIf->m_pcModuleStream->writeFrame( pcCurrModuleIf->m_pcProcessedFrame );
|
||||
for( UInt i = 0; i < numberOfWindows; i++ )
|
||||
{
|
||||
pcCurrModuleIf->m_pcSubWindow[i]->play();
|
||||
pcCurrModuleIf->m_pcSubWindow[i]->playEvent();
|
||||
}
|
||||
}
|
||||
for( UInt i = 0; i < numberOfWindows; i++ )
|
||||
{
|
||||
pcCurrModuleIf->m_pcSubWindow[i]->stop();
|
||||
}
|
||||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
}
|
||||
|
||||
Bool ModulesHandle::showModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf, PlaYUVerFrame* processedFrame )
|
||||
@@ -511,6 +516,7 @@ Void ModulesHandle::swapModulesWindowsIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
|
||||
VideoSubWindow* auxWindowHandle = pcCurrModuleIf->m_pcSubWindow[0];
|
||||
pcCurrModuleIf->m_pcSubWindow[0] = pcCurrModuleIf->m_pcSubWindow[1];
|
||||
pcCurrModuleIf->m_pcSubWindow[1] = auxWindowHandle;
|
||||
applyModuleIf( pcCurrModuleIf );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
-6
@@ -61,11 +61,10 @@ public:
|
||||
|
||||
|
||||
static Void destroyModuleIf( PlaYUVerAppModuleIf* pcCurrModuleIf );
|
||||
static Bool applyModuleIf( PlaYUVerAppModuleIf* pcCurrModuleIf, Bool isPlaying, Bool disableThreads = false );
|
||||
static Void swapModulesWindowsIf( PlaYUVerAppModuleIf *pcCurrModuleIf );
|
||||
static Bool applyModuleIf( PlaYUVerAppModuleIf* pcCurrModuleIf, Bool isPlaying = false, Bool disableThreads = false );
|
||||
|
||||
static Bool showModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf, PlaYUVerFrame* processedFrame );
|
||||
static Bool showModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf, Double moduleResult );
|
||||
static Void applyAllModuleIf( PlaYUVerAppModuleIf* pcCurrModuleIf );
|
||||
|
||||
private:
|
||||
QMainWindow *m_pcParent;
|
||||
@@ -77,8 +76,8 @@ private:
|
||||
enum
|
||||
{
|
||||
INVALID_OPT = -1,
|
||||
SWAP_FRAMES_OPT = -2,
|
||||
APPLY_ALL_OPT = -3,
|
||||
SWAP_FRAMES_OPT = 0,
|
||||
APPLY_ALL_OPT = 1,
|
||||
};
|
||||
|
||||
QMenu* m_pcModulesMenu;
|
||||
@@ -102,7 +101,8 @@ private:
|
||||
QSignalMapper* m_pcActionMapper;
|
||||
|
||||
Void enableModuleIf( PlaYUVerAppModuleIf* pcCurrModuleIf );
|
||||
Void openModuleIfStream( PlaYUVerAppModuleIf *pcCurrModuleIf );
|
||||
Void applyAllModuleIf( PlaYUVerAppModuleIf* pcCurrModuleIf );
|
||||
Void swapModulesWindowsIf( PlaYUVerAppModuleIf *pcCurrModuleIf );
|
||||
|
||||
Void customEvent( QEvent *event );
|
||||
|
||||
|
||||
@@ -227,24 +227,6 @@ Void VideoSubWindow::disableModule()
|
||||
}
|
||||
}
|
||||
|
||||
Void VideoSubWindow::swapModuleFrames()
|
||||
{
|
||||
if( m_pcCurrentModule )
|
||||
{
|
||||
ModulesHandle::swapModulesWindowsIf( m_pcCurrentModule );
|
||||
refreshFrame();
|
||||
}
|
||||
}
|
||||
|
||||
Void VideoSubWindow::applyModuleAllFrames()
|
||||
{
|
||||
if( m_pcCurrentModule )
|
||||
{
|
||||
ModulesHandle::applyAllModuleIf( m_pcCurrentModule );
|
||||
stop();
|
||||
}
|
||||
}
|
||||
|
||||
Void VideoSubWindow::setCurrFrame( PlaYUVerFrame* pcCurrFrame )
|
||||
{
|
||||
m_pcCurrFrame = pcCurrFrame;
|
||||
|
||||
@@ -158,8 +158,6 @@ public:
|
||||
*/
|
||||
Void enableModule( PlaYUVerAppModuleIf* select_module );
|
||||
Void disableModule();
|
||||
Void swapModuleFrames();
|
||||
Void applyModuleAllFrames();
|
||||
|
||||
/**
|
||||
* Virtual functions from SubWindowHandle
|
||||
|
||||
Reference in new issue
Block a user