//============================================================================== void FileSearchPathListComponent::setPath (const FileSearchPath& newPath) { if (newPath.toString() != path.toString()) { path = newPath; changed(); } }
void PluginListComponent::scanFor (AudioPluginFormat* format) { if (format != nullptr) { FileSearchPath path (format->getDefaultLocationsToSearch()); if (path.getNumPaths() > 0) // if the path is empty, then paths aren't used for this format. { #if JUCE_MODAL_LOOPS_PERMITTED if (propertiesToUse != nullptr) path = propertiesToUse->getValue ("lastPluginScanPath_" + format->getName(), path.toString()); AlertWindow aw (TRANS("Select folders to scan..."), String::empty, AlertWindow::NoIcon); FileSearchPathListComponent pathList; pathList.setSize (500, 300); pathList.setPath (path); aw.addCustomComponent (&pathList); aw.addButton (TRANS("Scan"), 1, KeyPress (KeyPress::returnKey)); aw.addButton (TRANS("Cancel"), 0, KeyPress (KeyPress::escapeKey)); if (aw.runModalLoop() == 0) return; path = pathList.getPath(); #else jassertfalse; // XXX this method needs refactoring to work without modal loops.. #endif } if (propertiesToUse != nullptr) { propertiesToUse->setValue ("lastPluginScanPath_" + format->getName(), path.toString()); propertiesToUse->saveIfNeeded(); } currentScanner = new Scanner (*this, *format, path); } }
void PluginListComponent::setLastSearchPath (PropertiesFile& properties, AudioPluginFormat& format, const FileSearchPath& newPath) { properties.setValue ("lastPluginScanPath_" + format.getName(), newPath.toString()); }
void PluginListComponent::scanFor (AudioPluginFormat* format) { #if JUCE_MODAL_LOOPS_PERMITTED if (format == nullptr) return; FileSearchPath path (format->getDefaultLocationsToSearch()); if (propertiesToUse != nullptr) path = propertiesToUse->getValue ("lastPluginScanPath_" + format->getName(), path.toString()); { AlertWindow aw (TRANS("Select folders to scan..."), String::empty, AlertWindow::NoIcon); FileSearchPathListComponent pathList; pathList.setSize (500, 300); pathList.setPath (path); aw.addCustomComponent (&pathList); aw.addButton (TRANS("Scan"), 1, KeyPress::returnKey); aw.addButton (TRANS("Cancel"), 0, KeyPress::escapeKey); if (aw.runModalLoop() == 0) return; path = pathList.getPath(); } if (propertiesToUse != nullptr) { propertiesToUse->setValue ("lastPluginScanPath_" + format->getName(), path.toString()); propertiesToUse->saveIfNeeded(); } double progress = 0.0; AlertWindow aw (TRANS("Scanning for plugins..."), TRANS("Searching for all possible plugin files..."), AlertWindow::NoIcon); aw.addButton (TRANS("Cancel"), 0, KeyPress::escapeKey); aw.addProgressBarComponent (progress); aw.enterModalState(); MessageManager::getInstance()->runDispatchLoopUntil (300); PluginDirectoryScanner scanner (list, *format, path, true, deadMansPedalFile); for (;;) { aw.setMessage (TRANS("Testing:\n\n") + scanner.getNextPluginFileThatWillBeScanned()); MessageManager::getInstance()->runDispatchLoopUntil (100); if (! scanner.scanNextFile (true)) break; if (! aw.isCurrentlyModal()) break; progress = scanner.getProgress(); } if (scanner.getFailedFiles().size() > 0) { StringArray shortNames; for (int i = 0; i < scanner.getFailedFiles().size(); ++i) shortNames.add (File (scanner.getFailedFiles()[i]).getFileName()); AlertWindow::showMessageBox (AlertWindow::InfoIcon, TRANS("Scan complete"), TRANS("Note that the following files appeared to be plugin files, but failed to load correctly:\n\n") + shortNames.joinIntoString (", ")); } #else jassertfalse; // this method needs refactoring to work without modal loops.. #endif }