From f1d65d112d45530f67b03f556d86f22db932f85f Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Tue, 27 Jan 2015 15:25:29 +0000 Subject: [PATCH] fix problems with windows categories --- app/ModulesHandle.cpp | 22 +++++++++++++--------- app/ModulesHandle.h | 4 +++- app/PlaYUVerSubWindowHandle.cpp | 2 +- app/VideoSubWindow.cpp | 6 +++--- app/VideoSubWindow.h | 7 ++++++- app/plaYUVerApp.cpp | 4 ++-- 6 files changed, 28 insertions(+), 17 deletions(-) diff --git a/app/ModulesHandle.cpp b/app/ModulesHandle.cpp index 72e0b28..ae9b6d0 100644 --- a/app/ModulesHandle.cpp +++ b/app/ModulesHandle.cpp @@ -23,21 +23,21 @@ */ #include - -#include "PlaYUVerSubWindowHandle.h" #include "ModulesHandle.h" +#include "PlaYUVerSubWindowHandle.h" +#include "VideoHandle.h" #include "PlaYUVerModuleFactory.h" #include "DialogSubWindowSelector.h" -#include "SubWindowHandle.h" -#include "VideoSubWindow.h" + namespace plaYUVer { -ModulesHandle::ModulesHandle( QWidget* parent, PlaYUVerSubWindowHandle *windowManager ) : +ModulesHandle::ModulesHandle( QWidget* parent, PlaYUVerSubWindowHandle *windowManager, VideoHandle *moduleVideo ) : QWidget( parent ), m_pcParent( parent ), - m_pcMainWindowManager( windowManager ) + m_pcMainWindowManager( windowManager ), + m_appModuleVideo( moduleVideo ) { setParent( m_pcParent ); } @@ -304,12 +304,16 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf ) { if( ( pcCurrModuleIf->m_pcModule->m_uiModuleRequirements & MODULE_REQUIRES_NEW_WINDOW ) || bShowModulesNewWindow ) { - pcModuleSubWindow = new VideoSubWindow( this, true ); + pcModuleSubWindow = new VideoSubWindow( VideoSubWindow::MODULE_SUBWINDOW, this ); pcModuleSubWindow->setWindowShortName( windowName ); pcModuleSubWindow->setWindowName( windowName ); - connect( pcModuleSubWindow, SIGNAL( updateStatusBar( const QString& ) ), m_pcParent, SLOT( updateStatusBar( const QString& ) ) ); - connect( pcModuleSubWindow, SIGNAL( zoomChanged() ), m_pcParent, SLOT( updateZoomFactorSBox() ) ); + connect( pcModuleSubWindow->getViewArea(), SIGNAL( selectionChanged( QRect ) ), m_appModuleVideo, SLOT( updateSelectionArea( QRect ) ) ); + connect( pcModuleSubWindow, SIGNAL( zoomFactorChanged_SWindow( const double, const QPoint ) ), m_appModuleVideo, 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() ) ); pcCurrModuleIf->m_pcDisplaySubWindow = pcModuleSubWindow; pcCurrModuleIf->m_pcDisplaySubWindow->enableModule( pcCurrModuleIf, true ); diff --git a/app/ModulesHandle.h b/app/ModulesHandle.h index d131d58..1928013 100644 --- a/app/ModulesHandle.h +++ b/app/ModulesHandle.h @@ -42,6 +42,7 @@ namespace plaYUVer { +class VideoHandle; class PlaYUVerSubWindowHandle; class PlaYUVerAppModuleIf; class SubWindowHandle; @@ -50,7 +51,7 @@ class ModulesHandle: public QWidget { Q_OBJECT public: - ModulesHandle( QWidget*, PlaYUVerSubWindowHandle* ); + ModulesHandle( QWidget*, PlaYUVerSubWindowHandle*, VideoHandle* ); ~ModulesHandle(); Void createActions(); @@ -70,6 +71,7 @@ public: private: QWidget* m_pcParent; PlaYUVerSubWindowHandle* m_pcMainWindowManager; + VideoHandle* m_appModuleVideo; enum { diff --git a/app/PlaYUVerSubWindowHandle.cpp b/app/PlaYUVerSubWindowHandle.cpp index f3421e4..e331374 100644 --- a/app/PlaYUVerSubWindowHandle.cpp +++ b/app/PlaYUVerSubWindowHandle.cpp @@ -223,7 +223,7 @@ QList PlaYUVerSubWindowHandle::findSubWindow( const UInt uiCat QList subWindowList = findSubWindow(); for( Int i = 0; i < subWindowList.size(); i++ ) { - if( subWindowList.at( i )->getCategory() == uiCategory ) + if( subWindowList.at( i )->getCategory() & uiCategory ) apcSubWindowList.append( subWindowList.at( i ) ); } return apcSubWindowList; diff --git a/app/VideoSubWindow.cpp b/app/VideoSubWindow.cpp index 168e458..162571e 100644 --- a/app/VideoSubWindow.cpp +++ b/app/VideoSubWindow.cpp @@ -71,13 +71,13 @@ Int findPlaYUVerStreamInfo( PlaYUVerStreamInfoVector array, QString filename ) return -1; } -VideoSubWindow::VideoSubWindow( QWidget * parent, Bool isModule ) : - SubWindowHandle( parent, SubWindowHandle::VIDEO_SUBWINDOW ), +VideoSubWindow::VideoSubWindow( enum VideoSubWindowCategories category, QWidget * parent ) : + SubWindowHandle( parent, SubWindowHandle::VIDEO_SUBWINDOW | category ), m_pCurrStream( NULL ), m_pcCurrFrame( NULL ), m_pcReferenceSubWindow( NULL ), m_bIsPlaying( false ), - m_bIsModule( isModule ) + m_bIsModule( category == MODULE_SUBWINDOW ) { setVisible( false ); diff --git a/app/VideoSubWindow.h b/app/VideoSubWindow.h index fa720e7..b7c5cd9 100644 --- a/app/VideoSubWindow.h +++ b/app/VideoSubWindow.h @@ -91,7 +91,12 @@ private: Void scaleView( const QSize & size , QPoint center = QPoint() ); public: - VideoSubWindow( QWidget * parent = 0, Bool isModule = false ); + enum VideoSubWindowCategories + { + VIDEO_STREAM_SUBWINDOW = 2, + MODULE_SUBWINDOW = 4, + }; + VideoSubWindow( enum VideoSubWindowCategories category, QWidget * parent = 0 ); ~VideoSubWindow(); Bool loadFile( QString cFilename, Bool bForceDialog = false ); diff --git a/app/plaYUVerApp.cpp b/app/plaYUVerApp.cpp index 4cc758b..b2061b1 100644 --- a/app/plaYUVerApp.cpp +++ b/app/plaYUVerApp.cpp @@ -50,7 +50,7 @@ plaYUVerApp::plaYUVerApp() m_appModuleVideo = new VideoHandle( this, m_pcWindowHandle ); m_appModuleQuality = new QualityHandle( this, m_pcWindowHandle ); - m_appModuleExtensions = new ModulesHandle( this, m_pcWindowHandle ); + m_appModuleExtensions = new ModulesHandle( this, m_pcWindowHandle, m_appModuleVideo ); createActions(); createToolBars(); @@ -155,7 +155,7 @@ Void plaYUVerApp::loadFile( QString fileName, PlaYUVerStreamInfo* pStreamInfo ) m_pcWindowHandle->setActiveSubWindow( videoSubWindow ); return; } - videoSubWindow = new VideoSubWindow; //createSubWindow(); + videoSubWindow = new VideoSubWindow( VideoSubWindow::VIDEO_STREAM_SUBWINDOW ); //createSubWindow(); SubWindowHandle *subWindow = videoSubWindow; if( !pStreamInfo ) {