Ability to disable shortkeys, fixes #305

This commit is contained in:
James Barnsley
2018-06-29 15:00:23 +12:00
parent 82fa3354c6
commit b02563fcac
6 changed files with 85 additions and 53 deletions

View File

@ -112,6 +112,10 @@ class App extends React.Component{
shouldTriggerShortcut(e){
if (!this.props.shortkeys_enabled){
return false;
}
// When we're focussed on certian elements, don't fire any shortcuts
// Typically form inputs
var ignoreNodes = ['INPUT', 'TEXTAREA'];
@ -327,6 +331,7 @@ class App extends React.Component{
const mapStateToProps = (state, ownProps) => {
return {
shortkeys_enabled: state.ui.shortkeys_enabled,
allow_reporting: state.ui.allow_reporting,
touch_dragging: state.ui.touch_dragging,
initial_setup_complete: state.ui.initial_setup_complete,

1
src/js/bootstrap.js vendored
View File

@ -48,6 +48,7 @@ var initialState = {
http_streaming_url: "http://"+window.location.hostname+":8000/mopidy"
},
ui: {
shortkeys_enabled: true,
allow_reporting: true,
slim_mode: false,
selected_tracks: [],

View File

@ -256,24 +256,22 @@ class Settings extends React.Component {
<h4 className="underline">Services</h4>
<Services active={this.props.params.sub_view} />
{helpers.isHosted() ? null : <div>
<h4 className="underline">Privacy</h4>
{helpers.isHosted() ? null : <h4 className="underline">Privacy</h4>}
<div className="field checkbox">
<div className="name">Reporting</div>
<div className="input">
<label>
<input
type="checkbox"
name="allow_reporting"
checked={ this.props.ui.allow_reporting }
onChange={ e => this.props.uiActions.set({ allow_reporting: !this.props.ui.allow_reporting })} />
<span className="label">
Allow reporting of anonymous usage statistics
</span>
</label>
<div className="description">Anonymous usage data is used to identify errors and potential features that make Iris better for everyone. Read the <a href="https://github.com/jaedb/Iris/wiki/Terms-of-use#privacy-policy" target="_blank">privacy policy</a>.</div>
</div>
{helpers.isHosted() ? null : <div className="field checkbox">
<div className="name">Reporting</div>
<div className="input">
<label>
<input
type="checkbox"
name="allow_reporting"
checked={ this.props.ui.allow_reporting }
onChange={ e => this.props.uiActions.set({ allow_reporting: !this.props.ui.allow_reporting })} />
<span className="label">
Allow reporting of anonymous usage statistics
</span>
</label>
<div className="description">Anonymous usage data is used to identify errors and potential features that make Iris better for everyone. Read the <a href="https://github.com/jaedb/Iris/wiki/Terms-of-use#privacy-policy" target="_blank">privacy policy</a>.</div>
</div>
</div>}
@ -293,6 +291,16 @@ class Settings extends React.Component {
<span className="tooltip">Playing one or more URIs will clear the current play queue first</span>
</span>
</label>
<label>
<input
type="checkbox"
name="shortkeys_enabled"
checked={ this.props.ui.shortkeys_enabled }
onChange={ e => this.props.uiActions.set({ shortkeys_enabled: !this.props.ui.shortkeys_enabled })} />
<span className="label">
Enable shortkeys
</span>
</label>
</div>
</div>