Merge pull request #746 from feross/fix-700

Fix 700
This commit is contained in:
Feross Aboukhadijeh
2016-07-27 16:04:29 -07:00
committed by GitHub
6 changed files with 10 additions and 9 deletions

View File

@@ -8,7 +8,6 @@ module.exports = {
var electron = require('electron') var electron = require('electron')
var config = require('../config')
var log = require('./log') var log = require('./log')
var windows = require('./windows') var windows = require('./windows')
@@ -118,5 +117,5 @@ function setTitle (title) {
} }
function resetTitle () { function resetTitle () {
setTitle(config.APP_WINDOW_TITLE) windows.main.dispatch('resetTitle')
} }

View File

@@ -115,8 +115,8 @@ function init () {
}) })
}) })
ipc.on('vlcPlay', function (e, url) { ipc.on('vlcPlay', function (e, url, title) {
var args = ['--play-and-exit', '--video-on-top', '--no-video-title-show', '--quiet', url] var args = ['--play-and-exit', '--video-on-top', '--no-video-title-show', '--quiet', `--meta-title=${title}`, url]
log('Running vlc ' + args.join(' ')) log('Running vlc ' + args.join(' '))
vlc.spawn(args, function (err, proc) { vlc.spawn(args, function (err, proc) {

View File

@@ -43,7 +43,7 @@ module.exports = class MediaController {
} }
vlcPlay () { vlcPlay () {
ipcRenderer.send('vlcPlay', this.state.server.localURL) ipcRenderer.send('vlcPlay', this.state.server.localURL, this.state.window.title)
this.state.playing.location = 'vlc' this.state.playing.location = 'vlc'
} }

View File

@@ -242,7 +242,7 @@ module.exports = class PlaybackController {
} }
// otherwise, play the video // otherwise, play the video
state.window.title = torrentSummary.files[state.playing.fileIndex].name dispatch('setTitle', torrentSummary.files[state.playing.fileIndex].name)
this.update() this.update()
ipcRenderer.send('onPlayerOpen') ipcRenderer.send('onPlayerOpen')
@@ -274,7 +274,7 @@ module.exports = class PlaybackController {
else console.error('Unknown state.playing.result', state.playing.result) else console.error('Unknown state.playing.result', state.playing.result)
// Reset the window contents back to the home screen // Reset the window contents back to the home screen
state.window.title = this.config.APP_WINDOW_TITLE dispatch('resetTitle')
state.playing = State.getDefaultPlayState() state.playing = State.getDefaultPlayState()
state.server = null state.server = null

View File

@@ -1,3 +1,4 @@
const {dispatch} = require('../lib/dispatcher')
const State = require('../lib/state') const State = require('../lib/state')
// Controls the Preferences screen // Controls the Preferences screen
@@ -14,14 +15,14 @@ module.exports = class PrefsController {
url: 'preferences', url: 'preferences',
onbeforeload: function (cb) { onbeforeload: function (cb) {
// initialize preferences // initialize preferences
state.window.title = 'Preferences' dispatch('setTitle', 'Preferences')
state.unsaved = Object.assign(state.unsaved || {}, {prefs: state.saved.prefs || {}}) state.unsaved = Object.assign(state.unsaved || {}, {prefs: state.saved.prefs || {}})
cb() cb()
}, },
onbeforeunload: (cb) => { onbeforeunload: (cb) => {
// save state after preferences // save state after preferences
this.save() this.save()
state.window.title = this.config.APP_WINDOW_TITLE dispatch('resetTitle')
cb() cb()
} }
}) })

View File

@@ -219,6 +219,7 @@ const dispatchHandlers = {
'setDimensions': setDimensions, 'setDimensions': setDimensions,
'toggleFullScreen': (setTo) => ipcRenderer.send('toggleFullScreen', setTo), 'toggleFullScreen': (setTo) => ipcRenderer.send('toggleFullScreen', setTo),
'setTitle': (title) => { state.window.title = title }, 'setTitle': (title) => { state.window.title = title },
'resetTitle': () => { state.window.title = config.APP_WINDOW_TITLE },
// Everything else // Everything else
'onOpen': onOpen, 'onOpen': onOpen,