| 182 | } |
| 183 | |
| 184 | void DialogExport::OnProcess(wxCommandEvent &) { |
| 185 | if (!d.TransferDataFromWindow()) return; |
| 186 | |
| 187 | auto filename = SaveFileSelector(_("Export subtitles file"), "", "", "", SubtitleFormat::GetWildcards(1), &d); |
| 188 | if (filename.empty()) return; |
| 189 | |
| 190 | for (size_t i = 0; i < filter_list->GetCount(); ++i) { |
| 191 | if (filter_list->IsChecked(i)) |
| 192 | exporter.AddFilter(from_wx(filter_list->GetString(i))); |
| 193 | } |
| 194 | |
| 195 | try { |
| 196 | wxBusyCursor busy; |
| 197 | c->ass->Properties.export_encoding = from_wx(charset_list->GetStringSelection()); |
| 198 | exporter.Export(filename, charset_list->GetStringSelection().utf8_str().data(), &d); |
| 199 | } |
| 200 | catch (agi::UserCancelException const&) { } |
| 201 | catch (agi::Exception const& err) { |
| 202 | wxMessageBox(to_wx(err.GetMessage()), "Error exporting subtitles", wxOK | wxICON_ERROR | wxCENTER, &d); |
| 203 | } |
| 204 | catch (std::exception const& err) { |
| 205 | wxMessageBox(to_wx(err.what()), "Error exporting subtitles", wxOK | wxICON_ERROR | wxCENTER, &d); |
| 206 | } |
| 207 | catch (...) { |
| 208 | wxMessageBox("Unknown error", "Error exporting subtitles", wxOK | wxICON_ERROR | wxCENTER, &d); |
| 209 | } |
| 210 | |
| 211 | d.EndModal(0); |
| 212 | } |
| 213 | |
| 214 | void DialogExport::OnChange(wxCommandEvent &) { |
| 215 | wxString sel = filter_list->GetStringSelection(); |
nothing calls this directly
no test coverage detected