* 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:
parent
e6dbd4538e
commit
0b69adbbc9
|
@ -145,8 +145,8 @@ public class Preset {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Locale getLanguage() {
|
public Language getLanguage() {
|
||||||
return language == null || language.isEmpty() ? null : new Locale(language);
|
return language == null || language.isEmpty() ? null : Language.getLanguage(language);
|
||||||
}
|
}
|
||||||
|
|
||||||
public StandardRenameAction getRenameAction() {
|
public StandardRenameAction getRenameAction() {
|
||||||
|
|
|
@ -12,6 +12,7 @@ import java.awt.event.ActionEvent;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import javax.swing.AbstractAction;
|
import javax.swing.AbstractAction;
|
||||||
|
@ -169,6 +170,16 @@ public class PresetEditor extends JDialog {
|
||||||
matchModeCombo.setSelectedItem(p.getMatchMode() == null ? RenamePanel.MATCH_MODE_OPPORTUNISTIC : p.getMatchMode());
|
matchModeCombo.setSelectedItem(p.getMatchMode() == null ? RenamePanel.MATCH_MODE_OPPORTUNISTIC : p.getMatchMode());
|
||||||
actionCombo.setSelectedItem(p.getRenameAction() == null ? StandardRenameAction.MOVE : p.getRenameAction());
|
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);
|
selectRadio.setSelected(p.getInputFolder() != null);
|
||||||
updateComponentStates();
|
updateComponentStates();
|
||||||
}
|
}
|
||||||
|
|
|
@ -722,7 +722,7 @@ public class RenamePanel extends JComponent {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Locale getLocale(ActionEvent evt) {
|
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
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue