@@ -677,8 +677,8 @@ struct AppSettings
677677 juce::String mixerMapBounds;
678678
679679 // PDL View layout state
680- bool pdlViewHorizontal = false ;
681- bool pdlViewShowMixer = true ;
680+ bool pdlViewHorizontal = false ;
681+ bool pdlViewShowMixer = true ;
682682
683683 // Per-engine settings
684684 std::vector<EngineSettings> engines;
@@ -767,8 +767,8 @@ struct AppSettings
767767 pdlViewBounds = getString (" pdlViewBounds" );
768768 trackMapBounds = getString (" trackMapBounds" );
769769 mixerMapBounds = getString (" mixerMapBounds" );
770- pdlViewHorizontal = getInt (" pdlViewHorizontal" , 0 ) != 0 ;
771- pdlViewShowMixer = getInt (" pdlViewShowMixer" , 1 ) != 0 ;
770+ pdlViewHorizontal = getInt (" pdlViewHorizontal" , 0 ) != 0 ;
771+ pdlViewShowMixer = getInt (" pdlViewShowMixer" , 1 ) != 0 ;
772772
773773 engines.clear ();
774774 auto * engArray = obj->getProperty (" engines" ).getArray ();
@@ -865,4 +865,49 @@ struct AppSettings
865865 engines.push_back (es);
866866 return true ;
867867 }
868+
869+ public:
870+ // ------------------------------------------------------------------
871+ // Full configuration export/import (backup/restore)
872+ //
873+ // Bundles settings.json + trackmap.json + mixermap.json into a
874+ // single JSON file. Import overwrites all three and reloads.
875+ // ------------------------------------------------------------------
876+ static juce::var readJsonFile (const juce::File& f)
877+ {
878+ if (!f.existsAsFile ()) return {};
879+ return juce::JSON::parse (f.loadFileAsString ());
880+ }
881+
882+ juce::var buildExportBundle () const
883+ {
884+ auto dir = getSettingsFile ().getParentDirectory ();
885+ auto * root = new juce::DynamicObject ();
886+ root->setProperty (" stc_backup_version" , 1 );
887+ root->setProperty (" settings" , readJsonFile (getSettingsFile ()));
888+ root->setProperty (" trackmap" , readJsonFile (dir.getChildFile (" trackmap.json" )));
889+ root->setProperty (" mixermap" , readJsonFile (dir.getChildFile (" mixermap.json" )));
890+ return juce::var (root);
891+ }
892+
893+ bool applyImportBundle (const juce::var& bundle)
894+ {
895+ auto * obj = bundle.getDynamicObject ();
896+ if (!obj) return false ;
897+
898+ auto dir = getSettingsFile ().getParentDirectory ();
899+ auto settingsVar = obj->getProperty (" settings" );
900+ auto trackmapVar = obj->getProperty (" trackmap" );
901+ auto mixermapVar = obj->getProperty (" mixermap" );
902+
903+ // Write each section back to its file (only if present in bundle)
904+ if (!settingsVar.isVoid ())
905+ getSettingsFile ().replaceWithText (juce::JSON::toString (settingsVar));
906+ if (!trackmapVar.isVoid ())
907+ dir.getChildFile (" trackmap.json" ).replaceWithText (juce::JSON::toString (trackmapVar));
908+ if (!mixermapVar.isVoid ())
909+ dir.getChildFile (" mixermap.json" ).replaceWithText (juce::JSON::toString (mixermapVar));
910+
911+ return true ;
912+ }
868913};
0 commit comments