From 1f9affe4995b323514c4a251e7a9d449f84c4154 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Tue, 30 Dec 2014 05:11:02 +0000 Subject: [PATCH] Add a global update signal --- app/ModulesHandle.cpp | 1 + app/ModulesHandle.h | 3 +++ app/QualityHandle.h | 3 +++ app/VideoHandle.cpp | 15 ++++++++++----- app/VideoHandle.h | 3 +++ app/plaYUVerApp.cpp | 13 ++++++++----- app/plaYUVerApp.h | 8 +++----- 7 files changed, 31 insertions(+), 15 deletions(-) diff --git a/app/ModulesHandle.cpp b/app/ModulesHandle.cpp index 772a07f..488828d 100644 --- a/app/ModulesHandle.cpp +++ b/app/ModulesHandle.cpp @@ -223,6 +223,7 @@ Void ModulesHandle::activateModule() pcVideoSubWindow->disableModule(); } } + emit changed(); } Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf ) diff --git a/app/ModulesHandle.h b/app/ModulesHandle.h index 8f2814f..51ca47f 100644 --- a/app/ModulesHandle.h +++ b/app/ModulesHandle.h @@ -105,6 +105,9 @@ private: Void customEvent( QEvent *event ); +Q_SIGNALS: + void changed(); + private Q_SLOTS: void activateModule(); void processOpt( int index ); diff --git a/app/QualityHandle.h b/app/QualityHandle.h index d70fc4e..12bae92 100644 --- a/app/QualityHandle.h +++ b/app/QualityHandle.h @@ -74,6 +74,9 @@ private: QDockWidget* m_pcQualityHandleDock; QualityMeasurementSidebar* m_pcQualityHandleSideBar; +Q_SIGNALS: + void changed(); + private Q_SLOTS: void slotQualityMetricChanged( int ); void slotSelectReference(); diff --git a/app/VideoHandle.cpp b/app/VideoHandle.cpp index f6b9fba..4773db1 100644 --- a/app/VideoHandle.cpp +++ b/app/VideoHandle.cpp @@ -373,7 +373,8 @@ Void VideoHandle::play() } } setTimerStatus(); - update(); + emit changed(); + //update(); } Void VideoHandle::stop() @@ -394,7 +395,8 @@ Void VideoHandle::stop() m_pcCurrentVideoSubWindow->stop(); } } - update(); + emit changed(); + //update(); m_arrayActions[VIDEO_LOCK_ACT]->setVisible( false ); } @@ -422,7 +424,8 @@ Void VideoHandle::playEvent() stop(); m_pcCurrentVideoSubWindow->close(); } - update(); + emit changed(); + //update(); } Void VideoHandle::seekEvent( Int direction ) @@ -443,7 +446,8 @@ Void VideoHandle::seekEvent( Int direction ) { m_pcCurrentVideoSubWindow->seekRelativeEvent( direction > 0 ? true : false ); } - update(); + emit changed(); + //update(); } } @@ -462,7 +466,8 @@ Void VideoHandle::seekSliderEvent( Int new_frame_num ) { m_pcCurrentVideoSubWindow->seekAbsoluteEvent( ( UInt )new_frame_num ); } - update(); + emit changed(); + //update(); } } diff --git a/app/VideoHandle.h b/app/VideoHandle.h index 3c02e7b..ecba095 100644 --- a/app/VideoHandle.h +++ b/app/VideoHandle.h @@ -102,6 +102,9 @@ private: UInt64 getMaxFrameNumber(); Void setTimerStatus(); +Q_SIGNALS: + void changed(); + private Q_SLOTS: void update(); void play(); diff --git a/app/plaYUVerApp.cpp b/app/plaYUVerApp.cpp index 1809da1..2bd8154 100644 --- a/app/plaYUVerApp.cpp +++ b/app/plaYUVerApp.cpp @@ -50,8 +50,6 @@ plaYUVerApp::plaYUVerApp() setCentralWidget( mdiArea ); mdiArea->setActivationOrder( QMdiArea::ActivationHistoryOrder ); - connect( mdiArea, SIGNAL( subWindowActivated(QMdiSubWindow*) ), this, SLOT( chageSubWindowSelection() ) ); - mapperWindow = new QSignalMapper( this ); connect( mapperWindow, SIGNAL( mapped(QWidget*) ), this, SLOT( setActiveSubWindow(QWidget*) ) ); @@ -75,6 +73,11 @@ plaYUVerApp::plaYUVerApp() setAcceptDrops( true ); mdiArea->setAcceptDrops( true ); + connect( mdiArea, SIGNAL( subWindowActivated(QMdiSubWindow*) ), 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() ) ); + m_pcAboutDialog = NULL; m_pcCurrentSubWindow = NULL; m_pcCurrentVideoSubWindow = NULL; @@ -321,7 +324,7 @@ Void plaYUVerApp::format() m_pcCurrentSubWindow->close(); } m_pcCurrentSubWindow = NULL; - chageSubWindowSelection(); + update(); } } @@ -332,7 +335,7 @@ Void plaYUVerApp::reload() VideoSubWindow* pcVideoSubWindow = qobject_cast( m_pcCurrentVideoSubWindow ); pcVideoSubWindow->reloadFile(); m_pcCurrentSubWindow = NULL; - chageSubWindowSelection(); + update(); } } @@ -506,7 +509,7 @@ Void plaYUVerApp::updateZoomFactorSBox() } } -Void plaYUVerApp::chageSubWindowSelection() +Void plaYUVerApp::update() { SubWindowHandle *new_window = activeSubWindow(); if( activeSubWindow() != m_pcCurrentSubWindow ) diff --git a/app/plaYUVerApp.h b/app/plaYUVerApp.h index c12c2df..62adef0 100644 --- a/app/plaYUVerApp.h +++ b/app/plaYUVerApp.h @@ -88,9 +88,11 @@ private Q_SLOTS: void normalSize(); void zoomToFit(); - void chageSubWindowSelection(); + void update(); void updateWindowMenu(); void updateZoomFactorSBox(); + void updateStatusBar( const QString& ); + void updatePropertiesSelectedArea( QRect area ); void about(); @@ -99,10 +101,6 @@ private Q_SLOTS: void setActiveSubWindow( QWidget *window ); - void updateStatusBar( const QString& ); - - void updatePropertiesSelectedArea( QRect area ); - void setAllSubWindowTool(); void setTool( int idxTool );