Interface for modules in SubWindowHandle and plaYUVerApp
This commit is contained in:
1 parent
1c28febd17
commit
4be68f5bae
9 files changed
+119
-53
No files matched your search
@@ -31,11 +31,15 @@ namespace plaYUVer
|
||||
|
||||
ModulesHandle::ModulesHandle( QWidget * parent )
|
||||
{
|
||||
setParent( parent );
|
||||
m_uiModulesCount = 0;
|
||||
|
||||
// Register Modules
|
||||
REGISTER_MODULE( FilterFrame );
|
||||
|
||||
|
||||
|
||||
// configure class
|
||||
setParent( parent );
|
||||
m_uiModulesCount = 0;
|
||||
m_uiModuleSelected= -1;
|
||||
}
|
||||
|
||||
ModulesHandle::~ModulesHandle()
|
||||
@@ -46,32 +50,50 @@ ModulesHandle::~ModulesHandle()
|
||||
Void ModulesHandle::appendModule( PlaYUVerModuleIf* pIfModule )
|
||||
{
|
||||
m_pcPlaYUVerModules.append( pIfModule );
|
||||
m_uiModulesCount++;
|
||||
m_uiModulesCount++;
|
||||
|
||||
}
|
||||
|
||||
Void ModulesHandle::createMenus( QMenuBar *MainAppMenuBar )
|
||||
void ModulesHandle::selectModule( int index )
|
||||
{
|
||||
m_uiModuleSelected = index;
|
||||
}
|
||||
|
||||
PlaYUVerModuleIf* ModulesHandle::getSelectedModuleIf()
|
||||
{
|
||||
PlaYUVerModuleIf* currModuleIf = NULL;
|
||||
if( m_uiModuleSelected >= 0 )
|
||||
return m_pcPlaYUVerModules.at( m_uiModuleSelected );
|
||||
m_uiModuleSelected = -1;
|
||||
return currModuleIf;
|
||||
}
|
||||
|
||||
QMenu* ModulesHandle::createMenus( QMenuBar *MainAppMenuBar )
|
||||
{
|
||||
PlaYUVerModuleIf* currModuleIf;
|
||||
QAction* currAction;
|
||||
|
||||
m_pcActionMapper = new QSignalMapper( this );
|
||||
connect( m_pcActionMapper, SIGNAL( mapped(int) ), this, SLOT( selectModule(int) ) );
|
||||
|
||||
m_pcModulesMenu = MainAppMenuBar->addMenu( "&Modules" );
|
||||
|
||||
//m_arrayModulesActions.resize( m_uiModulesCount );
|
||||
|
||||
for( Int i = 0; i < m_pcPlaYUVerModules.size(); i++ )
|
||||
{
|
||||
|
||||
currModuleIf = m_pcPlaYUVerModules.at( i );
|
||||
|
||||
currAction = new QAction( tr( currModuleIf->m_pchModuleName ), parent() );
|
||||
currAction->setStatusTip( tr( currModuleIf->m_pchModuleTooltip ) );
|
||||
|
||||
currAction->setCheckable( true );
|
||||
connect( currAction, SIGNAL( triggered() ), m_pcActionMapper, SLOT( map() ) );
|
||||
m_pcActionMapper->setMapping( currAction, i );
|
||||
m_arrayModulesActions.append( currAction );
|
||||
|
||||
m_pcModulesMenu->addAction( currAction );
|
||||
}
|
||||
|
||||
return m_pcModulesMenu;
|
||||
//MainAppMenuBar->
|
||||
}
|
||||
|
||||
|
||||
@@ -58,15 +58,21 @@ public:
|
||||
ModulesHandle( QWidget * parent = 0 );
|
||||
~ModulesHandle();
|
||||
|
||||
Void createMenus( QMenuBar *MainAppMenuBar );
|
||||
QMenu* createMenus( QMenuBar *MainAppMenuBar );
|
||||
PlaYUVerModuleIf* getSelectedModuleIf();
|
||||
|
||||
private:
|
||||
QMenu* m_pcModulesMenu;
|
||||
UInt m_uiModulesCount;
|
||||
Int m_uiModuleSelected;
|
||||
QMenu* m_pcModulesMenu;
|
||||
QList<PlaYUVerModuleIf*> m_pcPlaYUVerModules;
|
||||
QSignalMapper* m_pcActionMapper;
|
||||
QVector<QAction*> m_arrayModulesActions;
|
||||
|
||||
Void appendModule( PlaYUVerModuleIf* );
|
||||
|
||||
private Q_SLOTS:
|
||||
void selectModule( int index );
|
||||
};
|
||||
|
||||
} // NAMESPACE
|
||||
|
||||
@@ -46,6 +46,8 @@ SubWindowHandle::SubWindowHandle( QWidget * parent ) :
|
||||
// Define the cViewArea as the widget inside the scroll area
|
||||
m_cScrollArea->setWidget( m_cViewArea );
|
||||
|
||||
m_pcCurrentModule = NULL;
|
||||
|
||||
m_cWindowName = QString( " " );
|
||||
m_bIsPlaying = true;
|
||||
m_dScaleFactor = 1;
|
||||
@@ -107,10 +109,23 @@ bool SubWindowHandle::loadFile( const QString &fileName )
|
||||
return true;
|
||||
}
|
||||
|
||||
Void SubWindowHandle::enableModule( PlaYUVerModuleIf* select_module )
|
||||
{
|
||||
m_pcCurrentModule = select_module;
|
||||
m_pcCurrentModule->create( m_pCurrStream->getFrame( m_pcCurrentModule->getModImage() ) );
|
||||
refreshFrame();
|
||||
}
|
||||
|
||||
Void SubWindowHandle::refreshFrame()
|
||||
{
|
||||
m_pCurrStream->getFrame( m_pCurrFrameQImage );
|
||||
m_cViewArea->setImage( QPixmap::fromImage( *m_pCurrFrameQImage ) );
|
||||
if( m_pcCurrentModule )
|
||||
{
|
||||
m_pcCurrentModule->process( m_pCurrStream->getFrame( m_pcCurrentModule->getModImage() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_cViewArea->setImage( QPixmap::fromImage( *( m_pCurrStream->getFrame( m_pCurrFrameQImage ) ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
bool SubWindowHandle::save()
|
||||
@@ -179,7 +194,6 @@ Void SubWindowHandle::stopEvent()
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Void SubWindowHandle::normalSize()
|
||||
{
|
||||
m_dScaleFactor = 1.0;
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "TypeDef.h"
|
||||
#include "InputStream.h"
|
||||
#include "viewarea.h"
|
||||
#include "PlaYUVerModuleIf.h"
|
||||
|
||||
namespace plaYUVer
|
||||
{
|
||||
@@ -50,6 +51,8 @@ private:
|
||||
QScrollArea* m_cScrollArea;
|
||||
ViewArea* m_cViewArea;
|
||||
|
||||
PlaYUVerModuleIf* m_pcCurrentModule;
|
||||
|
||||
InputStream* m_pCurrStream;
|
||||
QImage* m_pCurrFrameQImage;
|
||||
|
||||
@@ -77,6 +80,12 @@ public:
|
||||
return m_pCurrStream;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to enable a module in the
|
||||
* current SubWindow
|
||||
*/
|
||||
Void enableModule( PlaYUVerModuleIf* select_module );
|
||||
|
||||
/**
|
||||
* Show the image at its original size
|
||||
*/
|
||||
|
||||
@@ -26,8 +26,6 @@
|
||||
#include "FilterFrame.h"
|
||||
#include "PlaYUVerFrame.h"
|
||||
|
||||
|
||||
|
||||
namespace plaYUVer
|
||||
{
|
||||
|
||||
@@ -38,7 +36,19 @@ Void FilterFrame::create( PlaYUVerFrame* InputFrame )
|
||||
|
||||
PlaYUVerFrame* FilterFrame::process( PlaYUVerFrame* InputFrame )
|
||||
{
|
||||
Pel*** pppPelYUV = m_pcFilteredFrame->getPelBufferYUV();
|
||||
|
||||
m_pcFilteredFrame->CopyFrom( InputFrame );
|
||||
|
||||
for( Int y = 0; y < m_pcFilteredFrame->getHeight() / 2; y++ )
|
||||
{
|
||||
for( Int x = 0; x < m_pcFilteredFrame->getWidth() / 2; x++ )
|
||||
{
|
||||
pppPelYUV[1][y][x] = 128;
|
||||
pppPelYUV[2][y][x] = 128;
|
||||
}
|
||||
}
|
||||
|
||||
return m_pcFilteredFrame;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,8 +57,14 @@ public:
|
||||
}
|
||||
|
||||
Void create( PlaYUVerFrame* InputFrame );
|
||||
|
||||
PlaYUVerFrame* process( PlaYUVerFrame* InputFrame );
|
||||
Void destroy();
|
||||
|
||||
PlaYUVerFrame* getModImage()
|
||||
{
|
||||
return m_pcFilteredFrame;
|
||||
}
|
||||
};
|
||||
|
||||
} // NAMESPACE
|
||||
|
||||
@@ -58,35 +58,14 @@ public:
|
||||
const Char* m_pchModuleName;
|
||||
const Char* m_pchModuleTooltip;
|
||||
|
||||
virtual Void create()
|
||||
{
|
||||
}
|
||||
virtual Void create() {};
|
||||
virtual Void process() {};
|
||||
|
||||
virtual Void create( QImage* )
|
||||
{
|
||||
}
|
||||
virtual Void create( PlaYUVerFrame* ) {};
|
||||
virtual PlaYUVerFrame* process( PlaYUVerFrame* ) {};
|
||||
virtual PlaYUVerFrame* getModImage() {};
|
||||
|
||||
virtual Void create( PlaYUVerFrame* )
|
||||
{
|
||||
}
|
||||
|
||||
virtual Void process()
|
||||
{
|
||||
}
|
||||
|
||||
virtual QImage* process( QImage* )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
virtual PlaYUVerFrame* process( PlaYUVerFrame* )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
virtual Void destroy()
|
||||
{
|
||||
}
|
||||
virtual Void destroy() {};
|
||||
|
||||
};
|
||||
|
||||
|
||||
+28
-11
@@ -51,7 +51,7 @@ plaYUVerApp::plaYUVerApp()
|
||||
mapperWindow = new QSignalMapper( this );
|
||||
connect( mapperWindow, SIGNAL( mapped(QWidget*) ), this, SLOT( setActiveSubWindow(QWidget*) ) );
|
||||
|
||||
m_pcModulesHandle = new ModulesHandle(this);
|
||||
m_pcModulesHandle = new ModulesHandle( this );
|
||||
|
||||
createActions();
|
||||
createMenus();
|
||||
@@ -133,6 +133,22 @@ void plaYUVerApp::save()
|
||||
activeSubWindow()->save();
|
||||
}
|
||||
|
||||
// ----------------------- Modules Selection --------------------
|
||||
|
||||
void plaYUVerApp::selectModule( QAction *curr_action )
|
||||
{
|
||||
//emit curr_action->triggered();
|
||||
|
||||
if( m_pcModulesHandle->getSelectedModuleIf() )
|
||||
{
|
||||
if( activeSubWindow() )
|
||||
{
|
||||
activeSubWindow()->enableModule( m_pcModulesHandle->getSelectedModuleIf() );
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// ----------------------- Playing Functions --------------------
|
||||
|
||||
void plaYUVerApp::play()
|
||||
@@ -447,7 +463,7 @@ Void plaYUVerApp::createActions()
|
||||
|
||||
Void plaYUVerApp::createMenus()
|
||||
{
|
||||
m_arrayMenu.resize(4);
|
||||
m_arrayMenu.resize( 4 );
|
||||
|
||||
m_arrayMenu[OTHER_MENU] = menuBar()->addMenu( tr( "&File" ) );
|
||||
m_arrayMenu[OTHER_MENU]->addAction( actionOpen );
|
||||
@@ -457,13 +473,14 @@ Void plaYUVerApp::createMenus()
|
||||
m_arrayMenu[OTHER_MENU]->addAction( actionClose );
|
||||
m_arrayMenu[OTHER_MENU]->addAction( actionExit );
|
||||
|
||||
m_arrayMenu[OTHER_MENU+1] = menuBar()->addMenu( tr( "&View" ) );
|
||||
m_arrayMenu[OTHER_MENU+1]->addAction( actionZoomIn );
|
||||
m_arrayMenu[OTHER_MENU+1]->addAction( actionZoomOut );
|
||||
m_arrayMenu[OTHER_MENU+1]->addAction( actionNormalSize );
|
||||
m_arrayMenu[OTHER_MENU+1]->addAction( actionZoomToFit );
|
||||
m_arrayMenu[OTHER_MENU + 1] = menuBar()->addMenu( tr( "&View" ) );
|
||||
m_arrayMenu[OTHER_MENU + 1]->addAction( actionZoomIn );
|
||||
m_arrayMenu[OTHER_MENU + 1]->addAction( actionZoomOut );
|
||||
m_arrayMenu[OTHER_MENU + 1]->addAction( actionNormalSize );
|
||||
m_arrayMenu[OTHER_MENU + 1]->addAction( actionZoomToFit );
|
||||
|
||||
m_pcModulesHandle->createMenus( menuBar() );
|
||||
QMenu* modules_menu = m_pcModulesHandle->createMenus( menuBar() );
|
||||
connect( modules_menu, SIGNAL( triggered(QAction *) ), this, SLOT( selectModule(QAction *) ) );
|
||||
|
||||
m_arrayMenu[WINDOW_MENU] = menuBar()->addMenu( tr( "&Window" ) );
|
||||
updateWindowMenu();
|
||||
@@ -471,9 +488,9 @@ Void plaYUVerApp::createMenus()
|
||||
|
||||
menuBar()->addSeparator();
|
||||
|
||||
m_arrayMenu[OTHER_MENU+2] = menuBar()->addMenu( tr( "&Help" ) );
|
||||
m_arrayMenu[OTHER_MENU+2]->addAction( actionAbout );
|
||||
m_arrayMenu[OTHER_MENU+2]->addAction( actionAboutQt );
|
||||
m_arrayMenu[OTHER_MENU + 2] = menuBar()->addMenu( tr( "&Help" ) );
|
||||
m_arrayMenu[OTHER_MENU + 2]->addAction( actionAbout );
|
||||
m_arrayMenu[OTHER_MENU + 2]->addAction( actionAboutQt );
|
||||
}
|
||||
|
||||
Void plaYUVerApp::createToolBars()
|
||||
|
||||
@@ -63,6 +63,9 @@ private Q_SLOTS:
|
||||
void stop();
|
||||
void playEvent();
|
||||
void seekSliderEvent( int new_frame_num );
|
||||
|
||||
void selectModule( QAction * );
|
||||
|
||||
/**
|
||||
* Scale the image by a given factor
|
||||
* @param factor factor of scale. Ex: 120 scale the image up by 20% and
|
||||
|
||||
Reference in new issue
Block a user