Improve modules interface. Add a variable to mark the module category
and type. change some function in the plaYUVerApp to fix modules disabling when closing a sub window
This commit is contained in:
1 parent
06b80cee03
commit
b4979106b9
7 files changed
+63
-26
No files matched your search
@@ -35,7 +35,6 @@ ModulesHandle::ModulesHandle( QWidget * parent )
|
||||
REGISTER_MODULE( FilterFrame );
|
||||
|
||||
|
||||
|
||||
// configure class
|
||||
setParent( parent );
|
||||
m_uiModulesCount = 0;
|
||||
@@ -51,7 +50,6 @@ Void ModulesHandle::appendModule( PlaYUVerModuleIf* pIfModule )
|
||||
{
|
||||
m_pcPlaYUVerModules.append( pIfModule );
|
||||
m_uiModulesCount++;
|
||||
|
||||
}
|
||||
|
||||
void ModulesHandle::selectModule( int index )
|
||||
@@ -75,6 +73,7 @@ QMenu* ModulesHandle::createMenus( QMenuBar *MainAppMenuBar )
|
||||
{
|
||||
PlaYUVerModuleIf* currModuleIf;
|
||||
QAction* currAction;
|
||||
Bool bCategoryExists = false;
|
||||
|
||||
m_pcActionMapper = new QSignalMapper( this );
|
||||
connect( m_pcActionMapper, SIGNAL( mapped(int) ), this, SLOT( selectModule(int) ) );
|
||||
@@ -82,11 +81,16 @@ QMenu* ModulesHandle::createMenus( QMenuBar *MainAppMenuBar )
|
||||
m_pcModulesMenu = MainAppMenuBar->addMenu( "&Modules" );
|
||||
|
||||
//m_arrayModulesActions.resize( m_uiModulesCount );
|
||||
|
||||
Int total = 0;
|
||||
for( Int i = 0; i < m_pcPlaYUVerModules.size(); i++ )
|
||||
{
|
||||
currModuleIf = m_pcPlaYUVerModules.at( i );
|
||||
|
||||
for( Int j = 0; j < total; j++ )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
currAction = new QAction( tr( currModuleIf->m_cModuleDef.m_pchModuleName ), parent() );
|
||||
currAction->setStatusTip( tr( currModuleIf->m_cModuleDef.m_pchModuleTooltip ) );
|
||||
currAction->setCheckable( true );
|
||||
@@ -99,7 +103,16 @@ QMenu* ModulesHandle::createMenus( QMenuBar *MainAppMenuBar )
|
||||
currModuleIf->m_pcAction = currAction;
|
||||
}
|
||||
return m_pcModulesMenu;
|
||||
//MainAppMenuBar->
|
||||
}
|
||||
|
||||
Void ModulesHandle::updateMenus( Bool hasSubWindow )
|
||||
{
|
||||
QAction* currModuleAction;
|
||||
for( Int i = 0; i < m_pcPlaYUVerModules.size(); i++ )
|
||||
{
|
||||
currModuleAction = m_arrayModulesActions.at( i );
|
||||
currModuleAction->setEnabled( hasSubWindow );
|
||||
}
|
||||
}
|
||||
|
||||
} // NAMESPACE
|
||||
|
||||
@@ -59,6 +59,7 @@ public:
|
||||
~ModulesHandle();
|
||||
|
||||
QMenu* createMenus( QMenuBar *MainAppMenuBar );
|
||||
Void updateMenus( Bool hasSubWindow );
|
||||
PlaYUVerModuleIf* getSelectedModuleIf();
|
||||
|
||||
private:
|
||||
|
||||
@@ -57,6 +57,11 @@ SubWindowHandle::SubWindowHandle( QWidget * parent ) :
|
||||
SubWindowHandle::~SubWindowHandle()
|
||||
{
|
||||
delete m_cViewArea;
|
||||
if( !m_pcCurrentModule )
|
||||
return;
|
||||
m_pcCurrentModule->m_pcAction->setChecked( false );
|
||||
m_pcCurrentModule->destroy();
|
||||
m_pcCurrentModule = NULL;
|
||||
}
|
||||
|
||||
bool SubWindowHandle::loadFile( const QString &fileName )
|
||||
@@ -129,6 +134,7 @@ Void SubWindowHandle::disableModule()
|
||||
{
|
||||
if( !m_pcCurrentModule )
|
||||
return;
|
||||
|
||||
m_pcCurrentModule->destroy();
|
||||
m_pcCurrentModule = NULL;
|
||||
refreshFrame();
|
||||
|
||||
@@ -30,7 +30,8 @@ namespace plaYUVer
|
||||
{
|
||||
|
||||
PlaYUVerModuleDefinition FilterFrameDef = {
|
||||
"FrameLevel",
|
||||
FRAME_LEVEL_MODULE,
|
||||
"Filters"
|
||||
"Y_Filter",
|
||||
"Filter Y matrix of YUV frame",
|
||||
};
|
||||
|
||||
@@ -38,11 +38,18 @@ class QAction;
|
||||
namespace plaYUVer
|
||||
{
|
||||
|
||||
enum __PlaYUVerModuleTypes
|
||||
{
|
||||
FRAME_LEVEL_MODULE,
|
||||
VIDEO_LEVEL_MODULE,
|
||||
};
|
||||
|
||||
typedef struct __PlaYUVerModuleDefinition
|
||||
{
|
||||
const char *m_pchModuleType;
|
||||
const char *m_pchModuleName;
|
||||
const char *m_pchModuleTooltip;
|
||||
int m_pchModuleType;
|
||||
char* m_pchModuleCategory;
|
||||
char* m_pchModuleName;
|
||||
char* m_pchModuleTooltip;
|
||||
}PlaYUVerModuleDefinition;
|
||||
|
||||
|
||||
|
||||
+22
-17
@@ -237,11 +237,14 @@ void plaYUVerApp::chageSubWindowSelection()
|
||||
{
|
||||
if( m_pcCurrentSubWindow )
|
||||
m_pcCurrentSubWindow->disableModule();
|
||||
|
||||
m_pcFrameSlider->setMaximum( activeSubWindow()->getInputStream()->getFrameNum() - 1 );
|
||||
m_pcFrameSlider->setValue( activeSubWindow()->getInputStream()->getCurrFrameNum() );
|
||||
m_pcCurrentSubWindow = activeSubWindow();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pcCurrentSubWindow = NULL;
|
||||
}
|
||||
updateMenus();
|
||||
//updateWindowMenu();
|
||||
}
|
||||
@@ -267,6 +270,8 @@ Void plaYUVerApp::updateMenus()
|
||||
actionVideoBackward->setEnabled( hasSubWindow );
|
||||
actionVideoForward->setEnabled( hasSubWindow );
|
||||
m_pcFrameSlider->setEnabled( hasSubWindow );
|
||||
|
||||
m_pcModulesHandle->updateMenus( hasSubWindow );
|
||||
}
|
||||
|
||||
void plaYUVerApp::updateWindowMenu()
|
||||
@@ -471,21 +476,21 @@ Void plaYUVerApp::createActions()
|
||||
|
||||
Void plaYUVerApp::createMenus()
|
||||
{
|
||||
m_arrayMenu.resize( 4 );
|
||||
m_arrayMenu.resize( TOTAL_MENUS );
|
||||
|
||||
m_arrayMenu[OTHER_MENU] = menuBar()->addMenu( tr( "&File" ) );
|
||||
m_arrayMenu[OTHER_MENU]->addAction( actionOpen );
|
||||
m_arrayMenu[OTHER_MENU]->addSeparator();
|
||||
m_arrayMenu[OTHER_MENU]->addAction( actionSave );
|
||||
m_arrayMenu[OTHER_MENU]->addSeparator();
|
||||
m_arrayMenu[OTHER_MENU]->addAction( actionClose );
|
||||
m_arrayMenu[OTHER_MENU]->addAction( actionExit );
|
||||
m_arrayMenu[FILE_MENU] = menuBar()->addMenu( tr( "&File" ) );
|
||||
m_arrayMenu[FILE_MENU]->addAction( actionOpen );
|
||||
m_arrayMenu[FILE_MENU]->addSeparator();
|
||||
m_arrayMenu[FILE_MENU]->addAction( actionSave );
|
||||
m_arrayMenu[FILE_MENU]->addSeparator();
|
||||
m_arrayMenu[FILE_MENU]->addAction( actionClose );
|
||||
m_arrayMenu[FILE_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[VIEW_MENU] = menuBar()->addMenu( tr( "&View" ) );
|
||||
m_arrayMenu[VIEW_MENU]->addAction( actionZoomIn );
|
||||
m_arrayMenu[VIEW_MENU]->addAction( actionZoomOut );
|
||||
m_arrayMenu[VIEW_MENU]->addAction( actionNormalSize );
|
||||
m_arrayMenu[VIEW_MENU]->addAction( actionZoomToFit );
|
||||
|
||||
QMenu* modules_menu = m_pcModulesHandle->createMenus( menuBar() );
|
||||
connect( modules_menu, SIGNAL( triggered(QAction *) ), this, SLOT( selectModule(QAction *) ) );
|
||||
@@ -496,9 +501,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[ABOUT_MENU] = menuBar()->addMenu( tr( "&Help" ) );
|
||||
m_arrayMenu[ABOUT_MENU]->addAction( actionAbout );
|
||||
m_arrayMenu[ABOUT_MENU]->addAction( actionAboutQt );
|
||||
}
|
||||
|
||||
Void plaYUVerApp::createToolBars()
|
||||
|
||||
@@ -128,7 +128,11 @@ private:
|
||||
*/
|
||||
enum MAIN_APP_MENU_LIST
|
||||
{
|
||||
WINDOW_MENU = 0, OTHER_MENU,
|
||||
FILE_MENU = 0,
|
||||
VIEW_MENU,
|
||||
WINDOW_MENU,
|
||||
ABOUT_MENU,
|
||||
TOTAL_MENUS,
|
||||
};
|
||||
QVector<QMenu*> m_arrayMenu;
|
||||
|
||||
|
||||
Reference in new issue
Block a user