Merge branch 'cmake_dist'
# Conflicts: # src/gui/FileBrowser.cpp
This commit is contained in:
@@ -67,7 +67,7 @@ void BandLimitedWave::generateWaves()
|
||||
int i;
|
||||
|
||||
// set wavetable directory
|
||||
s_wavetableDir = ConfigManager::inst()->dataDir() + "wavetables/";
|
||||
s_wavetableDir = "data:wavetables/";
|
||||
|
||||
// set wavetable files
|
||||
QFile saw_file( s_wavetableDir + "saw.bin" );
|
||||
|
||||
@@ -45,6 +45,7 @@ set(LMMS_SRCS
|
||||
core/Piano.cpp
|
||||
core/PlayHandle.cpp
|
||||
core/Plugin.cpp
|
||||
core/PluginFactory.cpp
|
||||
core/PresetPreviewPlayHandle.cpp
|
||||
core/ProjectJournal.cpp
|
||||
core/ProjectRenderer.cpp
|
||||
|
||||
@@ -59,18 +59,15 @@ ConfigManager::ConfigManager() :
|
||||
#endif
|
||||
),
|
||||
m_artworkDir( defaultArtworkDir() ),
|
||||
#ifdef LMMS_BUILD_WIN32
|
||||
m_pluginDir( qApp->applicationDirPath()
|
||||
+ QDir::separator() + "plugins" + QDir::separator() ),
|
||||
#else
|
||||
m_pluginDir( qApp->applicationDirPath() + '/' + PLUGIN_DIR ),
|
||||
#endif
|
||||
m_vstDir( m_workingDir + "vst" + QDir::separator() ),
|
||||
m_flDir( QDir::home().absolutePath() ),
|
||||
m_gigDir( m_workingDir + GIG_PATH ),
|
||||
m_sf2Dir( m_workingDir + SF2_PATH ),
|
||||
m_version( defaultVersion() )
|
||||
{
|
||||
if (! qgetenv("LMMS_DATA_DIR").isEmpty())
|
||||
QDir::addSearchPath("data", QString::fromLocal8Bit(qgetenv("LMMS_DATA_DIR")));
|
||||
QDir::addSearchPath("data", m_dataDir);
|
||||
}
|
||||
|
||||
|
||||
@@ -375,7 +372,7 @@ void ConfigManager::loadConfigFile()
|
||||
( !m_ladDir.contains( ':' ) && !QDir( m_ladDir ).exists() ) )
|
||||
{
|
||||
#if defined(LMMS_BUILD_WIN32)
|
||||
m_ladDir = m_pluginDir + "ladspa" + QDir::separator();
|
||||
m_ladDir = qApp->applicationDirPath() + "/plugins/ladspa" + QDir::separator();
|
||||
#elif defined(LMMS_BUILD_APPLE)
|
||||
m_ladDir = qApp->applicationDirPath() + "/../lib/lmms/ladspa/";
|
||||
#else
|
||||
@@ -398,9 +395,11 @@ void ConfigManager::loadConfigFile()
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
QDir::setSearchPaths( "resources", QStringList() << artworkDir()
|
||||
<< defaultArtworkDir() );
|
||||
QStringList searchPaths;
|
||||
if(! qgetenv("LMMS_THEME_PATH").isNull())
|
||||
searchPaths << qgetenv("LMMS_THEME_PATH");
|
||||
searchPaths << artworkDir() << defaultArtworkDir();
|
||||
QDir::setSearchPaths( "resources", searchPaths);
|
||||
|
||||
if( !QDir( m_workingDir ).exists() &&
|
||||
QApplication::type() == QApplication::GuiClient &&
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
|
||||
|
||||
#include "ConfigManager.h"
|
||||
#include "PluginFactory.h"
|
||||
#include "ProjectVersion.h"
|
||||
#include "ProjectVersion.h"
|
||||
#include "SongEditor.h"
|
||||
@@ -188,7 +189,7 @@ bool DataFile::validate( QString extension )
|
||||
case Type::UnknownType:
|
||||
if (! ( extension == "mmp" || extension == "mpt" || extension == "mmpz" ||
|
||||
extension == "xpf" || extension == "xml" ||
|
||||
( extension == "xiz" && Engine::pluginFileHandling().contains( extension ) ) ||
|
||||
( extension == "xiz" && ! pluginFactory->pluginSupportingExtension(extension).isNull()) ||
|
||||
extension == "sf2" || extension == "pat" || extension == "mid" ||
|
||||
extension == "flp" || extension == "dll"
|
||||
) )
|
||||
|
||||
@@ -57,17 +57,17 @@ void EffectChain::saveSettings( QDomDocument & _doc, QDomElement & _this )
|
||||
_this.setAttribute( "enabled", m_enabledModel.value() );
|
||||
_this.setAttribute( "numofeffects", m_effects.count() );
|
||||
|
||||
for( EffectList::Iterator it = m_effects.begin(); it != m_effects.end(); it++ )
|
||||
for( Effect* effect : m_effects)
|
||||
{
|
||||
if( dynamic_cast<DummyEffect *>( *it ) )
|
||||
if( DummyEffect* dummy = dynamic_cast<DummyEffect*>(effect) )
|
||||
{
|
||||
_this.appendChild( dynamic_cast<DummyEffect *>( *it )->originalPluginData() );
|
||||
_this.appendChild( dummy->originalPluginData() );
|
||||
}
|
||||
else
|
||||
{
|
||||
QDomElement ef = ( *it )->saveState( _doc, _this );
|
||||
ef.setAttribute( "name", ( *it )->descriptor()->name );
|
||||
ef.appendChild( ( *it )->key().saveXML( _doc ) );
|
||||
QDomElement ef = effect->saveState( _doc, _this );
|
||||
ef.setAttribute( "name", QString::fromUtf8( effect->descriptor()->name ) );
|
||||
ef.appendChild( effect->key().saveXML( _doc ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -94,7 +94,7 @@ void EffectChain::loadSettings( const QDomElement & _this )
|
||||
const QString name = effectData.attribute( "name" );
|
||||
EffectKey key( effectData.elementsByTagName( "key" ).item( 0 ).toElement() );
|
||||
|
||||
Effect* e = Effect::instantiate( name, this, &key );
|
||||
Effect* e = Effect::instantiate( name.toUtf8(), this, &key );
|
||||
|
||||
if( e != NULL && e->isOkay() && e->nodeName() == node.nodeName() )
|
||||
{
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "PresetPreviewPlayHandle.h"
|
||||
#include "ProjectJournal.h"
|
||||
#include "Plugin.h"
|
||||
#include "PluginFactory.h"
|
||||
#include "Song.h"
|
||||
#include "BandLimitedWave.h"
|
||||
|
||||
@@ -45,7 +46,6 @@ Song * Engine::s_song = NULL;
|
||||
ProjectJournal * Engine::s_projectJournal = NULL;
|
||||
Ladspa2LMMS * Engine::s_ladspaManager = NULL;
|
||||
DummyTrackContainer * Engine::s_dummyTC = NULL;
|
||||
QMap<QString, QString> Engine::s_pluginFileHandling;
|
||||
|
||||
|
||||
|
||||
@@ -58,9 +58,6 @@ void Engine::init()
|
||||
// generate (load from file) bandlimited wavetables
|
||||
BandLimitedWave::generateWaves();
|
||||
|
||||
emit engine->initProgress(tr("Locating plugins"));
|
||||
initPluginFileHandling();
|
||||
|
||||
emit engine->initProgress(tr("Initializing data structures"));
|
||||
s_projectJournal = new ProjectJournal;
|
||||
s_mixer = new Mixer;
|
||||
@@ -124,29 +121,4 @@ void Engine::updateFramesPerTick()
|
||||
DefaultTicksPerTact / s_song->getTempo();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Engine::initPluginFileHandling()
|
||||
{
|
||||
Plugin::DescriptorList pluginDescriptors;
|
||||
Plugin::getDescriptorsOfAvailPlugins( pluginDescriptors );
|
||||
for( Plugin::DescriptorList::ConstIterator it = pluginDescriptors.begin();
|
||||
it != pluginDescriptors.end(); ++it )
|
||||
{
|
||||
if( it->type == Plugin::Instrument )
|
||||
{
|
||||
const QStringList & ext =
|
||||
QString( it->supportedFileTypes ).
|
||||
split( QChar( ',' ) );
|
||||
for( QStringList::const_iterator itExt = ext.begin();
|
||||
itExt != ext.end(); ++itExt )
|
||||
{
|
||||
s_pluginFileHandling[*itExt] = it->name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Engine * Engine::s_instanceOfMe = NULL;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ImportFilter.cpp - base-class for all import-filters (MIDI, FLP etc)
|
||||
*
|
||||
* Copyright (c) 2006-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
*
|
||||
* This file is part of LMMS - http://lmms.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -28,10 +28,10 @@
|
||||
#include "ImportFilter.h"
|
||||
#include "Engine.h"
|
||||
#include "TrackContainer.h"
|
||||
#include "PluginFactory.h"
|
||||
#include "ProjectJournal.h"
|
||||
|
||||
|
||||
|
||||
ImportFilter::ImportFilter( const QString & _file_name,
|
||||
const Descriptor * _descriptor ) :
|
||||
Plugin( _descriptor, NULL ),
|
||||
@@ -52,9 +52,6 @@ ImportFilter::~ImportFilter()
|
||||
void ImportFilter::import( const QString & _file_to_import,
|
||||
TrackContainer* tc )
|
||||
{
|
||||
DescriptorList d;
|
||||
Plugin::getDescriptorsOfAvailPlugins( d );
|
||||
|
||||
bool successful = false;
|
||||
|
||||
char * s = qstrdup( _file_to_import.toUtf8().constData() );
|
||||
@@ -63,21 +60,17 @@ void ImportFilter::import( const QString & _file_to_import,
|
||||
const bool j = Engine::projectJournal()->isJournalling();
|
||||
Engine::projectJournal()->setJournalling( false );
|
||||
|
||||
for( Plugin::DescriptorList::ConstIterator it = d.begin();
|
||||
it != d.end(); ++it )
|
||||
for (const Plugin::Descriptor* desc : pluginFactory->descriptors(Plugin::ImportFilter))
|
||||
{
|
||||
if( it->type == Plugin::ImportFilter )
|
||||
Plugin * p = Plugin::instantiate( desc->name, NULL, s );
|
||||
if( dynamic_cast<ImportFilter *>( p ) != NULL &&
|
||||
dynamic_cast<ImportFilter *>( p )->tryImport( tc ) == true )
|
||||
{
|
||||
Plugin * p = Plugin::instantiate( it->name, NULL, s );
|
||||
if( dynamic_cast<ImportFilter *>( p ) != NULL &&
|
||||
dynamic_cast<ImportFilter *>( p )->tryImport( tc ) == true )
|
||||
{
|
||||
delete p;
|
||||
successful = true;
|
||||
break;
|
||||
}
|
||||
delete p;
|
||||
successful = true;
|
||||
break;
|
||||
}
|
||||
delete p;
|
||||
}
|
||||
|
||||
Engine::projectJournal()->setJournalling( j );
|
||||
|
||||
@@ -43,7 +43,7 @@ LadspaManager::LadspaManager()
|
||||
split( LADSPA_PATH_SEPERATOR );
|
||||
ladspaDirectories += ConfigManager::inst()->ladspaDir().split( ',' );
|
||||
|
||||
ladspaDirectories.push_back( ConfigManager::inst()->pluginDir() + "ladspa" );
|
||||
ladspaDirectories.push_back( "plugins:ladspa" );
|
||||
#ifndef LMMS_BUILD_WIN32
|
||||
ladspaDirectories.push_back( qApp->applicationDirPath() + '/' + LIB_DIR + "ladspa" );
|
||||
ladspaDirectories.push_back( "/usr/lib/ladspa" );
|
||||
|
||||
@@ -91,25 +91,25 @@ AutomatableModel * Plugin::childModel( const QString & )
|
||||
|
||||
|
||||
|
||||
|
||||
Plugin * Plugin::instantiate( const QString & pluginName, Model * parent,
|
||||
#include "PluginFactory.h"
|
||||
Plugin * Plugin::instantiate( const QString& pluginName, Model * parent,
|
||||
void * data )
|
||||
{
|
||||
QLibrary pluginLibrary( ConfigManager::inst()->pluginDir() + pluginName );
|
||||
if( pluginLibrary.load() == false )
|
||||
const PluginFactory::PluginInfo& pi = pluginFactory->pluginInfo(pluginName.toUtf8());
|
||||
if( pi.isNull() )
|
||||
{
|
||||
if( Engine::hasGUI() )
|
||||
{
|
||||
QMessageBox::information( NULL,
|
||||
tr( "Plugin not found" ),
|
||||
tr( "The plugin \"%1\" wasn't found or could not be loaded!\nReason: \"%2\"" ).
|
||||
arg( pluginName ).arg( pluginLibrary.errorString() ),
|
||||
arg( pluginName ).arg( pluginFactory->errorString(pluginName) ),
|
||||
QMessageBox::Ok | QMessageBox::Default );
|
||||
}
|
||||
return new DummyPlugin();
|
||||
}
|
||||
|
||||
InstantiationHook instantiationHook = ( InstantiationHook )pluginLibrary.resolve( "lmms_plugin_main" );
|
||||
InstantiationHook instantiationHook = ( InstantiationHook ) pi.library->resolve( "lmms_plugin_main" );
|
||||
if( instantiationHook == NULL )
|
||||
{
|
||||
if( Engine::hasGUI() )
|
||||
@@ -137,50 +137,6 @@ void Plugin::collectErrorForUI( QString errMsg )
|
||||
|
||||
|
||||
|
||||
void Plugin::getDescriptorsOfAvailPlugins( DescriptorList& pluginDescriptors )
|
||||
{
|
||||
QDir directory( ConfigManager::inst()->pluginDir() );
|
||||
#ifdef LMMS_BUILD_WIN32
|
||||
QFileInfoList list = directory.entryInfoList( QStringList( "*.dll" ) );
|
||||
#else
|
||||
QFileInfoList list = directory.entryInfoList( QStringList( "lib*.so" ) );
|
||||
#endif
|
||||
foreach( const QFileInfo& f, list )
|
||||
{
|
||||
QLibrary( f.absoluteFilePath() ).load();
|
||||
}
|
||||
|
||||
foreach( const QFileInfo& f, list )
|
||||
{
|
||||
QLibrary pluginLibrary( f.absoluteFilePath() );
|
||||
if( pluginLibrary.load() == false ||
|
||||
pluginLibrary.resolve( "lmms_plugin_main" ) == NULL )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
QString descriptorName = f.baseName() + "_plugin_descriptor";
|
||||
if( descriptorName.left( 3 ) == "lib" )
|
||||
{
|
||||
descriptorName = descriptorName.mid( 3 );
|
||||
}
|
||||
|
||||
Descriptor* pluginDescriptor = (Descriptor *) pluginLibrary.resolve( descriptorName.toUtf8().constData() );
|
||||
if( pluginDescriptor == NULL )
|
||||
{
|
||||
qWarning() << tr( "LMMS plugin %1 does not have a plugin descriptor named %2!" ).
|
||||
arg( f.absoluteFilePath() ).arg( descriptorName );
|
||||
continue;
|
||||
}
|
||||
|
||||
pluginDescriptors += *pluginDescriptor;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
PluginView * Plugin::createView( QWidget * parent )
|
||||
{
|
||||
PluginView * pv = instantiateView( parent );
|
||||
|
||||
197
src/core/PluginFactory.cpp
Normal file
197
src/core/PluginFactory.cpp
Normal file
@@ -0,0 +1,197 @@
|
||||
/*
|
||||
* PluginFactory.cpp
|
||||
*
|
||||
* Copyright (c) 2015 Lukas W <lukaswhl/at/gmail.com>
|
||||
*
|
||||
* This file is part of LMMS - http://lmms.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program (see COPYING); if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "PluginFactory.h"
|
||||
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/QLibrary>
|
||||
|
||||
#include "Plugin.h"
|
||||
|
||||
#ifdef LMMS_BUILD_WIN32
|
||||
QStringList nameFilters("*.dll");
|
||||
#else
|
||||
QStringList nameFilters("lib*.so");
|
||||
#endif
|
||||
|
||||
PluginFactory* PluginFactory::s_instance = nullptr;
|
||||
|
||||
PluginFactory::PluginFactory()
|
||||
{
|
||||
// Adds a search path relative to the main executable to if the path exists.
|
||||
auto addRelativeIfExists = [this] (const QString& path) {
|
||||
QDir dir(qApp->applicationDirPath());
|
||||
if (!path.isEmpty() && dir.cd(path)) {
|
||||
QDir::addSearchPath("plugins", dir.absolutePath());
|
||||
}
|
||||
};
|
||||
|
||||
// We're either running LMMS installed on an Unixoid or we're running a
|
||||
// portable version like we do on Windows.
|
||||
// We want to find our plugins in both cases:
|
||||
// (a) Installed (Unix):
|
||||
// e.g. binary at /usr/bin/lmms - plugin dir at /usr/lib/lmms/
|
||||
// (b) Portable:
|
||||
// e.g. binary at "C:/Program Files/LMMS/lmms.exe"
|
||||
// plugins at "C:/Program Files/LMMS/plugins/"
|
||||
|
||||
#ifndef LMMS_BUILD_WIN32
|
||||
addRelativeIfExists("../lib/lmms"); // Installed
|
||||
#endif
|
||||
addRelativeIfExists("plugins"); // Portable
|
||||
#ifdef PLUGIN_DIR // We may also have received a relative directory via a define
|
||||
addRelativeIfExists(PLUGIN_DIR);
|
||||
#endif
|
||||
// Or via an environment variable:
|
||||
QString env_path;
|
||||
if (!(env_path = qgetenv("LMMS_PLUGIN_DIR")).isEmpty())
|
||||
QDir::addSearchPath("plugins", env_path);
|
||||
|
||||
discoverPlugins();
|
||||
}
|
||||
|
||||
PluginFactory::~PluginFactory()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
PluginFactory* PluginFactory::instance()
|
||||
{
|
||||
if (s_instance == nullptr)
|
||||
s_instance = new PluginFactory();
|
||||
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
const Plugin::DescriptorList PluginFactory::descriptors() const
|
||||
{
|
||||
return m_descriptors.values();
|
||||
}
|
||||
|
||||
const Plugin::DescriptorList PluginFactory::descriptors(Plugin::PluginTypes type) const
|
||||
{
|
||||
return m_descriptors.values(type);
|
||||
}
|
||||
|
||||
const PluginFactory::PluginInfoList& PluginFactory::pluginInfos() const
|
||||
{
|
||||
return m_pluginInfos;
|
||||
}
|
||||
|
||||
const PluginFactory::PluginInfo PluginFactory::pluginSupportingExtension(const QString& ext)
|
||||
{
|
||||
PluginInfo* info = m_pluginByExt.value(ext, nullptr);
|
||||
return info == nullptr ? PluginInfo() : *info;
|
||||
}
|
||||
|
||||
const PluginFactory::PluginInfo PluginFactory::pluginInfo(const char* name) const
|
||||
{
|
||||
for (const PluginInfo* info : m_pluginInfos)
|
||||
{
|
||||
if (qstrcmp(info->descriptor->name, name) == 0)
|
||||
return *info;
|
||||
}
|
||||
return PluginInfo();
|
||||
}
|
||||
|
||||
QString PluginFactory::errorString(QString pluginName) const
|
||||
{
|
||||
static QString notfound = qApp->translate("PluginFactory", "Plugin not found.");
|
||||
return m_errors.value(pluginName, notfound);
|
||||
}
|
||||
|
||||
void PluginFactory::discoverPlugins()
|
||||
{
|
||||
DescriptorMap descriptors;
|
||||
PluginInfoList pluginInfos;
|
||||
m_pluginByExt.clear();
|
||||
|
||||
const QFileInfoList& files = QDir("plugins:").entryInfoList(nameFilters);
|
||||
|
||||
// Cheap dependency handling: zynaddsubfx needs ZynAddSubFxCore. By loading
|
||||
// all libraries twice we ensure that libZynAddSubFxCore is found.
|
||||
for (const QFileInfo& file : files)
|
||||
{
|
||||
QLibrary(file.absoluteFilePath()).load();
|
||||
}
|
||||
|
||||
for (const QFileInfo& file : files)
|
||||
{
|
||||
QLibrary* library = new QLibrary(file.absoluteFilePath());
|
||||
|
||||
if (! library->load()) {
|
||||
m_errors[file.baseName()] = library->errorString();
|
||||
continue;
|
||||
}
|
||||
if (library->resolve("lmms_plugin_main") == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
QString descriptorName = file.baseName() + "_plugin_descriptor";
|
||||
if( descriptorName.left(3) == "lib" )
|
||||
{
|
||||
descriptorName = descriptorName.mid(3);
|
||||
}
|
||||
|
||||
Plugin::Descriptor* pluginDescriptor = (Plugin::Descriptor*) library->resolve(descriptorName.toUtf8().constData());
|
||||
if(pluginDescriptor == nullptr)
|
||||
{
|
||||
qWarning() << qApp->translate("PluginFactory", "LMMS plugin %1 does not have a plugin descriptor named %2!").
|
||||
arg(file.absoluteFilePath()).arg(descriptorName);
|
||||
continue;
|
||||
}
|
||||
|
||||
PluginInfo* info = new PluginInfo;
|
||||
info->file = file;
|
||||
info->library = library;
|
||||
info->descriptor = pluginDescriptor;
|
||||
pluginInfos << info;
|
||||
|
||||
for (const QString& ext : QString(info->descriptor->supportedFileTypes).split(','))
|
||||
{
|
||||
m_pluginByExt.insert(ext, info);
|
||||
}
|
||||
|
||||
descriptors.insert(info->descriptor->type, info->descriptor);
|
||||
}
|
||||
|
||||
|
||||
for (PluginInfo* info : m_pluginInfos)
|
||||
{
|
||||
delete info->library;
|
||||
delete info;
|
||||
}
|
||||
m_pluginInfos = pluginInfos;
|
||||
m_descriptors = descriptors;
|
||||
}
|
||||
|
||||
|
||||
|
||||
const QString PluginFactory::PluginInfo::name() const
|
||||
{
|
||||
return descriptor ? descriptor->name : QString();
|
||||
}
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "MidiPort.h"
|
||||
#include "DataFile.h"
|
||||
#include "NotePlayHandle.h"
|
||||
#include "PluginFactory.h"
|
||||
#include "ProjectJournal.h"
|
||||
#include "TrackContainer.h"
|
||||
|
||||
@@ -134,8 +135,7 @@ PresetPreviewPlayHandle::PresetPreviewPlayHandle( const QString & _preset_file,
|
||||
if( i == NULL || !i->descriptor()->supportsFileType( ext ) )
|
||||
{
|
||||
i = s_previewTC->previewInstrumentTrack()->
|
||||
loadInstrument(
|
||||
Engine::pluginFileHandling()[ext] );
|
||||
loadInstrument(pluginFactory->pluginSupportingExtension(ext).name());
|
||||
}
|
||||
if( i != NULL )
|
||||
{
|
||||
|
||||
@@ -130,8 +130,7 @@ bool RemotePlugin::init( const QString &pluginExecutable,
|
||||
reset( new shmFifo(), new shmFifo() );
|
||||
m_failed = false;
|
||||
}
|
||||
QString exec = ConfigManager::inst()->pluginDir() +
|
||||
pluginExecutable;
|
||||
QString exec = QFileInfo(QDir("plugins:"), pluginExecutable).absoluteFilePath();
|
||||
|
||||
QStringList args;
|
||||
// swap in and out for bidirectional communication
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
#include "gui_templates.h"
|
||||
#include "embed.h"
|
||||
#include "PluginFactory.h"
|
||||
|
||||
#include <QLabel>
|
||||
|
||||
@@ -44,31 +45,25 @@ EffectSelectDialog::EffectSelectDialog( QWidget * _parent ) :
|
||||
setWindowIcon( embed::getIconPixmap( "setup_audio" ) );
|
||||
|
||||
// query effects
|
||||
Plugin::getDescriptorsOfAvailPlugins( m_pluginDescriptors );
|
||||
|
||||
EffectKeyList subPluginEffectKeys;
|
||||
|
||||
for( Plugin::DescriptorList::ConstIterator it = m_pluginDescriptors.begin();
|
||||
it != m_pluginDescriptors.end(); ++it )
|
||||
for (const Plugin::Descriptor* desc: pluginFactory->descriptors(Plugin::Effect))
|
||||
{
|
||||
if( it->type != Plugin::Effect )
|
||||
if( desc->subPluginFeatures )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if( it->subPluginFeatures )
|
||||
{
|
||||
it->subPluginFeatures->listSubPluginKeys(
|
||||
desc->subPluginFeatures->listSubPluginKeys(
|
||||
// as iterators are always stated to be not
|
||||
// equal with pointers, we dereference the
|
||||
// iterator and take the address of the item,
|
||||
// so we're on the safe side and the compiler
|
||||
// likely will reduce that to just "it"
|
||||
&( *it ),
|
||||
desc,
|
||||
subPluginEffectKeys );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_effectKeys << EffectKey( &( *it ), it->name );
|
||||
m_effectKeys << EffectKey( desc, desc->name );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#include "InstrumentTrack.h"
|
||||
#include "MainWindow.h"
|
||||
#include "DataFile.h"
|
||||
#include "PluginFactory.h"
|
||||
#include "PresetPreviewPlayHandle.h"
|
||||
#include "SamplePlayHandle.h"
|
||||
#include "Song.h"
|
||||
@@ -471,7 +472,8 @@ void FileBrowserTreeWidget::mousePressEvent(QMouseEvent * me )
|
||||
m_previewPlayHandle = s;
|
||||
delete tf;
|
||||
}
|
||||
else if( ( f->extension ()== "xiz" || f->extension() == "sf2" || f->extension() == "gig" ) && Engine::pluginFileHandling().contains( f->extension() ) )
|
||||
else if( ( f->extension ()== "xiz" || f->extension() == "sf2" || f->extension() == "gig" ) &&
|
||||
! pluginFactory->pluginSupportingExtension(f->extension()).isNull() )
|
||||
{
|
||||
m_previewPlayHandle = new PresetPreviewPlayHandle( f->fullName(), f->handling() == FileItem::LoadByPlugin );
|
||||
}
|
||||
@@ -614,7 +616,7 @@ void FileBrowserTreeWidget::handleFile(FileItem * f, InstrumentTrack * it )
|
||||
!i->descriptor()->supportsFileType( e ) )
|
||||
{
|
||||
i = it->loadInstrument(
|
||||
Engine::pluginFileHandling()[e] );
|
||||
pluginFactory->pluginSupportingExtension(e).name() );
|
||||
}
|
||||
i->loadFile( f->fullName() );
|
||||
break;
|
||||
@@ -1045,7 +1047,7 @@ void FileItem::determineFileType( void )
|
||||
m_type = PresetFile;
|
||||
m_handling = LoadAsPreset;
|
||||
}
|
||||
else if( ext == "xiz" && Engine::pluginFileHandling().contains( ext ) )
|
||||
else if( ext == "xiz" && ! pluginFactory->pluginSupportingExtension(ext).isNull() )
|
||||
{
|
||||
m_type = PresetFile;
|
||||
m_handling = LoadByPlugin;
|
||||
@@ -1079,7 +1081,7 @@ void FileItem::determineFileType( void )
|
||||
}
|
||||
|
||||
if( m_handling == NotSupported &&
|
||||
!ext.isEmpty() && Engine::pluginFileHandling().contains( ext ) )
|
||||
!ext.isEmpty() && ! pluginFactory->pluginSupportingExtension(ext).isNull() )
|
||||
{
|
||||
m_handling = LoadByPlugin;
|
||||
// classify as sample if not classified by anything yet but can
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
#include "SideBar.h"
|
||||
#include "ConfigManager.h"
|
||||
#include "Mixer.h"
|
||||
#include "PluginFactory.h"
|
||||
#include "PluginView.h"
|
||||
#include "ProjectNotes.h"
|
||||
#include "SetupDialog.h"
|
||||
@@ -330,18 +331,11 @@ void MainWindow::finalize()
|
||||
|
||||
|
||||
m_toolsMenu = new QMenu( this );
|
||||
Plugin::DescriptorList pluginDescriptors;
|
||||
Plugin::getDescriptorsOfAvailPlugins( pluginDescriptors );
|
||||
for( Plugin::DescriptorList::ConstIterator it = pluginDescriptors.begin();
|
||||
it != pluginDescriptors.end(); ++it )
|
||||
for( const Plugin::Descriptor* desc : pluginFactory->descriptors(Plugin::Tool) )
|
||||
{
|
||||
if( it->type == Plugin::Tool )
|
||||
{
|
||||
m_toolsMenu->addAction( it->logo->pixmap(),
|
||||
it->displayName );
|
||||
m_tools.push_back( ToolPlugin::instantiate( it->name,
|
||||
/*this*/NULL )->createView( this ) );
|
||||
}
|
||||
m_toolsMenu->addAction( desc->logo->pixmap(), desc->displayName );
|
||||
m_tools.push_back( ToolPlugin::instantiate( desc->name, /*this*/NULL )
|
||||
->createView(this) );
|
||||
}
|
||||
if( !m_toolsMenu->isEmpty() )
|
||||
{
|
||||
|
||||
@@ -22,25 +22,27 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "PluginBrowser.h"
|
||||
|
||||
#include <algorithm> // for std::sort
|
||||
|
||||
#include <QLabel>
|
||||
#include <QPainter>
|
||||
#include <QCursor>
|
||||
#include <QMouseEvent>
|
||||
#include <QScrollArea>
|
||||
|
||||
#include "PluginBrowser.h"
|
||||
#include <algorithm> // for std::sort
|
||||
|
||||
#include "embed.h"
|
||||
#include "debug.h"
|
||||
#include "templates.h"
|
||||
#include "gui_templates.h"
|
||||
#include "StringPairDrag.h"
|
||||
#include "PluginFactory.h"
|
||||
|
||||
|
||||
bool pluginBefore( const Plugin::Descriptor& d1, const Plugin::Descriptor& d2 )
|
||||
bool pluginBefore( const Plugin::Descriptor* d1, const Plugin::Descriptor* d2 )
|
||||
{
|
||||
return qstricmp( d1.displayName, d2.displayName ) < 0 ? true : false;
|
||||
return qstricmp( d1->displayName, d2->displayName ) < 0 ? true : false;
|
||||
}
|
||||
|
||||
|
||||
@@ -93,18 +95,13 @@ PluginDescList::PluginDescList(QWidget *parent) :
|
||||
{
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
|
||||
Plugin::getDescriptorsOfAvailPlugins( m_pluginDescriptors );
|
||||
std::sort(m_pluginDescriptors.begin(), m_pluginDescriptors.end(), pluginBefore);
|
||||
|
||||
for( Plugin::DescriptorList::const_iterator it = m_pluginDescriptors.constBegin();
|
||||
it != m_pluginDescriptors.constEnd(); ++it )
|
||||
QList<Plugin::Descriptor*> descs = pluginFactory->descriptors(Plugin::Instrument);
|
||||
std::sort(descs.begin(), descs.end(), pluginBefore);
|
||||
for (const Plugin::Descriptor* desc : descs)
|
||||
{
|
||||
if( it->type == Plugin::Instrument )
|
||||
{
|
||||
PluginDescWidget* p = new PluginDescWidget( *it, this );
|
||||
p->show();
|
||||
layout->addWidget(p);
|
||||
}
|
||||
PluginDescWidget* p = new PluginDescWidget( *desc, this );
|
||||
p->show();
|
||||
layout->addWidget(p);
|
||||
}
|
||||
|
||||
setLayout(layout);
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#include "StringPairDrag.h"
|
||||
#include "Track.h"
|
||||
#include "GuiApplication.h"
|
||||
#include "PluginFactory.h"
|
||||
|
||||
|
||||
TrackContainerView::TrackContainerView( TrackContainer * _tc ) :
|
||||
@@ -385,8 +386,7 @@ void TrackContainerView::dropEvent( QDropEvent * _de )
|
||||
Track::create( Track::InstrumentTrack,
|
||||
m_tc ) );
|
||||
Instrument * i = it->loadInstrument(
|
||||
Engine::pluginFileHandling()[FileItem::extension(
|
||||
value )]);
|
||||
pluginFactory->pluginSupportingExtension(FileItem::extension(value)).name());
|
||||
i->loadFile( value );
|
||||
//it->toggledInstrumentTrackButton( true );
|
||||
_de->accept();
|
||||
|
||||
@@ -71,19 +71,12 @@ QPixmap getIconPixmap( const char * pixmapName, int width, int height )
|
||||
#ifdef PLUGIN_NAME
|
||||
for ( i = 0; i < candidates.size() && pixmap.isNull(); ++i ) {
|
||||
name = candidates.at( i );
|
||||
pixmap = QPixmap( ConfigManager::inst()->artworkDir() + "plugins/" +
|
||||
STRINGIFY( PLUGIN_NAME ) + "_" + name );
|
||||
pixmap = QPixmap( "resources:plugins/" STRINGIFY( PLUGIN_NAME ) "_" + name );
|
||||
}
|
||||
#endif
|
||||
for ( i = 0; i < candidates.size() && pixmap.isNull(); ++i ) {
|
||||
name = candidates.at( i );
|
||||
pixmap = QPixmap( ConfigManager::inst()->artworkDir() + name );
|
||||
}
|
||||
|
||||
// nothing found, so look in default-artwork-dir
|
||||
for ( i = 0; i < candidates.size() && pixmap.isNull(); ++i ) {
|
||||
name = candidates.at( i );
|
||||
pixmap = QPixmap( ConfigManager::inst()->defaultArtworkDir() + name );
|
||||
pixmap = QPixmap( "resources:" + name );
|
||||
}
|
||||
|
||||
for ( i = 0; i < candidates.size() && pixmap.isNull(); ++i ) {
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
#include "DataFile.h"
|
||||
#include "NotePlayHandle.h"
|
||||
#include "Pattern.h"
|
||||
#include "PluginFactory.h"
|
||||
#include "PluginView.h"
|
||||
#include "SamplePlayHandle.h"
|
||||
#include "Song.h"
|
||||
@@ -1687,7 +1688,7 @@ void InstrumentTrackWindow::dropEvent( QDropEvent* event )
|
||||
|
||||
if( !i->descriptor()->supportsFileType( ext ) )
|
||||
{
|
||||
i = m_track->loadInstrument( Engine::pluginFileHandling()[ext] );
|
||||
i = m_track->loadInstrument( pluginFactory->pluginSupportingExtension(ext).name() );
|
||||
}
|
||||
|
||||
i->loadFile( value );
|
||||
|
||||
Reference in New Issue
Block a user