Skip to content

Commit

Permalink
Merge branch 'misc-lv2-preparation'
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesLorenz committed Mar 17, 2019
2 parents 4129be8 + 7e75a82 commit ef6bac6
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 17 deletions.
1 change: 1 addition & 0 deletions include/Knob.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class LMMS_EXPORT Knob : public QWidget, public FloatModelView
public:
Knob( knobTypes _knob_num, QWidget * _parent = NULL, const QString & _name = QString() );
Knob( QWidget * _parent = NULL, const QString & _name = QString() ); //!< default ctor
Knob( const Knob& other ) = delete;
virtual ~Knob();

// TODO: remove
Expand Down
36 changes: 23 additions & 13 deletions src/core/Plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,12 @@ AutomatableModel * Plugin::childModel( const QString & )


#include "PluginFactory.h"
Plugin * Plugin::instantiate( const QString& pluginName, Model * parent,
void * data )
Plugin * Plugin::instantiate(const QString& pluginName, Model * parent,
void *data)
{
const PluginFactory::PluginInfo& pi = pluginFactory->pluginInfo(pluginName.toUtf8());

Plugin* inst;
if( pi.isNull() )
{
if( gui )
Expand All @@ -104,23 +106,31 @@ Plugin * Plugin::instantiate( const QString& pluginName, Model * parent,
arg( pluginName ).arg( pluginFactory->errorString(pluginName) ),
QMessageBox::Ok | QMessageBox::Default );
}
return new DummyPlugin();
inst = new DummyPlugin();
}

InstantiationHook instantiationHook = ( InstantiationHook ) pi.library->resolve( "lmms_plugin_main" );
if( instantiationHook == NULL )
else
{
if( gui )
InstantiationHook instantiationHook;
if ((instantiationHook = ( InstantiationHook ) pi.library->resolve( "lmms_plugin_main" )))
{
QMessageBox::information( NULL,
tr( "Error while loading plugin" ),
tr( "Failed to load plugin \"%1\"!").arg( pluginName ),
QMessageBox::Ok | QMessageBox::Default );
inst = instantiationHook(parent, data);
if(!inst) {
inst = new DummyPlugin();
}
}
else
{
if( gui )
{
QMessageBox::information( NULL,
tr( "Error while loading plugin" ),
tr( "Failed to load plugin \"%1\"!").arg( pluginName ),
QMessageBox::Ok | QMessageBox::Default );
}
inst = new DummyPlugin();
}
return new DummyPlugin();
}

Plugin * inst = instantiationHook( parent, data );
return inst;
}

Expand Down
14 changes: 10 additions & 4 deletions src/gui/EffectSelectDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "ui_EffectSelectDialog.h"

#include "gui_templates.h"
#include "DummyEffect.h"
#include "embed.h"
#include "PluginFactory.h"

Expand Down Expand Up @@ -147,12 +148,17 @@ EffectSelectDialog::~EffectSelectDialog()

Effect * EffectSelectDialog::instantiateSelectedPlugin( EffectChain * _parent )
{
if( !m_currentSelection.name.isEmpty() && m_currentSelection.desc )
Effect* result = nullptr;
if(!m_currentSelection.name.isEmpty() && m_currentSelection.desc)
{
return Effect::instantiate( m_currentSelection.desc->name,
_parent, &m_currentSelection );
result = Effect::instantiate(m_currentSelection.desc->name,
_parent, &m_currentSelection);
}
return NULL;
if(!result)
{
result = new DummyEffect(_parent, QDomElement());
}
return result;
}


Expand Down

0 comments on commit ef6bac6

Please sign in to comment.