Add new functions to update modules menu and fix minor error in dynamic loaded modules
This commit is contained in:
1 parent
ae0f861988
commit
04300cc655
4 files changed
+58
-24
No files matched your search
+1
-1
@@ -23,7 +23,7 @@ SET( PLAYUVER_VERSION "${PLAYUVER_VERSION_MAJOR}.${PLAYUVER_VERSION_MINOR}.${PLA
|
||||
|
||||
OPTION( PLAYUVER_BUILD_APP "Build GUI Application" ON )
|
||||
OPTION( PLAYUVER_BUILD_TOOLS "Build Command Line Application" ON )
|
||||
OPTION( PLAYUVER_BUILD_EXEMPLES "Build Examples" ON )
|
||||
OPTION( PLAYUVER_BUILD_EXEMPLES "Build Examples" OFF )
|
||||
OPTION( USE_SSE "Build with SSE support" OFF )
|
||||
OPTION( USE_FERVOR "Add Fervor support" OFF )
|
||||
OPTION( USE_WERROR "Warnings as errors" OFF )
|
||||
|
||||
+50
-19
@@ -55,12 +55,13 @@ Void ModulesHandle::createActions()
|
||||
m_pcActionMapper = new QSignalMapper( this );
|
||||
connect( m_pcActionMapper, SIGNAL( mapped(int) ), this, SLOT( processOpt(int) ) );
|
||||
|
||||
m_arrayActions[FORCE_NEW_WINDOW_ACT] = new QAction( "Use New Window", parent() );
|
||||
m_arrayActions[FORCE_NEW_WINDOW_ACT]->setStatusTip( "Show module result in a new window. Some modules already force this feature" );
|
||||
m_arrayActions[FORCE_NEW_WINDOW_ACT]->setCheckable( true );
|
||||
m_arrayActions[FORCE_PLAYING_REFRESH_ACT] = new QAction( "Refresh while playing", parent() );
|
||||
m_arrayActions[FORCE_PLAYING_REFRESH_ACT]->setStatusTip( "Force module refreshing while playing" );
|
||||
m_arrayActions[FORCE_PLAYING_REFRESH_ACT]->setCheckable( true );
|
||||
// m_arrayActions[FORCE_PLAYING_REFRESH_ACT] = new QAction( "Refresh while playing", parent() );
|
||||
// m_arrayActions[FORCE_PLAYING_REFRESH_ACT]->setStatusTip( "Force module refreshing while playing" );
|
||||
// m_arrayActions[FORCE_PLAYING_REFRESH_ACT]->setCheckable( true );
|
||||
|
||||
m_arrayActions[LOAD_EXTERNAL_ACT] = new QAction( "Load external module", parent() );
|
||||
m_arrayActions[LOAD_EXTERNAL_ACT]->setStatusTip( "Load an externally build module" );
|
||||
connect( m_arrayActions[LOAD_EXTERNAL_ACT], SIGNAL( triggered() ), this, SLOT( loadExternalModule() ) );
|
||||
|
||||
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" );
|
||||
@@ -78,23 +79,37 @@ Void ModulesHandle::createActions()
|
||||
m_arrayActions[DISABLE_ALL_ACT] = new QAction( "Disable All Modules", parent() );
|
||||
connect( m_arrayActions[DISABLE_ALL_ACT], SIGNAL( triggered() ), this, SLOT( destroyAllModulesIf() ) );
|
||||
|
||||
m_arrayActions[FORCE_NEW_WINDOW_ACT] = new QAction( "Use New Window", parent() );
|
||||
m_arrayActions[FORCE_NEW_WINDOW_ACT]->setStatusTip( "Show module result in a new window. Some modules already force this feature" );
|
||||
m_arrayActions[FORCE_NEW_WINDOW_ACT]->setCheckable( true );
|
||||
|
||||
}
|
||||
|
||||
QMenu* ModulesHandle::createMenu()
|
||||
{
|
||||
m_pcModulesMenu = new QMenu( "&Modules", this );
|
||||
buildMenu();
|
||||
return m_pcModulesMenu;
|
||||
}
|
||||
|
||||
Void ModulesHandle::buildMenu()
|
||||
{
|
||||
PlaYUVerModuleIf* pcCurrModuleIf;
|
||||
QString ModuleIfInternalName;
|
||||
QAction* currAction;
|
||||
QMenu* currSubMenu;
|
||||
|
||||
m_pcModulesMenu = new QMenu( "&Modules", this );
|
||||
for( Int i = 0; i < m_arrayModulesActions.size(); i++ )
|
||||
{
|
||||
delete m_arrayModulesActions.at( i );
|
||||
}
|
||||
m_arrayModulesActions.clear();
|
||||
m_pcModulesMenu->clear();
|
||||
m_pcModulesSubMenuList.clear();
|
||||
|
||||
m_pcModulesActionMapper = new QSignalMapper( this );
|
||||
|
||||
UInt i = 0;
|
||||
PlaYUVerModuleFactoryMap& PlaYUVerModuleFactoryMap = PlaYUVerModuleFactory::Get()->getMap();
|
||||
PlaYUVerModuleFactoryMap::iterator it = PlaYUVerModuleFactoryMap.begin();
|
||||
for( ; it != PlaYUVerModuleFactoryMap.end(); ++it, i++ )
|
||||
for( ; it != PlaYUVerModuleFactoryMap.end(); ++it )
|
||||
{
|
||||
pcCurrModuleIf = it->second();
|
||||
ModuleIfInternalName = QString::fromLocal8Bit( it->first );
|
||||
@@ -122,8 +137,6 @@ QMenu* ModulesHandle::createMenu()
|
||||
currAction->setData( ModuleIfInternalName );
|
||||
currAction->setCheckable( false );
|
||||
connect( currAction, SIGNAL( triggered() ), this, SLOT( activateModule() ) );
|
||||
//connect( currAction, SIGNAL( triggered() ), m_pcModulesActionMapper, SLOT( map() ) );
|
||||
m_pcModulesActionMapper->setMapping( currAction, i );
|
||||
m_arrayModulesActions.append( currAction );
|
||||
|
||||
if( currSubMenu )
|
||||
@@ -134,14 +147,13 @@ QMenu* ModulesHandle::createMenu()
|
||||
pcCurrModuleIf->Delete();
|
||||
}
|
||||
|
||||
m_pcModulesMenu->addAction( m_arrayActions[LOAD_EXTERNAL_ACT] );
|
||||
m_pcModulesMenu->addSeparator();
|
||||
m_pcModulesMenu->addAction( m_arrayActions[APPLY_ALL_ACT] );
|
||||
m_pcModulesMenu->addAction( m_arrayActions[SWAP_FRAMES_ACT] );
|
||||
m_pcModulesMenu->addAction( m_arrayActions[DISABLE_ACT] );
|
||||
m_pcModulesMenu->addAction( m_arrayActions[DISABLE_ALL_ACT] );
|
||||
m_pcModulesMenu->addAction( m_arrayActions[FORCE_NEW_WINDOW_ACT] );
|
||||
|
||||
return m_pcModulesMenu;
|
||||
}
|
||||
|
||||
Void ModulesHandle::updateMenus()
|
||||
@@ -165,6 +177,7 @@ Void ModulesHandle::updateMenus()
|
||||
{
|
||||
m_arrayActions.at( i )->setEnabled( false );
|
||||
}
|
||||
m_arrayActions[LOAD_EXTERNAL_ACT]->setEnabled( true );
|
||||
m_arrayActions[FORCE_NEW_WINDOW_ACT]->setEnabled( hasSubWindow );
|
||||
m_arrayActions[DISABLE_ALL_ACT]->setEnabled( m_pcPlaYUVerAppModuleIfList.size() > 0 );
|
||||
|
||||
@@ -224,10 +237,29 @@ Void ModulesHandle::processOpt( Int index )
|
||||
}
|
||||
}
|
||||
|
||||
Void ModulesHandle::loadExternalModule()
|
||||
{
|
||||
QString supported = tr( "Supported Files (*.so)" );
|
||||
QStringList formatsList;
|
||||
formatsList << "Shared Libraries (*.so)";
|
||||
|
||||
QStringList filter;
|
||||
filter << supported
|
||||
<< formatsList
|
||||
<< tr( "All Files (*)" );
|
||||
|
||||
QString fileName = QFileDialog::getSaveFileName( m_pcParent, tr( "Open File" ), QString(), filter.join( ";;" ) );
|
||||
if( !fileName.isEmpty() )
|
||||
{
|
||||
PlaYUVerModuleFactory::Get()->RegisterDl( fileName.toStdString().data() );
|
||||
buildMenu();
|
||||
}
|
||||
}
|
||||
|
||||
Void ModulesHandle::activateModule()
|
||||
{
|
||||
QAction *pcAction = qobject_cast<QAction *>( sender() );
|
||||
Qt::KeyboardModifiers keyModifiers = QApplication::keyboardModifiers();
|
||||
Qt::KeyboardModifiers keyModifiers = QApplication::keyboardModifiers();
|
||||
Bool bTmpForceNewWindow = false;
|
||||
if( keyModifiers & Qt::ControlModifier )
|
||||
{
|
||||
@@ -242,7 +274,6 @@ Void ModulesHandle::activateModule()
|
||||
PlaYUVerModuleIf* pcCurrModuleIf = PlaYUVerModuleFactory::Get()->CreateModule( ModuleIfName.toLocal8Bit().constData() );
|
||||
PlaYUVerAppModuleIf* pcCurrAppModuleIf = new PlaYUVerAppModuleIf( this, pcAction, pcCurrModuleIf );
|
||||
|
||||
|
||||
QList<VideoSubWindow*> videoSubWindowList;
|
||||
Int numberOfFrames = pcCurrAppModuleIf->m_pcModule->m_uiNumberOfFrames;
|
||||
if( numberOfFrames > MODULE_REQUIRES_ONE_FRAME ) // Show dialog to select sub windows
|
||||
@@ -486,8 +517,8 @@ Void ModulesHandle::applyAllModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
|
||||
|
||||
QStringList filter;
|
||||
filter << supported
|
||||
<< formatsList
|
||||
<< tr( "All Files (*)" );
|
||||
<< formatsList
|
||||
<< tr( "All Files (*)" );
|
||||
|
||||
QString fileName = QFileDialog::getSaveFileName( m_pcParent, tr( "Open File" ), QString(), filter.join( ";;" ) );
|
||||
|
||||
|
||||
+5
-3
@@ -57,6 +57,7 @@ public:
|
||||
Void createActions();
|
||||
QMenu* createMenu();
|
||||
//QDockWidget* createDock();
|
||||
Void buildMenu();
|
||||
Void updateMenus();
|
||||
|
||||
Void readSettings();
|
||||
@@ -84,16 +85,16 @@ private:
|
||||
QList<PlaYUVerAppModuleIf*> m_pcPlaYUVerAppModuleIfList;
|
||||
|
||||
QVector<QAction*> m_arrayModulesActions;
|
||||
QSignalMapper* m_pcModulesActionMapper;
|
||||
|
||||
enum MODULES_ACTION_LIST
|
||||
{
|
||||
FORCE_NEW_WINDOW_ACT = 0,
|
||||
FORCE_PLAYING_REFRESH_ACT,
|
||||
LOAD_EXTERNAL_ACT,
|
||||
//FORCE_PLAYING_REFRESH_ACT,
|
||||
APPLY_ALL_ACT,
|
||||
SWAP_FRAMES_ACT,
|
||||
DISABLE_ACT,
|
||||
DISABLE_ALL_ACT,
|
||||
FORCE_NEW_WINDOW_ACT,
|
||||
MODULES_TOTAL_ACT
|
||||
};
|
||||
QVector<QAction*> m_arrayActions;
|
||||
@@ -109,6 +110,7 @@ Q_SIGNALS:
|
||||
void changed();
|
||||
|
||||
private Q_SLOTS:
|
||||
void loadExternalModule();
|
||||
void activateModule();
|
||||
void processOpt( int index );
|
||||
void destroyWindowModules();
|
||||
|
||||
@@ -33,8 +33,9 @@
|
||||
|
||||
namespace plaYUVer
|
||||
{
|
||||
|
||||
#define REGISTER_CLASS_MAKER(X) \
|
||||
extern "C" PlaYUVerModuleIf* Maker() { return new AbsoluteFrameDifference; }
|
||||
extern "C" PlaYUVerModuleIf* Maker() { return new X; }
|
||||
|
||||
#define REGISTER_CLASS_FACTORY(X) \
|
||||
public: \
|
||||
|
||||
Reference in new issue
Block a user