Add error messages in PlaYUVerStream in open operations
This commit is contained in:
1 parent
6b4771bf83
commit
b20bc6dc4e
6 files changed
+40
-63
No files matched your search
+6
-16
@@ -60,6 +60,8 @@ SubWindowHandle::SubWindowHandle( QWidget * parent, Bool isModule ) :
|
||||
m_cScrollArea->setWidget( m_cViewArea );
|
||||
m_cScrollArea->setWidgetResizable( true );
|
||||
|
||||
m_pCurrStream = new PlaYUVerStream;
|
||||
|
||||
m_cWindowName = QString( " " );
|
||||
m_cLastScroll = QPoint();
|
||||
}
|
||||
@@ -69,8 +71,7 @@ SubWindowHandle::~SubWindowHandle()
|
||||
disableModule();
|
||||
delete m_cViewArea;
|
||||
delete m_cScrollArea;
|
||||
if( m_pCurrStream )
|
||||
delete m_pCurrStream;
|
||||
delete m_pCurrStream;
|
||||
}
|
||||
|
||||
Void SubWindowHandle::reloadFile()
|
||||
@@ -85,11 +86,6 @@ Bool SubWindowHandle::loadFile( QString cFilename, Bool bForceDialog )
|
||||
UInt Width = 0, Height = 0, FrameRate = 30;
|
||||
Int InputFormat = -1;
|
||||
|
||||
if( !m_pCurrStream )
|
||||
{
|
||||
m_pCurrStream = new PlaYUVerStream;
|
||||
}
|
||||
|
||||
m_pCurrStream->getFormat( Width, Height, InputFormat, FrameRate );
|
||||
|
||||
if( m_pCurrStream->guessFormat( cFilename, Width, Height, InputFormat, FrameRate ) || bForceDialog )
|
||||
@@ -102,10 +98,8 @@ Bool SubWindowHandle::loadFile( QString cFilename, Bool bForceDialog )
|
||||
}
|
||||
QApplication::setOverrideCursor( Qt::WaitCursor );
|
||||
QApplication::restoreOverrideCursor();
|
||||
if( !m_pCurrStream->open( cFilename, Width, Height, InputFormat, FrameRate ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_pCurrStream->open( cFilename, Width, Height, InputFormat, FrameRate );
|
||||
|
||||
m_cViewArea->setInputStream( m_pCurrStream );
|
||||
|
||||
@@ -117,16 +111,12 @@ Bool SubWindowHandle::loadFile( QString cFilename, Bool bForceDialog )
|
||||
m_cWindowName = m_pCurrStream->getStreamInformationString();
|
||||
m_cWindowShortName = QFileInfo( cFilename ).fileName();
|
||||
setWindowTitle( m_cWindowName );
|
||||
qDebug() << "File " << m_cWindowName << "was successfully opened";
|
||||
return true;
|
||||
}
|
||||
|
||||
Bool SubWindowHandle::loadFile( PlaYUVerStreamInfo* streamInfo )
|
||||
{
|
||||
if( !m_pCurrStream )
|
||||
{
|
||||
m_pCurrStream = new PlaYUVerStream;
|
||||
}
|
||||
|
||||
if( !m_pCurrStream->open( streamInfo->m_cFilename, streamInfo->m_uiWidth, streamInfo->m_uiHeight, streamInfo->m_iPelFormat,
|
||||
streamInfo->m_uiFrameRate ) )
|
||||
{
|
||||
|
||||
+23
-12
@@ -167,19 +167,19 @@ Void plaYUVerApp::loadFile( QString fileName, PlaYUVerStreamInfo* streamInfo )
|
||||
return;
|
||||
}
|
||||
interfaceChild = new SubWindowHandle( this ); //createSubWindow();
|
||||
Bool retChild = false;
|
||||
if( !streamInfo )
|
||||
{
|
||||
Int idx = findPlaYUVerStreamInfo( m_aRecentFileStreamInfo, fileName );
|
||||
streamInfo = ( PlaYUVerStreamInfo* )( idx >= 0 ? &m_aRecentFileStreamInfo.at( idx ) : NULL );
|
||||
}
|
||||
|
||||
if( !streamInfo )
|
||||
retChild = interfaceChild->loadFile( fileName );
|
||||
else
|
||||
retChild = interfaceChild->loadFile( streamInfo );
|
||||
if( retChild )
|
||||
try
|
||||
{
|
||||
if( !streamInfo )
|
||||
interfaceChild->loadFile( fileName );
|
||||
else
|
||||
interfaceChild->loadFile( streamInfo );
|
||||
|
||||
statusBar()->showMessage( tr( "Loading file..." ) );
|
||||
mdiArea->addSubWindow( interfaceChild );
|
||||
interfaceChild->show();
|
||||
@@ -197,18 +197,18 @@ Void plaYUVerApp::loadFile( QString fileName, PlaYUVerStreamInfo* streamInfo )
|
||||
m_aRecentFileStreamInfo.remove( idx );
|
||||
m_aRecentFileStreamInfo.prepend( interfaceChild->getStreamInfo() );
|
||||
while( m_aRecentFileStreamInfo.size() > MAX_RECENT_FILES )
|
||||
//#if( QT_VERSION_PLAYUVER == 5)
|
||||
// m_aRecentFileStreamInfo.removeLast();
|
||||
//#else
|
||||
m_aRecentFileStreamInfo.remove( m_aRecentFileStreamInfo.size() - 1 );
|
||||
//#endif
|
||||
updateRecentFileActions();
|
||||
|
||||
statusBar()->showMessage( tr( "File loaded" ), 2000 );
|
||||
}
|
||||
else
|
||||
catch( const char *msg )
|
||||
{
|
||||
interfaceChild->close();
|
||||
QString warningMsg = "Cannot open file " + QFileInfo( fileName ).fileName() + " with the following error: \n" + msg;
|
||||
QMessageBox::warning( this, QApplication::applicationName(), warningMsg );
|
||||
statusBar()->showMessage( warningMsg, 2000 );
|
||||
qDebug() << warningMsg;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,7 +306,18 @@ Void plaYUVerApp::format()
|
||||
{
|
||||
if( m_pcCurrentSubWindow )
|
||||
{
|
||||
m_pcCurrentSubWindow->loadFile( m_pcCurrentSubWindow->getCurrentFileName(), true );
|
||||
try
|
||||
{
|
||||
m_pcCurrentSubWindow->loadFile( m_pcCurrentSubWindow->getCurrentFileName(), true );
|
||||
}
|
||||
catch( const char *msg )
|
||||
{
|
||||
QString warningMsg = "Cannot change format of " + QFileInfo( m_pcCurrentSubWindow->getCurrentFileName() ).fileName() + " with the following error: \n" + msg;
|
||||
QMessageBox::warning( this, QApplication::applicationName(), warningMsg );
|
||||
statusBar()->showMessage( warningMsg, 2000 );
|
||||
qDebug() << warningMsg;
|
||||
m_pcCurrentSubWindow->close();
|
||||
}
|
||||
m_pcCurrentSubWindow = NULL;
|
||||
chageSubWindowSelection();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user