From 3874270e1168aa6270df9f5fb4a21781e639eaf3 Mon Sep 17 00:00:00 2001 From: keith Date: Wed, 28 Oct 2020 19:41:25 -0500 Subject: [PATCH] Added load model button --- SmartPedal/SmartPedal.jucer | 5 +++-- SmartPedal/Source/PluginEditor.cpp | 17 ++++++++++++----- SmartPedal/Source/PluginEditor.h | 2 +- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/SmartPedal/SmartPedal.jucer b/SmartPedal/SmartPedal.jucer index d456575..2dd1d0a 100644 --- a/SmartPedal/SmartPedal.jucer +++ b/SmartPedal/SmartPedal.jucer @@ -2,7 +2,8 @@ + jucerFormatVersion="1" pluginCode="sp1" maxBinaryFileSize="20971520" + pluginManufacturer="GuitarML"> - + diff --git a/SmartPedal/Source/PluginEditor.cpp b/SmartPedal/Source/PluginEditor.cpp index fe4811b..12def87 100644 --- a/SmartPedal/Source/PluginEditor.cpp +++ b/SmartPedal/Source/PluginEditor.cpp @@ -19,6 +19,9 @@ SmartPedalAudioProcessorEditor::SmartPedalAudioProcessorEditor (SmartPedalAudioP // editor's size to whatever you need it to // Overall Widgets + addAndMakeVisible(loadButton); + loadButton.setButtonText("LOAD MODEL"); + loadButton.addListener(this); addAndMakeVisible(modelLabel); modelLabel.setText("Model", juce::NotificationType::dontSendNotification); @@ -124,6 +127,7 @@ void SmartPedalAudioProcessorEditor::resized() // subcomponents in your editor.. //Overall Widgets + loadButton.setBounds(184, 68, 120, 20); modelSelect.setBounds(142, 36, 210, 25); modelLabel.setBounds(193, 12, 90, 25); @@ -136,20 +140,23 @@ void SmartPedalAudioProcessorEditor::resized() void SmartPedalAudioProcessorEditor::loadButtonClicked() { - FileChooser chooser("Load model directory...", + FileChooser chooser("Load a .json model...", {}, "*.json"); - if (chooser.browseForDirectory()) + if (chooser.browseForFileToOpen()) { - processor.currentDirectory = chooser.getResult(); - + File file = chooser.getResult(); + processor.loadConfig(file); } } void SmartPedalAudioProcessorEditor::buttonClicked(juce::Button* button) { - if (button == &odFootSw) + if (button == &odFootSw) { odFootSwClicked(); + } else if (button == &loadButton) { + loadButtonClicked(); + } } void SmartPedalAudioProcessorEditor::odFootSwClicked() { diff --git a/SmartPedal/Source/PluginEditor.h b/SmartPedal/Source/PluginEditor.h index 26d3951..c271293 100644 --- a/SmartPedal/Source/PluginEditor.h +++ b/SmartPedal/Source/PluginEditor.h @@ -37,7 +37,7 @@ class SmartPedalAudioProcessorEditor : public AudioProcessorEditor, // This reference is provided as a quick way for your editor to // access the processor object that created it. SmartPedalAudioProcessor& processor; - + TextButton loadButton; virtual void buttonClicked(Button* button) override; void loadButtonClicked();