Convenient ways of opening external subtitles

Play video with external subtiles by:
* selecting and opening both video+subs from file chooser/manager
* dropping subtitles file on player window
* opening subtiles from file chooser/manager while video plays
* send their file path/uri to player via WebSocket message
This commit is contained in:
Rafał Dzięgiel
2021-04-07 13:52:51 +02:00
parent 28d8986072
commit b15b94fc90
7 changed files with 92 additions and 86 deletions

View File

@@ -59,6 +59,17 @@ class ClapperAppBase extends Gtk.Application
);
}
_openFiles(files)
{
const [playlist, subs] = Misc.parsePlaylistFiles(files);
const { player } = this.active_window.get_child();
if(playlist && playlist.length)
player.set_playlist(playlist);
if(subs)
player.set_subtitles(subs);
}
_onFirstActivate()
{
const gtkSettings = Gtk.Settings.get_default();
@@ -71,19 +82,9 @@ class ClapperAppBase extends Gtk.Application
this._onIconThemeChanged(gtkSettings);
gtkSettings.connect('notify::gtk-theme-name', this._onThemeChanged.bind(this));
gtkSettings.connect('notify::gtk-icon-theme-name', this._onIconThemeChanged.bind(this));
this.windowShowSignal = this.active_window.connect(
'show', this._onWindowShow.bind(this)
);
this.doneFirstActivate = true;
}
_onWindowShow(window)
{
window.disconnect(this.windowShowSignal);
this.windowShowSignal = null;
}
_onThemeChanged(gtkSettings)
{
const theme = gtkSettings.gtk_theme_name;