From c3682f5d32dbd63ec3ce514f62241c975609abe1 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Tue, 31 Dec 2013 09:12:28 +0000 Subject: [PATCH] * fix some interaction issues --- source/net/sourceforge/filebot/Language.java | 7 +------ .../filebot/ui/LanguageComboBox.java | 6 +++++- .../filebot/ui/LanguageComboBoxModel.java | 2 +- .../ui/subtitle/SubtitleUploadDialog.java | 18 +++++++++--------- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/source/net/sourceforge/filebot/Language.java b/source/net/sourceforge/filebot/Language.java index 3398f9e2..fc2d17a6 100644 --- a/source/net/sourceforge/filebot/Language.java +++ b/source/net/sourceforge/filebot/Language.java @@ -68,11 +68,7 @@ public class Language implements Serializable { String[] values = bundle.getString(code).split("\\t", 2); return new Language(code, values[0], values[1]); } catch (Exception e) { - if (code == null || code.isEmpty()) { - return null; - } - Locale locale = new Locale(code); - return new Language(locale.getLanguage(), locale.getISO3Language(), locale.getDisplayLanguage(Locale.ENGLISH)); + return null; } } @@ -94,7 +90,6 @@ public class Language implements Serializable { return it; } } - return new Language(code, locale.getISO3Language(), locale.getDisplayName(Locale.ENGLISH)); } return null; } diff --git a/source/net/sourceforge/filebot/ui/LanguageComboBox.java b/source/net/sourceforge/filebot/ui/LanguageComboBox.java index 5a8af121..1a59ecc0 100644 --- a/source/net/sourceforge/filebot/ui/LanguageComboBox.java +++ b/source/net/sourceforge/filebot/ui/LanguageComboBox.java @@ -37,7 +37,11 @@ public class LanguageComboBox extends JComboBox { } // restore selected language - getModel().setSelectedItem(Language.getLanguage(persistentSelectedLanguage.getValue())); + try { + getModel().setSelectedItem(Language.getLanguage(persistentSelectedLanguage.getValue())); + } catch (Exception e) { + getModel().setSelectedItem(LanguageComboBoxModel.ALL_LANGUAGES); + } // restore favorite languages for (String favoriteLanguage : persistentFavoriteLanguages) { diff --git a/source/net/sourceforge/filebot/ui/LanguageComboBoxModel.java b/source/net/sourceforge/filebot/ui/LanguageComboBoxModel.java index 428575c3..903b5846 100644 --- a/source/net/sourceforge/filebot/ui/LanguageComboBoxModel.java +++ b/source/net/sourceforge/filebot/ui/LanguageComboBoxModel.java @@ -14,7 +14,7 @@ import net.sourceforge.filebot.Language; public class LanguageComboBoxModel extends AbstractListModel implements ComboBoxModel { - public static final Language ALL_LANGUAGES = new Language("", "", "All Languages"); + public static final Language ALL_LANGUAGES = new Language("undefined", "undefined", "All Languages"); private Language defaultLanguage; private Language selection; diff --git a/source/net/sourceforge/filebot/ui/subtitle/SubtitleUploadDialog.java b/source/net/sourceforge/filebot/ui/subtitle/SubtitleUploadDialog.java index 0ad748c9..9693889e 100644 --- a/source/net/sourceforge/filebot/ui/subtitle/SubtitleUploadDialog.java +++ b/source/net/sourceforge/filebot/ui/subtitle/SubtitleUploadDialog.java @@ -50,9 +50,9 @@ import javax.swing.table.TableCellRenderer; import net.miginfocom.swing.MigLayout; import net.sourceforge.filebot.Analytics; +import net.sourceforge.filebot.Language; import net.sourceforge.filebot.ResourceManager; import net.sourceforge.filebot.media.MediaDetection; -import net.sourceforge.filebot.Language; import net.sourceforge.filebot.ui.LanguageComboBox; import net.sourceforge.filebot.ui.SelectDialog; import net.sourceforge.filebot.web.Movie; @@ -427,7 +427,7 @@ public class SubtitleUploadDialog extends JDialog { icon = ResourceManager.getIcon("action.export"); break; case IdentificationRequired: - text = "Unable to auto-detect movie / series info"; + text = "Please input the missing information"; icon = ResourceManager.getIcon("dialog.continue.invalid"); break; case UploadReady: @@ -454,7 +454,7 @@ public class SubtitleUploadDialog extends JDialog { } } - private static class SubtitleMappingTableModel extends AbstractTableModel { + private class SubtitleMappingTableModel extends AbstractTableModel { private final SubtitleMapping[] data; @@ -518,6 +518,11 @@ public class SubtitleUploadDialog extends JDialog { public void setValueAt(Object value, int row, int column) { if (getColumnClass(column) == Language.class && value instanceof Language) { data[row].setLanguage((Language) value); + + if (data[row].getStatus() == SubtitleMapping.Status.IdentificationRequired) { + data[row].setState(SubtitleMapping.Status.CheckPending); + startChecking(); + } } } @@ -657,11 +662,6 @@ public class SubtitleUploadDialog extends JDialog { } } - // default to English - if (mapping.getLanguage() == null) { - mapping.setLanguage(Language.getLanguage("en")); - } - if (mapping.getIdentity() == null) { mapping.setState(SubtitleMapping.Status.Identifying); try { @@ -680,7 +680,7 @@ public class SubtitleUploadDialog extends JDialog { } } - if (mapping.getIdentity() == null) { + if (mapping.getIdentity() == null || mapping.getLanguage() == null) { mapping.setState(SubtitleMapping.Status.IdentificationRequired); } else { mapping.setState(SubtitleMapping.Status.UploadReady);