ResourceItem: dynamically register plugin-processed file types
Dynamically extend the map of file types by plugin-processed file types. Furthermore renamed type TypePluginSpecificPreset to TypePluginSpecificResource. Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
This commit is contained in:
@@ -55,7 +55,7 @@ public:
|
||||
TypeSample,
|
||||
TypeSoundFont,
|
||||
TypePreset,
|
||||
TypePluginSpecificPreset,
|
||||
TypePluginSpecificResource,
|
||||
TypeProject,
|
||||
TypeMidiFile,
|
||||
TypeForeignProject,
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "ResourceItem.h"
|
||||
#include "ResourceProvider.h"
|
||||
#include "config_mgr.h"
|
||||
#include "engine.h"
|
||||
|
||||
|
||||
|
||||
@@ -185,8 +186,6 @@ ResourceItem::Type ResourceItem::guessType( void ) const
|
||||
|
||||
typeMap["xpf"] = TypePreset;
|
||||
|
||||
typeMap["xiz"] = TypePluginSpecificPreset;
|
||||
|
||||
typeMap["mmp"] = TypeProject;
|
||||
typeMap["mmpz"] = TypeProject;
|
||||
|
||||
@@ -200,6 +199,16 @@ ResourceItem::Type ResourceItem::guessType( void ) const
|
||||
typeMap["png"] = TypeImage;
|
||||
typeMap["jpg"] = TypeImage;
|
||||
typeMap["jpeg"] = TypeImage;
|
||||
|
||||
for( QMap<QString, QString>::ConstIterator it =
|
||||
engine::pluginFileHandling().begin();
|
||||
it != engine::pluginFileHandling().end(); ++it )
|
||||
{
|
||||
if( !typeMap.contains( it.key() ) )
|
||||
{
|
||||
typeMap[it.key()] = TypePluginSpecificResource;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const QString s = QFileInfo( name() ).suffix().toLower();
|
||||
|
||||
@@ -87,7 +87,7 @@ case ResourceItem::TypeDirectory:
|
||||
case ResourceItem::TypeSample:
|
||||
return embed::getIconPixmap( "mimetypes/sample", 24, 24 );
|
||||
case ResourceItem::TypePreset:
|
||||
case ResourceItem::TypePluginSpecificPreset:
|
||||
case ResourceItem::TypePluginSpecificResource:
|
||||
return embed::getIconPixmap( "mimetypes/preset", 24, 24 );
|
||||
case ResourceItem::TypeProject:
|
||||
return embed::getIconPixmap( "project_file", 24, 24 );
|
||||
@@ -117,7 +117,7 @@ Qt::ItemFlags ResourceTreeModel::flags( const QModelIndex & _index ) const
|
||||
{
|
||||
case ResourceItem::TypeSample:
|
||||
case ResourceItem::TypePreset:
|
||||
case ResourceItem::TypePluginSpecificPreset:
|
||||
case ResourceItem::TypePluginSpecificResource:
|
||||
case ResourceItem::TypeProject:
|
||||
case ResourceItem::TypeMidiFile:
|
||||
case ResourceItem::TypeImage:
|
||||
|
||||
@@ -183,7 +183,7 @@ void ResourceBrowser::showContextMenu( const QPoint & _pos )
|
||||
case ResourceItem::TypeSample:
|
||||
case ResourceItem::TypeSoundFont:
|
||||
case ResourceItem::TypePreset:
|
||||
case ResourceItem::TypePluginSpecificPreset:
|
||||
case ResourceItem::TypePluginSpecificResource:
|
||||
case ResourceItem::TypePlugin:
|
||||
m.addAction( m_actions[LoadInNewTrackSongEditor] );
|
||||
m.addAction( m_actions[LoadInNewTrackBBEditor] );
|
||||
@@ -271,7 +271,7 @@ void ResourceBrowser::triggerDefaultAction( const QModelIndex & _idx )
|
||||
action = LoadInNewTrackBBEditor;
|
||||
break;
|
||||
case ResourceItem::TypePreset:
|
||||
case ResourceItem::TypePluginSpecificPreset:
|
||||
case ResourceItem::TypePluginSpecificResource:
|
||||
case ResourceItem::TypePlugin:
|
||||
case ResourceItem::TypeSoundFont:
|
||||
action = LoadInNewTrackSongEditor;
|
||||
|
||||
Reference in New Issue
Block a user