From eda009274ebf63198cb4d0255fd4dfa3405080f7 Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Fri, 22 Dec 2023 14:20:40 +0800 Subject: [PATCH] add shortcut - Include more tracks from other file --- src/App.jsx | 26 ++++++++++++++------------ src/components/KeyboardShortcuts.jsx | 4 ++++ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index e7d00a4c..79ade467 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1899,6 +1899,17 @@ const App = memo(() => { electron.clipboard.writeText(await formatTsv(selectedSegments)); }, [isFileOpened, selectedSegments]); + const showIncludeExternalStreamsDialog = useCallback(async () => { + try { + const { canceled, filePaths } = await showOpenDialog({ properties: ['openFile'] }); + if (canceled || filePaths.length < 1) return; + await addStreamSourceFile(filePaths[0]); + } catch (err) { + handleError(err); + } + }, [addStreamSourceFile]); + + const mainActions = useMemo(() => { async function exportYouTube() { if (!checkFileOpened()) return; @@ -2027,8 +2038,9 @@ const App = memo(() => { toggleWaveformMode, toggleShowThumbnails, toggleShowKeyframes, + showIncludeExternalStreamsDialog, }; - }, [addSegment, alignSegmentTimesToKeyframes, apparentCutSegments, askStartTimeOffset, batchFileJump, batchOpenSelectedFile, captureSnapshot, captureSnapshotAsCoverArt, changePlaybackRate, checkFileOpened, cleanupFilesDialog, clearSegments, closeBatch, closeFileWithConfirm, combineOverlappingSegments, combineSelectedSegments, concatBatch, convertFormatBatch, copySegmentsToClipboard, createFixedDurationSegments, createNumSegments, createRandomSegments, createSegmentsFromKeyframes, currentSegIndexSafe, cutSegmentsHistory, deselectAllSegments, detectBlackScenes, detectSceneChanges, detectSilentScenes, duplicateCurrentSegment, extractAllStreams, extractCurrentSegmentFramesAsImages, extractSelectedSegmentsFramesAsImages, fillSegmentsGaps, goToTimecode, handleShowStreamsSelectorClick, increaseRotation, invertAllSegments, invertSelectedSegments, jumpCutEnd, jumpCutStart, jumpSeg, jumpTimelineEnd, jumpTimelineStart, keyboardNormalSeekSpeed, keyboardSeekAccFactor, onExportPress, onLabelSegment, openFilesDialog, openSendReportDialogWithState, pause, play, removeCutSegment, removeSelectedSegments, reorderSegsByStartTime, seekClosestKeyframe, seekRel, seekRelPercent, selectAllSegments, selectOnlyCurrentSegment, setCutEnd, setCutStart, setPlaybackVolume, shiftAllSegmentTimes, shortStep, shuffleSegments, splitCurrentSegment, timelineToggleComfortZoom, toggleCaptureFormat, toggleCurrentSegmentSelected, toggleKeyboardShortcuts, toggleKeyframeCut, toggleShowKeyframes, toggleLastCommands, toggleLoopSelectedSegments, togglePlay, toggleSegmentsList, toggleSettings, toggleShowThumbnails, toggleStreamsSelector, toggleStripAudio, toggleWaveformMode, tryFixInvalidDuration, userHtml5ifyCurrentFile, zoomRel]); + }, [addSegment, alignSegmentTimesToKeyframes, apparentCutSegments, askStartTimeOffset, batchFileJump, batchOpenSelectedFile, captureSnapshot, captureSnapshotAsCoverArt, changePlaybackRate, checkFileOpened, cleanupFilesDialog, clearSegments, closeBatch, closeFileWithConfirm, combineOverlappingSegments, combineSelectedSegments, concatBatch, convertFormatBatch, copySegmentsToClipboard, createFixedDurationSegments, createNumSegments, createRandomSegments, createSegmentsFromKeyframes, currentSegIndexSafe, cutSegmentsHistory, deselectAllSegments, detectBlackScenes, detectSceneChanges, detectSilentScenes, duplicateCurrentSegment, extractAllStreams, extractCurrentSegmentFramesAsImages, extractSelectedSegmentsFramesAsImages, fillSegmentsGaps, goToTimecode, handleShowStreamsSelectorClick, increaseRotation, invertAllSegments, invertSelectedSegments, jumpCutEnd, jumpCutStart, jumpSeg, jumpTimelineEnd, jumpTimelineStart, keyboardNormalSeekSpeed, keyboardSeekAccFactor, onExportPress, onLabelSegment, openFilesDialog, openSendReportDialogWithState, pause, play, removeCutSegment, removeSelectedSegments, reorderSegsByStartTime, seekClosestKeyframe, seekRel, seekRelPercent, selectAllSegments, selectOnlyCurrentSegment, setCutEnd, setCutStart, setPlaybackVolume, shiftAllSegmentTimes, shortStep, showIncludeExternalStreamsDialog, shuffleSegments, splitCurrentSegment, timelineToggleComfortZoom, toggleCaptureFormat, toggleCurrentSegmentSelected, toggleKeyboardShortcuts, toggleKeyframeCut, toggleLastCommands, toggleLoopSelectedSegments, togglePlay, toggleSegmentsList, toggleSettings, toggleShowKeyframes, toggleShowThumbnails, toggleStreamsSelector, toggleStripAudio, toggleWaveformMode, tryFixInvalidDuration, userHtml5ifyCurrentFile, zoomRel]); const getKeyboardAction = useCallback((action) => mainActions[action], [mainActions]); @@ -2228,16 +2240,6 @@ const App = memo(() => { }; }, [checkFileOpened, customOutDir, detectedFps, filePath, getFrameCount, getKeyboardAction, loadCutSegments, mainActions, selectedSegments, userOpenFiles]); - const showAddStreamSourceDialog = useCallback(async () => { - try { - const { canceled, filePaths } = await showOpenDialog({ properties: ['openFile'] }); - if (canceled || filePaths.length < 1) return; - await addStreamSourceFile(filePaths[0]); - } catch (err) { - handleError(err); - } - }, [addStreamSourceFile]); - useEffect(() => { async function onDrop(ev) { ev.preventDefault(); @@ -2522,7 +2524,7 @@ const App = memo(() => { allFilesMeta={allFilesMeta} externalFilesMeta={externalFilesMeta} setExternalFilesMeta={setExternalFilesMeta} - showAddStreamSourceDialog={showAddStreamSourceDialog} + showAddStreamSourceDialog={showIncludeExternalStreamsDialog} mainFileStreams={mainStreams} isCopyingStreamId={isCopyingStreamId} toggleCopyStreamId={toggleCopyStreamId} diff --git a/src/components/KeyboardShortcuts.jsx b/src/components/KeyboardShortcuts.jsx index a44a9646..d3854d35 100644 --- a/src/components/KeyboardShortcuts.jsx +++ b/src/components/KeyboardShortcuts.jsx @@ -416,6 +416,10 @@ const KeyboardShortcuts = memo(({ name: t('Edit tracks / metadata tags'), category: streamsCategory, }, + showIncludeExternalStreamsDialog: { + name: t('Include more tracks from other file'), + category: streamsCategory, + }, // zoomOperationsCategory timelineZoomIn: {