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,145 +1252,137 @@ const App = memo(() => {
); );
} }
const renderSettings = () => ( const renderSettings = () => {
<Fragment> // eslint-disable-next-line react/jsx-props-no-spreading
<tr> const Row = (props) => <Table.Row height="auto" paddingY={12} {...props} />;
<td>Output format (default autodetected)</td> // eslint-disable-next-line react/jsx-props-no-spreading
<td style={{ width: '50%' }}>{renderOutFmt()}</td> const KeyCell = (props) => <Table.TextCell textProps={{ whiteSpace: 'auto' }} {...props} />;
</tr>
return (
<tr> <Fragment>
<td> <Row>
Working directory<br /> <KeyCell textProps={{ whiteSpace: 'auto' }}>Output format (default autodetected)</KeyCell>
This is where working files, exported files, project files (CSV) are stored. <Table.TextCell>{renderOutFmt({ width: '100%' })}</Table.TextCell>
</td> </Row>
<td>
<button <Row>
type="button" <KeyCell>
onClick={setOutputDir} Working directory<br />
> This is where working files, exported files, project files (CSV) are stored.
{customOutDir ? 'Custom working directory' : 'Same directory as input file'} </KeyCell>
</button> <Table.TextCell>
<div>{customOutDir}</div> <button
</td> type="button"
</tr> onClick={setOutputDir}
>
<tr> {customOutDir ? 'Custom working directory' : 'Same directory as input file'}
<td>Auto merge segments to one file after export?</td> </button>
<td> <div>{customOutDir}</div>
<button </Table.TextCell>
type="button" </Row>
onClick={toggleAutoMerge}
> <Row>
{autoMerge ? 'Auto merge segments to one file' : 'Export separate files'} <KeyCell>Auto merge segments to one file during export or export to separate files?</KeyCell>
</button> <Table.TextCell>
</td> <SegmentedControl
</tr> options={[{ label: 'Auto merge', value: 'automerge' }, { label: 'Separate', value: 'separate' }]}
value={autoMerge ? 'automerge' : 'separate'}
<tr> onChange={value => setAutoMerge(value === 'automerge')}
<td>keyframe cut mode</td> />
<td> </Table.TextCell>
<button </Row>
type="button"
onClick={toggleKeyframeCut} <Row>
> <KeyCell>
{keyframeCut ? 'Nearest keyframe cut - will cut at the nearest keyframe' : 'Normal cut - cut accurate position but could leave an empty portion'} Keyframe cut mode<br />
</button> <b>Nearest keyframe</b>: Cut at the nearest keyframe (not accurate time.)<br />
</td> <b>Normal cut</b>: Accurate time but could leave an empty portion at the beginning of the video.<br />
</tr> </KeyCell>
<Table.TextCell>
<tr> <SegmentedControl
<td> options={[{ label: 'Nearest keyframe', value: 'keyframe' }, { label: 'Normal cut', value: 'normal' }]}
Discard (cut away) or keep selected segments from video when exporting value={keyframeCut ? 'keyframe' : 'normal'}
</td> onChange={value => setKeyframeCut(value === 'keyframe')}
<td> />
<button </Table.TextCell>
type="button" </Row>
onClick={withBlur(() => setInvertCutSegments(v => !v))}
> <Row>
{invertCutSegments ? 'Discard' : 'Keep'} <KeyCell>
</button> <span role="img" aria-label="Yin Yang"></span> Choose cutting mode: Cut away or keep selected segments from video when exporting?<br />
</td> When <b>Keep</b> is selected, the video inside segments will be kept, while the video outside will be discarded.<br />
</tr> When <b>Cut away</b> is selected, the video inside segments will be discarded, while the video surrounding them will be kept.
</KeyCell>
<tr> <Table.TextCell>
<td> <SegmentedControl
Discard audio? options={[{ label: 'Cut away', value: 'discard' }, { label: 'Keep', value: 'keep' }]}
</td> value={invertCutSegments ? 'discard' : 'keep'}
<td> onChange={value => setInvertCutSegments(value === 'discard')}
<button />
type="button" </Table.TextCell>
onClick={toggleStripAudio} </Row>
>
{copyAnyAudioTrack ? 'Keep audio tracks' : 'Discard all audio tracks'} <Row>
</button> <KeyCell>
</td> Extract unprocessable tracks to separate files or discard them?<br />
</tr> (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)
</KeyCell>
<tr> <Table.TextCell>
<td> <SegmentedControl
Extract unprocessable tracks to separate files?<br /> options={[{ label: 'Extract', value: 'extract' }, { label: 'Discard', value: 'discard' }]}
(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) value={autoExportExtraStreams ? 'extract' : 'discard'}
</td> onChange={value => setAutoExportExtraStreams(value === 'extract')}
<td> />
<button </Table.TextCell>
type="button" </Row>
onClick={() => setAutoExportExtraStreams(v => !v)}
> <Row>
{autoExportExtraStreams ? 'Extract unprocessable tracks' : 'Discard all unprocessable tracks'} <KeyCell>
</button> Auto save project file?<br />
</td> The project will be stored along with the output files as a CSV file
</tr> </KeyCell>
<Table.TextCell>
<tr> <Checkbox
<td> label="Auto save project"
Auto save project?<br /> checked={autoSaveProjectFile}
The project will be stored along with the output files as a CSV file onChange={e => setAutoSaveProjectFile(e.target.checked)}
</td> />
<td> </Table.TextCell>
<button </Row>
type="button"
onClick={() => setAutoSaveProjectFile(v => !v)} <Row>
> <KeyCell>
{autoSaveProjectFile ? 'Auto save project' : 'Don\'t save project file'} Snapshot capture format
</button> </KeyCell>
</td> <Table.TextCell>
</tr> {renderCaptureFormatButton()}
</Table.TextCell>
<tr> </Row>
<td>
Snapshot capture format <Row>
</td> <KeyCell>In timecode show</KeyCell>
<td> <Table.TextCell>
{renderCaptureFormatButton()} <SegmentedControl
</td> options={[{ label: 'Frame numbers', value: 'frames' }, { label: 'Millisecond fractions', value: 'ms' }]}
</tr> value={timecodeShowFrames ? 'frames' : 'ms'}
onChange={value => setTimecodeShowFrames(value === 'frames')}
<tr> />
<td>In timecode show</td> </Table.TextCell>
<td> </Row>
<button
type="button" <Row>
onClick={() => setTimecodeShowFrames(v => !v)} <KeyCell>Ask for confirmation when closing app?</KeyCell>
> <Table.TextCell>
{timecodeShowFrames ? 'Frame numbers' : 'Millisecond fractions'} <Checkbox
</button> label="Ask before closing"
</td> checked={askBeforeClose}
</tr> onChange={e => setAskBeforeClose(e.target.checked)}
/>
<tr> </Table.TextCell>
<td>Ask for confirmation when closing app?</td> </Row>
<td> </Fragment>
<button );
type="button" };
onClick={() => setAskBeforeClose(v => !v)}
>
{askBeforeClose ? 'Ask before closing' : 'Don\'t ask before closing'}
</button>
</td>
</tr>
</Fragment>
);
useEffect(() => { useEffect(() => {
loadMifiLink().then(setMifiLink); loadMifiLink().then(setMifiLink);

Loading…
Cancel
Save