* Fix: PresetEditor doesn't restore Language combo box

@see https://www.filebot.net/forums/viewtopic.php?f=6&t=3164
This commit is contained in:
Reinhard Pointner 2015-11-10 13:13:37 +00:00
parent e6dbd4538e
commit 0b69adbbc9
3 changed files with 14 additions and 3 deletions

View File

@ -145,8 +145,8 @@ public class Preset {
}
}
public Locale getLanguage() {
return language == null || language.isEmpty() ? null : new Locale(language);
public Language getLanguage() {
return language == null || language.isEmpty() ? null : Language.getLanguage(language);
}
public StandardRenameAction getRenameAction() {

View File

@ -12,6 +12,7 @@ import java.awt.event.ActionEvent;
import java.io.File;
import java.util.EnumSet;
import java.util.List;
import java.util.Locale;
import java.util.logging.Level;
import javax.swing.AbstractAction;
@ -169,6 +170,16 @@ public class PresetEditor extends JDialog {
matchModeCombo.setSelectedItem(p.getMatchMode() == null ? RenamePanel.MATCH_MODE_OPPORTUNISTIC : p.getMatchMode());
actionCombo.setSelectedItem(p.getRenameAction() == null ? StandardRenameAction.MOVE : p.getRenameAction());
// ugly hack, since Language objects only do object equality
if (p.getLanguage() != null && !p.getLanguage().getCode().equals(((Language) languageCombo.getSelectedItem()).getCode())) {
for (int i = 0; i < languageCombo.getModel().getSize(); i++) {
if (p.getLanguage().getCode().equals(languageCombo.getModel().getElementAt(i).getCode())) {
languageCombo.setSelectedIndex(i);
break;
}
}
}
selectRadio.setSelected(p.getInputFolder() != null);
updateComponentStates();
}

View File

@ -722,7 +722,7 @@ public class RenamePanel extends JComponent {
@Override
public Locale getLocale(ActionEvent evt) {
return preset.getLanguage() != null ? preset.getLanguage() : super.getLocale(evt);
return preset.getLanguage() != null ? preset.getLanguage().getLocale() : super.getLocale(evt);
}
@Override