// @flow import * as React from 'react'; import * as fontManager from 'font-manager'; import autobind from 'autobind-decorator'; import HelpTooltip from '../help-tooltip'; import { isLinux, isMac, isWindows, UPDATE_CHANNEL_BETA, UPDATE_CHANNEL_STABLE, } from '../../../common/constants'; import type { Settings } from '../../../models/settings'; import CheckForUpdatesButton from '../check-for-updates-button'; import { setFont } from '../../../plugins/misc'; type Props = { settings: Settings, updateSetting: Function, handleToggleMenuBar: Function, handleRootCssChange: Function, }; type State = { fonts: [], }; @autobind class General extends React.PureComponent { constructor(props: Props) { super(props); this.state = { fonts: [], }; } componentDidMount() { fontManager.getAvailableFonts(allFonts => { const fonts = allFonts .filter(i => i.style.toLowerCase() === 'regular' && !i.italic) .sort((a, b) => (a.family > b.family ? 1 : -1)); this.setState({ fonts }); }); } async _handleUpdateSetting(e: SyntheticEvent): Promise { const el = e.currentTarget; let value = el.type === 'checkbox' ? el.checked : el.value; if (e.currentTarget.type === 'number') { value = parseInt(value, 10); } if (e.currentTarget.value === '__NULL__') { value = null; } return this.props.updateSetting(el.name, value); } async _handleToggleMenuBar(e: SyntheticEvent) { const settings = await this._handleUpdateSetting(e); this.props.handleToggleMenuBar(settings.autoHideMenuBar); } async _handleFontLigatureChange(el: SyntheticEvent) { const settings = await this._handleUpdateSetting(el); setFont(settings); } async _handleFontSizeChange(el: SyntheticEvent) { const settings = await this._handleUpdateSetting(el); setFont(settings); } async _handleFontChange(el: SyntheticEvent) { const settings = await this._handleUpdateSetting(el); setFont(settings); } render() { const { settings } = this.props; const { fonts } = this.state; return (
{!isMac() && (
)}

HTTP Network Proxy Enable global network proxy. Supports authentication via Basic Auth, digest, or NTLM


HTTP Network Proxy Enable global network proxy. Supports authentication via Basic Auth, digest, or NTLM

{(isWindows() || isMac()) && (
Check Now

Software Updates

)} {isLinux() && (

Software Updates

)}

Plugins


); } } export default General;