Major refactor -- split windows into separate files

This commit is contained in:
Feross Aboukhadijeh
2016-05-27 00:01:30 -07:00
parent 3757507b18
commit 001601bc5f
15 changed files with 464 additions and 358 deletions

View File

@@ -606,7 +606,8 @@ function saveState () {
update()
}
// Called when the user drag-drops files onto the app
// Called when the user adds files (.torrent, files to seed, subtitles) to the app
// via any method (drag-drop, drag to app icon, command line)
function onOpen (files) {
if (!Array.isArray(files)) files = [ files ]
@@ -674,12 +675,13 @@ function addTorrent (torrentId) {
}
function addSubtitles (files, autoSelect) {
// Subtitles are only supported while playing video
// Subtitles are only supported when playing video files
if (state.playing.type !== 'video') return
if (files.length === 0) return
// Read the files concurrently, then add all resulting subtitle tracks
var jobs = files.map((file) => (cb) => loadSubtitle(file, cb))
parallel(jobs, function (err, tracks) {
var tasks = files.map((file) => (cb) => loadSubtitle(file, cb))
parallel(tasks, function (err, tracks) {
if (err) return onError(err)
for (var i = 0; i < tracks.length; i++) {