diff --git a/app/Settings.cpp b/app/Settings.cpp index f074854..cf8458f 100644 --- a/app/Settings.cpp +++ b/app/Settings.cpp @@ -93,14 +93,9 @@ Bool Settings::getRepeat() { return m_settings.value( "Playing/Repeat", false ).toBool(); } -Bool Settings::getVideoLock() -{ - return m_settings.value( "Playing/VideoLock", false ).toBool(); -} -Void Settings::setPlayingSettings( Bool repeat, Bool lock ) +Void Settings::setPlayingSettings( Bool repeat) { m_settings.setValue( "Playing/Repeat", repeat ); - m_settings.setValue( "Playing/VideoLock", lock ); } Void Settings::setRecentFileList( PlaYUVerStreamInfoVector recentFileList ) diff --git a/app/Settings.h b/app/Settings.h index 117f32c..d460022 100644 --- a/app/Settings.h +++ b/app/Settings.h @@ -54,8 +54,7 @@ public: Void setSelectedTool( Int); Bool getRepeat(); - Bool getVideoLock(); - Void setPlayingSettings( Bool repeat, Bool lock ); + Void setPlayingSettings( Bool repeat ); Void setDockVisibility( Bool statusStreamProperties, Bool statusFrameProperties, Bool statusQualityMeasurement ); Void getDockVisibility( Bool& statusStreamProperties, Bool& statusFrameProperties, Bool& statusQualityMeasurement ); diff --git a/app/plaYUVerApp.cpp b/app/plaYUVerApp.cpp index a651fc6..cccceeb 100644 --- a/app/plaYUVerApp.cpp +++ b/app/plaYUVerApp.cpp @@ -155,6 +155,10 @@ Void plaYUVerApp::closeEvent( QCloseEvent *event ) Void plaYUVerApp::loadFile( QString fileName, PlaYUVerStreamInfo* pStreamInfo ) { + if( !QFileInfo( fileName ).exists() ) + { + statusBar()->showMessage( "File do not exists!" ); + } VideoSubWindow *videoSubWindow = plaYUVerApp::findVideoSubWindow( mdiArea, fileName ); if( videoSubWindow ) { @@ -201,6 +205,7 @@ Void plaYUVerApp::loadFile( QString fileName, PlaYUVerStreamInfo* pStreamInfo ) updateRecentFileActions(); statusBar()->showMessage( tr( "File loaded" ), 2000 ); + m_cLastOpenPath = QFileInfo( fileName ).path(); } else { @@ -250,7 +255,6 @@ Void plaYUVerApp::open() { if( !fileNameList.at( i ).isEmpty() ) { - m_cLastOpenPath = QFileInfo( fileNameList.at( i ) ).path(); loadFile( fileNameList.at( i ) ); } } @@ -639,6 +643,7 @@ Void plaYUVerApp::stop() } } m_arrayActions[PLAY_ACT]->setIcon( style()->standardIcon( QStyle::SP_MediaPlay ) ); + m_arrayActions[VIDEO_LOCK_ACT]->setChecked( false ); updateTotalFrameNum(); } @@ -754,19 +759,26 @@ Void plaYUVerApp::seekSliderEvent( Int new_frame_num ) Void plaYUVerApp::lockButtonEvent() { - if( !m_arrayActions[VIDEO_LOCK_ACT]->isChecked() ) + if( m_arrayActions[VIDEO_LOCK_ACT]->isChecked() ) { - if( m_acPlayingSubWindows.contains( m_pcCurrentSubWindow ) ) - { + if( m_acPlayingSubWindows.size() > 1 ) m_acPlayingSubWindows.clear(); - m_acPlayingSubWindows.append( m_pcCurrentSubWindow ); - } - else + + SubWindowHandle *subWindow; + for( Int i = 0; i < mdiArea->subWindowList().size(); i++ ) { - if( m_acPlayingSubWindows.size() > 1 ) - m_acPlayingSubWindows.clear(); + subWindow = qobject_cast( mdiArea->subWindowList().at( i ) ); + if( !subWindow->getIsModule() ) + { + m_acPlayingSubWindows.append( subWindow ); + m_pcFrameSlider->setMaximum( qMin( m_pcFrameSlider->maximum(), ( Int )subWindow->getInputStream()->getFrameNum() - 1 ) ); + } } } + else + { + stop(); + } updateCurrFrameNum(); updateTotalFrameNum(); } @@ -1516,7 +1528,7 @@ Void plaYUVerApp::readSettings() //m_appTool = ( ViewArea::eTool )settings.getSelectedTool(); //setAllSubWindowTool(); m_arrayActions[VIDEO_LOOP_ACT]->setChecked( settings.getRepeat() ); - m_arrayActions[VIDEO_LOCK_ACT]->setChecked( settings.getVideoLock() ); + m_arrayActions[VIDEO_LOCK_ACT]->setChecked( false ); m_aRecentFileStreamInfo = settings.getRecentFileList(); updateRecentFileActions(); @@ -1541,7 +1553,7 @@ Void plaYUVerApp::writeSettings() settings.setSelectedTool( ( Int )m_appTool ); settings.setRecentFileList( m_aRecentFileStreamInfo ); settings.setDockVisibility( m_pcStreamProperties->isVisible(), m_pcFrameProperties->isVisible(), m_pcQualityMeasurement->isVisible() ); - settings.setPlayingSettings( m_arrayActions[VIDEO_LOOP_ACT]->isChecked(), m_arrayActions[VIDEO_LOCK_ACT]->isChecked() ); + settings.setPlayingSettings( m_arrayActions[VIDEO_LOOP_ACT]->isChecked() ); } } // NAMESPACE diff --git a/lib/PlaYUVerStream.cpp b/lib/PlaYUVerStream.cpp index 33605be..dd815bc 100644 --- a/lib/PlaYUVerStream.cpp +++ b/lib/PlaYUVerStream.cpp @@ -362,17 +362,16 @@ Bool PlaYUVerStream::guessFormat( QString filename, UInt& rWidth, UInt& rHeight, // Guess resolution by file size if( rWidth == 0 && rHeight == 0 ) { - Char *filename_char = new char[filename.length() + 1]; memcpy( filename_char, filename.toUtf8().constData(), filename.length() + 1 * sizeof(char) ); FILE* pF = fopen( filename_char, "rb" ); - fseek( pF, 0, SEEK_END ); - UInt64 uiFileSize = ftell( pF ); - fclose( pF ); - delete[] filename_char; - - if( pF != NULL ) + if( pF ) { + fseek( pF, 0, SEEK_END ); + UInt64 uiFileSize = ftell( pF ); + fclose( pF ); + delete[] filename_char; + Int count = 0, module, frame_bytes, match; QVector sizeResolution = standardResolutionSizes().sizeResolution; for( Int i = 0; i < sizeResolution.size(); i++ ) @@ -391,7 +390,6 @@ Bool PlaYUVerStream::guessFormat( QString filename, UInt& rWidth, UInt& rHeight, rHeight = sizeResolution.at( match ).height(); } } - } if( rWidth > 0 && rHeight > 0 && rInputFormat >= 0 )