mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-13 14:13:32 +02:00
Second big batch of Extended Import Filtering improvements
* /ExtendedImport/OverrideExtendedImportByOpenFileDialogChoice preference enables the override (backward-compatibel behaviour), and it is now false by default * File names (and mime types) and patterns are Lower()'ed before being fed to wxMatchWild(), now matching should be case-insensitive * Now empty rule elements (empty list of extensions, empty list of mime types) will match anything (just as if they had one "*" element) * "Extended Import" preferences tab is now next to "Import/Export" tab * Preferences now use Grid class (the one used in Tag editor) instead of default wxGrid. Tabbing now works correctly. * First attempt to add Drag'n'Drop re-ordering for Rule table. Seems to be working. * Cleaned up a couple of cruft code comments. * Separate buttons (with hotkeys) for moving rules and filters up and down (ctrl+up/down still works) * Moved some code into helper funcions (can be called from both button and keyboard event handlers) * Grid is now configured in PopulateOrExchange (the same way it is in Tags.cpp) * Keep selection while moving table rows and list items * Detect trailing/leading spaces in rule condition and offer to trim them
This commit is contained in:
@@ -339,16 +339,21 @@ int Importer::Import(wxString fName,
|
||||
wxString mime_type = wxT("*");
|
||||
|
||||
// First, add user-selected filter
|
||||
importPluginNode = mImportPluginList->GetFirst();
|
||||
while(importPluginNode)
|
||||
bool usersSelectionOverrides;
|
||||
gPrefs->Read(wxT("/ExtendedImport/OverrideExtendedImportByOpenFileDialogChoice"), &usersSelectionOverrides, false);
|
||||
if (usersSelectionOverrides)
|
||||
{
|
||||
ImportPlugin *plugin = importPluginNode->GetData();
|
||||
if (plugin->GetPluginFormatDescription().CompareTo(type) == 0)
|
||||
importPluginNode = mImportPluginList->GetFirst();
|
||||
while(importPluginNode)
|
||||
{
|
||||
// This plugin corresponds to user-selected filter, try it first.
|
||||
importPlugins.Insert(plugin);
|
||||
ImportPlugin *plugin = importPluginNode->GetData();
|
||||
if (plugin->GetPluginFormatDescription().CompareTo(type) == 0)
|
||||
{
|
||||
// This plugin corresponds to user-selected filter, try it first.
|
||||
importPlugins.Insert(plugin);
|
||||
}
|
||||
importPluginNode = importPluginNode->GetNext();
|
||||
}
|
||||
importPluginNode = importPluginNode->GetNext();
|
||||
}
|
||||
bool foundItem = false;
|
||||
|
||||
@@ -358,20 +363,24 @@ int Importer::Import(wxString fName,
|
||||
bool matches_ext = false, matches_mime = false;
|
||||
for (size_t j = 0; j < item->extensions.Count(); j++)
|
||||
{
|
||||
if (wxMatchWild (item->extensions[j],fName, false))
|
||||
if (wxMatchWild (item->extensions[j].Lower(),fName.Lower(), false))
|
||||
{
|
||||
matches_ext = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (item->extensions.Count() == 0)
|
||||
matches_ext = true;
|
||||
for (size_t j = 0; matches_ext && j < item->mime_types.Count(); j++)
|
||||
{
|
||||
if (wxMatchWild (item->mime_types[j],mime_type, false))
|
||||
if (wxMatchWild (item->mime_types[j].Lower(),mime_type.Lower(), false))
|
||||
{
|
||||
matches_mime = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (item->mime_types.Count() == 0)
|
||||
matches_mime = true;
|
||||
if (matches_ext && matches_mime)
|
||||
{
|
||||
for (size_t j = 0; j < item->filter_objects.Count() && (item->divider < 0 || (int) j < item->divider); j++)
|
||||
|
Reference in New Issue
Block a user