1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-17 14:55:09 -05:00

* fix some interaction issues

This commit is contained in:
Reinhard Pointner 2013-12-31 09:12:28 +00:00
parent b2b0610579
commit c3682f5d32
4 changed files with 16 additions and 17 deletions

View File

@ -68,12 +68,8 @@ public class Language implements Serializable {
String[] values = bundle.getString(code).split("\\t", 2); String[] values = bundle.getString(code).split("\\t", 2);
return new Language(code, values[0], values[1]); return new Language(code, values[0], values[1]);
} catch (Exception e) { } catch (Exception e) {
if (code == null || code.isEmpty()) {
return null; return null;
} }
Locale locale = new Locale(code);
return new Language(locale.getLanguage(), locale.getISO3Language(), locale.getDisplayLanguage(Locale.ENGLISH));
}
} }
public static List<Language> getLanguages(String... codes) { public static List<Language> getLanguages(String... codes) {
@ -94,7 +90,6 @@ public class Language implements Serializable {
return it; return it;
} }
} }
return new Language(code, locale.getISO3Language(), locale.getDisplayName(Locale.ENGLISH));
} }
return null; return null;
} }

View File

@ -37,7 +37,11 @@ public class LanguageComboBox extends JComboBox {
} }
// restore selected language // restore selected language
try {
getModel().setSelectedItem(Language.getLanguage(persistentSelectedLanguage.getValue())); getModel().setSelectedItem(Language.getLanguage(persistentSelectedLanguage.getValue()));
} catch (Exception e) {
getModel().setSelectedItem(LanguageComboBoxModel.ALL_LANGUAGES);
}
// restore favorite languages // restore favorite languages
for (String favoriteLanguage : persistentFavoriteLanguages) { for (String favoriteLanguage : persistentFavoriteLanguages) {

View File

@ -14,7 +14,7 @@ import net.sourceforge.filebot.Language;
public class LanguageComboBoxModel extends AbstractListModel implements ComboBoxModel { 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 defaultLanguage;
private Language selection; private Language selection;

View File

@ -50,9 +50,9 @@ import javax.swing.table.TableCellRenderer;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import net.sourceforge.filebot.Analytics; import net.sourceforge.filebot.Analytics;
import net.sourceforge.filebot.Language;
import net.sourceforge.filebot.ResourceManager; import net.sourceforge.filebot.ResourceManager;
import net.sourceforge.filebot.media.MediaDetection; import net.sourceforge.filebot.media.MediaDetection;
import net.sourceforge.filebot.Language;
import net.sourceforge.filebot.ui.LanguageComboBox; import net.sourceforge.filebot.ui.LanguageComboBox;
import net.sourceforge.filebot.ui.SelectDialog; import net.sourceforge.filebot.ui.SelectDialog;
import net.sourceforge.filebot.web.Movie; import net.sourceforge.filebot.web.Movie;
@ -427,7 +427,7 @@ public class SubtitleUploadDialog extends JDialog {
icon = ResourceManager.getIcon("action.export"); icon = ResourceManager.getIcon("action.export");
break; break;
case IdentificationRequired: case IdentificationRequired:
text = "Unable to auto-detect movie / series info"; text = "Please input the missing information";
icon = ResourceManager.getIcon("dialog.continue.invalid"); icon = ResourceManager.getIcon("dialog.continue.invalid");
break; break;
case UploadReady: 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; private final SubtitleMapping[] data;
@ -518,6 +518,11 @@ public class SubtitleUploadDialog extends JDialog {
public void setValueAt(Object value, int row, int column) { public void setValueAt(Object value, int row, int column) {
if (getColumnClass(column) == Language.class && value instanceof Language) { if (getColumnClass(column) == Language.class && value instanceof Language) {
data[row].setLanguage((Language) value); 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) { if (mapping.getIdentity() == null) {
mapping.setState(SubtitleMapping.Status.Identifying); mapping.setState(SubtitleMapping.Status.Identifying);
try { 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); mapping.setState(SubtitleMapping.Status.IdentificationRequired);
} else { } else {
mapping.setState(SubtitleMapping.Status.UploadReady); mapping.setState(SubtitleMapping.Status.UploadReady);