diff --git a/source/app/plaYUVerApp.cpp b/source/app/plaYUVerApp.cpp index 914c37d..06fb739 100644 --- a/source/app/plaYUVerApp.cpp +++ b/source/app/plaYUVerApp.cpp @@ -184,6 +184,9 @@ Void plaYUVerApp::loadFile( QString fileName, PlaYUVerStreamInfo* streamInfo ) interfaceChild->getViewArea()->setTool( m_appTool ); updateZoomFactorSBox(); + Int idx = findPlaYUVerStreamInfo( m_aRecentFileStreamInfo, fileName ); + if( idx >= 0 ) + m_aRecentFileStreamInfo.remove( idx ); m_aRecentFileStreamInfo.prepend( interfaceChild->getStreamInfo() ); while ( m_aRecentFileStreamInfo.size() > MAX_RECENT_FILES ) m_aRecentFileStreamInfo.removeLast(); @@ -231,7 +234,11 @@ Void plaYUVerApp::open() if( !fileNameList.at( i ).isEmpty() ) { m_cLastOpenPath = QFileInfo( fileNameList.at( i ) ).path(); - loadFile( fileNameList.at( i ) ); + Int idx = findPlaYUVerStreamInfo( m_aRecentFileStreamInfo, fileNameList.at( i ) ); + if( idx >= 0 ) + loadFile( fileNameList.at( i ), (PlaYUVerStreamInfo*) &m_aRecentFileStreamInfo.at( idx ) ); + else + loadFile( fileNameList.at( i ) ); } } } @@ -985,6 +992,9 @@ Void plaYUVerApp::setActiveSubWindow( QWidget *window ) Void plaYUVerApp::updateMenus() { Bool hasSubWindow = ( activeSubWindow() != 0 ); + + m_arrayMenu[RECENT_MENU]->setEnabled( m_aRecentFileStreamInfo.size() > 0 ? true : false ); + m_arrayActions[SAVE_ACT]->setEnabled( hasSubWindow ); m_arrayActions[FORMAT_ACT]->setEnabled( hasSubWindow ); m_arrayActions[CLOSE_ACT]->setEnabled( hasSubWindow ); @@ -1091,6 +1101,7 @@ Void plaYUVerApp::updateRecentFileActions() m_arrayRecentFilesActions.at( actionIdx )->setVisible( false ); actionIdx++; } + m_arrayMenu[RECENT_MENU]->setEnabled( m_aRecentFileStreamInfo.size() > 0 ? true : false ); } Void plaYUVerApp::createActions() diff --git a/source/app/plaYUVerApp.h b/source/app/plaYUVerApp.h index 3f7c284..ec0d29d 100644 --- a/source/app/plaYUVerApp.h +++ b/source/app/plaYUVerApp.h @@ -291,7 +291,7 @@ private: }; QVector m_arrayActions; -#define MAX_RECENT_FILES 5 +#define MAX_RECENT_FILES 10 QVector m_arrayRecentFilesActions; //QAction *actionPopupMenu; diff --git a/source/lib/PlaYUVerStream.cpp b/source/lib/PlaYUVerStream.cpp index 62e6387..9b57107 100644 --- a/source/lib/PlaYUVerStream.cpp +++ b/source/lib/PlaYUVerStream.cpp @@ -67,6 +67,16 @@ QDataStream& operator>>( QDataStream& in, PlaYUVerStreamInfoVector& array ) return in; } +Int findPlaYUVerStreamInfo( PlaYUVerStreamInfoVector array, QString filename ) +{ + for( Int i = 0; i < array.size(); i++ ) + if( array.at( i ).m_cFilename == filename) + return i; + return -1; +} + + + PlaYUVerStream::PlaYUVerStream() { @@ -246,6 +256,12 @@ Bool PlaYUVerStream::open( QString filename, UInt width, UInt height, Int input_ m_cStreamInformationString.append( "] " ); m_cStreamInformationString.append( QFileInfo( m_cFilename ).fileName() ); + m_sStreamInfo.m_cFilename = m_cFilename; + m_sStreamInfo.m_uiWidth = m_uiWidth; + m_sStreamInfo.m_uiHeight = m_uiHeight; + m_sStreamInfo.m_iPelFormat = m_iPixelFormat; + m_sStreamInfo.m_uiFrameRate = m_uiFrameRate; + m_iCurrFrameNum = -1; m_bInit = true; diff --git a/source/lib/PlaYUVerStream.h b/source/lib/PlaYUVerStream.h index d7c559e..072da79 100644 --- a/source/lib/PlaYUVerStream.h +++ b/source/lib/PlaYUVerStream.h @@ -48,7 +48,7 @@ typedef QVector PlaYUVerStreamInfoVector; QDataStream& operator<<(QDataStream& out, const PlaYUVerStreamInfoVector& d); QDataStream& operator>>(QDataStream& in, PlaYUVerStreamInfoVector& d); - +Int findPlaYUVerStreamInfo( PlaYUVerStreamInfoVector array, QString filename ); class PlaYUVerStream {