commit f5deef3d4d3083cf95c0393f144bcf46d08d1cc3
parent 3f8014c13d0f87d6e8b2e421d3f7ae499dd174cc
Author: Keith Bloemer <[email protected]>
Date: Tue, 8 Mar 2022 12:34:29 -0600
Update PluginEditor.cpp
Diffstat:
1 file changed, 18 insertions(+), 15 deletions(-)
diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp
@@ -682,13 +682,15 @@ void NeuralPiAudioProcessorEditor::updateToggleState(juce::Button* button, juce:
}
void NeuralPiAudioProcessorEditor::loadButtonClicked()
-{
- FileChooser chooser("Select one or more .json tone files to import",
- {},
- "*.json");
- if (chooser.browseForMultipleFilesToOpen())
+{
+ myChooser = std::make_unique<FileChooser> ("Select one or more .json tone files to import",
+ File::getSpecialLocation (File::userDesktopDirectory),
+ "*.json");
+
+ auto folderChooserFlags = FileBrowserComponent::openMode | FileBrowserComponent::canSelectFiles | FileBrowserComponent::canSelectMultipleItems;
+
+ myChooser->launchAsync (folderChooserFlags, [this] (const FileChooser& chooser)
{
- int import_fail = 1;
Array<File> files = chooser.getResults();
for (auto file : files) {
File fullpath = processor.userAppDataDirectory_tones.getFullPathName() + "/" + file.getFileName();
@@ -713,18 +715,20 @@ void NeuralPiAudioProcessorEditor::loadButtonClicked()
std::sort(processor.jsonFiles.begin(), processor.jsonFiles.end());
}
}
- }
+ });
setParamKnobColor();
}
void NeuralPiAudioProcessorEditor::loadIRClicked()
{
- FileChooser chooser("Select one or more .wav IR files to import",
- {},
- "*.wav");
- if (chooser.browseForMultipleFilesToOpen())
+ myChooser = std::make_unique<FileChooser> ("Select one or more .wav IR files to import",
+ File::getSpecialLocation (File::userDesktopDirectory),
+ "*.wav");
+
+ auto folderChooserFlags = FileBrowserComponent::openMode | FileBrowserComponent::canSelectFiles | FileBrowserComponent::canSelectMultipleItems;
+
+ myChooser->launchAsync (folderChooserFlags, [this] (const FileChooser& chooser)
{
- int import_fail = 1;
Array<File> files = chooser.getResults();
for (auto file : files) {
File fullpath = processor.userAppDataDirectory_irs.getFullPathName() + "/" + file.getFileName();
@@ -749,7 +753,7 @@ void NeuralPiAudioProcessorEditor::loadIRClicked()
std::sort(processor.irFiles.begin(), processor.irFiles.end());
}
}
- }
+ });
}
@@ -1101,4 +1105,4 @@ void NeuralPiAudioProcessorEditor::setParamKnobColor()
ampMasterKnob.setLookAndFeel(&redLookAndFeel);
}
-}
-\ No newline at end of file
+}