Use previous saved stream open to open recent files

This commit is contained in:
jfmcarreira committed 2014-10-04 15:12:58 +01:00
1 parent 784e009c87
commit fda381131c
4 files changed
+44 -13

No files matched your search

+32 -7
View File
@@ -36,8 +36,8 @@ QDataStream& operator<<( QDataStream& out, const PlaYUVerStreamInfoVector& array
for( Int i = 0; i < array.size(); i++ )
{
d = array.at( i );
out << d.m_cFilename << d.m_cResolution.width()
<< d.m_cResolution.height()
out << d.m_cFilename << d.m_uiWidth
<< d.m_uiHeight
<< d.m_iPelFormat
<< d.m_uiFrameRate;
@@ -53,12 +53,10 @@ QDataStream& operator>>( QDataStream& in, PlaYUVerStreamInfoVector& array )
for( Int i = 0; i < array_size; i++ )
{
in >> d.m_cFilename;
Int x, y;
in >> x;
in >> y;
in >> d.m_uiWidth;
in >> d.m_uiHeight;
in >> d.m_iPelFormat;
in >> d.m_uiFrameRate;
d.m_cResolution = QSize( x, y );
array.append( d );
}
return in;
@@ -148,7 +146,8 @@ Bool SubWindowHandle::loadFile( QString cFilename, Bool bForceDialog )
refreshFrame();
m_sStreamInfo.m_cFilename = cFilename;
m_sStreamInfo.m_cResolution = QSize( Width, Height );
m_sStreamInfo.m_uiWidth = Width;
m_sStreamInfo.m_uiHeight = Height;
m_sStreamInfo.m_iPelFormat = InputFormat;
m_sStreamInfo.m_uiFrameRate = FrameRate;
@@ -158,6 +157,32 @@ Bool SubWindowHandle::loadFile( QString cFilename, Bool bForceDialog )
return true;
}
Bool SubWindowHandle::loadFile( PlaYUVerStreamInfo* streamInfo )
{
if( !m_pCurrStream )
{
m_pCurrStream = new PlaYUVerStream;
}
m_sStreamInfo = *streamInfo;
if( !m_pCurrStream->open( m_sStreamInfo.m_cFilename, m_sStreamInfo.m_uiWidth, m_sStreamInfo.m_uiHeight, m_sStreamInfo.m_iPelFormat,
m_sStreamInfo.m_uiFrameRate ) )
{
return false;
}
m_cViewArea->setInputStream( m_pCurrStream );
QApplication::restoreOverrideCursor();
refreshFrame();
m_cWindowName = m_pCurrStream->getStreamInformationString();
m_cWindowShortName = QFileInfo( m_sStreamInfo.m_cFilename ).fileName();
setWindowTitle( m_cWindowName );
return true;
}
/**
* Functions to enable a module in the
* current SubWindow
+3 -1
View File
@@ -44,7 +44,8 @@ class SubWindowHandle;
typedef struct
{
QString m_cFilename;
QSize m_cResolution;
UInt m_uiWidth;
UInt m_uiHeight;
Int m_iPelFormat;
UInt m_uiFrameRate;
}PlaYUVerStreamInfo;
@@ -88,6 +89,7 @@ public:
Bool mayClose();
Bool loadFile( QString cFilename, Bool bForceDialog = false );
Bool loadFile( PlaYUVerStreamInfo* streamInfo );
Void reloadFile();
Bool save( QString filename );
+8 -4
View File
@@ -156,7 +156,7 @@ Void plaYUVerApp::closeEvent( QCloseEvent *event )
}
}
Void plaYUVerApp::loadFile( QString fileName )
Void plaYUVerApp::loadFile( QString fileName, PlaYUVerStreamInfo* streamInfo )
{
SubWindowHandle *interfaceChild = plaYUVerApp::findSubWindow( mdiArea, fileName );
if( interfaceChild )
@@ -164,9 +164,13 @@ Void plaYUVerApp::loadFile( QString fileName )
mdiArea->setActiveSubWindow( interfaceChild );
return;
}
interfaceChild = new SubWindowHandle( this ); //createSubWindow();
if( interfaceChild->loadFile( fileName ) )
Bool retChild = false;
if( !streamInfo )
retChild = interfaceChild->loadFile( fileName );
else
retChild = interfaceChild->loadFile( streamInfo );
if(retChild )
{
statusBar()->showMessage( tr( "Loading file..." ) );
mdiArea->addSubWindow( interfaceChild );
@@ -237,7 +241,7 @@ Void plaYUVerApp::openRecent()
QAction *action = qobject_cast<QAction *>( sender() );
PlaYUVerStreamInfo recentFile = action->data().value<PlaYUVerStreamInfo>();
if( action )
loadFile( recentFile.m_cFilename );
loadFile( recentFile.m_cFilename, &recentFile );
}
Void plaYUVerApp::save()
+1 -1
View File
@@ -153,7 +153,7 @@ private:
QTime m_cTimer;
UInt m_uiAveragePlayInterval;
Void loadFile( QString fileName );
Void loadFile( QString fileName, PlaYUVerStreamInfo* streamInfo = NULL );
Void readRecentFileList();
Void writeRecentFileList();