mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-30 16:02:00 +02:00
Customize external subtitles font
This commit is contained in:
@@ -193,12 +193,10 @@ class ClapperPrefsDialog extends Gtk.Dialog
|
||||
title: 'Audio',
|
||||
widget: Prefs.AudioPage,
|
||||
},
|
||||
/*
|
||||
{
|
||||
title: 'Subtitles',
|
||||
widget: Prefs.SubtitlesPage,
|
||||
}
|
||||
*/
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@@ -89,7 +89,8 @@ class ClapperPlayerBase extends GstPlayer.Player
|
||||
for(let key of settingsToSet)
|
||||
this._onSettingsKeyChanged(settings, key);
|
||||
|
||||
//let flag = Gio.SettingsBindFlags.GET;
|
||||
let flag = Gio.SettingsBindFlags.GET;
|
||||
settings.bind('subtitle-font', this.pipeline, 'subtitle_font_desc', flag);
|
||||
}
|
||||
|
||||
set_initial_config()
|
||||
@@ -123,13 +124,6 @@ class ClapperPlayerBase extends GstPlayer.Player
|
||||
debug(`could not change option: ${option}`);
|
||||
}
|
||||
|
||||
/* FIXME: add in prefs and move to bind_settings() */
|
||||
set_subtitle_font_desc(desc)
|
||||
{
|
||||
let pipeline = this.get_pipeline();
|
||||
pipeline.subtitle_font_desc = desc;
|
||||
}
|
||||
|
||||
set_all_plugins_ranks()
|
||||
{
|
||||
let data = [];
|
||||
|
@@ -84,8 +84,13 @@ class ClapperSubtitlesPage extends PrefsBase.Grid
|
||||
{
|
||||
super._init();
|
||||
|
||||
this.addTitle('Synchronization');
|
||||
this.addSpinButton('Offset (milliseconds)', -5000, 5000, 'subtitle-offset', 25);
|
||||
/* FIXME: This should be moved to subtitles popup and displayed only when
|
||||
external subtitles were added for easier customization per video. */
|
||||
//this.addTitle('Synchronization');
|
||||
//this.addSpinButton('Offset (milliseconds)', -5000, 5000, 'subtitle-offset', 25);
|
||||
|
||||
this.addTitle('External Subtitles');
|
||||
this.addFontButton('Default font', 'subtitle-font');
|
||||
}
|
||||
});
|
||||
|
||||
|
@@ -127,6 +127,14 @@ class ClapperPrefsGrid extends Gtk.Grid
|
||||
return this.addToGrid(widget);
|
||||
}
|
||||
|
||||
addFontButton(text, setting)
|
||||
{
|
||||
let label = this.getLabel(text + ':');
|
||||
let widget = this.getFontButton(setting);
|
||||
|
||||
return this.addToGrid(label, widget);
|
||||
}
|
||||
|
||||
getLabel(text, isTitle)
|
||||
{
|
||||
let marginLR = 0;
|
||||
@@ -185,6 +193,17 @@ class ClapperPrefsGrid extends Gtk.Grid
|
||||
return checkButton;
|
||||
}
|
||||
|
||||
getFontButton(setting)
|
||||
{
|
||||
let fontButton = new Gtk.FontButton({
|
||||
use_font: true,
|
||||
use_size: true,
|
||||
});
|
||||
settings.bind(setting, fontButton, 'font', this.flag);
|
||||
|
||||
return fontButton;
|
||||
}
|
||||
|
||||
_onClose(name)
|
||||
{
|
||||
if(name)
|
||||
|
Reference in New Issue
Block a user