From 38e64dd329c9f913f7669a65dc0b764b0b9548a6 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Mon, 28 Jul 2008 21:36:39 +0000 Subject: [PATCH] * don't show messagebox if no GUI is running * if plugin failed to load also tell about the reason git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1405 0778d3d1-df1d-0410-868b-ea421aaaa00d --- src/core/plugin.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/core/plugin.cpp b/src/core/plugin.cpp index cfee1134f..0282c80c0 100644 --- a/src/core/plugin.cpp +++ b/src/core/plugin.cpp @@ -28,11 +28,11 @@ #include #include #include -#include #include "plugin.h" #include "embed.h" +#include "engine.h" #include "mixer.h" #include "config_mgr.h" #include "dummy_plugin.h" @@ -98,24 +98,32 @@ plugin * plugin::instantiate( const QString & _plugin_name, model * _parent, _plugin_name ); if( plugin_lib.load() == FALSE ) { - QMessageBox::information( NULL, - mixer::tr( "Plugin not found" ), - mixer::tr( "The %1-plugin wasn't found!" - ).arg( _plugin_name ), + if( engine::hasGUI() ) + { + QMessageBox::information( NULL, + tr( "Plugin not found" ), + tr( "The %1-plugin wasn't found" + "or could not be loaded!\n" + "Reason: \"%2\"" ).arg( _plugin_name ). + arg( plugin_lib.errorString() ), QMessageBox::Ok | QMessageBox::Default ); + } return( new dummyPlugin() ); } instantiationHook inst_hook = ( instantiationHook ) plugin_lib.resolve( "lmms_plugin_main" ); if( inst_hook == NULL ) { - QMessageBox::information( NULL, - mixer::tr( "Error while loading plugin" ), - mixer::tr( "Failed loading plugin \"%1\"!" + if( engine::hasGUI() ) + { + QMessageBox::information( NULL, + tr( "Error while loading plugin" ), + tr( "Failed to load plugin \"%1\"!" ).arg( _plugin_name ), QMessageBox::Ok | QMessageBox::Default ); + } return( new dummyPlugin() ); } plugin * inst = inst_hook( _parent, _data );