Skip to content

Commit

Permalink
Merge f3651e7 into cb51af8
Browse files Browse the repository at this point in the history
  • Loading branch information
inukshuk committed Oct 1, 2019
2 parents cb51af8 + f3651e7 commit 0923dac
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 4 deletions.
2 changes: 2 additions & 0 deletions res/strings/renderer.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ en:
skip: Skip duplicate photos
import: Accept duplicate photos
prompt: Ask me every time
density:
label: DPI
export:
label: Export
note:
Expand Down
4 changes: 4 additions & 0 deletions src/components/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ class Input extends React.PureComponent {
required={this.props.isRequired}
tabIndex={this.props.tabIndex}
type={this.props.type}
max={this.props.max}
min={this.props.min}
value={this.state.value}
onBlur={this.handleBlur}
onChange={this.handleChange}
Expand Down Expand Up @@ -241,6 +243,8 @@ class Input extends React.PureComponent {
isReadOnly: bool,
isRequired: bool,
match: func.isRequired,
max: number,
min: number,
placeholder: string,
resize: bool,
tabIndex: number,
Expand Down
27 changes: 24 additions & 3 deletions src/components/prefs/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
const React = require('react')
const { TemplateSelect } = require('../template/select')
const { ResourceSelect } = require('../resource/select')
const { Input } = require('../input')
const { ipcRenderer: ipc } = require('electron')
const { ESPER, ITEM } = require('../../constants')
const { ESPER, ITEM, IMPORTS } = require('../../constants')
const { darwin } = require('../../common/os')

const {
Expand All @@ -14,7 +15,7 @@ const {
} = require('../icons')

const {
array, arrayOf, bool, func, object, shape, string
array, arrayOf, bool, func, object, shape, string, number
} = require('prop-types')

const {
Expand Down Expand Up @@ -43,6 +44,10 @@ class AppPrefs extends React.PureComponent {
this.props.onSettingsUpdate({ localtime })
}

handleDPIChange = dpi => {
this.props.onSettingsUpdate({ dpi: Number(dpi) })
}

handleTemplateChange = (values, hasChanged) => {
if (hasChanged) {
let [type, template] = Object.entries(values)[0]
Expand Down Expand Up @@ -142,6 +147,18 @@ class AppPrefs extends React.PureComponent {
name="force"
value={this.props.settings.title.force}
onChange={this.handleTitleChange}/>
<FormElement
id="prefs.app.density.label"
isCompact>
<Input
id="dpi"
min={this.props.importMin}
max={this.props.importMax}
value={this.props.settings.dpi}
onChange={this.handleDPIChange}
className="form-control"
type="number" />
</FormElement>
<hr/>
<FormSelect
id="prefs.app.style.theme"
Expand Down Expand Up @@ -268,6 +285,8 @@ class AppPrefs extends React.PureComponent {
}).isRequired,
layouts: arrayOf(string).isRequired,
locales: arrayOf(string).isRequired,
importMin: number.isRequired,
importMax: number.isRequired,
themes: arrayOf(string).isRequired,
dupOptions: arrayOf(string).isRequired,
zoomModes: arrayOf(string).isRequired,
Expand All @@ -281,7 +300,9 @@ class AppPrefs extends React.PureComponent {
locales: ['de', 'en', 'es', 'fr', 'it', 'ja'],
dupOptions: ['skip', 'import', 'prompt'],
zoomModes: [ESPER.MODE.FIT, ESPER.MODE.FILL],
printModes: ['item', 'photo', 'selection']
printModes: ['item', 'photo', 'selection'],
importMin: IMPORTS.DPIMIN,
importMax: IMPORTS.DPIMAX
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/constants/import.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict'

module.exports = {
RESTORE: 'imports.restore'
RESTORE: 'imports.restore',
DPIMAX: 300,
DPIMIN: 72
}
1 change: 1 addition & 0 deletions src/reducers/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const { darwin } = require('../common/os')
const defaults = {
debug: ARGS.debug,
dup: 'prompt',
dpi: 300,
export: {
note: {
format: {
Expand Down

0 comments on commit 0923dac

Please sign in to comment.