1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-08-13 17:03:45 -04: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,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;
}

View File

@ -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) {

View File

@ -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;

View File

@ -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);