</packing>
</child>
<child>
- <object class="GtkRadioButton" id="SubtitleSrtDisable">
+ <object class="GtkRadioButton" id="SubtitleSsaEnable">
+ <property name="label" translatable="yes">Import SSA</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="tooltip_text" translatable="yes">Enable settings to import an SSA subtitle file</property>
+ <property name="halign">start</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">SubtitleSrtEnable</property>
+ <signal name="toggled" handler="subtitle_import_radio_toggled_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="SubtitleImportDisable">
<property name="label" translatable="yes">Embedded Subtitle List</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">start</property>
<property name="draw_indicator">True</property>
<property name="group">SubtitleSrtEnable</property>
+ <signal name="toggled" handler="subtitle_import_radio_toggled_cb" swapped="no"/>
</object>
<packing>
<property name="position">1</property>
import = ghb_dict_get(subsettings, "Import");
if (import != NULL)
{
- const gchar *format = "SRT";
- const gchar *code;
- const gchar *lang;
+ const gchar * format = "SRT";
+ const gchar * code;
+ const gchar * lang;
+ int source = IMPORTSRT;
const iso639_lang_t *iso;
format = ghb_dict_get_string(import, "Format");
- lang = ghb_dict_get_string(import, "Language");
- code = ghb_dict_get_string(import, "Codeset");
+ lang = ghb_dict_get_string(import, "Language");
+ code = ghb_dict_get_string(import, "Codeset");
+ if (format != NULL && !strcasecmp(format, "SSA"))
+ {
+ source = IMPORTSSA;
+ }
iso = lang_lookup(lang);
if (iso != NULL)
{
lang = iso->eng_name;
}
- if (code != NULL)
+ if (source == IMPORTSRT)
{
desc = g_strdup_printf("%s (%s)(%s)", lang, code, format);
}
import = ghb_dict_get(subsettings, "Import");
if (import != NULL)
{
- const gchar *format = "SRT";
- const gchar *filename, *code;
- const gchar *lang;
+ const gchar * format = "SRT";
+ const gchar * filename, *code;
+ const gchar * lang;
+ int source = IMPORTSRT;
const iso639_lang_t *iso;
- format = ghb_dict_get_string(import, "Format");
- lang = ghb_dict_get_string(import, "Language");
- code = ghb_dict_get_string(import, "Codeset");
+ format = ghb_dict_get_string(import, "Format");
+ lang = ghb_dict_get_string(import, "Language");
+ code = ghb_dict_get_string(import, "Codeset");
filename = ghb_dict_get_string(import, "Filename");
+ if (format != NULL && !strcasecmp(format, "SSA"))
+ {
+ source = IMPORTSSA;
+ }
iso = lang_lookup(lang);
if (iso != NULL)
{
gchar *basename;
basename = g_path_get_basename(filename);
- if (code != NULL)
+ if (source == IMPORTSRT)
{
desc = g_strdup_printf("%s (%s)(%s)(%s)",
lang, code, format, basename);
}
else
{
- if (code != NULL)
+ if (source == IMPORTSRT)
{
desc = g_strdup_printf("%s (%s)(%s)", lang, code, format);
}
const gchar * format = "SRT";
const gchar * filename, * code;
const gchar * lang;
+ int source = IMPORTSRT;
const iso639_lang_t * iso;
format = ghb_dict_get_string(import, "Format");
lang = ghb_dict_get_string(import, "Language");
code = ghb_dict_get_string(import, "Codeset");
+ if (format != NULL && !strcasecmp(format, "SSA"))
+ {
+ source = IMPORTSSA;
+ }
iso = lang_lookup(lang);
if (iso != NULL)
{
gchar *basename;
basename = g_path_get_basename(filename);
- if (code != NULL)
+ if (source == IMPORTSRT)
{
desc = g_strdup_printf("%s (%s)(%s)(%s)",
lang, code, format, basename);
}
else
{
- if (code != NULL)
+ if (source == IMPORTSRT)
{
desc = g_strdup_printf("%s (%s)(%s)", lang, code, format);
}
const hb_title_t *title = ghb_lookup_title(title_id, NULL);
if (title != NULL)
{
- w = GHB_WIDGET(ud->builder, "SubtitleSrtDisable");
+ w = GHB_WIDGET(ud->builder, "SubtitleImportDisable");
gtk_widget_set_sensitive(w, !!hb_list_count(title->list_subtitle));
}
}
if (sub_count == 0)
{
// No source subtitles
- widget = GHB_WIDGET(ud->builder, "SubtitleSrtDisable");
- gtk_widget_set_sensitive(widget, FALSE);
+ widget = GHB_WIDGET(ud->builder, "SubtitleSrtEnable");
+ gtk_widget_set_sensitive(widget, TRUE);
}
else
{
- widget = GHB_WIDGET(ud->builder, "SubtitleSrtDisable");
+ widget = GHB_WIDGET(ud->builder, "SubtitleImportDisable");
gtk_widget_set_sensitive(widget, TRUE);
}
GhbValue *job = ghb_get_job_settings(ud->settings);
if (import != NULL)
{
- ghb_ui_update(ud, "SubtitleSrtEnable", ghb_boolean_value(TRUE));
+ if (source == IMPORTSSA)
+ {
+ ghb_ui_update(ud, "SubtitleSsaEnable", ghb_boolean_value(TRUE));
+ }
+ else
+ {
+ ghb_ui_update(ud, "SubtitleSrtEnable", ghb_boolean_value(TRUE));
+ }
val = ghb_dict_get(import, "Language");
ghb_ui_update(ud, "ImportLanguage", val);
val = ghb_dict_get(import, "Codeset");
}
else
{
- ghb_ui_update(ud, "SubtitleSrtDisable", ghb_boolean_value(TRUE));
+ ghb_ui_update(ud, "SubtitleImportDisable", ghb_boolean_value(TRUE));
}
widget = GHB_WIDGET(ud->builder, "SubtitleBurned");
GhbValue *subsettings;
ghb_widget_to_setting(ud->settings, widget);
+ if (!ghb_dict_get_bool(ud->settings, "SubtitleSrtEnable") &&
+ !ghb_dict_get_bool(ud->settings, "SubtitleSsaEnable") &&
+ !ghb_dict_get_bool(ud->settings, "SubtitleImportDisable"))
+ {
+ // Radio buttons are in an in-between state with none enabled.
+ // Wait for the next toggle when something gets enabled.
+ return;
+ }
subsettings = subtitle_get_selected_settings(ud, NULL);
if (subsettings != NULL)
{
- if (ghb_dict_get_bool(ud->settings, "SubtitleSrtEnable"))
+ if (ghb_dict_get_bool(ud->settings, "SubtitleSrtEnable") ||
+ ghb_dict_get_bool(ud->settings, "SubtitleSsaEnable"))
{
const gchar *pref_lang, *dir;
gchar *filename;
- GhbValue *srt = ghb_dict_new();
+ GhbValue *import = ghb_dict_get(subsettings, "Import");
- ghb_dict_set(subsettings, "Import", srt);
- pref_lang = ghb_dict_get_string(ud->settings, "PreferredLanguage");
- ghb_dict_set_string(srt, "Language", pref_lang);
- ghb_dict_set_string(srt, "Codeset", "UTF-8");
-
- dir = ghb_dict_get_string(ud->prefs, "SrtDir");
- filename = g_strdup_printf("%s/none", dir);
- ghb_dict_set_string(srt, "Filename", filename);
- g_free(filename);
+ if (import == NULL)
+ {
+ import = ghb_dict_new();
+ ghb_dict_set(subsettings, "Import", import);
+ pref_lang = ghb_dict_get_string(ud->settings, "PreferredLanguage");
+ ghb_dict_set_string(import, "Language", pref_lang);
+ ghb_dict_set_string(import, "Codeset", "UTF-8");
+
+ dir = ghb_dict_get_string(ud->prefs, "SrtDir");
+ filename = g_strdup_printf("%s/none", dir);
+ ghb_dict_set_string(import, "Filename", filename);
+ g_free(filename);
+ }
+ ghb_dict_set_string(import, "Format",
+ hb_dict_get_bool(ud->settings, "SubtitleSrtEnable") ?
+ "SRT" : "SSA");
}
else
{