When manually adding subtitle track(s), always switch to a new track

Also fix a bug I added in the parent commit
This commit is contained in:
DC
2016-05-16 08:41:02 -07:00
parent eeda7c17c5
commit d466ed085a
2 changed files with 7 additions and 3 deletions

View File

@@ -43,7 +43,7 @@ function init () {
app.setPath('userData', config.CONFIG_PATH)
}
app.isReady = false // app ready, windows can be created
var isReady = false // app ready, windows can be created
app.ipcReady = false // main window has finished loading and IPC is ready
app.isQuitting = false
@@ -58,7 +58,7 @@ function init () {
})
app.on('ready', function () {
app.isReady = true
isReady = true
windows.createMainWindow()
windows.createWebTorrentHiddenWindow()
@@ -86,7 +86,7 @@ function init () {
})
app.on('activate', function () {
if (app.isReady) windows.createMainWindow()
if (isReady) windows.createMainWindow()
})
}

View File

@@ -423,6 +423,8 @@ function openSubtitles () {
properties: [ 'openFile' ]
}, function (filenames) {
if (!Array.isArray(filenames)) return
// autoselect the newly added subtitle tracks
state.playing.subtitles.selectedIndex = -1
addSubtitle({path: filenames[0]}, true)
})
}
@@ -543,6 +545,8 @@ function onOpen (files) {
// In the player, the only drag-drop function is adding subtitles
var isInPlayer = state.location.current().url === 'player'
if (isInPlayer) {
// always autoselect one of the newly added subtitle tracks
state.playing.subtitles.selectedIndex = -1
return files.filter(isSubtitle).forEach((file) => addSubtitle(file, true))
}