From 6fc7001fa355b5f5c2aa97a25b51f7a111b65ce5 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Fri, 9 May 2014 05:14:13 +0100 Subject: [PATCH] Incorporate the DialogSubWindowSelector into the main app --- source/app/DialogSubWindowSelector.h | 7 +++- source/app/plaYUVerApp.cpp | 50 ++++++++++++++++++++-------- source/app/plaYUVerApp.h | 1 + 3 files changed, 44 insertions(+), 14 deletions(-) diff --git a/source/app/DialogSubWindowSelector.h b/source/app/DialogSubWindowSelector.h index 6326bd1..efacf4c 100755 --- a/source/app/DialogSubWindowSelector.h +++ b/source/app/DialogSubWindowSelector.h @@ -52,7 +52,10 @@ Q_OBJECT public: DialogSubWindowSelector( QWidget *parent = 0, QMdiArea *mdiArea = 0 ); - + QStringList getSelectedWindows() + { + return m_pcSelectedWindowListNames; + } private: QMdiArea* m_pcMainWindowMdiArea; QStringList m_pcWindowListNames; @@ -65,6 +68,8 @@ private: Void updateSubWindowList(); + + private Q_SLOTS: void addSubWindow(); void removeSubWindow(); diff --git a/source/app/plaYUVerApp.cpp b/source/app/plaYUVerApp.cpp index 920fe25..5cc3865 100644 --- a/source/app/plaYUVerApp.cpp +++ b/source/app/plaYUVerApp.cpp @@ -314,6 +314,20 @@ Void plaYUVerApp::setTimerStatus() } } +Void plaYUVerApp::startPlay() +{ + if( !m_bIsPlaying ) + { + UInt frameRate = m_acPlayingSubWindows.at( 0 )->getInputStream()->getFrameRate(); + UInt timeInterval = ( UInt )( 1000.0 / frameRate + 0.5 ); + qDebug( ) << "Desired frame rate: " + << QString::number( 1000 / timeInterval ) + << " fps"; + playingTimer->start( timeInterval ); + m_cTimer.start(); + } +} + void plaYUVerApp::play() { if( !m_pcCurrentSubWindow ) @@ -350,17 +364,7 @@ void plaYUVerApp::play() m_uiAveragePlayInterval = 0; m_bIsPlaying = false; } - if( !m_bIsPlaying ) - { - UInt frameRate = m_acPlayingSubWindows.at( 0 )->getInputStream()->getFrameRate(); - UInt timeInterval = ( UInt )( 1000.0 / frameRate + 0.5 ); - qDebug( ) << "Desired frame rate: " - << QString::number( 1000 / timeInterval ) - << " fps"; - playingTimer->start( timeInterval ); - m_cTimer.start(); - } - + startPlay(); } void plaYUVerApp::pause() @@ -523,8 +527,28 @@ void plaYUVerApp::lockButtonEvent() void plaYUVerApp::videoSelectionButtonEvent() { DialogSubWindowSelector dialogWindowsSelection( this, mdiArea ); - dialogWindowsSelection.exec(); - + if( dialogWindowsSelection.exec() == QDialog::Accepted ) + { + QStringList selectedWindows = dialogWindowsSelection.getSelectedWindows(); + m_acPlayingSubWindows.clear(); + SubWindowHandle *subWindow; + QString windowName; + for( Int i = 0; i < mdiArea->subWindowList().size(); i++ ) + { + subWindow = qobject_cast( mdiArea->subWindowList().at( i ) ); + windowName = subWindow->getWindowName(); + if( selectedWindows.contains( windowName ) ) + { + m_acPlayingSubWindows.append( subWindow ); + subWindow->seekAbsoluteEvent( m_acPlayingSubWindows.at( 0 )->getInputStream()->getCurrFrameNum() ); + subWindow->play(); + m_pcFrameSlider->setMaximum( qMin( m_pcFrameSlider->maximum(), ( Int )subWindow->getInputStream()->getFrameNum() - 1 ) ); + } + } + m_arrayActions[VIDEO_LOCK_ACT]->setChecked( true ); + startPlay(); + return; + } } // ----------------------- Zoom Functions ----------------------- diff --git a/source/app/plaYUVerApp.h b/source/app/plaYUVerApp.h index b618d5d..69411a0 100644 --- a/source/app/plaYUVerApp.h +++ b/source/app/plaYUVerApp.h @@ -122,6 +122,7 @@ private: Void zoomToFitAll(); //! Playing functions + Void startPlay(); Void setTimerStatus(); Void updateCurrFrameNum(); Void updateTotalFrameNum( UInt total_frame_num = 0 );