SampleBuffer: do not show messagebox if there's no GUI

Showing a messagebox if LMMS is running in console-mode only is bad and
makes it crash. Therefore check for engine::hasGUI() first.
This commit is contained in:
Tobias Doerffel
2009-08-04 12:11:30 +02:00
parent bf8f823751
commit afbaabed02

View File

@@ -277,14 +277,17 @@ void sampleBuffer::update( bool _keep_settings )
// TODO: this list probably shouldn't be hardcoded
QString decoders = niceListOfExts();
QMessageBox::information( NULL,
QObject::tr( "Unrecognized audio format" ),
QObject::tr( "None of the available audio decoders "
"recognized the format you are trying to load. Try "
"converting the file to a format LMMS understands.\n\n"
"Your file: %1\n"
"Available decoders: %2\n").arg( file, decoders ),
QMessageBox::Ok | QMessageBox::Default );
if( engine::hasGUI() )
{
QMessageBox::information( NULL,
QObject::tr( "Unrecognized audio format" ),
QObject::tr( "None of the available audio decoders "
"recognized the format you are trying to load. Try "
"converting the file to a format LMMS understands.\n\n"
"Your file: %1\n"
"Available decoders: %2\n").arg( file, decoders ),
QMessageBox::Ok | QMessageBox::Default );
}
}
}