improve settings screen

pull/276/head
Mikael Finstad 6 years ago
parent 6bb175b990
commit 3efd4ef489

@ -2,6 +2,7 @@ import React from 'react';
import { IoIosCloseCircleOutline } from 'react-icons/io'; import { IoIosCloseCircleOutline } from 'react-icons/io';
import { FaClipboard } from 'react-icons/fa'; import { FaClipboard } from 'react-icons/fa';
import { motion, AnimatePresence } from 'framer-motion'; import { motion, AnimatePresence } from 'framer-motion';
import { Table } from 'evergreen-ui';
// eslint-disable-next-line import/no-extraneous-dependencies // eslint-disable-next-line import/no-extraneous-dependencies
const { clipboard } = require('electron'); const { clipboard } = require('electron');
@ -23,39 +24,40 @@ const HelpSheet = ({
<IoIosCloseCircleOutline role="button" onClick={onTogglePress} size={30} style={{ position: 'fixed', right: 0, top: 0, padding: 20 }} /> <IoIosCloseCircleOutline role="button" onClick={onTogglePress} size={30} style={{ position: 'fixed', right: 0, top: 0, padding: 20 }} />
<h1>Keyboard shortcuts</h1> <h1>Keyboard shortcuts</h1>
<ul> <div><kbd>H</kbd> Show/hide this screen</div>
<li><kbd>H</kbd> Show/hide this screen</li> <div><kbd>SPACE</kbd>, <kbd>k</kbd> Play/pause</div>
<li><kbd>SPACE</kbd>, <kbd>k</kbd> Play/pause</li> <div><kbd>J</kbd> Slow down video</div>
<li><kbd>J</kbd> Slow down video</li> <div><kbd>L</kbd> Speed up video</div>
<li><kbd>L</kbd> Speed up video</li> <div><kbd></kbd> Seek backward 1 sec</div>
<li><kbd></kbd> Seek backward 1 sec</li> <div><kbd></kbd> Seek forward 1 sec</div>
<li><kbd></kbd> Seek forward 1 sec</li> <div><kbd>.</kbd> (period) Tiny seek forward (1/60 sec)</div>
<li><kbd>.</kbd> (period) Tiny seek forward (1/60 sec)</li> <div><kbd>,</kbd> (comma) Tiny seek backward (1/60 sec)</div>
<li><kbd>,</kbd> (comma) Tiny seek backward (1/60 sec)</li> <div><kbd>I</kbd> Mark in / cut start point</div>
<li><kbd>I</kbd> Mark in / cut start point</li> <div><kbd>O</kbd> Mark out / cut end point</div>
<li><kbd>O</kbd> Mark out / cut end point</li> <div><kbd>E</kbd> Cut (export selection in the same directory)</div>
<li><kbd>E</kbd> Cut (export selection in the same directory)</li> <div><kbd>C</kbd> Capture snapshot (in the same directory)</div>
<li><kbd>C</kbd> Capture snapshot (in the same directory)</li> <div><kbd>+</kbd> Add cut segment</div>
<li><kbd>+</kbd> Add cut segment</li> <div><kbd>BACKSPACE</kbd> Remove current cut segment</div>
<li><kbd>BACKSPACE</kbd> Remove current cut segment</li> <div><kbd>D</kbd> Delete source file</div>
<li><kbd>D</kbd> Delete source file</li>
</ul>
<p style={{ fontWeight: 'bold' }}>Hover mouse over buttons to see which function they have.</p> <p style={{ fontWeight: 'bold' }}>Hover mouse over buttons in the main interface to see which function they have.</p>
<table style={{ marginTop: 40 }}> <Table style={{ marginTop: 40 }}>
<thead> <Table.Head>
<tr style={{ textAlign: 'left' }}> <Table.TextHeaderCell>
<th>Settings</th> Settings
<th>Current setting</th> </Table.TextHeaderCell>
</tr> <Table.TextHeaderCell>
</thead> Current setting
<tbody> </Table.TextHeaderCell>
</Table.Head>
<Table.Body>
{renderSettings()} {renderSettings()}
</tbody> </Table.Body>
</table> </Table>
<h1 style={{ marginTop: 40 }}>Segment list</h1> <h1 style={{ marginTop: 40 }}>Segment list</h1>
<div style={{ overflowY: 'scroll', height: 200 }}> <div style={{ overflowY: 'scroll', height: 200 }}>
{sortedCutSegments.map((seg) => ( {sortedCutSegments.map((seg) => (
<div key={seg.uuid} style={{ margin: '5px 0' }}> <div key={seg.uuid} style={{ margin: '5px 0' }}>

@ -63,8 +63,8 @@ input, button, textarea, :focus {
} }
.help-sheet { .help-sheet {
background: #525252; background: white;
color: white; color: black;
padding: 1em 2em; padding: 1em 2em;
position: fixed; position: fixed;
left: 0; left: 0;
@ -87,7 +87,7 @@ input, button, textarea, :focus {
line-height: 10px; line-height: 10px;
color: #555; color: #555;
vertical-align: middle; vertical-align: middle;
background-color: #fcfcfc; background-color: rgba(0,0,0,0.03);
border: solid 1px #ccc; border: solid 1px #ccc;
border-bottom-color: #bbb; border-bottom-color: #bbb;
border-radius: 3px; border-radius: 3px;

@ -6,7 +6,7 @@ import { FiScissors } from 'react-icons/fi';
import { AnimatePresence, motion } from 'framer-motion'; import { AnimatePresence, motion } from 'framer-motion';
import Swal from 'sweetalert2'; import Swal from 'sweetalert2';
import Lottie from 'react-lottie'; import Lottie from 'react-lottie';
import { SideSheet, Button, Position } from 'evergreen-ui'; import { SideSheet, Button, Position, Table, SegmentedControl, Checkbox } from 'evergreen-ui';
import { useStateWithHistory } from 'react-use/lib/useStateWithHistory'; import { useStateWithHistory } from 'react-use/lib/useStateWithHistory';
import fromPairs from 'lodash/fromPairs'; import fromPairs from 'lodash/fromPairs';
@ -1220,9 +1220,9 @@ const App = memo(() => {
<option key={f} value={f}>{f} - {name}</option> <option key={f} value={f}>{f} - {name}</option>
)); ));
} }
function renderOutFmt({ width } = {}) { function renderOutFmt(style = {}) {
return ( return (
<select style={{ width }} defaultValue="" value={fileFormat} title="Output format" onChange={withBlur(e => setFileFormat(e.target.value))}> <select style={style} defaultValue="" value={fileFormat} title="Output format" onChange={withBlur(e => setFileFormat(e.target.value))}>
<option key="disabled1" value="" disabled>Format</option> <option key="disabled1" value="" disabled>Format</option>
{detectedFileFormat && ( {detectedFileFormat && (
@ -1252,19 +1252,25 @@ const App = memo(() => {
); );
} }
const renderSettings = () => ( const renderSettings = () => {
// eslint-disable-next-line react/jsx-props-no-spreading
const Row = (props) => <Table.Row height="auto" paddingY={12} {...props} />;
// eslint-disable-next-line react/jsx-props-no-spreading
const KeyCell = (props) => <Table.TextCell textProps={{ whiteSpace: 'auto' }} {...props} />;
return (
<Fragment> <Fragment>
<tr> <Row>
<td>Output format (default autodetected)</td> <KeyCell textProps={{ whiteSpace: 'auto' }}>Output format (default autodetected)</KeyCell>
<td style={{ width: '50%' }}>{renderOutFmt()}</td> <Table.TextCell>{renderOutFmt({ width: '100%' })}</Table.TextCell>
</tr> </Row>
<tr> <Row>
<td> <KeyCell>
Working directory<br /> Working directory<br />
This is where working files, exported files, project files (CSV) are stored. This is where working files, exported files, project files (CSV) are stored.
</td> </KeyCell>
<td> <Table.TextCell>
<button <button
type="button" type="button"
onClick={setOutputDir} onClick={setOutputDir}
@ -1272,125 +1278,111 @@ const App = memo(() => {
{customOutDir ? 'Custom working directory' : 'Same directory as input file'} {customOutDir ? 'Custom working directory' : 'Same directory as input file'}
</button> </button>
<div>{customOutDir}</div> <div>{customOutDir}</div>
</td> </Table.TextCell>
</tr> </Row>
<tr> <Row>
<td>Auto merge segments to one file after export?</td> <KeyCell>Auto merge segments to one file during export or export to separate files?</KeyCell>
<td> <Table.TextCell>
<button <SegmentedControl
type="button" options={[{ label: 'Auto merge', value: 'automerge' }, { label: 'Separate', value: 'separate' }]}
onClick={toggleAutoMerge} value={autoMerge ? 'automerge' : 'separate'}
> onChange={value => setAutoMerge(value === 'automerge')}
{autoMerge ? 'Auto merge segments to one file' : 'Export separate files'} />
</button> </Table.TextCell>
</td> </Row>
</tr>
<Row>
<tr> <KeyCell>
<td>keyframe cut mode</td> Keyframe cut mode<br />
<td> <b>Nearest keyframe</b>: Cut at the nearest keyframe (not accurate time.)<br />
<button <b>Normal cut</b>: Accurate time but could leave an empty portion at the beginning of the video.<br />
type="button" </KeyCell>
onClick={toggleKeyframeCut} <Table.TextCell>
> <SegmentedControl
{keyframeCut ? 'Nearest keyframe cut - will cut at the nearest keyframe' : 'Normal cut - cut accurate position but could leave an empty portion'} options={[{ label: 'Nearest keyframe', value: 'keyframe' }, { label: 'Normal cut', value: 'normal' }]}
</button> value={keyframeCut ? 'keyframe' : 'normal'}
</td> onChange={value => setKeyframeCut(value === 'keyframe')}
</tr> />
</Table.TextCell>
<tr> </Row>
<td>
Discard (cut away) or keep selected segments from video when exporting <Row>
</td> <KeyCell>
<td> <span role="img" aria-label="Yin Yang"></span> Choose cutting mode: Cut away or keep selected segments from video when exporting?<br />
<button When <b>Keep</b> is selected, the video inside segments will be kept, while the video outside will be discarded.<br />
type="button" When <b>Cut away</b> is selected, the video inside segments will be discarded, while the video surrounding them will be kept.
onClick={withBlur(() => setInvertCutSegments(v => !v))} </KeyCell>
> <Table.TextCell>
{invertCutSegments ? 'Discard' : 'Keep'} <SegmentedControl
</button> options={[{ label: 'Cut away', value: 'discard' }, { label: 'Keep', value: 'keep' }]}
</td> value={invertCutSegments ? 'discard' : 'keep'}
</tr> onChange={value => setInvertCutSegments(value === 'discard')}
/>
<tr> </Table.TextCell>
<td> </Row>
Discard audio?
</td>
<td>
<button
type="button"
onClick={toggleStripAudio}
>
{copyAnyAudioTrack ? 'Keep audio tracks' : 'Discard all audio tracks'}
</button>
</td>
</tr>
<tr> <Row>
<td> <KeyCell>
Extract unprocessable tracks to separate files?<br /> Extract unprocessable tracks to separate files or discard them?<br />
(data tracks such as GoPro GPS, telemetry etc. are not copied over by default because ffmpeg cannot cut them, thus they will cause the media duration to stay the same after cutting video/audio) (data tracks such as GoPro GPS, telemetry etc. are not copied over by default because ffmpeg cannot cut them, thus they will cause the media duration to stay the same after cutting video/audio)
</td> </KeyCell>
<td> <Table.TextCell>
<button <SegmentedControl
type="button" options={[{ label: 'Extract', value: 'extract' }, { label: 'Discard', value: 'discard' }]}
onClick={() => setAutoExportExtraStreams(v => !v)} value={autoExportExtraStreams ? 'extract' : 'discard'}
> onChange={value => setAutoExportExtraStreams(value === 'extract')}
{autoExportExtraStreams ? 'Extract unprocessable tracks' : 'Discard all unprocessable tracks'} />
</button> </Table.TextCell>
</td> </Row>
</tr>
<tr> <Row>
<td> <KeyCell>
Auto save project?<br /> Auto save project file?<br />
The project will be stored along with the output files as a CSV file The project will be stored along with the output files as a CSV file
</td> </KeyCell>
<td> <Table.TextCell>
<button <Checkbox
type="button" label="Auto save project"
onClick={() => setAutoSaveProjectFile(v => !v)} checked={autoSaveProjectFile}
> onChange={e => setAutoSaveProjectFile(e.target.checked)}
{autoSaveProjectFile ? 'Auto save project' : 'Don\'t save project file'} />
</button> </Table.TextCell>
</td> </Row>
</tr>
<tr> <Row>
<td> <KeyCell>
Snapshot capture format Snapshot capture format
</td> </KeyCell>
<td> <Table.TextCell>
{renderCaptureFormatButton()} {renderCaptureFormatButton()}
</td> </Table.TextCell>
</tr> </Row>
<tr> <Row>
<td>In timecode show</td> <KeyCell>In timecode show</KeyCell>
<td> <Table.TextCell>
<button <SegmentedControl
type="button" options={[{ label: 'Frame numbers', value: 'frames' }, { label: 'Millisecond fractions', value: 'ms' }]}
onClick={() => setTimecodeShowFrames(v => !v)} value={timecodeShowFrames ? 'frames' : 'ms'}
> onChange={value => setTimecodeShowFrames(value === 'frames')}
{timecodeShowFrames ? 'Frame numbers' : 'Millisecond fractions'} />
</button> </Table.TextCell>
</td> </Row>
</tr>
<Row>
<tr> <KeyCell>Ask for confirmation when closing app?</KeyCell>
<td>Ask for confirmation when closing app?</td> <Table.TextCell>
<td> <Checkbox
<button label="Ask before closing"
type="button" checked={askBeforeClose}
onClick={() => setAskBeforeClose(v => !v)} onChange={e => setAskBeforeClose(e.target.checked)}
> />
{askBeforeClose ? 'Ask before closing' : 'Don\'t ask before closing'} </Table.TextCell>
</button> </Row>
</td>
</tr>
</Fragment> </Fragment>
); );
};
useEffect(() => { useEffect(() => {
loadMifiLink().then(setMifiLink); loadMifiLink().then(setMifiLink);

Loading…
Cancel
Save