The swiss army knife of lossless video/audio editing
add title to dialogs #1954
Mikael Finstad625b696a4800
diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsxindex 6ad384fc..4d69b34e 100644--- a/src/renderer/src/App.tsx+++ b/src/renderer/src/App.tsx@@ -86,7 +86,7 @@ import { rightBarWidth, leftBarWidth, ffmpegExtractWindow, zoomMax } from './utiimport BigWaveform from './components/BigWaveform';import isDev from './isDev';-import { Chapter, ChromiumHTMLVideoElement, CustomTagsByFile, EdlFileType, FfmpegCommandLog, FilesMeta, FormatTimecode, ParamsByStreamId, ParseTimecode, PlaybackMode, SegmentColorIndex, SegmentTags, SegmentToExport, StateSegment, Thumbnail, TunerType } from './types';+import { Chapter, ChromiumHTMLVideoElement, CustomTagsByFile, EdlExportType, EdlFileType, EdlImportType, FfmpegCommandLog, FilesMeta, FormatTimecode, ParamsByStreamId, ParseTimecode, PlaybackMode, SegmentColorIndex, SegmentTags, SegmentToExport, StateSegment, Thumbnail, TunerType } from './types';import { CaptureFormat, KeyboardAction, Html5ifyMode, WaveformMode } from '../../../types';import { FFprobeChapter, FFprobeFormat, FFprobeStream } from '../../../ffprobe';@@ -2055,14 +2055,14 @@ function App() {const showIncludeExternalStreamsDialog = useCallback(async () => {try {- const { canceled, filePaths } = await showOpenDialog({ properties: ['openFile'] });+ const { canceled, filePaths } = await showOpenDialog({ properties: ['openFile'], title: t('Include more tracks from other file') });const [firstFilePath] = filePaths;if (canceled || firstFilePath == null) return;await addStreamSourceFile(firstFilePath);} catch (err) {handleError(err);}- }, [addStreamSourceFile]);+ }, [addStreamSourceFile, t]);const toggleFullscreenVideo = useCallback(async () => {if (!screenfull.isEnabled) {@@ -2372,7 +2372,7 @@ function App() {const onVideoClick = useCallback(() => togglePlay(), [togglePlay]);useEffect(() => {- async function tryExportEdlFile(type) {+ async function tryExportEdlFile(type: EdlExportType) {if (!checkFileOpened()) return;try {await exportEdlFile({ type, cutSegments: selectedSegments, customOutDir, filePath, getFrameCount });@@ -2382,7 +2382,7 @@ function App() {}}- async function importEdlFile(type) {+ async function importEdlFile(type: EdlImportType) {if (!checkFileOpened()) return;try {diff --git a/src/renderer/src/dialogs/index.tsx b/src/renderer/src/dialogs/index.tsxindex 165b8bbf..73c9db11 100644--- a/src/renderer/src/dialogs/index.tsx+++ b/src/renderer/src/dialogs/index.tsx@@ -46,9 +46,11 @@ export async function promptTimeOffset({ initialValue, title, text, inputPlaceho// https://github.com/mifi/lossless-cut/issues/1495export const showOpenDialog = async ({filters = isWindows ? [{ name: i18n.t('All Files'), extensions: ['*'] }] : undefined,+ title,...props- // @ts-expect-error todo-}: Parameters<typeof dialog.showOpenDialog>[0]) => dialog.showOpenDialog({ ...props, filters });+}: Omit<Parameters<typeof dialog.showOpenDialog>[0], 'title'> & { title: string }) => (+ dialog.showOpenDialog({ ...props, title, ...(filters != null ? { filters } : {}) })+);export async function askForYouTubeInput() {const example = i18n.t('YouTube video description\n00:00 Intro\n00:01 Chapter 2\n00:00:02.123 Chapter 3');diff --git a/src/renderer/src/edlStore.ts b/src/renderer/src/edlStore.tsindex 25a162b1..a57f017e 100644--- a/src/renderer/src/edlStore.ts+++ b/src/renderer/src/edlStore.ts@@ -131,7 +131,7 @@ export async function askForEdlImport({ type, fps }: { type: EdlImportType, fps?else if (type === 'srt') filters = [{ name: i18n.t('Subtitles (SRT)'), extensions: ['srt'] }];else if (type === 'llc') filters = [{ name: i18n.t('LosslessCut project'), extensions: ['llc'] }];- const { canceled, filePaths } = await showOpenDialog({ properties: ['openFile'], filters });+ const { canceled, filePaths } = await showOpenDialog({ properties: ['openFile'], filters, title: i18n.t('Import project') });const [firstFilePath] = filePaths;if (canceled || firstFilePath == null) return [];return readEdlFile({ type, path: firstFilePath, fps });@@ -167,7 +167,7 @@ export async function exportEdlFile({ type, cutSegments, customOutDir, filePath,const defaultPath = getOutPath({ filePath, customOutDir, fileName: `${basename(filePath)}.${ext}` });- const { canceled, filePath: savePath } = await dialog.showSaveDialog({ defaultPath, ...(filters != null ? { filters } : {}) });+ const { canceled, filePath: savePath } = await dialog.showSaveDialog({ defaultPath, title: i18n.t('Export project'), ...(filters != null ? { filters } : {}) });if (canceled || !savePath) return;console.log('Saving', type, savePath);// eslint-disable-next-line unicorn/prefer-switch