The swiss army knife of lossless video/audio editing
toggle tracks by expression #2435 #1465 #371
Mikael Finstad250505e9cdc6
diff --git a/src/main/configStore.ts b/src/main/configStore.tsindex 26321c63..c81b8c43 100644--- a/src/main/configStore.ts+++ b/src/main/configStore.ts@@ -30,6 +30,8 @@ const defaultKeyBindings: KeyBinding[] = [{ keys: 'b', action: 'splitCurrentSegment' },{ keys: 'r', action: 'increaseRotation' },{ keys: 'g', action: 'goToTimecode' },+ { keys: 't', action: 'toggleStripAll' },+ { keys: 'shift+t', action: 'toggleStripCurrentFilter' },{ keys: 'left', action: 'seekBackwards' },{ keys: 'ctrl+shift+left', action: 'seekBackwards2' },diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsxindex 5058cdbc..3f262dd0 100644--- a/src/renderer/src/App.tsx+++ b/src/renderer/src/App.tsx@@ -175,7 +175,7 @@ function App() {const allUserSettings = useUserSettingsRoot();const {- captureFormat, setCaptureFormat, customOutDir, setCustomOutDir, keyframeCut, setKeyframeCut, preserveMetadata, preserveChapters, preserveMovData, movFastStart, avoidNegativeTs, autoMerge, timecodeFormat, invertCutSegments, setInvertCutSegments, autoExportExtraStreams, askBeforeClose, enableAskForImportChapters, enableAskForFileOpenAction, playbackVolume, setPlaybackVolume, autoSaveProjectFile, wheelSensitivity, waveformHeight, invertTimelineScroll, language, ffmpegExperimental, hideNotifications, hideOsNotifications, autoLoadTimecode, autoDeleteMergedSegments, exportConfirmEnabled, setExportConfirmEnabled, segmentsToChapters, preserveMetadataOnMerge, simpleMode, setSimpleMode, outSegTemplate, setOutSegTemplate, mergedFileTemplate, setMergedFileTemplate, keyboardSeekAccFactor, keyboardNormalSeekSpeed, keyboardSeekSpeed2, keyboardSeekSpeed3, treatInputFileModifiedTimeAsStart, treatOutputFileModifiedTimeAsStart, outFormatLocked, setOutFormatLocked, safeOutputFileName, setSafeOutputFileName, enableAutoHtml5ify, segmentsToChaptersOnly, keyBindings, setKeyBindings, resetKeyBindings, enableSmartCut, customFfPath, storeProjectInWorkingDir, setStoreProjectInWorkingDir, enableOverwriteOutput, mouseWheelZoomModifierKey, mouseWheelFrameSeekModifierKey, mouseWheelKeyframeSeekModifierKey, captureFrameMethod, captureFrameQuality, captureFrameFileNameFormat, enableNativeHevc, cleanupChoices, setCleanupChoices, darkMode, setDarkMode, preferStrongColors, outputFileNameMinZeroPadding, cutFromAdjustmentFrames, cutToAdjustmentFrames,+ captureFormat, setCaptureFormat, customOutDir, setCustomOutDir, keyframeCut, setKeyframeCut, preserveMetadata, preserveChapters, preserveMovData, movFastStart, avoidNegativeTs, autoMerge, timecodeFormat, invertCutSegments, setInvertCutSegments, autoExportExtraStreams, askBeforeClose, enableAskForImportChapters, enableAskForFileOpenAction, playbackVolume, setPlaybackVolume, autoSaveProjectFile, wheelSensitivity, waveformHeight, invertTimelineScroll, language, ffmpegExperimental, hideNotifications, hideOsNotifications, autoLoadTimecode, autoDeleteMergedSegments, exportConfirmEnabled, setExportConfirmEnabled, segmentsToChapters, preserveMetadataOnMerge, simpleMode, setSimpleMode, outSegTemplate, setOutSegTemplate, mergedFileTemplate, setMergedFileTemplate, keyboardSeekAccFactor, keyboardNormalSeekSpeed, keyboardSeekSpeed2, keyboardSeekSpeed3, treatInputFileModifiedTimeAsStart, treatOutputFileModifiedTimeAsStart, outFormatLocked, setOutFormatLocked, safeOutputFileName, setSafeOutputFileName, enableAutoHtml5ify, segmentsToChaptersOnly, keyBindings, setKeyBindings, resetKeyBindings, enableSmartCut, customFfPath, storeProjectInWorkingDir, setStoreProjectInWorkingDir, enableOverwriteOutput, mouseWheelZoomModifierKey, mouseWheelFrameSeekModifierKey, mouseWheelKeyframeSeekModifierKey, captureFrameMethod, captureFrameQuality, captureFrameFileNameFormat, enableNativeHevc, cleanupChoices, setCleanupChoices, darkMode, toggleDarkMode, preferStrongColors, outputFileNameMinZeroPadding, cutFromAdjustmentFrames, cutToAdjustmentFrames,} = allUserSettings;// Note that each action may be multiple key bindings and this will only be the first binding for each action@@ -366,7 +366,7 @@ function App() {const { getEdlFilePath, projectFileSavePath, getProjectFileSavePath } = useSegmentsAutoSave({ autoSaveProjectFile, storeProjectInWorkingDir, filePath, customOutDir, cutSegments });- const { nonCopiedExtraStreams, exportExtraStreams, mainCopiedThumbnailStreams, numStreamsToCopy, toggleStripAudio, toggleStripThumbnail, copyAnyAudioTrack, copyStreamIdsByFile, setCopyStreamIdsByFile, copyFileStreams, mainCopiedStreams, setCopyStreamIdsForPath, toggleCopyStreamId, isCopyingStreamId } = useStreamsMeta({ mainStreams, filePath, autoExportExtraStreams });+ const { nonCopiedExtraStreams, exportExtraStreams, mainCopiedThumbnailStreams, numStreamsToCopy, toggleStripVideo, toggleStripAudio, toggleStripSubtitle, toggleStripThumbnail, toggleStripAll, copyStreamIdsByFile, setCopyStreamIdsByFile, copyFileStreams, mainCopiedStreams, setCopyStreamIdsForPath, toggleCopyStreamId, isCopyingStreamId, toggleCopyStreamIds, changeEnabledStreamsFilter, applyEnabledStreamsFilter, enabledStreamsFilter, toggleCopyAllStreamsForPath } = useStreamsMeta({ mainStreams, externalFilesMeta, filePath, autoExportExtraStreams });const onDurationChange = useCallback<ReactEventHandler<HTMLVideoElement>>((e) => {// Some files report duration infinity first, then proper duration later@@ -2081,7 +2081,12 @@ function App() {toggleKeyframeCutMode: () => toggleKeyframeCut(true),toggleCaptureFormat,toggleStripAudio,+ toggleStripVideo,+ toggleStripSubtitle,toggleStripThumbnail,+ toggleStripCurrentFilter: () => applyEnabledStreamsFilter(),+ toggleStripAll,+ toggleDarkMode,setStartTimeOffset: askStartTimeOffset,deselectAllSegments,selectAllSegments,@@ -2125,7 +2130,7 @@ function App() {};return ret;- }, [toggleLoopSelectedSegments, pause, timelineToggleComfortZoom, captureSnapshot, captureSnapshotAsCoverArt, setCutStart, setCutEnd, cleanupFilesDialog, splitCurrentSegment, focusSegmentAtCursor, selectSegmentsAtCursor, increaseRotation, goToTimecode, jumpCutStart, jumpCutEnd, jumpTimelineStart, jumpTimelineEnd, batchOpenSelectedFile, closeBatch, addSegment, duplicateCurrentSegment, onExportPress, extractCurrentSegmentFramesAsImages, extractSelectedSegmentsFramesAsImages, reorderSegsByStartTime, invertAllSegments, fillSegmentsGaps, combineOverlappingSegments, combineSelectedSegments, createFixedDurationSegments, createNumSegments, createFixedByteSizedSegments, createRandomSegments, alignSegmentTimesToKeyframes, shuffleSegments, clearSegments, toggleSegmentsList, toggleStreamsSelector, extractAllStreams, convertFormatBatch, concatBatch, toggleCaptureFormat, toggleStripAudio, toggleStripThumbnail, askStartTimeOffset, deselectAllSegments, selectAllSegments, selectOnlyCurrentSegment, editCurrentSegmentTags, toggleCurrentSegmentSelected, invertSelectedSegments, removeSelectedSegments, tryFixInvalidDuration, shiftAllSegmentTimes, toggleMuted, copySegmentsToClipboard, handleShowStreamsSelectorClick, openFilesDialog, openDirDialog, toggleSettings, createSegmentsFromKeyframes, toggleWaveformMode, toggleShowThumbnails, toggleShowKeyframes, showIncludeExternalStreamsDialog, toggleFullscreenVideo, selectAllMarkers, checkFileOpened, cutSegments, seekRel, keyboardSeekAccFactor, togglePlay, play, userChangePlaybackRate, keyboardNormalSeekSpeed, keyboardSeekSpeed2, keyboardSeekSpeed3, seekRelPercent, seekClosestKeyframe, shortStep, jumpSeg, zoomRel, batchFileJump, removeSegment, currentSegIndexSafe, cutSegmentsHistory, labelSegment, toggleLastCommands, userHtml5ifyCurrentFile, toggleKeyframeCut, setPlaybackVolume, closeFileWithConfirm, openSendReportDialogWithState, detectBlackScenes, detectSilentScenes, detectSceneChanges]);+ }, [toggleLoopSelectedSegments, pause, timelineToggleComfortZoom, captureSnapshot, captureSnapshotAsCoverArt, setCutStart, setCutEnd, cleanupFilesDialog, splitCurrentSegment, focusSegmentAtCursor, selectSegmentsAtCursor, increaseRotation, goToTimecode, jumpCutStart, jumpCutEnd, jumpTimelineStart, jumpTimelineEnd, batchOpenSelectedFile, closeBatch, addSegment, duplicateCurrentSegment, onExportPress, extractCurrentSegmentFramesAsImages, extractSelectedSegmentsFramesAsImages, reorderSegsByStartTime, invertAllSegments, fillSegmentsGaps, combineOverlappingSegments, combineSelectedSegments, createFixedDurationSegments, createNumSegments, createFixedByteSizedSegments, createRandomSegments, alignSegmentTimesToKeyframes, shuffleSegments, clearSegments, toggleSegmentsList, toggleStreamsSelector, extractAllStreams, convertFormatBatch, concatBatch, toggleCaptureFormat, toggleStripAudio, toggleStripVideo, toggleStripSubtitle, toggleStripThumbnail, toggleStripAll, toggleDarkMode, askStartTimeOffset, deselectAllSegments, selectAllSegments, selectOnlyCurrentSegment, editCurrentSegmentTags, toggleCurrentSegmentSelected, invertSelectedSegments, removeSelectedSegments, tryFixInvalidDuration, shiftAllSegmentTimes, toggleMuted, copySegmentsToClipboard, handleShowStreamsSelectorClick, openFilesDialog, openDirDialog, toggleSettings, createSegmentsFromKeyframes, toggleWaveformMode, toggleShowThumbnails, toggleShowKeyframes, showIncludeExternalStreamsDialog, toggleFullscreenVideo, selectAllMarkers, checkFileOpened, cutSegments, seekRel, keyboardSeekAccFactor, togglePlay, play, userChangePlaybackRate, keyboardNormalSeekSpeed, keyboardSeekSpeed2, keyboardSeekSpeed3, seekRelPercent, seekClosestKeyframe, shortStep, jumpSeg, zoomRel, batchFileJump, removeSegment, currentSegIndexSafe, cutSegmentsHistory, labelSegment, toggleLastCommands, userHtml5ifyCurrentFile, toggleKeyframeCut, applyEnabledStreamsFilter, setPlaybackVolume, closeFileWithConfirm, openSendReportDialogWithState, detectBlackScenes, detectSilentScenes, detectSceneChanges]);const getKeyboardAction = useCallback((action: MainKeyboardAction) => mainActions[action], [mainActions]);@@ -2455,8 +2460,9 @@ function App() {<TopMenufilePath={filePath}fileFormat={fileFormat}- copyAnyAudioTrack={copyAnyAudioTrack}- toggleStripAudio={toggleStripAudio}+ changeEnabledStreamsFilter={changeEnabledStreamsFilter}+ applyEnabledStreamsFilter={applyEnabledStreamsFilter}+ enabledStreamsFilter={enabledStreamsFilter}clearOutDir={clearOutDir}isCustomFormatSelected={isCustomFormatSelected}renderOutFmt={renderOutFmt}@@ -2682,7 +2688,7 @@ function App() {toggleLoopSelectedSegments={toggleLoopSelectedSegments}isFileOpened={isFileOpened}darkMode={darkMode}- setDarkMode={setDarkMode}+ toggleDarkMode={toggleDarkMode}outputPlaybackRate={outputPlaybackRate}setOutputPlaybackRate={setOutputPlaybackRate}formatTimecode={formatTimecode}@@ -2722,6 +2728,9 @@ function App() {updateStreamParams={updateStreamParams}formatTimecode={formatTimecode}loadSubtitleTrackToSegments={loadSubtitleTrackToSegments}+ toggleCopyStreamIds={toggleCopyStreamIds}+ changeEnabledStreamsFilter={changeEnabledStreamsFilter}+ toggleCopyAllStreamsForPath={toggleCopyAllStreamsForPath}/>)}</Sheet>diff --git a/src/renderer/src/BottomBar.tsx b/src/renderer/src/BottomBar.tsxindex 676b302c..89288dd9 100644--- a/src/renderer/src/BottomBar.tsx+++ b/src/renderer/src/BottomBar.tsx@@ -212,7 +212,7 @@ function BottomBar({jumpTimelineStart, jumpTimelineEnd, jumpCutEnd, jumpCutStart, startTimeOffset, setCutTime,playing, shortStep, togglePlay, toggleLoopSelectedSegments, hasAudio,keyframesEnabled, toggleShowKeyframes, seekClosestKeyframe, detectedFps, isFileOpened, selectedSegments,- darkMode, setDarkMode,+ darkMode, toggleDarkMode,toggleShowThumbnails, toggleWaveformMode, waveformMode, showThumbnails,outputPlaybackRate, setOutputPlaybackRate,formatTimecode, parseTimecode, playbackRate,@@ -254,7 +254,7 @@ function BottomBar({isFileOpened: boolean,selectedSegments: SegmentColorIndex[],darkMode: boolean,- setDarkMode: Dispatch<SetStateAction<boolean>>,+ toggleDarkMode: () => void,toggleShowThumbnails: () => void,toggleWaveformMode: () => void,waveformMode: WaveformMode | undefined,@@ -354,7 +354,7 @@ function BottomBar({<div style={{ display: 'flex', alignItems: 'center', flexBasis: leftRightWidth }}>{!simpleMode && (<>- <FaSun color="var(--gray-12)" role="button" onClick={() => setDarkMode((v) => !v)} style={{ padding: '0 .2em 0 .3em' }} />+ <FaSun color="var(--gray-12)" role="button" onClick={toggleDarkMode} style={{ padding: '0 .2em 0 .3em' }} title={t('Toggle dark mode')} />{hasAudio && (<GiSoundWavesdiff --git a/src/renderer/src/LastCommandsSheet.tsx b/src/renderer/src/LastCommandsSheet.tsxindex 1f8d2ffe..e7c8dfbf 100644--- a/src/renderer/src/LastCommandsSheet.tsx+++ b/src/renderer/src/LastCommandsSheet.tsx@@ -18,7 +18,7 @@ function LastCommandsSheet({ visible, onTogglePress, ffmpegCommandLog, setFfmpegreturn (<Sheet visible={visible} onClosePress={onTogglePress} style={{ padding: '0 1em' }} maxWidth={2000}>- <h2>{t('Last ffmpeg commands')}</h2>+ <h1>{t('Last ffmpeg commands')}</h1>{ffmpegCommandLog.length > 0 ? (<div>diff --git a/src/renderer/src/SegmentList.tsx b/src/renderer/src/SegmentList.tsxindex 6c4ce15d..f537a8d6 100644--- a/src/renderer/src/SegmentList.tsx+++ b/src/renderer/src/SegmentList.tsx@@ -458,12 +458,10 @@ function SegmentList({onSegmentTagsCloseComplete();}, [editingSegmentTags, editingSegmentTagsSegmentIndex, onSegmentTagsCloseComplete, updateSegAtIndex]);- const dialogRef = useRef<HTMLDialogElement>(null);-return (<>{editingSegmentTagsSegmentIndex != null && (- <Dialog ref={dialogRef} autoOpen onClose={onSegmentTagsCloseComplete} style={{ width: '100%', maxWidth: '40em' }}>+ <Dialog autoOpen onClose={onSegmentTagsCloseComplete} style={{ width: '100%', maxWidth: '40em' }}><h1 style={{ marginTop: 0 }}>{t('Edit segment tags')}</h1><TagEditor customTags={editingSegmentTags} editingTag={editingTag} setEditingTag={setEditingTag} onTagsChange={onTagsChange} onTagReset={onTagReset} addTagTitle={t('Add segment tag')} />diff --git a/src/renderer/src/StreamsSelector.module.css b/src/renderer/src/StreamsSelector.module.cssnew file mode 100644index 00000000..b37e4901--- /dev/null+++ b/src/renderer/src/StreamsSelector.module.css@@ -0,0 +1,14 @@+.table {+ font-size: .8em;+ width: 100%;+ border-collapse: collapse;++ th {+ padding-bottom: .3em;+ }++ th, td {+ padding-left: .2em;+ padding-right: .2em;+ }+}diff --git a/src/renderer/src/StreamsSelector.tsx b/src/renderer/src/StreamsSelector.tsxindex 8cbfcf9b..2c91b745 100644--- a/src/renderer/src/StreamsSelector.tsx+++ b/src/renderer/src/StreamsSelector.tsx@@ -1,9 +1,9 @@-import { memo, useState, useMemo, useCallback, Dispatch, SetStateAction, CSSProperties, ReactNode, ChangeEventHandler, useRef } from 'react';+import { memo, useState, useMemo, useCallback, Dispatch, SetStateAction, CSSProperties, ReactNode, ChangeEventHandler } from 'react';-import { FaImage, FaCheckCircle, FaPaperclip, FaVideo, FaVideoSlash, FaFileImport, FaVolumeUp, FaVolumeMute, FaBan, FaFileExport } from 'react-icons/fa';+import { FaImage, FaPaperclip, FaVideo, FaVideoSlash, FaFileImport, FaVolumeUp, FaVolumeMute, FaBan, FaFileExport } from 'react-icons/fa';import { GoFileBinary } from 'react-icons/go';import { MdSubtitles } from 'react-icons/md';-import { BookIcon, MoreIcon, Position, Popover, Menu, TrashIcon, EditIcon, InfoSignIcon, IconButton, SortAscIcon, SortDescIcon, ForkIcon, WarningSignIcon } from 'evergreen-ui';+import { BookIcon, MoreIcon, Position, Popover, Menu, TrashIcon, EditIcon, InfoSignIcon, IconButton, SortAscIcon, SortDescIcon, ForkIcon, WarningSignIcon, EyeOpenIcon, FilterIcon } from 'evergreen-ui';import { useTranslation } from 'react-i18next';import prettyBytes from 'pretty-bytes';@@ -21,6 +21,7 @@ import useUserSettings from './hooks/useUserSettings';import tryShowGpsMap from './gps';import Button from './components/Button';import Checkbox from './components/Checkbox';+import styles from './StreamsSelector.module.css';const dispositionOptions = ['default', 'dub', 'original', 'comment', 'lyrics', 'karaoke', 'forced', 'hearing_impaired', 'visual_impaired', 'clean_effects', 'attached_pic', 'captions', 'descriptions', 'dependent', 'metadata'];@@ -142,12 +143,10 @@ const EditStreamDialog = memo(({ editingStream: { streamId: editingStreamId, pat});}, [editingFile, editingStreamId, updateStreamParams]);- const dialogRef = useRef<HTMLDialogElement>(null);-if (!editingStream) return null;return (- <Dialog ref={dialogRef} autoOpen onClose={() => setEditingStream(undefined)} style={{ maxWidth: '40em' }}>+ <Dialog autoOpen onClose={() => setEditingStream(undefined)} style={{ width: '100%', maxWidth: '40em' }}><h1 style={{ marginTop: 0 }}>{t('Edit track {{trackNum}} metadata', { trackNum: editingStream && (editingStream.index + 1) })}</h1><h2>Parameters</h2>@@ -160,8 +159,19 @@ const EditStreamDialog = memo(({ editingStream: { streamId: editingStreamId, pat});// eslint-disable-next-line react/display-name-const Stream = memo(({ filePath, stream, onToggle, batchSetCopyStreamIds, copyStream, fileDuration, setEditingStream, onExtractStreamPress, paramsByStreamId, updateStreamParams, formatTimecode, loadSubtitleTrackToSegments, onInfoClick }: {- filePath: string, stream: FFprobeStream, onToggle: (a: number) => void, batchSetCopyStreamIds: (filter: (a: FFprobeStream) => boolean, enabled: boolean) => void, copyStream: boolean, fileDuration: number | undefined, setEditingStream: (a: EditingStream) => void, onExtractStreamPress?: () => void, paramsByStreamId: ParamsByStreamId, updateStreamParams: UpdateStreamParams, formatTimecode: FormatTimecode, loadSubtitleTrackToSegments?: (index: number) => void, onInfoClick: (json: unknown, title: string) => void,+const Stream = memo(({ filePath, stream, onToggle, toggleCopyStreamIds, copyStream, fileDuration, setEditingStream, onExtractStreamPress, paramsByStreamId, updateStreamParams, formatTimecode, loadSubtitleTrackToSegments, onInfoClick }: {+ filePath: string,+ stream: FFprobeStream,+ onToggle: (a: number) => void,+ toggleCopyStreamIds: (filter: (a: FFprobeStream) => boolean) => void,+ copyStream: boolean, fileDuration: number | undefined,+ setEditingStream: (a: EditingStream) => void,+ onExtractStreamPress?: () => void,+ paramsByStreamId: ParamsByStreamId,+ updateStreamParams: UpdateStreamParams,+ formatTimecode: FormatTimecode,+ loadSubtitleTrackToSegments?: (index: number) => void,+ onInfoClick: (json: unknown, title: string) => void,}) => {const { t } = useTranslation();@@ -283,11 +293,8 @@ const Stream = memo(({ filePath, stream, onToggle, batchSetCopyStreamIds, copySt</Menu.Group><Menu.Divider /><Menu.Group>- <Menu.Item icon={<Icon color="black" />} intent="success" onClick={() => batchSetCopyStreamIds((s) => s.codec_type === stream.codec_type, true)}>- {t('Keep all {{type}} tracks', { type: codecTypeHuman })}- </Menu.Item>- <Menu.Item icon={<FaBan color="black" />} intent="danger" onClick={() => batchSetCopyStreamIds((s) => s.codec_type === stream.codec_type, false)}>- {t('Discard all {{type}} tracks', { type: codecTypeHuman })}+ <Menu.Item icon={<EyeOpenIcon color="black" />} intent="success" onClick={() => toggleCopyStreamIds((s) => s.codec_type === stream.codec_type)}>+ {t('Toggle {{type}} tracks', { type: codecTypeHuman })}</Menu.Item></Menu.Group></Menu>@@ -300,8 +307,16 @@ const Stream = memo(({ filePath, stream, onToggle, batchSetCopyStreamIds, copySt);});-function FileHeading({ path, formatData, chapters, onTrashClick, onEditClick, setCopyAllStreams, onExtractAllStreamsPress, onInfoClick }: {- path: string, formatData: FFprobeFormat | undefined, chapters?: FFprobeChapter[] | undefined, onTrashClick?: (() => void) | undefined, onEditClick?: (() => void) | undefined, setCopyAllStreams: (a: boolean) => void, onExtractAllStreamsPress?: () => Promise<void>, onInfoClick: (json: unknown, title: string) => void,+function FileHeading({ path, formatData, chapters, onTrashClick, onEditClick, toggleCopyAllStreams, onExtractAllStreamsPress, onInfoClick, changeEnabledStreamsFilter }: {+ path: string,+ formatData: FFprobeFormat | undefined,+ chapters?: FFprobeChapter[] | undefined,+ onTrashClick?: (() => void) | undefined,+ onEditClick?: (() => void) | undefined,+ toggleCopyAllStreams: () => void,+ onExtractAllStreamsPress?: () => Promise<void>,+ onInfoClick: (json: unknown, title: string) => void,+ changeEnabledStreamsFilter?: (() => void) | undefined,}) {const { t } = useTranslation();@@ -311,44 +326,42 @@ function FileHeading({ path, formatData, chapters, onTrashClick, onEditClick, se<div style={{ flexGrow: 1 }} />- <IconButton icon={InfoSignIcon} title={t('File info')} onClick={() => onInfoClick(formatData, t('File info'))} appearance="minimal" iconSize={18} />{chapters && chapters.length > 0 && <IconButton icon={BookIcon} onClick={() => onInfoClick(chapters, t('Chapters'))} appearance="minimal" iconSize={18} />}+ <IconButton iconSize={18} icon={EyeOpenIcon} title={t('Toggle all tracks')} onClick={() => toggleCopyAllStreams()} appearance="minimal" />+ {changeEnabledStreamsFilter && <IconButton icon={FilterIcon} title={t('Filter tracks')} onClick={changeEnabledStreamsFilter} appearance="minimal" iconSize={18} />}+ <IconButton icon={InfoSignIcon} title={t('File info')} onClick={() => onInfoClick(formatData, t('File info'))} appearance="minimal" iconSize={18} />{onEditClick && <IconButton icon={EditIcon} title={t('Edit file metadata')} onClick={onEditClick} appearance="minimal" iconSize={18} />}- {onTrashClick && <IconButton icon={TrashIcon} onClick={onTrashClick} appearance="minimal" iconSize={18} />}- <IconButton iconSize={18} color="#52BD95" icon={FaCheckCircle} title={t('Keep all tracks')} onClick={() => setCopyAllStreams(true)} appearance="minimal" />- <IconButton iconSize={18} color="#D14343" icon={FaBan} title={t('Discard all tracks')} onClick={() => setCopyAllStreams(false)} appearance="minimal" />{onExtractAllStreamsPress && <IconButton iconSize={16} title={t('Export each track as individual files')} icon={ForkIcon} onClick={onExtractAllStreamsPress} appearance="minimal" />}++ {onTrashClick && <IconButton icon={TrashIcon} onClick={onTrashClick} appearance="minimal" intent="danger" iconSize={18} />}</div>);}-const thStyle: CSSProperties = { borderBottom: '1px solid var(--gray-6)', paddingBottom: '.5em' };-function Thead() {const { t } = useTranslation();return (<thead style={{ color: 'var(--gray-12)', textAlign: 'left', fontSize: '.9em' }}><tr>- <th style={thStyle}>{t('Keep?')}</th>- <th style={thStyle}>{t('Codec')}</th>- <th style={thStyle}>{t('Duration')}</th>- <th style={thStyle}>{t('Bitrate')}</th>- <th style={thStyle}>{t('Title')}</th>- <th style={thStyle}>{t('Lang')}</th>- <th style={thStyle}>{t('Data')}</th>- <th style={thStyle}>{t('Disposition')}</th>- <th style={thStyle} />+ <th>{t('Keep?')}</th>+ <th>{t('Codec')}</th>+ <th>{t('Duration')}</th>+ <th>{t('Bitrate')}</th>+ <th>{t('Title')}</th>+ <th>{t('Lang')}</th>+ <th>{t('Data')}</th>+ <th>{t('Disposition')}</th>+ <th /></tr></thead>);}-const tableStyle: CSSProperties = { fontSize: 14, width: '100%', borderCollapse: 'collapse' };const fileStyle: CSSProperties = { margin: '1.5em 1em 1.5em 1em', padding: 5, overflowX: 'auto' };function StreamsSelector({- mainFilePath, mainFileFormatData, mainFileStreams, mainFileChapters, isCopyingStreamId, toggleCopyStreamId, setCopyStreamIdsForPath, onExtractStreamPress, onExtractAllStreamsPress, allFilesMeta, externalFilesMeta, setExternalFilesMeta, showAddStreamSourceDialog, shortestFlag, setShortestFlag, nonCopiedExtraStreams, customTagsByFile, setCustomTagsByFile, paramsByStreamId, updateStreamParams, formatTimecode, loadSubtitleTrackToSegments,+ mainFilePath, mainFileFormatData, mainFileStreams, mainFileChapters, isCopyingStreamId, toggleCopyStreamId, setCopyStreamIdsForPath, onExtractStreamPress, onExtractAllStreamsPress, allFilesMeta, externalFilesMeta, setExternalFilesMeta, showAddStreamSourceDialog, shortestFlag, setShortestFlag, nonCopiedExtraStreams, customTagsByFile, setCustomTagsByFile, paramsByStreamId, updateStreamParams, formatTimecode, loadSubtitleTrackToSegments, toggleCopyStreamIds, changeEnabledStreamsFilter, toggleCopyAllStreamsForPath,}: {mainFilePath: string,mainFileFormatData: FFprobeFormat | undefined,@@ -372,6 +385,9 @@ function StreamsSelector({updateStreamParams: UpdateStreamParams,formatTimecode: FormatTimecode,loadSubtitleTrackToSegments: (index: number) => void,+ toggleCopyStreamIds: (path: string, filter: (a: FFprobeStream) => boolean) => void,+ changeEnabledStreamsFilter: () => void,+ toggleCopyAllStreamsForPath: (path: string) => void,}) {const [editingFile, setEditingFile] = useState<string>();const [editingStream, setEditingStream] = useState<EditingStream>();@@ -395,37 +411,20 @@ function StreamsSelector({});}- function batchSetCopyStreamIdsForPath(path: string, streams: FFprobeStream[], filter: (a: FFprobeStream) => boolean, enabled: boolean) {- setCopyStreamIdsForPath(path, (old) => {- const ret = { ...old };- // eslint-disable-next-line unicorn/no-array-callback-reference- streams.filter(filter).forEach(({ index }) => {- ret[index] = enabled;- });- return ret;- });- }-- function setCopyAllStreamsForPath(path: string, enabled: boolean) {- setCopyStreamIdsForPath(path, (old) => Object.fromEntries(Object.entries(old).map(([streamId]) => [streamId, enabled])));- }-const externalFilesEntries = Object.entries(externalFilesMeta);const onInfoClick = useCallback((json: unknown, title: string) => {showJson5Dialog({ title, json, darkMode });}, [darkMode]);- const dialogRef = useRef<HTMLDialogElement>(null);-return (<><p style={{ margin: '.5em 2em .5em 1em' }}>{t('Click to select which tracks to keep when exporting:')}</p><div style={fileStyle}>{/* We only support editing main file metadata for now */}- <FileHeading onInfoClick={onInfoClick} path={mainFilePath} formatData={mainFileFormatData} chapters={mainFileChapters} onEditClick={() => setEditingFile(mainFilePath)} setCopyAllStreams={(enabled) => setCopyAllStreamsForPath(mainFilePath, enabled)} onExtractAllStreamsPress={onExtractAllStreamsPress} />- <table style={tableStyle}>+ <FileHeading onInfoClick={onInfoClick} path={mainFilePath} formatData={mainFileFormatData} chapters={mainFileChapters} onEditClick={() => setEditingFile(mainFilePath)} toggleCopyAllStreams={() => toggleCopyAllStreamsForPath(mainFilePath)} onExtractAllStreamsPress={onExtractAllStreamsPress} changeEnabledStreamsFilter={changeEnabledStreamsFilter} />+ <table className={styles['table']}><Thead /><tbody>@@ -436,7 +435,7 @@ function StreamsSelector({stream={stream}copyStream={isCopyingStreamId(mainFilePath, stream.index)}onToggle={(streamId) => toggleCopyStreamId(mainFilePath, streamId)}- batchSetCopyStreamIds={(filter: (a: FFprobeStream) => boolean, enabled: boolean) => batchSetCopyStreamIdsForPath(mainFilePath, mainFileStreams, filter, enabled)}+ toggleCopyStreamIds={(filter: (a: FFprobeStream) => boolean) => toggleCopyStreamIds(mainFilePath, filter)}setEditingStream={setEditingStream}fileDuration={getFormatDuration(mainFileFormatData)}onExtractStreamPress={() => onExtractStreamPress(stream.index)}@@ -453,9 +452,9 @@ function StreamsSelector({{externalFilesEntries.map(([path, { streams: externalFileStreams, formatData }]) => (<div key={path} style={fileStyle}>- <FileHeading path={path} formatData={formatData} onTrashClick={() => removeFile(path)} setCopyAllStreams={(enabled) => setCopyAllStreamsForPath(path, enabled)} onInfoClick={onInfoClick} />+ <FileHeading path={path} formatData={formatData} onTrashClick={() => removeFile(path)} toggleCopyAllStreams={() => toggleCopyAllStreamsForPath(path)} onInfoClick={onInfoClick} />- <table style={tableStyle}>+ <table className={styles['table']}><Thead /><tbody>{externalFileStreams.map((stream) => (@@ -465,7 +464,7 @@ function StreamsSelector({stream={stream}copyStream={isCopyingStreamId(path, stream.index)}onToggle={(streamId) => toggleCopyStreamId(path, streamId)}- batchSetCopyStreamIds={(filter: (a: FFprobeStream) => boolean, enabled: boolean) => batchSetCopyStreamIdsForPath(path, externalFileStreams, filter, enabled)}+ toggleCopyStreamIds={(filter: (a: FFprobeStream) => boolean) => toggleCopyStreamIds(path, filter)}setEditingStream={setEditingStream}fileDuration={getFormatDuration(formatData)}paramsByStreamId={paramsByStreamId}@@ -506,7 +505,7 @@ function StreamsSelector({</div>{editingFile != null && (- <Dialog ref={dialogRef} autoOpen onClose={() => setEditingFile(undefined)} style={{ maxWidth: '40em' }}>+ <Dialog autoOpen onClose={() => setEditingFile(undefined)} style={{ width: '100%', maxWidth: '40em' }}><h1 style={{ marginTop: 0 }}>{t('Edit file metadata')}</h1><EditFileDialog editingFile={editingFile} editingTag={editingTag} setEditingTag={setEditingTag} allFilesMeta={allFilesMeta} customTagsByFile={customTagsByFile} setCustomTagsByFile={setCustomTagsByFile} />diff --git a/src/renderer/src/TopMenu.tsx b/src/renderer/src/TopMenu.tsxindex 41297158..e7ae8b48 100644--- a/src/renderer/src/TopMenu.tsx+++ b/src/renderer/src/TopMenu.tsx@@ -1,7 +1,7 @@import { CSSProperties, ReactNode, memo, useCallback, useEffect, useRef } from 'react';import { IoIosSettings } from 'react-icons/io';import { FaLock, FaUnlock } from 'react-icons/fa';-import { CrossIcon, ListIcon, VolumeUpIcon, VolumeOffIcon } from 'evergreen-ui';+import { CrossIcon, FilterIcon, ListIcon } from 'evergreen-ui';import { useTranslation } from 'react-i18next';import Button from './components/Button';@@ -21,8 +21,9 @@ const exportModeStyle = { flexGrow: 0, flexBasis: 140 };function TopMenu({filePath,fileFormat,- copyAnyAudioTrack,- toggleStripAudio,+ changeEnabledStreamsFilter,+ applyEnabledStreamsFilter,+ enabledStreamsFilter,renderOutFmt,numStreamsToCopy,numStreamsTotal,@@ -34,8 +35,9 @@ function TopMenu({}: {filePath: string | undefined,fileFormat: string | undefined,- copyAnyAudioTrack: boolean,- toggleStripAudio: () => void,+ changeEnabledStreamsFilter: () => void,+ applyEnabledStreamsFilter: () => void,+ enabledStreamsFilter: string | undefined,renderOutFmt: (style: CSSProperties) => ReactNode,numStreamsToCopy: number,numStreamsTotal: number,@@ -86,15 +88,20 @@ function TopMenu({{t('Tracks')} ({numStreamsToCopy}/{numStreamsTotal})</Button>+ {enabledStreamsFilter != null && (+ <FilterIcon+ role="button"+ tabIndex={0}+ style={{ width: 20 }}+ onClick={withBlur(() => applyEnabledStreamsFilter())}+ title={t('Toggle tracks using current filter')}+ />+ )}+<Button- title={copyAnyAudioTrack ? t('Keep audio tracks') : t('Discard audio tracks')}- onClick={withBlur(toggleStripAudio)}+ onClick={changeEnabledStreamsFilter}>- {copyAnyAudioTrack ? (- <><VolumeUpIcon size={'1em' as unknown as number} verticalAlign="middle" marginRight=".3em" />{t('Keep audio')}</>- ) : (- <><VolumeOffIcon size={'1em' as unknown as number} verticalAlign="middle" marginRight=".3em" />{t('Discard audio')}</>- )}+ {t('Filter tracks')}</Button></>)}diff --git a/src/renderer/src/components/Action.tsx b/src/renderer/src/components/Action.tsxnew file mode 100644index 00000000..6c1e61c1--- /dev/null+++ b/src/renderer/src/components/Action.tsx@@ -0,0 +1,13 @@+import { TakeActionIcon } from 'evergreen-ui';++import { KeyboardAction } from '../../../../types';+++export default function Action({ name }: { name: KeyboardAction }) {+ return (+ <span style={{ whiteSpace: 'nowrap' }}>+ <TakeActionIcon verticalAlign="middle" style={{ marginRight: '.2em' }} />+ <span style={{ textDecoration: 'underline', textDecorationStyle: 'dotted', textUnderlineOffset: '.2em', cursor: 'alias' }}>{name}</span>+ </span>+ );+}diff --git a/src/renderer/src/components/Button.module.css b/src/renderer/src/components/Button.module.cssindex 0f4b4942..1f53da33 100644--- a/src/renderer/src/components/Button.module.css+++ b/src/renderer/src/components/Button.module.css@@ -7,12 +7,20 @@color: var(--gray-12);border-radius: .3em;padding: 0 .5em 0 .3em;- outline: .05em solid var(--gray-8);border: .05em solid var(--gray-7);cursor: pointer;+ outline-offset: 0;}.button:disabled {opacity: .5;cursor: not-allowed;-}\ No newline at end of file+}++.button:focus {+ outline: .05em solid var(--gray-11);+}++.button:hover {+ filter: brightness(1.1);+}diff --git a/src/renderer/src/components/ConcatDialog.tsx b/src/renderer/src/components/ConcatDialog.tsxindex bf1f603d..192b97ce 100644--- a/src/renderer/src/components/ConcatDialog.tsx+++ b/src/renderer/src/components/ConcatDialog.tsx@@ -1,4 +1,4 @@-import { memo, useState, useCallback, useEffect, useMemo, CSSProperties, useRef } from 'react';+import { memo, useState, useCallback, useEffect, useMemo, CSSProperties } from 'react';import { useTranslation } from 'react-i18next';import { IconButton } from 'evergreen-ui';import { AiOutlineMergeCells } from 'react-icons/ai';@@ -20,6 +20,7 @@ import TextInput from './TextInput';import Button from './Button';import { defaultMergedFileTemplate, generateMergedFileNames, maxFileNameLength } from '../util/outputNameTemplate';import Dialog from './Dialog';+import { primaryColor } from '../colors';const { basename } = window.require('path');@@ -197,12 +198,10 @@ function ConcatDialog({ isShown, onHide, paths, onConcat, alwaysConcatMultipleFionConcat({ paths, includeAllStreams, streams: fileMeta!.streams, outFileName, fileFormat, clearBatchFilesAfterConcat });}, [clearBatchFilesAfterConcat, fileFormat, fileMeta, includeAllStreams, onConcat, outFileName, paths]);- const dialogRef = useRef<HTMLDialogElement>(null);-return (<><Sheet visible={isShown} onClosePress={onHide} maxWidth="100%" style={{ padding: '0 2em' }}>- <h2>{t('Merge/concatenate files')}</h2>+ <h1>{t('Merge/concatenate files')}</h1><div style={{ marginBottom: '1em' }}><div style={{ whiteSpace: 'pre-wrap', fontSize: '.9em', marginBottom: '1em' }}>@@ -234,28 +233,27 @@ function ConcatDialog({ isShown, onHide, paths, onConcat, alwaysConcatMultipleFi)}</div>- <div style={{ display: 'flex', alignItems: 'center', flexWrap: 'wrap', justifyContent: 'flex-end', marginBottom: '1em' }}>- <div style={{ marginRight: '.5em' }}>{t('Output file name')}:</div>- <TextInput value={outFileName || ''} onChange={(e) => setOutFileName(e.target.value)} />- <Button disabled={detectedFileFormat == null || !isOutFileNameValid} onClick={onConcatClick} style={{ fontSize: '1.3em', padding: '0 .3em', marginLeft: '1em' }}>- <AiOutlineMergeCells style={{ fontSize: '1.4em', verticalAlign: 'middle' }} /> {t('Merge!')}- </Button>- </div>-{isOutFileNameTooLong && (<Alert text={t('File name is too long and cannot be exported.')} />)}-{enableReadFileMeta && (!allFilesMeta || Object.values(problemsByFile).length > 0) && (<Alert text={t('A mismatch was detected in at least one file. You may proceed, but the resulting file might not be playable.')} />)}{!enableReadFileMeta && (<Alert text={t('File compatibility check is not enabled, so the merge operation might not produce a valid output. Enable "Check compatibility" below to check file compatibility before merging.')} />)}++ <div style={{ display: 'flex', alignItems: 'center', flexWrap: 'wrap', justifyContent: 'flex-end', marginBottom: '1em' }}>+ <div style={{ marginRight: '.5em' }}>{t('Output file name')}:</div>+ <TextInput value={outFileName || ''} onChange={(e) => setOutFileName(e.target.value)} />+ <Button disabled={detectedFileFormat == null || !isOutFileNameValid} onClick={onConcatClick} style={{ fontSize: '1.3em', padding: '0 .3em', marginLeft: '1em', background: primaryColor, color: 'white', border: 'none' }}>+ <AiOutlineMergeCells style={{ fontSize: '1.4em', verticalAlign: 'middle' }} /> {t('Merge!')}+ </Button>+ </div></Sheet>{settingsVisible && (- <Dialog ref={dialogRef} autoOpen onClose={() => setSettingsVisible(false)} style={{ maxWidth: '40em' }}>+ <Dialog autoOpen onClose={() => setSettingsVisible(false)} style={{ maxWidth: '40em' }}><h1 style={{ marginTop: 0 }}>{t('Merge options')}</h1><Checkbox checked={includeAllStreams} onCheckedChange={(checked) => setIncludeAllStreams(checked === true)} label={`${t('Include all tracks?')} ${t('If this is checked, all audio/video/subtitle/data tracks will be included. This may not always work for all file types. If not checked, only default streams will be included.')}`} />diff --git a/src/renderer/src/components/Dialog.module.css b/src/renderer/src/components/Dialog.module.cssindex 372a5ee5..4205f7fd 100644--- a/src/renderer/src/components/Dialog.module.css+++ b/src/renderer/src/components/Dialog.module.css@@ -1,36 +1,66 @@-dialog::backdrop {- background-color: var(--black-a7);- animation: overlayShow 400ms cubic-bezier(0.16, 1, 0.3, 1);-}+.dialog {+ --duration: 0.2s;-dialog {- border: .1em solid var(--black-a3);+ border: .1em solid var(--black-a5);background: var(--white-a8);color: var(--gray-12);backdrop-filter: blur(2em);border-radius: .5em;padding: 1.7em;- animation: contentShow 200ms cubic-bezier(0.16, 1, 0.3, 1);+ box-shadow: 0 0 1em .3em var(--black-a1);+ transform-origin: center;+ transition:+ translate var(--duration) ease-out,+ scale var(--duration) ease-out,+ opacity var(--duration) ease-out,+ display var(--duration) ease-out allow-discrete;++ &[open] {+ /* Post-Entry (Normal) State */+ scale: 1;+ opacity: 1;++ /* Pre-Entry State */+ @starting-style {+ scale: 0.6;+ opacity: 0;+ }+ }++ &::backdrop {+ background-color: var(--black-a7);+ animation: overlayShow 600ms cubic-bezier(0.16, 1, 0.3, 1);+ }++ h1 {+ text-transform: uppercase;+ font-size: 1.3em;+ margin-top: 0;+ }}-:global(.dark-theme) dialog {- border: .1em solid var(--white-a2);+:global(.dark-theme) .dialog {+ border: .1em solid var(--white-a3);background: var(--black-a4);+ box-shadow: 0 0 1em .3em var(--black-a2);}.close {all: unset;+ position: absolute;+ top: 1em;+ right: 1em;+ cursor: pointer;border-radius: 100%;height: 2em;width: 2em;+ border: .1em solid transparent;display: inline-flex;align-items: center;justify-content: center;color: var(--gray-12);- position: absolute;- top: 1em;- right: 1em;- background-color: var(--gray-3);+ background-color: none;+ transition: background-color 0.2s ease-in-out;}.close:hover {@@ -38,7 +68,7 @@ dialog {}.close:focus {- box-shadow: 0 0 0 .1em var(--gray-7);+ border: .1em solid var(--gray-4);}@keyframes overlayShow {@@ -48,15 +78,4 @@ dialog {to {opacity: 1;}-}--@keyframes contentShow {- from {- opacity: 0;- transform: translate(0, -5%) scale(0.96);- }- to {- opacity: 1;- transform: translate(0, 0) scale(1);- }-}+}diff --git a/src/renderer/src/components/Dialog.tsx b/src/renderer/src/components/Dialog.tsxindex 91749d2e..83a356f2 100644--- a/src/renderer/src/components/Dialog.tsx+++ b/src/renderer/src/components/Dialog.tsx@@ -1,5 +1,6 @@import { FaTimes } from 'react-icons/fa';-import { DetailedHTMLProps, DialogHTMLAttributes, useCallback, useEffect, forwardRef } from 'react';+import { DetailedHTMLProps, DialogHTMLAttributes, useCallback, useEffect, forwardRef, useRef } from 'react';+import invariant from 'tiny-invariant';import styles from './Dialog.module.css';import Button, { ButtonProps } from './Button';@@ -11,14 +12,24 @@ type Props = Omit<DetailedHTMLProps<DialogHTMLAttributes<HTMLDialogElement>, HTM};// eslint-disable-next-line react/display-name-const Dialog = forwardRef<HTMLDialogElement, Props>(({ children, autoOpen, onClose, onClick, ...props }, ref) => {+const Dialog = forwardRef<HTMLDialogElement, Props>(({ children, autoOpen, onClose, onClick, ...props }, refArg) => {+ const localRef = useRef<HTMLDialogElement>(null);+ const ref = refArg ?? localRef;+useEffect(() => {+ invariant('current' in ref);// eslint-disable-next-line react/destructuring-assignment- if (autoOpen) (ref as React.RefObject<HTMLDialogElement>).current?.showModal();- // eslint-disable-next-line react/destructuring-assignment- else (ref as React.RefObject<HTMLDialogElement>).current?.close();+ if (autoOpen) {+ ref.current?.showModal();+ }+ return undefined;}, [autoOpen, ref]);+ const handleClose = useCallback((e: React.MouseEvent<HTMLDialogElement>) => {+ invariant('current' in ref);+ onClose?.(e);+ }, [onClose, ref]);+const handleClick = useCallback((e: React.MouseEvent<HTMLDialogElement>) => {if (!(ref != null && 'current' in ref && ref.current != null)) return;const dialogDimensions = ref.current.getBoundingClientRect();@@ -26,14 +37,14 @@ const Dialog = forwardRef<HTMLDialogElement, Props>(({ children, autoOpen, onClo|| e.clientX > dialogDimensions.right|| e.clientY < dialogDimensions.top|| e.clientY > dialogDimensions.bottom) {- onClose?.(e);+ ref.current?.close();}onClick?.(e);- }, [onClick, onClose, ref]);+ }, [onClick, ref]);return (// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions, react/jsx-props-no-spreading- <dialog {...props} ref={ref} onClose={onClose} onClick={handleClick}>+ <dialog {...props} className={styles['dialog']} ref={ref} onClose={handleClose} onClick={handleClick}>{children}<form method="dialog">diff --git a/src/renderer/src/components/ExportConfirm.module.css b/src/renderer/src/components/ExportConfirm.module.cssindex 6510c73b..715d5314 100644--- a/src/renderer/src/components/ExportConfirm.module.css+++ b/src/renderer/src/components/ExportConfirm.module.css@@ -9,6 +9,23 @@backdrop-filter: blur(30px);overflow-y: scroll;display: flex;++ table.options {+ width: 100%;+ }++ table.options td:nth-child(2) {+ text-align: right;+ }++ table.options td:last-child {+ text-align: center;+ width: 1.7em;+ }++ table.options td {+ vertical-align: top;+ }}:global(.dark-theme) .sheet {@@ -22,20 +39,3 @@:global(.dark-theme) .box {background: var(--black-a11);}--table.options {- width: 100%;-}--table.options td:nth-child(2) {- text-align: right;-}--table.options td:last-child {- text-align: center;- width: 1.7em;-}--table.options td {- vertical-align: top;-}\ No newline at end of filediff --git a/src/renderer/src/components/ExportConfirm.tsx b/src/renderer/src/components/ExportConfirm.tsxindex 4e93adc1..e9211fee 100644--- a/src/renderer/src/components/ExportConfirm.tsx+++ b/src/renderer/src/components/ExportConfirm.tsx@@ -27,13 +27,14 @@ import { FFprobeStream } from '../../../../ffprobe';import { AvoidNegativeTs, PreserveMetadata } from '../../../../types';import TextInput from './TextInput';import { UseSegments } from '../hooks/useSegments';+import Warning from './Warning';const boxStyle: CSSProperties = { margin: '15px 15px 50px 15px', borderRadius: 10, padding: '10px 20px', minHeight: 500, position: 'relative' };const outDirStyle: CSSProperties = { ...highlightedTextStyle, wordBreak: 'break-all', cursor: 'pointer' };-const warningStyle: CSSProperties = { color: 'var(--orange-8)', fontSize: '80%', marginBottom: '.5em' };+const warningStyle: CSSProperties = { fontSize: '80%', marginBottom: '.5em' };const infoStyle: CSSProperties = { color: 'var(--gray-12)', fontSize: '80%', marginBottom: '.5em' };@@ -246,14 +247,14 @@ function ExportConfirm({<div style={boxStyle} className={styles['box']}><CrossIcon size={24} style={{ position: 'absolute', right: 0, top: 0, padding: 15, boxSizing: 'content-box', cursor: 'pointer' }} role="button" onClick={onClosePress} />- <h2 style={{ marginTop: 0, marginBottom: '.5em' }}>{t('Export options')}</h2>+ <h1 style={{ textTransform: 'uppercase', fontSize: '1.4em', marginTop: 0, marginBottom: '.5em' }}>{t('Export options')}</h1><table className={styles['options']}><tbody>{notices.map(({ warning, text }) => (<tr key={text}><td colSpan={2}>- <div style={{ ...(warning ? warningStyle : infoStyle), display: 'flex', alignItems: 'center', gap: '0 .5em' }}>+ <div style={{ ...(warning ? { ...warningStyle, color: 'var(--orange-8)' } : infoStyle), display: 'flex', alignItems: 'center', gap: '0 .5em' }}>{warning ? (<WarningSignIcon verticalAlign="middle" color="warning" flexShrink="0" />) : (@@ -306,7 +307,7 @@ function ExportConfirm({<td><Trans>Input has {{ numStreamsTotal }} tracks</Trans>{areWeCuttingProblematicStreams && (- <div style={warningStyle}><Trans>Warning: Cutting thumbnail tracks is known to cause problems. Consider disabling track {{ trackNumber: mainCopiedThumbnailStreams[0] ? mainCopiedThumbnailStreams[0].index + 1 : 0 }}.</Trans></div>+ <Warning style={warningStyle}><Trans>Warning: Cutting thumbnail tracks is known to cause problems. Consider disabling track {{ trackNumber: mainCopiedThumbnailStreams[0] ? mainCopiedThumbnailStreams[0].index + 1 : 0 }}.</Trans></Warning>)}</td><td>@@ -405,7 +406,7 @@ function ExportConfirm({</td><td><Switch checked={movFastStart} onCheckedChange={toggleMovFastStart} />- {isIpod && !movFastStart && <div style={warningStyle}>{t('For the ipod format, it is recommended to activate this option')}</div>}+ {isIpod && !movFastStart && <Warning style={warningStyle}>{t('For the ipod format, it is recommended to activate this option')}</Warning>}</td><td>{isIpod && !movFastStart ? (@@ -419,7 +420,7 @@ function ExportConfirm({<tr><td>{t('Preserve all MP4/MOV metadata?')}- {isIpod && preserveMovData && <div style={warningStyle}>{t('For the ipod format, it is recommended to deactivate this option')}</div>}+ {isIpod && preserveMovData && <Warning style={warningStyle}>{t('For the ipod format, it is recommended to deactivate this option')}</Warning>}</td><td><Switch checked={preserveMovData} onCheckedChange={togglePreserveMovData} />@@ -503,7 +504,7 @@ function ExportConfirm({<tr><td>{t('Smart cut (experimental):')}- {needSmartCut && <div style={warningStyle}>{t('Smart cut is experimental and will not work on all files.')}</div>}+ {needSmartCut && <Warning style={warningStyle}>{t('Smart cut is experimental and will not work on all files.')}</Warning>}</td><td>@@ -542,7 +543,7 @@ function ExportConfirm({<tr><td>{t('Keyframe cut mode')}- {!keyframeCut && <div style={warningStyle}>{t('Note: Keyframe cut is recommended for most common files')}</div>}+ {!keyframeCut && <Warning style={warningStyle}>{t('Note: Keyframe cut is recommended for most common files')}</Warning>}</td><td><Switch checked={keyframeCut} onCheckedChange={() => toggleKeyframeCut()} />@@ -577,7 +578,7 @@ function ExportConfirm({<tr><td>"ffmpeg" <code className="highlighted">avoid_negative_ts</code>- {avoidNegativeTsWarn != null && <div style={warningStyle}>{avoidNegativeTsWarn}</div>}+ {avoidNegativeTsWarn != null && <Warning style={warningStyle}>{avoidNegativeTsWarn}</Warning>}</td><td><Select value={avoidNegativeTs} onChange={(e) => setAvoidNegativeTs(e.target.value as AvoidNegativeTs)} style={{ height: 20, marginLeft: 5 }}>@@ -634,7 +635,7 @@ function ExportConfirm({style={{ display: 'flex', alignItems: 'flex-end', background: 'var(--gray-2)' }}><ToggleExportConfirm size={25} />- <div style={{ fontSize: 13, marginLeft: 3, marginRight: 7, maxWidth: 120, lineHeight: '100%', color: exportConfirmEnabled ? 'var(--gray-12)' : 'var(--gray-11)', cursor: 'pointer' }} role="button" onClick={toggleExportConfirmEnabled}>{t('Show this page before exporting?')}</div>+ <div style={{ fontSize: 13, marginLeft: 3, marginRight: 7, maxWidth: 120, lineHeight: '100%', color: exportConfirmEnabled ? 'var(--gray-12)' : 'var(--gray-11)' }} role="button" onClick={toggleExportConfirmEnabled}>{t('Show this page before exporting?')}</div></motion.div><motion.divdiff --git a/src/renderer/src/components/KeyboardShortcuts.tsx b/src/renderer/src/components/KeyboardShortcuts.tsxindex bc1e852e..d2e6d1e1 100644--- a/src/renderer/src/components/KeyboardShortcuts.tsx+++ b/src/renderer/src/components/KeyboardShortcuts.tsx@@ -1,11 +1,12 @@import { memo, Fragment, useEffect, useMemo, useCallback, useState, ReactNode, SetStateAction, Dispatch, useRef } from 'react';import { useTranslation } from 'react-i18next';-import { SearchInput, PlusIcon, UndoIcon, TakeActionIcon, IconButton, Button, DeleteIcon, AddIcon } from 'evergreen-ui';+import { UndoIcon, IconButton, DeleteIcon, AddIcon } from 'evergreen-ui';import { FaMouse, FaPlus, FaStepForward, FaStepBackward } from 'react-icons/fa';import Mousetrap from 'mousetrap';import groupBy from 'lodash/groupBy';import orderBy from 'lodash/orderBy';import uniq from 'lodash/uniq';+import { AnimatePresence, motion } from 'framer-motion';import useUserSettings from '../hooks/useUserSettings';import SetCutpointButton from './SetCutpointButton';@@ -16,6 +17,10 @@ import { StateSegment } from '../types';import Sheet from './Sheet';import { splitKeyboardKeys } from '../util';import Dialog, { ConfirmButton } from './Dialog';+import Warning from './Warning';+import Button from './Button';+import Action from './Action';+import TextInput from './TextInput';type Category = string;@@ -25,7 +30,7 @@ type ActionsMap = Record<KeyboardAction, { name: string, category?: Category, beconst renderKeys = (keys: string[]) => keys.map((key, i) => (<Fragment key={key}>- {i > 0 && <FaPlus style={{ fontSize: '.4em', opacity: 0.8, marginLeft: '.4em', marginRight: '.4em' }} />}+ {i > 0 && <FaPlus style={{ verticalAlign: 'middle', fontSize: '.4em', opacity: 0.8, marginLeft: '.4em', marginRight: '.4em' }} />}<kbd>{key.toUpperCase()}</kbd></Fragment>));@@ -92,27 +97,35 @@ const CreateBinding = memo(({const isComboInvalid = validKeysDown.length === 0 && keysDown.length > 0;- const dialogRef = useRef<HTMLDialogElement>(null);-const fixedKeys = useMemo(() => fixKeys(keysDown), [keysDown]);if (!isShown) return null;return (- <Dialog ref={dialogRef} autoOpen onClose={() => setCreatingBinding(undefined)} style={{ maxWidth: '40em' }}>+ <Dialog autoOpen onClose={() => setCreatingBinding(undefined)} style={{ maxWidth: '40em' }}><h1 style={{ marginTop: 0 }}>{t('Bind new key to action')}</h1>- <p><TakeActionIcon verticalAlign="middle" marginRight={5} /> {actionsMap[action].name} <span style={{ color: 'var(--gray-10)' }}>({action})</span></p>+ <p>{t('Action:')} {actionsMap[action].name} <span style={{ color: 'var(--gray-10)', marginLeft: '.5em' }}><Action name={action} /></span></p><p>{t('Please press your desired key combination. Make sure it doesn\'t conflict with any other binding or system hotkeys.')}</p>- <div style={{ margin: '20px 0' }}>{renderKeys(validKeysDown.length > 0 ? validKeysDown : keysDown)}</div>+ <div style={{ minHeight: '2em' }}>{renderKeys(validKeysDown.length > 0 ? validKeysDown : keysDown)}</div>- {isComboInvalid && <p>{t('Combination is invalid')}</p>}+ <AnimatePresence>+ {isComboInvalid && (+ <motion.div+ initial={{ height: 0, opacity: 0 }}+ animate={{ height: 'auto', opacity: 1 }}+ exit={{ height: 0, opacity: 0 }}+ >+ <Warning style={{ paddingBottom: '1em' }}>{t('Combination is invalid')}</Warning>+ </motion.div>+ )}+ </AnimatePresence><div style={{ marginBottom: '1em' }}>- {!keysDown.includes('esc') && <Button iconBefore={PlusIcon} onClick={() => addKeyDown('esc')}>ESC</Button>}- {keysDown.length > 0 && <Button intent="warning" iconBefore={UndoIcon} onClick={() => setKeysDown([])}>{t('Start over')}</Button>}+ <Button disabled={keysDown.includes('esc')} style={{ padding: '.2em .4em' }} onClick={() => addKeyDown('esc')}>ESC</Button>+ {keysDown.length > 0 && <Button style={{ padding: '.2em .4em' }} onClick={() => setKeysDown([])}><UndoIcon size={10} marginRight=".3em" />{t('Start over')}</Button>}</div><ConfirmButton disabled={fixedKeys.length === 0 || isComboInvalid} onClick={() => action != null && onNewKeyBindingConfirmed(action, keysDown)}>{t('Save')}</ConfirmButton>@@ -535,6 +548,10 @@ const KeyboardShortcuts = memo(({name: t('Set current frame as cover art'),category: outputCategory,},+ exportYouTube: {+ name: t('Start times as YouTube Chapters'),+ category: outputCategory,+ },extractCurrentSegmentFramesAsImages: {name: t('Extract frames from current segment as image files'),category: outputCategory,@@ -603,10 +620,26 @@ const KeyboardShortcuts = memo(({name: t('Keep or discard audio tracks'),category: otherCategory,},+ toggleStripVideo: {+ name: t('Keep or discard video tracks'),+ category: otherCategory,+ },+ toggleStripSubtitle: {+ name: t('Keep or discard subtitle tracks'),+ category: otherCategory,+ },toggleStripThumbnail: {name: t('Keep or discard thumbnail tracks'),category: otherCategory,},+ toggleStripAll: {+ name: t('Keep or discard all tracks'),+ category: otherCategory,+ },+ toggleStripCurrentFilter: {+ name: t('Toggle tracks using current filter'),+ category: otherCategory,+ },increaseRotation: {name: t('Change rotation'),category: otherCategory,@@ -647,6 +680,10 @@ const KeyboardShortcuts = memo(({name: t('Settings'),category: otherCategory,},+ toggleDarkMode: {+ name: t('Toggle dark mode'),+ category: otherCategory,+ },openSendReportDialog: {name: t('Report an error'),category: otherCategory,@@ -659,10 +696,6 @@ const KeyboardShortcuts = memo(({name: t('Open folder'),category: otherCategory,},- exportYouTube: {- name: t('Start times as YouTube Chapters'),- category: otherCategory,- },closeActiveScreen: {name: t('Close current screen'),category: otherCategory,@@ -720,16 +753,16 @@ const KeyboardShortcuts = memo(({searchInputRef.current?.focus();}, []);+ const searchQueryTrimmed = searchQuery.toLowerCase().trim();+ const isSearching = !!searchQueryTrimmed;+// eslint-disable-next-line @typescript-eslint/no-explicit-any- const actionEntries = useMemo(() => (Object.entries(actionsMap) as any as [keyof typeof actionsMap, typeof actionsMap[keyof typeof actionsMap]][]).filter(([key, { name, category }]) => {- const searchQueryTrimmed = searchQuery.toLowerCase().trim();- return (- !searchQuery- || key.toLocaleLowerCase().includes(searchQueryTrimmed)- || name.toLowerCase().includes(searchQueryTrimmed)- || (category != null && category.toLowerCase().includes(searchQueryTrimmed))- );- }), [actionsMap, searchQuery]);+ const actionEntries = useMemo(() => (Object.entries(actionsMap) as any as [keyof typeof actionsMap, typeof actionsMap[keyof typeof actionsMap]][]).filter(([key, { name, category }]) => (+ !isSearching+ || key.toLocaleLowerCase().includes(searchQueryTrimmed)+ || name.toLowerCase().includes(searchQueryTrimmed)+ || (category != null && category.toLowerCase().includes(searchQueryTrimmed))+ )), [actionsMap, isSearching, searchQueryTrimmed]);const categoriesWithActions = useMemo(() => Object.entries(groupBy(actionEntries, ([, { category }]) => category)), [actionEntries]);@@ -744,7 +777,7 @@ const KeyboardShortcuts = memo(({const onResetClick = useCallback(() => {// eslint-disable-next-line no-alert- if (!window.confirm(t('Are you sure?'))) return;+ if (!window.confirm(t('Are you sure you want to reset all keyboard bindings?'))) return;resetKeyBindings();}, [resetKeyBindings, t]);@@ -784,7 +817,7 @@ const KeyboardShortcuts = memo(({<><div style={{ marginBottom: '1em' }}><div style={{ marginBottom: '1em' }}>- <SearchInput ref={searchInputRef} value={searchQuery} onChange={(e) => setSearchQuery(e.target.value)} placeholder="Search" width="100%" />+ <TextInput ref={searchInputRef} value={searchQuery} onChange={(e) => setSearchQuery(e.target.value)} placeholder="Search" style={{ width: '100%', padding: '.4em .8em' }} /></div>{categoriesWithActions.map(([category, actionsInCategory]) => (@@ -829,7 +862,7 @@ const KeyboardShortcuts = memo(({))}</div>- <Button intent="danger" onClick={onResetClick}>{t('Reset')}</Button>+ {!isSearching && <Button onClick={onResetClick} style={{ marginBottom: '1em' }}>{t('Reset')}</Button>}<CreateBinding actionsMap={actionsMap} action={creatingBinding} setCreatingBinding={setCreatingBinding} onNewKeyBindingConfirmed={onNewKeyBindingConfirmed} /></>@@ -850,11 +883,9 @@ function KeyboardShortcutsDialog({return (<Sheet visible={isShown} onClosePress={onHide} maxWidth="40em" style={{ padding: '0 2em' }}>- <h2>{t('Keyboard & mouse shortcuts')}</h2>+ <h1>{t('Keyboard & mouse shortcuts')}</h1><KeyboardShortcuts keyBindings={keyBindings} setKeyBindings={setKeyBindings} currentCutSeg={currentCutSeg} resetKeyBindings={resetKeyBindings} />- <Button onClick={onHide}>{t('Done')}</Button>-</Sheet>);}diff --git a/src/renderer/src/components/Sheet.module.css b/src/renderer/src/components/Sheet.module.cssindex fbe2f709..d2f395e2 100644--- a/src/renderer/src/components/Sheet.module.css+++ b/src/renderer/src/components/Sheet.module.css@@ -7,8 +7,32 @@background: var(--white-a11);color: var(--gray-12);backdrop-filter: blur(30px);++ h1 {+ text-transform: uppercase;+ font-size: 1.3em;+ }}:global(.dark-theme) .sheet {background: var(--black-a11);}++.close {+ position: absolute;+ padding: .5em;+ margin: .2em;+ right: 0;+ top: 0;+ cursor: pointer;+ border-radius: 100%;+ font-size: 1.3em;++ color: var(--gray-12);+ background-color: none;+ transition: background-color 0.2s ease-in-out;+}++.close:hover {+ background-color: var(--gray-4);+}\ No newline at end of filediff --git a/src/renderer/src/components/Sheet.tsx b/src/renderer/src/components/Sheet.tsxindex 4b67011d..f2c0d343 100644--- a/src/renderer/src/components/Sheet.tsx+++ b/src/renderer/src/components/Sheet.tsx@@ -1,13 +1,17 @@import { CSSProperties, ReactNode, memo } from 'react';-import { IoIosCloseCircleOutline } from 'react-icons/io';import { motion, AnimatePresence } from 'framer-motion';import { useTranslation } from 'react-i18next';+import { FaTimes } from 'react-icons/fa';import styles from './Sheet.module.css';function Sheet({ visible, onClosePress, children, maxWidth = 800, style }: {- visible: boolean, onClosePress: () => void, children: ReactNode, maxWidth?: number | string, style?: CSSProperties+ visible: boolean,+ onClosePress: () => void,+ children: ReactNode,+ maxWidth?: number | string,+ style?: CSSProperties,}) {const { t } = useTranslation();@@ -25,7 +29,7 @@ function Sheet({ visible, onClosePress, children, maxWidth = 800, style }: {{children}</div>- <IoIosCloseCircleOutline role="button" onClick={onClosePress} title={t('Close')} size={30} style={{ position: 'absolute', padding: '1em', right: 0, top: 0, cursor: 'pointer' }} />+ <FaTimes role="button" className={styles['close']} onClick={onClosePress} title={t('Close')} /></div></motion.div>)}diff --git a/src/renderer/src/components/TagEditor.tsx b/src/renderer/src/components/TagEditor.tsxindex bf7ea506..7640c447 100644--- a/src/renderer/src/components/TagEditor.tsx+++ b/src/renderer/src/components/TagEditor.tsx@@ -2,12 +2,14 @@ import { memo, useRef, useState, useMemo, useCallback, useEffect, FormEventHandlimport { useTranslation } from 'react-i18next';import { TrashIcon, ResetIcon, TickIcon, EditIcon, PlusIcon, IconButton } from 'evergreen-ui';import invariant from 'tiny-invariant';+import { motion } from 'framer-motion';import { SegmentTags, segmentTagsSchema } from '../types';import CopyClipboardButton from './CopyClipboardButton';import { errorToast } from '../swal';import TextInput from './TextInput';import Button from './Button';+import Warning from './Warning';const { clipboard } = window.require('electron');@@ -110,9 +112,11 @@ function TagEditor({ existingTags = emptyObject, customTags = emptyObject, editiref.current?.focus();}, [editingTag]);+ const canAdd = !newTagKey && (editingTag == null || mergedTags[editingTag] == null);+return (<>- <table style={{ marginBottom: 10 }}>+ <table style={{ marginBottom: '1em' }}><tbody>{Object.keys(mergedTags).map((tag) => {const editingThis = tag === editingTag;@@ -121,7 +125,14 @@ function TagEditor({ existingTags = emptyObject, customTags = emptyObject, editiconst thisTagNew = existingTags[tag] == null;return (- <tr key={tag}>+ <motion.tr+ transition={{ duration: 0.2 }}+ layout+ key={tag}+ initial={{ opacity: 0 }}+ animate={{ opacity: 1 }}+ exit={{ opacity: 0 }}+ ><td style={{ paddingRight: '1em', color: thisTagNew ? activeColor : 'var(--gray-11)' }}>{tag}</td><td style={{ display: 'flex', alignItems: 'center' }}>@@ -135,24 +146,20 @@ function TagEditor({ existingTags = emptyObject, customTags = emptyObject, editi{(editingTag == null || editingThis) && <IconButton icon={Icon} title={t('Edit')} appearance="minimal" style={{ marginLeft: '.4em' }} onClick={() => onEditClick(tag)} intent={editingThis ? 'success' : 'none'} />}{editingThis && <IconButton icon={thisTagNew ? TrashIcon : ResetIcon} title={thisTagNew ? t('Delete') : t('Reset')} appearance="minimal" onClick={onResetClick} intent="danger" />}</td>- </tr>+ </motion.tr>);})}</tbody></table>- {(!newTagKey && (editingTag == null || mergedTags[editingTag] == null)) && (- <>- <form onSubmit={onAddSubmit}>- <TextInput value={newTagKeyInput} onChange={(e) => setNewTagKeyInput(e.target.value)} placeholder={addTagTitle} style={{ marginBottom: '1em', padding: '.4em', marginRight: '1em' }} />- <Button type="button" title={addTagTitle} onClick={add} style={{ padding: '.3em' }}><PlusIcon style={{ verticalAlign: 'middle' }} /></Button>- </form>+ <form onSubmit={onAddSubmit} style={{ opacity: canAdd ? undefined : 0.5 }}>+ <TextInput ref={ref} disabled={!canAdd} value={newTagKeyInput} onChange={(e) => setNewTagKeyInput(e.target.value)} placeholder={addTagTitle} style={{ marginBottom: '1em', padding: '.4em', marginRight: '1em' }} />+ <Button type="button" disabled={!canAdd} title={addTagTitle} onClick={add} style={{ padding: '.3em' }}><PlusIcon style={{ verticalAlign: 'middle' }} /></Button>+ </form>- {newTagKeyInputError && <div>{t('Invalid character(s) found in key')}</div>}- </>- )}+ {newTagKeyInputError && <Warning>{t('Invalid character(s) found in key')}</Warning>}- <div style={{ marginTop: '1em', marginBottom: '1em' }}>+ <div style={{ marginBottom: '1em' }}><CopyClipboardButton text={JSON.stringify(mergedTags, null, 2)} style={{ marginRight: '.3em', verticalAlign: 'middle' }}>{({ onClick }) => <Button onClick={onClick} style={{ display: 'block' }}>{t('Copy to clipboard')}</Button>}</CopyClipboardButton>diff --git a/src/renderer/src/components/ToggleExportConfirm.tsx b/src/renderer/src/components/ToggleExportConfirm.tsxindex 990ae18e..018a8e28 100644--- a/src/renderer/src/components/ToggleExportConfirm.tsx+++ b/src/renderer/src/components/ToggleExportConfirm.tsx@@ -12,7 +12,7 @@ function ToggleExportConfirm({ size = 23, style }: { size?: number | undefined,const { exportConfirmEnabled, toggleExportConfirmEnabled } = useUserSettings();return (- <MdEventNote style={{ color: exportConfirmEnabled ? primaryTextColor : 'var(--gray-11)', ...style }} size={size} title={t('Show export options screen before exporting?')} role="button" onClick={toggleExportConfirmEnabled} />+ <MdEventNote style={{ color: exportConfirmEnabled ? primaryTextColor : 'var(--gray-11)', ...style, cursor: 'pointer' }} size={size} title={t('Show export options screen before exporting?')} role="button" onClick={toggleExportConfirmEnabled} />);}diff --git a/src/renderer/src/components/Warning.tsx b/src/renderer/src/components/Warning.tsxnew file mode 100644index 00000000..f8d60213--- /dev/null+++ b/src/renderer/src/components/Warning.tsx@@ -0,0 +1,8 @@+import { DetailedHTMLProps, HTMLAttributes, useMemo } from 'react';+++export default function Warning({ style, ...props }: DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>) {+ const mergedStyle = useMemo(() => ({ color: 'var(--orange-8)', ...style }), [style]);+ // eslint-disable-next-line react/jsx-props-no-spreading+ return <div style={mergedStyle} {...props} />;+}diff --git a/src/renderer/src/dialogs/index.tsx b/src/renderer/src/dialogs/index.tsxindex c76436ea..123fc8ac 100644--- a/src/renderer/src/dialogs/index.tsx+++ b/src/renderer/src/dialogs/index.tsx@@ -16,6 +16,7 @@ import Checkbox from '../components/Checkbox';import { isWindows, showItemInFolder } from '../util';import { ParseTimecode } from '../types';import { FindKeyframeMode } from '../ffmpeg';+import Action from '../components/Action';const remote = window.require('@electron/remote');const { dialog, shell } = remote;@@ -600,15 +601,16 @@ export async function selectSegmentsByLabelDialog(currentName?: string | undefinreturn value;}-export async function exprDialog({ inputValidator, examples, title, description, variables }: {+export async function exprDialog({ inputValidator, examples, title, description, variables, inputValue }: {inputValidator: (v: string) => Promise<string | undefined>,- examples: Record<string, { name: string, code: string }>,+ examples: { name: string, code: string }[],title: string,description: ReactNode,- variables: string[]+ variables?: string[],+ inputValue?: string | undefined,}) {- function addExample(type: string) {- Swal.getInput()!.value = examples[type]?.code ?? '';+ function addExample(code: string) {+ Swal.getInput()!.value = code;}const { value } = await ReactSwal.fire<string>({@@ -622,17 +624,18 @@ export async function exprDialog({ inputValidator, examples, title, description,{description}</div>- <div style={{ marginBottom: '1em' }}><b>{i18n.t('Variables')}:</b> {variables.join(', ')}</div>+ {variables && <div style={{ marginBottom: '1em' }}>{i18n.t('Variables')}: <span style={{ display: 'inline-flex', gap: '.5em' }}>{variables.map((v) => <code key={v} className="highlighted">{v}</code>)}</span></div>}<div><b>{i18n.t('Examples')}:</b></div>- {Object.entries(examples).map(([key, { name }]) => (- <button key={key} type="button" onClick={() => addExample(key)} className="link-button" style={{ display: 'block', marginBottom: '.1em' }}>+ {examples.map(({ name, code }) => (+ <button key={code} type="button" onClick={() => addExample(code)} className="link-button" style={{ display: 'block', marginBottom: '.1em' }}>{name}</button>))}</div>),+ inputValue,inputPlaceholder: i18n.t('Enter JavaScript expression'),inputValidator,});@@ -642,33 +645,53 @@ export async function exprDialog({ inputValidator, examples, title, description,export async function selectSegmentsByExprDialog(inputValidator: (v: string) => Promise<string | undefined>) {return exprDialog({inputValidator,- examples: {- duration: { name: i18n.t('Segment duration less than 5 seconds'), code: 'segment.duration < 5' },- start: { name: i18n.t('Segment starts after 01:00'), code: 'segment.start > 60' },- label: { name: i18n.t('Segment label (exact)'), code: "segment.label === 'My label'" },- regexp: { name: i18n.t('Segment label (regexp)'), code: '/^My label/.test(segment.label)' },- tag: { name: i18n.t('Segment tag value'), code: "segment.tags.myTag === 'tag value'" },- markers: { name: i18n.t('Markers'), code: 'segment.end == null' },- },+ examples: [+ { name: i18n.t('Segment duration less than 5 seconds'), code: 'segment.duration < 5' },+ { name: i18n.t('Segment starts after 01:00'), code: 'segment.start > 60' },+ { name: i18n.t('Segment label (exact)'), code: "segment.label === 'My label'" },+ { name: i18n.t('Segment label (regexp)'), code: '/^My label/.test(segment.label)' },+ { name: i18n.t('Segment tag value'), code: "segment.tags.myTag === 'tag value'" },+ { name: i18n.t('Markers'), code: 'segment.end == null' },+ ],title: i18n.t('Select segments by expression'),description: <Trans>Enter a JavaScript expression which will be evaluated for each segment. Segments for which the expression evaluates to "true" will be selected. <button type="button" className="link-button" onClick={() => shell.openExternal('https://github.com/mifi/lossless-cut/blob/master/expressions.md')}>View available syntax.</button></Trans>,variables: ['segment.index', 'segment.label', 'segment.start', 'segment.end', 'segment.duration', 'segment.tags.*'],});}+export async function filterEnabledStreamsDialog({ validator, value }: {+ validator: (v: string) => Promise<string | undefined>,+ value: string | undefined,+}) {+ return exprDialog({+ inputValidator: validator,+ examples: [+ { name: i18n.t('Audio tracks'), code: "track.codec_type === 'audio'" },+ { name: i18n.t('Video tracks'), code: "track.codec_type === 'video'" },+ { name: i18n.t('English language tracks'), code: "track.tags?.language === 'eng'" },+ { name: i18n.t('Tracks with at least 720p video'), code: 'track.height >= 720' },+ { name: i18n.t('Tracks with H264 codec'), code: "track.codec_name === 'h264'" },+ { name: i18n.t('1st, 2nd and 3rd track'), code: 'track.index >= 0 && track.index <= 2' },+ ],+ title: i18n.t('Toggle tracks by expression'),+ description: <Trans>Enter a JavaScript filter expression which will be evaluated for each track of the current file. Tracks for which the expression evaluates to "true" will be selected or deselected. You may also the <Action name="toggleStripCurrentFilter" /> keyboard action to run this filter.</Trans>,+ inputValue: value ?? '',+ });+}+export async function mutateSegmentsByExprDialog(inputValidator: (v: string) => Promise<string | undefined>) {return exprDialog({inputValidator,- examples: {- expand: { name: i18n.t('Expand segments +5 sec'), code: '{ start: segment.start - 5, end: segment.end + 5 }' },- shrink: { name: i18n.t('Shrink segments -5 sec'), code: '{ start: segment.start + 5, end: segment.end - 5 }' },- center: { name: i18n.t('Center segments around start time'), code: '{ start: segment.start - 5, end: segment.start + 5 }' },+ examples: [+ { name: i18n.t('Expand segments +5 sec'), code: '{ start: segment.start - 5, end: segment.end + 5 }' },+ { name: i18n.t('Shrink segments -5 sec'), code: '{ start: segment.start + 5, end: segment.end - 5 }' },+ { name: i18n.t('Center segments around start time'), code: '{ start: segment.start - 5, end: segment.start + 5 }' },// eslint-disable-next-line no-template-curly-in-string- addNumToLabel: { name: i18n.t('Add number suffix to label'), code: '{ label: `${segment.label} ${segment.index + 1}` }' },- tagEven: { name: i18n.t('Add a tag to every even segment'), code: '{ tags: (segment.index + 1) % 2 === 0 ? { ...segment.tags, even: \'true\' } : segment.tags }' },- segmentsToMarkers: { name: i18n.t('Convert segments to markers'), code: '{ end: undefined }' },- markersToSegments: { name: i18n.t('Convert markers to segments'), code: '{ ...(segment.end == null && { end: segment.start + 5 }) }' },- },+ { name: i18n.t('Add number suffix to label'), code: '{ label: `${segment.label} ${segment.index + 1}` }' },+ { name: i18n.t('Add a tag to every even segment'), code: '{ tags: (segment.index + 1) % 2 === 0 ? { ...segment.tags, even: \'true\' } : segment.tags }' },+ { name: i18n.t('Convert segments to markers'), code: '{ end: undefined }' },+ { name: i18n.t('Convert markers to segments'), code: '{ ...(segment.end == null && { end: segment.start + 5 }) }' },+ ],title: i18n.t('Edit segments by expression'),description: <Trans>Enter a JavaScript expression which will be evaluated for each selected segment. Returned properties will be edited. <button type="button" className="link-button" onClick={() => shell.openExternal('https://github.com/mifi/lossless-cut/blob/master/expressions.md')}>View available syntax.</button></Trans>,variables: ['segment.index', 'segment.label', 'segment.start', 'segment.end', 'segment.tags.*'],@@ -686,6 +709,7 @@ export function showJson5Dialog({ title, json, darkMode }: { title: string, jsonshowCloseButton: true,title,html,+ width: '50em',});}diff --git a/src/renderer/src/hooks/useStreamsMeta.ts b/src/renderer/src/hooks/useStreamsMeta.tsindex 1312aed1..c6ea0151 100644--- a/src/renderer/src/hooks/useStreamsMeta.ts+++ b/src/renderer/src/hooks/useStreamsMeta.ts@@ -1,17 +1,25 @@import { useCallback, useMemo, useState } from 'react';+import pMap from 'p-map';import invariant from 'tiny-invariant';import { isStreamThumbnail, shouldCopyStreamByDefault } from '../util/streams';import StreamsSelector from '../StreamsSelector';import { FFprobeStream } from '../../../../ffprobe';+import { FilesMeta } from '../types';+import safeishEval from '../worker/eval';+import i18n from '../i18n';+import { filterEnabledStreamsDialog } from '../dialogs';-export default ({ mainStreams, filePath, autoExportExtraStreams }: {+export default ({ mainStreams, externalFilesMeta, filePath, autoExportExtraStreams }: {mainStreams: FFprobeStream[],+ externalFilesMeta: FilesMeta,filePath: string | undefined,autoExportExtraStreams: boolean,}) => {const [copyStreamIdsByFile, setCopyStreamIdsByFile] = useState<Record<string, Record<string, boolean>>>({});+ // this will be remembered between files:+ const [enabledStreamsFilter, setEnabledStreamsFilter] = useState<string>();const isCopyingStreamId = useCallback((path: string | undefined, streamId: number) => (!!((path != null && copyStreamIdsByFile[path]) || {})[streamId]@@ -43,28 +51,81 @@ export default ({ mainStreams, filePath, autoExportExtraStreams }: {});}, []);- const checkCopyingAnyTrackOfType = useCallback((filter: (s: FFprobeStream) => boolean) => mainStreams.some((stream) => isCopyingStreamId(filePath, stream.index) && filter(stream)), [filePath, isCopyingStreamId, mainStreams]);+ const toggleCopyStreamIdsInternal = useCallback((path: string, streams: FFprobeStream[]) => {+ setCopyStreamIdsForPath(path, (old) => {+ const ret = { ...old };+ // eslint-disable-next-line unicorn/no-array-callback-reference+ streams.forEach(({ index }) => {+ ret[index] = !ret[index];+ });+ return ret;+ });+ }, [setCopyStreamIdsForPath]);++ const toggleCopyStreamIds = useCallback((path: string, filter: (a: FFprobeStream) => boolean) => {+ const streams = path === filePath ? mainStreams : externalFilesMeta[path]?.streams;+ if (!streams) return;+ toggleCopyStreamIdsInternal(path, streams.filter((stream) => filter(stream)));+ }, [externalFilesMeta, filePath, mainStreams, toggleCopyStreamIdsInternal]);- const toggleStripStream = useCallback((filter: (s: FFprobeStream) => boolean) => {- const copyingAnyTrackOfType = checkCopyingAnyTrackOfType(filter);+ const filterEnabledStreams = useCallback(async (expr: string) => (await pMap(mainStreams, async (stream) => (+ (await safeishEval(expr, { track: stream })) === true ? [stream] : []+ ), { concurrency: 5 })).flat(), [mainStreams]);++ const applyEnabledStreamsFilter = useCallback(async (expr = enabledStreamsFilter) => {+ if (expr == null) return;invariant(filePath != null);- setCopyStreamIdsForPath(filePath, (old) => {- const newCopyStreamIds = { ...old };- mainStreams.forEach((stream) => {- if (filter(stream)) newCopyStreamIds[stream.index] = !copyingAnyTrackOfType;- });- return newCopyStreamIds;++ const filteredStreams = await filterEnabledStreams(expr);++ toggleCopyStreamIdsInternal(filePath, filteredStreams);+ }, [enabledStreamsFilter, filePath, filterEnabledStreams, toggleCopyStreamIdsInternal]);++ const changeEnabledStreamsFilter = useCallback(async () => {+ invariant(filePath != null);++ const isEmpty = (v: string) => v.trim().length === 0;++ const expr = await filterEnabledStreamsDialog({+ validator: async (v: string) => {+ try {+ if (isEmpty(v)) return undefined;+ const streams = await filterEnabledStreams(v);+ if (streams.length === 0) return i18n.t('No tracks match this expression.');+ return undefined;+ } catch (err) {+ if (err instanceof Error) {+ return i18n.t('Expression failed: {{errorMessage}}', { errorMessage: err.message });+ }+ throw err;+ }+ },+ value: enabledStreamsFilter,});- }, [checkCopyingAnyTrackOfType, filePath, mainStreams, setCopyStreamIdsForPath]);- const toggleStripAudio = useCallback(() => toggleStripStream((stream) => stream.codec_type === 'audio'), [toggleStripStream]);- const toggleStripThumbnail = useCallback(() => toggleStripStream(isStreamThumbnail), [toggleStripStream]);+ if (expr == null) return;++ if (isEmpty(expr)) {+ setEnabledStreamsFilter(undefined);+ return;+ }++ setEnabledStreamsFilter(expr);++ await applyEnabledStreamsFilter(expr);+ }, [applyEnabledStreamsFilter, enabledStreamsFilter, filePath, filterEnabledStreams]);- const copyAnyAudioTrack = useMemo(() => checkCopyingAnyTrackOfType((stream) => stream.codec_type === 'audio'), [checkCopyingAnyTrackOfType]);+ const toggleStripCodecType = useCallback((codecType: FFprobeStream['codec_type']) => toggleCopyStreamIds(filePath!, (stream) => stream.codec_type === codecType), [filePath, toggleCopyStreamIds]);+ const toggleStripAudio = useCallback(() => toggleStripCodecType('audio'), [toggleStripCodecType]);+ const toggleStripVideo = useCallback(() => toggleStripCodecType('video'), [toggleStripCodecType]);+ const toggleStripSubtitle = useCallback(() => toggleStripCodecType('subtitle'), [toggleStripCodecType]);+ const toggleStripThumbnail = useCallback(() => toggleCopyStreamIds(filePath!, isStreamThumbnail), [filePath, toggleCopyStreamIds]);+ const toggleCopyAllStreamsForPath = useCallback((path: string) => toggleCopyStreamIds(path, () => true), [toggleCopyStreamIds]);+ const toggleStripAll = useCallback(() => toggleCopyAllStreamsForPath(filePath!), [filePath, toggleCopyAllStreamsForPath]);const toggleCopyStreamId = useCallback((path: string, index: number) => {setCopyStreamIdsForPath(path, (old) => ({ ...old, [index]: !old[index] }));}, [setCopyStreamIdsForPath]);- return { nonCopiedExtraStreams, exportExtraStreams, mainCopiedThumbnailStreams, numStreamsToCopy, toggleStripAudio, toggleStripThumbnail, copyAnyAudioTrack, copyStreamIdsByFile, setCopyStreamIdsByFile, copyFileStreams, mainCopiedStreams, setCopyStreamIdsForPath, toggleCopyStreamId, isCopyingStreamId };+ return { nonCopiedExtraStreams, exportExtraStreams, mainCopiedThumbnailStreams, numStreamsToCopy, toggleStripAudio, toggleStripVideo, toggleStripSubtitle, toggleStripThumbnail, toggleStripAll, copyStreamIdsByFile, setCopyStreamIdsByFile, copyFileStreams, mainCopiedStreams, setCopyStreamIdsForPath, toggleCopyStreamId, isCopyingStreamId, toggleCopyStreamIds, changeEnabledStreamsFilter, applyEnabledStreamsFilter, enabledStreamsFilter, toggleCopyAllStreamsForPath };};diff --git a/src/renderer/src/hooks/useUserSettingsRoot.ts b/src/renderer/src/hooks/useUserSettingsRoot.tsindex 764168dd..bc0069c3 100644--- a/src/renderer/src/hooks/useUserSettingsRoot.ts+++ b/src/renderer/src/hooks/useUserSettingsRoot.ts@@ -183,6 +183,8 @@ export default () => {};}, []);+ const toggleDarkMode = useCallback(() => setDarkMode((v) => !v), []);+return {captureFormat,setCaptureFormat,@@ -300,7 +302,7 @@ export default () => {allowMultipleInstances,setAllowMultipleInstances,darkMode,- setDarkMode,+ toggleDarkMode,preferStrongColors,setPreferStrongColors,outputFileNameMinZeroPadding,diff --git a/src/renderer/src/main.css b/src/renderer/src/main.cssindex 11951813..70abe02d 100644--- a/src/renderer/src/main.css+++ b/src/renderer/src/main.css@@ -108,3 +108,8 @@ code.highlighted {.link-button:focus {outline: revert;}++input:focus-visible, select:focus-visible {+ outline: 0.1em solid var(--gray-11);+ outline-offset: 0;+}diff --git a/src/renderer/src/swal2.scss b/src/renderer/src/swal2.scssindex 7772cd9d..f3fae09c 100644--- a/src/renderer/src/swal2.scss+++ b/src/renderer/src/swal2.scss@@ -1,17 +1,22 @@-$swal2-outline-color: rgba(100, 150, 200, 0.5) !default;+$swal2-outline-color: var(--gray-5) !default;// see colors.ts primaryColor$swal2-confirm-button-background-color: var(--cyan-9);$myswal-background: var(--gray-1);$myswal-foreground: var(--gray-12);-$swal2-outline-color: lighten($swal2-outline-color, 10%);+$swal2-outline-color: $swal2-outline-color;+$swal2-border: .1em solid $swal2-outline-color;$swal2-background: $myswal-background;$swal2-html-container-color: $myswal-foreground;$swal2-title-color: $myswal-foreground;$swal2-backdrop: rgba(0, 0, 0, .75);+// TOAST+$swal2-toast-background: $myswal-background;+$swal2-toast-button-focus-box-shadow: 0 0 0 1px $swal2-background, 0 0 0 3px $swal2-outline-color;+$swal2-close-button-color: var(--gray-11);// FOOTER@@ -35,10 +40,6 @@ $swal2-progress-step-background: var(--gray-5);// COMMON VARIABLES FOR CONFIRM AND CANCEL BUTTONS$swal2-button-focus-box-shadow: 0 0 0 1px $swal2-background, 0 0 0 3px $swal2-outline-color;-// TOAST-$swal2-toast-background: $myswal-background;-$swal2-toast-button-focus-box-shadow: 0 0 0 1px $swal2-background, 0 0 0 3px $swal2-outline-color;-.swal2-textarea::placeholder {color: var(--gray-8);}diff --git a/types.ts b/types.tsindex 272e06e2..b0fdd34a 100644--- a/types.ts+++ b/types.ts@@ -1,4 +1,4 @@-export type KeyboardAction = 'addSegment' | 'togglePlayResetSpeed' | 'togglePlayNoResetSpeed' | 'reducePlaybackRate' | 'reducePlaybackRateMore' | 'increasePlaybackRate' | 'increasePlaybackRateMore' | 'timelineToggleComfortZoom' | 'seekPreviousFrame' | 'seekNextFrame' | 'captureSnapshot' | 'setCutStart' | 'setCutEnd' | 'removeCurrentSegment' | 'removeCurrentCutpoint' | 'cleanupFilesDialog' | 'splitCurrentSegment' | 'focusSegmentAtCursor' | 'selectSegmentsAtCursor' | 'increaseRotation' | 'goToTimecode' | 'seekBackwards' | 'seekBackwards2' | 'seekBackwards3' | 'seekBackwardsPercent' | 'seekBackwardsPercent' | 'seekBackwardsKeyframe' | 'jumpCutStart' | 'seekForwards' | 'seekForwards2' | 'seekForwards3' | 'seekForwardsPercent' | 'seekForwardsPercent' | 'seekForwardsKeyframe' | 'jumpCutEnd' | 'jumpTimelineStart' | 'jumpTimelineEnd' | 'jumpFirstSegment' | 'jumpPrevSegment' | 'jumpSeekFirstSegment' | 'jumpSeekPrevSegment' | 'timelineZoomIn' | 'timelineZoomIn' | 'batchPreviousFile' | 'jumpLastSegment' | 'jumpNextSegment' | 'jumpSeekLastSegment' | 'jumpSeekNextSegment' | 'timelineZoomOut' | 'timelineZoomOut' | 'batchNextFile' | 'batchOpenSelectedFile' | 'batchOpenPreviousFile' | 'batchOpenNextFile' | 'undo' | 'undo' | 'redo' | 'redo' | 'copySegmentsToClipboard' | 'copySegmentsToClipboard' | 'toggleFullscreenVideo' | 'labelCurrentSegment' | 'export' | 'toggleKeyboardShortcuts' | 'closeActiveScreen' | 'increaseVolume' | 'decreaseVolume' | 'toggleMuted' | 'detectBlackScenes' | 'detectSilentScenes' | 'detectSceneChanges' | 'toggleLastCommands' | 'play' | 'pause' | 'reloadFile' | 'html5ify' | 'togglePlayOnlyCurrentSegment' | 'toggleLoopOnlyCurrentSegment' | 'toggleLoopStartEndOnlyCurrentSegment' | 'toggleLoopSelectedSegments' | 'editCurrentSegmentTags' | 'duplicateCurrentSegment' | 'reorderSegsByStartTime' | 'invertAllSegments' | 'fillSegmentsGaps' | 'shiftAllSegmentTimes' | 'alignSegmentTimesToKeyframes' | 'createSegmentsFromKeyframes' | 'createFixedDurationSegments' | 'createNumSegments' | 'createFixedByteSizedSegments' | 'createRandomSegments' | 'shuffleSegments' | 'combineOverlappingSegments' | 'combineSelectedSegments' | 'clearSegments' | 'toggleSegmentsList' | 'selectOnlyCurrentSegment' | 'deselectAllSegments' | 'selectAllSegments' | 'toggleCurrentSegmentSelected' | 'invertSelectedSegments' | 'removeSelectedSegments' | 'toggleStreamsSelector' | 'extractAllStreams' | 'showStreamsSelector' | 'showIncludeExternalStreamsDialog' | 'captureSnapshotAsCoverArt' | 'extractCurrentSegmentFramesAsImages' | 'extractSelectedSegmentsFramesAsImages' | 'convertFormatBatch' | 'convertFormatCurrentFile' | 'fixInvalidDuration' | 'closeBatch' | 'concatBatch' | 'toggleKeyframeCutMode' | 'toggleCaptureFormat' | 'toggleStripAudio' | 'toggleStripThumbnail' | 'setStartTimeOffset' | 'toggleWaveformMode' | 'toggleShowThumbnails' | 'toggleShowKeyframes' | 'toggleSettings' | 'openSendReportDialog' | 'openFilesDialog' | 'openDirDialog' | 'exportYouTube' | 'closeCurrentFile' | 'quit' | 'selectAllMarkers';+export type KeyboardAction = 'addSegment' | 'togglePlayResetSpeed' | 'togglePlayNoResetSpeed' | 'reducePlaybackRate' | 'reducePlaybackRateMore' | 'increasePlaybackRate' | 'increasePlaybackRateMore' | 'timelineToggleComfortZoom' | 'seekPreviousFrame' | 'seekNextFrame' | 'captureSnapshot' | 'setCutStart' | 'setCutEnd' | 'removeCurrentSegment' | 'removeCurrentCutpoint' | 'cleanupFilesDialog' | 'splitCurrentSegment' | 'focusSegmentAtCursor' | 'selectSegmentsAtCursor' | 'increaseRotation' | 'goToTimecode' | 'seekBackwards' | 'seekBackwards2' | 'seekBackwards3' | 'seekBackwardsPercent' | 'seekBackwardsPercent' | 'seekBackwardsKeyframe' | 'jumpCutStart' | 'seekForwards' | 'seekForwards2' | 'seekForwards3' | 'seekForwardsPercent' | 'seekForwardsPercent' | 'seekForwardsKeyframe' | 'jumpCutEnd' | 'jumpTimelineStart' | 'jumpTimelineEnd' | 'jumpFirstSegment' | 'jumpPrevSegment' | 'jumpSeekFirstSegment' | 'jumpSeekPrevSegment' | 'timelineZoomIn' | 'timelineZoomIn' | 'batchPreviousFile' | 'jumpLastSegment' | 'jumpNextSegment' | 'jumpSeekLastSegment' | 'jumpSeekNextSegment' | 'timelineZoomOut' | 'timelineZoomOut' | 'batchNextFile' | 'batchOpenSelectedFile' | 'batchOpenPreviousFile' | 'batchOpenNextFile' | 'undo' | 'undo' | 'redo' | 'redo' | 'copySegmentsToClipboard' | 'copySegmentsToClipboard' | 'toggleFullscreenVideo' | 'labelCurrentSegment' | 'export' | 'toggleKeyboardShortcuts' | 'closeActiveScreen' | 'increaseVolume' | 'decreaseVolume' | 'toggleMuted' | 'detectBlackScenes' | 'detectSilentScenes' | 'detectSceneChanges' | 'toggleLastCommands' | 'play' | 'pause' | 'reloadFile' | 'html5ify' | 'togglePlayOnlyCurrentSegment' | 'toggleLoopOnlyCurrentSegment' | 'toggleLoopStartEndOnlyCurrentSegment' | 'toggleLoopSelectedSegments' | 'editCurrentSegmentTags' | 'duplicateCurrentSegment' | 'reorderSegsByStartTime' | 'invertAllSegments' | 'fillSegmentsGaps' | 'shiftAllSegmentTimes' | 'alignSegmentTimesToKeyframes' | 'createSegmentsFromKeyframes' | 'createFixedDurationSegments' | 'createNumSegments' | 'createFixedByteSizedSegments' | 'createRandomSegments' | 'shuffleSegments' | 'combineOverlappingSegments' | 'combineSelectedSegments' | 'clearSegments' | 'toggleSegmentsList' | 'selectOnlyCurrentSegment' | 'deselectAllSegments' | 'selectAllSegments' | 'toggleCurrentSegmentSelected' | 'invertSelectedSegments' | 'removeSelectedSegments' | 'toggleStreamsSelector' | 'extractAllStreams' | 'showStreamsSelector' | 'showIncludeExternalStreamsDialog' | 'captureSnapshotAsCoverArt' | 'extractCurrentSegmentFramesAsImages' | 'extractSelectedSegmentsFramesAsImages' | 'convertFormatBatch' | 'convertFormatCurrentFile' | 'fixInvalidDuration' | 'closeBatch' | 'concatBatch' | 'toggleKeyframeCutMode' | 'toggleCaptureFormat' | 'toggleStripAudio' | 'toggleStripVideo' | 'toggleStripSubtitle' | 'toggleStripThumbnail' | 'toggleStripCurrentFilter' | 'toggleStripAll' | 'toggleDarkMode' | 'setStartTimeOffset' | 'toggleWaveformMode' | 'toggleShowThumbnails' | 'toggleShowKeyframes' | 'toggleSettings' | 'openSendReportDialog' | 'openFilesDialog' | 'openDirDialog' | 'exportYouTube' | 'closeCurrentFile' | 'quit' | 'selectAllMarkers';export interface KeyBinding {keys: string,