MCPcopy Create free account
hub / github.com/TypesettingTools/Aegisub / OnExtract

Method OnExtract

src/dialog_attachments.cpp:155–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153}
154
155void DialogAttachments::OnExtract(wxCommandEvent &) {
156 long i = listView->GetFirstSelected();
157 if (i == -1) return;
158
159 agi::fs::path path;
160 bool fullPath = false;
161
162 // Multiple or single?
163 if (listView->GetNextSelected(i) != -1)
164 path = wxDirSelector(_("Select the path to save the files to:"), to_wx(OPT_GET("Path/Fonts Collector Destination")->GetString())).utf8_str().data();
165 else {
166 path = SaveFileSelector(
167 _("Select the path to save the file to:"),
168 "Path/Fonts Collector Destination",
169 ass->Attachments[i].GetFileName(),
170 ".ttf", "Font Files (*.ttf)|*.ttf",
171 &d);
172 fullPath = true;
173 }
174 if (path.empty()) return;
175
176 // Loop through items in list
177 while (i != -1) {
178 auto& attach = ass->Attachments[i];
179 attach.Extract(fullPath ? path : path/attach.GetFileName());
180 i = listView->GetNextSelected(i);
181 }
182}
183
184void DialogAttachments::OnDelete(wxCommandEvent &) {
185 size_t removed = 0;

Callers

nothing calls this directly

Calls 4

SaveFileSelectorFunction · 0.85
GetFileNameMethod · 0.80
ExtractMethod · 0.80
to_wxFunction · 0.70

Tested by

no test coverage detected