Add full interface to enable and disable a module in each SubWindow

This commit is contained in:
jfmcarreira committed 2014-02-09 18:48:27 +00:00
1 parent 4be68f5bae
commit a96db8ea57
5 files changed
+41 -4

No files matched your search

+30 -2
View File
@@ -109,6 +109,10 @@ bool SubWindowHandle::loadFile( const QString &fileName )
return true; return true;
} }
/**
* Functions to enable a module in the
* current SubWindow
*/
Void SubWindowHandle::enableModule( PlaYUVerModuleIf* select_module ) Void SubWindowHandle::enableModule( PlaYUVerModuleIf* select_module )
{ {
m_pcCurrentModule = select_module; m_pcCurrentModule = select_module;
@@ -116,16 +120,40 @@ Void SubWindowHandle::enableModule( PlaYUVerModuleIf* select_module )
refreshFrame(); refreshFrame();
} }
Void SubWindowHandle::disableModule()
{
m_pcCurrentModule->destroy();
m_pcCurrentModule = NULL;
refreshFrame();
}
QImage* SubWindowHandle::FrameToQImage( PlaYUVerFrame* curr_frame )
{
Pel*** bufferRGB = curr_frame->getPelBufferRGB();
curr_frame->YUV420toRGB();
for( Int y = 0; y < curr_frame->getHeight(); y++ )
{
for( Int x = 0; x < curr_frame->getWidth(); x++ )
{
m_pCurrFrameQImage->setPixel( x, y, qRgb( bufferRGB[0][y][x], bufferRGB[1][y][x], bufferRGB[2][y][x] ) );
}
}
return m_pCurrFrameQImage;
}
Void SubWindowHandle::refreshFrame() Void SubWindowHandle::refreshFrame()
{ {
if( m_pcCurrentModule ) if( m_pcCurrentModule )
{ {
m_pcCurrentModule->process( m_pCurrStream->getFrame( m_pcCurrentModule->getModImage() ) ); FrameToQImage( m_pcCurrentModule->process( m_pCurrStream->getFrame( m_pcCurrentModule->getModImage() ) ) );
} }
else else
{ {
m_cViewArea->setImage( QPixmap::fromImage( *( m_pCurrStream->getFrame( m_pCurrFrameQImage ) ) ) ); FrameToQImage( m_pCurrStream->getFrame( (PlaYUVerFrame*) NULL ) );
} }
m_cViewArea->setImage( QPixmap::fromImage( *m_pCurrFrameQImage ) );
} }
bool SubWindowHandle::save() bool SubWindowHandle::save()
+3 -1
View File
@@ -73,6 +73,7 @@ public:
Void stopEvent(); Void stopEvent();
Void seekEvent( UInt new_frame_num ); Void seekEvent( UInt new_frame_num );
QImage* FrameToQImage( PlaYUVerFrame* curr_frame );
Void refreshFrame(); Void refreshFrame();
InputStream* getInputStream() InputStream* getInputStream()
@@ -81,10 +82,11 @@ public:
} }
/** /**
* Function to enable a module in the * Functions to enable a module in the
* current SubWindow * current SubWindow
*/ */
Void enableModule( PlaYUVerModuleIf* select_module ); Void enableModule( PlaYUVerModuleIf* select_module );
Void disableModule();
/** /**
* Show the image at its original size * Show the image at its original size
+1 -1
View File
@@ -48,7 +48,7 @@ PlaYUVerFrame* FilterFrame::process( PlaYUVerFrame* InputFrame )
pppPelYUV[2][y][x] = 128; pppPelYUV[2][y][x] = 128;
} }
} }
m_pcFilteredFrame->YUV420toRGB();
return m_pcFilteredFrame; return m_pcFilteredFrame;
} }
+6
View File
@@ -71,6 +71,8 @@ plaYUVerApp::plaYUVerApp()
setAcceptDrops( true ); setAcceptDrops( true );
mdiArea->setAcceptDrops( true ); mdiArea->setAcceptDrops( true );
m_pcCurrentSubWindow = NULL;
} }
Void plaYUVerApp::closeEvent( QCloseEvent *event ) Void plaYUVerApp::closeEvent( QCloseEvent *event )
@@ -231,8 +233,12 @@ void plaYUVerApp::chageSubWindowSelection()
playingTimer->stop(); playingTimer->stop();
if( activeSubWindow() ) if( activeSubWindow() )
{ {
if( m_pcCurrentSubWindow )
m_pcCurrentSubWindow->disableModule();
m_pcFrameSlider->setMaximum( activeSubWindow()->getInputStream()->getFrameNum() - 1 ); m_pcFrameSlider->setMaximum( activeSubWindow()->getInputStream()->getFrameNum() - 1 );
m_pcFrameSlider->setValue( activeSubWindow()->getInputStream()->getCurrFrameNum() ); m_pcFrameSlider->setValue( activeSubWindow()->getInputStream()->getCurrFrameNum() );
m_pcCurrentSubWindow = activeSubWindow();
} }
updateMenus(); updateMenus();
//updateWindowMenu(); //updateWindowMenu();
+1
View File
@@ -92,6 +92,7 @@ private Q_SLOTS:
private: private:
QMdiArea *mdiArea; QMdiArea *mdiArea;
SubWindowHandle *m_pcCurrentSubWindow;
ModulesHandle *m_pcModulesHandle; ModulesHandle *m_pcModulesHandle;
QString m_cLastOpenPath; QString m_cLastOpenPath;