From 14959b8a2fe5fe011396a8e889ab7e42096a2ac1 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Sat, 18 Apr 2015 04:49:23 +0100 Subject: [PATCH 1/2] Fix bug in syncronized zoom - Window may not exist --- app/VideoHandle.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/VideoHandle.cpp b/app/VideoHandle.cpp index 8fc0233..b620472 100644 --- a/app/VideoHandle.cpp +++ b/app/VideoHandle.cpp @@ -93,11 +93,11 @@ Void VideoHandle::createActions() m_arrayActions[VIDEO_LOOP_ACT]->setCheckable( true ); m_arrayActions[VIDEO_LOOP_ACT]->setChecked( false ); - m_arrayActions[VIDEO_ZOOM_LOCK_ACT] = new QAction( "Video Zoom Lock", this ); + m_arrayActions[VIDEO_ZOOM_LOCK_ACT] = new QAction( "Zoom Lock", this ); m_arrayActions[VIDEO_ZOOM_LOCK_ACT]->setCheckable( true ); m_arrayActions[VIDEO_ZOOM_LOCK_ACT]->setChecked( false ); - m_arrayActions[VIDEO_LOCK_SELECTION_ACT] = new QAction( "Video Lock Window Selection", this ); + m_arrayActions[VIDEO_LOCK_SELECTION_ACT] = new QAction( "Playing Lock", this ); connect( m_arrayActions[VIDEO_LOCK_SELECTION_ACT], SIGNAL( triggered() ), this, SLOT( videoSelectionButtonEvent() ) ); m_pcFrameSlider = new QSlider; @@ -330,7 +330,7 @@ Void VideoHandle::zoomToFactorAll( const Double scale, const QPoint center ) Void VideoHandle::moveAllScrollBars( const QPoint offset ) { QPoint newOffset = offset; - if( m_arrayActions[VIDEO_ZOOM_LOCK_ACT]->isChecked() ) + if( m_arrayActions[VIDEO_ZOOM_LOCK_ACT]->isChecked() && m_pcCurrentVideoSubWindow ) { SubWindowAbstract *subWindow; QList subWindowList = m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW ); From 0bc716c0a52f3d766d067ae0b8ed357eafe75cfc Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Thu, 23 Apr 2015 22:09:26 +0100 Subject: [PATCH 2/2] Change the behaviour of open stream: use two tries, and show configuration dialog in the second one --- app/VideoSubWindow.cpp | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/app/VideoSubWindow.cpp b/app/VideoSubWindow.cpp index fea5e35..2eacb09 100644 --- a/app/VideoSubWindow.cpp +++ b/app/VideoSubWindow.cpp @@ -146,21 +146,13 @@ Void VideoSubWindow::refreshSubWindow() Bool VideoSubWindow::loadFile( QString cFilename, Bool bForceDialog ) { + ConfigureFormatDialog formatDialog( this ); UInt Width = 0, Height = 0, BitsPel = 8, FrameRate = 30; Int InputFormat = PlaYUVerFrame::YUV420p; if( m_pCurrStream ) m_pCurrStream->getFormat( Width, Height, InputFormat, BitsPel, FrameRate ); - if( guessFormat( cFilename, Width, Height, InputFormat, FrameRate ) || bForceDialog ) - { - ConfigureFormatDialog formatDialog( this ); - if( formatDialog.runConfigureFormatDialog( QFileInfo( cFilename ).fileName(), Width, Height, InputFormat, BitsPel, FrameRate ) == QDialog::Rejected ) - { - return false; - } - } - if( !m_pCurrStream ) { m_pCurrStream = new PlaYUVerStream; @@ -171,7 +163,26 @@ Bool VideoSubWindow::loadFile( QString cFilename, Bool bForceDialog ) m_pCurrStream = new PlaYUVerStream; } - m_pCurrStream->open( cFilename.toStdString(), Width, Height, InputFormat, BitsPel, FrameRate ); + if( guessFormat( cFilename, Width, Height, InputFormat, FrameRate ) || bForceDialog ) + { + if( formatDialog.runConfigureFormatDialog( QFileInfo( cFilename ).fileName(), Width, Height, InputFormat, BitsPel, FrameRate ) == QDialog::Rejected ) + { + return false; + } + } + + try + { + m_pCurrStream->open( cFilename.toStdString(), Width, Height, InputFormat, BitsPel, FrameRate ); + } + catch( const char *msg ) + { + if( formatDialog.runConfigureFormatDialog( QFileInfo( cFilename ).fileName(), Width, Height, InputFormat, BitsPel, FrameRate ) == QDialog::Rejected ) + { + return false; + } + m_pCurrStream->open( cFilename.toStdString(), Width, Height, InputFormat, BitsPel, FrameRate ); + } m_sStreamInfo.m_cFilename = cFilename; m_sStreamInfo.m_uiWidth = Width; @@ -711,4 +722,4 @@ QSize VideoSubWindow::sizeHint( const QSize & maxSize ) const // } //} -} // NAMESPACE +}// NAMESPACE