* Subtitle Actions: Save as = Select file(s); Export = Select folder

This commit is contained in:
Reinhard Pointner 2015-05-17 08:39:49 +00:00
parent 877deb7d63
commit 1c99bd44a2
1 changed files with 9 additions and 11 deletions

View File

@ -275,13 +275,11 @@ class SubtitleDownloadComponent extends JComponent {
private void save(Object[] selection) { private void save(Object[] selection) {
try { try {
// multiple files for (Object object : selection) {
File outputFolder = showOpenDialogSelectFolder(null, "Save Subtitles", new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "Save")); MemoryFile data = (MemoryFile) object;
if (outputFolder != null) { File destination = showSaveDialogSelectFile(false, new File(validateFileName(data.getName())), "Save Subtitles as ...", new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "Save"));
for (Object object : selection) { if (destination != null) {
MemoryFile file = (MemoryFile) object; writeFile(data.getData(), destination);
File destination = new File(outputFolder, validateFileName(file.getName()));
writeFile(file.getData(), destination);
} }
} }
} catch (Exception e) { } catch (Exception e) {
@ -298,10 +296,10 @@ class SubtitleDownloadComponent extends JComponent {
long selectedTimingOffset = 0; long selectedTimingOffset = 0;
Charset selectedEncoding = Charset.forName("UTF-8"); Charset selectedEncoding = Charset.forName("UTF-8");
// just use default values when we can't use a JFC with accessory component // just use default values when we can't use a JFC with accessory component (also Swing OSX LaF doesn't seem to support JFileChooser::setAccessory)
if (Settings.isMacSandbox()) { if (Settings.isMacApp()) {
// AWT // COCOA || AWT
selectedOutputFolder = showOpenDialogSelectFolder(null, "Export Subtitles", new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "Export")); selectedOutputFolder = showOpenDialogSelectFolder(null, "Export Subtitles to folder", new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "Export"));
} else { } else {
// Swing // Swing
SubtitleFileChooser sfc = new SubtitleFileChooser(); SubtitleFileChooser sfc = new SubtitleFileChooser();