The swiss army knife of lossless video/audio editing
show title in open dialog
Mikael Finstad88fbcc0129f3
diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsxindex 5a470d5d..e4bb11c2 100644--- a/src/renderer/src/App.tsx+++ b/src/renderer/src/App.tsx@@ -107,6 +107,8 @@ hevcPlaybackSupportedPromise.catch((err) => console.error(err));function App() {+ const { t } = useTranslation();+// Per project stateconst [commandedTime, setCommandedTime] = useState(0);const [ffmpegCommandLog, setFfmpegCommandLog] = useState<FfmpegCommandLog>([]);@@ -730,7 +732,7 @@ function App() {// Cleanup removed thumbnailsuseEffect(() => {thumnailsRef.current.forEach((thumbnail) => {- if (!thumbnails.some((t) => t.url === thumbnail.url)) URL.revokeObjectURL(thumbnail.url);+ if (!thumbnails.some((nextThumbnail) => nextThumbnail.url === thumbnail.url)) URL.revokeObjectURL(thumbnail.url);});thumnailsRef.current = thumbnails;}, [thumbnails]);@@ -739,7 +741,7 @@ function App() {const subtitlesByStreamIdRef = useRef({});useEffect(() => {Object.values(thumnailsRef.current).forEach(({ url }) => {- if (!Object.values(subtitlesByStreamId).some((t) => t.url === url)) URL.revokeObjectURL(url);+ if (!Object.values(subtitlesByStreamId).some((existingThumbnail) => existingThumbnail.url === url)) URL.revokeObjectURL(url);});subtitlesByStreamIdRef.current = subtitlesByStreamId;}, [subtitlesByStreamId]);@@ -1992,10 +1994,10 @@ function App() {}, [alwaysConcatMultipleFiles, batchLoadPaths, setWorking, isFileOpened, batchFiles.length, userOpenSingleFile, checkFileOpened, loadEdlFile, enableAskForFileOpenAction, addStreamSourceFile, filePath]);const openFilesDialog = useCallback(async () => {- const { canceled, filePaths } = await showOpenDialog({ properties: ['openFile', 'openDirectory', 'multiSelections'], defaultPath: lastOpenedPathRef.current });+ const { canceled, filePaths } = await showOpenDialog({ properties: ['openFile', 'openDirectory', 'multiSelections'], defaultPath: lastOpenedPathRef.current!, title: t('Open file') });if (canceled) return;userOpenFiles(filePaths);- }, [userOpenFiles]);+ }, [t, userOpenFiles]);const concatBatch = useCallback(() => {if (batchFiles.length < 2) {@@ -2455,8 +2457,6 @@ function App() {const thumbnailsSorted = useMemo(() => sortBy(thumbnails, (thumbnail) => thumbnail.time), [thumbnails]);- const { t } = useTranslation();-function renderSubtitles() {if (!activeSubtitle) return null;return <track default kind="subtitles" label={activeSubtitle.lang} srcLang="en" src={activeSubtitle.url} />;diff --git a/src/renderer/src/dialogs/index.tsx b/src/renderer/src/dialogs/index.tsxindex 3c7c01a9..a6a631eb 100644--- a/src/renderer/src/dialogs/index.tsx+++ b/src/renderer/src/dialogs/index.tsx@@ -46,7 +46,7 @@ export const showOpenDialog = async ({filters = isWindows ? [{ name: i18n.t('All Files'), extensions: ['*'] }] : undefined,...props// @ts-expect-error todo-}) => dialog.showOpenDialog({ ...props, filters });+}: Parameters<typeof dialog.showOpenDialog>[0]) => dialog.showOpenDialog({ ...props, 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');@@ -73,7 +73,7 @@ export async function askForYouTubeInput() {export async function askForInputDir(defaultPath?: string | undefined) {const { filePaths } = await showOpenDialog({properties: ['openDirectory', 'createDirectory'],- defaultPath,+ defaultPath: defaultPath!,title: i18n.t('Please confirm folder'),message: i18n.t('Press confirm to grant LosslessCut access to write the project file (due to App Sandbox restrictions).'),buttonLabel: i18n.t('Confirm'),@@ -84,7 +84,7 @@ export async function askForInputDir(defaultPath?: string | undefined) {export async function askForOutDir(defaultPath?: string | undefined) {const { filePaths } = await showOpenDialog({properties: ['openDirectory', 'createDirectory'],- defaultPath,+ defaultPath: defaultPath!,title: i18n.t('Where do you want to save output files?'),message: i18n.t('Where do you want to save output files? Make sure there is enough free space in this folder'),buttonLabel: i18n.t('Select output folder'),@@ -95,7 +95,7 @@ export async function askForOutDir(defaultPath?: string | undefined) {export async function askForFfPath(defaultPath?: string | undefined) {const { filePaths } = await showOpenDialog({properties: ['openDirectory'],- defaultPath,+ defaultPath: defaultPath!,title: i18n.t('Select custom FFmpeg directory'),});return (filePaths && filePaths.length === 1) ? filePaths[0] : undefined;