xml validation, removed redundant boxing, unknown files fail validation, caught a inverse logic error

This commit is contained in:
Dave French
2015-02-26 20:45:34 +00:00
parent 318260a7e2
commit 335711aac7
4 changed files with 6 additions and 7 deletions

View File

@@ -202,7 +202,7 @@ bool DataFile::validate( QString extension )
}
break;
default:
return true;
return false;
}
return false;
}

View File

@@ -151,15 +151,13 @@ PresetPreviewPlayHandle::PresetPreviewPlayHandle( const QString & _preset_file,
dataFileCreated = true;
}
DataFile data(*dataFile);
// vestige previews are bug prone; fallback on 3xosc with volume of 0
// without an instrument in preview track, it will segfault
if(data.content().elementsByTagName( "vestige" ).length() == 0 )
if(dataFile->content().elementsByTagName( "vestige" ).length() == 0 )
{
s_previewTC->previewInstrumentTrack()->
loadTrackSpecificSettings(
data.content().firstChild().toElement() );
dataFile->content().firstChild().toElement() );
}
else
{

View File

@@ -942,7 +942,7 @@ void Song::loadProject( const QString & fileName )
DataFile dataFile( m_fileName );
// if file could not be opened, head-node is null and we create
// new project
if( !dataFile.validate( _file_name.right(_file_name.lastIndexOf(".") ) ) )
if( dataFile.validate( _file_name.right(_file_name.lastIndexOf(".") ) ) )
{
return;
}

View File

@@ -466,7 +466,8 @@ void FileBrowserTreeWidget::mousePressEvent(QMouseEvent * me )
if( !dataFile.validate( f->extension() ) )
{
QMessageBox::warning( 0, tr ( "Error" ),
f->fullName() + " " + tr( "does not appear to be a valid") + " " + f->extension(),
f->fullName() + " " + tr( "does not appear to be a valid" ) + " " + f->extension() +
" " + tr( "file" ),
QMessageBox::Ok, QMessageBox::NoButton );
m_pphMutex.unlock();
return;