Fix problems with modules enable/disable
This commit is contained in:
1 parent
fb18de9ffa
commit
e9443dcfd3
10 files changed
+98
-44
No files matched your search
+29
-22
@@ -69,6 +69,9 @@ Void ModulesHandle::createActions()
|
||||
connect( m_arrayActions[SWAP_FRAMES_ACT], SIGNAL( triggered() ), m_pcActionMapper, SLOT( map() ) );
|
||||
m_pcActionMapper->setMapping( m_arrayActions[SWAP_FRAMES_ACT], SWAP_FRAMES_ACT );
|
||||
|
||||
m_arrayActions[DISABLE_ACT] = new QAction( "Disable Modules", parent() );
|
||||
connect( m_arrayActions[DISABLE_ACT], SIGNAL( triggered() ), this, SLOT( destroyWindowModules() ) );
|
||||
|
||||
m_arrayActions[DISABLE_ALL_ACT] = new QAction( "Disable All Modules", parent() );
|
||||
connect( m_arrayActions[DISABLE_ALL_ACT], SIGNAL( triggered() ), this, SLOT( destroyAllModulesIf() ) );
|
||||
|
||||
@@ -115,7 +118,7 @@ QMenu* ModulesHandle::createMenu()
|
||||
currAction = new QAction( pcCurrModuleIf->m_pchModuleName, parent() );
|
||||
currAction->setStatusTip( pcCurrModuleIf->m_pchModuleTooltip );
|
||||
currAction->setData( ModuleIfInternalName );
|
||||
currAction->setCheckable( true );
|
||||
currAction->setCheckable( false );
|
||||
connect( currAction, SIGNAL( triggered() ), this, SLOT( activateModule() ) );
|
||||
//connect( currAction, SIGNAL( triggered() ), m_pcModulesActionMapper, SLOT( map() ) );
|
||||
m_pcModulesActionMapper->setMapping( currAction, i );
|
||||
@@ -132,6 +135,7 @@ QMenu* ModulesHandle::createMenu()
|
||||
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] );
|
||||
|
||||
@@ -154,6 +158,7 @@ Void ModulesHandle::updateMenus()
|
||||
{
|
||||
m_arrayActions.at( i )->setEnabled( false );
|
||||
}
|
||||
m_arrayActions[DISABLE_ACT]->setEnabled( hasSubWindow );
|
||||
m_arrayActions[DISABLE_ALL_ACT]->setEnabled( hasSubWindow );
|
||||
m_arrayActions[FORCE_NEW_WINDOW_ACT]->setEnabled( hasSubWindow );
|
||||
if( pcSubWindow )
|
||||
@@ -217,19 +222,12 @@ Void ModulesHandle::activateModule()
|
||||
VideoSubWindow* pcVideoSubWindow = qobject_cast<VideoSubWindow *>( m_pcMainWindowManager->activeSubWindow() );
|
||||
if( pcVideoSubWindow )
|
||||
{
|
||||
if( pcAction->isChecked() )
|
||||
{
|
||||
QString ModuleIfName = pcAction->data().toString();
|
||||
PlaYUVerModuleIf* pcCurrModuleIf = PlaYUVerModuleFactory::Get()->CreateModule( ModuleIfName.toLocal8Bit().constData() );
|
||||
QString ModuleIfName = pcAction->data().toString();
|
||||
PlaYUVerModuleIf* pcCurrModuleIf = PlaYUVerModuleFactory::Get()->CreateModule( ModuleIfName.toLocal8Bit().constData() );
|
||||
|
||||
PlaYUVerAppModuleIf* pcCurrAppModuleIf = new PlaYUVerAppModuleIf( this, pcAction, pcCurrModuleIf );
|
||||
enableModuleIf( pcCurrAppModuleIf );
|
||||
m_pcPlaYUVerAppModuleIfList.append( pcCurrAppModuleIf );
|
||||
}
|
||||
else
|
||||
{
|
||||
pcVideoSubWindow->disableModule();
|
||||
}
|
||||
PlaYUVerAppModuleIf* pcCurrAppModuleIf = new PlaYUVerAppModuleIf( this, pcAction, pcCurrModuleIf );
|
||||
enableModuleIf( pcCurrAppModuleIf );
|
||||
m_pcPlaYUVerAppModuleIfList.append( pcCurrAppModuleIf );
|
||||
}
|
||||
emit changed();
|
||||
}
|
||||
@@ -297,8 +295,6 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
|
||||
pcCurrModuleIf->m_pcSubWindow[i] = videoSubWindowList.at( i );
|
||||
}
|
||||
|
||||
pcCurrModuleIf->m_pcDisplaySubWindow = NULL;
|
||||
|
||||
if( pcCurrModuleIf->m_pcModule->m_iModuleType == FRAME_PROCESSING_MODULE )
|
||||
{
|
||||
if( ( pcCurrModuleIf->m_pcModule->m_uiModuleRequirements & MODULE_REQUIRES_NEW_WINDOW ) || bShowModulesNewWindow )
|
||||
@@ -312,16 +308,18 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
|
||||
SLOT( zoomToFactorAll( double, QPoint ) ) );
|
||||
connect( pcModuleSubWindow, SIGNAL( scrollBarMoved_SWindow( const QPoint ) ), m_appModuleVideo, SLOT( moveAllScrollBars( const QPoint ) ) );
|
||||
|
||||
connect( pcModuleSubWindow, SIGNAL( updateStatusBar( const QString& ) ), this, SLOT( updateStatusBar( const QString& ) ) );
|
||||
connect( pcModuleSubWindow, SIGNAL( zoomFactorChanged_SWindow( const double, const QPoint ) ), this, SLOT( updateZoomFactorSBox() ) );
|
||||
//connect( pcModuleSubWindow, SIGNAL( updateStatusBar( const QString& ) ), this, SLOT( updateStatusBar( const QString& ) ) );
|
||||
//connect( pcModuleSubWindow, SIGNAL( zoomFactorChanged_SWindow( const double, const QPoint ) ), this, SLOT( updateZoomFactorSBox() ) );
|
||||
|
||||
pcCurrModuleIf->m_pcDisplaySubWindow = pcModuleSubWindow;
|
||||
|
||||
//m_pcMdiArea->addSubWindow( pcModuleSubWindow );
|
||||
}
|
||||
|
||||
}
|
||||
else if( pcCurrModuleIf->m_pcModule->m_iModuleType == FRAME_MEASUREMENT_MODULE )
|
||||
{
|
||||
pcCurrModuleIf->m_pcDisplaySubWindow = NULL;
|
||||
if( pcCurrModuleIf->m_pcModule->m_uiModuleRequirements & MODULE_REQUIRES_SIDEBAR )
|
||||
{
|
||||
pcCurrModuleIf->m_pcModuleDock = new ModuleHandleDock( m_pcParent, pcCurrModuleIf );
|
||||
@@ -340,18 +338,19 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
|
||||
pcCurrModuleIf->m_pcModule->create( pcCurrModuleIf->m_pcSubWindow[0]->getCurrFrame() );
|
||||
|
||||
// Associate module with subwindows
|
||||
if( pcCurrModuleIf->m_pcDisplaySubWindow )
|
||||
if( !pcCurrModuleIf->m_pcDisplaySubWindow && !pcCurrModuleIf->m_pcModuleDock )
|
||||
{
|
||||
pcCurrModuleIf->m_pcDisplaySubWindow->enableModule( pcCurrModuleIf, true );
|
||||
pcCurrModuleIf->m_pcSubWindow[0]->enableModule( pcCurrModuleIf );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( pcCurrModuleIf->m_pcDisplaySubWindow )
|
||||
pcCurrModuleIf->m_pcDisplaySubWindow->enableModule( pcCurrModuleIf );
|
||||
for( UInt i = 0; i < numberOfFrames; i++ )
|
||||
{
|
||||
pcCurrModuleIf->m_pcSubWindow[i]->associateModule( pcCurrModuleIf );
|
||||
}
|
||||
}
|
||||
|
||||
applyModuleIf( pcCurrModuleIf, false );
|
||||
QCoreApplication::processEvents();
|
||||
|
||||
@@ -360,7 +359,6 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
|
||||
m_pcMainWindowManager->addSubWindow( pcModuleSubWindow );
|
||||
pcModuleSubWindow->show();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -379,7 +377,7 @@ Void ModulesHandle::destroyModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
|
||||
pcCurrModuleIf->m_pcDockWidget = NULL;
|
||||
}
|
||||
if( pcCurrModuleIf->m_pcDisplaySubWindow )
|
||||
pcCurrModuleIf->m_pcDisplaySubWindow->close();
|
||||
pcCurrModuleIf->m_pcDisplaySubWindow->closeSubWindow();
|
||||
pcCurrModuleIf->m_pcDisplaySubWindow = NULL;
|
||||
|
||||
for( Int i = 0; i < MAX_NUMBER_FRAMES; i++ )
|
||||
@@ -405,6 +403,15 @@ Void ModulesHandle::destroyModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
|
||||
}
|
||||
}
|
||||
|
||||
Void ModulesHandle::destroyWindowModules()
|
||||
{
|
||||
VideoSubWindow* pcVideoSubWindow = qobject_cast<VideoSubWindow *>( m_pcMainWindowManager->activeSubWindow() );
|
||||
if( pcVideoSubWindow )
|
||||
{
|
||||
pcVideoSubWindow->disableModule();
|
||||
}
|
||||
}
|
||||
|
||||
Void ModulesHandle::destroyAllModulesIf()
|
||||
{
|
||||
for( Int i = 0; i < m_pcPlaYUVerAppModuleIfList.size(); i++ )
|
||||
|
||||
@@ -94,6 +94,7 @@ private:
|
||||
FORCE_PLAYING_REFRESH_ACT,
|
||||
APPLY_ALL_ACT,
|
||||
SWAP_FRAMES_ACT,
|
||||
DISABLE_ACT,
|
||||
DISABLE_ALL_ACT,
|
||||
MODULES_TOTAL_ACT
|
||||
};
|
||||
@@ -112,6 +113,7 @@ Q_SIGNALS:
|
||||
private Q_SLOTS:
|
||||
void activateModule();
|
||||
void processOpt( int index );
|
||||
void destroyWindowModules();
|
||||
void destroyAllModulesIf();
|
||||
|
||||
};
|
||||
|
||||
@@ -123,7 +123,7 @@ Void PlaYUVerSubWindowHandle::updateActiveSubWindow( SubWindowHandle *window )
|
||||
if( windowIdx >= 0 )
|
||||
{
|
||||
m_pcActiveWindow = m_apcSubWindowList.at( windowIdx );
|
||||
emit windowActivated();
|
||||
emit changed();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -133,8 +133,8 @@ Void PlaYUVerSubWindowHandle::addSubWindow( SubWindowHandle *window, Qt::WindowF
|
||||
{
|
||||
if( m_uiWindowMode == NormalSubWindows )
|
||||
{
|
||||
connect( window, SIGNAL( aboutToActivate( SubWindowHandle* ) ), this, SLOT( aboutToActivate( SubWindowHandle* ) ) );
|
||||
connect( window, SIGNAL( aboutToClose( SubWindowHandle* ) ), this, SLOT( removeMdiSubWindow( SubWindowHandle* ) ) );
|
||||
connect( window, SIGNAL( aboutToActivate( SubWindowHandle* ) ), this, SLOT( updateActiveSubWindow( SubWindowHandle* ) ) );
|
||||
connect( window, SIGNAL( aboutToClose( SubWindowHandle* ) ), this, SLOT( removeSubWindow( SubWindowHandle* ) ) );
|
||||
}
|
||||
if( m_uiWindowMode == MdiWSubWindows )
|
||||
{
|
||||
@@ -142,6 +142,7 @@ Void PlaYUVerSubWindowHandle::addSubWindow( SubWindowHandle *window, Qt::WindowF
|
||||
mdiSubWindow->setWidget( window );
|
||||
m_pcMdiArea->addSubWindow( mdiSubWindow );
|
||||
m_apcMdiSubWindowList.append( mdiSubWindow );
|
||||
window->setSubWindow( mdiSubWindow );
|
||||
connect( mdiSubWindow, SIGNAL( aboutToClose( PlaYUVerMdiSubWindow* ) ), this, SLOT( removeMdiSubWindow( PlaYUVerMdiSubWindow* ) ) );
|
||||
}
|
||||
m_apcSubWindowList.append( window );
|
||||
@@ -168,6 +169,10 @@ Void PlaYUVerSubWindowHandle::removeSubWindow( Int windowIdx )
|
||||
|
||||
if( !m_apcSubWindowList.isEmpty() )
|
||||
m_apcSubWindowList.front()->setFocus();
|
||||
else
|
||||
m_pcActiveWindow = NULL;
|
||||
|
||||
emit changed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -111,6 +111,7 @@ public Q_SLOTS:
|
||||
void updateMenu();
|
||||
|
||||
Q_SIGNALS:
|
||||
void changed();
|
||||
void windowActivated();
|
||||
|
||||
};
|
||||
|
||||
+18
-2
@@ -23,12 +23,13 @@
|
||||
*/
|
||||
|
||||
#include "SubWindowHandle.h"
|
||||
|
||||
#include "PlaYUVerMdiSubWindow.h"
|
||||
namespace plaYUVer
|
||||
{
|
||||
|
||||
SubWindowHandle::SubWindowHandle( QWidget * parent, UInt category ) :
|
||||
QScrollArea( parent )
|
||||
QScrollArea( parent ),
|
||||
m_cSubWindow( NULL )
|
||||
{
|
||||
setParent( parent );
|
||||
setFocusPolicy( Qt::WheelFocus );
|
||||
@@ -48,10 +49,18 @@ SubWindowHandle::SubWindowHandle( QWidget * parent, UInt category ) :
|
||||
m_uiCategory = category;
|
||||
m_cLastScroll = QPoint();
|
||||
m_cWindowName = QString( " " );
|
||||
|
||||
connect(this, SIGNAL(destroyed()), this, SLOT(onDestroyed()));
|
||||
}
|
||||
|
||||
void SubWindowHandle::onDestroyed()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SubWindowHandle::~SubWindowHandle()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QSize SubWindowHandle::getScrollSize()
|
||||
@@ -149,4 +158,11 @@ Void SubWindowHandle::closeEvent( QCloseEvent *event )
|
||||
event->accept();
|
||||
}
|
||||
|
||||
Void SubWindowHandle::closeSubWindow()
|
||||
{
|
||||
close();
|
||||
if( m_cSubWindow )
|
||||
m_cSubWindow->close();
|
||||
}
|
||||
|
||||
} // NAMESPACE
|
||||
@@ -36,6 +36,8 @@
|
||||
namespace plaYUVer
|
||||
{
|
||||
|
||||
class PlaYUVerMdiSubWindow;
|
||||
|
||||
class SubWindowHandle: public QScrollArea
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -46,6 +48,8 @@ private:
|
||||
UInt m_uiCategory;
|
||||
QString m_cWindowName;
|
||||
|
||||
PlaYUVerMdiSubWindow* m_cSubWindow;
|
||||
|
||||
public:
|
||||
enum SubWindowCategories
|
||||
{
|
||||
@@ -100,6 +104,13 @@ public:
|
||||
return m_uiCategory;
|
||||
}
|
||||
|
||||
Void setSubWindow(PlaYUVerMdiSubWindow* subWindow )
|
||||
{
|
||||
m_cSubWindow = subWindow;
|
||||
}
|
||||
|
||||
Void closeSubWindow();
|
||||
|
||||
protected:
|
||||
void focusInEvent( QFocusEvent * event );
|
||||
void closeEvent( QCloseEvent *event );
|
||||
@@ -123,6 +134,7 @@ Q_SIGNALS:
|
||||
void aboutToClose( SubWindowHandle* );
|
||||
|
||||
public Q_SLOTS:
|
||||
void onDestroyed();
|
||||
void adjustScrollBarByScale( double scale, QPoint center );
|
||||
void adjustScrollBarByOffset( QPoint Offset );
|
||||
void updateLastScrollValue();
|
||||
|
||||
@@ -250,6 +250,8 @@ Void VideoHandle::update()
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pcVideoFormatLabel->setText( "" );
|
||||
m_pcResolutionLabel->setText( "" );
|
||||
m_pcFramePropertiesSideBar->setData( NULL, false );
|
||||
m_pcFrameSlider->setValue( 0 );
|
||||
m_pcFrameNumInfo->clear();
|
||||
|
||||
+24
-16
@@ -200,19 +200,26 @@ Bool VideoSubWindow::loadFile( PlaYUVerStreamInfo* streamInfo )
|
||||
|
||||
Void VideoSubWindow::updateVideoWindowInfo()
|
||||
{
|
||||
if( !m_bIsModule && !m_pcCurrentDisplayModule)
|
||||
if( m_pCurrStream )
|
||||
{
|
||||
QString m_cFormatName = QString::fromStdString( m_pCurrStream->getFormatName() );
|
||||
QString m_cCodedName = QString::fromStdString( m_pCurrStream->getCodecName() );
|
||||
QString m_cPelFmtName = QString::fromStdString( m_pCurrStream->getPelFmtName() );
|
||||
m_cStreamInformation = m_cFormatName + " | " + m_cCodedName + " | " + m_cPelFmtName;
|
||||
}
|
||||
else if( m_pcCurrFrame )
|
||||
{
|
||||
if( m_bIsModule || m_pcCurrentDisplayModule )
|
||||
{
|
||||
m_cStreamInformation = "Module | ";
|
||||
}
|
||||
QString m_cPelFmtName = QString::fromStdString( PlaYUVerFrame::supportedPixelFormatListNames()[m_pcCurrFrame->getPelFormat()].data() );
|
||||
m_cStreamInformation += m_cPelFmtName;
|
||||
}
|
||||
else
|
||||
{
|
||||
QString m_cPelFmtName = QString::fromStdString( PlaYUVerFrame::supportedPixelFormatListNames()[m_pcCurrFrame->getPelFormat()].data() );
|
||||
m_cStreamInformation = "Module | " + m_cPelFmtName;
|
||||
m_cStreamInformation = " ";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Bool VideoSubWindow::guessFormat( QString filename, UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rFrameRate )
|
||||
@@ -320,14 +327,14 @@ Void VideoSubWindow::updateSelectedArea( QRect area )
|
||||
* Functions to enable a module in the
|
||||
* current SubWindow
|
||||
*/
|
||||
Void VideoSubWindow::enableModule( PlaYUVerAppModuleIf* pcModule, Bool bThisWindow )
|
||||
Void VideoSubWindow::enableModule( PlaYUVerAppModuleIf* pcModule )
|
||||
{
|
||||
if( bThisWindow && m_pcCurrentDisplayModule)
|
||||
if( m_pcCurrentDisplayModule )
|
||||
{
|
||||
disableModule( m_pcCurrentDisplayModule );
|
||||
m_pcCurrentDisplayModule = pcModule;
|
||||
updateVideoWindowInfo();
|
||||
}
|
||||
m_pcCurrentDisplayModule = pcModule;
|
||||
updateVideoWindowInfo();
|
||||
}
|
||||
|
||||
Void VideoSubWindow::disableModule( PlaYUVerAppModuleIf* pcModule )
|
||||
@@ -339,9 +346,9 @@ Void VideoSubWindow::disableModule( PlaYUVerAppModuleIf* pcModule )
|
||||
if( modIdx != -1 )
|
||||
{
|
||||
m_apcCurrentModule.removeAt( modIdx );
|
||||
ModulesHandle::destroyModuleIf( pcModule );
|
||||
bRefresh |= true;
|
||||
}
|
||||
ModulesHandle::destroyModuleIf( pcModule );
|
||||
bRefresh |= true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -357,7 +364,7 @@ Void VideoSubWindow::disableModule( PlaYUVerAppModuleIf* pcModule )
|
||||
{
|
||||
pcModule = m_pcCurrentDisplayModule;
|
||||
m_pcCurrentDisplayModule = 0;
|
||||
ModulesHandle::destroyModuleIf( m_pcCurrentDisplayModule );
|
||||
ModulesHandle::destroyModuleIf( pcModule );
|
||||
bRefresh |= true;
|
||||
}
|
||||
}
|
||||
@@ -389,16 +396,17 @@ Void VideoSubWindow::refreshFrame()
|
||||
}
|
||||
if( m_pcCurrentDisplayModule )
|
||||
{
|
||||
bSetFrame = ModulesHandle::applyModuleIf( m_pcCurrentDisplayModule, m_bIsPlaying );
|
||||
}
|
||||
for( Int i = 0; i < m_apcCurrentModule.size(); i++ )
|
||||
{
|
||||
ModulesHandle::applyModuleIf( m_apcCurrentModule.at( i ), m_bIsPlaying );
|
||||
ModulesHandle::applyModuleIf( m_pcCurrentDisplayModule, m_bIsPlaying );
|
||||
bSetFrame = false;
|
||||
}
|
||||
if( bSetFrame )
|
||||
{
|
||||
m_cViewArea->setImage( m_pcCurrFrame );
|
||||
}
|
||||
for( Int i = 0; i < m_apcCurrentModule.size(); i++ )
|
||||
{
|
||||
ModulesHandle::applyModuleIf( m_apcCurrentModule.at( i ), m_bIsPlaying );
|
||||
}
|
||||
}
|
||||
|
||||
Bool VideoSubWindow::save( QString filename )
|
||||
|
||||
@@ -164,7 +164,7 @@ public:
|
||||
* Functions to enable a module in the
|
||||
* current SubWindow
|
||||
*/
|
||||
Void enableModule( PlaYUVerAppModuleIf* pcModule, Bool bThisWindow = true );
|
||||
Void enableModule( PlaYUVerAppModuleIf* pcModule );
|
||||
Void disableModule( PlaYUVerAppModuleIf* pcModule = NULL );
|
||||
Void associateModule( PlaYUVerAppModuleIf* pcModule );
|
||||
|
||||
|
||||
@@ -68,6 +68,7 @@ plaYUVerApp::plaYUVerApp()
|
||||
setAcceptDrops( true );
|
||||
|
||||
connect( m_pcWindowHandle, SIGNAL( windowActivated() ), this, SLOT( update() ) );
|
||||
connect( m_pcWindowHandle, SIGNAL( changed() ), this, SLOT( update() ) );
|
||||
connect( m_appModuleVideo, SIGNAL( changed() ), this, SLOT( update() ) );
|
||||
connect( m_appModuleQuality, SIGNAL( changed() ), this, SLOT( update() ) );
|
||||
connect( m_appModuleExtensions, SIGNAL( changed() ), this, SLOT( update() ) );
|
||||
|
||||
Reference in new issue
Block a user