diff --git a/src/core/DataFile.cpp b/src/core/DataFile.cpp index 85d7f0e35..06afd9bc3 100644 --- a/src/core/DataFile.cpp +++ b/src/core/DataFile.cpp @@ -165,25 +165,24 @@ DataFile::~DataFile() bool DataFile::validate( QString extension ) { - bool result = false; switch( m_type ) { case Type::SongProject: if( extension == "mmp" || extension == "mmpz" ) { - result = true; + return true; } break; case Type::SongProjectTemplate: if( extension == "mpt" ) { - result = true; + return true; } break; case Type::InstrumentTrackSettings: if ( extension == "xpf" || extension == "xml" ) { - result = true; + return true; } break; case Type::UnknownType: @@ -194,18 +193,18 @@ bool DataFile::validate( QString extension ) extension == "flp" || extension == "dll" ) ) { - result = true; + return true; } if( extension == "wav" || extension == "ogg" || extension == "ds" ) { - result = true; + return true; } break; default: return true; } - return result; + return false; } diff --git a/src/core/Song.cpp b/src/core/Song.cpp index 7942b6452..0f072076e 100644 --- a/src/core/Song.cpp +++ b/src/core/Song.cpp @@ -924,7 +924,7 @@ void Song::loadProject( const QString & _file_name ) DataFile dataFile( m_fileName ); // if file could not be opened, head-node is null and we create // new project - if( dataFile.head().isNull() ) + if( !dataFile.validate( _file_name.right(_file_name.lastIndexOf(".") ) ) ) { return; } diff --git a/src/gui/FileBrowser.cpp b/src/gui/FileBrowser.cpp index f865fab19..50059734c 100644 --- a/src/gui/FileBrowser.cpp +++ b/src/gui/FileBrowser.cpp @@ -465,8 +465,8 @@ void FileBrowserTreeWidget::mousePressEvent(QMouseEvent * me ) DataFile dataFile( f->fullName() ); if( !dataFile.validate( f->extension() ) ) { - QMessageBox::warning( 0, "Corrupt File", - "File : " + f->fullName() + " contains invalid data", + QMessageBox::warning( 0, tr ( "Error" ), + f->fullName() + " " + tr( "does not appear to be a valid") + " " + f->extension(), QMessageBox::Ok, QMessageBox::NoButton ); m_pphMutex.unlock(); return;