Fixes to PR #682

- Rename 'playInVlc' preference to 'openExternalPlayer' since we
support more than just VLC now.
- Add default pref options to state.js
This commit is contained in:
Feross Aboukhadijeh
2016-08-20 01:19:50 -07:00
parent 667a04a41d
commit 2d3673ea33
5 changed files with 37 additions and 23 deletions

View File

@@ -25,8 +25,7 @@ function renderGeneralSection (state) {
icon: 'settings'
}, [
renderDownloadPathSelector(state),
renderFileHandlers(state),
renderExternalPlayerSelector(state)
renderFileHandlers(state)
])
}
@@ -36,24 +35,11 @@ function renderPlaybackSection (state) {
description: '',
icon: 'settings'
}, [
renderPlayInVlcSelector(state)
renderOpenExternalPlayerSelector(state),
renderExternalPlayerSelector(state)
])
}
function renderPlayInVlcSelector (state) {
return renderCheckbox({
key: 'play-in-vlc',
label: 'Play in VLC',
description: 'Media will play in VLC',
property: 'playInVlc',
value: state.saved.prefs.playInVlc
},
state.unsaved.prefs.playInVlc,
function (value) {
dispatch('updatePreferences', 'playInVlc', value)
})
}
function renderDownloadPathSelector (state) {
return renderFileSelector({
key: 'download-path',
@@ -104,7 +90,7 @@ function renderExternalPlayerSelector (state) {
properties: [ 'openFile' ]
}
},
state.unsaved.prefs.externalPlayerPath || '<VLC>', // TODO: should we get/store vlc path instead?
state.unsaved.prefs.externalPlayerPath || '<VLC>',
function (filePath) {
if (path.extname(filePath) === '.app') {
// Get executable in packaged mac app
@@ -115,6 +101,20 @@ function renderExternalPlayerSelector (state) {
})
}
function renderOpenExternalPlayerSelector (state) {
return renderCheckbox({
key: 'open-external-player',
label: 'Play in External Player',
description: 'Media will play in external player',
property: 'openExternalPlayer',
value: state.saved.prefs.openExternalPlayer
},
state.unsaved.prefs.openExternalPlayer,
function (value) {
dispatch('updatePreferences', 'openExternalPlayer', value)
})
}
// Renders a prefs section.
// - definition should be {icon, title, description}
// - controls should be an array of vdom elements