MCPcopy Create free account
hub / github.com/audacity/audacity / ExportPresets

Method ExportPresets

src/effects/BasicEffectUIServices.cpp:57–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55};
56
57void BasicEffectUIServices::ExportPresets(
58 const EffectPlugin &plugin, const EffectSettings &settings) const
59{
60 wxString params;
61 plugin.SaveSettingsAsString(settings, params);
62 auto commandId = plugin.GetSquashedName(plugin.GetSymbol().Internal());
63 params = commandId.GET() + ":" + params;
64
65 auto path = SelectFile(FileNames::Operation::Presets,
66 XO("Export Effect Parameters"),
67 wxEmptyString,
68 wxEmptyString,
69 wxEmptyString,
70 PresetTypes(),
71 wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER,
72 nullptr);
73 if (path.empty()) {
74 return;
75 }
76
77 // Create/Open the file
78 wxFFile f(path, wxT("wb"));
79 if (!f.IsOpened())
80 {
81 AudacityMessageBox(
82 XO("Could not open file: \"%s\"").Format( path ),
83 XO("Error Saving Effect Presets"),
84 wxICON_EXCLAMATION,
85 NULL);
86 return;
87 }
88
89 f.Write(params);
90 if (f.Error())
91 {
92 AudacityMessageBox(
93 XO("Error writing to file: \"%s\"").Format( path ),
94 XO("Error Saving Effect Presets"),
95 wxICON_EXCLAMATION,
96 NULL);
97 }
98
99 f.Close();
100
101
102 //SetWindowTitle();
103
104}
105
106OptionalMessage BasicEffectUIServices::ImportPresets(
107 const EffectPlugin &plugin, EffectSettings &settings) const

Callers

nothing calls this directly

Calls 10

SelectFileFunction · 0.85
AudacityMessageBoxFunction · 0.85
GetSquashedNameMethod · 0.80
IsOpenedMethod · 0.80
SaveSettingsAsStringMethod · 0.45
GetSymbolMethod · 0.45
emptyMethod · 0.45
WriteMethod · 0.45
ErrorMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected